Exemplo n.º 1
0
Arquivo: App.cs Projeto: 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;
    }
Exemplo n.º 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);
    }
Exemplo n.º 3
0
 public override LogicalForm Bind(int id, LogicalForm l)
 {
     if (this.id == id && l.GetSemanticType().Equals(this.GetSemanticType()))
     {
         return(l);
     }
     else
     {
         return(this);
     }
 }
Exemplo n.º 4
0
Arquivo: Not.cs Projeto: hwacha/SemInC
 public Not(LogicalForm sub) : base(sub.GetSemanticType())
 {
     if (!sub.IsFormula())
     {
         // error!
         return;
     }
     this.sub           = sub;
     this.isFormula     = true;
     this.freeVariables = sub.GetFreeVariables();
 }