Package edu.uky.ai.logic
Interface Proposition
- All Superinterfaces:
Comparable<Formula>,Formula
- All Known Implementing Classes:
AtomicProposition,BooleanProposition,Conjunction,Disjunction,Implication,NegatedAtom,Negation,Predication
A proposition is any logical formula with a truth value.
- Author:
- Stephen G. Ware
-
Field Summary
Fields -
Method Summary
Modifier and TypeMethodDescriptionbooleanTests whether this proposition is true in the given state.voidmakeTrue(MutableState state) Modifies the given state object to make this proposition true.negate()Returns a proposition whose truth values are opposite of this proposition (i.e.simplify()Returns an equivalent proposition which may be simpler.substitute(Substitution substitution) Returns a version of this formula such that any elements that appear in the given substitution are replaced.toCNF()Converts this proposition to Conjunctive Normal Form (CNF).toDNF()Converts this proposition to Disjunctive Normal Form (DNF).
-
Field Details
-
TRUE
A proposition which is always trivially true -
FALSE
A proposition which is always trivially false
-
-
Method Details
-
substitute
Description copied from interface:FormulaReturns a version of this formula such that any elements that appear in the given substitution are replaced.- Specified by:
substitutein interfaceFormula- Parameters:
substitution- the substitution- Returns:
- a formula with replacements from the substitution
-
isTrue
Tests whether this proposition is true in the given state.- Parameters:
state- the state in which to test this proposition- Returns:
- true if the proposition is true, false otherwise
-
makeTrue
Modifies the given state object to make this proposition true. Note that some propositions (such asDisjunctions) are non-deterministic, meaning there are multiple ways to make them true, and thus the state that would result from this operation is not clearly defined.- Parameters:
state- the state to modify- Throws:
IllegalStateException- if there is more than one way to make this proposition true
-
simplify
Proposition simplify()Returns an equivalent proposition which may be simpler.- Returns:
- the simplified proposition
-
negate
Proposition negate()Returns a proposition whose truth values are opposite of this proposition (i.e. true when this one is false, false when this one is true).- Returns:
- a proposition with opposite truth values
-
toCNF
Proposition toCNF()Converts this proposition to Conjunctive Normal Form (CNF). There are three kinds of formulas that are considered to be in CNF:- A
Literalby itself - A
Disjunctionof literals, called a clause - A
Conjunctionof clauses
- Returns:
- an equivalent proposition in CNF
- A
-
toDNF
Proposition toDNF()Converts this proposition to Disjunctive Normal Form (DNF). There are three kinds of formulas that are considered to be in DNF:- A
Literalby itself - A
Conjunctionof literals, called a clause - A
Disjunctionof clauses
- Returns:
- an equivalent proposition in DNF
- A
-