#[inline]
fn is_cyclic(&self, var_current: usize, var_next: usize) -> bool {
if self.heap[var_next].is_var() {
- var_current != var_next && self.current + 1 != var_current
- } else if self.heap[var_next].is_ref() {
- // the cell var_next in the second branch contains its original
- // value whether var_next is marked or unmarked, meaning the
- // is_compound check is well-founded in either case.
- self.heap[var_next].get_forwarding_bit()
+ !self.heap[var_next].get_forwarding_bit() && var_current != var_next
} else {
- false
+ self.heap[var_next].is_ref()
}
}
D=[C|_E],
A=[C|D].
+term4(A) :-
+ A=[B|C],
+ C=[C|B].
+
test("acyclic_term_1", (
L = [_Y,[M,B],B|M], acyclic_term(L)
)).
T = [[T, _], 1], \+ acyclic_term(T)
)).
+test("acyclic_term_27", (
+ T = str(A,A), acyclic_term(T)
+)).
+
+test("acyclic_term_28", (
+ T = str(A,A,A), acyclic_term(T)
+)).
+
+test("acyclic_term_29", (
+ A = s(B, d(Y)), Y = B, acyclic_term(A),
+ acyclic_term(B), acyclic_term(Y)
+)).
+
test("acyclic_term#2111_1", (
term1(A), \+ acyclic_term(A)
)).
term3(A), \+ acyclic_term(A)
)).
+test("acyclic_term#2111_4", (
+ term4(A), \+ acyclic_term(A)
+)).
+
test("acyclic_term#2113", (
A=[]*B,B=[]*B, \+ acyclic_term(A)
)).
A=B*B, acyclic_term(A)
)).
-test("acyclic_term_27", (
- T = str(A,A), acyclic_term(T)
-)).
-
-test("acyclic_term_28", (
- T = str(A,A,A), acyclic_term(T)
-)).
-
main :-
findall(test(Name, Goal), test(Name, Goal), Tests),
run_tests(Tests, Failed),