vicramgon / logicus / LogicUS.FOL.Clauses

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

Types


type ClauseFOLAtom
    = P (( String, List Basics.Int )) (List LogicUS.FOL.SyntaxSemantics.Term)
    | Eq LogicUS.FOL.SyntaxSemantics.Term LogicUS.FOL.SyntaxSemantics.Term

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


type alias ClauseFOLLiteral =
( ClauseFOLAtom
, Basics.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

cfolAtomVarSymbols : ClauseFOLAtom -> List LogicUS.FOL.SyntaxSemantics.Variable

It gives the variables that appears in a clause atom

cfolVarSymbols : ClauseFOL -> Set LogicUS.FOL.SyntaxSemantics.Variable

It gives the variables that appears in a clause

cfolAtomSymbol : ClauseFOLAtom -> ( String, List Basics.Int )

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

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

It gives the symbols of literals that appears in a clause

cfolAtomApplySubstitution : LogicUS.FOL.SyntaxSemantics.Substitution -> ClauseFOLAtom -> ClauseFOLAtom

It applies a Substitution over a clause atom

cfolApplySubstitution : LogicUS.FOL.SyntaxSemantics.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 -> Basics.Bool

Indicates if the first clause subsumes the second, that is, if the first is entirely contained in the second.

cfolIsTautology : ClauseFOL -> Basics.Bool

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

cfolIsPositive : ClauseFOL -> Basics.Bool

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

cfolIsNegative : ClauseFOL -> Basics.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

clauseFOLAtomToAtom : ClauseFOLAtom -> LogicUS.FOL.SyntaxSemantics.FormulaFOL

It converts a ClauseFOLAtom to an Atom (FormulaFOL)

clauseFOLLitToLiteral : ClauseFOLLiteral -> LogicUS.FOL.SyntaxSemantics.FormulaFOL

It converts a ClauseFOLLiteral to a Literal (FormulaFOL)

cfolFromCNF : LogicUS.FOL.SyntaxSemantics.FormulaFOL -> Maybe ClauseFOLSet

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

ffolToClauses : LogicUS.FOL.SyntaxSemantics.FormulaFOL -> ClauseFOLSet

Express a formula as a Set of clauses.

sfolToClauses : LogicUS.FOL.SyntaxSemantics.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.