# HG changeset patch # User ryokka # Date 1544690750 -32400 # Node ID ab73094377a228383a83ae12a19a58a004f021d6 # Parent 6d2dc87aaa62c61eb0c0c643bdf4f34751f0032a modify Hoare-Logic base diff -r 6d2dc87aaa62 -r ab73094377a2 whileTest.agda --- a/whileTest.agda Thu Dec 13 15:37:57 2018 +0900 +++ b/whileTest.agda Thu Dec 13 17:45:50 2018 +0900 @@ -1,7 +1,11 @@ module whileTest where open import Data.Nat -open import Data.Bool +open import Data.Bool hiding (_≟_) +open import Data.Product +open import Relation.Nullary +open import Relation.Binary +open import SET record Env : Set where @@ -10,36 +14,91 @@ vari : ℕ open Env -data PrimComm : Set where - command : (Env → Env) → PrimComm --- seti : (v : ℕ) → PrimComm (record {varn = {!!} ; vari = {!!}} ) +neg : (Env → Bool) → (Env → Bool) +neg x e = not (x e) + +and : (Env → Bool) → (Env → Bool) → (Env → Bool) +and x y e = (x e) ∧ (y e) + +enveq : (Env → Bool) → (Env → Bool) → Set +enveq x y = {!!} + +sem : (Env → Bool) → Pred Env +sem x y = {!!} + +tautValid : (b1 b2 : Env → Bool) -> enveq b1 b2 -> + (s : Env) -> sem b1 s -> sem b2 s +tautValid = {!!} + +respNeg : (b : Env → Bool) -> (s : Env) -> + Iff (sem (neg b) s) (¬ sem b s) +respNeg = {!!} + +respAnd : (b1 b2 : Env → Bool) -> (s : Env) -> + Iff (sem (and b1 b2) s) + ((sem b1 s) × (sem b2 s)) +respAnd = {!!} -data Cond : Set where - cond : (Env → Bool) → Cond +PrimSemComm : ∀ {l} -> (Env → Env) -> Rel Env l +PrimSemComm = {!!} + +Axiom :( Env → Bool) -> (Env → Env) -> (Env → Bool) -> Set +Axiom = {!!} + +axiomValid : ∀ {l} -> (bPre : Env → Bool ) -> (pcm : (Env → Env)) -> (bPost : Env → Bool) -> + (ax : Axiom bPre pcm bPost) -> (s1 s2 : Env) -> + sem bPre s1 -> PrimSemComm {l} pcm s1 s2 -> sem bPost s2 +axiomValid = {!!} + +open import Hoare (Env → Bool) (Env → Env) neg and enveq Env sem tautValid + respNeg respAnd PrimSemComm Axiom axiomValid -open import Hoare Cond PrimComm {!!} {!!} {!!} Env {!!} {!!} {!!} {!!} {!!} {!!} {!!} +lt : ℕ → ℕ → Bool +lt x y with x