Documentation

Cslib.Languages.LambdaCalculus.LocallyNameless.Untyped.StandardReduction

Standard Reduction and the Standardization Theorem #

References #

Main definitions #

A standard β-reduction sequence contracts redexes at non-decreasing positions. The index n is the last position contracted.

Instances For

    The Standard reduction relation.

    Instances For
      Equations
      • One or more equations did not get rendered due to their size.
      Instances For
        Equations
        • One or more equations did not get rendered due to their size.
        Instances For

          Basic properties #

          The left side of a standard reduction is locally closed.

          Standard reduction is reflexive for locally closed terms.

          The right side of a standard reduction is locally closed.

          theorem Cslib.LambdaCalculus.LocallyNameless.Untyped.Term.Standard.of_cbn_step {Var : Type u} {M N : Term Var} (step : M.CBN N) (lc_N : N.LC) :

          A single Call-by-Name step is a standard reduction.

          theorem Cslib.LambdaCalculus.LocallyNameless.Untyped.Term.Standard.cbn_step_trans {Var : Type u} {M N P : Term Var} (step : M.CBN P) (std : P.Standard N) :

          A Call-by-Name step followed by a standard reduction is a standard reduction.

          A Call-by-Name reduction followed by a standard reduction is a standard reduction.

          Call-by-Name reduction is contained in standard reduction.

          Standard sequences #

          Standard sequences preserve being an abstraction.

          theorem Cslib.LambdaCalculus.LocallyNameless.Untyped.Term.StandardSeq.head_leftmost {Var : Type u} {N P : Term Var} {n : } (seq : StandardSeq n P N) {M : Term Var} :
          BetaAt 0 M Pkn, StandardSeq k M N

          A standard sequence preceded by a step at position 0 remains standard.

          theorem Cslib.LambdaCalculus.LocallyNameless.Untyped.Term.StandardSeq.cbn_head {Var : Type u} {M N P : Term Var} {n : } (h : Relation.ReflTransGen CBN M P) (hseq : StandardSeq n P N) :
          ∃ (k : ), StandardSeq k M N

          A standard sequence stays standard when preceded by a Call-by-Name reduction.

          theorem Cslib.LambdaCalculus.LocallyNameless.Untyped.Term.StandardSeq.app_r_abs {Var : Type u} {L M M' : Term Var} {n : } (h : StandardSeq n M M') (ha : L.IsAbs) :
          StandardSeq (n + L.countRedexes + 1) (L.app M) (L.app M')

          Right congruence for standard sequences when the operator is an abstraction.

          theorem Cslib.LambdaCalculus.LocallyNameless.Untyped.Term.StandardSeq.app_r_noAbs {Var : Type u} {L M M' : Term Var} {n : } (h : StandardSeq n M M') (hna : ¬L.IsAbs) :
          StandardSeq (n + L.countRedexes) (L.app M) (L.app M')

          Right congruence for standard sequences when the operator is a non-abstraction.

          theorem Cslib.LambdaCalculus.LocallyNameless.Untyped.Term.StandardSeq.app_r_cong {Var : Type u} {L M M' : Term Var} {n : } (h : StandardSeq n M M') :
          ∃ (k : ), StandardSeq k (L.app M) (L.app M') k n + L.countRedexes + if L.IsAbs then 1 else 0

          Right application congruence for standard sequences.

          The final position of a nonempty standard sequence is at most its target's redex count.

          theorem Cslib.LambdaCalculus.LocallyNameless.Untyped.Term.StandardSeq.app_l_cong {Var : Type u} {L L' M : Term Var} {n : } (h : StandardSeq n L L') :
          ∃ (k : ), StandardSeq k (L.app M) (L'.app M) k n + if L'.IsAbs then 1 else 0

          Reducing the operator of an application yields a standard sequence, with the final position bounded.

          theorem Cslib.LambdaCalculus.LocallyNameless.Untyped.Term.StandardSeq.app_l_cong_of_ne {Var : Type u} {L L' M : Term Var} {n : } [HasFresh Var] (h : StandardSeq n L L') (hne : L L') :
          ∃ (k : ), StandardSeq k (L.app M) (L'.app M) k L'.countRedexes + if L'.IsAbs then 1 else 0

          A nonempty operator reduction lifts to the application, bounded by the operator's redex count.

          theorem Cslib.LambdaCalculus.LocallyNameless.Untyped.Term.StandardSeq.app_r_tail {Var : Type u} {L L' M N N' : Term Var} {i n : } (h : StandardSeq n (L.app M) (L'.app N)) (step : BetaAt i N N') (hle : n i + L'.countRedexes + if L'.IsAbs then 1 else 0) :
          StandardSeq (i + L'.countRedexes + if L'.IsAbs then 1 else 0) (L.app M) (L'.app N')

          Append an operand step to a standard sequence of applications.

          theorem Cslib.LambdaCalculus.LocallyNameless.Untyped.Term.StandardSeq.app_r_trans {Var : Type u} {L L' M M' : Term Var} {i n : } (h : StandardSeq n M M') (happ : StandardSeq i (L.app M) (L'.app M)) (hc : i L'.countRedexes + if L'.IsAbs then 1 else 0) :
          ∃ (d : ), StandardSeq d (L.app M) (L'.app M') d n + L'.countRedexes + if L'.IsAbs then 1 else 0

          Compose an application sequence with a standard reduction of its operand.

          theorem Cslib.LambdaCalculus.LocallyNameless.Untyped.Term.StandardSeq.app_cong {Var : Type u} {L L' M M' : Term Var} {b n : } [HasFresh Var] (hL : StandardSeq n L L') (hM : StandardSeq b M M') :
          ∃ (k : ), StandardSeq k (L.app M) (L'.app M')

          If operator and operand each reduce by a standard sequence, so does the application.

          Standardization #

          theorem Cslib.LambdaCalculus.LocallyNameless.Untyped.Term.Standard.subst {Var : Type u} {M M' N N' : Term Var} [HasFresh Var] [DecidableEq Var] (hM : M.Standard M') (hN : N.Standard N') (x : Var) (lc_N : N.LC) (lc_N' : N'.LC) :
          M[x := N].Standard M'[x := N']

          Standard reduction is preserved by substitution.

          theorem Cslib.LambdaCalculus.LocallyNameless.Untyped.Term.Standard.of_beta_step {Var : Type u} {M N : Term Var} [HasFresh Var] [DecidableEq Var] (step : M.FullBeta N) (lc_M : M.LC) :

          A single full β-step is a standard reduction.

          Standard reduction is contained in full β-reduction.

          theorem Cslib.LambdaCalculus.LocallyNameless.Untyped.Term.Standard.abs_inv {Var : Type u} {M N : Term Var} [HasFresh Var] [DecidableEq Var] (h : M.Standard N) (M' : Term Var) (eq : N = M'.abs) :
          ∃ (M'' : Term Var), Relation.ReflTransGen CBN M M''.abs M''.abs.Standard M'.abs

          If a standard reduction reaches an abstraction, then its leading Call-by-Name reduction reaches an abstraction that standardly reduces to the same target.

          theorem Cslib.LambdaCalculus.LocallyNameless.Untyped.Term.Standard.abs_subst {Var : Type u} {M M' N N' : Term Var} [HasFresh Var] [DecidableEq Var] (h_abs : M.abs.Standard M'.abs) (hN : N.Standard N') (lc_N : N.LC) (lc_N' : N'.LC) :
          (M.open' N).Standard (M'.open' N')

          Standard reduction of abstractions is preserved by opening.

          A standard reduction followed by a full β-step is a standard reduction.

          A standard reduction followed by a full β-reduction is a standard reduction.

          theorem Cslib.LambdaCalculus.LocallyNameless.Untyped.Term.Standard.trans {Var : Type u} {M N P : Term Var} [HasFresh Var] [DecidableEq Var] (h1 : M.Standard P) (h2 : P.Standard N) :

          Standard reduction is transitive.

          @[instance_reducible]
          instance Cslib.LambdaCalculus.LocallyNameless.Untyped.Term.instTransStandardFullBeta {Var : Type u} [HasFresh Var] [DecidableEq Var] :
          Trans (fun (x1 x2 : Term Var) => x1.Standard x2) (fun (x1 x2 : Term Var) => x1.FullBeta x2) fun (x1 x2 : Term Var) => x1.Standard x2
          Equations
          @[instance_reducible]
          instance Cslib.LambdaCalculus.LocallyNameless.Untyped.Term.instTransStandard {Var : Type u} [HasFresh Var] [DecidableEq Var] :
          Trans (fun (x1 x2 : Term Var) => x1.Standard x2) (fun (x1 x2 : Term Var) => x1.Standard x2) fun (x1 x2 : Term Var) => x1.Standard x2
          Equations

          The standardization theorem: every full β-reduction is a standard reduction.

          Standard reduction coincides with full β-reduction on locally closed terms.

          Equivalence with standard sequences #

          theorem Cslib.LambdaCalculus.LocallyNameless.Untyped.Term.StandardSeq.lc_r {Var : Type u} {M N : Term Var} {n : } [HasFresh Var] [DecidableEq Var] (h : StandardSeq n M N) (lc : M.LC) :
          N.LC

          Standard sequences preserve local closure.

          theorem Cslib.LambdaCalculus.LocallyNameless.Untyped.Term.StandardSeq.abs_close {Var : Type u} {M M' : Term Var} {n : } [HasFresh Var] [DecidableEq Var] {x : Var} (h : StandardSeq n M M') (lc : M.LC) :
          StandardSeq n (closeRec 0 x M).abs (closeRec 0 x M').abs

          Closing a variable and abstracting preserves a standard sequence.

          theorem Cslib.LambdaCalculus.LocallyNameless.Untyped.Term.StandardSeq.abs_cong {Var : Type u} {M M' : Term Var} [HasFresh Var] [DecidableEq Var] (xs : Finset Var) (cofin : xxs, ∃ (n : ), StandardSeq n (M.open' (fvar x)) (M'.open' (fvar x))) (lc : M.abs.LC) :
          ∃ (n : ), StandardSeq n M.abs M'.abs

          Abstraction congruence for standard sequences.

          A standard sequence is a full β-reduction.

          theorem Cslib.LambdaCalculus.LocallyNameless.Untyped.Term.Standard.to_seq {Var : Type u} {M N : Term Var} [HasFresh Var] [DecidableEq Var] (h : M.Standard N) :
          ∃ (n : ), StandardSeq n M N

          A standard reduction gives a standard β-reduction sequence.

          theorem Cslib.LambdaCalculus.LocallyNameless.Untyped.Term.StandardSeq.to_standard {Var : Type u} {M N : Term Var} {n : } [HasFresh Var] [DecidableEq Var] (h : StandardSeq n M N) (lc_M : M.LC) :

          A standard β-reduction sequence gives a standard reduction.

          theorem Cslib.LambdaCalculus.LocallyNameless.Untyped.Term.Standard.iff_seq {Var : Type u} {M N : Term Var} [HasFresh Var] [DecidableEq Var] (lc_M : M.LC) :
          M.Standard N ∃ (n : ), StandardSeq n M N

          Standard reduction coincides with the existence of a standard β-reduction sequence.