Evaluation results #
This file formalises evaluation and normal forms of SKI terms.
Main definitions #
RedexFree: a predicate expressing that a term has no redexesevalStep: SKI-reduction as a function
Main results #
evalStep_right_correct: correctness forevalStepredexFree_iffandredexFree_iff_mred_eq: a term is redex free if and only if it has (respectively) no one-step reductions, or if its only many step reduction is itself.unique_normal_form: ifxreduces to bothyandz, and bothyandzare in normal form, then they are equal.- Rice's theorem: no SKI term is a non-trivial predicate.
References #
This file draws heavily from https://gist.github.com/b-mehta/e412c837818223b8f16ca0b4aa19b166.
The predicate that a term has no reducible sub-terms.
Equations
- Cslib.SKI.S.RedexFree = True
- Cslib.SKI.K.RedexFree = True
- Cslib.SKI.I.RedexFree = True
- (Cslib.SKI.S.app x_1).RedexFree = x_1.RedexFree
- (Cslib.SKI.K.app x_1).RedexFree = x_1.RedexFree
- (Cslib.SKI.I.app a).RedexFree = False
- ((Cslib.SKI.S.app x_1).app y).RedexFree = (x_1.RedexFree ∧ y.RedexFree)
- ((Cslib.SKI.K.app a).app a_1).RedexFree = False
- ((Cslib.SKI.I.app a).app a_1).RedexFree = False
- (((Cslib.SKI.S.app a).app a_1).app a_2).RedexFree = False
- (((Cslib.SKI.K.app a).app a_1).app a_2).RedexFree = False
- (((Cslib.SKI.I.app a).app a_1).app a_2).RedexFree = False
- ((((a.app b).app c).app d).app e).RedexFree = ((((a.app b).app c).app d).RedexFree ∧ e.RedexFree)
Instances For
One-step evaluation as a function: either it returns a term that has been reduced by one step, or a proof that the term is redex free. Uses normal-order reduction.
Equations
- One or more equations did not get rendered due to their size.
- Cslib.SKI.S.evalStep = Sum.inl { down := trivial }
- Cslib.SKI.K.evalStep = Sum.inl { down := trivial }
- Cslib.SKI.I.evalStep = Sum.inl { down := trivial }
- (Cslib.SKI.S.app x_1).evalStep = match x_1.evalStep with | Sum.inl h => Sum.inl h | Sum.inr x' => Sum.inr (Cslib.SKI.S.app x')
- (Cslib.SKI.K.app x_1).evalStep = match x_1.evalStep with | Sum.inl h => Sum.inl h | Sum.inr x' => Sum.inr (Cslib.SKI.K.app x')
- (Cslib.SKI.I.app a).evalStep = Sum.inr a
- ((Cslib.SKI.K.app a).app a_1).evalStep = Sum.inr a
- ((Cslib.SKI.I.app a).app a_1).evalStep = Sum.inr (a.app a_1)
- (((Cslib.SKI.S.app a).app a_1).app a_2).evalStep = Sum.inr ((a.app a_2).app (a_1.app a_2))
- (((Cslib.SKI.K.app a).app a_1).app a_2).evalStep = Sum.inr (a.app a_2)
- (((Cslib.SKI.I.app a).app a_1).app a_2).evalStep = Sum.inr ((a.app a_1).app a_2)
Instances For
Equations
- x✝.instDecidablePredRedexFree = decidable_of_iff' (x✝.evalStep.isLeft = true) ⋯
If a term has a common reduct with a normal term, it in fact reduces to that term.
If x and y are normal and have a common reduct, then they are equal.
Injectivity for datatypes #
Injectivity for booleans.
Injectivity for Church numerals
Rice's theorem: no SKI term is a non-trivial predicate.
More specifically, say a term P is a predicate if, for every term x, P · x reduces to either
TT or FF. A predicate P is trivial if either it always reduces to true, or always to false.
This version of Rice's theorem derives a contradiction from the existence of a predicate P and the
existence of terms x for which P · x is true (P · x ↠ TT) and for which P · x is false
(P · x ↠ FF).
Rice's theorem: any SKI predicate is trivial.
This version of Rice's theorem proves (classically) that any SKI predicate P either is constantly
true (ie P · x ↠ TT for every x) or is constantly false (P · x ↠ FF for every x).