Ejemplo n.º 1
0
 // Use this for initialization
 protected void Start()
 {
     controller = GameObject.Find("GameController").GetComponent <GameController>();
     model      = DefaultModel.Make();
     // primitiveAbilities = new HashSet<Expression>();
 }
Ejemplo n.º 2
0
    void Start()
    {
        Model m = DefaultModel.Make();
        // Expression example = new Word(SemanticType.TRUTH_VALUE, "example");
        // Expression iPerceiveExample = new Phrase(Expression.PERCEIVE, Expression.SELF, example);
        // Expression iPerceiveNotExample = new Phrase(Expression.PERCEIVE, Expression.SELF, new Phrase(Expression.NOT, example));
        // m.Add(iPerceiveExample);
        // PrintProves(m, true, iPerceiveExample);
        // PrintProves(m, true, example);
        // Debug.Log(m.UpdateBelief(new Phrase(Expression.NOT, example)));
        // // Debug.Log(m.UpdateBelief(iPerceiveNotExample));
        // PrintProves(m, true, iPerceiveExample);
        // PrintProves(m, true, new Phrase(Expression.NOT, example));
        // PrintProves(m, false, example);
        // PrintProves(m, true, new Phrase(Expression.NOT, new Phrase(Expression.VERIDICAL, Expression.SELF, example)));

        // Debug.Log(m.UpdateBelief(new Phrase(Expression.EXPRESS, Expression.PLAYER, new Phrase(Expression.TREE, Expression.BOB))));
        // PrintProves(m, true, new Phrase(Expression.EXPRESS, Expression.PLAYER, new Phrase(Expression.TREE, Expression.BOB)));
        // PrintProves(m, true, new Phrase(Expression.BELIEVE, Expression.PLAYER, new Phrase(Expression.TREE, Expression.BOB)));
        // PrintProves(m, true, new Phrase(Expression.TREE, Expression.BOB));

        // Debug.Log(bm.DomainString());
        // PrintProves(bm, true, new Phrase(Expression.ANIMAL, Expression.BOB));
        // PrintProves(bm, true, new Phrase(Expression.SOME, Expression.ANIMAL, Expression.ACTIVE));
        // PrintProves(bm, true, new Phrase(Expression.SOME, new Phrase(Expression.IDENTITY, Expression.BOB), Expression.ACTIVE));
        // PrintProves(bm, true, new Phrase(Expression.EXISTS, Expression.BOB));
        // PrintProves(bm, true, new Phrase(Expression.CONTAINED_WITHIN, Expression.BOB, Expression.WAYSIDE_PARK));
        // PrintProves(bm, true, new Phrase(Expression.NOT, new Phrase(Expression.IDENTITY, Expression.BOB, Expression.EVAN)));
        // PrintProves(bm, true,
        //     new Phrase(Expression.NOT,
        //         new Phrase(Expression.AND,
        //             new Phrase(Expression.IDENTITY, Expression.BOB, Expression.EVAN),
        //             new Phrase(Expression.ACTIVE, Expression.BOB))));
        // PrintProves(bm, true, new Phrase(Expression.NOT, new Phrase(Expression.KING, Expression.EVAN)));
        // PrintProves(bm, true, new Phrase(Expression.ANIMAL, Expression.BOB_2));
        // PrintProves(bm, true, new Phrase(Expression.NOT, new Phrase(Expression.IDENTITY, Expression.EVAN, Expression.BOB_2)));
        // Debug.Log(new Phrase(Expression.IDENTITY, Expression.EVAN, Expression.BOB));
        // Debug.Log(new Phrase(Expression.SOME, Expression.KING, Expression.ACTIVE));
        // Debug.Log(new Phrase(Expression.GIVE, Expression.THE_GREAT_DOOR, Expression.BOB));
        // PrintProves(bm, true, new Phrase(Expression.GEACH_TF1, Expression.NOT, Expression.KING, Expression.EVAN));
        // PrintProves(m, true, b);
        // PrintProves(m, true, new Phrase(Expression.NOT, new Phrase(Expression.NOT, new Phrase(Expression.PERSON, Expression.SELF))));

        // Expression a = new Word(SemanticType.TRUTH_VALUE, "A");
        // Expression b = new Word(SemanticType.TRUTH_VALUE, "B");

        // m.Add(a);
        // m.Add(new Phrase(Expression.NOT, b));

        // PrintProves(m, true, new Phrase(Expression.TRUE, a));
        // PrintProves(m, true, new Phrase(Expression.TRUE, new Phrase(Expression.TRUE, a)));
        // PrintProves(m, true, new Phrase(Expression.TRUE, new Phrase(Expression.NOT, b)));
        // PrintProves(m, true, new Phrase(Expression.NOT, new Phrase(Expression.TRUE, b)));

        // m.Add(new SubstitutionRule(
        //     new List<IPattern>[]{DefaultModel.BuildList(a)},
        //     new List<IPattern>[]{DefaultModel.BuildList(b)},
        //     false));
        // Expression ifAB = new Phrase(Expression.IF, a, b);
        // PrintProves(m, false, b);
        // PrintProves(m, true, ifAB);
        // PrintProves(m, false, a);

        // // now, testing a conditional is true, even if the antecedant is thought false
        // m.Add(new Phrase(Expression.NOT, a));
        // PrintProves(m, true, new Phrase(Expression.NOT, a));
        // PrintProves(m, true, ifAB);

        // MODUS PONENS
        // Expression c = new Word(SemanticType.TRUTH_VALUE, "C");
        // Expression d = new Word(SemanticType.TRUTH_VALUE, "D");
        // m.Add(new Phrase(Expression.IF, c, d));
        // m.Add(c);
        // PrintProves(m, true, d);
        // Expression e = new Word(SemanticType.TRUTH_VALUE, "E");
        // m.Add(new Phrase(Expression.IF, d, e));
        // PrintProves(m, true, e);

        // Expression f = new Word(SemanticType.TRUTH_VALUE, "F");
        // m.Add(new Phrase(Expression.IF, e, f));
        // PrintProves(m, true, f);

        // Expression bobIsRed = new Phrase(Expression.RED, Expression.BOB);
        // Expression allRedsAreGreen = new Phrase(Expression.ALL, Expression.RED, Expression.GREEN);
        // m.Add(bobIsRed);
        // m.Add(allRedsAreGreen);
        // PrintProves(m, true, new Phrase(Expression.GREEN, Expression.BOB));

        // Expression allGreensAreBlue = new Phrase(Expression.ALL, Expression.GREEN, Expression.BLUE);
        // m.Add(allGreensAreBlue);
        // PrintProves(m, true, new Phrase(Expression.BLUE, Expression.BOB));

        // Expression dBetterThanC = new Phrase(Expression.BETTER, d, c);
        // Expression eBetterThanD = new Phrase(Expression.BETTER, e, d);
        // m.Add(dBetterThanC);
        // m.Add(eBetterThanD);
        // PrintProves(m, true, new Phrase(Expression.BETTER, e, c));
        // Expression fBetterThanE = new Phrase(Expression.BETTER, f, e);
        // m.Add(fBetterThanE);
        // PrintProves(m, true, new Phrase(Expression.BETTER, f, c));

        Expression g = new Word(SemanticType.TRUTH_VALUE, "G");

        // PrintProves(m, false, new Phrase(Expression.BETTER, g, c));

        // PrintPlan(m, c);

        // PrintPlan(m, new Phrase(Expression.MAKE, Expression.SELF, g));

        m.Add(new Phrase(Expression.ABLE, Expression.SELF, g));
        // m.Add(new Phrase(Expression.MAKE, Expression.SELF, g));
        // PrintProves(m, false, g);
        PrintPlan(m, g);


        // able(x, H), make(x, H) |- H
        Expression   h   = new Word(SemanticType.TRUTH_VALUE, "H");
        MetaVariable xi0 = new MetaVariable(SemanticType.INDIVIDUAL, 0);

        // m.Add(new SubstitutionRule(
        //     new List<IPattern>[]{
        //         DefaultModel.BuildList(new ExpressionPattern(Expression.ABLE, xi0, h)),
        //         DefaultModel.BuildList(new ExpressionPattern(Expression.MAKE, xi0, h))
        //     },
        //     new List<IPattern>[]{DefaultModel.BuildList(h)}));

        // m.Add(new Phrase(Expression.WOULD, h));
        m.Add(new Phrase(Expression.ABLE, Expression.BOB, h));
        m.Add(new Phrase(Expression.MAKE, Expression.BOB, h));
        PrintProves(m, true, h);

        m.Add(new Phrase(Expression.ABLE, Expression.SELF, new Phrase(Expression.AT, Expression.SELF, Expression.BOB)));
        // PrintProves(m, false, new Phrase(Expression.AT, Expression.SELF, Expression.BOB));
        PrintPlan(m, new Phrase(Expression.AT, Expression.SELF, Expression.BOB));

        // m.Add(new Phrase(Expression.IDENTITY, Expression.BOB, Expression.BOB_2));
        // m.Add(new Phrase(Expression.TREE, Expression.BOB));
        // PrintProves(m, true, new Phrase(Expression.TREE, Expression.BOB_2));

        // PrintProves(m, true, new Phrase(Expression.IDENTITY,
        //     new Phrase(Expression.SUCC, new Phrase(Expression.SUCC, new Phrase(Expression.SUCC, Expression.ZERO))),
        //     new Phrase(Expression.PLUS, new Phrase(Expression.SUCC, Expression.ZERO),
        //         new Phrase(Expression.SUCC, new Phrase(Expression.SUCC, Expression.ZERO)))));

        // PrintProves(m, true, new Phrase(Expression.NOT, new Phrase(Expression.IDENTITY,
        //     new Phrase(Expression.SUCC, new Phrase(Expression.SUCC, new Phrase(Expression.SUCC, Expression.ZERO))),
        //     new Phrase(Expression.PLUS, new Phrase(Expression.SUCC, new Phrase(Expression.SUCC, Expression.ZERO)),
        //         new Phrase(Expression.SUCC, new Phrase(Expression.SUCC, Expression.ZERO))))));
    }