The areas / V33. Data structures and computation
Mathlib.Data.PFunctor.Univariate.M
111 declarations. Mathlib docs · Source
theorem PFunctor.M.isubtree.match_1.congr_eq_1 E1 #
∀ {F : PFunctor.{u_1, u_2}} (motive : PFunctor.Approx.Path F → F.M → Sort u_3) (x : PFunctor.Approx.Path F) (x_1 : F.M)
(h_1 : (x : F.M) → motive [] x)
(h_2 : (a : F.A) → (i : F.B a) → (ps : List F.Idx) → (x : F.M) → motive (⟨a, i⟩ :: ps) x) (x_2 : F.M),
x = [] →
x_1 = x_2 →
(match x, x_1 with
| [], x => h_1 x
| ⟨a, i⟩ :: ps, x => h_2 a i ps x) ≍
h_1 x_2
theorem PFunctor.M.isubtree.match_1.congr_eq_2 E1 #
∀ {F : PFunctor.{u_1, u_2}} (motive : PFunctor.Approx.Path F → F.M → Sort u_3) (x : PFunctor.Approx.Path F) (x_1 : F.M)
(h_1 : (x : F.M) → motive [] x)
(h_2 : (a : F.A) → (i : F.B a) → (ps : List F.Idx) → (x : F.M) → motive (⟨a, i⟩ :: ps) x) (a : F.A) (i : F.B a)
(ps : List F.Idx) (x_2 : F.M),
x = ⟨a, i⟩ :: ps →
x_1 = x_2 →
(match x, x_1 with
| [], x => h_1 x
| ⟨a, i⟩ :: ps, x => h_2 a i ps x) ≍
h_2 a i ps x_2
abbrev PFunctor.Approx.CofixA.brecOn.go E1 #
{F : PFunctor.{uA, uB}} →
{motive : (a : ℕ) → PFunctor.Approx.CofixA F a → Sort u} →
{a : ℕ} →
(t : PFunctor.Approx.CofixA F a) →
((a : ℕ) → (t : PFunctor.Approx.CofixA F a) → PFunctor.Approx.CofixA.below t → motive a t) →
motive a t ×' PFunctor.Approx.CofixA.below t
ctor PFunctor.Approx.Agree.below.continu E0 #
∀ {F : PFunctor.{uA, uB}}
{motive :
{n : ℕ} →
(a : PFunctor.Approx.CofixA F n) → (a_1 : PFunctor.Approx.CofixA F (n + 1)) → PFunctor.Approx.Agree a a_1 → Prop}
(x : PFunctor.Approx.CofixA F 0) (y : PFunctor.Approx.CofixA F 1), PFunctor.Approx.Agree.below ⋯
theorem PFunctor.Approx.CofixA.intro.injEq E0 #
∀ {F : PFunctor.{uA, uB}} {n : ℕ} (a : F.A) (a_1 : F.B a → PFunctor.Approx.CofixA F n) (a_2 : F.A)
(a_3 : F.B a_2 → PFunctor.Approx.CofixA F n),
(PFunctor.Approx.CofixA.intro a a_1 = PFunctor.Approx.CofixA.intro a_2 a_3) = (a = a_2 ∧ a_1 ≍ a_3)
theorem PFunctor.MIntl.mk.inj E1 #
∀ {F : PFunctor.{uA, uB}} {approx : (n : ℕ) → PFunctor.Approx.CofixA F n} {consistent : PFunctor.Approx.AllAgree approx}
{approx_1 : (n : ℕ) → PFunctor.Approx.CofixA F n} {consistent_1 : PFunctor.Approx.AllAgree approx_1},
{ approx := approx, consistent := consistent } = { approx := approx_1, consistent := consistent_1 } →
approx = approx_1
theorem PFunctor.Approx.CofixA.intro.hcongr_4 E1 #
∀ (F F' : PFunctor.{uA, uB}),
F = F' →
∀ (n n' : ℕ),
n = n' →
∀ (a : F.A) (a' : F'.A),
a ≍ a' →
∀ (a_1 : F.B a → PFunctor.Approx.CofixA F n) (a'_1 : F'.B a' → PFunctor.Approx.CofixA F' n'),
a_1 ≍ a'_1 → PFunctor.Approx.CofixA.intro a a_1 ≍ PFunctor.Approx.CofixA.intro a' a'_1
ctor PFunctor.M.Agree'.below.step E0 #
∀ {F : PFunctor.{uA, uB}} {motive : (a : ℕ) → (a_1 a_2 : F.M) → PFunctor.M.Agree' a a_1 a_2 → Prop} {n : ℕ} {a : F.A}
(x y : F.B a → F.M) {x' y' : F.M} (a_1 : x' = PFunctor.M.mk (PFunctor.Obj.mk a x))
(a_2 : y' = PFunctor.M.mk (PFunctor.Obj.mk a y)) (a_3 : ∀ (i : F.B a), PFunctor.M.Agree' n (x i) (y i)),
(∀ (i : F.B a), PFunctor.M.Agree'.below ⋯) → (∀ (i : F.B a), motive n (x i) (y i) ⋯) → PFunctor.M.Agree'.below ⋯
theorem PFunctor.Approx.truncate.match_1.congr_eq_1 E1 #
∀ {F : PFunctor.{u_1, u_2}} (motive : (x : ℕ) → PFunctor.Approx.CofixA F (x + 1) → Sort u_3) (x : ℕ)
(x_1 : PFunctor.Approx.CofixA F (x + 1))
(h_1 : (a : F.A) → (a_1 : F.B a → PFunctor.Approx.CofixA F 0) → motive 0 (PFunctor.Approx.CofixA.intro a a_1))
(h_2 :
(a : ℕ) →
(i : F.A) → (f : F.B i → PFunctor.Approx.CofixA F (a + 1)) → motive a.succ (PFunctor.Approx.CofixA.intro i f))
(a : F.A) (a_1 : F.B a → PFunctor.Approx.CofixA F 0),
x = 0 →
x_1 ≍ PFunctor.Approx.CofixA.intro a a_1 →
(match x, x_1 with
| 0, PFunctor.Approx.CofixA.intro a a_2 => h_1 a a_2
| a.succ, PFunctor.Approx.CofixA.intro i f => h_2 a i f) ≍
h_1 a a_1
theorem PFunctor.Approx.head'.match_1.congr_eq_1 E1 #
∀ {F : PFunctor.{u_1, u_2}} (motive : (x : ℕ) → PFunctor.Approx.CofixA F x.succ → Sort u_3) (x : ℕ)
(x_1 : PFunctor.Approx.CofixA F x.succ)
(h_1 : (x : ℕ) → (i : F.A) → (a : F.B i → PFunctor.Approx.CofixA F x) → motive x (PFunctor.Approx.CofixA.intro i a))
(x_2 : ℕ) (i : F.A) (a : F.B i → PFunctor.Approx.CofixA F x_2),
x = x_2 →
x_1 ≍ PFunctor.Approx.CofixA.intro i a →
(match x, x_1 with
| x, PFunctor.Approx.CofixA.intro i a => h_1 x i a) ≍
h_1 x_2 i a
ctor PFunctor.Approx.Agree.below.intro E0 #
∀ {F : PFunctor.{uA, uB}}
{motive :
{n : ℕ} →
(a : PFunctor.Approx.CofixA F n) → (a_1 : PFunctor.Approx.CofixA F (n + 1)) → PFunctor.Approx.Agree a a_1 → Prop}
{n : ℕ} {a : F.A} (x : F.B a → PFunctor.Approx.CofixA F n) (x' : F.B a → PFunctor.Approx.CofixA F (n + 1))
(a_1 : ∀ (i : F.B a), PFunctor.Approx.Agree (x i) (x' i)),
(∀ (i : F.B a), PFunctor.Approx.Agree.below ⋯) →
(∀ (i : F.B a), motive (x i) (x' i) ⋯) → PFunctor.Approx.Agree.below ⋯
def PFunctor.Approx.CofixA.ctorIdx E1 #
{F : PFunctor.{uA, uB}} → {a : ℕ} → PFunctor.Approx.CofixA F a → ℕ
ctor PFunctor.M.IsPath.below.nil E0 #
∀ {F : PFunctor.{uA, uB}} {motive : (a : PFunctor.Approx.Path F) → (a_1 : F.M) → PFunctor.M.IsPath a a_1 → Prop}
(x : F.M), PFunctor.M.IsPath.below ⋯
theorem PFunctor.MIntl.mk.injEq E0 #
∀ {F : PFunctor.{uA, uB}} (approx : (n : ℕ) → PFunctor.Approx.CofixA F n) (consistent : PFunctor.Approx.AllAgree approx)
(approx_1 : (n : ℕ) → PFunctor.Approx.CofixA F n) (consistent_1 : PFunctor.Approx.AllAgree approx_1),
({ approx := approx, consistent := consistent } = { approx := approx_1, consistent := consistent_1 }) =
(approx = approx_1)
theorem PFunctor.Approx.CofixA.intro.inj E1 #
∀ {F : PFunctor.{uA, uB}} {n : ℕ} {a : F.A} {a_1 : F.B a → PFunctor.Approx.CofixA F n} {a_2 : F.A}
{a_3 : F.B a_2 → PFunctor.Approx.CofixA F n},
PFunctor.Approx.CofixA.intro a a_1 = PFunctor.Approx.CofixA.intro a_2 a_3 → a = a_2 ∧ a_1 ≍ a_3
ctor PFunctor.M.Agree'.below.trivial E0 #
∀ {F : PFunctor.{uA, uB}} {motive : (a : ℕ) → (a_1 a_2 : F.M) → PFunctor.M.Agree' a a_1 a_2 → Prop} (x y : F.M),
PFunctor.M.Agree'.below ⋯
theorem PFunctor.Approx.CofixA.brecOn.eq E1 #
∀ {F : PFunctor.{uA, uB}} {motive : (a : ℕ) → PFunctor.Approx.CofixA F a → Sort u} {a : ℕ}
(t : PFunctor.Approx.CofixA F a)
(F_1 : (a : ℕ) → (t : PFunctor.Approx.CofixA F a) → PFunctor.Approx.CofixA.below t → motive a t),
PFunctor.Approx.CofixA.brecOn t F_1 = F_1 a t (PFunctor.Approx.CofixA.brecOn.go t F_1).2
def PFunctor.MIntl.ctorIdx E1 #
{F : PFunctor.{uA, uB}} → F.MIntl → ℕ
abbrev PFunctor.Approx.CofixA.ctorElimType E1 #
{F : PFunctor.{uA, uB}} →
{motive : (a : ℕ) → PFunctor.Approx.CofixA F a → Sort u} →
ℕ → Sort (max 1 u (imax (uA + 1) (max (uA + 1) (uB + 1)) u))
theorem PFunctor.Approx.CofixA.intro.hinj E1 #
∀ {F : PFunctor.{uA, uB}} {n : ℕ} {a : F.A} {a_1 : F.B a → PFunctor.Approx.CofixA F n} {F_1 : PFunctor.{uA, uB}}
{n_1 : ℕ} {a_2 : F_1.A} {a_3 : F_1.B a_2 → PFunctor.Approx.CofixA F_1 n_1},
F = F_1 →
n.succ = n_1.succ →
PFunctor.Approx.CofixA.intro a a_1 ≍ PFunctor.Approx.CofixA.intro a_2 a_3 →
F = F_1 ∧ n = n_1 ∧ a ≍ a_2 ∧ a_1 ≍ a_3
theorem PFunctor.Approx.truncate.match_1.congr_eq_2 E1 #
∀ {F : PFunctor.{u_1, u_2}} (motive : (x : ℕ) → PFunctor.Approx.CofixA F (x + 1) → Sort u_3) (x : ℕ)
(x_1 : PFunctor.Approx.CofixA F (x + 1))
(h_1 : (a : F.A) → (a_1 : F.B a → PFunctor.Approx.CofixA F 0) → motive 0 (PFunctor.Approx.CofixA.intro a a_1))
(h_2 :
(a : ℕ) →
(i : F.A) → (f : F.B i → PFunctor.Approx.CofixA F (a + 1)) → motive a.succ (PFunctor.Approx.CofixA.intro i f))
(a : ℕ) (i : F.A) (f : F.B i → PFunctor.Approx.CofixA F (a + 1)),
x = a.succ →
x_1 ≍ PFunctor.Approx.CofixA.intro i f →
(match x, x_1 with
| 0, PFunctor.Approx.CofixA.intro a a_1 => h_1 a a_1
| a.succ, PFunctor.Approx.CofixA.intro i f => h_2 a i f) ≍
h_2 a i f
ctor PFunctor.M.IsPath.below.cons E0 #
∀ {F : PFunctor.{uA, uB}} {motive : (a : PFunctor.Approx.Path F) → (a_1 : F.M) → PFunctor.M.IsPath a a_1 → Prop}
(xs : PFunctor.Approx.Path F) {a : F.A} (x : F.M) (f : F.B a → F.M) (i : F.B a)
(a_1 : x = PFunctor.M.mk (PFunctor.Obj.mk a f)) (a_2 : PFunctor.M.IsPath xs (f i)),
PFunctor.M.IsPath.below a_2 → motive xs (f i) a_2 → PFunctor.M.IsPath.below ⋯
inductive PFunctor.Approx.CofixA E1 #
PFunctor.{uA, uB} → ℕ → Type (max uA uB)
CofixA F n is an n level approximation of an M-type
ctor PFunctor.Approx.CofixA.continue E0 #
{F : PFunctor.{uA, uB}} → PFunctor.Approx.CofixA F 0
ctor PFunctor.Approx.CofixA.intro E0 #
{F : PFunctor.{uA, uB}} → {n : ℕ} → (a : F.A) → (F.B a → PFunctor.Approx.CofixA F n) → PFunctor.Approx.CofixA F n.succ
def PFunctor.Approx.CofixA.default E1 #
(F : PFunctor.{uA, uB}) → [Inhabited F.A] → (n : ℕ) → PFunctor.Approx.CofixA F n
default inhabitant of CofixA
instance PFunctor.Approx.instInhabitedCofixAOfA E0 #
(F : PFunctor.{uA, uB}) → [Inhabited F.A] → {n : ℕ} → Inhabited (PFunctor.Approx.CofixA F n)
theorem PFunctor.Approx.cofixA_eq_zero E1 #
∀ (F : PFunctor.{uA, uB}) (x y : PFunctor.Approx.CofixA F 0), x = y
def PFunctor.Approx.head' E1 #
{F : PFunctor.{uA, uB}} → {n : ℕ} → PFunctor.Approx.CofixA F n.succ → F.A
The label of the root of the tree for a non-trivial approximation of the cofix of a pfunctor.
def PFunctor.Approx.children' E1 #
{F : PFunctor.{uA, uB}} →
{n : ℕ} → (x : PFunctor.Approx.CofixA F n.succ) → F.B (PFunctor.Approx.head' x) → PFunctor.Approx.CofixA F n
for a non-trivial approximation, return all the subtrees of the root
theorem PFunctor.Approx.approx_eta E1 #
∀ {F : PFunctor.{uA, uB}} {n : ℕ} (x : PFunctor.Approx.CofixA F (n + 1)),
x = PFunctor.Approx.CofixA.intro (PFunctor.Approx.head' x) (PFunctor.Approx.children' x)
inductive PFunctor.Approx.Agree E1 #
{F : PFunctor.{uA, uB}} → {n : ℕ} → PFunctor.Approx.CofixA F n → PFunctor.Approx.CofixA F (n + 1) → Prop
Relation between two approximations of the cofix of a pfunctor that state they both contain the same data until one of them is truncated
ctor PFunctor.Approx.Agree.continu E0 #
∀ {F : PFunctor.{uA, uB}} (x : PFunctor.Approx.CofixA F 0) (y : PFunctor.Approx.CofixA F 1), PFunctor.Approx.Agree x y
ctor PFunctor.Approx.Agree.intro E0 #
∀ {F : PFunctor.{uA, uB}} {n : ℕ} {a : F.A} (x : F.B a → PFunctor.Approx.CofixA F n)
(x' : F.B a → PFunctor.Approx.CofixA F (n + 1)),
(∀ (i : F.B a), PFunctor.Approx.Agree (x i) (x' i)) →
PFunctor.Approx.Agree (PFunctor.Approx.CofixA.intro a x) (PFunctor.Approx.CofixA.intro a x')
def PFunctor.Approx.AllAgree E1 #
{F : PFunctor.{uA, uB}} → ((n : ℕ) → PFunctor.Approx.CofixA F n) → Prop
Given an infinite series of approximations approx,
AllAgree approx states that they are all consistent with each other.
theorem PFunctor.Approx.agree_trivial E0 #
∀ {F : PFunctor.{uA, uB}} {x : PFunctor.Approx.CofixA F 0} {y : PFunctor.Approx.CofixA F 1}, PFunctor.Approx.Agree x y
theorem PFunctor.Approx.agree_children E1 #
∀ {F : PFunctor.{uA, uB}} {n : ℕ} (x : PFunctor.Approx.CofixA F n.succ) (y : PFunctor.Approx.CofixA F (n.succ + 1))
{i : F.B (PFunctor.Approx.head' x)} {j : F.B (PFunctor.Approx.head' y)},
i ≍ j →
PFunctor.Approx.Agree x y → PFunctor.Approx.Agree (PFunctor.Approx.children' x i) (PFunctor.Approx.children' y j)
def PFunctor.Approx.truncate E1 #
{F : PFunctor.{uA, uB}} → {n : ℕ} → PFunctor.Approx.CofixA F (n + 1) → PFunctor.Approx.CofixA F n
truncate a turns a into a more limited approximation
theorem PFunctor.Approx.truncate_eq_of_agree E1 #
∀ {F : PFunctor.{uA, uB}} {n : ℕ} (x : PFunctor.Approx.CofixA F n) (y : PFunctor.Approx.CofixA F n.succ),
PFunctor.Approx.Agree x y → PFunctor.Approx.truncate y = x
def PFunctor.Approx.sCorec E1 #
{F : PFunctor.{uA, uB}} → {X : Type w} → (X → ↑F X) → X → (n : ℕ) → PFunctor.Approx.CofixA F n
sCorec f i n creates an approximation of height n
of the final coalgebra of f
theorem PFunctor.Approx.P_corec E1 #
∀ {F : PFunctor.{uA, uB}} {X : Type w} (f : X → ↑F X) (i : X) (n : ℕ),
PFunctor.Approx.Agree (PFunctor.Approx.sCorec f i n) (PFunctor.Approx.sCorec f i n.succ)
def PFunctor.Approx.Path E1 #
PFunctor.{uA, uB} → Type (max uA uB)
Path F provides indices to access internal nodes in Corec F
instance PFunctor.Approx.Path.inhabited E0 #
{F : PFunctor.{uA, uB}} → Inhabited (PFunctor.Approx.Path F)
instance PFunctor.Approx.CofixA.instSubsingleton E0 #
∀ {F : PFunctor.{uA, uB}}, Subsingleton (PFunctor.Approx.CofixA F 0)
theorem PFunctor.Approx.head_succ' E1 #
∀ {F : PFunctor.{uA, uB}} (n m : ℕ) (x : (n : ℕ) → PFunctor.Approx.CofixA F n),
PFunctor.Approx.AllAgree x → PFunctor.Approx.head' (x n.succ) = PFunctor.Approx.head' (x m.succ)
structure PFunctor.MIntl E1 #
PFunctor.{uA, uB} → Type (max uA uB)
Internal definition for M. It is needed to avoid name clashes
between M.mk and M.casesOn and the declarations generated for
the structure
ctor PFunctor.MIntl.mk E0 #
{F : PFunctor.{uA, uB}} → (approx : (n : ℕ) → PFunctor.Approx.CofixA F n) → PFunctor.Approx.AllAgree approx → F.MIntl
abbrev PFunctor.MIntl.approx E1 #
{F : PFunctor.{uA, uB}} → F.MIntl → (n : ℕ) → PFunctor.Approx.CofixA F n
An n-th level approximation, for each depth n
theorem PFunctor.MIntl.consistent E1 #
∀ {F : PFunctor.{uA, uB}} (self : F.MIntl), PFunctor.Approx.AllAgree self.approx
Each approximation agrees with the next
def PFunctor.M E1 #
PFunctor.{uA, uB} → Type (max uA uB)
For polynomial functor F, M F is its final coalgebra
theorem PFunctor.M.default_consistent E1 #
∀ (F : PFunctor.{uA, uB}) [inst : Inhabited F.A] (n : ℕ), PFunctor.Approx.Agree default default
instance PFunctor.MIntl.inhabited E0 #
(F : PFunctor.{uA, uB}) → [Inhabited F.A] → Inhabited F.MIntl
instance PFunctor.M.inhabited E0 #
(F : PFunctor.{uA, uB}) → [Inhabited F.A] → Inhabited F.M
theorem PFunctor.M.ext' E1 #
∀ (F : PFunctor.{uA, uB}) (x y : F.M), (∀ (i : ℕ), x.approx i = y.approx i) → x = y
def PFunctor.M.corec E1 #
{F : PFunctor.{uA, uB}} → {X : Type u_1} → (X → ↑F X) → X → F.M
Corecursor for the M-type defined by F.
def PFunctor.M.head E1 #
{F : PFunctor.{uA, uB}} → F.M → F.A
given a tree generated by F, head gives us the first piece of data
it contains
def PFunctor.M.children E1 #
{F : PFunctor.{uA, uB}} → (x : F.M) → F.B x.head → F.M
return all the subtrees of the root of a tree x : M F
def PFunctor.M.ichildren E1 #
{F : PFunctor.{uA, uB}} → [Inhabited F.M] → [DecidableEq F.A] → F.Idx → F.M → F.M
select a subtree using an i : F.Idx or return an arbitrary tree if
i designates no subtree of x
theorem PFunctor.M.head_succ E1 #
∀ {F : PFunctor.{uA, uB}} (n m : ℕ) (x : F.M),
PFunctor.Approx.head' (x.approx n.succ) = PFunctor.Approx.head' (x.approx m.succ)
theorem PFunctor.M.head_eq_head' E1 #
∀ {F : PFunctor.{uA, uB}} (x : F.M) (n : ℕ), x.head = PFunctor.Approx.head' (x.approx (n + 1))
theorem PFunctor.M.head'_eq_head E1 #
∀ {F : PFunctor.{uA, uB}} (x : F.M) (n : ℕ), PFunctor.Approx.head' (x.approx (n + 1)) = x.head
theorem PFunctor.M.truncate_approx E1 #
∀ {F : PFunctor.{uA, uB}} (x : F.M) (n : ℕ), PFunctor.Approx.truncate (x.approx (n + 1)) = x.approx n
def PFunctor.M.dest E1 #
{F : PFunctor.{uA, uB}} → F.M → ↑F F.M
unfold an M-type
def PFunctor.M.Approx.sMk E1 #
{F : PFunctor.{uA, uB}} → ↑F F.M → (n : ℕ) → PFunctor.Approx.CofixA F n
generates the approximations needed for M.mk
theorem PFunctor.M.Approx.P_mk E0 #
∀ {F : PFunctor.{uA, uB}} (x : ↑F F.M), PFunctor.Approx.AllAgree (PFunctor.M.Approx.sMk x)
def PFunctor.M.mk E1 #
{F : PFunctor.{uA, uB}} → ↑F F.M → F.M
constructor for M-types
inductive PFunctor.M.Agree' E1 #
{F : PFunctor.{uA, uB}} → ℕ → F.M → F.M → Prop
Agree' n relates two trees of type M F that
are the same up to depth n
ctor PFunctor.M.Agree'.trivial E0 #
∀ {F : PFunctor.{uA, uB}} (x y : F.M), PFunctor.M.Agree' 0 x y
ctor PFunctor.M.Agree'.step E0 #
∀ {F : PFunctor.{uA, uB}} {n : ℕ} {a : F.A} (x y : F.B a → F.M) {x' y' : F.M},
x' = PFunctor.M.mk (PFunctor.Obj.mk a x) →
y' = PFunctor.M.mk (PFunctor.Obj.mk a y) →
(∀ (i : F.B a), PFunctor.M.Agree' n (x i) (y i)) → PFunctor.M.Agree' n.succ x' y'
theorem PFunctor.M.dest_mk E0 #
∀ {F : PFunctor.{uA, uB}} (x : ↑F F.M), (PFunctor.M.mk x).dest = x
theorem PFunctor.M.mk_dest E0 #
∀ {F : PFunctor.{uA, uB}} (x : F.M), PFunctor.M.mk x.dest = x
theorem PFunctor.M.mk_inj E1 #
∀ {F : PFunctor.{uA, uB}} {x y : ↑F F.M}, PFunctor.M.mk x = PFunctor.M.mk y → x = y
def PFunctor.M.cases E1 #
{F : PFunctor.{uA, uB}} → {r : F.M → Sort w} → ((x : ↑F F.M) → r (PFunctor.M.mk x)) → (x : F.M) → r x
destructor for M-types
def PFunctor.M.casesOn E1 #
{F : PFunctor.{uA, uB}} → {r : F.M → Sort w} → (x : F.M) → ((x : ↑F F.M) → r (PFunctor.M.mk x)) → r x
destructor for M-types
def PFunctor.M.casesOn' E1 #
{F : PFunctor.{uA, uB}} →
{r : F.M → Sort w} → (x : F.M) → ((a : F.A) → (f : F.B a → F.M) → r (PFunctor.M.mk (PFunctor.Obj.mk a f))) → r x
destructor for M-types, similar to casesOn but also
gives access directly to the root and subtrees on an M-type
theorem PFunctor.M.approx_mk E0 #
∀ {F : PFunctor.{uA, uB}} (a : F.A) (f : F.B a → F.M) (i : ℕ),
(PFunctor.M.mk (PFunctor.Obj.mk a f)).approx i.succ = PFunctor.Approx.CofixA.intro a fun j ↦ (f j).approx i
theorem PFunctor.M.agree'_refl E0 #
∀ {F : PFunctor.{uA, uB}} {n : ℕ} (x : F.M), PFunctor.M.Agree' n x x
theorem PFunctor.M.agree_iff_agree' E1 #
∀ {F : PFunctor.{uA, uB}} {n : ℕ} (x y : F.M),
PFunctor.Approx.Agree (x.approx n) (y.approx (n + 1)) ↔ PFunctor.M.Agree' n x y
theorem PFunctor.M.cases_mk E0 #
∀ {F : PFunctor.{uA, uB}} {r : F.M → Sort u_2} (x : ↑F F.M) (f : (x : ↑F F.M) → r (PFunctor.M.mk x)),
PFunctor.M.cases f (PFunctor.M.mk x) = f x
theorem PFunctor.M.casesOn_mk E0 #
∀ {F : PFunctor.{uA, uB}} {r : F.M → Sort u_2} (x : ↑F F.M) (f : (x : ↑F F.M) → r (PFunctor.M.mk x)),
(PFunctor.M.mk x).casesOn f = f x
theorem PFunctor.M.casesOn_mk' E0 #
∀ {F : PFunctor.{uA, uB}} {r : F.M → Sort u_2} {a : F.A} (x : F.B a → F.M)
(f : (a : F.A) → (f : F.B a → F.M) → r (PFunctor.M.mk (PFunctor.Obj.mk a f))),
(PFunctor.M.mk (PFunctor.Obj.mk a x)).casesOn' f = f a x
inductive PFunctor.M.IsPath E1 #
{F : PFunctor.{uA, uB}} → PFunctor.Approx.Path F → F.M → Prop
IsPath p x tells us if p is a valid path through x
ctor PFunctor.M.IsPath.nil E0 #
∀ {F : PFunctor.{uA, uB}} (x : F.M), PFunctor.M.IsPath [] x
ctor PFunctor.M.IsPath.cons E0 #
∀ {F : PFunctor.{uA, uB}} (xs : PFunctor.Approx.Path F) {a : F.A} (x : F.M) (f : F.B a → F.M) (i : F.B a),
x = PFunctor.M.mk (PFunctor.Obj.mk a f) → PFunctor.M.IsPath xs (f i) → PFunctor.M.IsPath (⟨a, i⟩ :: xs) x
theorem PFunctor.M.isPath_cons E1 #
∀ {F : PFunctor.{uA, uB}} {xs : PFunctor.Approx.Path F} {a a' : F.A} {f : F.B a → F.M} {i : F.B a'},
PFunctor.M.IsPath (⟨a', i⟩ :: xs) (PFunctor.M.mk (PFunctor.Obj.mk a f)) → a = a'
theorem PFunctor.M.isPath_cons' E1 #
∀ {F : PFunctor.{uA, uB}} {xs : PFunctor.Approx.Path F} {a : F.A} {f : F.B a → F.M} {i : F.B a},
PFunctor.M.IsPath (⟨a, i⟩ :: xs) (PFunctor.M.mk (PFunctor.Obj.mk a f)) → PFunctor.M.IsPath xs (f i)
def PFunctor.M.isubtree E1 #
{F : PFunctor.{uA, uB}} → [DecidableEq F.A] → [Inhabited F.M] → PFunctor.Approx.Path F → F.M → F.M
follow a path through a value of M F and return the subtree
found at the end of the path if it is a valid path for that value and
return a default tree
def PFunctor.M.iselect E1 #
{F : PFunctor.{uA, uB}} → [DecidableEq F.A] → [Inhabited F.M] → PFunctor.Approx.Path F → F.M → F.A
similar to isubtree but returns the data at the end of the path instead
of the whole subtree
theorem PFunctor.M.iselect_eq_default E1 #
∀ {F : PFunctor.{uA, uB}} [inst : DecidableEq F.A] [inst_1 : Inhabited F.M] (ps : PFunctor.Approx.Path F) (x : F.M),
¬PFunctor.M.IsPath ps x → PFunctor.M.iselect ps x = default.head
theorem PFunctor.M.head_mk E0 #
∀ {F : PFunctor.{uA, uB}} (x : ↑F F.M), (PFunctor.M.mk x).head = x.fst
theorem PFunctor.M.children_mk E0 #
∀ {F : PFunctor.{uA, uB}} {a : F.A} (x : F.B a → F.M) (i : F.B (PFunctor.M.mk (PFunctor.Obj.mk a x)).head),
(PFunctor.M.mk (PFunctor.Obj.mk a x)).children i = x (cast ⋯ i)
theorem PFunctor.M.ichildren_mk E0 #
∀ {F : PFunctor.{uA, uB}} [inst : DecidableEq F.A] [inst_1 : Inhabited F.M] (x : ↑F F.M) (i : F.Idx),
PFunctor.M.ichildren i (PFunctor.M.mk x) = x.iget i
theorem PFunctor.M.isubtree_cons E0 #
∀ {F : PFunctor.{uA, uB}} [inst : DecidableEq F.A] [inst_1 : Inhabited F.M] (ps : PFunctor.Approx.Path F) {a : F.A}
(f : F.B a → F.M) {i : F.B a},
PFunctor.M.isubtree (⟨a, i⟩ :: ps) (PFunctor.M.mk (PFunctor.Obj.mk a f)) = PFunctor.M.isubtree ps (f i)
theorem PFunctor.M.iselect_nil E0 #
∀ {F : PFunctor.{uA, uB}} [inst : DecidableEq F.A] [inst_1 : Inhabited F.M] {a : F.A} (f : F.B a → F.M),
PFunctor.M.iselect [] (PFunctor.M.mk (PFunctor.Obj.mk a f)) = a
theorem PFunctor.M.iselect_cons E0 #
∀ {F : PFunctor.{uA, uB}} [inst : DecidableEq F.A] [inst_1 : Inhabited F.M] (ps : PFunctor.Approx.Path F) {a : F.A}
(f : F.B a → F.M) {i : F.B a},
PFunctor.M.iselect (⟨a, i⟩ :: ps) (PFunctor.M.mk (PFunctor.Obj.mk a f)) = PFunctor.M.iselect ps (f i)
theorem PFunctor.M.corec_def E0 #
∀ {F : PFunctor.{uA, uB}} {X : Type u_2} (f : X → ↑F X) (x₀ : X),
PFunctor.M.corec f x₀ = PFunctor.M.mk (F.map (PFunctor.M.corec f) (f x₀))
theorem PFunctor.M.ext_aux E0 #
∀ {F : PFunctor.{uA, uB}} [inst : Inhabited F.M] [inst_1 : DecidableEq F.A] {n : ℕ} (x y z : F.M),
PFunctor.M.Agree' n z x →
PFunctor.M.Agree' n z y →
(∀ (ps : PFunctor.Approx.Path F), n = List.length ps → PFunctor.M.iselect ps x = PFunctor.M.iselect ps y) →
x.approx (n + 1) = y.approx (n + 1)
theorem PFunctor.M.ext E1 #
∀ {F : PFunctor.{uA, uB}} [inst : Inhabited F.M] [inst_1 : DecidableEq F.A] (x y : F.M),
(∀ (ps : PFunctor.Approx.Path F), PFunctor.M.iselect ps x = PFunctor.M.iselect ps y) → x = y
structure PFunctor.M.IsBisimulation E1 #
{F : PFunctor.{uA, uB}} → (F.M → F.M → Prop) → Prop
Bisimulation is the standard proof technique for equality between infinite tree-like structures
ctor PFunctor.M.IsBisimulation.mk E0 #
∀ {F : PFunctor.{uA, uB}} {R : F.M → F.M → Prop},
(∀ {a a' : F.A} {f : F.B a → F.M} {f' : F.B a' → F.M},
R (PFunctor.M.mk (PFunctor.Obj.mk a f)) (PFunctor.M.mk (PFunctor.Obj.mk a' f')) → a = a') →
(∀ {a : F.A} {f f' : F.B a → F.M},
R (PFunctor.M.mk (PFunctor.Obj.mk a f)) (PFunctor.M.mk (PFunctor.Obj.mk a f')) →
∀ (i : F.B a), R (f i) (f' i)) →
PFunctor.M.IsBisimulation R
theorem PFunctor.M.IsBisimulation.head E1 #
∀ {F : PFunctor.{uA, uB}} {R : F.M → F.M → Prop},
PFunctor.M.IsBisimulation R →
∀ {a a' : F.A} {f : F.B a → F.M} {f' : F.B a' → F.M},
R (PFunctor.M.mk (PFunctor.Obj.mk a f)) (PFunctor.M.mk (PFunctor.Obj.mk a' f')) → a = a'
The head of the trees are equal
theorem PFunctor.M.IsBisimulation.tail E1 #
∀ {F : PFunctor.{uA, uB}} {R : F.M → F.M → Prop},
PFunctor.M.IsBisimulation R →
∀ {a : F.A} {f f' : F.B a → F.M},
R (PFunctor.M.mk (PFunctor.Obj.mk a f)) (PFunctor.M.mk (PFunctor.Obj.mk a f')) → ∀ (i : F.B a), R (f i) (f' i)
The tails are equal
theorem PFunctor.M.nth_of_bisim E1 #
∀ {F : PFunctor.{uA, uB}} (R : F.M → F.M → Prop) [inst : Inhabited F.M] [inst_1 : DecidableEq F.A],
PFunctor.M.IsBisimulation R →
∀ (s₁ s₂ : F.M) (ps : PFunctor.Approx.Path F),
R s₁ s₂ →
PFunctor.M.IsPath ps s₁ ∨ PFunctor.M.IsPath ps s₂ →
PFunctor.M.iselect ps s₁ = PFunctor.M.iselect ps s₂ ∧
∃ a f f',
PFunctor.M.isubtree ps s₁ = PFunctor.M.mk (PFunctor.Obj.mk a f) ∧
PFunctor.M.isubtree ps s₂ = PFunctor.M.mk (PFunctor.Obj.mk a f') ∧ ∀ (i : F.B a), R (f i) (f' i)
def PFunctor.M.corecOn E1 #
{F : PFunctor.{uA, uB}} → {X : Type u_2} → X → (X → ↑F X) → F.M
corecursor for M F with swapped arguments
theorem PFunctor.M.dest_corec E1 #
∀ {P : PFunctor.{uA, uB}} {α : Type u_2} (g : α → ↑P α) (x : α),
(PFunctor.M.corec g x).dest = P.map (PFunctor.M.corec g) (g x)
theorem PFunctor.M.bisim E1 #
∀ {P : PFunctor.{uA, uB}} (R : P.M → P.M → Prop),
(∀ (x y : P.M),
R x y → ∃ a f f', x.dest = PFunctor.Obj.mk a f ∧ y.dest = PFunctor.Obj.mk a f' ∧ ∀ (i : P.B a), R (f i) (f' i)) →
∀ (x y : P.M), R x y → x = y
theorem PFunctor.M.bisim' E1 #
∀ {P : PFunctor.{uA, uB}} {α : Type u_3} (Q : α → Prop) (u v : α → P.M),
(∀ (x : α),
Q x →
∃ a f f',
(u x).dest = PFunctor.Obj.mk a f ∧
(v x).dest = PFunctor.Obj.mk a f' ∧ ∀ (i : P.B a), ∃ x', Q x' ∧ f i = u x' ∧ f' i = v x') →
∀ (x : α), Q x → u x = v x
theorem PFunctor.M.bisim_equiv E1 #
∀ {P : PFunctor.{uA, uB}} (R : P.M → P.M → Prop),
(∀ (x y : P.M),
R x y → ∃ a f f', x.dest = PFunctor.Obj.mk a f ∧ y.dest = PFunctor.Obj.mk a f' ∧ ∀ (i : P.B a), R (f i) (f' i)) →
∀ (x y : P.M), R x y → x = y
theorem PFunctor.M.corec_unique E1 #
∀ {P : PFunctor.{uA, uB}} {α : Type u_2} (g : α → ↑P α) (f : α → P.M),
(∀ (x : α), (f x).dest = P.map f (g x)) → f = PFunctor.M.corec g
def PFunctor.M.corec₁ E1 #
{P : PFunctor.{uA, uB}} → {α : Type u} → ((X : Type u) → (α → X) → α → ↑P X) → α → P.M
corecursor where the state of the computation can be sent downstream in the form of a recursive call
def PFunctor.M.corec' E1 #
{P : PFunctor.{uA, uB}} → {α : Type u} → ({X : Type (max u uA uB)} → (α → X) → α → P.M ⊕ ↑P X) → α → P.M
corecursor where it is possible to return a fully formed value at any point of the computation