Esempio n. 1
0
        //Extend model with the next symbol
        public model extend(propositionalSymbol s, bool bValue)
        {
            cell c = new cell(s, bValue);

            this.m.Add(c);
            return(this);
        }
Esempio n. 2
0
        //Check all models based on given symbols
        public void CheckAll(knowledgeBase kB, sentence query, List <propositionalSymbol> symbols, model model)
        {
            if (symbols.Count == 0)
            {
                if (model.isTrue(kB))
                {
                    if (model.isTrue(query))
                    {
                        modelEntailments++;
                    }
                    //return model.isTrue(query);
                }
                //else return true;
            }
            else
            {
                propositionalSymbol s = new propositionalSymbol(symbols.First());

                //rest of the symbols
                List <propositionalSymbol> rest = new List <propositionalSymbol>();
                rest.AddRange(symbols);
                rest.RemoveAt(0);

                //Initialize model for true branch
                model mleft = new model();
                mleft.getCellList.AddRange(model.getCellList);
                mleft.getCellList.Add(new cell(s, true));

                //Initialize model for false branch
                model mright = new model();
                mright.getCellList.AddRange(model.getCellList);
                mright.getCellList.Add(new cell(s, false));

                //Recursive call
                CheckAll(kB, query, rest, mleft);
                CheckAll(kB, query, rest, mright);
            }
        }
Esempio n. 3
0
 //constructor
 public cell(propositionalSymbol s, bool v)
 {
     symbol       = s;
     booleanValue = v;
 }
 public propositionalSymbol(propositionalSymbol s)
 {
     symbol = s.getSymbol;
 }
Esempio n. 5
0
 //Constructor for atomic sentence
 public sentence(propositionalSymbol s)
 {
     symbols.Add(s);
     clause = s.getSymbol;
 }