Inductive counting certificates
Lax362205.Counting · concepts/Lax362205/Counting.lean · lax-362205
No public endorsements yet.
Loading review…
Sign in with ORCIDNatural Language Statement
Definition
The th reachable layer contains vertices at distance at most from the source. A census lists distinct reachable vertices and their path witnesses. Given the correct census size, a negative classification checks that no listed vertex has an edge to the target. A counting step classifies every vertex and counts the positive answers.
Concept map
In the paper
- page 1 of this submission's paper
Lean source view on GitHub
| 1 | import Lax362205.Reachability |
| 2 | import Mathlib.Data.Fintype.Powerset |
| 3 | |
| 4 | /-! |
| 5 | --- |
| 6 | title: Inductive counting certificates |
| 7 | type: definition |
| 8 | --- |
| 9 | The th reachable layer contains vertices at distance at most from the |
| 10 | source. A census lists distinct reachable vertices and their path witnesses. |
| 11 | Given the correct census size, a negative classification checks that no |
| 12 | listed vertex has an edge to the target. A counting step classifies every |
| 13 | vertex and counts the positive answers. |
| 14 | -/ |
| 15 | |
| 16 | namespace Lax362205.Counting |
| 17 | |
| 18 | open scoped Classical |
| 19 | |
| 20 | open Lax362205.Reachability |
| 21 | |
| 22 | /-- The vertices reachable from `a` using at most `k` directed edges. -/ |
| 23 | noncomputable def layer {N : ℕ} (G : Graph N) (a : Fin N) (k : ℕ) : Finset (Fin N) := |
| 24 | Finset.univ.filter (fun v => Within (fun u v => G u v = true) k a v) |
| 25 | |
| 26 | /-- A set of `c` distinct vertices, each reachable within `k` steps. -/ |
| 27 | def Census {N : ℕ} (G : Graph N) (a : Fin N) (k c : ℕ) (S : Finset (Fin N)) : Prop := |
| 28 | S.card = c ∧ ∀ v ∈ S, Within (fun u v => G u v = true) k a v |
| 29 | |
| 30 | /-- A positive answer supplies a path; a negative answer supplies a census that has no edge to `v`. -/ |
| 31 | def Classify {N : ℕ} (G : Graph N) (a : Fin N) (k c : ℕ) (v : Fin N) : Bool → Prop |
| 32 | | true => Within (fun u v => G u v = true) (k + 1) a v |
| 33 | | false => ∃ S, Census G a k c S ∧ v ≠ a ∧ ∀ u ∈ S, G u v = false |
| 34 | |
| 35 | /-- Classify every vertex for the next layer and count exactly `d` positive answers. -/ |
| 36 | def CountStep {N : ℕ} (G : Graph N) (a : Fin N) (k c d : ℕ) : Prop := |
| 37 | ∃ answers : Fin N → Bool, (∀ v, Classify G a k c v (answers v)) ∧ |
| 38 | (Finset.univ.filter (fun v => answers v = true)).card = d |
| 39 | |
| 40 | /-- Start with the source alone and certify the size of each successive reachable layer. -/ |
| 41 | def CountTrace {N : ℕ} (G : Graph N) (a : Fin N) (counts : ℕ → ℕ) : Prop := |
| 42 | counts 0 = 1 ∧ ∀ k < N, CountStep G a k (counts k) (counts (k + 1)) |
| 43 | |
| 44 | /-- A certified sequence of layer counts whose final census omits the target `b`. -/ |
| 45 | def NonreachCertificate {N : ℕ} (G : Graph N) (a b : Fin N) : Prop := |
| 46 | ∃ counts, CountTrace G a counts ∧ |
| 47 | ∃ S, Census G a N (counts N) S ∧ b ∉ S |
| 48 | |
| 49 | end Lax362205.Counting |
| 50 |
Discussion
Ask a question or add context. Endorsements and structured flags are kept in the review panel above.
0 comments