src/HOL/Library/Product_ord.thy
author haftmann
Mon, 08 Feb 2010 14:06:41 +0100
changeset 35032 7efe662e41b4
parent 31040 996ae76c9eda
child 37678 0040bafffdef
permissions -rw-r--r--
separate library theory for type classes combining lattices with various algebraic structures
Ignore whitespace changes - Everywhere: Within whitespace: At end of lines:
15737
nipkow
parents:
diff changeset
     1
(*  Title:      HOL/Library/Product_ord.thy
nipkow
parents:
diff changeset
     2
    Author:     Norbert Voelker
nipkow
parents:
diff changeset
     3
*)
nipkow
parents:
diff changeset
     4
17200
3a4d03d1a31b tuned presentation;
wenzelm
parents: 15737
diff changeset
     5
header {* Order on product types *}
15737
nipkow
parents:
diff changeset
     6
nipkow
parents:
diff changeset
     7
theory Product_ord
30738
0842e906300c normalized imports
haftmann
parents: 28562
diff changeset
     8
imports Main
15737
nipkow
parents:
diff changeset
     9
begin
nipkow
parents:
diff changeset
    10
25571
c9e39eafc7a0 instantiation target rather than legacy instance
haftmann
parents: 25502
diff changeset
    11
instantiation "*" :: (ord, ord) ord
c9e39eafc7a0 instantiation target rather than legacy instance
haftmann
parents: 25502
diff changeset
    12
begin
c9e39eafc7a0 instantiation target rather than legacy instance
haftmann
parents: 25502
diff changeset
    13
c9e39eafc7a0 instantiation target rather than legacy instance
haftmann
parents: 25502
diff changeset
    14
definition
31040
996ae76c9eda compatible with preorder; bot and top instances
haftmann
parents: 30738
diff changeset
    15
  prod_le_def [code del]: "x \<le> y \<longleftrightarrow> fst x < fst y \<or> fst x \<le> fst y \<and> snd x \<le> snd y"
25571
c9e39eafc7a0 instantiation target rather than legacy instance
haftmann
parents: 25502
diff changeset
    16
c9e39eafc7a0 instantiation target rather than legacy instance
haftmann
parents: 25502
diff changeset
    17
definition
31040
996ae76c9eda compatible with preorder; bot and top instances
haftmann
parents: 30738
diff changeset
    18
  prod_less_def [code del]: "x < y \<longleftrightarrow> fst x < fst y \<or> fst x \<le> fst y \<and> snd x < snd y"
25571
c9e39eafc7a0 instantiation target rather than legacy instance
haftmann
parents: 25502
diff changeset
    19
c9e39eafc7a0 instantiation target rather than legacy instance
haftmann
parents: 25502
diff changeset
    20
instance ..
c9e39eafc7a0 instantiation target rather than legacy instance
haftmann
parents: 25502
diff changeset
    21
c9e39eafc7a0 instantiation target rather than legacy instance
haftmann
parents: 25502
diff changeset
    22
end
15737
nipkow
parents:
diff changeset
    23
28562
4e74209f113e `code func` now just `code`
haftmann
parents: 28519
diff changeset
    24
lemma [code]:
31040
996ae76c9eda compatible with preorder; bot and top instances
haftmann
parents: 30738
diff changeset
    25
  "(x1\<Colon>'a\<Colon>{ord, eq}, y1) \<le> (x2, y2) \<longleftrightarrow> x1 < x2 \<or> x1 \<le> x2 \<and> y1 \<le> y2"
996ae76c9eda compatible with preorder; bot and top instances
haftmann
parents: 30738
diff changeset
    26
  "(x1\<Colon>'a\<Colon>{ord, eq}, y1) < (x2, y2) \<longleftrightarrow> x1 < x2 \<or> x1 \<le> x2 \<and> y1 < y2"
25502
9200b36280c0 instance command as rudimentary class target
haftmann
parents: 22845
diff changeset
    27
  unfolding prod_le_def prod_less_def by simp_all
22177
515021e98684 improved
haftmann
parents: 21458
diff changeset
    28
31040
996ae76c9eda compatible with preorder; bot and top instances
haftmann
parents: 30738
diff changeset
    29
instance * :: (preorder, preorder) preorder proof
996ae76c9eda compatible with preorder; bot and top instances
haftmann
parents: 30738
diff changeset
    30
qed (auto simp: prod_le_def prod_less_def less_le_not_le intro: order_trans)
15737
nipkow
parents:
diff changeset
    31
31040
996ae76c9eda compatible with preorder; bot and top instances
haftmann
parents: 30738
diff changeset
    32
instance * :: (order, order) order proof
996ae76c9eda compatible with preorder; bot and top instances
haftmann
parents: 30738
diff changeset
    33
qed (auto simp add: prod_le_def)
996ae76c9eda compatible with preorder; bot and top instances
haftmann
parents: 30738
diff changeset
    34
996ae76c9eda compatible with preorder; bot and top instances
haftmann
parents: 30738
diff changeset
    35
instance * :: (linorder, linorder) linorder proof
996ae76c9eda compatible with preorder; bot and top instances
haftmann
parents: 30738
diff changeset
    36
qed (auto simp: prod_le_def)
15737
nipkow
parents:
diff changeset
    37
25571
c9e39eafc7a0 instantiation target rather than legacy instance
haftmann
parents: 25502
diff changeset
    38
instantiation * :: (linorder, linorder) distrib_lattice
c9e39eafc7a0 instantiation target rather than legacy instance
haftmann
parents: 25502
diff changeset
    39
begin
c9e39eafc7a0 instantiation target rather than legacy instance
haftmann
parents: 25502
diff changeset
    40
c9e39eafc7a0 instantiation target rather than legacy instance
haftmann
parents: 25502
diff changeset
    41
definition
25502
9200b36280c0 instance command as rudimentary class target
haftmann
parents: 22845
diff changeset
    42
  inf_prod_def: "(inf \<Colon> 'a \<times> 'b \<Rightarrow> _ \<Rightarrow> _) = min"
25571
c9e39eafc7a0 instantiation target rather than legacy instance
haftmann
parents: 25502
diff changeset
    43
c9e39eafc7a0 instantiation target rather than legacy instance
haftmann
parents: 25502
diff changeset
    44
definition
25502
9200b36280c0 instance command as rudimentary class target
haftmann
parents: 22845
diff changeset
    45
  sup_prod_def: "(sup \<Colon> 'a \<times> 'b \<Rightarrow> _ \<Rightarrow> _) = max"
25571
c9e39eafc7a0 instantiation target rather than legacy instance
haftmann
parents: 25502
diff changeset
    46
31040
996ae76c9eda compatible with preorder; bot and top instances
haftmann
parents: 30738
diff changeset
    47
instance proof
996ae76c9eda compatible with preorder; bot and top instances
haftmann
parents: 30738
diff changeset
    48
qed (auto simp add: inf_prod_def sup_prod_def min_max.sup_inf_distrib1)
996ae76c9eda compatible with preorder; bot and top instances
haftmann
parents: 30738
diff changeset
    49
996ae76c9eda compatible with preorder; bot and top instances
haftmann
parents: 30738
diff changeset
    50
end
996ae76c9eda compatible with preorder; bot and top instances
haftmann
parents: 30738
diff changeset
    51
996ae76c9eda compatible with preorder; bot and top instances
haftmann
parents: 30738
diff changeset
    52
instantiation * :: (bot, bot) bot
996ae76c9eda compatible with preorder; bot and top instances
haftmann
parents: 30738
diff changeset
    53
begin
996ae76c9eda compatible with preorder; bot and top instances
haftmann
parents: 30738
diff changeset
    54
996ae76c9eda compatible with preorder; bot and top instances
haftmann
parents: 30738
diff changeset
    55
definition
996ae76c9eda compatible with preorder; bot and top instances
haftmann
parents: 30738
diff changeset
    56
  bot_prod_def: "bot = (bot, bot)"
996ae76c9eda compatible with preorder; bot and top instances
haftmann
parents: 30738
diff changeset
    57
996ae76c9eda compatible with preorder; bot and top instances
haftmann
parents: 30738
diff changeset
    58
instance proof
996ae76c9eda compatible with preorder; bot and top instances
haftmann
parents: 30738
diff changeset
    59
qed (auto simp add: bot_prod_def prod_le_def)
996ae76c9eda compatible with preorder; bot and top instances
haftmann
parents: 30738
diff changeset
    60
996ae76c9eda compatible with preorder; bot and top instances
haftmann
parents: 30738
diff changeset
    61
end
996ae76c9eda compatible with preorder; bot and top instances
haftmann
parents: 30738
diff changeset
    62
996ae76c9eda compatible with preorder; bot and top instances
haftmann
parents: 30738
diff changeset
    63
instantiation * :: (top, top) top
996ae76c9eda compatible with preorder; bot and top instances
haftmann
parents: 30738
diff changeset
    64
begin
996ae76c9eda compatible with preorder; bot and top instances
haftmann
parents: 30738
diff changeset
    65
996ae76c9eda compatible with preorder; bot and top instances
haftmann
parents: 30738
diff changeset
    66
definition
996ae76c9eda compatible with preorder; bot and top instances
haftmann
parents: 30738
diff changeset
    67
  top_prod_def: "top = (top, top)"
996ae76c9eda compatible with preorder; bot and top instances
haftmann
parents: 30738
diff changeset
    68
996ae76c9eda compatible with preorder; bot and top instances
haftmann
parents: 30738
diff changeset
    69
instance proof
996ae76c9eda compatible with preorder; bot and top instances
haftmann
parents: 30738
diff changeset
    70
qed (auto simp add: top_prod_def prod_le_def)
22483
86064f2f2188 added instance for lattice
haftmann
parents: 22177
diff changeset
    71
19736
wenzelm
parents: 17200
diff changeset
    72
end
25571
c9e39eafc7a0 instantiation target rather than legacy instance
haftmann
parents: 25502
diff changeset
    73
c9e39eafc7a0 instantiation target rather than legacy instance
haftmann
parents: 25502
diff changeset
    74
end