Re: [isabelle] Overlapping patterns in code export
Indeed, it would be great if the sequential option in the function package produces less
redundant rules than it is doing now. In particular, as all those redundant cases show up
in the induction rule for the function, so if one uses this induction rule, one has to
prove a lot of redundant subgoals, too :-).
If you have some time, feel free to look into the code. The pattern splitting is done in
On 22/02/17 14:10, Sebastiaan Joosten wrote:
thank you for your response!
it surprised me that Haskell's overlapping patterns warning had not hit me earlier. If the function package can be simplified such that it creates *more* overlapping rules, I may not have been as surprised, and I would be all for it.
The function package is also well-advised to generate overlapping simp rules. Perfect minimisation is NP complete (Alex Krauss has a paper on that), so function definitions would take much longer.
I don't agree with this reasoning: eagerly removing an overlapped simp rule is something else than perfect minimisation. The function package might annotate which simp rules are overlapped by all the earlier ones, such that the code generator only produces code for those that are non-overlapped. Alternatively, the function package might generate a code lemma that uses in-order if-then-else, also to avoid unnecessary blowup in code size, as illustrated by the following:
fun foo where
"foo [x]      = True"
|"foo  [x]     = True"
|"foo   [x]    = True"
|"foo    [x]   = True"
|"foo     [x]  = True"
|"foo      [x] = True"
|"foo _ _ _ _ _ _ = False"
In any case, I suppose I should just suppress code-overlap warnings in Haskell for now.
This archive was generated by a fusion of
Pipermail (Mailman edition) and