(* A small example Coq file: Basics.v *)

(** Define a function to compute the factorial of a natural number.  *)
Fixpoint factorial (n : nat) : nat :=
  match n with
  | 0 => 1
  | S m => n * factorial m
  end.

(** Test the factorial function with some examples. *)
Example test_factorial1 : factorial 3 = 6.
Proof. simpl. reflexivity. Qed.

Example test_factorial2 : factorial 5 = 120.
Proof. simpl. reflexivity. Qed.

(** Define a boolean function that returns true if both inputs are true. *)
Definition andb (b1 b2 : bool) : bool :=
  match b1 with
  | true => b2
  | false => false
  end.

(** Prove a simple property: andb is commutative. *)
Theorem andb_comm : forall b1 b2 : bool, andb b1 b2 = andb b2 b1.
Proof.
  intros b1 b2.
  destruct b1; destruct b2; simpl; reflexivity.
Qed.   
