src/HOL/Analysis/Finite_Cartesian_Product.thy
changeset 69663 41ff40bf1530
parent 69597 ff784d5a5bfb
child 69668 14a8cac10eac
equal deleted inserted replaced
69661:a03a63b81f44 69663:41ff40bf1530
   257 
   257 
   258 end
   258 end
   259 
   259 
   260 text\<open>The ordering on one-dimensional vectors is linear.\<close>
   260 text\<open>The ordering on one-dimensional vectors is linear.\<close>
   261 
   261 
   262 class cart_one =
       
   263   assumes UNIV_one: "card (UNIV :: 'a set) = Suc 0"
       
   264 begin
       
   265 
       
   266 subclass finite
       
   267 proof
       
   268   from UNIV_one show "finite (UNIV :: 'a set)"
       
   269     by (auto intro!: card_ge_0_finite)
       
   270 qed
       
   271 
       
   272 end
       
   273 
       
   274 instance vec:: (order, finite) order
   262 instance vec:: (order, finite) order
   275   by standard (auto simp: less_eq_vec_def less_vec_def vec_eq_iff
   263   by standard (auto simp: less_eq_vec_def less_vec_def vec_eq_iff
   276       intro: order.trans order.antisym order.strict_implies_order)
   264       intro: order.trans order.antisym order.strict_implies_order)
   277 
   265 
   278 instance vec :: (linorder, cart_one) linorder
   266 instance vec :: (linorder, CARD_1) linorder
   279 proof
   267 proof
   280   obtain a :: 'b where all: "\<And>P. (\<forall>i. P i) \<longleftrightarrow> P a"
   268   obtain a :: 'b where all: "\<And>P. (\<forall>i. P i) \<longleftrightarrow> P a"
   281   proof -
   269   proof -
   282     have "card (UNIV :: 'b set) = Suc 0" by (rule UNIV_one)
   270     have "CARD ('b) = 1" by (rule CARD_1)
   283     then obtain b :: 'b where "UNIV = {b}" by (auto iff: card_Suc_eq)
   271     then obtain b :: 'b where "UNIV = {b}" by (auto iff: card_Suc_eq)
   284     then have "\<And>P. (\<forall>i\<in>UNIV. P i) \<longleftrightarrow> P b" by auto
   272     then have "\<And>P. (\<forall>i\<in>UNIV. P i) \<longleftrightarrow> P b" by auto
   285     then show thesis by (auto intro: that)
   273     then show thesis by (auto intro: that)
   286   qed
   274   qed
   287   fix x y :: "'a^'b::cart_one"
   275   fix x y :: "'a^'b::CARD_1"
   288   note [simp] = less_eq_vec_def less_vec_def all vec_eq_iff field_simps
   276   note [simp] = less_eq_vec_def less_vec_def all vec_eq_iff field_simps
   289   show "x \<le> y \<or> y \<le> x" by auto
   277   show "x \<le> y \<or> y \<le> x" by auto
   290 qed
   278 qed
   291 
   279 
   292 text\<open>Constant Vectors\<close>
   280 text\<open>Constant Vectors\<close>