equal
deleted
inserted
replaced
187 equalities (@{text"="}).) |
187 equalities (@{text"="}).) |
188 \end{exercise} |
188 \end{exercise} |
189 \index{boolean expressions example|)} |
189 \index{boolean expressions example|)} |
190 *} |
190 *} |
191 (*<*) |
191 (*<*) |
|
192 |
|
193 consts normif2 :: "ifex => ifex => ifex => ifex" |
|
194 primrec |
|
195 "normif2 (CIF b) t e = (if b then t else e)" |
|
196 "normif2 (VIF x) t e = IF (VIF x) t e" |
|
197 "normif2 (IF b t e) u f = normif2 b (normif2 t u f) (normif2 e u f)" |
|
198 |
|
199 consts norm2 :: "ifex => ifex" |
|
200 primrec |
|
201 "norm2 (CIF b) = CIF b" |
|
202 "norm2 (VIF x) = VIF x" |
|
203 "norm2 (IF b t e) = normif2 b (norm2 t) (norm2 e)" |
|
204 |
|
205 consts normal2 :: "ifex => bool" |
|
206 primrec |
|
207 "normal2(CIF b) = True" |
|
208 "normal2(VIF x) = True" |
|
209 "normal2(IF b t e) = (normal2 t & normal2 e & |
|
210 (case b of CIF b => False | VIF x => True | IF x y z => False))" |
|
211 |
|
212 |
|
213 lemma [simp]: |
|
214 "ALL t e. valif (normif2 b t e) env = valif (IF b t e) env" |
|
215 apply(induct b) |
|
216 by(auto) |
|
217 |
|
218 theorem "valif (norm2 b) env = valif b env" |
|
219 apply(induct b) |
|
220 by(auto) |
|
221 |
|
222 lemma [simp]: "ALL t e. normal2 t & normal2 e --> normal2(normif2 b t e)" |
|
223 apply(induct b) |
|
224 by(auto) |
|
225 |
|
226 theorem "normal2(norm2 b)" |
|
227 apply(induct b) |
|
228 by(auto) |
|
229 |
192 end |
230 end |
193 (*>*) |
231 (*>*) |