/export/starexec/sandbox/solver/bin/starexec_run_standard /export/starexec/sandbox/benchmark/theBenchmark.hs /export/starexec/sandbox/output/output_files -------------------------------------------------------------------------------- YES proof of /export/starexec/sandbox/benchmark/theBenchmark.hs # AProVE Commit ID: 48fb2092695e11cc9f56e44b17a92a5f88ffb256 marcel 20180622 unpublished dirty H-Termination with start terms of the given HASKELL could be proven: (0) HASKELL (1) BR [EQUIVALENT, 0 ms] (2) HASKELL (3) COR [EQUIVALENT, 0 ms] (4) HASKELL (5) Narrow [SOUND, 0 ms] (6) QDP (7) QDPSizeChangeProof [EQUIVALENT, 0 ms] (8) YES ---------------------------------------- (0) Obligation: mainModule Main module Main where { import qualified Prelude; data List a = Cons a (List a) | Nil ; data MyInt = Pos Main.Nat | Neg Main.Nat ; data Main.Nat = Succ Main.Nat | Zero ; data Main.WHNF a = WHNF a ; dsEm :: (a -> b) -> a -> b; dsEm f x = Main.seq x (f x); enforceWHNF :: Main.WHNF a -> b -> b; enforceWHNF (Main.WHNF x) y = y; foldl' :: (a -> b -> a) -> a -> List b -> a; foldl' f a Nil = a; foldl' f a (Cons x xs) = dsEm (foldl' f) (f a x) xs; length :: List a -> MyInt; length = foldl' length0 (Main.Pos Main.Zero); length0 n vv = psMyInt n (Main.Pos (Main.Succ Main.Zero)); primMinusNat :: Main.Nat -> Main.Nat -> MyInt; primMinusNat Main.Zero Main.Zero = Main.Pos Main.Zero; primMinusNat Main.Zero (Main.Succ y) = Main.Neg (Main.Succ y); primMinusNat (Main.Succ x) Main.Zero = Main.Pos (Main.Succ x); primMinusNat (Main.Succ x) (Main.Succ y) = primMinusNat x y; primPlusInt :: MyInt -> MyInt -> MyInt; primPlusInt (Main.Pos x) (Main.Neg y) = primMinusNat x y; primPlusInt (Main.Neg x) (Main.Pos y) = primMinusNat y x; primPlusInt (Main.Neg x) (Main.Neg y) = Main.Neg (primPlusNat x y); primPlusInt (Main.Pos x) (Main.Pos y) = Main.Pos (primPlusNat x y); primPlusNat :: Main.Nat -> Main.Nat -> Main.Nat; primPlusNat Main.Zero Main.Zero = Main.Zero; primPlusNat Main.Zero (Main.Succ y) = Main.Succ y; primPlusNat (Main.Succ x) Main.Zero = Main.Succ x; primPlusNat (Main.Succ x) (Main.Succ y) = Main.Succ (Main.Succ (primPlusNat x y)); psMyInt :: MyInt -> MyInt -> MyInt; psMyInt = primPlusInt; seq :: a -> b -> b; seq x y = Main.enforceWHNF (Main.WHNF x) y; } ---------------------------------------- (1) BR (EQUIVALENT) Replaced joker patterns by fresh variables and removed binding patterns. ---------------------------------------- (2) Obligation: mainModule Main module Main where { import qualified Prelude; data List a = Cons a (List a) | Nil ; data MyInt = Pos Main.Nat | Neg Main.Nat ; data Main.Nat = Succ Main.Nat | Zero ; data Main.WHNF a = WHNF a ; dsEm :: (b -> a) -> b -> a; dsEm f x = Main.seq x (f x); enforceWHNF :: Main.WHNF a -> b -> b; enforceWHNF (Main.WHNF x) y = y; foldl' :: (b -> a -> b) -> b -> List a -> b; foldl' f a Nil = a; foldl' f a (Cons x xs) = dsEm (foldl' f) (f a x) xs; length :: List a -> MyInt; length = foldl' length0 (Main.Pos Main.Zero); length0 n vv = psMyInt n (Main.Pos (Main.Succ Main.Zero)); primMinusNat :: Main.Nat -> Main.Nat -> MyInt; primMinusNat Main.Zero Main.Zero = Main.Pos Main.Zero; primMinusNat Main.Zero (Main.Succ y) = Main.Neg (Main.Succ y); primMinusNat (Main.Succ x) Main.Zero = Main.Pos (Main.Succ x); primMinusNat (Main.Succ x) (Main.Succ y) = primMinusNat x y; primPlusInt :: MyInt -> MyInt -> MyInt; primPlusInt (Main.Pos x) (Main.Neg y) = primMinusNat x y; primPlusInt (Main.Neg x) (Main.Pos y) = primMinusNat y x; primPlusInt (Main.Neg x) (Main.Neg y) = Main.Neg (primPlusNat x y); primPlusInt (Main.Pos x) (Main.Pos y) = Main.Pos (primPlusNat x y); primPlusNat :: Main.Nat -> Main.Nat -> Main.Nat; primPlusNat Main.Zero Main.Zero = Main.Zero; primPlusNat Main.Zero (Main.Succ y) = Main.Succ y; primPlusNat (Main.Succ x) Main.Zero = Main.Succ x; primPlusNat (Main.Succ x) (Main.Succ y) = Main.Succ (Main.Succ (primPlusNat x y)); psMyInt :: MyInt -> MyInt -> MyInt; psMyInt = primPlusInt; seq :: a -> b -> b; seq x y = Main.enforceWHNF (Main.WHNF x) y; } ---------------------------------------- (3) COR (EQUIVALENT) Cond Reductions: The following Function with conditions "undefined |Falseundefined; " is transformed to "undefined = undefined1; " "undefined0 True = undefined; " "undefined1 = undefined0 False; " ---------------------------------------- (4) Obligation: mainModule Main module Main where { import qualified Prelude; data List a = Cons a (List a) | Nil ; data MyInt = Pos Main.Nat | Neg Main.Nat ; data Main.Nat = Succ Main.Nat | Zero ; data Main.WHNF a = WHNF a ; dsEm :: (a -> b) -> a -> b; dsEm f x = Main.seq x (f x); enforceWHNF :: Main.WHNF b -> a -> a; enforceWHNF (Main.WHNF x) y = y; foldl' :: (b -> a -> b) -> b -> List a -> b; foldl' f a Nil = a; foldl' f a (Cons x xs) = dsEm (foldl' f) (f a x) xs; length :: List a -> MyInt; length = foldl' length0 (Main.Pos Main.Zero); length0 n vv = psMyInt n (Main.Pos (Main.Succ Main.Zero)); primMinusNat :: Main.Nat -> Main.Nat -> MyInt; primMinusNat Main.Zero Main.Zero = Main.Pos Main.Zero; primMinusNat Main.Zero (Main.Succ y) = Main.Neg (Main.Succ y); primMinusNat (Main.Succ x) Main.Zero = Main.Pos (Main.Succ x); primMinusNat (Main.Succ x) (Main.Succ y) = primMinusNat x y; primPlusInt :: MyInt -> MyInt -> MyInt; primPlusInt (Main.Pos x) (Main.Neg y) = primMinusNat x y; primPlusInt (Main.Neg x) (Main.Pos y) = primMinusNat y x; primPlusInt (Main.Neg x) (Main.Neg y) = Main.Neg (primPlusNat x y); primPlusInt (Main.Pos x) (Main.Pos y) = Main.Pos (primPlusNat x y); primPlusNat :: Main.Nat -> Main.Nat -> Main.Nat; primPlusNat Main.Zero Main.Zero = Main.Zero; primPlusNat Main.Zero (Main.Succ y) = Main.Succ y; primPlusNat (Main.Succ x) Main.Zero = Main.Succ x; primPlusNat (Main.Succ x) (Main.Succ y) = Main.Succ (Main.Succ (primPlusNat x y)); psMyInt :: MyInt -> MyInt -> MyInt; psMyInt = primPlusInt; seq :: b -> a -> a; seq x y = Main.enforceWHNF (Main.WHNF x) y; } ---------------------------------------- (5) Narrow (SOUND) Haskell To QDPs digraph dp_graph { node [outthreshold=100, inthreshold=100];1[label="length",fontsize=16,color="grey",shape="box"];1 -> 3[label="",style="dashed", color="grey", weight=3]; 3[label="length vy3",fontsize=16,color="black",shape="triangle"];3 -> 4[label="",style="solid", color="black", weight=3]; 4[label="foldl' length0 (Pos Zero) vy3",fontsize=16,color="burlywood",shape="box"];60[label="vy3/Cons vy30 vy31",fontsize=10,color="white",style="solid",shape="box"];4 -> 60[label="",style="solid", color="burlywood", weight=9]; 60 -> 5[label="",style="solid", color="burlywood", weight=3]; 61[label="vy3/Nil",fontsize=10,color="white",style="solid",shape="box"];4 -> 61[label="",style="solid", color="burlywood", weight=9]; 61 -> 6[label="",style="solid", color="burlywood", weight=3]; 5[label="foldl' length0 (Pos Zero) (Cons vy30 vy31)",fontsize=16,color="black",shape="box"];5 -> 7[label="",style="solid", color="black", weight=3]; 6[label="foldl' length0 (Pos Zero) Nil",fontsize=16,color="black",shape="box"];6 -> 8[label="",style="solid", color="black", weight=3]; 7[label="dsEm (foldl' length0) (length0 (Pos Zero) vy30) vy31",fontsize=16,color="black",shape="box"];7 -> 9[label="",style="solid", color="black", weight=3]; 8[label="Pos Zero",fontsize=16,color="green",shape="box"];9 -> 18[label="",style="dashed", color="red", weight=0]; 9[label="seq (length0 (Pos Zero) vy30) (foldl' length0 (length0 (Pos Zero) vy30)) vy31",fontsize=16,color="magenta"];9 -> 19[label="",style="dashed", color="magenta", weight=3]; 9 -> 20[label="",style="dashed", color="magenta", weight=3]; 9 -> 21[label="",style="dashed", color="magenta", weight=3]; 9 -> 22[label="",style="dashed", color="magenta", weight=3]; 19[label="Pos Zero",fontsize=16,color="green",shape="box"];20[label="vy31",fontsize=16,color="green",shape="box"];21[label="vy30",fontsize=16,color="green",shape="box"];22[label="Pos Zero",fontsize=16,color="green",shape="box"];18[label="seq (length0 vy4 vy310) (foldl' length0 (length0 vy5 vy310)) vy311",fontsize=16,color="black",shape="triangle"];18 -> 25[label="",style="solid", color="black", weight=3]; 25[label="enforceWHNF (WHNF (length0 vy4 vy310)) (foldl' length0 (length0 vy5 vy310)) vy311",fontsize=16,color="black",shape="box"];25 -> 26[label="",style="solid", color="black", weight=3]; 26[label="foldl' length0 (length0 vy5 vy310) vy311",fontsize=16,color="burlywood",shape="box"];62[label="vy311/Cons vy3110 vy3111",fontsize=10,color="white",style="solid",shape="box"];26 -> 62[label="",style="solid", color="burlywood", weight=9]; 62 -> 27[label="",style="solid", color="burlywood", weight=3]; 63[label="vy311/Nil",fontsize=10,color="white",style="solid",shape="box"];26 -> 63[label="",style="solid", color="burlywood", weight=9]; 63 -> 28[label="",style="solid", color="burlywood", weight=3]; 27[label="foldl' length0 (length0 vy5 vy310) (Cons vy3110 vy3111)",fontsize=16,color="black",shape="box"];27 -> 29[label="",style="solid", color="black", weight=3]; 28[label="foldl' length0 (length0 vy5 vy310) Nil",fontsize=16,color="black",shape="box"];28 -> 30[label="",style="solid", color="black", weight=3]; 29[label="dsEm (foldl' length0) (length0 (length0 vy5 vy310) vy3110) vy3111",fontsize=16,color="black",shape="box"];29 -> 31[label="",style="solid", color="black", weight=3]; 30[label="length0 vy5 vy310",fontsize=16,color="black",shape="triangle"];30 -> 32[label="",style="solid", color="black", weight=3]; 31 -> 18[label="",style="dashed", color="red", weight=0]; 31[label="seq (length0 (length0 vy5 vy310) vy3110) (foldl' length0 (length0 (length0 vy5 vy310) vy3110)) vy3111",fontsize=16,color="magenta"];31 -> 33[label="",style="dashed", color="magenta", weight=3]; 31 -> 34[label="",style="dashed", color="magenta", weight=3]; 31 -> 35[label="",style="dashed", color="magenta", weight=3]; 31 -> 36[label="",style="dashed", color="magenta", weight=3]; 32[label="psMyInt vy5 (Pos (Succ Zero))",fontsize=16,color="black",shape="box"];32 -> 37[label="",style="solid", color="black", weight=3]; 33 -> 30[label="",style="dashed", color="red", weight=0]; 33[label="length0 vy5 vy310",fontsize=16,color="magenta"];34[label="vy3111",fontsize=16,color="green",shape="box"];35[label="vy3110",fontsize=16,color="green",shape="box"];36 -> 30[label="",style="dashed", color="red", weight=0]; 36[label="length0 vy5 vy310",fontsize=16,color="magenta"];37[label="primPlusInt vy5 (Pos (Succ Zero))",fontsize=16,color="burlywood",shape="box"];64[label="vy5/Pos vy50",fontsize=10,color="white",style="solid",shape="box"];37 -> 64[label="",style="solid", color="burlywood", weight=9]; 64 -> 38[label="",style="solid", color="burlywood", weight=3]; 65[label="vy5/Neg vy50",fontsize=10,color="white",style="solid",shape="box"];37 -> 65[label="",style="solid", color="burlywood", weight=9]; 65 -> 39[label="",style="solid", color="burlywood", weight=3]; 38[label="primPlusInt (Pos vy50) (Pos (Succ Zero))",fontsize=16,color="black",shape="box"];38 -> 40[label="",style="solid", color="black", weight=3]; 39[label="primPlusInt (Neg vy50) (Pos (Succ Zero))",fontsize=16,color="black",shape="box"];39 -> 41[label="",style="solid", color="black", weight=3]; 40[label="Pos (primPlusNat vy50 (Succ Zero))",fontsize=16,color="green",shape="box"];40 -> 42[label="",style="dashed", color="green", weight=3]; 41[label="primMinusNat (Succ Zero) vy50",fontsize=16,color="burlywood",shape="box"];66[label="vy50/Succ vy500",fontsize=10,color="white",style="solid",shape="box"];41 -> 66[label="",style="solid", color="burlywood", weight=9]; 66 -> 43[label="",style="solid", color="burlywood", weight=3]; 67[label="vy50/Zero",fontsize=10,color="white",style="solid",shape="box"];41 -> 67[label="",style="solid", color="burlywood", weight=9]; 67 -> 44[label="",style="solid", color="burlywood", weight=3]; 42[label="primPlusNat vy50 (Succ Zero)",fontsize=16,color="burlywood",shape="box"];68[label="vy50/Succ vy500",fontsize=10,color="white",style="solid",shape="box"];42 -> 68[label="",style="solid", color="burlywood", weight=9]; 68 -> 45[label="",style="solid", color="burlywood", weight=3]; 69[label="vy50/Zero",fontsize=10,color="white",style="solid",shape="box"];42 -> 69[label="",style="solid", color="burlywood", weight=9]; 69 -> 46[label="",style="solid", color="burlywood", weight=3]; 43[label="primMinusNat (Succ Zero) (Succ vy500)",fontsize=16,color="black",shape="box"];43 -> 47[label="",style="solid", color="black", weight=3]; 44[label="primMinusNat (Succ Zero) Zero",fontsize=16,color="black",shape="box"];44 -> 48[label="",style="solid", color="black", weight=3]; 45[label="primPlusNat (Succ vy500) (Succ Zero)",fontsize=16,color="black",shape="box"];45 -> 49[label="",style="solid", color="black", weight=3]; 46[label="primPlusNat Zero (Succ Zero)",fontsize=16,color="black",shape="box"];46 -> 50[label="",style="solid", color="black", weight=3]; 47[label="primMinusNat Zero vy500",fontsize=16,color="burlywood",shape="box"];70[label="vy500/Succ vy5000",fontsize=10,color="white",style="solid",shape="box"];47 -> 70[label="",style="solid", color="burlywood", weight=9]; 70 -> 51[label="",style="solid", color="burlywood", weight=3]; 71[label="vy500/Zero",fontsize=10,color="white",style="solid",shape="box"];47 -> 71[label="",style="solid", color="burlywood", weight=9]; 71 -> 52[label="",style="solid", color="burlywood", weight=3]; 48[label="Pos (Succ Zero)",fontsize=16,color="green",shape="box"];49[label="Succ (Succ (primPlusNat vy500 Zero))",fontsize=16,color="green",shape="box"];49 -> 53[label="",style="dashed", color="green", weight=3]; 50[label="Succ Zero",fontsize=16,color="green",shape="box"];51[label="primMinusNat Zero (Succ vy5000)",fontsize=16,color="black",shape="box"];51 -> 54[label="",style="solid", color="black", weight=3]; 52[label="primMinusNat Zero Zero",fontsize=16,color="black",shape="box"];52 -> 55[label="",style="solid", color="black", weight=3]; 53[label="primPlusNat vy500 Zero",fontsize=16,color="burlywood",shape="box"];72[label="vy500/Succ vy5000",fontsize=10,color="white",style="solid",shape="box"];53 -> 72[label="",style="solid", color="burlywood", weight=9]; 72 -> 56[label="",style="solid", color="burlywood", weight=3]; 73[label="vy500/Zero",fontsize=10,color="white",style="solid",shape="box"];53 -> 73[label="",style="solid", color="burlywood", weight=9]; 73 -> 57[label="",style="solid", color="burlywood", weight=3]; 54[label="Neg (Succ vy5000)",fontsize=16,color="green",shape="box"];55[label="Pos Zero",fontsize=16,color="green",shape="box"];56[label="primPlusNat (Succ vy5000) Zero",fontsize=16,color="black",shape="box"];56 -> 58[label="",style="solid", color="black", weight=3]; 57[label="primPlusNat Zero Zero",fontsize=16,color="black",shape="box"];57 -> 59[label="",style="solid", color="black", weight=3]; 58[label="Succ vy5000",fontsize=16,color="green",shape="box"];59[label="Zero",fontsize=16,color="green",shape="box"];} ---------------------------------------- (6) Obligation: Q DP problem: The TRS P consists of the following rules: new_seq(vy4, vy310, vy5, Cons(vy3110, vy3111), h) -> new_seq(new_length0(vy5, vy310, h), vy3110, new_length0(vy5, vy310, h), vy3111, h) The TRS R consists of the following rules: new_primPlusNat(Main.Zero) -> Main.Succ(Main.Zero) new_length0(Main.Neg(Main.Zero), vy310, h) -> Main.Pos(Main.Succ(Main.Zero)) new_primPlusNat(Main.Succ(vy500)) -> Main.Succ(Main.Succ(new_primPlusNat0(vy500))) new_length0(Main.Neg(Main.Succ(Main.Zero)), vy310, h) -> Main.Pos(Main.Zero) new_length0(Main.Neg(Main.Succ(Main.Succ(vy5000))), vy310, h) -> Main.Neg(Main.Succ(vy5000)) new_primPlusNat0(Main.Succ(vy5000)) -> Main.Succ(vy5000) new_length0(Main.Pos(vy50), vy310, h) -> Main.Pos(new_primPlusNat(vy50)) new_primPlusNat0(Main.Zero) -> Main.Zero The set Q consists of the following terms: new_primPlusNat0(Main.Succ(x0)) new_primPlusNat0(Main.Zero) new_length0(Main.Neg(Main.Zero), x0, x1) new_length0(Main.Neg(Main.Succ(Main.Succ(x0))), x1, x2) new_length0(Main.Pos(x0), x1, x2) new_primPlusNat(Main.Succ(x0)) new_primPlusNat(Main.Zero) new_length0(Main.Neg(Main.Succ(Main.Zero)), x0, x1) We have to consider all minimal (P,Q,R)-chains. ---------------------------------------- (7) 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: *new_seq(vy4, vy310, vy5, Cons(vy3110, vy3111), h) -> new_seq(new_length0(vy5, vy310, h), vy3110, new_length0(vy5, vy310, h), vy3111, h) The graph contains the following edges 4 > 2, 4 > 4, 5 >= 5 ---------------------------------------- (8) YES