Ground substitutions for generation #
The drafts that generate produces have types over type variables and affinity variables. A
Ground substitution replaces all of them; Solves says that it satisfies every subtyping
constraint of a draft. Lemma S (Proof/Frontend/Soundness.lean) types the read-back program
under every solution, and Lemma C (Proof/Frontend/Completeness.lean) builds a solution from a
typed completion.
Generation draws fresh variables from a counter, so Lemma C extends a substitution on the
variables at or above the counter, and must know that this does not disturb what is already
established. Agree n σ σ' says that two substitutions agree on the variables below n, and
Robust n σ P that P holds for every substitution that agrees with σ below n.
The file also collects the monad lemmas for unfolding generate, and shows that the read-back
program is monotone in the affinities (program_le).
Unfolding generate #
Unfold one call of generate in a hypothesis (generate Γ e).run n = .ok (d, n') into the
successful runs of its steps.
Equations
- One or more equations did not get rendered due to their size.
Instances For
Unfold one call of generate in a goal (generate Γ e).run n = …, keeping site.
Equations
- Determinize.Proof.Frontend.tacticUnfold_generate = Lean.ParserDescr.node `Determinize.Proof.Frontend.tacticUnfold_generate 1024 (Lean.ParserDescr.nonReservedSymbol "unfold_generate" false)
Instances For
Ground substitutions #
A type for every type variable and an affinity for every affinity variable.
- types : ℕ → Spec.Paper.Ty
- affinities : Frontend.AffinityVar → Spec.Paper.Affinity
Instances For
Equations
Instances For
σ makes the first type of every relation a subtype of the second.
Instances For
Equations
- σ.setType i A = { types := Function.update σ.types i A, affinities := σ.affinities }
Instances For
Equations
- σ.setAffinity i m = { types := σ.types, affinities := Function.update σ.affinities (Determinize.Frontend.AffinityVar.generated i) m }
Instances For
σ and σ' agree on the type variables and generated affinity variables below n.
Equations
- One or more equations did not get rendered due to their size.
Instances For
Split the relations of a draft node into those of its children and casts, and instantiate the cast types.
Equations
- One or more equations did not get rendered due to their size.
Instances For
The read-back of a draft node.
Equations
- Determinize.Proof.Frontend.tacticRead_back = Lean.ParserDescr.node `Determinize.Proof.Frontend.tacticRead_back 1024 (Lean.ParserDescr.nonReservedSymbol "read_back" false)
Instances For
P holds for every substitution that agrees with σ below n.
Equations
- Determinize.Proof.Frontend.Robust n σ P = ∀ (σ' : Determinize.Proof.Frontend.Ground), Determinize.Proof.Frontend.Ground.Agree n σ σ' → P σ'
Instances For
The instances of a context are pointwise subtypes of Γ'.
Equations
Instances For
A variable of a context is found in the corresponding position.
Monotonicity of read-back #
Induction on drafts, with a hypothesis for every child of a node.
Read-back is monotone: larger affinities give a larger program.