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.

Theorem surjective_pairing : forall (p : natprod), p = (fst p, snd p).