(0) Obligation:

Clauses:

right(tree(X, XS1, XS2), XS2).
flat(niltree, nil).
flat(tree(X, niltree, XS), cons(X, YS)) :- ','(right(tree(X, niltree, XS), ZS), flat(ZS, YS)).
flat(tree(X, tree(Y, YS1, YS2), XS), ZS) :- flat(tree(Y, YS1, tree(X, YS2, XS)), ZS).

Queries:

flat(a,g).

(1) PrologToPrologProblemTransformerProof (SOUND transformation)

Built Prolog problem from termination graph.

(2) Obligation:

Clauses:

flat1(niltree, nil).
flat1(tree(T49, tree(T47, tree(T45, T46, T48), T50), T51), nil) :- flat1(tree(T45, T46, tree(T47, T48, tree(T49, T50, T51))), nil).
flat1(tree(T84, niltree, T86), cons(T84, T72)) :- flat1(T86, T72).
flat1(tree(T110, tree(T108, T109, T111), T112), cons(T106, T107)) :- flat1(tree(T108, T109, tree(T110, T111, T112)), cons(T106, T107)).
flat1(tree(T181, tree(T177, niltree, T182), T183), cons(T177, T159)) :- flat1(tree(T181, T182, T183), T159).
flat1(tree(T215, tree(T213, tree(T211, T212, T214), T216), T217), T210) :- flat1(tree(T211, T212, tree(T213, T214, tree(T215, T216, T217))), T210).

Queries:

flat1(a,g).

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

flat1_in_ag(niltree, nil) → flat1_out_ag(niltree, nil)
flat1_in_ag(tree(T49, tree(T47, tree(T45, T46, T48), T50), T51), nil) → U1_ag(T49, T47, T45, T46, T48, T50, T51, flat1_in_ag(tree(T45, T46, tree(T47, T48, tree(T49, T50, T51))), nil))
flat1_in_ag(tree(T84, niltree, T86), cons(T84, T72)) → U2_ag(T84, T86, T72, flat1_in_ag(T86, T72))
flat1_in_ag(tree(T110, tree(T108, T109, T111), T112), cons(T106, T107)) → U3_ag(T110, T108, T109, T111, T112, T106, T107, flat1_in_ag(tree(T108, T109, tree(T110, T111, T112)), cons(T106, T107)))
flat1_in_ag(tree(T181, tree(T177, niltree, T182), T183), cons(T177, T159)) → U4_ag(T181, T177, T182, T183, T159, flat1_in_ag(tree(T181, T182, T183), T159))
flat1_in_ag(tree(T215, tree(T213, tree(T211, T212, T214), T216), T217), T210) → U5_ag(T215, T213, T211, T212, T214, T216, T217, T210, flat1_in_ag(tree(T211, T212, tree(T213, T214, tree(T215, T216, T217))), T210))
U5_ag(T215, T213, T211, T212, T214, T216, T217, T210, flat1_out_ag(tree(T211, T212, tree(T213, T214, tree(T215, T216, T217))), T210)) → flat1_out_ag(tree(T215, tree(T213, tree(T211, T212, T214), T216), T217), T210)
U4_ag(T181, T177, T182, T183, T159, flat1_out_ag(tree(T181, T182, T183), T159)) → flat1_out_ag(tree(T181, tree(T177, niltree, T182), T183), cons(T177, T159))
U3_ag(T110, T108, T109, T111, T112, T106, T107, flat1_out_ag(tree(T108, T109, tree(T110, T111, T112)), cons(T106, T107))) → flat1_out_ag(tree(T110, tree(T108, T109, T111), T112), cons(T106, T107))
U2_ag(T84, T86, T72, flat1_out_ag(T86, T72)) → flat1_out_ag(tree(T84, niltree, T86), cons(T84, T72))
U1_ag(T49, T47, T45, T46, T48, T50, T51, flat1_out_ag(tree(T45, T46, tree(T47, T48, tree(T49, T50, T51))), nil)) → flat1_out_ag(tree(T49, tree(T47, tree(T45, T46, T48), T50), T51), nil)

The argument filtering Pi contains the following mapping:
flat1_in_ag(x1, x2)  =  flat1_in_ag(x2)
nil  =  nil
flat1_out_ag(x1, x2)  =  flat1_out_ag(x1)
U1_ag(x1, x2, x3, x4, x5, x6, x7, x8)  =  U1_ag(x8)
tree(x1, x2, x3)  =  tree(x2, x3)
cons(x1, x2)  =  cons(x1, x2)
U2_ag(x1, x2, x3, x4)  =  U2_ag(x4)
U3_ag(x1, x2, x3, x4, x5, x6, x7, x8)  =  U3_ag(x8)
U4_ag(x1, x2, x3, x4, x5, x6)  =  U4_ag(x6)
U5_ag(x1, x2, x3, x4, x5, x6, x7, x8, x9)  =  U5_ag(x9)
niltree  =  niltree

Infinitary Constructor Rewriting Termination of PiTRS implies Termination of Prolog

(4) Obligation:

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

flat1_in_ag(niltree, nil) → flat1_out_ag(niltree, nil)
flat1_in_ag(tree(T49, tree(T47, tree(T45, T46, T48), T50), T51), nil) → U1_ag(T49, T47, T45, T46, T48, T50, T51, flat1_in_ag(tree(T45, T46, tree(T47, T48, tree(T49, T50, T51))), nil))
flat1_in_ag(tree(T84, niltree, T86), cons(T84, T72)) → U2_ag(T84, T86, T72, flat1_in_ag(T86, T72))
flat1_in_ag(tree(T110, tree(T108, T109, T111), T112), cons(T106, T107)) → U3_ag(T110, T108, T109, T111, T112, T106, T107, flat1_in_ag(tree(T108, T109, tree(T110, T111, T112)), cons(T106, T107)))
flat1_in_ag(tree(T181, tree(T177, niltree, T182), T183), cons(T177, T159)) → U4_ag(T181, T177, T182, T183, T159, flat1_in_ag(tree(T181, T182, T183), T159))
flat1_in_ag(tree(T215, tree(T213, tree(T211, T212, T214), T216), T217), T210) → U5_ag(T215, T213, T211, T212, T214, T216, T217, T210, flat1_in_ag(tree(T211, T212, tree(T213, T214, tree(T215, T216, T217))), T210))
U5_ag(T215, T213, T211, T212, T214, T216, T217, T210, flat1_out_ag(tree(T211, T212, tree(T213, T214, tree(T215, T216, T217))), T210)) → flat1_out_ag(tree(T215, tree(T213, tree(T211, T212, T214), T216), T217), T210)
U4_ag(T181, T177, T182, T183, T159, flat1_out_ag(tree(T181, T182, T183), T159)) → flat1_out_ag(tree(T181, tree(T177, niltree, T182), T183), cons(T177, T159))
U3_ag(T110, T108, T109, T111, T112, T106, T107, flat1_out_ag(tree(T108, T109, tree(T110, T111, T112)), cons(T106, T107))) → flat1_out_ag(tree(T110, tree(T108, T109, T111), T112), cons(T106, T107))
U2_ag(T84, T86, T72, flat1_out_ag(T86, T72)) → flat1_out_ag(tree(T84, niltree, T86), cons(T84, T72))
U1_ag(T49, T47, T45, T46, T48, T50, T51, flat1_out_ag(tree(T45, T46, tree(T47, T48, tree(T49, T50, T51))), nil)) → flat1_out_ag(tree(T49, tree(T47, tree(T45, T46, T48), T50), T51), nil)

The argument filtering Pi contains the following mapping:
flat1_in_ag(x1, x2)  =  flat1_in_ag(x2)
nil  =  nil
flat1_out_ag(x1, x2)  =  flat1_out_ag(x1)
U1_ag(x1, x2, x3, x4, x5, x6, x7, x8)  =  U1_ag(x8)
tree(x1, x2, x3)  =  tree(x2, x3)
cons(x1, x2)  =  cons(x1, x2)
U2_ag(x1, x2, x3, x4)  =  U2_ag(x4)
U3_ag(x1, x2, x3, x4, x5, x6, x7, x8)  =  U3_ag(x8)
U4_ag(x1, x2, x3, x4, x5, x6)  =  U4_ag(x6)
U5_ag(x1, x2, x3, x4, x5, x6, x7, x8, x9)  =  U5_ag(x9)
niltree  =  niltree

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

FLAT1_IN_AG(tree(T49, tree(T47, tree(T45, T46, T48), T50), T51), nil) → U1_AG(T49, T47, T45, T46, T48, T50, T51, flat1_in_ag(tree(T45, T46, tree(T47, T48, tree(T49, T50, T51))), nil))
FLAT1_IN_AG(tree(T49, tree(T47, tree(T45, T46, T48), T50), T51), nil) → FLAT1_IN_AG(tree(T45, T46, tree(T47, T48, tree(T49, T50, T51))), nil)
FLAT1_IN_AG(tree(T84, niltree, T86), cons(T84, T72)) → U2_AG(T84, T86, T72, flat1_in_ag(T86, T72))
FLAT1_IN_AG(tree(T84, niltree, T86), cons(T84, T72)) → FLAT1_IN_AG(T86, T72)
FLAT1_IN_AG(tree(T110, tree(T108, T109, T111), T112), cons(T106, T107)) → U3_AG(T110, T108, T109, T111, T112, T106, T107, flat1_in_ag(tree(T108, T109, tree(T110, T111, T112)), cons(T106, T107)))
FLAT1_IN_AG(tree(T110, tree(T108, T109, T111), T112), cons(T106, T107)) → FLAT1_IN_AG(tree(T108, T109, tree(T110, T111, T112)), cons(T106, T107))
FLAT1_IN_AG(tree(T181, tree(T177, niltree, T182), T183), cons(T177, T159)) → U4_AG(T181, T177, T182, T183, T159, flat1_in_ag(tree(T181, T182, T183), T159))
FLAT1_IN_AG(tree(T181, tree(T177, niltree, T182), T183), cons(T177, T159)) → FLAT1_IN_AG(tree(T181, T182, T183), T159)
FLAT1_IN_AG(tree(T215, tree(T213, tree(T211, T212, T214), T216), T217), T210) → U5_AG(T215, T213, T211, T212, T214, T216, T217, T210, flat1_in_ag(tree(T211, T212, tree(T213, T214, tree(T215, T216, T217))), T210))
FLAT1_IN_AG(tree(T215, tree(T213, tree(T211, T212, T214), T216), T217), T210) → FLAT1_IN_AG(tree(T211, T212, tree(T213, T214, tree(T215, T216, T217))), T210)

The TRS R consists of the following rules:

flat1_in_ag(niltree, nil) → flat1_out_ag(niltree, nil)
flat1_in_ag(tree(T49, tree(T47, tree(T45, T46, T48), T50), T51), nil) → U1_ag(T49, T47, T45, T46, T48, T50, T51, flat1_in_ag(tree(T45, T46, tree(T47, T48, tree(T49, T50, T51))), nil))
flat1_in_ag(tree(T84, niltree, T86), cons(T84, T72)) → U2_ag(T84, T86, T72, flat1_in_ag(T86, T72))
flat1_in_ag(tree(T110, tree(T108, T109, T111), T112), cons(T106, T107)) → U3_ag(T110, T108, T109, T111, T112, T106, T107, flat1_in_ag(tree(T108, T109, tree(T110, T111, T112)), cons(T106, T107)))
flat1_in_ag(tree(T181, tree(T177, niltree, T182), T183), cons(T177, T159)) → U4_ag(T181, T177, T182, T183, T159, flat1_in_ag(tree(T181, T182, T183), T159))
flat1_in_ag(tree(T215, tree(T213, tree(T211, T212, T214), T216), T217), T210) → U5_ag(T215, T213, T211, T212, T214, T216, T217, T210, flat1_in_ag(tree(T211, T212, tree(T213, T214, tree(T215, T216, T217))), T210))
U5_ag(T215, T213, T211, T212, T214, T216, T217, T210, flat1_out_ag(tree(T211, T212, tree(T213, T214, tree(T215, T216, T217))), T210)) → flat1_out_ag(tree(T215, tree(T213, tree(T211, T212, T214), T216), T217), T210)
U4_ag(T181, T177, T182, T183, T159, flat1_out_ag(tree(T181, T182, T183), T159)) → flat1_out_ag(tree(T181, tree(T177, niltree, T182), T183), cons(T177, T159))
U3_ag(T110, T108, T109, T111, T112, T106, T107, flat1_out_ag(tree(T108, T109, tree(T110, T111, T112)), cons(T106, T107))) → flat1_out_ag(tree(T110, tree(T108, T109, T111), T112), cons(T106, T107))
U2_ag(T84, T86, T72, flat1_out_ag(T86, T72)) → flat1_out_ag(tree(T84, niltree, T86), cons(T84, T72))
U1_ag(T49, T47, T45, T46, T48, T50, T51, flat1_out_ag(tree(T45, T46, tree(T47, T48, tree(T49, T50, T51))), nil)) → flat1_out_ag(tree(T49, tree(T47, tree(T45, T46, T48), T50), T51), nil)

The argument filtering Pi contains the following mapping:
flat1_in_ag(x1, x2)  =  flat1_in_ag(x2)
nil  =  nil
flat1_out_ag(x1, x2)  =  flat1_out_ag(x1)
U1_ag(x1, x2, x3, x4, x5, x6, x7, x8)  =  U1_ag(x8)
tree(x1, x2, x3)  =  tree(x2, x3)
cons(x1, x2)  =  cons(x1, x2)
U2_ag(x1, x2, x3, x4)  =  U2_ag(x4)
U3_ag(x1, x2, x3, x4, x5, x6, x7, x8)  =  U3_ag(x8)
U4_ag(x1, x2, x3, x4, x5, x6)  =  U4_ag(x6)
U5_ag(x1, x2, x3, x4, x5, x6, x7, x8, x9)  =  U5_ag(x9)
niltree  =  niltree
FLAT1_IN_AG(x1, x2)  =  FLAT1_IN_AG(x2)
U1_AG(x1, x2, x3, x4, x5, x6, x7, x8)  =  U1_AG(x8)
U2_AG(x1, x2, x3, x4)  =  U2_AG(x4)
U3_AG(x1, x2, x3, x4, x5, x6, x7, x8)  =  U3_AG(x8)
U4_AG(x1, x2, x3, x4, x5, x6)  =  U4_AG(x6)
U5_AG(x1, x2, x3, x4, x5, x6, x7, x8, x9)  =  U5_AG(x9)

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

