Documentation

GaudisCrypt.Attic.TypedModules

Module context typing: Types of a given module contexts; just a list of module types

Instances For

    Pointer into a module context; type safe for a given module context typing

    Instances For

      Note: lives in GaudisCrypt.TypedModules, not in GaudisCrypt.HoleSigs, so that it does not clash with GaudisCrypt.HoleSigs.toModuleTypeRepTuple from Language/ModuleExpressions.lean (same name, different ModuleTypeRep). Dot notation on a HoleSigs therefore does not find it; write HoleSigs.toModuleTypeRepTuple holes.

      Equations
      Instances For

        ModuleExpression Γ T is the type of all module expressions that are well-typed in module contexts of type Γ and have type T.

        Instances For
          Equations
          Instances For
            Equations
            Instances For
              Equations
              Instances For
                Equations
                Instances For

                  IsProcTuple m holds when m is a right-nested tuple of hole-free procedures: either .proc _, or .pair (.proc _) rest with IsProcTuple rest. These are exactly the ground arguments a procedure-with-holes can be instantiated with (the module-level analogue of STLC BasicTerms).

                  Equations
                  Instances For
                    @[implicit_reducible]
                    Equations
                    Equations
                    Instances For

                      Beta-normal form: no beta-redex anywhere in the term.

                      Instances For

                        Neutral form: no outermost redex. Either the head is a variable, or it is a procedure-with-holes applied to a normal argument that is not a proc-tuple (so the δ-rule cannot fire) — both are stuck. Neutral f in app rules out app (abs ..) ... Neutral e in fst/snd rules out fst (pair ..) / snd (pair ..).

                        Instances For

                          Beta-normal form for closed terms (empty context). Neutral terms cannot occur (they would require a variable in the empty context), so this has fewer cases than Normal. The abs body is in a one-variable context and therefore still uses the general Normal.

                          Instances For

                            Extends a renaming ρ : ModuleContextIdx Δ → ModuleContextIdx Γ to work under one binder of type A. The bound variable .zero maps to itself; outer variables .succ r are renamed by ρ and re-wrapped with .succ. This is the typed analogue of incrementing the cutoff c in Pierce's shift operation.

                            Equations
                            Instances For

                              Applies a renaming ρ : ModuleContextIdx Δ → ModuleContextIdx Γ to every variable in a term, producing a term over context Γ. Goes under binders by lifting ρ with liftRename. This is the typed analogue of Pierce's shift ↑_c^d, where ρ encodes both the cutoff c and the displacement d.

                              Equations
                              Instances For

                                Extends a simultaneous substitution σ : ModuleContextIdx Δ → ModuleExpression Γ to work under one binder of type A, yielding a substitution ModuleContextIdx (Δ,A) → ModuleExpression (Γ,A). The bound variable .zero maps to the fresh variable .var .zero; outer variables .succ r are substituted by σ r and then weakened into the extended context Γ,A by renaming with .succ.

                                Equations
                                Instances For

                                  The single-variable substitution map used as the σ argument to substSimultaneous: de Bruijn index 0 (the outermost bound variable) maps to arg; any other index k+1 maps back to the variable at index k.

                                  Equations
                                  Instances For

                                    Single-variable de Bruijn substitution: replaces de Bruijn index 0 in body with arg. Implemented via substSimultaneous with the point substitution substVar arg.

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

                                      Convert a HoleSigs.Instantiation into the corresponding module-expression tuple.

                                      Like HoleSigs.toModuleTypeRepTuple, this lives in GaudisCrypt.TypedModules rather than in GaudisCrypt.HoleSigs, so dot notation on an Instantiation does not find it.

                                      Equations
                                      Instances For

                                        Non-deterministic single-step reduction: all possible one-step reductions.

                                        Instances For
                                          theorem GaudisCrypt.TypedModules.multiStepReduction_app {Γ : ModuleContext} {T U : ModuleTypeRep} {m1 m1' : ModuleExpression Γ (T.arr U)} {m2 m2' : ModuleExpression Γ T} (h1 : MultiStepReduction m1 m1') (h2 : MultiStepReduction m2 m2') :
                                          MultiStepReduction (m1.app m2) (m1'.app m2')

                                          Inverse of HoleSigs.Instantiation.toModuleTuple: extract a Procedure for each hole index from a ModuleExpression that is a right-nested tuple of procedures (IsProcTuple).

                                          Equations
                                          Instances For

                                            Round-trip: converting a proc-tuple back to an instantiation and then to a tuple recovers the original expression.

                                            theorem GaudisCrypt.TypedModules.ModuleExpression.erasedEqual_normal_neutral_eq {Γ : ModuleContext} {T1 T2 : ModuleTypeRep} (m : ModuleExpression Γ T1) (m' : ModuleExpression Γ T2) (h : m.erasedEqual m') :
                                            (Normal m → T1 = T2 → m ≍ m') ∧ (Neutral m → T1 = T2 ∧ m ≍ m')
                                            @[simp]
                                            @[implicit_reducible]
                                            Equations
                                            • One or more equations did not get rendered due to their size.
                                            Equations
                                            Instances For
                                              @[simp]
                                              theorem GaudisCrypt.TypedModules.Module.fst_pair' {T U : ModuleTypeRep} (m1 : Module T) (m2 : Module U) :
                                              (m1.pair' m2).fst' = m1
                                              @[simp]
                                              theorem GaudisCrypt.TypedModules.Module.snd_pair' {T U : ModuleTypeRep} (m1 : Module T) (m2 : Module U) :
                                              (m1.pair' m2).snd' = m2
                                              Instances
                                                @[reducible]
                                                Equations
                                                @[implicit_reducible]
                                                Equations
                                                • One or more equations did not get rendered due to their size.
                                                Equations
                                                Instances For
                                                  def GaudisCrypt.TypedModules.Module.app {M N : Type 1} [iM : IsModule M] [iN : IsModule N] (m : Arr M N) (m' : M) :
                                                  N
                                                  Equations
                                                  Instances For
                                                    theorem GaudisCrypt.TypedModules.Module.cast_app {M N : Type 1} [IsModule M] [IsModule N] (a : Arr M N) (b : M) :
                                                    cast N (app a b) = (cast (Arr M N) a).app' (cast M b)
                                                    @[implicit_reducible]
                                                    Equations
                                                    • One or more equations did not get rendered due to their size.
                                                    def GaudisCrypt.TypedModules.Module.fst {M N : Type 1} [iM : IsModule M] [iN : IsModule N] (m : Prod M N) :
                                                    M
                                                    Equations
                                                    Instances For
                                                      def GaudisCrypt.TypedModules.Module.snd {M N : Type 1} [iM : IsModule M] [iN : IsModule N] (m : Prod M N) :
                                                      N
                                                      Equations
                                                      Instances For
                                                        def GaudisCrypt.TypedModules.Module.pair {M N : Type 1} [iM : IsModule M] [iN : IsModule N] (m1 : M) (m2 : N) :
                                                        Prod M N
                                                        Equations
                                                        Instances For
                                                          @[simp]
                                                          theorem GaudisCrypt.TypedModules.Module.fst_pair {M N : Type 1} [IsModule M] [IsModule N] (m1 : M) (m2 : N) :
                                                          fst (pair m1 m2) = m1
                                                          @[simp]
                                                          theorem GaudisCrypt.TypedModules.Module.snd_pair {M N : Type 1} [IsModule M] [IsModule N] (m1 : M) (m2 : N) :
                                                          snd (pair m1 m2) = m2
                                                          Equations
                                                          • One or more equations did not get rendered due to their size.
                                                          Instances For