Slightly simplify evaluation code

Signed-off-by: Danila Fedorin <danila.fedorin@gmail.com>
This commit is contained in:
Danila Fedorin 2024-05-08 22:05:50 -07:00
parent 66d229c493
commit 7fe46b014c

View File

@ -158,13 +158,12 @@ module WithProg (prog : Program) where
updateVariablesFromStmt-Monoʳ (k e) {vs₁} {vs₂} vs₁≼vs₂ = updateVariablesFromExpression-Mono k e {vs₁} {vs₂} vs₁≼vs₂
updateVariablesFromStmt-Monoʳ noop vs₁≼vs₂ = vs₁≼vs₂
variablesAt : State StateVariables VariableValues
variablesAt s sv = proj₁ (locateᵐ {s} {sv} (states-in-Map s sv))
updateVariablesForState : State StateVariables VariableValues
updateVariablesForState s sv =
let
bss = code s
(vs , s,vs∈sv) = locateᵐ {s} {sv} (states-in-Map s sv)
in
foldl (flip updateVariablesFromStmt) vs bss
foldl (flip updateVariablesFromStmt) (variablesAt s sv) (code s)
updateVariablesForState-Monoʳ : (s : State) Monotonic _≼ᵐ_ _≼ᵛ_ (updateVariablesForState s)
updateVariablesForState-Monoʳ s {sv₁} {sv₂} sv₁≼sv₂ =