Skip to content

Instantly share code, notes, and snippets.

@KeenS
Created April 26, 2014 16:32
Show Gist options
  • Save KeenS/11324597 to your computer and use it in GitHub Desktop.
Save KeenS/11324597 to your computer and use it in GitHub Desktop.
Require Import Arith.
Fixpoint sum_odd(n:nat) : nat :=
match n with
| 0 => 0
| S m => 1 + m + m + sum_odd m
end.
Goal forall n, sum_odd n = n * n.
Proof.
intros.
induction n.
simpl.
ring.
simpl.
rewrite <- (eq_S (n + n + sum_odd n) (n + n * S n)).
ring.
rewrite IHn.
ring.
Qed.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment