简体   繁体   中英

Proof of application equality in coq

I have a sequence of applications in that way (f (f (fx))), being f an arbitrary function and any applications numbers sequences. I want to prove that f (xy) and (x (fy)), x = (fff ...) and y = any value, it's equal. I need that proof in the code below:

Fixpoint r_nat {A : Type} (a : nat) : A -> (A -> A) -> A :=
  match a with
    |S n => fun (x0 : A) (a0 : A -> A) => r_nat n (a0 x0) a0
    |0 => fun (x0 : A) (_ : A -> A) => x0
  end. 


Theorem homomo_nat : forall {T} (f : T -> T) (h : T) (x : nat), (r_nat x (f h) f) = f ((r_nat x) h f) .
compute.
??.
Qed. 

I try unfolding and refining but doesn't work.

这应该可以通过对x的感应( f的施加次数)来解决。

I moved the argument (x:nat) before (h:T) . That makes the induction hypothesis stronger - it holds for all h . Then the proof is simply:

Theorem homomo_nat : forall {T} (f : T -> T) (x:nat) (h : T), (r_nat x (f h) f) = f ((r_nat x) h f) .
Proof.
  induction x.
  reflexivity.
  intros. apply IHx.
Qed.

You can also "move the arguments around" with tactics to keep your original theorem if you prefer that... Start with intros; generalize dependent h. intros; generalize dependent h.

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM