intros.
cut (exists p : nat, m = p + n).
intro.
elim H0.
intro p.
intro.
rewrite H1.
apply analysis_seq_grows.
exists (m - n).
rewrite plus_comm.
apply le_plus_minus.
trivial.
Qed.
(** 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.

(* Specifications: *)
(** (reduce h) is included in h *)
Lemma red_incl_h : forall h : hedge, inclusion (reduce h) h.
unfold inclusion in |- *.