/export/starexec/sandbox/solver/bin/starexec_run_standard /export/starexec/sandbox/benchmark/theBenchmark.pl /export/starexec/sandbox/output/output_files -------------------------------------------------------------------------------- YES proof of /export/starexec/sandbox/benchmark/theBenchmark.pl # AProVE Commit ID: 48fb2092695e11cc9f56e44b17a92a5f88ffb256 marcel 20180622 unpublished dirty Left Termination of the query pattern isPrime(g) w.r.t. the given Prolog program could successfully be proven: (0) Prolog (1) PrologToIRSwTTransformerProof [SOUND, 52 ms] (2) TRUE ---------------------------------------- (0) Obligation: Clauses: isPrime(Cand) :- ','(>(Cand, 0), isNotMultipleOfRange(2, -(Cand, 1), Cand)). isNotMultipleOfRange(Low, High, Cand) :- ','(>(Low, High), !). isNotMultipleOfRange(Low, High, Cand) :- ','(=<(Low, High), ','(!, ','(isNotMultipleOf(Low, Cand), isNotMultipleOfRange(+(Low, 1), High, Cand)))). isNotMultipleOf(Factor, Multiple) :- checkNotMultipleRange(0, Multiple, Factor, Multiple). checkNotMultipleRange(Low, High, Factor, Multiple) :- ','(>(Low, High), !). checkNotMultipleRange(Low, High, Factor, Multiple) :- ','(=<(Low, High), ','(!, ','(checkNotMultiple(Low, Factor, Multiple), checkNotMultipleRange(+(Low, 1), High, Factor, Multiple)))). checkNotMultiple(Factor1, Factor2, Multiple) :- =\=(Multiple, *(Factor1, Factor2)). Query: isPrime(g) ---------------------------------------- (1) PrologToIRSwTTransformerProof (SOUND) Transformed Prolog program to IRSwT according to method in Master Thesis of A. Weinert { "root": 2, "program": { "directives": [], "clauses": [ [ "(isPrime Cand)", "(',' (> Cand (0)) (isNotMultipleOfRange (2) (- Cand (1)) Cand))" ], [ "(isNotMultipleOfRange Low High Cand)", "(',' (> Low High) (!))" ], [ "(isNotMultipleOfRange Low High Cand)", "(',' (=< Low High) (',' (!) (',' (isNotMultipleOf Low Cand) (isNotMultipleOfRange (+ Low (1)) High Cand))))" ], [ "(isNotMultipleOf Factor Multiple)", "(checkNotMultipleRange (0) Multiple Factor Multiple)" ], [ "(checkNotMultipleRange Low High Factor Multiple)", "(',' (> Low High) (!))" ], [ "(checkNotMultipleRange Low High Factor Multiple)", "(',' (=< Low High) (',' (!) (',' (checkNotMultiple Low Factor Multiple) (checkNotMultipleRange (+ Low (1)) High Factor Multiple))))" ], [ "(checkNotMultiple Factor1 Factor2 Multiple)", "(=\\= Multiple (* Factor1 Factor2))" ] ] }, "graph": { "nodes": { "type": "Nodes", "472": { "goal": [{ "clause": -1, "scope": -1, "term": "(isNotMultipleOfRange (2) (- T4 (1)) T4)" }], "kb": { "nonunifying": [], "intvars": {}, "arithmetic": { "type": "PlainIntegerRelationState", "relations": [{ "lhs": { "type": "PlainIntegerConstant", "value": "0" }, "type": "PlainIntegerRelation", "rhs": { "name": "T4", "type": "PlainIntegerVariable" }, "operation": "<" }] }, "ground": ["T4"], "free": [], "exprvars": ["T4"] } }, "473": { "goal": [], "kb": { "nonunifying": [], "intvars": {}, "arithmetic": { "type": "PlainIntegerRelationState", "relations": [{ "lhs": { "type": "PlainIntegerConstant", "value": "0" }, "type": "PlainIntegerRelation", "rhs": { "name": "T4", "type": "PlainIntegerVariable" }, "operation": ">=" }] }, "ground": ["T4"], "free": [], "exprvars": ["T4"] } }, "474": { "goal": [ { "clause": 1, "scope": 2, "term": "(isNotMultipleOfRange (2) (- T4 (1)) T4)" }, { "clause": 2, "scope": 2, "term": "(isNotMultipleOfRange (2) (- T4 (1)) T4)" } ], "kb": { "nonunifying": [], "intvars": {}, "arithmetic": { "type": "PlainIntegerRelationState", "relations": [{ "lhs": { "type": "PlainIntegerConstant", "value": "0" }, "type": "PlainIntegerRelation", "rhs": { "name": "T4", "type": "PlainIntegerVariable" }, "operation": "<" }] }, "ground": ["T4"], "free": [], "exprvars": ["T4"] } }, "540": { "goal": [{ "clause": 2, "scope": 2, "term": "(isNotMultipleOfRange (2) (- T8 (1)) T8)" }], "kb": { "nonunifying": [], "intvars": {}, "arithmetic": { "type": "PlainIntegerRelationState", "relations": [ { "lhs": { "type": "PlainIntegerConstant", "value": "0" }, "type": "PlainIntegerRelation", "rhs": { "name": "T4", "type": "PlainIntegerVariable" }, "operation": "<" }, { "lhs": { "name": "T8", "type": "PlainIntegerVariable" }, "type": "PlainIntegerRelation", "rhs": { "name": "T4", "type": "PlainIntegerVariable" }, "operation": "<" }, { "lhs": { "arguments": [ { "name": "T8", "type": "PlainIntegerVariable" }, { "type": "PlainIntegerConstant", "value": "1" } ], "type": "PlainIntegerOperation", "operation": "-" }, "type": "PlainIntegerRelation", "rhs": { "type": "PlainIntegerConstant", "value": "2" }, "operation": ">=" } ] }, "ground": ["T8"], "free": [], "exprvars": [ "T4", "T8" ] } }, "2": { "goal": [{ "clause": -1, "scope": -1, "term": "(isPrime T1)" }], "kb": { "nonunifying": [], "intvars": {}, "arithmetic": { "type": "PlainIntegerRelationState", "relations": [] }, "ground": ["T1"], "free": [], "exprvars": [] } }, "541": { "goal": [{ "clause": -1, "scope": -1, "term": "(true)" }], "kb": { "nonunifying": [], "intvars": {}, "arithmetic": { "type": "PlainIntegerRelationState", "relations": [ { "lhs": { "type": "PlainIntegerConstant", "value": "0" }, "type": "PlainIntegerRelation", "rhs": { "name": "T4", "type": "PlainIntegerVariable" }, "operation": "<" }, { "lhs": { "name": "T8", "type": "PlainIntegerVariable" }, "type": "PlainIntegerRelation", "rhs": { "name": "T4", "type": "PlainIntegerVariable" }, "operation": "<" }, { "lhs": { "arguments": [ { "name": "T8", "type": "PlainIntegerVariable" }, { "type": "PlainIntegerConstant", "value": "1" } ], "type": "PlainIntegerOperation", "operation": "-" }, "type": "PlainIntegerRelation", "rhs": { "type": "PlainIntegerConstant", "value": "2" }, "operation": "<" } ] }, "ground": [], "free": [], "exprvars": [ "T4", "T8" ] } }, "476": { "goal": [ { "clause": -1, "scope": -1, "term": "(',' (> (2) (- T8 (1))) (!_2))" }, { "clause": 2, "scope": 2, "term": "(isNotMultipleOfRange (2) (- T8 (1)) T8)" } ], "kb": { "nonunifying": [], "intvars": {}, "arithmetic": { "type": "PlainIntegerRelationState", "relations": [ { "lhs": { "type": "PlainIntegerConstant", "value": "0" }, "type": "PlainIntegerRelation", "rhs": { "name": "T4", "type": "PlainIntegerVariable" }, "operation": "<" }, { "lhs": { "name": "T8", "type": "PlainIntegerVariable" }, "type": "PlainIntegerRelation", "rhs": { "name": "T4", "type": "PlainIntegerVariable" }, "operation": "<" } ] }, "ground": ["T8"], "free": [], "exprvars": [ "T4", "T8" ] } }, "542": { "goal": [], "kb": { "nonunifying": [], "intvars": {}, "arithmetic": { "type": "PlainIntegerRelationState", "relations": [ { "lhs": { "type": "PlainIntegerConstant", "value": "0" }, "type": "PlainIntegerRelation", "rhs": { "name": "T4", "type": "PlainIntegerVariable" }, "operation": "<" }, { "lhs": { "name": "T8", "type": "PlainIntegerVariable" }, "type": "PlainIntegerRelation", "rhs": { "name": "T4", "type": "PlainIntegerVariable" }, "operation": "<" }, { "lhs": { "arguments": [ { "name": "T8", "type": "PlainIntegerVariable" }, { "type": "PlainIntegerConstant", "value": "1" } ], "type": "PlainIntegerOperation", "operation": "-" }, "type": "PlainIntegerRelation", "rhs": { "type": "PlainIntegerConstant", "value": "2" }, "operation": "<" } ] }, "ground": [], "free": [], "exprvars": [ "T4", "T8" ] } }, "4": { "goal": [{ "clause": 0, "scope": 1, "term": "(isPrime T1)" }], "kb": { "nonunifying": [], "intvars": {}, "arithmetic": { "type": "PlainIntegerRelationState", "relations": [] }, "ground": ["T1"], "free": [], "exprvars": [] } }, "543": { "goal": [{ "clause": -1, "scope": -1, "term": "(',' (=< (2) (- T11 (1))) (',' (!_2) (',' (isNotMultipleOf (2) T11) (isNotMultipleOfRange (+ (2) (1)) (- T11 (1)) T11))))" }], "kb": { "nonunifying": [], "intvars": {}, "arithmetic": { "type": "PlainIntegerRelationState", "relations": [ { "lhs": { "type": "PlainIntegerConstant", "value": "0" }, "type": "PlainIntegerRelation", "rhs": { "name": "T4", "type": "PlainIntegerVariable" }, "operation": "<" }, { "lhs": { "name": "T8", "type": "PlainIntegerVariable" }, "type": "PlainIntegerRelation", "rhs": { "name": "T4", "type": "PlainIntegerVariable" }, "operation": "<" }, { "lhs": { "name": "T4", "type": "PlainIntegerVariable" }, "type": "PlainIntegerRelation", "rhs": { "name": "T4", "type": "PlainIntegerVariable" }, "operation": "<" }, { "lhs": { "name": "T4", "type": "PlainIntegerVariable" }, "type": "PlainIntegerRelation", "rhs": { "name": "T4", "type": "PlainIntegerVariable" }, "operation": "<" }, { "lhs": { "arguments": [ { "name": "T8", "type": "PlainIntegerVariable" }, { "type": "PlainIntegerConstant", "value": "1" } ], "type": "PlainIntegerOperation", "operation": "-" }, "type": "PlainIntegerRelation", "rhs": { "type": "PlainIntegerConstant", "value": "2" }, "operation": ">=" }, { "lhs": { "type": "PlainIntegerConstant", "value": "2" }, "type": "PlainIntegerRelation", "rhs": { "type": "PlainIntegerConstant", "value": "2" }, "operation": ">=" } ] }, "ground": ["T11"], "free": [], "exprvars": [ "T4", "T11", "T8" ] } }, "6": { "goal": [{ "clause": -1, "scope": -1, "term": "(',' (> T4 (0)) (isNotMultipleOfRange (2) (- T4 (1)) T4))" }], "kb": { "nonunifying": [], "intvars": {}, "arithmetic": { "type": "PlainIntegerRelationState", "relations": [] }, "ground": ["T4"], "free": [], "exprvars": [] } }, "7": { "goal": [], "kb": { "nonunifying": [], "intvars": {}, "arithmetic": { "type": "PlainIntegerRelationState", "relations": [] }, "ground": [], "free": [], "exprvars": [] } }, "539": { "goal": [ { "clause": -1, "scope": -1, "term": "(!_2)" }, { "clause": 2, "scope": 2, "term": "(isNotMultipleOfRange (2) (- T8 (1)) T8)" } ], "kb": { "nonunifying": [], "intvars": {}, "arithmetic": { "type": "PlainIntegerRelationState", "relations": [ { "lhs": { "type": "PlainIntegerConstant", "value": "0" }, "type": "PlainIntegerRelation", "rhs": { "name": "T4", "type": "PlainIntegerVariable" }, "operation": "<" }, { "lhs": { "name": "T8", "type": "PlainIntegerVariable" }, "type": "PlainIntegerRelation", "rhs": { "name": "T4", "type": "PlainIntegerVariable" }, "operation": "<" }, { "lhs": { "arguments": [ { "name": "T8", "type": "PlainIntegerVariable" }, { "type": "PlainIntegerConstant", "value": "1" } ], "type": "PlainIntegerOperation", "operation": "-" }, "type": "PlainIntegerRelation", "rhs": { "type": "PlainIntegerConstant", "value": "2" }, "operation": "<" } ] }, "ground": ["T8"], "free": [], "exprvars": [ "T4", "T8" ] } } }, "edges": [ { "from": 2, "to": 4, "label": "CASE" }, { "from": 4, "to": 6, "label": "ONLY EVAL with clause\nisPrime(X3) :- ','(>(X3, 0), isNotMultipleOfRange(2, -(X3, 1), X3)).\nand substitutionT1 -> T4,\nX3 -> T4" }, { "from": 6, "to": 7, "label": "IS ERROR" }, { "from": 6, "to": 472, "label": "ARITHCOMP SUCCESS" }, { "from": 6, "to": 473, "label": "ARITHCOMP FAIL" }, { "from": 472, "to": 474, "label": "CASE" }, { "from": 474, "to": 476, "label": "ONLY EVAL with clause\nisNotMultipleOfRange(X13, X14, X15) :- ','(>(X13, X14), !_2).\nand substitutionX13 -> 2,\nT4 -> T8,\nX14 -> -(T8, 1),\nX15 -> T8" }, { "from": 476, "to": 539, "label": "ARITHCOMP SUCCESS" }, { "from": 476, "to": 540, "label": "ARITHCOMP FAIL" }, { "from": 539, "to": 541, "label": "CUT" }, { "from": 540, "to": 543, "label": "ONLY EVAL with clause\nisNotMultipleOfRange(X22, X23, X24) :- ','(=<(X22, X23), ','(!_2, ','(isNotMultipleOf(X22, X24), isNotMultipleOfRange(+(X22, 1), X23, X24)))).\nand substitutionX22 -> 2,\nT8 -> T11,\nX23 -> -(T11, 1),\nX24 -> T11" }, { "from": 541, "to": 542, "label": "SUCCESS" } ], "type": "Graph" } } ---------------------------------------- (2) TRUE