(0) Obligation:
Clauses:
flatten(atom(X), Y) :- ','(!, eq(Y, .(X, []))).
flatten(L, Y) :- ','(head(L, atom(H)), ','(!, ','(eq(Y, .(H, Z)), ','(tail(L, T), flatten(T, Z))))).
flatten(L, X) :- ','(head(L, cons(U, V)), ','(tail(L, W), flatten(cons(U, cons(V, W)), X))).
head(nil, X1).
head(cons(H, X2), H).
tail(nil, nil).
tail(cons(X3, T), T).
eq(X, X).
Queries:
flatten(g,a).
(1) PrologToDTProblemTransformerProof (SOUND transformation)
Built DT problem from termination graph.
(2) Obligation:
Triples:
flatten21(.(T45, T47)) :- flatten21(T47).
flatten1(nil, .(T26, T28)) :- flatten21(T28).
flatten1(cons(atom(T78), T79), .(T78, T70)) :- flatten1(T79, T70).
flatten1(cons(cons(T117, T118), T119), T90) :- flatten1(cons(T117, cons(T118, T119)), T90).
Clauses:
flattenc21(.(T45, T47)) :- flattenc21(T47).
flattenc1(atom(T13), .(T13, [])).
flattenc1(nil, .(T26, T28)) :- flattenc21(T28).
flattenc1(cons(atom(T78), T79), .(T78, T70)) :- flattenc1(T79, T70).
flattenc1(cons(cons(T117, T118), T119), T90) :- flattenc1(cons(T117, cons(T118, T119)), T90).
Afs:
flatten1(x1, x2) = flatten1(x1)
(3) TriplesToPiDPProof (SOUND transformation)
We use the technique of [LOPSTR]. With regard to the inferred argument filtering the predicates were used in the following modes:
flatten1_in: (b,f)
flatten21_in: (f)
Transforming
TRIPLES into the following
Term Rewriting System:
Pi DP problem:
The TRS P consists of the following rules:
FLATTEN1_IN_GA(nil, .(T26, T28)) → U2_GA(T26, T28, flatten21_in_a(T28))
FLATTEN1_IN_GA(nil, .(T26, T28)) → FLATTEN21_IN_A(T28)
FLATTEN21_IN_A(.(T45, T47)) → U1_A(T45, T47, flatten21_in_a(T47))
FLATTEN21_IN_A(.(T45, T47)) → FLATTEN21_IN_A(T47)
FLATTEN1_IN_GA(cons(atom(T78), T79), .(T78, T70)) → U3_GA(T78, T79, T70, flatten1_in_ga(T79, T70))
FLATTEN1_IN_GA(cons(atom(T78), T79), .(T78, T70)) → FLATTEN1_IN_GA(T79, T70)
FLATTEN1_IN_GA(cons(cons(T117, T118), T119), T90) → U4_GA(T117, T118, T119, T90, flatten1_in_ga(cons(T117, cons(T118, T119)), T90))
FLATTEN1_IN_GA(cons(cons(T117, T118), T119), T90) → FLATTEN1_IN_GA(cons(T117, cons(T118, T119)), T90)
R is empty.
The argument filtering Pi contains the following mapping:
flatten1_in_ga(
x1,
x2) =
flatten1_in_ga(
x1)
nil =
nil
flatten21_in_a(
x1) =
flatten21_in_a
.(
x1,
x2) =
.(
x2)
cons(
x1,
x2) =
cons(
x1,
x2)
atom(
x1) =
atom(
x1)
FLATTEN1_IN_GA(
x1,
x2) =
FLATTEN1_IN_GA(
x1)
U2_GA(
x1,
x2,
x3) =
U2_GA(
x3)
FLATTEN21_IN_A(
x1) =
FLATTEN21_IN_A
U1_A(
x1,
x2,
x3) =
U1_A(
x3)
U3_GA(
x1,
x2,
x3,
x4) =
U3_GA(
x1,
x2,
x4)
U4_GA(
x1,
x2,
x3,
x4,
x5) =
U4_GA(
x1,
x2,
x3,
x5)
We have to consider all (P,R,Pi)-chains
Infinitary Constructor Rewriting Termination of PiDP implies Termination of TRIPLES
(4) Obligation:
Pi DP problem:
The TRS P consists of the following rules:
FLATTEN1_IN_GA(nil, .(T26, T28)) → U2_GA(T26, T28, flatten21_in_a(T28))
FLATTEN1_IN_GA(nil, .(T26, T28)) → FLATTEN21_IN_A(T28)
FLATTEN21_IN_A(.(T45, T47)) → U1_A(T45, T47, flatten21_in_a(T47))
FLATTEN21_IN_A(.(T45, T47)) → FLATTEN21_IN_A(T47)
FLATTEN1_IN_GA(cons(atom(T78), T79), .(T78, T70)) → U3_GA(T78, T79, T70, flatten1_in_ga(T79, T70))
FLATTEN1_IN_GA(cons(atom(T78), T79), .(T78, T70)) → FLATTEN1_IN_GA(T79, T70)
FLATTEN1_IN_GA(cons(cons(T117, T118), T119), T90) → U4_GA(T117, T118, T119, T90, flatten1_in_ga(cons(T117, cons(T118, T119)), T90))
FLATTEN1_IN_GA(cons(cons(T117, T118), T119), T90) → FLATTEN1_IN_GA(cons(T117, cons(T118, T119)), T90)
R is empty.
The argument filtering Pi contains the following mapping:
flatten1_in_ga(
x1,
x2) =
flatten1_in_ga(
x1)
nil =
nil
flatten21_in_a(
x1) =
flatten21_in_a
.(
x1,
x2) =
.(
x2)
cons(
x1,
x2) =
cons(
x1,
x2)
atom(
x1) =
atom(
x1)
FLATTEN1_IN_GA(
x1,
x2) =
FLATTEN1_IN_GA(
x1)
U2_GA(
x1,
x2,
x3) =
U2_GA(
x3)
FLATTEN21_IN_A(
x1) =
FLATTEN21_IN_A
U1_A(
x1,
x2,
x3) =
U1_A(
x3)
U3_GA(
x1,
x2,
x3,
x4) =
U3_GA(
x1,
x2,
x4)
U4_GA(
x1,
x2,
x3,
x4,
x5) =
U4_GA(
x1,
x2,
x3,
x5)
We have to consider all (P,R,Pi)-chains
(5) DependencyGraphProof (EQUIVALENT transformation)
The approximation of the Dependency Graph [LOPSTR] contains 2 SCCs with 5 less nodes.
(6) Complex Obligation (AND)
(7) Obligation:
Pi DP problem:
The TRS P consists of the following rules:
FLATTEN21_IN_A(.(T45, T47)) → FLATTEN21_IN_A(T47)
R is empty.
The argument filtering Pi contains the following mapping:
.(
x1,
x2) =
.(
x2)
FLATTEN21_IN_A(
x1) =
FLATTEN21_IN_A
We have to consider all (P,R,Pi)-chains
(8) PiDPToQDPProof (SOUND transformation)
Transforming (infinitary) constructor rewriting Pi-DP problem [LOPSTR] into ordinary QDP problem [LPAR04] by application of Pi.
(9) Obligation:
Q DP problem:
The TRS P consists of the following rules:
FLATTEN21_IN_A → FLATTEN21_IN_A
R is empty.
Q is empty.
We have to consider all (P,Q,R)-chains.
(10) NonTerminationProof (EQUIVALENT transformation)
We used the non-termination processor [FROCOS05] to show that the DP problem is infinite.
Found a loop by semiunifying a rule from P directly.
s =
FLATTEN21_IN_A evaluates to t =
FLATTEN21_IN_AThus s starts an infinite chain as s semiunifies with t with the following substitutions:
- Semiunifier: [ ]
- Matcher: [ ]
Rewriting sequenceThe DP semiunifies directly so there is only one rewrite step from FLATTEN21_IN_A to FLATTEN21_IN_A.
(11) NO
(12) Obligation:
Pi DP problem:
The TRS P consists of the following rules:
FLATTEN1_IN_GA(cons(cons(T117, T118), T119), T90) → FLATTEN1_IN_GA(cons(T117, cons(T118, T119)), T90)
FLATTEN1_IN_GA(cons(atom(T78), T79), .(T78, T70)) → FLATTEN1_IN_GA(T79, T70)
R is empty.
The argument filtering Pi contains the following mapping:
.(
x1,
x2) =
.(
x2)
cons(
x1,
x2) =
cons(
x1,
x2)
atom(
x1) =
atom(
x1)
FLATTEN1_IN_GA(
x1,
x2) =
FLATTEN1_IN_GA(
x1)
We have to consider all (P,R,Pi)-chains
(13) PiDPToQDPProof (SOUND transformation)
Transforming (infinitary) constructor rewriting Pi-DP problem [LOPSTR] into ordinary QDP problem [LPAR04] by application of Pi.
(14) Obligation:
Q DP problem:
The TRS P consists of the following rules:
FLATTEN1_IN_GA(cons(cons(T117, T118), T119)) → FLATTEN1_IN_GA(cons(T117, cons(T118, T119)))
FLATTEN1_IN_GA(cons(atom(T78), T79)) → FLATTEN1_IN_GA(T79)
R is empty.
Q is empty.
We have to consider all (P,Q,R)-chains.
(15) UsableRulesReductionPairsProof (EQUIVALENT transformation)
By using the usable rules with reduction pair processor [LPAR04] with a polynomial ordering [POLO], all dependency pairs and the corresponding usable rules [FROCOS05] can be oriented non-strictly. All non-usable rules are removed, and those dependency pairs and usable rules that have been oriented strictly or contain non-usable symbols in their left-hand side are removed as well.
The following dependency pairs can be deleted:
FLATTEN1_IN_GA(cons(cons(T117, T118), T119)) → FLATTEN1_IN_GA(cons(T117, cons(T118, T119)))
FLATTEN1_IN_GA(cons(atom(T78), T79)) → FLATTEN1_IN_GA(T79)
No rules are removed from R.
Used ordering: POLO with Polynomial interpretation [POLO]:
POL(FLATTEN1_IN_GA(x1)) = 2·x1
POL(atom(x1)) = x1
POL(cons(x1, x2)) = 2 + 2·x1 + x2
(16) Obligation:
Q DP problem:
P is empty.
R is empty.
Q is empty.
We have to consider all (P,Q,R)-chains.
(17) PisEmptyProof (EQUIVALENT transformation)
The TRS P is empty. Hence, there is no (P,Q,R) chain.
(18) YES