Skip to content

Instantly share code, notes, and snippets.

@mukeshtiwari
Created August 23, 2016 08:09
Show Gist options
  • Save mukeshtiwari/980108d54f1bfffb38b55b1424887c07 to your computer and use it in GitHub Desktop.
Save mukeshtiwari/980108d54f1bfffb38b55b1424887c07 to your computer and use it in GitHub Desktop.
Theorem iter_aux_new {A: Type} (O: (A -> bool) -> (A -> bool)) (l: list A):
mon O ->
(forall a: A, In a l) ->
forall (n : nat), (forall a:A, iter O n nil_pred a = true <-> iter O (n+1) nil_pred a = true) \/
card l (iter O n nil_pred) >= n.
Proof.
intros Hmon Hfin n. specialize (iter_aux O l Hmon Hfin n); intros.
destruct H as [H | H]. left. assumption.
right. unfold mon in Hmon. unfold card in H; unfold card.
generalize dependent n.
and goal is
A : Type
O : (A -> bool) -> A -> bool
l : list A
Hmon : forall p1 p2 : A -> bool, pred_subset p1 p2 -> pred_subset (O p1) (O p2)
Hfin : forall a : A, In a l
============================
forall n : nat,
length (filter (iter O (n + 1) nil_pred) l) >= length (filter (iter O n nil_pred) l) + 1 ->
length (filter (iter O n nil_pred) l) >= n
@mukeshtiwari
Copy link
Author

@mukeshtiwari
Copy link
Author

Theorem iter_aux_new {A: Type} (O: (A -> bool) -> (A -> bool)) (l: list A):
mon O ->
(forall a: A, In a l) ->
forall (n : nat), (forall a:A, iter O n nil_pred a = true <-> iter O (n+1) nil_pred a = true) /
card l (iter O n nil_pred) >= n.
Proof.
intros Hmon Hfin n. specialize (iter_aux O l Hmon Hfin n); intros.
destruct H as [H | H]. left. assumption.
right. unfold mon in Hmon. unfold card in H; unfold card.
(* specialize (increasing O Hmon); intros Hinc.
unfold pred_subset in Hinc. *)
generalize dependent n. induction n.
intros. omega.
intros.

Goal is

A : Type
O : (A -> bool) -> A -> bool
l : list A
Hmon : forall p1 p2 : A -> bool, pred_subset p1 p2 -> pred_subset (O p1) (O p2)
Hfin : forall a : A, In a l
n : nat
IHn : length (filter (iter O (n + 1) nil_pred) l) >= length (filter (iter O n nil_pred) l) + 1 ->
length (filter (iter O n nil_pred) l) >= n
H : length (filter (iter O (S n + 1) nil_pred) l) >=
length (filter (iter O (S n) nil_pred) l) + 1

length (filter (iter O (S n) nil_pred) l) >= S n

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment