Hi, how do I get a fix
to reduce? Compare
Eval cbv in ((fun (_ : bool) => false) _).
Eval cbv in ((fix f (_ : bool) := false) _).
I have also tried using Eval cbv fix beta
, hoping it would reduce according to fix- and beta-reduction as described in https://coq.inria.fr/refman/language/core/conversion.html#term-beta-reduction. I'd be very happy to know what I am doing wrong, thanks!
fix only reduces when the argument in {struct}
reduces to a constructor
Thanks, why is that? The manual only mentions:
fix-reduction: replaces a fix with a beta-redex; recursive calls to the symbol are replaced with the fix term
Unfolding fix without restriction would lose the guarantee that simplification terminates.
That surprises me, how can there be termination issues when the argument to a fix
does not reduce into a constructor? Isn't the fact that that the fixpoint is defined with structural recursion restrictive enough?
Not really
Just expand the body multiple times to see the problem
Hm, you’d need an actually recursive function…
consider Eval cbv in (fix id n := match n with 0 => 0 | S k => id k end) _
if you reduce you get match _ with 0 => 0 | S k => (fix id n := match n with 0 => 0 | S k => id k end) k end
, but you would still want to reduce the new fix application, etc, etc
good example :-)
(I called that id
but it's not really the identity as I decided not to write S (id k)
while I was writing the thing)
but S (id k)
would work the same way, right?
y
Thanks, that makes sense
Last updated: Oct 01 2023 at 18:01 UTC