Fixpoint card (d : data) (q : queue) {struct q} : Z :=
  match q with
  | empty => 0%Z
  | input d' q' =>
      if eq_data_dec d d'
      then (card d q' + 1)%Z
      else card d q'
  end.

Lemma input_S_card : forall (d d' : data) (q : queue data), d = d' -> card data eq_data_dec d (input data d' q) = (card data eq_data_dec d q + 1)%Z.