I have the datatype definition
datatype 'a maybe = Nothing | Just 'a
and when I ask for its case rule:
thm maybe.case
I get
(case Nothing of Nothing ⇒ ?f1.0 | Just x ⇒ ?f2.0 x) = ?f1.0
(case Just ?x2.0 of Nothing ⇒ ?f1.0 | Just x ⇒ ?f2.0 x) = ?f2.0 ?x2.0
and when I try to use it as a case rule:
proof (cases a rule: maybe.case)
I get the error message
Single rule expected
How can I do a case distinction proof for this datatype?
IIrc the rule is (somewhat confusingly) called maybe.exhaust
. The cases
method should be able to figure out the correct rule without you providing a rule as well (proof (cases a)
).
(Also if your datatype is not just an example, consider using theoption
type from the library)
Let me add that the rule called maybe.cases
is actually a split rule, which you can use for the split:
parameter of the simplifier.
Last updated: Dec 30 2024 at 16:22 UTC