Require Import Arith. Inductive color : Type := | Red : color | Blue : color | Dark (c:color) : color | Light (c:color) : color. Definition isdark (c:color) : bool := match c with | Dark _ => true | _ => false end. Fixpoint isred (c:color) : bool := match c with | Red => true | Blue => false | Dark x => isred x | Light x => isred x end. Print nat. (* Fixpoint factorial (n:nat) : nat := if n <=? 1 then 1 else n*(factorial (n-1)). *) Fixpoint factorial (n:nat) : nat := match n with | O => 1 | S m => n * factorial m end. Fixpoint isblue (c:color) : bool := match c with | Red => false | Blue => true | Dark x => isblue x | Light x => isblue x end. Theorem redblue_dichotomy: forall c, isblue c = negb (isred c). Proof. intro. induction c. simpl. reflexivity. simpl. reflexivity. simpl. assumption. simpl. assumption. Qed. Check redblue_dichotomy. Check true. Check false. Check Nat.eqb. Check True. Check False. Check eq. Compute if (1 =? 1) then 1 else 0. (* Compute if (1 = 1) then 1 else 0. *) Definition zilch (n:nat) : Prop := (n = 0). Compute zilch 0. Compute zilch 1. Theorem zilch_onlyzero: forall n, zilch n -> n = 0. Proof. intro. destruct n. intro. reflexivity. intro. discriminate. Qed. Theorem rewrite_example: forall x, x=1 -> x+x=2. Proof. intros. rewrite H. simpl. reflexivity. Qed.