Library mcertikos.mcslock.HMCSLockOpGenLink

Require Import LinkTemplate.
Require Import MHMCSLockOp.
Require Import HMCSLockOpGen.
Require Import HMCSLockOpGenLinkSource.
Require Import MQMCSLockOp.

Section WITHCOMPCERTIKOS.
  Context `{compcertikos_prf: CompCertiKOS} `{real_params_prf: RealParams}.
  Context `{mcs_oracle_prop: MCSOracleProp}.
  Context `{multi_oracle_link: !MCSOracleLink}.

  Lemma init_correct:
    init_correct_type MHMCSLockOp_module mqmcslockop mhticketlockop.
  Proof.
    init_correct.
    -
      eapply relatemcs.
    -
      econstructor; eauto.
      intros.
      rewrite !Maps.ZMap.gi.
      constructor.
  Qed.

  Lemma link_correct_aux:
    link_correct_aux_type MHMCSLockOp_module mqmcslockop mhticketlockop.
  Proof.
    link_correct_aux.
    - match goal with |- _ _ _ ?R ?x ?ychange (sim R x y) end.
      apply lower_bound.     - apply passthrough_correct.
  Qed.

  Theorem cl_backward_simulation:
    cl_backward_simulation_type MHMCSLockOp_module mqmcslockop mhticketlockop.
  Proof.
    cl_backward_simulation init_correct link_correct_aux.
  Qed.

  Theorem make_program_exists:
    make_program_exist_type MHMCSLockOp_module mqmcslockop mhticketlockop.
  Proof.
    make_program_exists link_correct_aux.
  Qed.

End WITHCOMPCERTIKOS.