Skip to content

[audit] test-coverage: 22/36 SupportedStmtFragment constructors lack concrete instantiation witnesses #1075

@Th0rgal

Description

@Th0rgal

Finding

The master preservation theorem compile_supported_stmt_fragments_semantics (TypedIRCompilerCorrectness.lean:4797) generically proves correctness for all 36 SupportedStmtFragment constructors. However, only 14 of 36 constructors have concrete contract-function instantiation witnesses (lines 4859–5369).

The 22 constructors without concrete witnesses are:

# Constructor Category
1–17 Pure literal, branching, storage read/write, return patterns Basic building blocks
18–22 Arithmetic rebinding patterns (addRebind, subRebind, mulRebind, divRebind, modRebind) Arithmetic
30 returnMappingCaller Mapping access

Constructors WITH witnesses (14)

Risk

The 22 untested constructors are generically proved correct, so there is no soundness gap. However, the lack of concrete witnesses means:

  1. No instantiation smoke test: if a constructor's hypotheses are accidentally unsatisfiable, no test would catch it.
  2. No downstream contract exercise: patterns like addRebind are presumably used via the macro but no contract exercises them in the witness list.

Recommendation

Add concrete instantiation witnesses for the 22 missing constructors, or document that they are covered transitively by the macro-generated contract witnesses (if that can be shown).

Discovered by automated audit (Priority 5: test coverage).

Metadata

Metadata

Assignees

No one assigned

    Labels

    auditAudit findings

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions