Soundness of generation (Lemma S) #
Every ground substitution that solves the subtyping constraints of a draft types its read-back program at the instance of the draft's type, and the read-back program fills exactly the omitted affinities of the input. Each cast becomes one subsumption step.
theorem
Determinize.Proof.Frontend.generate_sound
(σ : Ground)
(e : Spec.Paper.Input)
(Γ : List Frontend.UType)
(n : ℕ)
(d : Frontend.Draft)
(n' : ℕ)
:
StateT.run (Frontend.generate Γ e) n = Except.ok (d, n') →
σ.Solves d.relations →
e.Matches (Frontend.Draft.program σ.affinities d) ∧ Spec.Paper.Typed (List.map σ.inst Γ) (Spec.Paper.interpret ↑(Frontend.Draft.program σ.affinities d)) (σ.inst d.ty)
Lemma S.