{-# LANGUAGE DeriveGeneric #-}
{-# LANGUAGE FlexibleContexts #-}
{-# LANGUAGE FlexibleInstances #-}
{-# LANGUAGE ImportQualifiedPost #-}
{-# LANGUAGE MultiParamTypeClasses #-}
{-# LANGUAGE QuasiQuotes #-}
{-# LANGUAGE UndecidableInstances #-}
{-# LANGUAGE ViewPatterns #-}
module Constrained.Examples.CheatSheet where
import Data.Set (Set)
import Data.Set qualified as Set
import GHC.Generics
import Test.QuickCheck (Property, label)
import Constrained
specInt :: Specification BaseFn Int
specInt :: Specification BaseFn Int
specInt = forall a (fn :: Univ) p.
(IsPred p fn, HasSpec fn a) =>
(Term fn a -> p) -> Specification fn a
constrained forall a b. (a -> b) -> a -> b
$ \Term BaseFn Int
i ->
[ forall (fn :: Univ) p.
(BaseUniverse fn, IsPred p fn) =>
p -> Pred fn
assert forall a b. (a -> b) -> a -> b
$ Term BaseFn Int
i forall a (fn :: Univ).
(Ord a, OrdLike fn a) =>
Term fn a -> Term fn a -> Term fn Bool
<. Term
(Fix
(Oneof
(Oneof
(Oneof MapFn (Oneof PairFn ListFn))
(Oneof FunFn (Oneof SetFn OrdFn)))
(Oneof
(Oneof SumFn (Oneof BoolFn GenericsFn))
(Oneof SizeFn (Oneof EqFn IntFn)))))
Int
10
, forall (fn :: Univ) p.
(BaseUniverse fn, IsPred p fn) =>
p -> Pred fn
assert forall a b. (a -> b) -> a -> b
$ Term
(Fix
(Oneof
(Oneof
(Oneof MapFn (Oneof PairFn ListFn))
(Oneof FunFn (Oneof SetFn OrdFn)))
(Oneof
(Oneof SumFn (Oneof BoolFn GenericsFn))
(Oneof SizeFn (Oneof EqFn IntFn)))))
Int
0 forall a (fn :: Univ).
(Ord a, OrdLike fn a) =>
Term fn a -> Term fn a -> Term fn Bool
<. Term BaseFn Int
i
]
specInt' :: Specification BaseFn Int
specInt' :: Specification BaseFn Int
specInt' = forall a (fn :: Univ) p.
(IsPred p fn, HasSpec fn a) =>
(Term fn a -> p) -> Specification fn a
constrained forall a b. (a -> b) -> a -> b
$ \Term BaseFn Int
i ->
[ Term BaseFn Int
i forall a (fn :: Univ).
(Ord a, OrdLike fn a) =>
Term fn a -> Term fn a -> Term fn Bool
<. Term
(Fix
(Oneof
(Oneof
(Oneof MapFn (Oneof PairFn ListFn))
(Oneof FunFn (Oneof SetFn OrdFn)))
(Oneof
(Oneof SumFn (Oneof BoolFn GenericsFn))
(Oneof SizeFn (Oneof EqFn IntFn)))))
Int
10
, Term
(Fix
(Oneof
(Oneof
(Oneof MapFn (Oneof PairFn ListFn))
(Oneof FunFn (Oneof SetFn OrdFn)))
(Oneof
(Oneof SumFn (Oneof BoolFn GenericsFn))
(Oneof SizeFn (Oneof EqFn IntFn)))))
Int
0 forall a (fn :: Univ).
(Ord a, OrdLike fn a) =>
Term fn a -> Term fn a -> Term fn Bool
<. Term BaseFn Int
i
]
specProd :: Specification BaseFn (Int, Int)
specProd :: Specification BaseFn (Int, Int)
specProd = forall a (fn :: Univ) p.
(IsPred p fn, HasSpec fn a) =>
(Term fn a -> p) -> Specification fn a
constrained forall a b. (a -> b) -> a -> b
$ \Term BaseFn (Int, Int)
p ->
[ forall (fn :: Univ) a b.
(HasSpec fn a, HasSpec fn b) =>
Term fn (a, b) -> Term fn a
fst_ Term BaseFn (Int, Int)
p forall a (fn :: Univ).
(Ord a, OrdLike fn a) =>
Term fn a -> Term fn a -> Term fn Bool
<. Term
(Fix
(Oneof
(Oneof
(Oneof MapFn (Oneof PairFn ListFn))
(Oneof FunFn (Oneof SetFn OrdFn)))
(Oneof
(Oneof SumFn (Oneof BoolFn GenericsFn))
(Oneof SizeFn (Oneof EqFn IntFn)))))
Int
10
, forall (fn :: Univ) a b.
(HasSpec fn a, HasSpec fn b) =>
Term fn (a, b) -> Term fn b
snd_ Term BaseFn (Int, Int)
p forall a (fn :: Univ).
(Ord a, OrdLike fn a) =>
Term fn a -> Term fn a -> Term fn Bool
<. Term
(Fix
(Oneof
(Oneof
(Oneof MapFn (Oneof PairFn ListFn))
(Oneof FunFn (Oneof SetFn OrdFn)))
(Oneof
(Oneof SumFn (Oneof BoolFn GenericsFn))
(Oneof SizeFn (Oneof EqFn IntFn)))))
Int
100
]
specProd0 :: Specification BaseFn (Int, Int)
specProd0 :: Specification BaseFn (Int, Int)
specProd0 = forall a (fn :: Univ) p.
(IsPred p fn, HasSpec fn a) =>
(Term fn a -> p) -> Specification fn a
constrained forall a b. (a -> b) -> a -> b
$ \Term BaseFn (Int, Int)
p -> forall (fn :: Univ) p.
(BaseUniverse fn, IsPred p fn) =>
p -> Pred fn
assert forall a b. (a -> b) -> a -> b
$ forall (fn :: Univ) a b.
(HasSpec fn a, HasSpec fn b) =>
Term fn (a, b) -> Term fn a
fst_ Term BaseFn (Int, Int)
p forall a (fn :: Univ).
(Ord a, OrdLike fn a) =>
Term fn a -> Term fn a -> Term fn Bool
<. forall (fn :: Univ) a b.
(HasSpec fn a, HasSpec fn b) =>
Term fn (a, b) -> Term fn b
snd_ Term BaseFn (Int, Int)
p
specProd1 :: Specification BaseFn (Int, Int)
specProd1 :: Specification BaseFn (Int, Int)
specProd1 = forall a (fn :: Univ) p.
(IsPred p fn, HasSpec fn a) =>
(Term fn a -> p) -> Specification fn a
constrained forall a b. (a -> b) -> a -> b
$ \Term BaseFn (Int, Int)
p ->
forall (fn :: Univ) p a.
(HasSpec fn a, IsProductType fn a, IsPred p fn) =>
Term fn a
-> FunTy (MapList (Term fn) (ProductAsList a)) p -> Pred fn
match Term BaseFn (Int, Int)
p forall a b. (a -> b) -> a -> b
$ \Term
(Fix
(Oneof
(Oneof
(Oneof MapFn (Oneof PairFn ListFn))
(Oneof FunFn (Oneof SetFn OrdFn)))
(Oneof
(Oneof SumFn (Oneof BoolFn GenericsFn))
(Oneof SizeFn (Oneof EqFn IntFn)))))
Int
x Term
(Fix
(Oneof
(Oneof
(Oneof MapFn (Oneof PairFn ListFn))
(Oneof FunFn (Oneof SetFn OrdFn)))
(Oneof
(Oneof SumFn (Oneof BoolFn GenericsFn))
(Oneof SizeFn (Oneof EqFn IntFn)))))
Int
y ->
Term
(Fix
(Oneof
(Oneof
(Oneof MapFn (Oneof PairFn ListFn))
(Oneof FunFn (Oneof SetFn OrdFn)))
(Oneof
(Oneof SumFn (Oneof BoolFn GenericsFn))
(Oneof SizeFn (Oneof EqFn IntFn)))))
Int
x forall a (fn :: Univ).
(Ord a, OrdLike fn a) =>
Term fn a -> Term fn a -> Term fn Bool
<. Term
(Fix
(Oneof
(Oneof
(Oneof MapFn (Oneof PairFn ListFn))
(Oneof FunFn (Oneof SetFn OrdFn)))
(Oneof
(Oneof SumFn (Oneof BoolFn GenericsFn))
(Oneof SizeFn (Oneof EqFn IntFn)))))
Int
y
nested :: Specification BaseFn ((Int, Int), (Int, Int))
nested :: Specification BaseFn ((Int, Int), (Int, Int))
nested =
forall a (fn :: Univ) p.
(IsPred p fn, HasSpec fn a) =>
(Term fn a -> p) -> Specification fn a
constrained forall a b. (a -> b) -> a -> b
$ \Term BaseFn ((Int, Int), (Int, Int))
pp ->
forall (fn :: Univ) p a.
(HasSpec fn a, IsProductType fn a, IsPred p fn) =>
Term fn a
-> FunTy (MapList (Term fn) (ProductAsList a)) p -> Pred fn
match Term BaseFn ((Int, Int), (Int, Int))
pp forall a b. (a -> b) -> a -> b
$ \Term
(Fix
(Oneof
(Oneof
(Oneof MapFn (Oneof PairFn ListFn))
(Oneof FunFn (Oneof SetFn OrdFn)))
(Oneof
(Oneof SumFn (Oneof BoolFn GenericsFn))
(Oneof SizeFn (Oneof EqFn IntFn)))))
(Int, Int)
p1 Term
(Fix
(Oneof
(Oneof
(Oneof MapFn (Oneof PairFn ListFn))
(Oneof FunFn (Oneof SetFn OrdFn)))
(Oneof
(Oneof SumFn (Oneof BoolFn GenericsFn))
(Oneof SizeFn (Oneof EqFn IntFn)))))
(Int, Int)
p2 ->
forall (fn :: Univ) p a.
(HasSpec fn a, IsProductType fn a, IsPred p fn) =>
Term fn a
-> FunTy (MapList (Term fn) (ProductAsList a)) p -> Pred fn
match Term
(Fix
(Oneof
(Oneof
(Oneof MapFn (Oneof PairFn ListFn))
(Oneof FunFn (Oneof SetFn OrdFn)))
(Oneof
(Oneof SumFn (Oneof BoolFn GenericsFn))
(Oneof SizeFn (Oneof EqFn IntFn)))))
(Int, Int)
p1 forall a b. (a -> b) -> a -> b
$ \Term
(Fix
(Oneof
(Oneof
(Oneof MapFn (Oneof PairFn ListFn))
(Oneof FunFn (Oneof SetFn OrdFn)))
(Oneof
(Oneof SumFn (Oneof BoolFn GenericsFn))
(Oneof SizeFn (Oneof EqFn IntFn)))))
Int
x1 Term
(Fix
(Oneof
(Oneof
(Oneof MapFn (Oneof PairFn ListFn))
(Oneof FunFn (Oneof SetFn OrdFn)))
(Oneof
(Oneof SumFn (Oneof BoolFn GenericsFn))
(Oneof SizeFn (Oneof EqFn IntFn)))))
Int
y1 ->
forall (fn :: Univ) p a.
(HasSpec fn a, IsProductType fn a, IsPred p fn) =>
Term fn a
-> FunTy (MapList (Term fn) (ProductAsList a)) p -> Pred fn
match Term
(Fix
(Oneof
(Oneof
(Oneof MapFn (Oneof PairFn ListFn))
(Oneof FunFn (Oneof SetFn OrdFn)))
(Oneof
(Oneof SumFn (Oneof BoolFn GenericsFn))
(Oneof SizeFn (Oneof EqFn IntFn)))))
(Int, Int)
p2 forall a b. (a -> b) -> a -> b
$ \Term
(Fix
(Oneof
(Oneof
(Oneof MapFn (Oneof PairFn ListFn))
(Oneof FunFn (Oneof SetFn OrdFn)))
(Oneof
(Oneof SumFn (Oneof BoolFn GenericsFn))
(Oneof SizeFn (Oneof EqFn IntFn)))))
Int
x2 Term
(Fix
(Oneof
(Oneof
(Oneof MapFn (Oneof PairFn ListFn))
(Oneof FunFn (Oneof SetFn OrdFn)))
(Oneof
(Oneof SumFn (Oneof BoolFn GenericsFn))
(Oneof SizeFn (Oneof EqFn IntFn)))))
Int
y2 ->
[Term
(Fix
(Oneof
(Oneof
(Oneof MapFn (Oneof PairFn ListFn))
(Oneof FunFn (Oneof SetFn OrdFn)))
(Oneof
(Oneof SumFn (Oneof BoolFn GenericsFn))
(Oneof SizeFn (Oneof EqFn IntFn)))))
Int
x1 forall a (fn :: Univ).
(Ord a, OrdLike fn a) =>
Term fn a -> Term fn a -> Term fn Bool
<=. Term
(Fix
(Oneof
(Oneof
(Oneof MapFn (Oneof PairFn ListFn))
(Oneof FunFn (Oneof SetFn OrdFn)))
(Oneof
(Oneof SumFn (Oneof BoolFn GenericsFn))
(Oneof SizeFn (Oneof EqFn IntFn)))))
Int
y1, Term
(Fix
(Oneof
(Oneof
(Oneof MapFn (Oneof PairFn ListFn))
(Oneof FunFn (Oneof SetFn OrdFn)))
(Oneof
(Oneof SumFn (Oneof BoolFn GenericsFn))
(Oneof SizeFn (Oneof EqFn IntFn)))))
Int
y1 forall a (fn :: Univ).
(Ord a, OrdLike fn a) =>
Term fn a -> Term fn a -> Term fn Bool
<=. Term
(Fix
(Oneof
(Oneof
(Oneof MapFn (Oneof PairFn ListFn))
(Oneof FunFn (Oneof SetFn OrdFn)))
(Oneof
(Oneof SumFn (Oneof BoolFn GenericsFn))
(Oneof SizeFn (Oneof EqFn IntFn)))))
Int
x2, Term
(Fix
(Oneof
(Oneof
(Oneof MapFn (Oneof PairFn ListFn))
(Oneof FunFn (Oneof SetFn OrdFn)))
(Oneof
(Oneof SumFn (Oneof BoolFn GenericsFn))
(Oneof SizeFn (Oneof EqFn IntFn)))))
Int
x2 forall a (fn :: Univ).
(Ord a, OrdLike fn a) =>
Term fn a -> Term fn a -> Term fn Bool
<=. Term
(Fix
(Oneof
(Oneof
(Oneof MapFn (Oneof PairFn ListFn))
(Oneof FunFn (Oneof SetFn OrdFn)))
(Oneof
(Oneof SumFn (Oneof BoolFn GenericsFn))
(Oneof SizeFn (Oneof EqFn IntFn)))))
Int
y2]
specProd2 :: Specification BaseFn (Int, Int)
specProd2 :: Specification BaseFn (Int, Int)
specProd2 = forall a (fn :: Univ) p.
(Cases (SimpleRep a) ~ '[SimpleRep a],
TypeSpec fn a ~ TypeSpec fn (SimpleRep a),
HasSpec fn (SimpleRep a), HasSimpleRep a,
All (HasSpec fn) (Args (SimpleRep a)), IsProd (SimpleRep a),
HasSpec fn a, IsPred p fn) =>
FunTy (MapList (Term fn) (Args (SimpleRep a))) p
-> Specification fn a
constrained' forall a b. (a -> b) -> a -> b
$ \Term
(Fix
(Oneof
(Oneof
(Oneof MapFn (Oneof PairFn ListFn))
(Oneof FunFn (Oneof SetFn OrdFn)))
(Oneof
(Oneof SumFn (Oneof BoolFn GenericsFn))
(Oneof SizeFn (Oneof EqFn IntFn)))))
Int
x Term
(Fix
(Oneof
(Oneof
(Oneof MapFn (Oneof PairFn ListFn))
(Oneof FunFn (Oneof SetFn OrdFn)))
(Oneof
(Oneof SumFn (Oneof BoolFn GenericsFn))
(Oneof SizeFn (Oneof EqFn IntFn)))))
Int
y -> Term
(Fix
(Oneof
(Oneof
(Oneof MapFn (Oneof PairFn ListFn))
(Oneof FunFn (Oneof SetFn OrdFn)))
(Oneof
(Oneof SumFn (Oneof BoolFn GenericsFn))
(Oneof SizeFn (Oneof EqFn IntFn)))))
Int
x forall a (fn :: Univ).
(Ord a, OrdLike fn a) =>
Term fn a -> Term fn a -> Term fn Bool
<. Term
(Fix
(Oneof
(Oneof
(Oneof MapFn (Oneof PairFn ListFn))
(Oneof FunFn (Oneof SetFn OrdFn)))
(Oneof
(Oneof SumFn (Oneof BoolFn GenericsFn))
(Oneof SizeFn (Oneof EqFn IntFn)))))
Int
y
solverOrder :: Specification BaseFn (Int, Int)
solverOrder :: Specification BaseFn (Int, Int)
solverOrder = forall a (fn :: Univ) p.
(Cases (SimpleRep a) ~ '[SimpleRep a],
TypeSpec fn a ~ TypeSpec fn (SimpleRep a),
HasSpec fn (SimpleRep a), HasSimpleRep a,
All (HasSpec fn) (Args (SimpleRep a)), IsProd (SimpleRep a),
HasSpec fn a, IsPred p fn) =>
FunTy (MapList (Term fn) (Args (SimpleRep a))) p
-> Specification fn a
constrained' forall a b. (a -> b) -> a -> b
$ \Term
(Fix
(Oneof
(Oneof
(Oneof MapFn (Oneof PairFn ListFn))
(Oneof FunFn (Oneof SetFn OrdFn)))
(Oneof
(Oneof SumFn (Oneof BoolFn GenericsFn))
(Oneof SizeFn (Oneof EqFn IntFn)))))
Int
x Term
(Fix
(Oneof
(Oneof
(Oneof MapFn (Oneof PairFn ListFn))
(Oneof FunFn (Oneof SetFn OrdFn)))
(Oneof
(Oneof SumFn (Oneof BoolFn GenericsFn))
(Oneof SizeFn (Oneof EqFn IntFn)))))
Int
y ->
[ Term
(Fix
(Oneof
(Oneof
(Oneof MapFn (Oneof PairFn ListFn))
(Oneof FunFn (Oneof SetFn OrdFn)))
(Oneof
(Oneof SumFn (Oneof BoolFn GenericsFn))
(Oneof SizeFn (Oneof EqFn IntFn)))))
Int
x forall a (fn :: Univ).
(Ord a, OrdLike fn a) =>
Term fn a -> Term fn a -> Term fn Bool
<. Term
(Fix
(Oneof
(Oneof
(Oneof MapFn (Oneof PairFn ListFn))
(Oneof FunFn (Oneof SetFn OrdFn)))
(Oneof
(Oneof SumFn (Oneof BoolFn GenericsFn))
(Oneof SizeFn (Oneof EqFn IntFn)))))
Int
y
, Term
(Fix
(Oneof
(Oneof
(Oneof MapFn (Oneof PairFn ListFn))
(Oneof FunFn (Oneof SetFn OrdFn)))
(Oneof
(Oneof SumFn (Oneof BoolFn GenericsFn))
(Oneof SizeFn (Oneof EqFn IntFn)))))
Int
y forall a (fn :: Univ).
(Ord a, OrdLike fn a) =>
Term fn a -> Term fn a -> Term fn Bool
<. Term
(Fix
(Oneof
(Oneof
(Oneof MapFn (Oneof PairFn ListFn))
(Oneof FunFn (Oneof SetFn OrdFn)))
(Oneof
(Oneof SumFn (Oneof BoolFn GenericsFn))
(Oneof SizeFn (Oneof EqFn IntFn)))))
Int
10
]
solverOrder' :: Specification BaseFn (Int, Int)
solverOrder' :: Specification BaseFn (Int, Int)
solverOrder' = forall a (fn :: Univ) p.
(Cases (SimpleRep a) ~ '[SimpleRep a],
TypeSpec fn a ~ TypeSpec fn (SimpleRep a),
HasSpec fn (SimpleRep a), HasSimpleRep a,
All (HasSpec fn) (Args (SimpleRep a)), IsProd (SimpleRep a),
HasSpec fn a, IsPred p fn) =>
FunTy (MapList (Term fn) (Args (SimpleRep a))) p
-> Specification fn a
constrained' forall a b. (a -> b) -> a -> b
$ \ Term
(Fix
(Oneof
(Oneof
(Oneof MapFn (Oneof PairFn ListFn))
(Oneof FunFn (Oneof SetFn OrdFn)))
(Oneof
(Oneof SumFn (Oneof BoolFn GenericsFn))
(Oneof SizeFn (Oneof EqFn IntFn)))))
Int
[var|x|] Term
(Fix
(Oneof
(Oneof
(Oneof MapFn (Oneof PairFn ListFn))
(Oneof FunFn (Oneof SetFn OrdFn)))
(Oneof
(Oneof SumFn (Oneof BoolFn GenericsFn))
(Oneof SizeFn (Oneof EqFn IntFn)))))
Int
[var|y|] ->
[ Term
(Fix
(Oneof
(Oneof
(Oneof MapFn (Oneof PairFn ListFn))
(Oneof FunFn (Oneof SetFn OrdFn)))
(Oneof
(Oneof SumFn (Oneof BoolFn GenericsFn))
(Oneof SizeFn (Oneof EqFn IntFn)))))
Int
x forall a (fn :: Univ).
(Ord a, OrdLike fn a) =>
Term fn a -> Term fn a -> Term fn Bool
<. Term
(Fix
(Oneof
(Oneof
(Oneof MapFn (Oneof PairFn ListFn))
(Oneof FunFn (Oneof SetFn OrdFn)))
(Oneof
(Oneof SumFn (Oneof BoolFn GenericsFn))
(Oneof SizeFn (Oneof EqFn IntFn)))))
Int
y
, Term
(Fix
(Oneof
(Oneof
(Oneof MapFn (Oneof PairFn ListFn))
(Oneof FunFn (Oneof SetFn OrdFn)))
(Oneof
(Oneof SumFn (Oneof BoolFn GenericsFn))
(Oneof SizeFn (Oneof EqFn IntFn)))))
Int
y forall a (fn :: Univ).
(Ord a, OrdLike fn a) =>
Term fn a -> Term fn a -> Term fn Bool
<. Term
(Fix
(Oneof
(Oneof
(Oneof MapFn (Oneof PairFn ListFn))
(Oneof FunFn (Oneof SetFn OrdFn)))
(Oneof
(Oneof SumFn (Oneof BoolFn GenericsFn))
(Oneof SizeFn (Oneof EqFn IntFn)))))
Int
10
]
tightFit0 :: Specification BaseFn (Int, Int)
tightFit0 :: Specification BaseFn (Int, Int)
tightFit0 = forall a (fn :: Univ) p.
(Cases (SimpleRep a) ~ '[SimpleRep a],
TypeSpec fn a ~ TypeSpec fn (SimpleRep a),
HasSpec fn (SimpleRep a), HasSimpleRep a,
All (HasSpec fn) (Args (SimpleRep a)), IsProd (SimpleRep a),
HasSpec fn a, IsPred p fn) =>
FunTy (MapList (Term fn) (Args (SimpleRep a))) p
-> Specification fn a
constrained' forall a b. (a -> b) -> a -> b
$ \Term
(Fix
(Oneof
(Oneof
(Oneof MapFn (Oneof PairFn ListFn))
(Oneof FunFn (Oneof SetFn OrdFn)))
(Oneof
(Oneof SumFn (Oneof BoolFn GenericsFn))
(Oneof SizeFn (Oneof EqFn IntFn)))))
Int
x Term
(Fix
(Oneof
(Oneof
(Oneof MapFn (Oneof PairFn ListFn))
(Oneof FunFn (Oneof SetFn OrdFn)))
(Oneof
(Oneof SumFn (Oneof BoolFn GenericsFn))
(Oneof SizeFn (Oneof EqFn IntFn)))))
Int
y ->
[ Term
(Fix
(Oneof
(Oneof
(Oneof MapFn (Oneof PairFn ListFn))
(Oneof FunFn (Oneof SetFn OrdFn)))
(Oneof
(Oneof SumFn (Oneof BoolFn GenericsFn))
(Oneof SizeFn (Oneof EqFn IntFn)))))
Int
0 forall a (fn :: Univ).
(Ord a, OrdLike fn a) =>
Term fn a -> Term fn a -> Term fn Bool
<. Term
(Fix
(Oneof
(Oneof
(Oneof MapFn (Oneof PairFn ListFn))
(Oneof FunFn (Oneof SetFn OrdFn)))
(Oneof
(Oneof SumFn (Oneof BoolFn GenericsFn))
(Oneof SizeFn (Oneof EqFn IntFn)))))
Int
x
, Term
(Fix
(Oneof
(Oneof
(Oneof MapFn (Oneof PairFn ListFn))
(Oneof FunFn (Oneof SetFn OrdFn)))
(Oneof
(Oneof SumFn (Oneof BoolFn GenericsFn))
(Oneof SizeFn (Oneof EqFn IntFn)))))
Int
x forall a (fn :: Univ).
(Ord a, OrdLike fn a) =>
Term fn a -> Term fn a -> Term fn Bool
<. Term
(Fix
(Oneof
(Oneof
(Oneof MapFn (Oneof PairFn ListFn))
(Oneof FunFn (Oneof SetFn OrdFn)))
(Oneof
(Oneof SumFn (Oneof BoolFn GenericsFn))
(Oneof SizeFn (Oneof EqFn IntFn)))))
Int
y
]
tightFit1 :: Specification BaseFn (Int, Int)
tightFit1 :: Specification BaseFn (Int, Int)
tightFit1 = forall a (fn :: Univ) p.
(Cases (SimpleRep a) ~ '[SimpleRep a],
TypeSpec fn a ~ TypeSpec fn (SimpleRep a),
HasSpec fn (SimpleRep a), HasSimpleRep a,
All (HasSpec fn) (Args (SimpleRep a)), IsProd (SimpleRep a),
HasSpec fn a, IsPred p fn) =>
FunTy (MapList (Term fn) (Args (SimpleRep a))) p
-> Specification fn a
constrained' forall a b. (a -> b) -> a -> b
$ \Term
(Fix
(Oneof
(Oneof
(Oneof MapFn (Oneof PairFn ListFn))
(Oneof FunFn (Oneof SetFn OrdFn)))
(Oneof
(Oneof SumFn (Oneof BoolFn GenericsFn))
(Oneof SizeFn (Oneof EqFn IntFn)))))
Int
x Term
(Fix
(Oneof
(Oneof
(Oneof MapFn (Oneof PairFn ListFn))
(Oneof FunFn (Oneof SetFn OrdFn)))
(Oneof
(Oneof SumFn (Oneof BoolFn GenericsFn))
(Oneof SizeFn (Oneof EqFn IntFn)))))
Int
y ->
[ forall (fn :: Univ) p.
(BaseUniverse fn, IsPred p fn) =>
p -> Pred fn
assert forall a b. (a -> b) -> a -> b
$ Term
(Fix
(Oneof
(Oneof
(Oneof MapFn (Oneof PairFn ListFn))
(Oneof FunFn (Oneof SetFn OrdFn)))
(Oneof
(Oneof SumFn (Oneof BoolFn GenericsFn))
(Oneof SizeFn (Oneof EqFn IntFn)))))
Int
0 forall a (fn :: Univ).
(Ord a, OrdLike fn a) =>
Term fn a -> Term fn a -> Term fn Bool
<. Term
(Fix
(Oneof
(Oneof
(Oneof MapFn (Oneof PairFn ListFn))
(Oneof FunFn (Oneof SetFn OrdFn)))
(Oneof
(Oneof SumFn (Oneof BoolFn GenericsFn))
(Oneof SizeFn (Oneof EqFn IntFn)))))
Int
x
, forall (fn :: Univ) p.
(BaseUniverse fn, IsPred p fn) =>
p -> Pred fn
assert forall a b. (a -> b) -> a -> b
$ Term
(Fix
(Oneof
(Oneof
(Oneof MapFn (Oneof PairFn ListFn))
(Oneof FunFn (Oneof SetFn OrdFn)))
(Oneof
(Oneof SumFn (Oneof BoolFn GenericsFn))
(Oneof SizeFn (Oneof EqFn IntFn)))))
Int
x forall a (fn :: Univ).
(Ord a, OrdLike fn a) =>
Term fn a -> Term fn a -> Term fn Bool
<. Term
(Fix
(Oneof
(Oneof
(Oneof MapFn (Oneof PairFn ListFn))
(Oneof FunFn (Oneof SetFn OrdFn)))
(Oneof
(Oneof SumFn (Oneof BoolFn GenericsFn))
(Oneof SizeFn (Oneof EqFn IntFn)))))
Int
y
, Term
(Fix
(Oneof
(Oneof
(Oneof MapFn (Oneof PairFn ListFn))
(Oneof FunFn (Oneof SetFn OrdFn)))
(Oneof
(Oneof SumFn (Oneof BoolFn GenericsFn))
(Oneof SizeFn (Oneof EqFn IntFn)))))
Int
y forall (fn :: Univ) a b.
(HasSpec fn a, HasSpec fn b) =>
Term fn a -> Term fn b -> Pred fn
`dependsOn` Term
(Fix
(Oneof
(Oneof
(Oneof MapFn (Oneof PairFn ListFn))
(Oneof FunFn (Oneof SetFn OrdFn)))
(Oneof
(Oneof SumFn (Oneof BoolFn GenericsFn))
(Oneof SizeFn (Oneof EqFn IntFn)))))
Int
x
]
booleanExample :: Specification BaseFn (Int, Int)
booleanExample :: Specification BaseFn (Int, Int)
booleanExample = forall a (fn :: Univ) p.
(Cases (SimpleRep a) ~ '[SimpleRep a],
TypeSpec fn a ~ TypeSpec fn (SimpleRep a),
HasSpec fn (SimpleRep a), HasSimpleRep a,
All (HasSpec fn) (Args (SimpleRep a)), IsProd (SimpleRep a),
HasSpec fn a, IsPred p fn) =>
FunTy (MapList (Term fn) (Args (SimpleRep a))) p
-> Specification fn a
constrained' forall a b. (a -> b) -> a -> b
$ \Term
(Fix
(Oneof
(Oneof
(Oneof MapFn (Oneof PairFn ListFn))
(Oneof FunFn (Oneof SetFn OrdFn)))
(Oneof
(Oneof SumFn (Oneof BoolFn GenericsFn))
(Oneof SizeFn (Oneof EqFn IntFn)))))
Int
x Term
(Fix
(Oneof
(Oneof
(Oneof MapFn (Oneof PairFn ListFn))
(Oneof FunFn (Oneof SetFn OrdFn)))
(Oneof
(Oneof SumFn (Oneof BoolFn GenericsFn))
(Oneof SizeFn (Oneof EqFn IntFn)))))
Int
y ->
forall (fn :: Univ) p q.
(BaseUniverse fn, IsPred p fn, IsPred q fn) =>
Term fn Bool -> p -> q -> Pred fn
ifElse
(Term
(Fix
(Oneof
(Oneof
(Oneof MapFn (Oneof PairFn ListFn))
(Oneof FunFn (Oneof SetFn OrdFn)))
(Oneof
(Oneof SumFn (Oneof BoolFn GenericsFn))
(Oneof SizeFn (Oneof EqFn IntFn)))))
Int
0 forall a (fn :: Univ).
(Ord a, OrdLike fn a) =>
Term fn a -> Term fn a -> Term fn Bool
<. Term
(Fix
(Oneof
(Oneof
(Oneof MapFn (Oneof PairFn ListFn))
(Oneof FunFn (Oneof SetFn OrdFn)))
(Oneof
(Oneof SumFn (Oneof BoolFn GenericsFn))
(Oneof SizeFn (Oneof EqFn IntFn)))))
Int
x)
(Term
(Fix
(Oneof
(Oneof
(Oneof MapFn (Oneof PairFn ListFn))
(Oneof FunFn (Oneof SetFn OrdFn)))
(Oneof
(Oneof SumFn (Oneof BoolFn GenericsFn))
(Oneof SizeFn (Oneof EqFn IntFn)))))
Int
y forall (fn :: Univ) a.
HasSpec fn a =>
Term fn a -> Term fn a -> Term fn Bool
==. Term
(Fix
(Oneof
(Oneof
(Oneof MapFn (Oneof PairFn ListFn))
(Oneof FunFn (Oneof SetFn OrdFn)))
(Oneof
(Oneof SumFn (Oneof BoolFn GenericsFn))
(Oneof SizeFn (Oneof EqFn IntFn)))))
Int
10)
(Term
(Fix
(Oneof
(Oneof
(Oneof MapFn (Oneof PairFn ListFn))
(Oneof FunFn (Oneof SetFn OrdFn)))
(Oneof
(Oneof SumFn (Oneof BoolFn GenericsFn))
(Oneof SizeFn (Oneof EqFn IntFn)))))
Int
y forall (fn :: Univ) a.
HasSpec fn a =>
Term fn a -> Term fn a -> Term fn Bool
==. Term
(Fix
(Oneof
(Oneof
(Oneof MapFn (Oneof PairFn ListFn))
(Oneof FunFn (Oneof SetFn OrdFn)))
(Oneof
(Oneof SumFn (Oneof BoolFn GenericsFn))
(Oneof SizeFn (Oneof EqFn IntFn)))))
Int
20)
validPVPVersion :: Specification BaseFn (Int, Int)
validPVPVersion :: Specification BaseFn (Int, Int)
validPVPVersion = forall a (fn :: Univ) p.
(Cases (SimpleRep a) ~ '[SimpleRep a],
TypeSpec fn a ~ TypeSpec fn (SimpleRep a),
HasSpec fn (SimpleRep a), HasSimpleRep a,
All (HasSpec fn) (Args (SimpleRep a)), IsProd (SimpleRep a),
HasSpec fn a, IsPred p fn) =>
FunTy (MapList (Term fn) (Args (SimpleRep a))) p
-> Specification fn a
constrained' forall a b. (a -> b) -> a -> b
$ \Term
(Fix
(Oneof
(Oneof
(Oneof MapFn (Oneof PairFn ListFn))
(Oneof FunFn (Oneof SetFn OrdFn)))
(Oneof
(Oneof SumFn (Oneof BoolFn GenericsFn))
(Oneof SizeFn (Oneof EqFn IntFn)))))
Int
ma Term
(Fix
(Oneof
(Oneof
(Oneof MapFn (Oneof PairFn ListFn))
(Oneof FunFn (Oneof SetFn OrdFn)))
(Oneof
(Oneof SumFn (Oneof BoolFn GenericsFn))
(Oneof SizeFn (Oneof EqFn IntFn)))))
Int
mi -> [Term
(Fix
(Oneof
(Oneof
(Oneof MapFn (Oneof PairFn ListFn))
(Oneof FunFn (Oneof SetFn OrdFn)))
(Oneof
(Oneof SumFn (Oneof BoolFn GenericsFn))
(Oneof SizeFn (Oneof EqFn IntFn)))))
Int
0 forall a (fn :: Univ).
(Ord a, OrdLike fn a) =>
Term fn a -> Term fn a -> Term fn Bool
<=. Term
(Fix
(Oneof
(Oneof
(Oneof MapFn (Oneof PairFn ListFn))
(Oneof FunFn (Oneof SetFn OrdFn)))
(Oneof
(Oneof SumFn (Oneof BoolFn GenericsFn))
(Oneof SizeFn (Oneof EqFn IntFn)))))
Int
ma, Term
(Fix
(Oneof
(Oneof
(Oneof MapFn (Oneof PairFn ListFn))
(Oneof FunFn (Oneof SetFn OrdFn)))
(Oneof
(Oneof SumFn (Oneof BoolFn GenericsFn))
(Oneof SizeFn (Oneof EqFn IntFn)))))
Int
0 forall a (fn :: Univ).
(Ord a, OrdLike fn a) =>
Term fn a -> Term fn a -> Term fn Bool
<=. Term
(Fix
(Oneof
(Oneof
(Oneof MapFn (Oneof PairFn ListFn))
(Oneof FunFn (Oneof SetFn OrdFn)))
(Oneof
(Oneof SumFn (Oneof BoolFn GenericsFn))
(Oneof SizeFn (Oneof EqFn IntFn)))))
Int
mi]
canFollowExample :: Specification BaseFn ((Int, Int), (Int, Int))
canFollowExample :: Specification BaseFn ((Int, Int), (Int, Int))
canFollowExample = forall a (fn :: Univ) p.
(Cases (SimpleRep a) ~ '[SimpleRep a],
TypeSpec fn a ~ TypeSpec fn (SimpleRep a),
HasSpec fn (SimpleRep a), HasSimpleRep a,
All (HasSpec fn) (Args (SimpleRep a)), IsProd (SimpleRep a),
HasSpec fn a, IsPred p fn) =>
FunTy (MapList (Term fn) (Args (SimpleRep a))) p
-> Specification fn a
constrained' forall a b. (a -> b) -> a -> b
$ \Term
(Fix
(Oneof
(Oneof
(Oneof MapFn (Oneof PairFn ListFn))
(Oneof FunFn (Oneof SetFn OrdFn)))
(Oneof
(Oneof SumFn (Oneof BoolFn GenericsFn))
(Oneof SizeFn (Oneof EqFn IntFn)))))
(Int, Int)
p Term
(Fix
(Oneof
(Oneof
(Oneof MapFn (Oneof PairFn ListFn))
(Oneof FunFn (Oneof SetFn OrdFn)))
(Oneof
(Oneof SumFn (Oneof BoolFn GenericsFn))
(Oneof SizeFn (Oneof EqFn IntFn)))))
(Int, Int)
q ->
[ forall (fn :: Univ) p a.
(HasSpec fn a, IsProductType fn a, IsPred p fn) =>
Term fn a
-> FunTy (MapList (Term fn) (ProductAsList a)) p -> Pred fn
match Term
(Fix
(Oneof
(Oneof
(Oneof MapFn (Oneof PairFn ListFn))
(Oneof FunFn (Oneof SetFn OrdFn)))
(Oneof
(Oneof SumFn (Oneof BoolFn GenericsFn))
(Oneof SizeFn (Oneof EqFn IntFn)))))
(Int, Int)
p forall a b. (a -> b) -> a -> b
$ \Term
(Fix
(Oneof
(Oneof
(Oneof MapFn (Oneof PairFn ListFn))
(Oneof FunFn (Oneof SetFn OrdFn)))
(Oneof
(Oneof SumFn (Oneof BoolFn GenericsFn))
(Oneof SizeFn (Oneof EqFn IntFn)))))
Int
ma Term
(Fix
(Oneof
(Oneof
(Oneof MapFn (Oneof PairFn ListFn))
(Oneof FunFn (Oneof SetFn OrdFn)))
(Oneof
(Oneof SumFn (Oneof BoolFn GenericsFn))
(Oneof SizeFn (Oneof EqFn IntFn)))))
Int
mi ->
forall (fn :: Univ) p a.
(HasSpec fn a, IsProductType fn a, IsPred p fn) =>
Term fn a
-> FunTy (MapList (Term fn) (ProductAsList a)) p -> Pred fn
match Term
(Fix
(Oneof
(Oneof
(Oneof MapFn (Oneof PairFn ListFn))
(Oneof FunFn (Oneof SetFn OrdFn)))
(Oneof
(Oneof SumFn (Oneof BoolFn GenericsFn))
(Oneof SizeFn (Oneof EqFn IntFn)))))
(Int, Int)
q forall a b. (a -> b) -> a -> b
$ \Term
(Fix
(Oneof
(Oneof
(Oneof MapFn (Oneof PairFn ListFn))
(Oneof FunFn (Oneof SetFn OrdFn)))
(Oneof
(Oneof SumFn (Oneof BoolFn GenericsFn))
(Oneof SizeFn (Oneof EqFn IntFn)))))
Int
ma' Term
(Fix
(Oneof
(Oneof
(Oneof MapFn (Oneof PairFn ListFn))
(Oneof FunFn (Oneof SetFn OrdFn)))
(Oneof
(Oneof SumFn (Oneof BoolFn GenericsFn))
(Oneof SizeFn (Oneof EqFn IntFn)))))
Int
mi' ->
[ forall (fn :: Univ) p q.
(BaseUniverse fn, IsPred p fn, IsPred q fn) =>
Term fn Bool -> p -> q -> Pred fn
ifElse
(Term
(Fix
(Oneof
(Oneof
(Oneof MapFn (Oneof PairFn ListFn))
(Oneof FunFn (Oneof SetFn OrdFn)))
(Oneof
(Oneof SumFn (Oneof BoolFn GenericsFn))
(Oneof SizeFn (Oneof EqFn IntFn)))))
Int
ma' forall (fn :: Univ) a.
HasSpec fn a =>
Term fn a -> Term fn a -> Term fn Bool
==. Term
(Fix
(Oneof
(Oneof
(Oneof MapFn (Oneof PairFn ListFn))
(Oneof FunFn (Oneof SetFn OrdFn)))
(Oneof
(Oneof SumFn (Oneof BoolFn GenericsFn))
(Oneof SizeFn (Oneof EqFn IntFn)))))
Int
ma)
(Term
(Fix
(Oneof
(Oneof
(Oneof MapFn (Oneof PairFn ListFn))
(Oneof FunFn (Oneof SetFn OrdFn)))
(Oneof
(Oneof SumFn (Oneof BoolFn GenericsFn))
(Oneof SizeFn (Oneof EqFn IntFn)))))
Int
mi' forall (fn :: Univ) a.
HasSpec fn a =>
Term fn a -> Term fn a -> Term fn Bool
==. Term
(Fix
(Oneof
(Oneof
(Oneof MapFn (Oneof PairFn ListFn))
(Oneof FunFn (Oneof SetFn OrdFn)))
(Oneof
(Oneof SumFn (Oneof BoolFn GenericsFn))
(Oneof SizeFn (Oneof EqFn IntFn)))))
Int
mi forall a. Num a => a -> a -> a
+ Term
(Fix
(Oneof
(Oneof
(Oneof MapFn (Oneof PairFn ListFn))
(Oneof FunFn (Oneof SetFn OrdFn)))
(Oneof
(Oneof SumFn (Oneof BoolFn GenericsFn))
(Oneof SizeFn (Oneof EqFn IntFn)))))
Int
1)
(Term
(Fix
(Oneof
(Oneof
(Oneof MapFn (Oneof PairFn ListFn))
(Oneof FunFn (Oneof SetFn OrdFn)))
(Oneof
(Oneof SumFn (Oneof BoolFn GenericsFn))
(Oneof SizeFn (Oneof EqFn IntFn)))))
Int
mi' forall (fn :: Univ) a.
HasSpec fn a =>
Term fn a -> Term fn a -> Term fn Bool
==. Term
(Fix
(Oneof
(Oneof
(Oneof MapFn (Oneof PairFn ListFn))
(Oneof FunFn (Oneof SetFn OrdFn)))
(Oneof
(Oneof SumFn (Oneof BoolFn GenericsFn))
(Oneof SizeFn (Oneof EqFn IntFn)))))
Int
0)
,
forall (fn :: Univ) p.
(BaseUniverse fn, IsPred p fn) =>
p -> Pred fn
assert forall a b. (a -> b) -> a -> b
$ Term
(Fix
(Oneof
(Oneof
(Oneof MapFn (Oneof PairFn ListFn))
(Oneof FunFn (Oneof SetFn OrdFn)))
(Oneof
(Oneof SumFn (Oneof BoolFn GenericsFn))
(Oneof SizeFn (Oneof EqFn IntFn)))))
Int
ma' forall a (fn :: Univ).
(Ord a, OrdLike fn a) =>
Term fn a -> Term fn a -> Term fn Bool
<=. Term
(Fix
(Oneof
(Oneof
(Oneof MapFn (Oneof PairFn ListFn))
(Oneof FunFn (Oneof SetFn OrdFn)))
(Oneof
(Oneof SumFn (Oneof BoolFn GenericsFn))
(Oneof SizeFn (Oneof EqFn IntFn)))))
Int
ma forall a. Num a => a -> a -> a
+ Term
(Fix
(Oneof
(Oneof
(Oneof MapFn (Oneof PairFn ListFn))
(Oneof FunFn (Oneof SetFn OrdFn)))
(Oneof
(Oneof SumFn (Oneof BoolFn GenericsFn))
(Oneof SizeFn (Oneof EqFn IntFn)))))
Int
1
, forall (fn :: Univ) p.
(BaseUniverse fn, IsPred p fn) =>
p -> Pred fn
assert forall a b. (a -> b) -> a -> b
$ Term
(Fix
(Oneof
(Oneof
(Oneof MapFn (Oneof PairFn ListFn))
(Oneof FunFn (Oneof SetFn OrdFn)))
(Oneof
(Oneof SumFn (Oneof BoolFn GenericsFn))
(Oneof SizeFn (Oneof EqFn IntFn)))))
Int
ma forall a (fn :: Univ).
(Ord a, OrdLike fn a) =>
Term fn a -> Term fn a -> Term fn Bool
<=. Term
(Fix
(Oneof
(Oneof
(Oneof MapFn (Oneof PairFn ListFn))
(Oneof FunFn (Oneof SetFn OrdFn)))
(Oneof
(Oneof SumFn (Oneof BoolFn GenericsFn))
(Oneof SizeFn (Oneof EqFn IntFn)))))
Int
ma'
,
Term
(Fix
(Oneof
(Oneof
(Oneof MapFn (Oneof PairFn ListFn))
(Oneof FunFn (Oneof SetFn OrdFn)))
(Oneof
(Oneof SumFn (Oneof BoolFn GenericsFn))
(Oneof SizeFn (Oneof EqFn IntFn)))))
Int
ma' forall (fn :: Univ) a b.
(HasSpec fn a, HasSpec fn b) =>
Term fn a -> Term fn b -> Pred fn
`dependsOn` Term
(Fix
(Oneof
(Oneof
(Oneof MapFn (Oneof PairFn ListFn))
(Oneof FunFn (Oneof SetFn OrdFn)))
(Oneof
(Oneof SumFn (Oneof BoolFn GenericsFn))
(Oneof SizeFn (Oneof EqFn IntFn)))))
Int
ma
]
, Term
(Fix
(Oneof
(Oneof
(Oneof MapFn (Oneof PairFn ListFn))
(Oneof FunFn (Oneof SetFn OrdFn)))
(Oneof
(Oneof SumFn (Oneof BoolFn GenericsFn))
(Oneof SizeFn (Oneof EqFn IntFn)))))
(Int, Int)
p forall (fn :: Univ) a.
HasSpec fn a =>
Term fn a -> Specification fn a -> Pred fn
`satisfies` Specification BaseFn (Int, Int)
validPVPVersion
, Term
(Fix
(Oneof
(Oneof
(Oneof MapFn (Oneof PairFn ListFn))
(Oneof FunFn (Oneof SetFn OrdFn)))
(Oneof
(Oneof SumFn (Oneof BoolFn GenericsFn))
(Oneof SizeFn (Oneof EqFn IntFn)))))
(Int, Int)
q forall (fn :: Univ) a.
HasSpec fn a =>
Term fn a -> Specification fn a -> Pred fn
`satisfies` Specification BaseFn (Int, Int)
validPVPVersion
]
sumExample :: Specification BaseFn (Either Int Bool)
sumExample :: Specification BaseFn (Either Int Bool)
sumExample = forall a (fn :: Univ) p.
(IsPred p fn, HasSpec fn a) =>
(Term fn a -> p) -> Specification fn a
constrained forall a b. (a -> b) -> a -> b
$ \Term BaseFn (Either Int Bool)
e ->
(forall (fn :: Univ) a.
(HasSpec fn a, HasSpec fn (SimpleRep a), HasSimpleRep a,
TypeSpec fn a ~ TypeSpec fn (SimpleRep a),
SimpleRep a ~ SumOver (Cases (SimpleRep a)),
TypeList (Cases (SimpleRep a))) =>
Term fn a
-> FunTy
(MapList (Weighted (Binder fn)) (Cases (SimpleRep a))) (Pred fn)
caseOn Term BaseFn (Either Int Bool)
e)
(forall (fn :: Univ) p a.
(HasSpec fn a, All (HasSpec fn) (Args a), IsPred p fn, IsProd a) =>
FunTy (MapList (Term fn) (Args a)) p -> Weighted (Binder fn) a
branch forall a b. (a -> b) -> a -> b
$ \Term
(Fix
(Oneof
(Oneof
(Oneof MapFn (Oneof PairFn ListFn))
(Oneof FunFn (Oneof SetFn OrdFn)))
(Oneof
(Oneof SumFn (Oneof BoolFn GenericsFn))
(Oneof SizeFn (Oneof EqFn IntFn)))))
Int
i -> Term
(Fix
(Oneof
(Oneof
(Oneof MapFn (Oneof PairFn ListFn))
(Oneof FunFn (Oneof SetFn OrdFn)))
(Oneof
(Oneof SumFn (Oneof BoolFn GenericsFn))
(Oneof SizeFn (Oneof EqFn IntFn)))))
Int
i forall a (fn :: Univ).
(Ord a, OrdLike fn a) =>
Term fn a -> Term fn a -> Term fn Bool
<. Term
(Fix
(Oneof
(Oneof
(Oneof MapFn (Oneof PairFn ListFn))
(Oneof FunFn (Oneof SetFn OrdFn)))
(Oneof
(Oneof SumFn (Oneof BoolFn GenericsFn))
(Oneof SizeFn (Oneof EqFn IntFn)))))
Int
0)
(forall (fn :: Univ) p a.
(HasSpec fn a, All (HasSpec fn) (Args a), IsPred p fn, IsProd a) =>
FunTy (MapList (Term fn) (Args a)) p -> Weighted (Binder fn) a
branch forall a b. (a -> b) -> a -> b
$ \Term
(Fix
(Oneof
(Oneof
(Oneof MapFn (Oneof PairFn ListFn))
(Oneof FunFn (Oneof SetFn OrdFn)))
(Oneof
(Oneof SumFn (Oneof BoolFn GenericsFn))
(Oneof SizeFn (Oneof EqFn IntFn)))))
Bool
b -> forall (fn :: Univ).
BaseUniverse fn =>
Term fn Bool -> Term fn Bool
not_ Term
(Fix
(Oneof
(Oneof
(Oneof MapFn (Oneof PairFn ListFn))
(Oneof FunFn (Oneof SetFn OrdFn)))
(Oneof
(Oneof SumFn (Oneof BoolFn GenericsFn))
(Oneof SizeFn (Oneof EqFn IntFn)))))
Bool
b)
sumExampleTwo :: Specification BaseFn (Int, Either Int Bool)
sumExampleTwo :: Specification BaseFn (Int, Either Int Bool)
sumExampleTwo = forall a (fn :: Univ) p.
(Cases (SimpleRep a) ~ '[SimpleRep a],
TypeSpec fn a ~ TypeSpec fn (SimpleRep a),
HasSpec fn (SimpleRep a), HasSimpleRep a,
All (HasSpec fn) (Args (SimpleRep a)), IsProd (SimpleRep a),
HasSpec fn a, IsPred p fn) =>
FunTy (MapList (Term fn) (Args (SimpleRep a))) p
-> Specification fn a
constrained' forall a b. (a -> b) -> a -> b
$ \Term
(Fix
(Oneof
(Oneof
(Oneof MapFn (Oneof PairFn ListFn))
(Oneof FunFn (Oneof SetFn OrdFn)))
(Oneof
(Oneof SumFn (Oneof BoolFn GenericsFn))
(Oneof SizeFn (Oneof EqFn IntFn)))))
Int
i Term
(Fix
(Oneof
(Oneof
(Oneof MapFn (Oneof PairFn ListFn))
(Oneof FunFn (Oneof SetFn OrdFn)))
(Oneof
(Oneof SumFn (Oneof BoolFn GenericsFn))
(Oneof SizeFn (Oneof EqFn IntFn)))))
(Either Int Bool)
e ->
[ forall (fn :: Univ) a.
(HasSpec fn a, HasSpec fn (SimpleRep a), HasSimpleRep a,
TypeSpec fn a ~ TypeSpec fn (SimpleRep a),
SimpleRep a ~ SumOver (Cases (SimpleRep a)),
TypeList (Cases (SimpleRep a))) =>
Term fn a
-> FunTy
(MapList (Weighted (Binder fn)) (Cases (SimpleRep a))) (Pred fn)
caseOn
Term
(Fix
(Oneof
(Oneof
(Oneof MapFn (Oneof PairFn ListFn))
(Oneof FunFn (Oneof SetFn OrdFn)))
(Oneof
(Oneof SumFn (Oneof BoolFn GenericsFn))
(Oneof SizeFn (Oneof EqFn IntFn)))))
(Either Int Bool)
e
(forall (fn :: Univ) p a.
(HasSpec fn a, All (HasSpec fn) (Args a), IsPred p fn, IsProd a) =>
FunTy (MapList (Term fn) (Args a)) p -> Weighted (Binder fn) a
branch forall a b. (a -> b) -> a -> b
$ \Term
(Fix
(Oneof
(Oneof
(Oneof MapFn (Oneof PairFn ListFn))
(Oneof FunFn (Oneof SetFn OrdFn)))
(Oneof
(Oneof SumFn (Oneof BoolFn GenericsFn))
(Oneof SizeFn (Oneof EqFn IntFn)))))
Int
j -> Term
(Fix
(Oneof
(Oneof
(Oneof MapFn (Oneof PairFn ListFn))
(Oneof FunFn (Oneof SetFn OrdFn)))
(Oneof
(Oneof SumFn (Oneof BoolFn GenericsFn))
(Oneof SizeFn (Oneof EqFn IntFn)))))
Int
i forall a (fn :: Univ).
(Ord a, OrdLike fn a) =>
Term fn a -> Term fn a -> Term fn Bool
<. Term
(Fix
(Oneof
(Oneof
(Oneof MapFn (Oneof PairFn ListFn))
(Oneof FunFn (Oneof SetFn OrdFn)))
(Oneof
(Oneof SumFn (Oneof BoolFn GenericsFn))
(Oneof SizeFn (Oneof EqFn IntFn)))))
Int
j)
(forall (fn :: Univ) p a.
(HasSpec fn a, All (HasSpec fn) (Args a), IsPred p fn, IsProd a) =>
FunTy (MapList (Term fn) (Args a)) p -> Weighted (Binder fn) a
branch forall a b. (a -> b) -> a -> b
$ \Term
(Fix
(Oneof
(Oneof
(Oneof MapFn (Oneof PairFn ListFn))
(Oneof FunFn (Oneof SetFn OrdFn)))
(Oneof
(Oneof SumFn (Oneof BoolFn GenericsFn))
(Oneof SizeFn (Oneof EqFn IntFn)))))
Bool
b -> forall (fn :: Univ).
BaseUniverse fn =>
Term fn Bool -> Term fn Bool
not_ Term
(Fix
(Oneof
(Oneof
(Oneof MapFn (Oneof PairFn ListFn))
(Oneof FunFn (Oneof SetFn OrdFn)))
(Oneof
(Oneof SumFn (Oneof BoolFn GenericsFn))
(Oneof SizeFn (Oneof EqFn IntFn)))))
Bool
b)
, forall (fn :: Univ) p.
(BaseUniverse fn, IsPred p fn) =>
p -> Pred fn
assert forall a b. (a -> b) -> a -> b
$ Term
(Fix
(Oneof
(Oneof
(Oneof MapFn (Oneof PairFn ListFn))
(Oneof FunFn (Oneof SetFn OrdFn)))
(Oneof
(Oneof SumFn (Oneof BoolFn GenericsFn))
(Oneof SizeFn (Oneof EqFn IntFn)))))
Int
20 forall a (fn :: Univ).
(Ord a, OrdLike fn a) =>
Term fn a -> Term fn a -> Term fn Bool
<. Term
(Fix
(Oneof
(Oneof
(Oneof MapFn (Oneof PairFn ListFn))
(Oneof FunFn (Oneof SetFn OrdFn)))
(Oneof
(Oneof SumFn (Oneof BoolFn GenericsFn))
(Oneof SizeFn (Oneof EqFn IntFn)))))
Int
i
]
setExample :: Specification BaseFn (Set Int, Set Int, Set Int)
setExample :: Specification BaseFn (Set Int, Set Int, Set Int)
setExample = forall a (fn :: Univ) p.
(Cases (SimpleRep a) ~ '[SimpleRep a],
TypeSpec fn a ~ TypeSpec fn (SimpleRep a),
HasSpec fn (SimpleRep a), HasSimpleRep a,
All (HasSpec fn) (Args (SimpleRep a)), IsProd (SimpleRep a),
HasSpec fn a, IsPred p fn) =>
FunTy (MapList (Term fn) (Args (SimpleRep a))) p
-> Specification fn a
constrained' forall a b. (a -> b) -> a -> b
$ \Term
(Fix
(Oneof
(Oneof
(Oneof MapFn (Oneof PairFn ListFn))
(Oneof FunFn (Oneof SetFn OrdFn)))
(Oneof
(Oneof SumFn (Oneof BoolFn GenericsFn))
(Oneof SizeFn (Oneof EqFn IntFn)))))
(Set Int)
xs Term
(Fix
(Oneof
(Oneof
(Oneof MapFn (Oneof PairFn ListFn))
(Oneof FunFn (Oneof SetFn OrdFn)))
(Oneof
(Oneof SumFn (Oneof BoolFn GenericsFn))
(Oneof SizeFn (Oneof EqFn IntFn)))))
(Set Int)
ys Term
(Fix
(Oneof
(Oneof
(Oneof MapFn (Oneof PairFn ListFn))
(Oneof FunFn (Oneof SetFn OrdFn)))
(Oneof
(Oneof SumFn (Oneof BoolFn GenericsFn))
(Oneof SizeFn (Oneof EqFn IntFn)))))
(Set Int)
zs ->
[ Term
(Fix
(Oneof
(Oneof
(Oneof MapFn (Oneof PairFn ListFn))
(Oneof FunFn (Oneof SetFn OrdFn)))
(Oneof
(Oneof SumFn (Oneof BoolFn GenericsFn))
(Oneof SizeFn (Oneof EqFn IntFn)))))
(Set Int)
xs forall (fn :: Univ) a.
(HasSpec fn (Set a), Ord a, Show a, Typeable a) =>
Term fn (Set a) -> Term fn (Set a) -> Term fn Bool
`subset_` (Term
(Fix
(Oneof
(Oneof
(Oneof MapFn (Oneof PairFn ListFn))
(Oneof FunFn (Oneof SetFn OrdFn)))
(Oneof
(Oneof SumFn (Oneof BoolFn GenericsFn))
(Oneof SizeFn (Oneof EqFn IntFn)))))
(Set Int)
ys forall a. Semigroup a => a -> a -> a
<> Term
(Fix
(Oneof
(Oneof
(Oneof MapFn (Oneof PairFn ListFn))
(Oneof FunFn (Oneof SetFn OrdFn)))
(Oneof
(Oneof SumFn (Oneof BoolFn GenericsFn))
(Oneof SizeFn (Oneof EqFn IntFn)))))
(Set Int)
zs)
, forall a (fn :: Univ).
(HasSpec fn a, Sized fn a) =>
Term fn a -> Term fn Integer
sizeOf_ Term
(Fix
(Oneof
(Oneof
(Oneof MapFn (Oneof PairFn ListFn))
(Oneof FunFn (Oneof SetFn OrdFn)))
(Oneof
(Oneof SumFn (Oneof BoolFn GenericsFn))
(Oneof SizeFn (Oneof EqFn IntFn)))))
(Set Int)
ys forall a (fn :: Univ).
(Ord a, OrdLike fn a) =>
Term fn a -> Term fn a -> Term fn Bool
<=. Term
(Fix
(Oneof
(Oneof
(Oneof MapFn (Oneof PairFn ListFn))
(Oneof FunFn (Oneof SetFn OrdFn)))
(Oneof
(Oneof SumFn (Oneof BoolFn GenericsFn))
(Oneof SizeFn (Oneof EqFn IntFn)))))
Integer
10
]
forAllFollow0 :: Specification BaseFn ((Int, Int), Set (Int, Int))
forAllFollow0 :: Specification BaseFn ((Int, Int), Set (Int, Int))
forAllFollow0 = forall a (fn :: Univ) p.
(Cases (SimpleRep a) ~ '[SimpleRep a],
TypeSpec fn a ~ TypeSpec fn (SimpleRep a),
HasSpec fn (SimpleRep a), HasSimpleRep a,
All (HasSpec fn) (Args (SimpleRep a)), IsProd (SimpleRep a),
HasSpec fn a, IsPred p fn) =>
FunTy (MapList (Term fn) (Args (SimpleRep a))) p
-> Specification fn a
constrained' forall a b. (a -> b) -> a -> b
$ \Term
(Fix
(Oneof
(Oneof
(Oneof MapFn (Oneof PairFn ListFn))
(Oneof FunFn (Oneof SetFn OrdFn)))
(Oneof
(Oneof SumFn (Oneof BoolFn GenericsFn))
(Oneof SizeFn (Oneof EqFn IntFn)))))
(Int, Int)
p Term
(Fix
(Oneof
(Oneof
(Oneof MapFn (Oneof PairFn ListFn))
(Oneof FunFn (Oneof SetFn OrdFn)))
(Oneof
(Oneof SumFn (Oneof BoolFn GenericsFn))
(Oneof SizeFn (Oneof EqFn IntFn)))))
(Set (Int, Int))
qs ->
[ forall t a (fn :: Univ) p.
(Forallable t a, HasSpec fn t, HasSpec fn a, IsPred p fn) =>
Term fn t -> (Term fn a -> p) -> Pred fn
forAll Term
(Fix
(Oneof
(Oneof
(Oneof MapFn (Oneof PairFn ListFn))
(Oneof FunFn (Oneof SetFn OrdFn)))
(Oneof
(Oneof SumFn (Oneof BoolFn GenericsFn))
(Oneof SizeFn (Oneof EqFn IntFn)))))
(Set (Int, Int))
qs forall a b. (a -> b) -> a -> b
$ \Term
(Fix
(Oneof
(Oneof
(Oneof MapFn (Oneof PairFn ListFn))
(Oneof FunFn (Oneof SetFn OrdFn)))
(Oneof
(Oneof SumFn (Oneof BoolFn GenericsFn))
(Oneof SizeFn (Oneof EqFn IntFn)))))
(Int, Int)
q -> forall (fn :: Univ) a b.
(HasSpec fn a, HasSpec fn b) =>
Term fn a -> Term fn b -> Term fn (a, b)
pair_ Term
(Fix
(Oneof
(Oneof
(Oneof MapFn (Oneof PairFn ListFn))
(Oneof FunFn (Oneof SetFn OrdFn)))
(Oneof
(Oneof SumFn (Oneof BoolFn GenericsFn))
(Oneof SizeFn (Oneof EqFn IntFn)))))
(Int, Int)
p Term
(Fix
(Oneof
(Oneof
(Oneof MapFn (Oneof PairFn ListFn))
(Oneof FunFn (Oneof SetFn OrdFn)))
(Oneof
(Oneof SumFn (Oneof BoolFn GenericsFn))
(Oneof SizeFn (Oneof EqFn IntFn)))))
(Int, Int)
q forall (fn :: Univ) a.
HasSpec fn a =>
Term fn a -> Specification fn a -> Pred fn
`satisfies` Specification BaseFn ((Int, Int), (Int, Int))
canFollowExample
]
forAllFollow :: Specification BaseFn ((Int, Int), Set (Int, Int))
forAllFollow :: Specification BaseFn ((Int, Int), Set (Int, Int))
forAllFollow = forall a (fn :: Univ) p.
(Cases (SimpleRep a) ~ '[SimpleRep a],
TypeSpec fn a ~ TypeSpec fn (SimpleRep a),
HasSpec fn (SimpleRep a), HasSimpleRep a,
All (HasSpec fn) (Args (SimpleRep a)), IsProd (SimpleRep a),
HasSpec fn a, IsPred p fn) =>
FunTy (MapList (Term fn) (Args (SimpleRep a))) p
-> Specification fn a
constrained' forall a b. (a -> b) -> a -> b
$ \Term
(Fix
(Oneof
(Oneof
(Oneof MapFn (Oneof PairFn ListFn))
(Oneof FunFn (Oneof SetFn OrdFn)))
(Oneof
(Oneof SumFn (Oneof BoolFn GenericsFn))
(Oneof SizeFn (Oneof EqFn IntFn)))))
(Int, Int)
p Term
(Fix
(Oneof
(Oneof
(Oneof MapFn (Oneof PairFn ListFn))
(Oneof FunFn (Oneof SetFn OrdFn)))
(Oneof
(Oneof SumFn (Oneof BoolFn GenericsFn))
(Oneof SizeFn (Oneof EqFn IntFn)))))
(Set (Int, Int))
qs ->
[ forall t a (fn :: Univ) p.
(Forallable t a, HasSpec fn t, HasSpec fn a, IsPred p fn) =>
Term fn t -> (Term fn a -> p) -> Pred fn
forAll Term
(Fix
(Oneof
(Oneof
(Oneof MapFn (Oneof PairFn ListFn))
(Oneof FunFn (Oneof SetFn OrdFn)))
(Oneof
(Oneof SumFn (Oneof BoolFn GenericsFn))
(Oneof SizeFn (Oneof EqFn IntFn)))))
(Set (Int, Int))
qs forall a b. (a -> b) -> a -> b
$ \Term
(Fix
(Oneof
(Oneof
(Oneof MapFn (Oneof PairFn ListFn))
(Oneof FunFn (Oneof SetFn OrdFn)))
(Oneof
(Oneof SumFn (Oneof BoolFn GenericsFn))
(Oneof SizeFn (Oneof EqFn IntFn)))))
(Int, Int)
q -> forall (fn :: Univ) a b.
(HasSpec fn a, HasSpec fn b) =>
Term fn a -> Term fn b -> Term fn (a, b)
pair_ Term
(Fix
(Oneof
(Oneof
(Oneof MapFn (Oneof PairFn ListFn))
(Oneof FunFn (Oneof SetFn OrdFn)))
(Oneof
(Oneof SumFn (Oneof BoolFn GenericsFn))
(Oneof SizeFn (Oneof EqFn IntFn)))))
(Int, Int)
p Term
(Fix
(Oneof
(Oneof
(Oneof MapFn (Oneof PairFn ListFn))
(Oneof FunFn (Oneof SetFn OrdFn)))
(Oneof
(Oneof SumFn (Oneof BoolFn GenericsFn))
(Oneof SizeFn (Oneof EqFn IntFn)))))
(Int, Int)
q forall (fn :: Univ) a.
HasSpec fn a =>
Term fn a -> Specification fn a -> Pred fn
`satisfies` Specification BaseFn ((Int, Int), (Int, Int))
canFollowExample
, Term
(Fix
(Oneof
(Oneof
(Oneof MapFn (Oneof PairFn ListFn))
(Oneof FunFn (Oneof SetFn OrdFn)))
(Oneof
(Oneof SumFn (Oneof BoolFn GenericsFn))
(Oneof SizeFn (Oneof EqFn IntFn)))))
(Int, Int)
p forall (fn :: Univ) a.
HasSpec fn a =>
Term fn a -> Specification fn a -> Pred fn
`satisfies` Specification BaseFn (Int, Int)
validPVPVersion
]
existentials :: Specification BaseFn (Set Int, Set Int)
existentials :: Specification BaseFn (Set Int, Set Int)
existentials = forall a (fn :: Univ) p.
(Cases (SimpleRep a) ~ '[SimpleRep a],
TypeSpec fn a ~ TypeSpec fn (SimpleRep a),
HasSpec fn (SimpleRep a), HasSimpleRep a,
All (HasSpec fn) (Args (SimpleRep a)), IsProd (SimpleRep a),
HasSpec fn a, IsPred p fn) =>
FunTy (MapList (Term fn) (Args (SimpleRep a))) p
-> Specification fn a
constrained' forall a b. (a -> b) -> a -> b
$ \Term
(Fix
(Oneof
(Oneof
(Oneof MapFn (Oneof PairFn ListFn))
(Oneof FunFn (Oneof SetFn OrdFn)))
(Oneof
(Oneof SumFn (Oneof BoolFn GenericsFn))
(Oneof SizeFn (Oneof EqFn IntFn)))))
(Set Int)
xs Term
(Fix
(Oneof
(Oneof
(Oneof MapFn (Oneof PairFn ListFn))
(Oneof FunFn (Oneof SetFn OrdFn)))
(Oneof
(Oneof SumFn (Oneof BoolFn GenericsFn))
(Oneof SizeFn (Oneof EqFn IntFn)))))
(Set Int)
ys ->
forall a p (fn :: Univ).
(HasSpec fn a, IsPred p fn) =>
((forall b. Term fn b -> b) -> GE a) -> (Term fn a -> p) -> Pred fn
exists (\forall b.
Term
(Fix
(Oneof
(Oneof
(Oneof MapFn (Oneof PairFn ListFn))
(Oneof FunFn (Oneof SetFn OrdFn)))
(Oneof
(Oneof SumFn (Oneof BoolFn GenericsFn))
(Oneof SizeFn (Oneof EqFn IntFn)))))
b
-> b
eval -> forall (f :: * -> *) a. Applicative f => a -> f a
pure forall a b. (a -> b) -> a -> b
$ forall a. Ord a => Set a -> Set a -> Set a
Set.intersection (forall b.
Term
(Fix
(Oneof
(Oneof
(Oneof MapFn (Oneof PairFn ListFn))
(Oneof FunFn (Oneof SetFn OrdFn)))
(Oneof
(Oneof SumFn (Oneof BoolFn GenericsFn))
(Oneof SizeFn (Oneof EqFn IntFn)))))
b
-> b
eval Term
(Fix
(Oneof
(Oneof
(Oneof MapFn (Oneof PairFn ListFn))
(Oneof FunFn (Oneof SetFn OrdFn)))
(Oneof
(Oneof SumFn (Oneof BoolFn GenericsFn))
(Oneof SizeFn (Oneof EqFn IntFn)))))
(Set Int)
xs) (forall b.
Term
(Fix
(Oneof
(Oneof
(Oneof MapFn (Oneof PairFn ListFn))
(Oneof FunFn (Oneof SetFn OrdFn)))
(Oneof
(Oneof SumFn (Oneof BoolFn GenericsFn))
(Oneof SizeFn (Oneof EqFn IntFn)))))
b
-> b
eval Term
(Fix
(Oneof
(Oneof
(Oneof MapFn (Oneof PairFn ListFn))
(Oneof FunFn (Oneof SetFn OrdFn)))
(Oneof
(Oneof SumFn (Oneof BoolFn GenericsFn))
(Oneof SizeFn (Oneof EqFn IntFn)))))
(Set Int)
ys)) forall a b. (a -> b) -> a -> b
$ \Term
(Fix
(Oneof
(Oneof
(Oneof MapFn (Oneof PairFn ListFn))
(Oneof FunFn (Oneof SetFn OrdFn)))
(Oneof
(Oneof SumFn (Oneof BoolFn GenericsFn))
(Oneof SizeFn (Oneof EqFn IntFn)))))
(Set Int)
zs ->
[ forall (fn :: Univ) p.
(BaseUniverse fn, IsPred p fn) =>
p -> Pred fn
assert forall a b. (a -> b) -> a -> b
$ forall (fn :: Univ).
BaseUniverse fn =>
Term fn Bool -> Term fn Bool
not_ forall a b. (a -> b) -> a -> b
$ forall (fn :: Univ) a.
(HasSpec fn a, Sized fn a) =>
Term fn a -> Term fn Bool
null_ Term
(Fix
(Oneof
(Oneof
(Oneof MapFn (Oneof PairFn ListFn))
(Oneof FunFn (Oneof SetFn OrdFn)))
(Oneof
(Oneof SumFn (Oneof BoolFn GenericsFn))
(Oneof SizeFn (Oneof EqFn IntFn)))))
(Set Int)
zs
, forall (fn :: Univ) p.
(BaseUniverse fn, IsPred p fn) =>
p -> Pred fn
assert forall a b. (a -> b) -> a -> b
$ Term
(Fix
(Oneof
(Oneof
(Oneof MapFn (Oneof PairFn ListFn))
(Oneof FunFn (Oneof SetFn OrdFn)))
(Oneof
(Oneof SumFn (Oneof BoolFn GenericsFn))
(Oneof SizeFn (Oneof EqFn IntFn)))))
(Set Int)
zs forall (fn :: Univ) a.
(HasSpec fn (Set a), Ord a, Show a, Typeable a) =>
Term fn (Set a) -> Term fn (Set a) -> Term fn Bool
`subset_` Term
(Fix
(Oneof
(Oneof
(Oneof MapFn (Oneof PairFn ListFn))
(Oneof FunFn (Oneof SetFn OrdFn)))
(Oneof
(Oneof SumFn (Oneof BoolFn GenericsFn))
(Oneof SizeFn (Oneof EqFn IntFn)))))
(Set Int)
xs
, forall (fn :: Univ) p.
(BaseUniverse fn, IsPred p fn) =>
p -> Pred fn
assert forall a b. (a -> b) -> a -> b
$ Term
(Fix
(Oneof
(Oneof
(Oneof MapFn (Oneof PairFn ListFn))
(Oneof FunFn (Oneof SetFn OrdFn)))
(Oneof
(Oneof SumFn (Oneof BoolFn GenericsFn))
(Oneof SizeFn (Oneof EqFn IntFn)))))
(Set Int)
zs forall (fn :: Univ) a.
(HasSpec fn (Set a), Ord a, Show a, Typeable a) =>
Term fn (Set a) -> Term fn (Set a) -> Term fn Bool
`subset_` Term
(Fix
(Oneof
(Oneof
(Oneof MapFn (Oneof PairFn ListFn))
(Oneof FunFn (Oneof SetFn OrdFn)))
(Oneof
(Oneof SumFn (Oneof BoolFn GenericsFn))
(Oneof SizeFn (Oneof EqFn IntFn)))))
(Set Int)
ys
, Term
(Fix
(Oneof
(Oneof
(Oneof MapFn (Oneof PairFn ListFn))
(Oneof FunFn (Oneof SetFn OrdFn)))
(Oneof
(Oneof SumFn (Oneof BoolFn GenericsFn))
(Oneof SizeFn (Oneof EqFn IntFn)))))
(Set Int)
xs forall (fn :: Univ) a b.
(HasSpec fn a, HasSpec fn b) =>
Term fn a -> Term fn b -> Pred fn
`dependsOn` Term
(Fix
(Oneof
(Oneof
(Oneof MapFn (Oneof PairFn ListFn))
(Oneof FunFn (Oneof SetFn OrdFn)))
(Oneof
(Oneof SumFn (Oneof BoolFn GenericsFn))
(Oneof SizeFn (Oneof EqFn IntFn)))))
(Set Int)
zs
, Term
(Fix
(Oneof
(Oneof
(Oneof MapFn (Oneof PairFn ListFn))
(Oneof FunFn (Oneof SetFn OrdFn)))
(Oneof
(Oneof SumFn (Oneof BoolFn GenericsFn))
(Oneof SizeFn (Oneof EqFn IntFn)))))
(Set Int)
ys forall (fn :: Univ) a b.
(HasSpec fn a, HasSpec fn b) =>
Term fn a -> Term fn b -> Pred fn
`dependsOn` Term
(Fix
(Oneof
(Oneof
(Oneof MapFn (Oneof PairFn ListFn))
(Oneof FunFn (Oneof SetFn OrdFn)))
(Oneof
(Oneof SumFn (Oneof BoolFn GenericsFn))
(Oneof SizeFn (Oneof EqFn IntFn)))))
(Set Int)
zs
]
data FooBarBaz = Foo Int Int | Bar Bool | Baz deriving (FooBarBaz -> FooBarBaz -> Bool
forall a. (a -> a -> Bool) -> (a -> a -> Bool) -> Eq a
/= :: FooBarBaz -> FooBarBaz -> Bool
$c/= :: FooBarBaz -> FooBarBaz -> Bool
== :: FooBarBaz -> FooBarBaz -> Bool
$c== :: FooBarBaz -> FooBarBaz -> Bool
Eq, Int -> FooBarBaz -> ShowS
[FooBarBaz] -> ShowS
FooBarBaz -> String
forall a.
(Int -> a -> ShowS) -> (a -> String) -> ([a] -> ShowS) -> Show a
showList :: [FooBarBaz] -> ShowS
$cshowList :: [FooBarBaz] -> ShowS
show :: FooBarBaz -> String
$cshow :: FooBarBaz -> String
showsPrec :: Int -> FooBarBaz -> ShowS
$cshowsPrec :: Int -> FooBarBaz -> ShowS
Show, forall x. Rep FooBarBaz x -> FooBarBaz
forall x. FooBarBaz -> Rep FooBarBaz x
forall a.
(forall x. a -> Rep a x) -> (forall x. Rep a x -> a) -> Generic a
$cto :: forall x. Rep FooBarBaz x -> FooBarBaz
$cfrom :: forall x. FooBarBaz -> Rep FooBarBaz x
Generic)
instance HasSimpleRep FooBarBaz
instance BaseUniverse fn => HasSpec fn FooBarBaz
fooBarBaz :: Specification BaseFn FooBarBaz
fooBarBaz :: Specification BaseFn FooBarBaz
fooBarBaz = forall a (fn :: Univ) p.
(IsPred p fn, HasSpec fn a) =>
(Term fn a -> p) -> Specification fn a
constrained forall a b. (a -> b) -> a -> b
$ \Term BaseFn FooBarBaz
fbb ->
forall (fn :: Univ) a.
(HasSpec fn a, HasSpec fn (SimpleRep a), HasSimpleRep a,
TypeSpec fn a ~ TypeSpec fn (SimpleRep a),
SimpleRep a ~ SumOver (Cases (SimpleRep a)),
TypeList (Cases (SimpleRep a))) =>
Term fn a
-> FunTy
(MapList (Weighted (Binder fn)) (Cases (SimpleRep a))) (Pred fn)
caseOn
Term BaseFn FooBarBaz
fbb
(forall (fn :: Univ) p a.
(HasSpec fn a, All (HasSpec fn) (Args a), IsPred p fn, IsProd a) =>
FunTy (MapList (Term fn) (Args a)) p -> Weighted (Binder fn) a
branch forall a b. (a -> b) -> a -> b
$ \Term
(Fix
(Oneof
(Oneof
(Oneof MapFn (Oneof PairFn ListFn))
(Oneof FunFn (Oneof SetFn OrdFn)))
(Oneof
(Oneof SumFn (Oneof BoolFn GenericsFn))
(Oneof SizeFn (Oneof EqFn IntFn)))))
Int
i Term
(Fix
(Oneof
(Oneof
(Oneof MapFn (Oneof PairFn ListFn))
(Oneof FunFn (Oneof SetFn OrdFn)))
(Oneof
(Oneof SumFn (Oneof BoolFn GenericsFn))
(Oneof SizeFn (Oneof EqFn IntFn)))))
Int
j -> Term
(Fix
(Oneof
(Oneof
(Oneof MapFn (Oneof PairFn ListFn))
(Oneof FunFn (Oneof SetFn OrdFn)))
(Oneof
(Oneof SumFn (Oneof BoolFn GenericsFn))
(Oneof SizeFn (Oneof EqFn IntFn)))))
Int
i forall a (fn :: Univ).
(Ord a, OrdLike fn a) =>
Term fn a -> Term fn a -> Term fn Bool
<. Term
(Fix
(Oneof
(Oneof
(Oneof MapFn (Oneof PairFn ListFn))
(Oneof FunFn (Oneof SetFn OrdFn)))
(Oneof
(Oneof SumFn (Oneof BoolFn GenericsFn))
(Oneof SizeFn (Oneof EqFn IntFn)))))
Int
j)
(forall (fn :: Univ) p a.
(HasSpec fn a, All (HasSpec fn) (Args a), IsPred p fn, IsProd a) =>
FunTy (MapList (Term fn) (Args a)) p -> Weighted (Binder fn) a
branch forall a b. (a -> b) -> a -> b
$ \Term
(Fix
(Oneof
(Oneof
(Oneof MapFn (Oneof PairFn ListFn))
(Oneof FunFn (Oneof SetFn OrdFn)))
(Oneof
(Oneof SumFn (Oneof BoolFn GenericsFn))
(Oneof SizeFn (Oneof EqFn IntFn)))))
Bool
b -> forall (fn :: Univ).
BaseUniverse fn =>
Term fn Bool -> Term fn Bool
not_ Term
(Fix
(Oneof
(Oneof
(Oneof MapFn (Oneof PairFn ListFn))
(Oneof FunFn (Oneof SetFn OrdFn)))
(Oneof
(Oneof SumFn (Oneof BoolFn GenericsFn))
(Oneof SizeFn (Oneof EqFn IntFn)))))
Bool
b)
(forall (fn :: Univ) p a.
(HasSpec fn a, All (HasSpec fn) (Args a), IsPred p fn, IsProd a) =>
FunTy (MapList (Term fn) (Args a)) p -> Weighted (Binder fn) a
branch forall a b. (a -> b) -> a -> b
$ \Term
(Fix
(Oneof
(Oneof
(Oneof MapFn (Oneof PairFn ListFn))
(Oneof FunFn (Oneof SetFn OrdFn)))
(Oneof
(Oneof SumFn (Oneof BoolFn GenericsFn))
(Oneof SizeFn (Oneof EqFn IntFn)))))
()
_ -> Bool
False)
reifyExample :: Specification BaseFn (Int, Int)
reifyExample :: Specification BaseFn (Int, Int)
reifyExample = forall a (fn :: Univ) p.
(Cases (SimpleRep a) ~ '[SimpleRep a],
TypeSpec fn a ~ TypeSpec fn (SimpleRep a),
HasSpec fn (SimpleRep a), HasSimpleRep a,
All (HasSpec fn) (Args (SimpleRep a)), IsProd (SimpleRep a),
HasSpec fn a, IsPred p fn) =>
FunTy (MapList (Term fn) (Args (SimpleRep a))) p
-> Specification fn a
constrained' forall a b. (a -> b) -> a -> b
$ \ Term
(Fix
(Oneof
(Oneof
(Oneof MapFn (Oneof PairFn ListFn))
(Oneof FunFn (Oneof SetFn OrdFn)))
(Oneof
(Oneof SumFn (Oneof BoolFn GenericsFn))
(Oneof SizeFn (Oneof EqFn IntFn)))))
Int
[var|a|] Term
(Fix
(Oneof
(Oneof
(Oneof MapFn (Oneof PairFn ListFn))
(Oneof FunFn (Oneof SetFn OrdFn)))
(Oneof
(Oneof SumFn (Oneof BoolFn GenericsFn))
(Oneof SizeFn (Oneof EqFn IntFn)))))
Int
[var|b|] ->
forall (fn :: Univ) a b.
(HasSpec fn a, HasSpec fn b) =>
Term fn b -> Term fn a -> (a -> b) -> Pred fn
reifies Term
(Fix
(Oneof
(Oneof
(Oneof MapFn (Oneof PairFn ListFn))
(Oneof FunFn (Oneof SetFn OrdFn)))
(Oneof
(Oneof SumFn (Oneof BoolFn GenericsFn))
(Oneof SizeFn (Oneof EqFn IntFn)))))
Int
b Term
(Fix
(Oneof
(Oneof
(Oneof MapFn (Oneof PairFn ListFn))
(Oneof FunFn (Oneof SetFn OrdFn)))
(Oneof
(Oneof SumFn (Oneof BoolFn GenericsFn))
(Oneof SizeFn (Oneof EqFn IntFn)))))
Int
a forall a b. (a -> b) -> a -> b
$ \Int
x -> forall a. Integral a => a -> a -> a
mod Int
x Int
10
reifyExample' :: Specification BaseFn (Int, Int)
reifyExample' :: Specification BaseFn (Int, Int)
reifyExample' = forall a (fn :: Univ) p.
(Cases (SimpleRep a) ~ '[SimpleRep a],
TypeSpec fn a ~ TypeSpec fn (SimpleRep a),
HasSpec fn (SimpleRep a), HasSimpleRep a,
All (HasSpec fn) (Args (SimpleRep a)), IsProd (SimpleRep a),
HasSpec fn a, IsPred p fn) =>
FunTy (MapList (Term fn) (Args (SimpleRep a))) p
-> Specification fn a
constrained' forall a b. (a -> b) -> a -> b
$ \Term
(Fix
(Oneof
(Oneof
(Oneof MapFn (Oneof PairFn ListFn))
(Oneof FunFn (Oneof SetFn OrdFn)))
(Oneof
(Oneof SumFn (Oneof BoolFn GenericsFn))
(Oneof SizeFn (Oneof EqFn IntFn)))))
Int
a Term
(Fix
(Oneof
(Oneof
(Oneof MapFn (Oneof PairFn ListFn))
(Oneof FunFn (Oneof SetFn OrdFn)))
(Oneof
(Oneof SumFn (Oneof BoolFn GenericsFn))
(Oneof SizeFn (Oneof EqFn IntFn)))))
Int
b ->
[ forall (fn :: Univ) p.
(BaseUniverse fn, IsPred p fn) =>
p -> Pred fn
assert forall a b. (a -> b) -> a -> b
$ Term
(Fix
(Oneof
(Oneof
(Oneof MapFn (Oneof PairFn ListFn))
(Oneof FunFn (Oneof SetFn OrdFn)))
(Oneof
(Oneof SumFn (Oneof BoolFn GenericsFn))
(Oneof SizeFn (Oneof EqFn IntFn)))))
Int
b forall (fn :: Univ) a.
HasSpec fn a =>
Term fn a -> Term fn a -> Term fn Bool
==. forall (fn :: Univ). Term fn Int -> Term fn Int -> Term fn Int
mod_ Term
(Fix
(Oneof
(Oneof
(Oneof MapFn (Oneof PairFn ListFn))
(Oneof FunFn (Oneof SetFn OrdFn)))
(Oneof
(Oneof SumFn (Oneof BoolFn GenericsFn))
(Oneof SizeFn (Oneof EqFn IntFn)))))
Int
a Term
(Fix
(Oneof
(Oneof
(Oneof MapFn (Oneof PairFn ListFn))
(Oneof FunFn (Oneof SetFn OrdFn)))
(Oneof
(Oneof SumFn (Oneof BoolFn GenericsFn))
(Oneof SizeFn (Oneof EqFn IntFn)))))
Int
10
, Term
(Fix
(Oneof
(Oneof
(Oneof MapFn (Oneof PairFn ListFn))
(Oneof FunFn (Oneof SetFn OrdFn)))
(Oneof
(Oneof SumFn (Oneof BoolFn GenericsFn))
(Oneof SizeFn (Oneof EqFn IntFn)))))
Int
b forall (fn :: Univ) a b.
(HasSpec fn a, HasSpec fn b) =>
Term fn a -> Term fn b -> Pred fn
`dependsOn` Term
(Fix
(Oneof
(Oneof
(Oneof MapFn (Oneof PairFn ListFn))
(Oneof FunFn (Oneof SetFn OrdFn)))
(Oneof
(Oneof SumFn (Oneof BoolFn GenericsFn))
(Oneof SizeFn (Oneof EqFn IntFn)))))
Int
a
]
where
mod_ :: Term fn Int -> Term fn Int -> Term fn Int
mod_ :: forall (fn :: Univ). Term fn Int -> Term fn Int -> Term fn Int
mod_ = forall a. HasCallStack => String -> a
error String
"This doesn't exist"
monitorExample :: Specification BaseFn (Either Int Int)
monitorExample :: Specification BaseFn (Either Int Int)
monitorExample = forall a (fn :: Univ) p.
(IsPred p fn, HasSpec fn a) =>
(Term fn a -> p) -> Specification fn a
constrained forall a b. (a -> b) -> a -> b
$ \Term BaseFn (Either Int Int)
e ->
forall (fn :: Univ) a.
(HasSpec fn a, HasSpec fn (SimpleRep a), HasSimpleRep a,
TypeSpec fn a ~ TypeSpec fn (SimpleRep a),
SimpleRep a ~ SumOver (Cases (SimpleRep a)),
TypeList (Cases (SimpleRep a))) =>
Term fn a
-> FunTy
(MapList (Weighted (Binder fn)) (Cases (SimpleRep a))) (Pred fn)
caseOn
Term BaseFn (Either Int Int)
e
(forall (fn :: Univ) p a.
(HasSpec fn a, All (HasSpec fn) (Args a), IsPred p fn, IsProd a) =>
Int
-> FunTy (MapList (Term fn) (Args a)) p -> Weighted (Binder fn) a
branchW Int
1 forall a b. (a -> b) -> a -> b
$ \Term
(Fix
(Oneof
(Oneof
(Oneof MapFn (Oneof PairFn ListFn))
(Oneof FunFn (Oneof SetFn OrdFn)))
(Oneof
(Oneof SumFn (Oneof BoolFn GenericsFn))
(Oneof SizeFn (Oneof EqFn IntFn)))))
Int
_ -> forall (fn :: Univ).
((forall a. Term fn a -> a) -> Property -> Property) -> Pred fn
monitor forall a b. (a -> b) -> a -> b
$ \forall b.
Term
(Fix
(Oneof
(Oneof
(Oneof MapFn (Oneof PairFn ListFn))
(Oneof FunFn (Oneof SetFn OrdFn)))
(Oneof
(Oneof SumFn (Oneof BoolFn GenericsFn))
(Oneof SizeFn (Oneof EqFn IntFn)))))
b
-> b
_ -> forall prop. Testable prop => String -> prop -> Property
label String
"Left")
(forall (fn :: Univ) p a.
(HasSpec fn a, All (HasSpec fn) (Args a), IsPred p fn, IsProd a) =>
Int
-> FunTy (MapList (Term fn) (Args a)) p -> Weighted (Binder fn) a
branchW Int
2 forall a b. (a -> b) -> a -> b
$ \Term
(Fix
(Oneof
(Oneof
(Oneof MapFn (Oneof PairFn ListFn))
(Oneof FunFn (Oneof SetFn OrdFn)))
(Oneof
(Oneof SumFn (Oneof BoolFn GenericsFn))
(Oneof SizeFn (Oneof EqFn IntFn)))))
Int
_ -> forall (fn :: Univ).
((forall a. Term fn a -> a) -> Property -> Property) -> Pred fn
monitor forall a b. (a -> b) -> a -> b
$ \forall b.
Term
(Fix
(Oneof
(Oneof
(Oneof MapFn (Oneof PairFn ListFn))
(Oneof FunFn (Oneof SetFn OrdFn)))
(Oneof
(Oneof SumFn (Oneof BoolFn GenericsFn))
(Oneof SizeFn (Oneof EqFn IntFn)))))
b
-> b
_ -> forall prop. Testable prop => String -> prop -> Property
label String
"Right")
prop_monitoring :: Property
prop_monitoring :: Property
prop_monitoring = forall (fn :: Univ) a p.
(HasSpec fn a, Testable p) =>
Specification fn a -> (a -> p) -> Property
forAllSpec Specification BaseFn (Either Int Int)
monitorExample forall a b. (a -> b) -> a -> b
$ \Either Int Int
_ -> Bool
True
chooseSpecExample :: Specification BaseFn Int
chooseSpecExample :: Specification BaseFn Int
chooseSpecExample =
forall (fn :: Univ) a.
HasSpec fn a =>
(Int, Specification fn a)
-> (Int, Specification fn a) -> Specification fn a
chooseSpec
(Int
1, forall a (fn :: Univ) p.
(IsPred p fn, HasSpec fn a) =>
(Term fn a -> p) -> Specification fn a
constrained forall a b. (a -> b) -> a -> b
$ \Term
(Fix
(Oneof
(Oneof
(Oneof MapFn (Oneof PairFn ListFn))
(Oneof FunFn (Oneof SetFn OrdFn)))
(Oneof
(Oneof SumFn (Oneof BoolFn GenericsFn))
(Oneof SizeFn (Oneof EqFn IntFn)))))
Int
i -> Term
(Fix
(Oneof
(Oneof
(Oneof MapFn (Oneof PairFn ListFn))
(Oneof FunFn (Oneof SetFn OrdFn)))
(Oneof
(Oneof SumFn (Oneof BoolFn GenericsFn))
(Oneof SizeFn (Oneof EqFn IntFn)))))
Int
i forall a (fn :: Univ).
(Ord a, OrdLike fn a) =>
Term fn a -> Term fn a -> Term fn Bool
<. Term
(Fix
(Oneof
(Oneof
(Oneof MapFn (Oneof PairFn ListFn))
(Oneof FunFn (Oneof SetFn OrdFn)))
(Oneof
(Oneof SumFn (Oneof BoolFn GenericsFn))
(Oneof SizeFn (Oneof EqFn IntFn)))))
Int
0)
(Int
2, forall a (fn :: Univ) p.
(IsPred p fn, HasSpec fn a) =>
(Term fn a -> p) -> Specification fn a
constrained forall a b. (a -> b) -> a -> b
$ \Term
(Fix
(Oneof
(Oneof
(Oneof MapFn (Oneof PairFn ListFn))
(Oneof FunFn (Oneof SetFn OrdFn)))
(Oneof
(Oneof SumFn (Oneof BoolFn GenericsFn))
(Oneof SizeFn (Oneof EqFn IntFn)))))
Int
i -> Term
(Fix
(Oneof
(Oneof
(Oneof MapFn (Oneof PairFn ListFn))
(Oneof FunFn (Oneof SetFn OrdFn)))
(Oneof
(Oneof SumFn (Oneof BoolFn GenericsFn))
(Oneof SizeFn (Oneof EqFn IntFn)))))
Int
0 forall a (fn :: Univ).
(Ord a, OrdLike fn a) =>
Term fn a -> Term fn a -> Term fn Bool
<. Term
(Fix
(Oneof
(Oneof
(Oneof MapFn (Oneof PairFn ListFn))
(Oneof FunFn (Oneof SetFn OrdFn)))
(Oneof
(Oneof SumFn (Oneof BoolFn GenericsFn))
(Oneof SizeFn (Oneof EqFn IntFn)))))
Int
i)
prop_chooseSpec :: Property
prop_chooseSpec :: Property
prop_chooseSpec = forall (fn :: Univ) a p.
(HasSpec fn a, Testable p) =>
Specification fn a -> (a -> p) -> Property
forAllSpec Specification BaseFn Int
chooseSpecExample forall a b. (a -> b) -> a -> b
$ \Int
i ->
forall prop. Testable prop => String -> prop -> Property
label (forall a. Show a => a -> String
show forall a b. (a -> b) -> a -> b
$ forall a. Num a => a -> a
signum Int
i) Bool
True