Require Import NArith. Print N. Print positive. Theorem and_example: forall (A B: Prop), A /\ B -> B /\ A. Proof. intros. destruct H. split. assumption. assumption. Qed. Print "/\". Theorem or_example: forall (A B: Prop), A \/ B -> B \/ A. Proof. intros. destruct H. right. assumption. left. assumption. Qed. Print "\/". Theorem exists_example: forall (f: nat -> nat), (exists (n:nat), f(n) = 0) -> (exists (n:nat), f(n)+n = n). Proof. intros. destruct H. exists x. rewrite H. reflexivity. Qed. Locate "exists". Print ex. Theorem forall_example: forall (A:Prop), (forall (B:Prop), B -> A) -> A. Proof. intros. (* apply H with (B := True). *) specialize H with (B := True). apply H. reflexivity. Qed. Print True. Print "=". Print False. Require Import Arith. Require Import List. Fixpoint count (x:nat) (l:list nat) : nat := match l with | nil => O | h::t => if h =? x then S (count x t) else count x t end. Theorem count_swap: forall (x y z:nat) (t:list nat), count x (y::z::t) = count x (z::y::t). Proof. intros. simpl. repeat destruct (_ =? _); reflexivity. (* destruct (y =? x); (destruct (z =? x); reflexivity). *) Qed. Inductive sorted : list nat -> Prop := | SortNil: sorted nil | SortUnit (n:nat): sorted (n::nil) | SortCons (x y:nat) (t:list nat) (LE: x <= y) (H: sorted (y::t)): sorted (x::y::t). Theorem sorted_tail: forall h t, sorted (h::t) -> sorted t. Proof. intros. inversion H; subst. apply SortNil. assumption. Qed.