Documentation

Cslib.Foundations.Data.PFunctor.Basic

Polynomial Functors #

Definitions of common PFunctor constructions:

Special cases C, linear, selfMonomial, purePower, the indeterminate y, and canonical choices of 0 and 1 are defined as abbreviations or instances over monomial. The scoped notations A y^ B and y^ B denote monomial A B and purePower B, respectively.

The child-map API includes const, Unary, and DecidableEqChildren.

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

Two polynomial functors are equal if their head types are equal and their child types agree over that equality.

def PFunctor.const {α : Sort u_1} {P : PFunctor.{u_2, u_3}} (a : P.A) (x : α) :
P.B a → α

The constant child map for a.

Equations
Instances For
    @[simp]
    theorem PFunctor.const_apply {α : Sort u_1} {P : PFunctor.{u_2, u_3}} (a : P.A) (x : α) (i : P.B a) :
    const a x i = x
    @[reducible, inline]
    abbrev PFunctor.monomial (A : Type uA) (B : Type uB) :

    The monomial PFunctor with head type A and constant B for any a : A.

    Equations
    Instances For

      The monomial PFunctor with head type A and constant B for any a : A.

      Equations
      Instances For
        theorem PFunctor.monomial_A (A : Type uA) (B : Type uB) :
        (monomial A B).A = A
        theorem PFunctor.monomial_B (A : Type uA) (B : Type uB) (a : (monomial A B).A) :
        (monomial A B).B a = B
        @[instance_reducible]

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

        Equations
        @[instance_reducible]

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

        Equations
        @[simp]
        @[instance_reducible]
        Equations
        instance PFunctor.instIsEmptyOneB (a : A 1) :
        IsEmpty (B 1 a)
        @[reducible, inline]

        The constant polynomial functor P(y) = A y^ PEmpty = A.

        Equations
        Instances For
          @[reducible, inline]

          The linear polynomial functor P(y) = A y.

          Equations
          Instances For
            @[reducible, inline]

            The self-monomial polynomial functor P(y) = S y^ S.

            Equations
            Instances For
              @[reducible, inline]

              The pure-power polynomial functor y^ B, representable on B.

              Equations
              Instances For

                The pure-power polynomial functor y^ B, representable on B.

                Equations
                Instances For
                  @[reducible, inline]

                  The indeterminate polynomial functor P(y) = y, the identity with respect to composition and tensor product (up to equivalence).

                  Equations
                  Instances For
                    @[implicit_reducible]

                    The sum of two polynomial functors P and Q, written as P + Q, defined as the sum of the head types and the dependent sum recursor for the child types.

                    The child universes must agree. The named spelling P.add Q can elaborate in contexts where P + Q fails to infer universes, such as under PFunctor.W; see CslibTests.PFunctor.

                    Equations
                    Instances For
                      @[simp]
                      theorem PFunctor.hAdd_B (P : PFunctor.{uA₁, uB}) (Q : PFunctor.{uA₂, uB}) (t : P.A ⊕ Q.A) :
                      (P + Q).B t = Sum.rec P.B Q.B t
                      @[simp]
                      @[implicit_reducible]

                      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
                        @[simp]
                        theorem PFunctor.hMul_B (P : PFunctor.{uA₁, uB₁}) (Q : PFunctor.{uA₂, uB₂}) (ab : P.A × Q.A) :
                        (P * Q).B ab = (P.B ab.1 ⊕ Q.B ab.2)
                        class PFunctor.Unary (P : PFunctor.{u_1, u_2}) :
                        Type (max u_1 u_2)

                        A polynomial functor is unary if all child types have exactly one element.

                        Instances
                          theorem PFunctor.Unary.fun_eq_const {P : PFunctor.{u_1, u_2}} {α : Sort u_3} [P.Unary] (a : P.A) (f : P.B a → α) :
                          f = fun (x : P.B a) => f default

                          A polynomial functor has children with decidable equality.

                          Instances
                            @[instance_reducible]

                            A unary polynomial functor has decidable child equality.

                            Equations
                            @[reducible, inline]

                            Constructs a unary polynomial functor.

                            Equations
                            Instances For
                              @[instance_reducible]
                              instance PFunctor.instUnaryLinear (A : Type uA) :
                              Equations