Documentation

Complexitylib.Models.FiniteAutomaton.OneWayLiveness.Internal.Binary

Correctness and state cost of the binary liveness scanner #

Descending column order lets a countdown retain the selected target vertex. The codeword transition relation is exactly the relation being encoded. The arbitrary-word-encoding lower bound then applies with no state loss.

theorem Complexity.FiniteAutomaton.BinaryLiveness.evalFrom_scan_columns (n k : ℕ) (hk : k ≤ n) (bits : ℕ → Bool) :
(machine n).evalFrom {State.scan ⟨k, ⋯⟩} (columnWord bits (k + 1)) = {q : State n | ∃ (j : Fin (n + 1)), q = State.carry j ∧ ↑j ≤ k ∧ bits ↑j = true}
theorem Complexity.FiniteAutomaton.BinaryLiveness.evalFrom_seek_row (n : ℕ) (i : Fin (n + 1)) (bits : ℕ → Bool) :
(machine n).evalFrom {State.seek i} (rowWord n bits) = if _hi : ↑i = 0 then {q : State n | ∃ (j : Fin (n + 1)), q = State.carry j ∧ bits ↑j = true} else {State.seek ⟨↑i - 1, ⋯⟩}
theorem Complexity.FiniteAutomaton.BinaryLiveness.evalFrom_row_selection (n : ℕ) (bits : ℕ → Bool) (rows : List (ℕ → Bool)) :
(machine n).evalFrom {q : State n | ∃ (j : Fin (n + 1)), q = State.carry j ∧ bits ↑j = true} (List.flatMap (rowWord n) rows ++ [Letter.stop]) = {q : State n | ∃ (j : Fin (n + 1)), q = State.seek j ∧ bits ↑j = true}
theorem Complexity.FiniteAutomaton.BinaryLiveness.rowAt_relationRows {n : ℕ} (R : BRel (Fin (n + 1))) (i j : Fin (n + 1)) :
rowAt (relationRows R) ↑i ↑j = true ↔ R.holds i j
theorem Complexity.FiniteAutomaton.BinaryLiveness.evalFrom_seek_code {n : ℕ} (R : BRel (Fin (n + 1))) (i : Fin (n + 1)) :
(machine n).evalFrom {State.seek i} (code R) = {q : State n | ∃ (j : Fin (n + 1)), q = State.seek j ∧ R.holds i j}
theorem Complexity.FiniteAutomaton.BinaryLiveness.binary_state_lower_bound (n : ℕ) (positive : Bool) (s : ℕ) (D : DMachine Bool s) (hD : D.Recognizes positive (binaryMachine (machine (n + 1))).accepts) :
2 ^ (n / 31) ≤ 4 * (s + if positive = true then 2 else 1) ^ 2