(0) Obligation:

Clauses:

f(X) :- ','(p(X), q(X)).
p(a).
p(X) :- ','(p(a), !).
q(b).

Queries:

f(a).

(1) PrologToPrologProblemTransformerProof (SOUND transformation)

Built Prolog problem from termination graph.

(2) Obligation:

Clauses:

p4(a).
p4(T5).
f1(T3) :- p4(T3).
f1(b) :- p4(b).

Queries:

f1(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:
f1_in: (f)
Transforming Prolog into the following Term Rewriting System:
Pi-finite rewrite system:
The TRS R consists of the following rules:

f1_in_a(T3) → U1_a(T3, p4_in_a(T3))
p4_in_a(a) → p4_out_a(a)
p4_in_a(T5) → p4_out_a(T5)
U1_a(T3, p4_out_a(T3)) → f1_out_a(T3)
f1_in_a(b) → U2_a(p4_in_g(b))
p4_in_g(a) → p4_out_g(a)
p4_in_g(T5) → p4_out_g(T5)
U2_a(p4_out_g(b)) → f1_out_a(b)

The argument filtering Pi contains the following mapping:
f1_in_a(x1)  =  f1_in_a
U1_a(x1, x2)  =  U1_a(x2)
p4_in_a(x1)  =  p4_in_a
p4_out_a(x1)  =  p4_out_a
f1_out_a(x1)  =  f1_out_a
U2_a(x1)  =  U2_a(x1)
p4_in_g(x1)  =  p4_in_g(x1)
a  =  a
p4_out_g(x1)  =  p4_out_g
b  =  b

Infinitary Constructor Rewriting Termination of PiTRS implies Termination of Prolog

(4) Obligation:

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

f1_in_a(T3) → U1_a(T3, p4_in_a(T3))
p4_in_a(a) → p4_out_a(a)
p4_in_a(T5) → p4_out_a(T5)
U1_a(T3, p4_out_a(T3)) → f1_out_a(T3)
f1_in_a(b) → U2_a(p4_in_g(b))
p4_in_g(a) → p4_out_g(a)
p4_in_g(T5) → p4_out_g(T5)
U2_a(p4_out_g(b)) → f1_out_a(b)

The argument filtering Pi contains the following mapping:
f1_in_a(x1)  =  f1_in_a
U1_a(x1, x2)  =  U1_a(x2)
p4_in_a(x1)  =  p4_in_a
p4_out_a(x1)  =  p4_out_a
f1_out_a(x1)  =  f1_out_a
U2_a(x1)  =  U2_a(x1)
p4_in_g(x1)  =  p4_in_g(x1)
a  =  a
p4_out_g(x1)  =  p4_out_g
b  =  b

(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:

F1_IN_A(T3) → U1_A(T3, p4_in_a(T3))
F1_IN_A(T3) → P4_IN_A(T3)
F1_IN_A(b) → U2_A(p4_in_g(b))
F1_IN_A(b) → P4_IN_G(b)

The TRS R consists of the following rules:

f1_in_a(T3) → U1_a(T3, p4_in_a(T3))
p4_in_a(a) → p4_out_a(a)
p4_in_a(T5) → p4_out_a(T5)
U1_a(T3, p4_out_a(T3)) → f1_out_a(T3)
f1_in_a(b) → U2_a(p4_in_g(b))
p4_in_g(a) → p4_out_g(a)
p4_in_g(T5) → p4_out_g(T5)
U2_a(p4_out_g(b)) → f1_out_a(b)

The argument filtering Pi contains the following mapping:
f1_in_a(x1)  =  f1_in_a
U1_a(x1, x2)  =  U1_a(x2)
p4_in_a(x1)  =  p4_in_a
p4_out_a(x1)  =  p4_out_a
f1_out_a(x1)  =  f1_out_a
U2_a(x1)  =  U2_a(x1)
p4_in_g(x1)  =  p4_in_g(x1)
a  =  a
p4_out_g(x1)  =  p4_out_g
b  =  b
F1_IN_A(x1)  =  F1_IN_A
U1_A(x1, x2)  =  U1_A(x2)
P4_IN_A(x1)  =  P4_IN_A
U2_A(x1)  =  U2_A(x1)
P4_IN_G(x1)  =  P4_IN_G(x1)

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

(6) Obligation:

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

F1_IN_A(T3) → U1_A(T3, p4_in_a(T3))
F1_IN_A(T3) → P4_IN_A(T3)
F1_IN_A(b) → U2_A(p4_in_g(b))
F1_IN_A(b) → P4_IN_G(b)

The TRS R consists of the following rules:

f1_in_a(T3) → U1_a(T3, p4_in_a(T3))
p4_in_a(a) → p4_out_a(a)
p4_in_a(T5) → p4_out_a(T5)
U1_a(T3, p4_out_a(T3)) → f1_out_a(T3)
f1_in_a(b) → U2_a(p4_in_g(b))
p4_in_g(a) → p4_out_g(a)
p4_in_g(T5) → p4_out_g(T5)
U2_a(p4_out_g(b)) → f1_out_a(b)

The argument filtering Pi contains the following mapping:
f1_in_a(x1)  =  f1_in_a
U1_a(x1, x2)  =  U1_a(x2)
p4_in_a(x1)  =  p4_in_a
p4_out_a(x1)  =  p4_out_a
f1_out_a(x1)  =  f1_out_a
U2_a(x1)  =  U2_a(x1)
p4_in_g(x1)  =  p4_in_g(x1)
a  =  a
p4_out_g(x1)  =  p4_out_g
b  =  b
F1_IN_A(x1)  =  F1_IN_A
U1_A(x1, x2)  =  U1_A(x2)
P4_IN_A(x1)  =  P4_IN_A
U2_A(x1)  =  U2_A(x1)
P4_IN_G(x1)  =  P4_IN_G(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 4 less nodes.

(8) TRUE