Documentation

Logic.Vorspiel.W

def WType.inversion {α : Type u_1} {β : αType u_2} [(a : α) → Fintype (β a)] [(a : α) → Primcodable (β a)] :
WType βα × List (WType β)
Equations
  • x.inversion = match x with | WType.mk a f => (a, List.ofFn (Encodable.fintypeArrowEquivFinArrow f))
Instances For
    def WType.elimv {α : Type u_1} {β : αType u_2} {σ : Type u_3} {γ : Type u_4} (fs : ασσ) (fγ : σ(a : α) × (β aγ)γ) :
    σWType βγ
    Equations
    Instances For
      def WType.elimOpt {α : Type u_1} {β : αType u_2} [(a : α) → Fintype (β a)] [(a : α) → Primcodable (β a)] (γ : Type u_3) (fγ : (a : α) × (β aγ)Option γ) :
      WType βOption γ
      Equations
      Instances For
        def WType.SubWType {α : Type u_3} (β : αType u_4) [(a : α) → Fintype (β a)] [(a : α) → Primcodable (β a)] (n : ) :
        Type (max 0 u_3 u_4)
        Equations
        Instances For
          theorem WType.SubWType.ext {α : Type u_1} {β : αType u_2} [(a : α) → Fintype (β a)] [(a : α) → Primcodable (β a)] {s : } (w₁ : WType.SubWType β s) (w₂ : WType.SubWType β s) :
          w₁ = w₂w₁ = w₂
          def WType.SubWType.cast {α : Type u_1} {β : αType u_2} [(a : α) → Fintype (β a)] [(a : α) → Primcodable (β a)] {s : } {s' : } (hs : s = s') (w : WType.SubWType β s) :
          Equations
          Instances For
            @[simp]
            def WType.SubWType.cast_refl {α : Type u_1} {β : αType u_2} [(a : α) → Fintype (β a)] [(a : α) → Primcodable (β a)] {s : } (h : s = s) (w : WType.SubWType β s) :
            Equations
            • =
            Instances For
              def WType.SubWType.mk {α : Type u_1} {β : αType u_2} [(a : α) → Fintype (β a)] [(a : α) → Primcodable (β a)] {s : } (a : α) (f : β aWType.SubWType β s) :
              WType.SubWType β (s + 1)
              Equations
              Instances For
                @[simp]
                theorem WType.SubWType.cast_mk {α : Type u_1} {β : αType u_2} [(a : α) → Fintype (β a)] [(a : α) → Primcodable (β a)] {s : } {s' : } (hs : s + 1 = s' + 1) (a : α) (f : β aWType.SubWType β s) :
                @[simp]
                theorem WType.SubWType.cast_mk_one {α : Type u_1} {β : αType u_2} [(a : α) → Fintype (β a)] [(a : α) → Primcodable (β a)] {s : } (hs : s + 1 = 1) (a : α) (f : β aWType.SubWType β s) :
                @[reducible, inline]
                abbrev WType.SubWType.ofWType {α : Type u_1} {β : αType u_2} [(a : α) → Fintype (β a)] [(a : α) → Primcodable (β a)] (w : WType β) (n : ) (h : w.depth n) :
                Equations
                Instances For
                  @[simp]
                  theorem WType.SubWType.depth_le {α : Type u_1} {β : αType u_2} [(a : α) → Fintype (β a)] [(a : α) → Primcodable (β a)] {n : } (t : WType.SubWType β n) :
                  (t).depth n
                  @[reducible, inline]
                  abbrev WType.SubWType.elim' {α : Type u_1} {β : αType u_2} [(a : α) → Fintype (β a)] [(a : α) → Primcodable (β a)] (γ : Type u_3) (fγ : (a : α) × (β aγ)γ) (s : ) :
                  WType.SubWType β sγ
                  Equations
                  Instances For
                    theorem WType.SubWType.elim_const {α : Type u_1} {β : αType u_2} [(a : α) → Fintype (β a)] [(a : α) → Primcodable (β a)] {s₁ : } {s₂ : } {w₁ : WType.SubWType β s₁} {w₂ : WType.SubWType β s₂} (h : w₁ = w₂) (γ : Type u_3) (fγ : (a : α) × (β aγ)γ) :
                    WType.SubWType.elim' γ s₁ w₁ = WType.SubWType.elim' γ s₂ w₂
                    def WType.SubWType.equiv_zero {α : Type u_1} {β : αType u_2} [(a : α) → Fintype (β a)] [(a : α) → Primcodable (β a)] :
                    Equations
                    • One or more equations did not get rendered due to their size.
                    Instances For
                      def WType.SubWType.equiv_succ {α : Type u_1} {β : αType u_2} [(a : α) → Fintype (β a)] [(a : α) → Primcodable (β a)] {n : } :
                      WType.SubWType β (n + 1) (a : α) × (β aWType.SubWType β n)
                      Equations
                      • One or more equations did not get rendered due to their size.
                      Instances For
                        def WType.SubWType.primcodable_zero {α : Type u_1} {β : αType u_2} [(a : α) → Fintype (β a)] [(a : α) → Primcodable (β a)] :
                        Equations
                        Instances For
                          def WType.SubWType.primcodable_succ {α : Type u_1} {β : αType u_2} [Primcodable α] [(a : α) → Fintype (β a)] [(a : α) → DecidableEq (β a)] [(a : α) → Primcodable (β a)] [PrimrecCard β] (n : ) :
                          Equations
                          Instances For
                            instance Primcodable.SubWType {α : Type u_1} {β : αType u_2} [Primcodable α] [(a : α) → Fintype (β a)] [(a : α) → DecidableEq (β a)] [(a : α) → Primcodable (β a)] [PrimrecCard β] (n : ) :
                            Equations
                            @[simp]
                            theorem WType.SubWType.decode_zero {α : Type u_1} {β : αType u_2} [Primcodable α] [(a : α) → Fintype (β a)] [(a : α) → DecidableEq (β a)] [(a : α) → Primcodable (β a)] [PrimrecCard β] {e : } :
                            theorem WType.SubWType.decode_succ {α : Type u_1} {β : αType u_2} [Primcodable α] [(a : α) → Fintype (β a)] [(a : α) → DecidableEq (β a)] [(a : α) → Primcodable (β a)] [PrimrecCard β] {s : } {e : } :
                            Encodable.decode e = (Encodable.decode (Nat.unpair e).1).bind fun (a : α) => (Encodable.decode (Nat.unpair e).2).bind fun (l : List (WType.SubWType β s)) => Option.map (fun (v : Mathlib.Vector (WType.SubWType β s) (Fintype.card (β a))) => WType.SubWType.ofWType (WType.mk a fun (b : β a) => (Encodable.fintypeArrowEquivVector.symm v b)) (s + 1) ) (List.toVector (Fintype.card (β a)) l)
                            theorem WType.SubWType.encode_mk {α : Type u_1} {β : αType u_2} [Primcodable α] [(a : α) → Fintype (β a)] [(a : α) → DecidableEq (β a)] [(a : α) → Primcodable (β a)] [PrimrecCard β] {s : } (a : α) (f : β aWType β) (h : (WType.mk a f).depth s + 1) :
                            theorem WType.SubWType.encode_cast {α : Type u_1} {β : αType u_2} [Primcodable α] [(a : α) → Fintype (β a)] [(a : α) → DecidableEq (β a)] [(a : α) → Primcodable (β a)] [PrimrecCard β] {s : } (w : WType.SubWType β s) {s' : } (hs : s = s') :
                            def WType.SubWType.elimDecode {α : Type u_1} (β : αType u_2) [Primcodable α] [(a : α) → Fintype (β a)] [(a : α) → DecidableEq (β a)] [(a : α) → Primcodable (β a)] [PrimrecCard β] {γ : Type u_4} (f : αList γγ) :
                            Option γ
                            Equations
                            • One or more equations did not get rendered due to their size.
                            Instances For
                              theorem WType.SubWType.elimDecode_eq_induction {α : Type u_1} (β : αType u_2) [Primcodable α] [(a : α) → Fintype (β a)] [(a : α) → DecidableEq (β a)] [(a : α) → Primcodable (β a)] [PrimrecCard β] {γ : Type u_4} (f : αList γγ) (s : ) (e : ) :
                              WType.SubWType.elimDecode β f s e = Nat.casesOn s none fun (s : ) => (Encodable.decode (Nat.unpair e).1).bind fun (a : α) => Option.map (fun (v : List γ) => f a v) ((mapM' (WType.SubWType.elimDecode β f s) (Denumerable.ofNat (List ) (Nat.unpair e).2)).bind fun (l : List γ) => if l.length = Fintype.card (β a) then some l else none)
                              theorem WType.SubWType.primrec_elimDecode_param {α : Type u_1} (β : αType u_2) [Primcodable α] [(a : α) → Fintype (β a)] [(a : α) → DecidableEq (β a)] [(a : α) → Primcodable (β a)] [PrimrecCard β] {σ : Type u_3} {γ : Type u_4} [Primcodable σ] [Primcodable γ] {f : σα × List γγ} (hf : Primrec₂ f) :
                              Primrec₂ fun (x : σ) (p : × ) => WType.SubWType.elimDecode β (fun (a : α) (ih : List γ) => f x (a, ih)) p.1 p.2
                              theorem WType.SubWType.primrec_elimDecode {α : Type u_1} (β : αType u_2) [Primcodable α] [(a : α) → Fintype (β a)] [(a : α) → DecidableEq (β a)] [(a : α) → Primcodable (β a)] [PrimrecCard β] {γ : Type u_4} [Primcodable γ] {f : αList γγ} (hf : Primrec₂ f) :
                              Primrec₂ fun (s e : ) => WType.SubWType.elimDecode β f s e
                              theorem WType.SubWType.primrec_elimDecode_param_comp {α : Type u_1} (β : αType u_2) [Primcodable α] [(a : α) → Fintype (β a)] [(a : α) → DecidableEq (β a)] [(a : α) → Primcodable (β a)] [PrimrecCard β] {σ : Type u_3} {γ : Type u_4} [Primcodable σ] [Primcodable γ] {f : σα × List γγ} {g : σ} {h : σ} (hf : Primrec₂ f) (hg : Primrec g) (hh : Primrec h) :
                              Primrec fun (x : σ) => WType.SubWType.elimDecode β (fun (a : α) (l : List γ) => f x (a, l)) (g x) (h x)
                              theorem WType.SubWType.encode_eq_elim' {α : Type u_1} {β : αType u_2} [Primcodable α] [(a : α) → Fintype (β a)] [(a : α) → DecidableEq (β a)] [(a : α) → Primcodable (β a)] [PrimrecCard β] {s : } (w : WType.SubWType β s) :
                              theorem WType.SubWType.encodeDecode_eq_elimDecode {α : Type u_1} {β : αType u_2} [Primcodable α] [(a : α) → Fintype (β a)] [(a : α) → DecidableEq (β a)] [(a : α) → Primcodable (β a)] [PrimrecCard β] (s : ) (e : ) :
                              instance WType.SubWType.uniformlyPrimcodable {α : Type u_1} {β : αType u_2} [Primcodable α] [(a : α) → Fintype (β a)] [(a : α) → DecidableEq (β a)] [(a : α) → Primcodable (β a)] [PrimrecCard β] :
                              Equations
                              • =
                              theorem WType.SubWType.depth_eq_elimDecode {α : Type u_1} {β : αType u_2} [Primcodable α] [(a : α) → Fintype (β a)] [(a : α) → DecidableEq (β a)] [(a : α) → Primcodable (β a)] [PrimrecCard β] (s : ) (e : ) :
                              Option.map (fun (w : WType.SubWType β s) => (w).depth) (Encodable.decode e) = WType.SubWType.elimDecode β (fun (a : α) (l : List ) => l.sup + 1) s e
                              theorem WType.SubWType.depth_decode_primrec {α : Type u_1} {β : αType u_2} [Primcodable α] [(a : α) → Fintype (β a)] [(a : α) → DecidableEq (β a)] [(a : α) → Primcodable (β a)] [PrimrecCard β] :
                              Primrec₂ fun (s e : ) => Option.map (fun (w : WType.SubWType β s) => (w).depth) (Encodable.decode e)
                              def WType.SubWType.ofW {α : Type u_1} {β : αType u_2} [(a : α) → Fintype (β a)] [(a : α) → Primcodable (β a)] :
                              WType β(s : ) × WType.SubWType β s
                              Equations
                              Instances For
                                def WType.SubWType.toW {α : Type u_1} {β : αType u_2} [(a : α) → Fintype (β a)] [(a : α) → Primcodable (β a)] :
                                (s : ) × WType.SubWType β sWType β
                                Equations
                                Instances For
                                  def Encodable.wtype {α : Type u_1} {β : αType u_2} [Primcodable α] [(a : α) → Fintype (β a)] [(a : α) → DecidableEq (β a)] [(a : α) → Primcodable (β a)] [PrimrecCard β] :
                                  Equations
                                  Instances For
                                    instance Primcodable.wtype {α : Type u_1} {β : αType u_2} [Primcodable α] [(a : α) → Fintype (β a)] [(a : α) → DecidableEq (β a)] [(a : α) → Primcodable (β a)] [PrimrecCard β] :
                                    Equations
                                    theorem WType.encode_eq {α : Type u_1} {β : αType u_2} [Primcodable α] [(a : α) → Fintype (β a)] [(a : α) → DecidableEq (β a)] [(a : α) → Primcodable (β a)] [PrimrecCard β] (w : WType β) :
                                    theorem WType.decode_eq {α : Type u_1} {β : αType u_2} [Primcodable α] [(a : α) → Fintype (β a)] [(a : α) → DecidableEq (β a)] [(a : α) → Primcodable (β a)] [PrimrecCard β] (e : ) :
                                    def WType.elimL {α : Type u_1} {β : αType u_2} [(a : α) → Fintype (β a)] [(a : α) → Primcodable (β a)] {γ : Type u_3} (f : αList γγ) :
                                    WType βγ
                                    Equations
                                    Instances For
                                      theorem WType.elimL_mk {α : Type u_1} {β : αType u_2} [(a : α) → Fintype (β a)] [(a : α) → Primcodable (β a)] {γ : Type u_3} (f : αList γγ) (a : α) (v : β aWType β) :
                                      WType.elimL f (WType.mk a v) = f a (List.ofFn (Encodable.fintypeArrowEquivFinArrow fun (b : β a) => WType.elimL f (v b)))
                                      theorem WType.elim_eq_elimL {α : Type u_1} {β : αType u_2} [(a : α) → Fintype (β a)] [(a : α) → Primcodable (β a)] {γ : Type u_3} {w : WType β} [Inhabited γ] (f : (a : α) × (β aγ)γ) :
                                      WType.elim γ f w = WType.elimL (fun (a : α) (l : List γ) => f a, Encodable.fintypeArrowEquivFinArrow.symm fun (i : Fin (Fintype.card (β a))) => l.getI i) w
                                      theorem WType.decode_elimL_eq {α : Type u_1} {β : αType u_2} [Primcodable α] [(a : α) → Fintype (β a)] [(a : α) → DecidableEq (β a)] [(a : α) → Primcodable (β a)] [PrimrecCard β] {γ : Type u_3} {e : } (f : αList γγ) :
                                      def WType.elimvL {α : Type u_1} {β : αType u_2} [(a : α) → Fintype (β a)] [(a : α) → Primcodable (β a)] {σ : Type u_3} {γ : Type u_4} (fs : ασσ) (fγ : σαList γγ) :
                                      σWType βγ
                                      Equations
                                      • WType.elimvL fs = WType.elimv fs fun (x : σ) (x_1 : (a : α) × (β aγ)) => match x_1 with | a, v => x a (List.ofFn (Encodable.fintypeArrowEquivFinArrow v))
                                      Instances For
                                        theorem WType.elimvL_mk {α : Type u_1} {β : αType u_2} [(a : α) → Fintype (β a)] [(a : α) → Primcodable (β a)] {σ : Type u_3} {γ : Type u_4} {x : σ} (fs : ασσ) (fγ : σαList γγ) (a : α) (v : β aWType β) :
                                        WType.elimvL fs x (WType.mk a v) = x a (List.ofFn (Encodable.fintypeArrowEquivFinArrow fun (b : β a) => WType.elimvL fs (fs a x) (v b)))
                                        def WType.mkL {α : Type u_1} {β : αType u_2} [(a : α) → Fintype (β a)] [(a : α) → Primcodable (β a)] (a : α) (l : List (WType β)) :
                                        Equations
                                        • One or more equations did not get rendered due to their size.
                                        Instances For
                                          def WType.mkFintype {α : Type u_1} {β : αType u_2} (a : α) (v : β aWType β) :
                                          Equations
                                          Instances For
                                            def WType.mk₀ {α : Type u_1} {β : αType u_2} [(a : α) → Fintype (β a)] [(a : α) → Primcodable (β a)] (a : α) :
                                            Equations
                                            Instances For
                                              def WType.mk₁ {α : Type u_1} {β : αType u_2} [(a : α) → Fintype (β a)] [(a : α) → Primcodable (β a)] (a : α) (w : WType β) :
                                              Equations
                                              Instances For
                                                def WType.mkFin {α : Type u_1} {β : αType u_2} [(a : α) → Fintype (β a)] [(a : α) → Primcodable (β a)] {k : } (a : α) (v : Fin kWType β) :
                                                Equations
                                                Instances For
                                                  theorem WType.encode_mk_eq {α : Type u_1} {β : αType u_2} [Primcodable α] [(a : α) → Fintype (β a)] [(a : α) → DecidableEq (β a)] [(a : α) → Primcodable (β a)] [PrimrecCard β] (a : α) (f : β aWType β) :
                                                  Encodable.encode (WType.mk a f) = Nat.pair ((Finset.univ.sup fun (n : β a) => (f n).depth) + 1) (Nat.pair (Encodable.encode a) (Encodable.encode fun (b : β a) => (Nat.unpair (Encodable.encode (f b))).2))
                                                  theorem WType.mk₀_eq {α : Type u_1} {β : αType u_2} [(a : α) → Fintype (β a)] [(a : α) → Primcodable (β a)] (a : α) [h : IsEmpty (β a)] :
                                                  WType.mk₀ a = some (WType.mk a h.elim')
                                                  theorem WType.mkL_inversion {α : Type u_1} {β : αType u_2} [(a : α) → Fintype (β a)] [(a : α) → Primcodable (β a)] (w : WType β) :
                                                  WType.mkL w.inversion.1 w.inversion.2 = some w
                                                  theorem Primrec.w_depth {α : Type u_3} {β : αType u_5} [Primcodable α] [(a : α) → Fintype (β a)] [(a : α) → DecidableEq (β a)] [(a : α) → Primcodable (β a)] [PrimrecCard β] :
                                                  Primrec WType.depth
                                                  theorem Primrec.w_elimL {α : Type u_3} {γ : Type u_4} {β : αType u_5} [Primcodable α] [(a : α) → Fintype (β a)] [(a : α) → DecidableEq (β a)] [(a : α) → Primcodable (β a)] [PrimrecCard β] [Primcodable γ] {f : αList γγ} (hf : Primrec₂ f) :
                                                  theorem Primrec.w_elimL_param {σ : Type u_2} {α : Type u_3} {γ : Type u_4} {β : αType u_5} [Primcodable σ] [Primcodable α] [(a : α) → Fintype (β a)] [(a : α) → DecidableEq (β a)] [(a : α) → Primcodable (β a)] [PrimrecCard β] [Primcodable γ] {f : σα × List γγ} {w : σWType β} (hf : Primrec₂ f) (hw : Primrec w) :
                                                  Primrec fun (x : σ) => WType.elimL (fun (p : α) (l : List γ) => f x (p, l)) (w x)
                                                  theorem Primrec.w_elim {α : Type u_3} {γ : Type u_4} {β : αType u_5} [Primcodable α] [(a : α) → Fintype (β a)] [(a : α) → DecidableEq (β a)] [(a : α) → Primcodable (β a)] [PrimrecCard β] [Primcodable γ] [Inhabited γ] {f : (a : α) × (β aγ)γ} (hf : Primrec₂ fun (a : α) (l : List γ) => f a, Encodable.fintypeArrowEquivFinArrow.symm fun (i : Fin (Fintype.card (β a))) => l.getI i) :
                                                  theorem Primrec.w_mkL {α : Type u_3} {β : αType u_5} [Primcodable α] [(a : α) → Fintype (β a)] [(a : α) → DecidableEq (β a)] [(a : α) → Primcodable (β a)] [PrimrecCard β] :
                                                  Primrec₂ WType.mkL
                                                  theorem Primrec.w_mk₀ {σ : Type u_2} {α : Type u_3} {β : αType u_5} [Primcodable σ] [Primcodable α] [(a : α) → Fintype (β a)] [(a : α) → DecidableEq (β a)] [(a : α) → Primcodable (β a)] [PrimrecCard β] (f : σα) (h : ∀ (x : σ), IsEmpty (β (f x))) (hf : Primrec f) {v : {x : σ} → β (f x)WType β} :
                                                  Primrec fun (x : σ) => WType.mk (f x) v
                                                  theorem Primrec.w_mk₁ {σ : Type u_2} {α : Type u_3} {β : αType u_5} [Primcodable σ] [Primcodable α] [(a : α) → Fintype (β a)] [(a : α) → DecidableEq (β a)] [(a : α) → Primcodable (β a)] [PrimrecCard β] (f : σα) (h : ∀ (x : σ), Fintype.card (β (f x)) = 1) (hf : Primrec f) :
                                                  Primrec₂ fun (x : σ) (w : WType β) => WType.mk (f x) fun (x : β (f x)) => w
                                                  theorem Primrec.w_mk₂ {σ : Type u_2} {α : Type u_3} {β : αType u_5} [Primcodable σ] [Primcodable α] [(a : α) → Fintype (β a)] [(a : α) → DecidableEq (β a)] [(a : α) → Primcodable (β a)] [PrimrecCard β] (f : σα) (h : ∀ (x : σ), Fintype.card (β (f x)) = 2) (hf : Primrec f) :
                                                  Primrec₂ fun (x : σ) (w : WType β × WType β) => WType.mk (f x) ((Encodable.fintypeArrowEquivFinArrow' ).symm ![w.1, w.2])
                                                  theorem Primrec.w_mkFin {σ : Type u_2} {α : Type u_3} {β : αType u_5} [Primcodable σ] [Primcodable α] [(a : α) → Fintype (β a)] [(a : α) → DecidableEq (β a)] [(a : α) → Primcodable (β a)] [PrimrecCard β] (f : σα) {k : } (h : ∀ (x : σ), Fintype.card (β (f x)) = k) (hf : Primrec f) :
                                                  Primrec₂ fun (x : σ) (w : Fin kWType β) => WType.mk (f x) ((Encodable.fintypeArrowEquivFinArrow' ).symm w)
                                                  theorem Primrec.w_inversion {α : Type u_3} {β : αType u_5} [Primcodable α] [(a : α) → Fintype (β a)] [(a : α) → DecidableEq (β a)] [(a : α) → Primcodable (β a)] [PrimrecCard β] [Inhabited (WType β)] :
                                                  Primrec WType.inversion
                                                  theorem Primrec.w_elimvL_param {τ : Type u_1} {σ : Type u_2} {α : Type u_3} {γ : Type u_4} {β : αType u_5} [Primcodable τ] [Primcodable σ] [Primcodable α] [(a : α) → Fintype (β a)] [(a : α) → DecidableEq (β a)] [(a : α) → Primcodable (β a)] [PrimrecCard β] [Primcodable γ] [Inhabited (WType β)] {fs : τα × σσ} {fγ : τσ × α × List γγ} {g : τσ} {w : τWType β} (hfs : Primrec₂ fs) (hfγ : Primrec₂ ) (hg : Primrec g) (hw : Primrec w) :
                                                  Primrec fun (z : τ) => WType.elimvL (fun (a : α) (x : σ) => fs z (a, x)) (fun (x : σ) (a : α) (l : List γ) => z (x, a, l)) (g z) (w z)
                                                  theorem Primrec.w_elimvL {σ : Type u_2} {α : Type u_3} {γ : Type u_4} {β : αType u_5} [Primcodable σ] [Primcodable α] [(a : α) → Fintype (β a)] [(a : α) → DecidableEq (β a)] [(a : α) → Primcodable (β a)] [PrimrecCard β] [Primcodable γ] [Inhabited (WType β)] {fs : ασσ} {fγ : σα × List γγ} (hfs : Primrec₂ fs) (hfγ : Primrec₂ ) :
                                                  Primrec₂ (WType.elimvL fs fun (x : σ) (a : α) (l : List γ) => x (a, l))