コード例 #1
0
ファイル: FType.cs プロジェクト: hwacha/SemInC
    public FType(ISemanticType basetype, LogicalForm formula)
    {
        if (!formula.IsFormula() || formula.IsClosed())
        {
            System.Console.WriteLine("FType failed: not a formula, or not free");
            return;
            // error
        }
        HashSet <Variable> .Enumerator vars = formula.GetFreeVariables().GetEnumerator();
        vars.MoveNext();
        Variable first = vars.Current;

        if (vars.MoveNext())
        {
            System.Console.WriteLine("FType failed: more than one free variable");
            return;
            // error (more than one free variable)
        }

        if (!first.GetSemanticType().Equals(basetype))
        {
            System.Console.WriteLine(first.GetSemanticType());
            System.Console.WriteLine(basetype);

            System.Console.WriteLine("FType failed: types aren't equal");
            return;
            // error
        }
        this.basetype = basetype;
        this.formula  = formula;
    }
コード例 #2
0
ファイル: Model.cs プロジェクト: hwacha/SemInC
    // Updates the Model (M) such that
    // l has the truth value v in M
    private UpdateInfo Make(LogicalForm l, TruthValue.T v)
    {
        if (l.IsClosed() && l.IsFormula())
        {
            return(UpdateInfo.NoChange);
        }

        return(l.Make(this, v));
    }
コード例 #3
0
ファイル: Model.cs プロジェクト: hwacha/SemInC
 // super compatible
 public bool Satisfies(LogicalForm l)
 {
     if (l.IsClosed() && l.IsFormula())
     {
         ISemanticValue s = l.Denotation(this);
         if (s.GetType() == typeof(TruthValue))
         {
             TruthValue t = (TruthValue)s;
             if (t.IsUnknown() && (super != null))
             {
                 return(super.Satisfies(l));
             }
             return(t.IsTrue());
         }
         if (super != null)
         {
             return(super.Satisfies(l));
         }
         return(false);
     }
     return(false);
 }