src/HOL/BNF_Wellorder_Constructions.thy
changeset 61799 4cf66f21b764
parent 60758 d8d85a8172b5
child 61943 7fba644ed827
equal deleted inserted replaced
61798:27f3c10b0b50 61799:4cf66f21b764
    12 begin
    12 begin
    13 
    13 
    14 text \<open>In this section, we study basic constructions on well-orders, such as restriction to
    14 text \<open>In this section, we study basic constructions on well-orders, such as restriction to
    15 a set/order filter, copy via direct images, ordinal-like sum of disjoint well-orders,
    15 a set/order filter, copy via direct images, ordinal-like sum of disjoint well-orders,
    16 and bounded square.  We also define between well-orders
    16 and bounded square.  We also define between well-orders
    17 the relations @{text "ordLeq"}, of being embedded (abbreviated @{text "\<le>o"}),
    17 the relations \<open>ordLeq\<close>, of being embedded (abbreviated \<open>\<le>o\<close>),
    18 @{text "ordLess"}, of being strictly embedded (abbreviated @{text "<o"}), and
    18 \<open>ordLess\<close>, of being strictly embedded (abbreviated \<open><o\<close>), and
    19 @{text "ordIso"}, of being isomorphic (abbreviated @{text "=o"}).  We study the
    19 \<open>ordIso\<close>, of being isomorphic (abbreviated \<open>=o\<close>).  We study the
    20 connections between these relations, order filters, and the aforementioned constructions.
    20 connections between these relations, order filters, and the aforementioned constructions.
    21 A main result of this section is that @{text "<o"} is well-founded.\<close>
    21 A main result of this section is that \<open><o\<close> is well-founded.\<close>
    22 
    22 
    23 
    23 
    24 subsection \<open>Restriction to a set\<close>
    24 subsection \<open>Restriction to a set\<close>
    25 
    25 
    26 abbreviation Restr :: "'a rel \<Rightarrow> 'a set \<Rightarrow> 'a rel"
    26 abbreviation Restr :: "'a rel \<Rightarrow> 'a set \<Rightarrow> 'a rel"
   304 
   304 
   305 subsection \<open>Ordering the well-orders by existence of embeddings\<close>
   305 subsection \<open>Ordering the well-orders by existence of embeddings\<close>
   306 
   306 
   307 text \<open>We define three relations between well-orders:
   307 text \<open>We define three relations between well-orders:
   308 \begin{itemize}
   308 \begin{itemize}
   309 \item @{text "ordLeq"}, of being embedded (abbreviated @{text "\<le>o"});
   309 \item \<open>ordLeq\<close>, of being embedded (abbreviated \<open>\<le>o\<close>);
   310 \item @{text "ordLess"}, of being strictly embedded (abbreviated @{text "<o"});
   310 \item \<open>ordLess\<close>, of being strictly embedded (abbreviated \<open><o\<close>);
   311 \item @{text "ordIso"}, of being isomorphic (abbreviated @{text "=o"}).
   311 \item \<open>ordIso\<close>, of being isomorphic (abbreviated \<open>=o\<close>).
   312 \end{itemize}
   312 \end{itemize}
   313 %
   313 %
   314 The prefix "ord" and the index "o" in these names stand for "ordinal-like".
   314 The prefix "ord" and the index "o" in these names stand for "ordinal-like".
   315 These relations shall be proved to be inter-connected in a similar fashion as the trio
   315 These relations shall be proved to be inter-connected in a similar fashion as the trio
   316 @{text "\<le>"}, @{text "<"}, @{text "="} associated to a total order on a set.
   316 \<open>\<le>\<close>, \<open><\<close>, \<open>=\<close> associated to a total order on a set.
   317 \<close>
   317 \<close>
   318 
   318 
   319 definition ordLeq :: "('a rel * 'a' rel) set"
   319 definition ordLeq :: "('a rel * 'a' rel) set"
   320 where
   320 where
   321 "ordLeq = {(r,r'). Well_order r \<and> Well_order r' \<and> (\<exists>f. embed r r' f)}"
   321 "ordLeq = {(r,r'). Well_order r \<and> Well_order r' \<and> (\<exists>f. embed r r' f)}"
   345 lemma ordLeq_Well_order_simp:
   345 lemma ordLeq_Well_order_simp:
   346 assumes "r \<le>o r'"
   346 assumes "r \<le>o r'"
   347 shows "Well_order r \<and> Well_order r'"
   347 shows "Well_order r \<and> Well_order r'"
   348 using assms unfolding ordLeq_def by simp
   348 using assms unfolding ordLeq_def by simp
   349 
   349 
   350 text\<open>Notice that the relations @{text "\<le>o"}, @{text "<o"}, @{text "=o"} connect well-orders
   350 text\<open>Notice that the relations \<open>\<le>o\<close>, \<open><o\<close>, \<open>=o\<close> connect well-orders
   351 on potentially {\em distinct} types. However, some of the lemmas below, including the next one,
   351 on potentially {\em distinct} types. However, some of the lemmas below, including the next one,
   352 restrict implicitly the type of these relations to @{text "(('a rel) * ('a rel)) set"} , i.e.,
   352 restrict implicitly the type of these relations to \<open>(('a rel) * ('a rel)) set\<close> , i.e.,
   353 to @{text "'a rel rel"}.\<close>
   353 to \<open>'a rel rel\<close>.\<close>
   354 
   354 
   355 lemma ordLeq_reflexive:
   355 lemma ordLeq_reflexive:
   356 "Well_order r \<Longrightarrow> r \<le>o r"
   356 "Well_order r \<Longrightarrow> r \<le>o r"
   357 unfolding ordLeq_def using id_embed[of r] by blast
   357 unfolding ordLeq_def using id_embed[of r] by blast
   358 
   358 
   820     thus "r =o r'" unfolding ordIso_def iso_def[abs_def] using 1 2 by auto
   820     thus "r =o r'" unfolding ordIso_def iso_def[abs_def] using 1 2 by auto
   821   qed
   821   qed
   822   ultimately show ?thesis using assms ordLeq_total ordIso_symmetric by blast
   822   ultimately show ?thesis using assms ordLeq_total ordIso_symmetric by blast
   823 qed
   823 qed
   824 
   824 
   825 subsection\<open>@{text "<o"} is well-founded\<close>
   825 subsection\<open>\<open><o\<close> is well-founded\<close>
   826 
   826 
   827 text \<open>Of course, it only makes sense to state that the @{text "<o"} is well-founded
   827 text \<open>Of course, it only makes sense to state that the \<open><o\<close> is well-founded
   828 on the restricted type @{text "'a rel rel"}.  We prove this by first showing that, for any set
   828 on the restricted type \<open>'a rel rel\<close>.  We prove this by first showing that, for any set
   829 of well-orders all embedded in a fixed well-order, the function mapping each well-order
   829 of well-orders all embedded in a fixed well-order, the function mapping each well-order
   830 in the set to an order filter of the fixed well-order is compatible w.r.t. to @{text "<o"} versus
   830 in the set to an order filter of the fixed well-order is compatible w.r.t. to \<open><o\<close> versus
   831 {\em strict inclusion}; and we already know that strict inclusion of order filters is well-founded.\<close>
   831 {\em strict inclusion}; and we already know that strict inclusion of order filters is well-founded.\<close>
   832 
   832 
   833 definition ord_to_filter :: "'a rel \<Rightarrow> 'a rel \<Rightarrow> 'a set"
   833 definition ord_to_filter :: "'a rel \<Rightarrow> 'a rel \<Rightarrow> 'a set"
   834 where "ord_to_filter r0 r \<equiv> (SOME f. embed r r0 f) ` (Field r)"
   834 where "ord_to_filter r0 r \<equiv> (SOME f. embed r r0 f) ` (Field r)"
   835 
   835 
   883 qed
   883 qed
   884 
   884 
   885 
   885 
   886 subsection \<open>Copy via direct images\<close>
   886 subsection \<open>Copy via direct images\<close>
   887 
   887 
   888 text\<open>The direct image operator is the dual of the inverse image operator @{text "inv_image"}
   888 text\<open>The direct image operator is the dual of the inverse image operator \<open>inv_image\<close>
   889 from @{text "Relation.thy"}.  It is useful for transporting a well-order between
   889 from \<open>Relation.thy\<close>.  It is useful for transporting a well-order between
   890 different types.\<close>
   890 different types.\<close>
   891 
   891 
   892 definition dir_image :: "'a rel \<Rightarrow> ('a \<Rightarrow> 'a') \<Rightarrow> 'a' rel"
   892 definition dir_image :: "'a rel \<Rightarrow> ('a \<Rightarrow> 'a') \<Rightarrow> 'a' rel"
   893 where
   893 where
   894 "dir_image r f = {(f a, f b)| a b. (a,b) \<in> r}"
   894 "dir_image r f = {(f a, f b)| a b. (a,b) \<in> r}"
  1043 qed
  1043 qed
  1044 
  1044 
  1045 
  1045 
  1046 subsection \<open>Bounded square\<close>
  1046 subsection \<open>Bounded square\<close>
  1047 
  1047 
  1048 text\<open>This construction essentially defines, for an order relation @{text "r"}, a lexicographic
  1048 text\<open>This construction essentially defines, for an order relation \<open>r\<close>, a lexicographic
  1049 order @{text "bsqr r"} on @{text "(Field r) \<times> (Field r)"}, applying the
  1049 order \<open>bsqr r\<close> on \<open>(Field r) \<times> (Field r)\<close>, applying the
  1050 following criteria (in this order):
  1050 following criteria (in this order):
  1051 \begin{itemize}
  1051 \begin{itemize}
  1052 \item compare the maximums;
  1052 \item compare the maximums;
  1053 \item compare the first components;
  1053 \item compare the first components;
  1054 \item compare the second components.
  1054 \item compare the second components.