简体   繁体   中英

Unexpected corecursive call

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, ie

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

通过私有通信,我被告知解决方案是在Hyp构造函数来自的datatype添加(discs_sel)选项。

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM