Require Import Arith. Require Import List. Open Scope list_scope. Check 3. Check nat. Check Set. Check Type. Theorem map_length: forall (A B:Type) (f: A -> B) (l:list A), length (map f l) = length l. Proof. intros. induction l. reflexivity. simpl. rewrite IHl. reflexivity. Qed. Check map_length. Compute (map_length bool). Compute (map_length bool nat). Compute (map_length bool nat (fun _ => 3)). Definition foo := map_length bool nat. Check foo. (* Theorem map_length2: forall (A B:Type) (f: A -> B) (l:list A) (n:nat), length (map f l) = n -> length l = n. Proof. intros. revert n H. induction l. admit. admit. Qed. *) Inductive sorted : list nat -> Prop := | SortNil: sorted nil | SortUnit (x:nat): sorted (x::nil) | SortCons (x y:nat) (t:list nat) (LE: (x <=? y) = true) (S: sorted (y::t)): sorted (x::y::t). Theorem sorted123: sorted (1::2::3::nil). Proof. apply SortCons. reflexivity. apply SortCons. reflexivity. apply SortUnit. Qed. Theorem context_examples: forall (A B C D E F: Prop), A -> B -> C -> D -> E -> F -> A. Proof. intro P. intros Q R. intros until E. intros F H1 H2. intros. revert H. revert F H4. rename E into HELLO. intros. clear Q R D HELLO H2 H0 H3 F H4 H. assert (H: 1+1=2). reflexivity. assert (S := sorted123). assumption. Qed. Theorem apply_example: forall (A B C:Prop), (A -> B) -> (B -> C) -> A -> C. Proof. intros. apply H0. apply H. assumption. (* apply H in H1. apply H0 in H1. assumption. *) Qed.