2014-07-14 19:32:44 +00:00
|
|
|
(*
|
2020-03-09 06:18:30 +00:00
|
|
|
* Copyright 2020, Data61, CSIRO (ABN 41 687 119 230)
|
2014-07-14 19:32:44 +00:00
|
|
|
*
|
2020-03-09 06:18:30 +00:00
|
|
|
* SPDX-License-Identifier: GPL-2.0-only
|
2014-07-14 19:32:44 +00:00
|
|
|
*)
|
|
|
|
|
|
|
|
theory Substitute
|
|
|
|
|
2016-04-18 20:25:44 +00:00
|
|
|
imports
|
2018-09-09 00:00:58 +00:00
|
|
|
"CKernel.Kernel_C"
|
2018-06-26 15:54:58 +00:00
|
|
|
"AsmRefine.GlobalsSwap"
|
2014-07-14 19:32:44 +00:00
|
|
|
begin
|
|
|
|
|
2019-05-26 23:45:14 +00:00
|
|
|
ML \<open>
|
2014-07-14 19:32:44 +00:00
|
|
|
|
|
|
|
structure SubstituteSpecs = struct
|
|
|
|
|
|
|
|
val list_abs = uncurry (fold_rev (fn (x, T) => fn t => Abs (x, T, t)));
|
|
|
|
|
|
|
|
fun get_rhs thm =
|
|
|
|
snd (Logic.dest_equals (Thm.concl_of thm))
|
|
|
|
handle TYPE _ =>
|
|
|
|
snd (HOLogic.dest_eq (Thm.concl_of thm));
|
|
|
|
|
|
|
|
fun get_lhs thm =
|
|
|
|
fst (Logic.dest_equals (Thm.concl_of thm))
|
|
|
|
handle TYPE _ =>
|
|
|
|
fst (HOLogic.dest_eq (Thm.concl_of thm));
|
|
|
|
|
|
|
|
fun term_convert prefix convs (tm as Const (name, _)) =
|
|
|
|
if not (String.isPrefix prefix name) then tm
|
|
|
|
else the (Termtab.lookup convs tm)
|
|
|
|
| term_convert _ _ tm = tm;
|
|
|
|
|
|
|
|
fun suspicious_term ctxt s t = if Term.add_var_names t [] = [] then ()
|
|
|
|
else (tracing ("suspicious " ^ s);
|
|
|
|
Syntax.pretty_term ctxt t |> Pretty.string_of |> tracing;
|
|
|
|
())
|
|
|
|
|
|
|
|
val debug_trace = ref (Bound 0);
|
|
|
|
|
|
|
|
fun convert prefix src_ctxt proc (tm as Const (name, _)) (convs, ctxt) =
|
2015-10-12 13:11:13 +00:00
|
|
|
((term_convert prefix convs tm; (convs, ctxt))
|
2014-07-14 19:32:44 +00:00
|
|
|
handle Option =>
|
|
|
|
let
|
|
|
|
val cname = unprefix prefix name;
|
|
|
|
val def_thm = Proof_Context.get_thm src_ctxt (cname ^ "_def")
|
|
|
|
val rhs = get_rhs def_thm;
|
|
|
|
val _ = suspicious_term ctxt "init rhs" rhs;
|
|
|
|
val consts = Term.add_consts rhs [];
|
|
|
|
val (convs, ctxt) = fold (convert prefix src_ctxt proc o Const)
|
|
|
|
consts (convs, ctxt);
|
|
|
|
val rhs' = map_aterms (term_convert prefix convs) rhs;
|
|
|
|
val rhs'' = proc ctxt cname rhs';
|
|
|
|
val _ = suspicious_term ctxt "adjusted rhs" rhs'';
|
|
|
|
|
|
|
|
in if rhs'' aconv rhs
|
|
|
|
then (Termtab.insert (K true) (tm, tm) convs,
|
2019-05-27 00:19:44 +00:00
|
|
|
ctxt
|
|
|
|
|> Local_Theory.open_target |> snd
|
|
|
|
|> Local_Theory.abbrev Syntax.mode_default ((Binding.name cname, NoSyn), get_lhs def_thm)
|
2014-07-14 19:32:44 +00:00
|
|
|
|> snd |> Local_Theory.note ((Binding.name (cname ^ "_def"), []), [def_thm])
|
2019-05-27 00:19:44 +00:00
|
|
|
|> snd |> Local_Theory.close_target
|
2014-07-14 19:32:44 +00:00
|
|
|
)
|
|
|
|
|
|
|
|
else let
|
|
|
|
val _ = tracing ("Defining " ^ cname);
|
|
|
|
|
|
|
|
val pre_def_ctxt = ctxt
|
|
|
|
val b = Binding.name cname
|
2019-05-27 00:19:44 +00:00
|
|
|
val ctxt = Local_Theory.open_target ctxt |> snd
|
2014-07-14 19:32:44 +00:00
|
|
|
val ((tm', _), ctxt) = Local_Theory.define
|
|
|
|
((b, NoSyn), ((Thm.def_binding b, []), rhs'')) ctxt
|
|
|
|
val tm'' = Morphism.term (Proof_Context.export_morphism ctxt pre_def_ctxt) tm'
|
2019-05-27 00:19:44 +00:00
|
|
|
val ctxt = Local_Theory.close_target ctxt
|
2014-07-14 19:32:44 +00:00
|
|
|
|
|
|
|
val lhs_argTs = get_lhs def_thm |> strip_comb |> snd |> map fastype_of;
|
|
|
|
val abs_tm = list_abs (map (pair "_") lhs_argTs, tm'')
|
|
|
|
|
|
|
|
in (Termtab.insert (K true) (tm, abs_tm) convs, ctxt) end
|
2015-10-12 13:11:13 +00:00
|
|
|
end)
|
|
|
|
| convert _ _ _ (tm) _ = raise TERM ("convert: not Const", [tm])
|
|
|
|
|
2014-07-14 19:32:44 +00:00
|
|
|
|
|
|
|
fun prove_impl_tac ctxt ss =
|
|
|
|
SUBGOAL (fn (t, n) => let
|
|
|
|
val lhs = t |> HOLogic.dest_Trueprop |> HOLogic.dest_eq |> fst;
|
|
|
|
val cnames = Term.add_const_names lhs []
|
|
|
|
|> filter (String.isSuffix "_'proc");
|
|
|
|
val unfolds = map (Proof_Context.get_thm ctxt o suffix "_def"
|
|
|
|
o Long_Name.base_name) cnames;
|
|
|
|
in simp_tac (put_simpset ss ctxt addsimps unfolds) n
|
|
|
|
end);
|
|
|
|
|
2014-09-23 04:40:31 +00:00
|
|
|
fun convert_impls ctxt = let
|
2014-07-14 19:32:44 +00:00
|
|
|
|
2014-09-23 04:40:31 +00:00
|
|
|
val thm = Proof_Context.get_thm ctxt "\<Gamma>_def"
|
2014-07-14 19:32:44 +00:00
|
|
|
|
2015-05-17 00:42:15 +00:00
|
|
|
val proc_defs = (Term.add_const_names (Thm.concl_of thm) [])
|
2014-09-23 04:40:31 +00:00
|
|
|
|> filter (String.isSuffix Hoare.proc_deco)
|
|
|
|
|> map (suffix "_def" #> Proof_Context.get_thm ctxt)
|
2014-07-14 19:32:44 +00:00
|
|
|
|
2014-09-23 04:40:31 +00:00
|
|
|
val tree_lemmata = StaticFun.prove_partial_map_thms thm
|
|
|
|
(ctxt addsimps proc_defs)
|
|
|
|
|
|
|
|
fun impl_name_from_proc (Const (s, _)) = s
|
|
|
|
|> Long_Name.base_name
|
|
|
|
|> unsuffix Hoare.proc_deco
|
|
|
|
|> suffix HoarePackage.implementationN
|
|
|
|
| impl_name_from_proc t = raise TERM ("impl_name_from_proc", [t])
|
2014-07-14 19:32:44 +00:00
|
|
|
|
2014-09-23 04:40:31 +00:00
|
|
|
val saves = tree_lemmata |> map (apfst (fst #> impl_name_from_proc))
|
2014-07-14 19:32:44 +00:00
|
|
|
|
2014-09-23 04:40:31 +00:00
|
|
|
in Local_Theory.notes (map (fn (n, t) => ((Binding.name n, []), [([t], [])])) saves)
|
2014-07-14 19:32:44 +00:00
|
|
|
ctxt |> snd end
|
|
|
|
|
|
|
|
fun take_all_actions prefix src_ctxt proc tm csenv
|
2014-09-23 04:40:31 +00:00
|
|
|
styargs ctxt = let
|
|
|
|
val (_, ctxt) = convert prefix src_ctxt proc tm (Termtab.empty, ctxt);
|
2014-07-14 19:32:44 +00:00
|
|
|
in ctxt
|
2014-09-23 04:40:31 +00:00
|
|
|
|> convert_impls
|
2014-07-14 19:32:44 +00:00
|
|
|
|> Modifies_Proofs.prove_all_modifies_goals_local csenv (fn _ => true) styargs
|
|
|
|
end
|
|
|
|
|
|
|
|
end
|
|
|
|
|
2019-05-26 23:45:14 +00:00
|
|
|
\<close>
|
2014-07-14 19:32:44 +00:00
|
|
|
|
2019-05-26 23:45:14 +00:00
|
|
|
ML \<open>
|
2014-07-14 19:32:44 +00:00
|
|
|
fun com_rewrite f t = case fastype_of t of
|
|
|
|
(comT as Type (@{type_name com}, [s, _, ft]))
|
|
|
|
=> let
|
|
|
|
val gd = Const (@{const_name Guard},
|
|
|
|
ft --> (HOLogic.mk_setT s) --> comT --> comT)
|
|
|
|
fun add_guard ((f, gd_s), c) = gd $ f $ gd_s $ c;
|
|
|
|
|
|
|
|
val seq = Const (@{const_name Seq}, comT --> comT --> comT);
|
|
|
|
val skip = Const (@{const_name Skip}, comT);
|
|
|
|
fun add_guards_to_seq gs (Const (@{const_name Seq}, _) $ a $ b)
|
|
|
|
= seq $ add_guards_to_seq gs a $ b
|
|
|
|
| add_guards_to_seq gs c
|
|
|
|
= seq $ foldr add_guard skip gs $ c;
|
|
|
|
|
|
|
|
fun add_guards c [] = c
|
|
|
|
| add_guards ((w as Const (@{const_name While}, _)) $ S $ c) gs
|
|
|
|
= seq $ (w $ S $ add_guards_to_seq gs c) $ foldr add_guard skip gs
|
|
|
|
| add_guards (call as (Const (@{const_name call}, _) $ _ $ _ $ _ $ _)) gs
|
|
|
|
= foldr add_guard (seq $ call $ foldr add_guard skip gs) gs
|
|
|
|
| add_guards c gs = foldr add_guard c gs;
|
|
|
|
|
|
|
|
fun inner t = case t of
|
|
|
|
(Const (@{const_name "switch"}, T) $ v $ set_com_list) => let
|
|
|
|
val (ss, cs) = map_split HOLogic.dest_prod
|
|
|
|
(HOLogic.dest_list set_com_list);
|
|
|
|
val cs' = map inner cs;
|
|
|
|
val (v', gs) = f v;
|
|
|
|
val (ss', gss) = map_split f ss;
|
|
|
|
val listT = HOLogic.mk_prodT
|
|
|
|
(HOLogic.mk_setT (range_type (domain_type T)), comT);
|
|
|
|
in foldr add_guard (head_of t $ v' $ HOLogic.mk_list listT
|
|
|
|
(map HOLogic.mk_prod (ss' ~~ cs')))
|
|
|
|
(gs @ flat gss)
|
|
|
|
end
|
|
|
|
| _ => let
|
|
|
|
val (h, xs) = strip_comb t;
|
|
|
|
(* assumption: we can only get into the com type with one of the
|
|
|
|
constructors or pseudo-constructors, which don't need rewriting,
|
|
|
|
so we can ignore h *)
|
|
|
|
val xTs = xs ~~ (fastype_of h |> strip_type |> fst);
|
|
|
|
fun upd_arg (x, T) = if T = comT then (inner x, []) else f x;
|
|
|
|
val (ys, gss) = map_split upd_arg xTs;
|
|
|
|
in add_guards (list_comb (h, ys)) (flat gss) end
|
|
|
|
in inner (Envir.beta_eta_contract t) end
|
|
|
|
| _ => t;
|
|
|
|
|
2019-05-26 23:45:14 +00:00
|
|
|
\<close>
|
2014-07-14 19:32:44 +00:00
|
|
|
|
2019-05-26 23:45:14 +00:00
|
|
|
setup \<open>DefineGlobalsList.define_globals_list_i
|
|
|
|
"../c/build/$L4V_ARCH/kernel_all.c_pp" @{typ globals}\<close>
|
2014-07-14 19:32:44 +00:00
|
|
|
|
2017-06-29 01:33:36 +00:00
|
|
|
|
2014-07-14 19:32:44 +00:00
|
|
|
locale substitute_pre
|
2017-08-09 06:55:32 +00:00
|
|
|
= fixes symbol_table :: "string \<Rightarrow> addr"
|
|
|
|
and domain :: "addr set"
|
2014-07-14 19:32:44 +00:00
|
|
|
|
|
|
|
begin
|
|
|
|
|
|
|
|
abbreviation
|
|
|
|
"globals_list \<equiv> kernel_all_global_addresses.global_data_list"
|
|
|
|
|
|
|
|
end
|
|
|
|
|
|
|
|
locale kernel_all_substitute = substitute_pre
|
|
|
|
begin
|
|
|
|
|
2019-05-26 23:45:14 +00:00
|
|
|
ML \<open>
|
2014-07-14 19:32:44 +00:00
|
|
|
fun mk_rew (t as Abs (s, T, _)) = mk_rew (betapply (t, Var ((s, 0), T)))
|
|
|
|
| mk_rew t = HOLogic.dest_eq t
|
|
|
|
|
|
|
|
val mk_varifyT = Term.map_types Logic.varifyT_global
|
|
|
|
|
|
|
|
local
|
|
|
|
val c_guard_rew =
|
|
|
|
@{term "\<lambda>p b. Guard C_Guard {s. c_guard (p s)} b
|
|
|
|
= Guard C_Guard {s. h_t_valid (hrs_htd (t_hrs_' (globals s))) c_guard (p s)} b"}
|
|
|
|
|> mk_varifyT |> mk_rew
|
|
|
|
|
|
|
|
val c_guard_rew_weak =
|
|
|
|
@{term "\<lambda>p b. Guard C_Guard {s. c_guard (p s)} b
|
|
|
|
= Guard C_Guard {s. ptr_safe (p s) (hrs_htd (t_hrs_' (globals s)))
|
|
|
|
\<and> c_guard (p s)} b"}
|
|
|
|
|> mk_varifyT |> mk_rew
|
|
|
|
|
|
|
|
in
|
|
|
|
fun strengthen_c_guards ss thy s =
|
2018-06-09 08:30:53 +00:00
|
|
|
if (exists (curry (=) s) ss)
|
2014-07-14 19:32:44 +00:00
|
|
|
then Pattern.rewrite_term thy [c_guard_rew_weak] []
|
|
|
|
else Pattern.rewrite_term thy [c_guard_rew] []
|
|
|
|
end;
|
2019-05-26 23:45:14 +00:00
|
|
|
\<close>
|
2014-07-14 19:32:44 +00:00
|
|
|
|
|
|
|
lemmas global_data_defs
|
|
|
|
= kernel_all_global_addresses.global_data_defs
|
|
|
|
|
|
|
|
lemmas globals_list_def
|
|
|
|
= kernel_all_global_addresses.global_data_list_def
|
|
|
|
|
2019-05-26 23:45:14 +00:00
|
|
|
ML \<open>
|
2014-07-14 19:32:44 +00:00
|
|
|
|
|
|
|
(* the unvarify sets ?symbol_table back to symbol_table. be careful *)
|
|
|
|
val global_datas = @{thms global_data_defs}
|
2015-05-17 00:42:15 +00:00
|
|
|
|> map (Thm.concl_of #> Logic.unvarify_global
|
2014-07-14 19:32:44 +00:00
|
|
|
#> Logic.dest_equals #> snd #> Envir.beta_eta_contract)
|
|
|
|
|
|
|
|
val const_globals = map_filter
|
|
|
|
(fn (Const (@{const_name const_global_data}, _) $ nm $ t)
|
|
|
|
=> SOME (HOLogic.dest_string nm, t)
|
|
|
|
| _ => NONE) global_datas
|
|
|
|
|
|
|
|
local
|
|
|
|
|
|
|
|
val hrs_htd_update_guard_rew1 =
|
|
|
|
@{term "\<lambda>u. Basic (\<lambda>s. globals_update (t_hrs_'_update (hrs_htd_update (u s))) s)
|
|
|
|
= Guard C_Guard {s. globals_list_distinct (fst ` dom_s (u s (hrs_htd (t_hrs_' (globals s)))))
|
|
|
|
symbol_table globals_list}
|
|
|
|
(Basic (\<lambda>s. globals_update (t_hrs_'_update (id hrs_htd_update (u s))) s))"}
|
|
|
|
|> mk_rew
|
|
|
|
|
|
|
|
val hrs_htd_update_guard_rew2 =
|
|
|
|
@{term "t_hrs_'_update (id hrs_htd_update f) = t_hrs_'_update (hrs_htd_update f)"}
|
|
|
|
|> Logic.varify_global |> HOLogic.dest_eq;
|
|
|
|
|
|
|
|
val consts = map snd const_globals
|
|
|
|
|
|
|
|
val index_eq_set_helper
|
|
|
|
= Syntax.parse_term @{context} (String.concat
|
|
|
|
["\<lambda>str t n c. {s :: globals myvars. c \<longrightarrow>",
|
|
|
|
"h_val (hrs_mem (t_hrs_' (globals s)))",
|
|
|
|
" (CTypesDefs.ptr_add (Ptr (symbol_table str)) (of_nat (n s)))",
|
|
|
|
" = t s}"])
|
|
|
|
|
|
|
|
val eq_set_helper
|
|
|
|
= Syntax.parse_term @{context} (String.concat
|
|
|
|
["\<lambda>str t c. {s :: globals myvars. c \<longrightarrow>",
|
|
|
|
"h_val (hrs_mem (t_hrs_' (globals s)))",
|
|
|
|
" (Ptr (symbol_table str)) = t}"])
|
|
|
|
|
|
|
|
val s = @{term "s :: globals myvars"}
|
|
|
|
|
|
|
|
val grab_name_str = head_of #> dest_Const #> fst #> Long_Name.base_name
|
|
|
|
#> HOLogic.mk_string
|
|
|
|
|
|
|
|
in
|
|
|
|
|
|
|
|
fun const_global_asserts ctxt cond
|
2018-06-09 08:30:53 +00:00
|
|
|
(t as (Const (@{const_name index}, _) $ arr $ n)) = if member (=) consts arr
|
2014-07-14 19:32:44 +00:00
|
|
|
then [(index_eq_set_helper $ grab_name_str arr
|
|
|
|
$ lambda s t $ lambda s n $ cond) |> Syntax.check_term ctxt]
|
|
|
|
else []
|
2018-06-09 08:30:53 +00:00
|
|
|
| const_global_asserts ctxt cond (Const c) = if member (=) consts (Const c)
|
2014-07-14 19:32:44 +00:00
|
|
|
then [(eq_set_helper $ grab_name_str (Const c) $ Const c $ cond)
|
|
|
|
|> Syntax.check_term ctxt]
|
|
|
|
else []
|
2018-06-09 08:30:53 +00:00
|
|
|
| const_global_asserts ctxt cond (f $ x) = if member (=) consts (f $ x)
|
2014-07-14 19:32:44 +00:00
|
|
|
then [(eq_set_helper $ grab_name_str (f $ x) $ (f $ x) $ cond)
|
|
|
|
|> Syntax.check_term ctxt]
|
|
|
|
else const_global_asserts ctxt cond f @ const_global_asserts ctxt cond x
|
2015-05-17 00:42:15 +00:00
|
|
|
| const_global_asserts ctxt cond (a as Abs (_, @{typ "globals myvars"}, _))
|
2014-07-14 19:32:44 +00:00
|
|
|
= const_global_asserts ctxt cond (betapply (a, s))
|
2015-05-17 00:42:15 +00:00
|
|
|
| const_global_asserts ctxt cond (Abs (_, _, t))
|
2014-07-14 19:32:44 +00:00
|
|
|
= const_global_asserts ctxt cond t
|
|
|
|
| const_global_asserts _ _ _ = []
|
|
|
|
|
|
|
|
fun guard_rewritable_globals const_cond ctxt =
|
|
|
|
Pattern.rewrite_term @{theory} [hrs_htd_update_guard_rew2] []
|
|
|
|
o Pattern.rewrite_term @{theory} [hrs_htd_update_guard_rew1] []
|
2017-07-12 05:13:51 +00:00
|
|
|
o com_rewrite (fn t =>
|
2015-05-17 00:42:15 +00:00
|
|
|
(t, map (pair @{term C_Guard})
|
2014-07-14 19:32:44 +00:00
|
|
|
(case const_cond of SOME cond => const_global_asserts ctxt cond t
|
2015-05-17 00:42:15 +00:00
|
|
|
| NONE => [])))
|
2014-07-14 19:32:44 +00:00
|
|
|
|
2017-07-12 05:13:51 +00:00
|
|
|
val guard_htd_updates_with_domain = com_rewrite
|
2014-07-14 19:32:44 +00:00
|
|
|
(fn t => if fastype_of t = @{typ "globals myvars \<Rightarrow> globals myvars"}
|
|
|
|
andalso Term.exists_Const (fn (s, _) => s = @{const_name "hrs_htd_update"}) t
|
|
|
|
then (t, [(@{term MemorySafety}, betapply (@{term "\<lambda>f :: globals myvars \<Rightarrow> globals myvars.
|
|
|
|
{s. htd_safe domain (hrs_htd (t_hrs_' (globals s)))
|
|
|
|
\<and> htd_safe domain (hrs_htd (t_hrs_' (globals (f s))))}"}, t))])
|
|
|
|
else (t, []))
|
|
|
|
|
2014-08-29 03:57:28 +00:00
|
|
|
val guard_halt = com_rewrite
|
|
|
|
(fn t => if t = @{term "halt_'proc"}
|
|
|
|
then (t, [(@{term DontReach}, @{term "{} :: globals myvars set"})])
|
|
|
|
else (t, []))
|
|
|
|
|
2015-10-12 13:11:13 +00:00
|
|
|
fun acc_ptr_adds (Const (@{const_name h_val}, _) $ m $ (Const (@{const_name ptr_add}, _) $ p $ n))
|
|
|
|
= [(p, n, true)] @ maps acc_ptr_adds [m, p, n]
|
|
|
|
| acc_ptr_adds (Const (@{const_name heap_update}, _) $ (Const (@{const_name ptr_add}, _) $ p $ n))
|
|
|
|
= [(p, n, true)] @ maps acc_ptr_adds [p, n]
|
|
|
|
| acc_ptr_adds (Const (@{const_name ptr_add}, _) $ p $ n)
|
|
|
|
= [(p, n, false)] @ maps acc_ptr_adds [p, n]
|
|
|
|
| acc_ptr_adds (f $ x) = maps acc_ptr_adds [f, x]
|
|
|
|
| acc_ptr_adds (abs as Abs (_, T, t)) = if T = @{typ "globals myvars"}
|
|
|
|
then acc_ptr_adds (betapply (abs, @{term "s :: globals myvars"}))
|
|
|
|
else acc_ptr_adds t
|
|
|
|
| acc_ptr_adds _ = []
|
|
|
|
|
|
|
|
fun mk_bool true = @{term True} | mk_bool false = @{term False}
|
|
|
|
|
|
|
|
val guard_acc_ptr_adds = com_rewrite
|
|
|
|
(fn t => (t, acc_ptr_adds t |> map (fn (p, n, strong) => let
|
2015-12-01 22:06:06 +00:00
|
|
|
val assn = Const (@{const_name ptr_add_assertion'},
|
2015-10-12 13:11:13 +00:00
|
|
|
fastype_of p --> @{typ "int \<Rightarrow> bool \<Rightarrow> heap_typ_desc \<Rightarrow> bool"})
|
|
|
|
$ p $ n $ mk_bool strong
|
|
|
|
$ @{term "hrs_htd (t_hrs_' (globals (s :: globals myvars)))"}
|
|
|
|
val gd = HOLogic.mk_Collect ("s", @{typ "globals myvars"}, assn)
|
|
|
|
in (@{term MemorySafety}, gd) end)))
|
|
|
|
|
2014-07-14 19:32:44 +00:00
|
|
|
end
|
|
|
|
|
2019-05-26 23:45:14 +00:00
|
|
|
\<close>
|
2014-07-14 19:32:44 +00:00
|
|
|
|
2018-08-04 08:38:51 +00:00
|
|
|
cond_sorry_modifies_proofs SORRY_MODIFIES_PROOFS
|
2014-07-14 19:32:44 +00:00
|
|
|
|
2019-05-26 23:45:14 +00:00
|
|
|
local_setup \<open>
|
2014-07-14 19:32:44 +00:00
|
|
|
SubstituteSpecs.take_all_actions
|
|
|
|
"Kernel_C.kernel_all_global_addresses."
|
|
|
|
(Locale.init "Kernel_C.kernel_all_global_addresses" @{theory})
|
|
|
|
(fn ctxt => fn s => guard_rewritable_globals NONE ctxt
|
|
|
|
o (strengthen_c_guards ["memset_body", "memcpy_body", "memzero_body"]
|
|
|
|
(Proof_Context.theory_of ctxt) s)
|
2014-08-29 03:57:28 +00:00
|
|
|
o guard_halt
|
2015-10-12 13:11:13 +00:00
|
|
|
o guard_htd_updates_with_domain
|
|
|
|
o guard_acc_ptr_adds)
|
2014-07-14 19:32:44 +00:00
|
|
|
@{term kernel_all_global_addresses.\<Gamma>}
|
2017-09-13 02:18:31 +00:00
|
|
|
(CalculateState.get_csenv @{theory} "../c/build/$L4V_ARCH/kernel_all.c_pp" |> the)
|
2014-07-14 19:32:44 +00:00
|
|
|
[@{typ "globals myvars"}, @{typ int}, @{typ strictc_errortype}]
|
2019-05-26 23:45:14 +00:00
|
|
|
\<close>
|
2014-07-14 19:32:44 +00:00
|
|
|
|
|
|
|
end
|
|
|
|
|
|
|
|
end
|