author | desharna |
Sun, 17 Mar 2024 12:34:11 +0100 | |
changeset 79922 | caa9dbffd712 |
parent 79920 | 91b7695c92cf |
child 79924 | 8d153846f65f |
permissions | -rw-r--r-- |
32960
69916a850301
eliminated hard tabulators, guessing at each author's individual tab-width;
wenzelm
parents:
32704
diff
changeset
|
1 |
(* Title: HOL/Wellfounded.thy |
69916a850301
eliminated hard tabulators, guessing at each author's individual tab-width;
wenzelm
parents:
32704
diff
changeset
|
2 |
Author: Tobias Nipkow |
69916a850301
eliminated hard tabulators, guessing at each author's individual tab-width;
wenzelm
parents:
32704
diff
changeset
|
3 |
Author: Lawrence C Paulson |
69916a850301
eliminated hard tabulators, guessing at each author's individual tab-width;
wenzelm
parents:
32704
diff
changeset
|
4 |
Author: Konrad Slind |
69916a850301
eliminated hard tabulators, guessing at each author's individual tab-width;
wenzelm
parents:
32704
diff
changeset
|
5 |
Author: Alexander Krauss |
55027 | 6 |
Author: Andrei Popescu, TU Muenchen |
26748
4d51ddd6aa5c
Merged theories about wellfoundedness into one: Wellfounded.thy
krauss
parents:
diff
changeset
|
7 |
*) |
4d51ddd6aa5c
Merged theories about wellfoundedness into one: Wellfounded.thy
krauss
parents:
diff
changeset
|
8 |
|
60758 | 9 |
section \<open>Well-founded Recursion\<close> |
26748
4d51ddd6aa5c
Merged theories about wellfoundedness into one: Wellfounded.thy
krauss
parents:
diff
changeset
|
10 |
|
4d51ddd6aa5c
Merged theories about wellfoundedness into one: Wellfounded.thy
krauss
parents:
diff
changeset
|
11 |
theory Wellfounded |
63572 | 12 |
imports Transitive_Closure |
26748
4d51ddd6aa5c
Merged theories about wellfoundedness into one: Wellfounded.thy
krauss
parents:
diff
changeset
|
13 |
begin |
4d51ddd6aa5c
Merged theories about wellfoundedness into one: Wellfounded.thy
krauss
parents:
diff
changeset
|
14 |
|
60758 | 15 |
subsection \<open>Basic Definitions\<close> |
26976 | 16 |
|
79917
d0205dde00bb
added definitions wf_on and wfp_on as restricted versions of wf and wfP respectively
desharna
parents:
77172
diff
changeset
|
17 |
definition wf_on :: "'a set \<Rightarrow> 'a rel \<Rightarrow> bool" |
d0205dde00bb
added definitions wf_on and wfp_on as restricted versions of wf and wfP respectively
desharna
parents:
77172
diff
changeset
|
18 |
where "wf_on A r \<longleftrightarrow> (\<forall>P. (\<forall>x \<in> A. (\<forall>y \<in> A. (y, x) \<in> r \<longrightarrow> P y) \<longrightarrow> P x) \<longrightarrow> (\<forall>x \<in> A. P x))" |
d0205dde00bb
added definitions wf_on and wfp_on as restricted versions of wf and wfP respectively
desharna
parents:
77172
diff
changeset
|
19 |
|
63108 | 20 |
definition wf :: "('a \<times> 'a) set \<Rightarrow> bool" |
21 |
where "wf r \<longleftrightarrow> (\<forall>P. (\<forall>x. (\<forall>y. (y, x) \<in> r \<longrightarrow> P y) \<longrightarrow> P x) \<longrightarrow> (\<forall>x. P x))" |
|
26748
4d51ddd6aa5c
Merged theories about wellfoundedness into one: Wellfounded.thy
krauss
parents:
diff
changeset
|
22 |
|
79917
d0205dde00bb
added definitions wf_on and wfp_on as restricted versions of wf and wfP respectively
desharna
parents:
77172
diff
changeset
|
23 |
definition wfp_on :: "'a set \<Rightarrow> ('a \<Rightarrow> 'a \<Rightarrow> bool) \<Rightarrow> bool" where |
d0205dde00bb
added definitions wf_on and wfp_on as restricted versions of wf and wfP respectively
desharna
parents:
77172
diff
changeset
|
24 |
"wfp_on A R \<longleftrightarrow> (\<forall>P. (\<forall>x \<in> A. (\<forall>y \<in> A. R y x \<longrightarrow> P y) \<longrightarrow> P x) \<longrightarrow> (\<forall>x \<in> A. P x))" |
d0205dde00bb
added definitions wf_on and wfp_on as restricted versions of wf and wfP respectively
desharna
parents:
77172
diff
changeset
|
25 |
|
63108 | 26 |
definition wfP :: "('a \<Rightarrow> 'a \<Rightarrow> bool) \<Rightarrow> bool" |
27 |
where "wfP r \<longleftrightarrow> wf {(x, y). r x y}" |
|
26748
4d51ddd6aa5c
Merged theories about wellfoundedness into one: Wellfounded.thy
krauss
parents:
diff
changeset
|
28 |
|
79917
d0205dde00bb
added definitions wf_on and wfp_on as restricted versions of wf and wfP respectively
desharna
parents:
77172
diff
changeset
|
29 |
|
d0205dde00bb
added definitions wf_on and wfp_on as restricted versions of wf and wfP respectively
desharna
parents:
77172
diff
changeset
|
30 |
subsection \<open>Equivalence of Definitions\<close> |
d0205dde00bb
added definitions wf_on and wfp_on as restricted versions of wf and wfP respectively
desharna
parents:
77172
diff
changeset
|
31 |
|
d0205dde00bb
added definitions wf_on and wfp_on as restricted versions of wf and wfP respectively
desharna
parents:
77172
diff
changeset
|
32 |
lemma wf_on_UNIV: "wf_on UNIV r \<longleftrightarrow> wf r" |
d0205dde00bb
added definitions wf_on and wfp_on as restricted versions of wf and wfP respectively
desharna
parents:
77172
diff
changeset
|
33 |
by (simp add: wf_on_def wf_def) |
d0205dde00bb
added definitions wf_on and wfp_on as restricted versions of wf and wfP respectively
desharna
parents:
77172
diff
changeset
|
34 |
|
d0205dde00bb
added definitions wf_on and wfp_on as restricted versions of wf and wfP respectively
desharna
parents:
77172
diff
changeset
|
35 |
lemma wfp_on_UNIV: "wfp_on UNIV R \<longleftrightarrow> wfP R" |
d0205dde00bb
added definitions wf_on and wfp_on as restricted versions of wf and wfP respectively
desharna
parents:
77172
diff
changeset
|
36 |
by (simp add: wfp_on_def wfP_def wf_def) |
d0205dde00bb
added definitions wf_on and wfp_on as restricted versions of wf and wfP respectively
desharna
parents:
77172
diff
changeset
|
37 |
|
d0205dde00bb
added definitions wf_on and wfp_on as restricted versions of wf and wfP respectively
desharna
parents:
77172
diff
changeset
|
38 |
lemma wfp_on_wf_on_eq[pred_set_conv]: "wfp_on A (\<lambda>x y. (x, y) \<in> r) \<longleftrightarrow> wf_on A r" |
d0205dde00bb
added definitions wf_on and wfp_on as restricted versions of wf and wfP respectively
desharna
parents:
77172
diff
changeset
|
39 |
by (simp add: wfp_on_def wf_on_def) |
d0205dde00bb
added definitions wf_on and wfp_on as restricted versions of wf and wfP respectively
desharna
parents:
77172
diff
changeset
|
40 |
|
26748
4d51ddd6aa5c
Merged theories about wellfoundedness into one: Wellfounded.thy
krauss
parents:
diff
changeset
|
41 |
lemma wfP_wf_eq [pred_set_conv]: "wfP (\<lambda>x y. (x, y) \<in> r) = wf r" |
4d51ddd6aa5c
Merged theories about wellfoundedness into one: Wellfounded.thy
krauss
parents:
diff
changeset
|
42 |
by (simp add: wfP_def) |
4d51ddd6aa5c
Merged theories about wellfoundedness into one: Wellfounded.thy
krauss
parents:
diff
changeset
|
43 |
|
79917
d0205dde00bb
added definitions wf_on and wfp_on as restricted versions of wf and wfP respectively
desharna
parents:
77172
diff
changeset
|
44 |
|
d0205dde00bb
added definitions wf_on and wfp_on as restricted versions of wf and wfP respectively
desharna
parents:
77172
diff
changeset
|
45 |
subsection \<open>Induction Principles\<close> |
d0205dde00bb
added definitions wf_on and wfp_on as restricted versions of wf and wfP respectively
desharna
parents:
77172
diff
changeset
|
46 |
|
79919
65e0682cca63
added lemmas wfP_iff_ex_minimal, wf_iff_ex_minimal, wf_onE_pf, wf_onI_pf, wf_on_iff_ex_minimal, and wfp_on_iff_ex_minimal
desharna
parents:
79917
diff
changeset
|
47 |
lemma wf_on_induct[consumes 2, case_names less, induct set: wf_on]: |
79917
d0205dde00bb
added definitions wf_on and wfp_on as restricted versions of wf and wfP respectively
desharna
parents:
77172
diff
changeset
|
48 |
assumes "wf_on A r" and "x \<in> A" and "\<And>x. x \<in> A \<Longrightarrow> (\<And>y. y \<in> A \<Longrightarrow> (y, x) \<in> r \<Longrightarrow> P y) \<Longrightarrow> P x" |
d0205dde00bb
added definitions wf_on and wfp_on as restricted versions of wf and wfP respectively
desharna
parents:
77172
diff
changeset
|
49 |
shows "P x" |
d0205dde00bb
added definitions wf_on and wfp_on as restricted versions of wf and wfP respectively
desharna
parents:
77172
diff
changeset
|
50 |
using assms(2,3) by (auto intro: \<open>wf_on A r\<close>[unfolded wf_on_def, rule_format]) |
d0205dde00bb
added definitions wf_on and wfp_on as restricted versions of wf and wfP respectively
desharna
parents:
77172
diff
changeset
|
51 |
|
d0205dde00bb
added definitions wf_on and wfp_on as restricted versions of wf and wfP respectively
desharna
parents:
77172
diff
changeset
|
52 |
lemma wfp_on_induct[consumes 2, case_names less, induct pred: wfp_on]: |
d0205dde00bb
added definitions wf_on and wfp_on as restricted versions of wf and wfP respectively
desharna
parents:
77172
diff
changeset
|
53 |
assumes "wfp_on A r" and "x \<in> A" and "\<And>x. x \<in> A \<Longrightarrow> (\<And>y. y \<in> A \<Longrightarrow> r y x \<Longrightarrow> P y) \<Longrightarrow> P x" |
d0205dde00bb
added definitions wf_on and wfp_on as restricted versions of wf and wfP respectively
desharna
parents:
77172
diff
changeset
|
54 |
shows "P x" |
d0205dde00bb
added definitions wf_on and wfp_on as restricted versions of wf and wfP respectively
desharna
parents:
77172
diff
changeset
|
55 |
using assms by (fact wf_on_induct[to_pred]) |
d0205dde00bb
added definitions wf_on and wfp_on as restricted versions of wf and wfP respectively
desharna
parents:
77172
diff
changeset
|
56 |
|
d0205dde00bb
added definitions wf_on and wfp_on as restricted versions of wf and wfP respectively
desharna
parents:
77172
diff
changeset
|
57 |
lemma wf_induct: |
d0205dde00bb
added definitions wf_on and wfp_on as restricted versions of wf and wfP respectively
desharna
parents:
77172
diff
changeset
|
58 |
assumes "wf r" |
d0205dde00bb
added definitions wf_on and wfp_on as restricted versions of wf and wfP respectively
desharna
parents:
77172
diff
changeset
|
59 |
and "\<And>x. \<forall>y. (y, x) \<in> r \<longrightarrow> P y \<Longrightarrow> P x" |
d0205dde00bb
added definitions wf_on and wfp_on as restricted versions of wf and wfP respectively
desharna
parents:
77172
diff
changeset
|
60 |
shows "P a" |
d0205dde00bb
added definitions wf_on and wfp_on as restricted versions of wf and wfP respectively
desharna
parents:
77172
diff
changeset
|
61 |
using assms by (auto simp: wf_on_UNIV intro: wf_on_induct[of UNIV]) |
d0205dde00bb
added definitions wf_on and wfp_on as restricted versions of wf and wfP respectively
desharna
parents:
77172
diff
changeset
|
62 |
|
d0205dde00bb
added definitions wf_on and wfp_on as restricted versions of wf and wfP respectively
desharna
parents:
77172
diff
changeset
|
63 |
lemmas wfP_induct = wf_induct [to_pred] |
d0205dde00bb
added definitions wf_on and wfp_on as restricted versions of wf and wfP respectively
desharna
parents:
77172
diff
changeset
|
64 |
|
d0205dde00bb
added definitions wf_on and wfp_on as restricted versions of wf and wfP respectively
desharna
parents:
77172
diff
changeset
|
65 |
lemmas wf_induct_rule = wf_induct [rule_format, consumes 1, case_names less, induct set: wf] |
d0205dde00bb
added definitions wf_on and wfp_on as restricted versions of wf and wfP respectively
desharna
parents:
77172
diff
changeset
|
66 |
|
d0205dde00bb
added definitions wf_on and wfp_on as restricted versions of wf and wfP respectively
desharna
parents:
77172
diff
changeset
|
67 |
lemmas wfP_induct_rule = wf_induct_rule [to_pred, induct set: wfP] |
d0205dde00bb
added definitions wf_on and wfp_on as restricted versions of wf and wfP respectively
desharna
parents:
77172
diff
changeset
|
68 |
|
d0205dde00bb
added definitions wf_on and wfp_on as restricted versions of wf and wfP respectively
desharna
parents:
77172
diff
changeset
|
69 |
|
d0205dde00bb
added definitions wf_on and wfp_on as restricted versions of wf and wfP respectively
desharna
parents:
77172
diff
changeset
|
70 |
subsection \<open>Introduction Rules\<close> |
d0205dde00bb
added definitions wf_on and wfp_on as restricted versions of wf and wfP respectively
desharna
parents:
77172
diff
changeset
|
71 |
|
63108 | 72 |
lemma wfUNIVI: "(\<And>P x. (\<forall>x. (\<forall>y. (y, x) \<in> r \<longrightarrow> P y) \<longrightarrow> P x) \<Longrightarrow> P x) \<Longrightarrow> wf r" |
26748
4d51ddd6aa5c
Merged theories about wellfoundedness into one: Wellfounded.thy
krauss
parents:
diff
changeset
|
73 |
unfolding wf_def by blast |
4d51ddd6aa5c
Merged theories about wellfoundedness into one: Wellfounded.thy
krauss
parents:
diff
changeset
|
74 |
|
4d51ddd6aa5c
Merged theories about wellfoundedness into one: Wellfounded.thy
krauss
parents:
diff
changeset
|
75 |
lemmas wfPUNIVI = wfUNIVI [to_pred] |
4d51ddd6aa5c
Merged theories about wellfoundedness into one: Wellfounded.thy
krauss
parents:
diff
changeset
|
76 |
|
63108 | 77 |
text \<open>Restriction to domain \<open>A\<close> and range \<open>B\<close>. |
78 |
If \<open>r\<close> is well-founded over their intersection, then \<open>wf r\<close>.\<close> |
|
79 |
lemma wfI: |
|
80 |
assumes "r \<subseteq> A \<times> B" |
|
81 |
and "\<And>x P. \<lbrakk>\<forall>x. (\<forall>y. (y, x) \<in> r \<longrightarrow> P y) \<longrightarrow> P x; x \<in> A; x \<in> B\<rbrakk> \<Longrightarrow> P x" |
|
82 |
shows "wf r" |
|
83 |
using assms unfolding wf_def by blast |
|
26748
4d51ddd6aa5c
Merged theories about wellfoundedness into one: Wellfounded.thy
krauss
parents:
diff
changeset
|
84 |
|
4d51ddd6aa5c
Merged theories about wellfoundedness into one: Wellfounded.thy
krauss
parents:
diff
changeset
|
85 |
|
79917
d0205dde00bb
added definitions wf_on and wfp_on as restricted versions of wf and wfP respectively
desharna
parents:
77172
diff
changeset
|
86 |
subsection \<open>Ordering Properties\<close> |
26748
4d51ddd6aa5c
Merged theories about wellfoundedness into one: Wellfounded.thy
krauss
parents:
diff
changeset
|
87 |
|
63108 | 88 |
lemma wf_not_sym: "wf r \<Longrightarrow> (a, x) \<in> r \<Longrightarrow> (x, a) \<notin> r" |
26748
4d51ddd6aa5c
Merged theories about wellfoundedness into one: Wellfounded.thy
krauss
parents:
diff
changeset
|
89 |
by (induct a arbitrary: x set: wf) blast |
4d51ddd6aa5c
Merged theories about wellfoundedness into one: Wellfounded.thy
krauss
parents:
diff
changeset
|
90 |
|
33215
6fd85372981e
replaced (outdated) comments by explicit statements
krauss
parents:
32960
diff
changeset
|
91 |
lemma wf_asym: |
6fd85372981e
replaced (outdated) comments by explicit statements
krauss
parents:
32960
diff
changeset
|
92 |
assumes "wf r" "(a, x) \<in> r" |
6fd85372981e
replaced (outdated) comments by explicit statements
krauss
parents:
32960
diff
changeset
|
93 |
obtains "(x, a) \<notin> r" |
6fd85372981e
replaced (outdated) comments by explicit statements
krauss
parents:
32960
diff
changeset
|
94 |
by (drule wf_not_sym[OF assms]) |
26748
4d51ddd6aa5c
Merged theories about wellfoundedness into one: Wellfounded.thy
krauss
parents:
diff
changeset
|
95 |
|
74971
16eaa56f69f7
added lemmas wf_imp_asym, wfP_imp_asymp, and wfP_imp_irreflp
desharna
parents:
74868
diff
changeset
|
96 |
lemma wf_imp_asym: "wf r \<Longrightarrow> asym r" |
16eaa56f69f7
added lemmas wf_imp_asym, wfP_imp_asymp, and wfP_imp_irreflp
desharna
parents:
74868
diff
changeset
|
97 |
by (auto intro: asymI elim: wf_asym) |
16eaa56f69f7
added lemmas wf_imp_asym, wfP_imp_asymp, and wfP_imp_irreflp
desharna
parents:
74868
diff
changeset
|
98 |
|
16eaa56f69f7
added lemmas wf_imp_asym, wfP_imp_asymp, and wfP_imp_irreflp
desharna
parents:
74868
diff
changeset
|
99 |
lemma wfP_imp_asymp: "wfP r \<Longrightarrow> asymp r" |
16eaa56f69f7
added lemmas wf_imp_asym, wfP_imp_asymp, and wfP_imp_irreflp
desharna
parents:
74868
diff
changeset
|
100 |
by (rule wf_imp_asym[to_pred]) |
16eaa56f69f7
added lemmas wf_imp_asym, wfP_imp_asymp, and wfP_imp_irreflp
desharna
parents:
74868
diff
changeset
|
101 |
|
63108 | 102 |
lemma wf_not_refl [simp]: "wf r \<Longrightarrow> (a, a) \<notin> r" |
26748
4d51ddd6aa5c
Merged theories about wellfoundedness into one: Wellfounded.thy
krauss
parents:
diff
changeset
|
103 |
by (blast elim: wf_asym) |
4d51ddd6aa5c
Merged theories about wellfoundedness into one: Wellfounded.thy
krauss
parents:
diff
changeset
|
104 |
|
63572 | 105 |
lemma wf_irrefl: |
106 |
assumes "wf r" |
|
107 |
obtains "(a, a) \<notin> r" |
|
63108 | 108 |
by (drule wf_not_refl[OF assms]) |
26748
4d51ddd6aa5c
Merged theories about wellfoundedness into one: Wellfounded.thy
krauss
parents:
diff
changeset
|
109 |
|
72170
7fa9605b226c
Another go with lex: now lexordp back in class ord
paulson <lp15@cam.ac.uk>
parents:
72168
diff
changeset
|
110 |
lemma wf_imp_irrefl: |
7fa9605b226c
Another go with lex: now lexordp back in class ord
paulson <lp15@cam.ac.uk>
parents:
72168
diff
changeset
|
111 |
assumes "wf r" shows "irrefl r" |
7fa9605b226c
Another go with lex: now lexordp back in class ord
paulson <lp15@cam.ac.uk>
parents:
72168
diff
changeset
|
112 |
using wf_irrefl [OF assms] by (auto simp add: irrefl_def) |
7fa9605b226c
Another go with lex: now lexordp back in class ord
paulson <lp15@cam.ac.uk>
parents:
72168
diff
changeset
|
113 |
|
74971
16eaa56f69f7
added lemmas wf_imp_asym, wfP_imp_asymp, and wfP_imp_irreflp
desharna
parents:
74868
diff
changeset
|
114 |
lemma wfP_imp_irreflp: "wfP r \<Longrightarrow> irreflp r" |
76588
82a36e3d1b55
rewrite proofs using to_pred attribute on existing lemmas
desharna
parents:
76559
diff
changeset
|
115 |
by (rule wf_imp_irrefl[to_pred]) |
74971
16eaa56f69f7
added lemmas wf_imp_asym, wfP_imp_asymp, and wfP_imp_irreflp
desharna
parents:
74868
diff
changeset
|
116 |
|
27823 | 117 |
lemma wf_wellorderI: |
118 |
assumes wf: "wf {(x::'a::ord, y). x < y}" |
|
63572 | 119 |
and lin: "OFCLASS('a::ord, linorder_class)" |
27823 | 120 |
shows "OFCLASS('a::ord, wellorder_class)" |
71410 | 121 |
apply (rule wellorder_class.intro [OF lin]) |
122 |
apply (simp add: wellorder_class.intro class.wellorder_axioms.intro wf_induct_rule [OF wf]) |
|
63108 | 123 |
done |
27823 | 124 |
|
63108 | 125 |
lemma (in wellorder) wf: "wf {(x, y). x < y}" |
126 |
unfolding wf_def by (blast intro: less_induct) |
|
27823 | 127 |
|
74868
2741ef11ccf6
added wfP_less to wellorder and wfP_less_multiset
desharna
parents:
72184
diff
changeset
|
128 |
lemma (in wellorder) wfP_less[simp]: "wfP (<)" |
2741ef11ccf6
added wfP_less to wellorder and wfP_less_multiset
desharna
parents:
72184
diff
changeset
|
129 |
by (simp add: wf wfP_def) |
2741ef11ccf6
added wfP_less to wellorder and wfP_less_multiset
desharna
parents:
72184
diff
changeset
|
130 |
|
27823 | 131 |
|
60758 | 132 |
subsection \<open>Basic Results\<close> |
26976 | 133 |
|
60758 | 134 |
text \<open>Point-free characterization of well-foundedness\<close> |
33216 | 135 |
|
79919
65e0682cca63
added lemmas wfP_iff_ex_minimal, wf_iff_ex_minimal, wf_onE_pf, wf_onI_pf, wf_on_iff_ex_minimal, and wfp_on_iff_ex_minimal
desharna
parents:
79917
diff
changeset
|
136 |
lemma wf_onE_pf: |
65e0682cca63
added lemmas wfP_iff_ex_minimal, wf_iff_ex_minimal, wf_onE_pf, wf_onI_pf, wf_on_iff_ex_minimal, and wfp_on_iff_ex_minimal
desharna
parents:
79917
diff
changeset
|
137 |
assumes wf: "wf_on A r" and "B \<subseteq> A" and "B \<subseteq> r `` B" |
65e0682cca63
added lemmas wfP_iff_ex_minimal, wf_iff_ex_minimal, wf_onE_pf, wf_onI_pf, wf_on_iff_ex_minimal, and wfp_on_iff_ex_minimal
desharna
parents:
79917
diff
changeset
|
138 |
shows "B = {}" |
65e0682cca63
added lemmas wfP_iff_ex_minimal, wf_iff_ex_minimal, wf_onE_pf, wf_onI_pf, wf_on_iff_ex_minimal, and wfp_on_iff_ex_minimal
desharna
parents:
79917
diff
changeset
|
139 |
proof - |
65e0682cca63
added lemmas wfP_iff_ex_minimal, wf_iff_ex_minimal, wf_onE_pf, wf_onI_pf, wf_on_iff_ex_minimal, and wfp_on_iff_ex_minimal
desharna
parents:
79917
diff
changeset
|
140 |
have "x \<notin> B" if "x \<in> A" for x |
65e0682cca63
added lemmas wfP_iff_ex_minimal, wf_iff_ex_minimal, wf_onE_pf, wf_onI_pf, wf_on_iff_ex_minimal, and wfp_on_iff_ex_minimal
desharna
parents:
79917
diff
changeset
|
141 |
using wf that |
65e0682cca63
added lemmas wfP_iff_ex_minimal, wf_iff_ex_minimal, wf_onE_pf, wf_onI_pf, wf_on_iff_ex_minimal, and wfp_on_iff_ex_minimal
desharna
parents:
79917
diff
changeset
|
142 |
proof (induction x rule: wf_on_induct) |
65e0682cca63
added lemmas wfP_iff_ex_minimal, wf_iff_ex_minimal, wf_onE_pf, wf_onI_pf, wf_on_iff_ex_minimal, and wfp_on_iff_ex_minimal
desharna
parents:
79917
diff
changeset
|
143 |
case (less x) |
65e0682cca63
added lemmas wfP_iff_ex_minimal, wf_iff_ex_minimal, wf_onE_pf, wf_onI_pf, wf_on_iff_ex_minimal, and wfp_on_iff_ex_minimal
desharna
parents:
79917
diff
changeset
|
144 |
have "x \<notin> r `` B" |
65e0682cca63
added lemmas wfP_iff_ex_minimal, wf_iff_ex_minimal, wf_onE_pf, wf_onI_pf, wf_on_iff_ex_minimal, and wfp_on_iff_ex_minimal
desharna
parents:
79917
diff
changeset
|
145 |
using less.IH \<open>B \<subseteq> A\<close> by blast |
65e0682cca63
added lemmas wfP_iff_ex_minimal, wf_iff_ex_minimal, wf_onE_pf, wf_onI_pf, wf_on_iff_ex_minimal, and wfp_on_iff_ex_minimal
desharna
parents:
79917
diff
changeset
|
146 |
thus ?case |
65e0682cca63
added lemmas wfP_iff_ex_minimal, wf_iff_ex_minimal, wf_onE_pf, wf_onI_pf, wf_on_iff_ex_minimal, and wfp_on_iff_ex_minimal
desharna
parents:
79917
diff
changeset
|
147 |
using \<open>B \<subseteq> r `` B\<close> by blast |
65e0682cca63
added lemmas wfP_iff_ex_minimal, wf_iff_ex_minimal, wf_onE_pf, wf_onI_pf, wf_on_iff_ex_minimal, and wfp_on_iff_ex_minimal
desharna
parents:
79917
diff
changeset
|
148 |
qed |
65e0682cca63
added lemmas wfP_iff_ex_minimal, wf_iff_ex_minimal, wf_onE_pf, wf_onI_pf, wf_on_iff_ex_minimal, and wfp_on_iff_ex_minimal
desharna
parents:
79917
diff
changeset
|
149 |
with \<open>B \<subseteq> A\<close> show ?thesis |
65e0682cca63
added lemmas wfP_iff_ex_minimal, wf_iff_ex_minimal, wf_onE_pf, wf_onI_pf, wf_on_iff_ex_minimal, and wfp_on_iff_ex_minimal
desharna
parents:
79917
diff
changeset
|
150 |
by blast |
65e0682cca63
added lemmas wfP_iff_ex_minimal, wf_iff_ex_minimal, wf_onE_pf, wf_onI_pf, wf_on_iff_ex_minimal, and wfp_on_iff_ex_minimal
desharna
parents:
79917
diff
changeset
|
151 |
qed |
65e0682cca63
added lemmas wfP_iff_ex_minimal, wf_iff_ex_minimal, wf_onE_pf, wf_onI_pf, wf_on_iff_ex_minimal, and wfp_on_iff_ex_minimal
desharna
parents:
79917
diff
changeset
|
152 |
|
79920 | 153 |
lemma wfE_pf: "wf R \<Longrightarrow> A \<subseteq> R `` A \<Longrightarrow> A = {}" |
154 |
using wf_onE_pf[of UNIV, unfolded wf_on_UNIV, simplified] . |
|
33216 | 155 |
|
79919
65e0682cca63
added lemmas wfP_iff_ex_minimal, wf_iff_ex_minimal, wf_onE_pf, wf_onI_pf, wf_on_iff_ex_minimal, and wfp_on_iff_ex_minimal
desharna
parents:
79917
diff
changeset
|
156 |
lemma wf_onI_pf: |
65e0682cca63
added lemmas wfP_iff_ex_minimal, wf_iff_ex_minimal, wf_onE_pf, wf_onI_pf, wf_on_iff_ex_minimal, and wfp_on_iff_ex_minimal
desharna
parents:
79917
diff
changeset
|
157 |
assumes "\<And>B. B \<subseteq> A \<Longrightarrow> B \<subseteq> R `` B \<Longrightarrow> B = {}" |
65e0682cca63
added lemmas wfP_iff_ex_minimal, wf_iff_ex_minimal, wf_onE_pf, wf_onI_pf, wf_on_iff_ex_minimal, and wfp_on_iff_ex_minimal
desharna
parents:
79917
diff
changeset
|
158 |
shows "wf_on A R" |
65e0682cca63
added lemmas wfP_iff_ex_minimal, wf_iff_ex_minimal, wf_onE_pf, wf_onI_pf, wf_on_iff_ex_minimal, and wfp_on_iff_ex_minimal
desharna
parents:
79917
diff
changeset
|
159 |
unfolding wf_on_def |
65e0682cca63
added lemmas wfP_iff_ex_minimal, wf_iff_ex_minimal, wf_onE_pf, wf_onI_pf, wf_on_iff_ex_minimal, and wfp_on_iff_ex_minimal
desharna
parents:
79917
diff
changeset
|
160 |
proof (intro allI impI ballI) |
65e0682cca63
added lemmas wfP_iff_ex_minimal, wf_iff_ex_minimal, wf_onE_pf, wf_onI_pf, wf_on_iff_ex_minimal, and wfp_on_iff_ex_minimal
desharna
parents:
79917
diff
changeset
|
161 |
fix P :: "'a \<Rightarrow> bool" and x :: 'a |
65e0682cca63
added lemmas wfP_iff_ex_minimal, wf_iff_ex_minimal, wf_onE_pf, wf_onI_pf, wf_on_iff_ex_minimal, and wfp_on_iff_ex_minimal
desharna
parents:
79917
diff
changeset
|
162 |
let ?B = "{x \<in> A. \<not> P x}" |
65e0682cca63
added lemmas wfP_iff_ex_minimal, wf_iff_ex_minimal, wf_onE_pf, wf_onI_pf, wf_on_iff_ex_minimal, and wfp_on_iff_ex_minimal
desharna
parents:
79917
diff
changeset
|
163 |
assume "\<forall>x\<in>A. (\<forall>y\<in>A. (y, x) \<in> R \<longrightarrow> P y) \<longrightarrow> P x" |
65e0682cca63
added lemmas wfP_iff_ex_minimal, wf_iff_ex_minimal, wf_onE_pf, wf_onI_pf, wf_on_iff_ex_minimal, and wfp_on_iff_ex_minimal
desharna
parents:
79917
diff
changeset
|
164 |
hence "?B \<subseteq> R `` ?B" by blast |
65e0682cca63
added lemmas wfP_iff_ex_minimal, wf_iff_ex_minimal, wf_onE_pf, wf_onI_pf, wf_on_iff_ex_minimal, and wfp_on_iff_ex_minimal
desharna
parents:
79917
diff
changeset
|
165 |
hence "{x \<in> A. \<not> P x} = {}" |
65e0682cca63
added lemmas wfP_iff_ex_minimal, wf_iff_ex_minimal, wf_onE_pf, wf_onI_pf, wf_on_iff_ex_minimal, and wfp_on_iff_ex_minimal
desharna
parents:
79917
diff
changeset
|
166 |
using assms(1)[of ?B] by simp |
65e0682cca63
added lemmas wfP_iff_ex_minimal, wf_iff_ex_minimal, wf_onE_pf, wf_onI_pf, wf_on_iff_ex_minimal, and wfp_on_iff_ex_minimal
desharna
parents:
79917
diff
changeset
|
167 |
moreover assume "x \<in> A" |
65e0682cca63
added lemmas wfP_iff_ex_minimal, wf_iff_ex_minimal, wf_onE_pf, wf_onI_pf, wf_on_iff_ex_minimal, and wfp_on_iff_ex_minimal
desharna
parents:
79917
diff
changeset
|
168 |
ultimately show "P x" |
65e0682cca63
added lemmas wfP_iff_ex_minimal, wf_iff_ex_minimal, wf_onE_pf, wf_onI_pf, wf_on_iff_ex_minimal, and wfp_on_iff_ex_minimal
desharna
parents:
79917
diff
changeset
|
169 |
by simp |
65e0682cca63
added lemmas wfP_iff_ex_minimal, wf_iff_ex_minimal, wf_onE_pf, wf_onI_pf, wf_on_iff_ex_minimal, and wfp_on_iff_ex_minimal
desharna
parents:
79917
diff
changeset
|
170 |
qed |
65e0682cca63
added lemmas wfP_iff_ex_minimal, wf_iff_ex_minimal, wf_onE_pf, wf_onI_pf, wf_on_iff_ex_minimal, and wfp_on_iff_ex_minimal
desharna
parents:
79917
diff
changeset
|
171 |
|
79920 | 172 |
lemma wfI_pf: "(\<And>A. A \<subseteq> R `` A \<Longrightarrow> A = {}) \<Longrightarrow> wf R" |
173 |
using wf_onI_pf[of UNIV, unfolded wf_on_UNIV, simplified] . |
|
33216 | 174 |
|
63108 | 175 |
|
176 |
subsubsection \<open>Minimal-element characterization of well-foundedness\<close> |
|
33216 | 177 |
|
79919
65e0682cca63
added lemmas wfP_iff_ex_minimal, wf_iff_ex_minimal, wf_onE_pf, wf_onI_pf, wf_on_iff_ex_minimal, and wfp_on_iff_ex_minimal
desharna
parents:
79917
diff
changeset
|
178 |
lemma wf_on_iff_ex_minimal: "wf_on A R \<longleftrightarrow> (\<forall>B \<subseteq> A. B \<noteq> {} \<longrightarrow> (\<exists>z \<in> B. \<forall>y. (y, z) \<in> R \<longrightarrow> y \<notin> B))" |
65e0682cca63
added lemmas wfP_iff_ex_minimal, wf_iff_ex_minimal, wf_onE_pf, wf_onI_pf, wf_on_iff_ex_minimal, and wfp_on_iff_ex_minimal
desharna
parents:
79917
diff
changeset
|
179 |
proof (intro iffI allI impI) |
65e0682cca63
added lemmas wfP_iff_ex_minimal, wf_iff_ex_minimal, wf_onE_pf, wf_onI_pf, wf_on_iff_ex_minimal, and wfp_on_iff_ex_minimal
desharna
parents:
79917
diff
changeset
|
180 |
fix B |
65e0682cca63
added lemmas wfP_iff_ex_minimal, wf_iff_ex_minimal, wf_onE_pf, wf_onI_pf, wf_on_iff_ex_minimal, and wfp_on_iff_ex_minimal
desharna
parents:
79917
diff
changeset
|
181 |
assume "wf_on A R" and "B \<subseteq> A" and "B \<noteq> {}" |
65e0682cca63
added lemmas wfP_iff_ex_minimal, wf_iff_ex_minimal, wf_onE_pf, wf_onI_pf, wf_on_iff_ex_minimal, and wfp_on_iff_ex_minimal
desharna
parents:
79917
diff
changeset
|
182 |
show "\<exists>z \<in> B. \<forall>y. (y, z) \<in> R \<longrightarrow> y \<notin> B" |
65e0682cca63
added lemmas wfP_iff_ex_minimal, wf_iff_ex_minimal, wf_onE_pf, wf_onI_pf, wf_on_iff_ex_minimal, and wfp_on_iff_ex_minimal
desharna
parents:
79917
diff
changeset
|
183 |
using wf_onE_pf[OF \<open>wf_on A R\<close> \<open>B \<subseteq> A\<close>] \<open>B \<noteq> {}\<close> by blast |
65e0682cca63
added lemmas wfP_iff_ex_minimal, wf_iff_ex_minimal, wf_onE_pf, wf_onI_pf, wf_on_iff_ex_minimal, and wfp_on_iff_ex_minimal
desharna
parents:
79917
diff
changeset
|
184 |
next |
65e0682cca63
added lemmas wfP_iff_ex_minimal, wf_iff_ex_minimal, wf_onE_pf, wf_onI_pf, wf_on_iff_ex_minimal, and wfp_on_iff_ex_minimal
desharna
parents:
79917
diff
changeset
|
185 |
assume ex_min: "\<forall>B\<subseteq>A. B \<noteq> {} \<longrightarrow> (\<exists>z\<in>B. \<forall>y. (y, z) \<in> R \<longrightarrow> y \<notin> B)" |
65e0682cca63
added lemmas wfP_iff_ex_minimal, wf_iff_ex_minimal, wf_onE_pf, wf_onI_pf, wf_on_iff_ex_minimal, and wfp_on_iff_ex_minimal
desharna
parents:
79917
diff
changeset
|
186 |
show "wf_on A R " |
65e0682cca63
added lemmas wfP_iff_ex_minimal, wf_iff_ex_minimal, wf_onE_pf, wf_onI_pf, wf_on_iff_ex_minimal, and wfp_on_iff_ex_minimal
desharna
parents:
79917
diff
changeset
|
187 |
proof (rule wf_onI_pf) |
65e0682cca63
added lemmas wfP_iff_ex_minimal, wf_iff_ex_minimal, wf_onE_pf, wf_onI_pf, wf_on_iff_ex_minimal, and wfp_on_iff_ex_minimal
desharna
parents:
79917
diff
changeset
|
188 |
fix B |
65e0682cca63
added lemmas wfP_iff_ex_minimal, wf_iff_ex_minimal, wf_onE_pf, wf_onI_pf, wf_on_iff_ex_minimal, and wfp_on_iff_ex_minimal
desharna
parents:
79917
diff
changeset
|
189 |
assume "B \<subseteq> A" and "B \<subseteq> R `` B" |
65e0682cca63
added lemmas wfP_iff_ex_minimal, wf_iff_ex_minimal, wf_onE_pf, wf_onI_pf, wf_on_iff_ex_minimal, and wfp_on_iff_ex_minimal
desharna
parents:
79917
diff
changeset
|
190 |
have False if "B \<noteq> {}" |
65e0682cca63
added lemmas wfP_iff_ex_minimal, wf_iff_ex_minimal, wf_onE_pf, wf_onI_pf, wf_on_iff_ex_minimal, and wfp_on_iff_ex_minimal
desharna
parents:
79917
diff
changeset
|
191 |
using ex_min[rule_format, OF \<open>B \<subseteq> A\<close> \<open>B \<noteq> {}\<close>] |
65e0682cca63
added lemmas wfP_iff_ex_minimal, wf_iff_ex_minimal, wf_onE_pf, wf_onI_pf, wf_on_iff_ex_minimal, and wfp_on_iff_ex_minimal
desharna
parents:
79917
diff
changeset
|
192 |
using \<open>B \<subseteq> R `` B\<close> by blast |
65e0682cca63
added lemmas wfP_iff_ex_minimal, wf_iff_ex_minimal, wf_onE_pf, wf_onI_pf, wf_on_iff_ex_minimal, and wfp_on_iff_ex_minimal
desharna
parents:
79917
diff
changeset
|
193 |
thus "B = {}" |
65e0682cca63
added lemmas wfP_iff_ex_minimal, wf_iff_ex_minimal, wf_onE_pf, wf_onI_pf, wf_on_iff_ex_minimal, and wfp_on_iff_ex_minimal
desharna
parents:
79917
diff
changeset
|
194 |
by blast |
65e0682cca63
added lemmas wfP_iff_ex_minimal, wf_iff_ex_minimal, wf_onE_pf, wf_onI_pf, wf_on_iff_ex_minimal, and wfp_on_iff_ex_minimal
desharna
parents:
79917
diff
changeset
|
195 |
qed |
65e0682cca63
added lemmas wfP_iff_ex_minimal, wf_iff_ex_minimal, wf_onE_pf, wf_onI_pf, wf_on_iff_ex_minimal, and wfp_on_iff_ex_minimal
desharna
parents:
79917
diff
changeset
|
196 |
qed |
65e0682cca63
added lemmas wfP_iff_ex_minimal, wf_iff_ex_minimal, wf_onE_pf, wf_onI_pf, wf_on_iff_ex_minimal, and wfp_on_iff_ex_minimal
desharna
parents:
79917
diff
changeset
|
197 |
|
65e0682cca63
added lemmas wfP_iff_ex_minimal, wf_iff_ex_minimal, wf_onE_pf, wf_onI_pf, wf_on_iff_ex_minimal, and wfp_on_iff_ex_minimal
desharna
parents:
79917
diff
changeset
|
198 |
lemma wf_iff_ex_minimal: "wf R \<longleftrightarrow> (\<forall>B. B \<noteq> {} \<longrightarrow> (\<exists>z \<in> B. \<forall>y. (y, z) \<in> R \<longrightarrow> y \<notin> B))" |
65e0682cca63
added lemmas wfP_iff_ex_minimal, wf_iff_ex_minimal, wf_onE_pf, wf_onI_pf, wf_on_iff_ex_minimal, and wfp_on_iff_ex_minimal
desharna
parents:
79917
diff
changeset
|
199 |
using wf_on_iff_ex_minimal[of UNIV, unfolded wf_on_UNIV, simplified] . |
65e0682cca63
added lemmas wfP_iff_ex_minimal, wf_iff_ex_minimal, wf_onE_pf, wf_onI_pf, wf_on_iff_ex_minimal, and wfp_on_iff_ex_minimal
desharna
parents:
79917
diff
changeset
|
200 |
|
65e0682cca63
added lemmas wfP_iff_ex_minimal, wf_iff_ex_minimal, wf_onE_pf, wf_onI_pf, wf_on_iff_ex_minimal, and wfp_on_iff_ex_minimal
desharna
parents:
79917
diff
changeset
|
201 |
lemma wfp_on_iff_ex_minimal: "wfp_on A R \<longleftrightarrow> (\<forall>B \<subseteq> A. B \<noteq> {} \<longrightarrow> (\<exists>z \<in> B. \<forall>y. R y z \<longrightarrow> y \<notin> B))" |
65e0682cca63
added lemmas wfP_iff_ex_minimal, wf_iff_ex_minimal, wf_onE_pf, wf_onI_pf, wf_on_iff_ex_minimal, and wfp_on_iff_ex_minimal
desharna
parents:
79917
diff
changeset
|
202 |
using wf_on_iff_ex_minimal[of A, to_pred] by simp |
65e0682cca63
added lemmas wfP_iff_ex_minimal, wf_iff_ex_minimal, wf_onE_pf, wf_onI_pf, wf_on_iff_ex_minimal, and wfp_on_iff_ex_minimal
desharna
parents:
79917
diff
changeset
|
203 |
|
65e0682cca63
added lemmas wfP_iff_ex_minimal, wf_iff_ex_minimal, wf_onE_pf, wf_onI_pf, wf_on_iff_ex_minimal, and wfp_on_iff_ex_minimal
desharna
parents:
79917
diff
changeset
|
204 |
lemma wfP_iff_ex_minimal: "wfP R \<longleftrightarrow> (\<forall>B. B \<noteq> {} \<longrightarrow> (\<exists>z \<in> B. \<forall>y. R y z \<longrightarrow> y \<notin> B))" |
65e0682cca63
added lemmas wfP_iff_ex_minimal, wf_iff_ex_minimal, wf_onE_pf, wf_onI_pf, wf_on_iff_ex_minimal, and wfp_on_iff_ex_minimal
desharna
parents:
79917
diff
changeset
|
205 |
using wfp_on_iff_ex_minimal[of UNIV, unfolded wfp_on_UNIV, simplified] . |
65e0682cca63
added lemmas wfP_iff_ex_minimal, wf_iff_ex_minimal, wf_onE_pf, wf_onI_pf, wf_on_iff_ex_minimal, and wfp_on_iff_ex_minimal
desharna
parents:
79917
diff
changeset
|
206 |
|
33216 | 207 |
lemma wfE_min: |
208 |
assumes wf: "wf R" and Q: "x \<in> Q" |
|
209 |
obtains z where "z \<in> Q" "\<And>y. (y, z) \<in> R \<Longrightarrow> y \<notin> Q" |
|
210 |
using Q wfE_pf[OF wf, of Q] by blast |
|
211 |
||
63099
af0e964aad7b
Moved material from AFP/Randomised_Social_Choice to distribution
eberlm
parents:
63088
diff
changeset
|
212 |
lemma wfE_min': |
af0e964aad7b
Moved material from AFP/Randomised_Social_Choice to distribution
eberlm
parents:
63088
diff
changeset
|
213 |
"wf R \<Longrightarrow> Q \<noteq> {} \<Longrightarrow> (\<And>z. z \<in> Q \<Longrightarrow> (\<And>y. (y, z) \<in> R \<Longrightarrow> y \<notin> Q) \<Longrightarrow> thesis) \<Longrightarrow> thesis" |
af0e964aad7b
Moved material from AFP/Randomised_Social_Choice to distribution
eberlm
parents:
63088
diff
changeset
|
214 |
using wfE_min[of R _ Q] by blast |
af0e964aad7b
Moved material from AFP/Randomised_Social_Choice to distribution
eberlm
parents:
63088
diff
changeset
|
215 |
|
33216 | 216 |
lemma wfI_min: |
217 |
assumes a: "\<And>x Q. x \<in> Q \<Longrightarrow> \<exists>z\<in>Q. \<forall>y. (y, z) \<in> R \<longrightarrow> y \<notin> Q" |
|
218 |
shows "wf R" |
|
219 |
proof (rule wfI_pf) |
|
63108 | 220 |
fix A |
221 |
assume b: "A \<subseteq> R `` A" |
|
222 |
have False if "x \<in> A" for x |
|
223 |
using a[OF that] b by blast |
|
224 |
then show "A = {}" by blast |
|
33216 | 225 |
qed |
226 |
||
63108 | 227 |
lemma wf_eq_minimal: "wf r \<longleftrightarrow> (\<forall>Q x. x \<in> Q \<longrightarrow> (\<exists>z\<in>Q. \<forall>y. (y, z) \<in> r \<longrightarrow> y \<notin> Q))" |
79920 | 228 |
unfolding wf_iff_ex_minimal by blast |
33216 | 229 |
|
230 |
lemmas wfP_eq_minimal = wf_eq_minimal [to_pred] |
|
231 |
||
63108 | 232 |
|
79922
caa9dbffd712
added lemmas wf_on_antimono, wf_on_antimono_strong, wfp_on_antimono, wfp_on_antimono_strong, wf_on_subset, and wfp_on_subset
desharna
parents:
79920
diff
changeset
|
233 |
subsubsection \<open>Antimonotonicity\<close> |
caa9dbffd712
added lemmas wf_on_antimono, wf_on_antimono_strong, wfp_on_antimono, wfp_on_antimono_strong, wf_on_subset, and wfp_on_subset
desharna
parents:
79920
diff
changeset
|
234 |
|
caa9dbffd712
added lemmas wf_on_antimono, wf_on_antimono_strong, wfp_on_antimono, wfp_on_antimono_strong, wf_on_subset, and wfp_on_subset
desharna
parents:
79920
diff
changeset
|
235 |
lemma wf_on_antimono_strong: |
caa9dbffd712
added lemmas wf_on_antimono, wf_on_antimono_strong, wfp_on_antimono, wfp_on_antimono_strong, wf_on_subset, and wfp_on_subset
desharna
parents:
79920
diff
changeset
|
236 |
assumes "wf_on B r" and "A \<subseteq> B" and "(\<And>x y. x \<in> A \<Longrightarrow> y \<in> A \<Longrightarrow> (x, y) \<in> q \<Longrightarrow> (x, y) \<in> r)" |
caa9dbffd712
added lemmas wf_on_antimono, wf_on_antimono_strong, wfp_on_antimono, wfp_on_antimono_strong, wf_on_subset, and wfp_on_subset
desharna
parents:
79920
diff
changeset
|
237 |
shows "wf_on A q" |
caa9dbffd712
added lemmas wf_on_antimono, wf_on_antimono_strong, wfp_on_antimono, wfp_on_antimono_strong, wf_on_subset, and wfp_on_subset
desharna
parents:
79920
diff
changeset
|
238 |
unfolding wf_on_iff_ex_minimal |
caa9dbffd712
added lemmas wf_on_antimono, wf_on_antimono_strong, wfp_on_antimono, wfp_on_antimono_strong, wf_on_subset, and wfp_on_subset
desharna
parents:
79920
diff
changeset
|
239 |
proof (intro allI impI) |
caa9dbffd712
added lemmas wf_on_antimono, wf_on_antimono_strong, wfp_on_antimono, wfp_on_antimono_strong, wf_on_subset, and wfp_on_subset
desharna
parents:
79920
diff
changeset
|
240 |
fix AA assume "AA \<subseteq> A" and "AA \<noteq> {}" |
caa9dbffd712
added lemmas wf_on_antimono, wf_on_antimono_strong, wfp_on_antimono, wfp_on_antimono_strong, wf_on_subset, and wfp_on_subset
desharna
parents:
79920
diff
changeset
|
241 |
hence "\<exists>z\<in>AA. \<forall>y. (y, z) \<in> r \<longrightarrow> y \<notin> AA" |
caa9dbffd712
added lemmas wf_on_antimono, wf_on_antimono_strong, wfp_on_antimono, wfp_on_antimono_strong, wf_on_subset, and wfp_on_subset
desharna
parents:
79920
diff
changeset
|
242 |
using \<open>wf_on B r\<close> \<open>A \<subseteq> B\<close> |
caa9dbffd712
added lemmas wf_on_antimono, wf_on_antimono_strong, wfp_on_antimono, wfp_on_antimono_strong, wf_on_subset, and wfp_on_subset
desharna
parents:
79920
diff
changeset
|
243 |
by (simp add: wf_on_iff_ex_minimal) |
caa9dbffd712
added lemmas wf_on_antimono, wf_on_antimono_strong, wfp_on_antimono, wfp_on_antimono_strong, wf_on_subset, and wfp_on_subset
desharna
parents:
79920
diff
changeset
|
244 |
then show "\<exists>z\<in>AA. \<forall>y. (y, z) \<in> q \<longrightarrow> y \<notin> AA" |
caa9dbffd712
added lemmas wf_on_antimono, wf_on_antimono_strong, wfp_on_antimono, wfp_on_antimono_strong, wf_on_subset, and wfp_on_subset
desharna
parents:
79920
diff
changeset
|
245 |
using \<open>AA \<subseteq> A\<close> assms(3) by blast |
caa9dbffd712
added lemmas wf_on_antimono, wf_on_antimono_strong, wfp_on_antimono, wfp_on_antimono_strong, wf_on_subset, and wfp_on_subset
desharna
parents:
79920
diff
changeset
|
246 |
qed |
caa9dbffd712
added lemmas wf_on_antimono, wf_on_antimono_strong, wfp_on_antimono, wfp_on_antimono_strong, wf_on_subset, and wfp_on_subset
desharna
parents:
79920
diff
changeset
|
247 |
|
caa9dbffd712
added lemmas wf_on_antimono, wf_on_antimono_strong, wfp_on_antimono, wfp_on_antimono_strong, wf_on_subset, and wfp_on_subset
desharna
parents:
79920
diff
changeset
|
248 |
lemma wfp_on_antimono_strong: |
caa9dbffd712
added lemmas wf_on_antimono, wf_on_antimono_strong, wfp_on_antimono, wfp_on_antimono_strong, wf_on_subset, and wfp_on_subset
desharna
parents:
79920
diff
changeset
|
249 |
"wfp_on B R \<Longrightarrow> A \<subseteq> B \<Longrightarrow> (\<And>x y. x \<in> A \<Longrightarrow> y \<in> A \<Longrightarrow> Q x y \<Longrightarrow> R x y) \<Longrightarrow> wfp_on A Q" |
caa9dbffd712
added lemmas wf_on_antimono, wf_on_antimono_strong, wfp_on_antimono, wfp_on_antimono_strong, wf_on_subset, and wfp_on_subset
desharna
parents:
79920
diff
changeset
|
250 |
using wf_on_antimono_strong[of B _ A, to_pred] . |
caa9dbffd712
added lemmas wf_on_antimono, wf_on_antimono_strong, wfp_on_antimono, wfp_on_antimono_strong, wf_on_subset, and wfp_on_subset
desharna
parents:
79920
diff
changeset
|
251 |
|
caa9dbffd712
added lemmas wf_on_antimono, wf_on_antimono_strong, wfp_on_antimono, wfp_on_antimono_strong, wf_on_subset, and wfp_on_subset
desharna
parents:
79920
diff
changeset
|
252 |
lemma wf_on_antimono: "A \<subseteq> B \<Longrightarrow> q \<subseteq> r \<Longrightarrow> wf_on B r \<le> wf_on A q" |
caa9dbffd712
added lemmas wf_on_antimono, wf_on_antimono_strong, wfp_on_antimono, wfp_on_antimono_strong, wf_on_subset, and wfp_on_subset
desharna
parents:
79920
diff
changeset
|
253 |
using wf_on_antimono_strong[of B r A q] by auto |
caa9dbffd712
added lemmas wf_on_antimono, wf_on_antimono_strong, wfp_on_antimono, wfp_on_antimono_strong, wf_on_subset, and wfp_on_subset
desharna
parents:
79920
diff
changeset
|
254 |
|
caa9dbffd712
added lemmas wf_on_antimono, wf_on_antimono_strong, wfp_on_antimono, wfp_on_antimono_strong, wf_on_subset, and wfp_on_subset
desharna
parents:
79920
diff
changeset
|
255 |
lemma wfp_on_antimono: "A \<subseteq> B \<Longrightarrow> Q \<le> R \<Longrightarrow> wfp_on B R \<le> wfp_on A Q" |
caa9dbffd712
added lemmas wf_on_antimono, wf_on_antimono_strong, wfp_on_antimono, wfp_on_antimono_strong, wf_on_subset, and wfp_on_subset
desharna
parents:
79920
diff
changeset
|
256 |
using wfp_on_antimono_strong[of B R A Q] by auto |
caa9dbffd712
added lemmas wf_on_antimono, wf_on_antimono_strong, wfp_on_antimono, wfp_on_antimono_strong, wf_on_subset, and wfp_on_subset
desharna
parents:
79920
diff
changeset
|
257 |
|
caa9dbffd712
added lemmas wf_on_antimono, wf_on_antimono_strong, wfp_on_antimono, wfp_on_antimono_strong, wf_on_subset, and wfp_on_subset
desharna
parents:
79920
diff
changeset
|
258 |
lemma wf_on_subset: "wf_on B r \<Longrightarrow> A \<subseteq> B \<Longrightarrow> wf_on A r" |
caa9dbffd712
added lemmas wf_on_antimono, wf_on_antimono_strong, wfp_on_antimono, wfp_on_antimono_strong, wf_on_subset, and wfp_on_subset
desharna
parents:
79920
diff
changeset
|
259 |
using wf_on_antimono_strong . |
caa9dbffd712
added lemmas wf_on_antimono, wf_on_antimono_strong, wfp_on_antimono, wfp_on_antimono_strong, wf_on_subset, and wfp_on_subset
desharna
parents:
79920
diff
changeset
|
260 |
|
caa9dbffd712
added lemmas wf_on_antimono, wf_on_antimono_strong, wfp_on_antimono, wfp_on_antimono_strong, wf_on_subset, and wfp_on_subset
desharna
parents:
79920
diff
changeset
|
261 |
lemma wfp_on_subset: "wfp_on B R \<Longrightarrow> A \<subseteq> B \<Longrightarrow> wfp_on A R" |
caa9dbffd712
added lemmas wf_on_antimono, wf_on_antimono_strong, wfp_on_antimono, wfp_on_antimono_strong, wf_on_subset, and wfp_on_subset
desharna
parents:
79920
diff
changeset
|
262 |
using wfp_on_antimono_strong . |
caa9dbffd712
added lemmas wf_on_antimono, wf_on_antimono_strong, wfp_on_antimono, wfp_on_antimono_strong, wf_on_subset, and wfp_on_subset
desharna
parents:
79920
diff
changeset
|
263 |
|
caa9dbffd712
added lemmas wf_on_antimono, wf_on_antimono_strong, wfp_on_antimono, wfp_on_antimono_strong, wf_on_subset, and wfp_on_subset
desharna
parents:
79920
diff
changeset
|
264 |
|
63108 | 265 |
subsubsection \<open>Well-foundedness of transitive closure\<close> |
33216 | 266 |
|
26748
4d51ddd6aa5c
Merged theories about wellfoundedness into one: Wellfounded.thy
krauss
parents:
diff
changeset
|
267 |
lemma wf_trancl: |
4d51ddd6aa5c
Merged theories about wellfoundedness into one: Wellfounded.thy
krauss
parents:
diff
changeset
|
268 |
assumes "wf r" |
63108 | 269 |
shows "wf (r\<^sup>+)" |
26748
4d51ddd6aa5c
Merged theories about wellfoundedness into one: Wellfounded.thy
krauss
parents:
diff
changeset
|
270 |
proof - |
63108 | 271 |
have "P x" if induct_step: "\<And>x. (\<And>y. (y, x) \<in> r\<^sup>+ \<Longrightarrow> P y) \<Longrightarrow> P x" for P x |
272 |
proof (rule induct_step) |
|
273 |
show "P y" if "(y, x) \<in> r\<^sup>+" for y |
|
274 |
using \<open>wf r\<close> and that |
|
275 |
proof (induct x arbitrary: y) |
|
276 |
case (less x) |
|
277 |
note hyp = \<open>\<And>x' y'. (x', x) \<in> r \<Longrightarrow> (y', x') \<in> r\<^sup>+ \<Longrightarrow> P y'\<close> |
|
278 |
from \<open>(y, x) \<in> r\<^sup>+\<close> show "P y" |
|
279 |
proof cases |
|
280 |
case base |
|
281 |
show "P y" |
|
282 |
proof (rule induct_step) |
|
283 |
fix y' |
|
284 |
assume "(y', y) \<in> r\<^sup>+" |
|
285 |
with \<open>(y, x) \<in> r\<close> show "P y'" |
|
286 |
by (rule hyp [of y y']) |
|
32960
69916a850301
eliminated hard tabulators, guessing at each author's individual tab-width;
wenzelm
parents:
32704
diff
changeset
|
287 |
qed |
63108 | 288 |
next |
289 |
case step |
|
290 |
then obtain x' where "(x', x) \<in> r" and "(y, x') \<in> r\<^sup>+" |
|
291 |
by simp |
|
292 |
then show "P y" by (rule hyp [of x' y]) |
|
26748
4d51ddd6aa5c
Merged theories about wellfoundedness into one: Wellfounded.thy
krauss
parents:
diff
changeset
|
293 |
qed |
4d51ddd6aa5c
Merged theories about wellfoundedness into one: Wellfounded.thy
krauss
parents:
diff
changeset
|
294 |
qed |
63108 | 295 |
qed |
296 |
then show ?thesis unfolding wf_def by blast |
|
26748
4d51ddd6aa5c
Merged theories about wellfoundedness into one: Wellfounded.thy
krauss
parents:
diff
changeset
|
297 |
qed |
4d51ddd6aa5c
Merged theories about wellfoundedness into one: Wellfounded.thy
krauss
parents:
diff
changeset
|
298 |
|
4d51ddd6aa5c
Merged theories about wellfoundedness into one: Wellfounded.thy
krauss
parents:
diff
changeset
|
299 |
lemmas wfP_trancl = wf_trancl [to_pred] |
4d51ddd6aa5c
Merged theories about wellfoundedness into one: Wellfounded.thy
krauss
parents:
diff
changeset
|
300 |
|
63108 | 301 |
lemma wf_converse_trancl: "wf (r\<inverse>) \<Longrightarrow> wf ((r\<^sup>+)\<inverse>)" |
26748
4d51ddd6aa5c
Merged theories about wellfoundedness into one: Wellfounded.thy
krauss
parents:
diff
changeset
|
302 |
apply (subst trancl_converse [symmetric]) |
4d51ddd6aa5c
Merged theories about wellfoundedness into one: Wellfounded.thy
krauss
parents:
diff
changeset
|
303 |
apply (erule wf_trancl) |
4d51ddd6aa5c
Merged theories about wellfoundedness into one: Wellfounded.thy
krauss
parents:
diff
changeset
|
304 |
done |
4d51ddd6aa5c
Merged theories about wellfoundedness into one: Wellfounded.thy
krauss
parents:
diff
changeset
|
305 |
|
60758 | 306 |
text \<open>Well-foundedness of subsets\<close> |
26748
4d51ddd6aa5c
Merged theories about wellfoundedness into one: Wellfounded.thy
krauss
parents:
diff
changeset
|
307 |
|
63108 | 308 |
lemma wf_subset: "wf r \<Longrightarrow> p \<subseteq> r \<Longrightarrow> wf p" |
63612 | 309 |
by (simp add: wf_eq_minimal) fast |
26748
4d51ddd6aa5c
Merged theories about wellfoundedness into one: Wellfounded.thy
krauss
parents:
diff
changeset
|
310 |
|
4d51ddd6aa5c
Merged theories about wellfoundedness into one: Wellfounded.thy
krauss
parents:
diff
changeset
|
311 |
lemmas wfP_subset = wf_subset [to_pred] |
4d51ddd6aa5c
Merged theories about wellfoundedness into one: Wellfounded.thy
krauss
parents:
diff
changeset
|
312 |
|
60758 | 313 |
text \<open>Well-foundedness of the empty relation\<close> |
33216 | 314 |
|
315 |
lemma wf_empty [iff]: "wf {}" |
|
26748
4d51ddd6aa5c
Merged theories about wellfoundedness into one: Wellfounded.thy
krauss
parents:
diff
changeset
|
316 |
by (simp add: wf_def) |
4d51ddd6aa5c
Merged theories about wellfoundedness into one: Wellfounded.thy
krauss
parents:
diff
changeset
|
317 |
|
63612 | 318 |
lemma wfP_empty [iff]: "wfP (\<lambda>x y. False)" |
32205 | 319 |
proof - |
63612 | 320 |
have "wfP bot" |
66952 | 321 |
by (fact wf_empty[to_pred bot_empty_eq2]) |
63612 | 322 |
then show ?thesis |
323 |
by (simp add: bot_fun_def) |
|
32205 | 324 |
qed |
26748
4d51ddd6aa5c
Merged theories about wellfoundedness into one: Wellfounded.thy
krauss
parents:
diff
changeset
|
325 |
|
63572 | 326 |
lemma wf_Int1: "wf r \<Longrightarrow> wf (r \<inter> r')" |
327 |
by (erule wf_subset) (rule Int_lower1) |
|
26748
4d51ddd6aa5c
Merged theories about wellfoundedness into one: Wellfounded.thy
krauss
parents:
diff
changeset
|
328 |
|
63572 | 329 |
lemma wf_Int2: "wf r \<Longrightarrow> wf (r' \<inter> r)" |
330 |
by (erule wf_subset) (rule Int_lower2) |
|
26748
4d51ddd6aa5c
Merged theories about wellfoundedness into one: Wellfounded.thy
krauss
parents:
diff
changeset
|
331 |
|
63572 | 332 |
text \<open>Exponentiation.\<close> |
33216 | 333 |
lemma wf_exp: |
334 |
assumes "wf (R ^^ n)" |
|
335 |
shows "wf R" |
|
336 |
proof (rule wfI_pf) |
|
337 |
fix A assume "A \<subseteq> R `` A" |
|
63612 | 338 |
then have "A \<subseteq> (R ^^ n) `` A" |
339 |
by (induct n) force+ |
|
340 |
with \<open>wf (R ^^ n)\<close> show "A = {}" |
|
341 |
by (rule wfE_pf) |
|
33216 | 342 |
qed |
343 |
||
63572 | 344 |
text \<open>Well-foundedness of \<open>insert\<close>.\<close> |
68646 | 345 |
lemma wf_insert [iff]: "wf (insert (y,x) r) \<longleftrightarrow> wf r \<and> (x,y) \<notin> r\<^sup>*" (is "?lhs = ?rhs") |
346 |
proof |
|
347 |
assume ?lhs then show ?rhs |
|
348 |
by (blast elim: wf_trancl [THEN wf_irrefl] |
|
349 |
intro: rtrancl_into_trancl1 wf_subset rtrancl_mono [THEN subsetD]) |
|
350 |
next |
|
71410 | 351 |
assume R: ?rhs |
68646 | 352 |
then have R': "Q \<noteq> {} \<Longrightarrow> (\<exists>z\<in>Q. \<forall>y. (y, z) \<in> r \<longrightarrow> y \<notin> Q)" for Q |
353 |
by (auto simp: wf_eq_minimal) |
|
354 |
show ?lhs |
|
355 |
unfolding wf_eq_minimal |
|
356 |
proof clarify |
|
357 |
fix Q :: "'a set" and q |
|
358 |
assume "q \<in> Q" |
|
359 |
then obtain a where "a \<in> Q" and a: "\<And>y. (y, a) \<in> r \<Longrightarrow> y \<notin> Q" |
|
360 |
using R by (auto simp: wf_eq_minimal) |
|
361 |
show "\<exists>z\<in>Q. \<forall>y'. (y', z) \<in> insert (y, x) r \<longrightarrow> y' \<notin> Q" |
|
362 |
proof (cases "a=x") |
|
363 |
case True |
|
364 |
show ?thesis |
|
365 |
proof (cases "y \<in> Q") |
|
366 |
case True |
|
367 |
then obtain z where "z \<in> Q" "(z, y) \<in> r\<^sup>*" |
|
368 |
"\<And>z'. (z', z) \<in> r \<longrightarrow> z' \<in> Q \<longrightarrow> (z', y) \<notin> r\<^sup>*" |
|
369 |
using R' [of "{z \<in> Q. (z,y) \<in> r\<^sup>*}"] by auto |
|
75669
43f5dfb7fa35
tuned (some HOL lints, by Yecine Megdiche);
Fabian Huch <huch@in.tum.de>
parents:
74971
diff
changeset
|
370 |
then have "\<forall>y'. (y', z) \<in> insert (y, x) r \<longrightarrow> y' \<notin> Q" |
43f5dfb7fa35
tuned (some HOL lints, by Yecine Megdiche);
Fabian Huch <huch@in.tum.de>
parents:
74971
diff
changeset
|
371 |
using R by(blast intro: rtrancl_trans)+ |
43f5dfb7fa35
tuned (some HOL lints, by Yecine Megdiche);
Fabian Huch <huch@in.tum.de>
parents:
74971
diff
changeset
|
372 |
then show ?thesis |
43f5dfb7fa35
tuned (some HOL lints, by Yecine Megdiche);
Fabian Huch <huch@in.tum.de>
parents:
74971
diff
changeset
|
373 |
by (rule bexI) fact |
68646 | 374 |
next |
375 |
case False |
|
376 |
then show ?thesis |
|
377 |
using a \<open>a \<in> Q\<close> by blast |
|
378 |
qed |
|
379 |
next |
|
380 |
case False |
|
381 |
with a \<open>a \<in> Q\<close> show ?thesis |
|
382 |
by blast |
|
383 |
qed |
|
384 |
qed |
|
385 |
qed |
|
26748
4d51ddd6aa5c
Merged theories about wellfoundedness into one: Wellfounded.thy
krauss
parents:
diff
changeset
|
386 |
|
63108 | 387 |
|
388 |
subsubsection \<open>Well-foundedness of image\<close> |
|
33216 | 389 |
|
68259
80df7c90e315
By Andrei Popescu based on an initial version by Kasper F. Brandt
nipkow
parents:
67399
diff
changeset
|
390 |
lemma wf_map_prod_image_Dom_Ran: |
80df7c90e315
By Andrei Popescu based on an initial version by Kasper F. Brandt
nipkow
parents:
67399
diff
changeset
|
391 |
fixes r:: "('a \<times> 'a) set" |
80df7c90e315
By Andrei Popescu based on an initial version by Kasper F. Brandt
nipkow
parents:
67399
diff
changeset
|
392 |
and f:: "'a \<Rightarrow> 'b" |
80df7c90e315
By Andrei Popescu based on an initial version by Kasper F. Brandt
nipkow
parents:
67399
diff
changeset
|
393 |
assumes wf_r: "wf r" |
80df7c90e315
By Andrei Popescu based on an initial version by Kasper F. Brandt
nipkow
parents:
67399
diff
changeset
|
394 |
and inj: "\<And> a a'. a \<in> Domain r \<Longrightarrow> a' \<in> Range r \<Longrightarrow> f a = f a' \<Longrightarrow> a = a'" |
80df7c90e315
By Andrei Popescu based on an initial version by Kasper F. Brandt
nipkow
parents:
67399
diff
changeset
|
395 |
shows "wf (map_prod f f ` r)" |
80df7c90e315
By Andrei Popescu based on an initial version by Kasper F. Brandt
nipkow
parents:
67399
diff
changeset
|
396 |
proof (unfold wf_eq_minimal, clarify) |
68262 | 397 |
fix B :: "'b set" and b::"'b" |
398 |
assume "b \<in> B" |
|
399 |
define A where "A = f -` B \<inter> Domain r" |
|
400 |
show "\<exists>z\<in>B. \<forall>y. (y, z) \<in> map_prod f f ` r \<longrightarrow> y \<notin> B" |
|
401 |
proof (cases "A = {}") |
|
68259
80df7c90e315
By Andrei Popescu based on an initial version by Kasper F. Brandt
nipkow
parents:
67399
diff
changeset
|
402 |
case False |
68262 | 403 |
then obtain a0 where "a0 \<in> A" and "\<forall>a. (a, a0) \<in> r \<longrightarrow> a \<notin> A" |
68259
80df7c90e315
By Andrei Popescu based on an initial version by Kasper F. Brandt
nipkow
parents:
67399
diff
changeset
|
404 |
using wfE_min[OF wf_r] by auto |
71410 | 405 |
thus ?thesis |
68262 | 406 |
using inj unfolding A_def |
407 |
by (intro bexI[of _ "f a0"]) auto |
|
75669
43f5dfb7fa35
tuned (some HOL lints, by Yecine Megdiche);
Fabian Huch <huch@in.tum.de>
parents:
74971
diff
changeset
|
408 |
qed (use \<open>b \<in> B\<close> in \<open>unfold A_def, auto\<close>) |
68259
80df7c90e315
By Andrei Popescu based on an initial version by Kasper F. Brandt
nipkow
parents:
67399
diff
changeset
|
409 |
qed |
80df7c90e315
By Andrei Popescu based on an initial version by Kasper F. Brandt
nipkow
parents:
67399
diff
changeset
|
410 |
|
63108 | 411 |
lemma wf_map_prod_image: "wf r \<Longrightarrow> inj f \<Longrightarrow> wf (map_prod f f ` r)" |
68259
80df7c90e315
By Andrei Popescu based on an initial version by Kasper F. Brandt
nipkow
parents:
67399
diff
changeset
|
412 |
by(rule wf_map_prod_image_Dom_Ran) (auto dest: inj_onD) |
26748
4d51ddd6aa5c
Merged theories about wellfoundedness into one: Wellfounded.thy
krauss
parents:
diff
changeset
|
413 |
|
4d51ddd6aa5c
Merged theories about wellfoundedness into one: Wellfounded.thy
krauss
parents:
diff
changeset
|
414 |
|
60758 | 415 |
subsection \<open>Well-Foundedness Results for Unions\<close> |
26748
4d51ddd6aa5c
Merged theories about wellfoundedness into one: Wellfounded.thy
krauss
parents:
diff
changeset
|
416 |
|
4d51ddd6aa5c
Merged theories about wellfoundedness into one: Wellfounded.thy
krauss
parents:
diff
changeset
|
417 |
lemma wf_union_compatible: |
4d51ddd6aa5c
Merged theories about wellfoundedness into one: Wellfounded.thy
krauss
parents:
diff
changeset
|
418 |
assumes "wf R" "wf S" |
32235
8f9b8d14fc9f
"more standard" argument order of relation composition (op O)
krauss
parents:
32205
diff
changeset
|
419 |
assumes "R O S \<subseteq> R" |
26748
4d51ddd6aa5c
Merged theories about wellfoundedness into one: Wellfounded.thy
krauss
parents:
diff
changeset
|
420 |
shows "wf (R \<union> S)" |
4d51ddd6aa5c
Merged theories about wellfoundedness into one: Wellfounded.thy
krauss
parents:
diff
changeset
|
421 |
proof (rule wfI_min) |
63108 | 422 |
fix x :: 'a and Q |
26748
4d51ddd6aa5c
Merged theories about wellfoundedness into one: Wellfounded.thy
krauss
parents:
diff
changeset
|
423 |
let ?Q' = "{x \<in> Q. \<forall>y. (y, x) \<in> R \<longrightarrow> y \<notin> Q}" |
4d51ddd6aa5c
Merged theories about wellfoundedness into one: Wellfounded.thy
krauss
parents:
diff
changeset
|
424 |
assume "x \<in> Q" |
4d51ddd6aa5c
Merged theories about wellfoundedness into one: Wellfounded.thy
krauss
parents:
diff
changeset
|
425 |
obtain a where "a \<in> ?Q'" |
60758 | 426 |
by (rule wfE_min [OF \<open>wf R\<close> \<open>x \<in> Q\<close>]) blast |
63108 | 427 |
with \<open>wf S\<close> obtain z where "z \<in> ?Q'" and zmin: "\<And>y. (y, z) \<in> S \<Longrightarrow> y \<notin> ?Q'" |
428 |
by (erule wfE_min) |
|
63572 | 429 |
have "y \<notin> Q" if "(y, z) \<in> S" for y |
430 |
proof |
|
431 |
from that have "y \<notin> ?Q'" by (rule zmin) |
|
432 |
assume "y \<in> Q" |
|
433 |
with \<open>y \<notin> ?Q'\<close> obtain w where "(w, y) \<in> R" and "w \<in> Q" by auto |
|
434 |
from \<open>(w, y) \<in> R\<close> \<open>(y, z) \<in> S\<close> have "(w, z) \<in> R O S" by (rule relcompI) |
|
435 |
with \<open>R O S \<subseteq> R\<close> have "(w, z) \<in> R" .. |
|
436 |
with \<open>z \<in> ?Q'\<close> have "w \<notin> Q" by blast |
|
437 |
with \<open>w \<in> Q\<close> show False by contradiction |
|
438 |
qed |
|
60758 | 439 |
with \<open>z \<in> ?Q'\<close> show "\<exists>z\<in>Q. \<forall>y. (y, z) \<in> R \<union> S \<longrightarrow> y \<notin> Q" by blast |
26748
4d51ddd6aa5c
Merged theories about wellfoundedness into one: Wellfounded.thy
krauss
parents:
diff
changeset
|
440 |
qed |
4d51ddd6aa5c
Merged theories about wellfoundedness into one: Wellfounded.thy
krauss
parents:
diff
changeset
|
441 |
|
4d51ddd6aa5c
Merged theories about wellfoundedness into one: Wellfounded.thy
krauss
parents:
diff
changeset
|
442 |
|
63572 | 443 |
text \<open>Well-foundedness of indexed union with disjoint domains and ranges.\<close> |
26748
4d51ddd6aa5c
Merged theories about wellfoundedness into one: Wellfounded.thy
krauss
parents:
diff
changeset
|
444 |
|
63108 | 445 |
lemma wf_UN: |
68646 | 446 |
assumes r: "\<And>i. i \<in> I \<Longrightarrow> wf (r i)" |
447 |
and disj: "\<And>i j. \<lbrakk>i \<in> I; j \<in> I; r i \<noteq> r j\<rbrakk> \<Longrightarrow> Domain (r i) \<inter> Range (r j) = {}" |
|
63108 | 448 |
shows "wf (\<Union>i\<in>I. r i)" |
68646 | 449 |
unfolding wf_eq_minimal |
450 |
proof clarify |
|
451 |
fix A and a :: "'b" |
|
452 |
assume "a \<in> A" |
|
69275 | 453 |
show "\<exists>z\<in>A. \<forall>y. (y, z) \<in> \<Union>(r ` I) \<longrightarrow> y \<notin> A" |
68646 | 454 |
proof (cases "\<exists>i\<in>I. \<exists>a\<in>A. \<exists>b\<in>A. (b, a) \<in> r i") |
455 |
case True |
|
456 |
then obtain i b c where ibc: "i \<in> I" "b \<in> A" "c \<in> A" "(c,b) \<in> r i" |
|
457 |
by blast |
|
458 |
have ri: "\<And>Q. Q \<noteq> {} \<Longrightarrow> \<exists>z\<in>Q. \<forall>y. (y, z) \<in> r i \<longrightarrow> y \<notin> Q" |
|
459 |
using r [OF \<open>i \<in> I\<close>] unfolding wf_eq_minimal by auto |
|
460 |
show ?thesis |
|
71410 | 461 |
using ri [of "{a. a \<in> A \<and> (\<exists>b\<in>A. (b, a) \<in> r i) }"] ibc disj |
68646 | 462 |
by blast |
463 |
next |
|
464 |
case False |
|
465 |
with \<open>a \<in> A\<close> show ?thesis |
|
466 |
by blast |
|
467 |
qed |
|
468 |
qed |
|
26748
4d51ddd6aa5c
Merged theories about wellfoundedness into one: Wellfounded.thy
krauss
parents:
diff
changeset
|
469 |
|
32263 | 470 |
lemma wfP_SUP: |
64632 | 471 |
"\<forall>i. wfP (r i) \<Longrightarrow> \<forall>i j. r i \<noteq> r j \<longrightarrow> inf (Domainp (r i)) (Rangep (r j)) = bot \<Longrightarrow> |
69275 | 472 |
wfP (\<Squnion>(range r))" |
63572 | 473 |
by (rule wf_UN[to_pred]) simp_all |
26748
4d51ddd6aa5c
Merged theories about wellfoundedness into one: Wellfounded.thy
krauss
parents:
diff
changeset
|
474 |
|
63108 | 475 |
lemma wf_Union: |
476 |
assumes "\<forall>r\<in>R. wf r" |
|
477 |
and "\<forall>r\<in>R. \<forall>s\<in>R. r \<noteq> s \<longrightarrow> Domain r \<inter> Range s = {}" |
|
478 |
shows "wf (\<Union>R)" |
|
479 |
using assms wf_UN[of R "\<lambda>i. i"] by simp |
|
26748
4d51ddd6aa5c
Merged theories about wellfoundedness into one: Wellfounded.thy
krauss
parents:
diff
changeset
|
480 |
|
63109 | 481 |
text \<open> |
482 |
Intuition: We find an \<open>R \<union> S\<close>-min element of a nonempty subset \<open>A\<close> by case distinction. |
|
483 |
\<^enum> There is a step \<open>a \<midarrow>R\<rightarrow> b\<close> with \<open>a, b \<in> A\<close>. |
|
484 |
Pick an \<open>R\<close>-min element \<open>z\<close> of the (nonempty) set \<open>{a\<in>A | \<exists>b\<in>A. a \<midarrow>R\<rightarrow> b}\<close>. |
|
485 |
By definition, there is \<open>z' \<in> A\<close> s.t. \<open>z \<midarrow>R\<rightarrow> z'\<close>. Because \<open>z\<close> is \<open>R\<close>-min in the |
|
486 |
subset, \<open>z'\<close> must be \<open>R\<close>-min in \<open>A\<close>. Because \<open>z'\<close> has an \<open>R\<close>-predecessor, it cannot |
|
487 |
have an \<open>S\<close>-successor and is thus \<open>S\<close>-min in \<open>A\<close> as well. |
|
488 |
\<^enum> There is no such step. |
|
489 |
Pick an \<open>S\<close>-min element of \<open>A\<close>. In this case it must be an \<open>R\<close>-min |
|
490 |
element of \<open>A\<close> as well. |
|
491 |
\<close> |
|
63108 | 492 |
lemma wf_Un: "wf r \<Longrightarrow> wf s \<Longrightarrow> Domain r \<inter> Range s = {} \<Longrightarrow> wf (r \<union> s)" |
493 |
using wf_union_compatible[of s r] |
|
26748
4d51ddd6aa5c
Merged theories about wellfoundedness into one: Wellfounded.thy
krauss
parents:
diff
changeset
|
494 |
by (auto simp: Un_ac) |
4d51ddd6aa5c
Merged theories about wellfoundedness into one: Wellfounded.thy
krauss
parents:
diff
changeset
|
495 |
|
63108 | 496 |
lemma wf_union_merge: "wf (R \<union> S) = wf (R O R \<union> S O R \<union> S)" |
497 |
(is "wf ?A = wf ?B") |
|
26748
4d51ddd6aa5c
Merged theories about wellfoundedness into one: Wellfounded.thy
krauss
parents:
diff
changeset
|
498 |
proof |
4d51ddd6aa5c
Merged theories about wellfoundedness into one: Wellfounded.thy
krauss
parents:
diff
changeset
|
499 |
assume "wf ?A" |
63108 | 500 |
with wf_trancl have wfT: "wf (?A\<^sup>+)" . |
501 |
moreover have "?B \<subseteq> ?A\<^sup>+" |
|
26748
4d51ddd6aa5c
Merged theories about wellfoundedness into one: Wellfounded.thy
krauss
parents:
diff
changeset
|
502 |
by (subst trancl_unfold, subst trancl_unfold) blast |
4d51ddd6aa5c
Merged theories about wellfoundedness into one: Wellfounded.thy
krauss
parents:
diff
changeset
|
503 |
ultimately show "wf ?B" by (rule wf_subset) |
4d51ddd6aa5c
Merged theories about wellfoundedness into one: Wellfounded.thy
krauss
parents:
diff
changeset
|
504 |
next |
4d51ddd6aa5c
Merged theories about wellfoundedness into one: Wellfounded.thy
krauss
parents:
diff
changeset
|
505 |
assume "wf ?B" |
4d51ddd6aa5c
Merged theories about wellfoundedness into one: Wellfounded.thy
krauss
parents:
diff
changeset
|
506 |
show "wf ?A" |
4d51ddd6aa5c
Merged theories about wellfoundedness into one: Wellfounded.thy
krauss
parents:
diff
changeset
|
507 |
proof (rule wfI_min) |
63108 | 508 |
fix Q :: "'a set" and x |
26748
4d51ddd6aa5c
Merged theories about wellfoundedness into one: Wellfounded.thy
krauss
parents:
diff
changeset
|
509 |
assume "x \<in> Q" |
63109 | 510 |
with \<open>wf ?B\<close> obtain z where "z \<in> Q" and "\<And>y. (y, z) \<in> ?B \<Longrightarrow> y \<notin> Q" |
26748
4d51ddd6aa5c
Merged theories about wellfoundedness into one: Wellfounded.thy
krauss
parents:
diff
changeset
|
511 |
by (erule wfE_min) |
63109 | 512 |
then have 1: "\<And>y. (y, z) \<in> R O R \<Longrightarrow> y \<notin> Q" |
513 |
and 2: "\<And>y. (y, z) \<in> S O R \<Longrightarrow> y \<notin> Q" |
|
514 |
and 3: "\<And>y. (y, z) \<in> S \<Longrightarrow> y \<notin> Q" |
|
26748
4d51ddd6aa5c
Merged theories about wellfoundedness into one: Wellfounded.thy
krauss
parents:
diff
changeset
|
515 |
by auto |
4d51ddd6aa5c
Merged theories about wellfoundedness into one: Wellfounded.thy
krauss
parents:
diff
changeset
|
516 |
show "\<exists>z\<in>Q. \<forall>y. (y, z) \<in> ?A \<longrightarrow> y \<notin> Q" |
4d51ddd6aa5c
Merged theories about wellfoundedness into one: Wellfounded.thy
krauss
parents:
diff
changeset
|
517 |
proof (cases "\<forall>y. (y, z) \<in> R \<longrightarrow> y \<notin> Q") |
4d51ddd6aa5c
Merged theories about wellfoundedness into one: Wellfounded.thy
krauss
parents:
diff
changeset
|
518 |
case True |
63109 | 519 |
with \<open>z \<in> Q\<close> 3 show ?thesis by blast |
26748
4d51ddd6aa5c
Merged theories about wellfoundedness into one: Wellfounded.thy
krauss
parents:
diff
changeset
|
520 |
next |
63108 | 521 |
case False |
26748
4d51ddd6aa5c
Merged theories about wellfoundedness into one: Wellfounded.thy
krauss
parents:
diff
changeset
|
522 |
then obtain z' where "z'\<in>Q" "(z', z) \<in> R" by blast |
4d51ddd6aa5c
Merged theories about wellfoundedness into one: Wellfounded.thy
krauss
parents:
diff
changeset
|
523 |
have "\<forall>y. (y, z') \<in> ?A \<longrightarrow> y \<notin> Q" |
4d51ddd6aa5c
Merged theories about wellfoundedness into one: Wellfounded.thy
krauss
parents:
diff
changeset
|
524 |
proof (intro allI impI) |
4d51ddd6aa5c
Merged theories about wellfoundedness into one: Wellfounded.thy
krauss
parents:
diff
changeset
|
525 |
fix y assume "(y, z') \<in> ?A" |
4d51ddd6aa5c
Merged theories about wellfoundedness into one: Wellfounded.thy
krauss
parents:
diff
changeset
|
526 |
then show "y \<notin> Q" |
4d51ddd6aa5c
Merged theories about wellfoundedness into one: Wellfounded.thy
krauss
parents:
diff
changeset
|
527 |
proof |
63108 | 528 |
assume "(y, z') \<in> R" |
60758 | 529 |
then have "(y, z) \<in> R O R" using \<open>(z', z) \<in> R\<close> .. |
63109 | 530 |
with 1 show "y \<notin> Q" . |
26748
4d51ddd6aa5c
Merged theories about wellfoundedness into one: Wellfounded.thy
krauss
parents:
diff
changeset
|
531 |
next |
63108 | 532 |
assume "(y, z') \<in> S" |
60758 | 533 |
then have "(y, z) \<in> S O R" using \<open>(z', z) \<in> R\<close> .. |
63109 | 534 |
with 2 show "y \<notin> Q" . |
26748
4d51ddd6aa5c
Merged theories about wellfoundedness into one: Wellfounded.thy
krauss
parents:
diff
changeset
|
535 |
qed |
4d51ddd6aa5c
Merged theories about wellfoundedness into one: Wellfounded.thy
krauss
parents:
diff
changeset
|
536 |
qed |
60758 | 537 |
with \<open>z' \<in> Q\<close> show ?thesis .. |
26748
4d51ddd6aa5c
Merged theories about wellfoundedness into one: Wellfounded.thy
krauss
parents:
diff
changeset
|
538 |
qed |
4d51ddd6aa5c
Merged theories about wellfoundedness into one: Wellfounded.thy
krauss
parents:
diff
changeset
|
539 |
qed |
4d51ddd6aa5c
Merged theories about wellfoundedness into one: Wellfounded.thy
krauss
parents:
diff
changeset
|
540 |
qed |
4d51ddd6aa5c
Merged theories about wellfoundedness into one: Wellfounded.thy
krauss
parents:
diff
changeset
|
541 |
|
63612 | 542 |
lemma wf_comp_self: "wf R \<longleftrightarrow> wf (R O R)" \<comment> \<open>special case\<close> |
26748
4d51ddd6aa5c
Merged theories about wellfoundedness into one: Wellfounded.thy
krauss
parents:
diff
changeset
|
543 |
by (rule wf_union_merge [where S = "{}", simplified]) |
4d51ddd6aa5c
Merged theories about wellfoundedness into one: Wellfounded.thy
krauss
parents:
diff
changeset
|
544 |
|
4d51ddd6aa5c
Merged theories about wellfoundedness into one: Wellfounded.thy
krauss
parents:
diff
changeset
|
545 |
|
60758 | 546 |
subsection \<open>Well-Foundedness of Composition\<close> |
60148 | 547 |
|
60493
866f41a869e6
New WF theorem by Tjark Weber. Replaced the proof of the subsequent theorem.
paulson <lp15@cam.ac.uk>
parents:
60148
diff
changeset
|
548 |
text \<open>Bachmair and Dershowitz 1986, Lemma 2. [Provided by Tjark Weber]\<close> |
60148 | 549 |
|
60493
866f41a869e6
New WF theorem by Tjark Weber. Replaced the proof of the subsequent theorem.
paulson <lp15@cam.ac.uk>
parents:
60148
diff
changeset
|
550 |
lemma qc_wf_relto_iff: |
61799 | 551 |
assumes "R O S \<subseteq> (R \<union> S)\<^sup>* O R" \<comment> \<open>R quasi-commutes over S\<close> |
63109 | 552 |
shows "wf (S\<^sup>* O R O S\<^sup>*) \<longleftrightarrow> wf R" |
63612 | 553 |
(is "wf ?S \<longleftrightarrow> _") |
60493
866f41a869e6
New WF theorem by Tjark Weber. Replaced the proof of the subsequent theorem.
paulson <lp15@cam.ac.uk>
parents:
60148
diff
changeset
|
554 |
proof |
63109 | 555 |
show "wf R" if "wf ?S" |
556 |
proof - |
|
557 |
have "R \<subseteq> ?S" by auto |
|
63612 | 558 |
with wf_subset [of ?S] that show "wf R" |
559 |
by auto |
|
63109 | 560 |
qed |
60493
866f41a869e6
New WF theorem by Tjark Weber. Replaced the proof of the subsequent theorem.
paulson <lp15@cam.ac.uk>
parents:
60148
diff
changeset
|
561 |
next |
63109 | 562 |
show "wf ?S" if "wf R" |
60493
866f41a869e6
New WF theorem by Tjark Weber. Replaced the proof of the subsequent theorem.
paulson <lp15@cam.ac.uk>
parents:
60148
diff
changeset
|
563 |
proof (rule wfI_pf) |
63109 | 564 |
fix A |
565 |
assume A: "A \<subseteq> ?S `` A" |
|
60493
866f41a869e6
New WF theorem by Tjark Weber. Replaced the proof of the subsequent theorem.
paulson <lp15@cam.ac.uk>
parents:
60148
diff
changeset
|
566 |
let ?X = "(R \<union> S)\<^sup>* `` A" |
866f41a869e6
New WF theorem by Tjark Weber. Replaced the proof of the subsequent theorem.
paulson <lp15@cam.ac.uk>
parents:
60148
diff
changeset
|
567 |
have *: "R O (R \<union> S)\<^sup>* \<subseteq> (R \<union> S)\<^sup>* O R" |
63109 | 568 |
proof - |
569 |
have "(x, z) \<in> (R \<union> S)\<^sup>* O R" if "(y, z) \<in> (R \<union> S)\<^sup>*" and "(x, y) \<in> R" for x y z |
|
570 |
using that |
|
571 |
proof (induct y z) |
|
572 |
case rtrancl_refl |
|
573 |
then show ?case by auto |
|
574 |
next |
|
575 |
case (rtrancl_into_rtrancl a b c) |
|
576 |
then have "(x, c) \<in> ((R \<union> S)\<^sup>* O (R \<union> S)\<^sup>*) O R" |
|
577 |
using assms by blast |
|
578 |
then show ?case by simp |
|
60493
866f41a869e6
New WF theorem by Tjark Weber. Replaced the proof of the subsequent theorem.
paulson <lp15@cam.ac.uk>
parents:
60148
diff
changeset
|
579 |
qed |
63109 | 580 |
then show ?thesis by auto |
581 |
qed |
|
582 |
then have "R O S\<^sup>* \<subseteq> (R \<union> S)\<^sup>* O R" |
|
583 |
using rtrancl_Un_subset by blast |
|
584 |
then have "?S \<subseteq> (R \<union> S)\<^sup>* O (R \<union> S)\<^sup>* O R" |
|
585 |
by (simp add: relcomp_mono rtrancl_mono) |
|
586 |
also have "\<dots> = (R \<union> S)\<^sup>* O R" |
|
587 |
by (simp add: O_assoc[symmetric]) |
|
588 |
finally have "?S O (R \<union> S)\<^sup>* \<subseteq> (R \<union> S)\<^sup>* O R O (R \<union> S)\<^sup>*" |
|
589 |
by (simp add: O_assoc[symmetric] relcomp_mono) |
|
590 |
also have "\<dots> \<subseteq> (R \<union> S)\<^sup>* O (R \<union> S)\<^sup>* O R" |
|
591 |
using * by (simp add: relcomp_mono) |
|
592 |
finally have "?S O (R \<union> S)\<^sup>* \<subseteq> (R \<union> S)\<^sup>* O R" |
|
593 |
by (simp add: O_assoc[symmetric]) |
|
594 |
then have "(?S O (R \<union> S)\<^sup>*) `` A \<subseteq> ((R \<union> S)\<^sup>* O R) `` A" |
|
595 |
by (simp add: Image_mono) |
|
596 |
moreover have "?X \<subseteq> (?S O (R \<union> S)\<^sup>*) `` A" |
|
597 |
using A by (auto simp: relcomp_Image) |
|
598 |
ultimately have "?X \<subseteq> R `` ?X" |
|
599 |
by (auto simp: relcomp_Image) |
|
600 |
then have "?X = {}" |
|
601 |
using \<open>wf R\<close> by (simp add: wfE_pf) |
|
60493
866f41a869e6
New WF theorem by Tjark Weber. Replaced the proof of the subsequent theorem.
paulson <lp15@cam.ac.uk>
parents:
60148
diff
changeset
|
602 |
moreover have "A \<subseteq> ?X" by auto |
866f41a869e6
New WF theorem by Tjark Weber. Replaced the proof of the subsequent theorem.
paulson <lp15@cam.ac.uk>
parents:
60148
diff
changeset
|
603 |
ultimately show "A = {}" by simp |
866f41a869e6
New WF theorem by Tjark Weber. Replaced the proof of the subsequent theorem.
paulson <lp15@cam.ac.uk>
parents:
60148
diff
changeset
|
604 |
qed |
866f41a869e6
New WF theorem by Tjark Weber. Replaced the proof of the subsequent theorem.
paulson <lp15@cam.ac.uk>
parents:
60148
diff
changeset
|
605 |
qed |
866f41a869e6
New WF theorem by Tjark Weber. Replaced the proof of the subsequent theorem.
paulson <lp15@cam.ac.uk>
parents:
60148
diff
changeset
|
606 |
|
866f41a869e6
New WF theorem by Tjark Weber. Replaced the proof of the subsequent theorem.
paulson <lp15@cam.ac.uk>
parents:
60148
diff
changeset
|
607 |
corollary wf_relcomp_compatible: |
60148 | 608 |
assumes "wf R" and "R O S \<subseteq> S O R" |
609 |
shows "wf (S O R)" |
|
60493
866f41a869e6
New WF theorem by Tjark Weber. Replaced the proof of the subsequent theorem.
paulson <lp15@cam.ac.uk>
parents:
60148
diff
changeset
|
610 |
proof - |
866f41a869e6
New WF theorem by Tjark Weber. Replaced the proof of the subsequent theorem.
paulson <lp15@cam.ac.uk>
parents:
60148
diff
changeset
|
611 |
have "R O S \<subseteq> (R \<union> S)\<^sup>* O R" |
866f41a869e6
New WF theorem by Tjark Weber. Replaced the proof of the subsequent theorem.
paulson <lp15@cam.ac.uk>
parents:
60148
diff
changeset
|
612 |
using assms by blast |
866f41a869e6
New WF theorem by Tjark Weber. Replaced the proof of the subsequent theorem.
paulson <lp15@cam.ac.uk>
parents:
60148
diff
changeset
|
613 |
then have "wf (S\<^sup>* O R O S\<^sup>*)" |
866f41a869e6
New WF theorem by Tjark Weber. Replaced the proof of the subsequent theorem.
paulson <lp15@cam.ac.uk>
parents:
60148
diff
changeset
|
614 |
by (simp add: assms qc_wf_relto_iff) |
866f41a869e6
New WF theorem by Tjark Weber. Replaced the proof of the subsequent theorem.
paulson <lp15@cam.ac.uk>
parents:
60148
diff
changeset
|
615 |
then show ?thesis |
866f41a869e6
New WF theorem by Tjark Weber. Replaced the proof of the subsequent theorem.
paulson <lp15@cam.ac.uk>
parents:
60148
diff
changeset
|
616 |
by (rule Wellfounded.wf_subset) blast |
60148 | 617 |
qed |
618 |
||
619 |
||
60758 | 620 |
subsection \<open>Acyclic relations\<close> |
33217 | 621 |
|
63108 | 622 |
lemma wf_acyclic: "wf r \<Longrightarrow> acyclic r" |
63572 | 623 |
by (simp add: acyclic_def) (blast elim: wf_trancl [THEN wf_irrefl]) |
26748
4d51ddd6aa5c
Merged theories about wellfoundedness into one: Wellfounded.thy
krauss
parents:
diff
changeset
|
624 |
|
4d51ddd6aa5c
Merged theories about wellfoundedness into one: Wellfounded.thy
krauss
parents:
diff
changeset
|
625 |
lemmas wfP_acyclicP = wf_acyclic [to_pred] |
4d51ddd6aa5c
Merged theories about wellfoundedness into one: Wellfounded.thy
krauss
parents:
diff
changeset
|
626 |
|
63108 | 627 |
|
628 |
subsubsection \<open>Wellfoundedness of finite acyclic relations\<close> |
|
26748
4d51ddd6aa5c
Merged theories about wellfoundedness into one: Wellfounded.thy
krauss
parents:
diff
changeset
|
629 |
|
68646 | 630 |
lemma finite_acyclic_wf: |
631 |
assumes "finite r" "acyclic r" shows "wf r" |
|
632 |
using assms |
|
633 |
proof (induction r rule: finite_induct) |
|
634 |
case (insert x r) |
|
635 |
then show ?case |
|
636 |
by (cases x) simp |
|
637 |
qed simp |
|
26748
4d51ddd6aa5c
Merged theories about wellfoundedness into one: Wellfounded.thy
krauss
parents:
diff
changeset
|
638 |
|
63108 | 639 |
lemma finite_acyclic_wf_converse: "finite r \<Longrightarrow> acyclic r \<Longrightarrow> wf (r\<inverse>)" |
63572 | 640 |
apply (erule finite_converse [THEN iffD2, THEN finite_acyclic_wf]) |
641 |
apply (erule acyclic_converse [THEN iffD2]) |
|
642 |
done |
|
26748
4d51ddd6aa5c
Merged theories about wellfoundedness into one: Wellfounded.thy
krauss
parents:
diff
changeset
|
643 |
|
63088
f2177f5d2aed
a quasi-recursive characterization of the multiset order (by Christian Sternagel)
haftmann
parents:
61952
diff
changeset
|
644 |
text \<open> |
f2177f5d2aed
a quasi-recursive characterization of the multiset order (by Christian Sternagel)
haftmann
parents:
61952
diff
changeset
|
645 |
Observe that the converse of an irreflexive, transitive, |
f2177f5d2aed
a quasi-recursive characterization of the multiset order (by Christian Sternagel)
haftmann
parents:
61952
diff
changeset
|
646 |
and finite relation is again well-founded. Thus, we may |
f2177f5d2aed
a quasi-recursive characterization of the multiset order (by Christian Sternagel)
haftmann
parents:
61952
diff
changeset
|
647 |
employ it for well-founded induction. |
f2177f5d2aed
a quasi-recursive characterization of the multiset order (by Christian Sternagel)
haftmann
parents:
61952
diff
changeset
|
648 |
\<close> |
f2177f5d2aed
a quasi-recursive characterization of the multiset order (by Christian Sternagel)
haftmann
parents:
61952
diff
changeset
|
649 |
lemma wf_converse: |
f2177f5d2aed
a quasi-recursive characterization of the multiset order (by Christian Sternagel)
haftmann
parents:
61952
diff
changeset
|
650 |
assumes "irrefl r" and "trans r" and "finite r" |
f2177f5d2aed
a quasi-recursive characterization of the multiset order (by Christian Sternagel)
haftmann
parents:
61952
diff
changeset
|
651 |
shows "wf (r\<inverse>)" |
f2177f5d2aed
a quasi-recursive characterization of the multiset order (by Christian Sternagel)
haftmann
parents:
61952
diff
changeset
|
652 |
proof - |
f2177f5d2aed
a quasi-recursive characterization of the multiset order (by Christian Sternagel)
haftmann
parents:
61952
diff
changeset
|
653 |
have "acyclic r" |
63572 | 654 |
using \<open>irrefl r\<close> and \<open>trans r\<close> |
655 |
by (simp add: irrefl_def acyclic_irrefl) |
|
656 |
with \<open>finite r\<close> show ?thesis |
|
657 |
by (rule finite_acyclic_wf_converse) |
|
63088
f2177f5d2aed
a quasi-recursive characterization of the multiset order (by Christian Sternagel)
haftmann
parents:
61952
diff
changeset
|
658 |
qed |
f2177f5d2aed
a quasi-recursive characterization of the multiset order (by Christian Sternagel)
haftmann
parents:
61952
diff
changeset
|
659 |
|
63108 | 660 |
lemma wf_iff_acyclic_if_finite: "finite r \<Longrightarrow> wf r = acyclic r" |
63572 | 661 |
by (blast intro: finite_acyclic_wf wf_acyclic) |
26748
4d51ddd6aa5c
Merged theories about wellfoundedness into one: Wellfounded.thy
krauss
parents:
diff
changeset
|
662 |
|
4d51ddd6aa5c
Merged theories about wellfoundedness into one: Wellfounded.thy
krauss
parents:
diff
changeset
|
663 |
|
69593 | 664 |
subsection \<open>\<^typ>\<open>nat\<close> is well-founded\<close> |
26748
4d51ddd6aa5c
Merged theories about wellfoundedness into one: Wellfounded.thy
krauss
parents:
diff
changeset
|
665 |
|
67399 | 666 |
lemma less_nat_rel: "(<) = (\<lambda>m n. n = Suc m)\<^sup>+\<^sup>+" |
26748
4d51ddd6aa5c
Merged theories about wellfoundedness into one: Wellfounded.thy
krauss
parents:
diff
changeset
|
667 |
proof (rule ext, rule ext, rule iffI) |
4d51ddd6aa5c
Merged theories about wellfoundedness into one: Wellfounded.thy
krauss
parents:
diff
changeset
|
668 |
fix n m :: nat |
63108 | 669 |
show "(\<lambda>m n. n = Suc m)\<^sup>+\<^sup>+ m n" if "m < n" |
670 |
using that |
|
26748
4d51ddd6aa5c
Merged theories about wellfoundedness into one: Wellfounded.thy
krauss
parents:
diff
changeset
|
671 |
proof (induct n) |
63108 | 672 |
case 0 |
673 |
then show ?case by auto |
|
26748
4d51ddd6aa5c
Merged theories about wellfoundedness into one: Wellfounded.thy
krauss
parents:
diff
changeset
|
674 |
next |
63108 | 675 |
case (Suc n) |
676 |
then show ?case |
|
26748
4d51ddd6aa5c
Merged theories about wellfoundedness into one: Wellfounded.thy
krauss
parents:
diff
changeset
|
677 |
by (auto simp add: less_Suc_eq_le le_less intro: tranclp.trancl_into_trancl) |
4d51ddd6aa5c
Merged theories about wellfoundedness into one: Wellfounded.thy
krauss
parents:
diff
changeset
|
678 |
qed |
63108 | 679 |
show "m < n" if "(\<lambda>m n. n = Suc m)\<^sup>+\<^sup>+ m n" |
680 |
using that by (induct n) (simp_all add: less_Suc_eq_le reflexive le_less) |
|
26748
4d51ddd6aa5c
Merged theories about wellfoundedness into one: Wellfounded.thy
krauss
parents:
diff
changeset
|
681 |
qed |
4d51ddd6aa5c
Merged theories about wellfoundedness into one: Wellfounded.thy
krauss
parents:
diff
changeset
|
682 |
|
63108 | 683 |
definition pred_nat :: "(nat \<times> nat) set" |
684 |
where "pred_nat = {(m, n). n = Suc m}" |
|
26748
4d51ddd6aa5c
Merged theories about wellfoundedness into one: Wellfounded.thy
krauss
parents:
diff
changeset
|
685 |
|
63108 | 686 |
definition less_than :: "(nat \<times> nat) set" |
687 |
where "less_than = pred_nat\<^sup>+" |
|
26748
4d51ddd6aa5c
Merged theories about wellfoundedness into one: Wellfounded.thy
krauss
parents:
diff
changeset
|
688 |
|
63108 | 689 |
lemma less_eq: "(m, n) \<in> pred_nat\<^sup>+ \<longleftrightarrow> m < n" |
26748
4d51ddd6aa5c
Merged theories about wellfoundedness into one: Wellfounded.thy
krauss
parents:
diff
changeset
|
690 |
unfolding less_nat_rel pred_nat_def trancl_def by simp |
4d51ddd6aa5c
Merged theories about wellfoundedness into one: Wellfounded.thy
krauss
parents:
diff
changeset
|
691 |
|
63108 | 692 |
lemma pred_nat_trancl_eq_le: "(m, n) \<in> pred_nat\<^sup>* \<longleftrightarrow> m \<le> n" |
26748
4d51ddd6aa5c
Merged theories about wellfoundedness into one: Wellfounded.thy
krauss
parents:
diff
changeset
|
693 |
unfolding less_eq rtrancl_eq_or_trancl by auto |
4d51ddd6aa5c
Merged theories about wellfoundedness into one: Wellfounded.thy
krauss
parents:
diff
changeset
|
694 |
|
4d51ddd6aa5c
Merged theories about wellfoundedness into one: Wellfounded.thy
krauss
parents:
diff
changeset
|
695 |
lemma wf_pred_nat: "wf pred_nat" |
75669
43f5dfb7fa35
tuned (some HOL lints, by Yecine Megdiche);
Fabian Huch <huch@in.tum.de>
parents:
74971
diff
changeset
|
696 |
unfolding wf_def |
43f5dfb7fa35
tuned (some HOL lints, by Yecine Megdiche);
Fabian Huch <huch@in.tum.de>
parents:
74971
diff
changeset
|
697 |
proof clarify |
43f5dfb7fa35
tuned (some HOL lints, by Yecine Megdiche);
Fabian Huch <huch@in.tum.de>
parents:
74971
diff
changeset
|
698 |
fix P x |
43f5dfb7fa35
tuned (some HOL lints, by Yecine Megdiche);
Fabian Huch <huch@in.tum.de>
parents:
74971
diff
changeset
|
699 |
assume "\<forall>x'. (\<forall>y. (y, x') \<in> pred_nat \<longrightarrow> P y) \<longrightarrow> P x'" |
43f5dfb7fa35
tuned (some HOL lints, by Yecine Megdiche);
Fabian Huch <huch@in.tum.de>
parents:
74971
diff
changeset
|
700 |
then show "P x" |
43f5dfb7fa35
tuned (some HOL lints, by Yecine Megdiche);
Fabian Huch <huch@in.tum.de>
parents:
74971
diff
changeset
|
701 |
unfolding pred_nat_def by (induction x) blast+ |
43f5dfb7fa35
tuned (some HOL lints, by Yecine Megdiche);
Fabian Huch <huch@in.tum.de>
parents:
74971
diff
changeset
|
702 |
qed |
26748
4d51ddd6aa5c
Merged theories about wellfoundedness into one: Wellfounded.thy
krauss
parents:
diff
changeset
|
703 |
|
4d51ddd6aa5c
Merged theories about wellfoundedness into one: Wellfounded.thy
krauss
parents:
diff
changeset
|
704 |
lemma wf_less_than [iff]: "wf less_than" |
4d51ddd6aa5c
Merged theories about wellfoundedness into one: Wellfounded.thy
krauss
parents:
diff
changeset
|
705 |
by (simp add: less_than_def wf_pred_nat [THEN wf_trancl]) |
4d51ddd6aa5c
Merged theories about wellfoundedness into one: Wellfounded.thy
krauss
parents:
diff
changeset
|
706 |
|
4d51ddd6aa5c
Merged theories about wellfoundedness into one: Wellfounded.thy
krauss
parents:
diff
changeset
|
707 |
lemma trans_less_than [iff]: "trans less_than" |
35216 | 708 |
by (simp add: less_than_def) |
26748
4d51ddd6aa5c
Merged theories about wellfoundedness into one: Wellfounded.thy
krauss
parents:
diff
changeset
|
709 |
|
63108 | 710 |
lemma less_than_iff [iff]: "((x,y) \<in> less_than) = (x<y)" |
26748
4d51ddd6aa5c
Merged theories about wellfoundedness into one: Wellfounded.thy
krauss
parents:
diff
changeset
|
711 |
by (simp add: less_than_def less_eq) |
4d51ddd6aa5c
Merged theories about wellfoundedness into one: Wellfounded.thy
krauss
parents:
diff
changeset
|
712 |
|
71827 | 713 |
lemma irrefl_less_than: "irrefl less_than" |
714 |
using irrefl_def by blast |
|
715 |
||
71935
82b00b8f1871
fixed the utterly weird definitions of asym / asymp, and added many asym lemmas
paulson <lp15@cam.ac.uk>
parents:
71827
diff
changeset
|
716 |
lemma asym_less_than: "asym less_than" |
76682
e260dabc88e6
added predicates asym_on and asymp_on and redefined asym and asymp to be abbreviations
desharna
parents:
76588
diff
changeset
|
717 |
by (rule asymI) simp |
71935
82b00b8f1871
fixed the utterly weird definitions of asym / asymp, and added many asym lemmas
paulson <lp15@cam.ac.uk>
parents:
71827
diff
changeset
|
718 |
|
71766
1249b998e377
New theory Library/List_Lenlexorder.thy, a type class instantiation for well-ordering lists
paulson <lp15@cam.ac.uk>
parents:
71544
diff
changeset
|
719 |
lemma total_less_than: "total less_than" and total_on_less_than [simp]: "total_on A less_than" |
1249b998e377
New theory Library/List_Lenlexorder.thy, a type class instantiation for well-ordering lists
paulson <lp15@cam.ac.uk>
parents:
71544
diff
changeset
|
720 |
using total_on_def by force+ |
71404
f2b783abfbe7
A few lemmas connected with orderings
paulson <lp15@cam.ac.uk>
parents:
69593
diff
changeset
|
721 |
|
26748
4d51ddd6aa5c
Merged theories about wellfoundedness into one: Wellfounded.thy
krauss
parents:
diff
changeset
|
722 |
lemma wf_less: "wf {(x, y::nat). x < y}" |
60493
866f41a869e6
New WF theorem by Tjark Weber. Replaced the proof of the subsequent theorem.
paulson <lp15@cam.ac.uk>
parents:
60148
diff
changeset
|
723 |
by (rule Wellfounded.wellorder_class.wf) |
26748
4d51ddd6aa5c
Merged theories about wellfoundedness into one: Wellfounded.thy
krauss
parents:
diff
changeset
|
724 |
|
4d51ddd6aa5c
Merged theories about wellfoundedness into one: Wellfounded.thy
krauss
parents:
diff
changeset
|
725 |
|
60758 | 726 |
subsection \<open>Accessible Part\<close> |
26748
4d51ddd6aa5c
Merged theories about wellfoundedness into one: Wellfounded.thy
krauss
parents:
diff
changeset
|
727 |
|
60758 | 728 |
text \<open> |
63108 | 729 |
Inductive definition of the accessible part \<open>acc r\<close> of a |
77172 | 730 |
relation; see also \<^cite>\<open>"paulin-tlca"\<close>. |
60758 | 731 |
\<close> |
26748
4d51ddd6aa5c
Merged theories about wellfoundedness into one: Wellfounded.thy
krauss
parents:
diff
changeset
|
732 |
|
63108 | 733 |
inductive_set acc :: "('a \<times> 'a) set \<Rightarrow> 'a set" for r :: "('a \<times> 'a) set" |
734 |
where accI: "(\<And>y. (y, x) \<in> r \<Longrightarrow> y \<in> acc r) \<Longrightarrow> x \<in> acc r" |
|
26748
4d51ddd6aa5c
Merged theories about wellfoundedness into one: Wellfounded.thy
krauss
parents:
diff
changeset
|
735 |
|
63108 | 736 |
abbreviation termip :: "('a \<Rightarrow> 'a \<Rightarrow> bool) \<Rightarrow> 'a \<Rightarrow> bool" |
737 |
where "termip r \<equiv> accp (r\<inverse>\<inverse>)" |
|
26748
4d51ddd6aa5c
Merged theories about wellfoundedness into one: Wellfounded.thy
krauss
parents:
diff
changeset
|
738 |
|
63108 | 739 |
abbreviation termi :: "('a \<times> 'a) set \<Rightarrow> 'a set" |
740 |
where "termi r \<equiv> acc (r\<inverse>)" |
|
26748
4d51ddd6aa5c
Merged theories about wellfoundedness into one: Wellfounded.thy
krauss
parents:
diff
changeset
|
741 |
|
4d51ddd6aa5c
Merged theories about wellfoundedness into one: Wellfounded.thy
krauss
parents:
diff
changeset
|
742 |
lemmas accpI = accp.accI |
4d51ddd6aa5c
Merged theories about wellfoundedness into one: Wellfounded.thy
krauss
parents:
diff
changeset
|
743 |
|
63108 | 744 |
lemma accp_eq_acc [code]: "accp r = (\<lambda>x. x \<in> Wellfounded.acc {(x, y). r x y})" |
54295 | 745 |
by (simp add: acc_def) |
746 |
||
747 |
||
60758 | 748 |
text \<open>Induction rules\<close> |
26748
4d51ddd6aa5c
Merged theories about wellfoundedness into one: Wellfounded.thy
krauss
parents:
diff
changeset
|
749 |
|
4d51ddd6aa5c
Merged theories about wellfoundedness into one: Wellfounded.thy
krauss
parents:
diff
changeset
|
750 |
theorem accp_induct: |
4d51ddd6aa5c
Merged theories about wellfoundedness into one: Wellfounded.thy
krauss
parents:
diff
changeset
|
751 |
assumes major: "accp r a" |
63108 | 752 |
assumes hyp: "\<And>x. accp r x \<Longrightarrow> \<forall>y. r y x \<longrightarrow> P y \<Longrightarrow> P x" |
26748
4d51ddd6aa5c
Merged theories about wellfoundedness into one: Wellfounded.thy
krauss
parents:
diff
changeset
|
753 |
shows "P a" |
4d51ddd6aa5c
Merged theories about wellfoundedness into one: Wellfounded.thy
krauss
parents:
diff
changeset
|
754 |
apply (rule major [THEN accp.induct]) |
4d51ddd6aa5c
Merged theories about wellfoundedness into one: Wellfounded.thy
krauss
parents:
diff
changeset
|
755 |
apply (rule hyp) |
4d51ddd6aa5c
Merged theories about wellfoundedness into one: Wellfounded.thy
krauss
parents:
diff
changeset
|
756 |
apply (rule accp.accI) |
68646 | 757 |
apply auto |
26748
4d51ddd6aa5c
Merged theories about wellfoundedness into one: Wellfounded.thy
krauss
parents:
diff
changeset
|
758 |
done |
4d51ddd6aa5c
Merged theories about wellfoundedness into one: Wellfounded.thy
krauss
parents:
diff
changeset
|
759 |
|
61337 | 760 |
lemmas accp_induct_rule = accp_induct [rule_format, induct set: accp] |
26748
4d51ddd6aa5c
Merged theories about wellfoundedness into one: Wellfounded.thy
krauss
parents:
diff
changeset
|
761 |
|
63108 | 762 |
theorem accp_downward: "accp r b \<Longrightarrow> r a b \<Longrightarrow> accp r a" |
63572 | 763 |
by (cases rule: accp.cases) |
26748
4d51ddd6aa5c
Merged theories about wellfoundedness into one: Wellfounded.thy
krauss
parents:
diff
changeset
|
764 |
|
4d51ddd6aa5c
Merged theories about wellfoundedness into one: Wellfounded.thy
krauss
parents:
diff
changeset
|
765 |
lemma not_accp_down: |
4d51ddd6aa5c
Merged theories about wellfoundedness into one: Wellfounded.thy
krauss
parents:
diff
changeset
|
766 |
assumes na: "\<not> accp R x" |
4d51ddd6aa5c
Merged theories about wellfoundedness into one: Wellfounded.thy
krauss
parents:
diff
changeset
|
767 |
obtains z where "R z x" and "\<not> accp R z" |
4d51ddd6aa5c
Merged theories about wellfoundedness into one: Wellfounded.thy
krauss
parents:
diff
changeset
|
768 |
proof - |
63572 | 769 |
assume a: "\<And>z. R z x \<Longrightarrow> \<not> accp R z \<Longrightarrow> thesis" |
26748
4d51ddd6aa5c
Merged theories about wellfoundedness into one: Wellfounded.thy
krauss
parents:
diff
changeset
|
770 |
show thesis |
4d51ddd6aa5c
Merged theories about wellfoundedness into one: Wellfounded.thy
krauss
parents:
diff
changeset
|
771 |
proof (cases "\<forall>z. R z x \<longrightarrow> accp R z") |
4d51ddd6aa5c
Merged theories about wellfoundedness into one: Wellfounded.thy
krauss
parents:
diff
changeset
|
772 |
case True |
63108 | 773 |
then have "\<And>z. R z x \<Longrightarrow> accp R z" by auto |
774 |
then have "accp R x" by (rule accp.accI) |
|
26748
4d51ddd6aa5c
Merged theories about wellfoundedness into one: Wellfounded.thy
krauss
parents:
diff
changeset
|
775 |
with na show thesis .. |
4d51ddd6aa5c
Merged theories about wellfoundedness into one: Wellfounded.thy
krauss
parents:
diff
changeset
|
776 |
next |
4d51ddd6aa5c
Merged theories about wellfoundedness into one: Wellfounded.thy
krauss
parents:
diff
changeset
|
777 |
case False then obtain z where "R z x" and "\<not> accp R z" |
4d51ddd6aa5c
Merged theories about wellfoundedness into one: Wellfounded.thy
krauss
parents:
diff
changeset
|
778 |
by auto |
4d51ddd6aa5c
Merged theories about wellfoundedness into one: Wellfounded.thy
krauss
parents:
diff
changeset
|
779 |
with a show thesis . |
4d51ddd6aa5c
Merged theories about wellfoundedness into one: Wellfounded.thy
krauss
parents:
diff
changeset
|
780 |
qed |
4d51ddd6aa5c
Merged theories about wellfoundedness into one: Wellfounded.thy
krauss
parents:
diff
changeset
|
781 |
qed |
4d51ddd6aa5c
Merged theories about wellfoundedness into one: Wellfounded.thy
krauss
parents:
diff
changeset
|
782 |
|
63108 | 783 |
lemma accp_downwards_aux: "r\<^sup>*\<^sup>* b a \<Longrightarrow> accp r a \<longrightarrow> accp r b" |
63612 | 784 |
by (erule rtranclp_induct) (blast dest: accp_downward)+ |
26748
4d51ddd6aa5c
Merged theories about wellfoundedness into one: Wellfounded.thy
krauss
parents:
diff
changeset
|
785 |
|
63108 | 786 |
theorem accp_downwards: "accp r a \<Longrightarrow> r\<^sup>*\<^sup>* b a \<Longrightarrow> accp r b" |
63572 | 787 |
by (blast dest: accp_downwards_aux) |
26748
4d51ddd6aa5c
Merged theories about wellfoundedness into one: Wellfounded.thy
krauss
parents:
diff
changeset
|
788 |
|
63108 | 789 |
theorem accp_wfPI: "\<forall>x. accp r x \<Longrightarrow> wfP r" |
75669
43f5dfb7fa35
tuned (some HOL lints, by Yecine Megdiche);
Fabian Huch <huch@in.tum.de>
parents:
74971
diff
changeset
|
790 |
proof (rule wfPUNIVI) |
43f5dfb7fa35
tuned (some HOL lints, by Yecine Megdiche);
Fabian Huch <huch@in.tum.de>
parents:
74971
diff
changeset
|
791 |
fix P x |
43f5dfb7fa35
tuned (some HOL lints, by Yecine Megdiche);
Fabian Huch <huch@in.tum.de>
parents:
74971
diff
changeset
|
792 |
assume "\<forall>x. accp r x" "\<forall>x. (\<forall>y. r y x \<longrightarrow> P y) \<longrightarrow> P x" |
43f5dfb7fa35
tuned (some HOL lints, by Yecine Megdiche);
Fabian Huch <huch@in.tum.de>
parents:
74971
diff
changeset
|
793 |
then show "P x" |
43f5dfb7fa35
tuned (some HOL lints, by Yecine Megdiche);
Fabian Huch <huch@in.tum.de>
parents:
74971
diff
changeset
|
794 |
using accp_induct[where P = P] by blast |
43f5dfb7fa35
tuned (some HOL lints, by Yecine Megdiche);
Fabian Huch <huch@in.tum.de>
parents:
74971
diff
changeset
|
795 |
qed |
26748
4d51ddd6aa5c
Merged theories about wellfoundedness into one: Wellfounded.thy
krauss
parents:
diff
changeset
|
796 |
|
63108 | 797 |
theorem accp_wfPD: "wfP r \<Longrightarrow> accp r x" |
26748
4d51ddd6aa5c
Merged theories about wellfoundedness into one: Wellfounded.thy
krauss
parents:
diff
changeset
|
798 |
apply (erule wfP_induct_rule) |
4d51ddd6aa5c
Merged theories about wellfoundedness into one: Wellfounded.thy
krauss
parents:
diff
changeset
|
799 |
apply (rule accp.accI) |
4d51ddd6aa5c
Merged theories about wellfoundedness into one: Wellfounded.thy
krauss
parents:
diff
changeset
|
800 |
apply blast |
4d51ddd6aa5c
Merged theories about wellfoundedness into one: Wellfounded.thy
krauss
parents:
diff
changeset
|
801 |
done |
4d51ddd6aa5c
Merged theories about wellfoundedness into one: Wellfounded.thy
krauss
parents:
diff
changeset
|
802 |
|
4d51ddd6aa5c
Merged theories about wellfoundedness into one: Wellfounded.thy
krauss
parents:
diff
changeset
|
803 |
theorem wfP_accp_iff: "wfP r = (\<forall>x. accp r x)" |
63572 | 804 |
by (blast intro: accp_wfPI dest: accp_wfPD) |
26748
4d51ddd6aa5c
Merged theories about wellfoundedness into one: Wellfounded.thy
krauss
parents:
diff
changeset
|
805 |
|
4d51ddd6aa5c
Merged theories about wellfoundedness into one: Wellfounded.thy
krauss
parents:
diff
changeset
|
806 |
|
60758 | 807 |
text \<open>Smaller relations have bigger accessible parts:\<close> |
26748
4d51ddd6aa5c
Merged theories about wellfoundedness into one: Wellfounded.thy
krauss
parents:
diff
changeset
|
808 |
|
4d51ddd6aa5c
Merged theories about wellfoundedness into one: Wellfounded.thy
krauss
parents:
diff
changeset
|
809 |
lemma accp_subset: |
63572 | 810 |
assumes "R1 \<le> R2" |
26748
4d51ddd6aa5c
Merged theories about wellfoundedness into one: Wellfounded.thy
krauss
parents:
diff
changeset
|
811 |
shows "accp R2 \<le> accp R1" |
26803
0af0f674845d
- Explicitely passed pred_subset_eq and pred_equals_eq as an argument to the
berghofe
parents:
26748
diff
changeset
|
812 |
proof (rule predicate1I) |
63572 | 813 |
fix x |
814 |
assume "accp R2 x" |
|
26748
4d51ddd6aa5c
Merged theories about wellfoundedness into one: Wellfounded.thy
krauss
parents:
diff
changeset
|
815 |
then show "accp R1 x" |
4d51ddd6aa5c
Merged theories about wellfoundedness into one: Wellfounded.thy
krauss
parents:
diff
changeset
|
816 |
proof (induct x) |
4d51ddd6aa5c
Merged theories about wellfoundedness into one: Wellfounded.thy
krauss
parents:
diff
changeset
|
817 |
fix x |
63572 | 818 |
assume "\<And>y. R2 y x \<Longrightarrow> accp R1 y" |
819 |
with assms show "accp R1 x" |
|
26748
4d51ddd6aa5c
Merged theories about wellfoundedness into one: Wellfounded.thy
krauss
parents:
diff
changeset
|
820 |
by (blast intro: accp.accI) |
4d51ddd6aa5c
Merged theories about wellfoundedness into one: Wellfounded.thy
krauss
parents:
diff
changeset
|
821 |
qed |
4d51ddd6aa5c
Merged theories about wellfoundedness into one: Wellfounded.thy
krauss
parents:
diff
changeset
|
822 |
qed |
4d51ddd6aa5c
Merged theories about wellfoundedness into one: Wellfounded.thy
krauss
parents:
diff
changeset
|
823 |
|
4d51ddd6aa5c
Merged theories about wellfoundedness into one: Wellfounded.thy
krauss
parents:
diff
changeset
|
824 |
|
60758 | 825 |
text \<open>This is a generalized induction theorem that works on |
826 |
subsets of the accessible part.\<close> |
|
26748
4d51ddd6aa5c
Merged theories about wellfoundedness into one: Wellfounded.thy
krauss
parents:
diff
changeset
|
827 |
|
4d51ddd6aa5c
Merged theories about wellfoundedness into one: Wellfounded.thy
krauss
parents:
diff
changeset
|
828 |
lemma accp_subset_induct: |
4d51ddd6aa5c
Merged theories about wellfoundedness into one: Wellfounded.thy
krauss
parents:
diff
changeset
|
829 |
assumes subset: "D \<le> accp R" |
63572 | 830 |
and dcl: "\<And>x z. D x \<Longrightarrow> R z x \<Longrightarrow> D z" |
26748
4d51ddd6aa5c
Merged theories about wellfoundedness into one: Wellfounded.thy
krauss
parents:
diff
changeset
|
831 |
and "D x" |
63572 | 832 |
and istep: "\<And>x. D x \<Longrightarrow> (\<And>z. R z x \<Longrightarrow> P z) \<Longrightarrow> P x" |
26748
4d51ddd6aa5c
Merged theories about wellfoundedness into one: Wellfounded.thy
krauss
parents:
diff
changeset
|
833 |
shows "P x" |
4d51ddd6aa5c
Merged theories about wellfoundedness into one: Wellfounded.thy
krauss
parents:
diff
changeset
|
834 |
proof - |
60758 | 835 |
from subset and \<open>D x\<close> |
26748
4d51ddd6aa5c
Merged theories about wellfoundedness into one: Wellfounded.thy
krauss
parents:
diff
changeset
|
836 |
have "accp R x" .. |
60758 | 837 |
then show "P x" using \<open>D x\<close> |
26748
4d51ddd6aa5c
Merged theories about wellfoundedness into one: Wellfounded.thy
krauss
parents:
diff
changeset
|
838 |
proof (induct x) |
4d51ddd6aa5c
Merged theories about wellfoundedness into one: Wellfounded.thy
krauss
parents:
diff
changeset
|
839 |
fix x |
63572 | 840 |
assume "D x" and "\<And>y. R y x \<Longrightarrow> D y \<Longrightarrow> P y" |
26748
4d51ddd6aa5c
Merged theories about wellfoundedness into one: Wellfounded.thy
krauss
parents:
diff
changeset
|
841 |
with dcl and istep show "P x" by blast |
4d51ddd6aa5c
Merged theories about wellfoundedness into one: Wellfounded.thy
krauss
parents:
diff
changeset
|
842 |
qed |
4d51ddd6aa5c
Merged theories about wellfoundedness into one: Wellfounded.thy
krauss
parents:
diff
changeset
|
843 |
qed |
4d51ddd6aa5c
Merged theories about wellfoundedness into one: Wellfounded.thy
krauss
parents:
diff
changeset
|
844 |
|
4d51ddd6aa5c
Merged theories about wellfoundedness into one: Wellfounded.thy
krauss
parents:
diff
changeset
|
845 |
|
60758 | 846 |
text \<open>Set versions of the above theorems\<close> |
26748
4d51ddd6aa5c
Merged theories about wellfoundedness into one: Wellfounded.thy
krauss
parents:
diff
changeset
|
847 |
|
4d51ddd6aa5c
Merged theories about wellfoundedness into one: Wellfounded.thy
krauss
parents:
diff
changeset
|
848 |
lemmas acc_induct = accp_induct [to_set] |
4d51ddd6aa5c
Merged theories about wellfoundedness into one: Wellfounded.thy
krauss
parents:
diff
changeset
|
849 |
lemmas acc_induct_rule = acc_induct [rule_format, induct set: acc] |
4d51ddd6aa5c
Merged theories about wellfoundedness into one: Wellfounded.thy
krauss
parents:
diff
changeset
|
850 |
lemmas acc_downward = accp_downward [to_set] |
4d51ddd6aa5c
Merged theories about wellfoundedness into one: Wellfounded.thy
krauss
parents:
diff
changeset
|
851 |
lemmas not_acc_down = not_accp_down [to_set] |
4d51ddd6aa5c
Merged theories about wellfoundedness into one: Wellfounded.thy
krauss
parents:
diff
changeset
|
852 |
lemmas acc_downwards_aux = accp_downwards_aux [to_set] |
4d51ddd6aa5c
Merged theories about wellfoundedness into one: Wellfounded.thy
krauss
parents:
diff
changeset
|
853 |
lemmas acc_downwards = accp_downwards [to_set] |
4d51ddd6aa5c
Merged theories about wellfoundedness into one: Wellfounded.thy
krauss
parents:
diff
changeset
|
854 |
lemmas acc_wfI = accp_wfPI [to_set] |
4d51ddd6aa5c
Merged theories about wellfoundedness into one: Wellfounded.thy
krauss
parents:
diff
changeset
|
855 |
lemmas acc_wfD = accp_wfPD [to_set] |
4d51ddd6aa5c
Merged theories about wellfoundedness into one: Wellfounded.thy
krauss
parents:
diff
changeset
|
856 |
lemmas wf_acc_iff = wfP_accp_iff [to_set] |
46177
adac34829e10
pred_subset_eq and SUP_UN_eq2 are now standard pred_set_conv rules
berghofe
parents:
45970
diff
changeset
|
857 |
lemmas acc_subset = accp_subset [to_set] |
adac34829e10
pred_subset_eq and SUP_UN_eq2 are now standard pred_set_conv rules
berghofe
parents:
45970
diff
changeset
|
858 |
lemmas acc_subset_induct = accp_subset_induct [to_set] |
26748
4d51ddd6aa5c
Merged theories about wellfoundedness into one: Wellfounded.thy
krauss
parents:
diff
changeset
|
859 |
|
4d51ddd6aa5c
Merged theories about wellfoundedness into one: Wellfounded.thy
krauss
parents:
diff
changeset
|
860 |
|
60758 | 861 |
subsection \<open>Tools for building wellfounded relations\<close> |
26748
4d51ddd6aa5c
Merged theories about wellfoundedness into one: Wellfounded.thy
krauss
parents:
diff
changeset
|
862 |
|
60758 | 863 |
text \<open>Inverse Image\<close> |
26748
4d51ddd6aa5c
Merged theories about wellfoundedness into one: Wellfounded.thy
krauss
parents:
diff
changeset
|
864 |
|
71544 | 865 |
lemma wf_inv_image [simp,intro!]: |
866 |
fixes f :: "'a \<Rightarrow> 'b" |
|
867 |
assumes "wf r" |
|
868 |
shows "wf (inv_image r f)" |
|
75669
43f5dfb7fa35
tuned (some HOL lints, by Yecine Megdiche);
Fabian Huch <huch@in.tum.de>
parents:
74971
diff
changeset
|
869 |
proof - |
43f5dfb7fa35
tuned (some HOL lints, by Yecine Megdiche);
Fabian Huch <huch@in.tum.de>
parents:
74971
diff
changeset
|
870 |
have "\<And>x P. x \<in> P \<Longrightarrow> \<exists>z\<in>P. \<forall>y. (f y, f z) \<in> r \<longrightarrow> y \<notin> P" |
43f5dfb7fa35
tuned (some HOL lints, by Yecine Megdiche);
Fabian Huch <huch@in.tum.de>
parents:
74971
diff
changeset
|
871 |
proof - |
43f5dfb7fa35
tuned (some HOL lints, by Yecine Megdiche);
Fabian Huch <huch@in.tum.de>
parents:
74971
diff
changeset
|
872 |
fix P and x::'a |
43f5dfb7fa35
tuned (some HOL lints, by Yecine Megdiche);
Fabian Huch <huch@in.tum.de>
parents:
74971
diff
changeset
|
873 |
assume "x \<in> P" |
43f5dfb7fa35
tuned (some HOL lints, by Yecine Megdiche);
Fabian Huch <huch@in.tum.de>
parents:
74971
diff
changeset
|
874 |
then obtain w where w: "w \<in> {w. \<exists>x::'a. x \<in> P \<and> f x = w}" |
43f5dfb7fa35
tuned (some HOL lints, by Yecine Megdiche);
Fabian Huch <huch@in.tum.de>
parents:
74971
diff
changeset
|
875 |
by auto |
43f5dfb7fa35
tuned (some HOL lints, by Yecine Megdiche);
Fabian Huch <huch@in.tum.de>
parents:
74971
diff
changeset
|
876 |
have *: "\<And>Q u. u \<in> Q \<Longrightarrow> \<exists>z\<in>Q. \<forall>y. (y, z) \<in> r \<longrightarrow> y \<notin> Q" |
43f5dfb7fa35
tuned (some HOL lints, by Yecine Megdiche);
Fabian Huch <huch@in.tum.de>
parents:
74971
diff
changeset
|
877 |
using assms by (auto simp add: wf_eq_minimal) |
43f5dfb7fa35
tuned (some HOL lints, by Yecine Megdiche);
Fabian Huch <huch@in.tum.de>
parents:
74971
diff
changeset
|
878 |
show "\<exists>z\<in>P. \<forall>y. (f y, f z) \<in> r \<longrightarrow> y \<notin> P" |
43f5dfb7fa35
tuned (some HOL lints, by Yecine Megdiche);
Fabian Huch <huch@in.tum.de>
parents:
74971
diff
changeset
|
879 |
using * [OF w] by auto |
43f5dfb7fa35
tuned (some HOL lints, by Yecine Megdiche);
Fabian Huch <huch@in.tum.de>
parents:
74971
diff
changeset
|
880 |
qed |
43f5dfb7fa35
tuned (some HOL lints, by Yecine Megdiche);
Fabian Huch <huch@in.tum.de>
parents:
74971
diff
changeset
|
881 |
then show ?thesis |
43f5dfb7fa35
tuned (some HOL lints, by Yecine Megdiche);
Fabian Huch <huch@in.tum.de>
parents:
74971
diff
changeset
|
882 |
by (clarsimp simp: inv_image_def wf_eq_minimal) |
71544 | 883 |
qed |
26748
4d51ddd6aa5c
Merged theories about wellfoundedness into one: Wellfounded.thy
krauss
parents:
diff
changeset
|
884 |
|
76267
5ea1f8bfb795
added lemmas wf_if_convertible_to_wf, wfP_if_convertible_to_wfP, and wfP_if_convertible_to_nat
desharna
parents:
75669
diff
changeset
|
885 |
|
5ea1f8bfb795
added lemmas wf_if_convertible_to_wf, wfP_if_convertible_to_wfP, and wfP_if_convertible_to_nat
desharna
parents:
75669
diff
changeset
|
886 |
subsubsection \<open>Conversion to a known well-founded relation\<close> |
5ea1f8bfb795
added lemmas wf_if_convertible_to_wf, wfP_if_convertible_to_wfP, and wfP_if_convertible_to_nat
desharna
parents:
75669
diff
changeset
|
887 |
|
5ea1f8bfb795
added lemmas wf_if_convertible_to_wf, wfP_if_convertible_to_wfP, and wfP_if_convertible_to_nat
desharna
parents:
75669
diff
changeset
|
888 |
lemma wf_if_convertible_to_wf: |
5ea1f8bfb795
added lemmas wf_if_convertible_to_wf, wfP_if_convertible_to_wfP, and wfP_if_convertible_to_nat
desharna
parents:
75669
diff
changeset
|
889 |
fixes r :: "'a rel" and s :: "'b rel" and f :: "'a \<Rightarrow> 'b" |
5ea1f8bfb795
added lemmas wf_if_convertible_to_wf, wfP_if_convertible_to_wfP, and wfP_if_convertible_to_nat
desharna
parents:
75669
diff
changeset
|
890 |
assumes "wf s" and convertible: "\<And>x y. (x, y) \<in> r \<Longrightarrow> (f x, f y) \<in> s" |
5ea1f8bfb795
added lemmas wf_if_convertible_to_wf, wfP_if_convertible_to_wfP, and wfP_if_convertible_to_nat
desharna
parents:
75669
diff
changeset
|
891 |
shows "wf r" |
5ea1f8bfb795
added lemmas wf_if_convertible_to_wf, wfP_if_convertible_to_wfP, and wfP_if_convertible_to_nat
desharna
parents:
75669
diff
changeset
|
892 |
proof (rule wfI_min[of r]) |
5ea1f8bfb795
added lemmas wf_if_convertible_to_wf, wfP_if_convertible_to_wfP, and wfP_if_convertible_to_nat
desharna
parents:
75669
diff
changeset
|
893 |
fix x :: 'a and Q :: "'a set" |
5ea1f8bfb795
added lemmas wf_if_convertible_to_wf, wfP_if_convertible_to_wfP, and wfP_if_convertible_to_nat
desharna
parents:
75669
diff
changeset
|
894 |
assume "x \<in> Q" |
5ea1f8bfb795
added lemmas wf_if_convertible_to_wf, wfP_if_convertible_to_wfP, and wfP_if_convertible_to_nat
desharna
parents:
75669
diff
changeset
|
895 |
then obtain y where "y \<in> Q" and "\<And>z. (f z, f y) \<in> s \<Longrightarrow> z \<notin> Q" |
5ea1f8bfb795
added lemmas wf_if_convertible_to_wf, wfP_if_convertible_to_wfP, and wfP_if_convertible_to_nat
desharna
parents:
75669
diff
changeset
|
896 |
by (auto elim: wfE_min[OF wf_inv_image[of s f, OF \<open>wf s\<close>], unfolded in_inv_image]) |
5ea1f8bfb795
added lemmas wf_if_convertible_to_wf, wfP_if_convertible_to_wfP, and wfP_if_convertible_to_nat
desharna
parents:
75669
diff
changeset
|
897 |
thus "\<exists>z \<in> Q. \<forall>y. (y, z) \<in> r \<longrightarrow> y \<notin> Q" |
5ea1f8bfb795
added lemmas wf_if_convertible_to_wf, wfP_if_convertible_to_wfP, and wfP_if_convertible_to_nat
desharna
parents:
75669
diff
changeset
|
898 |
by (auto intro: convertible) |
5ea1f8bfb795
added lemmas wf_if_convertible_to_wf, wfP_if_convertible_to_wfP, and wfP_if_convertible_to_nat
desharna
parents:
75669
diff
changeset
|
899 |
qed |
5ea1f8bfb795
added lemmas wf_if_convertible_to_wf, wfP_if_convertible_to_wfP, and wfP_if_convertible_to_nat
desharna
parents:
75669
diff
changeset
|
900 |
|
5ea1f8bfb795
added lemmas wf_if_convertible_to_wf, wfP_if_convertible_to_wfP, and wfP_if_convertible_to_nat
desharna
parents:
75669
diff
changeset
|
901 |
lemma wfP_if_convertible_to_wfP: "wfP S \<Longrightarrow> (\<And>x y. R x y \<Longrightarrow> S (f x) (f y)) \<Longrightarrow> wfP R" |
5ea1f8bfb795
added lemmas wf_if_convertible_to_wf, wfP_if_convertible_to_wfP, and wfP_if_convertible_to_nat
desharna
parents:
75669
diff
changeset
|
902 |
using wf_if_convertible_to_wf[to_pred, of S R f] by simp |
5ea1f8bfb795
added lemmas wf_if_convertible_to_wf, wfP_if_convertible_to_wfP, and wfP_if_convertible_to_nat
desharna
parents:
75669
diff
changeset
|
903 |
|
5ea1f8bfb795
added lemmas wf_if_convertible_to_wf, wfP_if_convertible_to_wfP, and wfP_if_convertible_to_nat
desharna
parents:
75669
diff
changeset
|
904 |
text \<open>Converting to @{typ nat} is a very common special case that might be found more easily by |
5ea1f8bfb795
added lemmas wf_if_convertible_to_wf, wfP_if_convertible_to_wfP, and wfP_if_convertible_to_nat
desharna
parents:
75669
diff
changeset
|
905 |
Sledgehammer.\<close> |
5ea1f8bfb795
added lemmas wf_if_convertible_to_wf, wfP_if_convertible_to_wfP, and wfP_if_convertible_to_nat
desharna
parents:
75669
diff
changeset
|
906 |
|
5ea1f8bfb795
added lemmas wf_if_convertible_to_wf, wfP_if_convertible_to_wfP, and wfP_if_convertible_to_nat
desharna
parents:
75669
diff
changeset
|
907 |
lemma wfP_if_convertible_to_nat: |
5ea1f8bfb795
added lemmas wf_if_convertible_to_wf, wfP_if_convertible_to_wfP, and wfP_if_convertible_to_nat
desharna
parents:
75669
diff
changeset
|
908 |
fixes f :: "_ \<Rightarrow> nat" |
5ea1f8bfb795
added lemmas wf_if_convertible_to_wf, wfP_if_convertible_to_wfP, and wfP_if_convertible_to_nat
desharna
parents:
75669
diff
changeset
|
909 |
shows "(\<And>x y. R x y \<Longrightarrow> f x < f y) \<Longrightarrow> wfP R" |
5ea1f8bfb795
added lemmas wf_if_convertible_to_wf, wfP_if_convertible_to_wfP, and wfP_if_convertible_to_nat
desharna
parents:
75669
diff
changeset
|
910 |
by (rule wfP_if_convertible_to_wfP[of "(<) :: nat \<Rightarrow> nat \<Rightarrow> bool", simplified]) |
5ea1f8bfb795
added lemmas wf_if_convertible_to_wf, wfP_if_convertible_to_wfP, and wfP_if_convertible_to_nat
desharna
parents:
75669
diff
changeset
|
911 |
|
5ea1f8bfb795
added lemmas wf_if_convertible_to_wf, wfP_if_convertible_to_wfP, and wfP_if_convertible_to_nat
desharna
parents:
75669
diff
changeset
|
912 |
|
5ea1f8bfb795
added lemmas wf_if_convertible_to_wf, wfP_if_convertible_to_wfP, and wfP_if_convertible_to_nat
desharna
parents:
75669
diff
changeset
|
913 |
subsubsection \<open>Measure functions into \<^typ>\<open>nat\<close>\<close> |
26748
4d51ddd6aa5c
Merged theories about wellfoundedness into one: Wellfounded.thy
krauss
parents:
diff
changeset
|
914 |
|
63108 | 915 |
definition measure :: "('a \<Rightarrow> nat) \<Rightarrow> ('a \<times> 'a) set" |
916 |
where "measure = inv_image less_than" |
|
26748
4d51ddd6aa5c
Merged theories about wellfoundedness into one: Wellfounded.thy
krauss
parents:
diff
changeset
|
917 |
|
63108 | 918 |
lemma in_measure[simp, code_unfold]: "(x, y) \<in> measure f \<longleftrightarrow> f x < f y" |
26748
4d51ddd6aa5c
Merged theories about wellfoundedness into one: Wellfounded.thy
krauss
parents:
diff
changeset
|
919 |
by (simp add:measure_def) |
4d51ddd6aa5c
Merged theories about wellfoundedness into one: Wellfounded.thy
krauss
parents:
diff
changeset
|
920 |
|
4d51ddd6aa5c
Merged theories about wellfoundedness into one: Wellfounded.thy
krauss
parents:
diff
changeset
|
921 |
lemma wf_measure [iff]: "wf (measure f)" |
63572 | 922 |
unfolding measure_def by (rule wf_less_than [THEN wf_inv_image]) |
26748
4d51ddd6aa5c
Merged theories about wellfoundedness into one: Wellfounded.thy
krauss
parents:
diff
changeset
|
923 |
|
63108 | 924 |
lemma wf_if_measure: "(\<And>x. P x \<Longrightarrow> f(g x) < f x) \<Longrightarrow> wf {(y,x). P x \<and> y = g x}" |
925 |
for f :: "'a \<Rightarrow> nat" |
|
68646 | 926 |
using wf_measure[of f] unfolding measure_def inv_image_def less_than_def less_eq |
927 |
by (rule wf_subset) auto |
|
41720 | 928 |
|
929 |
||
63108 | 930 |
subsubsection \<open>Lexicographic combinations\<close> |
26748
4d51ddd6aa5c
Merged theories about wellfoundedness into one: Wellfounded.thy
krauss
parents:
diff
changeset
|
931 |
|
63108 | 932 |
definition lex_prod :: "('a \<times>'a) set \<Rightarrow> ('b \<times> 'b) set \<Rightarrow> (('a \<times> 'b) \<times> ('a \<times> 'b)) set" |
933 |
(infixr "<*lex*>" 80) |
|
72184 | 934 |
where "ra <*lex*> rb = {((a, b), (a', b')). (a, a') \<in> ra \<or> a = a' \<and> (b, b') \<in> rb}" |
26748
4d51ddd6aa5c
Merged theories about wellfoundedness into one: Wellfounded.thy
krauss
parents:
diff
changeset
|
935 |
|
72184 | 936 |
lemma in_lex_prod[simp]: "((a, b), (a', b')) \<in> r <*lex*> s \<longleftrightarrow> (a, a') \<in> r \<or> a = a' \<and> (b, b') \<in> s" |
26748
4d51ddd6aa5c
Merged theories about wellfoundedness into one: Wellfounded.thy
krauss
parents:
diff
changeset
|
937 |
by (auto simp:lex_prod_def) |
4d51ddd6aa5c
Merged theories about wellfoundedness into one: Wellfounded.thy
krauss
parents:
diff
changeset
|
938 |
|
71410 | 939 |
lemma wf_lex_prod [intro!]: |
940 |
assumes "wf ra" "wf rb" |
|
941 |
shows "wf (ra <*lex*> rb)" |
|
942 |
proof (rule wfI) |
|
943 |
fix z :: "'a \<times> 'b" and P |
|
944 |
assume * [rule_format]: "\<forall>u. (\<forall>v. (v, u) \<in> ra <*lex*> rb \<longrightarrow> P v) \<longrightarrow> P u" |
|
945 |
obtain x y where zeq: "z = (x,y)" |
|
946 |
by fastforce |
|
947 |
have "P(x,y)" using \<open>wf ra\<close> |
|
948 |
proof (induction x arbitrary: y rule: wf_induct_rule) |
|
949 |
case (less x) |
|
950 |
note lessx = less |
|
951 |
show ?case using \<open>wf rb\<close> less |
|
952 |
proof (induction y rule: wf_induct_rule) |
|
953 |
case (less y) |
|
954 |
show ?case |
|
955 |
by (force intro: * less.IH lessx) |
|
956 |
qed |
|
957 |
qed |
|
958 |
then show "P z" |
|
959 |
by (simp add: zeq) |
|
960 |
qed auto |
|
961 |
||
76698 | 962 |
lemma refl_lex_prod[simp]: "refl r\<^sub>B \<Longrightarrow> refl (r\<^sub>A <*lex*> r\<^sub>B)" |
963 |
by (auto intro!: reflI dest: refl_onD) |
|
964 |
||
76694
2f8219460ac9
added lemmas irrefl_on_lex_prod[simp] and irrefl_lex_prod[simp]
desharna
parents:
76682
diff
changeset
|
965 |
lemma irrefl_on_lex_prod[simp]: |
2f8219460ac9
added lemmas irrefl_on_lex_prod[simp] and irrefl_lex_prod[simp]
desharna
parents:
76682
diff
changeset
|
966 |
"irrefl_on A r\<^sub>A \<Longrightarrow> irrefl_on B r\<^sub>B \<Longrightarrow> irrefl_on (A \<times> B) (r\<^sub>A <*lex*> r\<^sub>B)" |
2f8219460ac9
added lemmas irrefl_on_lex_prod[simp] and irrefl_lex_prod[simp]
desharna
parents:
76682
diff
changeset
|
967 |
by (auto intro!: irrefl_onI dest: irrefl_onD) |
2f8219460ac9
added lemmas irrefl_on_lex_prod[simp] and irrefl_lex_prod[simp]
desharna
parents:
76682
diff
changeset
|
968 |
|
2f8219460ac9
added lemmas irrefl_on_lex_prod[simp] and irrefl_lex_prod[simp]
desharna
parents:
76682
diff
changeset
|
969 |
lemma irrefl_lex_prod[simp]: "irrefl r\<^sub>A \<Longrightarrow> irrefl r\<^sub>B \<Longrightarrow> irrefl (r\<^sub>A <*lex*> r\<^sub>B)" |
2f8219460ac9
added lemmas irrefl_on_lex_prod[simp] and irrefl_lex_prod[simp]
desharna
parents:
76682
diff
changeset
|
970 |
by (rule irrefl_on_lex_prod[of UNIV _ UNIV, unfolded UNIV_Times_UNIV]) |
2f8219460ac9
added lemmas irrefl_on_lex_prod[simp] and irrefl_lex_prod[simp]
desharna
parents:
76682
diff
changeset
|
971 |
|
76695
e321569ec7a1
added lemmas sym_on_lex_prod[simp] and sym_lex_prod[simp]
desharna
parents:
76694
diff
changeset
|
972 |
lemma sym_on_lex_prod[simp]: |
e321569ec7a1
added lemmas sym_on_lex_prod[simp] and sym_lex_prod[simp]
desharna
parents:
76694
diff
changeset
|
973 |
"sym_on A r\<^sub>A \<Longrightarrow> sym_on B r\<^sub>B \<Longrightarrow> sym_on (A \<times> B) (r\<^sub>A <*lex*> r\<^sub>B)" |
e321569ec7a1
added lemmas sym_on_lex_prod[simp] and sym_lex_prod[simp]
desharna
parents:
76694
diff
changeset
|
974 |
by (auto intro!: sym_onI dest: sym_onD) |
e321569ec7a1
added lemmas sym_on_lex_prod[simp] and sym_lex_prod[simp]
desharna
parents:
76694
diff
changeset
|
975 |
|
e321569ec7a1
added lemmas sym_on_lex_prod[simp] and sym_lex_prod[simp]
desharna
parents:
76694
diff
changeset
|
976 |
lemma sym_lex_prod[simp]: |
e321569ec7a1
added lemmas sym_on_lex_prod[simp] and sym_lex_prod[simp]
desharna
parents:
76694
diff
changeset
|
977 |
"sym r\<^sub>A \<Longrightarrow> sym r\<^sub>B \<Longrightarrow> sym (r\<^sub>A <*lex*> r\<^sub>B)" |
e321569ec7a1
added lemmas sym_on_lex_prod[simp] and sym_lex_prod[simp]
desharna
parents:
76694
diff
changeset
|
978 |
by (rule sym_on_lex_prod[of UNIV _ UNIV, unfolded UNIV_Times_UNIV]) |
e321569ec7a1
added lemmas sym_on_lex_prod[simp] and sym_lex_prod[simp]
desharna
parents:
76694
diff
changeset
|
979 |
|
76696
b6b7f3caa74a
added lemmas asym_on_lex_prod[simp] and asym_lex_prod[simp]
desharna
parents:
76695
diff
changeset
|
980 |
lemma asym_on_lex_prod[simp]: |
b6b7f3caa74a
added lemmas asym_on_lex_prod[simp] and asym_lex_prod[simp]
desharna
parents:
76695
diff
changeset
|
981 |
"asym_on A r\<^sub>A \<Longrightarrow> asym_on B r\<^sub>B \<Longrightarrow> asym_on (A \<times> B) (r\<^sub>A <*lex*> r\<^sub>B)" |
b6b7f3caa74a
added lemmas asym_on_lex_prod[simp] and asym_lex_prod[simp]
desharna
parents:
76695
diff
changeset
|
982 |
by (auto intro!: asym_onI dest: asym_onD) |
b6b7f3caa74a
added lemmas asym_on_lex_prod[simp] and asym_lex_prod[simp]
desharna
parents:
76695
diff
changeset
|
983 |
|
b6b7f3caa74a
added lemmas asym_on_lex_prod[simp] and asym_lex_prod[simp]
desharna
parents:
76695
diff
changeset
|
984 |
lemma asym_lex_prod[simp]: |
b6b7f3caa74a
added lemmas asym_on_lex_prod[simp] and asym_lex_prod[simp]
desharna
parents:
76695
diff
changeset
|
985 |
"asym r\<^sub>A \<Longrightarrow> asym r\<^sub>B \<Longrightarrow> asym (r\<^sub>A <*lex*> r\<^sub>B)" |
b6b7f3caa74a
added lemmas asym_on_lex_prod[simp] and asym_lex_prod[simp]
desharna
parents:
76695
diff
changeset
|
986 |
by (rule asym_on_lex_prod[of UNIV _ UNIV, unfolded UNIV_Times_UNIV]) |
b6b7f3caa74a
added lemmas asym_on_lex_prod[simp] and asym_lex_prod[simp]
desharna
parents:
76695
diff
changeset
|
987 |
|
76753 | 988 |
lemma trans_on_lex_prod[simp]: |
989 |
assumes "trans_on A r\<^sub>A" and "trans_on B r\<^sub>B" |
|
990 |
shows "trans_on (A \<times> B) (r\<^sub>A <*lex*> r\<^sub>B)" |
|
991 |
proof (rule trans_onI) |
|
992 |
fix x y z |
|
993 |
show "x \<in> A \<times> B \<Longrightarrow> y \<in> A \<times> B \<Longrightarrow> z \<in> A \<times> B \<Longrightarrow> |
|
994 |
(x, y) \<in> r\<^sub>A <*lex*> r\<^sub>B \<Longrightarrow> (y, z) \<in> r\<^sub>A <*lex*> r\<^sub>B \<Longrightarrow> (x, z) \<in> r\<^sub>A <*lex*> r\<^sub>B" |
|
995 |
using trans_onD[OF \<open>trans_on A r\<^sub>A\<close>, of "fst x" "fst y" "fst z"] |
|
996 |
using trans_onD[OF \<open>trans_on B r\<^sub>B\<close>, of "snd x" "snd y" "snd z"] |
|
997 |
by auto |
|
998 |
qed |
|
999 |
||
1000 |
lemma trans_lex_prod [simp,intro!]: "trans r\<^sub>A \<Longrightarrow> trans r\<^sub>B \<Longrightarrow> trans (r\<^sub>A <*lex*> r\<^sub>B)" |
|
1001 |
by (rule trans_on_lex_prod[of UNIV _ UNIV, unfolded UNIV_Times_UNIV]) |
|
26748
4d51ddd6aa5c
Merged theories about wellfoundedness into one: Wellfounded.thy
krauss
parents:
diff
changeset
|
1002 |
|
76694
2f8219460ac9
added lemmas irrefl_on_lex_prod[simp] and irrefl_lex_prod[simp]
desharna
parents:
76682
diff
changeset
|
1003 |
lemma total_on_lex_prod[simp]: |
2f8219460ac9
added lemmas irrefl_on_lex_prod[simp] and irrefl_lex_prod[simp]
desharna
parents:
76682
diff
changeset
|
1004 |
"total_on A r\<^sub>A \<Longrightarrow> total_on B r\<^sub>B \<Longrightarrow> total_on (A \<times> B) (r\<^sub>A <*lex*> r\<^sub>B)" |
71404
f2b783abfbe7
A few lemmas connected with orderings
paulson <lp15@cam.ac.uk>
parents:
69593
diff
changeset
|
1005 |
by (auto simp: total_on_def) |
f2b783abfbe7
A few lemmas connected with orderings
paulson <lp15@cam.ac.uk>
parents:
69593
diff
changeset
|
1006 |
|
76694
2f8219460ac9
added lemmas irrefl_on_lex_prod[simp] and irrefl_lex_prod[simp]
desharna
parents:
76682
diff
changeset
|
1007 |
lemma total_lex_prod[simp]: "total r\<^sub>A \<Longrightarrow> total r\<^sub>B \<Longrightarrow> total (r\<^sub>A <*lex*> r\<^sub>B)" |
2f8219460ac9
added lemmas irrefl_on_lex_prod[simp] and irrefl_lex_prod[simp]
desharna
parents:
76682
diff
changeset
|
1008 |
by (rule total_on_lex_prod[of UNIV _ UNIV, unfolded UNIV_Times_UNIV]) |
2f8219460ac9
added lemmas irrefl_on_lex_prod[simp] and irrefl_lex_prod[simp]
desharna
parents:
76682
diff
changeset
|
1009 |
|
60758 | 1010 |
text \<open>lexicographic combinations with measure functions\<close> |
26748
4d51ddd6aa5c
Merged theories about wellfoundedness into one: Wellfounded.thy
krauss
parents:
diff
changeset
|
1011 |
|
63108 | 1012 |
definition mlex_prod :: "('a \<Rightarrow> nat) \<Rightarrow> ('a \<times> 'a) set \<Rightarrow> ('a \<times> 'a) set" (infixr "<*mlex*>" 80) |
1013 |
where "f <*mlex*> R = inv_image (less_than <*lex*> R) (\<lambda>x. (f x, x))" |
|
26748
4d51ddd6aa5c
Merged theories about wellfoundedness into one: Wellfounded.thy
krauss
parents:
diff
changeset
|
1014 |
|
66952 | 1015 |
lemma |
1016 |
wf_mlex: "wf R \<Longrightarrow> wf (f <*mlex*> R)" and |
|
1017 |
mlex_less: "f x < f y \<Longrightarrow> (x, y) \<in> f <*mlex*> R" and |
|
1018 |
mlex_leq: "f x \<le> f y \<Longrightarrow> (x, y) \<in> R \<Longrightarrow> (x, y) \<in> f <*mlex*> R" and |
|
1019 |
mlex_iff: "(x, y) \<in> f <*mlex*> R \<longleftrightarrow> f x < f y \<or> f x = f y \<and> (x, y) \<in> R" |
|
63572 | 1020 |
by (auto simp: mlex_prod_def) |
26748
4d51ddd6aa5c
Merged theories about wellfoundedness into one: Wellfounded.thy
krauss
parents:
diff
changeset
|
1021 |
|
63572 | 1022 |
text \<open>Proper subset relation on finite sets.\<close> |
63108 | 1023 |
definition finite_psubset :: "('a set \<times> 'a set) set" |
63572 | 1024 |
where "finite_psubset = {(A, B). A \<subset> B \<and> finite B}" |
26748
4d51ddd6aa5c
Merged theories about wellfoundedness into one: Wellfounded.thy
krauss
parents:
diff
changeset
|
1025 |
|
63108 | 1026 |
lemma wf_finite_psubset[simp]: "wf finite_psubset" |
1027 |
apply (unfold finite_psubset_def) |
|
1028 |
apply (rule wf_measure [THEN wf_subset]) |
|
1029 |
apply (simp add: measure_def inv_image_def less_than_def less_eq) |
|
1030 |
apply (fast elim!: psubset_card_mono) |
|
1031 |
done |
|
26748
4d51ddd6aa5c
Merged theories about wellfoundedness into one: Wellfounded.thy
krauss
parents:
diff
changeset
|
1032 |
|
4d51ddd6aa5c
Merged theories about wellfoundedness into one: Wellfounded.thy
krauss
parents:
diff
changeset
|
1033 |
lemma trans_finite_psubset: "trans finite_psubset" |
63612 | 1034 |
by (auto simp: finite_psubset_def less_le trans_def) |
26748
4d51ddd6aa5c
Merged theories about wellfoundedness into one: Wellfounded.thy
krauss
parents:
diff
changeset
|
1035 |
|
63572 | 1036 |
lemma in_finite_psubset[simp]: "(A, B) \<in> finite_psubset \<longleftrightarrow> A \<subset> B \<and> finite B" |
63108 | 1037 |
unfolding finite_psubset_def by auto |
26748
4d51ddd6aa5c
Merged theories about wellfoundedness into one: Wellfounded.thy
krauss
parents:
diff
changeset
|
1038 |
|
60758 | 1039 |
text \<open>max- and min-extension of order to finite sets\<close> |
28735
bed31381e6b6
min_ext/max_ext lifting wellfounded relations on finite sets. Preserves wf
krauss
parents:
28562
diff
changeset
|
1040 |
|
63108 | 1041 |
inductive_set max_ext :: "('a \<times> 'a) set \<Rightarrow> ('a set \<times> 'a set) set" |
1042 |
for R :: "('a \<times> 'a) set" |
|
63572 | 1043 |
where max_extI[intro]: |
1044 |
"finite X \<Longrightarrow> finite Y \<Longrightarrow> Y \<noteq> {} \<Longrightarrow> (\<And>x. x \<in> X \<Longrightarrow> \<exists>y\<in>Y. (x, y) \<in> R) \<Longrightarrow> (X, Y) \<in> max_ext R" |
|
28735
bed31381e6b6
min_ext/max_ext lifting wellfounded relations on finite sets. Preserves wf
krauss
parents:
28562
diff
changeset
|
1045 |
|
bed31381e6b6
min_ext/max_ext lifting wellfounded relations on finite sets. Preserves wf
krauss
parents:
28562
diff
changeset
|
1046 |
lemma max_ext_wf: |
bed31381e6b6
min_ext/max_ext lifting wellfounded relations on finite sets. Preserves wf
krauss
parents:
28562
diff
changeset
|
1047 |
assumes wf: "wf r" |
bed31381e6b6
min_ext/max_ext lifting wellfounded relations on finite sets. Preserves wf
krauss
parents:
28562
diff
changeset
|
1048 |
shows "wf (max_ext r)" |
bed31381e6b6
min_ext/max_ext lifting wellfounded relations on finite sets. Preserves wf
krauss
parents:
28562
diff
changeset
|
1049 |
proof (rule acc_wfI, intro allI) |
63915 | 1050 |
show "M \<in> acc (max_ext r)" (is "_ \<in> ?W") for M |
1051 |
proof (induct M rule: infinite_finite_induct) |
|
1052 |
case empty |
|
1053 |
show ?case |
|
1054 |
by (rule accI) (auto elim: max_ext.cases) |
|
1055 |
next |
|
1056 |
case (insert a M) |
|
1057 |
from wf \<open>M \<in> ?W\<close> \<open>finite M\<close> show "insert a M \<in> ?W" |
|
1058 |
proof (induct arbitrary: M) |
|
1059 |
fix M a |
|
1060 |
assume "M \<in> ?W" |
|
1061 |
assume [intro]: "finite M" |
|
1062 |
assume hyp: "\<And>b M. (b, a) \<in> r \<Longrightarrow> M \<in> ?W \<Longrightarrow> finite M \<Longrightarrow> insert b M \<in> ?W" |
|
1063 |
have add_less: "M \<in> ?W \<Longrightarrow> (\<And>y. y \<in> N \<Longrightarrow> (y, a) \<in> r) \<Longrightarrow> N \<union> M \<in> ?W" |
|
1064 |
if "finite N" "finite M" for N M :: "'a set" |
|
1065 |
using that by (induct N arbitrary: M) (auto simp: hyp) |
|
1066 |
show "insert a M \<in> ?W" |
|
1067 |
proof (rule accI) |
|
1068 |
fix N |
|
1069 |
assume Nless: "(N, insert a M) \<in> max_ext r" |
|
1070 |
then have *: "\<And>x. x \<in> N \<Longrightarrow> (x, a) \<in> r \<or> (\<exists>y \<in> M. (x, y) \<in> r)" |
|
1071 |
by (auto elim!: max_ext.cases) |
|
28735
bed31381e6b6
min_ext/max_ext lifting wellfounded relations on finite sets. Preserves wf
krauss
parents:
28562
diff
changeset
|
1072 |
|
63915 | 1073 |
let ?N1 = "{n \<in> N. (n, a) \<in> r}" |
1074 |
let ?N2 = "{n \<in> N. (n, a) \<notin> r}" |
|
1075 |
have N: "?N1 \<union> ?N2 = N" by (rule set_eqI) auto |
|
1076 |
from Nless have "finite N" by (auto elim: max_ext.cases) |
|
1077 |
then have finites: "finite ?N1" "finite ?N2" by auto |
|
63108 | 1078 |
|
63915 | 1079 |
have "?N2 \<in> ?W" |
1080 |
proof (cases "M = {}") |
|
1081 |
case [simp]: True |
|
1082 |
have Mw: "{} \<in> ?W" by (rule accI) (auto elim: max_ext.cases) |
|
1083 |
from * have "?N2 = {}" by auto |
|
1084 |
with Mw show "?N2 \<in> ?W" by (simp only:) |
|
1085 |
next |
|
1086 |
case False |
|
1087 |
from * finites have N2: "(?N2, M) \<in> max_ext r" |
|
75669
43f5dfb7fa35
tuned (some HOL lints, by Yecine Megdiche);
Fabian Huch <huch@in.tum.de>
parents:
74971
diff
changeset
|
1088 |
using max_extI[OF _ _ \<open>M \<noteq> {}\<close>, where ?X = ?N2] by auto |
63915 | 1089 |
with \<open>M \<in> ?W\<close> show "?N2 \<in> ?W" by (rule acc_downward) |
28735
bed31381e6b6
min_ext/max_ext lifting wellfounded relations on finite sets. Preserves wf
krauss
parents:
28562
diff
changeset
|
1090 |
qed |
63915 | 1091 |
with finites have "?N1 \<union> ?N2 \<in> ?W" |
1092 |
by (rule add_less) simp |
|
1093 |
then show "N \<in> ?W" by (simp only: N) |
|
28735
bed31381e6b6
min_ext/max_ext lifting wellfounded relations on finite sets. Preserves wf
krauss
parents:
28562
diff
changeset
|
1094 |
qed |
bed31381e6b6
min_ext/max_ext lifting wellfounded relations on finite sets. Preserves wf
krauss
parents:
28562
diff
changeset
|
1095 |
qed |
bed31381e6b6
min_ext/max_ext lifting wellfounded relations on finite sets. Preserves wf
krauss
parents:
28562
diff
changeset
|
1096 |
next |
63982 | 1097 |
case infinite |
1098 |
show ?case |
|
1099 |
by (rule accI) (auto elim: max_ext.cases simp: infinite) |
|
28735
bed31381e6b6
min_ext/max_ext lifting wellfounded relations on finite sets. Preserves wf
krauss
parents:
28562
diff
changeset
|
1100 |
qed |
bed31381e6b6
min_ext/max_ext lifting wellfounded relations on finite sets. Preserves wf
krauss
parents:
28562
diff
changeset
|
1101 |
qed |
bed31381e6b6
min_ext/max_ext lifting wellfounded relations on finite sets. Preserves wf
krauss
parents:
28562
diff
changeset
|
1102 |
|
63572 | 1103 |
lemma max_ext_additive: "(A, B) \<in> max_ext R \<Longrightarrow> (C, D) \<in> max_ext R \<Longrightarrow> (A \<union> C, B \<union> D) \<in> max_ext R" |
63108 | 1104 |
by (force elim!: max_ext.cases) |
29125
d41182a8135c
method "sizechange" proves termination of functions; added more infrastructure for termination proofs
krauss
parents:
28845
diff
changeset
|
1105 |
|
63108 | 1106 |
definition min_ext :: "('a \<times> 'a) set \<Rightarrow> ('a set \<times> 'a set) set" |
1107 |
where "min_ext r = {(X, Y) | X Y. X \<noteq> {} \<and> (\<forall>y \<in> Y. (\<exists>x \<in> X. (x, y) \<in> r))}" |
|
28735
bed31381e6b6
min_ext/max_ext lifting wellfounded relations on finite sets. Preserves wf
krauss
parents:
28562
diff
changeset
|
1108 |
|
bed31381e6b6
min_ext/max_ext lifting wellfounded relations on finite sets. Preserves wf
krauss
parents:
28562
diff
changeset
|
1109 |
lemma min_ext_wf: |
bed31381e6b6
min_ext/max_ext lifting wellfounded relations on finite sets. Preserves wf
krauss
parents:
28562
diff
changeset
|
1110 |
assumes "wf r" |
bed31381e6b6
min_ext/max_ext lifting wellfounded relations on finite sets. Preserves wf
krauss
parents:
28562
diff
changeset
|
1111 |
shows "wf (min_ext r)" |
bed31381e6b6
min_ext/max_ext lifting wellfounded relations on finite sets. Preserves wf
krauss
parents:
28562
diff
changeset
|
1112 |
proof (rule wfI_min) |
66952 | 1113 |
show "\<exists>m \<in> Q. (\<forall>n. (n, m) \<in> min_ext r \<longrightarrow> n \<notin> Q)" if nonempty: "x \<in> Q" |
63108 | 1114 |
for Q :: "'a set set" and x |
1115 |
proof (cases "Q = {{}}") |
|
1116 |
case True |
|
1117 |
then show ?thesis by (simp add: min_ext_def) |
|
28735
bed31381e6b6
min_ext/max_ext lifting wellfounded relations on finite sets. Preserves wf
krauss
parents:
28562
diff
changeset
|
1118 |
next |
63108 | 1119 |
case False |
1120 |
with nonempty obtain e x where "x \<in> Q" "e \<in> x" by force |
|
28735
bed31381e6b6
min_ext/max_ext lifting wellfounded relations on finite sets. Preserves wf
krauss
parents:
28562
diff
changeset
|
1121 |
then have eU: "e \<in> \<Union>Q" by auto |
63108 | 1122 |
with \<open>wf r\<close> |
1123 |
obtain z where z: "z \<in> \<Union>Q" "\<And>y. (y, z) \<in> r \<Longrightarrow> y \<notin> \<Union>Q" |
|
28735
bed31381e6b6
min_ext/max_ext lifting wellfounded relations on finite sets. Preserves wf
krauss
parents:
28562
diff
changeset
|
1124 |
by (erule wfE_min) |
bed31381e6b6
min_ext/max_ext lifting wellfounded relations on finite sets. Preserves wf
krauss
parents:
28562
diff
changeset
|
1125 |
from z obtain m where "m \<in> Q" "z \<in> m" by auto |
63572 | 1126 |
from \<open>m \<in> Q\<close> show ?thesis |
1127 |
proof (intro rev_bexI allI impI) |
|
28735
bed31381e6b6
min_ext/max_ext lifting wellfounded relations on finite sets. Preserves wf
krauss
parents:
28562
diff
changeset
|
1128 |
fix n |
bed31381e6b6
min_ext/max_ext lifting wellfounded relations on finite sets. Preserves wf
krauss
parents:
28562
diff
changeset
|
1129 |
assume smaller: "(n, m) \<in> min_ext r" |
63572 | 1130 |
with \<open>z \<in> m\<close> obtain y where "y \<in> n" "(y, z) \<in> r" |
1131 |
by (auto simp: min_ext_def) |
|
1132 |
with z(2) show "n \<notin> Q" by auto |
|
63108 | 1133 |
qed |
28735
bed31381e6b6
min_ext/max_ext lifting wellfounded relations on finite sets. Preserves wf
krauss
parents:
28562
diff
changeset
|
1134 |
qed |
bed31381e6b6
min_ext/max_ext lifting wellfounded relations on finite sets. Preserves wf
krauss
parents:
28562
diff
changeset
|
1135 |
qed |
26748
4d51ddd6aa5c
Merged theories about wellfoundedness into one: Wellfounded.thy
krauss
parents:
diff
changeset
|
1136 |
|
63108 | 1137 |
|
1138 |
subsubsection \<open>Bounded increase must terminate\<close> |
|
43137 | 1139 |
|
1140 |
lemma wf_bounded_measure: |
|
63108 | 1141 |
fixes ub :: "'a \<Rightarrow> nat" |
1142 |
and f :: "'a \<Rightarrow> nat" |
|
1143 |
assumes "\<And>a b. (b, a) \<in> r \<Longrightarrow> ub b \<le> ub a \<and> ub a \<ge> f b \<and> f b > f a" |
|
1144 |
shows "wf r" |
|
63572 | 1145 |
by (rule wf_subset[OF wf_measure[of "\<lambda>a. ub a - f a"]]) (auto dest: assms) |
43137 | 1146 |
|
1147 |
lemma wf_bounded_set: |
|
63108 | 1148 |
fixes ub :: "'a \<Rightarrow> 'b set" |
1149 |
and f :: "'a \<Rightarrow> 'b set" |
|
1150 |
assumes "\<And>a b. (b,a) \<in> r \<Longrightarrow> finite (ub a) \<and> ub b \<subseteq> ub a \<and> ub a \<supseteq> f b \<and> f b \<supset> f a" |
|
1151 |
shows "wf r" |
|
63572 | 1152 |
apply (rule wf_bounded_measure[of r "\<lambda>a. card (ub a)" "\<lambda>a. card (f a)"]) |
1153 |
apply (drule assms) |
|
63108 | 1154 |
apply (blast intro: card_mono finite_subset psubset_card_mono dest: psubset_eq[THEN iffD2]) |
1155 |
done |
|
43137 | 1156 |
|
63099
af0e964aad7b
Moved material from AFP/Randomised_Social_Choice to distribution
eberlm
parents:
63088
diff
changeset
|
1157 |
lemma finite_subset_wf: |
af0e964aad7b
Moved material from AFP/Randomised_Social_Choice to distribution
eberlm
parents:
63088
diff
changeset
|
1158 |
assumes "finite A" |
66952 | 1159 |
shows "wf {(X, Y). X \<subset> Y \<and> Y \<subseteq> A}" |
1160 |
by (rule wf_subset[OF wf_finite_psubset[unfolded finite_psubset_def]]) |
|
1161 |
(auto intro: finite_subset[OF _ assms]) |
|
26748
4d51ddd6aa5c
Merged theories about wellfoundedness into one: Wellfounded.thy
krauss
parents:
diff
changeset
|
1162 |
|
54295 | 1163 |
hide_const (open) acc accp |
1164 |
||
26748
4d51ddd6aa5c
Merged theories about wellfoundedness into one: Wellfounded.thy
krauss
parents:
diff
changeset
|
1165 |
end |