public override MSOFormula ToMSO(FreshGen fg, string V) { int c = fg.get(); string x = "_x_" + c.ToString(); string y = "_y_" + c.ToString(); string X = "_X_" + c.ToString(); int i = str.Length - 1; string z_i, z_im; MSOFormula phi = null; phi = new MSOLabel("z0", str[0]); while (i > 0) { z_i = "z" + i.ToString(); z_im = "z" + (i - 1).ToString(); phi = new MSOExistsFO(z_i, new MSOAnd(new MSOSucc(z_im, z_i), new MSOAnd(new MSOLabel(z_i, str[i]), phi))); i--; } return(new MSOForallFO("z0", new MSOIff(new MSOBelong("z0", V), phi))); }
public override MSOFormula Contains(FreshGen fg, string v) { switch (op) { case PDLComparisonOperator.Ge: { int c = fg.get(); string y = "_y_" + c.ToString(); return(new MSOExistsFO(y, new MSOAnd(pos.ToMSO(fg, y), new MSOLess(y, v)))); } case PDLComparisonOperator.Geq: { int c = fg.get(); string y = "_y_" + c.ToString(); return(new MSOExistsFO(y, new MSOAnd(pos.ToMSO(fg, y), new MSOLessEq(y, v)))); } case PDLComparisonOperator.Le: { int c = fg.get(); string y = "_y_" + c.ToString(); return(new MSOExistsFO(y, new MSOAnd(pos.ToMSO(fg, y), new MSOLess(v, y)))); } case PDLComparisonOperator.Leq: { int c = fg.get(); string y = "_y_" + c.ToString(); return(new MSOExistsFO(y, new MSOAnd(pos.ToMSO(fg, y), new MSOLessEq(v, y)))); } default: throw new PDLException("not defined on this operator"); } }
public override MSOFormula ToMSO(FreshGen fg, string V) { switch (op) { case PDLBinarySetOperator.Intersection: { int c = fg.get(); string X1 = "_X1_" + c.ToString(); string X2 = "_X2_" + c.ToString(); string x = "_x_" + c.ToString(); return(new MSOForallFO(x, new MSOIff(new MSOBelong(x, V), new MSOAnd(set1.Contains(fg, x), set2.Contains(fg, x))))); } case PDLBinarySetOperator.Union: { int c = fg.get(); string X1 = "_X1_" + c.ToString(); string X2 = "_X2_" + c.ToString(); string x = "_x_" + c.ToString(); return(new MSOForallFO(x, new MSOIff(new MSOBelong(x, V), new MSOOr(set1.Contains(fg, x), set2.Contains(fg, x))))); } default: throw new PDLException("undefined operator"); } }
public override void ToTreeString(FreshGen fg, StringBuilder sb, int index, Dictionary <string, Pair <PDL, string> > nodes) { nodes.Add(this.GetNodeName() + ":" + index, new Pair <PDL, string>(this, "")); int x1 = fg.get(); nodes.Add(str + ":" + x1, new Pair <PDL, string>(this, "str")); sb.Append(string.Format("{0}:{2}-{1}:{3};", this.GetNodeName(), str, index, x1)); }
public virtual string ToTreeString(Dictionary <string, Pair <PDL, string> > nodes) { FreshGen fg = new FreshGen(); StringBuilder sb = new StringBuilder(); fg.reset(); ToTreeString(fg, sb, 0, nodes); nodes.Add("AAA:0", new Pair <PDL, string>(null, "")); return("AAA:0-" + this.GetNodeName() + ":0;" + sb.ToString()); }
public override MSOFormula ToMSO(FreshGen fg, string v) { switch (op) { case PDLPosConstantName.First: return(new MSOFirst(v)); case PDLPosConstantName.Last: return(new MSOLast(v)); default: throw new PDLException("undefined operator"); } }
public override MSOFormula Contains(FreshGen fg, string v) { switch (op) { case PDLBinarySetOperator.Intersection: return(new MSOAnd(set1.Contains(fg, v), set2.Contains(fg, v))); case PDLBinarySetOperator.Union: return(new MSOOr(set1.Contains(fg, v), set2.Contains(fg, v))); default: throw new PDLException("undefined operator"); } }
public override MSOFormula ToMSO(FreshGen fg, string v) { switch (op) { case PDLStringPosOperator.FirstOcc: { int i = str.Length - 1; string z_i, z_im; MSOFormula phi = null; //new MSOForallFO("x", new MSOEqual("x", "x")); //TODO make sure input string is non empty that is i/=0 phi = new MSOLabel("z0", str[0]); while (i > 0) { z_i = "z" + i.ToString(); z_im = "z" + (i - 1).ToString(); phi = new MSOExistsFO(z_i, new MSOAnd(new MSOSucc(z_im, z_i), new MSOAnd(new MSOLabel(z_i, str[i]), phi))); i--; } return(new MSOAnd(new MSOForallFO("z0", new MSOIf(phi, new MSOLessEq(v, "z0"))), new MSOExistsFO("z0", new MSOAnd(phi, new MSOEqual(v, "z0"))))); } case PDLStringPosOperator.LastOcc: { int i = str.Length - 1; string z_i, z_im; MSOFormula phi = null; //new MSOForallFO("x", new MSOEqual("x", "x")); //TODO make sure input string is non empty that is i/=0 phi = new MSOLabel("z0", str[0]); while (i > 0) { z_i = "z" + i.ToString(); z_im = "z" + (i - 1).ToString(); phi = new MSOExistsFO(z_i, new MSOAnd(new MSOSucc(z_im, z_i), new MSOAnd(new MSOLabel(z_i, str[i]), phi))); i--; } return(new MSOAnd(new MSOForallFO("z0", new MSOIf(phi, new MSOLessEq("z0", v))), new MSOExistsFO("z0", new MSOAnd(phi, new MSOEqual(v, "z0"))))); } default: throw new PDLException("undefined operator"); } }
public override MSOFormula Contains(FreshGen fg, string v) { string zi, ziPrev, z0 = "_z0"; int i = str.Length - 1; MSOFormula phi = new MSOTrue(); while (i > 0) { zi = "_z" + i.ToString(); ziPrev = "_z" + (i - 1).ToString(); phi = new MSOExistsFO(zi, new MSOAnd(phi, new MSOAnd(new MSOLabel(zi, str[i]), new MSOSucc(ziPrev, zi)))); i--; } phi = new MSOExistsFO(z0, new MSOAnd(phi, new MSOAnd(new MSOLabel(z0, str[0]), new MSOEqual(z0, v)))); return(phi); }
public override MSOFormula ToMSO(FreshGen fg, string V) { switch (op) { case PDLComparisonOperator.Ge: { int c = fg.get(); string x = "_x"; string y = "_y_" + c.ToString(); return(new MSOExistsFO(y, new MSOAnd(pos.ToMSO(fg, y), new MSOForallFO(x, new MSOIff(new MSOLess(y, x), new MSOBelong(x, V)))))); } case PDLComparisonOperator.Geq: { int c = fg.get(); string x = "_x"; string y = "_y_" + c.ToString(); return(new MSOExistsFO(y, new MSOAnd(pos.ToMSO(fg, y), new MSOForallFO(x, new MSOIff(new MSOLessEq(y, x), new MSOBelong(x, V)))))); } case PDLComparisonOperator.Le: { int c = fg.get(); string x = "_x"; string y = "_y_" + c.ToString(); return(new MSOExistsFO(y, new MSOAnd(pos.ToMSO(fg, y), new MSOForallFO(x, new MSOIff(new MSOLess(x, y), new MSOBelong(x, V)))))); } case PDLComparisonOperator.Leq: { int c = fg.get(); string x = "_x"; string y = "_y_" + c.ToString(); return(new MSOExistsFO(y, new MSOAnd(pos.ToMSO(fg, y), new MSOForallFO(x, new MSOIff(new MSOLessEq(x, y), new MSOBelong(x, V)))))); } default: throw new PDLException("not defined on this operator"); } }
public override MSOFormula ToMSO(FreshGen fg, string v) { switch (op) { case PDLPosUnaryConstructor.Pred: { int c = fg.get(); string x1 = "_x1_" + c.ToString(); return(new MSOExistsFO(x1, new MSOAnd(pos.ToMSO(fg, x1), new MSOSucc(v, x1)))); } case PDLPosUnaryConstructor.Succ: { int c = fg.get(); string x = "_x_" + c.ToString(); return(new MSOExistsFO(x, new MSOAnd(pos.ToMSO(fg, x), new MSOSucc(x, v)))); } default: throw new PDLException("undefined operator"); } }
public override MSOFormula ToMSO(FreshGen fg, string v) { return(new MSOEqual(v, var)); }
/* while constructing the formula, you need to mention the free * variables with which you want it */ public abstract MSOFormula ToMSO(FreshGen fg, string v);
public abstract MSOFormula ToMSO(FreshGen fg, string V); //set variable V
public abstract int Eval(string str, Dictionary <string, int> A); // A is the assignment public abstract MSOFormula Contains(FreshGen fg, string v); // FO variable v
public abstract void ToTreeString(FreshGen fg, StringBuilder sb, int ind, Dictionary <string, Pair <PDL, string> > nodes);
public override MSOFormula ToMSO(FreshGen fg, string V) { string x = "x"; return(new MSOForallFO(x, new MSOBelong(x, V))); }
public abstract void ToTreeString(FreshGen fg , StringBuilder sb, int ind, Dictionary<string, Pair<PDL, string>> nodes);
public override MSOFormula Contains(FreshGen fg, string v) { return(new MSOTrue()); }
public override MSOFormula Contains(FreshGen fg, string v) { return(new MSOBelong(v, var)); }
public override void ToTreeString(FreshGen fg, StringBuilder sb, int index, Dictionary <string, Pair <PDL, string> > nodes) { nodes.Add(this.GetNodeName() + ":" + index, new Pair <PDL, string>(this, "")); }
public override MSOFormula ToMSO(FreshGen fg, string V) { // forall FOvar (pred(FOvar) iff FOvar \in V) return(new MSOForallFO(FOvar, new MSOIff(pred.ToMSO(fg), new MSOBelong(FOvar, V)))); }
public virtual string ToTreeString(Dictionary<string, Pair<PDL, string>> nodes) { FreshGen fg = new FreshGen(); StringBuilder sb = new StringBuilder(); fg.reset(); ToTreeString(fg,sb,0,nodes); nodes.Add("AAA:0",new Pair<PDL,string>(null,"")); return "AAA:0-" + this.GetNodeName() + ":0;" + sb.ToString(); }
public override MSOFormula Contains(FreshGen fg, string v) { //exists FOvar (pred(FOvar) and FOvar = v) return(new MSOExistsFO(FOvar, new MSOAnd(pred.ToMSO(fg), new MSOEqual(FOvar, v)))); }