src/HOL/MicroJava/BV/Semilat.thy
changeset 23757 087b0a241557
parent 22271 51a80e238b29
child 25592 e8ddaf6bf5df
equal deleted inserted replaced
23756:14008ce7df96 23757:087b0a241557
   270   \<Longrightarrow> EX v. is_lub (r^** ) x' y v"
   270   \<Longrightarrow> EX v. is_lub (r^** ) x' y v"
   271 apply (unfold is_lub_def is_ub_def)
   271 apply (unfold is_lub_def is_ub_def)
   272 apply (case_tac "r^** y x")
   272 apply (case_tac "r^** y x")
   273  apply (case_tac "r^** y x'")
   273  apply (case_tac "r^** y x'")
   274   apply blast
   274   apply blast
   275  apply (blast elim: converse_rtranclE' dest: single_valuedD)
   275  apply (blast elim: converse_rtranclpE dest: single_valuedD)
   276 apply (rule exI)
   276 apply (rule exI)
   277 apply (rule conjI)
   277 apply (rule conjI)
   278  apply (blast intro: converse_rtrancl_into_rtrancl' dest: single_valuedD)
   278  apply (blast intro: converse_rtranclp_into_rtranclp dest: single_valuedD)
   279 apply (blast intro: rtrancl.rtrancl_into_rtrancl converse_rtrancl_into_rtrancl'
   279 apply (blast intro: rtranclp.rtrancl_into_rtrancl converse_rtranclp_into_rtranclp
   280              elim: converse_rtranclE' dest: single_valuedD)
   280              elim: converse_rtranclpE dest: single_valuedD)
   281 done
   281 done
   282 
   282 
   283 lemma single_valued_has_lubs [rule_format]:
   283 lemma single_valued_has_lubs [rule_format]:
   284   "\<lbrakk> single_valuedP r; r^** x u \<rbrakk> \<Longrightarrow> (!y. r^** y u \<longrightarrow> 
   284   "\<lbrakk> single_valuedP r; r^** x u \<rbrakk> \<Longrightarrow> (!y. r^** y u \<longrightarrow> 
   285   (EX z. is_lub (r^** ) x y z))"
   285   (EX z. is_lub (r^** ) x y z))"
   286 apply (erule converse_rtrancl_induct')
   286 apply (erule converse_rtranclp_induct)
   287  apply clarify
   287  apply clarify
   288  apply (erule converse_rtrancl_induct')
   288  apply (erule converse_rtranclp_induct)
   289   apply blast
   289   apply blast
   290  apply (blast intro: converse_rtrancl_into_rtrancl')
   290  apply (blast intro: converse_rtranclp_into_rtranclp)
   291 apply (blast intro: extend_lub)
   291 apply (blast intro: extend_lub)
   292 done
   292 done
   293 
   293 
   294 lemma some_lub_conv:
   294 lemma some_lub_conv:
   295   "\<lbrakk> acyclicP r; is_lub (r^** ) x y u \<rbrakk> \<Longrightarrow> some_lub (r^** ) x y = u"
   295   "\<lbrakk> acyclicP r; is_lub (r^** ) x y u \<rbrakk> \<Longrightarrow> some_lub (r^** ) x y = u"
   311 "exec_lub r f x y == while (\<lambda>z. \<not> r\<^sup>*\<^sup>* x z) f y"
   311 "exec_lub r f x y == while (\<lambda>z. \<not> r\<^sup>*\<^sup>* x z) f y"
   312 
   312 
   313 
   313 
   314 lemma acyclic_single_valued_finite:
   314 lemma acyclic_single_valued_finite:
   315  "\<lbrakk>acyclicP r; single_valuedP r; r\<^sup>*\<^sup>* x y \<rbrakk>
   315  "\<lbrakk>acyclicP r; single_valuedP r; r\<^sup>*\<^sup>* x y \<rbrakk>
   316   \<Longrightarrow> finite (Collect2 r \<inter> {a. r\<^sup>*\<^sup>* x a} \<times> {b. r\<^sup>*\<^sup>* b y})"
   316   \<Longrightarrow> finite ({(x, y). r x y} \<inter> {a. r\<^sup>*\<^sup>* x a} \<times> {b. r\<^sup>*\<^sup>* b y})"
   317 apply(erule converse_rtrancl_induct')
   317 apply(erule converse_rtranclp_induct)
   318  apply(rule_tac B = "{}" in finite_subset)
   318  apply(rule_tac B = "{}" in finite_subset)
   319   apply(simp only:acyclic_def [to_pred])
   319   apply(simp only:acyclic_def [to_pred])
   320   apply(blast intro:rtrancl_into_trancl2' rtrancl_trancl_trancl')
   320   apply(blast intro:rtranclp_into_tranclp2 rtranclp_tranclp_tranclp)
   321  apply simp
   321  apply simp
   322 apply(rename_tac x x')
   322 apply(rename_tac x x')
   323 apply(subgoal_tac "Collect2 r \<inter> {a. r\<^sup>*\<^sup>* x a} \<times> {b. r\<^sup>*\<^sup>* b y} =
   323 apply(subgoal_tac "{(x, y). r x y} \<inter> {a. r\<^sup>*\<^sup>* x a} \<times> {b. r\<^sup>*\<^sup>* b y} =
   324                    insert (x,x') (Collect2 r \<inter> {a. r\<^sup>*\<^sup>* x' a} \<times> {b. r\<^sup>*\<^sup>* b y})")
   324                    insert (x,x') ({(x, y). r x y} \<inter> {a. r\<^sup>*\<^sup>* x' a} \<times> {b. r\<^sup>*\<^sup>* b y})")
   325  apply simp
   325  apply simp
   326 apply(blast intro:converse_rtrancl_into_rtrancl'
   326 apply(blast intro:converse_rtranclp_into_rtranclp
   327             elim:converse_rtranclE' dest:single_valuedD)
   327             elim:converse_rtranclpE dest:single_valuedD)
   328 done
   328 done
   329 
   329 
   330 
   330 
   331 lemma exec_lub_conv:
   331 lemma exec_lub_conv:
   332   "\<lbrakk> acyclicP r; !x y. r x y \<longrightarrow> f x = y; is_lub (r\<^sup>*\<^sup>*) x y u \<rbrakk> \<Longrightarrow>
   332   "\<lbrakk> acyclicP r; !x y. r x y \<longrightarrow> f x = y; is_lub (r\<^sup>*\<^sup>*) x y u \<rbrakk> \<Longrightarrow>
   333   exec_lub r f x y = u";
   333   exec_lub r f x y = u";
   334 apply(unfold exec_lub_def)
   334 apply(unfold exec_lub_def)
   335 apply(rule_tac P = "\<lambda>z. r\<^sup>*\<^sup>* y z \<and> r\<^sup>*\<^sup>* z u" and
   335 apply(rule_tac P = "\<lambda>z. r\<^sup>*\<^sup>* y z \<and> r\<^sup>*\<^sup>* z u" and
   336                r = "(Collect2 r \<inter> {(a,b). r\<^sup>*\<^sup>* y a \<and> r\<^sup>*\<^sup>* b u})^-1" in while_rule)
   336                r = "({(x, y). r x y} \<inter> {(a,b). r\<^sup>*\<^sup>* y a \<and> r\<^sup>*\<^sup>* b u})^-1" in while_rule)
   337     apply(blast dest: is_lubD is_ubD)
   337     apply(blast dest: is_lubD is_ubD)
   338    apply(erule conjE)
   338    apply(erule conjE)
   339    apply(erule_tac z = u in converse_rtranclE')
   339    apply(erule_tac z = u in converse_rtranclpE)
   340     apply(blast dest: is_lubD is_ubD)
   340     apply(blast dest: is_lubD is_ubD)
   341    apply(blast dest: rtrancl.rtrancl_into_rtrancl)
   341    apply(blast dest: rtranclp.rtrancl_into_rtrancl)
   342   apply(rename_tac s)
   342   apply(rename_tac s)
   343   apply(subgoal_tac "is_ub (r\<^sup>*\<^sup>*) x y s")
   343   apply(subgoal_tac "is_ub (r\<^sup>*\<^sup>*) x y s")
   344    prefer 2; apply(simp add:is_ub_def)
   344    prefer 2; apply(simp add:is_ub_def)
   345   apply(subgoal_tac "r\<^sup>*\<^sup>* u s")
   345   apply(subgoal_tac "r\<^sup>*\<^sup>* u s")
   346    prefer 2; apply(blast dest:is_lubD)
   346    prefer 2; apply(blast dest:is_lubD)
   347   apply(erule converse_rtranclE')
   347   apply(erule converse_rtranclpE)
   348    apply blast
   348    apply blast
   349   apply(simp only:acyclic_def [to_pred])
   349   apply(simp only:acyclic_def [to_pred])
   350   apply(blast intro:rtrancl_into_trancl2' rtrancl_trancl_trancl')
   350   apply(blast intro:rtranclp_into_tranclp2 rtranclp_tranclp_tranclp)
   351  apply(rule finite_acyclic_wf)
   351  apply(rule finite_acyclic_wf)
   352   apply simp
   352   apply simp
   353   apply(erule acyclic_single_valued_finite)
   353   apply(erule acyclic_single_valued_finite)
   354    apply(blast intro:single_valuedI)
   354    apply(blast intro:single_valuedI)
   355   apply(simp add:is_lub_def is_ub_def)
   355   apply(simp add:is_lub_def is_ub_def)
   356  apply simp
   356  apply simp
   357  apply(erule acyclic_subset)
   357  apply(erule acyclic_subset)
   358  apply blast
   358  apply blast
   359 apply simp
   359 apply simp
   360 apply(erule conjE)
   360 apply(erule conjE)
   361 apply(erule_tac z = u in converse_rtranclE')
   361 apply(erule_tac z = u in converse_rtranclpE)
   362  apply(blast dest: is_lubD is_ubD)
   362  apply(blast dest: is_lubD is_ubD)
   363 apply blast
   363 apply blast
   364 done
   364 done
   365 
   365 
   366 lemma is_lub_exec_lub:
   366 lemma is_lub_exec_lub: