static BFunctionTemplate() { { var X = new BasicTypeVariable("X=="); var XT = new VariableType(X); eq = new BFunctionTemplate("==", "", new TypeVariable[1] { X }, new BasicFunctionSignature(bt, new IType[2] { XT, XT }), null); } { var X = new BasicTypeVariable("X==<>"); var Y = new BasicTypeVariable("Y==<>"); var XT = new VariableType(X); var YT = new VariableType(Y); eqG = new BFunctionTemplate("==<>", "", new TypeVariable[2] { X, Y }, new BasicFunctionSignature(bt, new IType[2] { XT, YT }), null); } { var X = new BasicTypeVariable("X<:"); var XT = new VariableType(X); po = new BFunctionTemplate("<:", "", new TypeVariable[1] { X }, new BasicFunctionSignature(bt, new IType[2] { XT, XT }), null); } { var X = new BasicTypeVariable("Xite"); var XT = new VariableType(X); BooleanType BT = BooleanType.booleanType; ite = new BFunctionTemplate(iteName, "", new TypeVariable[1] { X }, new BasicFunctionSignature(XT, new IType[3] { BT, XT, XT }), null); } }
////////////////////////////////////////////// /////////////////////////////////////////////////////////// public BasicQuantifiedTypeExpression( QuantifiedTypeExpression other, ExpressionSubstitution s ) { quantifier = other.quantifier; variable = new BasicTypeVariable(getFreshTypeVariableName()); s.typeSubstitution.add(other.variable, new VariableType(variable)); expression = other.expression.substitute(s); triggers = new ExpressionList(other.triggers); attributes = other.attributes; s.typeSubstitution.remove(other.variable); }
/////////////////////////////////////////////////////////////////////// /////////////////////////////////////////////////////////////////////// /////////////////////////////////////////////////////////////////////// public TypeVariable makeFreshTypeVariable(string baseName) { if (parentScope != null) { return(parentScope.makeFreshTypeVariable(baseName)); } int index = 0; string name = baseName; while (typeVariableMap.ContainsKey(name)) { name = baseName + "_$" + (index++).ToString(); } TypeVariable result = new BasicTypeVariable(name); typeVariableMap[name] = result; return(result); }