I was trying to unfold a Fixpoint
definition and obtain the body of the definition. But Coq wouldn't give the body of the definition literally. Instead, it's giving me something starting with (fix ...)
, which I cannot make use of.
For example, in proving the following from Coq.Init.Wf
Lemma Fix_F_eq :
forall (x:A) (r:Acc x),
F x (fun (y:A) (p:R y x) => Fix_F y (Acc_inv x r y p)) = Fix_F x r.
Proof. intros.
The state is:
...
______________________________________(1/1)
F x
(fun (y : A) (p : R y x) =>
Fix_F y (Acc_inv x r y p)) =
Fix_F x r
Now, Fix_F
on the RHS was defined exactly the same as the LHS:
Fixpoint Fix_F (x:A) (r:Acc x) {struct r} : P x :=
F x (fun (y:A) (p:R y x) => Fix_F y (Acc_inv x r y p)).
I tried to make it a trivial
equality by:
unfold Fix_F at 2.
Yet, I got something like (fix Fix_F ... )
on the RHS, and I can't proceed along this line any further:
______________________________________(1/1)
F x
(fun (y : A) (p : R y x) =>
Fix_F y (Acc_inv x r y p)) =
(fix
Fix_F (x0 : A) (r0 : Acc x0) {struct r0} :
P x0 :=
F x0
(fun (y : A) (p : R y x0) =>
Fix_F y (Acc_inv x0 r0 y p))) x r
The question is:
Is there a way to unfold the above Fixpoint
to its function body to the letter?
Note: I know there is a workaround to prove this example.
Proof. intros. destruct r. simpl. trivial.
Defined.
But I am more interested in the unfold
-ing approach if it is valid.