Documentation

DY.ALaCarte.Basic

Compute the sum of sizeOf on the t contained by Functor. This is needed to prove Representable.sizeOf_eq.

Instances
    Instances
      Instances
        @[instance_reducible]
        Equations
        @[instance_reducible]
        Equations
        • One or more equations did not get rendered due to their size.
        structure DY.ALaCarte.Ctor :

        A constructor of a functor / an inductive is characterized by the fixed types it contains, and the number of time it recurses. For example, the constructor

        | foo: Nat → String → α → α → MyFunctor α

        of a functor, or equivalently the constructor

        | foo: Nat → String → MyInductive → MyInductive → MyInductive

        of an inductive is described by the Ctor

        { Data := Nat × String nRec := 2 }

        Instances For
          @[reducible, inline]
          abbrev DY.ALaCarte.Ctors (CtorId : Type) :
          Equations
          Instances For
            structure DY.ALaCarte.FunctorRepr {CtorId : Type} (ctors : Ctors CtorId) (a : Type) :
            Instances For
              @[instance_reducible]
              noncomputable instance DY.ALaCarte.instFunctorSizeOfFunctorRepr {CtorId : Type} (ctors : Ctors CtorId) :
              Equations
              • One or more equations did not get rendered due to their size.

              A functor is "representable" when there exists a set of Ctor such that the functor is isomorphic to FunctorRepr with this set of Ctor.

              Instances
                structure DY.ALaCarte.BareContainer {CtorId : Type} (ctors : Ctors CtorId) :
                Instances For
                  @[irreducible]
                  def DY.ALaCarte.BareContainer.wf {CtorId : Type} {ctors : Ctors CtorId} (x : BareContainer ctors) :
                  Equations
                  Instances For
                    @[reducible, inline]
                    abbrev DY.ALaCarte.Container {CtorId : Type} (ctors : Ctors CtorId) :

                    Container ctors is a type that is, by construction, isomorphic to FunctorRepr ctors (Container ctors).

                    Equations
                    Instances For
                      @[reducible, inline]

                      When a functor is Representable, we can use ContainerFor as a shorthand for Container. It has the property that ContainerFor f is isomorphic to f (ContainerFor f):

                      ContainerFor f
                      

                      = Container ctors [by unfolding ContainerFor] ≅ FunctorRepr ctors (Container ctors) [by property of Container] = FunctorRepr ctors (ContainerFor f) [by refolding ContainerFor] ≅ f (ContainerFor f) [by f being Representable]

                      Equations
                      Instances For
                        structure DY.ALaCarte.FunctorUnion {a : Type} (Functors : aTypeType) (t : Type) :

                        When we have a collection of functors, we can create the union using FunctorUnion. Such an union is representable, and each functor will then be a sub-functor of this union.

                        • id : a
                        • val : Functors self.id t
                        Instances For
                          structure DY.ALaCarte.FunctorUnion.CtorId {a : Type} (Functors : aTypeType) [(id : a) → FunctorSizeOf (Functors id)] [(id : a) → Representable (Functors id)] :
                          Instances For
                            @[instance_reducible]
                            instance DY.ALaCarte.instFunctorSizeOfFunctorUnion {a : Type} (Functors : aTypeType) [(id : a) → FunctorSizeOf (Functors id)] :
                            Equations
                            @[instance_reducible]
                            instance DY.ALaCarte.instRepresentableFunctorUnion {a : Type} (Functors : aTypeType) [(id : a) → FunctorSizeOf (Functors id)] [(id : a) → Representable (Functors id)] :
                            Equations
                            • One or more equations did not get rendered due to their size.
                            @[instance_reducible]
                            instance DY.ALaCarte.instSubFunctorFunctorUnionOfDecidableEq {a : Type} [DecidableEq a] (Functors : aTypeType) [(id : a) → FunctorSizeOf (Functors id)] (id : a) :
                            SubFunctor (Functors id) (FunctorUnion Functors)
                            Equations
                            • One or more equations did not get rendered due to their size.
                            theorem DY.ALaCarte.Container.pack_view (f : TypeType) {g : TypeType} [FunctorSizeOf f] [FunctorSizeOf g] [SubFunctorTC f g] [Representable g] (x : ContainerFor g) :
                            match view f x with | none => True | some y => pack f y = x
                            @[reducible, inline]
                            Equations
                            • One or more equations did not get rendered due to their size.
                            Instances For
                              @[reducible, inline]
                              Equations
                              Instances For
                                @[irreducible]
                                def DY.ALaCarte.Container.rec {f : TypeType} [FunctorSizeOf f] [Representable f] {motive : ContainerFor fSort u} (pf : PartialFunDep f motive) (x : ContainerFor f) :
                                motive x

                                Generic recursion principle on Container. This allows to define functions, predicates, and to do proofs.

                                Equations
                                • One or more equations did not get rendered due to their size.
                                Instances For
                                  Instances
                                    Instances
                                      theorem DY.ALaCarte.Container.rec_eq {f g : TypeType} [FunctorSizeOf f] [FunctorSizeOf g] [SubFunctorTC f g] [Representable g] {a : Type} (partialFun : PartialFun f g a) (totalFun : PartialFun g g a) [SubPartialFunTC partialFun totalFun] (x : f (ContainerFor g)) :
                                      rec totalFun (pack f x) = partialFun x fun (y : ContainerFor g) (x : sizeOf y FunctorSizeOf.sizeOf x) => rec totalFun y
                                      def DY.ALaCarte.Container.PartialFun.combine {t : Type} [DecidableEq t] {functors : tTypeType} [(id : t) → FunctorSizeOf (functors id)] {g : TypeType} [FunctorSizeOf g] [Representable g] {a : Type} (funs : (id : t) → PartialFun (functors id) g a) :
                                      PartialFun (FunctorUnion functors) g a
                                      Equations
                                      Instances For
                                        def DY.ALaCarte.Container.PartialFunDep.combine {t : Type} [DecidableEq t] {functors : tTypeType} [(id : t) → FunctorSizeOf (functors id)] {g : TypeType} [FunctorSizeOf g] [Representable g] [SubFunctorTC (FunctorUnion functors) g] {motive : ContainerFor gSort u} (funs : (id : t) → PartialFunDep (functors id) motive) :
                                        PartialFunDep (FunctorUnion functors) motive
                                        Equations
                                        Instances For
                                          instance DY.ALaCarte.instSubPartialFunFunctorUnionCombine {t : Type} [DecidableEq t] {functors : tTypeType} [(id : t) → FunctorSizeOf (functors id)] {g : TypeType} [FunctorSizeOf g] [Representable g] {a : Type} (funs : (id : t) → Container.PartialFun (functors id) g a) (id : t) :
                                          def DY.ALaCarte.Container.PartialProof1 {f g : TypeType} [FunctorSizeOf f] [FunctorSizeOf g] [Representable g] {a : Type} (fn : PartialFun f g a) (rec : ContainerFor ga) (p : aProp) :

                                          Helper to write a modular proof on one modular function

                                          Equations
                                          • One or more equations did not get rendered due to their size.
                                          Instances For
                                            theorem DY.ALaCarte.Container.PartialProof1.into {f : TypeType} [FunctorSizeOf f] [Representable f] {a : Type} {fn : PartialFun f f a} {p : aProp} (pf : PartialProof1 fn (rec fn) p) :
                                            PartialFunDep f fun (x : ContainerFor f) => p (rec fn x)
                                            theorem DY.ALaCarte.Container.PartialProof1.combine {t : Type} [DecidableEq t] {functors : tTypeType} [(id : t) → FunctorSizeOf (functors id)] {g : TypeType} [FunctorSizeOf g] [Representable g] {a : Type} {rec : ContainerFor ga} {p : aProp} {funs : (id : t) → PartialFun (functors id) g a} (pfs : ∀ (id : t), PartialProof1 (funs id) rec p) :
                                            def DY.ALaCarte.Container.PartialProof2 {f g : TypeType} [FunctorSizeOf f] [FunctorSizeOf g] [Representable g] {a b : Type} (fn1 : PartialFun f g a) (fn2 : PartialFun f g b) (rec1 : ContainerFor ga) (rec2 : ContainerFor gb) (p : a × bProp) :

                                            Helper to write a modular proof on two modular functions

                                            Equations
                                            • One or more equations did not get rendered due to their size.
                                            Instances For
                                              theorem DY.ALaCarte.Container.PartialProof2.into {f : TypeType} [FunctorSizeOf f] [Representable f] {a b : Type} {fn1 : PartialFun f f a} {fn2 : PartialFun f f b} {p : a × bProp} (pf : PartialProof2 fn1 fn2 (rec fn1) (rec fn2) p) :
                                              PartialFunDep f fun (x : ContainerFor f) => p (rec fn1 x, rec fn2 x)
                                              theorem DY.ALaCarte.Container.PartialProof2.combine {t : Type} [DecidableEq t] {functors : tTypeType} [(id : t) → FunctorSizeOf (functors id)] {g : TypeType} [FunctorSizeOf g] [Representable g] {a b : Type} {rec1 : ContainerFor ga} {rec2 : ContainerFor gb} {p : a × bProp} {funs1 : (id : t) → PartialFun (functors id) g a} {funs2 : (id : t) → PartialFun (functors id) g b} (pfs : ∀ (id : t), PartialProof2 (funs1 id) (funs2 id) rec1 rec2 p) :