This (trimmed out) corecursive function definition in Isabelle
primcorec tree :: "'form fset ⇒ 'vertex ⇒ 'preform ⇒ (('form fset × 'form), ('rule × 'preform) NatRule) dtree" where
"tree Γ v p =
(case undefined of Hyp h c ⇒ undefined | Reg c ⇒
Node undefined (fimage (tree Γ v) undefined)
)"
yields
Unexpected corecursive call in "case undefined of Reg c ⇒ Node undefined (tree Γ v |`| undefined)" at
"case case undefined of Reg c ⇒ Node undefined (tree Γ v |`| undefined) of Node uu uua ⇒ uua"
but if I simplify it further to
primcorec tree :: "'form fset ⇒ 'vertex ⇒ 'preform ⇒ (('form fset × 'form), ('rule × 'preform) NatRule) dtree" where
"tree Γ v p =
(Node undefined (fimage (tree Γ v) undefined))"
it works.
I also tried to use the deconstructor view, i.e.
primcorec tree :: "'form fset ⇒ 'vertex ⇒ 'preform ⇒ (('form fset × 'form), ('rule × 'preform) NatRule) dtree" where
"cont (tree Γ v p) = (case undefined of Hyp h c ⇒ undefined | Reg c ⇒ (fimage (tree Γ v) undefined))"
And now I get a different error message: Invalid map function at "case undefined of Reg c ⇒ tree Γ v |`| undefined"
.
What might be the cause?
With other case
expressions it works, and I don’t find any mention of a restriction in the documentation (§ 5.1.1 in the datatype documentation.)
Via private communication I was told that the solution is to add the
(discs_sel)
option to thedatatype
wher theHyp
constructor comes from.