Documentation

ToMathlib.PFunctor.Basic

Polynomial Functors, Lens, and Charts #

This file defines polynomial functors, lenses, and charts. The goal is to provide basic definitions, with their properties and categories defined in later files.

dt: this file is getting long and should maybe be split up more.

The zero polynomial functor, defined as A = PEmpty and B _ = PEmpty, is the identity with respect to sum (up to equivalence)

Equations

    The unit polynomial functor, defined as A = PUnit and B _ = PEmpty, is the identity with respect to product (up to equivalence)

    Equations

      The variable y polynomial functor. This is the unit for composition.

      Equations
        Instances For

          The monomial functor, also written P(X) = A X^ B, has A as its head type and the constant family B_a = B as the child type for each each shape a : A .

          Equations
            Instances For

              The monomial functor, also written P(X) = A X^ B, has A as its head type and the constant family B_a = B as the child type for each each shape a : A .

              Equations
                Instances For

                  The constant polynomial functor P(X) = A X^ PEmpty

                  Equations
                    Instances For

                      The variable (or indeterminate) polynomial functor X, defined as P(X) = PUnit X^ PUnit.

                      This is the identity with respect to tensor product and composition (up to equivalence).

                      Equations
                        Instances For

                          The linear polynomial functor P(X) = A X

                          Equations
                            Instances For

                              The self monomial polynomial functor P(X) = S X^ S

                              Equations
                                Instances For

                                  The pure power polynomial functor P(X) = X^ B

                                  Equations
                                    Instances For

                                      A polynomial functor is representable if it is equivalent to X^A for some type A.

                                      Equations
                                        Instances For
                                          def PFunctor.ofFn {A : Type uA₁} (B : AType uB) :

                                          Construct a polynomial functor from just a function B, with A derived implicitly.

                                          Equations
                                            Instances For
                                              @[simp]
                                              theorem PFunctor.ofFn_A {A : Type uA₁} (B : AType uB) :
                                              (ofFn B).A = A
                                              @[simp]
                                              theorem PFunctor.ofFn_B {A : Type uA₁} (B : AType uB) (a : A) :
                                              (ofFn B).B a = B a
                                              instance PFunctor.instIsEmptyBC {α : Type u_1} (a : α) :
                                              IsEmpty ((C α).B a)
                                              instance PFunctor.instUniqueBX {a : X.A} :
                                              Unique (X.B a)
                                              Equations
                                                instance PFunctor.instUniqueBLinear {α : Type u_1} (a : α) :
                                                Unique ((linear α).B a)
                                                Equations
                                                  Equations
                                                    @[simp]
                                                    theorem PFunctor.C_A (A : Type u) :
                                                    (C A).A = A
                                                    @[simp]
                                                    theorem PFunctor.C_B (A : Type u) (a : (C A).A) :
                                                    @[simp]
                                                    theorem PFunctor.X_B (a : X.A) :
                                                    @[simp]
                                                    theorem PFunctor.linear_A (A : Type u) :
                                                    (linear A).A = A
                                                    @[simp]
                                                    theorem PFunctor.linear_B (A : Type u) (a : (linear A).A) :
                                                    @[simp]
                                                    @[simp]
                                                    theorem PFunctor.selfMonomial_B (S : Type u) (a : (selfMonomial S).A) :
                                                    (selfMonomial S).B a = S
                                                    @[simp]
                                                    theorem PFunctor.purePower_B (B : Type u) (a : (purePower B).A) :
                                                    (purePower B).B a = B

                                                    The sum (coproduct) of two polynomial functors P and Q, written as P + Q.

                                                    Defined as the sum of the head types and the sum case analysis for the child types.

                                                    Note: requires the B universe levels to be the same.

                                                    Equations
                                                      Instances For

                                                        Addition of polynomial functors, defined as the sum construction.

                                                        Equations
                                                          theorem PFunctor.add_def (P : PFunctor.{uA₁, uB}) (Q : PFunctor.{uA₂, uB}) :
                                                          P + Q = { A := P.A Q.A, B := Sum.elim P.B Q.B }

                                                          Alias of PFunctor.sum.


                                                          The sum (coproduct) of two polynomial functors P and Q, written as P + Q.

                                                          Defined as the sum of the head types and the sum case analysis for the child types.

                                                          Note: requires the B universe levels to be the same.

                                                          Equations
                                                            Instances For

                                                              The generalized sum (sigma type) of an indexed family of polynomial functors.

                                                              Equations
                                                                Instances For

                                                                  The product of two polynomial functors P and Q, written as P * Q.

                                                                  Defined as the product of the head types and the sum of the child types.

                                                                  Equations
                                                                    Instances For

                                                                      Multiplication of polynomial functors, defined as the product construction.

                                                                      Equations

                                                                        The generalized product (pi type) of an indexed family of polynomial functors.

                                                                        Equations
                                                                          Instances For

                                                                            The tensor (also called parallel or Dirichlet) product of two polynomial functors P and Q.

                                                                            Defined as the product of the head types and the product of the child types.

                                                                            Equations
                                                                              Instances For

                                                                                Infix notation for tensor product P ⊗ Q

                                                                                Equations
                                                                                  Instances For

                                                                                    The unit for the tensor product Y

                                                                                    Equations
                                                                                      Instances For

                                                                                        Infix notation for PFunctor.comp P Q

                                                                                        Equations
                                                                                          Instances For

                                                                                            The unit for composition Y

                                                                                            Equations
                                                                                              Instances For

                                                                                                Repeated composition P ◃ P ◃ ... ◃ P (n times).

                                                                                                Equations
                                                                                                  Instances For

                                                                                                    Lift a polynomial functor P to a pair of larger universes.

                                                                                                    Equations
                                                                                                      Instances For

                                                                                                        Exponential of polynomial functors P ^ Q

                                                                                                        Equations
                                                                                                          Instances For
                                                                                                            class PFunctor.Fintype (P : PFunctor.{uA, uB}) :
                                                                                                            Type (max uA uB)

                                                                                                            A polynomial functor is finitely branching if each of its branches is a finite type.

                                                                                                            Instances
                                                                                                              instance PFunctor.instFintypeBOfFintype {P : PFunctor.{uA, uB}} [inst : P.Fintype] (a : P.A) :
                                                                                                              Fintype (P.B a)
                                                                                                              Equations
                                                                                                                class PFunctor.Inhabited (P : PFunctor.{uA, uB}) :
                                                                                                                Type (max uA uB)
                                                                                                                Instances
                                                                                                                  Equations
                                                                                                                    Instances

                                                                                                                      PFunctor where the output type is constant over an arbitrary input type.

                                                                                                                      Equations
                                                                                                                        Instances For
                                                                                                                          instance PFunctor.instFintypeOfConstOfFintype (A : Type uA) (B : Type uB) [hB : Fintype B] :
                                                                                                                          Equations
                                                                                                                            structure PFunctor.Equiv (P : PFunctor.{uA₁, uB₁}) (Q : PFunctor.{uA₂, uB₂}) :
                                                                                                                            Type (max (max (max uA₁ uA₂) uB₁) uB₂)

                                                                                                                            An equivalence between two polynomial functors P and Q, written P ≃ₚ Q, is given by an equivalence of the A types and an equivalence between the B types for each a : A.

                                                                                                                            • equivA : P.A Q.A

                                                                                                                              An equivalence between the A types

                                                                                                                            • equivB (a : P.A) : P.B a Q.B (self.equivA a)

                                                                                                                              An equivalence between the B types for each a : A

                                                                                                                            Instances For
                                                                                                                              theorem PFunctor.Equiv.ext {P : PFunctor.{uA₁, uB₁}} {Q : PFunctor.{uA₂, uB₂}} {x y : P.Equiv Q} (equivA : x.equivA = y.equivA) (equivB : x.equivB y.equivB) :
                                                                                                                              x = y

                                                                                                                              An equivalence between two polynomial functors P and Q, written P ≃ₚ Q, is given by an equivalence of the A types and an equivalence between the B types for each a : A.

                                                                                                                              Equations
                                                                                                                                Instances For

                                                                                                                                  The identity equivalence between a polynomial functor P and itself.

                                                                                                                                  Equations
                                                                                                                                    Instances For

                                                                                                                                      The inverse of an equivalence between polynomial functors.

                                                                                                                                      Equations
                                                                                                                                        Instances For

                                                                                                                                          The composition of two equivalences between polynomial functors.

                                                                                                                                          Equations
                                                                                                                                            Instances For
                                                                                                                                              def PFunctor.Equiv.cast {P Q : PFunctor.{uA, uB}} (hA : P.A = Q.A) (hB : ∀ (a : P.A), P.B a = Q.B (_root_.cast hA a)) :
                                                                                                                                              P.Equiv Q

                                                                                                                                              Equivalence between two polynomial functors P and Q that are equal.

                                                                                                                                              Equations
                                                                                                                                                Instances For
                                                                                                                                                  structure PFunctor.Lens (P : PFunctor.{uA₁, uB₁}) (Q : PFunctor.{uA₂, uB₂}) :
                                                                                                                                                  Type (max (max (max uA₁ uA₂) uB₁) uB₂)

                                                                                                                                                  A lens between two polynomial functors P and Q is a pair of a function:

                                                                                                                                                  • toFunA : P.A → Q.A
                                                                                                                                                  • toFunB : ∀ a, Q.B (toFunA a) → P.B a
                                                                                                                                                  • toFunA : P.AQ.A
                                                                                                                                                  • toFunB (a : P.A) : Q.B (self.toFunA a)P.B a
                                                                                                                                                  Instances For

                                                                                                                                                    Infix notation for constructing a lens toFunAtoFunB

                                                                                                                                                    Equations
                                                                                                                                                      Instances For
                                                                                                                                                        structure PFunctor.Chart (P : PFunctor.{uA₁, uB₁}) (Q : PFunctor.{uA₂, uB₂}) :
                                                                                                                                                        Type (max (max (max uA₁ uA₂) uB₁) uB₂)

                                                                                                                                                        A chart between two polynomial functors P and Q is a pair of a function:

                                                                                                                                                        • toFunA : P.A → Q.A
                                                                                                                                                        • toFunB : ∀ a, P.B a → Q.B (toFunA a)
                                                                                                                                                        • toFunA : P.AQ.A
                                                                                                                                                        • toFunB (a : P.A) : P.B aQ.B (self.toFunA a)
                                                                                                                                                        Instances For

                                                                                                                                                          Infix notation for constructing a chart toFunAtoFunB

                                                                                                                                                          Equations
                                                                                                                                                            Instances For
                                                                                                                                                              theorem PFunctor.ext {P Q : PFunctor.{uA, uB}} (h : P.A = Q.A) (h' : ∀ (a : P.A), P.B a = Q.B (h a)) :
                                                                                                                                                              P = Q
                                                                                                                                                              @[simp]
                                                                                                                                                              theorem PFunctor.ulift_B {P : PFunctor.{uA, uB}} {a : P.A} :
                                                                                                                                                              P.ulift.B { down := a } = ULift.{u_1, uB} (P.B a)