File: Mathlib/Data/W/Basic.lean

full_name: WType
code: /--
Given `β : α → Type*`, `WType β` is the type of finitely branching trees where nodes are labeled by
elements of `α` and the children of a node labeled `a` are indexed by elements of `β a`.
-/
inductive WType {α : Type*} (β : α → Type*)
  | mk (a : α) (f : β a → WType β) : WType β
goal: Type (max u_1 u_2)

full_name: WType.mk
code: /--
Given `β : α → Type*`, `WType β` is the type of finitely branching trees where nodes are labeled by
elements of `α` and the children of a node labeled `a` are indexed by elements of `β a`.
-/
inductive WType {α : Type*} (β : α → Type*)
  | mk (a : α) (f : β a → WType β) : WType β
goal: WType β

full_name: instInhabitedWTypeUnitEmpty
code: instance : Inhabited (WType fun _ : Unit => Empty) 
goal: Inhabited (WType fun x => Empty)

full_name: WType.toSigma
code: /-- The canonical map to the corresponding sigma type, returning the label of a node as an
  element `a` of `α`, and the children of the node as a function `β a → WType β`. -/
def toSigma : WType β → Σa : α, β a → WType β
  
goal: WType β → (a : α) × (β a → WType β)

full_name: WType.ofSigma
code: /-- The canonical map from the sigma type into a `WType`. Given a node `a : α`, and
  its children as a function `β a → WType β`, return the corresponding tree. -/
def ofSigma : (Σa : α, β a → WType β) → WType β
  
goal: (a : α) × (β a → WType β) → WType β

full_name: WType.ofSigma_toSigma
code: @[simp]
theorem ofSigma_toSigma : ∀ w : WType β, ofSigma (toSigma w) = w
  
goal: WType.ofSigma w.toSigma = w

full_name: WType.toSigma_ofSigma
code: @[simp]
theorem toSigma_ofSigma : ∀ s : Σa : α, β a → WType β, toSigma (ofSigma s) = s
  
goal: (WType.ofSigma s).toSigma = s

full_name: WType.equivSigma_apply
code: /-- The canonical bijection with the sigma type, showing that `WType` is a fixed point of
  the polynomial functor `X ↦ Σ a : α, β a → X`. -/
@[simps]
def equivSigma : WType β ≃ Σa : α, β a → WType β 
goal: ∀ (a : WType β), (WType.equivSigma β) a = a.toSigma

full_name: WType.equivSigma
code: /-- The canonical bijection with the sigma type, showing that `WType` is a fixed point of
  the polynomial functor `X ↦ Σ a : α, β a → X`. -/
@[simps]
def equivSigma : WType β ≃ Σa : α, β a → WType β 
goal: WType β ≃ (a : α) × (β a → WType β)

full_name: WType.equivSigma_symm_apply
code: /-- The canonical bijection with the sigma type, showing that `WType` is a fixed point of
  the polynomial functor `X ↦ Σ a : α, β a → X`. -/
@[simps]
def equivSigma : WType β ≃ Σa : α, β a → WType β 
goal: ∀ (a : (a : α) × (β a → WType β)), (WType.equivSigma β).symm a = WType.ofSigma a

full_name: WType.elim
code: /-- The canonical map from `WType β` into any type `γ` given a map `(Σ a : α, β a → γ) → γ`. -/
def elim (γ : Type*) (fγ : (Σa : α, β a → γ) → γ) : WType β → γ
  
goal: WType β → γ

full_name: WType.elim_injective
code: theorem elim_injective (γ : Type*) (fγ : (Σa : α, β a → γ) → γ)
    (fγ_injective : Function.Injective fγ) : Function.Injective (elim γ fγ)
  
goal: Function.Injective (WType.elim γ fγ)

full_name: WType.instIsEmpty
code: instance [hα : IsEmpty α] : IsEmpty (WType β) 
goal: IsEmpty (WType β)

full_name: WType.infinite_of_nonempty_of_isEmpty
code: theorem infinite_of_nonempty_of_isEmpty (a b : α) [ha : Nonempty (β a)] [he : IsEmpty (β b)] :
    Infinite (WType β) 
goal: Infinite (WType β)

full_name: WType.depth
code: /-- The depth of a finitely branching tree. -/
def depth : WType β → ℕ
  
goal: WType β → ℕ

full_name: WType.depth_pos
code: theorem depth_pos (t : WType β) : 0 < t.depth 
goal: 0 < t.depth

full_name: WType.depth_lt_depth_mk
code: theorem depth_lt_depth_mk (a : α) (f : β a → WType β) (i : β a) : depth (f i) < depth ⟨a, f⟩ 
goal: (f i).depth < (WType.mk a f).depth

full_name: _private.Mathlib.Data.W.Basic.0.WType.WType'
code: private abbrev WType' {α : Type*} (β : α → Type*) [∀ a : α, Fintype (β a)]
    [∀ a : α, Encodable (β a)] (n : ℕ) 
goal: Type (max 0 u_3 u_4)

full_name: _private.Mathlib.Data.W.Basic.0.WType.encodable_zero
code: private def encodable_zero : Encodable (WType' β 0) 
goal: Encodable (WType.WType' β 0)

full_name: _private.Mathlib.Data.W.Basic.0.WType.f
code: private def f (n : ℕ) : WType' β (n + 1) → Σa : α, β a → WType' β n
  
goal: WType.WType' β (n + 1) → (a : α) × (β a → WType.WType' β n)

full_name: _private.Mathlib.Data.W.Basic.0.WType.finv
code: private def finv (n : ℕ) : (Σa : α, β a → WType' β n) → WType' β (n + 1)
  
goal: (a : α) × (β a → WType.WType' β n) → WType.WType' β (n + 1)

full_name: _private.Mathlib.Data.W.Basic.0.WType.encodable_succ
code: private def encodable_succ (n : Nat) (h : Encodable (WType' β n)) : Encodable (WType' β (n + 1)) 
goal: Encodable (WType.WType' β (n + 1))

full_name: WType.instEncodable
code: /-- `WType` is encodable when `α` is an encodable fintype and for every `a : α`, `β a` is
encodable. -/
instance : Encodable (WType β) 
goal: Encodable (WType β)