The refman says that a folded primitive projection delta reduces to an unfolded primitive projection. And I guess unfolded primitive projections are like matches, so they reduce by iota. Thus if I run
cbn delta iota
I observe that it simplifies my record projections. However if I run cbn delta; cbn iota
nothing happens. Am i to infer from this that the primitive projection being 'unfolded' does not persist if there are no further reductions?
looks like the refolding gets in the way
so I guess your interpretation is correct?
I don't really understand how refolding works though
I experimented and the same thing happens with cbv.
so you have to write cbv delta [proj] iota
to unfold a constructor.
Alright i'm lost now. I have no idea how this works.
I have a hypothesis
j := @constructor (Build_Record A B C )
I try the following:
progress(cbv delta [constructor] iota) in j
>>> Failed to progress.
progress(cbv beta) in j
>>> Failed to progress.
progress(cbv delta [constructor] beta) in j
(* Success! *)
progress(cbv delta [constructor] iota) in j
(* Success! *)
What's strange to me about this is that there is no visible change to the term given by cbv delta [constructor] beta
. It is apparently progressing but I diff'ed the two terms before and after and there's nothing. Somehow the presence of bothdelta
and beta
is making some permanent change to the fold status of the constructor?
I just don't understand what the beta
is doing exactly.
I did "Show Proof Diffs" and there was no change to the proof either
Well, maybe there was , there were a lot of (...)'s from the full proof which I don't know how to unfold.
see https://github.com/coq/coq/commit/978ae7d9323558099efb0c4e4e39549221378d5d I guess
the handling of primitive projection is not very coherent across Coq
you can Set Printing Unfolded Projection As Match.
to see when projections get unfolded
Set Primitive Projections.
Record R := mk { p : nat }.
Set Printing Unfolded Projection As Match.
Goal p (mk 0) = 0.
cbv delta beta.
(* now goal is "(let '{| p := p |} := {| p := 0 |} in p) = 0" *)
cbv iota.
also compare with how it works with non primitive projections
Record R := mk { p : nat }.
Goal p (mk 0) = 0.
cbv delta.
cbv beta.
cbv iota.
I can't find this flag in the documentation and it doesn't work for me, it just says this flag is unknown.
Is it the same as "Set Printing Primitive Projection Parameters"
Gaëtan Gilbert said:
see https://github.com/coq/coq/commit/978ae7d9323558099efb0c4e4e39549221378d5d I guess
the handling of primitive projection is not very coherent across Coq
Thank you, lol, very straightforward answer to my question I guess
Patrick Nicodemus said:
I can't find this flag in the documentation and it doesn't work for me, it just says this flag is unknown.
Is it the same as "Set Printing Primitive Projection Parameters"
It's not in a released Coq version yet
Sweet, look forward to it in 8.1x
Last updated: Oct 04 2023 at 22:01 UTC