(0) Obligation:

Clauses:

hbal_tree(zero, nil).
hbal_tree(s(zero), t(x, nil, nil)).
hbal_tree(s(s(X)), t(x, L, R)) :- ','(distr(s(X), X, DL, DR), ','(hbal_tree(DL, L), hbal_tree(DR, R))).
distr(D1, X1, D1, D1).
distr(D1, D2, D1, D2).
distr(D1, D2, D2, D1).

Queries:

hbal_tree(g,a).

(1) PrologToPrologProblemTransformerProof (SOUND transformation)

Built Prolog problem from termination graph.

(2) Obligation:

Clauses:

hbal_tree1(zero, nil).
hbal_tree1(s(zero), t(x, nil, nil)).
hbal_tree1(s(s(T15)), t(x, T9, T10)) :- hbal_tree1(s(T15), T9).
hbal_tree1(s(s(T15)), t(x, T9, T16)) :- ','(hbal_tree1(s(T15), T9), hbal_tree1(s(T15), T16)).
hbal_tree1(s(s(T21)), t(x, T9, T10)) :- hbal_tree1(s(T21), T9).
hbal_tree1(s(s(T21)), t(x, T9, T22)) :- ','(hbal_tree1(s(T21), T9), hbal_tree1(T21, T22)).
hbal_tree1(s(s(T25)), t(x, T9, T10)) :- hbal_tree1(T25, T9).
hbal_tree1(s(s(T25)), t(x, T9, T26)) :- ','(hbal_tree1(T25, T9), hbal_tree1(s(T25), T26)).

Queries:

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

hbal_tree1_in_ga(zero, nil) → hbal_tree1_out_ga(zero, nil)
hbal_tree1_in_ga(s(zero), t(x, nil, nil)) → hbal_tree1_out_ga(s(zero), t(x, nil, nil))
hbal_tree1_in_ga(s(s(T15)), t(x, T9, T10)) → U1_ga(T15, T9, T10, hbal_tree1_in_ga(s(T15), T9))
hbal_tree1_in_ga(s(s(T15)), t(x, T9, T16)) → U2_ga(T15, T9, T16, hbal_tree1_in_ga(s(T15), T9))
hbal_tree1_in_ga(s(s(T21)), t(x, T9, T10)) → U4_ga(T21, T9, T10, hbal_tree1_in_ga(s(T21), T9))
hbal_tree1_in_ga(s(s(T21)), t(x, T9, T22)) → U5_ga(T21, T9, T22, hbal_tree1_in_ga(s(T21), T9))
hbal_tree1_in_ga(s(s(T25)), t(x, T9, T10)) → U7_ga(T25, T9, T10, hbal_tree1_in_ga(T25, T9))
hbal_tree1_in_ga(s(s(T25)), t(x, T9, T26)) → U8_ga(T25, T9, T26, hbal_tree1_in_ga(T25, T9))
U8_ga(T25, T9, T26, hbal_tree1_out_ga(T25, T9)) → U9_ga(T25, T9, T26, hbal_tree1_in_ga(s(T25), T26))
U9_ga(T25, T9, T26, hbal_tree1_out_ga(s(T25), T26)) → hbal_tree1_out_ga(s(s(T25)), t(x, T9, T26))
U7_ga(T25, T9, T10, hbal_tree1_out_ga(T25, T9)) → hbal_tree1_out_ga(s(s(T25)), t(x, T9, T10))
U5_ga(T21, T9, T22, hbal_tree1_out_ga(s(T21), T9)) → U6_ga(T21, T9, T22, hbal_tree1_in_ga(T21, T22))
U6_ga(T21, T9, T22, hbal_tree1_out_ga(T21, T22)) → hbal_tree1_out_ga(s(s(T21)), t(x, T9, T22))
U4_ga(T21, T9, T10, hbal_tree1_out_ga(s(T21), T9)) → hbal_tree1_out_ga(s(s(T21)), t(x, T9, T10))
U2_ga(T15, T9, T16, hbal_tree1_out_ga(s(T15), T9)) → U3_ga(T15, T9, T16, hbal_tree1_in_ga(s(T15), T16))
U3_ga(T15, T9, T16, hbal_tree1_out_ga(s(T15), T16)) → hbal_tree1_out_ga(s(s(T15)), t(x, T9, T16))
U1_ga(T15, T9, T10, hbal_tree1_out_ga(s(T15), T9)) → hbal_tree1_out_ga(s(s(T15)), t(x, T9, T10))

The argument filtering Pi contains the following mapping:
hbal_tree1_in_ga(x1, x2)  =  hbal_tree1_in_ga(x1)
zero  =  zero
hbal_tree1_out_ga(x1, x2)  =  hbal_tree1_out_ga
s(x1)  =  s(x1)
U1_ga(x1, x2, x3, x4)  =  U1_ga(x4)
U2_ga(x1, x2, x3, x4)  =  U2_ga(x1, x4)
U4_ga(x1, x2, x3, x4)  =  U4_ga(x4)
U5_ga(x1, x2, x3, x4)  =  U5_ga(x1, x4)
U7_ga(x1, x2, x3, x4)  =  U7_ga(x4)
U8_ga(x1, x2, x3, x4)  =  U8_ga(x1, x4)
U9_ga(x1, x2, x3, x4)  =  U9_ga(x4)
U6_ga(x1, x2, x3, x4)  =  U6_ga(x4)
U3_ga(x1, x2, x3, x4)  =  U3_ga(x4)

Infinitary Constructor Rewriting Termination of PiTRS implies Termination of Prolog

(4) Obligation:

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

hbal_tree1_in_ga(zero, nil) → hbal_tree1_out_ga(zero, nil)
hbal_tree1_in_ga(s(zero), t(x, nil, nil)) → hbal_tree1_out_ga(s(zero), t(x, nil, nil))
hbal_tree1_in_ga(s(s(T15)), t(x, T9, T10)) → U1_ga(T15, T9, T10, hbal_tree1_in_ga(s(T15), T9))
hbal_tree1_in_ga(s(s(T15)), t(x, T9, T16)) → U2_ga(T15, T9, T16, hbal_tree1_in_ga(s(T15), T9))
hbal_tree1_in_ga(s(s(T21)), t(x, T9, T10)) → U4_ga(T21, T9, T10, hbal_tree1_in_ga(s(T21), T9))
hbal_tree1_in_ga(s(s(T21)), t(x, T9, T22)) → U5_ga(T21, T9, T22, hbal_tree1_in_ga(s(T21), T9))
hbal_tree1_in_ga(s(s(T25)), t(x, T9, T10)) → U7_ga(T25, T9, T10, hbal_tree1_in_ga(T25, T9))
hbal_tree1_in_ga(s(s(T25)), t(x, T9, T26)) → U8_ga(T25, T9, T26, hbal_tree1_in_ga(T25, T9))
U8_ga(T25, T9, T26, hbal_tree1_out_ga(T25, T9)) → U9_ga(T25, T9, T26, hbal_tree1_in_ga(s(T25), T26))
U9_ga(T25, T9, T26, hbal_tree1_out_ga(s(T25), T26)) → hbal_tree1_out_ga(s(s(T25)), t(x, T9, T26))
U7_ga(T25, T9, T10, hbal_tree1_out_ga(T25, T9)) → hbal_tree1_out_ga(s(s(T25)), t(x, T9, T10))
U5_ga(T21, T9, T22, hbal_tree1_out_ga(s(T21), T9)) → U6_ga(T21, T9, T22, hbal_tree1_in_ga(T21, T22))
U6_ga(T21, T9, T22, hbal_tree1_out_ga(T21, T22)) → hbal_tree1_out_ga(s(s(T21)), t(x, T9, T22))
U4_ga(T21, T9, T10, hbal_tree1_out_ga(s(T21), T9)) → hbal_tree1_out_ga(s(s(T21)), t(x, T9, T10))
U2_ga(T15, T9, T16, hbal_tree1_out_ga(s(T15), T9)) → U3_ga(T15, T9, T16, hbal_tree1_in_ga(s(T15), T16))
U3_ga(T15, T9, T16, hbal_tree1_out_ga(s(T15), T16)) → hbal_tree1_out_ga(s(s(T15)), t(x, T9, T16))
U1_ga(T15, T9, T10, hbal_tree1_out_ga(s(T15), T9)) → hbal_tree1_out_ga(s(s(T15)), t(x, T9, T10))

The argument filtering Pi contains the following mapping:
hbal_tree1_in_ga(x1, x2)  =  hbal_tree1_in_ga(x1)
zero  =  zero
hbal_tree1_out_ga(x1, x2)  =  hbal_tree1_out_ga
s(x1)  =  s(x1)
U1_ga(x1, x2, x3, x4)  =  U1_ga(x4)
U2_ga(x1, x2, x3, x4)  =  U2_ga(x1, x4)
U4_ga(x1, x2, x3, x4)  =  U4_ga(x4)
U5_ga(x1, x2, x3, x4)  =  U5_ga(x1, x4)
U7_ga(x1, x2, x3, x4)  =  U7_ga(x4)
U8_ga(x1, x2, x3, x4)  =  U8_ga(x1, x4)
U9_ga(x1, x2, x3, x4)  =  U9_ga(x4)
U6_ga(x1, x2, x3, x4)  =  U6_ga(x4)
U3_ga(x1, x2, x3, x4)  =  U3_ga(x4)

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

HBAL_TREE1_IN_GA(s(s(T15)), t(x, T9, T10)) → U1_GA(T15, T9, T10, hbal_tree1_in_ga(s(T15), T9))
HBAL_TREE1_IN_GA(s(s(T15)), t(x, T9, T10)) → HBAL_TREE1_IN_GA(s(T15), T9)
HBAL_TREE1_IN_GA(s(s(T15)), t(x, T9, T16)) → U2_GA(T15, T9, T16, hbal_tree1_in_ga(s(T15), T9))
HBAL_TREE1_IN_GA(s(s(T21)), t(x, T9, T10)) → U4_GA(T21, T9, T10, hbal_tree1_in_ga(s(T21), T9))
HBAL_TREE1_IN_GA(s(s(T21)), t(x, T9, T22)) → U5_GA(T21, T9, T22, hbal_tree1_in_ga(s(T21), T9))
HBAL_TREE1_IN_GA(s(s(T25)), t(x, T9, T10)) → U7_GA(T25, T9, T10, hbal_tree1_in_ga(T25, T9))
HBAL_TREE1_IN_GA(s(s(T25)), t(x, T9, T10)) → HBAL_TREE1_IN_GA(T25, T9)
HBAL_TREE1_IN_GA(s(s(T25)), t(x, T9, T26)) → U8_GA(T25, T9, T26, hbal_tree1_in_ga(T25, T9))
U8_GA(T25, T9, T26, hbal_tree1_out_ga(T25, T9)) → U9_GA(T25, T9, T26, hbal_tree1_in_ga(s(T25), T26))
U8_GA(T25, T9, T26, hbal_tree1_out_ga(T25, T9)) → HBAL_TREE1_IN_GA(s(T25), T26)
U5_GA(T21, T9, T22, hbal_tree1_out_ga(s(T21), T9)) → U6_GA(T21, T9, T22, hbal_tree1_in_ga(T21, T22))
U5_GA(T21, T9, T22, hbal_tree1_out_ga(s(T21), T9)) → HBAL_TREE1_IN_GA(T21, T22)
U2_GA(T15, T9, T16, hbal_tree1_out_ga(s(T15), T9)) → U3_GA(T15, T9, T16, hbal_tree1_in_ga(s(T15), T16))
U2_GA(T15, T9, T16, hbal_tree1_out_ga(s(T15), T9)) → HBAL_TREE1_IN_GA(s(T15), T16)

The TRS R consists of the following rules:

hbal_tree1_in_ga(zero, nil) → hbal_tree1_out_ga(zero, nil)
hbal_tree1_in_ga(s(zero), t(x, nil, nil)) → hbal_tree1_out_ga(s(zero), t(x, nil, nil))
hbal_tree1_in_ga(s(s(T15)), t(x, T9, T10)) → U1_ga(T15, T9, T10, hbal_tree1_in_ga(s(T15), T9))
hbal_tree1_in_ga(s(s(T15)), t(x, T9, T16)) → U2_ga(T15, T9, T16, hbal_tree1_in_ga(s(T15), T9))
hbal_tree1_in_ga(s(s(T21)), t(x, T9, T10)) → U4_ga(T21, T9, T10, hbal_tree1_in_ga(s(T21), T9))
hbal_tree1_in_ga(s(s(T21)), t(x, T9, T22)) → U5_ga(T21, T9, T22, hbal_tree1_in_ga(s(T21), T9))
hbal_tree1_in_ga(s(s(T25)), t(x, T9, T10)) → U7_ga(T25, T9, T10, hbal_tree1_in_ga(T25, T9))
hbal_tree1_in_ga(s(s(T25)), t(x, T9, T26)) → U8_ga(T25, T9, T26, hbal_tree1_in_ga(T25, T9))
U8_ga(T25, T9, T26, hbal_tree1_out_ga(T25, T9)) → U9_ga(T25, T9, T26, hbal_tree1_in_ga(s(T25), T26))
U9_ga(T25, T9, T26, hbal_tree1_out_ga(s(T25), T26)) → hbal_tree1_out_ga(s(s(T25)), t(x, T9, T26))
U7_ga(T25, T9, T10, hbal_tree1_out_ga(T25, T9)) → hbal_tree1_out_ga(s(s(T25)), t(x, T9, T10))
U5_ga(T21, T9, T22, hbal_tree1_out_ga(s(T21), T9)) → U6_ga(T21, T9, T22, hbal_tree1_in_ga(T21, T22))
U6_ga(T21, T9, T22, hbal_tree1_out_ga(T21, T22)) → hbal_tree1_out_ga(s(s(T21)), t(x, T9, T22))
U4_ga(T21, T9, T10, hbal_tree1_out_ga(s(T21), T9)) → hbal_tree1_out_ga(s(s(T21)), t(x, T9, T10))
U2_ga(T15, T9, T16, hbal_tree1_out_ga(s(T15), T9)) → U3_ga(T15, T9, T16, hbal_tree1_in_ga(s(T15), T16))
U3_ga(T15, T9, T16, hbal_tree1_out_ga(s(T15), T16)) → hbal_tree1_out_ga(s(s(T15)), t(x, T9, T16))
U1_ga(T15, T9, T10, hbal_tree1_out_ga(s(T15), T9)) → hbal_tree1_out_ga(s(s(T15)), t(x, T9, T10))

