Documentation

Semantic.CC.Substitution

structure CC.Subst (s1 s2 : Sig) :

A substitution maps bound variables of each kind to terms of the appropriate sort.

Instances For
    def CC.Subst.lift {s1 s2 : Sig} {k : Kind} (s : Subst s1 s2) :
    Subst (s1,,k) (s2,,k)

    Lifts a substitution under a binder. The newly bound variable maps to itself.

    Equations
    • One or more equations did not get rendered due to their size.
    Instances For
      def CC.Subst.liftMany {s1 s2 : Sig} (s : Subst s1 s2) (K : Sig) :
      Subst (s1 ++ K) (s2 ++ K)

      Lifts a substitution under multiple binders.

      Equations
      Instances For
        def CC.Subst.id {s : Sig} :
        Subst s s

        The identity substitution.

        Equations
        • One or more equations did not get rendered due to their size.
        Instances For
          def CC.Var.subst {s1 s2 : Sig} :
          Var Kind.var s1Subst s1 s2Var Kind.var s2

          Applies a substitution to a variable. Free variables remain unchanged.

          Equations
          Instances For
            def CC.CaptureSet.subst {s1 s2 : Sig} :
            CaptureSet s1Subst s1 s2CaptureSet s2

            Applies a substitution to all bound variables in a capture set.

            Equations
            Instances For
              def CC.CaptureBound.subst {s1 s2 : Sig} :
              CaptureBound s1Subst s1 s2CaptureBound s2

              Applies a substitution to a capture bound.

              Equations
              Instances For
                def CC.Ty.subst {sort : TySort} {s1 s2 : Sig} :
                Ty sort s1Subst s1 s2Ty sort s2

                Applies a substitution to a type.

                Equations
                Instances For
                  def CC.Exp.subst {s1 s2 : Sig} :
                  Exp s1Subst s1 s2Exp s2

                  Applies a substitution to an expression.

                  Equations
                  Instances For
                    def CC.Subst.openVar {s : Sig} (x : Var Kind.var s) :
                    Subst (s,x) s

                    Substitution that opens a variable binder by replacing the innermost bound variable with x.

                    Equations
                    • One or more equations did not get rendered due to their size.
                    Instances For
                      def CC.Subst.openTVar {s : Sig} (U : Ty TySort.shape s) :
                      Subst (s,X) s

                      Opens a type variable binder, substituting U for the innermost bound.

                      Equations
                      • One or more equations did not get rendered due to their size.
                      Instances For
                        def CC.Subst.openCVar {s : Sig} (C : CaptureSet s) :
                        Subst (s,C) s

                        Opens a capture variable binder, substituting C for the innermost bound.

                        Equations
                        • One or more equations did not get rendered due to their size.
                        Instances For
                          def CC.Subst.unpack {s : Sig} (C : CaptureSet s) (x : Var Kind.var s) :
                          Subst (s,C,x) s

                          Opens an existential package, substituting C and x for the two innermost binders.

                          Equations
                          • One or more equations did not get rendered due to their size.
                          Instances For
                            theorem CC.Subst.funext {s1 s2 : Sig} {σ1 σ2 : Subst s1 s2} (hvar : ∀ (x : BVar s1 Kind.var), σ1.var x = σ2.var x) (htvar : ∀ (x : BVar s1 Kind.tvar), σ1.tvar x = σ2.tvar x) (hcvar : ∀ (x : BVar s1 Kind.cvar), σ1.cvar x = σ2.cvar x) :
                            σ1 = σ2

                            Function extensionality for substitutions. Two substitutions are equal if they map all variables equally.

                            def CC.Subst.comp {s1 s2 s3 : Sig} (σ1 : Subst s1 s2) (σ2 : Subst s2 s3) :
                            Subst s1 s3

                            Composition of substitutions.

                            Equations
                            • One or more equations did not get rendered due to their size.
                            Instances For
                              theorem CC.Subst.lift_there_var_eq {s1 s2 : Sig} {k : Kind} {σ : Subst s1 s2} {x : BVar s1 Kind.var} :
                              theorem CC.Subst.lift_there_tvar_eq {s1 s2 : Sig} {k : Kind} {σ : Subst s1 s2} {X : BVar s1 Kind.tvar} :
                              theorem CC.Rename.lift_there_tvar_eq {s1 s2 : Sig} {k : Kind} {f : Rename s1 s2} {x : BVar s1 Kind.tvar} :
                              f.lift.var x.there = (f.var x).there
                              theorem CC.Rename.lift_there_var_eq {s1 s2 : Sig} {k : Kind} {f : Rename s1 s2} {x : BVar s1 Kind.var} :
                              f.lift.var x.there = (f.var x).there
                              theorem CC.Subst.lift_there_cvar_eq {s1 s2 : Sig} {k : Kind} {σ : Subst s1 s2} {C : BVar s1 Kind.cvar} :
                              theorem CC.Rename.lift_there_cvar_eq {s1 s2 : Sig} {k : Kind} {f : Rename s1 s2} {C : BVar s1 Kind.cvar} :
                              f.lift.var C.there = (f.var C).there
                              theorem CC.TVar.weaken_subst_comm_liftMany {s1 K s2 : Sig} {k0 : Kind} {X : BVar (s1 ++ K) Kind.tvar} {σ : Subst s1 s2} :
                              theorem CC.Var.weaken_subst_comm_liftMany {s1 K s2 : Sig} {k0 : Kind} {x : Var Kind.var (s1 ++ K)} {σ : Subst s1 s2} :
                              theorem CC.CVar.weaken_subst_comm_liftMany {s1 K s2 : Sig} {k0 : Kind} {C : BVar (s1 ++ K) Kind.cvar} {σ : Subst s1 s2} :
                              theorem CC.CaptureSet.weaken_subst_comm_liftMany {s1 K s2 : Sig} {k0 : Kind} {cs : CaptureSet (s1 ++ K)} {σ : Subst s1 s2} :
                              theorem CC.CaptureBound.weaken_subst_comm_liftMany {s1 K s2 : Sig} {k0 : Kind} {cb : CaptureBound (s1 ++ K)} {σ : Subst s1 s2} :
                              @[irreducible]
                              theorem CC.Ty.weaken_subst_comm {sort : TySort} {s1 K s2 : Sig} {k0 : Kind} {T : Ty sort (s1 ++ K)} {σ : Subst s1 s2} :
                              theorem CC.Ty.weaken_subst_comm_base {sort : TySort} {s1 s2 : Sig} {k : Kind} {T : Ty sort s1} {σ : Subst s1 s2} :
                              theorem CC.Var.weaken_subst_comm_base {s1 s2 : Sig} {k : Kind} {x : Var Kind.var s1} {σ : Subst s1 s2} :
                              theorem CC.CVar.weaken_subst_comm_base {s1 s2 : Sig} {k : Kind} {C : BVar s1 Kind.cvar} {σ : Subst s1 s2} :
                              theorem CC.CaptureSet.weaken_subst_comm_base {s1 s2 : Sig} {k : Kind} {cs : CaptureSet s1} {σ : Subst s1 s2} :
                              theorem CC.Subst.comp_lift {s1 s2 s3 : Sig} {σ1 : Subst s1 s2} {σ2 : Subst s2 s3} {k : Kind} :
                              σ1.lift.comp σ2.lift = (σ1.comp σ2).lift

                              Composition of substitutions commutes with lifting.

                              theorem CC.Subst.comp_liftMany {s1 s2 s3 : Sig} {σ1 : Subst s1 s2} {σ2 : Subst s2 s3} {K : Sig} :
                              (σ1.liftMany K).comp (σ2.liftMany K) = (σ1.comp σ2).liftMany K

                              Composition of substitutions commutes with lifting many levels.

                              theorem CC.Var.subst_comp {s1 s2 s3 : Sig} {x : Var Kind.var s1} {σ1 : Subst s1 s2} {σ2 : Subst s2 s3} :
                              (x.subst σ1).subst σ2 = x.subst (σ1.comp σ2)

                              Substituting a composition of substitutions is the same as substituting one after the other.

                              theorem CC.CaptureSet.subst_comp {s1 s2 s3 : Sig} {cs : CaptureSet s1} {σ1 : Subst s1 s2} {σ2 : Subst s2 s3} :
                              (cs.subst σ1).subst σ2 = cs.subst (σ1.comp σ2)

                              Substitution on capture sets distributes over composition of substitutions.

                              theorem CC.CaptureBound.subst_comp {s1 s2 s3 : Sig} {cb : CaptureBound s1} {σ1 : Subst s1 s2} {σ2 : Subst s2 s3} :
                              (cb.subst σ1).subst σ2 = cb.subst (σ1.comp σ2)

                              Substitution on capture bounds distributes over composition of substitutions.

                              theorem CC.Ty.subst_comp {sort : TySort} {s1 s2 s3 : Sig} {T : Ty sort s1} {σ1 : Subst s1 s2} {σ2 : Subst s2 s3} :
                              (T.subst σ1).subst σ2 = T.subst (σ1.comp σ2)

                              Substitution on types distributes over composition of substitutions.

                              theorem CC.Exp.subst_comp {s1 s2 s3 : Sig} {e : Exp s1} {σ1 : Subst s1 s2} {σ2 : Subst s2 s3} :
                              (e.subst σ1).subst σ2 = e.subst (σ1.comp σ2)

                              Substitution on terms distributes over composition of substitutions.

                              theorem CC.Var.subst_id {s : Sig} {x : Var Kind.var s} :

                              Substituting with the identity substitution leaves a variable unchanged.

                              theorem CC.CaptureSet.subst_id {s : Sig} {cs : CaptureSet s} :

                              Substituting with the identity substitution leaves a capture set unchanged.

                              Substituting with the identity substitution leaves a capture bound unchanged.

                              theorem CC.Subst.lift_id {s : Sig} {k : Kind} :

                              Lifting the identity substitution yields the identity.

                              theorem CC.Ty.subst_id {sort : TySort} {s : Sig} {T : Ty sort s} :

                              Substituting with the identity substitution leaves a type unchanged.

                              theorem CC.Exp.subst_id {s : Sig} {e : Exp s} :

                              Substituting with the identity substitution leaves an expression unchanged.

                              def CC.Rename.asSubst {s1 s2 : Sig} (f : Rename s1 s2) :
                              Subst s1 s2

                              Converts a renaming to a substitution.

                              Equations
                              • One or more equations did not get rendered due to their size.
                              Instances For
                                theorem CC.Rename.asSubst_lift {s1 s2 : Sig} {k : Kind} {f : Rename s1 s2} :

                                Lifting a renaming and then converting to a substitution is the same as converting to a substitution and then lifting the substitution.

                                theorem CC.Var.subst_asSubst {s1 s2 : Sig} {x : Var Kind.var s1} {f : Rename s1 s2} :

                                Substituting a substitution lifted from a renaming is the same as renaming.

                                theorem CC.CaptureSet.subst_asSubst {s1 s2 : Sig} {cs : CaptureSet s1} {f : Rename s1 s2} :
                                cs.subst f.asSubst = cs.rename f

                                Substituting a substitution lifted from a renaming is the same as renaming.

                                theorem CC.CaptureBound.subst_asSubst {s1 s2 : Sig} {cb : CaptureBound s1} {f : Rename s1 s2} :
                                cb.subst f.asSubst = cb.rename f

                                Substituting a substitution lifted from a renaming is the same as renaming.

                                theorem CC.Ty.subst_asSubst {sort : TySort} {s1 s2 : Sig} {T : Ty sort s1} {f : Rename s1 s2} :

                                Substituting a substitution lifted from a renaming is the same as renaming.

                                theorem CC.Exp.subst_asSubst {s1 s2 : Sig} {e : Exp s1} {f : Rename s1 s2} :

                                Substituting a substitution lifted from a renaming is the same as renaming.

                                structure CC.Subst.IsClosed {s1 s2 : Sig} (σ : Subst s1 s2) :

                                A substitution is closed if all its images are closed.

                                Instances For
                                  def CC.Var.is_closed_subst {s1 s2 : Sig} {x : Var Kind.var s1} {σ : Subst s1 s2} (hc : x.IsClosed) (hsubst : σ.IsClosed) :

                                  Substitution preserves closedness for variables.

                                  Equations
                                  • =
                                  Instances For
                                    def CC.CaptureSet.is_closed_subst {s1 s2 : Sig} {cs : CaptureSet s1} {σ : Subst s1 s2} (hc : cs.IsClosed) (hsubst : σ.IsClosed) :
                                    (cs.subst σ).IsClosed

                                    Substitution preserves closedness for capture sets.

                                    Equations
                                    • =
                                    Instances For
                                      def CC.CaptureBound.is_closed_subst {s1 s2 : Sig} {cb : CaptureBound s1} {σ : Subst s1 s2} (hc : cb.IsClosed) (hsubst : σ.IsClosed) :
                                      (cb.subst σ).IsClosed

                                      Substitution preserves closedness for capture bounds.

                                      Equations
                                      • =
                                      Instances For
                                        theorem CC.Subst.lift_closed {s1 s2 : Sig} {k : Kind} {σ : Subst s1 s2} ( : σ.IsClosed) :

                                        Lifting preserves closedness of substitutions.

                                        def CC.Ty.is_closed_subst {sort : TySort} {s1 s2 : Sig} {T : Ty sort s1} {σ : Subst s1 s2} (hc : T.IsClosed) (hsubst : σ.IsClosed) :

                                        Substitution preserves closedness for types.

                                        Equations
                                        • =
                                        Instances For
                                          def CC.Exp.is_closed_subst {s1 s2 : Sig} {e : Exp s1} {σ : Subst s1 s2} (hc : e.IsClosed) (hsubst : σ.IsClosed) :

                                          Substitution preserves closedness for expressions.

                                          Equations
                                          • =
                                          Instances For
                                            theorem CC.Subst.openVar_is_closed {s : Sig} {z : Var Kind.var s} (hz : z.IsClosed) :

                                            The openVar substitution is closed if the variable is closed.

                                            The openTVar substitution is closed if the type is closed.

                                            The openCVar substitution is closed if the capture set is closed.

                                            theorem CC.Var.subst_closed_inv {s1 s2 : Sig} {x : Var Kind.var s1} {σ : Subst s1 s2} (hclosed : (x.subst σ).IsClosed) :

                                            If the result of substitution is closed, the original variable was closed.

                                            theorem CC.CaptureSet.subst_closed_inv {s1 s2 : Sig} {cs : CaptureSet s1} {σ : Subst s1 s2} (hclosed : (cs.subst σ).IsClosed) :

                                            If the result of substitution is closed, the original capture set was closed.

                                            theorem CC.CaptureBound.subst_closed_inv {s1 s2 : Sig} {cb : CaptureBound s1} {σ : Subst s1 s2} (hclosed : (cb.subst σ).IsClosed) :

                                            If the result of substitution is closed, the original capture bound was closed.

                                            theorem CC.Ty.subst_closed_inv {sort : TySort} {s1 s2 : Sig} {T : Ty sort s1} {σ : Subst s1 s2} (hclosed : (T.subst σ).IsClosed) :

                                            If the result of substitution is closed, the original type was closed.

                                            theorem CC.Exp.subst_closed_inv {s1 s2 : Sig} {e : Exp s1} {σ : Subst s1 s2} (hclosed : (e.subst σ).IsClosed) :

                                            If the result of substitution is closed, the original expression was closed.