playground/coq/unfinished/pigeonhole.v

62 lines
1.1 KiB
Coq

Require Import List.
Import ListNotations.
Search (_ -> list _ -> bool).
(*
forallb: forall [A : Type], (A -> bool) -> list A -> bool
existsb: forall [A : Type], (A -> bool) -> list A -> bool
*)
Search (list _ -> _ -> bool).
Search (nat -> nat -> bool).
Compute negb (Nat.ltb 1 0).
Compute existsb (fun x:nat => negb (Nat.leb x 1)) [0;1;0].
Check ~True.
Compute in_nil.
Search (In _ []).
Check in_nil.
Check @in_nil nat 3.
Check not (not (2<3)).
Check (@in_nil nat 3).
(*
in_nil (a:=3)
: ~ In 3 []
*)
Print In.
Check In%list.
Check in_nil%list.
Require Import Lia.
Theorem ph : forall l:list nat,
list_sum l > length l -> exists x:nat, x > 1 -> In x l.
Proof.
intros.
induction l.
- simpl in H.
simpl.
lia.
-
Theorem ph: forall ls:list nat,
list_sum ls > length ls
-> exists x:nat,
x > 1
-> In x ls.
Proof.
intros.
induction ls.
- discriminate H.
intros.
induction ls.
- exists 5.
intros H1.
Search (In _ []).
(* in_nil: forall [A : Type] [a : A], ~ In a [] *)
apply (in_nil).
rewrite <- (not in_nil).