(6) Obligation:

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

FLAT1_IN_AG(tree(T49, tree(T47, tree(T45, T46, T48), T50), T51), nil) → U1_AG(T49, T47, T45, T46, T48, T50, T51, flat1_in_ag(tree(T45, T46, tree(T47, T48, tree(T49, T50, T51))), nil))
FLAT1_IN_AG(tree(T49, tree(T47, tree(T45, T46, T48), T50), T51), nil) → FLAT1_IN_AG(tree(T45, T46, tree(T47, T48, tree(T49, T50, T51))), nil)
FLAT1_IN_AG(tree(T84, niltree, T86), cons(T84, T72)) → U2_AG(T84, T86, T72, flat1_in_ag(T86, T72))
FLAT1_IN_AG(tree(T84, niltree, T86), cons(T84, T72)) → FLAT1_IN_AG(T86, T72)
FLAT1_IN_AG(tree(T110, tree(T108, T109, T111), T112), cons(T106, T107)) → U3_AG(T110, T108, T109, T111, T112, T106, T107, flat1_in_ag(tree(T108, T109, tree(T110, T111, T112)), cons(T106, T107)))
FLAT1_IN_AG(tree(T110, tree(T108, T109, T111), T112), cons(T106, T107)) → FLAT1_IN_AG(tree(T108, T109, tree(T110, T111, T112)), cons(T106, T107))
FLAT1_IN_AG(tree(T181, tree(T177, niltree, T182), T183), cons(T177, T159)) → U4_AG(T181, T177, T182, T183, T159, flat1_in_ag(tree(T181, T182, T183), T159))
FLAT1_IN_AG(tree(T181, tree(T177, niltree, T182), T183), cons(T177, T159)) → FLAT1_IN_AG(tree(T181, T182, T183), T159)
FLAT1_IN_AG(tree(T215, tree(T213, tree(T211, T212, T214), T216), T217), T210) → U5_AG(T215, T213, T211, T212, T214, T216, T217, T210, flat1_in_ag(tree(T211, T212, tree(T213, T214, tree(T215, T216, T217))), T210))
FLAT1_IN_AG(tree(T215, tree(T213, tree(T211, T212, T214), T216), T217), T210) → FLAT1_IN_AG(tree(T211, T212, tree(T213, T214, tree(T215, T216, T217))), T210)

The TRS R consists of the following rules:

flat1_in_ag(niltree, nil) → flat1_out_ag(niltree, nil)
flat1_in_ag(tree(T49, tree(T47, tree(T45, T46, T48), T50), T51), nil) → U1_ag(T49, T47, T45, T46, T48, T50, T51, flat1_in_ag(tree(T45, T46, tree(T47, T48, tree(T49, T50, T51))), nil))
flat1_in_ag(tree(T84, niltree, T86), cons(T84, T72)) → U2_ag(T84, T86, T72, flat1_in_ag(T86, T72))
flat1_in_ag(tree(T110, tree(T108, T109, T111), T112), cons(T106, T107)) → U3_ag(T110, T108, T109, T111, T112, T106, T107, flat1_in_ag(tree(T108, T109, tree(T110, T111, T112)), cons(T106, T107)))
flat1_in_ag(tree(T181, tree(T177, niltree, T182), T183), cons(T177, T159)) → U4_ag(T181, T177, T182, T183, T159, flat1_in_ag(tree(T181, T182, T183), T159))
flat1_in_ag(tree(T215, tree(T213, tree(T211, T212, T214), T216), T217), T210) → U5_ag(T215, T213, T211, T212, T214, T216, T217, T210, flat1_in_ag(tree(T211, T212, tree(T213, T214, tree(T215, T216, T217))), T210))
U5_ag(T215, T213, T211, T212, T214, T216, T217, T210, flat1_out_ag(tree(T211, T212, tree(T213, T214, tree(T215, T216, T217))), T210)) → flat1_out_ag(tree(T215, tree(T213, tree(T211, T212, T214), T216), T217), T210)
U4_ag(T181, T177, T182, T183, T159, flat1_out_ag(tree(T181, T182, T183), T159)) → flat1_out_ag(tree(T181, tree(T177, niltree, T182), T183), cons(T177, T159))
U3_ag(T110, T108, T109, T111, T112, T106, T107, flat1_out_ag(tree(T108, T109, tree(T110, T111, T112)), cons(T106, T107))) → flat1_out_ag(tree(T110, tree(T108, T109, T111), T112), cons(T106, T107))
U2_ag(T84, T86, T72, flat1_out_ag(T86, T72)) → flat1_out_ag(tree(T84, niltree, T86), cons(T84, T72))
U1_ag(T49, T47, T45, T46, T48, T50, T51, flat1_out_ag(tree(T45, T46, tree(T47, T48, tree(T49, T50, T51))), nil)) → flat1_out_ag(tree(T49, tree(T47, tree(T45, T46, T48), T50), T51), nil)

The argument filtering Pi contains the following mapping:
flat1_in_ag(x1, x2)  =  flat1_in_ag(x2)
nil  =  nil
flat1_out_ag(x1, x2)  =  flat1_out_ag(x1)
U1_ag(x1, x2, x3, x4, x5, x6, x7, x8)  =  U1_ag(x8)
tree(x1, x2, x3)  =  tree(x2, x3)
cons(x1, x2)  =  cons(x1, x2)
U2_ag(x1, x2, x3, x4)  =  U2_ag(x4)
U3_ag(x1, x2, x3, x4, x5, x6, x7, x8)  =  U3_ag(x8)
U4_ag(x1, x2, x3, x4, x5, x6)  =  U4_ag(x6)
U5_ag(x1, x2, x3, x4, x5, x6, x7, x8, x9)  =  U5_ag(x9)
niltree  =  niltree
FLAT1_IN_AG(x1, x2)  =  FLAT1_IN_AG(x2)
U1_AG(x1, x2, x3, x4, x5, x6, x7, x8)  =  U1_AG(x8)
U2_AG(x1, x2, x3, x4)  =  U2_AG(x4)
U3_AG(x1, x2, x3, x4, x5, x6, x7, x8)  =  U3_AG(x8)
U4_AG(x1, x2, x3, x4, x5, x6)  =  U4_AG(x6)
U5_AG(x1, x2, x3, x4, x5, x6, x7, x8, x9)  =  U5_AG(x9)

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

(7) DependencyGraphProof (EQUIVALENT transformation)

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

(8) Obligation:

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

FLAT1_IN_AG(tree(T215, tree(T213, tree(T211, T212, T214), T216), T217), T210) → FLAT1_IN_AG(tree(T211, T212, tree(T213, T214, tree(T215, T216, T217))), T210)
FLAT1_IN_AG(tree(T49, tree(T47, tree(T45, T46, T48), T50), T51), nil) → FLAT1_IN_AG(tree(T45, T46, tree(T47, T48, tree(T49, T50, T51))), nil)
FLAT1_IN_AG(tree(T84, niltree, T86), cons(T84, T72)) → FLAT1_IN_AG(T86, T72)
FLAT1_IN_AG(tree(T110, tree(T108, T109, T111), T112), cons(T106, T107)) → FLAT1_IN_AG(tree(T108, T109, tree(T110, T111, T112)), cons(T106, T107))
FLAT1_IN_AG(tree(T181, tree(T177, niltree, T182), T183), cons(T177, T159)) → FLAT1_IN_AG(tree(T181, T182, T183), T159)

The TRS R consists of the following rules:

flat1_in_ag(niltree, nil) → flat1_out_ag(niltree, nil)
flat1_in_ag(tree(T49, tree(T47, tree(T45, T46, T48), T50), T51), nil) → U1_ag(T49, T47, T45, T46, T48, T50, T51, flat1_in_ag(tree(T45, T46, tree(T47, T48, tree(T49, T50, T51))), nil))
flat1_in_ag(tree(T84, niltree, T86), cons(T84, T72)) → U2_ag(T84, T86, T72, flat1_in_ag(T86, T72))
flat1_in_ag(tree(T110, tree(T108, T109, T111), T112), cons(T106, T107)) → U3_ag(T110, T108, T109, T111, T112, T106, T107, flat1_in_ag(tree(T108, T109, tree(T110, T111, T112)), cons(T106, T107)))
flat1_in_ag(tree(T181, tree(T177, niltree, T182), T183), cons(T177, T159)) → U4_ag(T181, T177, T182, T183, T159, flat1_in_ag(tree(T181, T182, T183), T159))
flat1_in_ag(tree(T215, tree(T213, tree(T211, T212, T214), T216), T217), T210) → U5_ag(T215, T213, T211, T212, T214, T216, T217, T210, flat1_in_ag(tree(T211, T212, tree(T213, T214, tree(T215, T216, T217))), T210))
U5_ag(T215, T213, T211, T212, T214, T216, T217, T210, flat1_out_ag(tree(T211, T212, tree(T213, T214, tree(T215, T216, T217))), T210)) → flat1_out_ag(tree(T215, tree(T213, tree(T211, T212, T214), T216), T217), T210)
U4_ag(T181, T177, T182, T183, T159, flat1_out_ag(tree(T181, T182, T183), T159)) → flat1_out_ag(tree(T181, tree(T177, niltree, T182), T183), cons(T177, T159))
U3_ag(T110, T108, T109, T111, T112, T106, T107, flat1_out_ag(tree(T108, T109, tree(T110, T111, T112)), cons(T106, T107))) → flat1_out_ag(tree(T110, tree(T108, T109, T111), T112), cons(T106, T107))
U2_ag(T84, T86, T72, flat1_out_ag(T86, T72)) → flat1_out_ag(tree(T84, niltree, T86), cons(T84, T72))
U1_ag(T49, T47, T45, T46, T48, T50, T51, flat1_out_ag(tree(T45, T46, tree(T47, T48, tree(T49, T50, T51))), nil)) → flat1_out_ag(tree(T49, tree(T47, tree(T45, T46, T48), T50), T51), nil)

The argument filtering Pi contains the following mapping:
flat1_in_ag(x1, x2)  =  flat1_in_ag(x2)
nil  =  nil
flat1_out_ag(x1, x2)  =  flat1_out_ag(x1)
U1_ag(x1, x2, x3, x4, x5, x6, x7, x8)  =  U1_ag(x8)
tree(x1, x2, x3)  =  tree(x2, x3)
cons(x1, x2)  =  cons(x1, x2)
U2_ag(x1, x2, x3, x4)  =  U2_ag(x4)
U3_ag(x1, x2, x3, x4, x5, x6, x7, x8)  =  U3_ag(x8)
U4_ag(x1, x2, x3, x4, x5, x6)  =  U4_ag(x6)
U5_ag(x1, x2, x3, x4, x5, x6, x7, x8, x9)  =  U5_ag(x9)
niltree  =  niltree
FLAT1_IN_AG(x1, x2)  =  FLAT1_IN_AG(x2)

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

(9) UsableRulesProof (EQUIVALENT transformation)

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

(10) Obligation:

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

FLAT1_IN_AG(tree(T215, tree(T213, tree(T211, T212, T214), T216), T217), T210) → FLAT1_IN_AG(tree(T211, T212, tree(T213, T214, tree(T215, T216, T217))), T210)
FLAT1_IN_AG(tree(T49, tree(T47, tree(T45, T46, T48), T50), T51), nil) → FLAT1_IN_AG(tree(T45, T46, tree(T47, T48, tree(T49, T50, T51))), nil)
FLAT1_IN_AG(tree(T84, niltree, T86), cons(T84, T72)) → FLAT1_IN_AG(T86, T72)
FLAT1_IN_AG(tree(T110, tree(T108, T109, T111), T112), cons(T106, T107)) → FLAT1_IN_AG(tree(T108, T109, tree(T110, T111, T112)), cons(T106, T107))
FLAT1_IN_AG(tree(T181, tree(T177, niltree, T182), T183), cons(T177, T159)) → FLAT1_IN_AG(tree(T181, T182, T183), T159)

R is empty.
The argument filtering Pi contains the following mapping:
nil  =  nil
tree(x1, x2, x3)  =  tree(x2, x3)
cons(x1, x2)  =  cons(x1, x2)
niltree  =  niltree
FLAT1_IN_AG(x1, x2)  =  FLAT1_IN_AG(x2)

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

(11) PiDPToQDPProof (SOUND transformation)

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

(12) Obligation:

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

FLAT1_IN_AG(T210) → FLAT1_IN_AG(T210)
FLAT1_IN_AG(nil) → FLAT1_IN_AG(nil)
FLAT1_IN_AG(cons(T84, T72)) → FLAT1_IN_AG(T72)
FLAT1_IN_AG(cons(T106, T107)) → FLAT1_IN_AG(cons(T106, T107))

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

(13) MRRProof (EQUIVALENT transformation)

By using the rule removal processor [LPAR04] with the following ordering, at least one Dependency Pair or term rewrite system rule of this QDP problem can be strictly oriented.
Strictly oriented dependency pairs:

FLAT1_IN_AG(cons(T84, T72)) → FLAT1_IN_AG(T72)


Used ordering: Polynomial interpretation [POLO]:

POL(FLAT1_IN_AG(x1)) = x1   
POL(cons(x1, x2)) = 1 + x1 + x2   
POL(nil) = 0   

(14) Obligation:

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

FLAT1_IN_AG(T210) → FLAT1_IN_AG(T210)
FLAT1_IN_AG(nil) → FLAT1_IN_AG(nil)
FLAT1_IN_AG(cons(T106, T107)) → FLAT1_IN_AG(cons(T106, T107))

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

(15) NonTerminationProof (EQUIVALENT transformation)

We used the non-termination processor [FROCOS05] to show that the DP problem is infinite.
Found a loop by semiunifying a rule from P directly.

s = FLAT1_IN_AG(T210) evaluates to t =FLAT1_IN_AG(T210)

Thus s starts an infinite chain as s semiunifies with t with the following substitutions:
  • Semiunifier: [ ]
  • Matcher: [ ]




Rewriting sequence

The DP semiunifies directly so there is only one rewrite step from FLAT1_IN_AG(T210) to FLAT1_IN_AG(T210).



(16) NO

(17) PrologToPiTRSProof (SOUND transformation)

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

flat1_in_ag(niltree, nil) → flat1_out_ag(niltree, nil)
flat1_in_ag(tree(T49, tree(T47, tree(T45, T46, T48), T50), T51), nil) → U1_ag(T49, T47, T45, T46, T48, T50, T51, flat1_in_ag(tree(T45, T46, tree(T47, T48, tree(T49, T50, T51))), nil))
flat1_in_ag(tree(T84, niltree, T86), cons(T84, T72)) → U2_ag(T84, T86, T72, flat1_in_ag(T86, T72))
flat1_in_ag(tree(T110, tree(T108, T109, T111), T112), cons(T106, T107)) → U3_ag(T110, T108, T109, T111, T112, T106, T107, flat1_in_ag(tree(T108, T109, tree(T110, T111, T112)), cons(T106, T107)))
flat1_in_ag(tree(T181, tree(T177, niltree, T182), T183), cons(T177, T159)) → U4_ag(T181, T177, T182, T183, T159, flat1_in_ag(tree(T181, T182, T183), T159))
flat1_in_ag(tree(T215, tree(T213, tree(T211, T212, T214), T216), T217), T210) → U5_ag(T215, T213, T211, T212, T214, T216, T217, T210, flat1_in_ag(tree(T211, T212, tree(T213, T214, tree(T215, T216, T217))), T210))
U5_ag(T215, T213, T211, T212, T214, T216, T217, T210, flat1_out_ag(tree(T211, T212, tree(T213, T214, tree(T215, T216, T217))), T210)) → flat1_out_ag(tree(T215, tree(T213, tree(T211, T212, T214), T216), T217), T210)
U4_ag(T181, T177, T182, T183, T159, flat1_out_ag(tree(T181, T182, T183), T159)) → flat1_out_ag(tree(T181, tree(T177, niltree, T182), T183), cons(T177, T159))
U3_ag(T110, T108, T109, T111, T112, T106, T107, flat1_out_ag(tree(T108, T109, tree(T110, T111, T112)), cons(T106, T107))) → flat1_out_ag(tree(T110, tree(T108, T109, T111), T112), cons(T106, T107))
U2_ag(T84, T86, T72, flat1_out_ag(T86, T72)) → flat1_out_ag(tree(T84, niltree, T86), cons(T84, T72))
U1_ag(T49, T47, T45, T46, T48, T50, T51, flat1_out_ag(tree(T45, T46, tree(T47, T48, tree(T49, T50, T51))), nil)) → flat1_out_ag(tree(T49, tree(T47, tree(T45, T46, T48), T50), T51), nil)

The argument filtering Pi contains the following mapping:
flat1_in_ag(x1, x2)  =  flat1_in_ag(x2)
nil  =  nil
flat1_out_ag(x1, x2)  =  flat1_out_ag(x1, x2)
U1_ag(x1, x2, x3, x4, x5, x6, x7, x8)  =  U1_ag(x8)
tree(x1, x2, x3)  =  tree(x2, x3)
cons(x1, x2)  =  cons(x1, x2)
U2_ag(x1, x2, x3, x4)  =  U2_ag(x1, x3, x4)
U3_ag(x1, x2, x3, x4, x5, x6, x7, x8)  =  U3_ag(x6, x7, x8)
U4_ag(x1, x2, x3, x4, x5, x6)  =  U4_ag(x2, x5, x6)
U5_ag(x1, x2, x3, x4, x5, x6, x7, x8, x9)  =  U5_ag(x8, x9)
niltree  =  niltree

Infinitary Constructor Rewriting Termination of PiTRS implies Termination of Prolog

(18) Obligation:

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

flat1_in_ag(niltree, nil) → flat1_out_ag(niltree, nil)
flat1_in_ag(tree(T49, tree(T47, tree(T45, T46, T48), T50), T51), nil) → U1_ag(T49, T47, T45, T46, T48, T50, T51, flat1_in_ag(tree(T45, T46, tree(T47, T48, tree(T49, T50, T51))), nil))
flat1_in_ag(tree(T84, niltree, T86), cons(T84, T72)) → U2_ag(T84, T86, T72, flat1_in_ag(T86, T72))
flat1_in_ag(tree(T110, tree(T108, T109, T111), T112), cons(T106, T107)) → U3_ag(T110, T108, T109, T111, T112, T106, T107, flat1_in_ag(tree(T108, T109, tree(T110, T111, T112)), cons(T106, T107)))
flat1_in_ag(tree(T181, tree(T177, niltree, T182), T183), cons(T177, T159)) → U4_ag(T181, T177, T182, T183, T159, flat1_in_ag(tree(T181, T182, T183), T159))
flat1_in_ag(tree(T215, tree(T213, tree(T211, T212, T214), T216), T217), T210) → U5_ag(T215, T213, T211, T212, T214, T216, T217, T210, flat1_in_ag(tree(T211, T212, tree(T213, T214, tree(T215, T216, T217))), T210))
U5_ag(T215, T213, T211, T212, T214, T216, T217, T210, flat1_out_ag(tree(T211, T212, tree(T213, T214, tree(T215, T216, T217))), T210)) → flat1_out_ag(tree(T215, tree(T213, tree(T211, T212, T214), T216), T217), T210)
U4_ag(T181, T177, T182, T183, T159, flat1_out_ag(tree(T181, T182, T183), T159)) → flat1_out_ag(tree(T181, tree(T177, niltree, T182), T183), cons(T177, T159))
U3_ag(T110, T108, T109, T111, T112, T106, T107, flat1_out_ag(tree(T108, T109, tree(T110, T111, T112)), cons(T106, T107))) → flat1_out_ag(tree(T110, tree(T108, T109, T111), T112), cons(T106, T107))
U2_ag(T84, T86, T72, flat1_out_ag(T86, T72)) → flat1_out_ag(tree(T84, niltree, T86), cons(T84, T72))
U1_ag(T49, T47, T45, T46, T48, T50, T51, flat1_out_ag(tree(T45, T46, tree(T47, T48, tree(T49, T50, T51))), nil)) → flat1_out_ag(tree(T49, tree(T47, tree(T45, T46, T48), T50), T51), nil)

