16 to well-order relations. Note that we consider well-order relations |
16 to well-order relations. Note that we consider well-order relations |
17 as {\em non-strict relations}, |
17 as {\em non-strict relations}, |
18 i.e., as containing the diagonals of their fields. *} |
18 i.e., as containing the diagonals of their fields. *} |
19 |
19 |
20 |
20 |
21 locale wo_rel = rel + assumes WELL: "Well_order r" |
21 locale wo_rel = |
|
22 fixes r :: "'a rel" |
|
23 assumes WELL: "Well_order r" |
22 begin |
24 begin |
23 |
25 |
24 text{* The following context encompasses all this section. In other words, |
26 text{* The following context encompasses all this section. In other words, |
25 for the whole section, we consider a fixed well-order relation @{term "r"}. *} |
27 for the whole section, we consider a fixed well-order relation @{term "r"}. *} |
26 |
28 |
27 (* context wo_rel *) |
29 (* context wo_rel *) |
|
30 |
|
31 abbreviation under where "under \<equiv> Order_Relation_More_FP.under r" |
|
32 abbreviation underS where "underS \<equiv> Order_Relation_More_FP.underS r" |
|
33 abbreviation Under where "Under \<equiv> Order_Relation_More_FP.Under r" |
|
34 abbreviation UnderS where "UnderS \<equiv> Order_Relation_More_FP.UnderS r" |
|
35 abbreviation above where "above \<equiv> Order_Relation_More_FP.above r" |
|
36 abbreviation aboveS where "aboveS \<equiv> Order_Relation_More_FP.aboveS r" |
|
37 abbreviation Above where "Above \<equiv> Order_Relation_More_FP.Above r" |
|
38 abbreviation AboveS where "AboveS \<equiv> Order_Relation_More_FP.AboveS r" |
28 |
39 |
29 |
40 |
30 subsection {* Auxiliaries *} |
41 subsection {* Auxiliaries *} |
31 |
42 |
32 |
43 |
107 shows "worec H = H (worec H)" |
118 shows "worec H = H (worec H)" |
108 proof- |
119 proof- |
109 let ?rS = "r - Id" |
120 let ?rS = "r - Id" |
110 have "adm_wf (r - Id) H" |
121 have "adm_wf (r - Id) H" |
111 unfolding adm_wf_def |
122 unfolding adm_wf_def |
112 using ADM adm_wo_def[of H] underS_def by auto |
123 using ADM adm_wo_def[of H] underS_def[of r] by auto |
113 hence "wfrec ?rS H = H (wfrec ?rS H)" |
124 hence "wfrec ?rS H = H (wfrec ?rS H)" |
114 using WF wfrec_fixpoint[of ?rS H] by simp |
125 using WF wfrec_fixpoint[of ?rS H] by simp |
115 thus ?thesis unfolding worec_def . |
126 thus ?thesis unfolding worec_def . |
116 qed |
127 qed |
117 |
128 |
325 lemma suc_AboveS: |
336 lemma suc_AboveS: |
326 assumes SUB: "B \<le> Field r" and ABOVES: "AboveS B \<noteq> {}" |
337 assumes SUB: "B \<le> Field r" and ABOVES: "AboveS B \<noteq> {}" |
327 shows "suc B \<in> AboveS B" |
338 shows "suc B \<in> AboveS B" |
328 proof(unfold suc_def) |
339 proof(unfold suc_def) |
329 have "AboveS B \<le> Field r" |
340 have "AboveS B \<le> Field r" |
330 using AboveS_Field by auto |
341 using AboveS_Field[of r] by auto |
331 thus "minim (AboveS B) \<in> AboveS B" |
342 thus "minim (AboveS B) \<in> AboveS B" |
332 using assms by (simp add: minim_in) |
343 using assms by (simp add: minim_in) |
333 qed |
344 qed |
334 |
345 |
335 |
346 |
338 IN: "b \<in> B" |
349 IN: "b \<in> B" |
339 shows "suc B \<noteq> b \<and> (b,suc B) \<in> r" |
350 shows "suc B \<noteq> b \<and> (b,suc B) \<in> r" |
340 proof- |
351 proof- |
341 from assms suc_AboveS |
352 from assms suc_AboveS |
342 have "suc B \<in> AboveS B" by simp |
353 have "suc B \<in> AboveS B" by simp |
343 with IN AboveS_def show ?thesis by simp |
354 with IN AboveS_def[of r] show ?thesis by simp |
344 qed |
355 qed |
345 |
356 |
346 |
357 |
347 lemma suc_least_AboveS: |
358 lemma suc_least_AboveS: |
348 assumes ABOVES: "a \<in> AboveS B" |
359 assumes ABOVES: "a \<in> AboveS B" |
349 shows "(suc B,a) \<in> r" |
360 shows "(suc B,a) \<in> r" |
350 proof(unfold suc_def) |
361 proof(unfold suc_def) |
351 have "AboveS B \<le> Field r" |
362 have "AboveS B \<le> Field r" |
352 using AboveS_Field by auto |
363 using AboveS_Field[of r] by auto |
353 thus "(minim (AboveS B),a) \<in> r" |
364 thus "(minim (AboveS B),a) \<in> r" |
354 using assms minim_least by simp |
365 using assms minim_least by simp |
355 qed |
366 qed |
356 |
367 |
357 |
368 |
359 assumes "B \<le> Field r" and "AboveS B \<noteq> {}" |
370 assumes "B \<le> Field r" and "AboveS B \<noteq> {}" |
360 shows "suc B \<in> Field r" |
371 shows "suc B \<in> Field r" |
361 proof- |
372 proof- |
362 have "suc B \<in> AboveS B" using suc_AboveS assms by simp |
373 have "suc B \<in> AboveS B" using suc_AboveS assms by simp |
363 thus ?thesis |
374 thus ?thesis |
364 using assms AboveS_Field by auto |
375 using assms AboveS_Field[of r] by auto |
365 qed |
376 qed |
366 |
377 |
367 |
378 |
368 lemma equals_suc_AboveS: |
379 lemma equals_suc_AboveS: |
369 assumes SUB: "B \<le> Field r" and ABV: "a \<in> AboveS B" and |
380 assumes SUB: "B \<le> Field r" and ABV: "a \<in> AboveS B" and |
370 MINIM: "\<And> a'. a' \<in> AboveS B \<Longrightarrow> (a,a') \<in> r" |
381 MINIM: "\<And> a'. a' \<in> AboveS B \<Longrightarrow> (a,a') \<in> r" |
371 shows "a = suc B" |
382 shows "a = suc B" |
372 proof(unfold suc_def) |
383 proof(unfold suc_def) |
373 have "AboveS B \<le> Field r" |
384 have "AboveS B \<le> Field r" |
374 using AboveS_Field[of B] by auto |
385 using AboveS_Field[of r B] by auto |
375 thus "a = minim (AboveS B)" |
386 thus "a = minim (AboveS B)" |
376 using assms equals_minim |
387 using assms equals_minim |
377 by simp |
388 by simp |
378 qed |
389 qed |
379 |
390 |
381 lemma suc_underS: |
392 lemma suc_underS: |
382 assumes IN: "a \<in> Field r" |
393 assumes IN: "a \<in> Field r" |
383 shows "a = suc (underS a)" |
394 shows "a = suc (underS a)" |
384 proof- |
395 proof- |
385 have "underS a \<le> Field r" |
396 have "underS a \<le> Field r" |
386 using underS_Field by auto |
397 using underS_Field[of r] by auto |
387 moreover |
398 moreover |
388 have "a \<in> AboveS (underS a)" |
399 have "a \<in> AboveS (underS a)" |
389 using in_AboveS_underS IN by auto |
400 using in_AboveS_underS IN by fast |
390 moreover |
401 moreover |
391 have "\<forall>a' \<in> AboveS (underS a). (a,a') \<in> r" |
402 have "\<forall>a' \<in> AboveS (underS a). (a,a') \<in> r" |
392 proof(clarify) |
403 proof(clarify) |
393 fix a' |
404 fix a' |
394 assume *: "a' \<in> AboveS (underS a)" |
405 assume *: "a' \<in> AboveS (underS a)" |
395 hence **: "a' \<in> Field r" |
406 hence **: "a' \<in> Field r" |
396 using AboveS_Field by auto |
407 using AboveS_Field by fast |
397 {assume "(a,a') \<notin> r" |
408 {assume "(a,a') \<notin> r" |
398 hence "a' = a \<or> (a',a) \<in> r" |
409 hence "a' = a \<or> (a',a) \<in> r" |
399 using TOTAL IN ** by (auto simp add: total_on_def) |
410 using TOTAL IN ** by (auto simp add: total_on_def) |
400 moreover |
411 moreover |
401 {assume "a' = a" |
412 {assume "a' = a" |
405 moreover |
416 moreover |
406 {assume "a' \<noteq> a \<and> (a',a) \<in> r" |
417 {assume "a' \<noteq> a \<and> (a',a) \<in> r" |
407 hence "a' \<in> underS a" |
418 hence "a' \<in> underS a" |
408 unfolding underS_def by simp |
419 unfolding underS_def by simp |
409 hence "a' \<notin> AboveS (underS a)" |
420 hence "a' \<notin> AboveS (underS a)" |
410 using AboveS_disjoint by blast |
421 using AboveS_disjoint by fast |
411 with * have False by simp |
422 with * have False by simp |
412 } |
423 } |
413 ultimately have "(a,a') \<in> r" by blast |
424 ultimately have "(a,a') \<in> r" by blast |
414 } |
425 } |
415 thus "(a, a') \<in> r" by blast |
426 thus "(a, a') \<in> r" by blast |
484 have 13: "under x \<le> A" using * ofilter_def ** by auto |
495 have 13: "under x \<le> A" using * ofilter_def ** by auto |
485 {assume "(x,?a) \<notin> r" |
496 {assume "(x,?a) \<notin> r" |
486 hence "(?a,x) \<in> r" |
497 hence "(?a,x) \<in> r" |
487 using TOTAL total_on_def[of "Field r" r] |
498 using TOTAL total_on_def[of "Field r" r] |
488 2 4 11 12 by auto |
499 2 4 11 12 by auto |
489 hence "?a \<in> under x" using under_def by auto |
500 hence "?a \<in> under x" using under_def[of r] by auto |
490 hence "?a \<in> A" using ** 13 by blast |
501 hence "?a \<in> A" using ** 13 by blast |
491 with 4 have False by simp |
502 with 4 have False by simp |
492 } |
503 } |
493 thus "(x,?a) \<in> r" by blast |
504 thus "(x,?a) \<in> r" by blast |
494 qed |
505 qed |
525 have "\<forall>a \<in> A. under a \<le> A" |
536 have "\<forall>a \<in> A. under a \<le> A" |
526 using assms ofilter_def by auto |
537 using assms ofilter_def by auto |
527 thus "(\<Union> a \<in> A. under a) \<le> A" by blast |
538 thus "(\<Union> a \<in> A. under a) \<le> A" by blast |
528 next |
539 next |
529 have "\<forall>a \<in> A. a \<in> under a" |
540 have "\<forall>a \<in> A. a \<in> under a" |
530 using REFL Refl_under_in assms ofilter_def by blast |
541 using REFL Refl_under_in[of r] assms ofilter_def[of A] by blast |
531 thus "A \<le> (\<Union> a \<in> A. under a)" by blast |
542 thus "A \<le> (\<Union> a \<in> A. under a)" by blast |
532 qed |
543 qed |
533 |
544 |
534 |
545 |
535 subsubsection{* Other properties *} |
546 subsubsection{* Other properties *} |
560 moreover |
571 moreover |
561 {assume "a = b" with 1 2 have ?thesis by auto |
572 {assume "a = b" with 1 2 have ?thesis by auto |
562 } |
573 } |
563 moreover |
574 moreover |
564 {assume "(a,b) \<in> r" |
575 {assume "(a,b) \<in> r" |
565 with underS_incr TRANS ANTISYM 1 2 |
576 with underS_incr[of r] TRANS ANTISYM 1 2 |
566 have "A \<le> B" by auto |
577 have "A \<le> B" by auto |
567 hence ?thesis by auto |
578 hence ?thesis by auto |
568 } |
579 } |
569 moreover |
580 moreover |
570 {assume "(b,a) \<in> r" |
581 {assume "(b,a) \<in> r" |
571 with underS_incr TRANS ANTISYM 1 2 |
582 with underS_incr[of r] TRANS ANTISYM 1 2 |
572 have "B \<le> A" by auto |
583 have "B \<le> A" by auto |
573 hence ?thesis by auto |
584 hence ?thesis by auto |
574 } |
585 } |
575 ultimately show ?thesis by blast |
586 ultimately show ?thesis by blast |
576 qed |
587 qed |
580 lemma ofilter_AboveS_Field: |
591 lemma ofilter_AboveS_Field: |
581 assumes "ofilter A" |
592 assumes "ofilter A" |
582 shows "A \<union> (AboveS A) = Field r" |
593 shows "A \<union> (AboveS A) = Field r" |
583 proof |
594 proof |
584 show "A \<union> (AboveS A) \<le> Field r" |
595 show "A \<union> (AboveS A) \<le> Field r" |
585 using assms ofilter_def AboveS_Field by auto |
596 using assms ofilter_def AboveS_Field[of r] by auto |
586 next |
597 next |
587 {fix x assume *: "x \<in> Field r" and **: "x \<notin> A" |
598 {fix x assume *: "x \<in> Field r" and **: "x \<notin> A" |
588 {fix y assume ***: "y \<in> A" |
599 {fix y assume ***: "y \<in> A" |
589 with ** have 1: "y \<noteq> x" by auto |
600 with ** have 1: "y \<noteq> x" by auto |
590 {assume "(y,x) \<notin> r" |
601 {assume "(y,x) \<notin> r" |
591 moreover |
602 moreover |
592 have "y \<in> Field r" using assms ofilter_def *** by auto |
603 have "y \<in> Field r" using assms ofilter_def *** by auto |
593 ultimately have "(x,y) \<in> r" |
604 ultimately have "(x,y) \<in> r" |
594 using 1 * TOTAL total_on_def[of _ r] by auto |
605 using 1 * TOTAL total_on_def[of _ r] by auto |
595 with *** assms ofilter_def under_def have "x \<in> A" by auto |
606 with *** assms ofilter_def under_def[of r] have "x \<in> A" by auto |
596 with ** have False by contradiction |
607 with ** have False by contradiction |
597 } |
608 } |
598 hence "(y,x) \<in> r" by blast |
609 hence "(y,x) \<in> r" by blast |
599 with 1 have "y \<noteq> x \<and> (y,x) \<in> r" by auto |
610 with 1 have "y \<noteq> x \<and> (y,x) \<in> r" by auto |
600 } |
611 } |
608 assumes OF: "ofilter A" and ABOVE_NE: "AboveS A \<noteq> {}" and |
619 assumes OF: "ofilter A" and ABOVE_NE: "AboveS A \<noteq> {}" and |
609 REL: "(b,suc A) \<in> r" and DIFF: "b \<noteq> suc A" |
620 REL: "(b,suc A) \<in> r" and DIFF: "b \<noteq> suc A" |
610 shows "b \<in> A" |
621 shows "b \<in> A" |
611 proof- |
622 proof- |
612 have *: "suc A \<in> Field r \<and> b \<in> Field r" |
623 have *: "suc A \<in> Field r \<and> b \<in> Field r" |
613 using WELL REL well_order_on_domain by auto |
624 using WELL REL well_order_on_domain[of "Field r"] by auto |
614 {assume **: "b \<notin> A" |
625 {assume **: "b \<notin> A" |
615 hence "b \<in> AboveS A" |
626 hence "b \<in> AboveS A" |
616 using OF * ofilter_AboveS_Field by auto |
627 using OF * ofilter_AboveS_Field by auto |
617 hence "(suc A, b) \<in> r" |
628 hence "(suc A, b) \<in> r" |
618 using suc_least_AboveS by auto |
629 using suc_least_AboveS by auto |