示例#1
0
文件: Program.cs 项目: xeno-by/rapt
        public static void AritySimplifierDemo()
        {
            var rules = new RuleSet();
            var term = rules.Define1("term");

            var node = 
              (
                (
                    term("o1") 
                    & term("o2") 
                    & term("o3") 
                    & term("o4")
                ) 
                | term("oo1") 
                | term("oo2")
              ) 
              & term("ooo1");
            var expr = new L1Expression(node);
            expr.Traverse(new TreeDumper());
            expr.Xform(new AritySimplifier());
            expr.Traverse(new AstValidator());
            expr.Traverse(new TreeDumper());
        }
示例#2
0
 private static Clause[] Disassemble(L1Expression expression)
 {
     var clone = (L1Expression)expression.Clone();
     clone.Xform(new CnfTransformer());
     return clone.Analyze<Clause[]>(new CnfDisassembler());
 }
示例#3
0
文件: RuleSet.cs 项目: xeno-by/rapt
        public bool Prove(L1Expression expression)
        {
            var clauses = new List<Clause>();
            clauses.AddRange(Disassembler.Disassemble(Axioms.ToArray()));
            clauses.AddRange(Disassembler.Disassemble(Factum.ToArray()));
            clauses.AddRange(Disassembler.Disassemble(!expression.Root));

            return !Prover.NaiveResolution(clauses.ToArray());
        }