Semantic invariants of the inductive-counting controller #
The sets in this file are ghost state used in the proofs. They are not part of the controller's registers. A scan selects distinct identifiers because its candidate register increases; equality of its selected count with the round count then forces exhaustiveness.
Main definitions #
Cslib.InductiveCounting.Graph: the graph restricted to the vertex interval.Cslib.InductiveCounting.roundSet,Cslib.InductiveCounting.prefixCount: the finite set represented by a round count and the next-round count below the current target.Cslib.InductiveCounting.Observed: the predicate observed for one included candidate.Cslib.InductiveCounting.RoundCorrect,Cslib.InductiveCounting.ScanContext,Cslib.InductiveCounting.ScanPrefix: ghost invariants for the round count and scan loop.Cslib.InductiveCounting.Safe: no bad vertex is reachable in the restricted input graph.Cslib.InductiveCounting.Invariant: the semantic assertion at each instruction.
References #
theorem Cslib.InductiveCounting.reachable_lt {N source u : ℕ} {edge : ℕ → ℕ → Bool} (hsource : source < N) (h : Relation.ReflTransGen (Graph N edge) source u) :
theorem Cslib.InductiveCounting.within_lt {N source k u : ℕ} {edge : ℕ → ℕ → Bool} (hsource : source < N) (h : Relation.RelatesWithinSteps (Graph N edge) source u k) :
Every vertex reachable within k steps in the restricted graph lies below N.
@[simp]
The prefix count below target 0 is zero.
def Cslib.InductiveCounting.ScanPrefix (N : ℕ) (edge : ℕ → ℕ → Bool) (bad : ℕ → Bool) (source : ℕ) (s : State) :
The selected identifiers form a subset of the processed prefix. The ghost set S is not
stored by the algorithm. Omissions are allowed here and detected by the final count check.
Instances For
theorem Cslib.InductiveCounting.scan_exhaustive {N source : ℕ} {edge : ℕ → ℕ → Bool} {bad : ℕ → Bool} {s : State} (hc : RoundCorrect N edge source s) (hp : ScanPrefix N edge bad source s) (he : s.selected = s.count) :
When the selected count matches the round count, s.hit reflects the entire round set.