- Some unfolding of tuple goals towards getting -m2 Arachne to work.

This commit is contained in:
ccremers 2005-01-14 14:08:01 +00:00
parent b607b1e260
commit d5cdac84cc

View File

@ -1279,6 +1279,37 @@ termBindConsequences (Term t)
// Larger logical componentents
//------------------------------------------------------------------------
//! Selector to select the first tuple goal.
/**
* Basically to get rid of -m2 tuple goals.
* Nice iteration, I'd suppose
*/
Binding
select_tuple_goal()
{
List bl;
Binding tuplegoal;
bl = sys->bindings;
tuplegoal = NULL;
while (bl != NULL && tuplegoal == NULL)
{
Binding b;
b = (Binding) bl->data;
// Ignore done stuff
if (!b->done)
{
if (isTermTuple (b->term))
{
tuplegoal = b;
}
}
bl = bl->next;
}
return tuplegoal;
}
//! Goal selection
/**
* Selects the most constrained goal.
@ -2237,6 +2268,41 @@ iterate ()
{
Binding b;
// Are there any tuple goals?
b = select_tuple_goal();
if (b != NULL)
{
// Expand tuple goal
int count;
Term tt;
// Show this in output
if (sys->output == PROOF)
{
indentPrint ();
eprintf ("Expanding tuple goal ");
termPrint (b->term);
eprintf ("\n");
}
// mark as done for iteration
b->done = 1;
// simply adding will detect the tuple and add the new subgoals
count = goal_add (b->term, b->run_to, b->ev_to, b->level);
// iterate
flag = iterate ();
// undo
goal_remove_last (count);
b->done = 0;
}
else
{
// No tuple goals; good
Binding b;
/**
* Not pruned: count
*/
@ -2271,6 +2337,7 @@ iterate ()
flag = bind_goal (b);
}
}
}
else
{
// Pruned because of bound!