(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(g,a,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_gaa(s(T13), 0, s(T13)) → maxA_out_gaa(s(T13), 0, s(T13))
maxA_in_gaa(s(T23), s(T24), s(T23)) → U1_gaa(T23, T24, lessB_in_ag(T24, T23))
lessB_in_ag(0, s(T31)) → lessB_out_ag(0, s(T31))
lessB_in_ag(s(T38), s(T37)) → U4_ag(T38, T37, lessB_in_ag(T38, T37))
U4_ag(T38, T37, lessB_out_ag(T38, T37)) → lessB_out_ag(s(T38), s(T37))
U1_gaa(T23, T24, lessB_out_ag(T24, T23)) → maxA_out_gaa(s(T23), s(T24), s(T23))
maxA_in_gaa(0, T54, T54) → maxA_out_gaa(0, T54, T54)
maxA_in_gaa(s(T59), T61, T61) → U2_gaa(T59, T61, lessC_in_ga(T59, T61))
lessC_in_ga(0, s(T68)) → lessC_out_ga(0, s(T68))
lessC_in_ga(s(T73), s(T75)) → U5_ga(T73, T75, lessC_in_ga(T73, T75))
U5_ga(T73, T75, lessC_out_ga(T73, T75)) → lessC_out_ga(s(T73), s(T75))
U2_gaa(T59, T61, lessC_out_ga(T59, T61)) → maxA_out_gaa(s(T59), T61, T61)
maxA_in_gaa(s(T92), T94, T94) → U3_gaa(T92, T94, lessC_in_ga(T92, T94))
U3_gaa(T92, T94, lessC_out_ga(T92, T94)) → maxA_out_gaa(s(T92), T94, T94)

The argument filtering Pi contains the following mapping:
maxA_in_gaa(x1, x2, x3)  =  maxA_in_gaa(x1)
s(x1)  =  s(x1)
maxA_out_gaa(x1, x2, x3)  =  maxA_out_gaa(x1)
U1_gaa(x1, x2, x3)  =  U1_gaa(x1, x3)
lessB_in_ag(x1, x2)  =  lessB_in_ag(x2)
lessB_out_ag(x1, x2)  =  lessB_out_ag(x1, x2)
U4_ag(x1, x2, x3)  =  U4_ag(x2, x3)
0  =  0
U2_gaa(x1, x2, x3)  =  U2_gaa(x1, x3)
lessC_in_ga(x1, x2)  =  lessC_in_ga(x1)
lessC_out_ga(x1, x2)  =  lessC_out_ga(x1)
U5_ga(x1, x2, x3)  =  U5_ga(x1, x3)
U3_gaa(x1, x2, x3)  =  U3_gaa(x1, 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_GAA(s(T23), s(T24), s(T23)) → U1_GAA(T23, T24, lessB_in_ag(T24, T23))
MAXA_IN_GAA(s(T23), s(T24), s(T23)) → LESSB_IN_AG(T24, T23)
LESSB_IN_AG(s(T38), s(T37)) → U4_AG(T38, T37, lessB_in_ag(T38, T37))
LESSB_IN_AG(s(T38), s(T37)) → LESSB_IN_AG(T38, T37)
MAXA_IN_GAA(s(T59), T61, T61) → U2_GAA(T59, T61, lessC_in_ga(T59, T61))
MAXA_IN_GAA(s(T59), T61, T61) → LESSC_IN_GA(T59, T61)
LESSC_IN_GA(s(T73), s(T75)) → U5_GA(T73, T75, lessC_in_ga(T73, T75))
LESSC_IN_GA(s(T73), s(T75)) → LESSC_IN_GA(T73, T75)
MAXA_IN_GAA(s(T92), T94, T94) → U3_GAA(T92, T94, lessC_in_ga(T92, T94))

The TRS R consists of the following rules:

maxA_in_gaa(s(T13), 0, s(T13)) → maxA_out_gaa(s(T13), 0, s(T13))
maxA_in_gaa(s(T23), s(T24), s(T23)) → U1_gaa(T23, T24, lessB_in_ag(T24, T23))
lessB_in_ag(0, s(T31)) → lessB_out_ag(0, s(T31))
lessB_in_ag(s(T38), s(T37)) → U4_ag(T38, T37, lessB_in_ag(T38, T37))
U4_ag(T38, T37, lessB_out_ag(T38, T37)) → lessB_out_ag(s(T38), s(T37))
U1_gaa(T23, T24, lessB_out_ag(T24, T23)) → maxA_out_gaa(s(T23), s(T24), s(T23))
maxA_in_gaa(0, T54, T54) → maxA_out_gaa(0, T54, T54)
maxA_in_gaa(s(T59), T61, T61) → U2_gaa(T59, T61, lessC_in_ga(T59, T61))
lessC_in_ga(0, s(T68)) → lessC_out_ga(0, s(T68))
lessC_in_ga(s(T73), s(T75)) → U5_ga(T73, T75, lessC_in_ga(T73, T75))
U5_ga(T73, T75, lessC_out_ga(T73, T75)) → lessC_out_ga(s(T73), s(T75))
U2_gaa(T59, T61, lessC_out_ga(T59, T61)) → maxA_out_gaa(s(T59), T61, T61)
maxA_in_gaa(s(T92), T94, T94) → U3_gaa(T92, T94, lessC_in_ga(T92, T94))
U3_gaa(T92, T94, lessC_out_ga(T92, T94)) → maxA_out_gaa(s(T92), T94, T94)

The argument filtering Pi contains the following mapping:
maxA_in_gaa(x1, x2, x3)  =  maxA_in_gaa(x1)
s(x1)  =  s(x1)
maxA_out_gaa(x1, x2, x3)  =  maxA_out_gaa(x1)
U1_gaa(x1, x2, x3)  =  U1_gaa(x1, x3)
lessB_in_ag(x1, x2)  =  lessB_in_ag(x2)
lessB_out_ag(x1, x2)  =  lessB_out_ag(x1, x2)
U4_ag(x1, x2, x3)  =  U4_ag(x2, x3)
0  =  0
U2_gaa(x1, x2, x3)  =  U2_gaa(x1, x3)
lessC_in_ga(x1, x2)  =  lessC_in_ga(x1)
lessC_out_ga(x1, x2)  =  lessC_out_ga(x1)
U5_ga(x1, x2, x3)  =  U5_ga(x1, x3)
U3_gaa(x1, x2, x3)  =  U3_gaa(x1, x3)
MAXA_IN_GAA(x1, x2, x3)  =  MAXA_IN_GAA(x1)
U1_GAA(x1, x2, x3)  =  U1_GAA(x1, x3)
LESSB_IN_AG(x1, x2)  =  LESSB_IN_AG(x2)
U4_AG(x1, x2, x3)  =  U4_AG(x2, x3)
U2_GAA(x1, x2, x3)  =  U2_GAA(x1, x3)
LESSC_IN_GA(x1, x2)  =  LESSC_IN_GA(x1)
U5_GA(x1, x2, x3)  =  U5_GA(x1, x3)
U3_GAA(x1, x2, x3)  =  U3_GAA(x1, 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_GAA(s(T23), s(T24), s(T23)) → U1_GAA(T23, T24, lessB_in_ag(T24, T23))
MAXA_IN_GAA(s(T23), s(T24), s(T23)) → LESSB_IN_AG(T24, T23)
LESSB_IN_AG(s(T38), s(T37)) → U4_AG(T38, T37, lessB_in_ag(T38, T37))
LESSB_IN_AG(s(T38), s(T37)) → LESSB_IN_AG(T38, T37)
MAXA_IN_GAA(s(T59), T61, T61) → U2_GAA(T59, T61, lessC_in_ga(T59, T61))
MAXA_IN_GAA(s(T59), T61, T61) → LESSC_IN_GA(T59, T61)
LESSC_IN_GA(s(T73), s(T75)) → U5_GA(T73, T75, lessC_in_ga(T73, T75))
LESSC_IN_GA(s(T73), s(T75)) → LESSC_IN_GA(T73, T75)
MAXA_IN_GAA(s(T92), T94, T94) → U3_GAA(T92, T94, lessC_in_ga(T92, T94))

The TRS R consists of the following rules:

maxA_in_gaa(s(T13), 0, s(T13)) → maxA_out_gaa(s(T13), 0, s(T13))
maxA_in_gaa(s(T23), s(T24), s(T23)) → U1_gaa(T23, T24, lessB_in_ag(T24, T23))
lessB_in_ag(0, s(T31)) → lessB_out_ag(0, s(T31))
lessB_in_ag(s(T38), s(T37)) → U4_ag(T38, T37, lessB_in_ag(T38, T37))
U4_ag(T38, T37, lessB_out_ag(T38, T37)) → lessB_out_ag(s(T38), s(T37))
U1_gaa(T23, T24, lessB_out_ag(T24, T23)) → maxA_out_gaa(s(T23), s(T24), s(T23))
maxA_in_gaa(0, T54, T54) → maxA_out_gaa(0, T54, T54)
maxA_in_gaa(s(T59), T61, T61) → U2_gaa(T59, T61, lessC_in_ga(T59, T61))
lessC_in_ga(0, s(T68)) → lessC_out_ga(0, s(T68))
lessC_in_ga(s(T73), s(T75)) → U5_ga(T73, T75, lessC_in_ga(T73, T75))
U5_ga(T73, T75, lessC_out_ga(T73, T75)) → lessC_out_ga(s(T73), s(T75))
U2_gaa(T59, T61, lessC_out_ga(T59, T61)) → maxA_out_gaa(s(T59), T61, T61)
maxA_in_gaa(s(T92), T94, T94) → U3_gaa(T92, T94, lessC_in_ga(T92, T94))
U3_gaa(T92, T94, lessC_out_ga(T92, T94)) → maxA_out_gaa(s(T92), T94, T94)

The argument filtering Pi contains the following mapping:
maxA_in_gaa(x1, x2, x3)  =  maxA_in_gaa(x1)
s(x1)  =  s(x1)
maxA_out_gaa(x1, x2, x3)  =  maxA_out_gaa(x1)
U1_gaa(x1, x2, x3)  =  U1_gaa(x1, x3)
lessB_in_ag(x1, x2)  =  lessB_in_ag(x2)
lessB_out_ag(x1, x2)  =  lessB_out_ag(x1, x2)
U4_ag(x1, x2, x3)  =  U4_ag(x2, x3)
0  =  0
U2_gaa(x1, x2, x3)  =  U2_gaa(x1, x3)
lessC_in_ga(x1, x2)  =  lessC_in_ga(x1)
lessC_out_ga(x1, x2)  =  lessC_out_ga(x1)
U5_ga(x1, x2, x3)  =  U5_ga(x1, x3)
U3_gaa(x1, x2, x3)  =  U3_gaa(x1, x3)
MAXA_IN_GAA(x1, x2, x3)  =  MAXA_IN_GAA(x1)
U1_GAA(x1, x2, x3)  =  U1_GAA(x1, x3)
LESSB_IN_AG(x1, x2)  =  LESSB_IN_AG(x2)
U4_AG(x1, x2, x3)  =  U4_AG(x2, x3)
U2_GAA(x1, x2, x3)  =  U2_GAA(x1, x3)
LESSC_IN_GA(x1, x2)  =  LESSC_IN_GA(x1)
U5_GA(x1, x2, x3)  =  U5_GA(x1, x3)
U3_GAA(x1, x2, x3)  =  U3_GAA(x1, 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_GA(s(T73), s(T75)) → LESSC_IN_GA(T73, T75)

The TRS R consists of the following rules:

maxA_in_gaa(s(T13), 0, s(T13)) → maxA_out_gaa(s(T13), 0, s(T13))
maxA_in_gaa(s(T23), s(T24), s(T23)) → U1_gaa(T23, T24, lessB_in_ag(T24, T23))
lessB_in_ag(0, s(T31)) → lessB_out_ag(0, s(T31))
lessB_in_ag(s(T38), s(T37)) → U4_ag(T38, T37, lessB_in_ag(T38, T37))
U4_ag(T38, T37, lessB_out_ag(T38, T37)) → lessB_out_ag(s(T38), s(T37))
U1_gaa(T23, T24, lessB_out_ag(T24, T23)) → maxA_out_gaa(s(T23), s(T24), s(T23))
maxA_in_gaa(0, T54, T54) → maxA_out_gaa(0, T54, T54)
maxA_in_gaa(s(T59), T61, T61) → U2_gaa(T59, T61, lessC_in_ga(T59, T61))
lessC_in_ga(0, s(T68)) → lessC_out_ga(0, s(T68))
lessC_in_ga(s(T73), s(T75)) → U5_ga(T73, T75, lessC_in_ga(T73, T75))
U5_ga(T73, T75, lessC_out_ga(T73, T75)) → lessC_out_ga(s(T73), s(T75))
U2_gaa(T59, T61, lessC_out_ga(T59, T61)) → maxA_out_gaa(s(T59), T61, T61)
maxA_in_gaa(s(T92), T94, T94) → U3_gaa(T92, T94, lessC_in_ga(T92, T94))
U3_gaa(T92, T94, lessC_out_ga(T92, T94)) → maxA_out_gaa(s(T92), T94, T94)

The argument filtering Pi contains the following mapping:
maxA_in_gaa(x1, x2, x3)  =  maxA_in_gaa(x1)
s(x1)  =  s(x1)
maxA_out_gaa(x1, x2, x3)  =  maxA_out_gaa(x1)
U1_gaa(x1, x2, x3)  =  U1_gaa(x1, x3)
lessB_in_ag(x1, x2)  =  lessB_in_ag(x2)
lessB_out_ag(x1, x2)  =  lessB_out_ag(x1, x2)
U4_ag(x1, x2, x3)  =  U4_ag(x2, x3)
0  =  0
U2_gaa(x1, x2, x3)  =  U2_gaa(x1, x3)
lessC_in_ga(x1, x2)  =  lessC_in_ga(x1)
lessC_out_ga(x1, x2)  =  lessC_out_ga(x1)
U5_ga(x1, x2, x3)  =  U5_ga(x1, x3)
U3_gaa(x1, x2, x3)  =  U3_gaa(x1, x3)
LESSC_IN_GA(x1, x2)  =  LESSC_IN_GA(x1)

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_GA(s(T73), s(T75)) → LESSC_IN_GA(T73, T75)

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

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_GA(s(T73)) → LESSC_IN_GA(T73)

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_GA(s(T73)) → LESSC_IN_GA(T73)
    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_AG(s(T38), s(T37)) → LESSB_IN_AG(T38, T37)

The TRS R consists of the following rules:

maxA_in_gaa(s(T13), 0, s(T13)) → maxA_out_gaa(s(T13), 0, s(T13))
maxA_in_gaa(s(T23), s(T24), s(T23)) → U1_gaa(T23, T24, lessB_in_ag(T24, T23))
lessB_in_ag(0, s(T31)) → lessB_out_ag(0, s(T31))
lessB_in_ag(s(T38), s(T37)) → U4_ag(T38, T37, lessB_in_ag(T38, T37))
U4_ag(T38, T37, lessB_out_ag(T38, T37)) → lessB_out_ag(s(T38), s(T37))
U1_gaa(T23, T24, lessB_out_ag(T24, T23)) → maxA_out_gaa(s(T23), s(T24), s(T23))
maxA_in_gaa(0, T54, T54) → maxA_out_gaa(0, T54, T54)
maxA_in_gaa(s(T59), T61, T61) → U2_gaa(T59, T61, lessC_in_ga(T59, T61))
lessC_in_ga(0, s(T68)) → lessC_out_ga(0, s(T68))
lessC_in_ga(s(T73), s(T75)) → U5_ga(T73, T75, lessC_in_ga(T73, T75))
U5_ga(T73, T75, lessC_out_ga(T73, T75)) → lessC_out_ga(s(T73), s(T75))
U2_gaa(T59, T61, lessC_out_ga(T59, T61)) → maxA_out_gaa(s(T59), T61, T61)
maxA_in_gaa(s(T92), T94, T94) → U3_gaa(T92, T94, lessC_in_ga(T92, T94))
U3_gaa(T92, T94, lessC_out_ga(T92, T94)) → maxA_out_gaa(s(T92), T94, T94)

The argument filtering Pi contains the following mapping:
maxA_in_gaa(x1, x2, x3)  =  maxA_in_gaa(x1)
s(x1)  =  s(x1)
maxA_out_gaa(x1, x2, x3)  =  maxA_out_gaa(x1)
U1_gaa(x1, x2, x3)  =  U1_gaa(x1, x3)
lessB_in_ag(x1, x2)  =  lessB_in_ag(x2)
lessB_out_ag(x1, x2)  =  lessB_out_ag(x1, x2)
U4_ag(x1, x2, x3)  =  U4_ag(x2, x3)
0  =  0
U2_gaa(x1, x2, x3)  =  U2_gaa(x1, x3)
lessC_in_ga(x1, x2)  =  lessC_in_ga(x1)
lessC_out_ga(x1, x2)  =  lessC_out_ga(x1)
U5_ga(x1, x2, x3)  =  U5_ga(x1, x3)
U3_gaa(x1, x2, x3)  =  U3_gaa(x1, x3)
LESSB_IN_AG(x1, x2)  =  LESSB_IN_AG(x2)

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_AG(s(T38), s(T37)) → LESSB_IN_AG(T38, T37)

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

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_AG(s(T37)) → LESSB_IN_AG(T37)

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_AG(s(T37)) → LESSB_IN_AG(T37)
    The graph contains the following edges 1 > 1

(20) YES