Documentation

CslibFrontier.Algorithms.Lean.TreeDecomposition.BagAssignment

Bag assignments indexed in radix q #

For dynamic programming over a tree decomposition of a constraint satisfaction problem over a finite domain of size q > 0, tables at a bag listed by L : List V are indexed by natural numbers m < q ^ L.length in mixed-arity base q.

Machine-level running-time bounds for radix lookup, bag projection, and constraint evaluation live in CslibFrontier.Algorithms.WordRAM.TreeDecomposition.CSP.

Main definitions #

Main results #

Decode m in base q into an assignment along the variable list L, defaulting to 0 off L.

def Cslib.Algorithms.Lean.TreeDecomposition.ofRadixFin {V : Type u_1} [DecidableEq V] (q : ℕ) (hq : 0 < q) (L : List V) (m : ℕ) (x : V) :
Fin q

Decode m in base q into a Fin q-valued assignment along L.

def Cslib.Algorithms.Lean.TreeDecomposition.toRadix {V : Type u_1} (q : ℕ) :
List V → (V → ℕ) → ℕ

Encode α on L in base q, reduced modulo q at each entry.

@[simp]
theorem Cslib.Algorithms.Lean.TreeDecomposition.toRadix_nil {V : Type u_1} (q : ℕ) (α : V → ℕ) :
toRadix q [] α = 0
@[simp]
theorem Cslib.Algorithms.Lean.TreeDecomposition.toRadix_cons {V : Type u_1} (q : ℕ) (v : V) (L : List V) (α : V → ℕ) :
toRadix q (v :: L) α = α v % q + q * toRadix q L α
theorem Cslib.Algorithms.Lean.TreeDecomposition.ofRadix_lt {V : Type u_1} [DecidableEq V] {q : ℕ} (hq : 0 < q) (L : List V) (m : ℕ) (x : V) :
ofRadix q L m x < q
theorem Cslib.Algorithms.Lean.TreeDecomposition.ofRadix_eq_zero_of_notMem {V : Type u_1} [DecidableEq V] {q : ℕ} (L : List V) (m : ℕ) {x : V} (hx : x ∉ L) :
ofRadix q L m x = 0
theorem Cslib.Algorithms.Lean.TreeDecomposition.ofRadix_cons_self {V : Type u_1} [DecidableEq V] {q : ℕ} (v : V) (L : List V) (m : ℕ) :
ofRadix q (v :: L) m v = m % q
theorem Cslib.Algorithms.Lean.TreeDecomposition.ofRadix_cons_ne {V : Type u_1} [DecidableEq V] {q : ℕ} {u x : V} (h : x ≠ u) (L : List V) (m : ℕ) :
ofRadix q (u :: L) m x = ofRadix q L (m / q) x
theorem Cslib.Algorithms.Lean.TreeDecomposition.toRadix_congr {V : Type u_1} {q : ℕ} {L : List V} {α β : V → ℕ} (h : ∀ v ∈ L, α v = β v) :
toRadix q L α = toRadix q L β
theorem Cslib.Algorithms.Lean.TreeDecomposition.toRadix_lt {V : Type u_1} {q : ℕ} (hq : 0 < q) (L : List V) (α : V → ℕ) :
toRadix q L α < q ^ L.length
theorem Cslib.Algorithms.Lean.TreeDecomposition.toRadix_ofRadix {V : Type u_1} [DecidableEq V] {q : ℕ} {L : List V} (hL : L.Nodup) {m : ℕ} (hm : m < q ^ L.length) :
toRadix q L (ofRadix q L m) = m
theorem Cslib.Algorithms.Lean.TreeDecomposition.ofRadix_toRadix {V : Type u_1} [DecidableEq V] {q : ℕ} (hq : 0 < q) {L : List V} {α : V → ℕ} (hα : ∀ v ∈ L, α v < q) {x : V} (hx : x ∈ L) :
ofRadix q L (toRadix q L α) x = α x