Skip to content

Instantly share code, notes, and snippets.

@mukeshtiwari
Created September 2, 2016 02:51
Show Gist options
  • Save mukeshtiwari/55d592e3467d0c46f6de11088b75b316 to your computer and use it in GitHub Desktop.
Save mukeshtiwari/55d592e3467d0c46f6de11088b75b316 to your computer and use it in GitHub Desktop.
Definition bounded_card (A: Type) (n: nat) :=
exists l, (forall a: A, In a l) /\ length l <= n.
Lemma length_cand : forall {A : Type} n ,
Fixpoints.bounded_card A n -> Fixpoints.bounded_card (A * A) (n * n).
Proof.
intros A n. unfold Fixpoints.bounded_card.
intros [l H]. exists (all_pairs l).
destruct H as [H1 H2]. split.
intros (a1, a2). clear H2. induction l.
specialize (H1 a1). inversion H1.
simpl.
pose proof H1 a1.
destruct H as [H3 | H3].
{
pose proof H1 a2.
destruct H as [H4 | H4].
left. congruence.
right. apply in_app_iff. right.
apply in_app_iff. left.
rewrite H3. apply in_map. assumption.
}
{
pose proof H1 a2.
destruct H as [H4 | H4].
right. apply in_app_iff.
right. apply in_app_iff.
right. rewrite H4. apply in_map_iff.
exists a1. split. auto. auto.
right. apply in_app_iff. left.
A : Type
n : nat
a : A
l : list A
H1 : forall a0 : A, In a0 (a :: l)
a1, a2 : A
IHl : (forall a : A, In a l) -> In (a1, a2) (all_pairs l)
H3 : In a1 l
H4 : In a2 l
============================
In (a1, a2) (all_pairs l)
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment