Documentation

GroupoidModel.TypeTheory

inductive TyExpr :
Instances For
    Equations
    Equations
    inductive Expr :
    Instances For

      In this section we compute the action of substitutions.

      Write ↑ⁿ for the n-fold weakening substitution {n+i/i}. Write σ:k for σ.vₖ₋₁.….v₁.v₀.

      The substitution ↑ⁿ⁺ᵏ:k, i.e., {0/0,…,k-1/k-1, k+n/k,k+1+n/k+1,…}, arises by starting with ↑ⁿ and traversing under k binders: for example, (ΠA. B)[↑¹] = ΠA[↑¹]. B[↑².v₀].

      The substitution ↑ᵏ.e[↑ᵏ]:k, i.e., {0/0,…,k-1/k-1, e[↑ᵏ]/k, k/k+1,k+2/k+3,…}, arises by starting with id.e and traversing under k binders: for example (ΠA. B)[id.e] = ΠA[id.e]. B[↑.e[↑].v₀].

      The substitution id.e is used in β-reduction: (λa) b ↝ a[id.b].

      def liftVar (n : ) (i : ) (k : optParam 0) :

      Evaluate ↑ⁿ⁺ᵏ:k at a de Bruijn index i.

      Equations
      Instances For
        theorem liftVar_lt {i : } {k : } {n : } (h : i < k) :
        liftVar n i k = i
        theorem liftVar_le {k : } {i : } {n : } (h : k i) :
        liftVar n i k = n + i
        theorem liftVar_base {n : } {i : } :
        liftVar n i = n + i
        @[simp]
        theorem liftVar_base' {n : } {i : } :
        liftVar n i = i + n
        @[simp]
        theorem liftVar_zero {n : } {k : } :
        liftVar n 0 (k + 1) = 0
        @[simp]
        theorem liftVar_succ {n : } {i : } {k : } :
        liftVar n (i + 1) (k + 1) = liftVar n i k + 1
        theorem liftVar_lt_add {i : } {k : } {n : } {j : } (self : i < k) :
        liftVar n i j < k + n
        def TyExpr.liftN (n : ) :

        Evaluate ↑ⁿ⁺ᵏ:k at a type expression.

        Equations
        Instances For
          def Expr.liftN (n : ) :
          ExproptParam 0Expr

          Evaluate ↑ⁿ⁺ᵏ:k at an expression.

          Equations
          Instances For
            @[reducible, inline]

            Evaluate ↑¹ at a type expression.

            Equations
            Instances For
              @[reducible, inline]
              abbrev Expr.lift :

              Evaluate ↑¹ at an expression.

              Equations
              Instances For
                def instVar (i : ) (e : Expr) (k : optParam 0) :

                Evaluate ↑ᵏ.e[↑ᵏ]:k at a de Bruijn index i.

                Equations
                Instances For

                  Evaluate ↑ᵏ.e[↑ᵏ]:k at a type expression.

                  Equations
                  Instances For
                    def Expr.inst :
                    ExprExproptParam 0Expr

                    Evaluate ↑ᵏ.e[↑ᵏ]:k at an expression.

                    Equations
                    • (Expr.bvar i).inst x✝ x = instVar i x✝ x
                    • (Expr.app B fn arg).inst x✝ x = Expr.app (B.inst x✝ (x + 1)) (fn.inst x✝ x) (arg.inst x✝ x)
                    • (Expr.lam ty body).inst x✝ x = Expr.lam (ty.inst x✝ x) (body.inst x✝ (x + 1))
                    • (ty.pi body).inst x✝ x = (ty.inst x✝ x).pi (body.inst x✝ (x + 1))
                    Instances For

                      In this section we specify typing judgments of the type theory as Prop-valued relations.

                      inductive HasType :
                      List TyExprExprTyExprProp
                      Instances For
                        inductive IsType :
                        Instances For
                          def wU {Ctx : Type u} [CategoryTheory.SmallCategory Ctx] [CategoryTheory.Limits.HasTerminal Ctx] [M : CategoryTheory.NaturalModel Ctx] {Γ : Ctx} :
                          CategoryTheory.yoneda.obj Γ CategoryTheory.NaturalModel.Ty
                          Equations
                          Instances For
                            @[simp]
                            theorem comp_wU {Ctx : Type u} [CategoryTheory.SmallCategory Ctx] [CategoryTheory.Limits.HasTerminal Ctx] [M : CategoryTheory.NaturalModel Ctx] (Δ : Ctx) (Γ : Ctx) (σ : CategoryTheory.yoneda.obj Δ CategoryTheory.yoneda.obj Γ) :

                            CtxStack Γ witnesses that the semantic context Γ is built by successive context extension operations.

                            Instances For
                              Equations
                              Instances For
                                @[reducible, inline]
                                Equations
                                • Γ.ty = (CategoryTheory.yoneda.obj Γ.fst CategoryTheory.NaturalModel.Ty)
                                Instances For
                                  @[reducible, inline]
                                  Equations
                                  • Γ.tm = (CategoryTheory.yoneda.obj Γ.fst CategoryTheory.NaturalModel.Tm)
                                  Instances For
                                    Equations
                                    Instances For
                                      def Context.typed.cast {Ctx : Type u} [CategoryTheory.SmallCategory Ctx] [CategoryTheory.Limits.HasTerminal Ctx] [M : CategoryTheory.NaturalModel Ctx] {Γ : Context Ctx} {A : Γ.ty} {B : Γ.ty} (h : A = B) (x : Γ.typed A) :
                                      Γ.typed B
                                      Equations
                                      Instances For
                                        @[simp]
                                        theorem Context.typed.val_cast {Ctx : Type u} [CategoryTheory.SmallCategory Ctx] [CategoryTheory.Limits.HasTerminal Ctx] [M : CategoryTheory.NaturalModel Ctx] {Γ : Context Ctx} {A : Γ.ty} {B : Γ.ty} (h : A = B) (x : Γ.typed A) :
                                        (Context.typed.cast h x) = x
                                        Equations
                                        • Context.nil = ⊤_ Ctx, CtxStack.nil
                                        Instances For
                                          Equations
                                          Instances For
                                            @[simp]
                                            def Context.weak {Ctx : Type u} [CategoryTheory.SmallCategory Ctx] [CategoryTheory.Limits.HasTerminal Ctx] [M : CategoryTheory.NaturalModel Ctx] (Γ : Context Ctx) (A : Γ.ty) {P : CategoryTheory.Psh Ctx} (f : CategoryTheory.yoneda.obj Γ.fst P) :
                                            CategoryTheory.yoneda.obj (Γ.cons A).fst P
                                            Equations
                                            Instances For
                                              def CtxStack.var {Ctx : Type u} [CategoryTheory.SmallCategory Ctx] [CategoryTheory.Limits.HasTerminal Ctx] [M : CategoryTheory.NaturalModel Ctx] {Γ : Ctx} :
                                              CtxStack ΓPart (CategoryTheory.yoneda.obj Γ CategoryTheory.NaturalModel.Tm)
                                              Equations
                                              Instances For
                                                Equations
                                                • Γ.var i = Γ.snd.var i
                                                Instances For
                                                  def substCons {Ctx : Type u} [CategoryTheory.SmallCategory Ctx] [CategoryTheory.Limits.HasTerminal Ctx] [M : CategoryTheory.NaturalModel Ctx] {Γ : Ctx} {Δ : Ctx} (σ : CategoryTheory.yoneda.obj Γ CategoryTheory.yoneda.obj Δ) (e : CategoryTheory.yoneda.obj Γ CategoryTheory.NaturalModel.Tm) (A : CategoryTheory.yoneda.obj Δ CategoryTheory.NaturalModel.Ty) (eTy : CategoryTheory.CategoryStruct.comp e CategoryTheory.NaturalModel.tp = CategoryTheory.CategoryStruct.comp σ A) :
                                                  CategoryTheory.yoneda.obj Γ CategoryTheory.yoneda.obj (CategoryTheory.NaturalModel.ext Δ A)
                                                  Equations
                                                  Instances For
                                                    @[simp]
                                                    theorem substCons_var {Ctx : Type u} [CategoryTheory.SmallCategory Ctx] [CategoryTheory.Limits.HasTerminal Ctx] [M : CategoryTheory.NaturalModel Ctx] {Γ : Ctx} {Δ : Ctx} (σ : CategoryTheory.yoneda.obj Γ CategoryTheory.yoneda.obj Δ) (e : CategoryTheory.yoneda.obj Γ CategoryTheory.NaturalModel.Tm) (A : CategoryTheory.yoneda.obj Δ CategoryTheory.NaturalModel.Ty) (eTy : CategoryTheory.CategoryStruct.comp e CategoryTheory.NaturalModel.tp = CategoryTheory.CategoryStruct.comp σ A) :
                                                    @[simp]
                                                    theorem substCons_var_assoc {Ctx : Type u} [CategoryTheory.SmallCategory Ctx] [CategoryTheory.Limits.HasTerminal Ctx] [M : CategoryTheory.NaturalModel Ctx] {Γ : Ctx} {Δ : Ctx} (σ : CategoryTheory.yoneda.obj Γ CategoryTheory.yoneda.obj Δ) (e : CategoryTheory.yoneda.obj Γ CategoryTheory.NaturalModel.Tm) (A : CategoryTheory.yoneda.obj Δ CategoryTheory.NaturalModel.Ty) (eTy : CategoryTheory.CategoryStruct.comp e CategoryTheory.NaturalModel.tp = CategoryTheory.CategoryStruct.comp σ A) {Z : CategoryTheory.Functor Ctxᵒᵖ (Type u)} (h : CategoryTheory.NaturalModel.Tm Z) :
                                                    @[simp]
                                                    theorem substCons_disp {Ctx : Type u} [CategoryTheory.SmallCategory Ctx] [CategoryTheory.Limits.HasTerminal Ctx] [M : CategoryTheory.NaturalModel Ctx] {Γ : Ctx} {Δ : Ctx} (σ : CategoryTheory.yoneda.obj Γ CategoryTheory.yoneda.obj Δ) (e : CategoryTheory.yoneda.obj Γ CategoryTheory.NaturalModel.Tm) (A : CategoryTheory.yoneda.obj Δ CategoryTheory.NaturalModel.Ty) (eTy : CategoryTheory.CategoryStruct.comp e CategoryTheory.NaturalModel.tp = CategoryTheory.CategoryStruct.comp σ A) :
                                                    CategoryTheory.CategoryStruct.comp (substCons σ e A eTy) (CategoryTheory.yoneda.map (CategoryTheory.NaturalModel.disp Δ A)) = σ
                                                    @[simp]
                                                    theorem substCons_disp_assoc {Ctx : Type u} [CategoryTheory.SmallCategory Ctx] [CategoryTheory.Limits.HasTerminal Ctx] [M : CategoryTheory.NaturalModel Ctx] {Γ : Ctx} {Δ : Ctx} (σ : CategoryTheory.yoneda.obj Γ CategoryTheory.yoneda.obj Δ) (e : CategoryTheory.yoneda.obj Γ CategoryTheory.NaturalModel.Tm) (A : CategoryTheory.yoneda.obj Δ CategoryTheory.NaturalModel.Ty) (eTy : CategoryTheory.CategoryStruct.comp e CategoryTheory.NaturalModel.tp = CategoryTheory.CategoryStruct.comp σ A) {Z : CategoryTheory.Functor Ctxᵒᵖ (Type u)} (h : CategoryTheory.yoneda.obj Δ Z) :
                                                    theorem comp_substUnit {Ctx : Type u} [CategoryTheory.SmallCategory Ctx] [CategoryTheory.Limits.HasTerminal Ctx] [M : CategoryTheory.NaturalModel Ctx] {Δ : Ctx} {Γ : Ctx} (σ : CategoryTheory.yoneda.obj Δ CategoryTheory.yoneda.obj Γ) (f : Γ ⊤_ Ctx) (f' : Δ ⊤_ Ctx) :
                                                    CategoryTheory.CategoryStruct.comp σ (CategoryTheory.yoneda.map f) = CategoryTheory.yoneda.map f'
                                                    theorem comp_substCons {Ctx : Type u} [CategoryTheory.SmallCategory Ctx] [CategoryTheory.Limits.HasTerminal Ctx] [M : CategoryTheory.NaturalModel Ctx] {Γ : Ctx} {Γ' : Ctx} {Δ : Ctx} (τ : CategoryTheory.yoneda.obj Γ' CategoryTheory.yoneda.obj Γ) (σ : CategoryTheory.yoneda.obj Γ CategoryTheory.yoneda.obj Δ) (e : CategoryTheory.yoneda.obj Γ CategoryTheory.NaturalModel.Tm) (A : CategoryTheory.yoneda.obj Δ CategoryTheory.NaturalModel.Ty) (eTy : CategoryTheory.CategoryStruct.comp e CategoryTheory.NaturalModel.tp = CategoryTheory.CategoryStruct.comp σ A) :
                                                    theorem comp_substCons_assoc {Ctx : Type u} [CategoryTheory.SmallCategory Ctx] [CategoryTheory.Limits.HasTerminal Ctx] [M : CategoryTheory.NaturalModel Ctx] {Γ : Ctx} {Γ' : Ctx} {Δ : Ctx} (τ : CategoryTheory.yoneda.obj Γ' CategoryTheory.yoneda.obj Γ) (σ : CategoryTheory.yoneda.obj Γ CategoryTheory.yoneda.obj Δ) (e : CategoryTheory.yoneda.obj Γ CategoryTheory.NaturalModel.Tm) (A : CategoryTheory.yoneda.obj Δ CategoryTheory.NaturalModel.Ty) (eTy : CategoryTheory.CategoryStruct.comp e CategoryTheory.NaturalModel.tp = CategoryTheory.CategoryStruct.comp σ A) {Z : CategoryTheory.Functor Ctxᵒᵖ (Type u)} (h : CategoryTheory.yoneda.obj (CategoryTheory.NaturalModel.ext Δ A) Z) :
                                                    def substFst {Ctx : Type u} [CategoryTheory.SmallCategory Ctx] [CategoryTheory.Limits.HasTerminal Ctx] [M : CategoryTheory.NaturalModel Ctx] {Γ : Ctx} {Δ : Ctx} {A : CategoryTheory.yoneda.obj Δ CategoryTheory.NaturalModel.Ty} (σ : CategoryTheory.yoneda.obj Γ CategoryTheory.yoneda.obj (CategoryTheory.NaturalModel.ext Δ A)) :
                                                    CategoryTheory.yoneda.obj Γ CategoryTheory.yoneda.obj Δ
                                                    Equations
                                                    Instances For
                                                      def substSnd {Ctx : Type u} [CategoryTheory.SmallCategory Ctx] [CategoryTheory.Limits.HasTerminal Ctx] [M : CategoryTheory.NaturalModel Ctx] {Γ : Ctx} {Δ : Ctx} {A : CategoryTheory.yoneda.obj Δ CategoryTheory.NaturalModel.Ty} (σ : CategoryTheory.yoneda.obj Γ CategoryTheory.yoneda.obj (CategoryTheory.NaturalModel.ext Δ A)) :
                                                      CategoryTheory.yoneda.obj Γ CategoryTheory.NaturalModel.Tm
                                                      Equations
                                                      Instances For
                                                        theorem substSnd_ty {Ctx : Type u} [CategoryTheory.SmallCategory Ctx] [CategoryTheory.Limits.HasTerminal Ctx] [M : CategoryTheory.NaturalModel Ctx] {Γ : Ctx} {Δ : Ctx} {A : CategoryTheory.yoneda.obj Δ CategoryTheory.NaturalModel.Ty} (σ : CategoryTheory.yoneda.obj Γ CategoryTheory.yoneda.obj (CategoryTheory.NaturalModel.ext Δ A)) :
                                                        def weakSubst {Ctx : Type u} [CategoryTheory.SmallCategory Ctx] [CategoryTheory.Limits.HasTerminal Ctx] [M : CategoryTheory.NaturalModel Ctx] {Δ : Ctx} {Γ : Ctx} (σ : CategoryTheory.yoneda.obj Δ CategoryTheory.yoneda.obj Γ) (A : CategoryTheory.yoneda.obj Γ CategoryTheory.NaturalModel.Ty) :
                                                        CategoryTheory.yoneda.obj (CategoryTheory.NaturalModel.ext Δ (CategoryTheory.CategoryStruct.comp σ A)) CategoryTheory.yoneda.obj (CategoryTheory.NaturalModel.ext Γ A)
                                                        Equations
                                                        • One or more equations did not get rendered due to their size.
                                                        Instances For
                                                          def weakSubst' {Ctx : Type u} [CategoryTheory.SmallCategory Ctx] [CategoryTheory.Limits.HasTerminal Ctx] [M : CategoryTheory.NaturalModel Ctx] {Δ : Ctx} {Γ : Ctx} (σ : CategoryTheory.yoneda.obj Δ CategoryTheory.yoneda.obj Γ) (A : CategoryTheory.yoneda.obj Γ CategoryTheory.NaturalModel.Ty) {A' : CategoryTheory.yoneda.obj Δ CategoryTheory.NaturalModel.Ty} (e : CategoryTheory.CategoryStruct.comp σ A = A') :
                                                          CategoryTheory.yoneda.obj (CategoryTheory.NaturalModel.ext Δ A') CategoryTheory.yoneda.obj (CategoryTheory.NaturalModel.ext Γ A)
                                                          Equations
                                                          Instances For
                                                            def Context.typed.subst {Ctx : Type u} [CategoryTheory.SmallCategory Ctx] [CategoryTheory.Limits.HasTerminal Ctx] [M : CategoryTheory.NaturalModel Ctx] {Γ : Context Ctx} {Δ : Context Ctx} (σ : CategoryTheory.yoneda.obj Δ.fst CategoryTheory.yoneda.obj Γ.fst) {A : Γ.ty} (x : Γ.typed A) :
                                                            Equations
                                                            Instances For
                                                              @[simp]
                                                              theorem Context.typed.subst_coe {Ctx : Type u} [CategoryTheory.SmallCategory Ctx] [CategoryTheory.Limits.HasTerminal Ctx] [M : CategoryTheory.NaturalModel Ctx] {Γ : Context Ctx} {Δ : Context Ctx} (σ : CategoryTheory.yoneda.obj Δ.fst CategoryTheory.yoneda.obj Γ.fst) {A : Γ.ty} (x : Γ.typed A) :
                                                              def mkEl {Ctx : Type u} [CategoryTheory.SmallCategory Ctx] [CategoryTheory.Limits.HasTerminal Ctx] [M : CategoryTheory.NaturalModel Ctx] {Γ : Context Ctx} (A : Γ.typed wU) :
                                                              Γ.ty
                                                              Equations
                                                              • One or more equations did not get rendered due to their size.
                                                              Instances For
                                                                theorem comp_mkEl {Ctx : Type u} [CategoryTheory.SmallCategory Ctx] [CategoryTheory.Limits.HasTerminal Ctx] [M : CategoryTheory.NaturalModel Ctx] {Δ : Context Ctx} {Γ : Context Ctx} (σ : CategoryTheory.yoneda.obj Δ.fst CategoryTheory.yoneda.obj Γ.fst) (A : Γ.typed wU) :
                                                                def mkP_equiv {Ctx : Type u} [CategoryTheory.SmallCategory Ctx] [CategoryTheory.Limits.HasTerminal Ctx] [M : CategoryTheory.NaturalModel Ctx] {Γ : Ctx} {X : CategoryTheory.Psh Ctx} :
                                                                (CategoryTheory.yoneda.obj Γ (CategoryTheory.NaturalModel.P CategoryTheory.NaturalModel.tp).obj X) (A : CategoryTheory.yoneda.obj Γ CategoryTheory.NaturalModel.Ty) × (CategoryTheory.yoneda.obj (CategoryTheory.NaturalModel.ext Γ A) X)
                                                                Equations
                                                                • One or more equations did not get rendered due to their size.
                                                                Instances For
                                                                  theorem mkP_equiv_naturality_left {Ctx : Type u} [CategoryTheory.SmallCategory Ctx] [CategoryTheory.Limits.HasTerminal Ctx] [M : CategoryTheory.NaturalModel Ctx] {Δ : Ctx} {Γ : Ctx} {X : CategoryTheory.Psh Ctx} (σ : CategoryTheory.yoneda.obj Δ CategoryTheory.yoneda.obj Γ) (f : CategoryTheory.yoneda.obj Γ (CategoryTheory.NaturalModel.P CategoryTheory.NaturalModel.tp).obj X) :
                                                                  mkP_equiv (CategoryTheory.CategoryStruct.comp σ f) = match mkP_equiv f with | A, a => CategoryTheory.CategoryStruct.comp σ A, CategoryTheory.CategoryStruct.comp (weakSubst σ A) a
                                                                  def mkP {Ctx : Type u} [CategoryTheory.SmallCategory Ctx] [CategoryTheory.Limits.HasTerminal Ctx] [M : CategoryTheory.NaturalModel Ctx] {Γ : Ctx} {X : CategoryTheory.Psh Ctx} (A : CategoryTheory.yoneda.obj Γ CategoryTheory.NaturalModel.Ty) (B : CategoryTheory.yoneda.obj (CategoryTheory.NaturalModel.ext Γ A) X) :
                                                                  CategoryTheory.yoneda.obj Γ (CategoryTheory.NaturalModel.P CategoryTheory.NaturalModel.tp).obj X
                                                                  Equations
                                                                  • mkP A B = mkP_equiv.symm A, B
                                                                  Instances For
                                                                    theorem mkP_app {Ctx : Type u} [CategoryTheory.SmallCategory Ctx] [CategoryTheory.Limits.HasTerminal Ctx] [M : CategoryTheory.NaturalModel Ctx] {Γ : Ctx} {X : CategoryTheory.Psh Ctx} {Y : CategoryTheory.Psh Ctx} (A : CategoryTheory.yoneda.obj Γ CategoryTheory.NaturalModel.Ty) (F : X Y) (B : CategoryTheory.yoneda.obj (CategoryTheory.NaturalModel.ext Γ A) X) :
                                                                    theorem comp_mkP {Ctx : Type u} [CategoryTheory.SmallCategory Ctx] [CategoryTheory.Limits.HasTerminal Ctx] [M : CategoryTheory.NaturalModel Ctx] {X : CategoryTheory.Functor Ctxᵒᵖ (Type u)} {Δ : Ctx} {Γ : Ctx} (σ : CategoryTheory.yoneda.obj Δ CategoryTheory.yoneda.obj Γ) (A : CategoryTheory.yoneda.obj Γ CategoryTheory.NaturalModel.Ty) (B : CategoryTheory.yoneda.obj (CategoryTheory.NaturalModel.ext Γ A) X) :
                                                                    def mkPi {Ctx : Type u} [CategoryTheory.SmallCategory Ctx] [CategoryTheory.Limits.HasTerminal Ctx] [M : CategoryTheory.NaturalModel Ctx] {Γ : Context Ctx} (A : Γ.ty) (B : (Γ.cons A).ty) :
                                                                    Γ.ty
                                                                    Equations
                                                                    Instances For
                                                                      theorem comp_mkPi {Ctx : Type u} [CategoryTheory.SmallCategory Ctx] [CategoryTheory.Limits.HasTerminal Ctx] [M : CategoryTheory.NaturalModel Ctx] {Γ : Context Ctx} {Δ : Context Ctx} (σ : CategoryTheory.yoneda.obj Δ.fst CategoryTheory.yoneda.obj Γ.fst) (A : Γ.ty) (B : (Γ.cons A).ty) :
                                                                      def mkLam' {Ctx : Type u} [CategoryTheory.SmallCategory Ctx] [CategoryTheory.Limits.HasTerminal Ctx] [M : CategoryTheory.NaturalModel Ctx] {Γ : Context Ctx} (A : Γ.ty) (e : (Γ.cons A).tm) :
                                                                      Γ.tm
                                                                      Equations
                                                                      Instances For
                                                                        theorem comp_mkLam' {Ctx : Type u} [CategoryTheory.SmallCategory Ctx] [CategoryTheory.Limits.HasTerminal Ctx] [M : CategoryTheory.NaturalModel Ctx] {Γ : Context Ctx} {Δ : Context Ctx} (σ : CategoryTheory.yoneda.obj Δ.fst CategoryTheory.yoneda.obj Γ.fst) (A : Γ.ty) (B : (Γ.cons A).tm) :
                                                                        def Context.subst {Ctx : Type u} [CategoryTheory.SmallCategory Ctx] [CategoryTheory.Limits.HasTerminal Ctx] [M : CategoryTheory.NaturalModel Ctx] {Γ : Context Ctx} {X : CategoryTheory.Psh Ctx} (A : Γ.ty) (B : CategoryTheory.yoneda.obj (Γ.cons A).fst X) (a : Γ.typed A) :
                                                                        CategoryTheory.yoneda.obj Γ.fst X
                                                                        Equations
                                                                        Instances For
                                                                          theorem Context.comp_subst {Ctx : Type u} [CategoryTheory.SmallCategory Ctx] [CategoryTheory.Limits.HasTerminal Ctx] [M : CategoryTheory.NaturalModel Ctx] {Γ : Context Ctx} {Δ : Context Ctx} (σ : CategoryTheory.yoneda.obj Δ.fst CategoryTheory.yoneda.obj Γ.fst) {X : CategoryTheory.Psh Ctx} (A : Γ.ty) (B : CategoryTheory.yoneda.obj (Γ.cons A).fst X) (a : Γ.typed A) :
                                                                          def mkTyped {Ctx : Type u} [CategoryTheory.SmallCategory Ctx] [CategoryTheory.Limits.HasTerminal Ctx] [M : CategoryTheory.NaturalModel Ctx] {Γ : Context Ctx} {Δ : Context Ctx} {A : Δ.ty} (σ : CategoryTheory.yoneda.obj Γ.fst CategoryTheory.yoneda.obj (CategoryTheory.NaturalModel.ext Δ.fst A)) {Aσ : CategoryTheory.yoneda.obj Γ.fst CategoryTheory.NaturalModel.Ty} (eq : CategoryTheory.CategoryStruct.comp (substFst σ) A = ) :
                                                                          Γ.typed
                                                                          Equations
                                                                          Instances For
                                                                            def mkLam {Ctx : Type u} [CategoryTheory.SmallCategory Ctx] [CategoryTheory.Limits.HasTerminal Ctx] [M : CategoryTheory.NaturalModel Ctx] {Γ : Context Ctx} (A : Γ.ty) (B : (Γ.cons A).ty) (e : (Γ.cons A).typed B) :
                                                                            Γ.typed (mkPi A B)
                                                                            Equations
                                                                            Instances For
                                                                              theorem comp_mkLam {Ctx : Type u} [CategoryTheory.SmallCategory Ctx] [CategoryTheory.Limits.HasTerminal Ctx] [M : CategoryTheory.NaturalModel Ctx] {Γ : Context Ctx} {Δ : Context Ctx} (σ : CategoryTheory.yoneda.obj Δ.fst CategoryTheory.yoneda.obj Γ.fst) (A : Γ.ty) (B : (Γ.cons A).ty) (e : (Γ.cons A).typed B) :
                                                                              def mkPApp'_aux {Ctx : Type u} [CategoryTheory.SmallCategory Ctx] [CategoryTheory.Limits.HasTerminal Ctx] [M : CategoryTheory.NaturalModel Ctx] {Γ : Ctx} (A : CategoryTheory.yoneda.obj Γ CategoryTheory.NaturalModel.Ty) (B : CategoryTheory.yoneda.obj (CategoryTheory.NaturalModel.ext Γ A) CategoryTheory.NaturalModel.Ty) (f : CategoryTheory.yoneda.obj Γ CategoryTheory.NaturalModel.Tm) (f_tp : CategoryTheory.CategoryStruct.comp f CategoryTheory.NaturalModel.tp = CategoryTheory.CategoryStruct.comp (mkP A B) CategoryTheory.NaturalModel.NaturalModelPi.Pi) :
                                                                              (A : CategoryTheory.yoneda.obj Γ CategoryTheory.NaturalModel.Ty) × (CategoryTheory.yoneda.obj (CategoryTheory.NaturalModel.ext Γ A) CategoryTheory.NaturalModel.Tm)
                                                                              Equations
                                                                              Instances For
                                                                                theorem mkPApp'_aux_tp {Ctx : Type u} [CategoryTheory.SmallCategory Ctx] [CategoryTheory.Limits.HasTerminal Ctx] [M : CategoryTheory.NaturalModel Ctx] {Γ : Ctx} (A : CategoryTheory.yoneda.obj Γ CategoryTheory.NaturalModel.Ty) (B : CategoryTheory.yoneda.obj (CategoryTheory.NaturalModel.ext Γ A) CategoryTheory.NaturalModel.Ty) (f : CategoryTheory.yoneda.obj Γ CategoryTheory.NaturalModel.Tm) (f_tp : CategoryTheory.CategoryStruct.comp f CategoryTheory.NaturalModel.tp = CategoryTheory.CategoryStruct.comp (mkP A B) CategoryTheory.NaturalModel.NaturalModelPi.Pi) :
                                                                                let p := mkPApp'_aux A B f f_tp; p.fst, CategoryTheory.CategoryStruct.comp p.snd CategoryTheory.NaturalModel.tp = A, B
                                                                                @[simp]
                                                                                theorem mkPApp'_aux_fst {Ctx : Type u} [CategoryTheory.SmallCategory Ctx] [CategoryTheory.Limits.HasTerminal Ctx] [M : CategoryTheory.NaturalModel Ctx] {Γ : Ctx} (A : CategoryTheory.yoneda.obj Γ CategoryTheory.NaturalModel.Ty) (B : CategoryTheory.yoneda.obj (CategoryTheory.NaturalModel.ext Γ A) CategoryTheory.NaturalModel.Ty) (f : CategoryTheory.yoneda.obj Γ CategoryTheory.NaturalModel.Tm) (f_tp : CategoryTheory.CategoryStruct.comp f CategoryTheory.NaturalModel.tp = CategoryTheory.CategoryStruct.comp (mkP A B) CategoryTheory.NaturalModel.NaturalModelPi.Pi) :
                                                                                (mkPApp'_aux A B f f_tp).fst = A
                                                                                @[simp]
                                                                                theorem mkPApp'_aux_snd_tp {Ctx : Type u} [CategoryTheory.SmallCategory Ctx] [CategoryTheory.Limits.HasTerminal Ctx] [M : CategoryTheory.NaturalModel Ctx] {Γ : Ctx} (A : CategoryTheory.yoneda.obj Γ CategoryTheory.NaturalModel.Ty) (B : CategoryTheory.yoneda.obj (CategoryTheory.NaturalModel.ext Γ A) CategoryTheory.NaturalModel.Ty) (f : CategoryTheory.yoneda.obj Γ CategoryTheory.NaturalModel.Tm) (f_tp : CategoryTheory.CategoryStruct.comp f CategoryTheory.NaturalModel.tp = CategoryTheory.CategoryStruct.comp (mkP A B) CategoryTheory.NaturalModel.NaturalModelPi.Pi) :
                                                                                def comp_mkPApp'_aux {Ctx : Type u} [CategoryTheory.SmallCategory Ctx] [CategoryTheory.Limits.HasTerminal Ctx] [M : CategoryTheory.NaturalModel Ctx] {Δ : Ctx} {Γ : Ctx} (σ : CategoryTheory.yoneda.obj Δ CategoryTheory.yoneda.obj Γ) (A : CategoryTheory.yoneda.obj Γ CategoryTheory.NaturalModel.Ty) (B : CategoryTheory.yoneda.obj (CategoryTheory.NaturalModel.ext Γ A) CategoryTheory.NaturalModel.Ty) (f : CategoryTheory.yoneda.obj Γ CategoryTheory.NaturalModel.Tm) (f_tp : CategoryTheory.CategoryStruct.comp f CategoryTheory.NaturalModel.tp = CategoryTheory.CategoryStruct.comp (mkP A B) CategoryTheory.NaturalModel.NaturalModelPi.Pi) :
                                                                                Equations
                                                                                • =
                                                                                Instances For
                                                                                  def mkPApp {Ctx : Type u} [CategoryTheory.SmallCategory Ctx] [CategoryTheory.Limits.HasTerminal Ctx] [M : CategoryTheory.NaturalModel Ctx] {Γ : Context Ctx} (A : Γ.ty) (B : (Γ.cons A).ty) (f : Γ.typed (mkPi A B)) :
                                                                                  (Γ.cons A).typed B
                                                                                  Equations
                                                                                  Instances For
                                                                                    theorem comp_mkPApp {Ctx : Type u} [CategoryTheory.SmallCategory Ctx] [CategoryTheory.Limits.HasTerminal Ctx] [M : CategoryTheory.NaturalModel Ctx] {Γ : Context Ctx} {Δ : Context Ctx} (σ : CategoryTheory.yoneda.obj Δ.fst CategoryTheory.yoneda.obj Γ.fst) (A : Γ.ty) (B : (Γ.cons A).ty) (f : Γ.typed (mkPi A B)) :
                                                                                    def mkApp {Ctx : Type u} [CategoryTheory.SmallCategory Ctx] [CategoryTheory.Limits.HasTerminal Ctx] [M : CategoryTheory.NaturalModel Ctx] {Γ : Context Ctx} (A : Γ.ty) (B : (Γ.cons A).ty) (f : Γ.typed (mkPi A B)) (a : Γ.typed A) :
                                                                                    Γ.typed (Context.subst A B a)
                                                                                    Equations
                                                                                    Instances For
                                                                                      theorem comp_mkApp {Ctx : Type u} [CategoryTheory.SmallCategory Ctx] [CategoryTheory.Limits.HasTerminal Ctx] [M : CategoryTheory.NaturalModel Ctx] {Γ : Context Ctx} {Δ : Context Ctx} (σ : CategoryTheory.yoneda.obj Δ.fst CategoryTheory.yoneda.obj Γ.fst) (A : Γ.ty) (B : (Γ.cons A).ty) (f : Γ.typed (mkPi A B)) (a : Γ.typed A) :
                                                                                      def mkSmallPi {Ctx : Type u} [CategoryTheory.SmallCategory Ctx] [CategoryTheory.Limits.HasTerminal Ctx] [M : CategoryTheory.NaturalModel Ctx] {Γ : Context Ctx} (A : Γ.typed wU) (B : (Γ.cons (mkEl A)).typed wU) :
                                                                                      Γ.typed wU
                                                                                      Equations
                                                                                      • One or more equations did not get rendered due to their size.
                                                                                      Instances For
                                                                                        theorem comp_mkSmallPi {Ctx : Type u} [CategoryTheory.SmallCategory Ctx] [CategoryTheory.Limits.HasTerminal Ctx] [M : CategoryTheory.NaturalModel Ctx] {Γ : Context Ctx} {Δ : Context Ctx} (σ : CategoryTheory.yoneda.obj Δ.fst CategoryTheory.yoneda.obj Γ.fst) (A : Γ.typed wU) (B : (Γ.cons (mkEl A)).typed wU) :
                                                                                        Equations
                                                                                        Instances For
                                                                                          Equations
                                                                                          Instances For
                                                                                            Equations
                                                                                            Instances For
                                                                                              theorem ofTerm_app {Ctx : Type u} [CategoryTheory.SmallCategory Ctx] [CategoryTheory.Limits.HasTerminal Ctx] [M : CategoryTheory.NaturalModel Ctx] {B : TyExpr} (Γ : Context Ctx) {f : Expr} {a : Expr} {e' : Γ.tm} :
                                                                                              e' ofTerm Γ (Expr.app B f a) f'ofTerm Γ f, a'ofTerm Γ a, ∃ (t' : CategoryTheory.yoneda.obj Γ.fst CategoryTheory.NaturalModel.Ty) (ht' : CategoryTheory.CategoryStruct.comp a' CategoryTheory.NaturalModel.tp = t'), B'ofType (Γ.cons t') B, ∃ (hB : CategoryTheory.CategoryStruct.comp f' CategoryTheory.NaturalModel.tp = mkPi t' B'), e' = (mkApp t' B' f', hB a', ht')
                                                                                              Equations
                                                                                              Instances For
                                                                                                def CtxStack.dropN {Ctx : Type u} [CategoryTheory.SmallCategory Ctx] [CategoryTheory.Limits.HasTerminal Ctx] [M : CategoryTheory.NaturalModel Ctx] {Γ : Ctx} (k : ) (S : CtxStack Γ) :
                                                                                                k S.sizeContext Ctx
                                                                                                Equations
                                                                                                Instances For
                                                                                                  def CtxStack.extN {Ctx : Type u} [CategoryTheory.SmallCategory Ctx] [CategoryTheory.Limits.HasTerminal Ctx] [M : CategoryTheory.NaturalModel Ctx] {Γ : Ctx} {k : } {S : CtxStack Γ} {h : k S.size} :
                                                                                                  (CtxStack.dropN k S h).ty(Δ : Context Ctx) × (CategoryTheory.yoneda.obj Δ.fst CategoryTheory.yoneda.obj Γ)
                                                                                                  Equations
                                                                                                  Instances For
                                                                                                    Equations
                                                                                                    Instances For
                                                                                                      def Context.tyN.up {Ctx : Type u} [CategoryTheory.SmallCategory Ctx] [CategoryTheory.Limits.HasTerminal Ctx] [M : CategoryTheory.NaturalModel Ctx] {Γ : Context Ctx} {k : } {A : Γ.ty} :
                                                                                                      Γ.tyN k(Γ.cons A).tyN (k + 1)
                                                                                                      Equations
                                                                                                      Instances For
                                                                                                        def Context.tyN.down {Ctx : Type u} [CategoryTheory.SmallCategory Ctx] [CategoryTheory.Limits.HasTerminal Ctx] [M : CategoryTheory.NaturalModel Ctx] {Γ : Context Ctx} {k : } {A : Γ.ty} :
                                                                                                        (Γ.cons A).tyN (k + 1)Γ.tyN k
                                                                                                        Equations
                                                                                                        Instances For
                                                                                                          Equations
                                                                                                          Instances For
                                                                                                            def Context.dispN {Ctx : Type u} [CategoryTheory.SmallCategory Ctx] [CategoryTheory.Limits.HasTerminal Ctx] [M : CategoryTheory.NaturalModel Ctx] {k : } (Γ : Context Ctx) (A : Γ.tyN k) :
                                                                                                            CategoryTheory.yoneda.obj (Γ.consN A).fst CategoryTheory.yoneda.obj Γ.fst
                                                                                                            Equations
                                                                                                            Instances For
                                                                                                              @[simp]
                                                                                                              theorem Context.dispN_cons {Ctx : Type u} [CategoryTheory.SmallCategory Ctx] [CategoryTheory.Limits.HasTerminal Ctx] [M : CategoryTheory.NaturalModel Ctx] {k : } (Γ : Context Ctx) (A : Γ.ty) (X : Γ.tyN k) :
                                                                                                              (Γ.cons A).dispN X.up = weakSubst (Γ.dispN X) A
                                                                                                              @[simp]
                                                                                                              theorem Context.consN_cons {Ctx : Type u} [CategoryTheory.SmallCategory Ctx] [CategoryTheory.Limits.HasTerminal Ctx] [M : CategoryTheory.NaturalModel Ctx] {k : } (Γ : Context Ctx) (A : Γ.ty) (X : Γ.tyN k) :
                                                                                                              (Γ.cons A).consN X.up = (Γ.consN X).cons (CategoryTheory.CategoryStruct.comp (Γ.dispN X) A)
                                                                                                              theorem ofType_liftN {Ctx : Type u} [CategoryTheory.SmallCategory Ctx] [CategoryTheory.Limits.HasTerminal Ctx] [M : CategoryTheory.NaturalModel Ctx] {k : } {Γ : Context Ctx} {A : TyExpr} {A' : Γ.ty} (X : Γ.tyN k) :
                                                                                                              A' ofType Γ ACategoryTheory.CategoryStruct.comp (Γ.dispN X) A' ofType (Γ.consN X) (TyExpr.liftN 1 A k)
                                                                                                              theorem ofTerm_liftN {Ctx : Type u} [CategoryTheory.SmallCategory Ctx] [CategoryTheory.Limits.HasTerminal Ctx] [M : CategoryTheory.NaturalModel Ctx] {k : } {Γ : Context Ctx} {e : Expr} {e' : Γ.tm} (X : Γ.tyN k) :
                                                                                                              e' ofTerm Γ eCategoryTheory.CategoryStruct.comp (Γ.dispN X) e' ofTerm (Γ.consN X) (Expr.liftN 1 e k)
                                                                                                              theorem ofType_lift {Ctx : Type u} [CategoryTheory.SmallCategory Ctx] [CategoryTheory.Limits.HasTerminal Ctx] [M : CategoryTheory.NaturalModel Ctx] {Γ : Context Ctx} {A : TyExpr} {A' : Γ.ty} (X : Γ.ty) (H : A' ofType Γ A) :
                                                                                                              Γ.weak X A' ofType (Γ.cons X) A.lift
                                                                                                              theorem ofTerm_lift {Ctx : Type u} [CategoryTheory.SmallCategory Ctx] [CategoryTheory.Limits.HasTerminal Ctx] [M : CategoryTheory.NaturalModel Ctx] {Γ : Context Ctx} {e : Expr} {e' : Γ.tm} (X : Γ.ty) (H : e' ofTerm Γ e) :
                                                                                                              Γ.weak X e' ofTerm (Γ.cons X) e.lift
                                                                                                              theorem ofType_inst {Ctx : Type u} [CategoryTheory.SmallCategory Ctx] [CategoryTheory.Limits.HasTerminal Ctx] [M : CategoryTheory.NaturalModel Ctx] {Γ : Context Ctx} {X : Γ.ty} {x : Expr} {A : TyExpr} {A' : (Γ.cons X).ty} (x' : Γ.typed X) (Hx : x' ofTerm Γ x) (He : A' ofType (Γ.cons X) A) :
                                                                                                              Context.subst X A' x' ofType Γ (A.inst x)
                                                                                                              theorem ofTerm_inst {Ctx : Type u} [CategoryTheory.SmallCategory Ctx] [CategoryTheory.Limits.HasTerminal Ctx] [M : CategoryTheory.NaturalModel Ctx] {Γ : Context Ctx} {X : Γ.ty} {x : Expr} {e : Expr} {e' : (Γ.cons X).tm} (x' : Γ.typed X) (Hx : x' ofTerm Γ x) (He : e' ofTerm (Γ.cons X) e) :
                                                                                                              Context.subst X e' x' ofTerm Γ (e.inst x)
                                                                                                              theorem ofTerm_ofType_correct {Ctx : Type u} [CategoryTheory.SmallCategory Ctx] [CategoryTheory.Limits.HasTerminal Ctx] [M : CategoryTheory.NaturalModel Ctx] :
                                                                                                              (∀ {Γ : List TyExpr} {e : Expr} {A : TyExpr}, HasType Γ e A∀ {Γ' : Context Ctx}, Γ' ofCtx ΓA'ofType Γ' A, e'ofTerm Γ' e, CategoryTheory.CategoryStruct.comp e' CategoryTheory.NaturalModel.tp = A') ∀ {Γ : List TyExpr} {A : TyExpr}, IsType Γ A∀ {Γ' : Context Ctx}, Γ' ofCtx Γ(ofType Γ' A).Dom
                                                                                                              theorem ofTerm_correct {Ctx : Type u} [CategoryTheory.SmallCategory Ctx] [CategoryTheory.Limits.HasTerminal Ctx] [M : CategoryTheory.NaturalModel Ctx] {Γ : List TyExpr} {e : Expr} {A : TyExpr} (H : HasType Γ e A) {Γ' : Context Ctx} (hΓ : Γ' ofCtx Γ) :
                                                                                                              A'ofType Γ' A, e'ofTerm Γ' e, CategoryTheory.CategoryStruct.comp e' CategoryTheory.NaturalModel.tp = A'
                                                                                                              theorem ofTerm_correct_ty {Ctx : Type u} [CategoryTheory.SmallCategory Ctx] [CategoryTheory.Limits.HasTerminal Ctx] [M : CategoryTheory.NaturalModel Ctx] {Γ : List TyExpr} {e : Expr} {A : TyExpr} (H : HasType Γ e A) {Γ' : Context Ctx} (hΓ : Γ' ofCtx Γ) :
                                                                                                              (ofType Γ' A).Dom
                                                                                                              theorem ofTerm_correct_tm {Ctx : Type u} [CategoryTheory.SmallCategory Ctx] [CategoryTheory.Limits.HasTerminal Ctx] [M : CategoryTheory.NaturalModel Ctx] {Γ : List TyExpr} {e : Expr} {A : TyExpr} (H : HasType Γ e A) {Γ' : Context Ctx} (hΓ : Γ' ofCtx Γ) :
                                                                                                              (ofTerm Γ' e).Dom
                                                                                                              theorem ofTerm_correct_tp {Ctx : Type u} [CategoryTheory.SmallCategory Ctx] [CategoryTheory.Limits.HasTerminal Ctx] [M : CategoryTheory.NaturalModel Ctx] {e : Expr} {Γ : List TyExpr} {A : TyExpr} (H : HasType Γ e A) {Γ' : Context Ctx} (hΓ : Γ' ofCtx Γ) :
                                                                                                              CategoryTheory.CategoryStruct.comp ((ofTerm Γ' e).get ) CategoryTheory.NaturalModel.tp = (ofType Γ' A).get
                                                                                                              theorem ofType_correct {Ctx : Type u} [CategoryTheory.SmallCategory Ctx] [CategoryTheory.Limits.HasTerminal Ctx] [M : CategoryTheory.NaturalModel Ctx] {Γ : List TyExpr} {A : TyExpr} (H : IsType Γ A) {Γ' : Context Ctx} (hΓ : Γ' ofCtx Γ) :
                                                                                                              (ofType Γ' A).Dom
                                                                                                              def Typed (Γ : List TyExpr) (A : TyExpr) :
                                                                                                              Equations
                                                                                                              Instances For
                                                                                                                def toModelType {Ctx : Type u} [CategoryTheory.SmallCategory Ctx] [CategoryTheory.Limits.HasTerminal Ctx] [M : CategoryTheory.NaturalModel Ctx] {A : TyExpr} (e : Typed [] A) :
                                                                                                                CategoryTheory.yoneda.obj (⊤_ Ctx) CategoryTheory.NaturalModel.Ty
                                                                                                                Equations
                                                                                                                Instances For
                                                                                                                  def toModel {Ctx : Type u} [CategoryTheory.SmallCategory Ctx] [CategoryTheory.Limits.HasTerminal Ctx] [M : CategoryTheory.NaturalModel Ctx] {A : TyExpr} (e : Typed [] A) :
                                                                                                                  CategoryTheory.yoneda.obj (⊤_ Ctx) CategoryTheory.NaturalModel.Tm
                                                                                                                  Equations
                                                                                                                  Instances For