Documentation

CslibFrontier.Computability.TreeEval.Ary.Descending

Unfolding computations with decreasing natural-number indices #

A computation has a source value at index zero, a gate at each positive index, and d strictly earlier dependencies. Unfolding those dependencies gives the existing Ary.Tree. Constant gates pad the source to obtain a uniform height. Paths can be resolved by following indices, without materializing the tree.

Main results #

These are pure semantic constructions, with no native resource certificate.

def Cslib.TreeEval.Ary.Descending.next {d : ℕ} (child : ℕ → Fin d → ℕ) (i : ℕ) (j : Fin d) :

A source has only source dependencies; positive indices follow the supplied dependencies.

def Cslib.TreeEval.Ary.Descending.paddedGate {d ℓ : ℕ} (source : Fin ℓ → Bool) (gates : ℕ → Gate d ℓ) (i : ℕ) :
Gate d ℓ

A constant gate pads the source; every positive index uses its supplied gate.

@[irreducible]
def Cslib.TreeEval.Ary.Descending.value {d ℓ : ℕ} (source : Fin ℓ → Bool) (child : ℕ → Fin d → ℕ) (gates : ℕ → Gate d ℓ) (hchild : ∀ (i : ℕ), 0 < i → ∀ (j : Fin d), child i j < i) :
ℕ → Fin ℓ → Bool

Evaluate a computation whose positive dependencies have strictly smaller indices.

def Cslib.TreeEval.Ary.Descending.tree {d ℓ : ℕ} (source : Fin ℓ → Bool) (child : ℕ → Fin d → ℕ) (gates : ℕ → Gate d ℓ) (h a✝ : ℕ) :
Tree d ℓ h

Unfold dependencies to height h, padding source nodes with constant gates.

theorem Cslib.TreeEval.Ary.Descending.eval_tree {d ℓ : ℕ} (source : Fin ℓ → Bool) (child : ℕ → Fin d → ℕ) (gates : ℕ → Gate d ℓ) (hchild : ∀ (i : ℕ), 0 < i → ∀ (j : Fin d), child i j < i) {h i : ℕ} (hi : i ≤ h) :
(tree source child gates h i).eval = value source child gates hchild i

A height at least the starting index suffices to reach every source dependency.

def Cslib.TreeEval.Ary.Descending.resolve {d : ℕ} (child : ℕ → Fin d → ℕ) (i : ℕ) (P : List (Fin d)) :

Resolve an implicit node index by following the path from the root.

@[simp]
theorem Cslib.TreeEval.Ary.Descending.resolve_nil {d : ℕ} (child : ℕ → Fin d → ℕ) (i : ℕ) :
resolve child i [] = i
theorem Cslib.TreeEval.Ary.Descending.resolve_cons {d : ℕ} (child : ℕ → Fin d → ℕ) (i : ℕ) (j : Fin d) (P : List (Fin d)) :
resolve child i (j :: P) = resolve child (next child i j) P
def Cslib.TreeEval.Ary.Descending.lookup {d ℓ : ℕ} (source : Fin ℓ → Bool) (child : ℕ → Fin d → ℕ) (gates : ℕ → Gate d ℓ) (h i : ℕ) (P : List (Fin d)) :
Tree.Node d ℓ

The label at an implicit path, including the uniform source padding and invalid paths.

theorem Cslib.TreeEval.Ary.Descending.nodeAt_tree {d ℓ : ℕ} (source : Fin ℓ → Bool) (child : ℕ → Fin d → ℕ) (gates : ℕ → Gate d ℓ) (h i : ℕ) (P : List (Fin d)) :
(tree source child gates h i).nodeAt P = lookup source child gates h i P

The unfolded tree is read by resolving just one decreasing index along the path.