public class TTEntails
extends java.lang.Object
function TT-ENTAILS?(KB, α) returns true or false
inputs: KB, the knowledge base, a sentence in propositional logic
α, the query, a sentence in propositional logic
symbols <- a list of proposition symbols in KB and &alpha
return TT-CHECK-ALL(KB, α symbols, {})
--------------------------------------------------------------------------------
function TT-CHECK-ALL(KB, α symbols, model) returns true or false
if EMPTY?(symbols) then
if PL-TRUE?(KB, model) then return PL-TRUE?(α, model)
else return true // when KB is false, always return true
else do
P <- FIRST(symbols)
rest <- REST(symbols)
return (TT-CHECK-ALL(KB, α, rest, model ∪ { P = true })
and
TT-CHECK-ALL(KB, α, rest, model ∪ { P = false }))
Figure 7.10 A truth-table enumeration algorithm for deciding propositional
entailment. (TT stands for truth table.) PL-TRUE? returns true if a sentence
holds within a model. The variable model represents a partional model - an
assignment to some of the symbols. The keyword "and" is used here as a
logical operation on its two arguments, returning true or false.| Constructor and Description |
|---|
TTEntails() |
| Modifier and Type | Method and Description |
|---|---|
boolean |
ttCheckAll(KnowledgeBase kb,
Sentence alpha,
java.util.List<PropositionSymbol> symbols,
Model model)
function TT-CHECK-ALL(KB, α symbols, model) returns true or false
|
boolean |
ttEntails(KnowledgeBase kb,
Sentence alpha)
function TT-ENTAILS?(KB, α) returns true or false.
|
public boolean ttEntails(KnowledgeBase kb, Sentence alpha)
kb - KB, the knowledge base, a sentence in propositional logicalpha - α, the query, a sentence in propositional logicpublic boolean ttCheckAll(KnowledgeBase kb, Sentence alpha, java.util.List<PropositionSymbol> symbols, Model model)
kb - KB, the knowledge base, a sentence in propositional logicalpha - α, the query, a sentence in propositional logicsymbols - a list of currently unassigned propositional symbols in the
model.model - a partially or fully assigned model for the given KB and
query.