Library mcertikos.mcslock.MCSLockOpGenLink

Require Import LinkTemplate.
Require Import MMCSLockOp.
Require Import MCSLockOpGen.
Require Import MCSLockOpGenLinkSource.
Require Import MMCSLockAbsIntro.
Require Import MMCSLockAbsIntroCSource.
Require Import MMCSLockAbsIntroCodeMCSPassLock.
Require Import MMCSLockAbsIntroCodeMCSWaitLock.

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

  Lemma init_correct:
    init_correct_type MMCSLockOp_module mmcslockabsintro mmcslockop.
  Proof.
    init_correct.
  Qed.

  Lemma link_correct_aux:
    link_correct_aux_type MMCSLockOp_module mmcslockabsintro mmcslockop.
  Proof.
    link_correct_aux.
    - link_cfunction mcs_pass_lock_spec_ref MMCSLOCKABSINTROCODEMCSPASSLOCK.mcs_pass_lock_code_correct.
    - link_cfunction mcs_wait_lock_spec_ref MMCSLOCKABSINTROCODEMCSWAITLOCK.mcs_wait_lock_code_correct.
    - apply passthrough_correct.
  Qed.

  Theorem cl_backward_simulation:
    cl_backward_simulation_type MMCSLockOp_module mmcslockabsintro mmcslockop.
  Proof.
    cl_backward_simulation init_correct link_correct_aux.
  Qed.

  Theorem make_program_exists:
    make_program_exist_type MMCSLockOp_module mmcslockabsintro mmcslockop.
  Proof.
    make_program_exists link_correct_aux.
  Qed.

End WITHCOMPCERTIKOS.