+theorem exists_forall_le:\forall f,n.
+(\exists i. i \le n \land f i = true) \lor
+(\forall i. i \le n \to f i = false).
+intros.
+elim n
+ [apply (bool_elim ? (f O));intro
+ [left.apply (ex_intro ? ? O).
+ split[apply le_n|assumption]
+ |right.intros.
+ apply (le_n_O_elim ? H1).
+ assumption
+ ]
+ |elim H
+ [elim H1.elim H2.
+ left.apply (ex_intro ? ? a).
+ split[apply le_S.assumption|assumption]
+ |apply (bool_elim ? (f (S n1)));intro
+ [left.apply (ex_intro ? ? (S n1)).
+ split[apply le_n|assumption]
+ |right.intros.
+ elim (le_to_or_lt_eq ? ? H3)
+ [apply H1.
+ apply le_S_S_to_le.
+ apply H4
+ |rewrite > H4.
+ assumption
+ ]
+ ]
+ ]
+ ]
+qed.
+
+theorem exists_max_forall_false:\forall f,n.
+((\exists i. i \le n \land f i = true) \land (f (max n f) = true))\lor
+((\forall i. i \le n \to f i = false) \land (max n f) = O).
+intros.
+elim (exists_forall_le f n)
+ [left.split
+ [assumption
+ |apply f_max_true.assumption
+ ]
+ |right.split
+ [assumption
+ |apply max_O.assumption
+ ]
+ ]
+qed.
+
+theorem false_to_lt_max: \forall f,n,m.O < n \to
+f n = false \to max m f \le n \to max m f < n.
+intros.
+elim (le_to_or_lt_eq ? ? H2)
+ [assumption
+ |elim (exists_max_forall_false f m)
+ [elim H4.
+ apply False_ind.
+ apply not_eq_true_false.
+ rewrite < H6.
+ rewrite > H3.
+ assumption
+ |elim H4.
+ rewrite > H6.
+ assumption
+ ]
+ ]
+qed.
+