equal
deleted
inserted
replaced
137 done |
137 done |
138 |
138 |
139 corollary hoaret_sound_complete: "\<turnstile>\<^sub>t {P}c{Q} \<longleftrightarrow> \<Turnstile>\<^sub>t {P}c{Q}" |
139 corollary hoaret_sound_complete: "\<turnstile>\<^sub>t {P}c{Q} \<longleftrightarrow> \<Turnstile>\<^sub>t {P}c{Q}" |
140 by (metis hoaret_sound hoaret_complete) |
140 by (metis hoaret_sound hoaret_complete) |
141 |
141 |
|
142 text \<open>Two examples:\<close> |
|
143 |
|
144 lemma "\<turnstile>\<^sub>t |
|
145 {\<lambda>s. \<exists>n. n = nat(s ''x'')} |
|
146 WHILE Less (N 0) (V ''x'') DO ''x'' ::= Plus (V ''x'') (N (-1)) |
|
147 {\<lambda>s. s ''x'' \<le> 0}" |
|
148 apply(rule weaken_post) |
|
149 apply(rule While) |
|
150 apply(rule Assign') |
|
151 apply auto |
|
152 done |
|
153 |
|
154 lemma "\<turnstile>\<^sub>t |
|
155 {\<lambda>s. \<exists>n. n = nat(s ''x'')} |
|
156 WHILE Less (N 0) (V ''x'') |
|
157 DO (''x'' ::= Plus (V ''x'') (N (-1));; |
|
158 (''y'' ::= V ''x'';; |
|
159 WHILE Less (N 0) (V ''y'') DO ''y'' ::= Plus (V ''y'') (N (-1)))) |
|
160 {\<lambda>s. s ''x'' \<le> 0}" |
|
161 apply(rule weaken_post) |
|
162 apply(rule While) |
|
163 defer |
|
164 apply auto[3] |
|
165 apply(rule Seq) |
|
166 prefer 2 |
|
167 apply(rule Seq) |
|
168 prefer 2 |
|
169 apply(rule weaken_post) |
|
170 apply(rule_tac P = "\<lambda>m s. n = nat(s ''x'') \<and> m = nat(s ''y'')" in While) |
|
171 apply(rule Assign') |
|
172 apply auto[4] |
|
173 apply(rule Assign) |
|
174 apply(rule Assign') |
|
175 apply auto |
|
176 done |
|
177 |
142 end |
178 end |