The argument filtering Pi contains the following mapping:
flat1_in_ag(x1, x2)  =  flat1_in_ag(x2)
nil  =  nil
flat1_out_ag(x1, x2)  =  flat1_out_ag(x1, x2)
U1_ag(x1, x2, x3, x4, x5, x6, x7, x8)  =  U1_ag(x8)
tree(x1, x2, x3)  =  tree(x2, x3)
cons(x1, x2)  =  cons(x1, x2)
U2_ag(x1, x2, x3, x4)  =  U2_ag(x1, x3, x4)
U3_ag(x1, x2, x3, x4, x5, x6, x7, x8)  =  U3_ag(x6, x7, x8)
U4_ag(x1, x2, x3, x4, x5, x6)  =  U4_ag(x2, x5, x6)
U5_ag(x1, x2, x3, x4, x5, x6, x7, x8, x9)  =  U5_ag(x8, x9)
niltree  =  niltree

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

FLAT1_IN_AG(tree(T49, tree(T47, tree(T45, T46, T48), T50), T51), nil) → U1_AG(T49, T47, T45, T46, T48, T50, T51, flat1_in_ag(tree(T45, T46, tree(T47, T48, tree(T49, T50, T51))), nil))
FLAT1_IN_AG(tree(T49, tree(T47, tree(T45, T46, T48), T50), T51), nil) → FLAT1_IN_AG(tree(T45, T46, tree(T47, T48, tree(T49, T50, T51))), nil)
FLAT1_IN_AG(tree(T84, niltree, T86), cons(T84, T72)) → U2_AG(T84, T86, T72, flat1_in_ag(T86, T72))
FLAT1_IN_AG(tree(T84, niltree, T86), cons(T84, T72)) → FLAT1_IN_AG(T86, T72)
FLAT1_IN_AG(tree(T110, tree(T108, T109, T111), T112), cons(T106, T107)) → U3_AG(T110, T108, T109, T111, T112, T106, T107, flat1_in_ag(tree(T108, T109, tree(T110, T111, T112)), cons(T106, T107)))
FLAT1_IN_AG(tree(T110, tree(T108, T109, T111), T112), cons(T106, T107)) → FLAT1_IN_AG(tree(T108, T109, tree(T110, T111, T112)), cons(T106, T107))
FLAT1_IN_AG(tree(T181, tree(T177, niltree, T182), T183), cons(T177, T159)) → U4_AG(T181, T177, T182, T183, T159, flat1_in_ag(tree(T181, T182, T183), T159))
FLAT1_IN_AG(tree(T181, tree(T177, niltree, T182), T183), cons(T177, T159)) → FLAT1_IN_AG(tree(T181, T182, T183), T159)
FLAT1_IN_AG(tree(T215, tree(T213, tree(T211, T212, T214), T216), T217), T210) → U5_AG(T215, T213, T211, T212, T214, T216, T217, T210, flat1_in_ag(tree(T211, T212, tree(T213, T214, tree(T215, T216, T217))), T210))
FLAT1_IN_AG(tree(T215, tree(T213, tree(T211, T212, T214), T216), T217), T210) → FLAT1_IN_AG(tree(T211, T212, tree(T213, T214, tree(T215, T216, T217))), T210)

The TRS R consists of the following rules:

flat1_in_ag(niltree, nil) → flat1_out_ag(niltree, nil)
flat1_in_ag(tree(T49, tree(T47, tree(T45, T46, T48), T50), T51), nil) → U1_ag(T49, T47, T45, T46, T48, T50, T51, flat1_in_ag(tree(T45, T46, tree(T47, T48, tree(T49, T50, T51))), nil))
flat1_in_ag(tree(T84, niltree, T86), cons(T84, T72)) → U2_ag(T84, T86, T72, flat1_in_ag(T86, T72))
flat1_in_ag(tree(T110, tree(T108, T109, T111), T112), cons(T106, T107)) → U3_ag(T110, T108, T109, T111, T112, T106, T107, flat1_in_ag(tree(T108, T109, tree(T110, T111, T112)), cons(T106, T107)))
flat1_in_ag(tree(T181, tree(T177, niltree, T182), T183), cons(T177, T159)) → U4_ag(T181, T177, T182, T183, T159, flat1_in_ag(tree(T181, T182, T183), T159))
flat1_in_ag(tree(T215, tree(T213, tree(T211, T212, T214), T216), T217), T210) → U5_ag(T215, T213, T211, T212, T214, T216, T217, T210, flat1_in_ag(tree(T211, T212, tree(T213, T214, tree(T215, T216, T217))), T210))
U5_ag(T215, T213, T211, T212, T214, T216, T217, T210, flat1_out_ag(tree(T211, T212, tree(T213, T214, tree(T215, T216, T217))), T210)) → flat1_out_ag(tree(T215, tree(T213, tree(T211, T212, T214), T216), T217), T210)
U4_ag(T181, T177, T182, T183, T159, flat1_out_ag(tree(T181, T182, T183), T159)) → flat1_out_ag(tree(T181, tree(T177, niltree, T182), T183), cons(T177, T159))
U3_ag(T110, T108, T109, T111, T112, T106, T107, flat1_out_ag(tree(T108, T109, tree(T110, T111, T112)), cons(T106, T107))) → flat1_out_ag(tree(T110, tree(T108, T109, T111), T112), cons(T106, T107))
U2_ag(T84, T86, T72, flat1_out_ag(T86, T72)) → flat1_out_ag(tree(T84, niltree, T86), cons(T84, T72))
U1_ag(T49, T47, T45, T46, T48, T50, T51, flat1_out_ag(tree(T45, T46, tree(T47, T48, tree(T49, T50, T51))), nil)) → flat1_out_ag(tree(T49, tree(T47, tree(T45, T46, T48), T50), T51), nil)

The argument filtering Pi contains the following mapping:
flat1_in_ag(x1, x2)  =  flat1_in_ag(x2)
nil  =  nil
flat1_out_ag(x1, x2)  =  flat1_out_ag(x1, x2)
U1_ag(x1, x2, x3, x4, x5, x6, x7, x8)  =  U1_ag(x8)
tree(x1, x2, x3)  =  tree(x2, x3)
cons(x1, x2)  =  cons(x1, x2)
U2_ag(x1, x2, x3, x4)  =  U2_ag(x1, x3, x4)
U3_ag(x1, x2, x3, x4, x5, x6, x7, x8)  =  U3_ag(x6, x7, x8)
U4_ag(x1, x2, x3, x4, x5, x6)  =  U4_ag(x2, x5, x6)
U5_ag(x1, x2, x3, x4, x5, x6, x7, x8, x9)  =  U5_ag(x8, x9)
niltree  =  niltree
FLAT1_IN_AG(x1, x2)  =  FLAT1_IN_AG(x2)
U1_AG(x1, x2, x3, x4, x5, x6, x7, x8)  =  U1_AG(x8)
U2_AG(x1, x2, x3, x4)  =  U2_AG(x1, x3, x4)
U3_AG(x1, x2, x3, x4, x5, x6, x7, x8)  =  U3_AG(x6, x7, x8)
U4_AG(x1, x2, x3, x4, x5, x6)  =  U4_AG(x2, x5, x6)
U5_AG(x1, x2, x3, x4, x5, x6, x7, x8, x9)  =  U5_AG(x8, x9)

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

(20) Obligation:

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

