UNPKG

@informalsystems/quint

Version:

Core tool for the Quint specification language

29 lines 1.33 kB
"use strict"; Object.defineProperty(exports, "__esModule", { value: true }); exports.compareConstraints = exports.toScheme = void 0; /** The constraint kinds, in order of "generality" * * Constraint solving is order dependent, and we need the most general constraints * to be solved first. "More general" is here understood to mean "requires less * information to solve correctly". */ const constraintKinds = ['empty', 'eq', 'conjunction', 'isDefined']; // Does not bind any type variables in `type`, which we take to assume // that `type` has no free variables in the context. function toScheme(type) { return { typeVariables: new Set([]), rowVariables: new Set([]), type }; } exports.toScheme = toScheme; /** compares two constraints based on the order of generality of their kind * * @returns a negative value if the kind of the first constraint is more general than the second, * a positive value if the kind of the first constraint is more specific than the second, * and 0 if the two constraints are the same kind. */ function compareConstraints(a, b) { const aIdx = constraintKinds.findIndex(s => s === a.kind); const bIdx = constraintKinds.findIndex(s => s === b.kind); return aIdx - bIdx; } exports.compareConstraints = compareConstraints; //# sourceMappingURL=base.js.map