[m-dev.] diff: Re-enable DD test cases

Mark Anthony BROWN dougl at cs.mu.OZ.AU
Thu Jan 6 16:06:04 AEDT 2000


Estimated hours taken: 5

Fix the output of the declarative debugger so that it prints out
something that resembles a bug.  Re-enable all the test cases,
and add some new ones.  Add an `.exp2' file for each case, so
that tests work in debug grades as well as non-debug grades.

browser/declarative_debugger.m:
	Output a text representation of the bug.  The output is
	rather unpretty, but allows us to check that the bug was
	found correctly.

tests/debugger/declarative/Mmakefile:
	Enable the new test cases.  Re-enable the old ones.

tests/debugger/declarative/app.exp:
tests/debugger/declarative/gcf.exp:
tests/debugger/declarative/if_then_else.exp:
tests/debugger/declarative/oracle_db.exp:
tests/debugger/declarative/propositional.exp:
tests/debugger/declarative/queens.exp:
	Update old test case results.

tests/debugger/declarative/app.exp2:
tests/debugger/declarative/gcf.exp2:
tests/debugger/declarative/if_then_else.exp2:
tests/debugger/declarative/oracle_db.exp2:
tests/debugger/declarative/propositional.exp2:
tests/debugger/declarative/queens.exp2:
	Alternative results for old test cases.

tests/debugger/declarative/big.{m,inp,exp,exp2}:
tests/debugger/declarative/lpe_example.{m,inp,exp,exp2}:
tests/debugger/declarative/neg_conj.{m,inp,exp,exp2}:
tests/debugger/declarative/negation.{exp,exp2,inp}:
tests/debugger/declarative/small.{m,inp,exp,exp2}:
	New test cases.

Index: browser/declarative_debugger.m
===================================================================
RCS file: /home/mercury1/repository/mercury/browser/declarative_debugger.m,v
retrieving revision 1.7
diff -u -r1.7 declarative_debugger.m
--- browser/declarative_debugger.m	2000/01/03 02:20:26	1.7
+++ browser/declarative_debugger.m	2000/01/05 17:01:57
@@ -185,8 +185,15 @@
 		<= execution_tree(S, R).
 :- mode confirm_bug(in, in, out, di, uo) is det.
 
-confirm_bug(_, Bug, yes) -->
-	io__write(Bug),		% XXX this doesn't work very well.
+confirm_bug(Store, e_bug(Node), yes) -->
+	io__write_string("Incorrect node found:\n"),
+	{ edt_root(wrap(Store), Node, Question) },
+	io__write(Question),
+	io__nl.
+confirm_bug(Store, i_bug(Node), yes) -->
+	io__write_string("Inadmissible call:\n"),
+	{ edt_root(wrap(Store), Node, Question) },
+	io__write(Question),
 	io__nl.
 
 	% Export a monomorphic version of diagnosis_state_init/4, to
Index: tests/debugger/declarative/Mmakefile
===================================================================
RCS file: /home/mercury1/repository/tests/debugger/declarative/Mmakefile,v
retrieving revision 1.8
diff -u -r1.8 Mmakefile
--- tests/debugger/declarative/Mmakefile	2000/01/04 13:30:10	1.8
+++ tests/debugger/declarative/Mmakefile	2000/01/05 17:02:11
@@ -16,9 +16,7 @@
 
 #-----------------------------------------------------------------------------#
 
-DECLARATIVE_PROGS=
-
-NONWORKING_DECLARATIVE_PROGS=	\
+DECLARATIVE_PROGS=		\
 	app			\
 	big			\
 	gcf			\
@@ -29,7 +27,9 @@
 	oracle_db		\
 	propositional		\
 	queens			\
-	small			\
+	small
+
+NONWORKING_DECLARATIVE_PROGS=	\
 	family			\
 	higher_order		\
 	ite_2
Index: tests/debugger/declarative/app.exp
===================================================================
RCS file: /home/mercury1/repository/tests/debugger/declarative/app.exp,v
retrieving revision 1.2
diff -u -r1.2 app.exp
--- tests/debugger/declarative/app.exp	2000/01/03 02:22:51	1.2
+++ tests/debugger/declarative/app.exp	2000/01/05 17:02:12
@@ -3,7 +3,7 @@
 Command echo enabled.
 mdb> break app
 Registering debuggable procedures... done.
-There is one debuggable module, with 5 procedures.
+There are 67 debuggable modules, with a total of 3206 procedures.
  0: + stop  interface pred app:app/3-0 (det)
 mdb> continue
        2:      2  2 CALL pred app:app/3-0 (det) app.m:26 (app.m:13)
@@ -32,13 +32,14 @@
 Valid? no
 atom("app", [univ([3, 4, 5] : list:list(int)), univ([6, 7, 8] : list:list(int)), univ([3, 4, 5, 6, 7, 8] : list:list(int)), univ(int : private_builtin:type_info(int))])
 Valid? no
-e_bug(dynamic(id('<<c_pointer>>')))
+Incorrect node found:
+wrong_answer(atom("app", [univ([3, 4, 5] : list:list(int)), univ([6, 7, 8] : list:list(int)), univ([3, 4, 5, 6, 7, 8] : list:list(int)), univ(int : private_builtin:type_info(int))]))
       19:      2  2 EXIT pred app:app/3-0 (det) app.m:26 (app.m:13)
 mdb> continue
 append([1, 2, 3, 4, 5], [6, 7, 8], [1, 2, 3, 4, 5, 6, 7, 8]).
-      20:      8  2 CALL pred app:app/3-0 (det) app.m:26 (app.m:18)
+      24:    347  2 CALL pred app:app/3-0 (det) app.m:26 (app.m:18)
 mdb> finish -n
-      67:      8  2 EXIT pred app:app/3-0 (det) app.m:26 (app.m:18)
+      71:    347  2 EXIT pred app:app/3-0 (det) app.m:26 (app.m:18)
 mdb> dd
 atom("app", [univ([1, 2, 3, 4, 5, 6, 7, 8, 9, 0, 1, 2, 3, 4, 5] : list:list(int)), univ([6, 7, 8] : list:list(int)), univ([1, 2, 3, 4, 5, 6, 7, 8, 9, 0, 1, 2, 3, 4, 5, 6, 7, 8] : list:list(int)), univ(int : private_builtin:type_info(int))])
 Valid? no
@@ -60,7 +61,8 @@
 Valid? no
 atom("app", [univ([0, 1, 2, 3, 4, 5] : list:list(int)), univ([6, 7, 8] : list:list(int)), univ([0, 1, 2, 3, 4, 5, 6, 7, 8] : list:list(int)), univ(int : private_builtin:type_info(int))])
 Valid? no
-e_bug(dynamic(id('<<c_pointer>>')))
-      67:      8  2 EXIT pred app:app/3-0 (det) app.m:26 (app.m:18)
+Incorrect node found:
+wrong_answer(atom("app", [univ([3, 4, 5] : list:list(int)), univ([6, 7, 8] : list:list(int)), univ([3, 4, 5, 6, 7, 8] : list:list(int)), univ(int : private_builtin:type_info(int))]))
+      71:    347  2 EXIT pred app:app/3-0 (det) app.m:26 (app.m:18)
 mdb> continue
 append([1, 2, 3, 4, 5, 6, 7, 8, 9, 0, 1, 2, 3, 4, 5], [6, 7, 8], [1, 2, 3, 4, 5, 6, 7, 8, 9, 0, 1, 2, 3, 4, 5, 6, 7, 8]).
Index: tests/debugger/declarative/gcf.exp
===================================================================
RCS file: /home/mercury1/repository/tests/debugger/declarative/gcf.exp,v
retrieving revision 1.2
diff -u -r1.2 gcf.exp
--- tests/debugger/declarative/gcf.exp	2000/01/03 02:22:52	1.2
+++ tests/debugger/declarative/gcf.exp	2000/01/05 17:02:13
@@ -3,7 +3,7 @@
 Command echo enabled.
 mdb> break a
 Registering debuggable procedures... done.
-There is one debuggable module, with 5 procedures.
+There are 67 debuggable modules, with a total of 3206 procedures.
  0: + stop  interface pred gcf:a/1-0 (nondet)
 mdb> continue
        3:      2  2 CALL pred gcf:a/1-0 (nondet) gcf.m:26 (gcf.m:10)
@@ -18,7 +18,8 @@
 Valid? yes
 atom("f", [univ(11 : int)])
 Valid? yes
-e_bug(dynamic(id('<<c_pointer>>')))
+Incorrect node found:
+wrong_answer(atom("a", [univ(11 : int)]))
       23:      2  2 EXIT pred gcf:a/1-0 (nondet) gcf.m:26 (gcf.m:10)
 mdb> continue
       24:      2  2 REDO pred gcf:a/1-0 (nondet) gcf.m:26 (gcf.m:10)
@@ -31,7 +32,8 @@
 Valid? yes
 atom("f", [univ(12 : int)])
 Valid? yes
-e_bug(dynamic(id('<<c_pointer>>')))
+Incorrect node found:
+wrong_answer(atom("a", [univ(12 : int)]))
       30:      2  2 EXIT pred gcf:a/1-0 (nondet) gcf.m:26 (gcf.m:10)
 mdb> continue
       31:      2  2 REDO pred gcf:a/1-0 (nondet) gcf.m:26 (gcf.m:10)
@@ -46,7 +48,8 @@
 Valid? yes
 atom("f", [univ(20 : int)])
 Valid? yes
-e_bug(dynamic(id('<<c_pointer>>')))
+Incorrect node found:
+wrong_answer(atom("a", [univ(20 : int)]))
       42:      2  2 EXIT pred gcf:a/1-0 (nondet) gcf.m:26 (gcf.m:10)
 mdb> continue
 yes(20)
Index: tests/debugger/declarative/if_then_else.exp
===================================================================
RCS file: /home/mercury1/repository/tests/debugger/declarative/if_then_else.exp,v
retrieving revision 1.2
diff -u -r1.2 if_then_else.exp
--- tests/debugger/declarative/if_then_else.exp	2000/01/03 02:22:52	1.2
+++ tests/debugger/declarative/if_then_else.exp	2000/01/05 17:02:14
@@ -3,7 +3,7 @@
 Command echo enabled.
 mdb> break ite
 Registering debuggable procedures... done.
-There is one debuggable module, with 5 procedures.
+There are 67 debuggable modules, with a total of 3206 procedures.
  0: + stop  interface pred if_then_else:ite/2-0 (det)
 mdb> continue
        2:      2  2 CALL pred if_then_else:ite/2-0 (det) if_then_else.m:22 (if_then_else.m:8)
@@ -16,20 +16,22 @@
 Valid? yes
 atom("b", [univ(1 : int)])
 Valid? yes
-e_bug(dynamic(id('<<c_pointer>>')))
+Incorrect node found:
+wrong_answer(atom("ite", [univ(0 : int), univ(1 : int)]))
        9:      2  2 EXIT pred if_then_else:ite/2-0 (det) if_then_else.m:22 (if_then_else.m:8)
 mdb> continue
 ite(0, 1).
-      10:      5  2 CALL pred if_then_else:ite/2-0 (det) if_then_else.m:22 (if_then_else.m:12)
+      16:    261  2 CALL pred if_then_else:ite/2-0 (det) if_then_else.m:22 (if_then_else.m:12)
 mdb> finish
-      17:      5  2 EXIT pred if_then_else:ite/2-0 (det) if_then_else.m:22 (if_then_else.m:12)
+      23:    261  2 EXIT pred if_then_else:ite/2-0 (det) if_then_else.m:22 (if_then_else.m:12)
 mdb> dd
 atom("ite", [univ(1 : int), univ(0 : int)])
 Valid? no
 Call atom("a", [univ(1 : int)])
 Solutions:
 Complete? yes
-e_bug(dynamic(id('<<c_pointer>>')))
-      17:      5  2 EXIT pred if_then_else:ite/2-0 (det) if_then_else.m:22 (if_then_else.m:12)
+Incorrect node found:
+wrong_answer(atom("ite", [univ(1 : int), univ(0 : int)]))
+      23:    261  2 EXIT pred if_then_else:ite/2-0 (det) if_then_else.m:22 (if_then_else.m:12)
 mdb> continue
 ite(1, 0).
Index: tests/debugger/declarative/oracle_db.exp
===================================================================
RCS file: /home/mercury1/repository/tests/debugger/declarative/oracle_db.exp,v
retrieving revision 1.2
diff -u -r1.2 oracle_db.exp
--- tests/debugger/declarative/oracle_db.exp	2000/01/03 02:22:52	1.2
+++ tests/debugger/declarative/oracle_db.exp	2000/01/05 17:02:14
@@ -3,7 +3,7 @@
 Command echo enabled.
 mdb> break a
 Registering debuggable procedures... done.
-There is one debuggable module, with 3 procedures.
+There are 67 debuggable modules, with a total of 3204 procedures.
  0: + stop  interface pred oracle_db:a/3-0 (semidet)
 mdb> continue
        3:      2  2 CALL pred oracle_db:a/3-0 (semidet) oracle_db.m:19 (oracle_db.m:9)
@@ -14,7 +14,8 @@
 Valid? no
 atom("b", [univ(99 : int)])
 Valid? yes
-e_bug(dynamic(id('<<c_pointer>>')))
+Incorrect node found:
+wrong_answer(atom("a", [univ(99 : int), univ(99 : int), univ(99 : int)]))
       10:      2  2 EXIT pred oracle_db:a/3-0 (semidet) oracle_db.m:19 (oracle_db.m:9)
 mdb> continue
 yes.
Index: tests/debugger/declarative/propositional.exp
===================================================================
RCS file: /home/mercury1/repository/tests/debugger/declarative/propositional.exp,v
retrieving revision 1.2
diff -u -r1.2 propositional.exp
--- tests/debugger/declarative/propositional.exp	2000/01/03 02:22:53	1.2
+++ tests/debugger/declarative/propositional.exp	2000/01/05 17:02:14
@@ -3,25 +3,26 @@
 Command echo enabled.
 mdb> break a
 Registering debuggable procedures... done.
-There is one debuggable module, with 10 procedures.
+There are 67 debuggable modules, with a total of 3211 procedures.
  0: + stop  interface pred propositional:a/0-0 (semidet)
 mdb> break b
  1: + stop  interface pred propositional:b/0-0 (semidet)
 mdb> continue
        3:      2  2 CALL pred propositional:a/0-0 (semidet) propositional.m:27 (propositional.m:10)
 mdb> finish
-      11:      2  2 EXIT pred propositional:a/0-0 (semidet) propositional.m:27 (propositional.m:10)
+      15:      2  2 EXIT pred propositional:a/0-0 (semidet) propositional.m:27 (propositional.m:10)
 mdb> dd
 atom("a", [])
 Valid? no
 atom("c", [])
 Valid? no
-e_bug(dynamic(id('<<c_pointer>>')))
-      11:      2  2 EXIT pred propositional:a/0-0 (semidet) propositional.m:27 (propositional.m:10)
+Incorrect node found:
+wrong_answer(atom("c", []))
+      15:      2  2 EXIT pred propositional:a/0-0 (semidet) propositional.m:27 (propositional.m:10)
 mdb> continue
-      12:      5  2 CALL pred propositional:b/0-0 (semidet) propositional.m:29 (propositional.m:10)
+      16:    203  2 CALL pred propositional:b/0-0 (semidet) propositional.m:29 (propositional.m:10)
 mdb> finish
-      22:      5  2 EXIT pred propositional:b/0-0 (semidet) propositional.m:29 (propositional.m:10)
+      30:    203  2 EXIT pred propositional:b/0-0 (semidet) propositional.m:29 (propositional.m:10)
 mdb> dd
 atom("b", [])
 Valid? no
@@ -29,7 +30,8 @@
 Valid? no
 atom("i", [])
 Valid? yes
-e_bug(dynamic(id('<<c_pointer>>')))
-      22:      5  2 EXIT pred propositional:b/0-0 (semidet) propositional.m:29 (propositional.m:10)
+Incorrect node found:
+wrong_answer(atom("f", []))
+      30:    203  2 EXIT pred propositional:b/0-0 (semidet) propositional.m:29 (propositional.m:10)
 mdb> continue
 yes
Index: tests/debugger/declarative/queens.exp
===================================================================
RCS file: /home/mercury1/repository/tests/debugger/declarative/queens.exp,v
retrieving revision 1.2
diff -u -r1.2 queens.exp
--- tests/debugger/declarative/queens.exp	2000/01/03 02:22:53	1.2
+++ tests/debugger/declarative/queens.exp	2000/01/05 17:02:15
@@ -5,7 +5,7 @@
 mdb: declarative debugging is only available from EXIT or FAIL events.
 mdb> break queen
 Registering debuggable procedures... done.
-There is one debuggable module, with 9 procedures.
+There are 67 debuggable modules, with a total of 3210 procedures.
  0: + stop  interface pred queens:queen/2-0 (nondet)
 mdb> continue
        5:      3  2 CALL pred queens:queen/2-0 (nondet) queens.m:41 (queens.m:15)
@@ -30,7 +30,8 @@
 	atom("qdelete", [univ(4 : int), univ([1, 2, 3, 4, 5] : list:list(int)), univ([1, 2, 3, 5] : list:list(int)), univ(int : private_builtin:type_info(int))])
 	atom("qdelete", [univ(5 : int), univ([1, 2, 3, 4, 5] : list:list(int)), univ([1, 2, 3, 4] : list:list(int)), univ(int : private_builtin:type_info(int))])
 Complete? yes
-e_bug(dynamic(id('<<c_pointer>>')))
+Incorrect node found:
+missing_answer(atom("qperm", [univ([1, 2, 3, 4, 5] : list:list(int)), univ(int : private_builtin:type_info(int))]), [])
      161:      3  2 FAIL pred queens:queen/2-0 (nondet) queens.m:41 (queens.m:15)
 mdb> continue
 No solution

New file: tests/debugger/declarative/app.exp2

       1:      1  1 CALL pred app:main/2-0 (det) app.m:10
mdb> echo on
Command echo enabled.
mdb> break app
Registering debuggable procedures... done.
There is one debuggable module, with 5 procedures.
 0: + stop  interface pred app:app/3-0 (det)
mdb> continue
       2:      2  2 CALL pred app:app/3-0 (det) app.m:26 (app.m:13)
mdb> continue
       4:      3  3 CALL pred app:app/3-0 (det) app.m:26 (app.m:28)
mdb> continue
       6:      4  4 CALL pred app:app/3-0 (det) app.m:26 (app.m:28)
mdb> continue
       8:      5  5 CALL pred app:app/3-0 (det) app.m:26 (app.m:28)
mdb> finish -n
      16:      5  5 EXIT pred app:app/3-0 (det) app.m:26 (app.m:28)
mdb> dd
atom("app", [univ([4, 5] : list:list(int)), univ([6, 7, 8] : list:list(int)), univ([4, 5, 6, 7, 8] : list:list(int)), univ(int : private_builtin:type_info(int))])
Valid? yes
      16:      5  5 EXIT pred app:app/3-0 (det) app.m:26 (app.m:28)
mdb> continue
      17:      4  4 EXIT pred app:app/3-0 (det) app.m:26 (app.m:28)
mdb> continue
      18:      3  3 EXIT pred app:app/3-0 (det) app.m:26 (app.m:28)
mdb> continue
      19:      2  2 EXIT pred app:app/3-0 (det) app.m:26 (app.m:13)
mdb> dd
atom("app", [univ([1, 2, 3, 4, 5] : list:list(int)), univ([6, 7, 8] : list:list(int)), univ([1, 2, 3, 4, 5, 6, 7, 8] : list:list(int)), univ(int : private_builtin:type_info(int))])
Valid? no
atom("app", [univ([2, 3, 4, 5] : list:list(int)), univ([6, 7, 8] : list:list(int)), univ([2, 3, 4, 5, 6, 7, 8] : list:list(int)), univ(int : private_builtin:type_info(int))])
Valid? no
atom("app", [univ([3, 4, 5] : list:list(int)), univ([6, 7, 8] : list:list(int)), univ([3, 4, 5, 6, 7, 8] : list:list(int)), univ(int : private_builtin:type_info(int))])
Valid? no
Incorrect node found:
wrong_answer(atom("app", [univ([3, 4, 5] : list:list(int)), univ([6, 7, 8] : list:list(int)), univ([3, 4, 5, 6, 7, 8] : list:list(int)), univ(int : private_builtin:type_info(int))]))
      19:      2  2 EXIT pred app:app/3-0 (det) app.m:26 (app.m:13)
mdb> continue
append([1, 2, 3, 4, 5], [6, 7, 8], [1, 2, 3, 4, 5, 6, 7, 8]).
      20:      8  2 CALL pred app:app/3-0 (det) app.m:26 (app.m:18)
mdb> finish -n
      67:      8  2 EXIT pred app:app/3-0 (det) app.m:26 (app.m:18)
mdb> dd
atom("app", [univ([1, 2, 3, 4, 5, 6, 7, 8, 9, 0, 1, 2, 3, 4, 5] : list:list(int)), univ([6, 7, 8] : list:list(int)), univ([1, 2, 3, 4, 5, 6, 7, 8, 9, 0, 1, 2, 3, 4, 5, 6, 7, 8] : list:list(int)), univ(int : private_builtin:type_info(int))])
Valid? no
atom("app", [univ([2, 3, 4, 5, 6, 7, 8, 9, 0, 1, 2, 3, 4, 5] : list:list(int)), univ([6, 7, 8] : list:list(int)), univ([2, 3, 4, 5, 6, 7, 8, 9, 0, 1, 2, 3, 4, 5, 6, 7, 8] : list:list(int)), univ(int : private_builtin:type_info(int))])
Valid? no
atom("app", [univ([3, 4, 5, 6, 7, 8, 9, 0, 1, 2, 3, 4, 5] : list:list(int)), univ([6, 7, 8] : list:list(int)), univ([3, 4, 5, 6, 7, 8, 9, 0, 1, 2, 3, 4, 5, 6, 7, 8] : list:list(int)), univ(int : private_builtin:type_info(int))])
Valid? no
atom("app", [univ([4, 5, 6, 7, 8, 9, 0, 1, 2, 3, 4, 5] : list:list(int)), univ([6, 7, 8] : list:list(int)), univ([4, 5, 6, 7, 8, 9, 0, 1, 2, 3, 4, 5, 6, 7, 8] : list:list(int)), univ(int : private_builtin:type_info(int))])
Valid? no
atom("app", [univ([5, 6, 7, 8, 9, 0, 1, 2, 3, 4, 5] : list:list(int)), univ([6, 7, 8] : list:list(int)), univ([5, 6, 7, 8, 9, 0, 1, 2, 3, 4, 5, 6, 7, 8] : list:list(int)), univ(int : private_builtin:type_info(int))])
Valid? no
atom("app", [univ([6, 7, 8, 9, 0, 1, 2, 3, 4, 5] : list:list(int)), univ([6, 7, 8] : list:list(int)), univ([6, 7, 8, 9, 0, 1, 2, 3, 4, 5, 6, 7, 8] : list:list(int)), univ(int : private_builtin:type_info(int))])
Valid? no
atom("app", [univ([7, 8, 9, 0, 1, 2, 3, 4, 5] : list:list(int)), univ([6, 7, 8] : list:list(int)), univ([7, 8, 9, 0, 1, 2, 3, 4, 5, 6, 7, 8] : list:list(int)), univ(int : private_builtin:type_info(int))])
Valid? no
atom("app", [univ([8, 9, 0, 1, 2, 3, 4, 5] : list:list(int)), univ([6, 7, 8] : list:list(int)), univ([8, 9, 0, 1, 2, 3, 4, 5, 6, 7, 8] : list:list(int)), univ(int : private_builtin:type_info(int))])
Valid? no
atom("app", [univ([9, 0, 1, 2, 3, 4, 5] : list:list(int)), univ([6, 7, 8] : list:list(int)), univ([9, 0, 1, 2, 3, 4, 5, 6, 7, 8] : list:list(int)), univ(int : private_builtin:type_info(int))])
Valid? no
atom("app", [univ([0, 1, 2, 3, 4, 5] : list:list(int)), univ([6, 7, 8] : list:list(int)), univ([0, 1, 2, 3, 4, 5, 6, 7, 8] : list:list(int)), univ(int : private_builtin:type_info(int))])
Valid? no
Incorrect node found:
wrong_answer(atom("app", [univ([3, 4, 5] : list:list(int)), univ([6, 7, 8] : list:list(int)), univ([3, 4, 5, 6, 7, 8] : list:list(int)), univ(int : private_builtin:type_info(int))]))
      67:      8  2 EXIT pred app:app/3-0 (det) app.m:26 (app.m:18)
mdb> continue
append([1, 2, 3, 4, 5, 6, 7, 8, 9, 0, 1, 2, 3, 4, 5], [6, 7, 8], [1, 2, 3, 4, 5, 6, 7, 8, 9, 0, 1, 2, 3, 4, 5, 6, 7, 8]).

New file: tests/debugger/declarative/big.m

:- module big.
:- interface.
:- import_module io.
:- pred main(io__state, io__state).
:- mode main(di, uo) is det.
:- implementation.
:- import_module bool, int, std_util.

main -->
	{
		p(1)
	->
		R = yes
	;
		R = no
	},
	io__write(R),
	io__write_string(".\n").


:- pred p(int::out) is nondet.

p(X) :-
	a(A),
	(
		b(A, B),
		(
			c(B, C),
			\+ (
				d(C, D),
				D > 5
			)
		->
			c(C, E)
		;
			e(B, E)
		)
	;
		f(A, F),
		b(F, B),
		(
			B = 0,
			g(1, E)
		;
			B = 1,
			g(10, E)
		),
		\+ (
			f(E, H),
			c(H, I),
			g(I, J),
			J > 0
		)
	),
	f(E, X).


:- pred a(int::out) is det.
:- pred b(int::in, int::out) is multi.
:- pred c(int::in, int::out) is nondet.
:- pred d(int::in, int::out) is semidet.
:- pred e(int::in, int::out) is multi.
:- pred f(int::in, int::out) is det.
:- pred g(int::in, int::out) is semidet.

a(0).

b(X, X).
b(X, X+1).

c(0, 2).
c(0, 3).
c(1, 15).
c(2, 6).
c(2, 7).
c(3, 17).
c(4, 8).
c(4, 9).

d(X, X*3) :-
	X mod 2 = 1.

e(X, X*10).
e(X, X*11).

f(X, X * -2).

g(1, -1).
g(6, -10).
g(7, -11).
g(8, -12).
g(9, 99).
g(10, -2).


New file: tests/debugger/declarative/big.exp

       1:      1  1 CALL pred big:main/2-0 (det) big.m:9
mdb> echo on
Command echo enabled.
mdb> break p
Registering debuggable procedures... done.
There are 67 debuggable modules, with a total of 3210 procedures.
 0: + stop  interface pred big:p/1-0 (nondet)
mdb> continue
       3:      2  2 CALL pred big:p/1-0 (nondet) big.m:23 (big.m:11)
mdb> finish
      28:      2  2 EXIT pred big:p/1-0 (nondet) big.m:23 (big.m:11)
mdb> dd
atom("p", [univ(-12 : int)])
Valid? no
atom("a", [univ(0 : int)])
Valid? yes
atom("b", [univ(0 : int), univ(0 : int)])
Valid? yes
atom("c", [univ(0 : int), univ(2 : int)])
Valid? yes
Call atom("d", [univ(2 : int)])
Solutions:
Complete? yes
atom("c", [univ(2 : int), univ(6 : int)])
Valid? yes
atom("f", [univ(6 : int), univ(-12 : int)])
Valid? yes
Incorrect node found:
wrong_answer(atom("p", [univ(-12 : int)]))
      28:      2  2 EXIT pred big:p/1-0 (nondet) big.m:23 (big.m:11)
mdb> continue
      29:      2  2 REDO pred big:p/1-0 (nondet) big.m:23 (big.m:11)
mdb> finish
      35:      2  2 EXIT pred big:p/1-0 (nondet) big.m:23 (big.m:11)
mdb> dd
atom("p", [univ(-14 : int)])
Valid? no
atom("c", [univ(2 : int), univ(7 : int)])
Valid? yes
atom("f", [univ(7 : int), univ(-14 : int)])
Valid? yes
Incorrect node found:
wrong_answer(atom("p", [univ(-14 : int)]))
      35:      2  2 EXIT pred big:p/1-0 (nondet) big.m:23 (big.m:11)
mdb> continue
      36:      2  2 REDO pred big:p/1-0 (nondet) big.m:23 (big.m:11)
mdb> finish
      71:      2  2 EXIT pred big:p/1-0 (nondet) big.m:23 (big.m:11)
mdb> dd
atom("p", [univ(-20 : int)])
Valid? no
atom("b", [univ(0 : int), univ(1 : int)])
Valid? yes
atom("c", [univ(1 : int), univ(15 : int)])
Valid? yes
atom("d", [univ(15 : int), univ(45 : int)])
Valid? yes
Call atom("c", [univ(1 : int)])
Solutions:
	atom("c", [univ(1 : int), univ(15 : int)])
Complete? yes
atom("e", [univ(1 : int), univ(10 : int)])
Valid? yes
atom("f", [univ(10 : int), univ(-20 : int)])
Valid? yes
Incorrect node found:
wrong_answer(atom("p", [univ(-20 : int)]))
      71:      2  2 EXIT pred big:p/1-0 (nondet) big.m:23 (big.m:11)
mdb> continue
      72:      2  2 REDO pred big:p/1-0 (nondet) big.m:23 (big.m:11)
mdb> finish
      78:      2  2 EXIT pred big:p/1-0 (nondet) big.m:23 (big.m:11)
mdb> dd
atom("p", [univ(-22 : int)])
Valid? no
atom("e", [univ(1 : int), univ(11 : int)])
Valid? yes
atom("f", [univ(11 : int), univ(-22 : int)])
Valid? yes
Incorrect node found:
wrong_answer(atom("p", [univ(-22 : int)]))
      78:      2  2 EXIT pred big:p/1-0 (nondet) big.m:23 (big.m:11)
mdb> continue
      79:      2  2 REDO pred big:p/1-0 (nondet) big.m:23 (big.m:11)
mdb> finish
     115:      2  2 EXIT pred big:p/1-0 (nondet) big.m:23 (big.m:11)
mdb> dd
atom("p", [univ(2 : int)])
Valid? no
atom("f", [univ(0 : int), univ(0 : int)])
Valid? yes
atom("g", [univ(1 : int), univ(-1 : int)])
Valid? yes
atom("f", [univ(-1 : int), univ(2 : int)])
Valid? yes
atom("g", [univ(7 : int), univ(-11 : int)])
Valid? yes
Call atom("c", [univ(2 : int)])
Solutions:
	atom("c", [univ(2 : int), univ(6 : int)])
	atom("c", [univ(2 : int), univ(7 : int)])
Complete? yes
Incorrect node found:
wrong_answer(atom("p", [univ(2 : int)]))
     115:      2  2 EXIT pred big:p/1-0 (nondet) big.m:23 (big.m:11)
mdb> continue
     116:      2  2 REDO pred big:p/1-0 (nondet) big.m:23 (big.m:11)
mdb> finish
     143:      2  2 FAIL pred big:p/1-0 (nondet) big.m:23 (big.m:11)
mdb> dd
Call atom("p", [])
Solutions:
	atom("p", [univ(-12 : int)])
	atom("p", [univ(-14 : int)])
	atom("p", [univ(-20 : int)])
	atom("p", [univ(-22 : int)])
	atom("p", [univ(2 : int)])
Complete? no
atom("g", [univ(10 : int), univ(-2 : int)])
Valid? yes
atom("f", [univ(-2 : int), univ(4 : int)])
Valid? yes
atom("c", [univ(4 : int), univ(9 : int)])
Valid? yes
atom("g", [univ(9 : int), univ(99 : int)])
Valid? yes
Call atom("b", [univ(0 : int)])
Solutions:
	atom("b", [univ(0 : int), univ(0 : int)])
	atom("b", [univ(0 : int), univ(1 : int)])
Complete? yes
Incorrect node found:
missing_answer(atom("p", []), [atom("p", [univ(-12 : int)]), atom("p", [univ(-14 : int)]), atom("p", [univ(-20 : int)]), atom("p", [univ(-22 : int)]), atom("p", [univ(2 : int)])])
     143:      2  2 FAIL pred big:p/1-0 (nondet) big.m:23 (big.m:11)
mdb> continue
no.

New file: tests/debugger/declarative/big.exp2

       1:      1  1 CALL pred big:main/2-0 (det) big.m:9
mdb> echo on
Command echo enabled.
mdb> break p
Registering debuggable procedures... done.
There is one debuggable module, with 9 procedures.
 0: + stop  interface pred big:p/1-0 (nondet)
mdb> continue
       3:      2  2 CALL pred big:p/1-0 (nondet) big.m:23 (big.m:11)
mdb> finish
      26:      2  2 EXIT pred big:p/1-0 (nondet) big.m:23 (big.m:11)
mdb> dd
atom("p", [univ(-12 : int)])
Valid? no
atom("a", [univ(0 : int)])
Valid? yes
atom("b", [univ(0 : int), univ(0 : int)])
Valid? yes
atom("c", [univ(0 : int), univ(2 : int)])
Valid? yes
Call atom("d", [univ(2 : int)])
Solutions:
Complete? yes
atom("c", [univ(2 : int), univ(6 : int)])
Valid? yes
atom("f", [univ(6 : int), univ(-12 : int)])
Valid? yes
Incorrect node found:
wrong_answer(atom("p", [univ(-12 : int)]))
      26:      2  2 EXIT pred big:p/1-0 (nondet) big.m:23 (big.m:11)
mdb> continue
      27:      2  2 REDO pred big:p/1-0 (nondet) big.m:23 (big.m:11)
mdb> finish
      33:      2  2 EXIT pred big:p/1-0 (nondet) big.m:23 (big.m:11)
mdb> dd
atom("p", [univ(-14 : int)])
Valid? no
atom("c", [univ(2 : int), univ(7 : int)])
Valid? yes
atom("f", [univ(7 : int), univ(-14 : int)])
Valid? yes
Incorrect node found:
wrong_answer(atom("p", [univ(-14 : int)]))
      33:      2  2 EXIT pred big:p/1-0 (nondet) big.m:23 (big.m:11)
mdb> continue
      34:      2  2 REDO pred big:p/1-0 (nondet) big.m:23 (big.m:11)
mdb> finish
      65:      2  2 EXIT pred big:p/1-0 (nondet) big.m:23 (big.m:11)
mdb> dd
atom("p", [univ(-20 : int)])
Valid? no
atom("b", [univ(0 : int), univ(1 : int)])
Valid? yes
atom("c", [univ(1 : int), univ(15 : int)])
Valid? yes
atom("d", [univ(15 : int), univ(45 : int)])
Valid? yes
Call atom("c", [univ(1 : int)])
Solutions:
	atom("c", [univ(1 : int), univ(15 : int)])
Complete? yes
atom("e", [univ(1 : int), univ(10 : int)])
Valid? yes
atom("f", [univ(10 : int), univ(-20 : int)])
Valid? yes
Incorrect node found:
wrong_answer(atom("p", [univ(-20 : int)]))
      65:      2  2 EXIT pred big:p/1-0 (nondet) big.m:23 (big.m:11)
mdb> continue
      66:      2  2 REDO pred big:p/1-0 (nondet) big.m:23 (big.m:11)
mdb> finish
      72:      2  2 EXIT pred big:p/1-0 (nondet) big.m:23 (big.m:11)
mdb> dd
atom("p", [univ(-22 : int)])
Valid? no
atom("e", [univ(1 : int), univ(11 : int)])
Valid? yes
atom("f", [univ(11 : int), univ(-22 : int)])
Valid? yes
Incorrect node found:
wrong_answer(atom("p", [univ(-22 : int)]))
      72:      2  2 EXIT pred big:p/1-0 (nondet) big.m:23 (big.m:11)
mdb> continue
      73:      2  2 REDO pred big:p/1-0 (nondet) big.m:23 (big.m:11)
mdb> finish
     109:      2  2 EXIT pred big:p/1-0 (nondet) big.m:23 (big.m:11)
mdb> dd
atom("p", [univ(2 : int)])
Valid? no
atom("f", [univ(0 : int), univ(0 : int)])
Valid? yes
atom("g", [univ(1 : int), univ(-1 : int)])
Valid? yes
atom("f", [univ(-1 : int), univ(2 : int)])
Valid? yes
atom("g", [univ(7 : int), univ(-11 : int)])
Valid? yes
Call atom("c", [univ(2 : int)])
Solutions:
	atom("c", [univ(2 : int), univ(6 : int)])
	atom("c", [univ(2 : int), univ(7 : int)])
Complete? yes
Incorrect node found:
wrong_answer(atom("p", [univ(2 : int)]))
     109:      2  2 EXIT pred big:p/1-0 (nondet) big.m:23 (big.m:11)
mdb> continue
     110:      2  2 REDO pred big:p/1-0 (nondet) big.m:23 (big.m:11)
mdb> finish
     137:      2  2 FAIL pred big:p/1-0 (nondet) big.m:23 (big.m:11)
mdb> dd
Call atom("p", [])
Solutions:
	atom("p", [univ(-12 : int)])
	atom("p", [univ(-14 : int)])
	atom("p", [univ(-20 : int)])
	atom("p", [univ(-22 : int)])
	atom("p", [univ(2 : int)])
Complete? no
atom("g", [univ(10 : int), univ(-2 : int)])
Valid? yes
atom("f", [univ(-2 : int), univ(4 : int)])
Valid? yes
atom("c", [univ(4 : int), univ(9 : int)])
Valid? yes
atom("g", [univ(9 : int), univ(99 : int)])
Valid? yes
Call atom("b", [univ(0 : int)])
Solutions:
	atom("b", [univ(0 : int), univ(0 : int)])
	atom("b", [univ(0 : int), univ(1 : int)])
Complete? yes
Incorrect node found:
missing_answer(atom("p", []), [atom("p", [univ(-12 : int)]), atom("p", [univ(-14 : int)]), atom("p", [univ(-20 : int)]), atom("p", [univ(-22 : int)]), atom("p", [univ(2 : int)])])
     137:      2  2 FAIL pred big:p/1-0 (nondet) big.m:23 (big.m:11)
mdb> continue
no.

New file: tests/debugger/declarative/big.inp

echo on
break p
continue
finish
dd
no
yes
yes
yes
yes
yes
yes
continue
finish
dd
no
yes
yes
continue
finish
dd
no
yes
yes
yes
yes
yes
yes
continue
finish
dd
no
yes
yes
continue
finish
dd
no
yes
yes
yes
yes
yes
continue
finish
dd
no
yes
yes
yes
yes
yes
continue


New file: tests/debugger/declarative/gcf.exp2

       1:      1  1 CALL pred gcf:main/2-0 (cc_multi) gcf.m:8
mdb> echo on
Command echo enabled.
mdb> break a
Registering debuggable procedures... done.
There is one debuggable module, with 5 procedures.
 0: + stop  interface pred gcf:a/1-0 (nondet)
mdb> continue
       3:      2  2 CALL pred gcf:a/1-0 (nondet) gcf.m:26 (gcf.m:10)
mdb> finish
      23:      2  2 EXIT pred gcf:a/1-0 (nondet) gcf.m:26 (gcf.m:10)
mdb> dd
atom("a", [univ(11 : int)])
Valid? no
atom("g", [univ(2 : int)])
Valid? yes
atom("c", [univ(2 : int), univ(11 : int)])
Valid? yes
atom("f", [univ(11 : int)])
Valid? yes
Incorrect node found:
wrong_answer(atom("a", [univ(11 : int)]))
      23:      2  2 EXIT pred gcf:a/1-0 (nondet) gcf.m:26 (gcf.m:10)
mdb> continue
      24:      2  2 REDO pred gcf:a/1-0 (nondet) gcf.m:26 (gcf.m:10)
mdb> finish
      30:      2  2 EXIT pred gcf:a/1-0 (nondet) gcf.m:26 (gcf.m:10)
mdb> dd
atom("a", [univ(12 : int)])
Valid? no
atom("c", [univ(2 : int), univ(12 : int)])
Valid? yes
atom("f", [univ(12 : int)])
Valid? yes
Incorrect node found:
wrong_answer(atom("a", [univ(12 : int)]))
      30:      2  2 EXIT pred gcf:a/1-0 (nondet) gcf.m:26 (gcf.m:10)
mdb> continue
      31:      2  2 REDO pred gcf:a/1-0 (nondet) gcf.m:26 (gcf.m:10)
mdb> finish
      42:      2  2 EXIT pred gcf:a/1-0 (nondet) gcf.m:26 (gcf.m:10)
mdb> dd
atom("a", [univ(20 : int)])
Valid? no
atom("g", [univ(3 : int)])
Valid? yes
atom("c", [univ(3 : int), univ(20 : int)])
Valid? yes
atom("f", [univ(20 : int)])
Valid? yes
Incorrect node found:
wrong_answer(atom("a", [univ(20 : int)]))
      42:      2  2 EXIT pred gcf:a/1-0 (nondet) gcf.m:26 (gcf.m:10)
mdb> continue
yes(20)

New file: tests/debugger/declarative/if_then_else.exp2

       1:      1  1 CALL pred if_then_else:main/2-0 (det) if_then_else.m:7
mdb> echo on
Command echo enabled.
mdb> break ite
Registering debuggable procedures... done.
There is one debuggable module, with 5 procedures.
 0: + stop  interface pred if_then_else:ite/2-0 (det)
mdb> continue
       2:      2  2 CALL pred if_then_else:ite/2-0 (det) if_then_else.m:22 (if_then_else.m:8)
mdb> finish
       9:      2  2 EXIT pred if_then_else:ite/2-0 (det) if_then_else.m:22 (if_then_else.m:8)
mdb> dd
atom("ite", [univ(0 : int), univ(1 : int)])
Valid? no
atom("a", [univ(0 : int)])
Valid? yes
atom("b", [univ(1 : int)])
Valid? yes
Incorrect node found:
wrong_answer(atom("ite", [univ(0 : int), univ(1 : int)]))
       9:      2  2 EXIT pred if_then_else:ite/2-0 (det) if_then_else.m:22 (if_then_else.m:8)
mdb> continue
ite(0, 1).
      10:      5  2 CALL pred if_then_else:ite/2-0 (det) if_then_else.m:22 (if_then_else.m:12)
mdb> finish
      17:      5  2 EXIT pred if_then_else:ite/2-0 (det) if_then_else.m:22 (if_then_else.m:12)
mdb> dd
atom("ite", [univ(1 : int), univ(0 : int)])
Valid? no
Call atom("a", [univ(1 : int)])
Solutions:
Complete? yes
Incorrect node found:
wrong_answer(atom("ite", [univ(1 : int), univ(0 : int)]))
      17:      5  2 EXIT pred if_then_else:ite/2-0 (det) if_then_else.m:22 (if_then_else.m:12)
mdb> continue
ite(1, 0).

New file: tests/debugger/declarative/lpe_example.m

:- module lpe_example.
:- interface.
:- import_module io.
:- pred main(io__state::di, io__state::uo) is det.
:- implementation.
:- import_module std_util, int.

main -->
	{ solutions(p(1), Ss) },
	io__write(Ss),
	io__nl.


:- pred p(int, int).
:- mode p(in, out) is nondet.

p(0, 0).
p(1, X) :-
	q(A),
	(
		r(A, X)
	;
		X = A
	).

:- pred q(int).
:- mode q(out) is det.

q(3).

:- pred r(int, int).
:- mode r(in, out) is multi.

r(X, X + 10).
r(X, X + 20).


New file: tests/debugger/declarative/lpe_example.exp

       1:      1  1 CALL pred lpe_example:main/2-0 (det) lpe_example.m:8
mdb> echo on
Command echo enabled.
mdb> break p
Registering debuggable procedures... done.
There are 67 debuggable modules, with a total of 3205 procedures.
 0: + stop  interface pred lpe_example:p/2-0 (nondet)
mdb> continue
       3:      3  3 CALL pred lpe_example:p/2-0 (nondet) lpe_example.m:17 (std_util.m:592)
mdb> finish
      11:      3  3 EXIT pred lpe_example:p/2-0 (nondet) lpe_example.m:17 (std_util.m:592)
mdb> dd
atom("p", [univ(1 : int), univ(13 : int)])
Valid? no
atom("q", [univ(3 : int)])
Valid? yes
atom("r", [univ(3 : int), univ(13 : int)])
Valid? yes
Incorrect node found:
wrong_answer(atom("p", [univ(1 : int), univ(13 : int)]))
      11:      3  3 EXIT pred lpe_example:p/2-0 (nondet) lpe_example.m:17 (std_util.m:592)
mdb> continue
      12:      3  3 REDO pred lpe_example:p/2-0 (nondet) lpe_example.m:17 (std_util.m:592)
mdb> finish
      16:      3  3 EXIT pred lpe_example:p/2-0 (nondet) lpe_example.m:17 (std_util.m:592)
mdb> dd
atom("p", [univ(1 : int), univ(23 : int)])
Valid? no
atom("r", [univ(3 : int), univ(23 : int)])
Valid? yes
Incorrect node found:
wrong_answer(atom("p", [univ(1 : int), univ(23 : int)]))
      16:      3  3 EXIT pred lpe_example:p/2-0 (nondet) lpe_example.m:17 (std_util.m:592)
mdb> continue
      17:      3  3 REDO pred lpe_example:p/2-0 (nondet) lpe_example.m:17 (std_util.m:592)
mdb> finish
      21:      3  3 EXIT pred lpe_example:p/2-0 (nondet) lpe_example.m:17 (std_util.m:592)
mdb> dd
atom("p", [univ(1 : int), univ(3 : int)])
Valid? no
Incorrect node found:
wrong_answer(atom("p", [univ(1 : int), univ(3 : int)]))
      21:      3  3 EXIT pred lpe_example:p/2-0 (nondet) lpe_example.m:17 (std_util.m:592)
mdb> continue
      22:      3  3 REDO pred lpe_example:p/2-0 (nondet) lpe_example.m:17 (std_util.m:592)
mdb> finish
      23:      3  3 FAIL pred lpe_example:p/2-0 (nondet) lpe_example.m:17 (std_util.m:592)
mdb> dd
Call atom("p", [univ(1 : int)])
Solutions:
	atom("p", [univ(1 : int), univ(13 : int)])
	atom("p", [univ(1 : int), univ(23 : int)])
	atom("p", [univ(1 : int), univ(3 : int)])
Complete? no
Incorrect node found:
missing_answer(atom("p", [univ(1 : int)]), [atom("p", [univ(1 : int), univ(13 : int)]), atom("p", [univ(1 : int), univ(23 : int)]), atom("p", [univ(1 : int), univ(3 : int)])])
      23:      3  3 FAIL pred lpe_example:p/2-0 (nondet) lpe_example.m:17 (std_util.m:592)
mdb> continue
[3, 13, 23]

New file: tests/debugger/declarative/lpe_example.exp2

       1:      1  1 CALL pred lpe_example:main/2-0 (det) lpe_example.m:8
mdb> echo on
Command echo enabled.
mdb> break p
Registering debuggable procedures... done.
There is one debuggable module, with 4 procedures.
 0: + stop  interface pred lpe_example:p/2-0 (nondet)
mdb> continue
       2:      2  2 CALL pred lpe_example:p/2-0 (nondet) lpe_example.m:17
mdb> finish
      10:      2  2 EXIT pred lpe_example:p/2-0 (nondet) lpe_example.m:17
mdb> dd
atom("p", [univ(1 : int), univ(13 : int)])
Valid? no
atom("q", [univ(3 : int)])
Valid? yes
atom("r", [univ(3 : int), univ(13 : int)])
Valid? yes
Incorrect node found:
wrong_answer(atom("p", [univ(1 : int), univ(13 : int)]))
      10:      2  2 EXIT pred lpe_example:p/2-0 (nondet) lpe_example.m:17
mdb> continue
      11:      2  2 REDO pred lpe_example:p/2-0 (nondet) lpe_example.m:17
mdb> finish
      15:      2  2 EXIT pred lpe_example:p/2-0 (nondet) lpe_example.m:17
mdb> dd
atom("p", [univ(1 : int), univ(23 : int)])
Valid? no
atom("r", [univ(3 : int), univ(23 : int)])
Valid? yes
Incorrect node found:
wrong_answer(atom("p", [univ(1 : int), univ(23 : int)]))
      15:      2  2 EXIT pred lpe_example:p/2-0 (nondet) lpe_example.m:17
mdb> continue
      16:      2  2 REDO pred lpe_example:p/2-0 (nondet) lpe_example.m:17
mdb> finish
      20:      2  2 EXIT pred lpe_example:p/2-0 (nondet) lpe_example.m:17
mdb> dd
atom("p", [univ(1 : int), univ(3 : int)])
Valid? no
Incorrect node found:
wrong_answer(atom("p", [univ(1 : int), univ(3 : int)]))
      20:      2  2 EXIT pred lpe_example:p/2-0 (nondet) lpe_example.m:17
mdb> continue
      21:      2  2 REDO pred lpe_example:p/2-0 (nondet) lpe_example.m:17
mdb> finish
      22:      2  2 FAIL pred lpe_example:p/2-0 (nondet) lpe_example.m:17
mdb> dd
Call atom("p", [univ(1 : int)])
Solutions:
	atom("p", [univ(1 : int), univ(13 : int)])
	atom("p", [univ(1 : int), univ(23 : int)])
	atom("p", [univ(1 : int), univ(3 : int)])
Complete? no
Incorrect node found:
missing_answer(atom("p", [univ(1 : int)]), [atom("p", [univ(1 : int), univ(13 : int)]), atom("p", [univ(1 : int), univ(23 : int)]), atom("p", [univ(1 : int), univ(3 : int)])])
      22:      2  2 FAIL pred lpe_example:p/2-0 (nondet) lpe_example.m:17
mdb> continue
[3, 13, 23]

New file: tests/debugger/declarative/lpe_example.inp

echo on
break p
continue
finish
dd
no
yes
yes
continue
finish
dd
no
yes
continue
finish
dd
no
continue
finish
dd
no
continue

New file: tests/debugger/declarative/neg_conj.m

:- module neg_conj.
:- interface.
:- import_module io.
:- pred main(io__state::di, io__state::uo) is det.
:- implementation.
:- import_module int.

main -->
	( { p(0) } ->
		io__write_string("yes.\n")
	;
		io__write_string("no.\n")
	).

:- pred p(int).
:- mode p(in) is semidet.

p(X) :-
	\+ (
		q(X, Y),
		r(Y)
	).

:- pred q(int, int).
:- mode q(in, out) is nondet.

q(0, 0).
q(0, 1).

:- pred r(int).
:- mode r(in) is semidet.

r(Y) :-
	Y > 1.

New file: tests/debugger/declarative/neg_conj.exp

       1:      1  1 CALL pred neg_conj:main/2-0 (det) neg_conj.m:11
mdb> echo on
Command echo enabled.
mdb> break p
Registering debuggable procedures... done.
There are 67 debuggable modules, with a total of 3205 procedures.
 0: + stop  interface pred neg_conj:p/1-0 (semidet)
mdb> continue
       3:      2  2 CALL pred neg_conj:p/1-0 (semidet) neg_conj.m:19 (neg_conj.m:9)
mdb> finish
      18:      2  2 EXIT pred neg_conj:p/1-0 (semidet) neg_conj.m:19 (neg_conj.m:9)
mdb> dd
atom("p", [univ(0 : int)])
Valid? no
atom("q", [univ(0 : int), univ(0 : int)])
Valid? yes
Call atom("r", [univ(0 : int)])
Solutions:
Complete? yes
atom("q", [univ(0 : int), univ(1 : int)])
Valid? yes
Call atom("r", [univ(1 : int)])
Solutions:
Complete? yes
Call atom("q", [univ(0 : int)])
Solutions:
	atom("q", [univ(0 : int), univ(0 : int)])
	atom("q", [univ(0 : int), univ(1 : int)])
Complete? yes
Incorrect node found:
wrong_answer(atom("p", [univ(0 : int)]))
      18:      2  2 EXIT pred neg_conj:p/1-0 (semidet) neg_conj.m:19 (neg_conj.m:9)
mdb> continue
yes.

New file: tests/debugger/declarative/neg_conj.exp2

       1:      1  1 CALL pred neg_conj:main/2-0 (det) neg_conj.m:11
mdb> echo on
Command echo enabled.
mdb> break p
Registering debuggable procedures... done.
There is one debuggable module, with 4 procedures.
 0: + stop  interface pred neg_conj:p/1-0 (semidet)
mdb> continue
       3:      2  2 CALL pred neg_conj:p/1-0 (semidet) neg_conj.m:19 (neg_conj.m:9)
mdb> finish
      18:      2  2 EXIT pred neg_conj:p/1-0 (semidet) neg_conj.m:19 (neg_conj.m:9)
mdb> dd
atom("p", [univ(0 : int)])
Valid? no
atom("q", [univ(0 : int), univ(0 : int)])
Valid? yes
Call atom("r", [univ(0 : int)])
Solutions:
Complete? yes
atom("q", [univ(0 : int), univ(1 : int)])
Valid? yes
Call atom("r", [univ(1 : int)])
Solutions:
Complete? yes
Call atom("q", [univ(0 : int)])
Solutions:
	atom("q", [univ(0 : int), univ(0 : int)])
	atom("q", [univ(0 : int), univ(1 : int)])
Complete? yes
Incorrect node found:
wrong_answer(atom("p", [univ(0 : int)]))
      18:      2  2 EXIT pred neg_conj:p/1-0 (semidet) neg_conj.m:19 (neg_conj.m:9)
mdb> continue
yes.

New file: tests/debugger/declarative/neg_conj.inp

echo on
break p
continue
finish
dd
no
yes
yes
yes
yes
yes
continue


New file: tests/debugger/declarative/negation.exp

       1:      1  1 CALL pred negation:main/2-0 (det) negation.m:13
mdb> echo on
Command echo enabled.
mdb> break p
Registering debuggable procedures... done.
There are 67 debuggable modules, with a total of 3205 procedures.
 0: + stop  interface pred negation:p/2-0 (det)
mdb> continue
       2:      2  2 CALL pred negation:p/2-0 (det) negation.m:29 (negation.m:14)
mdb> finish
      23:      2  2 EXIT pred negation:p/2-0 (det) negation.m:29 (negation.m:14)
mdb> dd
atom("p", [univ(1 : int), univ(42 : int)])
Valid? no
atom("r", [univ(1 : int), univ(11 : int)])
Valid? yes
atom("q", [univ(11 : int)])
Valid? yes
atom("r", [univ(1 : int), univ(21 : int)])
Valid? yes
atom("q", [univ(21 : int)])
Valid? yes
Call atom("r", [univ(1 : int)])
Solutions:
	atom("r", [univ(1 : int), univ(11 : int)])
	atom("r", [univ(1 : int), univ(21 : int)])
Complete? yes
Incorrect node found:
wrong_answer(atom("p", [univ(1 : int), univ(42 : int)]))
      23:      2  2 EXIT pred negation:p/2-0 (det) negation.m:29 (negation.m:14)
mdb> continue
42

New file: tests/debugger/declarative/negation.exp2

       1:      1  1 CALL pred negation:main/2-0 (det) negation.m:13
mdb> echo on
Command echo enabled.
mdb> break p
Registering debuggable procedures... done.
There is one debuggable module, with 4 procedures.
 0: + stop  interface pred negation:p/2-0 (det)
mdb> continue
       2:      2  2 CALL pred negation:p/2-0 (det) negation.m:29 (negation.m:14)
mdb> finish
      23:      2  2 EXIT pred negation:p/2-0 (det) negation.m:29 (negation.m:14)
mdb> dd
atom("p", [univ(1 : int), univ(42 : int)])
Valid? no
atom("r", [univ(1 : int), univ(11 : int)])
Valid? yes
atom("q", [univ(11 : int)])
Valid? yes
atom("r", [univ(1 : int), univ(21 : int)])
Valid? yes
atom("q", [univ(21 : int)])
Valid? yes
Call atom("r", [univ(1 : int)])
Solutions:
	atom("r", [univ(1 : int), univ(11 : int)])
	atom("r", [univ(1 : int), univ(21 : int)])
Complete? yes
Incorrect node found:
wrong_answer(atom("p", [univ(1 : int), univ(42 : int)]))
      23:      2  2 EXIT pred negation:p/2-0 (det) negation.m:29 (negation.m:14)
mdb> continue
42

New file: tests/debugger/declarative/negation.inp

echo on
break p
continue
finish
dd
no
yes
yes
yes
yes
yes
continue


New file: tests/debugger/declarative/oracle_db.exp2

       1:      1  1 CALL pred oracle_db:main/2-0 (det) oracle_db.m:12
mdb> echo on
Command echo enabled.
mdb> break a
Registering debuggable procedures... done.
There is one debuggable module, with 3 procedures.
 0: + stop  interface pred oracle_db:a/3-0 (semidet)
mdb> continue
       3:      2  2 CALL pred oracle_db:a/3-0 (semidet) oracle_db.m:19 (oracle_db.m:9)
mdb> finish
      10:      2  2 EXIT pred oracle_db:a/3-0 (semidet) oracle_db.m:19 (oracle_db.m:9)
mdb> dd
atom("a", [univ(99 : int), univ(99 : int), univ(99 : int)])
Valid? no
atom("b", [univ(99 : int)])
Valid? yes
Incorrect node found:
wrong_answer(atom("a", [univ(99 : int), univ(99 : int), univ(99 : int)]))
      10:      2  2 EXIT pred oracle_db:a/3-0 (semidet) oracle_db.m:19 (oracle_db.m:9)
mdb> continue
yes.

New file: tests/debugger/declarative/propositional.exp2

       1:      1  1 CALL pred propositional:main/2-0 (det) propositional.m:13
mdb> echo on
Command echo enabled.
mdb> break a
Registering debuggable procedures... done.
There is one debuggable module, with 10 procedures.
 0: + stop  interface pred propositional:a/0-0 (semidet)
mdb> break b
 1: + stop  interface pred propositional:b/0-0 (semidet)
mdb> continue
       3:      2  2 CALL pred propositional:a/0-0 (semidet) propositional.m:27 (propositional.m:10)
mdb> finish
      11:      2  2 EXIT pred propositional:a/0-0 (semidet) propositional.m:27 (propositional.m:10)
mdb> dd
atom("a", [])
Valid? no
atom("c", [])
Valid? no
Incorrect node found:
wrong_answer(atom("c", []))
      11:      2  2 EXIT pred propositional:a/0-0 (semidet) propositional.m:27 (propositional.m:10)
mdb> continue
      12:      5  2 CALL pred propositional:b/0-0 (semidet) propositional.m:29 (propositional.m:10)
mdb> finish
      22:      5  2 EXIT pred propositional:b/0-0 (semidet) propositional.m:29 (propositional.m:10)
mdb> dd
atom("b", [])
Valid? no
atom("f", [])
Valid? no
atom("i", [])
Valid? yes
Incorrect node found:
wrong_answer(atom("f", []))
      22:      5  2 EXIT pred propositional:b/0-0 (semidet) propositional.m:29 (propositional.m:10)
mdb> continue
yes

New file: tests/debugger/declarative/queens.exp2

       1:      1  1 CALL pred queens:main/2-0 (cc_multi) queens.m:17
mdb> echo on
Command echo enabled.
mdb> dd
mdb: declarative debugging is only available from EXIT or FAIL events.
mdb> break queen
Registering debuggable procedures... done.
There is one debuggable module, with 9 procedures.
 0: + stop  interface pred queens:queen/2-0 (nondet)
mdb> continue
       5:      3  2 CALL pred queens:queen/2-0 (nondet) queens.m:41 (queens.m:15)
mdb> finish
     161:      3  2 FAIL pred queens:queen/2-0 (nondet) queens.m:41 (queens.m:15)
mdb> dd
Call atom("queen", [univ([1, 2, 3, 4, 5] : list:list(int))])
Solutions:
Complete? no
Call atom("qperm", [univ([1, 2, 3, 4, 5] : list:list(int)), univ(int : private_builtin:type_info(int))])
Solutions:
Complete? no
atom("qdelete", [univ(4 : int), univ([1, 2, 3, 4, 5] : list:list(int)), univ([1, 2, 3, 5] : list:list(int)), univ(int : private_builtin:type_info(int))])
Valid? yes
atom("qdelete", [univ(5 : int), univ([1, 2, 3, 4, 5] : list:list(int)), univ([1, 2, 3, 4] : list:list(int)), univ(int : private_builtin:type_info(int))])
Valid? yes
Call atom("qdelete", [univ([1, 2, 3, 4, 5] : list:list(int)), univ(int : private_builtin:type_info(int))])
Solutions:
	atom("qdelete", [univ(1 : int), univ([1, 2, 3, 4, 5] : list:list(int)), univ([2, 3, 4, 5] : list:list(int)), univ(int : private_builtin:type_info(int))])
	atom("qdelete", [univ(2 : int), univ([1, 2, 3, 4, 5] : list:list(int)), univ([1, 3, 4, 5] : list:list(int)), univ(int : private_builtin:type_info(int))])
	atom("qdelete", [univ(3 : int), univ([1, 2, 3, 4, 5] : list:list(int)), univ([1, 2, 4, 5] : list:list(int)), univ(int : private_builtin:type_info(int))])
	atom("qdelete", [univ(4 : int), univ([1, 2, 3, 4, 5] : list:list(int)), univ([1, 2, 3, 5] : list:list(int)), univ(int : private_builtin:type_info(int))])
	atom("qdelete", [univ(5 : int), univ([1, 2, 3, 4, 5] : list:list(int)), univ([1, 2, 3, 4] : list:list(int)), univ(int : private_builtin:type_info(int))])
Complete? yes
Incorrect node found:
missing_answer(atom("qperm", [univ([1, 2, 3, 4, 5] : list:list(int)), univ(int : private_builtin:type_info(int))]), [])
     161:      3  2 FAIL pred queens:queen/2-0 (nondet) queens.m:41 (queens.m:15)
mdb> continue
No solution

New file: tests/debugger/declarative/small.m

:- module small.
:- interface.
:- import_module io.
:- pred main(io__state::di, io__state::uo) is det.
:- implementation.

main -->
	{ p(X) },
	io__write_int(X),
	io__nl.

:- pred p(int::out) is det.

p(42).


New file: tests/debugger/declarative/small.exp

       1:      1  1 CALL pred small:main/2-0 (det) small.m:7
mdb> echo on
Command echo enabled.
mdb> break p
Registering debuggable procedures... done.
There are 67 debuggable modules, with a total of 3203 procedures.
 0: + stop  interface pred small:p/1-0 (det)
mdb> continue
       2:      2  2 CALL pred small:p/1-0 (det) small.m:14 (small.m:8)
mdb> finish
       3:      2  2 EXIT pred small:p/1-0 (det) small.m:14 (small.m:8)
mdb> dd
atom("p", [univ(42 : int)])
Valid? no
Incorrect node found:
wrong_answer(atom("p", [univ(42 : int)]))
       3:      2  2 EXIT pred small:p/1-0 (det) small.m:14 (small.m:8)
mdb> continue
42

New file: tests/debugger/declarative/small.exp2

       1:      1  1 CALL pred small:main/2-0 (det) small.m:7
mdb> echo on
Command echo enabled.
mdb> break p
Registering debuggable procedures... done.
There is one debuggable module, with 2 procedures.
 0: + stop  interface pred small:p/1-0 (det)
mdb> continue
       2:      2  2 CALL pred small:p/1-0 (det) small.m:14 (small.m:8)
mdb> finish
       3:      2  2 EXIT pred small:p/1-0 (det) small.m:14 (small.m:8)
mdb> dd
atom("p", [univ(42 : int)])
Valid? no
Incorrect node found:
wrong_answer(atom("p", [univ(42 : int)]))
       3:      2  2 EXIT pred small:p/1-0 (det) small.m:14 (small.m:8)
mdb> continue
42

New file: tests/debugger/declarative/small.inp

echo on
break p
continue
finish
dd
no
continue

-- 
Mark Brown, PhD student            )O+  |  "Another of Fortran's breakthroughs
(m.brown at cs.mu.oz.au)                   |  was the GOTO statement, which was...
Dept. of Computer Science and Software  |  uniquely simple and understandable"
Engineering, University of Melbourne    |              -- IEEE, 1994
--------------------------------------------------------------------------
mercury-developers mailing list
Post messages to:       mercury-developers at cs.mu.oz.au
Administrative Queries: owner-mercury-developers at cs.mu.oz.au
Subscriptions:          mercury-developers-request at cs.mu.oz.au
--------------------------------------------------------------------------



More information about the developers mailing list