Search in sources :

Example 16 with PSM

use of catdata.fql.sql.PSM in project fql by CategoricalData.

the class InstOps method visit.

@Override
public List<PSM> visit(String dst, Fst e) {
    List<PSM> ret = new LinkedList<>();
    InstExp k = prog.insts.get(e.obj);
    Signature t = k.type(prog).toSig(prog);
    for (Node n : t.nodes) {
        ret.add(new InsertSQL(dst + "_" + n.string, new CopyFlower(e.obj + "_fst_" + n.string, "c0", "c1"), "c0", "c1"));
    }
    return ret;
}
Also used : InsertSQL(catdata.fql.sql.InsertSQL) CopyFlower(catdata.fql.sql.CopyFlower) PropPSM(catdata.fql.sql.PropPSM) ExpPSM(catdata.fql.sql.ExpPSM) PSM(catdata.fql.sql.PSM) LinkedList(java.util.LinkedList)

Example 17 with PSM

use of catdata.fql.sql.PSM in project fql by CategoricalData.

the class InstOps method visit.

@Override
public List<PSM> visit(String env, TransEval e) {
    List<PSM> ret = new LinkedList<>();
    InstExp k = prog.insts.get(e.inst);
    Times t = (Times) k;
    InstExp v = prog.insts.get(t.a);
    Exp i = (Exp) v;
    ret.add(new PSMEval(env, i.a, i.b, t.a, e.inst, t.type(prog).toSig(prog)));
    return ret;
}
Also used : PSMEval(catdata.fql.sql.PSMEval) Times(catdata.fql.decl.InstExp.Times) PropPSM(catdata.fql.sql.PropPSM) ExpPSM(catdata.fql.sql.ExpPSM) PSM(catdata.fql.sql.PSM) Exp(catdata.fql.decl.InstExp.Exp) LinkedList(java.util.LinkedList)

Example 18 with PSM

use of catdata.fql.sql.PSM in project fql by CategoricalData.

the class InstOps method visit.

@Override
public List<PSM> visit(String dst, TransExp.Sigma e) {
    List<PSM> ret = new LinkedList<>();
    Pair<String, String> ht = e.h.type(prog);
    Signature sig = prog.insts.get(ht.first).type(prog).toSig(prog);
    Mapping F = ((Sigma) prog.insts.get(e.src)).F.toMap(prog);
    String next = next();
    ret.addAll(PSMGen.makeTables(next, sig, false));
    ret.addAll(e.h.accept(next, this));
    Signature sig2 = prog.insts.get(e.src).type(prog).toSig(prog);
    String xxx = "sigfunc";
    ret.addAll(PSMGen.makeTables(xxx, sig2, false));
    for (Node n : sig2.nodes) {
        List<Flower> l = new LinkedList<>();
        for (Node m : F.source.nodes) {
            if (F.nm.get(m).equals(n)) {
                l.add(new CopyFlower(next + "_" + m.string, "c0", "c1"));
            }
        }
        String yyy = xxx + "_" + n.string;
        if (l.isEmpty()) {
            ret.add(new InsertSQL(yyy, l.get(0), "c0", "c1"));
        } else {
            ret.add(new InsertSQL(yyy, new Union(l), "c0", "c1"));
        }
        ret.add(new InsertSQL(dst + "_" + n.string, PSMGen.compose(e.src + "_" + n.string + "_subst_inv", yyy, e.dst + "_" + n.string + "_subst"), "c0", "c1"));
    }
    ret.addAll(PSMGen.dropTables(xxx, sig2));
    ret.addAll(PSMGen.dropTables(next, sig));
    return ret;
}
Also used : CopyFlower(catdata.fql.sql.CopyFlower) Flower(catdata.fql.sql.Flower) CopyFlower(catdata.fql.sql.CopyFlower) PropPSM(catdata.fql.sql.PropPSM) ExpPSM(catdata.fql.sql.ExpPSM) PSM(catdata.fql.sql.PSM) LinkedList(java.util.LinkedList) Union(catdata.fql.sql.Union) InsertSQL(catdata.fql.sql.InsertSQL)

Example 19 with PSM

use of catdata.fql.sql.PSM in project fql by CategoricalData.

the class InstOps method visit.

@Override
public List<PSM> visit(String env, Implies e) {
    List<PSM> ret = new LinkedList<>();
    Times pr = (Times) prog.insts.get(e.prop);
    Signature sig = pr.type(prog).toSig(prog);
    ret.add(new PSMAnd(sig, env, e.prop, pr.a, "implies"));
    return ret;
}
Also used : PSMAnd(catdata.fql.sql.PSMAnd) Times(catdata.fql.decl.InstExp.Times) PropPSM(catdata.fql.sql.PropPSM) ExpPSM(catdata.fql.sql.ExpPSM) PSM(catdata.fql.sql.PSM) LinkedList(java.util.LinkedList)

Example 20 with PSM

use of catdata.fql.sql.PSM in project fql by CategoricalData.

the class InstOps method visit.

@Override
public Pair<List<PSM>, Object> visit(String dst, Exp e) {
    List<PSM> ret = new LinkedList<>();
    ret.add(new ExpPSM(dst, e.a, e.b, prog.insts.get(e.a).type(prog).toSig(prog)));
    return new Pair<>(ret, new Object());
}
Also used : ExpPSM(catdata.fql.sql.ExpPSM) PropPSM(catdata.fql.sql.PropPSM) ExpPSM(catdata.fql.sql.ExpPSM) PSM(catdata.fql.sql.PSM) LinkedList(java.util.LinkedList) Pair(catdata.Pair)

Aggregations

ExpPSM (catdata.fql.sql.ExpPSM)37 PSM (catdata.fql.sql.PSM)37 PropPSM (catdata.fql.sql.PropPSM)37 LinkedList (java.util.LinkedList)36 InsertSQL (catdata.fql.sql.InsertSQL)18 CopyFlower (catdata.fql.sql.CopyFlower)14 Pair (catdata.Pair)12 HashMap (java.util.HashMap)12 LinkedHashMap (java.util.LinkedHashMap)12 Flower (catdata.fql.sql.Flower)9 Times (catdata.fql.decl.InstExp.Times)8 Map (java.util.Map)7 FQLException (catdata.fql.FQLException)6 Arr (catdata.fql.cat.Arr)6 Triple (catdata.Triple)5 Delta (catdata.fql.decl.InstExp.Delta)5 PSMAnd (catdata.fql.sql.PSMAnd)5 SimpleCreateTable (catdata.fql.sql.SimpleCreateTable)5 Exp (catdata.fql.decl.InstExp.Exp)4 FullSigma (catdata.fql.decl.InstExp.FullSigma)4