Search in sources :

Example 1 with Pi

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

the class TransChecker method visit.

@Override
public Pair<String, String> visit(FQLProgram env, Pi e) {
    Pair<String, String> ht = e.h.type(env);
    InstExp i1 = env.insts.get(e.src);
    if (!(i1 instanceof InstExp.Pi)) {
        throw new RuntimeException(i1 + " is not a pi in " + e);
    }
    String i1x = ((InstExp.Pi) 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.Pi)) {
        throw new RuntimeException(i2 + " is not a pi in " + e);
    }
    String i2x = ((InstExp.Pi) 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) Pi(catdata.fql.decl.TransExp.Pi) Pair(catdata.Pair)

Aggregations

Pair (catdata.Pair)1 InstExp (catdata.fql.decl.InstExp)1 Pi (catdata.fql.decl.TransExp.Pi)1