Gate clauses

Lax429075.Tseitin · concepts/Lax429075/Tseitin.lean · lax-429075

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

    The Tseitin encoding assigns one variable to each gate. At most three clauses enforce a gate's truth table, and a unit clause requires a true output. Input gates have no constraints.

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

    In the paper

    • page 2 of this submission's paper

    Lean source view on GitHub

    1import Lax429075.Circuits
    2
    3/-!
    4---
    5title: Gate clauses
    6type: definition
    7---
    8The Tseitin encoding assigns one variable to each gate. At most three
    9clauses enforce a gate's truth table, and a unit clause requires a true
    10output. Input gates have no constraints.
    11-/
    12
    13namespace Lax429075.Tseitin
    14
    15open CNF Circuits
    16
    17def positive (i : ℕ) : Literal := ⟨i, true
    18def negative (i : ℕ) : Literal := ⟨i, false
    19
    20def gateClauses (i : ℕ) : GateFormula
    21 | .input => []
    22 | .constant b => [[⟨i, b⟩]]
    23 | .neg a => [[positive i, positive a], [negative i, negative a]]
    24 | .conj a b => [[negative i, positive a], [negative i, positive b],
    25 [positive i, negative a, negative b]]
    26 | .disj a b => [[positive i, negative a], [positive i, negative b],
    27 [negative i, positive a, positive b]]
    28
    29def encode (C : Circuit) : Formula :=
    30 [[positive C.output]] ++ C.gates.zipIdx.flatMap (fun gi => gateClauses gi.2 gi.1)
    31
    32end Lax429075.Tseitin
    33

    Discussion

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

    Loading discussion…