Skip to content
Snippets Groups Projects
Commit 1b561324 authored by Robbert Krebbers's avatar Robbert Krebbers
Browse files

Misc changes to language.

parent ed0cd58b
No related branches found
No related tags found
No related merge requests found
...@@ -409,8 +409,8 @@ Section Language. ...@@ -409,8 +409,8 @@ Section Language.
exists K e1' e2', e1 = fill K e1' /\ e2 = fill K e2' /\ prim_step e1' σ1 e2' σ2 ef. exists K e1' e2', e1 = fill K e1' /\ e2 = fill K e2' /\ prim_step e1' σ1 e2' σ2 ef.
Instance heap_lang : Language expr value state := {| Instance heap_lang : Language expr value state := {|
to_expr := v2e; of_val := v2e;
of_expr := e2v; to_val := e2v;
atomic := atomic; atomic := atomic;
prim_step := ectx_step prim_step := ectx_step
|}. |}.
...@@ -430,7 +430,7 @@ Section Language. ...@@ -430,7 +430,7 @@ Section Language.
(** We can have bind with arbitrary evaluation contexts **) (** We can have bind with arbitrary evaluation contexts **)
Lemma fill_is_ctx K: is_ctx (fill K). Lemma fill_is_ctx K: is_ctx (fill K).
Proof. Proof.
split; last split. split.
- intros ? [v Hval]. eapply fill_value. eassumption. - intros ? [v Hval]. eapply fill_value. eassumption.
- intros ? ? ? ? ? (K' & e1' & e2' & Heq1 & Heq2 & Hstep). - intros ? ? ? ? ? (K' & e1' & e2' & Heq1 & Heq2 & Hstep).
exists (comp_ctx K K'), e1', e2'. rewrite -!fill_comp Heq1 Heq2. exists (comp_ctx K K'), e1', e2'. rewrite -!fill_comp Heq1 Heq2.
......
Require Import prelude.prelude. Require Import prelude.prelude.
Class Language (E V St : Type) := { Class Language (E V St : Type) := {
to_expr : V E; of_val : V E;
of_expr : E option V; to_val : E option V;
atomic : E Prop; atomic : E Prop;
prim_step : E St E St option E Prop; prim_step : E St E St option E Prop;
of_to_expr v : of_expr (to_expr v) = Some v; to_of_val v : to_val (of_val v) = Some v;
to_of_expr e v : of_expr e = Some v to_expr v = e; of_to_val e v : to_val e = Some v of_val v = e;
values_stuck e σ e' σ' ef : prim_step e σ e' σ' ef of_expr e = None; values_stuck e σ e' σ' ef : prim_step e σ e' σ' ef to_val e = None;
atomic_not_value e : atomic e of_expr e = None; atomic_not_value e : atomic e to_val e = None;
atomic_step e1 σ1 e2 σ2 ef : atomic_step e1 σ1 e2 σ2 ef :
atomic e1 atomic e1
prim_step e1 σ1 e2 σ2 ef prim_step e1 σ1 e2 σ2 ef
is_Some (of_expr e2) is_Some (to_val e2)
}. }.
Section language. Section language.
...@@ -29,12 +29,13 @@ Section language. ...@@ -29,12 +29,13 @@ Section language.
Definition steps := rtc step. Definition steps := rtc step.
Definition stepn := nsteps step. Definition stepn := nsteps step.
Definition is_ctx (ctx : E E) : Prop := Record is_ctx (K : E E) := IsCtx {
( e, is_Some (of_expr (ctx e)) is_Some (of_expr e)) is_ctx_value e : is_Some (to_val (K e)) is_Some (to_val e);
( e1 σ1 e2 σ2 ef, is_ctx_step_preserved e1 σ1 e2 σ2 ef :
prim_step e1 σ1 e2 σ2 ef -> prim_step (ctx e1) σ1 (ctx e2) σ2 ef) prim_step e1 σ1 e2 σ2 ef prim_step (K e1) σ1 (K e2) σ2 ef;
( e1' σ1 e2 σ2 ef, is_ctx_step e1' σ1 e2 σ2 ef :
of_expr e1' = None prim_step (ctx e1') σ1 e2 σ2 ef to_val e1' = None prim_step (K e1') σ1 e2 σ2 ef
e2', e2 = ctx e2' prim_step e1' σ1 e2' σ2 ef). e2', e2 = K e2' prim_step e1' σ1 e2' σ2 ef
}.
End language. End language.
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment