Precedence_ord.thy
author Christian Urban <urbanc@in.tum.de>
Wed, 02 Jan 2019 21:09:05 +0000
changeset 208 a5afc26b1d62
parent 197 ca4ddf26a7c7
permissions -rw-r--r--
final version
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
theory Precedence_ord
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
diff changeset
     2
imports Main
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
diff changeset
     3
begin
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
diff changeset
     4
197
ca4ddf26a7c7 updated to Isabelle 2016-1
Christian Urban <urbanc@in.tum.de>
parents: 63
diff changeset
     5
section {* Order on product types *}
ca4ddf26a7c7 updated to Isabelle 2016-1
Christian Urban <urbanc@in.tum.de>
parents: 63
diff changeset
     6
0
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
63
b620a2a0806a ExtGG.thy finished, but more comments are needed.
zhangx
parents: 33
diff changeset
    17
lemma preced_leI1[intro]: 
b620a2a0806a ExtGG.thy finished, but more comments are needed.
zhangx
parents: 33
diff changeset
    18
  assumes "fx < fy"
b620a2a0806a ExtGG.thy finished, but more comments are needed.
zhangx
parents: 33
diff changeset
    19
  shows "Prc fx sx \<le> Prc fy sy"
b620a2a0806a ExtGG.thy finished, but more comments are needed.
zhangx
parents: 33
diff changeset
    20
  using assms
b620a2a0806a ExtGG.thy finished, but more comments are needed.
zhangx
parents: 33
diff changeset
    21
  by (simp add: precedence_le_def) 
b620a2a0806a ExtGG.thy finished, but more comments are needed.
zhangx
parents: 33
diff changeset
    22
b620a2a0806a ExtGG.thy finished, but more comments are needed.
zhangx
parents: 33
diff changeset
    23
lemma preced_leI2[intro]: 
b620a2a0806a ExtGG.thy finished, but more comments are needed.
zhangx
parents: 33
diff changeset
    24
  assumes "fx \<le> fy"
b620a2a0806a ExtGG.thy finished, but more comments are needed.
zhangx
parents: 33
diff changeset
    25
  and "sy \<le> sx"
b620a2a0806a ExtGG.thy finished, but more comments are needed.
zhangx
parents: 33
diff changeset
    26
  shows "Prc fx sx \<le> Prc fy sy"
b620a2a0806a ExtGG.thy finished, but more comments are needed.
zhangx
parents: 33
diff changeset
    27
  using assms
b620a2a0806a ExtGG.thy finished, but more comments are needed.
zhangx
parents: 33
diff changeset
    28
  by (simp add: precedence_le_def) 
b620a2a0806a ExtGG.thy finished, but more comments are needed.
zhangx
parents: 33
diff changeset
    29
0
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
diff changeset
    30
definition
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
diff changeset
    31
  precedence_less_def: "x < y \<longleftrightarrow> (case (x, y) of
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
diff changeset
    32
                               (Prc fx sx, Prc fy sy) \<Rightarrow> 
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
diff changeset
    33
                                     fx < fy \<or> (fx \<le> fy \<and> sy < sx))"
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
diff changeset
    34
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
diff changeset
    35
instance
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
diff changeset
    36
proof
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
diff changeset
    37
qed (auto simp: precedence_le_def precedence_less_def 
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
diff changeset
    38
              intro: order_trans split:precedence.splits)
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
diff changeset
    39
end
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
diff changeset
    40
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
diff changeset
    41
instance precedence :: preorder ..
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
diff changeset
    42
33
9b9f2117561f simplified the cp_rec proof
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents: 0
diff changeset
    43
instance precedence :: linorder 
9b9f2117561f simplified the cp_rec proof
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents: 0
diff changeset
    44
proof
0
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
diff changeset
    45
qed (auto simp: precedence_le_def precedence_less_def 
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
diff changeset
    46
              intro: order_trans split:precedence.splits)
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
diff changeset
    47
33
9b9f2117561f simplified the cp_rec proof
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents: 0
diff changeset
    48
instantiation precedence :: zero
9b9f2117561f simplified the cp_rec proof
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents: 0
diff changeset
    49
begin
9b9f2117561f simplified the cp_rec proof
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents: 0
diff changeset
    50
9b9f2117561f simplified the cp_rec proof
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents: 0
diff changeset
    51
definition Zero_precedence_def:
9b9f2117561f simplified the cp_rec proof
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents: 0
diff changeset
    52
  "0 = Prc 0 0"
9b9f2117561f simplified the cp_rec proof
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents: 0
diff changeset
    53
9b9f2117561f simplified the cp_rec proof
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents: 0
diff changeset
    54
instance ..
9b9f2117561f simplified the cp_rec proof
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents: 0
diff changeset
    55
0
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
diff changeset
    56
end
33
9b9f2117561f simplified the cp_rec proof
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents: 0
diff changeset
    57
9b9f2117561f simplified the cp_rec proof
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents: 0
diff changeset
    58
end