(0) Obligation:

Clauses:

p(X) :- ','(q(X), r(X)).
p(X) :- =(X, 2).
q(X) :- ','(=(X, 1), !).
q(X) :- =(X, 3).
r(X) :- ','(=(X, 1), !).
r(X) :- =(X, 4).
=(X, X).

Queries:

p(a).

(1) PrologToPrologProblemTransformerProof (SOUND transformation)

Built Prolog problem from termination graph.

(2) Obligation:

Clauses:

q6(1).
q6(3).
p1(T3) :- q6(T3).
p1(1) :- q6(1).
p1(4) :- q6(4).
p1(2).

Queries:

p1(a).

(3) PrologToPiTRSProof (SOUND transformation)

We use the technique of [LOPSTR]. With regard to the inferred argument filtering the predicates were used in the following modes:
p1_in: (f)
Transforming Prolog into the following Term Rewriting System:
Pi-finite rewrite system:
The TRS R consists of the following rules:

p1_in_a(T3) → U1_a(T3, q6_in_a(T3))
q6_in_a(1) → q6_out_a(1)
q6_in_a(3) → q6_out_a(3)
U1_a(T3, q6_out_a(T3)) → p1_out_a(T3)
p1_in_a(1) → U2_a(q6_in_g(1))
q6_in_g(1) → q6_out_g(1)
q6_in_g(3) → q6_out_g(3)
U2_a(q6_out_g(1)) → p1_out_a(1)
p1_in_a(4) → U3_a(q6_in_g(4))
U3_a(q6_out_g(4)) → p1_out_a(4)
p1_in_a(2) → p1_out_a(2)

The argument filtering Pi contains the following mapping:
p1_in_a(x1)  =  p1_in_a
U1_a(x1, x2)  =  U1_a(x2)
q6_in_a(x1)  =  q6_in_a
q6_out_a(x1)  =  q6_out_a(x1)
p1_out_a(x1)  =  p1_out_a(x1)
U2_a(x1)  =  U2_a(x1)
q6_in_g(x1)  =  q6_in_g(x1)
1  =  1
q6_out_g(x1)  =  q6_out_g
3  =  3
U3_a(x1)  =  U3_a(x1)
4  =  4

Infinitary Constructor Rewriting Termination of PiTRS implies Termination of Prolog

(4) Obligation:

Pi-finite rewrite system:
The TRS R consists of the following rules:

p1_in_a(T3) → U1_a(T3, q6_in_a(T3))
q6_in_a(1) → q6_out_a(1)
q6_in_a(3) → q6_out_a(3)
U1_a(T3, q6_out_a(T3)) → p1_out_a(T3)
p1_in_a(1) → U2_a(q6_in_g(1))
q6_in_g(1) → q6_out_g(1)
q6_in_g(3) → q6_out_g(3)
U2_a(q6_out_g(1)) → p1_out_a(1)
p1_in_a(4) → U3_a(q6_in_g(4))
U3_a(q6_out_g(4)) → p1_out_a(4)
p1_in_a(2) → p1_out_a(2)

The argument filtering Pi contains the following mapping:
p1_in_a(x1)  =  p1_in_a
U1_a(x1, x2)  =  U1_a(x2)
q6_in_a(x1)  =  q6_in_a
q6_out_a(x1)  =  q6_out_a(x1)
p1_out_a(x1)  =  p1_out_a(x1)
U2_a(x1)  =  U2_a(x1)
q6_in_g(x1)  =  q6_in_g(x1)
1  =  1
q6_out_g(x1)  =  q6_out_g
3  =  3
U3_a(x1)  =  U3_a(x1)
4  =  4

(5) DependencyPairsProof (EQUIVALENT transformation)

Using Dependency Pairs [AG00,LOPSTR] we result in the following initial DP problem:
Pi DP problem:
The TRS P consists of the following rules:

P1_IN_A(T3) → U1_A(T3, q6_in_a(T3))
P1_IN_A(T3) → Q6_IN_A(T3)
P1_IN_A(1) → U2_A(q6_in_g(1))
P1_IN_A(1) → Q6_IN_G(1)
P1_IN_A(4) → U3_A(q6_in_g(4))
P1_IN_A(4) → Q6_IN_G(4)

