Section ExpressionErasure.
Variables
(W S' : Type)
(G : pfunc W val -> Prop)
(F : pfunc S' val -> Prop)
(GF : pfunc W val -> pfunc S' val -> Prop)
(world_erase : W -> S')
(primexpr_erasure : forall g f b1 b2 w s (Hgf : GF g f),
world_erase w = s
-> exprEval G (EPrim g) w b1
-> exprEval F (EPrim f) s b2
-> b1=b2)
(primexpr_safety : forall g f b1 w s,
GF g f
-> world_erase w = s
-> exprEval G (EPrim g) w b1
-> exists b2, exprEval F (EPrim f) s b2).
Inductive expr_erase : expr W -> expr S' -> Prop :=
| erase_EVal : forall v,
expr_erase (EVal _ v) (EVal _ v)
| erase_EUnop : forall op e e',
expr_erase e e'
-> expr_erase (EUnop op e) (EUnop op e')
| erase_EBinop : forall op e1 e2 e1' e2',
expr_erase e1 e1'
-> expr_erase e2 e2'
-> expr_erase (EBinop op e1 e2) (EBinop op e1' e2')
| erase_EPrim : forall g f,
GF g f
-> expr_erase (EPrim g) (EPrim f).

Lemma expr_erasure : forall e e' w b1 b2,
expr_erase e e'
-> exprEval G e w b1
-> exprEval F e' (world_erase w) b2
-> b1=b2.