Search in sources :

Example 1 with Sigma

use of catdata.fql.decl.TransExp.Sigma in project fql by CategoricalData.

the class TransChecker method visit.

@Override
public Pair<String, String> visit(FQLProgram env, Sigma e) {
    Pair<String, String> ht = e.h.type(env);
    InstExp i1 = env.insts.get(e.src);
    if (!(i1 instanceof InstExp.Sigma)) {
        throw new RuntimeException(i1 + " is not a sigma in " + e);
    }
    String i1x = ((InstExp.Sigma) i1).I;
    if (!i1x.equals(ht.first)) {
        throw new RuntimeException("Source mismatch on " + e + ": " + i1x + " and " + ht.first);
    }
    InstExp i2 = env.insts.get(e.dst);
    if (!(i2 instanceof InstExp.Sigma)) {
        throw new RuntimeException(i2 + " is not a sigma in " + e);
    }
    String i2x = ((InstExp.Sigma) i2).I;
    if (!i2x.equals(ht.second)) {
        throw new RuntimeException("Target mismatch on " + e + ": " + i2x + " and " + ht.second);
    }
    return new Pair<>(e.src, e.dst);
}
Also used : InstExp(catdata.fql.decl.InstExp) FullSigma(catdata.fql.decl.TransExp.FullSigma) Sigma(catdata.fql.decl.TransExp.Sigma) Pair(catdata.Pair)

Aggregations

Pair (catdata.Pair)1 InstExp (catdata.fql.decl.InstExp)1 FullSigma (catdata.fql.decl.TransExp.FullSigma)1 Sigma (catdata.fql.decl.TransExp.Sigma)1