123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293(**************************************************************************)(* *)(* Alt-Ergo Zero *)(* *)(* Sylvain Conchon and Alain Mebsout *)(* Universite Paris-Sud 11 *)(* *)(* Copyright 2011. This file is distributed under the terms of the *)(* Apache Software License version 2.0 *)(* *)(**************************************************************************)(** Interfaces for Tseitin's CNF conversion *)(** Atomic formulas. *)moduletypeArg=sigtypet(** Type of atomic formulas. *)valneg:t->t(** Negation of atomic formulas. *)valpp:tCCFormat.printer(** Print the given formula. *)end(** CNF conversion
This modules allows to convert arbitrary boolean formulas
into CNF.
*)moduletypeS=sigtypeatom(** The type of atomic formulas. *)typecombinator=And|Or|Nottypeidtypet=private{id:id;view:view;}andview=|True|Litofatom|Combofcombinator*tlist(** The type of arbitrary boolean formulas. Arbitrary boolean formulas
can be built using functions in this module, and then converted
to a CNF, which is a list of clauses that only use atomic formulas. *)valview:t->viewvaltrue_:t(** The [true] formula, i.e a formula that is always satisfied. *)valfalse_:t(** The [false] formula, i.e a formula that cannot be satisfied. *)valatom:atom->t(** [atom p] builds the boolean formula equivalent to the atomic formula [p]. *)valnot_:t->t(** Creates the negation of a boolean formula. *)valand_:tlist->t(** Creates the conjunction of a list of formulas. An empty conjunction is always satisfied. *)valor_:tlist->t(** Creates the disjunction of a list of formulas. An empty disjunction is never satisfied. *)valxor:t->t->t(** [xor p q] creates the boolean formula "[p] xor [q]". *)valimply:t->t->t(** [imply p q] creates the boolean formula "[p] implies [q]". *)valimply_l:tlist->t->tvalequiv:t->t->t(** [equiv p q] creates the boolena formula "[p] is equivalent to [q]". *)valcnf:?simplify:bool->fresh:(unit->atom)->t->atomlistlist(** [cnf f] returns a conjunctive normal form of [f] under the form: a
list (which is a conjunction) of lists (which are disjunctions) of
atomic formulas.
@param fresh used to generate fresh atoms to name formulas
@param simplify if true (default) simplifiy formula *)valpp:tCCFormat.printer(** [pp fmt f] prints the formula on the formatter [fmt].*)end