Documentation

Mathlib.Data.QPF.Multivariate.Constructions.Fix

The initial algebra of a multivariate qpf is again a qpf. #

For an (n+1)-ary QPF F (α₀,..,αₙ), we take the least fixed point of F with regards to its last argument αₙ. The result is an n-ary functor: Fix F (α₀,..,αₙ₋₁). Making Fix F into a functor allows us to take the fixed point, compose with other functors and take a fixed point again.

Main definitions #

Implementation notes #

For F a QPF, we define Fix F α in terms of the W-type of the polynomial functor P of F. We define the relation WEquiv and take its quotient as the definition of Fix F α.

See [avigad-carneiro-hudon2019] for more details.

Reference #

def MvQPF.recF {n : } {F : TypeVec.{u} (n + 1)Type u} [q : MvQPF F] {α : TypeVec.{u} n} {β : Type u} (g : F (α ::: β)β) :
(P F).W αβ

recF is used as a basis for defining the recursor on Fix F α. recF traverses recursively the W-type generated by q.P using a function on F as a recursive step

Equations
    Instances For
      theorem MvQPF.recF_eq {n : } {F : TypeVec.{u} (n + 1)Type u} [q : MvQPF F] {α : TypeVec.{u} n} {β : Type u} (g : F (α ::: β)β) (a : (P F).A) (f' : ((P F).drop.B a).Arrow α) (f : (P F).last.B a(P F).W α) :
      recF g ((P F).wMk a f' f) = g (abs a, TypeVec.splitFun f' (recF g f))
      theorem MvQPF.recF_eq' {n : } {F : TypeVec.{u} (n + 1)Type u} [q : MvQPF F] {α : TypeVec.{u} n} {β : Type u} (g : F (α ::: β)β) (x : (P F).W α) :
      recF g x = g (abs (MvFunctor.map (TypeVec.id ::: recF g) ((P F).wDest' x)))
      inductive MvQPF.WEquiv {n : } {F : TypeVec.{u} (n + 1)Type u} [q : MvQPF F] {α : TypeVec.{u} n} :
      (P F).W α(P F).W αProp

      Equivalence relation on W-types that represent the same Fix F value

      Instances For
        theorem MvQPF.recF_eq_of_wEquiv {n : } {F : TypeVec.{u} (n + 1)Type u} [q : MvQPF F] (α : TypeVec.{u} n) {β : Type u} (u : F (α ::: β)β) (x y : (P F).W α) :
        WEquiv x yrecF u x = recF u y
        theorem MvQPF.wEquiv.abs' {n : } {F : TypeVec.{u} (n + 1)Type u} [q : MvQPF F] {α : TypeVec.{u} n} (x y : (P F).W α) (h : abs ((P F).wDest' x) = abs ((P F).wDest' y)) :
        WEquiv x y
        theorem MvQPF.wEquiv.refl {n : } {F : TypeVec.{u} (n + 1)Type u} [q : MvQPF F] {α : TypeVec.{u} n} (x : (P F).W α) :
        WEquiv x x
        theorem MvQPF.wEquiv.symm {n : } {F : TypeVec.{u} (n + 1)Type u} [q : MvQPF F] {α : TypeVec.{u} n} (x y : (P F).W α) :
        WEquiv x yWEquiv y x
        def MvQPF.wrepr {n : } {F : TypeVec.{u} (n + 1)Type u} [q : MvQPF F] {α : TypeVec.{u} n} :
        (P F).W α(P F).W α

        maps every element of the W type to a canonical representative

        Equations
          Instances For
            theorem MvQPF.wrepr_wMk {n : } {F : TypeVec.{u} (n + 1)Type u} [q : MvQPF F] {α : TypeVec.{u} n} (a : (P F).A) (f' : ((P F).drop.B a).Arrow α) (f : (P F).last.B a(P F).W α) :
            wrepr ((P F).wMk a f' f) = (P F).wMk' (repr (abs (MvFunctor.map (TypeVec.id ::: wrepr) a, (P F).appendContents f' f)))
            theorem MvQPF.wrepr_equiv {n : } {F : TypeVec.{u} (n + 1)Type u} [q : MvQPF F] {α : TypeVec.{u} n} (x : (P F).W α) :
            theorem MvQPF.wEquiv_map {n : } {F : TypeVec.{u} (n + 1)Type u} [q : MvQPF F] {α β : TypeVec.{u} n} (g : α.Arrow β) (x y : (P F).W α) :
            def MvQPF.wSetoid {n : } {F : TypeVec.{u} (n + 1)Type u} [q : MvQPF F] (α : TypeVec.{u} n) :
            Setoid ((P F).W α)

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

            Equations
              Instances For
                def MvQPF.Fix {n : } (F : TypeVec.{u_1} (n + 1)Type u_1) [q : MvQPF F] (α : TypeVec.{u_1} n) :
                Type u_1

                Least fixed point of functor F. The result is a functor with one fewer parameters than the input. For F a b c a ternary functor, Fix F is a binary functor such that

                Fix F a b = F a b (Fix F a b)
                
                Equations
                  Instances For
                    def MvQPF.Fix.map {n : } {F : TypeVec.{u} (n + 1)Type u} [q : MvQPF F] {α β : TypeVec.{u} n} (g : α.Arrow β) :
                    Fix F αFix F β

                    Fix F is a functor

                    Equations
                      Instances For
                        instance MvQPF.Fix.mvfunctor {n : } {F : TypeVec.{u} (n + 1)Type u} [q : MvQPF F] :
                        Equations
                          def MvQPF.Fix.rec {n : } {F : TypeVec.{u} (n + 1)Type u} [q : MvQPF F] {α : TypeVec.{u} n} {β : Type u} (g : F (α ::: β)β) :
                          Fix F αβ

                          Recursor for Fix F

                          Equations
                            Instances For
                              def MvQPF.fixToW {n : } {F : TypeVec.{u} (n + 1)Type u} [q : MvQPF F] {α : TypeVec.{u} n} :
                              Fix F α(P F).W α

                              Access W-type underlying Fix F

                              Equations
                                Instances For
                                  def MvQPF.Fix.mk {n : } {F : TypeVec.{u} (n + 1)Type u} [q : MvQPF F] {α : TypeVec.{u} n} (x : F (α ::: Fix F α)) :
                                  Fix F α

                                  Constructor for Fix F

                                  Equations
                                    Instances For
                                      def MvQPF.Fix.dest {n : } {F : TypeVec.{u} (n + 1)Type u} [q : MvQPF F] {α : TypeVec.{u} n} :
                                      Fix F αF (α ::: Fix F α)

                                      Destructor for Fix F

                                      Equations
                                        Instances For
                                          theorem MvQPF.Fix.rec_eq {n : } {F : TypeVec.{u} (n + 1)Type u} [q : MvQPF F] {α : TypeVec.{u} n} {β : Type u} (g : F (α ::: β)β) (x : F (α ::: Fix F α)) :
                                          theorem MvQPF.Fix.ind_aux {n : } {F : TypeVec.{u} (n + 1)Type u} [q : MvQPF F] {α : TypeVec.{u} n} (a : (P F).A) (f' : ((P F).drop.B a).Arrow α) (f : (P F).last.B a(P F).W α) :
                                          mk (abs a, (P F).appendContents f' fun (x : (P F).last.B a) => f x) = (P F).wMk a f' f
                                          theorem MvQPF.Fix.ind_rec {n : } {F : TypeVec.{u} (n + 1)Type u} [q : MvQPF F] {α : TypeVec.{u} n} {β : Type u} (g₁ g₂ : Fix F αβ) (h : ∀ (x : F (α ::: Fix F α)), MvFunctor.map (TypeVec.id ::: g₁) x = MvFunctor.map (TypeVec.id ::: g₂) xg₁ (mk x) = g₂ (mk x)) (x : Fix F α) :
                                          g₁ x = g₂ x
                                          theorem MvQPF.Fix.rec_unique {n : } {F : TypeVec.{u} (n + 1)Type u} [q : MvQPF F] {α : TypeVec.{u} n} {β : Type u} (g : F (α ::: β)β) (h : Fix F αβ) (hyp : ∀ (x : F (α ::: Fix F α)), h (mk x) = g (MvFunctor.map (TypeVec.id ::: h) x)) :
                                          rec g = h
                                          theorem MvQPF.Fix.mk_dest {n : } {F : TypeVec.{u} (n + 1)Type u} [q : MvQPF F] {α : TypeVec.{u} n} (x : Fix F α) :
                                          mk x.dest = x
                                          theorem MvQPF.Fix.dest_mk {n : } {F : TypeVec.{u} (n + 1)Type u} [q : MvQPF F] {α : TypeVec.{u} n} (x : F (α ::: Fix F α)) :
                                          (mk x).dest = x
                                          theorem MvQPF.Fix.ind {n : } {F : TypeVec.{u} (n + 1)Type u} [q : MvQPF F] {α : TypeVec.{u} n} (p : Fix F αProp) (h : ∀ (x : F (α ::: Fix F α)), MvFunctor.LiftP (α.PredLast p) xp (mk x)) (x : Fix F α) :
                                          p x
                                          instance MvQPF.mvqpfFix {n : } {F : TypeVec.{u} (n + 1)Type u} [q : MvQPF F] :
                                          Equations
                                            def MvQPF.Fix.drec {n : } {F : TypeVec.{u} (n + 1)Type u} [q : MvQPF F] {α : TypeVec.{u} n} {β : Fix F αType u} (g : (x : F (α ::: Sigma β)) → β (mk (MvFunctor.map (TypeVec.id ::: Sigma.fst) x))) (x : Fix F α) :
                                            β x

                                            Dependent recursor for fix F

                                            Equations
                                              Instances For