Navigation Menu

Skip to content

Instantly share code, notes, and snippets.

@lyricallogical
Forked from erutuf/daigakusei.v
Created February 26, 2012 04:40
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save lyricallogical/1913046 to your computer and use it in GitHub Desktop.
Save lyricallogical/1913046 to your computer and use it in GitHub Desktop.
ボクには ; 使ったのは気持ちはなんとなくわかるけど imihu だったので一つずつ証明した。
Inductive even : nat -> Prop :=
| even_O : even 0
| even_S : forall n, odd n -> even (S n)
with odd : nat -> Prop :=
| odd_S : forall n, even n -> odd (S n).
Scheme even_mut := Induction for even Sort Prop
with odd_mut := Induction for odd Sort Prop.
Theorem daigakuseinosuugakuryoku : forall n m,
even n -> odd m -> odd (m + n).
Proof.
intros n m H H0.
revert m H0.
apply odd_mut with (fun m e => even (m + n)).
simpl.
assumption.
intros.
simpl.
apply even_S.
assumption.
intros.
simpl.
apply odd_S.
assumption.
Qed.
-------------------------------------------------------
別解(こっちのほうがめんどくさいぞ!)
Require Import Arith.
Inductive even : nat -> Prop :=
| even_O : even 0
| even_S : forall n, odd n -> even (S n)
with odd : nat -> Prop :=
| odd_S : forall n, even n -> odd (S n).
Scheme even_mut := Induction for even Sort Prop
with odd_mut := Induction for odd Sort Prop.
Theorem daigakuseinosuugakuryoku : forall n m,
even n -> odd m -> odd (m + n).
Proof.
intros n m H H0.
revert n H.
apply even_mut with (fun n e => even (m + n)).
rewrite plus_comm.
simpl.
assumption.
intros.
rewrite <- plus_Snm_nSm.
simpl.
apply odd_S.
assumption.
intros.
rewrite <- plus_Snm_nSm.
simpl.
apply even_S.
assumption.
Qed.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment