in meta/src/main/java/org/arend/lib/meta/solver/BaseTermCompiler.java [44:72]
protected BaseTermCompiler(CoreClassCallExpression classCall, boolean isRing, boolean isLattice, TypedExpression instance, RingKind kind, StdExtension ext, ExpressionTypechecker typechecker, ConcreteSourceNode marker, Values<CoreExpression> values, Set<Integer> positiveVars, boolean toInt, boolean toRat) {
meta = ext.equationMeta;
factory = ext.factory.withData(marker);
zroMatcher = FunctionMatcher.makeFieldMatcher(classCall, instance, isLattice ? meta.bottom : meta.ext.zro, typechecker, factory, marker, ext, 0);
ideMatcher = FunctionMatcher.makeFieldMatcher(classCall, instance, isLattice ? meta.top : ext.ide, typechecker, factory, marker, ext, 0);
addMatcher = FunctionMatcher.makeFieldMatcher(classCall, instance, isLattice ? meta.join : meta.plus, typechecker, factory, marker, ext, 2);
mulMatcher = FunctionMatcher.makeFieldMatcher(classCall, instance, isLattice ? meta.meet : meta.mul, typechecker, factory, marker, ext, 2);
natCoefMatcher = FunctionMatcher.makeFieldMatcher(classCall, instance, meta.natCoef, typechecker, factory, marker, ext, 1);
negativeMatcher = isRing ? FunctionMatcher.makeFieldMatcher(classCall, instance, meta.negative, typechecker, factory, marker, ext, 1) : null;
ratAlgebraMatcher = kind == RingKind.RAT_ALG ? FunctionMatcher.makeFieldMatcher(classCall, instance, meta.ext.linearSolverMeta.coefMap, typechecker, factory, marker, ext, 1) : null;
minusMatcher = toInt ? new DefinitionFunctionMatcher(ext.prelude.getMinus(), 2) : null;
this.values = values;
this.kind = kind;
BaseTermCompiler subTermCompiler = null;
if (kind == RingKind.INT || kind == RingKind.RAT) {
CoreFunctionDefinition subInstance = kind == RingKind.INT ? meta.NatSemiring : meta.IntRing;
TypedExpression typed = Utils.tryTypecheck(typechecker, tc -> tc.typecheck(factory.ref(subInstance.getRef()), null));
if (typed != null) {
subTermCompiler = newInstance((CoreClassCallExpression) subInstance.getResultType(), typed, kind == RingKind.INT ? RingKind.NAT : RingKind.INT, ext, typechecker, marker, values, positiveVars, kind == RingKind.INT, kind == RingKind.RAT);
}
}
this.toInt = toInt;
this.toRat = toRat;
this.subTermCompiler = subTermCompiler;
this.typechecker = typechecker;
this.positiveVars = positiveVars;
this.instance = instance.getExpression();
this.marker = marker;
}