YES
proof of /hpcwork/ff862203/termcomp26/benchmarks/iFemN.pl
# AProVE Commit ID: 23a904c96b029b0a549cde0d0d17dbccf967db59 jckassing 20260626 unpublished dirty


Left Termination of the query pattern

p(g,a)

w.r.t. the given Prolog program could successfully be proven:

(0) Prolog
(1) PrologToDTProblemTransformerProof [SOUND, 0 ms]
(2) TRIPLES
(3) TriplesToPiDPProof [SOUND, 0 ms]
(4) PiDP
(5) DependencyGraphProof [EQUIVALENT, 0 ms]
(6) PiDP
(7) PiDPToQDPProof [SOUND, 0 ms]
(8) QDP
(9) QDPSizeChangeProof [EQUIVALENT, 0 ms]
(10) YES


----------------------------------------

(0)
Obligation:
Clauses:

p(X, X).
p(f(X), g(Y)) :- ','(p(f(X), f(Z)), p(Z, g(W))).


Query: p(g,a)
----------------------------------------

(1) PrologToDTProblemTransformerProof (SOUND)
Built DT problem from termination graph DT10.

{
    "root": 4,
    "program": {
        "directives": [],
        "clauses": [
            [
                "(p X X)",
                null
            ],
            [
                "(p (f X) (g Y))",
                "(',' (p (f X) (f Z)) (p Z (g W)))"
            ]
        ]
    },
    "graph": {
        "nodes": {
            "11": {
                "goal": [
                    {
                        "clause": -1,
                        "scope": -1,
                        "term": "(true)"
                    },
                    {
                        "clause": 1,
                        "scope": 1,
                        "term": "(p T4 T2)"
                    }
                ],
                "kb": {
                    "nonunifying": [],
                    "intvars": {},
                    "arithmetic": {
                        "type": "PlainIntegerRelationState",
                        "relations": []
                    },
                    "ground": ["T4"],
                    "free": [],
                    "exprvars": []
                }
            },
            "77": {
                "goal": [],
                "kb": {
                    "nonunifying": [],
                    "intvars": {},
                    "arithmetic": {
                        "type": "PlainIntegerRelationState",
                        "relations": []
                    },
                    "ground": [],
                    "free": [],
                    "exprvars": []
                }
            },
            "12": {
                "goal": [{
                    "clause": 1,
                    "scope": 1,
                    "term": "(p T1 T2)"
                }],
                "kb": {
                    "nonunifying": [[
                        "(p T1 T2)",
                        "(p X2 X2)"
                    ]],
                    "intvars": {},
                    "arithmetic": {
                        "type": "PlainIntegerRelationState",
                        "relations": []
                    },
                    "ground": ["T1"],
                    "free": ["X2"],
                    "exprvars": []
                }
            },
            "34": {
                "goal": [{
                    "clause": -1,
                    "scope": -1,
                    "term": "(p T21 (g X8))"
                }],
                "kb": {
                    "nonunifying": [],
                    "intvars": {},
                    "arithmetic": {
                        "type": "PlainIntegerRelationState",
                        "relations": []
                    },
                    "ground": ["T21"],
                    "free": ["X8"],
                    "exprvars": []
                }
            },
            "13": {
                "goal": [{
                    "clause": 1,
                    "scope": 1,
                    "term": "(p T4 T2)"
                }],
                "kb": {
                    "nonunifying": [],
                    "intvars": {},
                    "arithmetic": {
                        "type": "PlainIntegerRelationState",
                        "relations": []
                    },
                    "ground": ["T4"],
                    "free": [],
                    "exprvars": []
                }
            },
            "24": {
                "goal": [{
                    "clause": -1,
                    "scope": -1,
                    "term": "(',' (p (f T7) (f X7)) (p X7 (g X8)))"
                }],
                "kb": {
                    "nonunifying": [],
                    "intvars": {},
                    "arithmetic": {
                        "type": "PlainIntegerRelationState",
                        "relations": []
                    },
                    "ground": ["T7"],
                    "free": [
                        "X7",
                        "X8"
                    ],
                    "exprvars": []
                }
            },
            "79": {
                "goal": [
                    {
                        "clause": 0,
                        "scope": 3,
                        "term": "(',' (p (f T29) (f X26)) (p X26 (g X27)))"
                    },
                    {
                        "clause": 1,
                        "scope": 3,
                        "term": "(',' (p (f T29) (f X26)) (p X26 (g X27)))"
                    }
                ],
                "kb": {
                    "nonunifying": [[
                        "(p (f T29) T2)",
                        "(p X2 X2)"
                    ]],
                    "intvars": {},
                    "arithmetic": {
                        "type": "PlainIntegerRelationState",
                        "relations": []
                    },
                    "ground": ["T29"],
                    "free": [
                        "X2",
                        "X26",
                        "X27"
                    ],
                    "exprvars": []
                }
            },
            "25": {
                "goal": [],
                "kb": {
                    "nonunifying": [],
                    "intvars": {},
                    "arithmetic": {
                        "type": "PlainIntegerRelationState",
                        "relations": []
                    },
                    "ground": [],
                    "free": [],
                    "exprvars": []
                }
            },
            "26": {
                "goal": [
                    {
                        "clause": 0,
                        "scope": 2,
                        "term": "(',' (p (f T7) (f X7)) (p X7 (g X8)))"
                    },
                    {
                        "clause": 1,
                        "scope": 2,
                        "term": "(',' (p (f T7) (f X7)) (p X7 (g X8)))"
                    }
                ],
                "kb": {
                    "nonunifying": [],
                    "intvars": {},
                    "arithmetic": {
                        "type": "PlainIntegerRelationState",
                        "relations": []
                    },
                    "ground": ["T7"],
                    "free": [
                        "X7",
                        "X8"
                    ],
                    "exprvars": []
                }
            },
            "27": {
                "goal": [{
                    "clause": 0,
                    "scope": 2,
                    "term": "(',' (p (f T7) (f X7)) (p X7 (g X8)))"
                }],
                "kb": {
                    "nonunifying": [],
                    "intvars": {},
                    "arithmetic": {
                        "type": "PlainIntegerRelationState",
                        "relations": []
                    },
                    "ground": ["T7"],
                    "free": [
                        "X7",
                        "X8"
                    ],
                    "exprvars": []
                }
            },
            "28": {
                "goal": [{
                    "clause": 1,
                    "scope": 2,
                    "term": "(',' (p (f T7) (f X7)) (p X7 (g X8)))"
                }],
                "kb": {
                    "nonunifying": [],
                    "intvars": {},
                    "arithmetic": {
                        "type": "PlainIntegerRelationState",
                        "relations": []
                    },
                    "ground": ["T7"],
                    "free": [
                        "X7",
                        "X8"
                    ],
                    "exprvars": []
                }
            },
            "type": "Nodes",
            "101": {
                "goal": [{
                    "clause": -1,
                    "scope": -1,
                    "term": "(p T43 (g X27))"
                }],
                "kb": {
                    "nonunifying": [[
                        "(p (f T43) T2)",
                        "(p X2 X2)"
                    ]],
                    "intvars": {},
                    "arithmetic": {
                        "type": "PlainIntegerRelationState",
                        "relations": []
                    },
                    "ground": ["T43"],
                    "free": [
                        "X2",
                        "X27"
                    ],
                    "exprvars": []
                }
            },
            "4": {
                "goal": [{
                    "clause": -1,
                    "scope": -1,
                    "term": "(p T1 T2)"
                }],
                "kb": {
                    "nonunifying": [],
                    "intvars": {},
                    "arithmetic": {
                        "type": "PlainIntegerRelationState",
                        "relations": []
                    },
                    "ground": ["T1"],
                    "free": [],
                    "exprvars": []
                }
            },
            "5": {
                "goal": [
                    {
                        "clause": 0,
                        "scope": 1,
                        "term": "(p T1 T2)"
                    },
                    {
                        "clause": 1,
                        "scope": 1,
                        "term": "(p T1 T2)"
                    }
                ],
                "kb": {
                    "nonunifying": [],
                    "intvars": {},
                    "arithmetic": {
                        "type": "PlainIntegerRelationState",
                        "relations": []
                    },
                    "ground": ["T1"],
                    "free": [],
                    "exprvars": []
                }
            },
            "104": {
                "goal": [],
                "kb": {
                    "nonunifying": [],
                    "intvars": {},
                    "arithmetic": {
                        "type": "PlainIntegerRelationState",
                        "relations": []
                    },
                    "ground": [],
                    "free": [],
                    "exprvars": []
                }
            },
            "71": {
                "goal": [],
                "kb": {
                    "nonunifying": [],
                    "intvars": {},
                    "arithmetic": {
                        "type": "PlainIntegerRelationState",
                        "relations": []
                    },
                    "ground": [],
                    "free": [],
                    "exprvars": []
                }
            },
            "94": {
                "goal": [{
                    "clause": 0,
                    "scope": 3,
                    "term": "(',' (p (f T29) (f X26)) (p X26 (g X27)))"
                }],
                "kb": {
                    "nonunifying": [[
                        "(p (f T29) T2)",
                        "(p X2 X2)"
                    ]],
                    "intvars": {},
                    "arithmetic": {
                        "type": "PlainIntegerRelationState",
                        "relations": []
                    },
                    "ground": ["T29"],
                    "free": [
                        "X2",
                        "X26",
                        "X27"
                    ],
                    "exprvars": []
                }
            },
            "97": {
                "goal": [{
                    "clause": 1,
                    "scope": 3,
                    "term": "(',' (p (f T29) (f X26)) (p X26 (g X27)))"
                }],
                "kb": {
                    "nonunifying": [[
                        "(p (f T29) T2)",
                        "(p X2 X2)"
                    ]],
                    "intvars": {},
                    "arithmetic": {
                        "type": "PlainIntegerRelationState",
                        "relations": []
                    },
                    "ground": ["T29"],
                    "free": [
                        "X2",
                        "X26",
                        "X27"
                    ],
                    "exprvars": []
                }
            },
            "76": {
                "goal": [{
                    "clause": -1,
                    "scope": -1,
                    "term": "(',' (p (f T29) (f X26)) (p X26 (g X27)))"
                }],
                "kb": {
                    "nonunifying": [[
                        "(p (f T29) T2)",
                        "(p X2 X2)"
                    ]],
                    "intvars": {},
                    "arithmetic": {
                        "type": "PlainIntegerRelationState",
                        "relations": []
                    },
                    "ground": ["T29"],
                    "free": [
                        "X2",
                        "X26",
                        "X27"
                    ],
                    "exprvars": []
                }
            }
        },
        "edges": [
            {
                "from": 4,
                "to": 5,
                "label": "CASE"
            },
            {
                "from": 5,
                "to": 11,
                "label": "EVAL with clause\np(X2, X2).\nand substitutionT1 -> T4,\nX2 -> T4,\nT2 -> T4"
            },
            {
                "from": 5,
                "to": 12,
                "label": "EVAL-BACKTRACK"
            },
            {
                "from": 11,
                "to": 13,
                "label": "SUCCESS"
            },
            {
                "from": 12,
                "to": 76,
                "label": "EVAL with clause\np(f(X24), g(X25)) :- ','(p(f(X24), f(X26)), p(X26, g(X27))).\nand substitutionX24 -> T29,\nT1 -> f(T29),\nX25 -> T30,\nT2 -> g(T30)"
            },
            {
                "from": 12,
                "to": 77,
                "label": "EVAL-BACKTRACK"
            },
            {
                "from": 13,
                "to": 24,
                "label": "EVAL with clause\np(f(X5), g(X6)) :- ','(p(f(X5), f(X7)), p(X7, g(X8))).\nand substitutionX5 -> T7,\nT4 -> f(T7),\nX6 -> T8,\nT2 -> g(T8)"
            },
            {
                "from": 13,
                "to": 25,
                "label": "EVAL-BACKTRACK"
            },
            {
                "from": 24,
                "to": 26,
                "label": "CASE"
            },
            {
                "from": 26,
                "to": 27,
                "label": "PARALLEL"
            },
            {
                "from": 26,
                "to": 28,
                "label": "PARALLEL"
            },
            {
                "from": 27,
                "to": 34,
                "label": "ONLY EVAL with clause\np(X17, X17).\nand substitutionT7 -> T21,\nX17 -> f(T21),\nX7 -> T21"
            },
            {
                "from": 28,
                "to": 71,
                "label": "BACKTRACK\nfor clause: p(f(X), g(Y)) :- ','(p(f(X), f(Z)), p(Z, g(W)))because of non-unification"
            },
            {
                "from": 34,
                "to": 4,
                "label": "INSTANCE with matching:\nT1 -> T21\nT2 -> g(X8)"
            },
            {
                "from": 76,
                "to": 79,
                "label": "CASE"
            },
            {
                "from": 79,
                "to": 94,
                "label": "PARALLEL"
            },
            {
                "from": 79,
                "to": 97,
                "label": "PARALLEL"
            },
            {
                "from": 94,
                "to": 101,
                "label": "ONLY EVAL with clause\np(X36, X36).\nand substitutionT29 -> T43,\nX36 -> f(T43),\nX26 -> T43"
            },
            {
                "from": 97,
                "to": 104,
                "label": "BACKTRACK\nfor clause: p(f(X), g(Y)) :- ','(p(f(X), f(Z)), p(Z, g(W)))because of non-unification"
            },
            {
                "from": 101,
                "to": 4,
                "label": "INSTANCE with matching:\nT1 -> T43\nT2 -> g(X27)"
            }
        ],
        "type": "Graph"
    }
}

