coq-club AT inria.fr
Subject: The Coq mailing list
List archive
- From: Dominique Larchey-Wendling <dominique.larchey-wendling AT loria.fr>
- To: coq-club AT inria.fr
- Subject: Re: [Coq-Club] proof with nat_ind
- Date: Thu, 03 Dec 2015 11:18:25 +0100
- Organization: LORIA
On 12/02/2015 06:37 PM, Patricia Peratto wrote:
> I want to prove (using nat_ind) the following proposition.
> I adjoin the proof I have written myself.
>
> Definition aux1b (n:nat) : forall m:nat,
> forall (e:n=m),S n = S m.
aux1b is an instance of a much more general result
which derives from the inductive definition of
(Leibniz) equality "=". "=" is itself a notation for
eq : forall X : Type, X -> X -> Prop)
Fact f__equal X Y (f : X -> Y) (n m : X) : n = m -> f n = f m.
Proof.
induction 1; reflexivity.
Qed.
or using eq_ind directly
Fact f__equal X Y (f : X -> Y) (n m : X) : n = m -> f n = f m.
Proof.
apply eq_ind with (P := fun y => f n = f y).
reflexivity.
Qed.
or by pattern matching (which is how eq_ind/eq_rect are defined)
Definition f__equal X Y (f : X -> Y) (n m : X) (H : n = m) : f n = f m :=
match H with
eq_refl => @eq_refl _ (f n)
end.
Regards,
Dominique
- [Coq-Club] proof with nat_ind, Patricia Peratto, 12/02/2015
- Re: [Coq-Club] proof with nat_ind, Jonathan Leivent, 12/02/2015
- Re: [Coq-Club] proof with nat_ind, Pierre Casteran, 12/02/2015
- Re: [Coq-Club] proof with nat_ind, James Wilcox, 12/02/2015
- Re: [Coq-Club] proof with nat_ind, Emilio Jesús Gallego Arias, 12/02/2015
- Re: [Coq-Club] proof with nat_ind, Dominique Larchey-Wendling, 12/03/2015
Archive powered by MHonArc 2.6.18.