A clause in a CNF.
The literal (i, b) is satisfied if the assignment to i agrees with b.
- atoms : Array α
- polarities : ByteArray
- isBool_polarities (i : Nat) (h : i < self.polarities.size) : self.polarities[i] = 0 ∨ self.polarities[i] = 1
Instances For
@[instance_reducible]
Equations
- c1.instDecidableEq c2 = if h : c1.atoms = c2.atoms ∧ c1.polarities = c2.polarities then isTrue ⋯ else isFalse ⋯
@[inline]
Equations
- Std.Sat.CNF.Clause.empty = { atoms := #[], polarities := ByteArray.empty, size_polarities := ⋯, isBool_polarities := Std.Sat.CNF.Clause.empty._proof_2✝ }
Instances For
@[instance_reducible]
Equations
- Std.Sat.CNF.Clause.instInhabited = { default := Std.Sat.CNF.Clause.empty }
theorem
Std.Sat.CNF.Clause.Internal.polarity_eq_getElem
{α : Type u_1}
{c : Clause α}
{i : Nat}
(h : i < c.polarities.size)
:
Build a Clause from a list of literals.
Equations
- Std.Sat.CNF.Clause.ofLiterals l = List.foldl (fun (c : Std.Sat.CNF.Clause α) (x : Std.Sat.Literal α) => match x with | (atom, pol) => c.add atom pol) Std.Sat.CNF.Clause.empty l
Instances For
@[simp]
@[simp]
@[instance_reducible]
Equations
- Std.Sat.CNF.Clause.instMembershipLiteral = { mem := fun (clause : Std.Sat.CNF.Clause α) (lit : Std.Sat.Literal α) => lit ∈ clause.literals }
@[instance_reducible]
instance
Std.Sat.CNF.Clause.instDecidableMemLiteralOfDecidableEq
{α : Type u_1}
[DecidableEq α]
{lit : Literal α}
{c : Clause α}
:
Equations
@[inline]
unsafe def
Std.Sat.CNF.Clause.forIn'ImplUnsafe
{m : Type u_1 → Type u_2}
{α : Type u_3}
{β : Type u_1}
[Monad m]
(c : Clause α)
(b : β)
(f : (l : Literal α) → l ∈ c → β → m (ForInStep β))
:
m β
See comment at Array.forIn'Unsafe.
Equations
- c.forIn'ImplUnsafe b f = Std.Sat.CNF.Clause.forIn'ImplUnsafe.loop✝ c f c.atoms.usize 0 b
Instances For
@[implemented_by Std.Sat.CNF.Clause.forIn'ImplUnsafe]
def
Std.Sat.CNF.Clause.forIn'Impl
{m : Type u_1 → Type u_2}
{α : Type u_3}
{β : Type u_1}
[Monad m]
(c : Clause α)
(b : β)
(f : (l : Literal α) → l ∈ c → β → m (ForInStep β))
:
m β
Reference implementation for forIn' on Clause, iterating directly over the packed
representation without materializing literals.
Equations
- c.forIn'Impl b f = Std.Sat.CNF.Clause.forIn'Impl.go✝ c f 0 b
Instances For
@[instance_reducible]
instance
Std.Sat.CNF.Clause.instForIn'LiteralInferInstanceMembershipOfMonad
{m : Type u_1 → Type u_2}
{α : Type u_3}
[Monad m]
:
ForIn' m (Clause α) (Literal α) inferInstance
Equations
- Std.Sat.CNF.Clause.instForIn'LiteralInferInstanceMembershipOfMonad = { forIn' := fun {β : Type ?u.3} => Std.Sat.CNF.Clause.forIn'Impl }
@[inline]
Erase all occurrences of lit from c.
Equations
- c.erase lit = Std.Sat.CNF.Clause.erase.go✝ c lit 0 Std.Sat.CNF.Clause.empty
Instances For
The disjunction of two clauses, obtained by concatenating their literals.
Equations
- c1.append c2 = { atoms := c1.atoms ++ c2.atoms, polarities := c1.polarities ++ c2.polarities, size_polarities := ⋯, isBool_polarities := ⋯ }
Instances For
@[instance_reducible]
Equations
@[simp]
@[inline]
Instances For
@[inline]
Equations
- Std.Sat.CNF.emptyWithCapacity n = { clauses := Array.emptyWithCapacity n }
Instances For
@[instance_reducible]
Equations
- Std.Sat.CNF.instAppend = { append := Std.Sat.CNF.append }
@[instance_reducible]
instance
Std.Sat.CNF.Clause.instDecidableVarMemOfDecidableEq
{α : Type u_1}
{v : α}
{c : Clause α}
[DecidableEq α]
:
Equations
- Std.Sat.CNF.Clause.instDecidableVarMemOfDecidableEq = { decide := decide (Array.elem v c.atoms = true), reflects_decide := ⋯ }
@[instance_reducible]
Equations
@[instance_reducible]
instance
Std.Sat.CNF.instDecidableMemClauseOfDecidableEq
{α : Type u_1}
{c : Clause α}
{f : CNF α}
[DecidableEq α]
:
Equations
- Std.Sat.CNF.instDecidableMemClauseOfDecidableEq = { decide := decide (Array.elem c f.clauses = true), reflects_decide := ⋯ }
Variable v occurs in CNF formula f.
Equations
- Std.Sat.CNF.VarMem v f = ∃ (c : Std.Sat.CNF.Clause α), c ∈ f.clauses ∧ Std.Sat.CNF.Clause.VarMem v c
Instances For
@[instance_reducible]
instance
Std.Sat.CNF.instDecidableVarMemOfDecidableEq
{α : Type u_1}
{v : α}
{f : CNF α}
[DecidableEq α]
:
@[instance_reducible]
instance
Std.Sat.CNF.instDecidableExistsVarMemOfDecidableEq
{α : Type u_1}
{f : CNF α}
[DecidableEq α]
:
Equations
- Std.Sat.CNF.instDecidableExistsVarMemOfDecidableEq = decidable_of_iff ((f.clauses.any fun (c : Std.Sat.CNF.Clause α) => c.atoms.size != 0) = true) ⋯
theorem
Std.Sat.CNF.VarMem_of
{α✝ : Type u_1}
{f : CNF α✝}
{c : Clause α✝}
{v : α✝}
(h : c ∈ f)
(w : Clause.VarMem v c)
:
VarMem v f
@[simp]