fact
stringlengths 4
2k
| type
stringclasses 20
values | library
stringclasses 8
values | imports
listlengths 0
41
| filename
stringlengths 11
62
| symbolic_name
stringlengths 1
69
| docstring
stringclasses 1
value |
|---|---|---|---|---|---|---|
disj_conj_distribR : "(A \<and> B \<or> C) = ((A \<or> C) \<and> (B \<or> C))" apply (rule iffI) apply (rule conjI) apply fast apply fast apply auto done text \<open>The statement of Hoare triple lemmas are generally indented in the following way.\<close>
|
lemma
|
docs
|
[] |
docs/Style.thy
|
disj_conj_distribR
| |
my_hoare_triple_lemma : "\<lbrace>precondition_one and precondition_two and precondition three\<rbrace> my_function param_a param_b \<lbrace>post_condition\<rbrace>" oops text \<open> or \<close>
|
lemma
|
docs
|
[] |
docs/Style.thy
|
my_hoare_triple_lemma
| |
my_hoare_triple_lemma : "\<lbrace>precondition_one and precondition_two and precondition three\<rbrace> my_function param_a param_b \<lbrace>post_condition\<rbrace>" oops text \<open> Definitions, record and datatypes are generally indented as follows and generally use @{text \<open>\<equiv>\<close>} rather than @{text \<open>=\<close>}. Short datatypes can be on a single line. Note: Upstream Isabelle tends to use @{text \<open>=\<close>} rather than @{text \<open>\<equiv>\<close>}. So we don't enforce a strict rule in this case.\<close>
|
lemma
|
docs
|
[] |
docs/Style.thy
|
my_hoare_triple_lemma
| |
word_bits :: nat where "word_bits \<equiv> 32"
|
definition
|
docs
|
[] |
docs/Style.thy
|
word_bits
| |
long_defn_type :: "'this => 'is => 'a => 'long => 'type => 'that => 'does => 'not => 'fit => 'in => 'one => 'line" where "long_defn_type \<equiv> undefined"
|
definition
|
docs
|
[] |
docs/Style.thy
|
long_defn_type
| |
foo_fun :: "nat \<Rightarrow> nat" where "foo_fun 0 = 0" | "foo_fun (Suc n) = n"
|
fun
|
docs
|
[] |
docs/Style.thy
|
foo_fun
| |
cdl_cnode = cdl_cnode_caps :: type_foo cdl_cnode_size_bits :: type_bar
|
record
|
docs
|
[] |
docs/Style.thy
|
cdl_cnode
| |
cdl_object = Endpoint | Tcb type_foo | CNode cdl_cnode | Untyped
|
datatype
|
docs
|
[] |
docs/Style.thy
|
cdl_object
| |
cdl_arch = IA32 | ARM11 text \<open> There are tools to automatically indent proofs in jEdit. In terms of rules: * definition and fun should be on the same line as the name. * Everything after the first line of a definition or fun statement should be indented. * Type definitions (record, type_synonym, datatype) have the defined type on the same line, the rest only if it fits. * Avoid long hanging indentation in data types, case expressions, etc. That is: Wrong: @{term\<open> case xs_blah of [] \<Rightarrow> foo | y#ys \<Rightarrow> baz \<close>} Right: @{term\<open> case xs_blah of [] \<Rightarrow> foo | y#ys \<Rightarrow> baz \<close>}\<close> text \<open> If a definition body causes an overflow of the 100 char line limit, use one of the following two patterns.\<close>
|
datatype
|
docs
|
[] |
docs/Style.thy
|
cdl_arch
| |
hd_opt :: "'a list \<Rightarrow> 'a option" where "hd_opt \<equiv> case_list None (\<lambda>h t. Some h)"
|
definition
|
docs
|
[] |
docs/Style.thy
|
hd_opt
| |
hd_opt4 :: "'a list \<Rightarrow> 'a option" where "hd_opt4 \<equiv> case_list None (\<lambda>h t. Some h)" text \<open> If an apply line causes an overflow of the 100 char line limit, use one of the following two patterns: aligning on ":" or aligning on left.\<close>
|
definition
|
docs
|
[] |
docs/Style.thy
|
hd_opt4
| |
test_lemma0 : "\<lbrakk>hd_opt l \<noteq> None; hd_opt (hd l) = Some x\<rbrakk> \<Longrightarrow> hd_opt (concat l) = Some x" apply (clarsimp simp: hd_opt_def split: list.splits) done
|
lemma
|
docs
|
[] |
docs/Style.thy
|
test_lemma0
| |
test_lemma1 : "\<lbrakk>hd_opt l \<noteq> None; hd_opt (hd l) = Some x\<rbrakk> \<Longrightarrow> hd_opt (concat l) = Some x" apply (clarsimp simp: hd_opt_def split: list.splits) done
|
lemma
|
docs
|
[] |
docs/Style.thy
|
test_lemma1
| |
test_lemma3 : "case_option None hd_opt (hd_opt l) = Some x \<Longrightarrow> hd_opt (concat l) = Some x" apply ((cases l; simp add: hd_opt_def), rename_tac h t, case_tac h; simp) done
|
lemma
|
docs
|
[] |
docs/Style.thy
|
test_lemma3
| |
shows "\<lbrakk> A; B; C\<rbrakk> \<Longrightarrow> D" \<comment> \<open>right-wrapping OK\<close> and "\<lbrakk> A; B; C\<rbrakk> \<Longrightarrow> D" \<comment> \<open>left-wrapping OK\<close> oops \<comment> \<open>mixing styles: NOT OK\<close> text \<open> Some operators and syntax only have ONE style. As seen in other sections: * the `|` in `case` never appears on the right * `;` is always on the right when wrapping lists of assumptions * `shows .. and ... and` wraps with `and` on the left * `|` in method invocations always goes on the left * commas and (semi)colons, owing to our natural language origins, always end up on the right\<close>
|
lemma
|
docs
|
[] |
docs/Style.thy
|
shows
| |
shows "\<lbrakk> A ; B \<rbrakk> \<comment> \<open>wrong: always on right\<close> \<comment> \<open>ok: \<Longrightarrow> can be either left or right\<close> \<Longrightarrow> C" and \<comment> \<open>wrong: `shows/and` only on left!\<close> "D" and "E" \<comment> \<open>ok: on left\<close> proof - have "True \<and> True" by (rule conjI, blast, blast) \<comment> \<open>ok\<close> have "True \<and> True" by (rule conjI , blast , blast) \<comment> \<open>NOT OK: commas go on right\<close> have "True \<and> True" by (rule conjI; blast) \<comment> \<open>ok\<close> have "True \<and> True" by (rule conjI ; blast) \<comment> \<open>NOT OK: semicolons go on right\<close> have "True \<and> True" by (rule conjI | blast)+ \<comment> \<open>ok\<close> have "True \<and> True" by (rule conjI | blast)+ \<comment> \<open>NOT OK: `|` goes on the left\<close> oops text \<open> The general principle of "nothing indented less than what it belongs to" is in effect for both wrapping styles. Remember, the goal of the exercise is to make it as clear to read for others as you can. Sometimes, scanning the left side of the screen to see the overall term can help, while other times putting @{text \<Longrightarrow>} on the right will save space and prevent subsequent lines from wrapping.\<close> text \<open> Inner-syntax indentation is not automatable in the general case, so our goal is to help ease of comprehension as much as possible, i.e. @{term "A \<and> B \<or> C \<longrightarrow> D \<or> E \<and> F"} is bearable if A..F are short, but if they are large terms, please avoid doing either of these:\<close> term " A \<and> B \<or> C \<longrightarrow> D \<or> E \<and> F" \<comment> \<open>avoid: requires building a parse tree in one's head\<close> term " A \<and> B \<or> C \<longrightarrow> D \<or> E \<and> F" \<comment> \<open>can be marginally easier to scan, but still avoid due to mental parsing difficulty\<close> text \<open>Instead, help out the reader like this:\<close> term " A \<and> B...
|
lemma
|
docs
|
[] |
docs/Style.thy
|
shows
| |
conjI3 : "\<lbrakk>a; b; c\<rbrakk> \<Longrightarrow> a \<and> b \<and> c" by simp text \<open> For left operator-wrapping style, use this version. It was chosen based on being space-optimising and nice-looking (variable instantiations and rule all left-align, while operators right-align):\<close>
|
lemma
|
docs
|
[] |
docs/Style.thy
|
conjI3
| |
some_f :: "nat \<Rightarrow> nat" where "some_f x \<equiv> case x of 0 \<Rightarrow> 1 | Suc n \<Rightarrow> n+2" lemmas some_f_simps[simp] = some_f_def[split_simps nat.split] (* Pattern is simplified automatically: *)
|
definition
|
docs
|
[] |
docs/Style.thy
|
some_f
| |
long_running_ending : "True \<and> True \<and> True \<and> True \<and> True \<and> True \<and> True" apply (intro conjI) apply blast apply blast by auto \<comment> \<open>only if long-running, and note indentation!\<close>
|
lemma
|
docs
|
[] |
docs/Style.thy
|
long_running_ending
| |
my_hoare_triple_lemma : "\<lbrace>precondition_one and precondition_two and precondition three\<rbrace> my_function param_a param_b \<lbrace>post_condition\<rbrace>" unfolding my_function_def oops text \<open>instead of\<close>
|
lemma
|
docs
|
[] |
docs/Style.thy
|
my_hoare_triple_lemma
| |
my_hoare_triple_lemma : "\<lbrace>precondition_one and precondition_two and precondition three\<rbrace> my_function param_a param_b \<lbrace>post_condition\<rbrace>" apply (clarsimp simp: my_function_def) oops
|
lemma
|
docs
|
[] |
docs/Style.thy
|
my_hoare_triple_lemma
| |
ccorres_example : "ccorres rrel xf P Q hs a c" oops text \<open> where rrel is the return relation, xf is the extraction function, P is the abstract guard, Q is the concrete guard, hs is the handler stack, a is the abstract function, and c is the concrete function. If the statement can fit on a single line within the character limit, then this is best. If not, wherever possible - rrel and xf should occur on the same line, - P, Q, and hs should occur on the same line, and - a and c should occur on the same line Often the guards will require more than one line, and in this case, hs should occur on the same line as the concrete guard wherever possible. If the statement must use more than one line, all lines after the first should be indented by 2 spaces from @{term ccorres}. Here are some examples.\<close>
|
lemma
|
docs
|
[] |
docs/Style.thy
|
ccorres_example
| |
short_ccorres_example : "ccorres rrel xf short_abs_guard short_conc_guard hs short_abs_fn short_conc_fn" oops
|
lemma
|
docs
|
[] |
docs/Style.thy
|
short_ccorres_example
| |
long_ccorres_example : "ccorres rrel xf long_abs_guard long_conc_guard hs long_abs_fn long_conc_fn" oops
|
lemma
|
docs
|
[] |
docs/Style.thy
|
long_ccorres_example
| |
longer_ccorres_example : "ccorres long_rrel long_xf long_abs_guard long_conc_guard hs long_abs_fn long_conc_fn" oops text \<open> The concrete guard will often be simply @{term UNIV}, or an intersection of terms of the form @{term "\<lbrace>\<acute>pointer = cond\<rbrace>"}, which supersedes the set-builder notation wherever applicable. Note that the semantically redundant form @{term "UNIV \<inter> \<lbrace>\<acute>pointer = cond\<rbrace>"} should no longer be necessary, and should be avoided wherever possible.\<close>
|
lemma
|
docs
|
[] |
docs/Style.thy
|
longer_ccorres_example
| |
valid :: "'a \<Rightarrow> 'b \<Rightarrow> 'c \<Rightarrow> bool" ("\<lbrace>_\<rbrace>/ _ /\<lbrace>_\<rbrace>") where "\<lbrace>P\<rbrace> f \<lbrace>Q\<rbrace> \<equiv> undefined"
|
definition
|
docs
|
[] |
docs/Style_pre.thy
|
valid
| |
pred_conj :: "('a \<Rightarrow> bool) \<Rightarrow> ('a \<Rightarrow> bool) \<Rightarrow> ('a \<Rightarrow> bool)" (infixl "and" 35) where "pred_conj P Q \<equiv> \<lambda>x. P x \<and> Q x" consts my_function :: 'a
|
definition
|
docs
|
[] |
docs/Style_pre.thy
|
pred_conj
| |
where my_function_def: "my_function \<equiv> undefined"
|
axiomatization
|
docs
|
[] |
docs/Style_pre.thy
|
where
| |
ccorres :: "'a \<Rightarrow> 'b \<Rightarrow> 'c \<Rightarrow> 'd \<Rightarrow> 'e \<Rightarrow> 'f \<Rightarrow> 'g \<Rightarrow> bool" where "ccorres rrel xf P Q hs a c \<equiv> undefined"
|
definition
|
docs
|
[] |
docs/Style_pre.thy
|
ccorres
| |
c_guard :: "'h \<Rightarrow> 'i \<Rightarrow> 'd" ("\<lbrace> _ = _ \<rbrace>") where "\<lbrace> ptr = cond \<rbrace> \<equiv> undefined"
|
definition
|
docs
|
[] |
docs/Style_pre.thy
|
c_guard
| |
ptr_select :: "'h \<Rightarrow> 'h" ("\<acute>") where "ptr_select \<equiv> undefined"
|
definition
|
docs
|
[] |
docs/Style_pre.thy
|
ptr_select
| |
mk_var_app nm (f $ _) = let val (_, xs) = strip_comb f val n = length xs val T = domain_type (fastype_of f) in mk_var_app nm f $ Free (nm ^ string_of_int n, T) end | mk_var_app _ t = t
|
fun
|
lib
|
[
"Main",
"keywords",
"\"add_upd_simps\"",
"::",
"thy_decl"
] |
lib/AddUpdSimps.thy
|
mk_var_app
| |
get_upd_apps (f $ (g $ x)) = if is_Const (head_of f) andalso is_Const (head_of g) andalso domain_type (fastype_of g) = range_type (fastype_of g) then mk_var_app "x" f $ (mk_var_app "y" (g $ x)) :: get_upd_apps f @ get_upd_apps (g $ x) else get_upd_apps f @ get_upd_apps (g $ x) | get_upd_apps (f $ x) = get_upd_apps f @ get_upd_apps x | get_upd_apps (Abs (_, _, t)) = get_upd_apps t | get_upd_apps _ = []
|
fun
|
lib
|
[
"Main",
"keywords",
"\"add_upd_simps\"",
"::",
"thy_decl"
] |
lib/AddUpdSimps.thy
|
get_upd_apps
| |
mk_upd_simps ctxt upd_app (simps, done, n) = let val n = n + 1 val _ = n <= 5000 orelse raise TERM ("mk_upd_simps: 5000", [upd_app]) val (nm, _) = dest_Const (head_of upd_app) val def = Proof_Context.get_thm ctxt (nm ^ "_def") val rhs = case (mk_var_app "x" upd_app, upd_app) of (f $ _, _ $ (_ $ x)) => f $ x | _ => raise TERM ("mk_upd_simps: impossible", [upd_app]) val prop = HOLogic.mk_eq (upd_app, rhs) |> HOLogic.mk_Trueprop val thm = Thm.trivial (Thm.cterm_of ctxt prop) |> simp_tac (ctxt addsimps [def, @{thm fun_eq_iff}] addsimps simps) 1 |> Seq.hd val upd_apps_prem = Thm.prems_of thm |> maps get_upd_apps |> sort_distinct Term_Ord.fast_term_ord |> filter_out (Termtab.defined done) |> filter_out (curry (op =) upd_app) |> filter_out (head_of #> dest_Const #> fst #> String.isPrefix "HOL.") val (simps2, done, n) = fold (mk_upd_simps ctxt) upd_apps_prem (simps, done, n) val thm = Drule.export_without_context thm in if length simps2 <> length simps then mk_upd_simps ctxt upd_app (simps2, done, n) else (if Thm.nprems_of thm = 0 then thm :: simps2 else simps2, Termtab.update (upd_app, ()) done, n)
|
fun
|
lib
|
[
"Main",
"keywords",
"\"add_upd_simps\"",
"::",
"thy_decl"
] |
lib/AddUpdSimps.thy
|
mk_upd_simps
| |
mk_upd_simps_tm ctxt t = let val uas = get_upd_apps t |> sort_distinct Term_Ord.fast_term_ord val (simps, _, _) = fold (mk_upd_simps ctxt) uas ([], Termtab.empty, 0) in simps end
|
fun
|
lib
|
[
"Main",
"keywords",
"\"add_upd_simps\"",
"::",
"thy_decl"
] |
lib/AddUpdSimps.thy
|
mk_upd_simps_tm
| |
add_upd_simps t exsimps ctxt = let val thms = mk_upd_simps_tm (ctxt addsimps exsimps) t val _ = map (Thm.pretty_thm ctxt #> Pretty.writeln) thms in if null thms then ctxt else (Local_Theory.notes [((@{binding upd_simps}, []), [(thms, [])])] ctxt |> #2) addsimps thms
|
fun
|
lib
|
[
"Main",
"keywords",
"\"add_upd_simps\"",
"::",
"thy_decl"
] |
lib/AddUpdSimps.thy
|
add_upd_simps
| |
s_bcorres_underlying where "s_bcorres_underlying t f g s \<equiv> (\<lambda>(x,y). (x, t y)) ` (fst (f s)) \<subseteq> (fst (g (t s)))"
|
definition
|
lib
|
[
"Monads.Nondet_VCG",
"Crunch_Instances_NonDet"
] |
lib/BCorres_UL.thy
|
s_bcorres_underlying
| |
bcorres_underlying where "bcorres_underlying t f g \<equiv> \<forall>s. s_bcorres_underlying t f g s"
|
definition
|
lib
|
[
"Monads.Nondet_VCG",
"Crunch_Instances_NonDet"
] |
lib/BCorres_UL.thy
|
bcorres_underlying
| |
wpc_helper_bcorres : "bcorres_underlying t f g \<Longrightarrow> wpc_helper P Q (bcorres_underlying t f g)" by (simp add: wpc_helper_def split: prod.split)
|
lemma
|
lib
|
[
"Monads.Nondet_VCG",
"Crunch_Instances_NonDet"
] |
lib/BCorres_UL.thy
|
wpc_helper_bcorres
| |
wpc_helper_s_bcorres : "s_bcorres_underlying t f g s \<Longrightarrow> wpc_helper P Q (s_bcorres_underlying t f g s)" by (simp add: wpc_helper_def split: prod.split) wpc_setup "\<lambda>f. bcorres_underlying t f g" wpc_helper_bcorres wpc_setup "\<lambda>f. s_bcorres_underlying t f g s" wpc_helper_bcorres
|
lemma
|
lib
|
[
"Monads.Nondet_VCG",
"Crunch_Instances_NonDet"
] |
lib/BCorres_UL.thy
|
wpc_helper_s_bcorres
| |
s_bcorres_underlying_split [wp_split]: "(\<And>r s'. (r,s') \<in> fst (f s) \<Longrightarrow> (s_bcorres_underlying t (g r) (g' r) s')) \<Longrightarrow> s_bcorres_underlying t f f' s \<Longrightarrow> s_bcorres_underlying t (f >>= g) (f' >>= g') s" by (clarsimp simp: s_bcorres_underlying_def bind_def) force
|
lemma
|
lib
|
[
"Monads.Nondet_VCG",
"Crunch_Instances_NonDet"
] |
lib/BCorres_UL.thy
|
s_bcorres_underlying_split
| |
bcorres_underlying_split [wp_split]: "(\<And>r. (bcorres_underlying t (g r) (g' r))) \<Longrightarrow> bcorres_underlying t f f' \<Longrightarrow> bcorres_underlying t (f >>= g) (f' >>= g')" by (simp add: bcorres_underlying_def s_bcorres_underlying_split)
|
lemma
|
lib
|
[
"Monads.Nondet_VCG",
"Crunch_Instances_NonDet"
] |
lib/BCorres_UL.thy
|
bcorres_underlying_split
| |
get_s_bcorres_underlying [wp]: "s_bcorres_underlying t (f s) (f' (t s)) s \<Longrightarrow> s_bcorres_underlying t (get >>= f) (get >>= f') s" by (simp add: gets_def s_bcorres_underlying_def get_def bind_def return_def)
|
lemma
|
lib
|
[
"Monads.Nondet_VCG",
"Crunch_Instances_NonDet"
] |
lib/BCorres_UL.thy
|
get_s_bcorres_underlying
| |
get_bcorres [wp]: "(\<And>x. bcorres_underlying t (f x) (f' (t x))) \<Longrightarrow> bcorres_underlying t (get >>= f) (get >>= f')" by (simp add: bcorres_underlying_def get_s_bcorres_underlying)
|
lemma
|
lib
|
[
"Monads.Nondet_VCG",
"Crunch_Instances_NonDet"
] |
lib/BCorres_UL.thy
|
get_bcorres
| |
gets_s_bcorres_underlying [wp]: "x' (t s) = x s \<Longrightarrow> s_bcorres_underlying t (gets x) (gets x') s" by (simp add: s_bcorres_underlying_def gets_def get_def bind_def return_def)
|
lemma
|
lib
|
[
"Monads.Nondet_VCG",
"Crunch_Instances_NonDet"
] |
lib/BCorres_UL.thy
|
gets_s_bcorres_underlying
| |
gets_bcorres_underlying [wp]: "(\<And>s. x' (t s) = x s) \<Longrightarrow> bcorres_underlying t (gets x) (gets x')" by (simp add: bcorres_underlying_def gets_s_bcorres_underlying)
|
lemma
|
lib
|
[
"Monads.Nondet_VCG",
"Crunch_Instances_NonDet"
] |
lib/BCorres_UL.thy
|
gets_bcorres_underlying
| |
gets_map_bcorres_underlying [wp]: "(\<And>s. f' (t s) p = f s p) \<Longrightarrow> bcorres_underlying t (gets_map f p) (gets_map f' p)" by (simp add: gets_map_def bcorres_underlying_def s_bcorres_underlying_def simpler_gets_def bind_def assert_opt_def fail_def return_def split: option.splits)
|
lemma
|
lib
|
[
"Monads.Nondet_VCG",
"Crunch_Instances_NonDet"
] |
lib/BCorres_UL.thy
|
gets_map_bcorres_underlying
| |
gets_bcorres_underlying ': "(\<And>xa. bcorres_underlying t (f (x xa)) (f' (x' (t xa)))) \<Longrightarrow> bcorres_underlying t (gets x >>= f) (gets x' >>= f')" by (wpsimp simp: gets_def)
|
lemma
|
lib
|
[
"Monads.Nondet_VCG",
"Crunch_Instances_NonDet"
] |
lib/BCorres_UL.thy
|
gets_bcorres_underlying
| |
assert_bcorres_underlying [wp]: "f = f' \<Longrightarrow> bcorres_underlying t (assert f) (assert f')" by (simp add: assert_def bcorres_underlying_def return_def s_bcorres_underlying_def fail_def)
|
lemma
|
lib
|
[
"Monads.Nondet_VCG",
"Crunch_Instances_NonDet"
] |
lib/BCorres_UL.thy
|
assert_bcorres_underlying
| |
return_bcorres [wp]: "bcorres_underlying t (return x) (return x)" by (simp add:return_def bcorres_underlying_def s_bcorres_underlying_def)
|
lemma
|
lib
|
[
"Monads.Nondet_VCG",
"Crunch_Instances_NonDet"
] |
lib/BCorres_UL.thy
|
return_bcorres
| |
drop_sbcorres_underlying : "bcorres_underlying t f g \<Longrightarrow> s_bcorres_underlying t f g s" by (simp add: bcorres_underlying_def)
|
lemma
|
lib
|
[
"Monads.Nondet_VCG",
"Crunch_Instances_NonDet"
] |
lib/BCorres_UL.thy
|
drop_sbcorres_underlying
| |
use_sbcorres_underlying : "(\<And>s. s_bcorres_underlying t f g s) \<Longrightarrow> bcorres_underlying t f g" by (simp add: bcorres_underlying_def)
|
lemma
|
lib
|
[
"Monads.Nondet_VCG",
"Crunch_Instances_NonDet"
] |
lib/BCorres_UL.thy
|
use_sbcorres_underlying
| |
bcorres_underlying_throwError [wp]: "bcorres_underlying t (throwError a) (throwError a)" by (wpsimp simp: throwError_def)
|
lemma
|
lib
|
[
"Monads.Nondet_VCG",
"Crunch_Instances_NonDet"
] |
lib/BCorres_UL.thy
|
bcorres_underlying_throwError
| |
s_bcorres_underlying_splitE [wp_split]: "(\<And>r s'. (Inr r,s') \<in> fst (f s) \<Longrightarrow> s_bcorres_underlying t (g r) (g' r) s') \<Longrightarrow> s_bcorres_underlying t f f' s \<Longrightarrow> s_bcorres_underlying t (f >>=E g) (f' >>=E g') s" by (wpsimp simp: bindE_def lift_def split: sum.splits | rule conjI drop_sbcorres_underlying)+
|
lemma
|
lib
|
[
"Monads.Nondet_VCG",
"Crunch_Instances_NonDet"
] |
lib/BCorres_UL.thy
|
s_bcorres_underlying_splitE
| |
get_s_bcorres_underlyingE [wp]: "s_bcorres_underlying t (f s) (f' (t s)) s \<Longrightarrow> s_bcorres_underlying t (liftE get >>=E f) (liftE get >>=E f') s" by (simp add: gets_def s_bcorres_underlying_def get_def bindE_def bind_def return_def liftE_def lift_def)
|
lemma
|
lib
|
[
"Monads.Nondet_VCG",
"Crunch_Instances_NonDet"
] |
lib/BCorres_UL.thy
|
get_s_bcorres_underlyingE
| |
bcorres_underlying_splitE [wp_split]: "(\<And>r. bcorres_underlying t (g r) (g' r)) \<Longrightarrow> bcorres_underlying t f f' \<Longrightarrow> bcorres_underlying t (f >>=E g) (f' >>=E g')" by (simp add: bcorres_underlying_def s_bcorres_underlying_splitE) lemmas return_s_bcorres_underlying[wp] = drop_sbcorres_underlying[OF return_bcorres]
|
lemma
|
lib
|
[
"Monads.Nondet_VCG",
"Crunch_Instances_NonDet"
] |
lib/BCorres_UL.thy
|
bcorres_underlying_splitE
| |
liftE_s_bcorres_underlying [wp]: "s_bcorres_underlying t f f' s \<Longrightarrow> s_bcorres_underlying t (liftE f) (liftE f') s" by (wpsimp simp: liftE_def)
|
lemma
|
lib
|
[
"Monads.Nondet_VCG",
"Crunch_Instances_NonDet"
] |
lib/BCorres_UL.thy
|
liftE_s_bcorres_underlying
| |
liftE_bcorres_underlying [wp]: "bcorres_underlying t f f' \<Longrightarrow> bcorres_underlying t (liftE f) (liftE f')" by (simp add: bcorres_underlying_def liftE_s_bcorres_underlying)
|
lemma
|
lib
|
[
"Monads.Nondet_VCG",
"Crunch_Instances_NonDet"
] |
lib/BCorres_UL.thy
|
liftE_bcorres_underlying
| |
returnOk_bcorres_underlying [wp]: "bcorres_underlying t (returnOk x) (returnOk x)" by (wpsimp simp: returnOk_def)
|
lemma
|
lib
|
[
"Monads.Nondet_VCG",
"Crunch_Instances_NonDet"
] |
lib/BCorres_UL.thy
|
returnOk_bcorres_underlying
| |
whenE_s_bcorres_underlying [wp]: "\<lbrakk> \<lbrakk>P = P'; P\<rbrakk> \<Longrightarrow> s_bcorres_underlying t f f' s; P = P' \<rbrakk> \<Longrightarrow> s_bcorres_underlying t (whenE P f) (whenE P' f') s" by (wpsimp simp: whenE_def|rule drop_sbcorres_underlying)+
|
lemma
|
lib
|
[
"Monads.Nondet_VCG",
"Crunch_Instances_NonDet"
] |
lib/BCorres_UL.thy
|
whenE_s_bcorres_underlying
| |
select_s_bcorres_underlying [wp]: "A \<subseteq> B \<Longrightarrow> s_bcorres_underlying t (select A) (select B) s" by (simp add: s_bcorres_underlying_def select_def image_def) blast
|
lemma
|
lib
|
[
"Monads.Nondet_VCG",
"Crunch_Instances_NonDet"
] |
lib/BCorres_UL.thy
|
select_s_bcorres_underlying
| |
fail_s_bcorres_underlying [wp]: "s_bcorres_underlying t fail fail s" by (simp add: s_bcorres_underlying_def fail_def)
|
lemma
|
lib
|
[
"Monads.Nondet_VCG",
"Crunch_Instances_NonDet"
] |
lib/BCorres_UL.thy
|
fail_s_bcorres_underlying
| |
fail_bcorres_underlying [wp]: "bcorres_underlying t fail fail" by (simp add: bcorres_underlying_def fail_s_bcorres_underlying)
|
lemma
|
lib
|
[
"Monads.Nondet_VCG",
"Crunch_Instances_NonDet"
] |
lib/BCorres_UL.thy
|
fail_bcorres_underlying
| |
assertE_bcorres_underlying [wp]: "bcorres_underlying t (assertE P) (assertE P)" by (wpsimp simp: assertE_def returnOk_def|rule conjI)+ lemmas assertE_s_bcorres_underlying[wp] = drop_sbcorres_underlying[OF assertE_bcorres_underlying]
|
lemma
|
lib
|
[
"Monads.Nondet_VCG",
"Crunch_Instances_NonDet"
] |
lib/BCorres_UL.thy
|
assertE_bcorres_underlying
| |
when_s_bcorres_underlying [wp]: "(P \<Longrightarrow> s_bcorres_underlying t f f' s) \<Longrightarrow> s_bcorres_underlying t (when P f) (when P f') s" by (simp add: return_s_bcorres_underlying when_def)
|
lemma
|
lib
|
[
"Monads.Nondet_VCG",
"Crunch_Instances_NonDet"
] |
lib/BCorres_UL.thy
|
when_s_bcorres_underlying
| |
when_bcorres_underlying [wp]: "(P \<Longrightarrow> bcorres_underlying t f f') \<Longrightarrow> bcorres_underlying t (when P f) (when P f')" by (simp add: bcorres_underlying_def when_s_bcorres_underlying)
|
lemma
|
lib
|
[
"Monads.Nondet_VCG",
"Crunch_Instances_NonDet"
] |
lib/BCorres_UL.thy
|
when_bcorres_underlying
| |
put_bcorres_underlying [wp]: "t f = f' \<Longrightarrow> bcorres_underlying t (put f) (put f')" by (simp add: bcorres_underlying_def s_bcorres_underlying_def put_def)
|
lemma
|
lib
|
[
"Monads.Nondet_VCG",
"Crunch_Instances_NonDet"
] |
lib/BCorres_UL.thy
|
put_bcorres_underlying
| |
modify_bcorres_underlying [wp]: "(\<And>x. t (f x) = f' (t x)) \<Longrightarrow> bcorres_underlying t (modify f) (modify f')" by (wpsimp simp: modify_def)
|
lemma
|
lib
|
[
"Monads.Nondet_VCG",
"Crunch_Instances_NonDet"
] |
lib/BCorres_UL.thy
|
modify_bcorres_underlying
| |
liftM_bcorres_underlying [wp]: "bcorres_underlying t m m' \<Longrightarrow> bcorres_underlying t (liftM f m) (liftM f m')" by (wpsimp simp: liftM_def)
|
lemma
|
lib
|
[
"Monads.Nondet_VCG",
"Crunch_Instances_NonDet"
] |
lib/BCorres_UL.thy
|
liftM_bcorres_underlying
| |
sequence_x_bcorres_underlying [wp]: "(\<And>x. bcorres_underlying t (f x) (f' x)) \<Longrightarrow> bcorres_underlying t (sequence_x (map f xs)) (sequence_x (map f' xs))" by (induct xs; wpsimp simp: sequence_x_def)
|
lemma
|
lib
|
[
"Monads.Nondet_VCG",
"Crunch_Instances_NonDet"
] |
lib/BCorres_UL.thy
|
sequence_x_bcorres_underlying
| |
sequence_bcorres_underlying [wp]: "(\<And>x. bcorres_underlying t (f x) (f' x)) \<Longrightarrow> bcorres_underlying t (sequence (map f xs)) (sequence (map f' xs))" by (induct xs; wpsimp simp: sequence_def)
|
lemma
|
lib
|
[
"Monads.Nondet_VCG",
"Crunch_Instances_NonDet"
] |
lib/BCorres_UL.thy
|
sequence_bcorres_underlying
| |
mapM_x_bcorres_underlying [wp]: "(\<And>x. bcorres_underlying t (f x) (f' x)) \<Longrightarrow> bcorres_underlying t (mapM_x f xs) (mapM_x f' xs)" by (wpsimp simp: mapM_x_def)
|
lemma
|
lib
|
[
"Monads.Nondet_VCG",
"Crunch_Instances_NonDet"
] |
lib/BCorres_UL.thy
|
mapM_x_bcorres_underlying
| |
mapM_bcorres_underlying [wp]: "(\<And>x. bcorres_underlying t (f x) (f' x)) \<Longrightarrow> bcorres_underlying t (mapM f xs) (mapM f' xs)" by (simp add: mapM_def | wp)+
|
lemma
|
lib
|
[
"Monads.Nondet_VCG",
"Crunch_Instances_NonDet"
] |
lib/BCorres_UL.thy
|
mapM_bcorres_underlying
| |
gets_s_bcorres_underlyingE ': "s_bcorres_underlying t (f (x s)) (f' (x' (t s))) s \<Longrightarrow> s_bcorres_underlying t (liftE (gets x) >>=E f) (liftE (gets x') >>=E f') s" by (simp add: gets_def liftE_def lift_def bindE_def) wp
|
lemma
|
lib
|
[
"Monads.Nondet_VCG",
"Crunch_Instances_NonDet"
] |
lib/BCorres_UL.thy
|
gets_s_bcorres_underlyingE
| |
bcorres_underlying_filterM [wp]: "(\<And>x. bcorres_underlying t (a x) (a' x)) \<Longrightarrow> bcorres_underlying t (filterM a b) (filterM a' b)" by (induct b; wpsimp simp: filterM_def)
|
lemma
|
lib
|
[
"Monads.Nondet_VCG",
"Crunch_Instances_NonDet"
] |
lib/BCorres_UL.thy
|
bcorres_underlying_filterM
| |
option_rec_bcorres_underlying [wp_split]: "(\<And>x y. bcorres_underlying t (g x y) (g' x y)) \<Longrightarrow> (\<And>x. bcorres_underlying t (f x) (f' x)) \<Longrightarrow> bcorres_underlying t (rec_option f g a b) (rec_option f' g' a b)" by (cases a, simp+)
|
lemma
|
lib
|
[
"Monads.Nondet_VCG",
"Crunch_Instances_NonDet"
] |
lib/BCorres_UL.thy
|
option_rec_bcorres_underlying
| |
bcorres_underlying_mapME [wp]: "(\<And>x. bcorres_underlying t (f x) (f' x)) \<Longrightarrow> bcorres_underlying t (mapME f r) (mapME f' r)" by (induct r; wpsimp simp: mapME_def sequenceE_def)
|
lemma
|
lib
|
[
"Monads.Nondet_VCG",
"Crunch_Instances_NonDet"
] |
lib/BCorres_UL.thy
|
bcorres_underlying_mapME
| |
handle2_bcorres_underlying [wp]: "bcorres_underlying t f f' \<Longrightarrow> (\<And>x. bcorres_underlying t (g x) (g' x)) \<Longrightarrow> bcorres_underlying t (f <handle2> g) (f' <handle2> g')" by (wpsimp simp: handleE'_def)
|
lemma
|
lib
|
[
"Monads.Nondet_VCG",
"Crunch_Instances_NonDet"
] |
lib/BCorres_UL.thy
|
handle2_bcorres_underlying
| |
liftME_bcorres_underlying [wp]: "bcorres_underlying t f f' \<Longrightarrow> bcorres_underlying t (liftME a f) (liftME a f')" by (wpsimp simp: liftME_def)
|
lemma
|
lib
|
[
"Monads.Nondet_VCG",
"Crunch_Instances_NonDet"
] |
lib/BCorres_UL.thy
|
liftME_bcorres_underlying
| |
zipWithM_x_bcorres [wp]: "(\<And>x y. bcorres_underlying t (f x y) (f' x y) ) \<Longrightarrow> bcorres_underlying t (zipWithM_x f xs ys) (zipWithM_x f' xs ys)" by (wpsimp simp: zipWithM_x_def zipWith_def split_def)
|
lemma
|
lib
|
[
"Monads.Nondet_VCG",
"Crunch_Instances_NonDet"
] |
lib/BCorres_UL.thy
|
zipWithM_x_bcorres
| |
mapME_x_bcorres_underlying [wp]: "(\<And>x. bcorres_underlying t (f x) (f' x)) \<Longrightarrow> bcorres_underlying t (mapME_x f xs) (mapME_x f' xs)" by (induct xs; wpsimp simp: mapME_x_def sequenceE_x_def)
|
lemma
|
lib
|
[
"Monads.Nondet_VCG",
"Crunch_Instances_NonDet"
] |
lib/BCorres_UL.thy
|
mapME_x_bcorres_underlying
| |
liftE_bind_bcorres [wp]: "bcorres_underlying t (f >>= g) (f' >>= g') \<Longrightarrow> bcorres_underlying t (liftE f >>=E g) (liftE f' >>=E g')" by (simp add: gets_def bcorres_underlying_def s_bcorres_underlying_def get_def bind_def return_def split_def liftE_def bindE_def lift_def)
|
lemma
|
lib
|
[
"Monads.Nondet_VCG",
"Crunch_Instances_NonDet"
] |
lib/BCorres_UL.thy
|
liftE_bind_bcorres
| |
select_f_bcorres [wp]: "bcorres_underlying t (select_f f) (select_f f)" by (fastforce simp: select_f_def bcorres_underlying_def s_bcorres_underlying_def)
|
lemma
|
lib
|
[
"Monads.Nondet_VCG",
"Crunch_Instances_NonDet"
] |
lib/BCorres_UL.thy
|
select_f_bcorres
| |
bcorres_underlying_if [wp]: "(b \<Longrightarrow> bcorres_underlying t f f') \<Longrightarrow> (\<not>b \<Longrightarrow> bcorres_underlying t g g') \<Longrightarrow> bcorres_underlying t (if b then f else g) (if b then f' else g')" by (case_tac b; simp)
|
lemma
|
lib
|
[
"Monads.Nondet_VCG",
"Crunch_Instances_NonDet"
] |
lib/BCorres_UL.thy
|
bcorres_underlying_if
| |
assert_opt_bcorres_underlying [wp]: "bcorres_underlying t (assert_opt f) (assert_opt f)" by (wpsimp simp: assert_opt_def)
|
lemma
|
lib
|
[
"Monads.Nondet_VCG",
"Crunch_Instances_NonDet"
] |
lib/BCorres_UL.thy
|
assert_opt_bcorres_underlying
| |
unlessb_corres_underlying [wp]: "bcorres_underlying t f f' \<Longrightarrow> bcorres_underlying t (unless a f) (unless a f')" by (wpsimp simp: unless_def)
|
lemma
|
lib
|
[
"Monads.Nondet_VCG",
"Crunch_Instances_NonDet"
] |
lib/BCorres_UL.thy
|
unlessb_corres_underlying
| |
select_bcorres_underlying [wp]: "A \<subseteq> B \<Longrightarrow> bcorres_underlying t (select A) (select B)" by (fastforce simp: bcorres_underlying_def select_def s_bcorres_underlying_def)
|
lemma
|
lib
|
[
"Monads.Nondet_VCG",
"Crunch_Instances_NonDet"
] |
lib/BCorres_UL.thy
|
select_bcorres_underlying
| |
catch_bcorres [wp]: "bcorres_underlying t f f' \<Longrightarrow> (\<And>x. bcorres_underlying t (g x) (g' x)) \<Longrightarrow> bcorres_underlying t (f <catch> g) (f' <catch> g')" unfolding catch_def by wpsimp
|
lemma
|
lib
|
[
"Monads.Nondet_VCG",
"Crunch_Instances_NonDet"
] |
lib/BCorres_UL.thy
|
catch_bcorres
| |
whenE_bcorres_underlying [wp]: "\<lbrakk> \<lbrakk>P = P'; P\<rbrakk> \<Longrightarrow> bcorres_underlying t f f'; P = P' \<rbrakk> \<Longrightarrow> bcorres_underlying t (whenE P f) (whenE P' f')" unfolding whenE_def by wpsimp
|
lemma
|
lib
|
[
"Monads.Nondet_VCG",
"Crunch_Instances_NonDet"
] |
lib/BCorres_UL.thy
|
whenE_bcorres_underlying
| |
unlessE_bcorres [wp]: "bcorres_underlying t f f' \<Longrightarrow> bcorres_underlying t (unlessE P f) (unlessE P f')" by (wpsimp simp: unlessE_def)
|
lemma
|
lib
|
[
"Monads.Nondet_VCG",
"Crunch_Instances_NonDet"
] |
lib/BCorres_UL.thy
|
unlessE_bcorres
| |
alternative_bcorres [wp]: "\<lbrakk> bcorres_underlying t f f'; bcorres_underlying t g g' \<rbrakk> \<Longrightarrow> bcorres_underlying t (f \<sqinter> g) (f' \<sqinter> g')" by (fastforce simp: alternative_def bcorres_underlying_def s_bcorres_underlying_def)
|
lemma
|
lib
|
[
"Monads.Nondet_VCG",
"Crunch_Instances_NonDet"
] |
lib/BCorres_UL.thy
|
alternative_bcorres
| |
gets_the_bcorres_underlying [wp]: "(\<And>s. f' (t s) = f s) \<Longrightarrow> bcorres_underlying t (gets_the f) (gets_the f')" by (wpsimp simp: gets_the_def)
|
lemma
|
lib
|
[
"Monads.Nondet_VCG",
"Crunch_Instances_NonDet"
] |
lib/BCorres_UL.thy
|
gets_the_bcorres_underlying
| |
maybeM_bcorres_underlying [wp]: "\<lbrakk>\<And>x. y = Some x \<Longrightarrow> bcorres_underlying t (f x) (f' x)\<rbrakk> \<Longrightarrow> bcorres_underlying t (maybeM f y) (maybeM f' y)" by (wpsimp simp: maybeM_def) ML \<open> structure CrunchBCorresInstance : CrunchInstance = struct val name = "bcorres"; val prefix_name_scheme = false; type extra = term; val eq_extra = ae_conv;
|
lemma
|
lib
|
[
"Monads.Nondet_VCG",
"Crunch_Instances_NonDet"
] |
lib/BCorres_UL.thy
|
maybeM_bcorres_underlying
| |
bisim_underlying :: "('a \<Rightarrow> 'b \<Rightarrow> bool) \<Rightarrow> ('c \<Rightarrow> 'd \<Rightarrow> bool) \<Rightarrow> ('a \<Rightarrow> bool) \<Rightarrow> ('b \<Rightarrow> bool) \<Rightarrow> ('a \<Rightarrow> (('c \<times> 'a) set) \<times> bool) \<Rightarrow> ('b \<Rightarrow> (('d \<times> 'b) set) \<times> bool) \<Rightarrow> bool" where "bisim_underlying SR R P P' m m' \<equiv> \<forall>s s'. SR s s' \<and> P s \<and> P' s' \<longrightarrow> ((\<forall>(r, t) \<in> fst (m s). \<exists>(r', t') \<in> fst (m' s'). R r r' \<and> SR t t') \<and> (\<forall>(r', t') \<in> fst (m' s'). \<exists>(r, t) \<in> fst (m s). R r r' \<and> SR t t'))" (*
|
definition
|
lib
|
[
"Monads.Nondet_VCG",
"Corres_UL",
"Monads.Nondet_Empty_Fail"
] |
lib/Bisim_UL.thy
|
bisim_underlying
| |
bisim_is_corres_both_ways : "bisim_underlying SR R P P' m m' = (corres_underlying SR False R P P' m m' \<and> corres_underlying (converse SR) False (swp R) P' P m' m)" unfolding bisim_underlying_def corres_underlying_def by (fastforce simp: swp_def Ball_def Bex_def) *)
|
lemma
|
lib
|
[
"Monads.Nondet_VCG",
"Corres_UL",
"Monads.Nondet_Empty_Fail"
] |
lib/Bisim_UL.thy
|
bisim_is_corres_both_ways
| |
bisim_valid : assumes ac: "bisim_underlying (=) (=) P P' a a'" and rl: "\<lbrace>Q\<rbrace> a \<lbrace>S\<rbrace>" shows "\<lbrace>P and P' and Q\<rbrace> a' \<lbrace>S\<rbrace>" using ac rl unfolding bisim_underlying_def valid_def by (fastforce simp: split_def)
|
lemma
|
lib
|
[
"Monads.Nondet_VCG",
"Corres_UL",
"Monads.Nondet_Empty_Fail"
] |
lib/Bisim_UL.thy
|
bisim_valid
| |
bisim_valid2 : assumes ac: "bisim_underlying (=) (=) P P' a a'" and rl: "\<lbrace>Q\<rbrace> a' \<lbrace>S\<rbrace>" shows "\<lbrace>P and P' and Q\<rbrace> a \<lbrace>S\<rbrace>" using ac rl unfolding bisim_underlying_def valid_def by (fastforce simp: split_def)
|
lemma
|
lib
|
[
"Monads.Nondet_VCG",
"Corres_UL",
"Monads.Nondet_Empty_Fail"
] |
lib/Bisim_UL.thy
|
bisim_valid2
| |
bisim_underlyingI [consumes 0, case_names Left Right]: assumes r1: "\<And>s s' r t. \<lbrakk>SR s s'; P s; P' s'; (r, t) \<in> fst (m s) \<rbrakk> \<Longrightarrow> \<exists>(r', t') \<in> fst (m' s'). R r r' \<and> SR t t'" and r2: "\<And>s s' r' t'. \<lbrakk>SR s s'; P s; P' s'; (r', t') \<in> fst (m' s') \<rbrakk> \<Longrightarrow> \<exists>(r, t) \<in> fst (m s). R r r' \<and> SR t t'" shows "bisim_underlying SR R P P' m m'" unfolding bisim_underlying_def by (fastforce dest: r1 r2 simp: split_def)
|
lemma
|
lib
|
[
"Monads.Nondet_VCG",
"Corres_UL",
"Monads.Nondet_Empty_Fail"
] |
lib/Bisim_UL.thy
|
bisim_underlyingI
| |
bisim_underlyingE1 : assumes bs: "bisim_underlying SR R P P' m m'" and sr: "SR s s'" and ps: "P s" "P' s'" and ms: "(r, t) \<in> fst (m s)" and rl: "\<And>r' t'. \<lbrakk> (r', t') \<in> fst (m' s'); R r r'; SR t t' \<rbrakk> \<Longrightarrow> X" shows X using bs sr ps ms unfolding bisim_underlying_def by (fastforce intro: rl)
|
lemma
|
lib
|
[
"Monads.Nondet_VCG",
"Corres_UL",
"Monads.Nondet_Empty_Fail"
] |
lib/Bisim_UL.thy
|
bisim_underlyingE1
| |
bisim_underlyingE2 : assumes bs: "bisim_underlying SR R P P' m m'" and sr: "SR s s'" and ps: "P s" "P' s'" and ms: "(r', t') \<in> fst (m' s')" and rl: "\<And>r t. \<lbrakk> (r, t) \<in> fst (m s); R r r'; SR t t' \<rbrakk> \<Longrightarrow> X" shows X using bs sr ps ms unfolding bisim_underlying_def by (fastforce intro: rl)
|
lemma
|
lib
|
[
"Monads.Nondet_VCG",
"Corres_UL",
"Monads.Nondet_Empty_Fail"
] |
lib/Bisim_UL.thy
|
bisim_underlyingE2
|
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.