
nipkow@15737: (*  Title:      HOL/Library/Product_ord.thy
nipkow@15737:     ID:         $Id$
nipkow@15737:     Author:     Norbert Voelker
nipkow@15737: *)
nipkow@15737: 
wenzelm@17200: header {* Order on product types *}
nipkow@15737: 
nipkow@15737: theory Product_ord
haftmann@25691: imports ATP_Linkup
nipkow@15737: begin
nipkow@15737: 
haftmann@25571: instantiation "*" :: (ord, ord) ord
haftmann@25571: begin
haftmann@25571: 
haftmann@25571: definition
haftmann@25502:   prod_le_def [code func del]: "x \<le> y \<longleftrightarrow> fst x < fst y \<or> fst x = fst y \<and> snd x \<le> snd y"
haftmann@25571: 
haftmann@25571: definition
haftmann@25571:   prod_less_def [code func del]: "x < y \<longleftrightarrow> fst x < fst y \<or> fst x = fst y \<and> snd x < snd y"
haftmann@25571: 
haftmann@25571: instance ..
haftmann@25571: 
haftmann@25571: end
nipkow@15737: 
haftmann@26993: lemma [code, code func del]:
haftmann@26993:   "(x1, y1) \<le> (x2, y2) \<longleftrightarrow> x1 < x2 \<or> x1 = x2 \<and> y1 \<le> y2"
haftmann@26993:   "(x1, y1) < (x2, y2) \<longleftrightarrow> x1 < x2 \<or> x1 = x2 \<and> y1 < y2"
haftmann@26993:   unfolding prod_le_def prod_less_def by simp_all
haftmann@26993: 
haftmann@22177: lemma [code func]:
haftmann@22177:   "(x1\<Colon>'a\<Colon>{ord, eq}, y1) \<le> (x2, y2) \<longleftrightarrow> x1 < x2 \<or> x1 = x2 \<and> y1 \<le> y2"
haftmann@22177:   "(x1\<Colon>'a\<Colon>{ord, eq}, y1) < (x2, y2) \<longleftrightarrow> x1 < x2 \<or> x1 = x2 \<and> y1 < y2"
haftmann@25502:   unfolding prod_le_def prod_less_def by simp_all
haftmann@22177: 
wenzelm@19736: instance * :: (order, order) order
haftmann@25502:   by default (auto simp: prod_le_def prod_less_def intro: order_less_trans)
nipkow@15737: 
wenzelm@19736: instance * :: (linorder, linorder) linorder
wenzelm@19736:   by default (auto simp: prod_le_def)
nipkow@15737: 
haftmann@25571: instantiation * :: (linorder, linorder) distrib_lattice
haftmann@25571: begin
haftmann@25571: 
haftmann@25571: definition
haftmann@25502:   inf_prod_def: "(inf \<Colon> 'a \<times> 'b \<Rightarrow> _ \<Rightarrow> _) = min"
haftmann@25571: 
haftmann@25571: definition
haftmann@25502:   sup_prod_def: "(sup \<Colon> 'a \<times> 'b \<Rightarrow> _ \<Rightarrow> _) = max"
haftmann@25571: 
haftmann@25571: instance
haftmann@22483:   by intro_classes
haftmann@22483:     (auto simp add: inf_prod_def sup_prod_def min_max.sup_inf_distrib1)
haftmann@22483: 
wenzelm@19736: end
haftmann@25571: 
haftmann@25571: end




