Documentation

TTFPI.Untyped

Untyped λ-calculus #

Note that we are not using simp or aesop in this file, even though our code is written in a style that is compatible with these tactics. This is because we want to keep the proofs as explicit as possible, for educational purposes.

inductive Untyped.Λ :
Instances For
    Equations
    Instances For
      Equations
      • One or more equations did not get rendered due to their size.
      Instances For
        Equations
        Instances For
          Equations
          Instances For
            Equations
            • L.Subterm M = (L ∈ M.Sub)
            Instances For
              Equations
              Equations
              Equations
              Instances For
                instance Untyped.Λ.instDecidableProperSubterm {M : Untyped.Λ} {N : Untyped.Λ} :
                Decidable (M.ProperSubterm N)
                Equations
                Equations
                Equations
                Instances For
                  Equations
                  Instances For
                    Equations
                    Equations
                    Instances For
                      def Untyped.Λ.hasDecHasBindingVar (M : Untyped.Λ) (x : Name) :
                      Decidable (M.HasBindingVar x)
                      Equations
                      Instances For
                        instance Untyped.Λ.instDecidableHasBindingVar {M : Untyped.Λ} {x : Name} :
                        Decidable (M.HasBindingVar x)
                        Equations
                        • Untyped.Λ.instDecidableHasBindingVar = M.hasDecHasBindingVar x
                        Equations
                        Instances For
                          @[simp]
                          theorem Untyped.Λ.rename_size_eq {M : Untyped.Λ} {x : Name} {y : Name} :
                          (M.rename x y).size = M.size
                          Instances For
                            @[simp]
                            theorem Untyped.Λ.renaming_rename {x : Name} {y : Name} {M : Untyped.Λ} {hfv : y ∉ M.FV} {hnb : ¬M.HasBindingVar y} :
                            (Untyped.Λ.abs x M).Renaming (Untyped.Λ.abs y (M.rename x y))
                            Instances For
                              instance Untyped.Λ.instCoeRenamingAlphaEq {M : Untyped.Λ} {N : Untyped.Λ} :
                              Coe (M.Renaming N) (M =α N)
                              Equations
                              • Untyped.Λ.instCoeRenamingAlphaEq = { coe := ⋯ }
                              @[simp]
                              theorem Untyped.Λ.alpha_eq_rename {M : Untyped.Λ} {N : Untyped.Λ} :
                              M.Renaming N → M =α N
                              @[simp]
                              theorem Untyped.Λ.alpha_eq_compat_app_left {L : Untyped.Λ} {M : Untyped.Λ} {N : Untyped.Λ} (h : M =α N) :
                              M ∙ L =α N ∙ L
                              @[simp]
                              theorem Untyped.Λ.alpha_eq_compat_app_right {L : Untyped.Λ} {M : Untyped.Λ} {N : Untyped.Λ} (h : M =α N) :
                              L ∙ M =α L ∙ N
                              theorem Untyped.Λ.alpha_eq_symm {M : Untyped.Λ} {N : Untyped.Λ} (h : M =α N) :
                              N =α M
                              theorem Untyped.Λ.alpha_eq_trans {L : Untyped.Λ} {M : Untyped.Λ} {N : Untyped.Λ} (hlm : L =α M) (hmn : M =α N) :
                              L =α N
                              theorem Untyped.Λ.eq_imp_alpha_eq {M : Untyped.Λ} {N : Untyped.Λ} (h : M = N) :
                              M =α N
                              @[reducible, inline]
                              Equations
                              Instances For
                                Equations
                                • One or more equations did not get rendered due to their size.
                                Instances For
                                  @[irreducible]
                                  Equations
                                  Instances For
                                    Equations
                                    Instances For
                                      Equations
                                      Instances For
                                        Equations
                                        • One or more equations did not get rendered due to their size.
                                        Instances For
                                          theorem Untyped.Λ.subst_noop {M : Untyped.Λ} {N : Untyped.Λ} {x : Name} (h : x ∉ M.FV) :
                                          M.subst x N = M
                                          theorem Untyped.Λ.subst_sequence {L : Untyped.Λ} {M : Untyped.Λ} {N : Untyped.Λ} {x : Name} {y : Name} (h : x ≠ y) (hxm : x ∉ L.FV) :
                                          (M.subst x N).subst y L = (M.subst y L).subst x (N.subst y L)
                                          theorem Untyped.Λ.modulo_alpha_eq_app {M : Untyped.Λ} {N : Untyped.Λ} {P : Untyped.Λ} {Q : Untyped.Λ} (hmn : M =α N) (hpq : P =α Q) :
                                          M ∙ P =α N ∙ Q
                                          theorem Untyped.Λ.modulo_alpha_eq_subst {M : Untyped.Λ} {N : Untyped.Λ} {P : Untyped.Λ} {Q : Untyped.Λ} {x : Name} (hmn : M =α N) (hpq : P =α Q) :
                                          M.subst x P =α N.subst x Q
                                          Equations
                                          Instances For
                                            Instances For
                                              @[simp]
                                              theorem Untyped.Λ.beta_redex {x : Name} {M : Untyped.Λ} {N : Untyped.Λ} :
                                              Untyped.Λ.abs x M ∙ N →β M.subst x N
                                              @[simp]
                                              theorem Untyped.Λ.beta_compat_app_left {L : Untyped.Λ} {M : Untyped.Λ} {N : Untyped.Λ} (h : M →β N) :
                                              M ∙ L →β N ∙ L
                                              @[simp]
                                              theorem Untyped.Λ.beta_compat_app_right {L : Untyped.Λ} {M : Untyped.Λ} {N : Untyped.Λ} (h : M →β N) :
                                              L ∙ M →β L ∙ N
                                              Equations
                                              • Untyped.Λ.instCoeBetaBetaChain = { coe := ⋯ }
                                              Instances For
                                                @[simp]
                                                theorem Untyped.Λ.beta_eq_beta {M : Untyped.Λ} {N : Untyped.Λ} (h : M →β N) :
                                                M =β N
                                                @[simp]
                                                theorem Untyped.Λ.beta_eq_beta_inv {M : Untyped.Λ} {N : Untyped.Λ} (h : N →β M) :
                                                M =β N
                                                theorem Untyped.Λ.beta_eq_symm {M : Untyped.Λ} {N : Untyped.Λ} (h : M =β N) :
                                                N =β M
                                                theorem Untyped.Λ.beta_eq_trans {L : Untyped.Λ} {M : Untyped.Λ} {N : Untyped.Λ} (hlm : L =β M) (hmn : M =β N) :
                                                L =β N
                                                theorem Untyped.Λ.eq_imp_beta_eq {M : Untyped.Λ} {N : Untyped.Λ} (h : M = N) :
                                                M =β N
                                                Equations
                                                Instances For
                                                  Equations
                                                  • Untyped.Λ.instDecidableRedex = isFalse ⋯
                                                  • Untyped.Λ.instDecidableRedex = isFalse ⋯
                                                  • Untyped.Λ.instDecidableRedex = isFalse ⋯
                                                  • Untyped.Λ.instDecidableRedex = isTrue ⋯
                                                  • Untyped.Λ.instDecidableRedex = isFalse ⋯
                                                  Equations
                                                  Instances For
                                                    Equations
                                                    Instances For
                                                      Equations
                                                      • Untyped.Λ.instDecidableInNormalForm = M.hasDecInNormalForm
                                                      Equations
                                                      Instances For
                                                        Equations
                                                        Instances For
                                                          Equations
                                                          Instances For
                                                            @[simp]
                                                            theorem Untyped.Λ.nf_beta_imp_eq {M : Untyped.Λ} {N : Untyped.Λ} (h : M.InNormalForm) (hmn : M →β N) :
                                                            M = N
                                                            @[simp]
                                                            theorem Untyped.Λ.nf_beta_chain_imp_eq {M : Untyped.Λ} {N : Untyped.Λ} (h : M.InNormalForm) (hmn : M ↠β N) :
                                                            M = N
                                                            theorem Untyped.Λ.nf_beta_chain_imp_alpha_eq {M : Untyped.Λ} {N : Untyped.Λ} (h : M.InNormalForm) (hmn : M ↠β N) :
                                                            M =α N
                                                            Equations
                                                            Instances For
                                                              Equations
                                                              Instances For
                                                                theorem Untyped.Λ.church_rosser {L : Untyped.Λ} {M : Untyped.Λ} {N : Untyped.Λ} (hmn : L ↠β M) (hmp : L ↠β N) :
                                                                ∃ (P : Untyped.Λ), M ↠β P ∧ N ↠β P
                                                                theorem Untyped.Λ.church_rosser_corollary {L : Untyped.Λ} {M : Untyped.Λ} {N : Untyped.Λ} (hmn : M =β N) :
                                                                ∃ (L : Untyped.Λ), M ↠β L ∧ N ↠β L
                                                                theorem Untyped.Λ.fixpoint {x : Name} (L : Untyped.Λ) (h : x ∉ L.FV) :
                                                                ∃ (M : Untyped.Λ), L ∙ M =β M
                                                                Equations
                                                                Instances For
                                                                  Equations
                                                                  • M.toNat! = M.toNat?.getD default
                                                                  Instances For
                                                                    Equations
                                                                    Instances For
                                                                      Equations
                                                                      • M.toBool! = M.toBool?.getD default
                                                                      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
                                                                            Equations
                                                                            • One or more equations did not get rendered due to their size.
                                                                            Instances For