oplss2024/zdancewic/Day1.agda

30 lines
719 B
Agda
Raw Permalink Normal View History

2024-06-11 02:56:36 +00:00
{-# OPTIONS --prop #-}
module Zdancewic.Day1 where
open import Data.Bool
open import Data.Nat
open import Data.String
mem = String ->
infixl 20 _∙_
data aexp : Set where
data bexp : Set where
data com : Set where
`_:=_ : String com
`if_then_else_ : bexp com com com
`skip : com
_∙_ : com com com
beval : mem bexp Bool
denote : com mem mem
denote `skip st = st
denote (`if x then c else c₁) st = if beval st x then denote c st else denote c₁ st
denote (` x := n) st = λ y if x == y then n else st x
denote (c c₁) st = denote c₁ (denote c st)
data ceval : com mem mem Prop where
E_skip : {st} ceval `skip st st