(0) Obligation:

Clauses:

max(X, Y, X) :- less(Y, X).
max(X, Y, Y) :- less(X, s(Y)).
less(0, s(X1)).
less(s(X), s(Y)) :- less(X, Y).

Query: max(a,g,a)

(1) PrologToPiTRSViaGraphTransformerProof (SOUND transformation)

Transformed Prolog program to (Pi-)TRS.

(2) Obligation:

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

maxA_in_aga(s(T13), 0, s(T13)) → maxA_out_aga(s(T13), 0, s(T13))
maxA_in_aga(s(T24), s(T22), s(T24)) → U1_aga(T24, T22, lessB_in_ga(T22, T24))
lessB_in_ga(0, s(T31)) → lessB_out_ga(0, s(T31))
lessB_in_ga(s(T36), s(T38)) → U4_ga(T36, T38, lessB_in_ga(T36, T38))
U4_ga(T36, T38, lessB_out_ga(T36, T38)) → lessB_out_ga(s(T36), s(T38))
U1_aga(T24, T22, lessB_out_ga(T22, T24)) → maxA_out_aga(s(T24), s(T22), s(T24))
maxA_in_aga(0, T54, T54) → maxA_out_aga(0, T54, T54)
maxA_in_aga(s(T61), T60, T60) → U2_aga(T61, T60, lessC_in_ag(T61, T60))
lessC_in_ag(0, s(T68)) → lessC_out_ag(0, s(T68))
lessC_in_ag(s(T75), s(T74)) → U5_ag(T75, T74, lessC_in_ag(T75, T74))
U5_ag(T75, T74, lessC_out_ag(T75, T74)) → lessC_out_ag(s(T75), s(T74))
U2_aga(T61, T60, lessC_out_ag(T61, T60)) → maxA_out_aga(s(T61), T60, T60)
maxA_in_aga(s(T94), T93, T93) → U3_aga(T94, T93, lessC_in_ag(T94, T93))
U3_aga(T94, T93, lessC_out_ag(T94, T93)) → maxA_out_aga(s(T94), T93, T93)

The argument filtering Pi contains the following mapping:
maxA_in_aga(x1, x2, x3)  =  maxA_in_aga(x2)
0  =  0
maxA_out_aga(x1, x2, x3)  =  maxA_out_aga(x2)
s(x1)  =  s(x1)
U1_aga(x1, x2, x3)  =  U1_aga(x2, x3)
lessB_in_ga(x1, x2)  =  lessB_in_ga(x1)
lessB_out_ga(x1, x2)  =  lessB_out_ga(x1)
U4_ga(x1, x2, x3)  =  U4_ga(x1, x3)
U2_aga(x1, x2, x3)  =  U2_aga(x2, x3)
lessC_in_ag(x1, x2)  =  lessC_in_ag(x2)
lessC_out_ag(x1, x2)  =  lessC_out_ag(x1, x2)
U5_ag(x1, x2, x3)  =  U5_ag(x2, x3)
U3_aga(x1, x2, x3)  =  U3_aga(x2, x3)

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

MAXA_IN_AGA(s(T24), s(T22), s(T24)) → U1_AGA(T24, T22, lessB_in_ga(T22, T24))
MAXA_IN_AGA(s(T24), s(T22), s(T24)) → LESSB_IN_GA(T22, T24)
LESSB_IN_GA(s(T36), s(T38)) → U4_GA(T36, T38, lessB_in_ga(T36, T38))
LESSB_IN_GA(s(T36), s(T38)) → LESSB_IN_GA(T36, T38)
MAXA_IN_AGA(s(T61), T60, T60) → U2_AGA(T61, T60, lessC_in_ag(T61, T60))
MAXA_IN_AGA(s(T61), T60, T60) → LESSC_IN_AG(T61, T60)
LESSC_IN_AG(s(T75), s(T74)) → U5_AG(T75, T74, lessC_in_ag(T75, T74))
LESSC_IN_AG(s(T75), s(T74)) → LESSC_IN_AG(T75, T74)
MAXA_IN_AGA(s(T94), T93, T93) → U3_AGA(T94, T93, lessC_in_ag(T94, T93))

