(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) CutEliminatorProof (SOUND transformation)

Eliminated all cuts by simply ignoring them[PROLOG].

(2) 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).

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

p_in_a(X) → U1_a(X, q_in_a(X))
q_in_a(X) → U4_a(X, =_in_ag(X, 1))
=_in_ag(X, X) → =_out_ag(X, X)
U4_a(X, =_out_ag(X, 1)) → q_out_a(X)
q_in_a(X) → U5_a(X, =_in_ag(X, 3))
U5_a(X, =_out_ag(X, 3)) → q_out_a(X)
U1_a(X, q_out_a(X)) → U2_a(X, r_in_g(X))
r_in_g(X) → U6_g(X, =_in_gg(X, 1))
=_in_gg(X, X) → =_out_gg(X, X)
U6_g(X, =_out_gg(X, 1)) → r_out_g(X)
r_in_g(X) → U7_g(X, =_in_gg(X, 4))
U7_g(X, =_out_gg(X, 4)) → r_out_g(X)
U2_a(X, r_out_g(X)) → p_out_a(X)
p_in_a(X) → U3_a(X, =_in_ag(X, 2))
U3_a(X, =_out_ag(X, 2)) → p_out_a(X)

The argument filtering Pi contains the following mapping:
p_in_a(x1)  =  p_in_a
U1_a(x1, x2)  =  U1_a(x2)
q_in_a(x1)  =  q_in_a
U4_a(x1, x2)  =  U4_a(x2)
=_in_ag(x1, x2)  =  =_in_ag(x2)
=_out_ag(x1, x2)  =  =_out_ag(x1)
1  =  1
q_out_a(x1)  =  q_out_a(x1)
U5_a(x1, x2)  =  U5_a(x2)
3  =  3
U2_a(x1, x2)  =  U2_a(x1, x2)
r_in_g(x1)  =  r_in_g(x1)
U6_g(x1, x2)  =  U6_g(x2)
=_in_gg(x1, x2)  =  =_in_gg(x1, x2)
=_out_gg(x1, x2)  =  =_out_gg
r_out_g(x1)  =  r_out_g
U7_g(x1, x2)  =  U7_g(x2)
4  =  4
p_out_a(x1)  =  p_out_a(x1)
U3_a(x1, x2)  =  U3_a(x2)
2  =  2

Infinitary Constructor Rewriting Termination of PiTRS implies Termination of Prolog

(4) Obligation:

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

p_in_a(X) → U1_a(X, q_in_a(X))
q_in_a(X) → U4_a(X, =_in_ag(X, 1))
=_in_ag(X, X) → =_out_ag(X, X)
U4_a(X, =_out_ag(X, 1)) → q_out_a(X)
q_in_a(X) → U5_a(X, =_in_ag(X, 3))
U5_a(X, =_out_ag(X, 3)) → q_out_a(X)
U1_a(X, q_out_a(X)) → U2_a(X, r_in_g(X))
r_in_g(X) → U6_g(X, =_in_gg(X, 1))
=_in_gg(X, X) → =_out_gg(X, X)
U6_g(X, =_out_gg(X, 1)) → r_out_g(X)
r_in_g(X) → U7_g(X, =_in_gg(X, 4))
U7_g(X, =_out_gg(X, 4)) → r_out_g(X)
U2_a(X, r_out_g(X)) → p_out_a(X)
p_in_a(X) → U3_a(X, =_in_ag(X, 2))
U3_a(X, =_out_ag(X, 2)) → p_out_a(X)

The argument filtering Pi contains the following mapping:
p_in_a(x1)  =  p_in_a
U1_a(x1, x2)  =  U1_a(x2)
q_in_a(x1)  =  q_in_a
U4_a(x1, x2)  =  U4_a(x2)
=_in_ag(x1, x2)  =  =_in_ag(x2)
=_out_ag(x1, x2)  =  =_out_ag(x1)
1  =  1
q_out_a(x1)  =  q_out_a(x1)
U5_a(x1, x2)  =  U5_a(x2)
3  =  3
U2_a(x1, x2)  =  U2_a(x1, x2)
r_in_g(x1)  =  r_in_g(x1)
U6_g(x1, x2)  =  U6_g(x2)
=_in_gg(x1, x2)  =  =_in_gg(x1, x2)
=_out_gg(x1, x2)  =  =_out_gg
r_out_g(x1)  =  r_out_g
U7_g(x1, x2)  =  U7_g(x2)
4  =  4
p_out_a(x1)  =  p_out_a(x1)
U3_a(x1, x2)  =  U3_a(x2)
2  =  2

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

P_IN_A(X) → U1_A(X, q_in_a(X))
P_IN_A(X) → Q_IN_A(X)
Q_IN_A(X) → U4_A(X, =_in_ag(X, 1))
Q_IN_A(X) → =_IN_AG(X, 1)
Q_IN_A(X) → U5_A(X, =_in_ag(X, 3))
Q_IN_A(X) → =_IN_AG(X, 3)
U1_A(X, q_out_a(X)) → U2_A(X, r_in_g(X))
U1_A(X, q_out_a(X)) → R_IN_G(X)
R_IN_G(X) → U6_G(X, =_in_gg(X, 1))
R_IN_G(X) → =_IN_GG(X, 1)
R_IN_G(X) → U7_G(X, =_in_gg(X, 4))
R_IN_G(X) → =_IN_GG(X, 4)
P_IN_A(X) → U3_A(X, =_in_ag(X, 2))
P_IN_A(X) → =_IN_AG(X, 2)

The TRS R consists of the following rules:

p_in_a(X) → U1_a(X, q_in_a(X))
q_in_a(X) → U4_a(X, =_in_ag(X, 1))
=_in_ag(X, X) → =_out_ag(X, X)
U4_a(X, =_out_ag(X, 1)) → q_out_a(X)
q_in_a(X) → U5_a(X, =_in_ag(X, 3))
U5_a(X, =_out_ag(X, 3)) → q_out_a(X)
U1_a(X, q_out_a(X)) → U2_a(X, r_in_g(X))
r_in_g(X) → U6_g(X, =_in_gg(X, 1))
=_in_gg(X, X) → =_out_gg(X, X)
U6_g(X, =_out_gg(X, 1)) → r_out_g(X)
r_in_g(X) → U7_g(X, =_in_gg(X, 4))
U7_g(X, =_out_gg(X, 4)) → r_out_g(X)
U2_a(X, r_out_g(X)) → p_out_a(X)
p_in_a(X) → U3_a(X, =_in_ag(X, 2))
U3_a(X, =_out_ag(X, 2)) → p_out_a(X)

The argument filtering Pi contains the following mapping:
p_in_a(x1)  =  p_in_a
U1_a(x1, x2)  =  U1_a(x2)
q_in_a(x1)  =  q_in_a
U4_a(x1, x2)  =  U4_a(x2)
=_in_ag(x1, x2)  =  =_in_ag(x2)
=_out_ag(x1, x2)  =  =_out_ag(x1)
1  =  1
q_out_a(x1)  =  q_out_a(x1)
U5_a(x1, x2)  =  U5_a(x2)
3  =  3
U2_a(x1, x2)  =  U2_a(x1, x2)
r_in_g(x1)  =  r_in_g(x1)
U6_g(x1, x2)  =  U6_g(x2)
=_in_gg(x1, x2)  =  =_in_gg(x1, x2)
=_out_gg(x1, x2)  =  =_out_gg
r_out_g(x1)  =  r_out_g
U7_g(x1, x2)  =  U7_g(x2)
4  =  4
p_out_a(x1)  =  p_out_a(x1)
U3_a(x1, x2)  =  U3_a(x2)
2  =  2
P_IN_A(x1)  =  P_IN_A
U1_A(x1, x2)  =  U1_A(x2)
Q_IN_A(x1)  =  Q_IN_A
U4_A(x1, x2)  =  U4_A(x2)
=_IN_AG(x1, x2)  =  =_IN_AG(x2)
U5_A(x1, x2)  =  U5_A(x2)
U2_A(x1, x2)  =  U2_A(x1, x2)
R_IN_G(x1)  =  R_IN_G(x1)
U6_G(x1, x2)  =  U6_G(x2)
=_IN_GG(x1, x2)  =  =_IN_GG(x1, x2)
U7_G(x1, x2)  =  U7_G(x2)
U3_A(x1, x2)  =  U3_A(x2)

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

(6) Obligation:

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

P_IN_A(X) → U1_A(X, q_in_a(X))
P_IN_A(X) → Q_IN_A(X)
Q_IN_A(X) → U4_A(X, =_in_ag(X, 1))
Q_IN_A(X) → =_IN_AG(X, 1)
Q_IN_A(X) → U5_A(X, =_in_ag(X, 3))
Q_IN_A(X) → =_IN_AG(X, 3)
U1_A(X, q_out_a(X)) → U2_A(X, r_in_g(X))
U1_A(X, q_out_a(X)) → R_IN_G(X)
R_IN_G(X) → U6_G(X, =_in_gg(X, 1))
R_IN_G(X) → =_IN_GG(X, 1)
R_IN_G(X) → U7_G(X, =_in_gg(X, 4))
R_IN_G(X) → =_IN_GG(X, 4)
P_IN_A(X) → U3_A(X, =_in_ag(X, 2))
P_IN_A(X) → =_IN_AG(X, 2)

The TRS R consists of the following rules:

p_in_a(X) → U1_a(X, q_in_a(X))
q_in_a(X) → U4_a(X, =_in_ag(X, 1))
=_in_ag(X, X) → =_out_ag(X, X)
U4_a(X, =_out_ag(X, 1)) → q_out_a(X)
q_in_a(X) → U5_a(X, =_in_ag(X, 3))
U5_a(X, =_out_ag(X, 3)) → q_out_a(X)
U1_a(X, q_out_a(X)) → U2_a(X, r_in_g(X))
r_in_g(X) → U6_g(X, =_in_gg(X, 1))
=_in_gg(X, X) → =_out_gg(X, X)
U6_g(X, =_out_gg(X, 1)) → r_out_g(X)
r_in_g(X) → U7_g(X, =_in_gg(X, 4))
U7_g(X, =_out_gg(X, 4)) → r_out_g(X)
U2_a(X, r_out_g(X)) → p_out_a(X)
p_in_a(X) → U3_a(X, =_in_ag(X, 2))
U3_a(X, =_out_ag(X, 2)) → p_out_a(X)

The argument filtering Pi contains the following mapping:
p_in_a(x1)  =  p_in_a
U1_a(x1, x2)  =  U1_a(x2)
q_in_a(x1)  =  q_in_a
U4_a(x1, x2)  =  U4_a(x2)
=_in_ag(x1, x2)  =  =_in_ag(x2)
=_out_ag(x1, x2)  =  =_out_ag(x1)
1  =  1
q_out_a(x1)  =  q_out_a(x1)
U5_a(x1, x2)  =  U5_a(x2)
3  =  3
U2_a(x1, x2)  =  U2_a(x1, x2)
r_in_g(x1)  =  r_in_g(x1)
U6_g(x1, x2)  =  U6_g(x2)
=_in_gg(x1, x2)  =  =_in_gg(x1, x2)
=_out_gg(x1, x2)  =  =_out_gg
r_out_g(x1)  =  r_out_g
U7_g(x1, x2)  =  U7_g(x2)
4  =  4
p_out_a(x1)  =  p_out_a(x1)
U3_a(x1, x2)  =  U3_a(x2)
2  =  2
P_IN_A(x1)  =  P_IN_A
U1_A(x1, x2)  =  U1_A(x2)
Q_IN_A(x1)  =  Q_IN_A
U4_A(x1, x2)  =  U4_A(x2)
=_IN_AG(x1, x2)  =  =_IN_AG(x2)
U5_A(x1, x2)  =  U5_A(x2)
U2_A(x1, x2)  =  U2_A(x1, x2)
R_IN_G(x1)  =  R_IN_G(x1)
U6_G(x1, x2)  =  U6_G(x2)
=_IN_GG(x1, x2)  =  =_IN_GG(x1, x2)
U7_G(x1, x2)  =  U7_G(x2)
U3_A(x1, x2)  =  U3_A(x2)

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

(7) DependencyGraphProof (EQUIVALENT transformation)

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

(8) TRUE

(9) PrologToPiTRSProof (SOUND transformation)

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

p_in_a(X) → U1_a(X, q_in_a(X))
q_in_a(X) → U4_a(X, =_in_ag(X, 1))
=_in_ag(X, X) → =_out_ag(X, X)
U4_a(X, =_out_ag(X, 1)) → q_out_a(X)
q_in_a(X) → U5_a(X, =_in_ag(X, 3))
U5_a(X, =_out_ag(X, 3)) → q_out_a(X)
U1_a(X, q_out_a(X)) → U2_a(X, r_in_g(X))
r_in_g(X) → U6_g(X, =_in_gg(X, 1))
=_in_gg(X, X) → =_out_gg(X, X)
U6_g(X, =_out_gg(X, 1)) → r_out_g(X)
r_in_g(X) → U7_g(X, =_in_gg(X, 4))
U7_g(X, =_out_gg(X, 4)) → r_out_g(X)
U2_a(X, r_out_g(X)) → p_out_a(X)
p_in_a(X) → U3_a(X, =_in_ag(X, 2))
U3_a(X, =_out_ag(X, 2)) → p_out_a(X)

The argument filtering Pi contains the following mapping:
p_in_a(x1)  =  p_in_a
U1_a(x1, x2)  =  U1_a(x2)
q_in_a(x1)  =  q_in_a
U4_a(x1, x2)  =  U4_a(x2)
=_in_ag(x1, x2)  =  =_in_ag(x2)
=_out_ag(x1, x2)  =  =_out_ag(x1, x2)
1  =  1
q_out_a(x1)  =  q_out_a(x1)
U5_a(x1, x2)  =  U5_a(x2)
3  =  3
U2_a(x1, x2)  =  U2_a(x1, x2)
r_in_g(x1)  =  r_in_g(x1)
U6_g(x1, x2)  =  U6_g(x1, x2)
=_in_gg(x1, x2)  =  =_in_gg(x1, x2)
=_out_gg(x1, x2)  =  =_out_gg(x1, x2)
r_out_g(x1)  =  r_out_g(x1)
U7_g(x1, x2)  =  U7_g(x1, x2)
4  =  4
p_out_a(x1)  =  p_out_a(x1)
U3_a(x1, x2)  =  U3_a(x2)
2  =  2

Infinitary Constructor Rewriting Termination of PiTRS implies Termination of Prolog

(10) Obligation:

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

p_in_a(X) → U1_a(X, q_in_a(X))
q_in_a(X) → U4_a(X, =_in_ag(X, 1))
=_in_ag(X, X) → =_out_ag(X, X)
U4_a(X, =_out_ag(X, 1)) → q_out_a(X)
q_in_a(X) → U5_a(X, =_in_ag(X, 3))
U5_a(X, =_out_ag(X, 3)) → q_out_a(X)
U1_a(X, q_out_a(X)) → U2_a(X, r_in_g(X))
r_in_g(X) → U6_g(X, =_in_gg(X, 1))
=_in_gg(X, X) → =_out_gg(X, X)
U6_g(X, =_out_gg(X, 1)) → r_out_g(X)
r_in_g(X) → U7_g(X, =_in_gg(X, 4))
U7_g(X, =_out_gg(X, 4)) → r_out_g(X)
U2_a(X, r_out_g(X)) → p_out_a(X)
p_in_a(X) → U3_a(X, =_in_ag(X, 2))
U3_a(X, =_out_ag(X, 2)) → p_out_a(X)

The argument filtering Pi contains the following mapping:
p_in_a(x1)  =  p_in_a
U1_a(x1, x2)  =  U1_a(x2)
q_in_a(x1)  =  q_in_a
U4_a(x1, x2)  =  U4_a(x2)
=_in_ag(x1, x2)  =  =_in_ag(x2)
=_out_ag(x1, x2)  =  =_out_ag(x1, x2)
1  =  1
q_out_a(x1)  =  q_out_a(x1)
U5_a(x1, x2)  =  U5_a(x2)
3  =  3
U2_a(x1, x2)  =  U2_a(x1, x2)
r_in_g(x1)  =  r_in_g(x1)
U6_g(x1, x2)  =  U6_g(x1, x2)
=_in_gg(x1, x2)  =  =_in_gg(x1, x2)
=_out_gg(x1, x2)  =  =_out_gg(x1, x2)
r_out_g(x1)  =  r_out_g(x1)
U7_g(x1, x2)  =  U7_g(x1, x2)
4  =  4
p_out_a(x1)  =  p_out_a(x1)
U3_a(x1, x2)  =  U3_a(x2)
2  =  2