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

inconsistent results with simpl, cofix, and section variables #4056

Closed
coqbot opened this issue Feb 17, 2015 · 4 comments · Fixed by #18576
Closed

inconsistent results with simpl, cofix, and section variables #4056

coqbot opened this issue Feb 17, 2015 · 4 comments · Fixed by #18576
Labels
part: tactics resolved: won't fix There are no plans to fix this.

Comments

@coqbot
Copy link
Contributor

coqbot commented Feb 17, 2015

Note: the issue was created automatically with bugzilla2github tool

Original bug ID: BZ#4056
From: @siegebell
Reported version: 8.5
CC: @ppedrot

@coqbot
Copy link
Contributor Author

coqbot commented Feb 17, 2015

Comment author: @siegebell

Depending on whether a variable is provided with a definition or given as a section variable, the results of simpl on a cofix can differ. This happens with both 8.4 and trunk. However, cbn gives consistent results.

CoInductive stream {A:Type} : Type :=
  | scons: A->stream->stream.

Definition stream_unfold {A} (s: @ stream A) := match s with
| scons a s' => (a, scons a s')
end.


Section A.
  CoFixpoint inf_stream1 (x:nat) (n:nat) :=
    scons n (inf_stream1 x (n+x)).
End A.

Section B.
  Variable (x:nat).
  CoFixpoint inf_stream2 (n:nat) :=
    scons n (inf_stream2 (n+x)).
End B.


Goal (forall x n, stream_unfold (inf_stream1 x n) = stream_unfold (inf_stream2 2 n)).
(* simpl exposes the cofix on the rhs but not the lhs *)
simpl.
(* ... inf_stream1 x (n + x))... = ...(cofix inf_stream2 n0 := ...) ... *)
Abort.

@coqbot
Copy link
Contributor Author

coqbot commented Feb 21, 2015

Comment author: @ppedrot

I think that the one sensible answer is: use cbn. The current simpl tactic is going to be deprecated some day anyway.

@coqbot coqbot closed this as completed Feb 21, 2015
@coqbot coqbot added part: tactics resolved: won't fix There are no plans to fix this. labels Oct 18, 2017
herbelin added a commit to herbelin/github-coq that referenced this issue Jan 27, 2024
We mostly reuse the code existing to refold fixpoints.
herbelin added a commit to herbelin/github-coq that referenced this issue Jan 28, 2024
We mostly reuse the code existing to refold fixpoints.
herbelin added a commit to herbelin/github-coq that referenced this issue Jan 28, 2024
We mostly reuse the code existing to refold fixpoints.
herbelin added a commit to herbelin/github-coq that referenced this issue Jan 28, 2024
We mostly reuse the code existing to refold fixpoints.
herbelin added a commit to herbelin/github-coq that referenced this issue Jan 28, 2024
We mostly reuse the code existing to refold fixpoints.
@herbelin
Copy link
Member

Proper fix in #18576.

herbelin added a commit to herbelin/github-coq that referenced this issue Jan 29, 2024
We mostly reuse the code existing to refold fixpoints.
herbelin added a commit to herbelin/github-coq that referenced this issue Jan 29, 2024
We mostly reuse the code existing to refold fixpoints.
herbelin added a commit to herbelin/github-coq that referenced this issue Jan 30, 2024
We mostly reuse the code existing to refold fixpoints.
@herbelin
Copy link
Member

For the record, note that cbn does not (yet) refold mutual fixpoints defined with section variables while simpl does in #18576.

CoInductive stream {A:Type} : Type :=
  | scons: A->stream->stream.
Definition stream_unfold {A} (s: @ stream A) := match s with
| scons a s' => (a, scons a s')
end.

Section C.
Variable (x:nat).
 CoFixpoint mut_stream1 (n:nat) := scons n (mut_stream2 (n+x))
 with mut_stream2 (n:nat) :=  scons n (mut_stream1  (n+x)).
End C.

Goal (forall x n, stream_unfold (mut_stream1 x n) = stream_unfold (mut_stream2 x n)).
intros. cbn.
(*
(n,
 scons n
   ((cofix mut_stream1 (n0 : nat) : stream :=
       scons n0 (mut_stream2 (n0 + x))
     with mut_stream2 (n0 : nat) : stream :=
       scons n0 (mut_stream1 (n0 + x))
     for
     mut_stream2) (n + x))) =
(n,
 scons n
   ((cofix mut_stream1 (n0 : nat) : stream :=
       scons n0 (mut_stream2 (n0 + x))
     with mut_stream2 (n0 : nat) : stream :=
       scons n0 (mut_stream1 (n0 + x))
     for
     mut_stream1) (n + x)))
*)

herbelin added a commit to herbelin/github-coq that referenced this issue Feb 1, 2024
herbelin added a commit to herbelin/github-coq that referenced this issue Feb 1, 2024
herbelin added a commit to herbelin/github-coq that referenced this issue Feb 1, 2024
herbelin added a commit to herbelin/github-coq that referenced this issue Feb 1, 2024
We mostly reuse the code existing to refold fixpoints.
herbelin added a commit to herbelin/github-coq that referenced this issue Feb 4, 2024
We mostly reuse the code existing to refold fixpoints.
louiseddp pushed a commit to louiseddp/coq that referenced this issue Feb 27, 2024
We mostly reuse the code existing to refold fixpoints.
louiseddp pushed a commit to louiseddp/coq that referenced this issue Feb 27, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
part: tactics resolved: won't fix There are no plans to fix this.
Projects
None yet
2 participants