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

cbn reduces in the context of the goal's evars #11083

Open
cpitclaudel opened this issue Nov 8, 2019 · 2 comments
Open

cbn reduces in the context of the goal's evars #11083

cpitclaudel opened this issue Nov 8, 2019 · 2 comments
Labels
needs: triage The validity of this issue needs to be checked, or the issue itself updated.

Comments

@cpitclaudel
Copy link
Contributor

Description of the problem

The following program does not terminate (it allocates until it crashes):

Goal (0 = 0).
  pose (Nat.pow 2 30).
  etransitivity.
  clear.
  cbn.

This is because cbn reduces the context of the evars that appear in the goal in addition to the goal itself:

Set Printing Existential Instances.
Goal (0 = 0).
  pose (Nat.pow 2 5).
  etransitivity.
(*  n := Nat.pow 2 5 : nat
    ============================
    0 = ?y@{n:=n} *)
  cbn.
(*  n := Nat.pow 2 5 : nat
    ============================
    0 = ?y@{n:=32} *)
  Show Existentials.

Is that on purpose? (simpl doesn't do that) Don't we expect users to run instantiate (1 := ltac:(cbn in * )). for that instead?

I came across this while porting some code from 8.4 to 8.9; I changed some simpls to cbns and everything blew up.

Coq Version

8.9.1.

@Alizter Alizter added kind: bug An error, flaw, fault or unintended behaviour. needs: triage The validity of this issue needs to be checked, or the issue itself updated. labels Sep 29, 2021
@SkySkimmer
Copy link
Contributor

Relevant code:

coq/tactics/cbn.ml

Lines 833 to 835 in f81225b

let rec strongrec env t =
map_constr_with_full_binders env sigma
push_rel_check_zeta strongrec env (whd_cbn flags env sigma t) in

@SkySkimmer
Copy link
Contributor

Maybe we could reduce evar arguments with delta of the proof context off? Or maybe it would be enough to reduce only the non-identity parts of the instance?

Don't we expect users to run instantiate (1 := ltac:(cbn in * )). for that instead?

I don't ever expect anyone to use instantiate.

@SkySkimmer SkySkimmer removed the kind: bug An error, flaw, fault or unintended behaviour. label May 2, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
needs: triage The validity of this issue needs to be checked, or the issue itself updated.
Projects
None yet
Development

Successfully merging a pull request may close this issue.

3 participants