Skip to content

Instantly share code, notes, and snippets.

@mukeshtiwari
Created September 2, 2016 05:25
Show Gist options
  • Save mukeshtiwari/5a1ecc113c5fb655c11dc3cb1a9f26fd to your computer and use it in GitHub Desktop.
Save mukeshtiwari/5a1ecc113c5fb655c11dc3cb1a9f26fd to your computer and use it in GitHub Desktop.
Lemma length_pair : forall {A : Type} (n : nat) (l : list A),
length l <= n -> length (all_pairs l) <= n * n.
Proof.
intros A n l. generalize dependent n. induction l.
intros n H. auto with arith.
intros n H. destruct n.
inversion H.
simpl. simpl in H.
repeat rewrite app_length. repeat rewrite map_length.
Open Scope nat_scope.
apply le_n_S. apply le_S_n in H.
SearchAbout ( _ + _ <= _).
A : Type
a : A
l : list A
IHl : forall n : nat, length l <= n -> length (all_pairs l) <= n * n
n : nat
H : length l <= n
============================
length (all_pairs l) + (length l + length l) <= n + n * S n
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment