Library liblayers.logic.Language
Language definitions
Require Export liblayers.logic.Modules.
Require Export liblayers.logic.Layers.
Require Export liblayers.logic.Semantics.
Layer logic
Class LayerLogicOps {layerdata simrel} ident F primsem V module layer
`{sem_ops: SemanticsOps layerdata ident F primsem V module layer} :=
{
ll_vdash {D1 D2} :> Vdash (layer D1) (simrel D2 D1 × module) (layer D2)
}.
Class LayerLogic {layerdata simrel} ident F primsem V module layer
`{ll_ops: LayerLogicOps layerdata simrel ident F primsem V module layer}
`{rg_ops: !ReflexiveGraphOps layerdata simrel}
`{primsem_sim: !Sim simrel primsem}
`{layer_sim: !Sim simrel layer} :=
{
conseq_le_le D1 D2 (R: simrel D1 D2) L1 L2 L3 L4 M:
L2 ⊢ (R, M) : L3 →
L2 ≤ L1 →
L4 ≤ L3 →
L1 ⊢ (R, M) : L4;
hcomp_rule D D´ (R: simrel D´ D) L M1 M2 (L1 L2: layer D´):
layers_disjoint L1 L ∨ layers_disjoint L2 L →
L ⊢ (R, M1) : L1 →
L ⊢ (R, M2) : L2 →
L ⊢ (R, M1 ⊕ M2) : L1 ⊕ L2
}.
Section DERIVED_RULES.
Context `{Hll: LayerLogic}.
Context `{Hmodule: !Modules ident F V module}.
Context `{Hlayer: !Layers ident primsem V layer}.
Context `{fsem_ops: !FunctionSemanticsOps ident F primsem V module layer}.
Context `{Hsem: !Semantics ident F primsem V module layer}.
The following specialized versions of the consequence rule are
easier to apply depending on situation, since you don't have to
rewrite the relation involved to account for identities.
Lemma conseq_le_left {D1 D2} (R: simrel D1 D2) M L1 L1´ L2:
L1 ⊢ (R, M) : L2 →
L1 ≤ L1´ →
L1´ ⊢ (R, M) : L2.
Proof.
intros HM HL1.
eapply conseq_le_le.
× apply HM.
× apply HL1.
× reflexivity.
Qed.
Lemma conseq_le_right {D1 D2} (R: simrel D1 D2) M L1 L2 L2´:
L1 ⊢ (R, M) : L2 →
L2´ ≤ L2 →
L1 ⊢ (R, M) : L2´.
Proof.
intros HM HL2.
eapply conseq_le_le.
× apply HM.
× reflexivity.
× apply HL2.
Qed.
The frame rule can be proved from horizontal composition and
some consequence rules.
Not sure how to fit layers_disjoint in though <
Lemma frame_rule D D' (R: simrel D' D) L1 L2 M1 M2 L1' L2':
L1 ⊢ (R, M1) : L1' ->
L2 ⊢ (R, M2) : L2' ->
L1 ⊕ L2 ⊢ (R, M1 ⊕ M2) : L1' ⊕ L2'.
Proof.
intros H1 H2.
apply hcomp_rule.
* eapply conseq_le_left; try eassumption.
apply left_upper_bound.
* eapply conseq_le_left; try eassumption.
apply right_upper_bound.
Qed.
>