Debian Codegraph @

apps/tc/elpi/alias.elpi

raw
1 /* license: GNU Lesser General Public License Version 2.1 or later */
2 /* ------------------------------------------------------------------------- */
3
4 namespace tc {
5 pred alias i:term, o:term.
6
7 func replace-with-alias.aux list term -> list term, bool.
8 replace-with-alias.aux [] [] ff.
9 replace-with-alias.aux [X | Xs] [Y | Ys] B :-
10 replace-with-alias X Y B',
11 replace-with-alias.aux Xs Ys B'',
12 or B' B'' B.
13
14 % [replace-with-alias T T1 Changed] T1 is T where aliases are replaced
15 func replace-with-alias term -> term, bool.
16 replace-with-alias A Sol tt :- alias A Sol',
17 replace-with-alias Sol' Sol _.
18 replace-with-alias (app ToReplace) (app Sol) A :-
19 replace-with-alias.aux ToReplace Sol A.
20 replace-with-alias A A ff.
21 }