Commit ccafa39b by wenzelm

### eliminated old 'def' command;

 ... ... @@ -4588,7 +4588,7 @@ proof rule thus "\y\ccpo_class.iterates g. f x \ y" .. next case (Sup M) def N \ "{SOME y. y\ccpo_class.iterates g \ x\y | x. x\M}" define N where "N = {SOME y. y\ccpo_class.iterates g \ x\y | x. x\M}" have N1: "\y\N. y\ccpo_class.iterates g \ (\x\M. x\y)" unfolding N_def ... ...
 ... ... @@ -908,7 +908,7 @@ begin proof - assume R0: "r 0 \ V0" and RS: "\i. (r i, r (Suc i)) \ E" def r'\"rec_nat define r' where "r' = rec_nat (r 0,0) (\i (q,n). (r (Suc i), if n \ acc q then (n+1) mod num_acc else n))" ... ... @@ -926,7 +926,8 @@ begin have R0': "r' 0 \ degen.V0 T m" using R0 unfolding degeneralize_ext_def by auto have MAP: "r = fst o r'" proof (rule ext) have MAP: "r = fst o r'" proof (rule ext) fix i show "r i = (fst o r') i" by (cases i) (auto simp: split: prod.split) ... ... @@ -979,7 +980,7 @@ begin assumes RI: "r i = (q,n)" shows "\j\i. \q'. r j = (q',n) \ n \ acc q'" proof - def j \ "LEAST j. j\i \ n \ acc (fst (r j))" define j where "j = (LEAST j. j\i \ n \ acc (fst (r j)))" from RI have "n "LEAST k. i snd (r k) \ n" define k where "k = (LEAST k. i snd (r k) \ n)" have "i n" by (metis (lifting, mono_tags) LeastI_ex A k_def leD less_linear snd_conv)+ ... ...
 ... ... @@ -84,7 +84,8 @@ begin from init_sim obtain rb0 where rel0: "(ra 0, rb0) \ R" and binit: "rb0 \ b.V0" by (auto intro: ainit) def rb \ "rec_nat rb0 (\i rbi. SOME rbsi. (rbi, rbsi) \ b.E \ (ra (Suc i), rbsi) \ R)" define rb where "rb = rec_nat rb0 (\i rbi. SOME rbsi. (rbi, rbsi) \ b.E \ (ra (Suc i), rbsi) \ R)" have [simp]: "rb 0 = rb0" ... ...
 ... ... @@ -515,16 +515,16 @@ proof - " let "REC\<^sub>T ?body ?init" = "?dfs_red" def pre \ "\S (V,u0). gen_dfs_pre E U S V u0 \ E``V \ onstack = {}" def post \ "\S (V0,u0) (V,cyc). gen_dfs_post E U S V0 u0 V (cyc\None) define pre where "pre = (\S (V,u0). gen_dfs_pre E U S V u0 \ E``V \ onstack = {})" define post where "post = (\S (V0,u0) (V,cyc). gen_dfs_post E U S V0 u0 V (cyc\None) \ (case cyc of None \ E``V \ onstack = {} | Some (p,v) \ v\onstack \ p\[] \ path E u0 p v) | Some (p,v) \ v\onstack \ p\[] \ path E u0 p v)) " def fe_inv \ "\S V0 u0 it (V,cyc). define fe_inv where "fe_inv = (\S V0 u0 it (V,cyc). gen_dfs_fe_inv E U S V0 u0 it V (cyc\None) \ (case cyc of None \ E``V \ onstack = {} | Some (p,v) \ v\onstack \ p\[] \ path E u0 p v) | Some (p,v) \ v\onstack \ p\[] \ path E u0 p v)) " ... ... @@ -671,14 +671,14 @@ proof - let ?U = "?E\<^sup>*``?V0" def add_inv \ "\blues reds onstack. define add_inv where "add_inv = (\blues reds onstack. \(\v\(blues-onstack)\?A. (v,v)\?E\<^sup>+) (* No cycles over finished, accepting states *) \ reds \ blues (* Red nodes are also blue *) \ reds \ onstack = {} (* No red nodes on stack *) \ red_dfs_inv ?E ?U reds onstack" \ red_dfs_inv ?E ?U reds onstack)" def cyc_post \ "\blues reds onstack u0 cyc. (case cyc of define cyc_post where "cyc_post = (\blues reds onstack u0 cyc. (case cyc of NO_CYC \ add_inv blues reds onstack | REACH u p \ path ?E u0 p u ... ... @@ -689,22 +689,22 @@ proof - \ path ?E v pl v \ path ?E u0 pr v \ set pl \ ?A \ {} )" ))" def pre \ "\(blues,reds,onstack,u::'v). gen_dfs_pre ?E ?U onstack blues u \ add_inv blues reds onstack" define pre where "pre = (\(blues,reds,onstack,u::'v). gen_dfs_pre ?E ?U onstack blues u \ add_inv blues reds onstack)" def post \ "\(blues0,reds0::'v set,onstack0,u0) (blues,reds,onstack,cyc). define post where "post = (\(blues0,reds0::'v set,onstack0,u0) (blues,reds,onstack,cyc). onstack = onstack0 \ gen_dfs_post ?E ?U onstack0 blues0 u0 blues (cyc\NO_CYC) \ cyc_post blues reds onstack u0 cyc" \ cyc_post blues reds onstack u0 cyc)" def fe_inv \ "\blues0 u0 onstack0 it (blues,reds,onstack,cyc). define fe_inv where "fe_inv = (\blues0 u0 onstack0 it (blues,reds,onstack,cyc). onstack=onstack0 \ gen_dfs_fe_inv ?E ?U onstack0 blues0 u0 it blues (cyc\NO_CYC) \ cyc_post blues reds onstack u0 cyc" \ cyc_post blues reds onstack u0 cyc)" def outer_inv \ "\it (blues,reds,cyc). define outer_inv where "outer_inv = (\it (blues,reds,cyc). case cyc of NO_CYC \ add_inv blues reds {} ... ... @@ -714,7 +714,7 @@ proof - \ path ?E v pl v \ path ?E v0 pr v \ set pl \ ?A \ {} | _ \ False" | _ \ False)" have OUTER_INITIAL: "outer_inv V0 ({}, {}, NO_CYC)" unfolding outer_inv_def add_inv_def ... ...
 ... ... @@ -416,16 +416,16 @@ proof - " let "REC\<^sub>T ?body ?init" = "?dfs_red" def pre \ "\S (V,u0). gen_dfs_pre E U S V u0 \ E``V \ onstack = {}" def post \ "\S (V0,u0) (V,cyc). gen_dfs_post E U S V0 u0 V (cyc\None) define pre where "pre = (\S (V,u0). gen_dfs_pre E U S V u0 \ E``V \ onstack = {})" define post where "post = (\S (V0,u0) (V,cyc). gen_dfs_post E U S V0 u0 V (cyc\None) \ (case cyc of None \ E``V \ onstack = {} | Some (p,v) \ v\onstack \ p\[] \ path E u0 p v) | Some (p,v) \ v\onstack \ p\[] \ path E u0 p v)) " def fe_inv \ "\S V0 u0 it (V,cyc). define fe_inv where "fe_inv = (\S V0 u0 it (V,cyc). gen_dfs_fe_inv E U S V0 u0 it V (cyc\None) \ (case cyc of None \ E``V \ onstack = {} | Some (p,v) \ v\onstack \ p\[] \ path E u0 p v) | Some (p,v) \ v\onstack \ p\[] \ path E u0 p v)) " ... ... @@ -592,32 +592,32 @@ proof - let ?U = "E\<^sup>*``{v0}" def add_inv \ "\blues reds onstack. define add_inv where "add_inv = (\blues reds onstack. \(\v\(blues-onstack)\A. (v,v)\E\<^sup>+) (* No cycles over finished, accepting states *) \ reds \ blues (* Red nodes are also blue *) \ reds \ onstack = {} (* No red nodes on stack *) \ red_dfs_inv E ?U reds onstack" \ red_dfs_inv E ?U reds onstack)" def cyc_post \ "\blues reds onstack u0 cyc. (case cyc of define cyc_post where "cyc_post = (\blues reds onstack u0 cyc. (case cyc of NO_CYC \ add_inv blues reds onstack | REACH v p u p' \ v\A \ u\onstack-{u0} \ p\[] \ path E v p u \ path E u0 p' v | CIRC v pc pr \ v\A \ pc\[] \ path E v pc v \ path E u0 pr v )" ))" def pre \ "\(blues,reds,onstack,u). gen_dfs_pre E ?U onstack blues u \ add_inv blues reds onstack" define pre where "pre = (\(blues,reds,onstack,u). gen_dfs_pre E ?U onstack blues u \ add_inv blues reds onstack)" def post \ "\(blues0,reds0::'v set,onstack0,u0) (blues,reds,onstack,cyc). define post where "post = (\(blues0,reds0::'v set,onstack0,u0) (blues,reds,onstack,cyc). onstack = onstack0 \ gen_dfs_post E ?U onstack0 blues0 u0 blues (cyc\NO_CYC) \ cyc_post blues reds onstack u0 cyc" \ cyc_post blues reds onstack u0 cyc)" def fe_inv \ "\blues0 u0 onstack0 it (blues,reds,onstack,cyc). define fe_inv where "fe_inv = (\blues0 u0 onstack0 it (blues,reds,onstack,cyc). onstack=onstack0 \ gen_dfs_fe_inv E ?U onstack0 blues0 u0 it blues (cyc\NO_CYC) \ cyc_post blues reds onstack u0 cyc" \ cyc_post blues reds onstack u0 cyc)" have GENPRE: "gen_dfs_pre E ?U {} {} v0" apply (auto intro: gen_dfs_pre_initial) ... ...
 ... ... @@ -725,14 +725,13 @@ lemma ahm_rehash_aux_correct: shows "ahm_invar_aux bhc n (ahm_rehash_aux bhc a sz)" (is "?thesis1") and "ahm_\_aux bhc (ahm_rehash_aux bhc a sz) = ahm_\_aux bhc a" (is "?thesis2") proof - thm ahm_rehash_aux'_def let ?a = "ahm_rehash_aux bhc a sz" def I \ "\it a'. define I where "I it a' \ ahm_invar_aux bhc (n - card it) a' \ array_length a' = sz \ (\k. if k \ it then ahm_\_aux bhc a' k = None else ahm_\_aux bhc a' k = ahm_\_aux bhc a k)" else ahm_\_aux bhc a' k = ahm_\_aux bhc a k)" for it a' note iterator_rule = map_iterator_no_cond_rule_P[ OF ahm_iteratei_aux_impl[OF inv bhc], ... ...
 ... ... @@ -182,7 +182,7 @@ begin fix s i assume "invar s" "i < length (\ s)" def l \ "\ s" define l where "l = \ s" from `i < length (\ s)` show "it_get s i = \ s ! i" unfolding it_get_def iteratei_correct l_def[symmetric] ... ...
 ... ... @@ -572,7 +572,7 @@ begin unfolding transforms_to_unique_keys_def inj_on_def Ball_def map_to_set_def by auto (metis option.inject) def vP \ "\k v. \k' v'. m1.\ m k' = Some v' \ f (k', v') = Some (k, v)" define vP where "vP k v \ (\k' v'. m1.\ m k' = Some v' \ f (k', v') = Some (k, v))" for k v have vP_intro: "\k v. (\k' v'. m1.\ m k' = Some v' \ f (k', v') = Some (k, v)) \ vP k v" unfolding vP_def by simp ... ... @@ -667,4 +667,3 @@ sublocale g_value_image_filter_loc end
 ... ... @@ -164,7 +164,7 @@ begin show "iam_rev_iterateoi m = foldli kvs" unfolding iam_rev_iterateoi_foldli_conv kvs_def by simp next def al \ "array_length m" define al where "al = array_length m" show dist_kvs: "distinct (map fst kvs)" and "sorted (rev (map fst kvs))" unfolding kvs_def al_def[symmetric] apply (induct al) ... ... @@ -242,7 +242,7 @@ begin show "iam_iterateoi m = foldli kvs" unfolding iam_iterateoi_foldli_conv kvs_def by simp next def al \ "array_length m::nat" define al where "al = array_length m" show dist_kvs: "distinct (map fst kvs)" and "sorted (map fst kvs)" unfolding kvs_def al_def[symmetric] apply (induct al) ... ...
 ... ... @@ -77,8 +77,8 @@ proof (rule proper_it'I) apply (rule pi_union) apply (auto split: option.split intro: icf_proper_iteratorI) [] proof (rule pi_image) def bs \ "\(k,t). SOME l'::('k list \ 'v) list. ?ITA (k#l) t = foldli l' \ ?ITB (k#l) t = foldli l'" define bs where "bs = (\(k,t). SOME l'::('k list \ 'v) list. ?ITA (k#l) t = foldli l' \ ?ITB (k#l) t = foldli l')" have EQ1: "\(k,t)\set kvs. ?ITA (k#l) t = foldli (bs (k,t))" and EQ2: "\(k,t)\set kvs. ?ITB (k#l) t = foldli (bs (k,t))" ... ...
 ... ... @@ -70,23 +70,23 @@ proof (induct t arbitrary: ks0) by (simp_all add: Ball_def distinct_map) -- "root iterator" def it_vo \ "(case vo of None \ set_iterator_emp | Some v \ set_iterator_sng (ks0, v)) :: ('key list \ 'val, '\) set_iterator" def vo_S \ "case vo of None \ {} | Some v \ {(ks0, v)}" define it_vo :: "('key list \ 'val, '\) set_iterator" where "it_vo = (case vo of None \ set_iterator_emp | Some v \ set_iterator_sng (ks0, v))" define vo_S where "vo_S = (case vo of None \ {} | Some v \ {(ks0, v)})" have it_vo_OK: "set_iterator it_vo vo_S" unfolding it_vo_def vo_S_def by (simp split: option.split add: set_iterator_emp_correct set_iterator_sng_correct) -- "children iterator" def it_prod \ "(set_iterator_product (foldli kvs) (\(k, y). iteratei_postfixed (k # ks0) y)):: (('key \ ('key, 'val) trie) \ 'key list \ 'val, '\) set_iterator" define it_prod :: "(('key \ ('key, 'val) trie) \ 'key list \ 'val, '\) set_iterator" where "it_prod = set_iterator_product (foldli kvs) (\(k, y). iteratei_postfixed (k # ks0) y)" def it_prod_S \ "SIGMA kt:set kvs. define it_prod_S where "it_prod_S = (SIGMA kt:set kvs. (\ksv. (rev (fst ksv) @ ((fst kt) # ks0), snd ksv)) ` map_to_set (lookup_trie (snd kt))" map_to_set (lookup_trie (snd kt)))" have it_prod_OK: "set_iterator it_prod it_prod_S" proof - ... ...
 ... ... @@ -304,7 +304,7 @@ assumes sort_fun_OK: "\l. sorted_by_rel R (sort_fun l) \ mset (sort_fu and it_OK: "set_iterator it S0" shows "set_iterator_genord (iterator_to_ordered_iterator sort_fun it) S0 R" proof - def l \ "iterate_to_list it" define l where "l = iterate_to_list it" have l_props: "set l = S0" "distinct l" using iterate_to_list_correct [OF it_OK, folded l_def] by simp_all ... ...
 ... ... @@ -315,7 +315,7 @@ proof - from Cons(4) have dist_as: "distinct as" and a_nin_as: "a \ set as" by simp_all note ind_hyp = Cons(1)[OF sorted_as sorted_bs_as dist_as] def bs_a \ "bs a" define bs_a where "bs_a = bs a" from sorted_bs_a have sorted_prod_a : "sorted_by_rel (set_iterator_product_order R_a R_b) (map (Pair a) (bs a))" unfolding bs_a_def[symmetric] ... ... @@ -736,7 +736,7 @@ lemma map_iterator_genord_dom_filter_correct : m k2 = Some v2; P (k2, v2); R (k1, v1) (k2, v2)\ \ R' k1 k2" shows "set_iterator_genord (map_iterator_dom_filter P it) {k . \v. m k = Some v \ P (k, v)} R'" proof - def g \ "\xy::('a \ 'b). if P xy then Some (fst xy) else None" define g where "g xy = (if P xy then Some (fst xy) else None)" for xy :: "'a \ 'b" note set_iterator_genord_image_filter_correct [OF it_OK, of g R'] ... ...
 ... ... @@ -266,7 +266,7 @@ lemma array_map_conv_array_foldl: "array_map f a = array_foldl (\h a v. array_set a h (f h v)) a a" proof(cases a) case (Array xs) def a == xs define a where "a = xs" hence "length xs \ length a" by simp hence "foldl (\a (k, v). array_set a k (f k v)) (Array a) (zip [0..
 ... ... @@ -666,8 +666,8 @@ proof - from sem_eq have sem_eq_a: "\a. robdd_\ (robdd_var i1 l1 v1 r1) a = robdd_\ (robdd_var i2 l2 v2 r2) a" by (simp add: fun_eq_iff) def a1 \ "\a v'. if v1 = v' then True else a v'" def a2 \ "\a v'. if v1 = v' then False else a v'" define a1 where "a1 a v' = (if v1 = v' then True else a v')" for a v' define a2 where "a2 a v' = (if v1 = v' then False else a v')" for a v' have a12_eval: "\a. a1 a v1" "\a. ~(a2 a v1)" "\a v. v \ v1 \ a1 a v = a v \ a2 a v = a v" unfolding a1_def a2_def by simp_all ... ... @@ -1379,8 +1379,8 @@ locale robdd_locale = shows "robdd_invar_ext bs' v b \ rev_map_invar bs' rev_map' \ robdd_\ b = robdd_\ (robdd_var 0 l v r)" proof - def l_id \ "robdd_get_id l" def r_id \ "robdd_get_id r" define l_id where "l_id = robdd_get_id l" define r_id where "r_id = robdd_get_id r" note bs_OK = rev_map_invar_implies_invar_bs[OF invar_rev_map] ... ... @@ -1448,7 +1448,7 @@ locale robdd_locale = by (simp add: map_eq bs'_eq invar_b b_\ lr'_eq invar_rev_map) next case None note map_eq = this def b' \ "robdd_var (snd rev_map) l v r" define b' where "b' = robdd_var (snd rev_map) l v r" have \_b': "robdd_\ b' = robdd_\ (robdd_var 0 l v r)" unfolding b'_def by (simp add: fun_eq_iff) ... ... @@ -1988,8 +1988,10 @@ locale robdd_locale = obtain r apply_map'' rev_map'' where apply_r_eq: "robdd_apply apply_map' rev_map' bop b1_r b2_r = (r, apply_map'', rev_map'')" by (metis prod.exhaust) obtain b' rev_map''' where const_eq: "robdd_construct rev_map'' l v'' r = (b', rev_map''')" by (metis prod.exhaust) def apply_map''' \ "c_update (robdd_get_id b1, robdd_get_id b2) b' apply_map''" obtain b' rev_map''' where const_eq: "robdd_construct rev_map'' l v'' r = (b', rev_map''')" by (metis prod.exhaust) define apply_map''' where "apply_map''' = c_update (robdd_get_id b1, robdd_get_id b2) b' apply_map''" note next_props = robdd_apply_next_correct [OF b1_invar b2_invar next_eq] not_leaf_b12 note v''_eq = next_props(13) ... ... @@ -2025,7 +2027,7 @@ locale robdd_locale = have l_invar1: "robdd_invar_ext bs'' (Suc v'') l" unfolding robdd_invar_ext_def by simp (metis subrobdds_set_mono subsetD) def bs''' \ "insert b' bs''" define bs''' where "bs''' = insert b' bs''" from robdd_construct_correct[OF invar_rev_map'' _ _ l_invar1 r_invar1] have b'_invar: "robdd_invar_ext bs''' v'' b'" and invar_rev_map''': "rev_map_invar bs''' rev_map'''" ... ... @@ -2709,7 +2711,7 @@ next robdd_invar_vars_greater.simps(2) robdd_invar_vars_impl) then obtain a where a_sem_neq: "robdd_\ ll a \ robdd_\ rr a" by (auto simp add: fun_eq_iff) def aa \ "\v. a (v + n)" define aa where "aa v = a (v + n)" for v from invar(1) have ll_sem: "\b. robdd_\ ll (\v'. (aa(v - n := b)) (v' - n)) = robdd_\ ll a" apply (rule_tac robdd_\_invar_greater [of "Suc v"]) apply (simp_all add: aa_def) ... ...
 ... ... @@ -148,7 +148,7 @@ lemma perm_weak_contr_mono: proof - from contr weak have contr': "! x xs. P(x#x#xs) = P (x#xs)" by blast def y' == "filter (% z. z : set x) y" define y' where "y' = filter (% z. z : set x) y" from xy have "set x = set y'" apply(simp add: y'_def) apply blast done hence rxry': "remdups x <~~> remdups y'" by(simp add: perm_remdups_iff_eq_set) ... ...