author | Christian Urban <christian dot urban at kcl dot ac dot uk> |
Mon, 24 Mar 2014 11:39:39 +0000 | |
changeset 8 | dcbf7888a070 |
parent 2 | 995eb45bbadc |
permissions | -rw-r--r-- |
2
995eb45bbadc
added original Separation_Algebra theory
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
diff
changeset
|
1 |
(* Authors: Gerwin Klein and Rafal Kolanski, 2012 |
995eb45bbadc
added original Separation_Algebra theory
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
diff
changeset
|
2 |
Maintainers: Gerwin Klein <kleing at cse.unsw.edu.au> |
995eb45bbadc
added original Separation_Algebra theory
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
diff
changeset
|
3 |
Rafal Kolanski <rafal.kolanski at nicta.com.au> |
995eb45bbadc
added original Separation_Algebra theory
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
diff
changeset
|
4 |
*) |
995eb45bbadc
added original Separation_Algebra theory
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
diff
changeset
|
5 |
|
995eb45bbadc
added original Separation_Algebra theory
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
diff
changeset
|
6 |
header "Abstract Separation Algebra" |
995eb45bbadc
added original Separation_Algebra theory
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
diff
changeset
|
7 |
|
995eb45bbadc
added original Separation_Algebra theory
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
diff
changeset
|
8 |
theory Separation_Algebra |
995eb45bbadc
added original Separation_Algebra theory
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
diff
changeset
|
9 |
imports Main |
995eb45bbadc
added original Separation_Algebra theory
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
diff
changeset
|
10 |
begin |
995eb45bbadc
added original Separation_Algebra theory
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
diff
changeset
|
11 |
|
995eb45bbadc
added original Separation_Algebra theory
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
diff
changeset
|
12 |
|
995eb45bbadc
added original Separation_Algebra theory
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
diff
changeset
|
13 |
text {* This theory is the main abstract separation algebra development *} |
995eb45bbadc
added original Separation_Algebra theory
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
diff
changeset
|
14 |
|
995eb45bbadc
added original Separation_Algebra theory
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
diff
changeset
|
15 |
|
995eb45bbadc
added original Separation_Algebra theory
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
diff
changeset
|
16 |
section {* Input syntax for lifting boolean predicates to separation predicates *} |
995eb45bbadc
added original Separation_Algebra theory
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
diff
changeset
|
17 |
|
995eb45bbadc
added original Separation_Algebra theory
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
diff
changeset
|
18 |
abbreviation (input) |
995eb45bbadc
added original Separation_Algebra theory
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
diff
changeset
|
19 |
pred_and :: "('a \<Rightarrow> bool) \<Rightarrow> ('a \<Rightarrow> bool) \<Rightarrow> 'a \<Rightarrow> bool" (infixr "and" 35) where |
995eb45bbadc
added original Separation_Algebra theory
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
diff
changeset
|
20 |
"a and b \<equiv> \<lambda>s. a s \<and> b s" |
995eb45bbadc
added original Separation_Algebra theory
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
diff
changeset
|
21 |
|
995eb45bbadc
added original Separation_Algebra theory
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
diff
changeset
|
22 |
abbreviation (input) |
995eb45bbadc
added original Separation_Algebra theory
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
diff
changeset
|
23 |
pred_or :: "('a \<Rightarrow> bool) \<Rightarrow> ('a \<Rightarrow> bool) \<Rightarrow> 'a \<Rightarrow> bool" (infixr "or" 30) where |
995eb45bbadc
added original Separation_Algebra theory
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
diff
changeset
|
24 |
"a or b \<equiv> \<lambda>s. a s \<or> b s" |
995eb45bbadc
added original Separation_Algebra theory
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
diff
changeset
|
25 |
|
995eb45bbadc
added original Separation_Algebra theory
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
diff
changeset
|
26 |
abbreviation (input) |
995eb45bbadc
added original Separation_Algebra theory
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
diff
changeset
|
27 |
pred_not :: "('a \<Rightarrow> bool) \<Rightarrow> 'a \<Rightarrow> bool" ("not _" [40] 40) where |
995eb45bbadc
added original Separation_Algebra theory
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
diff
changeset
|
28 |
"not a \<equiv> \<lambda>s. \<not>a s" |
995eb45bbadc
added original Separation_Algebra theory
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
diff
changeset
|
29 |
|
995eb45bbadc
added original Separation_Algebra theory
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
diff
changeset
|
30 |
abbreviation (input) |
995eb45bbadc
added original Separation_Algebra theory
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
diff
changeset
|
31 |
pred_imp :: "('a \<Rightarrow> bool) \<Rightarrow> ('a \<Rightarrow> bool) \<Rightarrow> 'a \<Rightarrow> bool" (infixr "imp" 25) where |
995eb45bbadc
added original Separation_Algebra theory
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
diff
changeset
|
32 |
"a imp b \<equiv> \<lambda>s. a s \<longrightarrow> b s" |
995eb45bbadc
added original Separation_Algebra theory
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
diff
changeset
|
33 |
|
995eb45bbadc
added original Separation_Algebra theory
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
diff
changeset
|
34 |
abbreviation (input) |
995eb45bbadc
added original Separation_Algebra theory
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
diff
changeset
|
35 |
pred_K :: "'b \<Rightarrow> 'a \<Rightarrow> 'b" ("\<langle>_\<rangle>") where |
995eb45bbadc
added original Separation_Algebra theory
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
diff
changeset
|
36 |
"\<langle>f\<rangle> \<equiv> \<lambda>s. f" |
995eb45bbadc
added original Separation_Algebra theory
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
diff
changeset
|
37 |
|
995eb45bbadc
added original Separation_Algebra theory
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
diff
changeset
|
38 |
abbreviation (input) |
995eb45bbadc
added original Separation_Algebra theory
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
diff
changeset
|
39 |
pred_ex :: "('b \<Rightarrow> 'a \<Rightarrow> bool) \<Rightarrow> 'a \<Rightarrow> bool" (binder "EXS " 10) where |
995eb45bbadc
added original Separation_Algebra theory
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
diff
changeset
|
40 |
"EXS x. P x \<equiv> \<lambda>s. \<exists>x. P x s" |
995eb45bbadc
added original Separation_Algebra theory
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
diff
changeset
|
41 |
|
995eb45bbadc
added original Separation_Algebra theory
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
diff
changeset
|
42 |
abbreviation (input) |
995eb45bbadc
added original Separation_Algebra theory
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
diff
changeset
|
43 |
pred_all :: "('b \<Rightarrow> 'a \<Rightarrow> bool) \<Rightarrow> 'a \<Rightarrow> bool" (binder "ALLS " 10) where |
995eb45bbadc
added original Separation_Algebra theory
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
diff
changeset
|
44 |
"ALLS x. P x \<equiv> \<lambda>s. \<forall>x. P x s" |
995eb45bbadc
added original Separation_Algebra theory
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
diff
changeset
|
45 |
|
995eb45bbadc
added original Separation_Algebra theory
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
diff
changeset
|
46 |
|
995eb45bbadc
added original Separation_Algebra theory
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
diff
changeset
|
47 |
section {* Associative/Commutative Monoid Basis of Separation Algebras *} |
995eb45bbadc
added original Separation_Algebra theory
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
diff
changeset
|
48 |
|
995eb45bbadc
added original Separation_Algebra theory
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
diff
changeset
|
49 |
class pre_sep_algebra = zero + plus + |
995eb45bbadc
added original Separation_Algebra theory
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
diff
changeset
|
50 |
fixes sep_disj :: "'a => 'a => bool" (infix "##" 60) |
995eb45bbadc
added original Separation_Algebra theory
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
diff
changeset
|
51 |
|
995eb45bbadc
added original Separation_Algebra theory
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
diff
changeset
|
52 |
assumes sep_disj_zero [simp]: "x ## 0" |
995eb45bbadc
added original Separation_Algebra theory
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
diff
changeset
|
53 |
assumes sep_disj_commuteI: "x ## y \<Longrightarrow> y ## x" |
995eb45bbadc
added original Separation_Algebra theory
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
diff
changeset
|
54 |
|
995eb45bbadc
added original Separation_Algebra theory
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
diff
changeset
|
55 |
assumes sep_add_zero [simp]: "x + 0 = x" |
995eb45bbadc
added original Separation_Algebra theory
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
diff
changeset
|
56 |
assumes sep_add_commute: "x ## y \<Longrightarrow> x + y = y + x" |
995eb45bbadc
added original Separation_Algebra theory
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
diff
changeset
|
57 |
|
995eb45bbadc
added original Separation_Algebra theory
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
diff
changeset
|
58 |
assumes sep_add_assoc: |
995eb45bbadc
added original Separation_Algebra theory
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
diff
changeset
|
59 |
"\<lbrakk> x ## y; y ## z; x ## z \<rbrakk> \<Longrightarrow> (x + y) + z = x + (y + z)" |
995eb45bbadc
added original Separation_Algebra theory
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
diff
changeset
|
60 |
begin |
995eb45bbadc
added original Separation_Algebra theory
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
diff
changeset
|
61 |
|
995eb45bbadc
added original Separation_Algebra theory
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
diff
changeset
|
62 |
lemma sep_disj_commute: "x ## y = y ## x" |
995eb45bbadc
added original Separation_Algebra theory
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
diff
changeset
|
63 |
by (blast intro: sep_disj_commuteI) |
995eb45bbadc
added original Separation_Algebra theory
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
diff
changeset
|
64 |
|
995eb45bbadc
added original Separation_Algebra theory
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
diff
changeset
|
65 |
lemma sep_add_left_commute: |
995eb45bbadc
added original Separation_Algebra theory
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
diff
changeset
|
66 |
assumes a: "a ## b" "b ## c" "a ## c" |
995eb45bbadc
added original Separation_Algebra theory
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
diff
changeset
|
67 |
shows "b + (a + c) = a + (b + c)" (is "?lhs = ?rhs") |
995eb45bbadc
added original Separation_Algebra theory
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
diff
changeset
|
68 |
proof - |
995eb45bbadc
added original Separation_Algebra theory
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
diff
changeset
|
69 |
have "?lhs = b + a + c" using a |
995eb45bbadc
added original Separation_Algebra theory
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
diff
changeset
|
70 |
by (simp add: sep_add_assoc[symmetric] sep_disj_commute) |
995eb45bbadc
added original Separation_Algebra theory
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
diff
changeset
|
71 |
also have "... = a + b + c" using a |
995eb45bbadc
added original Separation_Algebra theory
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
diff
changeset
|
72 |
by (simp add: sep_add_commute sep_disj_commute) |
995eb45bbadc
added original Separation_Algebra theory
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
diff
changeset
|
73 |
also have "... = ?rhs" using a |
995eb45bbadc
added original Separation_Algebra theory
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
diff
changeset
|
74 |
by (simp add: sep_add_assoc sep_disj_commute) |
995eb45bbadc
added original Separation_Algebra theory
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
diff
changeset
|
75 |
finally show ?thesis . |
995eb45bbadc
added original Separation_Algebra theory
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
diff
changeset
|
76 |
qed |
995eb45bbadc
added original Separation_Algebra theory
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
diff
changeset
|
77 |
|
995eb45bbadc
added original Separation_Algebra theory
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
diff
changeset
|
78 |
lemmas sep_add_ac = sep_add_assoc sep_add_commute sep_add_left_commute |
995eb45bbadc
added original Separation_Algebra theory
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
diff
changeset
|
79 |
sep_disj_commute (* nearly always necessary *) |
995eb45bbadc
added original Separation_Algebra theory
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
diff
changeset
|
80 |
|
995eb45bbadc
added original Separation_Algebra theory
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
diff
changeset
|
81 |
end |
995eb45bbadc
added original Separation_Algebra theory
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
diff
changeset
|
82 |
|
995eb45bbadc
added original Separation_Algebra theory
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
diff
changeset
|
83 |
|
995eb45bbadc
added original Separation_Algebra theory
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
diff
changeset
|
84 |
section {* Separation Algebra as Defined by Calcagno et al. *} |
995eb45bbadc
added original Separation_Algebra theory
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
diff
changeset
|
85 |
|
995eb45bbadc
added original Separation_Algebra theory
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
diff
changeset
|
86 |
class sep_algebra = pre_sep_algebra + |
995eb45bbadc
added original Separation_Algebra theory
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
diff
changeset
|
87 |
assumes sep_disj_addD1: "\<lbrakk> x ## y + z; y ## z \<rbrakk> \<Longrightarrow> x ## y" |
995eb45bbadc
added original Separation_Algebra theory
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
diff
changeset
|
88 |
assumes sep_disj_addI1: "\<lbrakk> x ## y + z; y ## z \<rbrakk> \<Longrightarrow> x + y ## z" |
995eb45bbadc
added original Separation_Algebra theory
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
diff
changeset
|
89 |
begin |
995eb45bbadc
added original Separation_Algebra theory
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
diff
changeset
|
90 |
|
995eb45bbadc
added original Separation_Algebra theory
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
diff
changeset
|
91 |
subsection {* Basic Construct Definitions and Abbreviations *} |
995eb45bbadc
added original Separation_Algebra theory
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
diff
changeset
|
92 |
|
995eb45bbadc
added original Separation_Algebra theory
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
diff
changeset
|
93 |
definition |
995eb45bbadc
added original Separation_Algebra theory
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
diff
changeset
|
94 |
sep_conj :: "('a \<Rightarrow> bool) \<Rightarrow> ('a \<Rightarrow> bool) \<Rightarrow> ('a \<Rightarrow> bool)" (infixr "**" 35) |
995eb45bbadc
added original Separation_Algebra theory
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
diff
changeset
|
95 |
where |
995eb45bbadc
added original Separation_Algebra theory
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
diff
changeset
|
96 |
"P ** Q \<equiv> \<lambda>h. \<exists>x y. x ## y \<and> h = x + y \<and> P x \<and> Q y" |
995eb45bbadc
added original Separation_Algebra theory
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
diff
changeset
|
97 |
|
995eb45bbadc
added original Separation_Algebra theory
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
diff
changeset
|
98 |
notation |
995eb45bbadc
added original Separation_Algebra theory
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
diff
changeset
|
99 |
sep_conj (infixr "\<and>*" 35) |
995eb45bbadc
added original Separation_Algebra theory
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
diff
changeset
|
100 |
|
995eb45bbadc
added original Separation_Algebra theory
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
diff
changeset
|
101 |
definition |
995eb45bbadc
added original Separation_Algebra theory
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
diff
changeset
|
102 |
sep_empty :: "'a \<Rightarrow> bool" ("\<box>") where |
995eb45bbadc
added original Separation_Algebra theory
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
diff
changeset
|
103 |
"\<box> \<equiv> \<lambda>h. h = 0" |
995eb45bbadc
added original Separation_Algebra theory
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
diff
changeset
|
104 |
|
995eb45bbadc
added original Separation_Algebra theory
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
diff
changeset
|
105 |
definition |
995eb45bbadc
added original Separation_Algebra theory
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
diff
changeset
|
106 |
sep_impl :: "('a \<Rightarrow> bool) \<Rightarrow> ('a \<Rightarrow> bool) \<Rightarrow> ('a \<Rightarrow> bool)" (infixr "\<longrightarrow>*" 25) |
995eb45bbadc
added original Separation_Algebra theory
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
diff
changeset
|
107 |
where |
995eb45bbadc
added original Separation_Algebra theory
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
diff
changeset
|
108 |
"P \<longrightarrow>* Q \<equiv> \<lambda>h. \<forall>h'. h ## h' \<and> P h' \<longrightarrow> Q (h + h')" |
995eb45bbadc
added original Separation_Algebra theory
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
diff
changeset
|
109 |
|
995eb45bbadc
added original Separation_Algebra theory
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
diff
changeset
|
110 |
definition |
995eb45bbadc
added original Separation_Algebra theory
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
diff
changeset
|
111 |
sep_substate :: "'a => 'a => bool" (infix "\<preceq>" 60) where |
995eb45bbadc
added original Separation_Algebra theory
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
diff
changeset
|
112 |
"x \<preceq> y \<equiv> \<exists>z. x ## z \<and> x + z = y" |
995eb45bbadc
added original Separation_Algebra theory
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
diff
changeset
|
113 |
|
995eb45bbadc
added original Separation_Algebra theory
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
diff
changeset
|
114 |
(* We want these to be abbreviations not definitions, because basic True and |
995eb45bbadc
added original Separation_Algebra theory
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
diff
changeset
|
115 |
False will occur by simplification in sep_conj terms *) |
995eb45bbadc
added original Separation_Algebra theory
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
diff
changeset
|
116 |
abbreviation |
995eb45bbadc
added original Separation_Algebra theory
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
diff
changeset
|
117 |
"sep_true \<equiv> \<langle>True\<rangle>" |
995eb45bbadc
added original Separation_Algebra theory
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
diff
changeset
|
118 |
|
995eb45bbadc
added original Separation_Algebra theory
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
diff
changeset
|
119 |
abbreviation |
995eb45bbadc
added original Separation_Algebra theory
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
diff
changeset
|
120 |
"sep_false \<equiv> \<langle>False\<rangle>" |
995eb45bbadc
added original Separation_Algebra theory
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
diff
changeset
|
121 |
|
995eb45bbadc
added original Separation_Algebra theory
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
diff
changeset
|
122 |
definition |
995eb45bbadc
added original Separation_Algebra theory
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
diff
changeset
|
123 |
sep_list_conj :: "('a \<Rightarrow> bool) list \<Rightarrow> ('a \<Rightarrow> bool)" ("\<And>* _" [60] 90) where |
995eb45bbadc
added original Separation_Algebra theory
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
diff
changeset
|
124 |
"sep_list_conj Ps \<equiv> foldl (op **) \<box> Ps" |
995eb45bbadc
added original Separation_Algebra theory
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
diff
changeset
|
125 |
|
995eb45bbadc
added original Separation_Algebra theory
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
diff
changeset
|
126 |
|
995eb45bbadc
added original Separation_Algebra theory
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
diff
changeset
|
127 |
subsection {* Disjunction/Addition Properties *} |
995eb45bbadc
added original Separation_Algebra theory
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
diff
changeset
|
128 |
|
995eb45bbadc
added original Separation_Algebra theory
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
diff
changeset
|
129 |
lemma disjoint_zero_sym [simp]: "0 ## x" |
995eb45bbadc
added original Separation_Algebra theory
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
diff
changeset
|
130 |
by (simp add: sep_disj_commute) |
995eb45bbadc
added original Separation_Algebra theory
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
diff
changeset
|
131 |
|
995eb45bbadc
added original Separation_Algebra theory
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
diff
changeset
|
132 |
lemma sep_add_zero_sym [simp]: "0 + x = x" |
995eb45bbadc
added original Separation_Algebra theory
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
diff
changeset
|
133 |
by (simp add: sep_add_commute) |
995eb45bbadc
added original Separation_Algebra theory
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
diff
changeset
|
134 |
|
995eb45bbadc
added original Separation_Algebra theory
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
diff
changeset
|
135 |
lemma sep_disj_addD2: "\<lbrakk> x ## y + z; y ## z \<rbrakk> \<Longrightarrow> x ## z" |
995eb45bbadc
added original Separation_Algebra theory
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
diff
changeset
|
136 |
by (metis sep_disj_addD1 sep_add_ac) |
995eb45bbadc
added original Separation_Algebra theory
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
diff
changeset
|
137 |
|
995eb45bbadc
added original Separation_Algebra theory
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
diff
changeset
|
138 |
lemma sep_disj_addD: "\<lbrakk> x ## y + z; y ## z \<rbrakk> \<Longrightarrow> x ## y \<and> x ## z" |
995eb45bbadc
added original Separation_Algebra theory
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
diff
changeset
|
139 |
by (metis sep_disj_addD1 sep_disj_addD2) |
995eb45bbadc
added original Separation_Algebra theory
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
diff
changeset
|
140 |
|
995eb45bbadc
added original Separation_Algebra theory
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
diff
changeset
|
141 |
lemma sep_add_disjD: "\<lbrakk> x + y ## z; x ## y \<rbrakk> \<Longrightarrow> x ## z \<and> y ## z" |
995eb45bbadc
added original Separation_Algebra theory
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
diff
changeset
|
142 |
by (metis sep_disj_addD sep_disj_commuteI) |
995eb45bbadc
added original Separation_Algebra theory
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
diff
changeset
|
143 |
|
995eb45bbadc
added original Separation_Algebra theory
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
diff
changeset
|
144 |
lemma sep_disj_addI2: |
995eb45bbadc
added original Separation_Algebra theory
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
diff
changeset
|
145 |
"\<lbrakk> x ## y + z; y ## z \<rbrakk> \<Longrightarrow> x + z ## y" |
995eb45bbadc
added original Separation_Algebra theory
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
diff
changeset
|
146 |
by (metis sep_add_ac sep_disj_addI1) |
995eb45bbadc
added original Separation_Algebra theory
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
diff
changeset
|
147 |
|
995eb45bbadc
added original Separation_Algebra theory
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
diff
changeset
|
148 |
lemma sep_add_disjI1: |
995eb45bbadc
added original Separation_Algebra theory
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
diff
changeset
|
149 |
"\<lbrakk> x + y ## z; x ## y \<rbrakk> \<Longrightarrow> x + z ## y" |
995eb45bbadc
added original Separation_Algebra theory
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
diff
changeset
|
150 |
by (metis sep_add_ac sep_add_disjD sep_disj_addI2) |
995eb45bbadc
added original Separation_Algebra theory
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
diff
changeset
|
151 |
|
995eb45bbadc
added original Separation_Algebra theory
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
diff
changeset
|
152 |
lemma sep_add_disjI2: |
995eb45bbadc
added original Separation_Algebra theory
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
diff
changeset
|
153 |
"\<lbrakk> x + y ## z; x ## y \<rbrakk> \<Longrightarrow> z + y ## x" |
995eb45bbadc
added original Separation_Algebra theory
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
diff
changeset
|
154 |
by (metis sep_add_ac sep_add_disjD sep_disj_addI2) |
995eb45bbadc
added original Separation_Algebra theory
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
diff
changeset
|
155 |
|
995eb45bbadc
added original Separation_Algebra theory
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
diff
changeset
|
156 |
lemma sep_disj_addI3: |
995eb45bbadc
added original Separation_Algebra theory
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
diff
changeset
|
157 |
"x + y ## z \<Longrightarrow> x ## y \<Longrightarrow> x ## y + z" |
995eb45bbadc
added original Separation_Algebra theory
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
diff
changeset
|
158 |
by (metis sep_add_ac sep_add_disjD sep_add_disjI2) |
995eb45bbadc
added original Separation_Algebra theory
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
diff
changeset
|
159 |
|
995eb45bbadc
added original Separation_Algebra theory
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
diff
changeset
|
160 |
lemma sep_disj_add: |
995eb45bbadc
added original Separation_Algebra theory
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
diff
changeset
|
161 |
"\<lbrakk> y ## z; x ## y \<rbrakk> \<Longrightarrow> x ## y + z = x + y ## z" |
995eb45bbadc
added original Separation_Algebra theory
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
diff
changeset
|
162 |
by (metis sep_disj_addI1 sep_disj_addI3) |
995eb45bbadc
added original Separation_Algebra theory
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
diff
changeset
|
163 |
|
995eb45bbadc
added original Separation_Algebra theory
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
diff
changeset
|
164 |
|
995eb45bbadc
added original Separation_Algebra theory
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
diff
changeset
|
165 |
subsection {* Substate Properties *} |
995eb45bbadc
added original Separation_Algebra theory
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
diff
changeset
|
166 |
|
995eb45bbadc
added original Separation_Algebra theory
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
diff
changeset
|
167 |
lemma sep_substate_disj_add: |
995eb45bbadc
added original Separation_Algebra theory
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
diff
changeset
|
168 |
"x ## y \<Longrightarrow> x \<preceq> x + y" |
995eb45bbadc
added original Separation_Algebra theory
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
diff
changeset
|
169 |
unfolding sep_substate_def by blast |
995eb45bbadc
added original Separation_Algebra theory
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
diff
changeset
|
170 |
|
995eb45bbadc
added original Separation_Algebra theory
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
diff
changeset
|
171 |
lemma sep_substate_disj_add': |
995eb45bbadc
added original Separation_Algebra theory
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
diff
changeset
|
172 |
"x ## y \<Longrightarrow> x \<preceq> y + x" |
995eb45bbadc
added original Separation_Algebra theory
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
diff
changeset
|
173 |
by (simp add: sep_add_ac sep_substate_disj_add) |
995eb45bbadc
added original Separation_Algebra theory
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
diff
changeset
|
174 |
|
995eb45bbadc
added original Separation_Algebra theory
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
diff
changeset
|
175 |
|
995eb45bbadc
added original Separation_Algebra theory
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
diff
changeset
|
176 |
subsection {* Separating Conjunction Properties *} |
995eb45bbadc
added original Separation_Algebra theory
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
diff
changeset
|
177 |
|
995eb45bbadc
added original Separation_Algebra theory
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
diff
changeset
|
178 |
lemma sep_conjD: |
995eb45bbadc
added original Separation_Algebra theory
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
diff
changeset
|
179 |
"(P \<and>* Q) h \<Longrightarrow> \<exists>x y. x ## y \<and> h = x + y \<and> P x \<and> Q y" |
995eb45bbadc
added original Separation_Algebra theory
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
diff
changeset
|
180 |
by (simp add: sep_conj_def) |
995eb45bbadc
added original Separation_Algebra theory
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
diff
changeset
|
181 |
|
995eb45bbadc
added original Separation_Algebra theory
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
diff
changeset
|
182 |
lemma sep_conjE: |
995eb45bbadc
added original Separation_Algebra theory
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
diff
changeset
|
183 |
"\<lbrakk> (P ** Q) h; \<And>x y. \<lbrakk> P x; Q y; x ## y; h = x + y \<rbrakk> \<Longrightarrow> X \<rbrakk> \<Longrightarrow> X" |
995eb45bbadc
added original Separation_Algebra theory
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
diff
changeset
|
184 |
by (auto simp: sep_conj_def) |
995eb45bbadc
added original Separation_Algebra theory
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
diff
changeset
|
185 |
|
995eb45bbadc
added original Separation_Algebra theory
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
diff
changeset
|
186 |
lemma sep_conjI: |
995eb45bbadc
added original Separation_Algebra theory
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
diff
changeset
|
187 |
"\<lbrakk> P x; Q y; x ## y; h = x + y \<rbrakk> \<Longrightarrow> (P ** Q) h" |
995eb45bbadc
added original Separation_Algebra theory
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
diff
changeset
|
188 |
by (auto simp: sep_conj_def) |
995eb45bbadc
added original Separation_Algebra theory
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
diff
changeset
|
189 |
|
995eb45bbadc
added original Separation_Algebra theory
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
diff
changeset
|
190 |
lemma sep_conj_commuteI: |
995eb45bbadc
added original Separation_Algebra theory
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
diff
changeset
|
191 |
"(P ** Q) h \<Longrightarrow> (Q ** P) h" |
995eb45bbadc
added original Separation_Algebra theory
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
diff
changeset
|
192 |
by (auto intro!: sep_conjI elim!: sep_conjE simp: sep_add_ac) |
995eb45bbadc
added original Separation_Algebra theory
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
diff
changeset
|
193 |
|
995eb45bbadc
added original Separation_Algebra theory
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
diff
changeset
|
194 |
lemma sep_conj_commute: |
995eb45bbadc
added original Separation_Algebra theory
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
diff
changeset
|
195 |
"(P ** Q) = (Q ** P)" |
995eb45bbadc
added original Separation_Algebra theory
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
diff
changeset
|
196 |
by (rule ext) (auto intro: sep_conj_commuteI) |
995eb45bbadc
added original Separation_Algebra theory
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
diff
changeset
|
197 |
|
995eb45bbadc
added original Separation_Algebra theory
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
diff
changeset
|
198 |
lemma sep_conj_assoc: |
995eb45bbadc
added original Separation_Algebra theory
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
diff
changeset
|
199 |
"((P ** Q) ** R) = (P ** Q ** R)" (is "?lhs = ?rhs") |
995eb45bbadc
added original Separation_Algebra theory
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
diff
changeset
|
200 |
proof (rule ext, rule iffI) |
995eb45bbadc
added original Separation_Algebra theory
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
diff
changeset
|
201 |
fix h |
995eb45bbadc
added original Separation_Algebra theory
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
diff
changeset
|
202 |
assume a: "?lhs h" |
995eb45bbadc
added original Separation_Algebra theory
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
diff
changeset
|
203 |
then obtain x y z where "P x" and "Q y" and "R z" |
995eb45bbadc
added original Separation_Algebra theory
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
diff
changeset
|
204 |
and "x ## y" and "x ## z" and "y ## z" and "x + y ## z" |
995eb45bbadc
added original Separation_Algebra theory
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
diff
changeset
|
205 |
and "h = x + y + z" |
995eb45bbadc
added original Separation_Algebra theory
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
diff
changeset
|
206 |
by (auto dest!: sep_conjD dest: sep_add_disjD) |
995eb45bbadc
added original Separation_Algebra theory
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
diff
changeset
|
207 |
moreover |
995eb45bbadc
added original Separation_Algebra theory
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
diff
changeset
|
208 |
then have "x ## y + z" |
995eb45bbadc
added original Separation_Algebra theory
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
diff
changeset
|
209 |
by (simp add: sep_disj_add) |
995eb45bbadc
added original Separation_Algebra theory
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
diff
changeset
|
210 |
ultimately |
995eb45bbadc
added original Separation_Algebra theory
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
diff
changeset
|
211 |
show "?rhs h" |
995eb45bbadc
added original Separation_Algebra theory
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
diff
changeset
|
212 |
by (auto simp: sep_add_ac intro!: sep_conjI) |
995eb45bbadc
added original Separation_Algebra theory
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
diff
changeset
|
213 |
next |
995eb45bbadc
added original Separation_Algebra theory
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
diff
changeset
|
214 |
fix h |
995eb45bbadc
added original Separation_Algebra theory
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
diff
changeset
|
215 |
assume a: "?rhs h" |
995eb45bbadc
added original Separation_Algebra theory
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
diff
changeset
|
216 |
then obtain x y z where "P x" and "Q y" and "R z" |
995eb45bbadc
added original Separation_Algebra theory
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
diff
changeset
|
217 |
and "x ## y" and "x ## z" and "y ## z" and "x ## y + z" |
995eb45bbadc
added original Separation_Algebra theory
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
diff
changeset
|
218 |
and "h = x + y + z" |
995eb45bbadc
added original Separation_Algebra theory
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
diff
changeset
|
219 |
by (fastforce elim!: sep_conjE simp: sep_add_ac dest: sep_disj_addD) |
995eb45bbadc
added original Separation_Algebra theory
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
diff
changeset
|
220 |
thus "?lhs h" |
995eb45bbadc
added original Separation_Algebra theory
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
diff
changeset
|
221 |
by (metis sep_conj_def sep_disj_addI1) |
995eb45bbadc
added original Separation_Algebra theory
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
diff
changeset
|
222 |
qed |
995eb45bbadc
added original Separation_Algebra theory
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
diff
changeset
|
223 |
|
995eb45bbadc
added original Separation_Algebra theory
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
diff
changeset
|
224 |
lemma sep_conj_impl: |
995eb45bbadc
added original Separation_Algebra theory
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
diff
changeset
|
225 |
"\<lbrakk> (P ** Q) h; \<And>h. P h \<Longrightarrow> P' h; \<And>h. Q h \<Longrightarrow> Q' h \<rbrakk> \<Longrightarrow> (P' ** Q') h" |
995eb45bbadc
added original Separation_Algebra theory
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
diff
changeset
|
226 |
by (erule sep_conjE, auto intro!: sep_conjI) |
995eb45bbadc
added original Separation_Algebra theory
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
diff
changeset
|
227 |
|
995eb45bbadc
added original Separation_Algebra theory
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
diff
changeset
|
228 |
lemma sep_conj_impl1: |
995eb45bbadc
added original Separation_Algebra theory
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
diff
changeset
|
229 |
assumes P: "\<And>h. P h \<Longrightarrow> I h" |
995eb45bbadc
added original Separation_Algebra theory
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
diff
changeset
|
230 |
shows "(P ** R) h \<Longrightarrow> (I ** R) h" |
995eb45bbadc
added original Separation_Algebra theory
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
diff
changeset
|
231 |
by (auto intro: sep_conj_impl P) |
995eb45bbadc
added original Separation_Algebra theory
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
diff
changeset
|
232 |
|
995eb45bbadc
added original Separation_Algebra theory
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
diff
changeset
|
233 |
lemma sep_globalise: |
995eb45bbadc
added original Separation_Algebra theory
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
diff
changeset
|
234 |
"\<lbrakk> (P ** R) h; (\<And>h. P h \<Longrightarrow> Q h) \<rbrakk> \<Longrightarrow> (Q ** R) h" |
995eb45bbadc
added original Separation_Algebra theory
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
diff
changeset
|
235 |
by (fast elim: sep_conj_impl) |
995eb45bbadc
added original Separation_Algebra theory
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
diff
changeset
|
236 |
|
995eb45bbadc
added original Separation_Algebra theory
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
diff
changeset
|
237 |
lemma sep_conj_trivial_strip2: |
995eb45bbadc
added original Separation_Algebra theory
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
diff
changeset
|
238 |
"Q = R \<Longrightarrow> (Q ** P) = (R ** P)" by simp |
995eb45bbadc
added original Separation_Algebra theory
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
diff
changeset
|
239 |
|
995eb45bbadc
added original Separation_Algebra theory
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
diff
changeset
|
240 |
lemma disjoint_subheaps_exist: |
995eb45bbadc
added original Separation_Algebra theory
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
diff
changeset
|
241 |
"\<exists>x y. x ## y \<and> h = x + y" |
995eb45bbadc
added original Separation_Algebra theory
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
diff
changeset
|
242 |
by (rule_tac x=0 in exI, auto) |
995eb45bbadc
added original Separation_Algebra theory
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
diff
changeset
|
243 |
|
995eb45bbadc
added original Separation_Algebra theory
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
diff
changeset
|
244 |
lemma sep_conj_left_commute: (* for permutative rewriting *) |
995eb45bbadc
added original Separation_Algebra theory
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
diff
changeset
|
245 |
"(P ** (Q ** R)) = (Q ** (P ** R))" (is "?x = ?y") |
995eb45bbadc
added original Separation_Algebra theory
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
diff
changeset
|
246 |
proof - |
995eb45bbadc
added original Separation_Algebra theory
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
diff
changeset
|
247 |
have "?x = ((Q ** R) ** P)" by (simp add: sep_conj_commute) |
995eb45bbadc
added original Separation_Algebra theory
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
diff
changeset
|
248 |
also have "\<dots> = (Q ** (R ** P))" by (subst sep_conj_assoc, simp) |
995eb45bbadc
added original Separation_Algebra theory
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
diff
changeset
|
249 |
finally show ?thesis by (simp add: sep_conj_commute) |
995eb45bbadc
added original Separation_Algebra theory
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
diff
changeset
|
250 |
qed |
995eb45bbadc
added original Separation_Algebra theory
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
diff
changeset
|
251 |
|
995eb45bbadc
added original Separation_Algebra theory
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
diff
changeset
|
252 |
lemmas sep_conj_ac = sep_conj_commute sep_conj_assoc sep_conj_left_commute |
995eb45bbadc
added original Separation_Algebra theory
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
diff
changeset
|
253 |
|
995eb45bbadc
added original Separation_Algebra theory
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
diff
changeset
|
254 |
lemma ab_semigroup_mult_sep_conj: "class.ab_semigroup_mult op **" |
995eb45bbadc
added original Separation_Algebra theory
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
diff
changeset
|
255 |
by (unfold_locales) |
995eb45bbadc
added original Separation_Algebra theory
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
diff
changeset
|
256 |
(auto simp: sep_conj_ac) |
995eb45bbadc
added original Separation_Algebra theory
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
diff
changeset
|
257 |
|
995eb45bbadc
added original Separation_Algebra theory
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
diff
changeset
|
258 |
lemma sep_empty_zero [simp,intro!]: "\<box> 0" |
995eb45bbadc
added original Separation_Algebra theory
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
diff
changeset
|
259 |
by (simp add: sep_empty_def) |
995eb45bbadc
added original Separation_Algebra theory
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
diff
changeset
|
260 |
|
995eb45bbadc
added original Separation_Algebra theory
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
diff
changeset
|
261 |
|
995eb45bbadc
added original Separation_Algebra theory
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
diff
changeset
|
262 |
subsection {* Properties of @{text sep_true} and @{text sep_false} *} |
995eb45bbadc
added original Separation_Algebra theory
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
diff
changeset
|
263 |
|
995eb45bbadc
added original Separation_Algebra theory
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
diff
changeset
|
264 |
lemma sep_conj_sep_true: |
995eb45bbadc
added original Separation_Algebra theory
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
diff
changeset
|
265 |
"P h \<Longrightarrow> (P ** sep_true) h" |
995eb45bbadc
added original Separation_Algebra theory
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
diff
changeset
|
266 |
by (simp add: sep_conjI[where y=0]) |
995eb45bbadc
added original Separation_Algebra theory
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
diff
changeset
|
267 |
|
995eb45bbadc
added original Separation_Algebra theory
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
diff
changeset
|
268 |
lemma sep_conj_sep_true': |
995eb45bbadc
added original Separation_Algebra theory
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
diff
changeset
|
269 |
"P h \<Longrightarrow> (sep_true ** P) h" |
995eb45bbadc
added original Separation_Algebra theory
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
diff
changeset
|
270 |
by (simp add: sep_conjI[where x=0]) |
995eb45bbadc
added original Separation_Algebra theory
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
diff
changeset
|
271 |
|
995eb45bbadc
added original Separation_Algebra theory
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
diff
changeset
|
272 |
lemma sep_conj_true [simp]: |
995eb45bbadc
added original Separation_Algebra theory
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
diff
changeset
|
273 |
"(sep_true ** sep_true) = sep_true" |
995eb45bbadc
added original Separation_Algebra theory
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
diff
changeset
|
274 |
unfolding sep_conj_def |
995eb45bbadc
added original Separation_Algebra theory
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
diff
changeset
|
275 |
by (auto intro!: ext intro: disjoint_subheaps_exist) |
995eb45bbadc
added original Separation_Algebra theory
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
diff
changeset
|
276 |
|
995eb45bbadc
added original Separation_Algebra theory
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
diff
changeset
|
277 |
lemma sep_conj_false_right [simp]: |
995eb45bbadc
added original Separation_Algebra theory
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
diff
changeset
|
278 |
"(P ** sep_false) = sep_false" |
995eb45bbadc
added original Separation_Algebra theory
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
diff
changeset
|
279 |
by (force elim: sep_conjE intro!: ext) |
995eb45bbadc
added original Separation_Algebra theory
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
diff
changeset
|
280 |
|
995eb45bbadc
added original Separation_Algebra theory
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
diff
changeset
|
281 |
lemma sep_conj_false_left [simp]: |
995eb45bbadc
added original Separation_Algebra theory
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
diff
changeset
|
282 |
"(sep_false ** P) = sep_false" |
995eb45bbadc
added original Separation_Algebra theory
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
diff
changeset
|
283 |
by (subst sep_conj_commute) (rule sep_conj_false_right) |
995eb45bbadc
added original Separation_Algebra theory
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
diff
changeset
|
284 |
|
995eb45bbadc
added original Separation_Algebra theory
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
diff
changeset
|
285 |
|
995eb45bbadc
added original Separation_Algebra theory
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
diff
changeset
|
286 |
|
995eb45bbadc
added original Separation_Algebra theory
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
diff
changeset
|
287 |
subsection {* Properties of zero (@{const sep_empty}) *} |
995eb45bbadc
added original Separation_Algebra theory
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
diff
changeset
|
288 |
|
995eb45bbadc
added original Separation_Algebra theory
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
diff
changeset
|
289 |
lemma sep_conj_empty [simp]: |
995eb45bbadc
added original Separation_Algebra theory
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
diff
changeset
|
290 |
"(P ** \<box>) = P" |
995eb45bbadc
added original Separation_Algebra theory
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
diff
changeset
|
291 |
by (simp add: sep_conj_def sep_empty_def) |
995eb45bbadc
added original Separation_Algebra theory
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
diff
changeset
|
292 |
|
995eb45bbadc
added original Separation_Algebra theory
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
diff
changeset
|
293 |
lemma sep_conj_empty'[simp]: |
995eb45bbadc
added original Separation_Algebra theory
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
diff
changeset
|
294 |
"(\<box> ** P) = P" |
995eb45bbadc
added original Separation_Algebra theory
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
diff
changeset
|
295 |
by (subst sep_conj_commute, rule sep_conj_empty) |
995eb45bbadc
added original Separation_Algebra theory
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
diff
changeset
|
296 |
|
995eb45bbadc
added original Separation_Algebra theory
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
diff
changeset
|
297 |
lemma sep_conj_sep_emptyI: |
995eb45bbadc
added original Separation_Algebra theory
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
diff
changeset
|
298 |
"P h \<Longrightarrow> (P ** \<box>) h" |
995eb45bbadc
added original Separation_Algebra theory
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
diff
changeset
|
299 |
by simp |
995eb45bbadc
added original Separation_Algebra theory
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
diff
changeset
|
300 |
|
995eb45bbadc
added original Separation_Algebra theory
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
diff
changeset
|
301 |
lemma sep_conj_sep_emptyE: |
995eb45bbadc
added original Separation_Algebra theory
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
diff
changeset
|
302 |
"\<lbrakk> P s; (P ** \<box>) s \<Longrightarrow> (Q ** R) s \<rbrakk> \<Longrightarrow> (Q ** R) s" |
995eb45bbadc
added original Separation_Algebra theory
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
diff
changeset
|
303 |
by simp |
995eb45bbadc
added original Separation_Algebra theory
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
diff
changeset
|
304 |
|
995eb45bbadc
added original Separation_Algebra theory
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
diff
changeset
|
305 |
lemma monoid_add: "class.monoid_add (op **) \<box>" |
995eb45bbadc
added original Separation_Algebra theory
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
diff
changeset
|
306 |
by (unfold_locales) (auto simp: sep_conj_ac) |
995eb45bbadc
added original Separation_Algebra theory
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
diff
changeset
|
307 |
|
995eb45bbadc
added original Separation_Algebra theory
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
diff
changeset
|
308 |
lemma comm_monoid_add: "class.comm_monoid_add op ** \<box>" |
995eb45bbadc
added original Separation_Algebra theory
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
diff
changeset
|
309 |
by (unfold_locales) (auto simp: sep_conj_ac) |
995eb45bbadc
added original Separation_Algebra theory
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
diff
changeset
|
310 |
|
995eb45bbadc
added original Separation_Algebra theory
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
diff
changeset
|
311 |
|
995eb45bbadc
added original Separation_Algebra theory
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
diff
changeset
|
312 |
subsection {* Properties of top (@{text sep_true}) *} |
995eb45bbadc
added original Separation_Algebra theory
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
diff
changeset
|
313 |
|
995eb45bbadc
added original Separation_Algebra theory
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
diff
changeset
|
314 |
lemma sep_conj_true_P [simp]: |
995eb45bbadc
added original Separation_Algebra theory
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
diff
changeset
|
315 |
"(sep_true ** (sep_true ** P)) = (sep_true ** P)" |
995eb45bbadc
added original Separation_Algebra theory
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
diff
changeset
|
316 |
by (simp add: sep_conj_assoc[symmetric]) |
995eb45bbadc
added original Separation_Algebra theory
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
diff
changeset
|
317 |
|
995eb45bbadc
added original Separation_Algebra theory
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
diff
changeset
|
318 |
lemma sep_conj_disj: |
995eb45bbadc
added original Separation_Algebra theory
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
diff
changeset
|
319 |
"((P or Q) ** R) = ((P ** R) or (Q ** R))" |
995eb45bbadc
added original Separation_Algebra theory
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
diff
changeset
|
320 |
by (auto simp: sep_conj_def intro!: ext) |
995eb45bbadc
added original Separation_Algebra theory
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
diff
changeset
|
321 |
|
995eb45bbadc
added original Separation_Algebra theory
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
diff
changeset
|
322 |
lemma sep_conj_sep_true_left: |
995eb45bbadc
added original Separation_Algebra theory
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
diff
changeset
|
323 |
"(P ** Q) h \<Longrightarrow> (sep_true ** Q) h" |
995eb45bbadc
added original Separation_Algebra theory
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
diff
changeset
|
324 |
by (erule sep_conj_impl, simp+) |
995eb45bbadc
added original Separation_Algebra theory
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
diff
changeset
|
325 |
|
995eb45bbadc
added original Separation_Algebra theory
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
diff
changeset
|
326 |
lemma sep_conj_sep_true_right: |
995eb45bbadc
added original Separation_Algebra theory
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
diff
changeset
|
327 |
"(P ** Q) h \<Longrightarrow> (P ** sep_true) h" |
995eb45bbadc
added original Separation_Algebra theory
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
diff
changeset
|
328 |
by (subst (asm) sep_conj_commute, drule sep_conj_sep_true_left, |
995eb45bbadc
added original Separation_Algebra theory
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
diff
changeset
|
329 |
simp add: sep_conj_ac) |
995eb45bbadc
added original Separation_Algebra theory
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
diff
changeset
|
330 |
|
995eb45bbadc
added original Separation_Algebra theory
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
diff
changeset
|
331 |
|
995eb45bbadc
added original Separation_Algebra theory
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
diff
changeset
|
332 |
subsection {* Separating Conjunction with Quantifiers *} |
995eb45bbadc
added original Separation_Algebra theory
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
diff
changeset
|
333 |
|
995eb45bbadc
added original Separation_Algebra theory
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
diff
changeset
|
334 |
lemma sep_conj_conj: |
995eb45bbadc
added original Separation_Algebra theory
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
diff
changeset
|
335 |
"((P and Q) ** R) h \<Longrightarrow> ((P ** R) and (Q ** R)) h" |
995eb45bbadc
added original Separation_Algebra theory
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
diff
changeset
|
336 |
by (force intro: sep_conjI elim!: sep_conjE) |
995eb45bbadc
added original Separation_Algebra theory
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
diff
changeset
|
337 |
|
995eb45bbadc
added original Separation_Algebra theory
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
diff
changeset
|
338 |
lemma sep_conj_exists1: |
995eb45bbadc
added original Separation_Algebra theory
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
diff
changeset
|
339 |
"((EXS x. P x) ** Q) = (EXS x. (P x ** Q))" |
995eb45bbadc
added original Separation_Algebra theory
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
diff
changeset
|
340 |
by (force intro!: ext intro: sep_conjI elim: sep_conjE) |
995eb45bbadc
added original Separation_Algebra theory
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
diff
changeset
|
341 |
|
995eb45bbadc
added original Separation_Algebra theory
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
diff
changeset
|
342 |
lemma sep_conj_exists2: |
995eb45bbadc
added original Separation_Algebra theory
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
diff
changeset
|
343 |
"(P ** (EXS x. Q x)) = (EXS x. P ** Q x)" |
995eb45bbadc
added original Separation_Algebra theory
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
diff
changeset
|
344 |
by (force intro!: sep_conjI ext elim!: sep_conjE) |
995eb45bbadc
added original Separation_Algebra theory
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
diff
changeset
|
345 |
|
995eb45bbadc
added original Separation_Algebra theory
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
diff
changeset
|
346 |
lemmas sep_conj_exists = sep_conj_exists1 sep_conj_exists2 |
995eb45bbadc
added original Separation_Algebra theory
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
diff
changeset
|
347 |
|
995eb45bbadc
added original Separation_Algebra theory
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
diff
changeset
|
348 |
lemma sep_conj_spec: |
995eb45bbadc
added original Separation_Algebra theory
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
diff
changeset
|
349 |
"((ALLS x. P x) ** Q) h \<Longrightarrow> (P x ** Q) h" |
995eb45bbadc
added original Separation_Algebra theory
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
diff
changeset
|
350 |
by (force intro: sep_conjI elim: sep_conjE) |
995eb45bbadc
added original Separation_Algebra theory
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
diff
changeset
|
351 |
|
995eb45bbadc
added original Separation_Algebra theory
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
diff
changeset
|
352 |
|
995eb45bbadc
added original Separation_Algebra theory
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
diff
changeset
|
353 |
subsection {* Properties of Separating Implication *} |
995eb45bbadc
added original Separation_Algebra theory
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
diff
changeset
|
354 |
|
995eb45bbadc
added original Separation_Algebra theory
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
diff
changeset
|
355 |
lemma sep_implI: |
995eb45bbadc
added original Separation_Algebra theory
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
diff
changeset
|
356 |
assumes a: "\<And>h'. \<lbrakk> h ## h'; P h' \<rbrakk> \<Longrightarrow> Q (h + h')" |
995eb45bbadc
added original Separation_Algebra theory
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
diff
changeset
|
357 |
shows "(P \<longrightarrow>* Q) h" |
995eb45bbadc
added original Separation_Algebra theory
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
diff
changeset
|
358 |
unfolding sep_impl_def by (auto elim: a) |
995eb45bbadc
added original Separation_Algebra theory
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
diff
changeset
|
359 |
|
995eb45bbadc
added original Separation_Algebra theory
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
diff
changeset
|
360 |
lemma sep_implD: |
995eb45bbadc
added original Separation_Algebra theory
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
diff
changeset
|
361 |
"(x \<longrightarrow>* y) h \<Longrightarrow> \<forall>h'. h ## h' \<and> x h' \<longrightarrow> y (h + h')" |
995eb45bbadc
added original Separation_Algebra theory
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
diff
changeset
|
362 |
by (force simp: sep_impl_def) |
995eb45bbadc
added original Separation_Algebra theory
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
diff
changeset
|
363 |
|
995eb45bbadc
added original Separation_Algebra theory
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
diff
changeset
|
364 |
lemma sep_implE: |
995eb45bbadc
added original Separation_Algebra theory
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
diff
changeset
|
365 |
"(x \<longrightarrow>* y) h \<Longrightarrow> (\<forall>h'. h ## h' \<and> x h' \<longrightarrow> y (h + h') \<Longrightarrow> Q) \<Longrightarrow> Q" |
995eb45bbadc
added original Separation_Algebra theory
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
diff
changeset
|
366 |
by (auto dest: sep_implD) |
995eb45bbadc
added original Separation_Algebra theory
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
diff
changeset
|
367 |
|
995eb45bbadc
added original Separation_Algebra theory
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
diff
changeset
|
368 |
lemma sep_impl_sep_true [simp]: |
995eb45bbadc
added original Separation_Algebra theory
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
diff
changeset
|
369 |
"(P \<longrightarrow>* sep_true) = sep_true" |
995eb45bbadc
added original Separation_Algebra theory
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
diff
changeset
|
370 |
by (force intro!: sep_implI ext) |
995eb45bbadc
added original Separation_Algebra theory
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
diff
changeset
|
371 |
|
995eb45bbadc
added original Separation_Algebra theory
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
diff
changeset
|
372 |
lemma sep_impl_sep_false [simp]: |
995eb45bbadc
added original Separation_Algebra theory
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
diff
changeset
|
373 |
"(sep_false \<longrightarrow>* P) = sep_true" |
995eb45bbadc
added original Separation_Algebra theory
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
diff
changeset
|
374 |
by (force intro!: sep_implI ext) |
995eb45bbadc
added original Separation_Algebra theory
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
diff
changeset
|
375 |
|
995eb45bbadc
added original Separation_Algebra theory
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
diff
changeset
|
376 |
lemma sep_impl_sep_true_P: |
995eb45bbadc
added original Separation_Algebra theory
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
diff
changeset
|
377 |
"(sep_true \<longrightarrow>* P) h \<Longrightarrow> P h" |
995eb45bbadc
added original Separation_Algebra theory
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
diff
changeset
|
378 |
by (clarsimp dest!: sep_implD elim!: allE[where x=0]) |
995eb45bbadc
added original Separation_Algebra theory
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
diff
changeset
|
379 |
|
995eb45bbadc
added original Separation_Algebra theory
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
diff
changeset
|
380 |
lemma sep_impl_sep_true_false [simp]: |
995eb45bbadc
added original Separation_Algebra theory
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
diff
changeset
|
381 |
"(sep_true \<longrightarrow>* sep_false) = sep_false" |
995eb45bbadc
added original Separation_Algebra theory
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
diff
changeset
|
382 |
by (force intro!: ext dest: sep_impl_sep_true_P) |
995eb45bbadc
added original Separation_Algebra theory
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
diff
changeset
|
383 |
|
995eb45bbadc
added original Separation_Algebra theory
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
diff
changeset
|
384 |
lemma sep_conj_sep_impl: |
995eb45bbadc
added original Separation_Algebra theory
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
diff
changeset
|
385 |
"\<lbrakk> P h; \<And>h. (P ** Q) h \<Longrightarrow> R h \<rbrakk> \<Longrightarrow> (Q \<longrightarrow>* R) h" |
995eb45bbadc
added original Separation_Algebra theory
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
diff
changeset
|
386 |
proof (rule sep_implI) |
995eb45bbadc
added original Separation_Algebra theory
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
diff
changeset
|
387 |
fix h' h |
995eb45bbadc
added original Separation_Algebra theory
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
diff
changeset
|
388 |
assume "P h" and "h ## h'" and "Q h'" |
995eb45bbadc
added original Separation_Algebra theory
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
diff
changeset
|
389 |
hence "(P ** Q) (h + h')" by (force intro: sep_conjI) |
995eb45bbadc
added original Separation_Algebra theory
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
diff
changeset
|
390 |
moreover assume "\<And>h. (P ** Q) h \<Longrightarrow> R h" |
995eb45bbadc
added original Separation_Algebra theory
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
diff
changeset
|
391 |
ultimately show "R (h + h')" by simp |
995eb45bbadc
added original Separation_Algebra theory
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
diff
changeset
|
392 |
qed |
995eb45bbadc
added original Separation_Algebra theory
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
diff
changeset
|
393 |
|
995eb45bbadc
added original Separation_Algebra theory
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
diff
changeset
|
394 |
lemma sep_conj_sep_impl2: |
995eb45bbadc
added original Separation_Algebra theory
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
diff
changeset
|
395 |
"\<lbrakk> (P ** Q) h; \<And>h. P h \<Longrightarrow> (Q \<longrightarrow>* R) h \<rbrakk> \<Longrightarrow> R h" |
995eb45bbadc
added original Separation_Algebra theory
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
diff
changeset
|
396 |
by (force dest: sep_implD elim: sep_conjE) |
995eb45bbadc
added original Separation_Algebra theory
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
diff
changeset
|
397 |
|
995eb45bbadc
added original Separation_Algebra theory
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
diff
changeset
|
398 |
lemma sep_conj_sep_impl_sep_conj2: |
995eb45bbadc
added original Separation_Algebra theory
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
diff
changeset
|
399 |
"(P ** R) h \<Longrightarrow> (P ** (Q \<longrightarrow>* (Q ** R))) h" |
995eb45bbadc
added original Separation_Algebra theory
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
diff
changeset
|
400 |
by (erule (1) sep_conj_impl, erule sep_conj_sep_impl, simp add: sep_conj_ac) |
995eb45bbadc
added original Separation_Algebra theory
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
diff
changeset
|
401 |
|
995eb45bbadc
added original Separation_Algebra theory
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
diff
changeset
|
402 |
|
995eb45bbadc
added original Separation_Algebra theory
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
diff
changeset
|
403 |
subsection {* Pure assertions *} |
995eb45bbadc
added original Separation_Algebra theory
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
diff
changeset
|
404 |
|
995eb45bbadc
added original Separation_Algebra theory
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
diff
changeset
|
405 |
definition |
995eb45bbadc
added original Separation_Algebra theory
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
diff
changeset
|
406 |
pure :: "('a \<Rightarrow> bool) \<Rightarrow> bool" where |
995eb45bbadc
added original Separation_Algebra theory
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
diff
changeset
|
407 |
"pure P \<equiv> \<forall>h h'. P h = P h'" |
995eb45bbadc
added original Separation_Algebra theory
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
diff
changeset
|
408 |
|
995eb45bbadc
added original Separation_Algebra theory
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
diff
changeset
|
409 |
lemma pure_sep_true: |
995eb45bbadc
added original Separation_Algebra theory
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
diff
changeset
|
410 |
"pure sep_true" |
995eb45bbadc
added original Separation_Algebra theory
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
diff
changeset
|
411 |
by (simp add: pure_def) |
995eb45bbadc
added original Separation_Algebra theory
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
diff
changeset
|
412 |
|
995eb45bbadc
added original Separation_Algebra theory
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
diff
changeset
|
413 |
lemma pure_sep_false: |
995eb45bbadc
added original Separation_Algebra theory
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
diff
changeset
|
414 |
"pure sep_true" |
995eb45bbadc
added original Separation_Algebra theory
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
diff
changeset
|
415 |
by (simp add: pure_def) |
995eb45bbadc
added original Separation_Algebra theory
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
diff
changeset
|
416 |
|
995eb45bbadc
added original Separation_Algebra theory
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
diff
changeset
|
417 |
lemma pure_split: |
995eb45bbadc
added original Separation_Algebra theory
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
diff
changeset
|
418 |
"pure P = (P = sep_true \<or> P = sep_false)" |
995eb45bbadc
added original Separation_Algebra theory
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
diff
changeset
|
419 |
by (force simp: pure_def intro!: ext) |
995eb45bbadc
added original Separation_Algebra theory
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
diff
changeset
|
420 |
|
995eb45bbadc
added original Separation_Algebra theory
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
diff
changeset
|
421 |
lemma pure_sep_conj: |
995eb45bbadc
added original Separation_Algebra theory
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
diff
changeset
|
422 |
"\<lbrakk> pure P; pure Q \<rbrakk> \<Longrightarrow> pure (P \<and>* Q)" |
995eb45bbadc
added original Separation_Algebra theory
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
diff
changeset
|
423 |
by (force simp: pure_split) |
995eb45bbadc
added original Separation_Algebra theory
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
diff
changeset
|
424 |
|
995eb45bbadc
added original Separation_Algebra theory
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
diff
changeset
|
425 |
lemma pure_sep_impl: |
995eb45bbadc
added original Separation_Algebra theory
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
diff
changeset
|
426 |
"\<lbrakk> pure P; pure Q \<rbrakk> \<Longrightarrow> pure (P \<longrightarrow>* Q)" |
995eb45bbadc
added original Separation_Algebra theory
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
diff
changeset
|
427 |
by (force simp: pure_split) |
995eb45bbadc
added original Separation_Algebra theory
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
diff
changeset
|
428 |
|
995eb45bbadc
added original Separation_Algebra theory
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
diff
changeset
|
429 |
lemma pure_conj_sep_conj: |
995eb45bbadc
added original Separation_Algebra theory
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
diff
changeset
|
430 |
"\<lbrakk> (P and Q) h; pure P \<or> pure Q \<rbrakk> \<Longrightarrow> (P \<and>* Q) h" |
995eb45bbadc
added original Separation_Algebra theory
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
diff
changeset
|
431 |
by (metis pure_def sep_add_zero sep_conjI sep_conj_commute sep_disj_zero) |
995eb45bbadc
added original Separation_Algebra theory
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
diff
changeset
|
432 |
|
995eb45bbadc
added original Separation_Algebra theory
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
diff
changeset
|
433 |
lemma pure_sep_conj_conj: |
995eb45bbadc
added original Separation_Algebra theory
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
diff
changeset
|
434 |
"\<lbrakk> (P \<and>* Q) h; pure P; pure Q \<rbrakk> \<Longrightarrow> (P and Q) h" |
995eb45bbadc
added original Separation_Algebra theory
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
diff
changeset
|
435 |
by (force simp: pure_split) |
995eb45bbadc
added original Separation_Algebra theory
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
diff
changeset
|
436 |
|
995eb45bbadc
added original Separation_Algebra theory
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
diff
changeset
|
437 |
lemma pure_conj_sep_conj_assoc: |
995eb45bbadc
added original Separation_Algebra theory
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
diff
changeset
|
438 |
"pure P \<Longrightarrow> ((P and Q) \<and>* R) = (P and (Q \<and>* R))" |
995eb45bbadc
added original Separation_Algebra theory
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
diff
changeset
|
439 |
by (auto simp: pure_split) |
995eb45bbadc
added original Separation_Algebra theory
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
diff
changeset
|
440 |
|
995eb45bbadc
added original Separation_Algebra theory
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
diff
changeset
|
441 |
lemma pure_sep_impl_impl: |
995eb45bbadc
added original Separation_Algebra theory
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
diff
changeset
|
442 |
"\<lbrakk> (P \<longrightarrow>* Q) h; pure P \<rbrakk> \<Longrightarrow> P h \<longrightarrow> Q h" |
995eb45bbadc
added original Separation_Algebra theory
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
diff
changeset
|
443 |
by (force simp: pure_split dest: sep_impl_sep_true_P) |
995eb45bbadc
added original Separation_Algebra theory
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
diff
changeset
|
444 |
|
995eb45bbadc
added original Separation_Algebra theory
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
diff
changeset
|
445 |
lemma pure_impl_sep_impl: |
995eb45bbadc
added original Separation_Algebra theory
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
diff
changeset
|
446 |
"\<lbrakk> P h \<longrightarrow> Q h; pure P; pure Q \<rbrakk> \<Longrightarrow> (P \<longrightarrow>* Q) h" |
995eb45bbadc
added original Separation_Algebra theory
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
diff
changeset
|
447 |
by (force simp: pure_split) |
995eb45bbadc
added original Separation_Algebra theory
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
diff
changeset
|
448 |
|
995eb45bbadc
added original Separation_Algebra theory
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
diff
changeset
|
449 |
lemma pure_conj_right: "(Q \<and>* (\<langle>P'\<rangle> and Q')) = (\<langle>P'\<rangle> and (Q \<and>* Q'))" |
995eb45bbadc
added original Separation_Algebra theory
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
diff
changeset
|
450 |
by (rule ext, rule, rule, clarsimp elim!: sep_conjE) |
995eb45bbadc
added original Separation_Algebra theory
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
diff
changeset
|
451 |
(erule sep_conj_impl, auto) |
995eb45bbadc
added original Separation_Algebra theory
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
diff
changeset
|
452 |
|
995eb45bbadc
added original Separation_Algebra theory
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
diff
changeset
|
453 |
lemma pure_conj_right': "(Q \<and>* (P' and \<langle>Q'\<rangle>)) = (\<langle>Q'\<rangle> and (Q \<and>* P'))" |
995eb45bbadc
added original Separation_Algebra theory
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
diff
changeset
|
454 |
by (simp add: conj_comms pure_conj_right) |
995eb45bbadc
added original Separation_Algebra theory
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
diff
changeset
|
455 |
|
995eb45bbadc
added original Separation_Algebra theory
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
diff
changeset
|
456 |
lemma pure_conj_left: "((\<langle>P'\<rangle> and Q') \<and>* Q) = (\<langle>P'\<rangle> and (Q' \<and>* Q))" |
995eb45bbadc
added original Separation_Algebra theory
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
diff
changeset
|
457 |
by (simp add: pure_conj_right sep_conj_ac) |
995eb45bbadc
added original Separation_Algebra theory
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
diff
changeset
|
458 |
|
995eb45bbadc
added original Separation_Algebra theory
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
diff
changeset
|
459 |
lemma pure_conj_left': "((P' and \<langle>Q'\<rangle>) \<and>* Q) = (\<langle>Q'\<rangle> and (P' \<and>* Q))" |
995eb45bbadc
added original Separation_Algebra theory
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
diff
changeset
|
460 |
by (subst conj_comms, subst pure_conj_left, simp) |
995eb45bbadc
added original Separation_Algebra theory
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
diff
changeset
|
461 |
|
995eb45bbadc
added original Separation_Algebra theory
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
diff
changeset
|
462 |
lemmas pure_conj = pure_conj_right pure_conj_right' pure_conj_left |
995eb45bbadc
added original Separation_Algebra theory
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
diff
changeset
|
463 |
pure_conj_left' |
995eb45bbadc
added original Separation_Algebra theory
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
diff
changeset
|
464 |
|
995eb45bbadc
added original Separation_Algebra theory
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
diff
changeset
|
465 |
declare pure_conj[simp add] |
995eb45bbadc
added original Separation_Algebra theory
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
diff
changeset
|
466 |
|
995eb45bbadc
added original Separation_Algebra theory
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
diff
changeset
|
467 |
|
995eb45bbadc
added original Separation_Algebra theory
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
diff
changeset
|
468 |
subsection {* Intuitionistic assertions *} |
995eb45bbadc
added original Separation_Algebra theory
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
diff
changeset
|
469 |
|
995eb45bbadc
added original Separation_Algebra theory
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
diff
changeset
|
470 |
definition intuitionistic :: "('a \<Rightarrow> bool) \<Rightarrow> bool" where |
995eb45bbadc
added original Separation_Algebra theory
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
diff
changeset
|
471 |
"intuitionistic P \<equiv> \<forall>h h'. P h \<and> h \<preceq> h' \<longrightarrow> P h'" |
995eb45bbadc
added original Separation_Algebra theory
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
diff
changeset
|
472 |
|
995eb45bbadc
added original Separation_Algebra theory
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
diff
changeset
|
473 |
lemma intuitionisticI: |
995eb45bbadc
added original Separation_Algebra theory
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
diff
changeset
|
474 |
"(\<And>h h'. \<lbrakk> P h; h \<preceq> h' \<rbrakk> \<Longrightarrow> P h') \<Longrightarrow> intuitionistic P" |
995eb45bbadc
added original Separation_Algebra theory
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
diff
changeset
|
475 |
by (unfold intuitionistic_def, fast) |
995eb45bbadc
added original Separation_Algebra theory
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
diff
changeset
|
476 |
|
995eb45bbadc
added original Separation_Algebra theory
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
diff
changeset
|
477 |
lemma intuitionisticD: |
995eb45bbadc
added original Separation_Algebra theory
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
diff
changeset
|
478 |
"\<lbrakk> intuitionistic P; P h; h \<preceq> h' \<rbrakk> \<Longrightarrow> P h'" |
995eb45bbadc
added original Separation_Algebra theory
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
diff
changeset
|
479 |
by (unfold intuitionistic_def, fast) |
995eb45bbadc
added original Separation_Algebra theory
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
diff
changeset
|
480 |
|
995eb45bbadc
added original Separation_Algebra theory
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
diff
changeset
|
481 |
lemma pure_intuitionistic: |
995eb45bbadc
added original Separation_Algebra theory
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
diff
changeset
|
482 |
"pure P \<Longrightarrow> intuitionistic P" |
995eb45bbadc
added original Separation_Algebra theory
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
diff
changeset
|
483 |
by (clarsimp simp: intuitionistic_def pure_def, fast) |
995eb45bbadc
added original Separation_Algebra theory
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
diff
changeset
|
484 |
|
995eb45bbadc
added original Separation_Algebra theory
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
diff
changeset
|
485 |
lemma intuitionistic_conj: |
995eb45bbadc
added original Separation_Algebra theory
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
diff
changeset
|
486 |
"\<lbrakk> intuitionistic P; intuitionistic Q \<rbrakk> \<Longrightarrow> intuitionistic (P and Q)" |
995eb45bbadc
added original Separation_Algebra theory
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
diff
changeset
|
487 |
by (force intro: intuitionisticI dest: intuitionisticD) |
995eb45bbadc
added original Separation_Algebra theory
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
diff
changeset
|
488 |
|
995eb45bbadc
added original Separation_Algebra theory
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
diff
changeset
|
489 |
lemma intuitionistic_disj: |
995eb45bbadc
added original Separation_Algebra theory
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
diff
changeset
|
490 |
"\<lbrakk> intuitionistic P; intuitionistic Q \<rbrakk> \<Longrightarrow> intuitionistic (P or Q)" |
995eb45bbadc
added original Separation_Algebra theory
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
diff
changeset
|
491 |
by (force intro: intuitionisticI dest: intuitionisticD) |
995eb45bbadc
added original Separation_Algebra theory
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
diff
changeset
|
492 |
|
995eb45bbadc
added original Separation_Algebra theory
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
diff
changeset
|
493 |
lemma intuitionistic_forall: |
995eb45bbadc
added original Separation_Algebra theory
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
diff
changeset
|
494 |
"(\<And>x. intuitionistic (P x)) \<Longrightarrow> intuitionistic (ALLS x. P x)" |
995eb45bbadc
added original Separation_Algebra theory
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
diff
changeset
|
495 |
by (force intro: intuitionisticI dest: intuitionisticD) |
995eb45bbadc
added original Separation_Algebra theory
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
diff
changeset
|
496 |
|
995eb45bbadc
added original Separation_Algebra theory
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
diff
changeset
|
497 |
lemma intuitionistic_exists: |
995eb45bbadc
added original Separation_Algebra theory
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
diff
changeset
|
498 |
"(\<And>x. intuitionistic (P x)) \<Longrightarrow> intuitionistic (EXS x. P x)" |
995eb45bbadc
added original Separation_Algebra theory
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
diff
changeset
|
499 |
by (force intro: intuitionisticI dest: intuitionisticD) |
995eb45bbadc
added original Separation_Algebra theory
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
diff
changeset
|
500 |
|
995eb45bbadc
added original Separation_Algebra theory
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
diff
changeset
|
501 |
lemma intuitionistic_sep_conj_sep_true: |
995eb45bbadc
added original Separation_Algebra theory
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
diff
changeset
|
502 |
"intuitionistic (sep_true \<and>* P)" |
995eb45bbadc
added original Separation_Algebra theory
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
diff
changeset
|
503 |
proof (rule intuitionisticI) |
995eb45bbadc
added original Separation_Algebra theory
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
diff
changeset
|
504 |
fix h h' r |
995eb45bbadc
added original Separation_Algebra theory
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
diff
changeset
|
505 |
assume a: "(sep_true \<and>* P) h" |
995eb45bbadc
added original Separation_Algebra theory
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
diff
changeset
|
506 |
then obtain x y where P: "P y" and h: "h = x + y" and xyd: "x ## y" |
995eb45bbadc
added original Separation_Algebra theory
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
diff
changeset
|
507 |
by - (drule sep_conjD, clarsimp) |
995eb45bbadc
added original Separation_Algebra theory
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
diff
changeset
|
508 |
moreover assume a2: "h \<preceq> h'" |
995eb45bbadc
added original Separation_Algebra theory
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
diff
changeset
|
509 |
then obtain z where h': "h' = h + z" and hzd: "h ## z" |
995eb45bbadc
added original Separation_Algebra theory
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
diff
changeset
|
510 |
by (clarsimp simp: sep_substate_def) |
995eb45bbadc
added original Separation_Algebra theory
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
diff
changeset
|
511 |
|
995eb45bbadc
added original Separation_Algebra theory
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
diff
changeset
|
512 |
moreover have "(P \<and>* sep_true) (y + (x + z))" |
995eb45bbadc
added original Separation_Algebra theory
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
diff
changeset
|
513 |
using P h hzd xyd |
995eb45bbadc
added original Separation_Algebra theory
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
diff
changeset
|
514 |
by (metis sep_add_disjI1 sep_disj_commute sep_conjI) |
995eb45bbadc
added original Separation_Algebra theory
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
diff
changeset
|
515 |
ultimately show "(sep_true \<and>* P) h'" using hzd |
995eb45bbadc
added original Separation_Algebra theory
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
diff
changeset
|
516 |
by (auto simp: sep_conj_commute sep_add_ac dest!: sep_disj_addD) |
995eb45bbadc
added original Separation_Algebra theory
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
diff
changeset
|
517 |
qed |
995eb45bbadc
added original Separation_Algebra theory
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
diff
changeset
|
518 |
|
995eb45bbadc
added original Separation_Algebra theory
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
diff
changeset
|
519 |
lemma intuitionistic_sep_impl_sep_true: |
995eb45bbadc
added original Separation_Algebra theory
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
diff
changeset
|
520 |
"intuitionistic (sep_true \<longrightarrow>* P)" |
995eb45bbadc
added original Separation_Algebra theory
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
diff
changeset
|
521 |
proof (rule intuitionisticI) |
995eb45bbadc
added original Separation_Algebra theory
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
diff
changeset
|
522 |
fix h h' |
995eb45bbadc
added original Separation_Algebra theory
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
diff
changeset
|
523 |
assume imp: "(sep_true \<longrightarrow>* P) h" and hh': "h \<preceq> h'" |
995eb45bbadc
added original Separation_Algebra theory
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
diff
changeset
|
524 |
|
995eb45bbadc
added original Separation_Algebra theory
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
diff
changeset
|
525 |
from hh' obtain z where h': "h' = h + z" and hzd: "h ## z" |
995eb45bbadc
added original Separation_Algebra theory
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
diff
changeset
|
526 |
by (clarsimp simp: sep_substate_def) |
995eb45bbadc
added original Separation_Algebra theory
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
diff
changeset
|
527 |
show "(sep_true \<longrightarrow>* P) h'" using imp h' hzd |
995eb45bbadc
added original Separation_Algebra theory
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
diff
changeset
|
528 |
apply (clarsimp dest!: sep_implD) |
995eb45bbadc
added original Separation_Algebra theory
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
diff
changeset
|
529 |
apply (metis sep_add_assoc sep_add_disjD sep_disj_addI3 sep_implI) |
995eb45bbadc
added original Separation_Algebra theory
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
diff
changeset
|
530 |
done |
995eb45bbadc
added original Separation_Algebra theory
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
diff
changeset
|
531 |
qed |
995eb45bbadc
added original Separation_Algebra theory
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
diff
changeset
|
532 |
|
995eb45bbadc
added original Separation_Algebra theory
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
diff
changeset
|
533 |
lemma intuitionistic_sep_conj: |
995eb45bbadc
added original Separation_Algebra theory
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
diff
changeset
|
534 |
assumes ip: "intuitionistic (P::('a \<Rightarrow> bool))" |
995eb45bbadc
added original Separation_Algebra theory
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
diff
changeset
|
535 |
shows "intuitionistic (P \<and>* Q)" |
995eb45bbadc
added original Separation_Algebra theory
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
diff
changeset
|
536 |
proof (rule intuitionisticI) |
995eb45bbadc
added original Separation_Algebra theory
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
diff
changeset
|
537 |
fix h h' |
995eb45bbadc
added original Separation_Algebra theory
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
diff
changeset
|
538 |
assume sc: "(P \<and>* Q) h" and hh': "h \<preceq> h'" |
995eb45bbadc
added original Separation_Algebra theory
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
diff
changeset
|
539 |
|
995eb45bbadc
added original Separation_Algebra theory
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
diff
changeset
|
540 |
from hh' obtain z where h': "h' = h + z" and hzd: "h ## z" |
995eb45bbadc
added original Separation_Algebra theory
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
diff
changeset
|
541 |
by (clarsimp simp: sep_substate_def) |
995eb45bbadc
added original Separation_Algebra theory
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
diff
changeset
|
542 |
|
995eb45bbadc
added original Separation_Algebra theory
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
diff
changeset
|
543 |
from sc obtain x y where px: "P x" and qy: "Q y" |
995eb45bbadc
added original Separation_Algebra theory
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
diff
changeset
|
544 |
and h: "h = x + y" and xyd: "x ## y" |
995eb45bbadc
added original Separation_Algebra theory
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
diff
changeset
|
545 |
by (clarsimp simp: sep_conj_def) |
995eb45bbadc
added original Separation_Algebra theory
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
diff
changeset
|
546 |
|
995eb45bbadc
added original Separation_Algebra theory
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
diff
changeset
|
547 |
have "x ## z" using hzd h xyd |
995eb45bbadc
added original Separation_Algebra theory
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
diff
changeset
|
548 |
by (metis sep_add_disjD) |
995eb45bbadc
added original Separation_Algebra theory
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
diff
changeset
|
549 |
|
995eb45bbadc
added original Separation_Algebra theory
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
diff
changeset
|
550 |
with ip px have "P (x + z)" |
995eb45bbadc
added original Separation_Algebra theory
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
diff
changeset
|
551 |
by (fastforce elim: intuitionisticD sep_substate_disj_add) |
995eb45bbadc
added original Separation_Algebra theory
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
diff
changeset
|
552 |
|
995eb45bbadc
added original Separation_Algebra theory
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
diff
changeset
|
553 |
thus "(P \<and>* Q) h'" using h' h hzd qy xyd |
995eb45bbadc
added original Separation_Algebra theory
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
diff
changeset
|
554 |
by (metis (full_types) sep_add_commute sep_add_disjD sep_add_disjI2 |
995eb45bbadc
added original Separation_Algebra theory
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
diff
changeset
|
555 |
sep_add_left_commute sep_conjI) |
995eb45bbadc
added original Separation_Algebra theory
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
diff
changeset
|
556 |
qed |
995eb45bbadc
added original Separation_Algebra theory
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
diff
changeset
|
557 |
|
995eb45bbadc
added original Separation_Algebra theory
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
diff
changeset
|
558 |
lemma intuitionistic_sep_impl: |
995eb45bbadc
added original Separation_Algebra theory
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
diff
changeset
|
559 |
assumes iq: "intuitionistic Q" |
995eb45bbadc
added original Separation_Algebra theory
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
diff
changeset
|
560 |
shows "intuitionistic (P \<longrightarrow>* Q)" |
995eb45bbadc
added original Separation_Algebra theory
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
diff
changeset
|
561 |
proof (rule intuitionisticI) |
995eb45bbadc
added original Separation_Algebra theory
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
diff
changeset
|
562 |
fix h h' |
995eb45bbadc
added original Separation_Algebra theory
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
diff
changeset
|
563 |
assume imp: "(P \<longrightarrow>* Q) h" and hh': "h \<preceq> h'" |
995eb45bbadc
added original Separation_Algebra theory
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
diff
changeset
|
564 |
|
995eb45bbadc
added original Separation_Algebra theory
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
diff
changeset
|
565 |
from hh' obtain z where h': "h' = h + z" and hzd: "h ## z" |
995eb45bbadc
added original Separation_Algebra theory
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
diff
changeset
|
566 |
by (clarsimp simp: sep_substate_def) |
995eb45bbadc
added original Separation_Algebra theory
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
diff
changeset
|
567 |
|
995eb45bbadc
added original Separation_Algebra theory
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
diff
changeset
|
568 |
{ |
995eb45bbadc
added original Separation_Algebra theory
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
diff
changeset
|
569 |
fix x |
995eb45bbadc
added original Separation_Algebra theory
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
diff
changeset
|
570 |
assume px: "P x" and hzx: "h + z ## x" |
995eb45bbadc
added original Separation_Algebra theory
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
diff
changeset
|
571 |
|
995eb45bbadc
added original Separation_Algebra theory
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
diff
changeset
|
572 |
have "h + x \<preceq> h + x + z" using hzx hzd |
995eb45bbadc
added original Separation_Algebra theory
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
diff
changeset
|
573 |
by (metis sep_add_disjI1 sep_substate_def) |
995eb45bbadc
added original Separation_Algebra theory
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
diff
changeset
|
574 |
|
995eb45bbadc
added original Separation_Algebra theory
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
diff
changeset
|
575 |
with imp hzd iq px hzx |
995eb45bbadc
added original Separation_Algebra theory
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
diff
changeset
|
576 |
have "Q (h + z + x)" |
995eb45bbadc
added original Separation_Algebra theory
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
diff
changeset
|
577 |
by (metis intuitionisticD sep_add_assoc sep_add_ac sep_add_disjD sep_implE) |
995eb45bbadc
added original Separation_Algebra theory
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
diff
changeset
|
578 |
} |
995eb45bbadc
added original Separation_Algebra theory
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
diff
changeset
|
579 |
|
995eb45bbadc
added original Separation_Algebra theory
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
diff
changeset
|
580 |
with imp h' hzd iq show "(P \<longrightarrow>* Q) h'" |
995eb45bbadc
added original Separation_Algebra theory
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
diff
changeset
|
581 |
by (fastforce intro: sep_implI) |
995eb45bbadc
added original Separation_Algebra theory
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
diff
changeset
|
582 |
qed |
995eb45bbadc
added original Separation_Algebra theory
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
diff
changeset
|
583 |
|
995eb45bbadc
added original Separation_Algebra theory
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
diff
changeset
|
584 |
lemma strongest_intuitionistic: |
995eb45bbadc
added original Separation_Algebra theory
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
diff
changeset
|
585 |
"\<not> (\<exists>Q. (\<forall>h. (Q h \<longrightarrow> (P \<and>* sep_true) h)) \<and> intuitionistic Q \<and> |
995eb45bbadc
added original Separation_Algebra theory
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
diff
changeset
|
586 |
Q \<noteq> (P \<and>* sep_true) \<and> (\<forall>h. P h \<longrightarrow> Q h))" |
995eb45bbadc
added original Separation_Algebra theory
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
diff
changeset
|
587 |
by (fastforce intro!: ext sep_substate_disj_add |
995eb45bbadc
added original Separation_Algebra theory
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
diff
changeset
|
588 |
dest!: sep_conjD intuitionisticD) |
995eb45bbadc
added original Separation_Algebra theory
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
diff
changeset
|
589 |
|
995eb45bbadc
added original Separation_Algebra theory
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
diff
changeset
|
590 |
lemma weakest_intuitionistic: |
995eb45bbadc
added original Separation_Algebra theory
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
diff
changeset
|
591 |
"\<not> (\<exists>Q. (\<forall>h. ((sep_true \<longrightarrow>* P) h \<longrightarrow> Q h)) \<and> intuitionistic Q \<and> |
995eb45bbadc
added original Separation_Algebra theory
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
diff
changeset
|
592 |
Q \<noteq> (sep_true \<longrightarrow>* P) \<and> (\<forall>h. Q h \<longrightarrow> P h))" |
995eb45bbadc
added original Separation_Algebra theory
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
diff
changeset
|
593 |
apply (clarsimp intro!: ext) |
995eb45bbadc
added original Separation_Algebra theory
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
diff
changeset
|
594 |
apply (rule iffI) |
995eb45bbadc
added original Separation_Algebra theory
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
diff
changeset
|
595 |
apply (rule sep_implI) |
995eb45bbadc
added original Separation_Algebra theory
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
diff
changeset
|
596 |
apply (drule_tac h="x" and h'="x + h'" in intuitionisticD) |
995eb45bbadc
added original Separation_Algebra theory
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
diff
changeset
|
597 |
apply (clarsimp simp: sep_add_ac sep_substate_disj_add)+ |
995eb45bbadc
added original Separation_Algebra theory
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
diff
changeset
|
598 |
done |
995eb45bbadc
added original Separation_Algebra theory
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
diff
changeset
|
599 |
|
995eb45bbadc
added original Separation_Algebra theory
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
diff
changeset
|
600 |
lemma intuitionistic_sep_conj_sep_true_P: |
995eb45bbadc
added original Separation_Algebra theory
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
diff
changeset
|
601 |
"\<lbrakk> (P \<and>* sep_true) s; intuitionistic P \<rbrakk> \<Longrightarrow> P s" |
995eb45bbadc
added original Separation_Algebra theory
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
diff
changeset
|
602 |
by (force dest: intuitionisticD elim: sep_conjE sep_substate_disj_add) |
995eb45bbadc
added original Separation_Algebra theory
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
diff
changeset
|
603 |
|
995eb45bbadc
added original Separation_Algebra theory
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
diff
changeset
|
604 |
lemma intuitionistic_sep_conj_sep_true_simp: |
995eb45bbadc
added original Separation_Algebra theory
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
diff
changeset
|
605 |
"intuitionistic P \<Longrightarrow> (P \<and>* sep_true) = P" |
995eb45bbadc
added original Separation_Algebra theory
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
diff
changeset
|
606 |
by (fast intro!: sep_conj_sep_true ext |
995eb45bbadc
added original Separation_Algebra theory
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
diff
changeset
|
607 |
elim: intuitionistic_sep_conj_sep_true_P) |
995eb45bbadc
added original Separation_Algebra theory
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
diff
changeset
|
608 |
|
995eb45bbadc
added original Separation_Algebra theory
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
diff
changeset
|
609 |
lemma intuitionistic_sep_impl_sep_true_P: |
995eb45bbadc
added original Separation_Algebra theory
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
diff
changeset
|
610 |
"\<lbrakk> P h; intuitionistic P \<rbrakk> \<Longrightarrow> (sep_true \<longrightarrow>* P) h" |
995eb45bbadc
added original Separation_Algebra theory
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
diff
changeset
|
611 |
by (force intro!: sep_implI dest: intuitionisticD |
995eb45bbadc
added original Separation_Algebra theory
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
diff
changeset
|
612 |
intro: sep_substate_disj_add) |
995eb45bbadc
added original Separation_Algebra theory
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
diff
changeset
|
613 |
|
995eb45bbadc
added original Separation_Algebra theory
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
diff
changeset
|
614 |
lemma intuitionistic_sep_impl_sep_true_simp: |
995eb45bbadc
added original Separation_Algebra theory
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
diff
changeset
|
615 |
"intuitionistic P \<Longrightarrow> (sep_true \<longrightarrow>* P) = P" |
995eb45bbadc
added original Separation_Algebra theory
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
diff
changeset
|
616 |
by (fast intro!: ext |
995eb45bbadc
added original Separation_Algebra theory
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
diff
changeset
|
617 |
elim: sep_impl_sep_true_P intuitionistic_sep_impl_sep_true_P) |
995eb45bbadc
added original Separation_Algebra theory
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
diff
changeset
|
618 |
|
995eb45bbadc
added original Separation_Algebra theory
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
diff
changeset
|
619 |
|
995eb45bbadc
added original Separation_Algebra theory
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
diff
changeset
|
620 |
subsection {* Strictly exact assertions *} |
995eb45bbadc
added original Separation_Algebra theory
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
diff
changeset
|
621 |
|
995eb45bbadc
added original Separation_Algebra theory
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
diff
changeset
|
622 |
definition strictly_exact :: "('a \<Rightarrow> bool) \<Rightarrow> bool" where |
995eb45bbadc
added original Separation_Algebra theory
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
diff
changeset
|
623 |
"strictly_exact P \<equiv> \<forall>h h'. P h \<and> P h' \<longrightarrow> h = h'" |
995eb45bbadc
added original Separation_Algebra theory
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
diff
changeset
|
624 |
|
995eb45bbadc
added original Separation_Algebra theory
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
diff
changeset
|
625 |
lemma strictly_exactD: |
995eb45bbadc
added original Separation_Algebra theory
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
diff
changeset
|
626 |
"\<lbrakk> strictly_exact P; P h; P h' \<rbrakk> \<Longrightarrow> h = h'" |
995eb45bbadc
added original Separation_Algebra theory
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
diff
changeset
|
627 |
by (unfold strictly_exact_def, fast) |
995eb45bbadc
added original Separation_Algebra theory
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
diff
changeset
|
628 |
|
995eb45bbadc
added original Separation_Algebra theory
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
diff
changeset
|
629 |
lemma strictly_exactI: |
995eb45bbadc
added original Separation_Algebra theory
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
diff
changeset
|
630 |
"(\<And>h h'. \<lbrakk> P h; P h' \<rbrakk> \<Longrightarrow> h = h') \<Longrightarrow> strictly_exact P" |
995eb45bbadc
added original Separation_Algebra theory
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
diff
changeset
|
631 |
by (unfold strictly_exact_def, fast) |
995eb45bbadc
added original Separation_Algebra theory
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
diff
changeset
|
632 |
|
995eb45bbadc
added original Separation_Algebra theory
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
diff
changeset
|
633 |
lemma strictly_exact_sep_conj: |
995eb45bbadc
added original Separation_Algebra theory
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
diff
changeset
|
634 |
"\<lbrakk> strictly_exact P; strictly_exact Q \<rbrakk> \<Longrightarrow> strictly_exact (P \<and>* Q)" |
995eb45bbadc
added original Separation_Algebra theory
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
diff
changeset
|
635 |
apply (rule strictly_exactI) |
995eb45bbadc
added original Separation_Algebra theory
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
diff
changeset
|
636 |
apply (erule sep_conjE)+ |
995eb45bbadc
added original Separation_Algebra theory
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
diff
changeset
|
637 |
apply (drule_tac h="x" and h'="xa" in strictly_exactD, assumption+) |
995eb45bbadc
added original Separation_Algebra theory
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
diff
changeset
|
638 |
apply (drule_tac h="y" and h'="ya" in strictly_exactD, assumption+) |
995eb45bbadc
added original Separation_Algebra theory
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
diff
changeset
|
639 |
apply clarsimp |
995eb45bbadc
added original Separation_Algebra theory
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
diff
changeset
|
640 |
done |
995eb45bbadc
added original Separation_Algebra theory
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
diff
changeset
|
641 |
|
995eb45bbadc
added original Separation_Algebra theory
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
diff
changeset
|
642 |
lemma strictly_exact_conj_impl: |
995eb45bbadc
added original Separation_Algebra theory
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
diff
changeset
|
643 |
"\<lbrakk> (Q \<and>* sep_true) h; P h; strictly_exact Q \<rbrakk> \<Longrightarrow> (Q \<and>* (Q \<longrightarrow>* P)) h" |
995eb45bbadc
added original Separation_Algebra theory
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
diff
changeset
|
644 |
by (force intro: sep_conjI sep_implI dest: strictly_exactD elim!: sep_conjE |
995eb45bbadc
added original Separation_Algebra theory
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
diff
changeset
|
645 |
simp: sep_add_commute sep_add_assoc) |
995eb45bbadc
added original Separation_Algebra theory
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
diff
changeset
|
646 |
|
995eb45bbadc
added original Separation_Algebra theory
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
diff
changeset
|
647 |
end |
995eb45bbadc
added original Separation_Algebra theory
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
diff
changeset
|
648 |
|
995eb45bbadc
added original Separation_Algebra theory
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
diff
changeset
|
649 |
interpretation sep: ab_semigroup_mult "op **" |
995eb45bbadc
added original Separation_Algebra theory
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
diff
changeset
|
650 |
by (rule ab_semigroup_mult_sep_conj) |
995eb45bbadc
added original Separation_Algebra theory
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
diff
changeset
|
651 |
|
995eb45bbadc
added original Separation_Algebra theory
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
diff
changeset
|
652 |
interpretation sep: comm_monoid_add "op **" \<box> |
995eb45bbadc
added original Separation_Algebra theory
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
diff
changeset
|
653 |
by (rule comm_monoid_add) |
995eb45bbadc
added original Separation_Algebra theory
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
diff
changeset
|
654 |
|
995eb45bbadc
added original Separation_Algebra theory
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
diff
changeset
|
655 |
|
995eb45bbadc
added original Separation_Algebra theory
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
diff
changeset
|
656 |
section {* Separation Algebra with Stronger, but More Intuitive Disjunction Axiom *} |
995eb45bbadc
added original Separation_Algebra theory
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
diff
changeset
|
657 |
|
995eb45bbadc
added original Separation_Algebra theory
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
diff
changeset
|
658 |
class stronger_sep_algebra = pre_sep_algebra + |
995eb45bbadc
added original Separation_Algebra theory
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
diff
changeset
|
659 |
assumes sep_add_disj_eq [simp]: "y ## z \<Longrightarrow> x ## y + z = (x ## y \<and> x ## z)" |
995eb45bbadc
added original Separation_Algebra theory
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
diff
changeset
|
660 |
begin |
995eb45bbadc
added original Separation_Algebra theory
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
diff
changeset
|
661 |
|
995eb45bbadc
added original Separation_Algebra theory
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
diff
changeset
|
662 |
lemma sep_disj_add_eq [simp]: "x ## y \<Longrightarrow> x + y ## z = (x ## z \<and> y ## z)" |
995eb45bbadc
added original Separation_Algebra theory
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
diff
changeset
|
663 |
by (metis sep_add_disj_eq sep_disj_commute) |
995eb45bbadc
added original Separation_Algebra theory
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
diff
changeset
|
664 |
|
995eb45bbadc
added original Separation_Algebra theory
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
diff
changeset
|
665 |
subclass sep_algebra by default auto |
995eb45bbadc
added original Separation_Algebra theory
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
diff
changeset
|
666 |
|
995eb45bbadc
added original Separation_Algebra theory
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
diff
changeset
|
667 |
end |
995eb45bbadc
added original Separation_Algebra theory
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
diff
changeset
|
668 |
|
995eb45bbadc
added original Separation_Algebra theory
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
diff
changeset
|
669 |
|
995eb45bbadc
added original Separation_Algebra theory
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
diff
changeset
|
670 |
section {* Folding separating conjunction over lists of predicates *} |
995eb45bbadc
added original Separation_Algebra theory
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
diff
changeset
|
671 |
|
995eb45bbadc
added original Separation_Algebra theory
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
diff
changeset
|
672 |
lemma sep_list_conj_Nil [simp]: "\<And>* [] = \<box>" |
995eb45bbadc
added original Separation_Algebra theory
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
diff
changeset
|
673 |
by (simp add: sep_list_conj_def) |
995eb45bbadc
added original Separation_Algebra theory
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
diff
changeset
|
674 |
|
995eb45bbadc
added original Separation_Algebra theory
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
diff
changeset
|
675 |
(* apparently these two are rarely used and had to be removed from List.thy *) |
995eb45bbadc
added original Separation_Algebra theory
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
diff
changeset
|
676 |
lemma (in semigroup_add) foldl_assoc: |
995eb45bbadc
added original Separation_Algebra theory
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
diff
changeset
|
677 |
shows "foldl op+ (x+y) zs = x + (foldl op+ y zs)" |
995eb45bbadc
added original Separation_Algebra theory
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
diff
changeset
|
678 |
by (induct zs arbitrary: y) (simp_all add:add_assoc) |
995eb45bbadc
added original Separation_Algebra theory
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
diff
changeset
|
679 |
|
995eb45bbadc
added original Separation_Algebra theory
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
diff
changeset
|
680 |
lemma (in monoid_add) foldl_absorb0: |
995eb45bbadc
added original Separation_Algebra theory
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
diff
changeset
|
681 |
shows "x + (foldl op+ 0 zs) = foldl op+ x zs" |
995eb45bbadc
added original Separation_Algebra theory
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
diff
changeset
|
682 |
by (induct zs) (simp_all add:foldl_assoc) |
995eb45bbadc
added original Separation_Algebra theory
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
diff
changeset
|
683 |
|
995eb45bbadc
added original Separation_Algebra theory
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
diff
changeset
|
684 |
lemma sep_list_conj_Cons [simp]: "\<And>* (x#xs) = (x ** \<And>* xs)" |
995eb45bbadc
added original Separation_Algebra theory
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
diff
changeset
|
685 |
by (simp add: sep_list_conj_def sep.foldl_absorb0) |
995eb45bbadc
added original Separation_Algebra theory
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
diff
changeset
|
686 |
|
995eb45bbadc
added original Separation_Algebra theory
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
diff
changeset
|
687 |
lemma sep_list_conj_append [simp]: "\<And>* (xs @ ys) = (\<And>* xs ** \<And>* ys)" |
995eb45bbadc
added original Separation_Algebra theory
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
diff
changeset
|
688 |
by (simp add: sep_list_conj_def sep.foldl_absorb0) |
995eb45bbadc
added original Separation_Algebra theory
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
diff
changeset
|
689 |
|
995eb45bbadc
added original Separation_Algebra theory
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
diff
changeset
|
690 |
lemma (in comm_monoid_add) foldl_map_filter: |
995eb45bbadc
added original Separation_Algebra theory
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
diff
changeset
|
691 |
"foldl op + 0 (map f (filter P xs)) + |
995eb45bbadc
added original Separation_Algebra theory
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
diff
changeset
|
692 |
foldl op + 0 (map f (filter (not P) xs)) |
995eb45bbadc
added original Separation_Algebra theory
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
diff
changeset
|
693 |
= foldl op + 0 (map f xs)" |
995eb45bbadc
added original Separation_Algebra theory
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
diff
changeset
|
694 |
proof (induct xs) |
995eb45bbadc
added original Separation_Algebra theory
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
diff
changeset
|
695 |
case Nil thus ?case by clarsimp |
995eb45bbadc
added original Separation_Algebra theory
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
diff
changeset
|
696 |
next |
995eb45bbadc
added original Separation_Algebra theory
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
diff
changeset
|
697 |
case (Cons x xs) |
995eb45bbadc
added original Separation_Algebra theory
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
diff
changeset
|
698 |
hence IH: "foldl op + 0 (map f xs) = |
995eb45bbadc
added original Separation_Algebra theory
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
diff
changeset
|
699 |
foldl op + 0 (map f (filter P xs)) + |
995eb45bbadc
added original Separation_Algebra theory
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
diff
changeset
|
700 |
foldl op + 0 (map f [x\<leftarrow>xs . \<not> P x])" |
995eb45bbadc
added original Separation_Algebra theory
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
diff
changeset
|
701 |
by (simp only: eq_commute) |
995eb45bbadc
added original Separation_Algebra theory
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
diff
changeset
|
702 |
|
995eb45bbadc
added original Separation_Algebra theory
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
diff
changeset
|
703 |
have foldl_Cons': |
995eb45bbadc
added original Separation_Algebra theory
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
diff
changeset
|
704 |
"\<And>x xs. foldl op + 0 (x # xs) = x + (foldl op + 0 xs)" |
995eb45bbadc
added original Separation_Algebra theory
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
diff
changeset
|
705 |
by (simp, subst foldl_absorb0[symmetric], rule refl) |
995eb45bbadc
added original Separation_Algebra theory
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
diff
changeset
|
706 |
|
995eb45bbadc
added original Separation_Algebra theory
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
diff
changeset
|
707 |
{ assume "P x" |
995eb45bbadc
added original Separation_Algebra theory
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
diff
changeset
|
708 |
hence ?case by (auto simp del: foldl_Cons simp add: foldl_Cons' IH add_ac) |
995eb45bbadc
added original Separation_Algebra theory
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
diff
changeset
|
709 |
} moreover { |
995eb45bbadc
added original Separation_Algebra theory
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
diff
changeset
|
710 |
assume "\<not> P x" |
995eb45bbadc
added original Separation_Algebra theory
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
diff
changeset
|
711 |
hence ?case by (auto simp del: foldl_Cons simp add: foldl_Cons' IH add_ac) |
995eb45bbadc
added original Separation_Algebra theory
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
diff
changeset
|
712 |
} |
995eb45bbadc
added original Separation_Algebra theory
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
diff
changeset
|
713 |
ultimately show ?case by blast |
995eb45bbadc
added original Separation_Algebra theory
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
diff
changeset
|
714 |
qed |
995eb45bbadc
added original Separation_Algebra theory
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
diff
changeset
|
715 |
|
995eb45bbadc
added original Separation_Algebra theory
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
diff
changeset
|
716 |
|
995eb45bbadc
added original Separation_Algebra theory
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
diff
changeset
|
717 |
section {* Separation Algebra with a Cancellative Monoid (for completeness) *} |
995eb45bbadc
added original Separation_Algebra theory
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
diff
changeset
|
718 |
|
995eb45bbadc
added original Separation_Algebra theory
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
diff
changeset
|
719 |
text {* |
995eb45bbadc
added original Separation_Algebra theory
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
diff
changeset
|
720 |
Separation algebra with a cancellative monoid. The results of being a precise |
995eb45bbadc
added original Separation_Algebra theory
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
diff
changeset
|
721 |
assertion (distributivity over separating conjunction) require this. |
995eb45bbadc
added original Separation_Algebra theory
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
diff
changeset
|
722 |
although we never actually use this property in our developments, we keep |
995eb45bbadc
added original Separation_Algebra theory
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
diff
changeset
|
723 |
it here for completeness. |
995eb45bbadc
added original Separation_Algebra theory
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
diff
changeset
|
724 |
*} |
995eb45bbadc
added original Separation_Algebra theory
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
diff
changeset
|
725 |
class cancellative_sep_algebra = sep_algebra + |
995eb45bbadc
added original Separation_Algebra theory
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
diff
changeset
|
726 |
assumes sep_add_cancelD: "\<lbrakk> x + z = y + z ; x ## z ; y ## z \<rbrakk> \<Longrightarrow> x = y" |
995eb45bbadc
added original Separation_Algebra theory
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
diff
changeset
|
727 |
begin |
995eb45bbadc
added original Separation_Algebra theory
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
diff
changeset
|
728 |
|
995eb45bbadc
added original Separation_Algebra theory
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
diff
changeset
|
729 |
definition |
995eb45bbadc
added original Separation_Algebra theory
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
diff
changeset
|
730 |
(* In any heap, there exists at most one subheap for which P holds *) |
995eb45bbadc
added original Separation_Algebra theory
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
diff
changeset
|
731 |
precise :: "('a \<Rightarrow> bool) \<Rightarrow> bool" where |
995eb45bbadc
added original Separation_Algebra theory
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
diff
changeset
|
732 |
"precise P = (\<forall>h hp hp'. hp \<preceq> h \<and> P hp \<and> hp' \<preceq> h \<and> P hp' \<longrightarrow> hp = hp')" |
995eb45bbadc
added original Separation_Algebra theory
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
diff
changeset
|
733 |
|
995eb45bbadc
added original Separation_Algebra theory
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
diff
changeset
|
734 |
lemma "precise (op = s)" |
995eb45bbadc
added original Separation_Algebra theory
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
diff
changeset
|
735 |
by (metis (full_types) precise_def) |
995eb45bbadc
added original Separation_Algebra theory
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
diff
changeset
|
736 |
|
995eb45bbadc
added original Separation_Algebra theory
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
diff
changeset
|
737 |
lemma sep_add_cancel: |
995eb45bbadc
added original Separation_Algebra theory
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
diff
changeset
|
738 |
"x ## z \<Longrightarrow> y ## z \<Longrightarrow> (x + z = y + z) = (x = y)" |
995eb45bbadc
added original Separation_Algebra theory
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
diff
changeset
|
739 |
by (metis sep_add_cancelD) |
995eb45bbadc
added original Separation_Algebra theory
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
diff
changeset
|
740 |
|
995eb45bbadc
added original Separation_Algebra theory
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
diff
changeset
|
741 |
lemma precise_distribute: |
995eb45bbadc
added original Separation_Algebra theory
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
diff
changeset
|
742 |
"precise P = (\<forall>Q R. ((Q and R) \<and>* P) = ((Q \<and>* P) and (R \<and>* P)))" |
995eb45bbadc
added original Separation_Algebra theory
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
diff
changeset
|
743 |
proof (rule iffI) |
995eb45bbadc
added original Separation_Algebra theory
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
diff
changeset
|
744 |
assume pp: "precise P" |
995eb45bbadc
added original Separation_Algebra theory
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
diff
changeset
|
745 |
{ |
995eb45bbadc
added original Separation_Algebra theory
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
diff
changeset
|
746 |
fix Q R |
995eb45bbadc
added original Separation_Algebra theory
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
diff
changeset
|
747 |
fix h hp hp' s |
995eb45bbadc
added original Separation_Algebra theory
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
diff
changeset
|
748 |
|
995eb45bbadc
added original Separation_Algebra theory
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
diff
changeset
|
749 |
{ assume a: "((Q and R) \<and>* P) s" |
995eb45bbadc
added original Separation_Algebra theory
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
diff
changeset
|
750 |
hence "((Q \<and>* P) and (R \<and>* P)) s" |
995eb45bbadc
added original Separation_Algebra theory
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
diff
changeset
|
751 |
by (fastforce dest!: sep_conjD elim: sep_conjI) |
995eb45bbadc
added original Separation_Algebra theory
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
diff
changeset
|
752 |
} |
995eb45bbadc
added original Separation_Algebra theory
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
diff
changeset
|
753 |
moreover |
995eb45bbadc
added original Separation_Algebra theory
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
diff
changeset
|
754 |
{ assume qs: "(Q \<and>* P) s" and qr: "(R \<and>* P) s" |
995eb45bbadc
added original Separation_Algebra theory
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
diff
changeset
|
755 |
|
995eb45bbadc
added original Separation_Algebra theory
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
diff
changeset
|
756 |
from qs obtain x y where sxy: "s = x + y" and xy: "x ## y" |
995eb45bbadc
added original Separation_Algebra theory
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
diff
changeset
|
757 |
and x: "Q x" and y: "P y" |
995eb45bbadc
added original Separation_Algebra theory
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
diff
changeset
|
758 |
by (fastforce dest!: sep_conjD) |
995eb45bbadc
added original Separation_Algebra theory
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
diff
changeset
|
759 |
from qr obtain x' y' where sxy': "s = x' + y'" and xy': "x' ## y'" |
995eb45bbadc
added original Separation_Algebra theory
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
diff
changeset
|
760 |
and x': "R x'" and y': "P y'" |
995eb45bbadc
added original Separation_Algebra theory
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
diff
changeset
|
761 |
by (fastforce dest!: sep_conjD) |
995eb45bbadc
added original Separation_Algebra theory
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
diff
changeset
|
762 |
|
995eb45bbadc
added original Separation_Algebra theory
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
diff
changeset
|
763 |
from sxy have ys: "y \<preceq> x + y" using xy |
995eb45bbadc
added original Separation_Algebra theory
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
diff
changeset
|
764 |
by (fastforce simp: sep_substate_disj_add' sep_disj_commute) |
995eb45bbadc
added original Separation_Algebra theory
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
diff
changeset
|
765 |
from sxy' have ys': "y' \<preceq> x' + y'" using xy' |
995eb45bbadc
added original Separation_Algebra theory
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
diff
changeset
|
766 |
by (fastforce simp: sep_substate_disj_add' sep_disj_commute) |
995eb45bbadc
added original Separation_Algebra theory
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
diff
changeset
|
767 |
|
995eb45bbadc
added original Separation_Algebra theory
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
diff
changeset
|
768 |
from pp have yy: "y = y'" using sxy sxy' xy xy' y y' ys ys' |
995eb45bbadc
added original Separation_Algebra theory
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
diff
changeset
|
769 |
by (fastforce simp: precise_def) |
995eb45bbadc
added original Separation_Algebra theory
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
diff
changeset
|
770 |
|
995eb45bbadc
added original Separation_Algebra theory
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
diff
changeset
|
771 |
hence "x = x'" using sxy sxy' xy xy' |
995eb45bbadc
added original Separation_Algebra theory
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
diff
changeset
|
772 |
by (fastforce dest!: sep_add_cancelD) |
995eb45bbadc
added original Separation_Algebra theory
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
diff
changeset
|
773 |
|
995eb45bbadc
added original Separation_Algebra theory
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
diff
changeset
|
774 |
hence "((Q and R) \<and>* P) s" using sxy x x' yy y' xy' |
995eb45bbadc
added original Separation_Algebra theory
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
diff
changeset
|
775 |
by (fastforce intro: sep_conjI) |
995eb45bbadc
added original Separation_Algebra theory
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
diff
changeset
|
776 |
} |
995eb45bbadc
added original Separation_Algebra theory
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
diff
changeset
|
777 |
ultimately |
995eb45bbadc
added original Separation_Algebra theory
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
diff
changeset
|
778 |
have "((Q and R) \<and>* P) s = ((Q \<and>* P) and (R \<and>* P)) s" using pp by blast |
995eb45bbadc
added original Separation_Algebra theory
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
diff
changeset
|
779 |
} |
995eb45bbadc
added original Separation_Algebra theory
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
diff
changeset
|
780 |
thus "\<forall>Q R. ((Q and R) \<and>* P) = ((Q \<and>* P) and (R \<and>* P))" by (blast intro!: ext) |
995eb45bbadc
added original Separation_Algebra theory
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
diff
changeset
|
781 |
|
995eb45bbadc
added original Separation_Algebra theory
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
diff
changeset
|
782 |
next |
995eb45bbadc
added original Separation_Algebra theory
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
diff
changeset
|
783 |
assume a: "\<forall>Q R. ((Q and R) \<and>* P) = ((Q \<and>* P) and (R \<and>* P))" |
995eb45bbadc
added original Separation_Algebra theory
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
diff
changeset
|
784 |
thus "precise P" |
995eb45bbadc
added original Separation_Algebra theory
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
diff
changeset
|
785 |
proof (clarsimp simp: precise_def) |
995eb45bbadc
added original Separation_Algebra theory
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
diff
changeset
|
786 |
fix h hp hp' Q R |
995eb45bbadc
added original Separation_Algebra theory
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
diff
changeset
|
787 |
assume hp: "hp \<preceq> h" and hp': "hp' \<preceq> h" and php: "P hp" and php': "P hp'" |
995eb45bbadc
added original Separation_Algebra theory
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
diff
changeset
|
788 |
|
995eb45bbadc
added original Separation_Algebra theory
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
diff
changeset
|
789 |
obtain z where hhp: "h = hp + z" and hpz: "hp ## z" using hp |
995eb45bbadc
added original Separation_Algebra theory
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
diff
changeset
|
790 |
by (clarsimp simp: sep_substate_def) |
995eb45bbadc
added original Separation_Algebra theory
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
diff
changeset
|
791 |
obtain z' where hhp': "h = hp' + z'" and hpz': "hp' ## z'" using hp' |
995eb45bbadc
added original Separation_Algebra theory
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
diff
changeset
|
792 |
by (clarsimp simp: sep_substate_def) |
995eb45bbadc
added original Separation_Algebra theory
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
diff
changeset
|
793 |
|
995eb45bbadc
added original Separation_Algebra theory
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
diff
changeset
|
794 |
have h_eq: "z' + hp' = z + hp" using hhp hhp' hpz hpz' |
995eb45bbadc
added original Separation_Algebra theory
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
diff
changeset
|
795 |
by (fastforce simp: sep_add_ac) |
995eb45bbadc
added original Separation_Algebra theory
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
diff
changeset
|
796 |
|
995eb45bbadc
added original Separation_Algebra theory
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
diff
changeset
|
797 |
from hhp hhp' a hpz hpz' h_eq |
995eb45bbadc
added original Separation_Algebra theory
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
diff
changeset
|
798 |
have "\<forall>Q R. ((Q and R) \<and>* P) (z + hp) = ((Q \<and>* P) and (R \<and>* P)) (z' + hp')" |
995eb45bbadc
added original Separation_Algebra theory
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
diff
changeset
|
799 |
by (fastforce simp: h_eq sep_add_ac sep_conj_commute) |
995eb45bbadc
added original Separation_Algebra theory
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
diff
changeset
|
800 |
|
995eb45bbadc
added original Separation_Algebra theory
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
diff
changeset
|
801 |
hence "((op = z and op = z') \<and>* P) (z + hp) = |
995eb45bbadc
added original Separation_Algebra theory
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
diff
changeset
|
802 |
((op = z \<and>* P) and (op = z' \<and>* P)) (z' + hp')" by blast |
995eb45bbadc
added original Separation_Algebra theory
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
diff
changeset
|
803 |
|
995eb45bbadc
added original Separation_Algebra theory
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
diff
changeset
|
804 |
thus "hp = hp'" using php php' hpz hpz' h_eq |
995eb45bbadc
added original Separation_Algebra theory
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
diff
changeset
|
805 |
by (fastforce dest!: iffD2 cong: conj_cong |
995eb45bbadc
added original Separation_Algebra theory
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
diff
changeset
|
806 |
simp: sep_add_ac sep_add_cancel sep_conj_def) |
995eb45bbadc
added original Separation_Algebra theory
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
diff
changeset
|
807 |
qed |
995eb45bbadc
added original Separation_Algebra theory
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
diff
changeset
|
808 |
qed |
995eb45bbadc
added original Separation_Algebra theory
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
diff
changeset
|
809 |
|
995eb45bbadc
added original Separation_Algebra theory
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
diff
changeset
|
810 |
lemma strictly_precise: "strictly_exact P \<Longrightarrow> precise P" |
995eb45bbadc
added original Separation_Algebra theory
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
diff
changeset
|
811 |
by (metis precise_def strictly_exactD) |
995eb45bbadc
added original Separation_Algebra theory
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
diff
changeset
|
812 |
|
995eb45bbadc
added original Separation_Algebra theory
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
diff
changeset
|
813 |
end |
995eb45bbadc
added original Separation_Algebra theory
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
diff
changeset
|
814 |
|
995eb45bbadc
added original Separation_Algebra theory
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
diff
changeset
|
815 |
end |