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
Comments
Comment author: @siegebell Depending on whether a variable is provided with a definition or given as a section variable, the results of 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. |
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. |
We mostly reuse the code existing to refold fixpoints.
We mostly reuse the code existing to refold fixpoints.
We mostly reuse the code existing to refold fixpoints.
We mostly reuse the code existing to refold fixpoints.
We mostly reuse the code existing to refold fixpoints.
Proper fix in #18576. |
We mostly reuse the code existing to refold fixpoints.
We mostly reuse the code existing to refold fixpoints.
We mostly reuse the code existing to refold fixpoints.
For the record, note that 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)))
*) |
This was mentioned e.g. in coq#4056.
This was mentioned e.g. in coq#4056.
This was mentioned e.g. in coq#4056.
We mostly reuse the code existing to refold fixpoints.
We mostly reuse the code existing to refold fixpoints.
We mostly reuse the code existing to refold fixpoints.
This was mentioned e.g. in coq#4056.
Note: the issue was created automatically with bugzilla2github tool
Original bug ID: BZ#4056
From: @siegebell
Reported version: 8.5
CC: @ppedrot
The text was updated successfully, but these errors were encountered: