Library mcertikos.devdrivers.AbsConsoleBuffIntroGenSpec


This file provide the contextual refinement proof between MBoot layer and MALInit layer
Require Import Coqlib.
Require Import Errors.
Require Import AST.
Require Import Integers.
Require Import Floats.
Require Import Op.
Require Import Asm.
Require Import Events.
Require Import Globalenvs.
Require Import Smallstep.
Require Import Values.
Require Import Memory.
Require Import Maps.
Require Import AuxLemma.
Require Import FlatMemory.
Require Import AuxStateDataType.
Require Import Constant.
Require Import GlobIdent.
Require Import RealParams.
Require Import AsmImplLemma.
Require Import GenSem.
Require Import PrimSemantics.
Require Import DConsoleBuffIntro.
Require Import AbstractDataType.

Require Import liblayers.logic.PTreeModules.
Require Import liblayers.logic.LayerLogicImpl.
Require Import liblayers.compcertx.Stencil.
Require Import liblayers.compcertx.MakeProgram.
Require Import liblayers.compat.CompatLayers.
Require Import liblayers.compat.CompatGenSem.
Require Import compcert.cfrontend.Ctypes.

Local Open Scope string_scope.
Local Open Scope error_monad_scope.
Local Open Scope Z_scope.

Require Import ObjConsole.

Definition of the refinement relation

Section DABDCONSOLEBUFFINTROGEN_DEFINE.

  Context `{real_params: RealParams}.
  Context `{oracle_prop: MultiOracleProp}.

  Notation LDATA := RData.

  Notation LDATAOps := (cdata LDATA).

  Inductive cons_buf_init_spec_low_step `{StencilOps} `{Mem.MemoryModelOps} `{UseMemWithData mem}:
    sextcall_sem (mem := mwd LDATAOps) :=
    cons_buf_init_spec_low_intro s (WB: _Prop) m d :
      cons_buf_init_concrete_spec d = Some
      kernel_mode d
      high_level_invariant d
      cons_buf_init_spec_low_step s WB nil (m, d) Vundef (m, ).

  Inductive cons_buf_write_spec_low_step `{StencilOps} `{Mem.MemoryModelOps} `{UseMemWithData mem}:
    sextcall_sem (mem := mwd LDATAOps) :=
    cons_buf_write_spec_low_intro s (WB: _Prop) m d c:
      cons_buf_write_concrete_spec (Int.unsigned c) d = Some
      kernel_mode d
      high_level_invariant d
      cons_buf_write_spec_low_step s WB (Vint c :: nil) (m, d) Vundef (m, ).

  Inductive cons_buf_read_spec_low_step `{StencilOps} `{Mem.MemoryModelOps} `{UseMemWithData mem}:
    sextcall_sem (mem := mwd LDATAOps) :=
    cons_buf_read_spec_low_intro2 s (WB: _Prop) m d c:
      cons_buf_read_concrete_spec d = Some (, Int.unsigned c)
      kernel_mode d
      high_level_invariant d
      cons_buf_read_spec_low_step s WB nil (m, d) (Vint c) (m, ).

  Inductive cons_buf_wpos_spec_low_step `{StencilOps} `{Mem.MemoryModelOps} `{UseMemWithData mem}:
    sextcall_sem (mem := mwd LDATAOps) :=
    cons_buf_wpos_spec_low_intro s (WB: _Prop) m d wpos:
      cons_buf_wpos_concrete_spec d = Some (Int.unsigned wpos) →
      kernel_mode d
      high_level_invariant d
      cons_buf_wpos_spec_low_step s WB nil (m, d) (Vint wpos) (m, ).

  Section WITHMEM.

    Context `{Hstencil: Stencil}.
    Context `{Hmem: Mem.MemoryModelX}.
    Context `{Hmwd: UseMemWithData mem}.

    Definition cons_buf_init_spec_low: compatsem LDATAOps :=
      csem cons_buf_init_spec_low_step (type_of_list_type nil) Tvoid.

    Definition cons_buf_write_spec_low: compatsem LDATAOps :=
      csem cons_buf_write_spec_low_step (type_of_list_type (Tint32::nil)) Tvoid.

    Definition cons_buf_read_spec_low: compatsem LDATAOps :=
      csem cons_buf_read_spec_low_step (type_of_list_type nil) Tint32.

    Definition cons_buf_wpos_spec_low: compatsem LDATAOps :=
      csem cons_buf_wpos_spec_low_step (type_of_list_type nil) Tint32.

  End WITHMEM.

End DABDCONSOLEBUFFINTROGEN_DEFINE.