示例#1
0
            public override Proposition Resolve(string[] key, SymbolIs[] state)
            {
                //Resolve child prepositions.
                _fact1 = _fact1.Resolve(key, state);
                _fact2 = _fact2.Resolve(key, state);

                SymbolIs sol1 = _fact1.CheckSolvable(key, state);
                SymbolIs sol2 = _fact2.CheckSolvable(key, state);

                //If both are false resolve to Not-True, if either is true resolve to True.
                if (sol1 == SymbolIs.False && sol2 == SymbolIs.False)
                {
                    return(new Not(new True()));
                }
                else if (sol1 == SymbolIs.True || sol2 == SymbolIs.True)
                {
                    return(new True());
                }
                else
                {
                    //If one of the facts can be proved false, it can be removed from the logic.
                    if (sol1 == SymbolIs.False)
                    {
                        return(_fact2);
                    }
                    else if (sol2 == SymbolIs.False)
                    {
                        return(_fact1);
                    }
                    else
                    {
                        return(this);
                    }
                }
            }
示例#2
0
            public override Proposition Resolve(string[] key, SymbolIs[] state)
            {
                //Resolve child prepositions.
                _requirement = _requirement.Resolve(key, state);
                _implication = _implication.Resolve(key, state);

                SymbolIs solution = CheckSolvable(key, state);

                if (solution == SymbolIs.True)
                {
                    return(new True());
                }
                else if (solution == SymbolIs.False)
                {
                    return(new Not(new True()));
                }
                else
                {
                    //If the requirement [A in A=>B] is true, return the implication [B].
                    SymbolIs req = _requirement.CheckSolvable(key, state);

                    if (req == SymbolIs.True)
                    {
                        return(_implication);
                    }
                    else
                    {
                        return(this);
                    }
                }
            }
示例#3
0
            public override Proposition Resolve(string[] key, SymbolIs[] state)
            {
                //Resolve child prepositions.
                _fact1 = _fact1.Resolve(key, state);
                _fact2 = _fact2.Resolve(key, state);

                SymbolIs sol1 = _fact1.CheckSolvable(key, state);
                SymbolIs sol2 = _fact2.CheckSolvable(key, state);

                //If the either fact is Unknown return this, otherwise resolve to True if they are the same, or false if they are different.
                if (sol1 == sol2 && sol1 != SymbolIs.Unknown)
                {
                    return(new True());
                }
                else if (sol1 != SymbolIs.Unknown && sol2 != SymbolIs.Unknown)
                {
                    return(new Not(new True()));
                }
                else
                {
                    return(this);
                }
            }