(** Now we prove the hoare rules. **)

(* Lemma for proving the correctness of straight-line instructions. The sufficent condition is : If the state before satisfies the precondition then there exists a post state satisfiing the postcondition. *)
Lemma hoare_straight : forall pu R c P Q n,
(forall k rho m F n', n' <= n ->
proj1_sig (P * F) (n',(rho,m)) ->
exists rho', exists m',
step pu k rho m c k rho' m' /\
proj1_sig (Q * F) (n',(rho',m'))) ->
hoare_ pu R P c Q n.