(*
-* Copyright 2005-2009, Ecole des Mines de Nantes, University of Copenhagen
-* Yoann Padioleau, Julia Lawall, Rene Rydhof Hansen, Henrik Stuart, Gilles Muller
-* This file is part of Coccinelle.
-*
-* Coccinelle is free software: you can redistribute it and/or modify
-* it under the terms of the GNU General Public License as published by
-* the Free Software Foundation, according to version 2 of the License.
-*
-* Coccinelle is distributed in the hope that it will be useful,
-* but WITHOUT ANY WARRANTY; without even the implied warranty of
-* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
-* GNU General Public License for more details.
-*
-* You should have received a copy of the GNU General Public License
-* along with Coccinelle. If not, see <http://www.gnu.org/licenses/>.
-*
-* The authors reserve the right to distribute this or future versions of
-* Coccinelle under other licenses.
-*)
+ * Copyright 2005-2010, Ecole des Mines de Nantes, University of Copenhagen
+ * Yoann Padioleau, Julia Lawall, Rene Rydhof Hansen, Henrik Stuart, Gilles Muller, Nicolas Palix
+ * This file is part of Coccinelle.
+ *
+ * Coccinelle is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU General Public License as published by
+ * the Free Software Foundation, according to version 2 of the License.
+ *
+ * Coccinelle is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU General Public License for more details.
+ *
+ * You should have received a copy of the GNU General Public License
+ * along with Coccinelle. If not, see <http://www.gnu.org/licenses/>.
+ *
+ * The authors reserve the right to distribute this or future versions of
+ * Coccinelle under other licenses.
+ *)
;;
(* Simple predicates *)
-module WRAPPER_PRED =
+module WRAPPER_PRED =
struct
type predicate = string
end
-module EXAMPLE_ENGINE =
+module EXAMPLE_ENGINE =
Wrapper_ctl.CTL_ENGINE_BIS (SIMPLE_ENV) (Ctl_engine.OGRAPHEXT_GRAPH) (WRAPPER_PRED)
let top_wit = []
(* FIX ME: move to ENGINE module *)
let (-/->) x v = NegSubst(x,v);;
-let mkgraph nodes edges =
+let mkgraph nodes edges =
let g = ref (new Ograph_extended.ograph_extended) in
- let addn (n,x) =
- (* let (g',i) = (!g)#add_node x in *)
- (* now I need to force the nodei of a node, because of the state(vx) predicates
+ let addn (n,x) =
+ (* let (g',i) = (!g)#add_node x in *)
+ (* now I need to force the nodei of a node, because of the state(vx) predicates
hence add_node -> add_nodei
*)
let (g', i) = !g#add_nodei n x in
assert (i = n);
g := g'; (n,i) in
- let adde anodes (n1,n2,x) =
+ let adde anodes (n1,n2,x) =
let g' = (!g)#add_arc ((List.assoc n1 anodes,List.assoc n2 anodes),x) in
g := g'; () in
let add_nodes = List.map addn nodes in
(* CTL parameterised on basic predicates and metavar's*)
-type ('pred,'mvar) old_gen_ctl =
+type ('pred,'mvar) old_gen_ctl =
| False_
| True_
| Pred_ of 'pred
| _ -> []
;;
-let ex1graph =
- let nodes =
+let ex1graph =
+ let nodes =
[(0,"f(1)");(1,"f(2)");(2,"< >");(3,"g(1)");(4,"g(2)");(5,"<exit>")] in
let edges = [(0,2); (1,2); (2,3); (2,4); (3,5); (4,5); (5,5)] in
mkgraph nodes (List.map (fun (x,y) -> (x,y,())) edges)
let ex1phi1 = ex1s4;;
let ex1phi2 = ex1s5a;;
-let ex1phi3 =
+let ex1phi3 =
And_
(Exists_ ("x",
(Exists_ ("v3",
Pred_ ("g(y)", Modif "v0")
))))));;
-let ex1phi4 =
+let ex1phi4 =
Exists_ ("x",
And_ (
(Exists_ ("v3",
let ex1phi5 = AU_(True_,Exists_("y", Exists_("v0",Pred_("g(y)",Modif "v0"))));;
-let ex1phi6 =
+let ex1phi6 =
AU_(
Not_(Exists_("x",Exists_("v1",Pred_("f(x)",UnModif "v1")))),
Exists_("y", Exists_("v0",Pred_("g(y)",Modif "v0")))
);;
(* use with ex1nc *)
-let ex1phi7 =
+let ex1phi7 =
AU_(
Not_(Or_(Pred_("f(1)",Control),Pred_("f(2)",Control))),
Exists_("y", Exists_("v0",Pred_("g(y)",Modif "v0")))
| "p" -> [0,[]]
| "{" -> [(1,[]); (2,[])]
| "}" -> [(3,[]); (4,[])]
- | "paren(v)" -> [(1,["v" --> "1"]); (2,["v" --> "2"]);
+ | "paren(v)" -> [(1,["v" --> "1"]); (2,["v" --> "2"]);
(3,["v" --> "2"]); (4,["v" --> "1"])]
| _ -> []
;;
-let ex2graph =
- let nodes =
+let ex2graph =
+ let nodes =
[(0,"p");(1,"{");(2,"{");(3,"}");(4,"}");(5,"<exit>")] in
let edges = [(0,1); (1,2); (2,3); (3,4); (4,5); (5,5)] in
mkgraph nodes (List.map (fun (x,y) -> (x,y,())) edges)