Theory DBM_Examples
theory DBM_Examples
imports
DBM_Operations_Impl_Refine
FW_More
Show.Show_Instances
begin
section ‹Examples›
no_notation Ref.update ("_ := _" 62)
text ‹Let us represent the zone ‹y ≤ x ∧ x − y ≤ 2 ∧ y ≥ 1› as a DBM:›
definition test_dbm :: "int DBM'" where
"test_dbm = ((((λ(i, j). Le 0)((1,2) := Le 2))((0, 2) := Le (-1)))((1, 0) := ∞))((2, 0) := ∞)"
definition show_test_dbm where
"show_test_dbm M = String.implode (
show_dbm 2
(λi. if i = 1 then ''x'' else if i = 2 then ''y'' else ''f'') show
M
)"
value [code] "show_test_dbm test_dbm"
value [code] "show_test_dbm (FW' test_dbm 2)"
value [code] "show_test_dbm (reset'_upd (FW' test_dbm 2) 2 [2] 0)"
value [code] "show_test_dbm (reset'_upd test_dbm 2 [2] 0)"
value [code] "show_test_dbm (FW' (reset'_upd (FW' test_dbm 2) 2 [2] 0) 2)"
value [code] "show_test_dbm (up_canonical_upd (reset'_upd (FW' test_dbm 2) 2 [2] 0) 2)"
value [code] "show_test_dbm (FW' (And_upd 2
(up_canonical_upd (reset'_upd (FW' test_dbm 2) 2 [2] 0) 2)
((λ(i, j). ∞)((1, 0):=Lt 1))) 2)"
value [code] "check_diag 2 (FW' (And_upd 2
(up_canonical_upd (reset'_upd (FW' test_dbm 2) 2 [2] 0) 2)
((λ(i, j). ∞)((1, 0):=Lt 1))) 2)"
end