The TRS R consists of the following rules:

p1_in_a(T3) → U1_a(T3, q6_in_a(T3))
q6_in_a(1) → q6_out_a(1)
q6_in_a(3) → q6_out_a(3)
U1_a(T3, q6_out_a(T3)) → p1_out_a(T3)
p1_in_a(1) → U2_a(q6_in_g(1))
q6_in_g(1) → q6_out_g(1)
q6_in_g(3) → q6_out_g(3)
U2_a(q6_out_g(1)) → p1_out_a(1)
p1_in_a(4) → U3_a(q6_in_g(4))
U3_a(q6_out_g(4)) → p1_out_a(4)
p1_in_a(2) → p1_out_a(2)

The argument filtering Pi contains the following mapping:
p1_in_a(x1)  =  p1_in_a
U1_a(x1, x2)  =  U1_a(x2)
q6_in_a(x1)  =  q6_in_a
q6_out_a(x1)  =  q6_out_a(x1)
p1_out_a(x1)  =  p1_out_a(x1)
U2_a(x1)  =  U2_a(x1)
q6_in_g(x1)  =  q6_in_g(x1)
1  =  1
q6_out_g(x1)  =  q6_out_g
3  =  3
U3_a(x1)  =  U3_a(x1)
4  =  4
P1_IN_A(x1)  =  P1_IN_A
U1_A(x1, x2)  =  U1_A(x2)
Q6_IN_A(x1)  =  Q6_IN_A
U2_A(x1)  =  U2_A(x1)
Q6_IN_G(x1)  =  Q6_IN_G(x1)
U3_A(x1)  =  U3_A(x1)

We have to consider all (P,R,Pi)-chains

(6) Obligation:

Pi DP problem:
The TRS P consists of the following rules:

P1_IN_A(T3) → U1_A(T3, q6_in_a(T3))
P1_IN_A(T3) → Q6_IN_A(T3)
P1_IN_A(1) → U2_A(q6_in_g(1))
P1_IN_A(1) → Q6_IN_G(1)
P1_IN_A(4) → U3_A(q6_in_g(4))
P1_IN_A(4) → Q6_IN_G(4)

The TRS R consists of the following rules:

p1_in_a(T3) → U1_a(T3, q6_in_a(T3))
q6_in_a(1) → q6_out_a(1)
q6_in_a(3) → q6_out_a(3)
U1_a(T3, q6_out_a(T3)) → p1_out_a(T3)
p1_in_a(1) → U2_a(q6_in_g(1))
q6_in_g(1) → q6_out_g(1)
q6_in_g(3) → q6_out_g(3)
U2_a(q6_out_g(1)) → p1_out_a(1)
p1_in_a(4) → U3_a(q6_in_g(4))
U3_a(q6_out_g(4)) → p1_out_a(4)
p1_in_a(2) → p1_out_a(2)

The argument filtering Pi contains the following mapping:
p1_in_a(x1)  =  p1_in_a
U1_a(x1, x2)  =  U1_a(x2)
q6_in_a(x1)  =  q6_in_a
q6_out_a(x1)  =  q6_out_a(x1)
p1_out_a(x1)  =  p1_out_a(x1)
U2_a(x1)  =  U2_a(x1)
q6_in_g(x1)  =  q6_in_g(x1)
1  =  1
q6_out_g(x1)  =  q6_out_g
3  =  3
U3_a(x1)  =  U3_a(x1)
4  =  4
P1_IN_A(x1)  =  P1_IN_A
U1_A(x1, x2)  =  U1_A(x2)
Q6_IN_A(x1)  =  Q6_IN_A
U2_A(x1)  =  U2_A(x1)
Q6_IN_G(x1)  =  Q6_IN_G(x1)
U3_A(x1)  =  U3_A(x1)

We have to consider all (P,R,Pi)-chains

(7) DependencyGraphProof (EQUIVALENT transformation)

The approximation of the Dependency Graph [LOPSTR] contains 0 SCCs with 6 less nodes.

(8) TRUE