Library mcertikos.proc.QThreadGenLink

Require Import LinkTemplate.
Require Import PQThread.
Require Import QThreadGen.
Require Import QThreadGenLinkSource.
Require Import PThread.

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 PQThread_module pthread pqthread.
  Proof.
    init_correct.
    - eapply relate_thread; eauto.
    - constructor.
      + intros.
        rewrite !ZMap.gi.
        reflexivity.
      + intros.
        rewrite !ZMap.gi.
        constructor.
    - constructor.
      intros.
      rewrite !ZMap.gi in Hlog.
      discriminate.
  Qed.

  Lemma link_correct_aux:
    link_correct_aux_type PQThread_module pthread pqthread.
  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 PQThread_module pthread pqthread.
  Proof.
    cl_backward_simulation init_correct link_correct_aux.
  Qed.

  Theorem make_program_exists:
    make_program_exist_type PQThread_module pthread pqthread.
  Proof.
    make_program_exists link_correct_aux.
  Qed.

End WITHCOMPCERTIKOS.