Theory System_Construction
section ‹Examples›
theory System_Construction imports
"../../Constructive_Cryptography"
begin
subsection ‹Random oracle resource›
locale rorc =
fixes range :: "'r set"
begin
fun rnd_oracle :: "('m ⇒ 'r option, 'm, 'r) oracle'" where
"rnd_oracle f m = (case f m of
(Some r) ⇒ return_spmf (r, f)
| None ⇒ do {
r ← spmf_of_set (range);
return_spmf (r, f(m := Some r))})"
definition "res = RES (rnd_oracle ⊕⇩O rnd_oracle) Map.empty"
end
subsection ‹Key resource›
locale key =
fixes key_gen :: "'k spmf"
begin
fun key_oracle :: "('k option, unit, 'k) oracle'" where
"key_oracle None () = do { k ← key_gen; return_spmf (k, Some k)}"
| "key_oracle (Some x) () = return_spmf (x, Some x)"
definition "res = RES (key_oracle ⊕⇩O key_oracle) None"
end
subsection ‹Channel resource›