FLAT1_IN_AG(tree(T49, tree(T47, tree(T45, T46, T48), T50), T51), nil) → U1_AG(T49, T47, T45, T46, T48, T50, T51, flat1_in_ag(tree(T45, T46, tree(T47, T48, tree(T49, T50, T51))), nil))
FLAT1_IN_AG(tree(T49, tree(T47, tree(T45, T46, T48), T50), T51), nil) → FLAT1_IN_AG(tree(T45, T46, tree(T47, T48, tree(T49, T50, T51))), nil)
FLAT1_IN_AG(tree(T84, niltree, T86), cons(T84, T72)) → U2_AG(T84, T86, T72, flat1_in_ag(T86, T72))
FLAT1_IN_AG(tree(T84, niltree, T86), cons(T84, T72)) → FLAT1_IN_AG(T86, T72)
FLAT1_IN_AG(tree(T110, tree(T108, T109, T111), T112), cons(T106, T107)) → U3_AG(T110, T108, T109, T111, T112, T106, T107, flat1_in_ag(tree(T108, T109, tree(T110, T111, T112)), cons(T106, T107)))
FLAT1_IN_AG(tree(T110, tree(T108, T109, T111), T112), cons(T106, T107)) → FLAT1_IN_AG(tree(T108, T109, tree(T110, T111, T112)), cons(T106, T107))
FLAT1_IN_AG(tree(T181, tree(T177, niltree, T182), T183), cons(T177, T159)) → U4_AG(T181, T177, T182, T183, T159, flat1_in_ag(tree(T181, T182, T183), T159))
FLAT1_IN_AG(tree(T181, tree(T177, niltree, T182), T183), cons(T177, T159)) → FLAT1_IN_AG(tree(T181, T182, T183), T159)
FLAT1_IN_AG(tree(T215, tree(T213, tree(T211, T212, T214), T216), T217), T210) → U5_AG(T215, T213, T211, T212, T214, T216, T217, T210, flat1_in_ag(tree(T211, T212, tree(T213, T214, tree(T215, T216, T217))), T210))
FLAT1_IN_AG(tree(T215, tree(T213, tree(T211, T212, T214), T216), T217), T210) → FLAT1_IN_AG(tree(T211, T212, tree(T213, T214, tree(T215, T216, T217))), T210)

The TRS R consists of the following rules:

flat1_in_ag(niltree, nil) → flat1_out_ag(niltree, nil)
flat1_in_ag(tree(T49, tree(T47, tree(T45, T46, T48), T50), T51), nil) → U1_ag(T49, T47, T45, T46, T48, T50, T51, flat1_in_ag(tree(T45, T46, tree(T47, T48, tree(T49, T50, T51))), nil))
flat1_in_ag(tree(T84, niltree, T86), cons(T84, T72)) → U2_ag(T84, T86, T72, flat1_in_ag(T86, T72))
flat1_in_ag(tree(T110, tree(T108, T109, T111), T112), cons(T106, T107)) → U3_ag(T110, T108, T109, T111, T112, T106, T107, flat1_in_ag(tree(T108, T109, tree(T110, T111, T112)), cons(T106, T107)))
flat1_in_ag(tree(T181, tree(T177, niltree, T182), T183), cons(T177, T159)) → U4_ag(T181, T177, T182, T183, T159, flat1_in_ag(tree(T181, T182, T183), T159))
flat1_in_ag(tree(T215, tree(T213, tree(T211, T212, T214), T216), T217), T210) → U5_ag(T215, T213, T211, T212, T214, T216, T217, T210, flat1_in_ag(tree(T211, T212, tree(T213, T214, tree(T215, T216, T217))), T210))
U5_ag(T215, T213, T211, T212, T214, T216, T217, T210, flat1_out_ag(tree(T211, T212, tree(T213, T214, tree(T215, T216, T217))), T210)) → flat1_out_ag(tree(T215, tree(T213, tree(T211, T212, T214), T216), T217), T210)
U4_ag(T181, T177, T182, T183, T159, flat1_out_ag(tree(T181, T182, T183), T159)) → flat1_out_ag(tree(T181, tree(T177, niltree, T182), T183), cons(T177, T159))
U3_ag(T110, T108, T109, T111, T112, T106, T107, flat1_out_ag(tree(T108, T109, tree(T110, T111, T112)), cons(T106, T107))) → flat1_out_ag(tree(T110, tree(T108, T109, T111), T112), cons(T106, T107))
U2_ag(T84, T86, T72, flat1_out_ag(T86, T72)) → flat1_out_ag(tree(T84, niltree, T86), cons(T84, T72))
U1_ag(T49, T47, T45, T46, T48, T50, T51, flat1_out_ag(tree(T45, T46, tree(T47, T48, tree(T49, T50, T51))), nil)) → flat1_out_ag(tree(T49, tree(T47, tree(T45, T46, T48), T50), T51), nil)

The argument filtering Pi contains the following mapping:
flat1_in_ag(x1, x2)  =  flat1_in_ag(x2)
nil  =  nil
flat1_out_ag(x1, x2)  =  flat1_out_ag(x1, x2)
U1_ag(x1, x2, x3, x4, x5, x6, x7, x8)  =  U1_ag(x8)
tree(x1, x2, x3)  =  tree(x2, x3)
cons(x1, x2)  =  cons(x1, x2)
U2_ag(x1, x2, x3, x4)  =  U2_ag(x1, x3, x4)
U3_ag(x1, x2, x3, x4, x5, x6, x7, x8)  =  U3_ag(x6, x7, x8)
U4_ag(x1, x2, x3, x4, x5, x6)  =  U4_ag(x2, x5, x6)
U5_ag(x1, x2, x3, x4, x5, x6, x7, x8, x9)  =  U5_ag(x8, x9)
niltree  =  niltree
FLAT1_IN_AG(x1, x2)  =  FLAT1_IN_AG(x2)
U1_AG(x1, x2, x3, x4, x5, x6, x7, x8)  =  U1_AG(x8)
U2_AG(x1, x2, x3, x4)  =  U2_AG(x1, x3, x4)
U3_AG(x1, x2, x3, x4, x5, x6, x7, x8)  =  U3_AG(x6, x7, x8)
U4_AG(x1, x2, x3, x4, x5, x6)  =  U4_AG(x2, x5, x6)
U5_AG(x1, x2, x3, x4, x5, x6, x7, x8, x9)  =  U5_AG(x8, x9)

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

(21) DependencyGraphProof (EQUIVALENT transformation)

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

(22) Obligation:

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

FLAT1_IN_AG(tree(T215, tree(T213, tree(T211, T212, T214), T216), T217), T210) → FLAT1_IN_AG(tree(T211, T212, tree(T213, T214, tree(T215, T216, T217))), T210)
FLAT1_IN_AG(tree(T49, tree(T47, tree(T45, T46, T48), T50), T51), nil) → FLAT1_IN_AG(tree(T45, T46, tree(T47, T48, tree(T49, T50, T51))), nil)
FLAT1_IN_AG(tree(T84, niltree, T86), cons(T84, T72)) → FLAT1_IN_AG(T86, T72)
FLAT1_IN_AG(tree(T110, tree(T108, T109, T111), T112), cons(T106, T107)) → FLAT1_IN_AG(tree(T108, T109, tree(T110, T111, T112)), cons(T106, T107))
FLAT1_IN_AG(tree(T181, tree(T177, niltree, T182), T183), cons(T177, T159)) → FLAT1_IN_AG(tree(T181, T182, T183), T159)

