Skip to content

Multiple let ... and ... clauses allowed for same function, but output doesn't work in OCaml/Coq #2

@bacam

Description

@bacam

The following function definition (from Sail) typechecks and produces useful output for Isabelle/HOL and HOL4, but not OCaml or Coq:

val foreach : forall 'a 'vars.
  (list 'a) -> 'vars -> ('a -> 'vars -> 'vars) -> 'vars
let rec foreach [] vars _ = vars
and foreach (x :: xs) vars body = foreach xs (body x vars) body

The resulting code for OCaml and Coq has the same structure, which they don't allow (the clauses have to define different functions), whereas the HOLs get the obvious equations. I'm not sure if we ought to reject this in typechecking or translate it into a supported pattern match.

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions