OAI/Computability/TypeSystem/Labelled.lean
133 declarations, 0 contain sorry, 0 declared as axioms
- inductive
OAI.PureTypeSystem.Labelled.Modeline 11 - inductive
OAI.PureTypeSystem.Labelled.Labelline 16 - def
OAI.PureTypeSystem.Labelled.Label.domainline 22 - def
OAI.PureTypeSystem.Labelled.Label.resultline 26 - inductive
OAI.PureTypeSystem.Labelled.Exprline 30 - abbrev
OAI.PureTypeSystem.Labelled.Expr.liftRenline 41 - def
OAI.PureTypeSystem.Labelled.Expr.renameline 43 - def
OAI.PureTypeSystem.Labelled.Expr.liftSubline 50 - def
OAI.PureTypeSystem.Labelled.Expr.substline 54 - def
OAI.PureTypeSystem.Labelled.Expr.singleline 61 - def
OAI.PureTypeSystem.Labelled.Expr.instantiateline 65 - def
OAI.PureTypeSystem.Labelled.Expr.eraseline 67 - theorem
OAI.PureTypeSystem.Labelled.Expr.rename_idline 74 - theorem
OAI.PureTypeSystem.Labelled.Expr.rename_compline 77 - theorem
OAI.PureTypeSystem.Labelled.Expr.subst_varline 82 - theorem
OAI.PureTypeSystem.Labelled.Expr.subst_renameline 86 - theorem
OAI.PureTypeSystem.Labelled.Expr.rename_substline 93 - theorem
OAI.PureTypeSystem.Labelled.Expr.subst_substline 102 - theorem
OAI.PureTypeSystem.Labelled.Expr.instantiate_renameline 111 - theorem
OAI.PureTypeSystem.Labelled.Expr.instantiate_substline 116 - theorem
OAI.PureTypeSystem.Labelled.Expr.erase_renameline 123 - theorem
OAI.PureTypeSystem.Labelled.Expr.erase_liftSubline 127 - theorem
OAI.PureTypeSystem.Labelled.Expr.erase_substline 131 - theorem
OAI.PureTypeSystem.Labelled.Expr.erase_instantiateline 135 - inductive
OAI.PureTypeSystem.Labelled.Betaline 142 - def
OAI.PureTypeSystem.Labelled.Convertsline 151 - abbrev
OAI.PureTypeSystem.Labelled.Reducesline 152 - theorem
OAI.PureTypeSystem.Labelled.Beta.renameline 157 - theorem
OAI.PureTypeSystem.Labelled.Beta.substline 169 - theorem
OAI.PureTypeSystem.Labelled.Beta.eraseline 181 - inductive
OAI.PureTypeSystem.Labelled.Parallelline 194 - theorem
OAI.PureTypeSystem.Labelled.Parallel.reflline 210 - theorem
OAI.PureTypeSystem.Labelled.Parallel.of_betaline 218 - theorem
OAI.PureTypeSystem.Labelled.Parallel.renameline 228 - theorem
OAI.PureTypeSystem.Labelled.Parallel.substline 240 - theorem
OAI.PureTypeSystem.Labelled.Parallel.instantiateline 258 - def
OAI.PureTypeSystem.Labelled.Expr.developline 273Source documentation
Complete development contracts only matching-labelled redexes.
def develop : Expr S → Expr S | var n => var n | sort s => sort s | app l (lam k A b) a => if l = k then (develop b).instantiate (develop a) else app l (lam k (develop A) (develop b)) (develop a) | app l f a => app l (develop f) (develop a) | lam l A b => lam l (develop A) (develop b) | pi l A B => pi l (develop A) (develop B) end Expr …Mentions: OAI.PureTypeSystem.Labelled.Expr, OAI.PureTypeSystem.Labelled.Expr.instantiate
- theorem
OAI.PureTypeSystem.Labelled.Parallel.triangleline 289 - theorem
OAI.PureTypeSystem.Labelled.Parallel.diamondline 313 - theorem
OAI.PureTypeSystem.Labelled.Reduces.appline 322 - theorem
OAI.PureTypeSystem.Labelled.Reduces.lamline 327 - theorem
OAI.PureTypeSystem.Labelled.Reduces.piline 332 - theorem
OAI.PureTypeSystem.Labelled.Reduces.renameline 337 - theorem
OAI.PureTypeSystem.Labelled.Reduces.substline 340 - theorem
OAI.PureTypeSystem.Labelled.Parallel.reducesline 349 - theorem
OAI.PureTypeSystem.Labelled.Parallel.rtc_reducesline 359 - theorem
OAI.PureTypeSystem.Labelled.Reduces.parallelline 368 - theorem
OAI.PureTypeSystem.Labelled.Reduces.confluentline 371 - theorem
OAI.PureTypeSystem.Labelled.Converts.joinline 387 - theorem
OAI.PureTypeSystem.Labelled.Reduces.pi_invline 406 - theorem
OAI.PureTypeSystem.Labelled.Reduces.convertsline 416 - theorem
OAI.PureTypeSystem.Labelled.Converts.product_compatibilityline 425 - inductive
OAI.PureTypeSystem.Labelled.HasTypeline 437 - inductive
OAI.PureTypeSystem.Labelled.ValidContextline 455 - theorem
OAI.PureTypeSystem.Labelled.HasType.validline 464 - theorem
OAI.PureTypeSystem.Labelled.Expr.liftSub_zeroline 478 - theorem
OAI.PureTypeSystem.Labelled.Expr.liftSub_succline 479 - inductive
OAI.PureTypeSystem.Labelled.Lookupline 483 - theorem
OAI.PureTypeSystem.Labelled.HasType.sort_of_validline 491 - theorem
OAI.PureTypeSystem.Labelled.HasType.product_domainline 499Source documentation
Domain generation alone precedes substitution and does not need any exchange or context-substitution theorem.
theorem product_domain {Γ : List (Expr S)} {M T : Expr S} (h : HasType P Γ M T) : ∀ l A B, M = .pi l A B → ∃ s, HasType P Γ A (.sort s) := by …Mentions: OAI.PureTypeSystem.Labelled.Expr, OAI.PureTypeSystem.Labelled.HasType
- theorem
OAI.PureTypeSystem.Labelled.Converts.substline 529 - theorem
OAI.PureTypeSystem.Labelled.Converts.renameline 537 - def
OAI.PureTypeSystem.Labelled.TypedSubstitutionline 549Source documentation
A simultaneous substitution respects each declared variable's exact type. This is a premise only of the substitution metatheorem, not of the main target.
def TypedSubstitution {S : Type u} (P : Specification S) (Γ Δ : List (Expr S)) (σ : Nat → Expr S) : Prop := …Mentions: OAI.PureTypeSystem.Specification, OAI.PureTypeSystem.Labelled.Expr
- theorem
OAI.PureTypeSystem.Labelled.TypedSubstitution.tailline 558 - theorem
OAI.PureTypeSystem.Labelled.TypedSubstitution.liftline 564 - theorem
OAI.PureTypeSystem.Labelled.HasType.substline 584 - theorem
OAI.PureTypeSystem.Labelled.Expr.subst_var_renameline 611 - theorem
OAI.PureTypeSystem.Labelled.Expr.subst_lift_singleline 615 - theorem
OAI.PureTypeSystem.Labelled.HasType.lookupline 626 - theorem
OAI.PureTypeSystem.Labelled.TypedSubstitution.identityline 641 - theorem
OAI.PureTypeSystem.Labelled.TypedSubstitution.weakenline 646 - theorem
OAI.PureTypeSystem.Labelled.TypedSubstitution.singleline 653 - theorem
OAI.PureTypeSystem.Labelled.HasType.renameline 667 - theorem
OAI.PureTypeSystem.Labelled.HasType.instantiateline 676 - theorem
OAI.PureTypeSystem.Labelled.HasType.weaken_underline 681 - theorem
OAI.PureTypeSystem.Labelled.HasType.context_head_conversionline 696 - def
OAI.PureTypeSystem.Labelled.Normalline 712 - theorem
OAI.PureTypeSystem.Labelled.Normal.reduces_eqline 720 - theorem
OAI.PureTypeSystem.Labelled.Normal.eq_of_convertsline 725 - theorem
OAI.PureTypeSystem.Labelled.Normal.varline 732 - theorem
OAI.PureTypeSystem.Labelled.Normal.sortline 733 - def
OAI.PureTypeSystem.Labelled.HasType.Generationline 741Source documentation
Generation is stated up to conversion, without any functionality premise.
def Generation (P : Specification S) (Γ : List (Expr S)) (M T : Expr S) : Prop := …Mentions: OAI.PureTypeSystem.Specification, OAI.PureTypeSystem.Labelled.Expr
- theorem
OAI.PureTypeSystem.Labelled.HasType.generationline 754 - theorem
OAI.PureTypeSystem.Labelled.HasType.generation_piline 801 - theorem
OAI.PureTypeSystem.Labelled.HasType.generation_lamline 807 - theorem
OAI.PureTypeSystem.Labelled.HasType.generation_appline 812 - theorem
OAI.PureTypeSystem.Labelled.HasType.regularityline 818Source documentation
Correctness of types, including the unsorted literal-sort alternative.
theorem regularity {Γ : List (Expr S)} {M A : Expr S} (h : HasType P Γ M A) : (∃ s, A = .sort s) ∨ (∃ s, HasType P Γ A (.sort s)) := by …Mentions: OAI.PureTypeSystem.Labelled.Expr, OAI.PureTypeSystem.Labelled.HasType
- theorem
OAI.PureTypeSystem.Labelled.HasType.product_type_sortedline 836 - theorem
OAI.PureTypeSystem.Labelled.Converts.piline 848 - theorem
OAI.PureTypeSystem.Labelled.Converts.pi_not_sortline 854 - theorem
OAI.PureTypeSystem.Labelled.Converts.sort_injline 861 - theorem
OAI.PureTypeSystem.Labelled.Converts.instantiate_rightline 864 - theorem
OAI.PureTypeSystem.Labelled.HasType.application_type_sorted_auxline 879 - theorem
OAI.PureTypeSystem.Labelled.HasType.application_type_sortedline 904 - theorem
OAI.PureTypeSystem.Labelled.HasType.abstraction_type_sortedline 908 - theorem
OAI.PureTypeSystem.Labelled.HasType.conversion_from_sortline 918Source documentation
Reconstructing a sorted expression at its original expected type does not require a sorting of a terminal (unsorted) sort.
theorem conversion_from_sort {Γ : List (Expr S)} {M T : Expr S} {s : S} (h : HasType P Γ M (.sort s)) (hT : (∃ t, T = .sort t) ∨ ∃ t, HasType P Γ T (.sort t)) (hc : Converts T (.sort s)) : HasType P Γ M T := by …Mentions: OAI.PureTypeSystem.Labelled.Expr, OAI.PureTypeSystem.Labelled.HasType, OAI.PureTypeSystem.Labelled.Converts
- theorem
OAI.PureTypeSystem.Labelled.HasType.subject_reductionline 929Source documentation
Subject reduction at the exact original type, including binder annotations.
theorem subject_reduction {Γ : List (Expr S)} {M N T : Expr S} (h : HasType P Γ M T) (hr : Beta M N) : HasType P Γ N T := by …Mentions: OAI.PureTypeSystem.Labelled.Expr, OAI.PureTypeSystem.Labelled.HasType, OAI.PureTypeSystem.Labelled.Beta
- theorem
OAI.PureTypeSystem.Labelled.HasType.subject_reducesline 975 - theorem
OAI.PureTypeSystem.Labelled.Converts.eraseline 985 - theorem
OAI.PureTypeSystem.Labelled.HasType.eraseline 995 - def
OAI.PureTypeSystem.Labelled.modeConsline 1012Source documentation
Modes are a separate syntax discipline on the labelled PTS. This keeps metatheory independent of mode well-formedness and proves preservation below.
def modeCons (m : Mode) (γ : Nat → Mode) : Nat → Mode | 0 => m | n+1 => γ n
Mentions: OAI.PureTypeSystem.Labelled.Mode
- inductive
OAI.PureTypeSystem.Labelled.WellModedline 1016 - theorem
OAI.PureTypeSystem.Labelled.WellModed.renameline 1028 - theorem
OAI.PureTypeSystem.Labelled.WellModed.substline 1042 - theorem
OAI.PureTypeSystem.Labelled.WellModed.instantiateline 1058 - theorem
OAI.PureTypeSystem.Labelled.WellModed.betaline 1067 - theorem
OAI.PureTypeSystem.Labelled.WellModed.reducesline 1080 - theorem
OAI.PureTypeSystem.Labelled.Expr.erase_lam_invline 1088 - theorem
OAI.PureTypeSystem.Labelled.erased_app_stepline 1101 - theorem
OAI.PureTypeSystem.Labelled.HasType.lift_erased_stepline 1116Source documentation
Every erased redex of a typable labelled term has matching labels, even inside its annotations. No weak or strong normalization is assumed.
theorem lift_erased_step (h : HasType P Γ M T) {N : PureTypeSystem.Expr S} (hr : PureTypeSystem.Beta M.erase N) : ∃ M', Beta M M' ∧ M'.erase = N := by …Mentions: OAI.PureTypeSystem.Labelled.HasType, OAI.PureTypeSystem.Expr, OAI.PureTypeSystem.Beta, OAI.PureTypeSystem.Labelled.Beta
- theorem
OAI.PureTypeSystem.Labelled.HasType.lift_erased_reducesline 1155 - theorem
OAI.PureTypeSystem.Labelled.HasType.normal_erasure_reductline 1166Source documentation
The exact final interface of the labelled-metatheory lemma.
theorem normal_erasure_reduct (h : HasType P Γ M T) {γ : Nat → Mode} {m : Mode} (hm : WellModed γ M m) (hw : PureTypeSystem.WeaklyNormalizing M.erase) : ∃ M', Reduces M M' ∧ HasType P Γ M' T ∧ WellModed γ M' m ∧ PureTypeSystem.Normal M'.erase := by …Mentions: OAI.PureTypeSystem.Labelled.HasType, OAI.PureTypeSystem.Labelled.Mode, OAI.PureTypeSystem.Labelled.WellModed, OAI.PureTypeSystem.WeaklyNormalizing, OAI.PureTypeSystem.Labelled.Reduces, OAI.PureTypeSystem.Normal
- def
OAI.PureTypeSystem.Labelled.Expr.weightline 1177 - inductive
OAI.PureTypeSystem.Labelled.Expr.AllDataline 1184Source documentation
A terminal contains data/data labels only.
inductive AllData : Expr S → Prop | var (n) : AllData (.var n) | sort (s) : AllData (.sort s) | app {f a} : AllData f → AllData a → AllData (.app .dd f a) | lam {A b} : AllData A → AllData b → AllData (.lam .dd A b) | pi {A B} : AllData A → AllData B → AllData (.pi .dd A B) namespace AllDataMentions: OAI.PureTypeSystem.Labelled.Expr
- theorem
OAI.PureTypeSystem.Labelled.Expr.AllData.renameline 1192 - inductive
OAI.PureTypeSystem.Labelled.Expr.Positiveline 1203Source documentation
A positive telescope ending in an all-data terminal. The source uses constant telescopes; the no-normal-proof argument also permits dependency.
inductive Positive : Expr S → Prop | terminal {T} : AllData T → Positive T | step (D) {E} : Positive E → Positive (.pi .dp D E) namespace PositiveMentions: OAI.PureTypeSystem.Labelled.Expr, OAI.PureTypeSystem.Labelled.Expr.AllData
- theorem
OAI.PureTypeSystem.Labelled.Expr.Positive.renameline 1208 - theorem
OAI.PureTypeSystem.Labelled.Expr.Positive.not_ppline 1213 - theorem
OAI.PureTypeSystem.Labelled.Expr.Positive.dp_bodyline 1218 - def
OAI.PureTypeSystem.Labelled.Expr.Targetline 1225Source documentation
The normal target family used in the no-normal-proof obstruction.
def Target (T : Expr S) : Prop := Positive T ∧ PureTypeSystem.Normal T.erase …
Mentions: OAI.PureTypeSystem.Labelled.Expr, OAI.PureTypeSystem.Labelled.Expr.Positive, OAI.PureTypeSystem.Normal
- theorem
OAI.PureTypeSystem.Labelled.Expr.Target.renameline 1228 - theorem
OAI.PureTypeSystem.Labelled.Expr.Target.normalline 1231 - theorem
OAI.PureTypeSystem.Labelled.Expr.Target.productline 1234 - inductive
OAI.PureTypeSystem.Labelled.Expr.Neutralline 1248 - theorem
OAI.PureTypeSystem.Labelled.WellModed.var_invline 1255 - theorem
OAI.PureTypeSystem.Labelled.WellModed.app_invline 1258 - theorem
OAI.PureTypeSystem.Labelled.WellModed.lam_invline 1262 - theorem
OAI.PureTypeSystem.Labelled.WellModed.normal_proof_shapeline 1267Source documentation
A normal-erasure proof has a lambda at the root or a variable-headed spine.
theorem normal_proof_shape {M : Expr S} (h : WellModed γ M .proof) (hn : PureTypeSystem.Normal M.erase) : (∃ l A b, M = .lam l A b) ∨ M.Neutral := by …Mentions: OAI.PureTypeSystem.Labelled.Expr, OAI.PureTypeSystem.Labelled.WellModed, OAI.PureTypeSystem.Normal
- def
OAI.PureTypeSystem.Labelled.ProofContextline 1286Source documentation
Only proof variables are constrained. Each is a proof/proof converter whose first argument is one of the positive normal targets. This includes exactly the context shape used by the source, and is stable under data extensions. No converter result is assumed inhabited.
def ProofContext {S : Type u} (Γ : List (Expr S)) (γ : Nat → Mode) : Prop := …Mentions: OAI.PureTypeSystem.Labelled.Expr, OAI.PureTypeSystem.Labelled.Mode
- theorem
OAI.PureTypeSystem.Labelled.ProofContext.data_consline 1292 - theorem
OAI.PureTypeSystem.Labelled.Expr.Neutral.first_targetline 1308Source documentation
The first argument of a normal proof-mode converter spine is itself a strictly smaller normal proof at a positive target.
theorem first_target (hM : M.Neutral) (h : HasType P Γ M T) (hm : WellModed γ M .proof) (hn : PureTypeSystem.Normal M.erase) (hΓ : ProofContext Γ γ) : (∃ n, M = .var n) ∨ ∃ Q R, Q.weight < M.weight ∧ R.Target ∧ HasType P Γ Q R ∧ WellModed γ Q .proof ∧ PureTypeSystem.Normal Q.erase := by …Mentions: OAI.PureTypeSystem.Labelled.HasType, OAI.PureTypeSystem.Labelled.WellModed, OAI.PureTypeSystem.Normal, OAI.PureTypeSystem.Labelled.ProofContext
- theorem
OAI.PureTypeSystem.Labelled.no_normal_proofline 1334Source documentation
No normal erasure at a terminal. The stronger form allows a dependent positive telescope: it uses only the outer labels, normality, typing and the decreasing body/first-argument syntax measure.
theorem no_normal_proof {S : Type u} {P : Specification S} {Γ : List (Expr S)} {γ : Nat → Mode} {M T : Expr S} (hΓ : ProofContext Γ γ) (hT : T.Target) (h : HasType P Γ M T) (hm : WellModed γ M .proof) (hn : PureTypeSystem.Normal M.erase) : False := by …Mentions: OAI.PureTypeSystem.Specification, OAI.PureTypeSystem.Labelled.Expr, OAI.PureTypeSystem.Labelled.Mode, OAI.PureTypeSystem.Labelled.ProofContext, OAI.PureTypeSystem.Labelled.HasType, OAI.PureTypeSystem.Labelled.WellModed, OAI.PureTypeSystem.Normal
- theorem
OAI.PureTypeSystem.Labelled.no_proof_at_targetline 1362Source documentation
A system-wide WN PTS has no proof-mode inhabitant of these targets in these converter contexts. All later encodings must supply a genuine typing and mode derivation to invoke this obstruction.
theorem no_proof_at_target {S : Type u} {P : Specification S} (hw : SystemWeaklyNormalizing P) {Γ : List (Expr S)} {γ : Nat → Mode} {M T : Expr S} (hΓ : ProofContext Γ γ) (hT : T.Target) (h : HasType P Γ M T) (hm : WellModed γ M .proof) : False := by …Mentions: OAI.PureTypeSystem.Specification, OAI.PureTypeSystem.SystemWeaklyNormalizing, OAI.PureTypeSystem.Labelled.Expr, OAI.PureTypeSystem.Labelled.Mode, OAI.PureTypeSystem.Labelled.ProofContext, OAI.PureTypeSystem.Labelled.HasType, OAI.PureTypeSystem.Labelled.WellModed