The TRS R consists of the following rules:

flat1_in_ag(niltree, nil) → flat1_out_ag(niltree, nil)
flat1_in_ag(tree(T49, tree(T47, tree(T45, T46, T48), T50), T51), nil) → U1_ag(T49, T47, T45, T46, T48, T50, T51, flat1_in_ag(tree(T45, T46, tree(T47, T48, tree(T49, T50, T51))), nil))
flat1_in_ag(tree(T84, niltree, T86), cons(T84, T72)) → U2_ag(T84, T86, T72, flat1_in_ag(T86, T72))
flat1_in_ag(tree(T110, tree(T108, T109, T111), T112), cons(T106, T107)) → U3_ag(T110, T108, T109, T111, T112, T106, T107, flat1_in_ag(tree(T108, T109, tree(T110, T111, T112)), cons(T106, T107)))
flat1_in_ag(tree(T181, tree(T177, niltree, T182), T183), cons(T177, T159)) → U4_ag(T181, T177, T182, T183, T159, flat1_in_ag(tree(T181, T182, T183), T159))
flat1_in_ag(tree(T215, tree(T213, tree(T211, T212, T214), T216), T217), T210) → U5_ag(T215, T213, T211, T212, T214, T216, T217, T210, flat1_in_ag(tree(T211, T212, tree(T213, T214, tree(T215, T216, T217))), T210))
U5_ag(T215, T213, T211, T212, T214, T216, T217, T210, flat1_out_ag(tree(T211, T212, tree(T213, T214, tree(T215, T216, T217))), T210)) → flat1_out_ag(tree(T215, tree(T213, tree(T211, T212, T214), T216), T217), T210)
U4_ag(T181, T177, T182, T183, T159, flat1_out_ag(tree(T181, T182, T183), T159)) → flat1_out_ag(tree(T181, tree(T177, niltree, T182), T183), cons(T177, T159))
U3_ag(T110, T108, T109, T111, T112, T106, T107, flat1_out_ag(tree(T108, T109, tree(T110, T111, T112)), cons(T106, T107))) → flat1_out_ag(tree(T110, tree(T108, T109, T111), T112), cons(T106, T107))
U2_ag(T84, T86, T72, flat1_out_ag(T86, T72)) → flat1_out_ag(tree(T84, niltree, T86), cons(T84, T72))
U1_ag(T49, T47, T45, T46, T48, T50, T51, flat1_out_ag(tree(T45, T46, tree(T47, T48, tree(T49, T50, T51))), nil)) → flat1_out_ag(tree(T49, tree(T47, tree(T45, T46, T48), T50), T51), nil)

The argument filtering Pi contains the following mapping:
flat1_in_ag(x1, x2)  =  flat1_in_ag(x2)
nil  =  nil
flat1_out_ag(x1, x2)  =  flat1_out_ag(x1, x2)
U1_ag(x1, x2, x3, x4, x5, x6, x7, x8)  =  U1_ag(x8)
tree(x1, x2, x3)  =  tree(x2, x3)
cons(x1, x2)  =  cons(x1, x2)
U2_ag(x1, x2, x3, x4)  =  U2_ag(x1, x3, x4)
U3_ag(x1, x2, x3, x4, x5, x6, x7, x8)  =  U3_ag(x6, x7, x8)
U4_ag(x1, x2, x3, x4, x5, x6)  =  U4_ag(x2, x5, x6)
U5_ag(x1, x2, x3, x4, x5, x6, x7, x8, x9)  =  U5_ag(x8, x9)
niltree  =  niltree
FLAT1_IN_AG(x1, x2)  =  FLAT1_IN_AG(x2)

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

(23) UsableRulesProof (EQUIVALENT transformation)

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

(24) Obligation:

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

FLAT1_IN_AG(tree(T215, tree(T213, tree(T211, T212, T214), T216), T217), T210) → FLAT1_IN_AG(tree(T211, T212, tree(T213, T214, tree(T215, T216, T217))), T210)
FLAT1_IN_AG(tree(T49, tree(T47, tree(T45, T46, T48), T50), T51), nil) → FLAT1_IN_AG(tree(T45, T46, tree(T47, T48, tree(T49, T50, T51))), nil)
FLAT1_IN_AG(tree(T84, niltree, T86), cons(T84, T72)) → FLAT1_IN_AG(T86, T72)
FLAT1_IN_AG(tree(T110, tree(T108, T109, T111), T112), cons(T106, T107)) → FLAT1_IN_AG(tree(T108, T109, tree(T110, T111, T112)), cons(T106, T107))
FLAT1_IN_AG(tree(T181, tree(T177, niltree, T182), T183), cons(T177, T159)) → FLAT1_IN_AG(tree(T181, T182, T183), T159)

R is empty.
The argument filtering Pi contains the following mapping:
nil  =  nil
tree(x1, x2, x3)  =  tree(x2, x3)
cons(x1, x2)  =  cons(x1, x2)
niltree  =  niltree
FLAT1_IN_AG(x1, x2)  =  FLAT1_IN_AG(x2)

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

(25) PiDPToQDPProof (SOUND transformation)

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

(26) Obligation:

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

FLAT1_IN_AG(T210) → FLAT1_IN_AG(T210)
FLAT1_IN_AG(nil) → FLAT1_IN_AG(nil)
FLAT1_IN_AG(cons(T84, T72)) → FLAT1_IN_AG(T72)
FLAT1_IN_AG(cons(T106, T107)) → FLAT1_IN_AG(cons(T106, T107))

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

(27) MRRProof (EQUIVALENT transformation)

By using the rule removal processor [LPAR04] with the following ordering, at least one Dependency Pair or term rewrite system rule of this QDP problem can be strictly oriented.
Strictly oriented dependency pairs:

FLAT1_IN_AG(cons(T84, T72)) → FLAT1_IN_AG(T72)


Used ordering: Polynomial interpretation [POLO]:

POL(FLAT1_IN_AG(x1)) = x1   
POL(cons(x1, x2)) = 1 + x1 + x2   
POL(nil) = 0   

(28) Obligation:

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

FLAT1_IN_AG(T210) → FLAT1_IN_AG(T210)
FLAT1_IN_AG(nil) → FLAT1_IN_AG(nil)
FLAT1_IN_AG(cons(T106, T107)) → FLAT1_IN_AG(cons(T106, T107))

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

(29) NonTerminationProof (EQUIVALENT transformation)

We used the non-termination processor [FROCOS05] to show that the DP problem is infinite.
Found a loop by semiunifying a rule from P directly.

s = FLAT1_IN_AG(T210) evaluates to t =FLAT1_IN_AG(T210)

Thus s starts an infinite chain as s semiunifies with t with the following substitutions:
  • Matcher: [ ]
  • Semiunifier: [ ]




Rewriting sequence

The DP semiunifies directly so there is only one rewrite step from FLAT1_IN_AG(T210) to FLAT1_IN_AG(T210).



(30) NO