The argument filtering Pi contains the following mapping:
hbal_tree1_in_ga(x1, x2)  =  hbal_tree1_in_ga(x1)
zero  =  zero
hbal_tree1_out_ga(x1, x2)  =  hbal_tree1_out_ga
s(x1)  =  s(x1)
U1_ga(x1, x2, x3, x4)  =  U1_ga(x4)
U2_ga(x1, x2, x3, x4)  =  U2_ga(x1, x4)
U4_ga(x1, x2, x3, x4)  =  U4_ga(x4)
U5_ga(x1, x2, x3, x4)  =  U5_ga(x1, x4)
U7_ga(x1, x2, x3, x4)  =  U7_ga(x4)
U8_ga(x1, x2, x3, x4)  =  U8_ga(x1, x4)
U9_ga(x1, x2, x3, x4)  =  U9_ga(x4)
U6_ga(x1, x2, x3, x4)  =  U6_ga(x4)
U3_ga(x1, x2, x3, x4)  =  U3_ga(x4)
HBAL_TREE1_IN_GA(x1, x2)  =  HBAL_TREE1_IN_GA(x1)
U1_GA(x1, x2, x3, x4)  =  U1_GA(x4)
U2_GA(x1, x2, x3, x4)  =  U2_GA(x1, x4)
U4_GA(x1, x2, x3, x4)  =  U4_GA(x4)
U5_GA(x1, x2, x3, x4)  =  U5_GA(x1, x4)
U7_GA(x1, x2, x3, x4)  =  U7_GA(x4)
U8_GA(x1, x2, x3, x4)  =  U8_GA(x1, x4)
U9_GA(x1, x2, x3, x4)  =  U9_GA(x4)
U6_GA(x1, x2, x3, x4)  =  U6_GA(x4)
U3_GA(x1, x2, x3, x4)  =  U3_GA(x4)

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

(6) Obligation:

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

HBAL_TREE1_IN_GA(s(s(T15)), t(x, T9, T10)) → U1_GA(T15, T9, T10, hbal_tree1_in_ga(s(T15), T9))
HBAL_TREE1_IN_GA(s(s(T15)), t(x, T9, T10)) → HBAL_TREE1_IN_GA(s(T15), T9)
HBAL_TREE1_IN_GA(s(s(T15)), t(x, T9, T16)) → U2_GA(T15, T9, T16, hbal_tree1_in_ga(s(T15), T9))
HBAL_TREE1_IN_GA(s(s(T21)), t(x, T9, T10)) → U4_GA(T21, T9, T10, hbal_tree1_in_ga(s(T21), T9))
HBAL_TREE1_IN_GA(s(s(T21)), t(x, T9, T22)) → U5_GA(T21, T9, T22, hbal_tree1_in_ga(s(T21), T9))
HBAL_TREE1_IN_GA(s(s(T25)), t(x, T9, T10)) → U7_GA(T25, T9, T10, hbal_tree1_in_ga(T25, T9))
HBAL_TREE1_IN_GA(s(s(T25)), t(x, T9, T10)) → HBAL_TREE1_IN_GA(T25, T9)
HBAL_TREE1_IN_GA(s(s(T25)), t(x, T9, T26)) → U8_GA(T25, T9, T26, hbal_tree1_in_ga(T25, T9))
U8_GA(T25, T9, T26, hbal_tree1_out_ga(T25, T9)) → U9_GA(T25, T9, T26, hbal_tree1_in_ga(s(T25), T26))
U8_GA(T25, T9, T26, hbal_tree1_out_ga(T25, T9)) → HBAL_TREE1_IN_GA(s(T25), T26)
U5_GA(T21, T9, T22, hbal_tree1_out_ga(s(T21), T9)) → U6_GA(T21, T9, T22, hbal_tree1_in_ga(T21, T22))
U5_GA(T21, T9, T22, hbal_tree1_out_ga(s(T21), T9)) → HBAL_TREE1_IN_GA(T21, T22)
U2_GA(T15, T9, T16, hbal_tree1_out_ga(s(T15), T9)) → U3_GA(T15, T9, T16, hbal_tree1_in_ga(s(T15), T16))
U2_GA(T15, T9, T16, hbal_tree1_out_ga(s(T15), T9)) → HBAL_TREE1_IN_GA(s(T15), T16)

The TRS R consists of the following rules:

hbal_tree1_in_ga(zero, nil) → hbal_tree1_out_ga(zero, nil)
hbal_tree1_in_ga(s(zero), t(x, nil, nil)) → hbal_tree1_out_ga(s(zero), t(x, nil, nil))
hbal_tree1_in_ga(s(s(T15)), t(x, T9, T10)) → U1_ga(T15, T9, T10, hbal_tree1_in_ga(s(T15), T9))
hbal_tree1_in_ga(s(s(T15)), t(x, T9, T16)) → U2_ga(T15, T9, T16, hbal_tree1_in_ga(s(T15), T9))
hbal_tree1_in_ga(s(s(T21)), t(x, T9, T10)) → U4_ga(T21, T9, T10, hbal_tree1_in_ga(s(T21), T9))
hbal_tree1_in_ga(s(s(T21)), t(x, T9, T22)) → U5_ga(T21, T9, T22, hbal_tree1_in_ga(s(T21), T9))
hbal_tree1_in_ga(s(s(T25)), t(x, T9, T10)) → U7_ga(T25, T9, T10, hbal_tree1_in_ga(T25, T9))
hbal_tree1_in_ga(s(s(T25)), t(x, T9, T26)) → U8_ga(T25, T9, T26, hbal_tree1_in_ga(T25, T9))
U8_ga(T25, T9, T26, hbal_tree1_out_ga(T25, T9)) → U9_ga(T25, T9, T26, hbal_tree1_in_ga(s(T25), T26))
U9_ga(T25, T9, T26, hbal_tree1_out_ga(s(T25), T26)) → hbal_tree1_out_ga(s(s(T25)), t(x, T9, T26))
U7_ga(T25, T9, T10, hbal_tree1_out_ga(T25, T9)) → hbal_tree1_out_ga(s(s(T25)), t(x, T9, T10))
U5_ga(T21, T9, T22, hbal_tree1_out_ga(s(T21), T9)) → U6_ga(T21, T9, T22, hbal_tree1_in_ga(T21, T22))
U6_ga(T21, T9, T22, hbal_tree1_out_ga(T21, T22)) → hbal_tree1_out_ga(s(s(T21)), t(x, T9, T22))
U4_ga(T21, T9, T10, hbal_tree1_out_ga(s(T21), T9)) → hbal_tree1_out_ga(s(s(T21)), t(x, T9, T10))
U2_ga(T15, T9, T16, hbal_tree1_out_ga(s(T15), T9)) → U3_ga(T15, T9, T16, hbal_tree1_in_ga(s(T15), T16))
U3_ga(T15, T9, T16, hbal_tree1_out_ga(s(T15), T16)) → hbal_tree1_out_ga(s(s(T15)), t(x, T9, T16))
U1_ga(T15, T9, T10, hbal_tree1_out_ga(s(T15), T9)) → hbal_tree1_out_ga(s(s(T15)), t(x, T9, T10))

The argument filtering Pi contains the following mapping:
hbal_tree1_in_ga(x1, x2)  =  hbal_tree1_in_ga(x1)
zero  =  zero
hbal_tree1_out_ga(x1, x2)  =  hbal_tree1_out_ga
s(x1)  =  s(x1)
U1_ga(x1, x2, x3, x4)  =  U1_ga(x4)
U2_ga(x1, x2, x3, x4)  =  U2_ga(x1, x4)
U4_ga(x1, x2, x3, x4)  =  U4_ga(x4)
U5_ga(x1, x2, x3, x4)  =  U5_ga(x1, x4)
U7_ga(x1, x2, x3, x4)  =  U7_ga(x4)
U8_ga(x1, x2, x3, x4)  =  U8_ga(x1, x4)
U9_ga(x1, x2, x3, x4)  =  U9_ga(x4)
U6_ga(x1, x2, x3, x4)  =  U6_ga(x4)
U3_ga(x1, x2, x3, x4)  =  U3_ga(x4)
HBAL_TREE1_IN_GA(x1, x2)  =  HBAL_TREE1_IN_GA(x1)
U1_GA(x1, x2, x3, x4)  =  U1_GA(x4)
U2_GA(x1, x2, x3, x4)  =  U2_GA(x1, x4)
U4_GA(x1, x2, x3, x4)  =  U4_GA(x4)
U5_GA(x1, x2, x3, x4)  =  U5_GA(x1, x4)
U7_GA(x1, x2, x3, x4)  =  U7_GA(x4)
U8_GA(x1, x2, x3, x4)  =  U8_GA(x1, x4)
U9_GA(x1, x2, x3, x4)  =  U9_GA(x4)
U6_GA(x1, x2, x3, x4)  =  U6_GA(x4)
U3_GA(x1, x2, x3, x4)  =  U3_GA(x4)

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

(7) DependencyGraphProof (EQUIVALENT transformation)

The approximation of the Dependency Graph [LOPSTR] contains 1 SCC with 6 less nodes.

(8) Obligation:

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

HBAL_TREE1_IN_GA(s(s(T15)), t(x, T9, T16)) → U2_GA(T15, T9, T16, hbal_tree1_in_ga(s(T15), T9))
U2_GA(T15, T9, T16, hbal_tree1_out_ga(s(T15), T9)) → HBAL_TREE1_IN_GA(s(T15), T16)
HBAL_TREE1_IN_GA(s(s(T15)), t(x, T9, T10)) → HBAL_TREE1_IN_GA(s(T15), T9)
HBAL_TREE1_IN_GA(s(s(T21)), t(x, T9, T22)) → U5_GA(T21, T9, T22, hbal_tree1_in_ga(s(T21), T9))
U5_GA(T21, T9, T22, hbal_tree1_out_ga(s(T21), T9)) → HBAL_TREE1_IN_GA(T21, T22)
HBAL_TREE1_IN_GA(s(s(T25)), t(x, T9, T10)) → HBAL_TREE1_IN_GA(T25, T9)
HBAL_TREE1_IN_GA(s(s(T25)), t(x, T9, T26)) → U8_GA(T25, T9, T26, hbal_tree1_in_ga(T25, T9))
U8_GA(T25, T9, T26, hbal_tree1_out_ga(T25, T9)) → HBAL_TREE1_IN_GA(s(T25), T26)

The TRS R consists of the following rules:

