Package edu.tufts.hrilab.belief.provers
Class DCEC
java.lang.Object
edu.tufts.hrilab.belief.provers.DCEC
- All Implemented Interfaces:
Prover
Interface for the Talos/DCEC logical proof generator
Contains the following functionality:
- Solve query via online Talos/DCEC server
- Knowledge database in DCEC syntax
- Prolog to DCEC syntax converter
Mimics the way the prolog is used in DIARC/Belief:
- Add facts to the database through the assert asserta, assertz commands
- Remove facts from the database through the retract, retractall commands
- Prove conjecture
Features from prolog that are missing:
- Get bindings
- Probably some more stuff...
-
Nested Class Summary
Nested classes/interfaces inherited from interface edu.tufts.hrilab.belief.provers.Prover
Prover.Engine
-
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescriptionvoid
void
assertBelief
(Term belief) Adds a single belief to the Belief State of the agent.void
assertBelief
(String belief) Assert belief to prover.void
assertRule
(Term head, List<Term> body) void
assertRule
(String rule) Add rule to prover.Get the theory representation in its source formatGet the theory representation as a string in target language format.void
initializeFromFiles
(List<String> filenames) initialize the knowledge base from a filequeryBelief
(Term query) Queries the Belief State about the term in the argument, and a set of bindings corresponding to all of the found answers.queryBelief
(String query) queryString
(String query) querySupport
(Term query) checks validity of a belief.querySupportWithExplanation
(Term query) checks validity of a belief, with an explanation from spy.void
retractBelief
(Term belief) Removes a single belief from the Belief State of the agent.void
retractBelief
(String belief) Retract belief from prover.void
retractRule
(Term head, List<Term> body) remove the specified rulevoid
retractRule
(String rule) Retract rule from prover.Convert DIARC FOL Term to appropriate prover syntax.boolean
Set the theory (aka beliefs aka assumptions).boolean
Solve prolog statementsolveBindings
(String statement)
-
Constructor Details
-
DCEC
public DCEC()Constructor
-
-
Method Details
-
solve
Solve prolog statement- Parameters:
statement
- prolog statement- Returns:
- true if successful (e.g. proof found, fact added to knowledge base, ...)
-
solveBindings
-
querySupport
Description copied from interface:Prover
checks validity of a belief.- Specified by:
querySupport
in interfaceProver
- Parameters:
query
- The query / belief- Returns:
- whether the belief holds
-
querySupportWithExplanation
public org.apache.commons.lang3.tuple.Pair<Boolean,Map<Term, querySupportWithExplanationBoolean>> (Term query) Description copied from interface:Prover
checks validity of a belief, with an explanation from spy.- Specified by:
querySupportWithExplanation
in interfaceProver
- Parameters:
query
- The query / belief- Returns:
- whether the belief holds
-
queryBelief
Description copied from interface:Prover
Queries the Belief State about the term in the argument, and a set of bindings corresponding to all of the found answers.- Specified by:
queryBelief
in interfaceProver
- Parameters:
query
- : a query in Term format- Returns:
- an ArrayList of bindings: here represented as a HashMap from Variables to Symbols
-
assertBelief
Description copied from interface:Prover
Adds a single belief to the Belief State of the agent. Note: new beliefs are added such that they take priority in unification to old beliefs. queryBelief() will still return all asserted and inferred bindings.- Specified by:
assertBelief
in interfaceProver
-
assertBelief
Description copied from interface:Prover
Assert belief to prover.- Specified by:
assertBelief
in interfaceProver
-
retractBelief
Description copied from interface:Prover
Removes a single belief from the Belief State of the agent.- Specified by:
retractBelief
in interfaceProver
-
assertRule
- Specified by:
assertRule
in interfaceProver
-
retractRule
Description copied from interface:Prover
remove the specified rule- Specified by:
retractRule
in interfaceProver
-
initializeFromFiles
Description copied from interface:Prover
initialize the knowledge base from a file- Specified by:
initializeFromFiles
in interfaceProver
- Throws:
IOException
-
getTheory
Description copied from interface:Prover
Get the theory representation as a string in target language format. Returned string depends on prover implementation. -
getInternalTheory
Description copied from interface:Prover
Get the theory representation in its source format- Specified by:
getInternalTheory
in interfaceProver
- Returns:
- internal theory representation
-
setTheory
Description copied from interface:Prover
Set the theory (aka beliefs aka assumptions). -
assertRule
Description copied from interface:Prover
Add rule to prover.- Specified by:
assertRule
in interfaceProver
-
retractRule
Description copied from interface:Prover
Retract rule from prover.- Specified by:
retractRule
in interfaceProver
-
sanitize
Description copied from interface:Prover
Convert DIARC FOL Term to appropriate prover syntax. TODO: consolidate all code related to converting FOL to/from Prover and replace this method with two new methods (1) convertToProverForm and (2) convertToDiarcForm -
queryString
-
queryBelief
-
addBelief
-
retractBelief
Description copied from interface:Prover
Retract belief from prover.- Specified by:
retractBelief
in interfaceProver
-