Aiur verified-compiler proof scaffolding#399
Open
arthurpaulino wants to merge 1 commit into
Open
Conversation
## Summary End-to-end Lean proof scaffolding for the Aiur compiler pipeline, landing `Aiur.Toplevel.compile_correct` modulo **16 named axioms** sitting next to the theorems they replace. Build is green, no `sorry`s, no warnings. ## Pipeline ``` Source.Toplevel ├── mkDecls → Source.Decls ├── checkAndSimplify → Typed.Decls ├── concretize → Concrete.Decls ├── lower → Bytecode + preNameMap └── deduplicate → Bytecode + remap ``` `compile_correct` composes three top-level lemmas: 1. `compile_progress_entry` (Progress) 2. `compile_preservation_entry` (Preservation) 3. `compile_correct_concRetFnFree_entry` (FnFree projection) ## Organization - `Ix/Aiur/Semantics/` — semantic predicates and evaluator definitions (`WellFormed`, `TypedEval`, `ConcreteEval`, `DrainInvariants`, `Relation`, etc.). Anything that defines what a program *means*. - `Ix/Aiur/Proofs/` — proof modules. Proof-internal predicates kept in self-contained contexts; cross-cutting predicates lifted into `Semantics/`. - Each remaining axiom lives in the file of its consumer theorem, declared at the dispatch site with a closure-plan docstring (file/line target, closure path, infrastructure to reuse, dependency notes, LoC estimate, risk factors). ## Cross-evaluator value bridging The cross-evaluator value bridge is carried by `ValueR` (in `Proofs/Simulation.lean`), routing concrete-eval ctors at polymorphic-mangled keys (e.g. `Option_U32.None`) to source ctors with no same-key preimage. The `TermBridge.app` constructor carries a name-map witness `(concretizeName g_src tArgs = g_conc ∨ same-key)`. ## Axioms (16) Each axiom is grouped by the file where it lives, with its consumer theorem. **`Proofs/LowerSoundControl.lean`** - `interp_preserves_ValueHasTyp` - `Function_body_preservation_succ_fuel` **`Proofs/ConcretizeSound/Layout.lean`** - `dataTypeFlatSize_bound_saturation_wf` **`Proofs/ConcretizeSound/SizeBound.lean`** - `Global.toString_init` - `dt.params` parser-shape invariant - `MonoShape` projection - `spine_transfer_aux` `.tuple` arm - `spine_transfer_aux` `.array` arm - `spine_transfer_aux` `.app` mono-hit arm - `mkParamSubst_some_implies_param` **`Proofs/CompilerProgress.lean`** - `body_compile_ok` - `function_compile_progress_entry` **`Proofs/StructCompatible.lean`** - `typFlatSize_eq_typSize_under_match_wf` (CLOSED — kept named) - `compile_ok_implies_struct_compatible_of_entry` **`Proofs/Simulation.lean`** - `step_R_preservation_applyGlobal` **`Proofs/CompilerCorrect.lean`** - `body_termBridge_at_function_key` ## Invariants 1. **Wiring discipline** — every theorem in `Ix/Aiur/Proofs/*.lean` (except `compile_correct`) is transitively reachable from `compile_correct`. Orphan-free. 2. **No body sorries** — every remaining work-unit is a named axiom with a sig + closure docstring sitting next to its consumer. 3. **Sig stability** — axiom signatures are locked; sig changes require explicit amendment documented in the axiom's docstring. ## Stats - ~59 files changed, ~64k insertions - 277 build jobs green - 0 sorries, 0 warnings - 16 axioms, each with closure docstring ## Test plan - [x] `lake build` green - [x] No `sorry` reachable from `compile_correct` - [x] No warnings - [x] Orphan check: every Proofs theorem reaches `compile_correct`
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Summary
End-to-end Lean proof scaffolding for the Aiur compiler pipeline, landing
Aiur.Toplevel.compile_correctmodulo 16 named axioms sitting next to the theorems they replace. Build is green, nosorrys, no warnings.Pipeline
compile_correctcomposes three top-level lemmas:compile_progress_entry(Progress)compile_preservation_entry(Preservation)compile_correct_concRetFnFree_entry(FnFree projection)Organization
Ix/Aiur/Semantics/— semantic predicates and evaluator definitions (WellFormed,TypedEval,ConcreteEval,DrainInvariants,Relation, etc.). Anything that defines what a program means.Ix/Aiur/Proofs/— proof modules. Proof-internal predicates kept in self-contained contexts; cross-cutting predicates lifted intoSemantics/.Cross-evaluator value bridging
The cross-evaluator value bridge is carried by
ValueR(inProofs/Simulation.lean), routing concrete-eval ctors at polymorphic-mangled keys (e.g.Option_U32.None) to source ctors with no same-key preimage. TheTermBridge.appconstructor carries a name-map witness(concretizeName g_src tArgs = g_conc ∨ same-key).Axioms (16)
Each axiom is grouped by the file where it lives, with its consumer theorem.
Proofs/LowerSoundControl.leaninterp_preserves_ValueHasTypFunction_body_preservation_succ_fuelProofs/ConcretizeSound/Layout.leandataTypeFlatSize_bound_saturation_wfProofs/ConcretizeSound/SizeBound.leanGlobal.toString_initdt.paramsparser-shape invariantMonoShapeprojectionspine_transfer_aux.tuplearmspine_transfer_aux.arrayarmspine_transfer_aux.appmono-hit armmkParamSubst_some_implies_paramProofs/CompilerProgress.leanbody_compile_okfunction_compile_progress_entryProofs/StructCompatible.leantypFlatSize_eq_typSize_under_match_wf(CLOSED — kept named)compile_ok_implies_struct_compatible_of_entryProofs/Simulation.leanstep_R_preservation_applyGlobalProofs/CompilerCorrect.leanbody_termBridge_at_function_keyInvariants
Ix/Aiur/Proofs/*.lean(exceptcompile_correct) is transitively reachable fromcompile_correct. Orphan-free.Stats
Test plan
lake buildgreensorryreachable fromcompile_correctcompile_correct