The TRS R consists of the following rules:

maxA_in_aga(s(T13), 0, s(T13)) → maxA_out_aga(s(T13), 0, s(T13))
maxA_in_aga(s(T24), s(T22), s(T24)) → U1_aga(T24, T22, lessB_in_ga(T22, T24))
lessB_in_ga(0, s(T31)) → lessB_out_ga(0, s(T31))
lessB_in_ga(s(T36), s(T38)) → U4_ga(T36, T38, lessB_in_ga(T36, T38))
U4_ga(T36, T38, lessB_out_ga(T36, T38)) → lessB_out_ga(s(T36), s(T38))
U1_aga(T24, T22, lessB_out_ga(T22, T24)) → maxA_out_aga(s(T24), s(T22), s(T24))
maxA_in_aga(0, T54, T54) → maxA_out_aga(0, T54, T54)
maxA_in_aga(s(T61), T60, T60) → U2_aga(T61, T60, lessC_in_ag(T61, T60))
lessC_in_ag(0, s(T68)) → lessC_out_ag(0, s(T68))
lessC_in_ag(s(T75), s(T74)) → U5_ag(T75, T74, lessC_in_ag(T75, T74))
U5_ag(T75, T74, lessC_out_ag(T75, T74)) → lessC_out_ag(s(T75), s(T74))
U2_aga(T61, T60, lessC_out_ag(T61, T60)) → maxA_out_aga(s(T61), T60, T60)
maxA_in_aga(s(T94), T93, T93) → U3_aga(T94, T93, lessC_in_ag(T94, T93))
U3_aga(T94, T93, lessC_out_ag(T94, T93)) → maxA_out_aga(s(T94), T93, T93)

The argument filtering Pi contains the following mapping:
maxA_in_aga(x1, x2, x3)  =  maxA_in_aga(x2)
0  =  0
maxA_out_aga(x1, x2, x3)  =  maxA_out_aga(x2)
s(x1)  =  s(x1)
U1_aga(x1, x2, x3)  =  U1_aga(x2, x3)
lessB_in_ga(x1, x2)  =  lessB_in_ga(x1)
lessB_out_ga(x1, x2)  =  lessB_out_ga(x1)
U4_ga(x1, x2, x3)  =  U4_ga(x1, x3)
U2_aga(x1, x2, x3)  =  U2_aga(x2, x3)
lessC_in_ag(x1, x2)  =  lessC_in_ag(x2)
lessC_out_ag(x1, x2)  =  lessC_out_ag(x1, x2)
U5_ag(x1, x2, x3)  =  U5_ag(x2, x3)
U3_aga(x1, x2, x3)  =  U3_aga(x2, x3)
MAXA_IN_AGA(x1, x2, x3)  =  MAXA_IN_AGA(x2)
U1_AGA(x1, x2, x3)  =  U1_AGA(x2, x3)
LESSB_IN_GA(x1, x2)  =  LESSB_IN_GA(x1)
U4_GA(x1, x2, x3)  =  U4_GA(x1, x3)
U2_AGA(x1, x2, x3)  =  U2_AGA(x2, x3)
LESSC_IN_AG(x1, x2)  =  LESSC_IN_AG(x2)
U5_AG(x1, x2, x3)  =  U5_AG(x2, x3)
U3_AGA(x1, x2, x3)  =  U3_AGA(x2, x3)

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

(4) Obligation:

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

MAXA_IN_AGA(s(T24), s(T22), s(T24)) → U1_AGA(T24, T22, lessB_in_ga(T22, T24))
MAXA_IN_AGA(s(T24), s(T22), s(T24)) → LESSB_IN_GA(T22, T24)
LESSB_IN_GA(s(T36), s(T38)) → U4_GA(T36, T38, lessB_in_ga(T36, T38))
LESSB_IN_GA(s(T36), s(T38)) → LESSB_IN_GA(T36, T38)
MAXA_IN_AGA(s(T61), T60, T60) → U2_AGA(T61, T60, lessC_in_ag(T61, T60))
MAXA_IN_AGA(s(T61), T60, T60) → LESSC_IN_AG(T61, T60)
LESSC_IN_AG(s(T75), s(T74)) → U5_AG(T75, T74, lessC_in_ag(T75, T74))
LESSC_IN_AG(s(T75), s(T74)) → LESSC_IN_AG(T75, T74)
MAXA_IN_AGA(s(T94), T93, T93) → U3_AGA(T94, T93, lessC_in_ag(T94, T93))

