Open
Description
Consider the following specification built from evenSpec
an existential, and the simple assertion that x
is greater than 10. Surely there are even numbers greater than 10. This should succeed. but it does not
ghci> debugSpec $ constrained $ \ x -> [satisfies x evenSpec, Assert $ x >. 10]
Stepping the plan:
SolverPlan
Linearization:
v_2 <-
ErrorSpec
The two Integer Specifications are inconsistent.
MemberSpec [ 10 ]
TypeSpec [11..] []
Env
somey_0 -> 5
StepPlan for variable: v_2 fails to produce Specification, probably overconstrained.PS =
Original spec ErrorSpec
The two Integer Specifications are inconsistent.
MemberSpec [ 10 ]
TypeSpec [11..] []
Predicates
The two Integer Specifications are inconsistent.
MemberSpec [ 10 ]
TypeSpec [11..] []
Here is the definition of evenSpec which is defined in cardano-ledger/libs/constrained/Examples/Fold.hs
evenSpec ::
forall n.
(TypeSpec n ~ NumSpec n, Integral n, HasSpec n, MaybeBounded n) =>
Specification n
evenSpec = ExplainSpec ["even via (x+x)"] $
constrained $ \ [var|evenx|] ->
exists
(\eval -> pure (div (eval evenx) 2))
(\ [var|somey|] -> [assert $ evenx ==. somey + somey])
The same problem also occurs in oddSpec
which is also an Existential, but fixed to Int, rather than Integral
oddSpec :: Specification Int
oddSpec = ExplainSpec ["odd via (y+y+1)"] $
constrained $ \ [var|oddx|] ->
exists
(\eval -> pure (div (eval oddx - 1) 2))
(\ [var|y|] -> [assert $ oddx ==. y + y + 1])
It would be good ti find a way to fix this.