hbal_tree1_in_ga(zero, nil) → hbal_tree1_out_ga(zero, nil)
hbal_tree1_in_ga(s(zero), t(x, nil, nil)) → hbal_tree1_out_ga(s(zero), t(x, nil, nil))
hbal_tree1_in_ga(s(s(T15)), t(x, T9, T10)) → U1_ga(T15, T9, T10, hbal_tree1_in_ga(s(T15), T9))
hbal_tree1_in_ga(s(s(T15)), t(x, T9, T16)) → U2_ga(T15, T9, T16, hbal_tree1_in_ga(s(T15), T9))
hbal_tree1_in_ga(s(s(T21)), t(x, T9, T10)) → U4_ga(T21, T9, T10, hbal_tree1_in_ga(s(T21), T9))
hbal_tree1_in_ga(s(s(T21)), t(x, T9, T22)) → U5_ga(T21, T9, T22, hbal_tree1_in_ga(s(T21), T9))
hbal_tree1_in_ga(s(s(T25)), t(x, T9, T10)) → U7_ga(T25, T9, T10, hbal_tree1_in_ga(T25, T9))
hbal_tree1_in_ga(s(s(T25)), t(x, T9, T26)) → U8_ga(T25, T9, T26, hbal_tree1_in_ga(T25, T9))
U8_ga(T25, T9, T26, hbal_tree1_out_ga(T25, T9)) → U9_ga(T25, T9, T26, hbal_tree1_in_ga(s(T25), T26))
U9_ga(T25, T9, T26, hbal_tree1_out_ga(s(T25), T26)) → hbal_tree1_out_ga(s(s(T25)), t(x, T9, T26))
U7_ga(T25, T9, T10, hbal_tree1_out_ga(T25, T9)) → hbal_tree1_out_ga(s(s(T25)), t(x, T9, T10))
U5_ga(T21, T9, T22, hbal_tree1_out_ga(s(T21), T9)) → U6_ga(T21, T9, T22, hbal_tree1_in_ga(T21, T22))
U6_ga(T21, T9, T22, hbal_tree1_out_ga(T21, T22)) → hbal_tree1_out_ga(s(s(T21)), t(x, T9, T22))
U4_ga(T21, T9, T10, hbal_tree1_out_ga(s(T21), T9)) → hbal_tree1_out_ga(s(s(T21)), t(x, T9, T10))
U2_ga(T15, T9, T16, hbal_tree1_out_ga(s(T15), T9)) → U3_ga(T15, T9, T16, hbal_tree1_in_ga(s(T15), T16))
U3_ga(T15, T9, T16, hbal_tree1_out_ga(s(T15), T16)) → hbal_tree1_out_ga(s(s(T15)), t(x, T9, T16))
U1_ga(T15, T9, T10, hbal_tree1_out_ga(s(T15), T9)) → hbal_tree1_out_ga(s(s(T15)), t(x, T9, T10))

The argument filtering Pi contains the following mapping:
hbal_tree1_in_ga(x1, x2)  =  hbal_tree1_in_ga(x1)
zero  =  zero
hbal_tree1_out_ga(x1, x2)  =  hbal_tree1_out_ga
s(x1)  =  s(x1)
U1_ga(x1, x2, x3, x4)  =  U1_ga(x4)
U2_ga(x1, x2, x3, x4)  =  U2_ga(x1, x4)
U4_ga(x1, x2, x3, x4)  =  U4_ga(x4)
U5_ga(x1, x2, x3, x4)  =  U5_ga(x1, x4)
U7_ga(x1, x2, x3, x4)  =  U7_ga(x4)
U8_ga(x1, x2, x3, x4)  =  U8_ga(x1, x4)
U9_ga(x1, x2, x3, x4)  =  U9_ga(x4)
U6_ga(x1, x2, x3, x4)  =  U6_ga(x4)
U3_ga(x1, x2, x3, x4)  =  U3_ga(x4)
HBAL_TREE1_IN_GA(x1, x2)  =  HBAL_TREE1_IN_GA(x1)
U2_GA(x1, x2, x3, x4)  =  U2_GA(x1, x4)
U5_GA(x1, x2, x3, x4)  =  U5_GA(x1, x4)
U8_GA(x1, x2, x3, x4)  =  U8_GA(x1, x4)

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

(9) PiDPToQDPProof (SOUND transformation)

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

(10) Obligation:

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

HBAL_TREE1_IN_GA(s(s(T15))) → U2_GA(T15, hbal_tree1_in_ga(s(T15)))
U2_GA(T15, hbal_tree1_out_ga) → HBAL_TREE1_IN_GA(s(T15))
HBAL_TREE1_IN_GA(s(s(T15))) → HBAL_TREE1_IN_GA(s(T15))
HBAL_TREE1_IN_GA(s(s(T21))) → U5_GA(T21, hbal_tree1_in_ga(s(T21)))
U5_GA(T21, hbal_tree1_out_ga) → HBAL_TREE1_IN_GA(T21)
HBAL_TREE1_IN_GA(s(s(T25))) → HBAL_TREE1_IN_GA(T25)
HBAL_TREE1_IN_GA(s(s(T25))) → U8_GA(T25, hbal_tree1_in_ga(T25))
U8_GA(T25, hbal_tree1_out_ga) → HBAL_TREE1_IN_GA(s(T25))

The TRS R consists of the following rules:

