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; }
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); }
public override LogicalForm Bind(int id, LogicalForm l) { if (this.id == id && l.GetSemanticType().Equals(this.GetSemanticType())) { return(l); } else { return(this); } }
public Not(LogicalForm sub) : base(sub.GetSemanticType()) { if (!sub.IsFormula()) { // error! return; } this.sub = sub; this.isFormula = true; this.freeVariables = sub.GetFreeVariables(); }