The reduction graph

Lax689614.Construction · concepts/Lax689614/Construction.lean · lax-689614

definition

Loading review…

Sign in with ORCID

Community review

Flags

Each flag is tied to a public ORCID identity and explains why this concept may be incorrect.

No flags have been submitted.

    Community review

    Flag this concept

    State precisely what appears incorrect. This explanation will be public under your ORCID name.

    No source line selected.

    Natural Language Statement

    Definition

    For a formula with nn variables and mm clauses, put K=4n+6K=4n+6 and R=m+2n+2R=m+2n+2. The vertices are s,ts,t, aj,bja_j,b_j for clauses, vi,tiv_i,t_i for 0i<R0\leq i<R, fif_i for variables, and yi,ziy_i,z_i for 0i<K0\leq i<K. The edges are stst, sajsa_j, ajbja_jb_j, all bjvib_jv_i, vitiv_it_i, vifiv_if_i for i<ni<n, bjfib_jf_i when xiCjx_i\in C_j, and syi,yizisy_i,y_iz_i. Labels use consecutive blocks in the displayed order. The correctness statements assume an odd number of clauses.

    Concept map
    5 concepts; 4 descendants hidden
    100%
    Proven claimDefinitionThis conceptRelated conceptA → B: B builds on A

    Lean source view on GitHub

    1import Lax689614.Encoding
    2
    3/-!
    4---
    5title: The reduction graph
    6type: definition
    7---
    8For a formula with nn variables and mm clauses, put K=4n+6K=4n+6 and
    9R=m+2n+2R=m+2n+2. The vertices are s,ts,t, aj,bja_j,b_j for clauses,
    10vi,tiv_i,t_i for 0i<R0\leq i<R, fif_i for variables, and yi,ziy_i,z_i
    11for 0i<K0\leq i<K. The edges are stst, sajsa_j, ajbja_jb_j, all bjvib_jv_i,
    12vitiv_it_i, vifiv_if_i for i<ni<n, bjfib_jf_i when xiCjx_i\in C_j,
    13and syi,yizisy_i,y_iz_i. Labels use consecutive blocks in the displayed order.
    14The correctness statements assume an odd number of clauses.
    15-/
    16
    17namespace Lax689614.Construction
    18
    19open PositiveCNF
    20
    21def K (φ : Formula) : ℕ := 4 * φ.nvars + 6
    22def R (φ : Formula) : ℕ := φ.clauses.length + 2 * φ.nvars + 2
    23def size (φ : Formula) : ℕ := 2 + 2 * φ.clauses.length + 2 * R φ + φ.nvars + 2 * K φ
    24
    25def s : ℕ := 0
    26def t : ℕ := 1
    27def a (_φ : Formula) (j : ℕ) : ℕ := 2 + j
    28def b (φ : Formula) (j : ℕ) : ℕ := 2 + φ.clauses.length + j
    29def v (φ : Formula) (i : ℕ) : ℕ := 2 + 2 * φ.clauses.length + i
    30def vt (φ : Formula) (i : ℕ) : ℕ := 2 + 2 * φ.clauses.length + R φ + i
    31def f (φ : Formula) (i : ℕ) : ℕ := 2 + 2 * φ.clauses.length + 2 * R φ + i
    32def y (φ : Formula) (i : ℕ) : ℕ :=
    33 2 + 2 * φ.clauses.length + 2 * R φ + φ.nvars + i
    34def z (φ : Formula) (i : ℕ) : ℕ :=
    35 2 + 2 * φ.clauses.length + 2 * R φ + φ.nvars + K φ + i
    36
    37def 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
    49def graph (φ : Formula) : SimpleGraph ℕ := SimpleGraph.fromRel (Edge φ)
    50
    51def board (φ : Formula) : Finset ℕ := Finset.range (size φ)
    52
    53def labeledGraph (φ : Formula) : Encoding.Graph where
    54 vertices := size φ
    55 graph := SimpleGraph.fromRel fun u v : Fin (size φ) => Edge φ u.val v.val
    56
    57end Lax689614.Construction
    58

    Discussion

    Ask a question or add context. Endorsements and structured flags are kept in the review panel above.

    Loading discussion…