hbal_tree1_in_ga(zero) → hbal_tree1_out_ga
hbal_tree1_in_ga(s(zero)) → hbal_tree1_out_ga
hbal_tree1_in_ga(s(s(T15))) → U1_ga(hbal_tree1_in_ga(s(T15)))
hbal_tree1_in_ga(s(s(T15))) → U2_ga(T15, hbal_tree1_in_ga(s(T15)))
hbal_tree1_in_ga(s(s(T21))) → U4_ga(hbal_tree1_in_ga(s(T21)))
hbal_tree1_in_ga(s(s(T21))) → U5_ga(T21, hbal_tree1_in_ga(s(T21)))
hbal_tree1_in_ga(s(s(T25))) → U7_ga(hbal_tree1_in_ga(T25))
hbal_tree1_in_ga(s(s(T25))) → U8_ga(T25, hbal_tree1_in_ga(T25))
U8_ga(T25, hbal_tree1_out_ga) → U9_ga(hbal_tree1_in_ga(s(T25)))
U9_ga(hbal_tree1_out_ga) → hbal_tree1_out_ga
U7_ga(hbal_tree1_out_ga) → hbal_tree1_out_ga
U5_ga(T21, hbal_tree1_out_ga) → U6_ga(hbal_tree1_in_ga(T21))
U6_ga(hbal_tree1_out_ga) → hbal_tree1_out_ga
U4_ga(hbal_tree1_out_ga) → hbal_tree1_out_ga
U2_ga(T15, hbal_tree1_out_ga) → U3_ga(hbal_tree1_in_ga(s(T15)))
U3_ga(hbal_tree1_out_ga) → hbal_tree1_out_ga
U1_ga(hbal_tree1_out_ga) → hbal_tree1_out_ga

The set Q consists of the following terms:

hbal_tree1_in_ga(x0)
U8_ga(x0, x1)
U9_ga(x0)
U7_ga(x0)
U5_ga(x0, x1)
U6_ga(x0)
U4_ga(x0)
U2_ga(x0, x1)
U3_ga(x0)
U1_ga(x0)

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

(11) UsableRulesReductionPairsProof (EQUIVALENT transformation)

By using the usable rules with reduction pair processor [LPAR04] with a polynomial ordering [POLO], all dependency pairs and the corresponding usable rules [FROCOS05] can be oriented non-strictly. All non-usable rules are removed, and those dependency pairs and usable rules that have been oriented strictly or contain non-usable symbols in their left-hand side are removed as well.

The following dependency pairs can be deleted:

U2_GA(T15, hbal_tree1_out_ga) → HBAL_TREE1_IN_GA(s(T15))
U5_GA(T21, hbal_tree1_out_ga) → HBAL_TREE1_IN_GA(T21)
U8_GA(T25, hbal_tree1_out_ga) → HBAL_TREE1_IN_GA(s(T25))
The following rules are removed from R:

hbal_tree1_in_ga(zero) → hbal_tree1_out_ga
hbal_tree1_in_ga(s(zero)) → hbal_tree1_out_ga
U8_ga(T25, hbal_tree1_out_ga) → U9_ga(hbal_tree1_in_ga(s(T25)))
U9_ga(hbal_tree1_out_ga) → hbal_tree1_out_ga
U7_ga(hbal_tree1_out_ga) → hbal_tree1_out_ga
U5_ga(T21, hbal_tree1_out_ga) → U6_ga(hbal_tree1_in_ga(T21))
U6_ga(hbal_tree1_out_ga) → hbal_tree1_out_ga
U3_ga(hbal_tree1_out_ga) → hbal_tree1_out_ga
U1_ga(hbal_tree1_out_ga) → hbal_tree1_out_ga
Used ordering: POLO with Polynomial interpretation [POLO]:

POL(HBAL_TREE1_IN_GA(x1)) = x1   
POL(U1_ga(x1)) = 2·x1   
POL(U2_GA(x1, x2)) = 2·x1 + x2   
POL(U2_ga(x1, x2)) = 2·x1 + x2   
POL(U3_ga(x1)) = 1 + x1   
POL(U4_ga(x1)) = x1   
POL(U5_GA(x1, x2)) = x1 + x2   
POL(U5_ga(x1, x2)) = 2·x1 + x2   
POL(U6_ga(x1)) = 2·x1   
POL(U7_ga(x1)) = 2·x1   
POL(U8_GA(x1, x2)) = 2·x1 + x2   
POL(U8_ga(x1, x2)) = 2·x1 + 2·x2   
POL(U9_ga(x1)) = 1 + x1   
POL(hbal_tree1_in_ga(x1)) = x1   
POL(hbal_tree1_out_ga) = 1   
POL(s(x1)) = 2·x1   
POL(zero) = 2   

(12) Obligation:

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

HBAL_TREE1_IN_GA(s(s(T15))) → U2_GA(T15, hbal_tree1_in_ga(s(T15)))
HBAL_TREE1_IN_GA(s(s(T15))) → HBAL_TREE1_IN_GA(s(T15))
HBAL_TREE1_IN_GA(s(s(T21))) → U5_GA(T21, hbal_tree1_in_ga(s(T21)))
HBAL_TREE1_IN_GA(s(s(T25))) → HBAL_TREE1_IN_GA(T25)
HBAL_TREE1_IN_GA(s(s(T25))) → U8_GA(T25, hbal_tree1_in_ga(T25))

