Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Spurious warning on mutually recursive functions #3220

Open
nikswamy opened this issue Mar 3, 2024 · 1 comment
Open

Spurious warning on mutually recursive functions #3220

nikswamy opened this issue Mar 3, 2024 · 1 comment

Comments

@nikswamy
Copy link
Collaborator

nikswamy commented Mar 3, 2024

  type value = bool

  let rec array_cmp (l1:list value) (l2:list value) : bool =
    match l1, l2 with
     | hd1::tl1, hd2::tl2  ->   array_cmp tl1 tl2
     | _ -> false

  and cmp (v1:value) (v2:value) : bool =
    false

Produces

(Warning 290) - SMT may not be able to prove the types of l1 at <input>(10,21-10,23)
    (Prims.list Value.value) and v1 at <input>(15,11-15,13) (Value.value) to be
    equal, if the proof fails, try annotating these with the same type
  - See also <input>(10,21-10,23)

I think I've noticed this before from inferred decreases clauses, but this warning remains even if you add explicit decreases annotations.

Thanks to @anakrish

@anakrish
Copy link

anakrish commented Mar 3, 2024

With

$ fstar.exe -v
F* 2024.01.13~dev
platform=Darwin_arm64
compiler=OCaml 4.14.1
date=2024-02-26 06:11:44 -0800
commit=a48722f90e14be69b850f093b41fbbdfee7f6eb9

the warnings go away if decreases clauses are added thus:

module Foo

  type value = bool

  let rec array_cmp (l1:list value) (l2:list value) : Tot bool (decreases l1)=
    match l1, l2 with
     | hd1::tl1, hd2::tl2  ->   array_cmp tl1 tl2
     | _ -> false

  and cmp (v1:value) (v2:value) : Tot bool (decreases v1)=
    false

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants