Operational semantics of the simply typed lambda calculus
InductiveValues of STLC#✓fully proved
A term of type \(A\) in a context \(\Gamma\) is a value exactly when it is a lambda abstraction.
inductive Value {Base : Type u} : {Γ : List (Ty Base)} → {A : Ty Base} → Tm Γ A → Prop where
| lam {A B : Ty Base} {Γ : List (Ty Base)} (body : Tm (A :: Γ) B) : Value (.lam body)
inductive Ty (Base : Type u) where
| base : Base → Ty Base
| arr : Ty Base → Ty Base → Ty Base
deriving DecidableEq, Repr
CSLibExt/Languages/LambdaCalculus/DeBruijn/Stlc/Syntax.lean:36
inductive Tm {Base : Type u} : List (Ty Base) → Ty Base → Type u where
| var {A : Ty Base} {Γ : List (Ty Base)} : Var Γ A → Tm Γ A
| app {A B : Ty Base} {Γ : List (Ty Base)} : Tm Γ (A ⇒ B) → Tm Γ A → Tm Γ B
| lam {A B : Ty Base} {Γ : List (Ty Base)} : Tm (A :: Γ) B → Tm Γ (A ⇒ B)
CSLibExt/Languages/LambdaCalculus/DeBruijn/Stlc/Syntax.lean:61
Uses 2 · Used by 42
InductiveSmall-step call-by-value reduction in STLC#✓fully proved
One-step reduction on terms of type \(A\) in a context \(\Gamma\) is the least relation closed under three left-to-right call-by-value rules: if \(f\) reduces to \(f'\), then the application \(f\,a\) reduces to \(f'\,a\); if \(f\) is a value and \(a\) reduces to \(a'\), then \(f\,a\) reduces to \(f\,a'\); and if \(a\) is a value, then the application of the abstraction of \(b\) to \(a\) reduces to \(b[a]\), the result of substituting \(a\) for the newest free variable of \(b\).
inductive Step {Base : Type u} : {Γ : List (Ty Base)} → {A : Ty Base} →
Tm Γ A → Tm Γ A → Prop where
| appFun {A B : Ty Base} {Γ : List (Ty Base)} {f f' : Tm Γ (A ⇒ B)} {a : Tm Γ A} :
Step f f' → Step (.app f a) (.app f' a)
| appArg {A B : Ty Base} {Γ : List (Ty Base)} {f : Tm Γ (A ⇒ B)} {a a' : Tm Γ A} :
Value f → Step a a' → Step (.app f a) (.app f a')
| beta {A B : Ty Base} {Γ : List (Ty Base)} {body : Tm (A :: Γ) B} {a : Tm Γ A} :
Value a → Step (.app (.lam body) a) (Tm.instantiate body a)
inductive Ty (Base : Type u) where
| base : Base → Ty Base
| arr : Ty Base → Ty Base → Ty Base
deriving DecidableEq, Repr
CSLibExt/Languages/LambdaCalculus/DeBruijn/Stlc/Syntax.lean:36
inductive Tm {Base : Type u} : List (Ty Base) → Ty Base → Type u where
| var {A : Ty Base} {Γ : List (Ty Base)} : Var Γ A → Tm Γ A
| app {A B : Ty Base} {Γ : List (Ty Base)} : Tm Γ (A ⇒ B) → Tm Γ A → Tm Γ B
| lam {A B : Ty Base} {Γ : List (Ty Base)} : Tm (A :: Γ) B → Tm Γ (A ⇒ B)
CSLibExt/Languages/LambdaCalculus/DeBruijn/Stlc/Syntax.lean:61
inductive Value {Base : Type u} : {Γ : List (Ty Base)} → {A : Ty Base} → Tm Γ A → Prop where
| lam {A B : Ty Base} {Γ : List (Ty Base)} (body : Tm (A :: Γ) B) : Value (.lam body)
CSLibExt/Languages/LambdaCalculus/DeBruijn/Stlc/Semantics.lean:39
def instantiate (body : Tm (A :: Γ) B) (a : Tm Γ A) : Tm Γ B :=
subst (Sub.single a) body
CSLibExt/Languages/LambdaCalculus/DeBruijn/Stlc/Substitution.lean:124
Uses 4 · Used by 21
TheoremValues are irreducible#✓fully proved
If a term \(t\) of type \(A\) in a context \(\Gamma\) is a value, then there is no term \(t'\) to which \(t\) reduces in one call-by-value step.
theorem value_irreducible {t t' : Tm Γ A} (hv : Value t) : ¬ t ⟶ₛ t'
inductive Tm {Base : Type u} : List (Ty Base) → Ty Base → Type u where
| var {A : Ty Base} {Γ : List (Ty Base)} : Var Γ A → Tm Γ A
| app {A B : Ty Base} {Γ : List (Ty Base)} : Tm Γ (A ⇒ B) → Tm Γ A → Tm Γ B
| lam {A B : Ty Base} {Γ : List (Ty Base)} : Tm (A :: Γ) B → Tm Γ (A ⇒ B)
CSLibExt/Languages/LambdaCalculus/DeBruijn/Stlc/Syntax.lean:61
inductive Value {Base : Type u} : {Γ : List (Ty Base)} → {A : Ty Base} → Tm Γ A → Prop where
| lam {A B : Ty Base} {Γ : List (Ty Base)} (body : Tm (A :: Γ) B) : Value (.lam body)
CSLibExt/Languages/LambdaCalculus/DeBruijn/Stlc/Semantics.lean:39
Uses 6 · Used by 4
TheoremCanonical forms for closed function values#✓fully proved
If a term \(f\) of function type \(A \Rightarrow B\) in the empty context is a value, then \(f\) is a lambda abstraction: there is a term \(b\) of type \(B\) in the one-variable context \([A]\) such that \(f\) is the abstraction of \(b\).
theorem closed_function_value_is_lam {f : Tm [] (A ⇒ B)} (hv : Value f) :
∃ body : Tm [A] B, f = .lam body
inductive Tm {Base : Type u} : List (Ty Base) → Ty Base → Type u where
| var {A : Ty Base} {Γ : List (Ty Base)} : Var Γ A → Tm Γ A
| app {A B : Ty Base} {Γ : List (Ty Base)} : Tm Γ (A ⇒ B) → Tm Γ A → Tm Γ B
| lam {A B : Ty Base} {Γ : List (Ty Base)} : Tm (A :: Γ) B → Tm Γ (A ⇒ B)
CSLibExt/Languages/LambdaCalculus/DeBruijn/Stlc/Syntax.lean:61
inductive Value {Base : Type u} : {Γ : List (Ty Base)} → {A : Ty Base} → Tm Γ A → Prop where
| lam {A B : Ty Base} {Γ : List (Ty Base)} (body : Tm (A :: Γ) B) : Value (.lam body)
CSLibExt/Languages/LambdaCalculus/DeBruijn/Stlc/Semantics.lean:39
Uses 3 · Used by 3
TheoremProgress for closed STLC terms#✓fully proved
Every term \(t\) of type \(A\) in the empty context is either a value or reduces in one call-by-value step to some term \(t'\).
theorem progress : {A : Ty Base} → (t : Tm [] A) → Value t ∨ ∃ t', t ⟶ₛ t'
inductive Ty (Base : Type u) where
| base : Base → Ty Base
| arr : Ty Base → Ty Base → Ty Base
deriving DecidableEq, Repr
CSLibExt/Languages/LambdaCalculus/DeBruijn/Stlc/Syntax.lean:36
inductive Tm {Base : Type u} : List (Ty Base) → Ty Base → Type u where
| var {A : Ty Base} {Γ : List (Ty Base)} : Var Γ A → Tm Γ A
| app {A B : Ty Base} {Γ : List (Ty Base)} : Tm Γ (A ⇒ B) → Tm Γ A → Tm Γ B
| lam {A B : Ty Base} {Γ : List (Ty Base)} : Tm (A :: Γ) B → Tm Γ (A ⇒ B)
CSLibExt/Languages/LambdaCalculus/DeBruijn/Stlc/Syntax.lean:61
inductive Value {Base : Type u} : {Γ : List (Ty Base)} → {A : Ty Base} → Tm Γ A → Prop where
| lam {A B : Ty Base} {Γ : List (Ty Base)} (body : Tm (A :: Γ) B) : Value (.lam body)
CSLibExt/Languages/LambdaCalculus/DeBruijn/Stlc/Semantics.lean:39
Uses 7 · Used by 1
TheoremSmall-step call-by-value reduction in STLC is deterministic#✓fully proved
For terms \(t\), \(t_1\), \(t_2\) of type \(A\) in a context \(\Gamma\), if \(t\) reduces in one call-by-value step both to \(t_1\) and to \(t_2\), then \(t_1 = t_2\).
theorem deterministic {t t₁ t₂ : Tm Γ A} (h₁ : t ⟶ₛ t₁) (h₂ : t ⟶ₛ t₂) : t₁ = t₂
inductive Tm {Base : Type u} : List (Ty Base) → Ty Base → Type u where
| var {A : Ty Base} {Γ : List (Ty Base)} : Var Γ A → Tm Γ A
| app {A B : Ty Base} {Γ : List (Ty Base)} : Tm Γ (A ⇒ B) → Tm Γ A → Tm Γ B
| lam {A B : Ty Base} {Γ : List (Ty Base)} : Tm (A :: Γ) B → Tm Γ (A ⇒ B)
CSLibExt/Languages/LambdaCalculus/DeBruijn/Stlc/Syntax.lean:61
Uses 7 · Used by 1
DefinitionNormal forms for call-by-value reduction in STLC#✓fully proved
A term \(t\) of type \(A\) in a context \(\Gamma\) is in normal form when there is no term \(t'\) such that \(t\) reduces to \(t'\) in one call-by-value step.
def NormalForm (t : Tm Γ A) : Prop := ∀ t', ¬t ⟶ₛ t'
inductive Tm {Base : Type u} : List (Ty Base) → Ty Base → Type u where
| var {A : Ty Base} {Γ : List (Ty Base)} : Var Γ A → Tm Γ A
| app {A B : Ty Base} {Γ : List (Ty Base)} : Tm Γ (A ⇒ B) → Tm Γ A → Tm Γ B
| lam {A B : Ty Base} {Γ : List (Ty Base)} : Tm (A :: Γ) B → Tm Γ (A ⇒ B)
CSLibExt/Languages/LambdaCalculus/DeBruijn/Stlc/Syntax.lean:61
Uses 3 · Used by 4
TheoremClosed normal forms are exactly the values#✓fully proved
A term \(t\) of type \(A\) in the empty context is in normal form, that is, has no call-by-value reduction step, if and only if it is a value.
theorem closed_normalForm_iff_value (t : Tm [] A) : NormalForm t ↔ Value t
inductive Tm {Base : Type u} : List (Ty Base) → Ty Base → Type u where
| var {A : Ty Base} {Γ : List (Ty Base)} : Var Γ A → Tm Γ A
| app {A B : Ty Base} {Γ : List (Ty Base)} : Tm Γ (A ⇒ B) → Tm Γ A → Tm Γ B
| lam {A B : Ty Base} {Γ : List (Ty Base)} : Tm (A :: Γ) B → Tm Γ (A ⇒ B)
CSLibExt/Languages/LambdaCalculus/DeBruijn/Stlc/Syntax.lean:61
def NormalForm (t : Tm Γ A) : Prop := ∀ t', ¬t ⟶ₛ t'
CSLibExt/Languages/LambdaCalculus/DeBruijn/Stlc/Semantics.lean:114
inductive Value {Base : Type u} : {Γ : List (Ty Base)} → {A : Ty Base} → Tm Γ A → Prop where
| lam {A B : Ty Base} {Γ : List (Ty Base)} (body : Tm (A :: Γ) B) : Value (.lam body)
CSLibExt/Languages/LambdaCalculus/DeBruijn/Stlc/Semantics.lean:39
Uses 7 · Used by 2
AbbreviationMulti-step call-by-value reduction in STLC#✓fully proved
For terms of type \(A\) in a context \(\Gamma\), multi-step reduction is the reflexive transitive closure of one-step call-by-value reduction.
abbrev Steps {Base : Type u} {Γ : List (Ty Base)} {A : Ty Base} :=
Relation.ReflTransGen (@Step Base Γ A)
inductive Ty (Base : Type u) where
| base : Base → Ty Base
| arr : Ty Base → Ty Base → Ty Base
deriving DecidableEq, Repr
CSLibExt/Languages/LambdaCalculus/DeBruijn/Stlc/Syntax.lean:36
inductive Step {Base : Type u} : {Γ : List (Ty Base)} → {A : Ty Base} →
Tm Γ A → Tm Γ A → Prop where
| appFun {A B : Ty Base} {Γ : List (Ty Base)} {f f' : Tm Γ (A ⇒ B)} {a : Tm Γ A} :
Step f f' → Step (.app f a) (.app f' a)
| appArg {A B : Ty Base} {Γ : List (Ty Base)} {f : Tm Γ (A ⇒ B)} {a a' : Tm Γ A} :
Value f → Step a a' → Step (.app f a) (.app f a')
| beta {A B : Ty Base} {Γ : List (Ty Base)} {body : Tm (A :: Γ) B} {a : Tm Γ A} :
Value a → Step (.app (.lam body) a) (Tm.instantiate body a)
CSLibExt/Languages/LambdaCalculus/DeBruijn/Stlc/Semantics.lean:43
Uses 3 · Used by 34
InductiveBig-step call-by-value evaluation in the simply typed lambda calculus#✓fully proved
Fix a typing context \(\Gamma\). For terms \(t\) and \(v\) of the same type in context \(\Gamma\), the big-step evaluation relation \(t \Downarrow v\) is the least relation such that every lambda abstraction \(\lambda.\,b\) evaluates to itself, and an application \(f\,a\) evaluates to \(v\) whenever \(f \Downarrow \lambda.\,b\), \(a \Downarrow u\) and \(b[u] \Downarrow v\), where \(b[u]\) is the body \(b\) with its newest free variable replaced by \(u\).
The application rule fixes a left-to-right order: first the function, then the argument, then the instantiated body.
inductive Eval : {A : Ty Base} → Tm Γ A → Tm Γ A → Prop where
| lam {A B : Ty Base} (body : Tm (A :: Γ) B) : Eval (.lam body) (.lam body)
| app {A B : Ty Base} {f : Tm Γ (A ⇒ B)} {a : Tm Γ A}
{body : Tm (A :: Γ) B} {va : Tm Γ A} {v : Tm Γ B} :
Eval f (.lam body) →
Eval a va →
Eval (Tm.instantiate body va) v →
Eval (.app f a) v
inductive Ty (Base : Type u) where
| base : Base → Ty Base
| arr : Ty Base → Ty Base → Ty Base
deriving DecidableEq, Repr
CSLibExt/Languages/LambdaCalculus/DeBruijn/Stlc/Syntax.lean:36
inductive Tm {Base : Type u} : List (Ty Base) → Ty Base → Type u where
| var {A : Ty Base} {Γ : List (Ty Base)} : Var Γ A → Tm Γ A
| app {A B : Ty Base} {Γ : List (Ty Base)} : Tm Γ (A ⇒ B) → Tm Γ A → Tm Γ B
| lam {A B : Ty Base} {Γ : List (Ty Base)} : Tm (A :: Γ) B → Tm Γ (A ⇒ B)
CSLibExt/Languages/LambdaCalculus/DeBruijn/Stlc/Syntax.lean:61
def instantiate (body : Tm (A :: Γ) B) (a : Tm Γ A) : Tm Γ B :=
subst (Sub.single a) body
CSLibExt/Languages/LambdaCalculus/DeBruijn/Stlc/Substitution.lean:124
Uses 3 · Used by 18
TheoremBig-step evaluation produces values#✓fully proved
In the call-by-value simply typed lambda calculus, if a term \(t\) of type \(A\) in context \(\Gamma\) evaluates by big-step evaluation to a term \(v\), written \(t \Downarrow v\), then \(v\) is a value, that is, a lambda abstraction.
theorem value {t v : Tm Γ A} (h : t ⇓ v) : Value v
inductive Tm {Base : Type u} : List (Ty Base) → Ty Base → Type u where
| var {A : Ty Base} {Γ : List (Ty Base)} : Var Γ A → Tm Γ A
| app {A B : Ty Base} {Γ : List (Ty Base)} : Tm Γ (A ⇒ B) → Tm Γ A → Tm Γ B
| lam {A B : Ty Base} {Γ : List (Ty Base)} : Tm (A :: Γ) B → Tm Γ (A ⇒ B)
CSLibExt/Languages/LambdaCalculus/DeBruijn/Stlc/Syntax.lean:61
inductive Value {Base : Type u} : {Γ : List (Ty Base)} → {A : Ty Base} → Tm Γ A → Prop where
| lam {A B : Ty Base} {Γ : List (Ty Base)} (body : Tm (A :: Γ) B) : Value (.lam body)
CSLibExt/Languages/LambdaCalculus/DeBruijn/Stlc/Semantics.lean:39
Uses 5 · Used by 5
TheoremValues evaluate to themselves#✓fully proved
Every value \(v\), that is, every lambda abstraction, of any type in any typing context evaluates to itself in the big-step semantics: \(v \Downarrow v\).
theorem value_self {v : Tm Γ A} (hv : Value v) : v ⇓ v
inductive Tm {Base : Type u} : List (Ty Base) → Ty Base → Type u where
| var {A : Ty Base} {Γ : List (Ty Base)} : Var Γ A → Tm Γ A
| app {A B : Ty Base} {Γ : List (Ty Base)} : Tm Γ (A ⇒ B) → Tm Γ A → Tm Γ B
| lam {A B : Ty Base} {Γ : List (Ty Base)} : Tm (A :: Γ) B → Tm Γ (A ⇒ B)
CSLibExt/Languages/LambdaCalculus/DeBruijn/Stlc/Syntax.lean:61
inductive Value {Base : Type u} : {Γ : List (Ty Base)} → {A : Ty Base} → Tm Γ A → Prop where
| lam {A B : Ty Base} {Γ : List (Ty Base)} (body : Tm (A :: Γ) B) : Value (.lam body)
CSLibExt/Languages/LambdaCalculus/DeBruijn/Stlc/Semantics.lean:39
Uses 4 · Used by 3
TheoremBig-step evaluation implies small-step evaluation#✓fully proved
Let \(t\) and \(v\) be terms of the same type in the same typing context. If \(t\) evaluates to \(v\) in the big-step semantics, written \(t \Downarrow v\), then \(t\) reduces to \(v\) in finitely many (possibly zero) left-to-right call-by-value steps.
theorem to_steps {t v : Tm Γ A} (h : t ⇓ v) : Steps t v
inductive Tm {Base : Type u} : List (Ty Base) → Ty Base → Type u where
| var {A : Ty Base} {Γ : List (Ty Base)} : Var Γ A → Tm Γ A
| app {A B : Ty Base} {Γ : List (Ty Base)} : Tm Γ (A ⇒ B) → Tm Γ A → Tm Γ B
| lam {A B : Ty Base} {Γ : List (Ty Base)} : Tm (A :: Γ) B → Tm Γ (A ⇒ B)
CSLibExt/Languages/LambdaCalculus/DeBruijn/Stlc/Syntax.lean:61
abbrev Steps {Base : Type u} {Γ : List (Ty Base)} {A : Ty Base} :=
Relation.ReflTransGen (@Step Base Γ A)
CSLibExt/Languages/LambdaCalculus/DeBruijn/Stlc/Semantics.lean:129
Uses 10 · Used by 4
TheoremBig-step evaluation is closed under backward reduction steps#✓fully proved
Let \(t\), \(t'\) and \(v\) be terms of the same type \(A\) in the same typing context \(\Gamma\). If \(t\) reduces to \(t'\) in one left-to-right call-by-value step and \(t'\) evaluates to \(v\) in the big-step semantics, written \(t' \Downarrow v\), then \(t \Downarrow v\).
theorem anti_step {t t' v : Tm Γ A} (hstep : Step t t') (heval : t' ⇓ v) : t ⇓ v
inductive Tm {Base : Type u} : List (Ty Base) → Ty Base → Type u where
| var {A : Ty Base} {Γ : List (Ty Base)} : Var Γ A → Tm Γ A
| app {A B : Ty Base} {Γ : List (Ty Base)} : Tm Γ (A ⇒ B) → Tm Γ A → Tm Γ B
| lam {A B : Ty Base} {Γ : List (Ty Base)} : Tm (A :: Γ) B → Tm Γ (A ⇒ B)
CSLibExt/Languages/LambdaCalculus/DeBruijn/Stlc/Syntax.lean:61
inductive Step {Base : Type u} : {Γ : List (Ty Base)} → {A : Ty Base} →
Tm Γ A → Tm Γ A → Prop where
| appFun {A B : Ty Base} {Γ : List (Ty Base)} {f f' : Tm Γ (A ⇒ B)} {a : Tm Γ A} :
Step f f' → Step (.app f a) (.app f' a)
| appArg {A B : Ty Base} {Γ : List (Ty Base)} {f : Tm Γ (A ⇒ B)} {a a' : Tm Γ A} :
Value f → Step a a' → Step (.app f a) (.app f a')
| beta {A B : Ty Base} {Γ : List (Ty Base)} {body : Tm (A :: Γ) B} {a : Tm Γ A} :
Value a → Step (.app (.lam body) a) (Tm.instantiate body a)
CSLibExt/Languages/LambdaCalculus/DeBruijn/Stlc/Semantics.lean:43
Uses 8 · Used by 1
TheoremBig-step evaluation is closed under backward multi-step reduction#✓fully proved
Let \(t\), \(t'\) and \(v\) be terms of the same type \(A\) in the same typing context \(\Gamma\). If \(t\) reduces to \(t'\) in finitely many (possibly zero) left-to-right call-by-value steps and \(t'\) evaluates to \(v\) in the big-step semantics, written \(t' \Downarrow v\), then \(t \Downarrow v\).
theorem anti_steps {t t' v : Tm Γ A} (hsteps : Steps t t') (heval : t' ⇓ v) : t ⇓ v
inductive Tm {Base : Type u} : List (Ty Base) → Ty Base → Type u where
| var {A : Ty Base} {Γ : List (Ty Base)} : Var Γ A → Tm Γ A
| app {A B : Ty Base} {Γ : List (Ty Base)} : Tm Γ (A ⇒ B) → Tm Γ A → Tm Γ B
| lam {A B : Ty Base} {Γ : List (Ty Base)} : Tm (A :: Γ) B → Tm Γ (A ⇒ B)
CSLibExt/Languages/LambdaCalculus/DeBruijn/Stlc/Syntax.lean:61
abbrev Steps {Base : Type u} {Γ : List (Ty Base)} {A : Ty Base} :=
Relation.ReflTransGen (@Step Base Γ A)
CSLibExt/Languages/LambdaCalculus/DeBruijn/Stlc/Semantics.lean:129
Uses 6 · Used by 1
TheoremSmall-step evaluation to a value implies big-step evaluation#✓fully proved
Let \(t\) and \(v\) be terms of the same type in the same typing context. If \(t\) reduces to \(v\) in finitely many (possibly zero) left-to-right call-by-value steps and \(v\) is a value, then \(t\) evaluates to \(v\) in the big-step semantics, written \(t \Downarrow v\).
theorem of_steps {t v : Tm Γ A} (hsteps : Steps t v) (hv : Value v) : t ⇓ v
inductive Tm {Base : Type u} : List (Ty Base) → Ty Base → Type u where
| var {A : Ty Base} {Γ : List (Ty Base)} : Var Γ A → Tm Γ A
| app {A B : Ty Base} {Γ : List (Ty Base)} : Tm Γ (A ⇒ B) → Tm Γ A → Tm Γ B
| lam {A B : Ty Base} {Γ : List (Ty Base)} : Tm (A :: Γ) B → Tm Γ (A ⇒ B)
CSLibExt/Languages/LambdaCalculus/DeBruijn/Stlc/Syntax.lean:61
abbrev Steps {Base : Type u} {Γ : List (Ty Base)} {A : Ty Base} :=
Relation.ReflTransGen (@Step Base Γ A)
CSLibExt/Languages/LambdaCalculus/DeBruijn/Stlc/Semantics.lean:129
inductive Value {Base : Type u} : {Γ : List (Ty Base)} → {A : Ty Base} → Tm Γ A → Prop where
| lam {A B : Ty Base} {Γ : List (Ty Base)} (body : Tm (A :: Γ) B) : Value (.lam body)
CSLibExt/Languages/LambdaCalculus/DeBruijn/Stlc/Semantics.lean:39
Uses 7 · Used by 3
TheoremBig-step evaluation is small-step evaluation to a value#✓fully proved
For terms \(t\) and \(v\) of the same type in the same typing context, \(t\) evaluates to \(v\) in the big-step semantics, written \(t \Downarrow v\), if and only if \(t\) reduces to \(v\) in finitely many (possibly zero) left-to-right call-by-value steps and \(v\) is a value, that is, a lambda abstraction.
theorem iff_steps_value {t v : Tm Γ A} : t ⇓ v ↔ Steps t v ∧ Value v
inductive Tm {Base : Type u} : List (Ty Base) → Ty Base → Type u where
| var {A : Ty Base} {Γ : List (Ty Base)} : Var Γ A → Tm Γ A
| app {A B : Ty Base} {Γ : List (Ty Base)} : Tm Γ (A ⇒ B) → Tm Γ A → Tm Γ B
| lam {A B : Ty Base} {Γ : List (Ty Base)} : Tm (A :: Γ) B → Tm Γ (A ⇒ B)
CSLibExt/Languages/LambdaCalculus/DeBruijn/Stlc/Syntax.lean:61
abbrev Steps {Base : Type u} {Γ : List (Ty Base)} {A : Ty Base} :=
Relation.ReflTransGen (@Step Base Γ A)
CSLibExt/Languages/LambdaCalculus/DeBruijn/Stlc/Semantics.lean:129
inductive Value {Base : Type u} : {Γ : List (Ty Base)} → {A : Ty Base} → Tm Γ A → Prop where
| lam {A B : Ty Base} {Γ : List (Ty Base)} (body : Tm (A :: Γ) B) : Value (.lam body)
CSLibExt/Languages/LambdaCalculus/DeBruijn/Stlc/Semantics.lean:39
TheoremDeterminism of big-step evaluation in the simply typed lambda calculus#✓fully proved
For every typing context \(\Gamma\) and type \(A\), if a term \(t\) of type \(A\) in context \(\Gamma\) evaluates in the big-step call-by-value semantics both to \(v\) and to \(w\), written \(t \Downarrow v\) and \(t \Downarrow w\), then \(v = w\).
theorem deterministic {t v w : Tm Γ A} (htv : t ⇓ v) (htw : t ⇓ w) : v = w
inductive Tm {Base : Type u} : List (Ty Base) → Ty Base → Type u where
| var {A : Ty Base} {Γ : List (Ty Base)} : Var Γ A → Tm Γ A
| app {A B : Ty Base} {Γ : List (Ty Base)} : Tm Γ (A ⇒ B) → Tm Γ A → Tm Γ B
| lam {A B : Ty Base} {Γ : List (Ty Base)} : Tm (A :: Γ) B → Tm Γ (A ⇒ B)
CSLibExt/Languages/LambdaCalculus/DeBruijn/Stlc/Syntax.lean:61
Uses 6 · Used by 1
TheoremClosed simply typed terms have a big-step evaluation#✓fully proved
For every type \(A\) and every closed term \(t\) of type \(A\), that is, a term in the empty typing context, there is a term \(v\) such that \(t\) evaluates to \(v\) in the big-step call-by-value semantics, written \(t \Downarrow v\).
theorem exists_closed (t : Tm [] A) : ∃ v, t ⇓ v
inductive Tm {Base : Type u} : List (Ty Base) → Ty Base → Type u where
| var {A : Ty Base} {Γ : List (Ty Base)} : Var Γ A → Tm Γ A
| app {A B : Ty Base} {Γ : List (Ty Base)} : Tm Γ (A ⇒ B) → Tm Γ A → Tm Γ B
| lam {A B : Ty Base} {Γ : List (Ty Base)} : Tm (A :: Γ) B → Tm Γ (A ⇒ B)
CSLibExt/Languages/LambdaCalculus/DeBruijn/Stlc/Syntax.lean:61
TheoremTermination in terms of big-step evaluation#✓fully proved
For every closed term \(t\) of type \(A\), that is, a term in the empty typing context, \(t\) terminates (it reduces to a value in finitely many left-to-right call-by-value steps) if and only if there is a term \(v\) such that \(t\) evaluates to \(v\) in the big-step semantics, written \(t \Downarrow v\).
theorem terminates_iff_eval {t : Tm [] A} : Terminates t ↔ ∃ v, t ⇓ v
inductive Tm {Base : Type u} : List (Ty Base) → Ty Base → Type u where
| var {A : Ty Base} {Γ : List (Ty Base)} : Var Γ A → Tm Γ A
| app {A B : Ty Base} {Γ : List (Ty Base)} : Tm Γ (A ⇒ B) → Tm Γ A → Tm Γ B
| lam {A B : Ty Base} {Γ : List (Ty Base)} : Tm (A :: Γ) B → Tm Γ (A ⇒ B)
CSLibExt/Languages/LambdaCalculus/DeBruijn/Stlc/Syntax.lean:61
def Terminates (t : Tm [] A) : Prop := ∃ v, Steps t v ∧ Value v
CSLibExt/Languages/LambdaCalculus/DeBruijn/Stlc/LogicalRelation.lean:88
Loading dependency explorer…
The dependency explorer needs JavaScript and its graph data.