module CoercionExpr.GG where
open import Data.Nat
open import Data.Unit using (ā¤; tt)
open import Data.Bool using (true; false) renaming (Bool to š¹)
open import Data.List hiding ([_])
open import Data.Product renaming (_,_ to āØ_,_ā©)
open import Data.Sum using (_ā_)
open import Data.Maybe
open import Relation.Nullary using (Ā¬_; Dec; yes; no)
open import Relation.Binary.PropositionalEquality using (_ā”_; refl)
open import Function using (case_of_)
open import Common.Utils
open import Common.SecurityLabels
open import Common.BlameLabels
open import CoercionExpr.CoercionExpr
open import CoercionExpr.Precision
open import CoercionExpr.CatchUp using (catchup) public
open import CoercionExpr.Simulation using (sim) public
open import CoercionExpr.CatchUpBack using (InSync; v-v; v-ā„; catchup-back) public
open import CoercionExpr.SimBack using (sim-back) public
open import CoercionExpr.SimBackBlame
sim-mult : ā {gā gāā² gā gāā²} {cĢ
ā : CExpr gā ā gā} {cĢ
āā² cĢ
āā² : CExpr gāā² ā gāā²}
ā ā¢ cĢ
ā ā cĢ
āā²
ā CVal cĢ
āā²
ā cĢ
āā² āā cĢ
āā²
ā ā[ cĢ
ā ] (CVal cĢ
ā) Ć (cĢ
ā āā cĢ
ā) Ć (ā¢ cĢ
ā ā cĢ
āā²)
sim-mult cĢ
āācĢ
āā² šā² (_ ā) = catchup _ _ šā² cĢ
āācĢ
āā²
sim-mult {cĢ
ā = cĢ
ā} cĢ
āācĢ
āā² šā² (_ āāāØ cĢ
āā²ācĢ
ā² ā© cĢ
ā²ā cĢ
āā²) =
let āØ cĢ
ā , cĢ
āā cĢ
ā , cĢ
āācĢ
ā² ā© = sim cĢ
āācĢ
āā² cĢ
āā²ācĢ
ā² in
let āØ cĢ
ā , š , cĢ
āā cĢ
ā , cĢ
āācĢ
āā² ā© = sim-mult cĢ
āācĢ
ā² šā² cĢ
ā²ā cĢ
āā² in
āØ cĢ
ā , š , ā -trans cĢ
āā cĢ
ā cĢ
āā cĢ
ā , cĢ
āācĢ
āā² ā©
sim-back-success : ā {ā āā² g gā²} {cĢ
ā cĢ
ā : CExpr l ā ā g} {cĢ
āā² : CExpr l āā² ā gā²}
ā ā¢ cĢ
ā ā cĢ
āā²
ā CVal cĢ
ā
ā cĢ
ā āā cĢ
ā
ā ā[ cĢ
āā² ] (cĢ
āā² āā cĢ
āā²) Ć (InSync cĢ
ā cĢ
āā²)
sim-back-success cĢ
āācĢ
āā² š (_ ā) = catchup-back _ _ š cĢ
āācĢ
āā²
sim-back-success {cĢ
ā = cĢ
ā} cĢ
āācĢ
āā² š (_ āāāØ cĢ
āācĢ
ā© cĢ
ā cĢ
ā) =
let āØ cĢ
āā² , cĢ
āā²ā cĢ
āā² , prec ā© = sim-back cĢ
āācĢ
āā² cĢ
āācĢ
in
let āØ cĢ
āā² , cĢ
āā²ā cĢ
āā² , sync ā© = sim-back-success prec š cĢ
ā cĢ
ā in
āØ cĢ
āā² , ā -trans cĢ
āā²ā cĢ
āā² cĢ
āā²ā cĢ
āā² , sync ā©
sim-back-fail : ā {ā āā² g gā²} {cĢ
: CExpr l ā ā g} {cĢ
ā² : CExpr l āā² ā gā²} {p}
ā ā¢ cĢ
ā cĢ
ā²
ā cĢ
āā ā„ (l ā) g p
ā ā[ q ] (cĢ
ā² āā ā„ (l āā²) gā² q) Ć (ā¢ ā„ (l ā) g p ā ā„ (l āā²) gā² q)
sim-back-fail cĢ
ācĢ
ā² (_ ā) = sim-back-blame cĢ
ācĢ
ā²
sim-back-fail {cĢ
= cĢ
ā} cĢ
āācĢ
āā² (_ āāāØ cĢ
āācĢ
ā© cĢ
ā cĢ
ā) =
let āØ cĢ
āā² , cĢ
āā²ā cĢ
āā² , prec ā© = sim-back cĢ
āācĢ
āā² cĢ
āācĢ
in
let āØ cĢ
āā² , cĢ
āā²ā cĢ
āā² , sync ā© = sim-back-fail prec cĢ
ā cĢ
ā in
āØ cĢ
āā² , ā -trans cĢ
āā²ā cĢ
āā² cĢ
āā²ā cĢ
āā² , sync ā©