Inductive natprod : Type :=
| pair : nat -> nat -> natprod.Inductive natprod : Type :=
| pair : nat -> nat -> natprod.Instance dec_natprod (p q : natprod) : Dec (p = q).Definition fst (p : natprod) : nat :=
  match p with
  | pair x y => x
  end.Definition snd (p : natprod) : nat :=
  match p with
  | pair x y => y
  end.Notation "x ++ y" := (app x y)
                     (right associativity, at level 60).Definition fst' (p : natprod) : nat :=
  match p with
  | (x,y) => x
  end.Definition snd' (p : natprod) : nat :=
  match p with
  | (x,y) => y
  end.Definition swap_pair (p : natprod) : natprod :=
  match p with
  | (x,y) => (y,x)
  end.

(* Specifications: *)
Theorem surjective_pairing' : forall (n m : nat), (n,m) = (fst (n,m), snd (n,m)).
Theorem surjective_pairing : forall (p : natprod), p = (fst p, snd p).
Theorem snd_fst_is_swap : forall (p : natprod), (snd p, fst p) = swap_pair p.
Theorem fst_swap_is_snd : forall (p : natprod), fst (swap_pair p) = snd p.