public FType(ISemanticType basetype, LogicalForm formula) { if (!formula.IsFormula() || formula.IsClosed()) { System.Console.WriteLine("FType failed: not a formula, or not free"); return; // error } HashSet <Variable> .Enumerator vars = formula.GetFreeVariables().GetEnumerator(); vars.MoveNext(); Variable first = vars.Current; if (vars.MoveNext()) { System.Console.WriteLine("FType failed: more than one free variable"); return; // error (more than one free variable) } if (!first.GetSemanticType().Equals(basetype)) { System.Console.WriteLine(first.GetSemanticType()); System.Console.WriteLine(basetype); System.Console.WriteLine("FType failed: types aren't equal"); return; // error } this.basetype = basetype; this.formula = formula; }
// Updates the Model (M) such that // l has the truth value v in M private UpdateInfo Make(LogicalForm l, TruthValue.T v) { if (l.IsClosed() && l.IsFormula()) { return(UpdateInfo.NoChange); } return(l.Make(this, v)); }
public Not(LogicalForm sub) : base(sub.GetSemanticType()) { if (!sub.IsFormula()) { // error! return; } this.sub = sub; this.isFormula = true; this.freeVariables = sub.GetFreeVariables(); }
public ModelBind(LogicalForm sentence, LogicalForm model) : base(new TWG()) { if (!sentence.IsFormula()) { // error! } if (model.GetType() != typeof(Model)) { // error! } this.sentence = sentence; this.model = model; this.isFormula = false; this.freeVariables = sentence.MergeVariables(model); }
// super compatible public bool Satisfies(LogicalForm l) { if (l.IsClosed() && l.IsFormula()) { ISemanticValue s = l.Denotation(this); if (s.GetType() == typeof(TruthValue)) { TruthValue t = (TruthValue)s; if (t.IsUnknown() && (super != null)) { return(super.Satisfies(l)); } return(t.IsTrue()); } if (super != null) { return(super.Satisfies(l)); } return(false); } return(false); }