[m-dev.] for review: Aditi updates[6]
Simon Taylor
stayl at cs.mu.OZ.AU
Sat Jun 5 14:46:54 AEST 1999
Index: doc/reference_manual.texi
===================================================================
RCS file: /home/staff/zs/imp/mercury/doc/reference_manual.texi,v
retrieving revision 1.139
diff -u -u -r1.139 reference_manual.texi
--- reference_manual.texi 1999/04/30 04:24:45 1.139
+++ reference_manual.texi 1999/06/03 02:28:38
@@ -4991,6 +4991,16 @@
@node Aditi deductive database interface
@subsection Aditi deductive database interface
+ at menu
+* Aditi overview::
+* Aditi pragma declarations:: Controlling Aditi compilation
+* Aditi update syntax:: Changing the contents of Aditi relations
+* Aditi glossary:: Glossary of Aditi terms
+ at end menu
+
+ at node Aditi overview
+ at subsubsection Aditi overview
+
The University of Melbourne Mercury implementation includes support for
compiling Mercury predicates for bottom-up evaluation using the Aditi
deductive database system. The Aditi system is not yet publicly available,
@@ -5006,10 +5016,6 @@
rather than a tuple at a time as in the normal top-down execution of a
Mercury program.
- at menu
-* Aditi glossary:: Glossary of Aditi terms
- at end menu
-
There are several restrictions on predicates to be evaluated using Aditi.
Argument types may not include polymorphic, higher-order or abstract types.
Type classes are not supported within database predicates. The argument
@@ -5034,7 +5040,10 @@
Some useful predicates are defined in @file{extras/aditi/aditi.m} in the
@samp{mercury-extras} distribution.
-The following pragma declarations control Aditi compilation.
+ at node Aditi pragma declarations
+ at subsubsection Aditi pragma declarations
+
+The following pragma declarations control compilation of Aditi predicates.
@example
:- pragma aditi(@var{Name}/@var{Arity}).
@@ -5107,6 +5116,261 @@
@var{IndexType} must be one of @samp{unique_B_tree} or
@samp{non_unique_B_tree}. @var{Attributes} is a list of argument
numbers (argument numbers are counted from one).
+
+ at node Aditi update syntax
+ at subsubsection Aditi update syntax
+
+The Melbourne Mercury compiler provides special syntax to specify updates
+of Aditi base relations. For a predicate @samp{p/3}, the following update
+procedures are defined. Variables named @samp{DB at var{N}} are
+ at samp{aditi__state} variables. When occuring as a pair at the end
+of an argument list, they have mode @samp{aditi_di, aditi_uo}.
+
+It is currently up to the application to ensure that any modifications
+do not change the determinism of a base relation. Updates of relations
+with unique B-tree indexes are checked to ensure that a key is not given
+multiple values. The transaction will abort if this occurs.
+
+Note: The implementation of Aditi updates is not yet complete.
+
+The examples make use of the following declarations.
+ at example
+:- pred p(aditi__state::aditi_ui, int::out, int::out) is nondet.
+:- pragma base_relation(p/3).
+
+:- func q(aditi__state::aditi_ui, int::out) = (int::out) is nondet.
+:- pragma base_relation(q/2).
+
+:- pred ancestor(aditi__state::aditi_ui, int::out, int::out) is nondet.
+:- pragma aditi(ancestor/3).
+ at end example
+
+ at c XXX texinfo doesn't have subsubsubsection.
+ at subsubheading Insertion
+
+ at example
+aditi_insert(@var{PredName}(@var{Var1}, @var{Var2}, @dots{}), @var{DB0}, @var{DB}).
+
+aditi_insert(@var{FuncName}(@var{Var1}, @var{Var2}, @dots{}) = @var{RetVar}, @var{DB0}, @var{DB}).
+ at end example
+
+Insert the specified tuple into a relation. The tuple to be inserted
+must have the same type signature as the relation. All the arguments
+of the tuple have mode @samp{in}, except the @samp{aditi__state} argument
+which has mode @samp{unused}.
+There must be a @w{@samp{:- pragma base_relation}} declaration for
+ at w{@samp{@var{Name}/@var{Arity}}}.
+
+Note that @w{@samp{@var{PredName}(@var{Var1}, @var{Var2}, @dots{})}}
+in a call to @samp{aditi_insert} is not a higher-order term.
+ at w{@samp{Pred = p(DB0, X, Y), aditi_insert(Pred, DB0, DB)}}
+is a syntax error.
+
+Examples:
+ at example
+ aditi_insert(p(_, 1, 2), DB0, DB).
+
+ aditi_insert(q(_, 1) = 2, DB0, DB).
+ at end example
+
+ at subsubheading Deletion
+
+ at example
+aditi_delete(@var{PredName}(@var{Var1}, @var{Var2}, @dots{}) :- @var{Goal}, @var{DB0}, @var{DB}).
+
+aditi_delete(@var{FuncName}(@var{Var1}, @var{Var2}, @dots{}) = @var{RetVar} :- @var{Goal}, @var{DB0}, @var{DB}).
+
+aditi_delete(@var{PredOrFunc} @var{Name}/@var{Arity}, @var{Closure}, @var{DB0}, @var{DB}).
+ at end example
+
+Delete all tuples for which @samp{@var{Goal}} or @samp{@var{Closure}}
+succeeds from the named base relation.
+
+There must be a @w{@samp{:- pragma base_relation}} declaration for
+ at w{@samp{@var{PredOrFunc} @var{Name}/@var{Arity}}}.
+
+For the third alternative @samp{@var{PredOrFunc}} must be either
+ at samp{pred} or @samp{func}.
+
+When updating a predicate with type declaration
+ at w{@samp{:- pred p(aditi__state, @var{Type1}, @dots{})}},
+ at samp{@var{Closure}} must have type
+ at w{@samp{aditi_top_down pred(aditi__state, @var{Type1}, @dots{})}},
+and inst @w{@samp{pred(unused, in, @dots{}) is semidet}}.
+
+When updating a function with type declaration
+ at w{@samp{:- func p(aditi__state, @var{Type1}, @dots{}) = @var{Type2}}},
+ at samp{@var{Closure}} must have type
+ at w{@samp{aditi_top_down func(aditi__state, @var{Type1}, @dots{}) = @var{Type2}}},
+and inst @w{@samp{func(unused, in, @dots{}) = in is semidet}}.
+
+The @samp{aditi_top_down} annotation on the lambda expression is needed to
+tell the compiler to generate code for execution by the
+Aditi database using the normal Mercury execution algorithm.
+
+The @samp{aditi__state} argument of @samp{@var{Closure}} must have
+mode @samp{unused} -- it is not possible to call an Aditi
+relation from the deletion condition. All other arguments of
+ at samp{@var{Closure}} must have mode @samp{in}.
+
+If the construction of the lambda expression is in the same conjunction
+as the @samp{aditi_delete} call, the compiler may be able to do a better
+job of optimizing the deletion using indexes.
+
+Examples:
+ at example
+ aditi_delete((p(_, X, Y) :- X + Y = 2), DB0, DB).
+
+ aditi_delete(q(_, 2) = Y, DB0, DB).
+
+ DeleteP = (aditi_top_down
+ pred(_::unused, X::in, Y::in) is semidet :-
+ X = 2
+ ),
+ aditi_delete(pred p/3, DeleteP, DB0, DB).
+
+ DeleteQ = (aditi_top_down
+ func(_::unused, X::in) = (Y::in) is semidet :-
+ X = 2
+ ),
+ aditi_delete(func q/2, DeleteQ, DB0, DB).
+ at end example
+
+The type of @samp{Pred} is
+ at w{@samp{aditi_top_down pred(aditi__state, int, int)}}.
+Its inst is @w{@samp{pred(unused, in, in) is nondet}}, as for a normal
+lambda expression.
+
+ at subsubheading Bulk insertion
+
+ at example
+aditi_bulk_insert(@var{PredOrFunc} @var{Name}/@var{Arity}, @var{Closure}, @var{DB0}, @var{DB}).
+ at end example
+
+Insert all solutions of @samp{@var{Closure}} into the named relation.
+ at samp{@var{PredOrFunc}} must be either @samp{pred} or @samp{func}.
+There must be a @w{@samp{:- pragma base_relation}} declaration for
+ at w{@samp{@var{Name}/@var{Arity}}}.
+
+The closure to produce the tuples to insert must have the same
+type signature as the base relation, with all arguments except
+the @samp{aditi__state} output. It must also be evaluable bottom-up
+by the Aditi system. This means the predicate passed must have a
+ at w{@samp{:- pragma aditi(@dots{})}} declaration. Lambda expressions can
+be marked as evaluable by Aditi using an @samp{aditi_bottom_up} annotation
+on the lambda expression.
+
+Examples:
+ at example
+ aditi_bulk_insert(pred p/3, ancestor, DB0, DB).
+
+ InsertP = (aditi_bottom_up
+ pred(DB1::aditi_ui, X::out, Y::out) is nondet :-
+ ancestor(DB1, X, Y)
+ ),
+ aditi_bulk_insert(pred p/3, InsertP, DB0, DB).
+
+ InsertQ = (aditi_bottom_up
+ func(DB1::aditi_ui, X::out) = (Y::out) is nondet :-
+ ancestor(DB1, X, Y)
+ ),
+ aditi_bulk_insert(pred p/3, InsertQ, DB0, DB).
+ at end example
+
+The type of @samp{Pred} is
+ at w{@samp{aditi_bottom_up pred(aditi__state, int, int)}}.
+Its inst is @w{@samp{pred(aditi_ui, out, out) is nondet}},
+as for a normal lambda expression.
+
+ at subsubheading Bulk deletion
+
+ at example
+aditi_bulk_delete(@var{PredOrFunc} @var{Name}/@var{Arity}, @var{Closure}, @var{DB0}, @var{DB}).
+ at end example
+
+Delete all solutions of @samp{@var{Closure}} from the named relation.
+ at samp{@var{PredOrFunc}} must be either @samp{pred} or @samp{func}.
+There must be a @w{@samp{:- pragma base_relation}} declaration for
+ at w{@samp{@var{Name}/@var{Arity}}}.
+
+The restrictions on the closure term passed to @samp{aditi_bulk_insert} also
+apply to @samp{aditi_bulk_delete}.
+
+ at subsubheading Modification
+
+ at example
+aditi_modify(
+ (@var{PredName}(@var{Var1}, @var{Var2}, @dots{}) = @var{Predname}(@var{Var3}, @var{Var4}, @dots{}) :-
+ @var{Goal},
+ ),
+ @var{DB0}, @var{DB}).
+
+aditi_modify(
+ ((@var{FuncName}(@var{Var1}, @var{Var2}, @dots{}) = @var{RetVar0}) =
+ ((@var{Predname}(@var{Var3}, @var{Var4}, @dots{}) = @var{RetVar})) :-
+ @var{Goal},
+ ),
+ @var{DB0}, @var{DB}).
+
+aditi_modify(@var{PredOrFunc} @var{PredName}/@var{Arity}, @var{Closure}, @var{DB0}, @var{DB}).
+
+ at end example
+
+Modify tuples for which @samp{@var{Goal}} or @samp{@var{Closure}}.
+Tuples for which the modification goal fails are left unchanged.
+There must be a @w{@samp{:- pragma base_relation}} declaration for
+ at w{@samp{@var{PredOrFunc} @var{Name}/@var{Arity}}}.
+The original tuple is given by the first set of arguments, the
+updated tuple is given by the second set.
+
+For the third alternative @samp{@var{PredOrFunc}} must be either @samp{pred}
+or @samp{func}.
+
+When updating a predicate with type declaration
+ at w{@samp{:- pred p(aditi__state, @var{Type1}, @dots{})}}, @samp{@var{Closure}}
+must have type
+ at samp{aditi_top_down pred(aditi__state, @var{Type1}, @dots{}, aditi__state, @var{Type1}, @dots{})},
+and inst @w{@samp{pred(unused, in, @dots{}, unused, out, @dots{}) is semidet}}.
+
+When updating a function with type declaration
+ at w{@samp{:- func p(aditi__state, @var{Type1}, @dots{}) = @var{Type2}}},
+ at samp{@var{Closure}} must have type
+ at samp{aditi_top_down pred(aditi__state, @var{Type1}, @dots{}, @var{Type2}, aditi__state, @var{Type1}, @dots{}, @var{Type2})},
+and inst
+ at w{@samp{pred(unused, in, @dots{}, in, unused, out, @dots{}, out) is semidet}}.
+
+The @samp{aditi__state} arguments of @samp{@var{Closure}} must have
+mode @samp{unused} -- it is not possible to call an Aditi
+relation from the modification goal.
+
+If the construction of the lambda expression is in the same conjunction
+as the @samp{aditi_modify} call, the compiler may be able to do a better
+job of optimizing the modification using indexes.
+
+Examples:
+ at example
+ aditi_modify(
+ (p(_DB0, X, Y0) = p(_DB, X, Y) :-
+ X > 2, X < 5, Y = Y0 + 1
+ ), DB0, DB).
+
+ aditi_modify(
+ ((q(_DB0, X) = Y0) = (q(_DB, X) = Y) :-
+ X > 2, X < 5, Y = Y0 + 1
+ ), DB0, DB).
+
+ ModifyP = (aditi_top_down pred(_::unused, X::in, Y0::in,
+ _::unused, X::out, Y::out) is semidet :-
+ X > 2, X < 5, Y = Y0 + 1
+ ),
+ aditi_modify(pred p/3, ModifyP, DB0, DB).
+
+ ModifyQ = (aditi_top_down pred(_::unused, X::in, Y0::in,
+ _::unused, X::out, Y::out) is semidet :-
+ X > 2, X < 5, Y = Y0 + 1
+ ),
+ aditi_modify(func q/2, ModifyQ, DB0, DB).
+ at end example
@node Aditi glossary
@subsubsection Aditi glossary
Index: library/ops.m
===================================================================
RCS file: /home/staff/zs/imp/mercury/library/ops.m,v
retrieving revision 1.23
diff -u -u -r1.23 ops.m
--- ops.m 1998/03/03 17:26:02 1.23
+++ ops.m 1999/05/23 23:48:45
@@ -165,6 +165,8 @@
ops__op_table("\\=", after, xfx, 700). % standard ISO Prolog
ops__op_table("\\==", after, xfx, 700). % standard ISO Prolog (*)
ops__op_table("^", after, xfy, 200). % standard ISO Prolog
+ops__op_table("aditi_bottom_up", before, fx, 500). % Mercury extension
+ops__op_table("aditi_top_down", before, fx, 500). % Mercury extension
ops__op_table("all", before, fxy, 950). % Mercury/NU-Prolog extension
ops__op_table("and", after, xfy, 720). % NU-Prolog extension
ops__op_table("div", after, yfx, 400). % standard ISO Prolog
Index: tests/invalid/aditi.m
===================================================================
RCS file: aditi.m
diff -N aditi.m
--- /dev/null Sat Jun 5 14:25:53 1999
+++ aditi.m Thu Jun 3 12:18:06 1999
@@ -0,0 +1,13 @@
+:- module aditi.
+
+:- interface.
+
+:- type aditi__state.
+:- mode aditi_di :: in.
+:- mode aditi_uo :: out.
+:- mode aditi_ui :: in.
+
+:- implementation.
+
+:- type aditi__state ---> aditi__state.
+
Index: tests/invalid/aditi_update_errors.err_exp
===================================================================
RCS file: aditi_update_errors.err_exp
diff -N aditi_update_errors.err_exp
--- /dev/null Sat Jun 5 14:25:53 1999
+++ aditi_update_errors.err_exp Fri Jun 4 11:54:16 1999
@@ -0,0 +1,210 @@
+aditi_update_errors.m:112: Error: wrong number of arguments (5; should be 3 or 4)
+aditi_update_errors.m:112: in call to predicate `aditi_modify'.
+aditi_update_errors.m:111: Error: expected
+aditi_update_errors.m:111: `aditi_modify(
+aditi_update_errors.m:111: (p(<Args0>) = p(<Args>) :- <Goal>),
+aditi_update_errors.m:111: DB0, DB)'
+aditi_update_errors.m:111: or `aditi_modify(PredOrFunc p/N, Closure, DB0, DB)'.
+aditi_update_errors.m:102: Error: wrong number of arguments (5; should be 3 or 4)
+aditi_update_errors.m:102: in call to predicate `aditi_modify'.
+aditi_update_errors.m:101: Error: expected
+aditi_update_errors.m:101: `aditi_modify(
+aditi_update_errors.m:101: (p(<Args0>) = p(<Args>) :- <Goal>),
+aditi_update_errors.m:101: DB0, DB)'
+aditi_update_errors.m:101: or `aditi_modify(PredOrFunc p/N, Closure, DB0, DB)'.
+aditi_update_errors.m:092: Error: expected
+aditi_update_errors.m:092: `aditi_modify(
+aditi_update_errors.m:092: (p(<Args0>) = p(<Args>) :- <Goal>),
+aditi_update_errors.m:092: DB0, DB)'
+aditi_update_errors.m:092: or `aditi_modify(PredOrFunc p/N, Closure, DB0, DB)'.
+aditi_update_errors.m:088: Error: wrong number of arguments (5; should be 4)
+aditi_update_errors.m:088: in call to predicate `aditi_bulk_delete'.
+aditi_update_errors.m:087: Error: expected `PredOrFunc Name/Arity' in call to `aditi_bulk_delete'.
+aditi_update_errors.m:078: Error: wrong number of arguments (5; should be 4)
+aditi_update_errors.m:078: in call to predicate `aditi_bulk_delete'.
+aditi_update_errors.m:077: Error: expected `PredOrFunc Name/Arity' in call to `aditi_bulk_insert'.
+aditi_update_errors.m:069: Error: expected `aditi_delete((p(<Args>) :- <Goal>), DB0, DB)'
+aditi_update_errors.m:069: or `aditi_delete(PredOrFunc p/N, Closure, DB0, DB)'.
+aditi_update_errors.m:064: Error: expected `aditi_delete((p(<Args>) :- <Goal>), DB0, DB)'
+aditi_update_errors.m:064: or `aditi_delete(PredOrFunc p/N, Closure, DB0, DB)'.
+aditi_update_errors.m:058: Error: expected `aditi_delete((p(<Args>) :- <Goal>), DB0, DB)'
+aditi_update_errors.m:058: or `aditi_delete(PredOrFunc p/N, Closure, DB0, DB)'.
+aditi_update_errors.m:057: Error: expected `aditi_delete((p(<Args>) :- <Goal>), DB0, DB)'
+aditi_update_errors.m:057: or `aditi_delete(PredOrFunc p/N, Closure, DB0, DB)'.
+aditi_update_errors.m:055: Error: wrong number of arguments (4; should be 3)
+aditi_update_errors.m:055: in call to predicate `aditi_insert'.
+aditi_update_errors.m:054: Error: wrong number of arguments (4; should be 3)
+aditi_update_errors.m:054: in call to predicate `aditi_insert'.
+aditi_update_errors.m:052: "Error: expected tuple to insert in call to `aditi_insert\'\n"aditi_update_errors.m:094: In clause for predicate `aditi_update_errors:aditi_update_syntax/2':
+aditi_update_errors.m:094: warning: variable `X' has overlapping scopes.
+aditi_update_errors.m:104: In clause for predicate `aditi_update_errors:aditi_update_syntax/2':
+aditi_update_errors.m:104: warning: variable `X' has overlapping scopes.
+aditi_update_errors.m:206: In clause for predicate `aditi_update_errors:aditi_update_modes4/2':
+aditi_update_errors.m:206: warning: variable `X' occurs only once in this scope.
+aditi_update_errors.m:209: In clause for predicate `aditi_update_errors:aditi_update_modes5/2':
+aditi_update_errors.m:209: warning: variable `X' occurs only once in this scope.
+aditi_update_errors.m:246: In clause for predicate `aditi_update_errors:aditi_update_modes10/2':
+aditi_update_errors.m:246: warning: variable `X0' occurs only once in this scope.
+aditi_update_errors.m:249: In clause for predicate `aditi_update_errors:aditi_update_modes11/2':
+aditi_update_errors.m:249: warning: variable `X0' occurs only once in this scope.
+aditi_update_errors.m:007: Error: no clauses for predicate `aditi_update_errors:aditi_update_syntax/2'
+aditi_update_errors.m:115: In clause for predicate `aditi_update_errors:aditi_update_types/2':
+aditi_update_errors.m:115: error: wrong number of arguments (2; should be 3)
+aditi_update_errors.m:115: in call to predicate `p'.
+aditi_update_errors.m:116: In clause for predicate `aditi_update_errors:aditi_update_types/2':
+aditi_update_errors.m:116: error: undefined predicate `q/2'.
+aditi_update_errors.m:116: (There is a *function* with that name, however.
+aditi_update_errors.m:116: Perhaps you forgot to add ` = ...'?)
+aditi_update_errors.m:117: In clause for predicate `aditi_update_errors:aditi_update_types/2':
+aditi_update_errors.m:117: error: wrong number of arguments (1; should be 2)
+aditi_update_errors.m:117: in call to function `q'.
+aditi_update_errors.m:118: In clause for predicate `aditi_update_errors:aditi_update_types/2':
+aditi_update_errors.m:118: in argument 2 of call to `aditi_insert' of predicate `p/3':
+aditi_update_errors.m:118: type error: argument has type `int',
+aditi_update_errors.m:118: expected type was `(aditi:state)'.
+aditi_update_errors.m:120: In clause for predicate `aditi_update_errors:aditi_update_types/2':
+aditi_update_errors.m:120: in argument 2 of call to predicate `</2':
+aditi_update_errors.m:120: type error: argument has type `float',
+aditi_update_errors.m:120: expected type was `int'.
+aditi_update_errors.m:121: In clause for predicate `aditi_update_errors:aditi_update_types/2':
+aditi_update_errors.m:121: in argument 2 of call to predicate `</2':
+aditi_update_errors.m:121: type error: argument has type `float',
+aditi_update_errors.m:121: expected type was `int'.
+aditi_update_errors.m:123: In clause for predicate `aditi_update_errors:aditi_update_types/2':
+aditi_update_errors.m:123: in argument 2 of call to predicate `</2':
+aditi_update_errors.m:123: type error: argument has type `float',
+aditi_update_errors.m:123: expected type was `int'.
+aditi_update_errors.m:123: In clause for predicate `aditi_update_errors:aditi_update_types/2':
+aditi_update_errors.m:123: error: wrong number of arguments (2; should be 3)
+aditi_update_errors.m:123: in call to predicate `p'.
+aditi_update_errors.m:124: In clause for predicate `aditi_update_errors:aditi_update_types/2':
+aditi_update_errors.m:124: error: wrong number of arguments (1; should be 2)
+aditi_update_errors.m:124: in call to function `q'.
+aditi_update_errors.m:130: In clause for predicate `aditi_update_errors:aditi_update_types/2':
+aditi_update_errors.m:130: in argument 2 of call to `aditi_delete' of predicate `p/3':
+aditi_update_errors.m:130: type error: variable `DeleteP' has type `(aditi_top_down pred(V_10, int))',
+aditi_update_errors.m:130: expected type was `(aditi_top_down pred((aditi:state), int, int))'.
+aditi_update_errors.m:131: In clause for predicate `aditi_update_errors:aditi_update_types/2':
+aditi_update_errors.m:131: error: undefined predicate `q/2'.
+aditi_update_errors.m:131: (There is a *function* with that name, however.
+aditi_update_errors.m:131: Perhaps you forgot to add ` = ...'?)
+aditi_update_errors.m:136: In clause for predicate `aditi_update_errors:aditi_update_types/2':
+aditi_update_errors.m:136: in argument 2 of call to `aditi_delete' of function `q/2':
+aditi_update_errors.m:136: type error: variable `DeleteQ' has type `((aditi_top_down (func V_12)) = int)',
+aditi_update_errors.m:136: expected type was `((aditi_top_down func((aditi:state), int)) = int)'.
+aditi_update_errors.m:137: In clause for predicate `aditi_update_errors:aditi_update_types/2':
+aditi_update_errors.m:137: error: undefined function `p/3'.
+aditi_update_errors.m:137: (There is a *predicate* with that name, however.)
+aditi_update_errors.m:142: In clause for predicate `aditi_update_errors:aditi_update_types/2':
+aditi_update_errors.m:142: in argument 2 of call to `aditi_delete' of function `q/2':
+aditi_update_errors.m:142: type error: variable `DeleteQ2' has type `((func V_14) = int)',
+aditi_update_errors.m:142: expected type was `((aditi_top_down func((aditi:state), int)) = int)'.
+aditi_update_errors.m:150: In clause for predicate `aditi_update_errors:aditi_update_types/2':
+aditi_update_errors.m:150: error: wrong number of arguments (4; should be 3)
+aditi_update_errors.m:150: in call to predicate `p'.
+aditi_update_errors.m:151: In clause for predicate `aditi_update_errors:aditi_update_types/2':
+aditi_update_errors.m:151: in argument 2 of call to `aditi_bulk_insert' of predicate `p/3':
+aditi_update_errors.m:151: type error: variable `InsertP' has type `(aditi_bottom_up pred(V_16, int, float))',
+aditi_update_errors.m:151: expected type was `(aditi_bottom_up pred((aditi:state), int, int))'.
+aditi_update_errors.m:152: In clause for predicate `aditi_update_errors:aditi_update_types/2':
+aditi_update_errors.m:152: error: undefined predicate `q/2'.
+aditi_update_errors.m:152: (There is a *function* with that name, however.
+aditi_update_errors.m:152: Perhaps you forgot to add ` = ...'?)
+aditi_update_errors.m:160: In clause for predicate `aditi_update_errors:aditi_update_types/2':
+aditi_update_errors.m:160: in argument 2 of call to `aditi_bulk_insert' of predicate `p/3':
+aditi_update_errors.m:160: type error: variable `InsertP2' has type `pred(V_19, int, float)',
+aditi_update_errors.m:160: expected type was `(aditi_bottom_up pred((aditi:state), int, int))'.
+aditi_update_errors.m:170: In clause for predicate `aditi_update_errors:aditi_update_types/2':
+aditi_update_errors.m:170: error: undefined predicate `q/2'.
+aditi_update_errors.m:170: (There is a *function* with that name, however.
+aditi_update_errors.m:170: Perhaps you forgot to add ` = ...'?)
+aditi_update_errors.m:173: In clause for predicate `aditi_update_errors:aditi_update_types/2':
+aditi_update_errors.m:173: in argument 1 of call to `aditi_modify' of predicate `p/3':
+aditi_update_errors.m:173: type error: argument has type `(aditi_top_down pred(int, int, V_27, int, int, V_30))',
+aditi_update_errors.m:173: expected type was `(aditi_top_down pred((aditi:state), int, int, (aditi:state), int, int))'.
+aditi_update_errors.m:174: In clause for predicate `aditi_update_errors:aditi_update_types/2':
+aditi_update_errors.m:174: error: wrong number of arguments (1; should be 2)
+aditi_update_errors.m:174: in call to function `q'.
+aditi_update_errors.m:175: In clause for predicate `aditi_update_errors:aditi_update_types/2':
+aditi_update_errors.m:175: error: undefined predicate `q/3'.
+aditi_update_errors.m:175: (There is a *function* with that name, however.
+aditi_update_errors.m:175: Perhaps you forgot to add ` = ...'?)
+aditi_update_errors.m:181: In clause for predicate `aditi_update_errors:aditi_update_types/2':
+aditi_update_errors.m:181: in unification of variable `X'
+aditi_update_errors.m:181: and term `(X0 + Y0)':
+aditi_update_errors.m:181: type error in argument(s) of functor `+/2'.
+aditi_update_errors.m:181: Argument 1 (X0) has type `float',
+aditi_update_errors.m:181: expected type was `int';
+aditi_update_errors.m:181: argument 2 (Y0) has type `V_43',
+aditi_update_errors.m:181: expected type was `int'.
+aditi_update_errors.m:182: In clause for predicate `aditi_update_errors:aditi_update_types/2':
+aditi_update_errors.m:182: in unification of variable `Y'
+aditi_update_errors.m:182: and term `(X0 - Y0)':
+aditi_update_errors.m:182: type error in argument(s) of functor `-/2'.
+aditi_update_errors.m:182: Argument 1 (X0) has type `float',
+aditi_update_errors.m:182: expected type was `int';
+aditi_update_errors.m:182: argument 2 (Y0) has type `V_43',
+aditi_update_errors.m:182: expected type was `int'.
+aditi_update_errors.m:184: In clause for predicate `aditi_update_errors:aditi_update_types/2':
+aditi_update_errors.m:184: in argument 2 of call to `aditi_modify' of predicate `p/3':
+aditi_update_errors.m:184: type error: variable `ModifyP' has type `(aditi_top_down pred(V_41, float, V_43, V_44, V_45, V_46))',
+aditi_update_errors.m:184: expected type was `(aditi_top_down pred((aditi:state), int, int, (aditi:state), int, int))'.
+aditi_update_errors.m:193: In clause for predicate `aditi_update_errors:aditi_update_types/2':
+aditi_update_errors.m:193: in argument 2 of call to `aditi_modify' of function `q/2':
+aditi_update_errors.m:193: type error: variable `ModifyQ' has type `((aditi_top_down func(V_47, int, int, V_50, int)) = int)',
+aditi_update_errors.m:193: expected type was `(aditi_top_down pred((aditi:state), int, int, (aditi:state), int, int))'.
+aditi_update_errors.m:197: In clause for `aditi_update_modes1((aditi:aditi_di), (aditi:aditi_uo))':
+aditi_update_errors.m:197: in argument 2 of the inserted tuple of call to `aditi_insert' of predicate `p/3':
+aditi_update_errors.m:197: mode error: variable `V_4' has instantiatedness `free',
+aditi_update_errors.m:197: expected instantiatedness was `ground'.
+aditi_update_errors.m:200: In clause for `aditi_update_modes2((aditi:aditi_di), (aditi:aditi_uo))':
+aditi_update_errors.m:200: in argument 2 of the inserted tuple of call to `aditi_insert' of function `q/2':
+aditi_update_errors.m:200: mode error: variable `V_4' has instantiatedness `free',
+aditi_update_errors.m:200: expected instantiatedness was `ground'.
+aditi_update_errors.m:203: In clause for `aditi_update_modes3((aditi:aditi_di), (aditi:aditi_uo))':
+aditi_update_errors.m:203: in argument 2 of call to `aditi_insert' of predicate `p/3':
+aditi_update_errors.m:203: mode error: variable `V_4' has instantiatedness `free',
+aditi_update_errors.m:203: expected instantiatedness was `ground'.
+aditi_update_errors.m:206: In clause for `aditi_update_modes4((aditi:aditi_di), (aditi:aditi_uo))':
+aditi_update_errors.m:206: in argument 1 of call to predicate `int:</2':
+aditi_update_errors.m:206: mode error: variable `X' has instantiatedness `free',
+aditi_update_errors.m:206: expected instantiatedness was `ground'.
+aditi_update_errors.m:209: In clause for `aditi_update_modes5((aditi:aditi_di), (aditi:aditi_uo))':
+aditi_update_errors.m:209: in argument 1 of call to predicate `int:</2':
+aditi_update_errors.m:209: mode error: variable `X' has instantiatedness `free',
+aditi_update_errors.m:209: expected instantiatedness was `ground'.
+aditi_update_errors.m:216: In clause for `aditi_update_modes6((aditi:aditi_di), (aditi:aditi_uo))':
+aditi_update_errors.m:216: in argument 2 of call to `aditi_delete' of predicate `p/3':
+aditi_update_errors.m:216: mode error: variable `DeleteP' has instantiatedness `/* unique */(pred((free -> free), (free -> ground), (ground -> ground)) is semidet)',
+aditi_update_errors.m:216: expected instantiatedness was `(pred((free -> free), in, in) is semidet)'.
+aditi_update_errors.m:222: In clause for `aditi_update_modes7((aditi:aditi_di), (aditi:aditi_uo))':
+aditi_update_errors.m:222: in argument 2 of call to `aditi_delete' of function `q/2':
+aditi_update_errors.m:222: mode error: variable `DeleteQ' has instantiatedness `/* unique */(func((free -> free), (free -> ground)) = (ground -> ground) is semidet)',
+aditi_update_errors.m:222: expected instantiatedness was `(func((free -> free), in) = in is semidet)'.
+aditi_update_errors.m:231: In clause for `aditi_update_modes8((aditi:aditi_di), (aditi:aditi_uo))':
+aditi_update_errors.m:231: in argument 2 of call to `aditi_bulk_insert' of predicate `p/3':
+aditi_update_errors.m:231: mode error: variable `InsertP' has instantiatedness `/* unique */(pred(((aditi:aditi_unique) -> (aditi:aditi_unique)), (ground -> ground), (free -> ground)) is nondet)',
+aditi_update_errors.m:231: expected instantiatedness was `(pred(in, out, out) is nondet)'.
+aditi_update_errors.m:242: In clause for `aditi_update_modes9((aditi:aditi_di), (aditi:aditi_uo))':
+aditi_update_errors.m:242: in argument 2 of call to `aditi_bulk_insert' of function `q/2':
+aditi_update_errors.m:242: mode error: variable `InsertQ' has instantiatedness `/* unique */(func(((aditi:aditi_unique) -> (aditi:aditi_unique)), (ground -> ground)) = (free -> ground) is nondet)',
+aditi_update_errors.m:242: expected instantiatedness was `(func(in, out) = out is nondet)'.
+aditi_update_errors.m:246: In clause for `aditi_update_modes10((aditi:aditi_di), (aditi:aditi_uo))':
+aditi_update_errors.m:246: in call to function `int:+/2':
+aditi_update_errors.m:246: mode error: arguments `X0, V_12, V_10'
+aditi_update_errors.m:246: have insts `free, unique(1), free',
+aditi_update_errors.m:246: which does not match any of the modes for function `int:+/2'.
+aditi_update_errors.m:249: In clause for `aditi_update_modes11((aditi:aditi_di), (aditi:aditi_uo))':
+aditi_update_errors.m:249: in call to function `int:+/2':
+aditi_update_errors.m:249: mode error: arguments `X0, V_12, V_10'
+aditi_update_errors.m:249: have insts `free, unique(1), free',
+aditi_update_errors.m:249: which does not match any of the modes for function `int:+/2'.
+aditi_update_errors.m:259: In clause for `aditi_update_modes12((aditi:aditi_di), (aditi:aditi_uo))':
+aditi_update_errors.m:259: in argument 2 of call to `aditi_modify' of predicate `p/3':
+aditi_update_errors.m:259: mode error: variable `ModifyP' has instantiatedness `/* unique */(pred((free -> free), (free -> ground), (free -> ground), (free -> free), (ground -> ground), (ground -> ground)) is semidet)',
+aditi_update_errors.m:259: expected instantiatedness was `(pred((free -> free), in, in, (free -> free), out, out) is semidet)'.
+aditi_update_errors.m:269: In clause for `aditi_update_modes13((aditi:aditi_di), (aditi:aditi_uo))':
+aditi_update_errors.m:269: in argument 2 of call to `aditi_modify' of function `q/2':
+aditi_update_errors.m:269: mode error: variable `ModifyQ' has instantiatedness `/* unique */(pred((free -> free), (ground -> ground), (ground -> ground), (free -> free), (ground -> ground), (ground -> ground)) is semidet)',
+aditi_update_errors.m:269: expected instantiatedness was `(pred((free -> free), in, in, (free -> free), out, out) is semidet)'.
+For more information, try recompiling with `-E'.
Index: tests/invalid/aditi_update_errors.m
===================================================================
RCS file: aditi_update_errors.m
diff -N aditi_update_errors.m
--- /dev/null Sat Jun 5 14:25:53 1999
+++ aditi_update_errors.m Thu Jun 3 14:49:26 1999
@@ -0,0 +1,270 @@
+:- module aditi_update_errors.
+
+:- interface.
+
+:- import_module aditi.
+
+:- pred aditi_update_syntax(aditi__state::aditi_di,
+ aditi__state::aditi_uo) is det.
+
+:- pred aditi_update_types(aditi__state::aditi_di,
+ aditi__state::aditi_uo) is det.
+
+:- pred aditi_update_modes1(aditi__state::aditi_di,
+ aditi__state::aditi_uo) is det.
+:- pred aditi_update_modes2(aditi__state::aditi_di,
+ aditi__state::aditi_uo) is det.
+:- pred aditi_update_modes3(aditi__state::aditi_di,
+ aditi__state::aditi_uo) is det.
+:- pred aditi_update_modes4(aditi__state::aditi_di,
+ aditi__state::aditi_uo) is det.
+:- pred aditi_update_modes5(aditi__state::aditi_di,
+ aditi__state::aditi_uo) is det.
+:- pred aditi_update_modes6(aditi__state::aditi_di,
+ aditi__state::aditi_uo) is det.
+:- pred aditi_update_modes7(aditi__state::aditi_di,
+ aditi__state::aditi_uo) is det.
+:- pred aditi_update_modes8(aditi__state::aditi_di,
+ aditi__state::aditi_uo) is det.
+:- pred aditi_update_modes9(aditi__state::aditi_di,
+ aditi__state::aditi_uo) is det.
+:- pred aditi_update_modes10(aditi__state::aditi_di,
+ aditi__state::aditi_uo) is det.
+:- pred aditi_update_modes11(aditi__state::aditi_di,
+ aditi__state::aditi_uo) is det.
+:- pred aditi_update_modes12(aditi__state::aditi_di,
+ aditi__state::aditi_uo) is det.
+:- pred aditi_update_modes13(aditi__state::aditi_di,
+ aditi__state::aditi_uo) is det.
+
+:- implementation.
+
+:- import_module int.
+
+:- pred p(aditi__state::aditi_ui, int::out, int::out) is nondet.
+:- pragma base_relation(p/3).
+
+:- func q(aditi__state::aditi_ui, int::out) = (int::out) is nondet.
+:- pragma base_relation(q/2).
+
+aditi_update_syntax -->
+ X = p(_, 1, 2),
+ aditi_insert(X),
+
+ aditi_insert(p(_, 1, 2), foo),
+ aditi_insert(q(_, 1) = 2, foo),
+
+ aditi_delete(p(_, X, _Y) :- X < 2, foo),
+ aditi_delete(q(_, X) = _Y :- X < 2, foo),
+
+ { DeleteP =
+ (aditi_top_down pred(_::unused, 1::in, 2::in) is semidet :-
+ true
+ ) },
+ aditi_delete(p/3, DeleteP),
+
+ { DeleteQ =
+ (aditi_top_down func(_::unused, 1::in) = (2::in) is semidet)
+ },
+ aditi_delete(q/2, DeleteQ),
+
+ { InsertP =
+ (aditi_bottom_up pred(_::aditi_ui, A1::out, A2::out) is nondet :-
+ ( A1 = 1, A2 = 2
+ ; A1 = 2, A2 = 3
+ )
+ ) },
+ aditi_bulk_insert(p/3, InsertP),
+ aditi_bulk_delete(pred p/3, InsertP, foo),
+
+ { InsertQ =
+ (aditi_bottom_up func(_::aditi_ui, A1::out)
+ = (A2::out) is nondet :-
+ ( A1 = 1, A2 = 2
+ ; A1 = 2, A2 = 3
+ )
+ ) },
+ aditi_bulk_delete(q/2, InsertQ),
+ aditi_bulk_delete(func q/2, InsertQ, foo),
+
+ aditi_modify(p(_, X0, Y0) = p(_, X0 + 1, Y0 + 1)),
+ aditi_modify((q(_, X0) = Y0) = (q(_, X0 + 1) = (Y0 + 1))),
+ aditi_modify(q(_, _X0) = _Y0),
+
+ { ModifyP =
+ (aditi_top_down pred(_::unused, X0::in, Y0::in,
+ _::unused, X::out, Y::out) is semidet :-
+ X0 = 1,
+ X = X0 + Y0,
+ Y = X0 - Y0
+ ) },
+ aditi_modify(p/3, ModifyP),
+ aditi_modify(pred p/3, ModifyP, foo),
+
+ { ModifyQ =
+ (aditi_top_down pred(_::unused, X0::in, Y0::in,
+ _::unused, X::out, Y::out) is semidet :-
+ X0 = 1,
+ X = X0 + Y0,
+ Y = X0 - Y0
+ ) },
+ aditi_modify(q/2, ModifyQ),
+ aditi_modify(func q/2, ModifyQ, foo).
+
+aditi_update_types -->
+ aditi_insert(p(_, 1)),
+ aditi_insert(q(_, 1)),
+ aditi_insert(q(_) = 2),
+ { aditi_insert(p(_, 1, 2), 1, _) },
+
+ aditi_delete(p(_, X, _Y) :- X < 2.0),
+ aditi_delete(q(_, X) = _Y :- X < 2.0),
+
+ aditi_delete(p(_, X) :- X < 2.0),
+ aditi_delete(q(_) = Y :- Y < 2),
+
+ { DeleteP =
+ (aditi_top_down pred(_::unused, 2::in) is semidet :-
+ true
+ ) },
+ aditi_delete(pred p/3, DeleteP),
+ aditi_delete(pred q/2, DeleteP),
+
+ { DeleteQ =
+ (aditi_top_down func(_::unused) = (2::in) is semidet)
+ },
+ aditi_delete(func q/2, DeleteQ),
+ aditi_delete(func p/3, DeleteQ),
+
+ { DeleteQ2 =
+ (func(_::unused) = (2::in) is semidet)
+ },
+ aditi_delete(func q/2, DeleteQ2),
+
+ { InsertP =
+ (aditi_bottom_up pred(_::aditi_ui, A1::out, A2::out) is nondet :-
+ ( A1 = 1, A2 = 2.0
+ ; A1 = 2, A2 = 3.0
+ )
+ ) },
+ aditi_bulk_insert(pred p/4, InsertP),
+ aditi_bulk_insert(pred p/3, InsertP),
+ aditi_bulk_delete(pred q/2, InsertP),
+
+ { InsertP2 =
+ (pred(_::aditi_ui, A1::out, A2::out) is nondet :-
+ ( A1 = 1, A2 = 2.0
+ ; A1 = 2, A2 = 3.0
+ )
+ ) },
+ aditi_bulk_insert(pred p/3, InsertP2),
+
+ { InsertQ =
+ (aditi_bottom_up func(_::aditi_ui, A1::out)
+ = (A2::out) is nondet :-
+ ( A1 = 1, A2 = 2
+ ; A1 = 2, A2 = 3
+ )
+ ) },
+ aditi_bulk_insert(func q/2, InsertQ),
+ aditi_bulk_insert(pred q/2, InsertQ),
+ aditi_bulk_delete(func q/2, InsertQ),
+
+ aditi_modify(p(X0, Y0, _) = p(X0 + 1, Y0 + 1, _)),
+ aditi_modify((q(_) = Y0) = (q(_) = (Y0 + 1))),
+ aditi_modify(q(_, X0, Y0) = q(_, X0 + 1, Y0 + 1)),
+
+ { ModifyP =
+ (aditi_top_down pred(_::unused, X0::in, Y0::in,
+ _::unused, X::out, Y::out) is semidet :-
+ X0 = 1.0,
+ X = X0 + Y0,
+ Y = X0 - Y0
+ ) },
+ aditi_modify(pred p/3, ModifyP),
+
+ { ModifyQ =
+ (aditi_top_down func(_::unused, X0::in, Y0::in,
+ _::unused, X::out) = (Y::out) is semidet :-
+ X0 = 1,
+ X = X0 + Y0,
+ Y = X0 - Y0
+ ) },
+ aditi_modify(func q/2, ModifyQ).
+
+
+aditi_update_modes1 -->
+ aditi_insert(p(_, _, 2)).
+
+aditi_update_modes2 -->
+ aditi_insert(q(_, _) = 2).
+
+aditi_update_modes3 -->
+ { aditi_insert(p(_, 1, 2), _, _) }.
+
+aditi_update_modes4 -->
+ aditi_delete(p(_, _X, _Y) :- X < 2).
+
+aditi_update_modes5 -->
+ aditi_delete(q(_, _X) = _Y :- X < 2).
+
+aditi_update_modes6 -->
+ { DeleteP =
+ (aditi_top_down pred(_::unused, 1::out, 2::in) is semidet :-
+ true
+ ) },
+ aditi_delete(pred p/3, DeleteP).
+
+aditi_update_modes7 -->
+ { DeleteQ =
+ (aditi_top_down func(_::unused, 1::out) = (2::in) is semidet)
+ },
+ aditi_delete(func q/2, DeleteQ).
+
+aditi_update_modes8 -->
+ { InsertP =
+ (aditi_bottom_up pred(_::aditi_ui, A1::in, A2::out) is nondet :-
+ ( A1 = 1, A2 = 2
+ ; A1 = 2, A2 = 3
+ )
+ ) },
+ aditi_bulk_insert(pred p/3, InsertP),
+ aditi_bulk_delete(pred p/3, InsertP).
+
+aditi_update_modes9 -->
+ { InsertQ =
+ (aditi_bottom_up func(_::aditi_ui, A1::in)
+ = (A2::out) is nondet :-
+ ( A1 = 1, A2 = 2
+ ; A1 = 2, A2 = 3
+ )
+ ) },
+ aditi_bulk_insert(func q/2, InsertQ),
+ aditi_bulk_delete(func q/2, InsertQ).
+
+aditi_update_modes10 -->
+ aditi_modify(p(_, _X0, Y0) = p(_, X0 + 1, Y0 + 1)).
+
+aditi_update_modes11 -->
+ aditi_modify((q(_, _X0) = Y0) = (q(_, X0 + 1) = (Y0 + 1))).
+
+aditi_update_modes12 -->
+ { ModifyP =
+ (aditi_top_down pred(_::unused, X0::out, Y0::out,
+ _::unused, X::in, Y::in) is semidet :-
+ X0 = 1,
+ X = X0 + Y0,
+ Y = X0 - Y0
+ ) },
+ aditi_modify(pred p/3, ModifyP).
+
+aditi_update_modes13 -->
+ { ModifyQ =
+ (aditi_top_down pred(_::unused, X0::in, Y0::in,
+ _::unused, X::in, Y::in) is semidet :-
+ X0 = 1,
+ X = X0 + Y0,
+ Y = X0 - Y0
+ ) },
+ aditi_modify(func q/2, ModifyQ).
+
Index: tests/invalid/errors2.err_exp
===================================================================
RCS file: /home/staff/zs/imp/tests/invalid/errors2.err_exp,v
retrieving revision 1.7
diff -u -u -r1.7 errors2.err_exp
--- errors2.err_exp 1999/03/05 13:09:35 1.7
+++ errors2.err_exp 1999/05/21 09:43:08
@@ -15,7 +15,7 @@
errors2.m:023: Error: no clauses for predicate `errors2:produce_string/1'
errors2.m:025: Error: no clauses for predicate `errors2:expect_int/1'
errors2.m:031: In clause for predicate `errors2:type_error/0':
-errors2.m:031: in argument 1 of call to pred `expect_int/1':
+errors2.m:031: in argument 1 of call to predicate `expect_int/1':
errors2.m:031: type error: variable `X' has type `string',
errors2.m:031: expected type was `int'.
errors2.m:037: In clause for predicate `errors2:type_error_2/0':
@@ -24,7 +24,7 @@
errors2.m:037: `X' has type `string',
errors2.m:037: `Y' has type `int'.
errors2.m:043: In clause for predicate `errors2:type_error_3/0':
-errors2.m:043: in argument 1 of call to pred `expect_int/1':
+errors2.m:043: in argument 1 of call to predicate `expect_int/1':
errors2.m:043: type error: variable `Y' has type `string',
errors2.m:043: expected type was `int'.
errors2.m:052: In clause for predicate `errors2:type_error_4/0':
@@ -46,7 +46,7 @@
errors2.m:065: argument has type `string',
errors2.m:065: constant `1.00000000000000' has type `float'.
errors2.m:072: In clause for predicate `errors2:type_error_7/0':
-errors2.m:072: in argument 1 of call to pred `expect_int/1':
+errors2.m:072: in argument 1 of call to predicate `expect_int/1':
errors2.m:072: type error: variable `C' has type `string',
errors2.m:072: expected type was `int'.
errors2.m:078: In clause for predicate `errors2:type_error_8/0':
Index: tests/invalid/ext_type_bug.err_exp
===================================================================
RCS file: /home/staff/zs/imp/tests/invalid/ext_type_bug.err_exp,v
retrieving revision 1.1
diff -u -u -r1.1 ext_type_bug.err_exp
--- ext_type_bug.err_exp 1998/10/01 06:46:05 1.1
+++ ext_type_bug.err_exp 1999/05/21 09:43:09
@@ -1,5 +1,5 @@
ext_type_bug.m:011: In clause for predicate `ext_type_bug:foo/1':
-ext_type_bug.m:011: in argument 1 of call to pred `make_bar/1':
+ext_type_bug.m:011: in argument 1 of call to predicate `make_bar/1':
ext_type_bug.m:011: type error: variable `Bar' has type `(ext_type_bug:bar(int))',
ext_type_bug.m:011: expected type was `(ext_type_bug:bar(T))'.
For more information, try recompiling with `-E'.
Index: tests/invalid/ho_type_mode_bug.err_exp
===================================================================
RCS file: /home/staff/zs/imp/tests/invalid/ho_type_mode_bug.err_exp,v
retrieving revision 1.1
diff -u -u -r1.1 ho_type_mode_bug.err_exp
--- ho_type_mode_bug.err_exp 1997/06/16 08:55:31 1.1
+++ ho_type_mode_bug.err_exp 1999/05/21 09:43:11
@@ -1,11 +1,9 @@
ho_type_mode_bug.m:025: In clause for `my_foldl2((pred(in, in, out) is det), in, in, out, in, out)':
-ho_type_mode_bug.m:025: in argument 1 of higher-order predicate call
-ho_type_mode_bug.m:025: (i.e. in the predicate term):
+ho_type_mode_bug.m:025: in argument 1 (i.e. the predicate term) of call to predicate `call/6':
ho_type_mode_bug.m:025: mode error: variable `P' has instantiatedness `(pred(in, in, out) is det)',
ho_type_mode_bug.m:025: expecting higher-order pred inst (of arity 5).
ho_type_mode_bug.m:025: In clause for `my_foldl2((pred(in, in, out) is det), in, in, out, di, uo)':
-ho_type_mode_bug.m:025: in argument 1 of higher-order predicate call
-ho_type_mode_bug.m:025: (i.e. in the predicate term):
+ho_type_mode_bug.m:025: in argument 1 (i.e. the predicate term) of call to predicate `call/6':
ho_type_mode_bug.m:025: mode error: variable `P' has instantiatedness `(pred(in, in, out) is det)',
ho_type_mode_bug.m:025: expecting higher-order pred inst (of arity 5).
For more information, try recompiling with `-E'.
Index: tests/invalid/types.err_exp
===================================================================
RCS file: /home/staff/zs/imp/tests/invalid/types.err_exp,v
retrieving revision 1.6
diff -u -u -r1.6 types.err_exp
--- types.err_exp 1999/03/05 13:09:36 1.6
+++ types.err_exp 1999/05/31 06:28:17
@@ -9,9 +9,12 @@
types.m:012: In clause for predicate `types:q/0':
types.m:012: error: undefined predicate `zzzzzzzz/0'.
types.m:013: In clause for predicate `types:q/0':
-types.m:013: in argument 1 of call to pred `p/1':
+types.m:013: in argument 1 of call to predicate `p/1':
types.m:013: type error: argument has type `int',
types.m:013: expected type was `(pred)'.
+types.m:014: In clause for predicate `types:q/0':
+types.m:014: error: wrong number of arguments (0; should be 1)
+types.m:014: in call to predicate `p'.
types.m:039: In clause for predicate `types:bar/1':
types.m:039: type error in unification of variable `X'
types.m:039: and constant `0'.
Index: tests/invalid/types.m
===================================================================
RCS file: /home/staff/zs/imp/tests/invalid/types.m,v
retrieving revision 1.2
diff -u -u -r1.2 types.m
--- types.m 1998/05/29 08:57:10 1.2
+++ types.m 1999/05/31 02:41:17
@@ -10,8 +10,8 @@
q :-
p(q),
zzzzzzzz,
- p(2).
-
+ p(2),
+ p.
r :-
Index: tests/valid/Mmakefile
===================================================================
RCS file: /home/staff/zs/imp/tests/valid/Mmakefile,v
retrieving revision 1.34
diff -u -u -r1.34 Mmakefile
--- Mmakefile 1999/04/20 11:48:50 1.34
+++ Mmakefile 1999/05/29 00:41:14
@@ -112,6 +112,10 @@
unused_args_test2.m \
vn_float.m
+# Code generation is not yet implemented for Aditi updates,
+# so don't attempt to compile to C.
+# aditi_update.m
+
# The mode system can't handle the following test cases yet:
# assoc_list.m
# determinism.m
@@ -141,7 +145,7 @@
SOURCES=$(SOURCES0) $(TRAIL_SOURCES)
endif
-DEPS = $(SOURCES:%.m=%.depend)
+DEPS = $(SOURCES:%.m=%.depend) aditi_update.depend
OBJS = $(SOURCES:%.m=$(os_subdir)%.o)
PROGS = $(SOURCES:%.m=%)
@@ -159,6 +163,7 @@
GRADEFLAGS-complex_failure = --use-trail
GRADEFLAGS-semi_fail_in_non_ite = --use-trail
+MCFLAGS-aditi_update = --aditi
MCFLAGS-compl_unify_bug = -O3
MCFLAGS-deforest_loop = -O3 --intermodule-optimization
MCFLAGS-deforest_rerun_det = -O3 --check-termination
@@ -166,6 +171,12 @@
MCFLAGS-explicit_quant = --halt-at-warn
MCFLAGS-higher_order_implied_mode = -O-1
MCFLAGS-inhibit_warn_test = --inhibit-warnings --halt-at-warn
+MCFLAGS-intermod_lambda = --intermodule-optimization
+MCFLAGS-intermod_lambda2 = --intermodule-optimization
+MCFLAGS-intermod_quote = --intermodule-optimization
+MCFLAGS-intermod_quote2 = --intermodule-optimization
+MCFLAGS-intermod_test = --intermodule-optimization
+MCFLAGS-intermod_test2 = --intermodule-optimization
MCFLAGS-livevals_seq = -O5 --opt-space
MCFLAGS-middle_rec_labels = --middle-rec --no-follow-vars
MCFLAGS-mostly_uniq_mode_inf = --infer-all
@@ -176,26 +187,7 @@
MCFLAGS-uniq_mode_inf_bug = --infer-all
MCFLAGS-vn_float = -O5
-# intermod_lambda.m needs inter-module optimization
-intermod_lambda.c:
- $(MCI) $(GRADEFLAGS) $(MCIFLAGS) intermod_lambda2.m
- $(MCOI) $(GRADEFLAGS) $(MCOIFLAGS) intermod_lambda2.m
- $(MCG) $(GRADEFLAGS) $(MCGFLAGS) --intermodule-optimization \
- intermod_lambda.m
-
-intermod_quote.c:
- $(MCI) $(GRADEFLAGS) $(MCIFLAGS) intermod_quote2.m
- $(MCOI) $(GRADEFLAGS) $(MCOIFLAGS) intermod_quote2.m
- $(MCG) $(GRADEFLAGS) $(MCGFLAGS) --intermodule-optimization \
- intermod_quote.m
-
-intermod_test.c:
- $(MCI) $(GRADEFLAGS) $(MCIFLAGS) intermod_test2.m
- $(MCOI) $(GRADEFLAGS) $(MCOIFLAGS) intermod_test2.m
- $(MCG) $(GRADEFLAGS) $(MCGFLAGS) --intermodule-optimization \
- intermod_test.m
-
-check: objs
+check: objs aditi_update.err
objs: $(OBJS)
Index: tests/valid/aditi.m
===================================================================
RCS file: aditi.m
diff -N aditi.m
--- /dev/null Sat Jun 5 14:25:53 1999
+++ aditi.m Mon May 24 10:32:57 1999
@@ -0,0 +1,13 @@
+:- module aditi.
+
+:- interface.
+
+:- type aditi__state.
+:- mode aditi_di :: in.
+:- mode aditi_uo :: out.
+:- mode aditi_ui :: in.
+
+:- implementation.
+
+:- type aditi__state ---> aditi__state.
+
Index: tests/valid/aditi_update.m
===================================================================
RCS file: aditi_update.m
diff -N aditi_update.m
--- /dev/null Sat Jun 5 14:25:53 1999
+++ aditi_update.m Mon May 31 12:53:55 1999
@@ -0,0 +1,75 @@
+:- module aditi_update.
+:- interface.
+
+:- import_module aditi.
+
+:- pred aditi_update(aditi__state::aditi_di, aditi__state::aditi_uo) is det.
+
+:- implementation.
+
+:- import_module int.
+
+:- pred p(aditi__state::aditi_ui, int::out, int::out) is nondet.
+:- pragma base_relation(p/3).
+
+:- func q(aditi__state::aditi_ui, int::out) = (int::out) is nondet.
+:- pragma base_relation(q/2).
+
+aditi_update -->
+ aditi_insert(p(_, 1, 2)),
+ aditi_insert(q(_, 1) = 2),
+
+ aditi_delete(p(_, X, _Y) :- X < 2),
+ aditi_delete(q(_, X) = _Y :- X < 2),
+
+ { DeleteP =
+ (aditi_top_down pred(_::unused, 1::in, 2::in) is semidet :-
+ true
+ ) },
+ aditi_delete(pred p/3, DeleteP),
+
+ { DeleteQ =
+ (aditi_top_down func(_::unused, 1::in) = (2::in) is semidet)
+ },
+ aditi_delete(func q/2, DeleteQ),
+
+ { InsertP =
+ (aditi_bottom_up pred(_::aditi_ui, A1::out, A2::out) is nondet :-
+ ( A1 = 1, A2 = 2
+ ; A1 = 2, A2 = 3
+ )
+ ) },
+ aditi_bulk_insert(pred p/3, InsertP),
+ aditi_bulk_delete(pred p/3, InsertP),
+
+ { InsertQ =
+ (aditi_bottom_up func(_::aditi_ui, A1::out)
+ = (A2::out) is nondet :-
+ ( A1 = 1, A2 = 2
+ ; A1 = 2, A2 = 3
+ )
+ ) },
+ aditi_bulk_insert(func q/2, InsertQ),
+ aditi_bulk_delete(func q/2, InsertQ),
+
+ aditi_modify(p(_, X0, Y0) = p(_, X0 + 1, Y0 + 1)),
+ aditi_modify((q(_, X0) = Y0) = (q(_, X0 + 1) = (Y0 + 1))),
+
+ { ModifyP =
+ (aditi_top_down pred(_::unused, X0::in, Y0::in,
+ _::unused, X::out, Y::out) is semidet :-
+ X0 = 1,
+ X = X0 + Y0,
+ Y = X0 - Y0
+ ) },
+ aditi_modify(pred p/3, ModifyP),
+
+ { ModifyQ =
+ (aditi_top_down pred(_::unused, X0::in, Y0::in,
+ _::unused, X::out, Y::out) is semidet :-
+ X0 = 1,
+ X = X0 + Y0,
+ Y = X0 - Y0
+ ) },
+ aditi_modify(func q/2, ModifyQ).
+
--------------------------------------------------------------------------
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