[Toss-devel-svn] SF.net SVN: toss:[1620] trunk/Toss
Status: Beta
Brought to you by:
lukaszkaiser
|
From: <luk...@us...> - 2011-11-05 14:15:28
|
Revision: 1620
http://toss.svn.sourceforge.net/toss/?rev=1620&view=rev
Author: lukstafi
Date: 2011-11-05 14:15:19 +0000 (Sat, 05 Nov 2011)
Log Message:
-----------
GDL translation: fixes to unframed fluent and erasure clauses treatment; regenerated tests. Discrete rule formula-based representation moved to ELEMS, RELS keywords.
Modified Paths:
--------------
trunk/Toss/Arena/ArenaParser.mly
trunk/Toss/Arena/DiscreteRule.ml
trunk/Toss/Arena/DiscreteRuleParser.mly
trunk/Toss/Arena/DiscreteRuleTest.ml
trunk/Toss/Formula/Lexer.mll
trunk/Toss/Formula/Tokens.mly
trunk/Toss/GGP/TranslateGame.ml
trunk/Toss/GGP/TranslateGameTest.ml
trunk/Toss/GGP/tests/2player_normal_form_2010-raw.toss
trunk/Toss/GGP/tests/2player_normal_form_2010-simpl.toss
trunk/Toss/GGP/tests/2player_normal_form_joint-raw.toss
trunk/Toss/GGP/tests/2player_normal_form_joint-simpl.toss
trunk/Toss/GGP/tests/asteroids-scrambled-raw.toss
trunk/Toss/GGP/tests/asteroids-scrambled-simpl.toss
trunk/Toss/GGP/tests/breakthrough-raw.toss
trunk/Toss/GGP/tests/breakthrough-simpl.toss
trunk/Toss/GGP/tests/connect4-raw.toss
trunk/Toss/GGP/tests/connect4-simpl.toss
trunk/Toss/GGP/tests/connect5-raw.toss
trunk/Toss/GGP/tests/connect5-simpl.toss
trunk/Toss/GGP/tests/pacman3p-raw.toss
trunk/Toss/GGP/tests/pacman3p-simpl.toss
trunk/Toss/GGP/tests/tictactoe-other-raw.toss
trunk/Toss/GGP/tests/tictactoe-other-simpl.toss
trunk/Toss/GGP/tests/tictactoe-raw.toss
trunk/Toss/GGP/tests/tictactoe-simpl.toss
trunk/Toss/Solver/RealQuantElim/Poly.ml
trunk/Toss/Solver/Solver.ml
Modified: trunk/Toss/Arena/ArenaParser.mly
===================================================================
--- trunk/Toss/Arena/ArenaParser.mly 2011-11-03 18:39:52 UTC (rev 1619)
+++ trunk/Toss/Arena/ArenaParser.mly 2011-11-05 14:15:19 UTC (rev 1620)
@@ -101,6 +101,10 @@
game_defs:
| RULE_SPEC rname = id_int COLON r = rule_expr
{ DefRule (rname, r) }
+ | RULE_SPEC error
+ { Lexer.report_parsing_error
+ $startpos $endpos
+ "Syntax error in rule specification of game definition." }
| LOC_MOD l = location
{ DefLoc l }
| PLAYERS_MOD pnames = separated_list (COMMA, id_int)
Modified: trunk/Toss/Arena/DiscreteRule.ml
===================================================================
--- trunk/Toss/Arena/DiscreteRule.ml 2011-11-03 18:39:52 UTC (rev 1619)
+++ trunk/Toss/Arena/DiscreteRule.ml 2011-11-05 14:15:19 UTC (rev 1620)
@@ -1313,12 +1313,12 @@
let add_elems = Aux.list_diff r.rhs_vars r.lhs_vars in
let elem_del_part =
if del_elems = [] then ""
- else "ELEM "^String.concat ", " del_elems in
+ else "ELEMS "^String.concat ", " del_elems in
let elem_add_part =
if add_elems = [] then ""
else match r.rlmap with
- | None -> "ELEM "^String.concat ", " add_elems
- | Some rlmap -> "ELEM "^String.concat ", "
+ | None -> "ELEMS "^String.concat ", " add_elems
+ | Some rlmap -> "ELEMS "^String.concat ", "
(List.map
(fun v ->
if List.mem_assoc v rlmap && List.assoc v rlmap <> v
@@ -1327,10 +1327,10 @@
add_elems) in
let rel_del_part =
if r.del_tuples = [] then ""
- else "REL "^str_tuples r.del_tuples in
+ else "RELS "^str_tuples r.del_tuples in
let rel_add_part =
if r.add_tuples = [] then ""
- else "REL "^str_tuples r.add_tuples in
+ else "RELS "^str_tuples r.add_tuples in
let del_part =
if elem_del_part = "" && rel_del_part = ""
then ""
@@ -1354,16 +1354,16 @@
let add_elems = Aux.list_diff r.rhs_vars r.lhs_vars in
let elem_del_part () =
if del_elems = [] then ()
- else Format.fprintf f "@[<1>ELEM@ %a@]"
+ else Format.fprintf f "@[<1>ELEMS@ %a@]"
(Aux.fprint_sep_list "," Format.pp_print_string) del_elems in
let elem_add_part () =
if add_elems = [] then ()
else match r.rlmap with
| None ->
- Format.fprintf f "@[<1>ELEM@ %a@]"
+ Format.fprintf f "@[<1>ELEMS@ %a@]"
(Aux.fprint_sep_list "," Format.pp_print_string) del_elems
| Some rlmap ->
- Format.fprintf f "@[<1>ELEM@ %a@]"
+ Format.fprintf f "@[<1>ELEMS@ %a@]"
(Aux.fprint_sep_list "," Format.pp_print_string)
(List.map
(fun v ->
@@ -1374,13 +1374,13 @@
let rel_del_part () =
if r.del_tuples = [] then ()
else (
- Format.fprintf f "@[<1>REL@ ";
+ Format.fprintf f "@[<1>RELS@ ";
str_tuples r.del_tuples;
Format.fprintf f "@]") in
let rel_add_part () =
if r.add_tuples = [] then ()
else (
- Format.fprintf f "@[<1>REL@ ";
+ Format.fprintf f "@[<1>RELS@ ";
str_tuples r.add_tuples;
Format.fprintf f "@]") in
let del_part () =
Modified: trunk/Toss/Arena/DiscreteRuleParser.mly
===================================================================
--- trunk/Toss/Arena/DiscreteRuleParser.mly 2011-11-03 18:39:52 UTC (rev 1619)
+++ trunk/Toss/Arena/DiscreteRuleParser.mly 2011-11-05 14:15:19 UTC (rev 1620)
@@ -20,8 +20,8 @@
{ rel, tup }
del_vars_and_rel_tuples:
- | elems = option (preceded (ELEM_MOD, separated_list (COMMA, ID)))
- rel_tups = option (preceded (REL_MOD, separated_list (COMMA, rel_atom)))
+ | elems = option (preceded (ELEMS_MOD, separated_list (COMMA, ID)))
+ rel_tups = option (preceded (RELS_MOD, separated_list (COMMA, rel_atom)))
{ (match elems with None -> [] | Some l->l),
(match rel_tups with None -> [] | Some l->l) }
@@ -30,8 +30,8 @@
{ rhs, lhs }
add_vars_and_rel_tuples:
- | elems = option (preceded (ELEM_MOD, separated_list (COMMA, var_or_asgn)))
- rel_tups = option (preceded (REL_MOD, separated_list (COMMA, rel_atom)))
+ | elems = option (preceded (ELEMS_MOD, separated_list (COMMA, var_or_asgn)))
+ rel_tups = option (preceded (RELS_MOD, separated_list (COMMA, rel_atom)))
{ (match elems with None -> [] | Some l->l),
(match rel_tups with None -> [] | Some l->l) }
@@ -67,6 +67,9 @@
DiscreteRule.compile_formula_rule signat defs phi del_part
add_part pre
}
+ | MATCH error
+ { Lexer.report_parsing_error $startpos $endpos
+ "Syntax error after the discrete rewrite rule MATCH keyword" }
parse_discrete_rule:
discrete_rule_expr EOF { $1 };
Modified: trunk/Toss/Arena/DiscreteRuleTest.ml
===================================================================
--- trunk/Toss/Arena/DiscreteRuleTest.ml 2011-11-03 18:39:52 UTC (rev 1619)
+++ trunk/Toss/Arena/DiscreteRuleTest.ml 2011-11-05 14:15:19 UTC (rev 1620)
@@ -48,7 +48,7 @@
"formula-based: simple" >::
(fun () ->
let s =
- "MATCH Q(a) DEL REL Q(a) ADD REL P(A)" in
+ "MATCH Q(a) DEL RELS Q(a) ADD RELS P(A)" in
let r = rule_of_str ["Q",1;"P",1] s in
assert_equal ~printer:(fun x->x) s (rule_str r)
);
@@ -56,20 +56,20 @@
"formula-based: elem manip" >::
(fun () ->
let s =
- "MATCH (Q(a) and R(a, b)) DEL ELEM b REL Q(a) ADD ELEM c REL R(a, c)" in
+ "MATCH (Q(a) and R(a, b)) DEL ELEMS b RELS Q(a) ADD ELEMS c RELS R(a, c)" in
let r = rule_of_str ["Q",1;"P",1] s in
assert_equal ~msg:"replace" ~printer:(fun x->x) s (rule_str r);
let s =
- "MATCH Q(a) and R(a, b) DEL ELEM b REL Q(a) ADD ELEM c REL R(a, c)" in
+ "MATCH Q(a) and R(a, b) DEL ELEMS b RELS Q(a) ADD ELEMS c RELS R(a, c)" in
let r = rule_of_str ["Q",1;"P",1] s in
assert_equal ~msg:"sprint replace" ~printer:(fun x->x) s (sprint_rule r);
let s =
- "MATCH (Q(a) and R(a, b)) DEL REL Q(a) ADD ELEM c <- b REL Q(c)" in
+ "MATCH (Q(a) and R(a, b)) DEL RELS Q(a) ADD ELEMS c <- b RELS Q(c)" in
let r = rule_of_str ["Q",1;"P",1] s in
assert_equal ~msg:"clone" ~printer:(fun x->x) s (rule_str r);
let s =
- "MATCH Q(a) and R(a, b) DEL REL Q(a) ADD ELEM c <- b REL Q(c)" in
+ "MATCH Q(a) and R(a, b) DEL RELS Q(a) ADD ELEMS c <- b RELS Q(c)" in
let r = rule_of_str ["Q",1;"P",1] s in
assert_equal ~msg:"sprint clone" ~printer:(fun x->x) s (sprint_rule r);
);
@@ -88,11 +88,38 @@
let s="MATCH
D(c, c) and D(c, a) and D(c, b) and D(b, a) and D(b, b) and P(c) and P(b) and
Q(a) and Q(b) and R(c, c) and R(a, c) and R(a, b) and R(b, c) and R(b, b)
- DEL ELEM b REL Q(a), Q(c) ADD REL D(c, b), D(c, c), P(b), R(c, c)" in
+ DEL ELEMS b RELS Q(a), Q(c) ADD RELS D(c, b), D(c, c), P(b), R(c, c)" in
let r = rule_of_str ["D",2;"R",2;"Q",1;"P",1] s in
assert_equal ~printer:(fun x->x) s (sprint_rule r);
);
+ "formula-based: GDL breakthrough" >::
+ (fun () ->
+ let signat = ["R",2;"index__cellholds_1",1;
+ "control__BLANK_",1;"cellempty",1;
+ "cellholds_2white",1;"control_0white",1;
+ "cellholds_2black",1;"control_0black",1;
+ "terminal",0] in
+ let s =
+ "MATCH
+ R(cellholds_x_y__BLANK_, cellholds_x_y0__BLANK_) and
+ index__cellholds_1(cellholds_x_y0__BLANK_) and
+ index__cellholds_1(cellholds_x_y__BLANK_) and
+ control__BLANK_(control__BLANK_) and cellempty(cellholds_x_y0__BLANK_) and
+ cellholds_2white(cellholds_x_y__BLANK_) and control_0white(control__BLANK_) and
+ not terminal()
+ DEL
+ RELS cellholds_2black(cellholds_x_y__BLANK_),
+ cellholds_2black(cellholds_x_y0__BLANK_),
+ cellholds_2white(cellholds_x_y__BLANK_),
+ cellholds_2white(cellholds_x_y0__BLANK_), control_0white(control__BLANK_)
+ ADD
+ RELS cellholds_2white(cellholds_x_y0__BLANK_),
+ control_0black(control__BLANK_)" in
+ let r = rule_of_str signat s in
+ assert_equal ~printer:(fun x->x) s (sprint_rule r);
+ );
+
"rewrite: compile_rule" >::
(fun () ->
@@ -103,10 +130,10 @@
let signat = Structure.rel_signature model in
let rule_obj = compile_rule signat []
{lhs_struc = lhs_struc;
- rhs_struc = rhs_struc;
- emb_rels = [];
- pre = Formula.And [];
- rule_s = [1,1; 2,1]} in
+ rhs_struc = rhs_struc;
+ emb_rels = [];
+ pre = Formula.And [];
+ rule_s = [1,1; 2,1]} in
let embs = find_matchings model rule_obj in
let emb = choose_match model rule_obj embs in
let nmodel =
@@ -122,10 +149,10 @@
let signat = Structure.rel_signature model in
let rule_obj = compile_rule signat []
{lhs_struc = lhs_struc;
- rhs_struc = rhs_struc;
- emb_rels = ["P";"Q"];
- pre = Formula.And [];
- rule_s = [1,1; 2,1]} in
+ rhs_struc = rhs_struc;
+ emb_rels = ["P";"Q"];
+ pre = Formula.And [];
+ rule_s = [1,1; 2,1]} in
let embs = find_matchings model rule_obj in
let emb = choose_match model rule_obj embs in
let nmodel =
@@ -142,10 +169,10 @@
let signat = Structure.rel_signature model in
let rule_obj = compile_rule signat []
{lhs_struc = lhs_struc;
- rhs_struc = rhs_struc;
- emb_rels = ["P";"Q"];
- pre = Formula.And [];
- rule_s = [1,1; 2,1]} in
+ rhs_struc = rhs_struc;
+ emb_rels = ["P";"Q"];
+ pre = Formula.And [];
+ rule_s = [1,1; 2,1]} in
let embs = find_matchings model rule_obj in
let emb = choose_match model rule_obj embs in
let nmodel =
@@ -161,10 +188,10 @@
let signat = Structure.rel_signature model in
let rule_obj = compile_rule signat []
{lhs_struc = lhs_struc;
- rhs_struc = rhs_struc;
- emb_rels = ["P";"R"];
- pre = Formula.And [];
- rule_s = [1,1; 2,2; 3,2]} in
+ rhs_struc = rhs_struc;
+ emb_rels = ["P";"R"];
+ pre = Formula.And [];
+ rule_s = [1,1; 2,2; 3,2]} in
let embs = find_matchings model rule_obj in
let emb = choose_match model rule_obj embs in
let nmodel =
@@ -186,10 +213,10 @@
let signat = Structure.rel_signature model in
let rule_obj = compile_rule signat []
{lhs_struc = lhs_struc;
- rhs_struc = rhs_struc;
- emb_rels = [];
- pre = Formula.And [];
- rule_s = [1,1; 2,1]} in
+ rhs_struc = rhs_struc;
+ emb_rels = [];
+ pre = Formula.And [];
+ rule_s = [1,1; 2,1]} in
let embs = find_matchings model rule_obj in
let emb = choose_match model rule_obj embs in
let nmodel =
@@ -205,10 +232,10 @@
let signat = Structure.rel_signature model in
let rule_obj = compile_rule signat []
{lhs_struc = lhs_struc;
- rhs_struc = rhs_struc;
- emb_rels = ["P";"Q"];
- pre = Formula.And [];
- rule_s = [1,1; 2,1]} in
+ rhs_struc = rhs_struc;
+ emb_rels = ["P";"Q"];
+ pre = Formula.And [];
+ rule_s = [1,1; 2,1]} in
let embs = find_matchings model rule_obj in
let emb = choose_match model rule_obj embs in
let nmodel =
@@ -225,10 +252,10 @@
let signat = Structure.rel_signature model in
let rule_obj = compile_rule signat []
{lhs_struc = lhs_struc;
- rhs_struc = rhs_struc;
- emb_rels = ["P";"Q"];
- pre = Formula.And [];
- rule_s = [1,1; 2,1]} in
+ rhs_struc = rhs_struc;
+ emb_rels = ["P";"Q"];
+ pre = Formula.And [];
+ rule_s = [1,1; 2,1]} in
let embs = find_matchings model rule_obj in
let emb = choose_match model rule_obj embs in
let nmodel =
@@ -244,10 +271,10 @@
let signat = Structure.rel_signature model in
let rule_obj = compile_rule signat []
{lhs_struc = lhs_struc;
- rhs_struc = rhs_struc;
- emb_rels = ["P";"R"];
- pre = Formula.And [];
- rule_s = [1,1; 2,2; 3,2]} in
+ rhs_struc = rhs_struc;
+ emb_rels = ["P";"R"];
+ pre = Formula.And [];
+ rule_s = [1,1; 2,2; 3,2]} in
let embs = find_matchings model rule_obj in
let emb = choose_match model rule_obj embs in
let nmodel =
@@ -269,10 +296,10 @@
let signat = Structure.rel_signature model in
let rule_obj = compile_rule signat []
{lhs_struc = lhs_struc;
- rhs_struc = rhs_struc;
- emb_rels = [];
- pre = Formula.And [];
- rule_s = [1,1; 2,1]} in
+ rhs_struc = rhs_struc;
+ emb_rels = [];
+ pre = Formula.And [];
+ rule_s = [1,1; 2,1]} in
let embs = find_matchings model rule_obj in
let emb = choose_match model rule_obj embs in
let nmodel =
@@ -289,10 +316,10 @@
let signat = Structure.rel_signature model in
let rule_obj = compile_rule signat []
{lhs_struc = lhs_struc;
- rhs_struc = rhs_struc;
- emb_rels = ["P";"Q"];
- pre = Formula.And [];
- rule_s = [1,1; 2,1]} in
+ rhs_struc = rhs_struc;
+ emb_rels = ["P";"Q"];
+ pre = Formula.And [];
+ rule_s = [1,1; 2,1]} in
let embs = find_matchings model rule_obj in
let emb = choose_match model rule_obj embs in
let nmodel =
@@ -313,10 +340,10 @@
let signat = Structure.rel_signature model in
let rule_obj = compile_rule signat []
{lhs_struc = lhs_struc;
- rhs_struc = rhs_struc;
- emb_rels = [];
- pre = Formula.And [];
- rule_s = [1,1]} in
+ rhs_struc = rhs_struc;
+ emb_rels = [];
+ pre = Formula.And [];
+ rule_s = [1,1]} in
let embs = find_matchings model rule_obj in
let emb = choose_match model rule_obj embs in
let nmodel =
@@ -332,10 +359,10 @@
let signat = Structure.rel_signature model in
let rule_obj = compile_rule signat []
{lhs_struc = lhs_struc;
- rhs_struc = rhs_struc;
- emb_rels = ["P";"Q"];
- pre = Formula.And [];
- rule_s = [1,1]} in
+ rhs_struc = rhs_struc;
+ emb_rels = ["P";"Q"];
+ pre = Formula.And [];
+ rule_s = [1,1]} in
let embs = find_matchings model rule_obj in
let emb = choose_match model rule_obj embs in
let nmodel =
@@ -356,10 +383,10 @@
let signat = Structure.rel_signature model in
let rule_obj = compile_rule signat []
{lhs_struc = lhs_struc;
- rhs_struc = rhs_struc;
- emb_rels = [];
- pre = Formula.And [];
- rule_s = [1,1]} in
+ rhs_struc = rhs_struc;
+ emb_rels = [];
+ pre = Formula.And [];
+ rule_s = [1,1]} in
let embs = find_matchings model rule_obj in
let emb = choose_match model rule_obj embs in
let nmodel =
@@ -376,10 +403,10 @@
let signat = Structure.rel_signature model in
let rule_obj = compile_rule signat []
{lhs_struc = lhs_struc;
- rhs_struc = rhs_struc;
- emb_rels = ["P"];
- pre = Formula.And [];
- rule_s = [1,1]} in
+ rhs_struc = rhs_struc;
+ emb_rels = ["P"];
+ pre = Formula.And [];
+ rule_s = [1,1]} in
let embs = find_matchings model rule_obj in
let emb = choose_match model rule_obj embs in
let nmodel =
@@ -401,10 +428,10 @@
let signat = Structure.rel_signature model in
let rule_obj = compile_rule signat []
{lhs_struc = lhs_struc;
- rhs_struc = rhs_struc;
- emb_rels = [];
- pre = Formula.And [];
- rule_s = [1,1]} in
+ rhs_struc = rhs_struc;
+ emb_rels = [];
+ pre = Formula.And [];
+ rule_s = [1,1]} in
let embs = find_matchings model rule_obj in
let emb = choose_match model rule_obj embs in
let nmodel =
@@ -427,7 +454,7 @@
{lhs_struc = lhs_struc;
rhs_struc = rhs_struc;
emb_rels = ["P"];
- pre = Formula.And [];
+ pre = Formula.And [];
rule_s = [1,1]} in
let embs = find_matchings model rule_obj in
let emb = choose_match model rule_obj embs in
@@ -447,8 +474,8 @@
{lhs_struc = lhs_struc;
rhs_struc = rhs_struc;
emb_rels = ["C"];
- pre = Formula.And [];
- rule_s = [1,1; 2,2]} in
+ pre = Formula.And [];
+ rule_s = [1,1; 2,2]} in
let embs = find_matchings model rule_obj in
let emb = choose_match model rule_obj embs in
let nmodel =
@@ -473,7 +500,7 @@
{lhs_struc = lhs_struc;
rhs_struc = rhs_struc;
emb_rels = ["P"];
- pre = Formula.And [];
+ pre = Formula.And [];
rule_s = [1,1]} in
let embs = find_matchings model rule_obj in
let emb = choose_match model rule_obj embs in
@@ -513,7 +540,7 @@
{lhs_struc = lhs_struc;
rhs_struc = rhs_struc;
emb_rels = ["C"];
- pre = Formula.And [];
+ pre = Formula.And [];
rule_s = [1,1]} in
let embs = find_matchings model rule_obj in
let emb = choose_match model rule_obj embs in
@@ -535,10 +562,10 @@
let signat = Structure.rel_signature model in
let rule_obj = compile_rule signat []
{lhs_struc = lhs_struc;
- rhs_struc = rhs_struc;
- emb_rels = ["R"];
- pre = Formula.And [];
- rule_s = [1,1; 2,2]} in
+ rhs_struc = rhs_struc;
+ emb_rels = ["R"];
+ pre = Formula.And [];
+ rule_s = [1,1; 2,2]} in
let embs = find_matchings model rule_obj in
assert_raises
~msg:"inserting a two element into a single element structure"
@@ -560,10 +587,10 @@
let signat = Structure.rel_signature model in
let rule_obj = compile_rule signat []
{lhs_struc = lhs_struc;
- rhs_struc = rhs_struc;
- emb_rels = ["P"];
- pre = formula_of_str "not C(a)";
- rule_s = [1,1]} in
+ rhs_struc = rhs_struc;
+ emb_rels = ["P"];
+ pre = formula_of_str "not C(a)";
+ rule_s = [1,1]} in
let embs = find_matchings model rule_obj in
assert_raises
~msg:"with renaming, precondition should not be met"
@@ -578,10 +605,10 @@
let signat = Structure.rel_signature model in
let rule_obj = compile_rule signat []
{lhs_struc = lhs_struc;
- rhs_struc = rhs_struc;
- emb_rels = ["P"];
- pre = formula_of_str "not C(a)";
- rule_s = [1,1]} in
+ rhs_struc = rhs_struc;
+ emb_rels = ["P"];
+ pre = formula_of_str "not C(a)";
+ rule_s = [1,1]} in
let embs = find_matchings model rule_obj in
let emb = choose_match model rule_obj embs in
let nmodel =
@@ -591,7 +618,7 @@
"[e, f | C (e); P (e); Q (f); _del_P (f); _new_Q (f); _right_a (f) | ]"
(Structure.str nmodel);
- (* without renaming *)
+ (* without renaming *)
let model =
struc_of_str "[ | P{e;f}; Q:1{}; C{e} | ]" in
@@ -601,10 +628,10 @@
let signat = Structure.rel_signature model in
let rule_obj = compile_rule signat []
{lhs_struc = lhs_struc;
- rhs_struc = rhs_struc;
- emb_rels = ["P"];
- pre = formula_of_str "not C(a)";
- rule_s = [1,1]} in
+ rhs_struc = rhs_struc;
+ emb_rels = ["P"];
+ pre = formula_of_str "not C(a)";
+ rule_s = [1,1]} in
let embs = find_matchings model rule_obj in
let emb = choose_match model rule_obj embs in
let nmodel =
Modified: trunk/Toss/Formula/Lexer.mll
===================================================================
--- trunk/Toss/Formula/Lexer.mll 2011-11-03 18:39:52 UTC (rev 1619)
+++ trunk/Toss/Formula/Lexer.mll 2011-11-05 14:15:19 UTC (rev 1620)
@@ -66,7 +66,9 @@
| LET_CMD
| EVAL_CMD
| ELEM_MOD
+ | ELEMS_MOD
| REL_MOD
+ | RELS_MOD
| ALLOF_MOD
| SIG_MOD
| FUN_MOD
@@ -208,7 +210,9 @@
| "let" { LET_CMD }
| "EVAL" { EVAL_CMD }
| "ELEM" { ELEM_MOD }
+ | "ELEMS" { ELEMS_MOD }
| "REL" { REL_MOD }
+ | "RELS" { RELS_MOD }
| "ALLOF" { ALLOF_MOD }
| "SIGNATURE" { SIG_MOD }
| "FUN" { FUN_MOD }
Modified: trunk/Toss/Formula/Tokens.mly
===================================================================
--- trunk/Toss/Formula/Tokens.mly 2011-11-03 18:39:52 UTC (rev 1619)
+++ trunk/Toss/Formula/Tokens.mly 2011-11-05 14:15:19 UTC (rev 1620)
@@ -10,7 +10,7 @@
%token IN AND OR XOR NOT EX ALL TC
%token WITH EMB PRE INV POST UPDATE DYNAMICS TRUE FALSE ASSOC COND PAYOFF MOVES
%token MATCH ADD_CMD DEL_CMD GET_CMD SET_CMD LET_CMD EVAL_CMD
-%token ELEM_MOD REL_MOD ALLOF_MOD SIG_MOD FUN_MOD DATA_MOD LOC_MOD TIMEOUT_MOD TIME_MOD PLAYER_MOD PLAYERS_MOD
+%token ELEM_MOD ELEMS_MOD REL_MOD RELS_MOD ALLOF_MOD SIG_MOD FUN_MOD DATA_MOD LOC_MOD TIMEOUT_MOD TIME_MOD PLAYER_MOD PLAYERS_MOD
%token MODEL_SPEC RULE_SPEC STATE_SPEC LEFT_SPEC RIGHT_SPEC CLASS LFP GFP EOF
/* List in order of increasing precedence. */
Modified: trunk/Toss/GGP/TranslateGame.ml
===================================================================
--- trunk/Toss/GGP/TranslateGame.ml 2011-11-03 18:39:52 UTC (rev 1619)
+++ trunk/Toss/GGP/TranslateGame.ml 2011-11-05 14:15:19 UTC (rev 1620)
@@ -1196,10 +1196,27 @@
(* The [Erasure_cl_OK] clauses do not have unfixed variables. The
[Erasure_cl_inst] stores the unfixed-variable-dependent part
separately, already instantiated. *)
-type cl_type =
+type cl_kind =
| Legal_cl | Next_cl | Erasure_cl_OK
| Erasure_cl_inst of (term * literal list) list
+let subst_cl_kind sb = function
+ | Erasure_cl_inst local ->
+ Erasure_cl_inst
+ (List.map
+ (fun (h, body) -> subst sb h, subst_literals sb body) local)
+ | kind -> kind
+
+let cl_kind_str = function
+ | Legal_cl -> "Legal_cl"
+ | Next_cl -> "Next_cl"
+ | Erasure_cl_OK -> "Era_OK"
+ | Erasure_cl_inst local ->
+ "Era_inst{" ^
+ String.concat "; "
+ (List.map (fun (h, body) -> term_str h ^"<-"^ literals_str body)
+ local) ^ "}"
+
(* substitute a "next" clause with frame info *)
let subst_fnextcl sb (head, frame, body) =
subst sb head, frame, subst_literals sb body
@@ -1312,17 +1329,20 @@
let add_erasure_clauses f_paths (legal_tup, next_cls) =
let fixed_vars = terms_vars (Aux.array_map_of_list fst legal_tup) in
check_timeout "TranslateGame: add_erasure_clauses: start";
+ let legal_cl_bodies = List.map snd legal_tup in
+ let frame_cls, move_cl_bodies =
+ Aux.partition_map (fun (s, frame, body) ->
+ if frame then Aux.Left (s, body) else Aux.Right body) next_cls in
+ let cl_pos_terms =
+ Aux.concat_map pos_state_terms (legal_cl_bodies @ move_cl_bodies) in
(* {{{ log entry *)
if !debug_level > 2 then (
- Printf.printf "add_erasure_clauses: fixed_vars=%s\n%!"
+ Printf.printf
+ "\nadd_erasure_clauses: fixed_vars=%s; cl_pos_terms=%s\n%!"
(String.concat ", " (Aux.Strings.elements fixed_vars))
+ (String.concat ", " (List.map term_str cl_pos_terms))
);
(* }}} *)
- let frame_cls, move_cl_bodies =
- Aux.partition_map (fun (s, frame, body) ->
- if frame then Aux.Left (s, body) else Aux.Right body) next_cls in
- let move_cl_pos_terms =
- Aux.concat_map pos_state_terms move_cl_bodies in
(* two passes to ensure coverage and maximality *)
(* Treating fixed-vars as consts, by substituting them with
Const, and later substituting-back Var *)
@@ -1387,8 +1407,8 @@
let nbodies = negate_bodies bodies in
List.map
(fun (nsb, b) ->
- let s = subst nsb s in
- s, Aux.unique_sorted (Pos (True s) :: b))
+ let s = subst nsb s in (* b already substituted *)
+ s, Aux.unique_sorted b)
nbodies
) frames in
@@ -1403,6 +1423,15 @@
let local_ex_vars = term_vars s in
let local_uni_vars = Aux.Strings.diff
(literals_vars body) local_ex_vars in
+ (* {{{ log entry *)
+ if !debug_level > 3 then (
+ Printf.printf "ERASURE: ex=%s; uni=%s; %s <== %s\n%!"
+ (String.concat "," (Aux.Strings.elements local_ex_vars))
+ (String.concat "," (Aux.Strings.elements local_uni_vars))
+ (term_str s)
+ (String.concat " " (List.map literal_str body))
+ );
+ (* }}} *)
if Aux.Strings.is_empty local_uni_vars then
let body, local_body = List.partition
(fun lit -> Aux.Strings.is_empty (literals_vars [lit]))
@@ -1411,11 +1440,17 @@
if Aux.Strings.is_empty local_ex_vars then Erasure_cl_OK
else
let sbs = Aux.map_try
- (fun t -> unify [] [s] [t]) move_cl_pos_terms in
+ (fun t -> unify [] [s] [t]) cl_pos_terms in
let local = List.map
(fun sb -> subst_consts fixed_to_var (subst sb s),
subst_consts_literals fixed_to_var
(subst_literals sb local_body)) sbs in
+ (* {{{ log entry *)
+ if !debug_level > 3 then (
+ Printf.printf "(local sbs = %s)\n%!"
+ (String.concat "; " (List.map sb_str sbs))
+ );
+ (* }}} *)
Erasure_cl_inst local in
if kind = Erasure_cl_inst [] then None
else
@@ -1427,7 +1462,7 @@
(* {{{ log entry *)
if !debug_level > 2 then (
- Printf.printf "add_erasure_clauses: all erasure clauses --\n%!";
+ Printf.printf "\nadd_erasure_clauses: all filtered erasure clauses --\n%!";
let print_erasure (s, kind, body) =
Printf.printf "ERASURE: %s %s <== %s\n%!"
(if kind = Erasure_cl_OK then " OK " else "inst") (term_str s)
@@ -1589,10 +1624,10 @@
let legal_lits_enc = Aux.map_try encode_lit legal_lits in
(* {{{ log entry *)
if !debug_level > 3 then (
- Printf.printf "filter_redundant:\nlegal_lits=%s\nbody=%s\n\n%!"
+ Printf.printf "filter_redundant:\nlegal_lits=%s\nbody=%s\n%!"
(rel_atoms_str legal_lits_enc) (literals_str body)
);
- (* }}} *)
+ (* }}} *)
let sbs, keep_parts = Aux.partition_map
(fun part ->
try
@@ -1604,7 +1639,14 @@
Aux.Left sb
with Not_found -> Aux.Right part)
parts in
- List.concat sbs, List.concat keep_parts
+ let sb = List.concat sbs and keep = List.concat keep_parts in
+ (* {{{ log entry *)
+ if !debug_level > 3 then (
+ Printf.printf "sb=%s; keep=%s\n\n%!"
+ (sb_str sb) (literals_str keep)
+ );
+ (* }}} *)
+ sb, keep
let remove_local_vars gvars lits =
List.filter (fun l -> Aux.Strings.subset (literals_vars [l]) gvars) lits
@@ -1621,10 +1663,22 @@
let neg_rhs, more_conds = List.split erasure_OK in
let cond = List.concat (more_conds @ conds) in
let cond_sterms = pos_state_terms cond in
+ (* {{{ log entry *)
+ if !debug_level > 3 then (
+ Printf.printf "erasure-cond_sterms: %s\n%!"
+ (String.concat ", " (List.map term_str cond_sterms))
+ );
+ (* }}} *)
let erasure_loc_cls = Aux.concat_map
(fun (local, body) ->
Aux.map_some
(fun (h, loc_body) ->
+ (* {{{ log entry *)
+ if !debug_level > 3 then (
+ Printf.printf "erasure-local-cand: %s\n%!"
+ (term_str h)
+ );
+ (* }}} *)
if List.mem h cond_sterms then Some (h, loc_body @ body)
else None)
local)
@@ -1860,7 +1914,8 @@
(fun (f, brs) ->
let brs = List.map
(fun (cond, update) ->
- let sb, cond = filter_redundant case_cond cond in
+ let sb, cond = filter_redundant case_cond cond in
+ (* TODO: we should pbbly apply [sb] to the whole candidate *)
subst_literals sb cond, update)
brs in
f, brs)
@@ -1942,8 +1997,18 @@
let next_cls = List.map
(fun (head, kind, body) ->
let sb, body = filter_redundant legal_lits body in
- subst sb head, kind, subst_literals sb body)
+ subst sb head, subst_cl_kind sb kind, subst_literals sb body)
next_cls in
+ (* {{{ log entry *)
+ if !debug_level > 3 then (
+ let print_cl (head, kind, body) =
+ Printf.printf
+ "legal-filtered-next-cl: head=%s; kind=%s; body=%s\n%!"
+ (term_str head) (cl_kind_str kind) (literals_str body)
+ in
+ List.iter print_cl next_cls;
+ );
+ (* }}} *)
let fixed_to_var = List.map
(fun v -> v, Var v) fixed_vars in
let next_cls = List.map
@@ -2381,6 +2446,47 @@
(Formula.str (Formula.And synch_precond)) (Formula.str case_precond)
);
(* }}} *)
+ (* we find which rule results should have their old values erased,
+ in cases not covered by erasure clauses *)
+ let used_fluents = Aux.concat_map
+ (map_paths (fun p subt -> p, subt) f_paths)
+ (state_terms case_cond (* @ pos_rhs *)) in
+ let unframed_fluents = List.filter
+ (fun (p, subt) ->
+ subt != blank &&
+ let f_subts = Aux.assoc_all p framed_fluents in
+ not (List.exists (function
+ | Var _ -> true
+ | f_subt -> f_subt = subt) f_subts))
+ used_fluents in
+ let unframed_elems_fluents = Aux.concat_map
+ (fun st -> Aux.map_some
+ (fun (p,subt) ->
+ try
+ if at_path st p = subt then Some (st, (p,subt))
+ else None with Not_found -> None)
+ unframed_fluents)
+ (*Aux.list_diff*) (pos_state_terms case_cond) (*pos_rhs*) in
+ let unframed_elems = List.map fst unframed_elems_fluents in
+ (* {{{ log entry *)
+ if !debug_level > 3 then (
+ Printf.printf "build_toss_rule:\nframed_fluents=%s\nused_fluents=%s\nunframed_fluents=%s;\nunframed_elems=%s\npos_rhs=%s\nneg_rhs=%s\n\n%!"
+ (String.concat ", " (List.map (fun (p, subt) ->
+ path_str p^"->"^term_str subt) framed_fluents))
+ (String.concat ", " (List.map (fun (p, subt) ->
+ path_str p^"->"^term_str subt) used_fluents))
+ (String.concat ", " (List.map (fun (p, subt) ->
+ path_str p^"->"^term_str subt) unframed_fluents))
+ (String.concat ", " (List.map term_str unframed_elems))
+ (String.concat ", " (List.map term_str pos_rhs))
+ (String.concat ", " (List.map term_str neg_rhs))
+ );
+ (* }}} *)
+ let unframed_tups = List.map
+ (fun (sterm, (path, subt)) ->
+ let vartup = [|term_to_name (blank_out transl_data sterm)|] in
+ pred_on_path_subterm path subt, vartup)
+ unframed_elems_fluents in
let extract_tups = Aux.concat_map
(fun sterm ->
let s_subterms =
@@ -2395,31 +2501,7 @@
s_subterms) in
let add = synch_postcond @ extract_tups pos_rhs in
(* let add = if counter_cls = [] then add else *)
- let del = extract_tups neg_rhs in
- (* we find which rule results should have their old values erased,
- in cases not covered by erasure clauses *)
- let used_fluents = Aux.concat_map
- (map_paths (fun p subt -> p, subt) f_paths) pos_rhs in
- let unframed_fluents = List.filter
- (fun (p, subt) ->
- let f_subts = Aux.assoc_all p framed_fluents in
- not (List.exists (function
- | Var _ -> true
- | f_subt -> f_subt = subt) f_subts))
- used_fluents in
- let unframed_elems = List.filter
- (fun st -> List.exists
- (fun (p,subt) -> try at_path st p = subt with Not_found -> false)
- unframed_fluents)
- (Aux.list_diff (state_terms case_cond) pos_rhs) in
- (* {{{ log entry *)
- if !debug_level > 3 then (
- Printf.printf "build_toss_rule: unframed_fluents=%s; unframed_elems=%s\n%!"
- (String.concat ", " (List.map (fun (p, subt) ->
- path_str p^"->"^term_str subt) unframed_fluents))
- (String.concat ", " (List.map term_str unframed_elems))
- );
- (* }}} *)
+ let del = unframed_tups @ extract_tups neg_rhs in
let all_rhs = pos_rhs @ neg_rhs in
let struc_elems = List.map
(fun sterm -> term_to_name (blank_out transl_data sterm))
@@ -3016,8 +3098,6 @@
let ground_at_f_paths = ground_at f_paths in
let prepare_lits ((h_rel, h_args), body) =
if h_rel = "next" then (Pos (True h_args.(0))::body)
- else if h_rel = "frame next"
- then Aux.list_remove (Pos (True h_args.(0))) body
else body in
let clauses =
GDL.ground_vars_at_paths prepare_lits ground_at_f_paths clauses in
Modified: trunk/Toss/GGP/TranslateGameTest.ml
===================================================================
--- trunk/Toss/GGP/TranslateGameTest.ml 2011-11-03 18:39:52 UTC (rev 1619)
+++ trunk/Toss/GGP/TranslateGameTest.ml 2011-11-05 14:15:19 UTC (rev 1620)
@@ -300,6 +300,7 @@
~moves:[|"(move east)"; "(move nowhere)"; "(move nowhere)"|]
~rules_and_embs:[|
"move_east", [
+ "control__BLANK_", "control__BLANK_";
"gdl__counter", "gdl__counter";
"location__BLANK__x10_y10", "location__BLANK__6_3";
"location__BLANK__x_y", "location__BLANK__5_3";
@@ -353,27 +354,29 @@
let a () =
set_debug_level 4;
- game_test_case ~game_name:"asteroids-scrambled" ~player:"ship"
- ~own_plnum:0 ~opponent_plnum:0
- ~loc0_rule_name:"turn_clock2"
- ~loc0_emb:[
- "value___BLANK__old0", "value___BLANK__i10";
- "value___BLANK__old", "value___BLANK__i10";
- "value___BLANK__new0", "value___BLANK__i13";
- "value___BLANK__new", "value___BLANK__i12";
- "value___BLANK__east", "value___BLANK__east";
- "gdl__counter", "gdl__counter";
- ]
- ~loc0_move:"(turn clock)"
- ~loc1:0 ~loc1_rule_name:"thrust0"
- ~loc1_emb:[
- "gdl__counter", "gdl__counter";
- "value___BLANK__new", "value___BLANK__i14";
- "value___BLANK__new0", "value___BLANK__i16";
- "value___BLANK__old", "value___BLANK__i12";
- "value___BLANK__old0", "value___BLANK__i13";
- "value___BLANK__s12", "value___BLANK__i3"]
- ~loc1_move:"thrust" ();
+ (* Works only with [filter_possibly_redundant] true. *)
+ let old_filter_possibly_redundant =
+ !TranslateGame.filter_possibly_redundant in
+ TranslateGame.filter_possibly_redundant := true;
+ simult_test_case ~game_name:"pacman3p" ~player:"pacman"
+ ~plnum:1 (* 0 is environment! *)
+ ~moves:[|"(move east)"; "(move nowhere)"; "(move nowhere)"|]
+ ~rules_and_embs:[|
+ "move_east", [
+ "control__BLANK_", "control__BLANK_";
+ "gdl__counter", "gdl__counter";
+ "location__BLANK__x10_y10", "location__BLANK__6_3";
+ "location__BLANK__x_y", "location__BLANK__5_3";
+ "synch_control_", "synch_control_"];
+ "move_nowhere0", [
+ "location__BLANK__x11_y11", "location__BLANK__4_6";
+ "location__BLANK__x12_y12", "location__BLANK__4_6";
+ "synch_control_", "synch_control_"];
+ "move_nowhere1", [
+ "location__BLANK__x13_y13", "location__BLANK__5_6";
+ "location__BLANK__x14_y14", "location__BLANK__5_6";
+ "synch_control_", "synch_control_"]|];
+ TranslateGame.filter_possibly_redundant := old_filter_possibly_redundant;
(* failwith "tested"; *)
()
@@ -415,12 +418,12 @@
(* regenerate ~debug:false ~game_name:"tictactoe-other" ~player:"xPLAYER"; *)
(* regenerate ~debug:false ~game_name:"connect5" ~player:"x"; *)
(* regenerate ~debug:false ~game_name:"breakthrough" ~player:"white"; *)
- (* regenerate ~debug:true ~game_name:"pawn_whopping" ~player:"x"; *)
+ (* regenerate ~debug:false ~game_name:"pawn_whopping" ~player:"x"; *)
(* regenerate ~debug:false ~game_name:"connect4" ~player:"white"; *)
(* regenerate ~debug:false ~game_name:"2player_normal_form_2010" ~player:"row"; *)
(* regenerate ~debug:false ~game_name:"2player_normal_form_joint" ~player:"row"; *)
(* regenerate ~debug:false ~game_name:"pacman3p" ~player:"pacman"; *)
- (* regenerate ~debug:true ~game_name:"asteroids-scrambled" ~player:"ship"; *)
+ (* regenerate ~debug:false ~game_name:"asteroids-scrambled" ~player:"ship"; *)
(* failwith "generated"; *)
()
Modified: trunk/Toss/GGP/tests/2player_normal_form_2010-raw.toss
===================================================================
--- trunk/Toss/GGP/tests/2player_normal_form_2010-raw.toss 2011-11-03 18:39:52 UTC (rev 1619)
+++ trunk/Toss/GGP/tests/2player_normal_form_2010-raw.toss 2011-11-05 14:15:19 UTC (rev 1620)
@@ -7,53 +7,34 @@
did_0row(did__BLANK__m11) and did__BLANK___BLANK_(did__BLANK__m11))
PLAYERS environment, row, column
RULE m:
- [did__BLANK__m, synch_control_ |
- _opt_column__SYNC {did__BLANK__m; synch_control_};
- _opt_did_0column {did__BLANK__m; synch_control_};
- _opt_did_0row {did__BLANK__m; synch_control_};
- _opt_row__SYNC (did__BLANK__m); did__BLANK___BLANK_ (did__BLANK__m);
- synch_control_ (synch_control_)
- |
- ] ->
- [did__BLANK__m, synch_control_ |
- did_0row (did__BLANK__m); row__SYNC (synch_control_);
- synch_control_ (synch_control_)
- |
- ] emb row__SYNC, column__SYNC, did_0column, did_0row
- pre
- (not terminal() and
- ex val__r0, val__r, did__BLANK__m0
- (did__BLANK___BLANK_(did__BLANK__m0) and val___BLANK_(val__r) and
- val___BLANK_(val__r0) and reward(did__BLANK__m, did__BLANK__m0, val__r,
- val__r0)))
+ MATCH
+ not terminal() and not row__SYNC(synch_control_) and
+ synch_control_(synch_control_) and
+ ex val__r0, val__r, did__BLANK__m0
+ (reward(did__BLANK__m, did__BLANK__m0, val__r, val__r0) and
+ val___BLANK_(val__r0) and val___BLANK_(val__r) and
+ did__BLANK___BLANK_(did__BLANK__m0) and
+ did__BLANK___BLANK_(did__BLANK__m))
+ ADD
+ RELS did_0row(did__BLANK__m), row__SYNC(synch_control_),
+ synch_control_(synch_control_)
RULE m2:
- [did__BLANK__m2, synch_control_ |
- _opt_column__SYNC (did__BLANK__m2);
- _opt_did_0column {did__BLANK__m2; synch_control_};
- _opt_did_0row {did__BLANK__m2; synch_control_};
- _opt_row__SYNC {did__BLANK__m2; synch_control_};
- did__BLANK___BLANK_ (did__BLANK__m2); synch_control_ (synch_control_)
- |
- ] ->
- [did__BLANK__m2, synch_control_ |
- column__SYNC (synch_control_); did_0column (did__BLANK__m2);
- synch_control_ (synch_control_)
- |
- ] emb row__SYNC, column__SYNC, did_0column, did_0row
- pre
- (not terminal() and
- ex val__r2, val__r1, did__BLANK__m1
- (did__BLANK___BLANK_(did__BLANK__m1) and val___BLANK_(val__r1) and
- val___BLANK_(val__r2) and reward(did__BLANK__m1, did__BLANK__m2,
- val__r1, val__r2)))
+ MATCH
+ not terminal() and not column__SYNC(synch_control_) and
+ synch_control_(synch_control_) and
+ ex val__r2, val__r1, did__BLANK__m1
+ (reward(did__BLANK__m1, did__BLANK__m2, val__r1, val__r2) and
+ val___BLANK_(val__r2) and val___BLANK_(val__r1) and
+ did__BLANK___BLANK_(did__BLANK__m1) and
+ did__BLANK___BLANK_(did__BLANK__m2))
+ ADD
+ RELS column__SYNC(synch_control_), did_0column(did__BLANK__m2),
+ synch_control_(synch_control_)
RULE environment:
- [synch_control_ |
- _opt_did_0column (synch_control_); _opt_did_0row (synch_control_);
- column__SYNC (synch_control_); row__SYNC (synch_control_);
- synch_control_ (synch_control_)
- |
- ] -> [synch_control_ | | ]
- emb row__SYNC, column__SYNC, did_0column, did_0row
+ MATCH
+ synch_control_(synch_control_) and row__SYNC(synch_control_) and
+ column__SYNC(synch_control_) and true and true
+
LOC 0 {
PLAYER environment { PAYOFF 0. MOVES [environment -> 0] }
PLAYER row {
Modified: trunk/Toss/GGP/tests/2player_normal_form_2010-simpl.toss
===================================================================
--- trunk/Toss/GGP/tests/2player_normal_form_2010-simpl.toss 2011-11-03 18:39:52 UTC (rev 1619)
+++ trunk/Toss/GGP/tests/2player_normal_form_2010-simpl.toss 2011-11-05 14:15:19 UTC (rev 1620)
@@ -5,53 +5,34 @@
(did__BLANK___BLANK_(did__BLANK__m11) and did_0row(did__BLANK__m11))
PLAYERS environment, row, column
RULE m:
- [did__BLANK__m, synch_control_ |
- _opt_column__SYNC {did__BLANK__m; synch_control_};
- _opt_did_0column {did__BLANK__m; synch_control_};
- _opt_did_0row {did__BLANK__m; synch_control_};
- _opt_row__SYNC (did__BLANK__m); did__BLANK___BLANK_ (did__BLANK__m);
- synch_control_ (synch_control_)
- |
- ] ->
- [did__BLANK__m, synch_control_ |
- did_0row (did__BLANK__m); row__SYNC (synch_control_);
- synch_control_ (synch_control_)
- |
- ] emb column__SYNC, did_0column, did_0row, row__SYNC
- pre
- (not terminal() and
- ex val__r0, val__r, did__BLANK__m0
- (did__BLANK___BLANK_(did__BLANK__m0) and val___BLANK_(val__r) and
- val___BLANK_(val__r0) and reward(did__BLANK__m, did__BLANK__m0, val__r,
- val__r0)))
+ MATCH
+ synch_control_(synch_control_) and not terminal() and
+ not row__SYNC(synch_control_) and
+ ex val__r0, val__r, did__BLANK__m0
+ (did__BLANK___BLANK_(did__BLANK__m) and
+ did__BLANK___BLANK_(did__BLANK__m0) and val___BLANK_(val__r) and
+ val___BLANK_(val__r0) and reward(did__BLANK__m, did__BLANK__m0, val__r,
+ val__r0))
+ ADD
+ RELS did_0row(did__BLANK__m), row__SYNC(synch_control_),
+ synch_control_(synch_control_)
RULE m2:
- [did__BLANK__m2, synch_control_ |
- _opt_column__SYNC (did__BLANK__m2);
- _opt_did_0column {did__BLANK__m2; synch_control_};
- _opt_did_0row {did__BLANK__m2; synch_control_};
- _opt_row__SYNC {did__BLANK__m2; synch_control_};
- did__BLANK___BLANK_ (did__BLANK__m2); synch_control_ (synch_control_)
- |
- ] ->
- [did__BLANK__m2, synch_control_ |
- column__SYNC (synch_control_); did_0column (did__BLANK__m2);
- synch_control_ (synch_control_)
- |
- ] emb column__SYNC, did_0column, did_0row, row__SYNC
- pre
- (not terminal() and
- ex val__r2, val__r1, did__BLANK__m1
- (did__BLANK___BLANK_(did__BLANK__m1) and val___BLANK_(val__r1) and
- val___BLANK_(val__r2) and reward(did__BLANK__m1, did__BLANK__m2,
- val__r1, val__r2)))
+ MATCH
+ synch_control_(synch_control_) and not terminal() and
+ not column__SYNC(synch_control_) and
+ ex val__r2, val__r1, did__BLANK__m1
+ (did__BLANK___BLANK_(did__BLANK__m1) and
+ did__BLANK___BLANK_(did__BLANK__m2) and val___BLANK_(val__r1) and
+ val___BLANK_(val__r2) and reward(did__BLANK__m1, did__BLANK__m2,
+ val__r1, val__r2))
+ ADD
+ RELS column__SYNC(synch_control_), did_0column(did__BLANK__m2),
+ synch_control_(synch_control_)
RULE environment:
- [synch_control_ |
- _opt_did_0column (synch_control_); _opt_did_0row (synch_control_);
- column__SYNC (synch_control_); row__SYNC (synch_control_);
- synch_control_ (synch_control_)
- |
- ] -> [synch_control_ | | ]
- emb column__SYNC, did_0column, did_0row, row__SYNC
+ MATCH
+ column__SYNC(synch_control_) and row__SYNC(synch_control_) and
+ synch_control_(synch_control_)
+
LOC 0 {
PLAYER environment { PAYOFF 0. MOVES [environment -> 0] }
PLAYER row {
Modified: trunk/Toss/GGP/tests/2player_normal_form_joint-raw.toss
===================================================================
--- trunk/Toss/GGP/tests/2player_normal_form_joint-raw.toss 2011-11-03 18:39:52 UTC (rev 1619)
+++ trunk/Toss/GGP/tests/2player_normal_form_joint-raw.toss 2011-11-05 14:15:19 UTC (rev 1620)
@@ -5,53 +5,34 @@
did_0column(did__BLANK__m12) and did__BLANK___BLANK_(did__BLANK__m12))
PLAYERS environment, row, column
RULE m:
- [did__BLANK__m, synch_control_ |
- _opt_column__SYNC {did__BLANK__m; synch_control_};
- _opt_did_0column {did__BLANK__m; synch_control_};
- _opt_did_0row {did__BLANK__m; synch_control_};
- _opt_row__SYNC (did__BLANK__m); did__BLANK___BLANK_ (did__BLANK__m);
- synch_control_ (synch_control_)
- |
- ] ->
- [did__BLANK__m, synch_control_ |
- did_0row (did__BLANK__m); row__SYNC (synch_control_);
- synch_control_ (synch_control_)
- |
- ] emb row__SYNC, column__SYNC, did_0column, did_0row
- pre
- (not terminal() and
- ex val__r0, val__r, did__BLANK__m0
- (did__BLANK___BLANK_(did__BLANK__m0) and val___BLANK_(val__r) and
- val___BLANK_(val__r0) and reward(did__BLANK__m, did__BLANK__m0, val__r,
- val__r0)))
+ MATCH
+ not terminal() and not row__SYNC(synch_control_) and
+ synch_control_(synch_control_) and
+ ex val__r0, val__r, did__BLANK__m0
+ (reward(did__BLANK__m, did__BLANK__m0, val__r, val__r0) and
+ val___BLANK_(val__r0) and val___BLANK_(val__r) and
+ did__BLANK___BLANK_(did__BLANK__m0) and
+ did__BLANK___BLANK_(did__BLANK__m))
+ ADD
+ RELS did_0row(did__BLANK__m), row__SYNC(synch_control_),
+ synch_control_(synch_control_)
RULE m2:
- [did__BLANK__m2, synch_control_ |
- _opt_column__SYNC (did__BLANK__m2);
- _opt_did_0column {did__BLANK__m2; synch_control_};
- _opt_did_0row {did__BLANK__m2; synch_control_};
- _opt_row__SYNC {did__BLANK__m2; synch_control_};
- did__BLANK___BLANK_ (did__BLANK__m2); synch_control_ (synch_control_)
- |
- ] ->
- [did__BLANK__m2, synch_control_ |
- column__SYNC (synch_control_); did_0column (did__BLANK__m2);
- synch_control_ (synch_control_)
- |
- ] emb row__SYNC, column__SYNC, did_0column, did_0row
- pre
- (not terminal() and
- ex val__r2, val__r1, did__BLANK__m1
- (did__BLANK___BLANK_(did__BLANK__m1) and val___BLANK_(val__r1) and
- val___BLANK_(val__r2) and reward(did__BLANK__m1, did__BLANK__m2,
- val__r1, val__r2)))
+ MATCH
+ not terminal() and not column__SYNC(synch_control_) and
+ synch_control_(synch_control_) and
+ ex val__r2, val__r1, did__BLANK__m1
+ (reward(did__BLANK__m1, did__BLANK__m2, val__r1, val__r2) and
+ val___BLANK_(val__r2) and val___BLANK_(val__r1) and
+ did__BLANK___BLANK_(did__BLANK__m1) and
+ did__BLANK___BLANK_(did__BLANK__m2))
+ ADD
+ RELS column__SYNC(synch_control_), did_0column(did__BLANK__m2),
+ synch_control_(synch_control_)
RULE environment:
- [synch_control_ |
- _opt_did_0column (synch_control_); _opt_did_0row (synch_control_);
- column__SYNC (synch_control_); row__SYNC (synch_control_);
- synch_control_ (synch_control_)
- |
- ] -> [synch_control_ | | ]
- emb row__SYNC, column__SYNC, did_0column, did_0row
+ MATCH
+ synch_control_(synch_control_) and row__SYNC(synch_control_) and
+ column__SYNC(synch_control_) and true and true
+
LOC 0 {
PLAYER environment { PAYOFF 0. MOVES [environment -> 0] }
PLAYER row {
Modified: trunk/Toss/GGP/tests/2player_normal_form_joint-simpl.toss
===================================================================
--- trunk/Toss/GGP/tests/2player_normal_form_joint-simpl.toss 2011-11-03 18:39:52 UTC (rev 1619)
+++ trunk/Toss/GGP/tests/2player_normal_form_joint-simpl.toss 2011-11-05 14:15:19 UTC (rev 1620)
@@ -5,53 +5,34 @@
did_0column(did__BLANK__m12))
PLAYERS environment, row, column
RULE m:
- [did__BLANK__m, synch_control_ |
- _opt_column__SYNC {did__BLANK__m; synch_control_};
- _opt_did_0column {did__BLANK__m; synch_control_};
- _opt_did_0row {did__BLANK__m; synch_control_};
- _opt_row__SYNC (did__BLANK__m); did__BLANK___BLANK_ (did__BLANK__m);
- synch_control_ (synch_control_)
- |
- ] ->
- [did__BLANK__m, synch_control_ |
- did_0row (did__BLANK__m); row__SYNC (synch_control_);
- synch_control_ (synch_control_)
- |
- ] emb column__SYNC, did_0column, did_0row, row__SYNC
- pre
- (not terminal() and
- ex val__r0, val__r, did__BLANK__m0
- (did__BLANK___BLANK_(did__BLANK__m0) and val___BLANK_(val__r) and
- val___BLANK_(val__r0) and reward(did__BLANK__m, did__BLANK__m0, val__r,
- val__r0)))
+ MATCH
+ synch_control_(synch_control_) and not terminal() and
+ not row__SYNC(synch_control_) and
+ ex val__r0, val__r, did__BLANK__m0
+ (did__BLANK___BLANK_(did__BLANK__m) and
+ did__BLANK___BLANK_(did__BLANK__m0) and val___BLANK_(val__r) and
+ val___BLANK_(val__r0) and reward(did__BLANK__m, did__BLANK__m0, val__r,
+ val__r0))
+ ADD
+ RELS did_0row(did__BLANK__m), row__SYNC(synch_control_),
+ synch_control_(synch_control_)
RULE m2:
- [did__BLANK__m2, synch_control_ |
- _opt_column__SYNC (did__BLANK__m2);
- _opt_did_0column {did__BLANK__m2; synch_control_};
- _opt_did_0row {did__BLANK__m2; synch_control_};
- _opt_row__SYNC {did__BLANK__m2; synch_control_};
- did__BLANK___BLANK_ (did__BLANK__m2); synch_control_ (synch_control_)
- |
- ] ->
- [did__BLANK__m2, synch_control_ |
- column__SYNC (synch_control_); did_0column (did__BLANK__m2);
- synch_control_ (synch_control_)
- |
- ] emb column__SYNC, did_0column, did_0row, row__SYNC
- pre
- (not terminal() and
- ex val__r2, val__r1, did__BLANK__m1
- (did__BLANK___BLANK_(did__BLANK__m1) and val___BLANK_(val__r1) and
- val___BLANK_(val__r2) and reward(did__BLANK__m1, did__BLANK__m2,
- val__r1, val__r2)))
+ MATCH
+ synch_control_(synch_control_) and not terminal() and
+ not column__SYNC(synch_control_) and
+ ex val__r2, val__r1, did__BLANK__m1
+ (did__BLANK___BLANK_(did__BLANK__m1) and
+ did__BLANK___BLANK_(did__BLANK__m2) and val___BLANK_(val__r1) and
+ val___BLANK_(val__r2) and reward(did__BLANK__m1, did__BLANK__m2,
+ val__r1, val__r2))
+ ADD
+ RELS column__SYNC(synch_control_), did_0column(did__BLANK__m2),
+ synch_control_(synch_control_)
RULE environment:
- [synch_control_ |
- _opt_did_0column (synch_control_); _opt_did_0row (synch_control_);
- column__SYNC (synch_control_); row__SYNC (synch_control_);
- synch_control_ (synch_control_)
- |
- ] -> [synch_control_ | | ]
- emb column__SYNC, did_0column, did_0row, row__SYNC
+ MATCH
+ column__SYNC(synch_control_) and row__SYNC(synch_control_) and
+ synch_control_(synch_control_)
+
LOC 0 {
PLAYER environment { PAYOFF 0. MOVES [environment -> 0] }
PLAYER row {
Modified: trunk/Toss/GGP/tests/asteroids-scrambled-raw.toss
===================================================================
--- trunk/Toss/GGP/tests/asteroids-scrambled-raw.toss 2011-11-03 18:39:52 UTC (rev 1619)
+++ trunk/Toss/GGP/tests/asteroids-scrambled-raw.toss 2011-11-05 14:15:19 UTC (rev 1620)
@@ -20,849 +20,543 @@
(gdl__counter(gdl__counter) and (:step(gdl__counter) - 50. = 0) and true)
PLAYERS ship
RULE thrust:
- [gdl__counter, value___BLANK__new, value___BLANK__new0, value___BLANK__old,
- value___BLANK__old0, value___BLANK__s14 |
- _nondistinct_ {
- (value___BLANK__old, value___BLANK__new);
- (value___BLANK__old, value___BLANK__new0);
- (value___BLANK__old, value___BLANK__old0);
- (value___BLANK__old, value___BLANK__s14);
- (value___BLANK__old0, value___BLANK__new);
- (value___BLANK__old0, value___BLANK__new0);
- (value___BLANK__old0, value___BLANK__s14)
- };
- _opt_value__0eastc45speed {
- gdl__counter; value___BLANK__new; value___BLANK__new0;
- value___BLANK__old; value___BLANK__old0; value___BLANK__s14
- };
- _opt_value__0heading {
- gdl__counter; value___BLANK__new; value___BLANK__new0;
- value___BLANK__old; value___BLANK__old0; value___BLANK__s14
- };
- _opt_value__0northc45speed {
- gdl__counter; value___BLANK__new; value___BLANK__new0;
- value___BLANK__old; value___BLANK__old0; value___BLANK__s14
- };
- _opt_value__0x {
- gdl__counter; value___BLANK__new; value___BLANK__new0;
- value___BLANK__old0; value___BLANK__s14
- };
- _opt_value__0y {
- gdl__counter; value___BLANK__new; value___BLANK__new0;
- value___BLANK__old; value___BLANK__s14
- };
- gdl__counter (gdl__counter); value__0x (value___BLANK__old);
- value__0y (value___BLANK__old0);
- value___BLANK___BLANK_ {
- value___BLANK__new; value___BLANK__new0; value___BLANK__old;
- value___BLANK__old0; value___BLANK__s14
- }
- |
- ] ->
- [gdl__counter, value___BLANK__new, value___BLANK__new0, value___BLANK__old,
- value___BLANK__old0, value___BLANK__s14 |
- value__0eastc45speed (value___BLANK__s14);
- value__0x (value___BLANK__new); value__0y (value___BLANK__new0)
- |
- ]
- emb value__0eastc45speed, value__0heading, value__0northc45speed,
- value__0x, value__0y
- update
- :step(gdl__counter) =
- :((true and true)) * (1. * (:step(gdl__counter) - 48.) + 49.)
- pre
- (not terminal() and
- ex value___BLANK__s13, value___BLANK__s15, value___BLANK__west,
- value___BLANK__s16
- (value__0eastc45speed(value___BLANK__s13) and
+ MATCH
+ gdl__counter(gdl__counter) and not terminal() and
+ ex value___BLANK__west, value___BLANK__s16
+ (mapc43(value___BLANK__old, value___BLANK__s15, value___BLANK__new) and
+ mapc43(value___BLANK__old0, value___BLANK__s16,
+ value___BLANK__new0) and speedc45(value___BLANK__s13,
+ value___BLANK__s14) and
+ value___BLANK___BLANK_(value___BLANK__new) and
+ value___BLANK___BLANK_(value___BLANK__new0) and
value___BLANK___BLANK_(value___BLANK__s13) and
+ value___BLANK___BLANK_(value___BLANK__s14) and
+ value___BLANK___BLANK_(value___BLANK__s15) and
+ value__0eastc45speed(value___BLANK__s13) and
+ value___BLANK___BLANK_(value___BLANK__s13) and
value__0eastc45speed(value___BLANK__s15) and
value___BLANK___BLANK_(value___BLANK__s15) and
- value__0northc45speed(value___BLANK__s16) and
- value___BLANK___BLANK_(value___BLANK__s16) and
value__0heading(value___BLANK__west) and
value__1west(value___BLANK__west) and
value___BLANK___BLANK_(value___BLANK__west) and
- speedc45(value___BLANK__s13, value___BLANK__s14) and
- mapc43(value___BLANK__old, value___BLANK__s15, value___BLANK__new) and
- mapc43(value___BLANK__old0, value___BLANK__s16, value___BLANK__new0)))
-RULE thrust0:
- [gdl__counter, value___BLANK__new, value___BLANK__new0, value___BLANK__old,
- value___BLANK__old0, value___BLANK__s12 |
- _nondistinct_ {
- (value___BLANK__old, value___BLANK__new);
- (value___BLANK__old, value___BLANK__new0);
- (value___BLANK__old, value___BLANK__old0);
- (value___BLANK__old, value___BLANK__s12);
- (value___BLANK__old0, value___BLANK__new);
- (value___BLANK__old0, value___BLANK__new0);
- (value___BLANK__old0, value___BLANK__s12)
- };
- _opt_value__0eastc45speed {
- gdl__counter; value___BLANK__new; value___BLANK__new0;
- value___BLANK__old; value___BLANK__old0; value___BLANK__s12
- };
- _opt_value__0heading {
- gdl__counter; value___BLANK__new; value___BLANK__new0;
- value___BLANK__old; value___BLANK__old0; value___BLANK__s12
- };
- _opt_value__0northc45speed {
- gdl__counter; value___BLANK__new; value___BLANK__new0;
- value___BLANK__old; value___BLANK__old0; value___BLANK__s12
- };
- _opt_value__0x {
- gdl__counter; value___BLANK__new; value___BLANK__new0;
- value___BLANK__old0; value___BLANK__s12
- };
- _opt_value__0y {
- gdl__counter; value___BLANK__new; value___BLANK__new0;
- value___BLANK__old; value___BLANK__s12
- };
- gdl__counter (gdl__counter); value__0x (value___BLANK__old);
- value__0y (value___BLANK__old0);
- value___BLANK___BLANK_ {
- value___BLANK__new; value___BLANK__new0; value___BLANK__old;
- value___BLANK__old0; value___BLANK__s12
- }
- |
- ] ->
- [gdl__counter, value___BLANK__new, value___BLANK__new0, value___BLANK__old,
- value___BLANK__old0, value___BLANK__s12 |
- value__0eastc45speed (value___BLANK__s12);
- value__0x (value___BLANK__new); value__0y (value___BLANK__new0)
- |
- ]
- emb value__0eastc45speed, value__0heading, value__0northc45speed,
- value__0x, value__0y
+ value__0northc45speed(value___BLANK__s16) and
+ value___BLANK___BLANK_(value___BLANK__s16) and
+ value__0x(value___BLANK__old) and
+ value___BLANK___BLANK_(value___BLANK__old) and
+ value__0y(value___BLANK__old0) and
+ value___BLANK___BLANK_(value___BLANK__old0) and
+ not
+ ex value___BLANK__east, value___BLANK__north, value___BLANK__south
+ (mapc43(value___BLANK__old, value___BLANK__s15,
+ value___BLANK__new) and mapc43(value___BLANK__old0,
+ value___BLANK__s16, value___BLANK__new0) and
+ speedc45(value___BLANK__s13, value___BLANK__s14) and
+ ((value__0heading(value___BLANK__east) and
+ value__1east(value___BLANK__east) and
+ value___BLANK___BLANK_(value___BLANK__east)) or
+ (value__0heading(value___BLANK__north) and
+ value__1north(value___BLANK__north) and
+ value___BLANK___BLANK_(value___BLANK__north)) or
+ (value__0heading(value___BLANK__south) and
+ value__1south(value___BLANK__south) and
+ value___BLANK___BLANK_(value___BLANK__south)))))
+ DEL
+ RELS value__0eastc45speed(value___BLANK__s13),
+ value__0eastc45speed(value___BLANK__s15), value__0x(value___BLANK__old),
+ value__0y(value___BLANK__old0)
+ ADD
+ RELS value__0eastc45speed(value___BLANK__s14),
+ value__0x(value___BLANK__new), value__0y(value___BLANK__new0)
update
:step(gdl__counter) =
:((true and true)) * (1. * (:step(gdl__counter) - 48.) + 49.)
- pre
- (not terminal() and
- ex value___BLANK__s11, value___BLANK__s15, value___BLANK__east,
- value___BLANK__s16
- (value__0heading(value___BLANK__east) and
- value__1east(value___BLANK__east) and
- value___BLANK___BLANK_(value___BLANK__east) and
+RULE thrust0:
+ MATCH
+ gdl__counter(gdl__counter) and not terminal() and
+ ex value___BLANK__east, value___BLANK__s16
+ (mapc43(value___BLANK__old, value___BLANK__s15, value___BLANK__new) and
+ mapc43(value___BLANK__old0, value___BLANK__s16,
+ value___BLANK__new0) and speedc43(value___BLANK__s11,
+ value___BLANK__s12) and
+ value___BLANK___BLANK_(value___BLANK__new) and
+ value___BLANK___BLANK_(value___BLANK__new0) and
+ value___BLANK___BLANK_(value___BLANK__s11) and
+ value___BLANK___BLANK_(value___BLANK__s12) and
+ value___BLANK___BLANK_(value___BLANK__s15) and
value__0eastc45speed(value___BLANK__s11) and
value___BLANK___BLANK_(value___BLANK__s11) and
value__0eastc45speed(value___BLANK__s15) and
value___BLANK___BLANK_(value___BLANK__s15) and
+ value__0heading(value___BLANK__east) and
+ value__1east(value___BLANK__east) and
+ value___BLANK___BLANK_(value___BLANK__east) and
value__0northc45speed(value___BLANK__s16) and
value___BLANK___BLANK_(value___BLANK__s16) and
- speedc43(value___BLANK__s11, value___BLANK__s12) and
- mapc43(value___BLANK__old, value___BLANK__s1...
[truncated message content] |