Documentation

CslibFrontier.Logics.Propositional.DNF

Disjunctive normal form #

Formulas in disjunctive normal form over a type of variables V, dual to the conjunctive normal form of Cslib.Logic.PL.CNF. A term is a list of literals read conjunctively, and a formula is a list of terms read disjunctively. Negating every literal turns a term into a clause and a formula in disjunctive normal form into the negation of a formula in conjunctive normal form (DNF.eval_negate).

Main definitions #

Main results #

References #

@[reducible, inline]
abbrev Cslib.Logic.PL.Term (V : Type u_2) :
Type u_2

A term is a conjunction of literals.

@[reducible, inline]
abbrev Cslib.Logic.PL.DNF (V : Type u_2) :
Type u_2

A formula in disjunctive normal form is a disjunction of terms.

def Cslib.Logic.PL.Term.eval {V : Type u_1} (σ : V → Bool) (t : Term V) :

A term holds when all of its literals do.

def Cslib.Logic.PL.DNF.eval {V : Type u_1} (σ : V → Bool) (φ : DNF V) :

A formula holds when one of its terms does.

theorem Cslib.Logic.PL.Term.eval_eq_true_iff {V : Type u_1} (σ : V → Bool) (t : Term V) :
eval σ t = true ↔ ∀ l ∈ t, σ l.1 = l.2

A term holds when every literal does.

theorem Cslib.Logic.PL.Term.eval_update_of_forall_ne {V : Type u_1} [DecidableEq V] {t : Term V} {i : V} (hi : ∀ l ∈ t, l.1 ≠ i) (x : V → Bool) (b : Bool) :
eval (Function.update x i b) t = eval x t

Flipping a variable that a term does not mention does not change its value.

@[simp]
theorem Cslib.Logic.PL.Term.eval_nil {V : Type u_1} (σ : V → Bool) :

Evaluating the empty term yields true.

@[simp]
theorem Cslib.Logic.PL.Term.eval_cons {V : Type u_1} (σ : V → Bool) (l : Literal V) (t : Term V) :
eval σ (l :: t) = (Literal.eval σ l && eval σ t)

Evaluating a cons term conjoins the head literal with the tail term.

theorem Cslib.Logic.PL.DNF.eval_eq_true_iff {V : Type u_1} (σ : V → Bool) (φ : DNF V) :
eval σ φ = true ↔ ∃ t ∈ φ, Term.eval σ t = true

A formula holds when some term does.

@[simp]
theorem Cslib.Logic.PL.DNF.eval_nil {V : Type u_1} (σ : V → Bool) :

Evaluating the empty DNF formula yields false.

@[simp]
theorem Cslib.Logic.PL.DNF.eval_append {V : Type u_1} (σ : V → Bool) (φ ψ : DNF V) :
eval σ (φ ++ ψ) = (eval σ φ || eval σ ψ)

Evaluating the concatenation of two DNF formulas disjoins their values.

@[simp]
theorem Cslib.Logic.PL.DNF.eval_cons {V : Type u_1} (σ : V → Bool) (t : Term V) (φ : DNF V) :
eval σ (t :: φ) = (Term.eval σ t || eval σ φ)

Evaluating a cons DNF formula disjoins the head term with the tail formula.

def Cslib.Logic.PL.Term.negate {V : Type u_1} (t : Term V) :

The clause of the negated literals of a term.

@[simp]
theorem Cslib.Logic.PL.Term.eval_negate {V : Type u_1} (σ : V → Bool) (t : Term V) :

Evaluating the negated clause of a term t negates t.eval σ.

@[simp]

Negating a term preserves its length.

def Cslib.Logic.PL.DNF.negate {V : Type u_1} (φ : DNF V) :
CNF V

The formula in conjunctive normal form of the negation of a formula in disjunctive normal form.

@[simp]
theorem Cslib.Logic.PL.DNF.eval_negate {V : Type u_1} (σ : V → Bool) (φ : DNF V) :
CNF.eval σ φ.negate = !eval σ φ

De Morgan duality.

def Cslib.Logic.PL.Clause.negate {V : Type u_1} (c : Clause V) :

The term of the negated literals of a clause.

@[simp]
theorem Cslib.Logic.PL.Clause.eval_negate {V : Type u_1} (σ : V → Bool) (c : Clause V) :

Evaluating the negated term of a clause c negates c.eval σ.

@[simp]

Negating a clause preserves its length.

Negating a clause preserves its list of underlying variables.

def Cslib.Logic.PL.CNF.negate {V : Type u_1} (φ : CNF V) :
DNF V

The formula in disjunctive normal form of the negation of a formula in conjunctive normal form.

@[simp]
theorem Cslib.Logic.PL.CNF.eval_negate {V : Type u_1} (σ : V → Bool) (φ : CNF V) :
DNF.eval σ φ.negate = !eval σ φ

De Morgan duality, from conjunctive to disjunctive normal form.

@[simp]

Negating a clause and then the resulting term preserves its literals.

@[simp]
theorem Cslib.Logic.PL.Term.negate_negate {V : Type u_1} (t : Term V) :

Negating a term and then the resulting clause preserves its literals.

@[simp]
theorem Cslib.Logic.PL.CNF.negate_negate {V : Type u_1} (p : CNF V) :

Taking the Boolean dual twice preserves the CNF.

@[simp]
theorem Cslib.Logic.PL.DNF.negate_negate {V : Type u_1} (p : DNF V) :

Taking the Boolean dual twice preserves the DNF.