logicUSLIB/logicus-fol/3.2.2

NOTE: the latest version is 3.3.0

LogicUS.FOL.Clauses

The module provides the tools for express formulas in their Clausal Form.

Types

= P ( String, List Int ) (List Term)
| Eq Term Term

It represent An Atom of a clause as a Predicate (P) or as a equality (E)

type alias ClauseFOLLiteral =
( ClauseFOLAtom, Bool )

It represent a literal of a clause as a tuple with the symbol of the literal (string) and the sign of the literal (False:negative literal, True:positive literal).

type alias ClauseFOL =
List ClauseFOLLiteral

It represent a set of clause literals.

type alias ClauseFOLSet =
List ClauseFOL

It represent a set of ClauseFOL

Work with clauses

It gives the variables that appears in a clause atom

cfolVarSymbols : ClauseFOL -> Set Variable

It gives the variables that appears in a clause

cfolAtomSymbol : ClauseFOLAtom -> ( String, List Int )

It gives the symbol of the predicate of the atom ("=" is reserved for equality)

cfolLiteralSymbols : ClauseFOL -> Set ( String, List Int )

It gives the symbols of literals that appears in a clause

It applies a Substitution over a clause atom

cfolApplySubstitution : Substitution -> ClauseFOL -> ClauseFOL

It applies a substitution over a clause

cfolSort : ClauseFOL -> ClauseFOL

It sorts the literals of the clause by alphabetical order.

cfolUnion : ClauseFOL -> ClauseFOL -> ClauseFOL

It calculates the union of two clauses

cfolSubsumes : ClauseFOL -> ClauseFOL -> Bool

Indicates if the first clause subsumes the second (θ-subsumption): there is a substitution θ of the variables of the first clause such that every literal of c1θ is in c2. Only the variables of the first clause are instantiated, and c1 may not have more literals than c2 (so a clause does not subsume its own factors).

cfolSubsumes [ ( P ( "P", [] ) [ Var ( "X", [], 0 ) ], True ) ] [ ( P ( "P", [] ) [ Func ( "a", [] ) [] ], True ), ( P ( "Q", [] ) [], True ) ] == True
cfolIsTautology : ClauseFOL -> Bool

Indicates if the clause is a tautology, that is if it contains a literal and its complement.

cfolIsPositive : ClauseFOL -> Bool

Indicates if the clause is enterly positive, this is with all its literals positive

cfolIsNegative : ClauseFOL -> Bool

Indicates if the clause is enterly negative, this is with all its literals negative

csfolRemoveEqClauses : ClauseFOLSet -> ClauseFOLSet

It removes clauses that are equal from a list of clauses

csfolRemoveTautClauses : ClauseFOLSet -> ClauseFOLSet

It removes clauses that are tautological clauses

csfolRemoveSubsumedClauses : ClauseFOLSet -> ClauseFOLSet

It removes clauses that are subsumed by other from the list

Formulas and Clauses

It converts a ClauseFOLAtom to an Atom (FormulaFOL)

clauseFOLLitToLiteral : ClauseFOLLiteral -> FormulaFOL

It converts a ClauseFOLLiteral to a Literal (FormulaFOL)

csfolFromCNF : FormulaFOL -> Maybe ClauseFOLSet

It pass a CNF formula (opened) to a Set of clausses

ffolToClauses : FormulaFOL -> ClauseFOLSet

Express a formula as a Set of clauses.

sfolToClauses : SetFOL -> ClauseFOLSet

Express a set of formulas as a Set of clauses.

Clauses Parser

cfolReadFromString : String -> ( Maybe ClauseFOL, String, String )

It reads the Cc from a string. It returns a tuple with may be a formula (if it can be read it) and a message of error it it cannot.

cfolReadExtraction : ( Maybe ClauseFOL, String, String ) -> ClauseFOL

It extracts the clause readed. If it is Nothing then it returns an empty clause

cfolToInputString : ClauseFOL -> String

It gives the corresponding input syntax of a clause

Clauses Representation

cfolToString : ClauseFOL -> String

It generates the String representation of a ClauseFOL using unicode symbols.

cfolToMathString : ClauseFOL -> String

It generates the Latex string of a ClauseFOL. The result requires a math enviroment to be displayed.

csfolToString : ClauseFOLSet -> String

It generates the String representation of a Set of Clauses using unicode symbols.

csfolToMathString : ClauseFOLSet -> String

It generates the Latex string of a Set of Clauses. The result requires a math enviroment to be displayed.