예제 #1
0
파일: App.cs 프로젝트: hwacha/SemInC
    public App(LogicalForm f, LogicalForm x) : base(null)
    {
        ISemanticType fType = f.GetSemanticType();
        ISemanticType xType = x.GetSemanticType();

        if (fType.GetType() != typeof(Arrow))
        {
            System.Console.WriteLine(
                "App failed: function argument not function type");
            return;
        }
        Arrow aType = (Arrow)fType;

        if (!aType.GetInputType().Equals(xType))
        {
            // error
            System.Console.WriteLine("App failed: type mismatch");
            // throw new InvalidTypeException();
            return;
        }

        this.type = aType.GetOutputType();

        this.isFormula = this.type.GetType() == typeof(T);

        this.freeVariables = f.MergeVariables(x);

        this.f = f;
        this.x = x;
    }
예제 #2
0
    public Lambda(Variable v, LogicalForm l)
        : base(new Arrow(v.GetSemanticType(), l.GetSemanticType()))
    {
        this.v = v;
        this.l = l;

        this.freeVariables = l.CloneVariables();
        freeVariables.Remove(v);
    }
예제 #3
0
 public override LogicalForm Bind(int id, LogicalForm l)
 {
     if (this.id == id && l.GetSemanticType().Equals(this.GetSemanticType()))
     {
         return(l);
     }
     else
     {
         return(this);
     }
 }
예제 #4
0
파일: Not.cs 프로젝트: hwacha/SemInC
 public Not(LogicalForm sub) : base(sub.GetSemanticType())
 {
     if (!sub.IsFormula())
     {
         // error!
         return;
     }
     this.sub           = sub;
     this.isFormula     = true;
     this.freeVariables = sub.GetFreeVariables();
 }