The TRS R consists of the following rules:

maxA_in_aga(s(T13), 0, s(T13)) → maxA_out_aga(s(T13), 0, s(T13))
maxA_in_aga(s(T24), s(T22), s(T24)) → U1_aga(T24, T22, lessB_in_ga(T22, T24))
lessB_in_ga(0, s(T31)) → lessB_out_ga(0, s(T31))
lessB_in_ga(s(T36), s(T38)) → U4_ga(T36, T38, lessB_in_ga(T36, T38))
U4_ga(T36, T38, lessB_out_ga(T36, T38)) → lessB_out_ga(s(T36), s(T38))
U1_aga(T24, T22, lessB_out_ga(T22, T24)) → maxA_out_aga(s(T24), s(T22), s(T24))
maxA_in_aga(0, T54, T54) → maxA_out_aga(0, T54, T54)
maxA_in_aga(s(T61), T60, T60) → U2_aga(T61, T60, lessC_in_ag(T61, T60))
lessC_in_ag(0, s(T68)) → lessC_out_ag(0, s(T68))
lessC_in_ag(s(T75), s(T74)) → U5_ag(T75, T74, lessC_in_ag(T75, T74))
U5_ag(T75, T74, lessC_out_ag(T75, T74)) → lessC_out_ag(s(T75), s(T74))
U2_aga(T61, T60, lessC_out_ag(T61, T60)) → maxA_out_aga(s(T61), T60, T60)
maxA_in_aga(s(T94), T93, T93) → U3_aga(T94, T93, lessC_in_ag(T94, T93))
U3_aga(T94, T93, lessC_out_ag(T94, T93)) → maxA_out_aga(s(T94), T93, T93)

The argument filtering Pi contains the following mapping:
maxA_in_aga(x1, x2, x3)  =  maxA_in_aga(x2)
0  =  0
maxA_out_aga(x1, x2, x3)  =  maxA_out_aga(x2)
s(x1)  =  s(x1)
U1_aga(x1, x2, x3)  =  U1_aga(x2, x3)
lessB_in_ga(x1, x2)  =  lessB_in_ga(x1)
lessB_out_ga(x1, x2)  =  lessB_out_ga(x1)
U4_ga(x1, x2, x3)  =  U4_ga(x1, x3)
U2_aga(x1, x2, x3)  =  U2_aga(x2, x3)
lessC_in_ag(x1, x2)  =  lessC_in_ag(x2)
lessC_out_ag(x1, x2)  =  lessC_out_ag(x1, x2)
U5_ag(x1, x2, x3)  =  U5_ag(x2, x3)
U3_aga(x1, x2, x3)  =  U3_aga(x2, x3)
MAXA_IN_AGA(x1, x2, x3)  =  MAXA_IN_AGA(x2)
U1_AGA(x1, x2, x3)  =  U1_AGA(x2, x3)
LESSB_IN_GA(x1, x2)  =  LESSB_IN_GA(x1)
U4_GA(x1, x2, x3)  =  U4_GA(x1, x3)
U2_AGA(x1, x2, x3)  =  U2_AGA(x2, x3)
LESSC_IN_AG(x1, x2)  =  LESSC_IN_AG(x2)
U5_AG(x1, x2, x3)  =  U5_AG(x2, x3)
U3_AGA(x1, x2, x3)  =  U3_AGA(x2, x3)

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

(5) DependencyGraphProof (EQUIVALENT transformation)

The approximation of the Dependency Graph [LOPSTR] contains 2 SCCs with 7 less nodes.

(6) Complex Obligation (AND)

(7) Obligation:

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

LESSC_IN_AG(s(T75), s(T74)) → LESSC_IN_AG(T75, T74)

