aboutsummaryrefslogtreecommitdiff
path: root/src/kompsos.adb
diff options
context:
space:
mode:
Diffstat (limited to 'src/kompsos.adb')
-rw-r--r--src/kompsos.adb35
1 files changed, 29 insertions, 6 deletions
diff --git a/src/kompsos.adb b/src/kompsos.adb
index 4a34b1b..ae7848d 100644
--- a/src/kompsos.adb
+++ b/src/kompsos.adb
@@ -209,6 +209,25 @@ package body Kompsos is
+ -- States --
+
+ function Lookup
+ (This : in State;
+ Key : in Variable;
+ Value : out Term'Class)
+ return Boolean is
+ begin
+ for Bind of This.Actual loop
+ if Bind.Key = Key then
+ Value := Term'Class (Bind.Elem);
+ return True;
+ end if;
+ end loop;
+ return False;
+ end Lookup;
+
+
+
-- Goal Graphs --
package Graph_Convert is new System.Address_To_Access_Conversions (Graph_Component);
@@ -550,11 +569,15 @@ package body Kompsos is
when Null_Term | Atom_Term =>
return This;
when Var_Term =>
- if Subst.Actual.Contains (This.Var) then
- return Subst.Actual.Element (This.Var).Resolve (Subst);
- else
- return This;
- end if;
+ declare
+ Bound_Term : Term;
+ begin
+ if Lookup (Subst, This.Var, Bound_Term) then
+ return Bound_Term.Resolve (Subst);
+ else
+ return This;
+ end if;
+ end;
when Pair_Term =>
return T (This.Left.Resolve (Subst), This.Right.Resolve (Subst));
end case;
@@ -568,7 +591,7 @@ package body Kompsos is
if Subst.Actual.Is_Empty then
return Empty_Term;
else
- return Subst.Actual.First_Element.Resolve (Subst);
+ return Subst.Actual.First_Element.Elem.Resolve (Subst);
end if;
end Resolve_First;