/** Construct an RPFP graph with a given interpolating prover context. It is allowed to * have multiple RPFP's use the same context, but you should never have teo RPFP's * with the same conext asserting nodes or edges at the same time. Note, if you create * axioms in one RPFP, them create a second RPFP with the same context, the second will * inherit the axioms. */ public RPFP(LogicSolver slvr) { solver = slvr; ctx = slvr.ctx; stack = new Stack <stack_entry>(); stack.Push(new stack_entry()); }
static public LogicSolver CreateLogicSolver(Context _ctx) { LogicSolver res = new LogicSolver(); res.ctx = _ctx; return(res); }
public void Example4() { var baseWorld = LogicSolver.WorldService.GetNewWorldConstant(); var baseIndex = new WorldIndex(baseWorld); var relation = new AccessibilityRelation(new List <IRelationProperty>() { new SerialProperty(), new TransitiveProperty() }); //x var variable = LogicSolver.TermNamer.GetNewVariable(); var func = LogicSolver.TermNamer.GetNewFunction(new List <Terminal>() { variable }); var baseFormula = new AtomicFormula(func, baseIndex); var formula = new BinaryFormula( new QuantifierFormula(new UnaryFormula(baseFormula, UnaryConnective.Necessity, baseIndex), variable, QuantifierConnective.ForAll, baseIndex), new UnaryFormula(new QuantifierFormula(baseFormula, variable, QuantifierConnective.ForAll, baseIndex), UnaryConnective.Necessity, baseIndex), BinaryConnective.Implication, baseIndex); var solver = new LogicSolver(relation); Assert.IsTrue(solver.Solve(formula)); }
/** Construct an RPFP graph with a given interpolating prover context. It is allowed to have multiple RPFP's use the same context, but you should never have teo RPFP's with the same conext asserting nodes or edges at the same time. Note, if you create axioms in one RPFP, them create a second RPFP with the same context, the second will inherit the axioms. */ public RPFP(LogicSolver slvr) { solver = slvr; ctx = slvr.ctx; stack = new Stack<stack_entry>(); stack.Push(new stack_entry()); }
public static LogicSolver CreateLogicSolver(Context _ctx) { LogicSolver res = new LogicSolver(); res.ctx = _ctx; return res; }
static void Main(string[] args) { Console.OutputEncoding = new UnicodeEncoding(); Console.WriteLine("Hello World!"); #region test8 //var baseWorld = new ConstantWorldSymbol("0"); //var baseIndex = new WorldIndex(baseWorld); //var relation = new AccessibilityRelation(new List<IRelationProperty>() { // new SerialProperty() //}); //var variable = LogicSolver.TermNamer.GetNewVariable(); //var atomicFormula = new AtomicFormula(LogicSolver.TermNamer.GetNewFunction(new List<Terminal>() { variable }), baseIndex); //var formula = new BinaryFormula( // new QuantifierFormula(new UnaryFormula(atomicFormula, UnaryConnective.Necessity, baseIndex), variable, QuantifierConnective.ForAll, baseIndex), // new UnaryFormula(new QuantifierFormula(atomicFormula, variable, QuantifierConnective.ForAll, baseIndex), UnaryConnective.Necessity, baseIndex), // BinaryConnective.Implication, baseIndex); #endregion #region test1 var baseWorld = LogicSolver.WorldService.GetNewWorldConstant(); var baseIndex = new WorldIndex(baseWorld); var relation = new AccessibilityRelation(new List <IRelationProperty>() { new SerialProperty(), new TransitiveProperty() }); var variable = LogicSolver.TermNamer.GetNewVariable(); var baseFormula = new AtomicFormula(variable, baseIndex); var formula = new BinaryFormula( new UnaryFormula(baseFormula, UnaryConnective.Necessity, baseIndex), new UnaryFormula(new UnaryFormula(baseFormula, UnaryConnective.Necessity, baseIndex), UnaryConnective.Necessity, baseIndex), BinaryConnective.Implication, baseIndex); #endregion //Example9 #region test2 //var baseWorld = LogicSolver.WorldService.GetNewWorldConstant(); //var baseIndex = new WorldIndex(baseWorld); //var relation = new AccessibilityRelation(new List<IRelationProperty>() { // new SerialProperty(), // new TransitiveProperty() //}); //var variable = LogicSolver.TermNamer.GetNewVariable(); //var atomicFormula = new AtomicFormula(LogicSolver.TermNamer.GetNewFunction(new List<Terminal>() { variable }), baseIndex); //var formula = new BinaryFormula( // new UnaryFormula(new QuantifierFormula(atomicFormula, variable, QuantifierConnective.ForAll, baseIndex), UnaryConnective.Necessity, baseIndex), // new QuantifierFormula(new UnaryFormula(atomicFormula, UnaryConnective.Necessity, baseIndex), variable, QuantifierConnective.ForAll, baseIndex), // BinaryConnective.Implication, baseIndex); #endregion Console.WriteLine(); Console.WriteLine("Formula: " + formula.ToWorldString()); var solver = new LogicSolver(relation); var result = solver.Solve(formula); Console.WriteLine("Proof found: " + result); }