The TRS R consists of the following rules:

maxA_in_aga(s(T13), 0, s(T13)) → maxA_out_aga(s(T13), 0, s(T13))
maxA_in_aga(s(T24), s(T22), s(T24)) → U1_aga(T24, T22, lessB_in_ga(T22, T24))
lessB_in_ga(0, s(T31)) → lessB_out_ga(0, s(T31))
lessB_in_ga(s(T36), s(T38)) → U4_ga(T36, T38, lessB_in_ga(T36, T38))
U4_ga(T36, T38, lessB_out_ga(T36, T38)) → lessB_out_ga(s(T36), s(T38))
U1_aga(T24, T22, lessB_out_ga(T22, T24)) → maxA_out_aga(s(T24), s(T22), s(T24))
maxA_in_aga(0, T54, T54) → maxA_out_aga(0, T54, T54)
maxA_in_aga(s(T61), T60, T60) → U2_aga(T61, T60, lessC_in_ag(T61, T60))
lessC_in_ag(0, s(T68)) → lessC_out_ag(0, s(T68))
lessC_in_ag(s(T75), s(T74)) → U5_ag(T75, T74, lessC_in_ag(T75, T74))
U5_ag(T75, T74, lessC_out_ag(T75, T74)) → lessC_out_ag(s(T75), s(T74))
U2_aga(T61, T60, lessC_out_ag(T61, T60)) → maxA_out_aga(s(T61), T60, T60)
maxA_in_aga(s(T94), T93, T93) → U3_aga(T94, T93, lessC_in_ag(T94, T93))
U3_aga(T94, T93, lessC_out_ag(T94, T93)) → maxA_out_aga(s(T94), T93, T93)

The argument filtering Pi contains the following mapping:
maxA_in_aga(x1, x2, x3)  =  maxA_in_aga(x2)
0  =  0
maxA_out_aga(x1, x2, x3)  =  maxA_out_aga(x2)
s(x1)  =  s(x1)
U1_aga(x1, x2, x3)  =  U1_aga(x2, x3)
lessB_in_ga(x1, x2)  =  lessB_in_ga(x1)
lessB_out_ga(x1, x2)  =  lessB_out_ga(x1)
U4_ga(x1, x2, x3)  =  U4_ga(x1, x3)
U2_aga(x1, x2, x3)  =  U2_aga(x2, x3)
lessC_in_ag(x1, x2)  =  lessC_in_ag(x2)
lessC_out_ag(x1, x2)  =  lessC_out_ag(x1, x2)
U5_ag(x1, x2, x3)  =  U5_ag(x2, x3)
U3_aga(x1, x2, x3)  =  U3_aga(x2, x3)
LESSC_IN_AG(x1, x2)  =  LESSC_IN_AG(x2)

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

(8) UsableRulesProof (EQUIVALENT transformation)

For (infinitary) constructor rewriting [LOPSTR] we can delete all non-usable rules from R.

(9) Obligation:

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

LESSC_IN_AG(s(T75), s(T74)) → LESSC_IN_AG(T75, T74)

R is empty.
The argument filtering Pi contains the following mapping:
s(x1)  =  s(x1)
LESSC_IN_AG(x1, x2)  =  LESSC_IN_AG(x2)

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

(10) PiDPToQDPProof (SOUND transformation)

Transforming (infinitary) constructor rewriting Pi-DP problem [LOPSTR] into ordinary QDP problem [LPAR04] by application of Pi.

(11) Obligation:

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

LESSC_IN_AG(s(T74)) → LESSC_IN_AG(T74)

R is empty.
Q is empty.
We have to consider all (P,Q,R)-chains.

(12) QDPSizeChangeProof (EQUIVALENT transformation)

By using the subterm criterion [SUBTERM_CRITERION] together with the size-change analysis [AAECC05] we have proven that there are no infinite chains for this DP problem.

From the DPs we obtained the following set of size-change graphs:

  • LESSC_IN_AG(s(T74)) → LESSC_IN_AG(T74)
    The graph contains the following edges 1 > 1

(13) YES

(14) Obligation:

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

