(* An equality function on Z that return a bool *)
 
Fixpoint pos_eq_bool (a b : positive) {struct b} : bool :=
  match a, b with
  | xH, xH => true
  | xI a', xI b' => pos_eq_bool a' b'
  | xO a', xO b' => pos_eq_bool a' b'
  | _, _ => false
  end.

Theorem pos_eq_bool_correct : forall p q : positive, match pos_eq_bool p q with | true => p = q | false => p <> q end.