Documentation

Mathlib.Data.QPF.Univariate.Basic

Quotients of Polynomial Functors #

We assume the following:

We define:

The main goal is to construct:

We also show that the composition of qpfs is a qpf, and that the quotient of a qpf is a qpf.

The present theory focuses on the univariate case for qpfs

References #

class QPF (F : Type u β†’ Type v) extends Functor F :
Type (max (max (u + 1) (u' + 1)) v)

Quotients of polynomial functors.

Roughly speaking, saying that F is a quotient of a polynomial functor means that for each α, elements of F α are represented by pairs ⟨a, f⟩, where a is the shape of the object and f indexes the relevant elements of α, in a suitably natural manner.

  • map {Ξ± Ξ² : Type u} : (Ξ± β†’ Ξ²) β†’ F Ξ± β†’ F Ξ²
  • mapConst {Ξ± Ξ² : Type u} : Ξ± β†’ F Ξ² β†’ F Ξ±
  • abs {Ξ± : Type u} : ↑(P F) Ξ± β†’ F Ξ±
  • repr {Ξ± : Type u} : F Ξ± β†’ ↑(P F) Ξ±
  • abs_repr {Ξ± : Type u} (x : F Ξ±) : abs (repr x) = x
  • abs_map {Ξ± Ξ² : Type u} (f : Ξ± β†’ Ξ²) (p : ↑(P F) Ξ±) : abs ((P F).map f p) = f <$> abs p
Instances
    theorem QPF.id_map {F : Type u β†’ Type v} [q : QPF F] {Ξ± : Type u} (x : F Ξ±) :
    id <$> x = x
    theorem QPF.comp_map {F : Type u β†’ Type v} [q : QPF F] {Ξ± Ξ² Ξ³ : Type u} (f : Ξ± β†’ Ξ²) (g : Ξ² β†’ Ξ³) (x : F Ξ±) :
    (g ∘ f) <$> x = g <$> f <$> x
    theorem QPF.lawfulFunctor {F : Type u β†’ Type v} [q : QPF F] (h : βˆ€ (Ξ± Ξ² : Type u), Functor.mapConst = Functor.map ∘ Function.const Ξ²) :
    LawfulFunctor F
    theorem QPF.liftp_iff {F : Type u β†’ Type v} [q : QPF F] {Ξ± : Type u} (p : Ξ± β†’ Prop) (x : F Ξ±) :
    Functor.Liftp p x ↔ βˆƒ (a : (P F).A) (f : (P F).B a β†’ Ξ±), x = abs ⟨a, f⟩ ∧ βˆ€ (i : (P F).B a), p (f i)
    theorem QPF.liftp_iff' {F : Type u β†’ Type v} [q : QPF F] {Ξ± : Type u} (p : Ξ± β†’ Prop) (x : F Ξ±) :
    Functor.Liftp p x ↔ βˆƒ (u : ↑(P F) Ξ±), abs u = x ∧ βˆ€ (i : (P F).B u.fst), p (u.snd i)
    theorem QPF.liftr_iff {F : Type u β†’ Type v} [q : QPF F] {Ξ± : Type u} (r : Ξ± β†’ Ξ± β†’ Prop) (x y : F Ξ±) :
    Functor.Liftr r x y ↔ βˆƒ (a : (P F).A) (fβ‚€ : (P F).B a β†’ Ξ±) (f₁ : (P F).B a β†’ Ξ±), x = abs ⟨a, fβ‚€βŸ© ∧ y = abs ⟨a, fβ‚βŸ© ∧ βˆ€ (i : (P F).B a), r (fβ‚€ i) (f₁ i)
    def QPF.recF {F : Type u β†’ Type v} [q : QPF F] {Ξ± : Type u} (g : F Ξ± β†’ Ξ±) :
    (P F).W β†’ Ξ±

    does recursion on q.P.W using g : F Ξ± β†’ Ξ± rather than g : P Ξ± β†’ Ξ±

    Instances For
      theorem QPF.recF_eq {F : Type u β†’ Type v} [q : QPF F] {Ξ± : Type u} (g : F Ξ± β†’ Ξ±) (x : (P F).W) :
      recF g x = g (abs ((P F).map (recF g) x.dest))
      theorem QPF.recF_eq' {F : Type u β†’ Type v} [q : QPF F] {Ξ± : Type u} (g : F Ξ± β†’ Ξ±) (a : (P F).A) (f : (P F).B a β†’ (P F).W) :
      recF g (WType.mk a f) = g (abs ((P F).map (recF g) ⟨a, f⟩))
      inductive QPF.Wequiv {F : Type u β†’ Type v} [q : QPF F] :
      (P F).W β†’ (P F).W β†’ Prop

      two trees are equivalent if their F-abstractions are

      Instances For
        theorem QPF.recF_eq_of_Wequiv {F : Type u β†’ Type v} [q : QPF F] {Ξ± : Type u} (u : F Ξ± β†’ Ξ±) (x y : (P F).W) :
        Wequiv x y β†’ recF u x = recF u y

        recF is insensitive to the representation

        theorem QPF.Wequiv.abs' {F : Type u β†’ Type v} [q : QPF F] (x y : (P F).W) (h : QPF.abs x.dest = QPF.abs y.dest) :
        Wequiv x y
        theorem QPF.Wequiv.refl {F : Type u β†’ Type v} [q : QPF F] (x : (P F).W) :
        Wequiv x x
        theorem QPF.Wequiv.symm {F : Type u β†’ Type v} [q : QPF F] (x y : (P F).W) :
        Wequiv x y β†’ Wequiv y x
        def QPF.Wrepr {F : Type u β†’ Type v} [q : QPF F] :
        (P F).W β†’ (P F).W

        maps every element of the W type to a canonical representative

        Instances For
          theorem QPF.Wrepr_equiv {F : Type u β†’ Type v} [q : QPF F] (x : (P F).W) :
          @[implicit_reducible]
          def QPF.Wsetoid {F : Type u β†’ Type v} [q : QPF F] :
          Setoid (P F).W

          Define the fixed point as the quotient of trees under the equivalence relation Wequiv.

          Instances For
            def QPF.Fix (F : Type u β†’ Type u) [q : QPF F] :

            inductive type defined as initial algebra of a Quotient of Polynomial Functor

            Instances For
              def QPF.Fix.rec {F : Type u β†’ Type u} [q : QPF F] {Ξ± : Type u} (g : F Ξ± β†’ Ξ±) :
              Fix F β†’ Ξ±

              recursor of a type defined by a qpf

              Instances For
                def QPF.fixToW {F : Type u β†’ Type u} [q : QPF F] :
                Fix F β†’ (P F).W

                access the underlying W-type of a fixpoint data type

                Instances For
                  def QPF.Fix.mk {F : Type u β†’ Type u} [q : QPF F] (x : F (Fix F)) :
                  Fix F

                  constructor of a type defined by a qpf

                  Instances For
                    def QPF.Fix.dest {F : Type u β†’ Type u} [q : QPF F] :
                    Fix F β†’ F (Fix F)

                    destructor of a type defined by a qpf

                    Instances For
                      theorem QPF.Fix.rec_eq {F : Type u β†’ Type u} [q : QPF F] {Ξ± : Type u} (g : F Ξ± β†’ Ξ±) (x : F (Fix F)) :
                      rec g (mk x) = g (rec g <$> x)
                      theorem QPF.Fix.ind_aux {F : Type u β†’ Type u} [q : QPF F] (a : (P F).A) (f : (P F).B a β†’ (P F).W) :
                      mk (abs ⟨a, fun (x : (P F).B a) => ⟦f x⟧⟩) = ⟦WType.mk a f⟧
                      theorem QPF.Fix.ind_rec {F : Type u β†’ Type u} [q : QPF F] {Ξ± : Type u} (g₁ gβ‚‚ : Fix F β†’ Ξ±) (h : βˆ€ (x : F (Fix F)), g₁ <$> x = gβ‚‚ <$> x β†’ g₁ (mk x) = gβ‚‚ (mk x)) (x : Fix F) :
                      g₁ x = gβ‚‚ x
                      theorem QPF.Fix.rec_unique {F : Type u β†’ Type u} [q : QPF F] {Ξ± : Type u} (g : F Ξ± β†’ Ξ±) (h : Fix F β†’ Ξ±) (hyp : βˆ€ (x : F (Fix F)), h (mk x) = g (h <$> x)) :
                      rec g = h
                      theorem QPF.Fix.mk_dest {F : Type u β†’ Type u} [q : QPF F] (x : Fix F) :
                      mk x.dest = x
                      theorem QPF.Fix.dest_mk {F : Type u β†’ Type u} [q : QPF F] (x : F (Fix F)) :
                      (mk x).dest = x
                      theorem QPF.Fix.ind {F : Type u β†’ Type u} [q : QPF F] (p : Fix F β†’ Prop) (h : βˆ€ (x : F (Fix F)), Functor.Liftp p x β†’ p (mk x)) (x : Fix F) :
                      p x
                      def QPF.corecF {F : Type u β†’ Type u} [q : QPF F] {Ξ± : Type u} (g : Ξ± β†’ F Ξ±) :
                      Ξ± β†’ (P F).M

                      does recursion on q.P.M using g : Ξ± β†’ F Ξ± rather than g : Ξ± β†’ P Ξ±

                      Instances For
                        theorem QPF.corecF_eq {F : Type u β†’ Type u} [q : QPF F] {Ξ± : Type u} (g : Ξ± β†’ F Ξ±) (x : Ξ±) :
                        (corecF g x).dest = (P F).map (corecF g) (repr (g x))
                        def QPF.IsPrecongr {F : Type u β†’ Type u} [q : QPF F] (r : (P F).M β†’ (P F).M β†’ Prop) :

                        A pre-congruence on q.P.M viewed as an F-coalgebra. Not necessarily symmetric.

                        Instances For
                          def QPF.Mcongr {F : Type u β†’ Type u} [q : QPF F] :
                          (P F).M β†’ (P F).M β†’ Prop

                          The maximal congruence on q.P.M.

                          Instances For
                            def QPF.Cofix (F : Type u β†’ Type u) [q : QPF F] :

                            coinductive type defined as the final coalgebra of a qpf

                            Instances For
                              @[implicit_reducible]
                              instance QPF.instInhabitedCofixOfAP {F : Type u β†’ Type u} [q : QPF F] [Inhabited (P F).A] :
                              Inhabited (Cofix F)
                              def QPF.Cofix.corec {F : Type u β†’ Type u} [q : QPF F] {Ξ± : Type u} (g : Ξ± β†’ F Ξ±) (x : Ξ±) :

                              corecursor for type defined by Cofix

                              Instances For
                                def QPF.Cofix.dest {F : Type u β†’ Type u} [q : QPF F] :
                                Cofix F β†’ F (Cofix F)

                                destructor for type defined by Cofix

                                Instances For
                                  theorem QPF.Cofix.dest_corec {F : Type u β†’ Type u} [q : QPF F] {Ξ± : Type u} (g : Ξ± β†’ F Ξ±) (x : Ξ±) :
                                  (corec g x).dest = corec g <$> g x
                                  theorem QPF.Cofix.bisim_rel {F : Type u β†’ Type u} [q : QPF F] (r : Cofix F β†’ Cofix F β†’ Prop) (h : βˆ€ (x y : Cofix F), r x y β†’ Quot.mk r <$> x.dest = Quot.mk r <$> y.dest) (x y : Cofix F) :
                                  r x y β†’ x = y
                                  theorem QPF.Cofix.bisim {F : Type u β†’ Type u} [q : QPF F] (r : Cofix F β†’ Cofix F β†’ Prop) (h : βˆ€ (x y : Cofix F), r x y β†’ Functor.Liftr r x.dest y.dest) (x y : Cofix F) :
                                  r x y β†’ x = y
                                  theorem QPF.Cofix.bisim' {F : Type u β†’ Type u} [q : QPF F] {Ξ± : Type u_1} (Q : Ξ± β†’ Prop) (u v : Ξ± β†’ Cofix F) (h : βˆ€ (x : Ξ±), Q x β†’ βˆƒ (a : (P F).A) (f : (P F).B a β†’ Cofix F) (f' : (P F).B a β†’ Cofix F), (u x).dest = abs ⟨a, f⟩ ∧ (v x).dest = abs ⟨a, f'⟩ ∧ βˆ€ (i : (P F).B a), βˆƒ (x' : Ξ±), Q x' ∧ f i = u x' ∧ f' i = v x') (x : Ξ±) :
                                  Q x β†’ u x = v x
                                  @[implicit_reducible]
                                  def QPF.comp {Fβ‚‚ : Type u β†’ Type u} [qβ‚‚ : QPF Fβ‚‚] {F₁ : Type u β†’ Type u} [q₁ : QPF F₁] :
                                  QPF (Functor.Comp Fβ‚‚ F₁)

                                  composition of qpfs gives another qpf

                                  Instances For
                                    @[implicit_reducible]
                                    def QPF.quotientQPF {F : Type u β†’ Type u} [q : QPF F] {G : Type u β†’ Type u} [Functor G] {FG_abs : {Ξ± : Type u} β†’ F Ξ± β†’ G Ξ±} {FG_repr : {Ξ± : Type u} β†’ G Ξ± β†’ F Ξ±} (FG_abs_repr : βˆ€ {Ξ± : Type u} (x : G Ξ±), FG_abs (FG_repr x) = x) (FG_abs_map : βˆ€ {Ξ± Ξ² : Type u} (f : Ξ± β†’ Ξ²) (x : F Ξ±), FG_abs (f <$> x) = f <$> FG_abs x) :
                                    QPF G

                                    Given a qpf F and a well-behaved surjection FG_abs from F Ξ± to functor G Ξ±, G is a qpf. We can consider G a quotient on F where elements x y : F Ξ± are in the same equivalence class if FG_abs x = FG_abs y.

                                    Instances For
                                      theorem QPF.mem_supp {F : Type u β†’ Type u} [q : QPF F] {Ξ± : Type u} (x : F Ξ±) (u : Ξ±) :
                                      u ∈ Functor.supp x ↔ βˆ€ (a : (P F).A) (f : (P F).B a β†’ Ξ±), abs ⟨a, f⟩ = x β†’ u ∈ f '' Set.univ
                                      theorem QPF.supp_eq {F : Type u β†’ Type u} [q : QPF F] {Ξ± : Type u} (x : F Ξ±) :
                                      Functor.supp x = {u : Ξ± | βˆ€ (a : (P F).A) (f : (P F).B a β†’ Ξ±), abs ⟨a, f⟩ = x β†’ u ∈ f '' Set.univ}
                                      theorem QPF.has_good_supp_iff {F : Type u β†’ Type u} [q : QPF F] {Ξ± : Type u} (x : F Ξ±) :
                                      (βˆ€ (p : Ξ± β†’ Prop), Functor.Liftp p x ↔ βˆ€ u ∈ Functor.supp x, p u) ↔ βˆƒ (a : (P F).A) (f : (P F).B a β†’ Ξ±), abs ⟨a, f⟩ = x ∧ βˆ€ (a' : (P F).A) (f' : (P F).B a' β†’ Ξ±), abs ⟨a', f'⟩ = x β†’ f '' Set.univ βŠ† f' '' Set.univ
                                      def QPF.IsUniform {F : Type u β†’ Type u} [q : QPF F] :

                                      A qpf is said to be uniform if every polynomial functor representing a single value all have the same range.

                                      Instances For
                                        def QPF.LiftpPreservation {F : Type u β†’ Type u} [q : QPF F] :

                                        does abs preserve Liftp?

                                        Instances For
                                          def QPF.SuppPreservation {F : Type u β†’ Type u} [q : QPF F] :

                                          does abs preserve supp?

                                          Instances For
                                            theorem QPF.supp_eq_of_isUniform {F : Type u β†’ Type u} [q : QPF F] (h : IsUniform) {Ξ± : Type u} (a : (P F).A) (f : (P F).B a β†’ Ξ±) :
                                            Functor.supp (abs ⟨a, f⟩) = f '' Set.univ
                                            theorem QPF.liftp_iff_of_isUniform {F : Type u β†’ Type u} [q : QPF F] (h : IsUniform) {Ξ± : Type u} (x : F Ξ±) (p : Ξ± β†’ Prop) :
                                            Functor.Liftp p x ↔ βˆ€ u ∈ Functor.supp x, p u
                                            theorem QPF.supp_map {F : Type u β†’ Type u} [q : QPF F] (h : IsUniform) {Ξ± Ξ² : Type u} (g : Ξ± β†’ Ξ²) (x : F Ξ±) :