LESSB_IN_GA(s(T36), s(T38)) → LESSB_IN_GA(T36, T38)

The TRS R consists of the following rules:

maxA_in_aga(s(T13), 0, s(T13)) → maxA_out_aga(s(T13), 0, s(T13))
maxA_in_aga(s(T24), s(T22), s(T24)) → U1_aga(T24, T22, lessB_in_ga(T22, T24))
lessB_in_ga(0, s(T31)) → lessB_out_ga(0, s(T31))
lessB_in_ga(s(T36), s(T38)) → U4_ga(T36, T38, lessB_in_ga(T36, T38))
U4_ga(T36, T38, lessB_out_ga(T36, T38)) → lessB_out_ga(s(T36), s(T38))
U1_aga(T24, T22, lessB_out_ga(T22, T24)) → maxA_out_aga(s(T24), s(T22), s(T24))
maxA_in_aga(0, T54, T54) → maxA_out_aga(0, T54, T54)
maxA_in_aga(s(T61), T60, T60) → U2_aga(T61, T60, lessC_in_ag(T61, T60))
lessC_in_ag(0, s(T68)) → lessC_out_ag(0, s(T68))
lessC_in_ag(s(T75), s(T74)) → U5_ag(T75, T74, lessC_in_ag(T75, T74))
U5_ag(T75, T74, lessC_out_ag(T75, T74)) → lessC_out_ag(s(T75), s(T74))
U2_aga(T61, T60, lessC_out_ag(T61, T60)) → maxA_out_aga(s(T61), T60, T60)
maxA_in_aga(s(T94), T93, T93) → U3_aga(T94, T93, lessC_in_ag(T94, T93))
U3_aga(T94, T93, lessC_out_ag(T94, T93)) → maxA_out_aga(s(T94), T93, T93)

The argument filtering Pi contains the following mapping:
maxA_in_aga(x1, x2, x3)  =  maxA_in_aga(x2)
0  =  0
maxA_out_aga(x1, x2, x3)  =  maxA_out_aga(x2)
s(x1)  =  s(x1)
U1_aga(x1, x2, x3)  =  U1_aga(x2, x3)
lessB_in_ga(x1, x2)  =  lessB_in_ga(x1)
lessB_out_ga(x1, x2)  =  lessB_out_ga(x1)
U4_ga(x1, x2, x3)  =  U4_ga(x1, x3)
U2_aga(x1, x2, x3)  =  U2_aga(x2, x3)
lessC_in_ag(x1, x2)  =  lessC_in_ag(x2)
lessC_out_ag(x1, x2)  =  lessC_out_ag(x1, x2)
U5_ag(x1, x2, x3)  =  U5_ag(x2, x3)
U3_aga(x1, x2, x3)  =  U3_aga(x2, x3)
LESSB_IN_GA(x1, x2)  =  LESSB_IN_GA(x1)

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

(15) UsableRulesProof (EQUIVALENT transformation)

For (infinitary) constructor rewriting [LOPSTR] we can delete all non-usable rules from R.

(16) Obligation:

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

LESSB_IN_GA(s(T36), s(T38)) → LESSB_IN_GA(T36, T38)

R is empty.
The argument filtering Pi contains the following mapping:
s(x1)  =  s(x1)
LESSB_IN_GA(x1, x2)  =  LESSB_IN_GA(x1)

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

(17) PiDPToQDPProof (SOUND transformation)

Transforming (infinitary) constructor rewriting Pi-DP problem [LOPSTR] into ordinary QDP problem [LPAR04] by application of Pi.

(18) Obligation:

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

LESSB_IN_GA(s(T36)) → LESSB_IN_GA(T36)

R is empty.
Q is empty.
We have to consider all (P,Q,R)-chains.

(19) QDPSizeChangeProof (EQUIVALENT transformation)

By using the subterm criterion [SUBTERM_CRITERION] together with the size-change analysis [AAECC05] we have proven that there are no infinite chains for this DP problem.

From the DPs we obtained the following set of size-change graphs:

  • LESSB_IN_GA(s(T36)) → LESSB_IN_GA(T36)
    The graph contains the following edges 1 > 1

(20) YES