263 |
263 |
264 instance .. |
264 instance .. |
265 end |
265 end |
266 |
266 |
267 |
267 |
268 definition constrain_plus_ivl :: "ivl \<Rightarrow> ivl \<Rightarrow> ivl \<Rightarrow> ivl*ivl" where |
268 definition inv_plus_ivl :: "ivl \<Rightarrow> ivl \<Rightarrow> ivl \<Rightarrow> ivl*ivl" where |
269 "constrain_plus_ivl iv iv1 iv2 = (iv1 \<sqinter> (iv - iv2), iv2 \<sqinter> (iv - iv1))" |
269 "inv_plus_ivl iv iv1 iv2 = (iv1 \<sqinter> (iv - iv2), iv2 \<sqinter> (iv - iv1))" |
270 |
270 |
271 definition above_rep :: "eint2 \<Rightarrow> eint2" where |
271 definition above_rep :: "eint2 \<Rightarrow> eint2" where |
272 "above_rep p = (if is_empty_rep p then empty_rep else let (l,h) = p in (l,\<infinity>))" |
272 "above_rep p = (if is_empty_rep p then empty_rep else let (l,h) = p in (l,\<infinity>))" |
273 |
273 |
274 definition below_rep :: "eint2 \<Rightarrow> eint2" where |
274 definition below_rep :: "eint2 \<Rightarrow> eint2" where |
288 lemma \<gamma>_belowI: "i : \<gamma>_ivl iv \<Longrightarrow> j \<le> i \<Longrightarrow> j : \<gamma>_ivl(below iv)" |
288 lemma \<gamma>_belowI: "i : \<gamma>_ivl iv \<Longrightarrow> j \<le> i \<Longrightarrow> j : \<gamma>_ivl(below iv)" |
289 by transfer |
289 by transfer |
290 (auto simp add: below_rep_def \<gamma>_rep_cases is_empty_rep_def |
290 (auto simp add: below_rep_def \<gamma>_rep_cases is_empty_rep_def |
291 split: extended.splits) |
291 split: extended.splits) |
292 |
292 |
293 definition constrain_less_ivl :: "bool \<Rightarrow> ivl \<Rightarrow> ivl \<Rightarrow> ivl * ivl" where |
293 definition inv_less_ivl :: "bool \<Rightarrow> ivl \<Rightarrow> ivl \<Rightarrow> ivl * ivl" where |
294 "constrain_less_ivl res iv1 iv2 = |
294 "inv_less_ivl res iv1 iv2 = |
295 (if res |
295 (if res |
296 then (iv1 \<sqinter> (below iv2 - [Fin 1,Fin 1]), |
296 then (iv1 \<sqinter> (below iv2 - [Fin 1,Fin 1]), |
297 iv2 \<sqinter> (above iv1 + [Fin 1,Fin 1])) |
297 iv2 \<sqinter> (above iv1 + [Fin 1,Fin 1])) |
298 else (iv1 \<sqinter> above iv2, iv2 \<sqinter> below iv1))" |
298 else (iv1 \<sqinter> above iv2, iv2 \<sqinter> below iv1))" |
299 |
299 |
337 qed |
337 qed |
338 |
338 |
339 interpretation Val_abs1 |
339 interpretation Val_abs1 |
340 where \<gamma> = \<gamma>_ivl and num' = num_ivl and plus' = "op +" |
340 where \<gamma> = \<gamma>_ivl and num' = num_ivl and plus' = "op +" |
341 and test_num' = in_ivl |
341 and test_num' = in_ivl |
342 and constrain_plus' = constrain_plus_ivl and constrain_less' = constrain_less_ivl |
342 and inv_plus' = inv_plus_ivl and inv_less' = inv_less_ivl |
343 proof |
343 proof |
344 case goal1 thus ?case by transfer (auto simp: \<gamma>_rep_def) |
344 case goal1 thus ?case by transfer (auto simp: \<gamma>_rep_def) |
345 next |
345 next |
346 case goal2 thus ?case |
346 case goal2 thus ?case |
347 unfolding constrain_plus_ivl_def minus_ivl_def |
347 unfolding inv_plus_ivl_def minus_ivl_def |
348 apply(clarsimp simp add: \<gamma>_inf) |
348 apply(clarsimp simp add: \<gamma>_inf) |
349 using gamma_plus'[of "i1+i2" _ "-i1"] gamma_plus'[of "i1+i2" _ "-i2"] |
349 using gamma_plus'[of "i1+i2" _ "-i1"] gamma_plus'[of "i1+i2" _ "-i2"] |
350 by(simp add: \<gamma>_uminus) |
350 by(simp add: \<gamma>_uminus) |
351 next |
351 next |
352 case goal3 thus ?case |
352 case goal3 thus ?case |
353 unfolding constrain_less_ivl_def minus_ivl_def |
353 unfolding inv_less_ivl_def minus_ivl_def |
354 apply(clarsimp simp add: \<gamma>_inf split: if_splits) |
354 apply(clarsimp simp add: \<gamma>_inf split: if_splits) |
355 using gamma_plus'[of "i1+1" _ "-1"] gamma_plus'[of "i2 - 1" _ "1"] |
355 using gamma_plus'[of "i1+1" _ "-1"] gamma_plus'[of "i2 - 1" _ "1"] |
356 apply(simp add: \<gamma>_belowI[of i2] \<gamma>_aboveI[of i1] |
356 apply(simp add: \<gamma>_belowI[of i2] \<gamma>_aboveI[of i1] |
357 uminus_ivl.abs_eq uminus_rep_def \<gamma>_ivl_nice) |
357 uminus_ivl.abs_eq uminus_rep_def \<gamma>_ivl_nice) |
358 apply(simp add: \<gamma>_aboveI[of i2] \<gamma>_belowI[of i1]) |
358 apply(simp add: \<gamma>_aboveI[of i2] \<gamma>_belowI[of i1]) |
360 qed |
360 qed |
361 |
361 |
362 interpretation Abs_Int1 |
362 interpretation Abs_Int1 |
363 where \<gamma> = \<gamma>_ivl and num' = num_ivl and plus' = "op +" |
363 where \<gamma> = \<gamma>_ivl and num' = num_ivl and plus' = "op +" |
364 and test_num' = in_ivl |
364 and test_num' = in_ivl |
365 and constrain_plus' = constrain_plus_ivl and constrain_less' = constrain_less_ivl |
365 and inv_plus' = inv_plus_ivl and inv_less' = inv_less_ivl |
366 defines aconstrain_ivl is aconstrain |
366 defines inv_aval_ivl is inv_aval'' |
367 and bconstrain_ivl is bconstrain |
367 and inv_bval_ivl is inv_bval'' |
368 and step_ivl is step' |
368 and step_ivl is step' |
369 and AI_ivl is AI |
369 and AI_ivl is AI |
370 and aval_ivl' is aval'' |
370 and aval_ivl' is aval'' |
371 .. |
371 .. |
372 |
372 |
394 by(auto simp: is_empty_rep_iff \<gamma>_rep_cases split: extended.splits) |
394 by(auto simp: is_empty_rep_iff \<gamma>_rep_cases split: extended.splits) |
395 |
395 |
396 interpretation Abs_Int1_mono |
396 interpretation Abs_Int1_mono |
397 where \<gamma> = \<gamma>_ivl and num' = num_ivl and plus' = "op +" |
397 where \<gamma> = \<gamma>_ivl and num' = num_ivl and plus' = "op +" |
398 and test_num' = in_ivl |
398 and test_num' = in_ivl |
399 and constrain_plus' = constrain_plus_ivl and constrain_less' = constrain_less_ivl |
399 and inv_plus' = inv_plus_ivl and inv_less' = inv_less_ivl |
400 proof |
400 proof |
401 case goal1 thus ?case by (rule mono_plus_ivl) |
401 case goal1 thus ?case by (rule mono_plus_ivl) |
402 next |
402 next |
403 case goal2 thus ?case |
403 case goal2 thus ?case |
404 unfolding constrain_plus_ivl_def minus_ivl_def less_eq_prod_def |
404 unfolding inv_plus_ivl_def minus_ivl_def less_eq_prod_def |
405 by (auto simp: le_infI1 le_infI2 mono_plus_ivl mono_minus_ivl) |
405 by (auto simp: le_infI1 le_infI2 mono_plus_ivl mono_minus_ivl) |
406 next |
406 next |
407 case goal3 thus ?case |
407 case goal3 thus ?case |
408 unfolding less_eq_prod_def constrain_less_ivl_def minus_ivl_def |
408 unfolding less_eq_prod_def inv_less_ivl_def minus_ivl_def |
409 by (auto simp: le_infI1 le_infI2 mono_plus_ivl mono_above mono_below) |
409 by (auto simp: le_infI1 le_infI2 mono_plus_ivl mono_above mono_below) |
410 qed |
410 qed |
411 |
411 |
412 |
412 |
413 subsubsection "Tests" |
413 subsubsection "Tests" |