Precedence_ord.thy
author Christian Urban <christian dot urban at kcl dot ac dot uk>
Tue, 04 Mar 2014 08:45:11 +0000
changeset 23 24e6884d9258
parent 0 110247f9d47e
child 33 9b9f2117561f
permissions -rw-r--r--
made some small chages
Ignore whitespace changes - Everywhere: Within whitespace: At end of lines:
0
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
diff changeset
     1
header {* Order on product types *}
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
diff changeset
     2
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
diff changeset
     3
theory Precedence_ord
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
diff changeset
     4
imports Main
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
diff changeset
     5
begin
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
diff changeset
     6
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
diff changeset
     7
datatype precedence = Prc nat nat
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
diff changeset
     8
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
diff changeset
     9
instantiation precedence :: order
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
diff changeset
    10
begin
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
diff changeset
    11
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
diff changeset
    12
definition
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
diff changeset
    13
  precedence_le_def: "x \<le> y \<longleftrightarrow> (case (x, y) of
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
diff changeset
    14
                                   (Prc fx sx, Prc fy sy) \<Rightarrow> 
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
diff changeset
    15
                                 fx < fy \<or> (fx \<le> fy \<and> sy \<le> sx))"
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
diff changeset
    16
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
diff changeset
    17
definition
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
diff changeset
    18
  precedence_less_def: "x < y \<longleftrightarrow> (case (x, y) of
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
diff changeset
    19
                               (Prc fx sx, Prc fy sy) \<Rightarrow> 
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
diff changeset
    20
                                     fx < fy \<or> (fx \<le> fy \<and> sy < sx))"
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
diff changeset
    21
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
diff changeset
    22
instance
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
diff changeset
    23
proof
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
diff changeset
    24
qed (auto simp: precedence_le_def precedence_less_def 
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
diff changeset
    25
              intro: order_trans split:precedence.splits)
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
diff changeset
    26
end
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
diff changeset
    27
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
diff changeset
    28
instance precedence :: preorder ..
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
diff changeset
    29
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
diff changeset
    30
instance precedence :: linorder proof
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
diff changeset
    31
qed (auto simp: precedence_le_def precedence_less_def 
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
diff changeset
    32
              intro: order_trans split:precedence.splits)
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
diff changeset
    33
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
diff changeset
    34
end