(** reduce remove from h all the redundancy: a pair (M,N) is kept
   in (reduce h) iff it cannot be 'strictly' synthetised by h *)
Definition reduce (h : hedge) (M N : Msg) :=
  h M N /\
  match M with
  | MEnc M' K =>
      match N with
      | MEnc N' L => ~ synthesis h M' N' \/ ~ synthesis h K L
      | _ => True
      end
  | MPair M1 M2 =>
      match N with
      | MPair N1 N2 => ~ synthesis h M1 N1 \/ ~ synthesis h M2 N2
      | _ => True
      end
  | Mop opM M' =>
      match N with
      | Mop opN N' => opM <> opN \/ ~ synthesis h M' N'
      | _ => True
      end
  | _ => True
  end.

Lemma h_equiv_h_red : forall h : hedge, equiv_h h (reduce h).