The reduction graph
Lax689614.Construction · concepts/Lax689614/Construction.lean · lax-689614
No public endorsements yet.
Loading review…
Sign in with ORCIDNatural Language Statement
Definition
For a formula with variables and clauses, put and . The vertices are , for clauses, for , for variables, and for . The edges are , , , all , , for , when , and . Labels use consecutive blocks in the displayed order. The correctness statements assume an odd number of clauses.
Concept map
Lean source view on GitHub
| 1 | import Lax689614.Encoding |
| 2 | |
| 3 | /-! |
| 4 | --- |
| 5 | title: The reduction graph |
| 6 | type: definition |
| 7 | --- |
| 8 | For a formula with variables and clauses, put and |
| 9 | . The vertices are , for clauses, |
| 10 | for , for variables, and |
| 11 | for . The edges are , , , all , |
| 12 | , for , when , |
| 13 | and . Labels use consecutive blocks in the displayed order. |
| 14 | The correctness statements assume an odd number of clauses. |
| 15 | -/ |
| 16 | |
| 17 | namespace Lax689614.Construction |
| 18 | |
| 19 | open PositiveCNF |
| 20 | |
| 21 | def K (φ : Formula) : ℕ := 4 * φ.nvars + 6 |
| 22 | def R (φ : Formula) : ℕ := φ.clauses.length + 2 * φ.nvars + 2 |
| 23 | def size (φ : Formula) : ℕ := 2 + 2 * φ.clauses.length + 2 * R φ + φ.nvars + 2 * K φ |
| 24 | |
| 25 | def s : ℕ := 0 |
| 26 | def t : ℕ := 1 |
| 27 | def a (_φ : Formula) (j : ℕ) : ℕ := 2 + j |
| 28 | def b (φ : Formula) (j : ℕ) : ℕ := 2 + φ.clauses.length + j |
| 29 | def v (φ : Formula) (i : ℕ) : ℕ := 2 + 2 * φ.clauses.length + i |
| 30 | def vt (φ : Formula) (i : ℕ) : ℕ := 2 + 2 * φ.clauses.length + R φ + i |
| 31 | def f (φ : Formula) (i : ℕ) : ℕ := 2 + 2 * φ.clauses.length + 2 * R φ + i |
| 32 | def y (φ : Formula) (i : ℕ) : ℕ := |
| 33 | 2 + 2 * φ.clauses.length + 2 * R φ + φ.nvars + i |
| 34 | def z (φ : Formula) (i : ℕ) : ℕ := |
| 35 | 2 + 2 * φ.clauses.length + 2 * R φ + φ.nvars + K φ + i |
| 36 | |
| 37 | def Edge (φ : Formula) (u w : ℕ) : Prop := |
| 38 | (u = s ∧ w = t) ∨ |
| 39 | (∃ j < φ.clauses.length, u = s ∧ w = a φ j) ∨ |
| 40 | (∃ j < φ.clauses.length, u = a φ j ∧ w = b φ j) ∨ |
| 41 | (∃ j < φ.clauses.length, ∃ i < R φ, u = b φ j ∧ w = v φ i) ∨ |
| 42 | (∃ i < R φ, u = v φ i ∧ w = vt φ i) ∨ |
| 43 | (∃ i < φ.nvars, u = v φ i ∧ w = f φ i) ∨ |
| 44 | (∃ j : Fin φ.clauses.length, ∃ i ∈ φ.clauses[j], |
| 45 | u = b φ j ∧ w = f φ i) ∨ |
| 46 | (∃ i < K φ, u = s ∧ w = y φ i) ∨ |
| 47 | (∃ i < K φ, u = y φ i ∧ w = z φ i) |
| 48 | |
| 49 | def graph (φ : Formula) : SimpleGraph ℕ := SimpleGraph.fromRel (Edge φ) |
| 50 | |
| 51 | def board (φ : Formula) : Finset ℕ := Finset.range (size φ) |
| 52 | |
| 53 | def labeledGraph (φ : Formula) : Encoding.Graph where |
| 54 | vertices := size φ |
| 55 | graph := SimpleGraph.fromRel fun u v : Fin (size φ) => Edge φ u.val v.val |
| 56 | |
| 57 | end Lax689614.Construction |
| 58 |
Builds on
From Mathlib
none
Discussion
Ask a question or add context. Endorsements and structured flags are kept in the review panel above.
0 comments