----------------------------------------

(2)
Obligation:
Triples:

pA(f(X1), g(X2)) :- pA(X1, g(X3)).
pA(f(X1), g(X2)) :- pA(X1, g(X3)).

Clauses:

pcA(X1, X1).
pcA(f(X1), g(X2)) :- pcA(X1, g(X3)).
pcA(f(X1), g(X2)) :- pcA(X1, g(X3)).

Afs:

pA(x1, x2)  =  pA(x1)


----------------------------------------

(3) TriplesToPiDPProof (SOUND)
We use the technique of [DT09]. With regard to the inferred argument filtering the predicates were used in the following modes:

pA_in_2: (b,f) (b,b)

Transforming TRIPLES into the following Term Rewriting System:

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

   PA_IN_GA(f(X1), g(X2)) -> U1_GA(X1, X2, pA_in_gg(X1, g(X3)))
   PA_IN_GA(f(X1), g(X2)) -> PA_IN_GG(X1, g(X3))
   PA_IN_GG(f(X1), g(X2)) -> U1_GG(X1, X2, pA_in_gg(X1, g(X3)))
   PA_IN_GG(f(X1), g(X2)) -> PA_IN_GG(X1, g(X3))

R is empty.
The argument filtering Pi contains the following mapping:
f(x1)  =  f(x1)

pA_in_gg(x1, x2)  =  pA_in_gg(x1, x2)

g(x1)  =  g

PA_IN_GA(x1, x2)  =  PA_IN_GA(x1)

U1_GA(x1, x2, x3)  =  U1_GA(x1, x3)

PA_IN_GG(x1, x2)  =  PA_IN_GG(x1, x2)

U1_GG(x1, x2, x3)  =  U1_GG(x1, x3)


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


Infinitary Constructor Rewriting Termination of PiDP implies Termination of TRIPLES



----------------------------------------

(4)
Obligation:
Pi DP problem:
The TRS P consists of the following rules:

   PA_IN_GA(f(X1), g(X2)) -> U1_GA(X1, X2, pA_in_gg(X1, g(X3)))
   PA_IN_GA(f(X1), g(X2)) -> PA_IN_GG(X1, g(X3))
   PA_IN_GG(f(X1), g(X2)) -> U1_GG(X1, X2, pA_in_gg(X1, g(X3)))
   PA_IN_GG(f(X1), g(X2)) -> PA_IN_GG(X1, g(X3))

R is empty.
The argument filtering Pi contains the following mapping:
f(x1)  =  f(x1)

pA_in_gg(x1, x2)  =  pA_in_gg(x1, x2)

g(x1)  =  g

PA_IN_GA(x1, x2)  =  PA_IN_GA(x1)

U1_GA(x1, x2, x3)  =  U1_GA(x1, x3)

PA_IN_GG(x1, x2)  =  PA_IN_GG(x1, x2)

U1_GG(x1, x2, x3)  =  U1_GG(x1, x3)


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

(5) DependencyGraphProof (EQUIVALENT)
The approximation of the Dependency Graph [LOPSTR] contains 1 SCC with 3 less nodes.
----------------------------------------

(6)
Obligation:
Pi DP problem:
The TRS P consists of the following rules:

   PA_IN_GG(f(X1), g(X2)) -> PA_IN_GG(X1, g(X3))

R is empty.
The argument filtering Pi contains the following mapping:
f(x1)  =  f(x1)

g(x1)  =  g

PA_IN_GG(x1, x2)  =  PA_IN_GG(x1, x2)


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

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

(8)
Obligation:
Q DP problem:
The TRS P consists of the following rules:

   PA_IN_GG(f(X1), g) -> PA_IN_GG(X1, g)

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

(9) QDPSizeChangeProof (EQUIVALENT)
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:
*PA_IN_GG(f(X1), g) -> PA_IN_GG(X1, g)
The graph contains the following edges 1 > 1, 2 >= 2


----------------------------------------

(10)
YES
