1(*  Title:      HOL/UNITY/FP.thy
2    Author:     Lawrence C Paulson, Cambridge University Computer Laboratory
3    Copyright   1998  University of Cambridge
4
5From Misra, "A Logic for Concurrent Programming", 1994
6*)
7
8section\<open>Fixed Point of a Program\<close>
9
10theory FP imports UNITY begin
11
12definition FP_Orig :: "'a program => 'a set" where
13    "FP_Orig F == \<Union>{A. \<forall>B. F \<in> stable (A \<inter> B)}"
14
15definition FP :: "'a program => 'a set" where
16    "FP F == {s. F \<in> stable {s}}"
17
18lemma stable_FP_Orig_Int: "F \<in> stable (FP_Orig F Int B)"
19apply (simp only: FP_Orig_def stable_def Int_Union2)
20apply (blast intro: constrains_UN)
21done
22
23lemma FP_Orig_weakest:
24    "(\<And>B. F \<in> stable (A \<inter> B)) \<Longrightarrow> A <= FP_Orig F"
25by (simp add: FP_Orig_def stable_def, blast)
26
27lemma stable_FP_Int: "F \<in> stable (FP F \<inter> B)"
28apply (subgoal_tac "FP F Int B = (UN x:B. FP F Int {x}) ")
29prefer 2 apply blast
30apply (simp (no_asm_simp) add: Int_insert_right)
31apply (simp add: FP_def stable_def)
32apply (rule constrains_UN)
33apply (simp (no_asm))
34done
35
36lemma FP_equivalence: "FP F = FP_Orig F"
37apply (rule equalityI) 
38 apply (rule stable_FP_Int [THEN FP_Orig_weakest])
39apply (simp add: FP_Orig_def FP_def, clarify)
40apply (drule_tac x = "{x}" in spec)
41apply (simp add: Int_insert_right)
42done
43
44lemma FP_weakest:
45    "(\<And>B. F \<in> stable (A Int B)) \<Longrightarrow> A <= FP F"
46by (simp add: FP_equivalence FP_Orig_weakest)
47
48lemma Compl_FP: 
49    "-(FP F) = (UN act: Acts F. -{s. act``{s} <= {s}})"
50by (simp add: FP_def stable_def constrains_def, blast)
51
52lemma Diff_FP: "A - (FP F) = (UN act: Acts F. A - {s. act``{s} <= {s}})"
53by (simp add: Diff_eq Compl_FP)
54
55lemma totalize_FP [simp]: "FP (totalize F) = FP F"
56by (simp add: FP_def)
57
58end
59