Inductive counting certificates
Lax733996.Counting · concepts/Lax733996/Counting.lean · lax-733996
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 Lax733996.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 Lax733996.Counting |
| 17 | |
| 18 | open Lax733996.Reachability |
| 19 | |
| 20 | noncomputable def layer {N : ℕ} (G : Graph N) (a : Fin N) (k : ℕ) : Finset (Fin N) := by |
| 21 | classical |
| 22 | exact Finset.univ.filter (fun v => Within (fun u v => G u v = true) k a v) |
| 23 | |
| 24 | def Census {N : ℕ} (G : Graph N) (a : Fin N) (k c : ℕ) (S : Finset (Fin N)) : Prop := |
| 25 | S.card = c ∧ ∀ v ∈ S, Within (fun u v => G u v = true) k a v |
| 26 | |
| 27 | def Classify {N : ℕ} (G : Graph N) (a : Fin N) (k c : ℕ) (v : Fin N) : Bool → Prop |
| 28 | | true => Within (fun u v => G u v = true) (k + 1) a v |
| 29 | | false => ∃ S, Census G a k c S ∧ v ≠ a ∧ ∀ u ∈ S, G u v = false |
| 30 | |
| 31 | def CountStep {N : ℕ} (G : Graph N) (a : Fin N) (k c d : ℕ) : Prop := |
| 32 | ∃ answers : Fin N → Bool, (∀ v, Classify G a k c v (answers v)) ∧ |
| 33 | (Finset.univ.filter (fun v => answers v = true)).card = d |
| 34 | |
| 35 | def CountTrace {N : ℕ} (G : Graph N) (a : Fin N) (counts : ℕ → ℕ) : Prop := |
| 36 | counts 0 = 1 ∧ ∀ k < N, CountStep G a k (counts k) (counts (k + 1)) |
| 37 | |
| 38 | def NonreachCertificate {N : ℕ} (G : Graph N) (a b : Fin N) : Prop := |
| 39 | ∃ counts, CountTrace G a counts ∧ |
| 40 | ∃ S, Census G a N (counts N) S ∧ b ∉ S |
| 41 | |
| 42 | end Lax733996.Counting |
| 43 |
Discussion
Ask a question or add context. Endorsements and structured flags are kept in the review panel above.
0 comments