A fixed RAM program for exact small-target search
Lax263307.NativeExhaustive · concepts/Lax263307/NativeExhaustive.lean · lax-263307
No public endorsements yet.
Loading review…
Sign in with ORCIDNatural Language Statement
Theorem
One finite RAM program enumerates the size-k vertex sets in the same order as the exact branch of the recursive algorithm and returns its first independent set, or reports that no candidate succeeds. The time and sufficient word width are bounded by c(n+k+2)^2(n+1)^k, uniformly for every larger word width.
Concept map
Lean source view on GitHub
| 1 | import Lax263307.ExhaustiveTargets |
| 2 | import Lax263307.WeightedIndependentSet |
| 3 | import Lax808846.Ram |
| 4 | |
| 5 | /-! |
| 6 | --- |
| 7 | title: A fixed RAM program for exact small-target search |
| 8 | type: theorem |
| 9 | --- |
| 10 | One finite RAM program enumerates the size-k vertex sets in the same order |
| 11 | as the exact branch of the recursive algorithm and returns its first |
| 12 | independent set, or reports that no candidate succeeds. The time and |
| 13 | sufficient word width are bounded by c(n+k+2)^2(n+1)^k, uniformly for every |
| 14 | larger word width. |
| 15 | |
| 16 | # Formalization notes |
| 17 | |
| 18 | The input is n, k, the matrix length n^2, and the row-major adjacency |
| 19 | matrix. Failure is encoded as [0]; success is 1 followed by the selected |
| 20 | set's membership vector. Native Pascal-table construction and ranked subset |
| 21 | decoding avoid enumerating the whole powerset. The proof includes actual |
| 22 | matrix reads, independence tests, first-success retention, input/output, |
| 23 | compilation, and instruction and word bounds. The source subroutine also |
| 24 | operates directly on graph buffers for use by the recursive solver. |
| 25 | -/ |
| 26 | |
| 27 | namespace Lax263307.NativeExhaustive |
| 28 | |
| 29 | def encodeInput {n : ℕ} (G : SimpleGraph (Fin n)) [DecidableRel G.Adj] (k : ℕ) : List ℕ := |
| 30 | n::k::(n*n)::(List.ofFn fun u => List.ofFn fun v => if G.Adj u v then 1 else 0).flatten |
| 31 | |
| 32 | def encodeAnswer {n : ℕ} : Option (Finset (Fin n)) → List ℕ |
| 33 | | none => [0] |
| 34 | | some I => 1::WeightedIndependentSet.encodeOutput I |
| 35 | |
| 36 | axiom exists_program : ∃ p : Lax808846.Ram.Program, ∃ c : ℕ, 0<c ∧ |
| 37 | ∀ (n k : ℕ) (G : SimpleGraph (Fin n)) [DecidableRel G.Adj], |
| 38 | ∀ width : ℕ,c*(n+k+2)^2*(n+1)^k≤width → |
| 39 | ∃ t≤c*(n+k+2)^2*(n+1)^k,Lax808846.Ram.RunsTo width p (encodeInput G k) |
| 40 | (encodeAnswer (ExhaustiveTargets.findIndependentSet G k)) t |
| 41 | |
| 42 | end Lax263307.NativeExhaustive |
| 43 |
Formalization notes
The input is n, k, the matrix length n^2, and the row-major adjacency matrix. Failure is encoded as [0]; success is 1 followed by the selected set's membership vector. Native Pascal-table construction and ranked subset decoding avoid enumerating the whole powerset. The proof includes actual matrix reads, independence tests, first-success retention, input/output, compilation, and instruction and word bounds. The source subroutine also operates directly on graph buffers for use by the recursive solver.
Used by
none
From Mathlib
none
Discussion
Ask a question or add context. Endorsements and structured flags are kept in the review panel above.
0 comments