The TRS R consists of the following rules:

hbal_tree1_in_ga(s(s(T15))) → U1_ga(hbal_tree1_in_ga(s(T15)))
hbal_tree1_in_ga(s(s(T15))) → U2_ga(T15, hbal_tree1_in_ga(s(T15)))
hbal_tree1_in_ga(s(s(T21))) → U4_ga(hbal_tree1_in_ga(s(T21)))
hbal_tree1_in_ga(s(s(T21))) → U5_ga(T21, hbal_tree1_in_ga(s(T21)))
hbal_tree1_in_ga(s(s(T25))) → U7_ga(hbal_tree1_in_ga(T25))
hbal_tree1_in_ga(s(s(T25))) → U8_ga(T25, hbal_tree1_in_ga(T25))
U4_ga(hbal_tree1_out_ga) → hbal_tree1_out_ga
U2_ga(T15, hbal_tree1_out_ga) → U3_ga(hbal_tree1_in_ga(s(T15)))

The set Q consists of the following terms:

hbal_tree1_in_ga(x0)
U8_ga(x0, x1)
U9_ga(x0)
U7_ga(x0)
U5_ga(x0, x1)
U6_ga(x0)
U4_ga(x0)
U2_ga(x0, x1)
U3_ga(x0)
U1_ga(x0)

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

(13) DependencyGraphProof (EQUIVALENT transformation)

The approximation of the Dependency Graph [LPAR04,FROCOS05,EDGSTAR] contains 1 SCC with 3 less nodes.

(14) Obligation:

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

HBAL_TREE1_IN_GA(s(s(T25))) → HBAL_TREE1_IN_GA(T25)
HBAL_TREE1_IN_GA(s(s(T15))) → HBAL_TREE1_IN_GA(s(T15))

The TRS R consists of the following rules:

hbal_tree1_in_ga(s(s(T15))) → U1_ga(hbal_tree1_in_ga(s(T15)))
hbal_tree1_in_ga(s(s(T15))) → U2_ga(T15, hbal_tree1_in_ga(s(T15)))
hbal_tree1_in_ga(s(s(T21))) → U4_ga(hbal_tree1_in_ga(s(T21)))
hbal_tree1_in_ga(s(s(T21))) → U5_ga(T21, hbal_tree1_in_ga(s(T21)))
hbal_tree1_in_ga(s(s(T25))) → U7_ga(hbal_tree1_in_ga(T25))
hbal_tree1_in_ga(s(s(T25))) → U8_ga(T25, hbal_tree1_in_ga(T25))
U4_ga(hbal_tree1_out_ga) → hbal_tree1_out_ga
U2_ga(T15, hbal_tree1_out_ga) → U3_ga(hbal_tree1_in_ga(s(T15)))

The set Q consists of the following terms:

hbal_tree1_in_ga(x0)
U8_ga(x0, x1)
U9_ga(x0)
U7_ga(x0)
U5_ga(x0, x1)
U6_ga(x0)
U4_ga(x0)
U2_ga(x0, x1)
U3_ga(x0)
U1_ga(x0)

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

(15) UsableRulesProof (EQUIVALENT transformation)

As all Q-normal forms are R-normal forms we are in the innermost case. Hence, by the usable rules processor [LPAR04] we can delete all non-usable rules [FROCOS05] from R.

(16) Obligation:

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

HBAL_TREE1_IN_GA(s(s(T25))) → HBAL_TREE1_IN_GA(T25)
HBAL_TREE1_IN_GA(s(s(T15))) → HBAL_TREE1_IN_GA(s(T15))

R is empty.
The set Q consists of the following terms:

hbal_tree1_in_ga(x0)
U8_ga(x0, x1)
U9_ga(x0)
U7_ga(x0)
U5_ga(x0, x1)
U6_ga(x0)
U4_ga(x0)
U2_ga(x0, x1)
U3_ga(x0)
U1_ga(x0)

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

(17) QReductionProof (EQUIVALENT transformation)

We deleted the following terms from Q as each root-symbol of these terms does neither occur in P nor in R.[THIEMANN].

hbal_tree1_in_ga(x0)
U8_ga(x0, x1)
U9_ga(x0)
U7_ga(x0)
U5_ga(x0, x1)
U6_ga(x0)
U4_ga(x0)
U2_ga(x0, x1)
U3_ga(x0)
U1_ga(x0)

(18) Obligation:

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

HBAL_TREE1_IN_GA(s(s(T25))) → HBAL_TREE1_IN_GA(T25)
HBAL_TREE1_IN_GA(s(s(T15))) → HBAL_TREE1_IN_GA(s(T15))

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:

  • HBAL_TREE1_IN_GA(s(s(T25))) → HBAL_TREE1_IN_GA(T25)
    The graph contains the following edges 1 > 1

  • HBAL_TREE1_IN_GA(s(s(T15))) → HBAL_TREE1_IN_GA(s(T15))
    The graph contains the following edges 1 > 1

(20) YES