oplss2024/zdancewic/Day1.agda

30 lines
No EOL
719 B
Agda
Raw Blame History

This file contains ambiguous Unicode characters

This file contains Unicode characters that might be confused with other characters. If you think that this is intentional, you can safely ignore this warning. Use the Escape button to reveal them.

{-# 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