logic-classes-1.5.3: Framework for propositional and first order logic, theorem proving

Safe HaskellNone
LanguageHaskell98

Data.Logic.KnowledgeBase

Synopsis

Documentation

data WithId a Source

Constructors

WithId 

Fields

wiItem :: a
 
wiIdent :: Int
 

Instances

Eq a => Eq (WithId a) Source 
Data a => Data (WithId a) Source 
Ord a => Ord (WithId a) Source 
Show a => Show (WithId a) Source 

type ProverT inf = StateT (ProverState inf) Source

A monad for running the knowledge base.

runProver' :: Maybe Int -> ProverT' v term inf Identity a -> a Source

runProverT' :: Monad m => Maybe Int -> ProverT' v term inf m a -> m a Source

getKB :: Monad m => ProverT inf m (Set (WithId inf)) Source

Return the contents of the knowledgebase.

unloadKB :: (Monad m, Ord inf) => SentenceCount -> ProverT inf m (Maybe (KnowledgeBase inf)) Source

Remove a particular sentence from the knowledge base

askKB :: (Monad m, FirstOrderFormula formula atom v, PropositionalFormula formula atom, Literal lit atom, Atom atom term v, AtomEq atom p term, Term term v f, Ord formula, Ord term, Ord lit, Data formula, Data lit) => formula -> ProverT' v term (ImplicativeForm lit) m Bool Source

Try to prove a sentence, return the result and the proof. askKB should be in KnowledgeBase module. However, since resolution is here functions are here, it is also placed in this module.

theoremKB :: forall m formula atom term v p f lit. (Monad m, FirstOrderFormula formula atom v, PropositionalFormula formula atom, Literal lit atom, Atom atom term v, AtomEq atom p term, Term term v f, Ord formula, Ord term, Ord lit, Data formula, Data lit) => formula -> ProverT' v term (ImplicativeForm lit) m (Bool, SetOfSupport lit v term) Source

Return a flag indicating whether sentence was proved, along with a proof.

inconsistantKB :: forall m formula atom term v p f lit. (FirstOrderFormula formula atom v, PropositionalFormula formula atom, Literal lit atom, Atom atom term v, AtomEq atom p term, Term term v f, Monad m, Ord formula, Data formula, Data lit, Eq lit, Ord lit, Ord term) => formula -> ProverT' v term (ImplicativeForm lit) m (Bool, SetOfSupport lit v term) Source

Return a flag indicating whether sentence was disproved, along with a disproof.

data ProofResult Source

Constructors

Disproved

The conjecture is unsatisfiable

Proved

The negated conjecture is unsatisfiable

Invalid

Both are satisfiable

data Proof lit Source

Constructors

Proof 

Instances

Eq lit => Eq (Proof lit) Source 
(Data lit, Ord lit) => Data (Proof lit) Source 
Ord lit => Ord (Proof lit) Source 
(Ord lit, Show lit, Literal lit atom, FirstOrderFormula lit atom v) => Show (Proof lit) Source 

validKB :: (FirstOrderFormula formula atom v, PropositionalFormula formula atom, Literal lit atom, Atom atom term v, AtomEq atom p term, Term term v f, Monad m, Ord formula, Ord term, Ord lit, Data formula, Data lit) => formula -> ProverT' v term (ImplicativeForm lit) m (ProofResult, SetOfSupport lit v term, SetOfSupport lit v term) Source

See whether the sentence is true, false or invalid. Return proofs for truth and falsity.

tellKB :: (FirstOrderFormula formula atom v, PropositionalFormula formula atom, Literal lit atom, Atom atom term v, AtomEq atom p term, Term term v f, Monad m, Ord formula, Data formula, Data lit, Eq lit, Ord lit, Ord term) => formula -> ProverT' v term (ImplicativeForm lit) m (Proof lit) Source

Validate a sentence and insert it into the knowledgebase. Returns the INF sentences derived from the new sentence, or Nothing if the new sentence is inconsistant with the current knowledgebase.

loadKB :: (FirstOrderFormula formula atom v, PropositionalFormula formula atom, Literal lit atom, Atom atom term v, AtomEq atom p term, Term term v f, Monad m, Ord formula, Ord term, Ord lit, Data formula, Data lit) => [formula] -> ProverT' v term (ImplicativeForm lit) m [Proof lit] Source

showKB :: (Show inf, Monad m) => ProverT inf m String Source

Delete an entry from the KB.

Return a text description of the contents of the knowledgebase.