Re: [isabelle] Overlapping patterns in code export

Hi Andreas,

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 MHonArc.