crosslang/GolangLean
Maximus Gorog ed636a1aa2 Prove preservation theorem for TGC big-step semantics.
GolangLean/Core/Preservation.lean:

theorem preservation:
  HasType Γ e T -> HasTypeH ht h -> HasTypeEnv ht env Γ ->
  BigStep h env e v h' ->
    ∃ ht', HeapTy.extends ht ht' /\ HasTypeH ht' h' /\
            HasTypeV ht' v T /\ HasTypeEnv ht' env Γ

The standard big-step type-soundness result: well-typed terminating
programs produce well-typed values, with heap conformance preserved.
Proof is by induction on the big-step derivation, fourteen cases.

Supporting infrastructure:
  HeapTy.extends_push    - heap-typing extends across a push
  HasTypeH.push          - heap conformance preserved by push
  HasTypeH.setIfInBounds - heap conformance preserved by in-bounds update
  binop_apply_sound      - operator typing matches operator semantics

The closure case (appR) uses the mutual HasTypeV/HasTypeEnv weakening
lemmas from TypeSoundness to thread heap-typings across the three
sub-derivations. The assign case (assignR) uses the heap-update
lemma to preserve conformance. The if-cases collapse the cross-rule
(ifT vs ifF) ambiguity via Bool.noConfusion on the condition's IH.

Zero sorries / axioms / admits across the project. Full lake build clean.
2026-05-10 04:05:08 -06:00
..
Core Prove preservation theorem for TGC big-step semantics. 2026-05-10 04:05:08 -06:00
AST.lean Initial scaffold: Lean 4 reimplementation of Go. 2026-05-10 02:12:19 -06:00
BigStep.lean Initial scaffold: Lean 4 reimplementation of Go. 2026-05-10 02:12:19 -06:00
Builtins.lean Initial scaffold: Lean 4 reimplementation of Go. 2026-05-10 02:12:19 -06:00
Env.lean Initial scaffold: Lean 4 reimplementation of Go. 2026-05-10 02:12:19 -06:00
Error.lean Initial scaffold: Lean 4 reimplementation of Go. 2026-05-10 02:12:19 -06:00
Eval.lean Initial scaffold: Lean 4 reimplementation of Go. 2026-05-10 02:12:19 -06:00
Parser.lean Initial scaffold: Lean 4 reimplementation of Go. 2026-05-10 02:12:19 -06:00
PureEval.lean Initial scaffold: Lean 4 reimplementation of Go. 2026-05-10 02:12:19 -06:00
REPL.lean Initial scaffold: Lean 4 reimplementation of Go. 2026-05-10 02:12:19 -06:00
Scanner.lean Initial scaffold: Lean 4 reimplementation of Go. 2026-05-10 02:12:19 -06:00
Token.lean Initial scaffold: Lean 4 reimplementation of Go. 2026-05-10 02:12:19 -06:00
Value.lean Initial scaffold: Lean 4 reimplementation of Go. 2026-05-10 02:12:19 -06:00
ValueEquiv.lean Initial scaffold: Lean 4 reimplementation of Go. 2026-05-10 02:12:19 -06:00