362 |
362 |
363 (*###TO Map?*) |
363 (*###TO Map?*) |
364 primrec atleast_free :: "('a \<rightharpoonup> 'b) => nat => bool" |
364 primrec atleast_free :: "('a \<rightharpoonup> 'b) => nat => bool" |
365 where |
365 where |
366 "atleast_free m 0 = True" |
366 "atleast_free m 0 = True" |
367 | atleast_free_Suc: "atleast_free m (Suc n) = (\<exists>a. m a = None & (!b. atleast_free (m(a|->b)) n))" |
367 | atleast_free_Suc: "atleast_free m (Suc n) = (\<exists>a. m a = None \<and> (\<forall>b. atleast_free (m(a\<mapsto>b)) n))" |
368 |
368 |
369 lemma atleast_free_weaken [rule_format (no_asm)]: |
369 lemma atleast_free_weaken [rule_format (no_asm)]: |
370 "!m. atleast_free m (Suc n) \<longrightarrow> atleast_free m n" |
370 "\<forall>m. atleast_free m (Suc n) \<longrightarrow> atleast_free m n" |
371 apply (induct_tac "n") |
371 apply (induct_tac "n") |
372 apply (simp (no_asm)) |
372 apply (simp (no_asm)) |
373 apply clarify |
373 apply clarify |
374 apply (simp (no_asm)) |
374 apply (simp (no_asm)) |
375 apply (drule atleast_free_Suc [THEN iffD1]) |
375 apply (drule atleast_free_Suc [THEN iffD1]) |
376 apply fast |
376 apply fast |
377 done |
377 done |
378 |
378 |
379 lemma atleast_free_SucI: |
379 lemma atleast_free_SucI: |
380 "[| h a = None; !obj. atleast_free (h(a|->obj)) n |] ==> atleast_free h (Suc n)" |
380 "[| h a = None; \<forall>obj. atleast_free (h(a|->obj)) n |] ==> atleast_free h (Suc n)" |
381 by force |
381 by force |
382 |
382 |
383 declare fun_upd_apply [simp del] |
383 declare fun_upd_apply [simp del] |
384 lemma atleast_free_SucD_lemma [rule_format (no_asm)]: |
384 lemma atleast_free_SucD_lemma [rule_format (no_asm)]: |
385 " !m a. m a = None --> (!c. atleast_free (m(a|->c)) n) --> |
385 "\<forall>m a. m a = None \<longrightarrow> (\<forall>c. atleast_free (m(a\<mapsto>c)) n) \<longrightarrow> |
386 (!b d. a ~= b --> atleast_free (m(b|->d)) n)" |
386 (\<forall>b d. a \<noteq> b \<longrightarrow> atleast_free (m(b\<mapsto>d)) n)" |
387 apply (induct_tac "n") |
387 apply (induct_tac "n") |
388 apply auto |
388 apply auto |
389 apply (rule_tac x = "a" in exI) |
389 apply (rule_tac x = "a" in exI) |
390 apply (rule conjI) |
390 apply (rule conjI) |
391 apply (force simp add: fun_upd_apply) |
391 apply (force simp add: fun_upd_apply) |