Library mcertikos.proc.BThreadGenLink

Require Import LinkTemplate.
Require Import PBThread.
Require Import BThreadGen.
Require Import BThreadGenLinkSource.
Require Import VVMXInit.

Section WITHCOMPCERTIKOS.
  Context `{compcertikos_prf: CompCertiKOS} `{real_params_prf: RealParams}.
  Context `{multi_oracle_prop: MultiOracleProp}.
  Context `{multi_oracle_link: !MultiOracleLink}.

  Lemma init_correct:
    init_correct_type PBThread_module vmxinit pbthread.
  Proof.
    init_correct.
    - eapply relate_big; eauto.
    - constructor.
    - repeat intro.
      rewrite <- H1, <- H2.
      rewrite ZMap.gi.
      econstructor; eauto.
      intro; rewrite ZMap.gi; eauto.
    - repeat intro.
      rewrite <- H1, <- H2.
      rewrite ZMap.gi.
      econstructor; eauto.
      intro; rewrite ZMap.gi; eauto.
  Qed.

  Lemma link_correct_aux:
    link_correct_aux_type PBThread_module vmxinit pbthread.
  Proof.
    link_correct_aux.
    - match goal with |- _ ?R ?x ?ychange (sim R x y) end.
      match goal with |- _ ?R ?x ?yassert (x ) by le_oplus end.
      rewrite H.
      apply lower_bound.
    - apply passthrough_correct.
  Qed.

  Theorem cl_backward_simulation:
    cl_backward_simulation_type PBThread_module vmxinit pbthread.
  Proof.
    cl_backward_simulation init_correct link_correct_aux.
  Qed.

  Theorem make_program_exists:
    make_program_exist_type PBThread_module vmxinit pbthread.
  Proof.
    make_program_exists link_correct_aux.
  Qed.

End WITHCOMPCERTIKOS.