public HornClause(Sentence sentence, PLFCEntails plfcEntails)
{
this.plfcEntails = plfcEntails;
if (sentence is Symbol)
{
_head = (Symbol)sentence;
plfcEntails.agenda.Push(_head);
premiseSymbols = new List<Symbol>();
plfcEntails.count.Add(this, 0);
plfcEntails._inferred.Add(_head, false);
}
else if (!isImpliedSentence(sentence))
{
throw new ApplicationException("Sentence " + sentence
+ " is not a horn clause");
}
else
{
BinarySentence bs = (BinarySentence)sentence;
_head = (Symbol)bs.getSecond();
if (plfcEntails._inferred.ContainsKey(_head))
{
plfcEntails._inferred[_head] = false;
}
else
{
plfcEntails._inferred.Add(_head, false);
}
List<Symbol> symbolsInPremise = new SymbolCollector()
.getSymbolsIn(bs.getFirst());
foreach(Symbol s in symbolsInPremise)
{
plfcEntails._inferred.Add(s, false);
}
premiseSymbols = symbolsInPremise;
plfcEntails.count.Add(this, premiseSymbols.Count);
}
}