src/HOL/MicroJava/BV/Semilat.thy
author haftmann
Fri, 25 Jul 2008 12:03:32 +0200
changeset 27681 8cedebf55539
parent 25592 e8ddaf6bf5df
permissions -rw-r--r--
dropped locale (open)
Ignore whitespace changes - Everywhere: Within whitespace: At end of lines:
12516
d09d0f160888 exceptions
kleing
parents: 11175
diff changeset
     1
(*  Title:      HOL/MicroJava/BV/Semilat.thy
10496
f2d304bdf3cc BCV integration (first step)
kleing
parents:
diff changeset
     2
    ID:         $Id$
f2d304bdf3cc BCV integration (first step)
kleing
parents:
diff changeset
     3
    Author:     Tobias Nipkow
f2d304bdf3cc BCV integration (first step)
kleing
parents:
diff changeset
     4
    Copyright   2000 TUM
f2d304bdf3cc BCV integration (first step)
kleing
parents:
diff changeset
     5
f2d304bdf3cc BCV integration (first step)
kleing
parents:
diff changeset
     6
Semilattices
f2d304bdf3cc BCV integration (first step)
kleing
parents:
diff changeset
     7
*)
f2d304bdf3cc BCV integration (first step)
kleing
parents:
diff changeset
     8
12911
704713ca07ea new document
kleing
parents: 12773
diff changeset
     9
header {* 
704713ca07ea new document
kleing
parents: 12773
diff changeset
    10
  \chapter{Bytecode Verifier}\label{cha:bv}
704713ca07ea new document
kleing
parents: 12773
diff changeset
    11
  \isaheader{Semilattices} 
704713ca07ea new document
kleing
parents: 12773
diff changeset
    12
*}
10496
f2d304bdf3cc BCV integration (first step)
kleing
parents:
diff changeset
    13
25592
e8ddaf6bf5df explicit import of theory Main
haftmann
parents: 23757
diff changeset
    14
theory Semilat
e8ddaf6bf5df explicit import of theory Main
haftmann
parents: 23757
diff changeset
    15
imports Main While_Combinator
e8ddaf6bf5df explicit import of theory Main
haftmann
parents: 23757
diff changeset
    16
begin
10496
f2d304bdf3cc BCV integration (first step)
kleing
parents:
diff changeset
    17
13006
51c5f3f11d16 symbolized
kleing
parents: 12911
diff changeset
    18
types 'a ord    = "'a \<Rightarrow> 'a \<Rightarrow> bool"
51c5f3f11d16 symbolized
kleing
parents: 12911
diff changeset
    19
      'a binop  = "'a \<Rightarrow> 'a \<Rightarrow> 'a"
10496
f2d304bdf3cc BCV integration (first step)
kleing
parents:
diff changeset
    20
      'a sl     = "'a set * 'a ord * 'a binop"
f2d304bdf3cc BCV integration (first step)
kleing
parents:
diff changeset
    21
f2d304bdf3cc BCV integration (first step)
kleing
parents:
diff changeset
    22
consts
13006
51c5f3f11d16 symbolized
kleing
parents: 12911
diff changeset
    23
 "@lesub"   :: "'a \<Rightarrow> 'a ord \<Rightarrow> 'a \<Rightarrow> bool" ("(_ /<='__ _)" [50, 1000, 51] 50)
51c5f3f11d16 symbolized
kleing
parents: 12911
diff changeset
    24
 "@lesssub" :: "'a \<Rightarrow> 'a ord \<Rightarrow> 'a \<Rightarrow> bool" ("(_ /<'__ _)" [50, 1000, 51] 50)
10496
f2d304bdf3cc BCV integration (first step)
kleing
parents:
diff changeset
    25
defs
f2d304bdf3cc BCV integration (first step)
kleing
parents:
diff changeset
    26
lesub_def:   "x <=_r y == r x y"
f2d304bdf3cc BCV integration (first step)
kleing
parents:
diff changeset
    27
lesssub_def: "x <_r y  == x <=_r y & x ~= y"
f2d304bdf3cc BCV integration (first step)
kleing
parents:
diff changeset
    28
13649
0f562a70c07d alternative syntax
kleing
parents: 13365
diff changeset
    29
syntax (xsymbols)
0f562a70c07d alternative syntax
kleing
parents: 13365
diff changeset
    30
 "@lesub" :: "'a \<Rightarrow> 'a ord \<Rightarrow> 'a \<Rightarrow> bool" ("(_ /\<le>\<^sub>_ _)" [50, 1000, 51] 50)
0f562a70c07d alternative syntax
kleing
parents: 13365
diff changeset
    31
10496
f2d304bdf3cc BCV integration (first step)
kleing
parents:
diff changeset
    32
consts
13006
51c5f3f11d16 symbolized
kleing
parents: 12911
diff changeset
    33
 "@plussub" :: "'a \<Rightarrow> ('a \<Rightarrow> 'b \<Rightarrow> 'c) \<Rightarrow> 'b \<Rightarrow> 'c" ("(_ /+'__ _)" [65, 1000, 66] 65)
10496
f2d304bdf3cc BCV integration (first step)
kleing
parents:
diff changeset
    34
defs
f2d304bdf3cc BCV integration (first step)
kleing
parents:
diff changeset
    35
plussub_def: "x +_f y == f x y"
f2d304bdf3cc BCV integration (first step)
kleing
parents:
diff changeset
    36
13649
0f562a70c07d alternative syntax
kleing
parents: 13365
diff changeset
    37
syntax (xsymbols)
0f562a70c07d alternative syntax
kleing
parents: 13365
diff changeset
    38
 "@plussub" :: "'a \<Rightarrow> ('a \<Rightarrow> 'b \<Rightarrow> 'c) \<Rightarrow> 'b \<Rightarrow> 'c" ("(_ /+\<^sub>_ _)" [65, 1000, 66] 65)
0f562a70c07d alternative syntax
kleing
parents: 13365
diff changeset
    39
0f562a70c07d alternative syntax
kleing
parents: 13365
diff changeset
    40
syntax (xsymbols)
0f562a70c07d alternative syntax
kleing
parents: 13365
diff changeset
    41
 "@plussub" :: "'a \<Rightarrow> ('a \<Rightarrow> 'b \<Rightarrow> 'c) \<Rightarrow> 'b \<Rightarrow> 'c" ("(_ /\<squnion>\<^sub>_ _)" [65, 1000, 66] 65)
0f562a70c07d alternative syntax
kleing
parents: 13365
diff changeset
    42
10496
f2d304bdf3cc BCV integration (first step)
kleing
parents:
diff changeset
    43
f2d304bdf3cc BCV integration (first step)
kleing
parents:
diff changeset
    44
constdefs
13006
51c5f3f11d16 symbolized
kleing
parents: 12911
diff changeset
    45
 order :: "'a ord \<Rightarrow> bool"
10496
f2d304bdf3cc BCV integration (first step)
kleing
parents:
diff changeset
    46
"order r == (!x. x <=_r x) &
13006
51c5f3f11d16 symbolized
kleing
parents: 12911
diff changeset
    47
            (!x y. x <=_r y & y <=_r x \<longrightarrow> x=y) &
51c5f3f11d16 symbolized
kleing
parents: 12911
diff changeset
    48
            (!x y z. x <=_r y & y <=_r z \<longrightarrow> x <=_r z)"
10496
f2d304bdf3cc BCV integration (first step)
kleing
parents:
diff changeset
    49
13006
51c5f3f11d16 symbolized
kleing
parents: 12911
diff changeset
    50
 acc :: "'a ord \<Rightarrow> bool"
22271
51a80e238b29 Adapted to new inductive definition package.
berghofe
parents: 16417
diff changeset
    51
"acc r == wfP (\<lambda>y x. x <_r y)"
10496
f2d304bdf3cc BCV integration (first step)
kleing
parents:
diff changeset
    52
13006
51c5f3f11d16 symbolized
kleing
parents: 12911
diff changeset
    53
 top :: "'a ord \<Rightarrow> 'a \<Rightarrow> bool"
10496
f2d304bdf3cc BCV integration (first step)
kleing
parents:
diff changeset
    54
"top r T == !x. x <=_r T"
f2d304bdf3cc BCV integration (first step)
kleing
parents:
diff changeset
    55
13006
51c5f3f11d16 symbolized
kleing
parents: 12911
diff changeset
    56
 closed :: "'a set \<Rightarrow> 'a binop \<Rightarrow> bool"
10496
f2d304bdf3cc BCV integration (first step)
kleing
parents:
diff changeset
    57
"closed A f == !x:A. !y:A. x +_f y : A"
f2d304bdf3cc BCV integration (first step)
kleing
parents:
diff changeset
    58
13006
51c5f3f11d16 symbolized
kleing
parents: 12911
diff changeset
    59
 semilat :: "'a sl \<Rightarrow> bool"
10496
f2d304bdf3cc BCV integration (first step)
kleing
parents:
diff changeset
    60
"semilat == %(A,r,f). order r & closed A f &
f2d304bdf3cc BCV integration (first step)
kleing
parents:
diff changeset
    61
                (!x:A. !y:A. x <=_r x +_f y)  &
f2d304bdf3cc BCV integration (first step)
kleing
parents:
diff changeset
    62
                (!x:A. !y:A. y <=_r x +_f y)  &
13006
51c5f3f11d16 symbolized
kleing
parents: 12911
diff changeset
    63
                (!x:A. !y:A. !z:A. x <=_r z & y <=_r z \<longrightarrow> x +_f y <=_r z)"
10496
f2d304bdf3cc BCV integration (first step)
kleing
parents:
diff changeset
    64
22271
51a80e238b29 Adapted to new inductive definition package.
berghofe
parents: 16417
diff changeset
    65
 is_ub :: "'a ord \<Rightarrow> 'a \<Rightarrow> 'a \<Rightarrow> 'a \<Rightarrow> bool"
51a80e238b29 Adapted to new inductive definition package.
berghofe
parents: 16417
diff changeset
    66
"is_ub r x y u == r x u & r y u"
10496
f2d304bdf3cc BCV integration (first step)
kleing
parents:
diff changeset
    67
22271
51a80e238b29 Adapted to new inductive definition package.
berghofe
parents: 16417
diff changeset
    68
 is_lub :: "'a ord \<Rightarrow> 'a \<Rightarrow> 'a \<Rightarrow> 'a \<Rightarrow> bool"
51a80e238b29 Adapted to new inductive definition package.
berghofe
parents: 16417
diff changeset
    69
"is_lub r x y u == is_ub r x y u & (!z. is_ub r x y z \<longrightarrow> r u z)"
10496
f2d304bdf3cc BCV integration (first step)
kleing
parents:
diff changeset
    70
22271
51a80e238b29 Adapted to new inductive definition package.
berghofe
parents: 16417
diff changeset
    71
 some_lub :: "'a ord \<Rightarrow> 'a \<Rightarrow> 'a \<Rightarrow> 'a"
13074
96bf406fd3e5 Started to convert to locales
nipkow
parents: 13068
diff changeset
    72
"some_lub r x y == SOME z. is_lub r x y z";
10496
f2d304bdf3cc BCV integration (first step)
kleing
parents:
diff changeset
    73
27681
8cedebf55539 dropped locale (open)
haftmann
parents: 25592
diff changeset
    74
locale Semilat =
13074
96bf406fd3e5 Started to convert to locales
nipkow
parents: 13068
diff changeset
    75
  fixes A :: "'a set"
96bf406fd3e5 Started to convert to locales
nipkow
parents: 13068
diff changeset
    76
    and r :: "'a ord"
96bf406fd3e5 Started to convert to locales
nipkow
parents: 13068
diff changeset
    77
    and f :: "'a binop"
96bf406fd3e5 Started to convert to locales
nipkow
parents: 13068
diff changeset
    78
  assumes semilat: "semilat(A,r,f)"
10496
f2d304bdf3cc BCV integration (first step)
kleing
parents:
diff changeset
    79
f2d304bdf3cc BCV integration (first step)
kleing
parents:
diff changeset
    80
lemma order_refl [simp, intro]:
13006
51c5f3f11d16 symbolized
kleing
parents: 12911
diff changeset
    81
  "order r \<Longrightarrow> x <=_r x";
10496
f2d304bdf3cc BCV integration (first step)
kleing
parents:
diff changeset
    82
  by (simp add: order_def)
f2d304bdf3cc BCV integration (first step)
kleing
parents:
diff changeset
    83
f2d304bdf3cc BCV integration (first step)
kleing
parents:
diff changeset
    84
lemma order_antisym:
13006
51c5f3f11d16 symbolized
kleing
parents: 12911
diff changeset
    85
  "\<lbrakk> order r; x <=_r y; y <=_r x \<rbrakk> \<Longrightarrow> x = y"
10496
f2d304bdf3cc BCV integration (first step)
kleing
parents:
diff changeset
    86
apply (unfold order_def)
13074
96bf406fd3e5 Started to convert to locales
nipkow
parents: 13068
diff changeset
    87
apply (simp (no_asm_simp))
10496
f2d304bdf3cc BCV integration (first step)
kleing
parents:
diff changeset
    88
done
f2d304bdf3cc BCV integration (first step)
kleing
parents:
diff changeset
    89
f2d304bdf3cc BCV integration (first step)
kleing
parents:
diff changeset
    90
lemma order_trans:
13006
51c5f3f11d16 symbolized
kleing
parents: 12911
diff changeset
    91
   "\<lbrakk> order r; x <=_r y; y <=_r z \<rbrakk> \<Longrightarrow> x <=_r z"
10496
f2d304bdf3cc BCV integration (first step)
kleing
parents:
diff changeset
    92
apply (unfold order_def)
f2d304bdf3cc BCV integration (first step)
kleing
parents:
diff changeset
    93
apply blast
f2d304bdf3cc BCV integration (first step)
kleing
parents:
diff changeset
    94
done 
f2d304bdf3cc BCV integration (first step)
kleing
parents:
diff changeset
    95
f2d304bdf3cc BCV integration (first step)
kleing
parents:
diff changeset
    96
lemma order_less_irrefl [intro, simp]:
13006
51c5f3f11d16 symbolized
kleing
parents: 12911
diff changeset
    97
   "order r \<Longrightarrow> ~ x <_r x"
10496
f2d304bdf3cc BCV integration (first step)
kleing
parents:
diff changeset
    98
apply (unfold order_def lesssub_def)
f2d304bdf3cc BCV integration (first step)
kleing
parents:
diff changeset
    99
apply blast
f2d304bdf3cc BCV integration (first step)
kleing
parents:
diff changeset
   100
done 
f2d304bdf3cc BCV integration (first step)
kleing
parents:
diff changeset
   101
f2d304bdf3cc BCV integration (first step)
kleing
parents:
diff changeset
   102
lemma order_less_trans:
13006
51c5f3f11d16 symbolized
kleing
parents: 12911
diff changeset
   103
  "\<lbrakk> order r; x <_r y; y <_r z \<rbrakk> \<Longrightarrow> x <_r z"
10496
f2d304bdf3cc BCV integration (first step)
kleing
parents:
diff changeset
   104
apply (unfold order_def lesssub_def)
f2d304bdf3cc BCV integration (first step)
kleing
parents:
diff changeset
   105
apply blast
f2d304bdf3cc BCV integration (first step)
kleing
parents:
diff changeset
   106
done 
f2d304bdf3cc BCV integration (first step)
kleing
parents:
diff changeset
   107
f2d304bdf3cc BCV integration (first step)
kleing
parents:
diff changeset
   108
lemma topD [simp, intro]:
13006
51c5f3f11d16 symbolized
kleing
parents: 12911
diff changeset
   109
  "top r T \<Longrightarrow> x <=_r T"
10496
f2d304bdf3cc BCV integration (first step)
kleing
parents:
diff changeset
   110
  by (simp add: top_def)
f2d304bdf3cc BCV integration (first step)
kleing
parents:
diff changeset
   111
f2d304bdf3cc BCV integration (first step)
kleing
parents:
diff changeset
   112
lemma top_le_conv [simp]:
13006
51c5f3f11d16 symbolized
kleing
parents: 12911
diff changeset
   113
  "\<lbrakk> order r; top r T \<rbrakk> \<Longrightarrow> (T <=_r x) = (x = T)"
10496
f2d304bdf3cc BCV integration (first step)
kleing
parents:
diff changeset
   114
  by (blast intro: order_antisym)
f2d304bdf3cc BCV integration (first step)
kleing
parents:
diff changeset
   115
f2d304bdf3cc BCV integration (first step)
kleing
parents:
diff changeset
   116
lemma semilat_Def:
f2d304bdf3cc BCV integration (first step)
kleing
parents:
diff changeset
   117
"semilat(A,r,f) == order r & closed A f & 
f2d304bdf3cc BCV integration (first step)
kleing
parents:
diff changeset
   118
                 (!x:A. !y:A. x <=_r x +_f y) & 
f2d304bdf3cc BCV integration (first step)
kleing
parents:
diff changeset
   119
                 (!x:A. !y:A. y <=_r x +_f y) & 
13006
51c5f3f11d16 symbolized
kleing
parents: 12911
diff changeset
   120
                 (!x:A. !y:A. !z:A. x <=_r z & y <=_r z \<longrightarrow> x +_f y <=_r z)"
10918
9679326489cd renamed Product_Type.split to split_conv;
wenzelm
parents: 10797
diff changeset
   121
apply (unfold semilat_def split_conv [THEN eq_reflection])
10496
f2d304bdf3cc BCV integration (first step)
kleing
parents:
diff changeset
   122
apply (rule refl [THEN eq_reflection])
f2d304bdf3cc BCV integration (first step)
kleing
parents:
diff changeset
   123
done
f2d304bdf3cc BCV integration (first step)
kleing
parents:
diff changeset
   124
27681
8cedebf55539 dropped locale (open)
haftmann
parents: 25592
diff changeset
   125
lemma (in Semilat) orderI [simp, intro]:
13074
96bf406fd3e5 Started to convert to locales
nipkow
parents: 13068
diff changeset
   126
  "order r"
96bf406fd3e5 Started to convert to locales
nipkow
parents: 13068
diff changeset
   127
  by (insert semilat) (simp add: semilat_Def)
96bf406fd3e5 Started to convert to locales
nipkow
parents: 13068
diff changeset
   128
27681
8cedebf55539 dropped locale (open)
haftmann
parents: 25592
diff changeset
   129
lemma (in Semilat) closedI [simp, intro]:
13074
96bf406fd3e5 Started to convert to locales
nipkow
parents: 13068
diff changeset
   130
  "closed A f"
96bf406fd3e5 Started to convert to locales
nipkow
parents: 13068
diff changeset
   131
  by (insert semilat) (simp add: semilat_Def)
96bf406fd3e5 Started to convert to locales
nipkow
parents: 13068
diff changeset
   132
13077
kleing
parents: 13074
diff changeset
   133
lemma closedD:
kleing
parents: 13074
diff changeset
   134
  "\<lbrakk> closed A f; x:A; y:A \<rbrakk> \<Longrightarrow> x +_f y : A"
kleing
parents: 13074
diff changeset
   135
  by (unfold closed_def) blast
kleing
parents: 13074
diff changeset
   136
kleing
parents: 13074
diff changeset
   137
lemma closed_UNIV [simp]: "closed UNIV f"
kleing
parents: 13074
diff changeset
   138
  by (simp add: closed_def)
kleing
parents: 13074
diff changeset
   139
kleing
parents: 13074
diff changeset
   140
27681
8cedebf55539 dropped locale (open)
haftmann
parents: 25592
diff changeset
   141
lemma (in Semilat) closed_f [simp, intro]:
13077
kleing
parents: 13074
diff changeset
   142
  "\<lbrakk>x:A; y:A\<rbrakk>  \<Longrightarrow> x +_f y : A"
kleing
parents: 13074
diff changeset
   143
  by (simp add: closedD [OF closedI])
kleing
parents: 13074
diff changeset
   144
27681
8cedebf55539 dropped locale (open)
haftmann
parents: 25592
diff changeset
   145
lemma (in Semilat) refl_r [intro, simp]:
13077
kleing
parents: 13074
diff changeset
   146
  "x <=_r x"
kleing
parents: 13074
diff changeset
   147
  by simp
kleing
parents: 13074
diff changeset
   148
27681
8cedebf55539 dropped locale (open)
haftmann
parents: 25592
diff changeset
   149
lemma (in Semilat) antisym_r [intro?]:
13077
kleing
parents: 13074
diff changeset
   150
  "\<lbrakk> x <=_r y; y <=_r x \<rbrakk> \<Longrightarrow> x = y"
kleing
parents: 13074
diff changeset
   151
  by (rule order_antisym) auto
kleing
parents: 13074
diff changeset
   152
  
27681
8cedebf55539 dropped locale (open)
haftmann
parents: 25592
diff changeset
   153
lemma (in Semilat) trans_r [trans, intro?]:
13077
kleing
parents: 13074
diff changeset
   154
  "\<lbrakk>x <=_r y; y <=_r z\<rbrakk> \<Longrightarrow> x <=_r z"
kleing
parents: 13074
diff changeset
   155
  by (auto intro: order_trans)    
kleing
parents: 13074
diff changeset
   156
  
kleing
parents: 13074
diff changeset
   157
27681
8cedebf55539 dropped locale (open)
haftmann
parents: 25592
diff changeset
   158
lemma (in Semilat) ub1 [simp, intro?]:
13074
96bf406fd3e5 Started to convert to locales
nipkow
parents: 13068
diff changeset
   159
  "\<lbrakk> x:A; y:A \<rbrakk> \<Longrightarrow> x <=_r x +_f y"
96bf406fd3e5 Started to convert to locales
nipkow
parents: 13068
diff changeset
   160
  by (insert semilat) (unfold semilat_Def, simp)
96bf406fd3e5 Started to convert to locales
nipkow
parents: 13068
diff changeset
   161
27681
8cedebf55539 dropped locale (open)
haftmann
parents: 25592
diff changeset
   162
lemma (in Semilat) ub2 [simp, intro?]:
13074
96bf406fd3e5 Started to convert to locales
nipkow
parents: 13068
diff changeset
   163
  "\<lbrakk> x:A; y:A \<rbrakk> \<Longrightarrow> y <=_r x +_f y"
96bf406fd3e5 Started to convert to locales
nipkow
parents: 13068
diff changeset
   164
  by (insert semilat) (unfold semilat_Def, simp)
10496
f2d304bdf3cc BCV integration (first step)
kleing
parents:
diff changeset
   165
27681
8cedebf55539 dropped locale (open)
haftmann
parents: 25592
diff changeset
   166
lemma (in Semilat) lub [simp, intro?]:
13074
96bf406fd3e5 Started to convert to locales
nipkow
parents: 13068
diff changeset
   167
 "\<lbrakk> x <=_r z; y <=_r z; x:A; y:A; z:A \<rbrakk> \<Longrightarrow> x +_f y <=_r z";
96bf406fd3e5 Started to convert to locales
nipkow
parents: 13068
diff changeset
   168
  by (insert semilat) (unfold semilat_Def, simp)
96bf406fd3e5 Started to convert to locales
nipkow
parents: 13068
diff changeset
   169
96bf406fd3e5 Started to convert to locales
nipkow
parents: 13068
diff changeset
   170
27681
8cedebf55539 dropped locale (open)
haftmann
parents: 25592
diff changeset
   171
lemma (in Semilat) plus_le_conv [simp]:
13074
96bf406fd3e5 Started to convert to locales
nipkow
parents: 13068
diff changeset
   172
  "\<lbrakk> x:A; y:A; z:A \<rbrakk> \<Longrightarrow> (x +_f y <=_r z) = (x <=_r z & y <=_r z)"
13077
kleing
parents: 13074
diff changeset
   173
  by (blast intro: ub1 ub2 lub order_trans)
13074
96bf406fd3e5 Started to convert to locales
nipkow
parents: 13068
diff changeset
   174
27681
8cedebf55539 dropped locale (open)
haftmann
parents: 25592
diff changeset
   175
lemma (in Semilat) le_iff_plus_unchanged:
13074
96bf406fd3e5 Started to convert to locales
nipkow
parents: 13068
diff changeset
   176
  "\<lbrakk> x:A; y:A \<rbrakk> \<Longrightarrow> (x <=_r y) = (x +_f y = y)"
96bf406fd3e5 Started to convert to locales
nipkow
parents: 13068
diff changeset
   177
apply (rule iffI)
13077
kleing
parents: 13074
diff changeset
   178
 apply (blast intro: antisym_r refl_r lub ub2)
13074
96bf406fd3e5 Started to convert to locales
nipkow
parents: 13068
diff changeset
   179
apply (erule subst)
10496
f2d304bdf3cc BCV integration (first step)
kleing
parents:
diff changeset
   180
apply simp
f2d304bdf3cc BCV integration (first step)
kleing
parents:
diff changeset
   181
done
f2d304bdf3cc BCV integration (first step)
kleing
parents:
diff changeset
   182
27681
8cedebf55539 dropped locale (open)
haftmann
parents: 25592
diff changeset
   183
lemma (in Semilat) le_iff_plus_unchanged2:
13074
96bf406fd3e5 Started to convert to locales
nipkow
parents: 13068
diff changeset
   184
  "\<lbrakk> x:A; y:A \<rbrakk> \<Longrightarrow> (x <=_r y) = (y +_f x = y)"
10496
f2d304bdf3cc BCV integration (first step)
kleing
parents:
diff changeset
   185
apply (rule iffI)
13074
96bf406fd3e5 Started to convert to locales
nipkow
parents: 13068
diff changeset
   186
 apply (blast intro: order_antisym lub order_refl ub1)
10496
f2d304bdf3cc BCV integration (first step)
kleing
parents:
diff changeset
   187
apply (erule subst)
f2d304bdf3cc BCV integration (first step)
kleing
parents:
diff changeset
   188
apply simp
f2d304bdf3cc BCV integration (first step)
kleing
parents:
diff changeset
   189
done 
f2d304bdf3cc BCV integration (first step)
kleing
parents:
diff changeset
   190
f2d304bdf3cc BCV integration (first step)
kleing
parents:
diff changeset
   191
27681
8cedebf55539 dropped locale (open)
haftmann
parents: 25592
diff changeset
   192
lemma (in Semilat) plus_assoc [simp]:
13068
472b1c91b09f +_f is associative and commutative
kleing
parents: 13006
diff changeset
   193
  assumes a: "a \<in> A" and b: "b \<in> A" and c: "c \<in> A"
472b1c91b09f +_f is associative and commutative
kleing
parents: 13006
diff changeset
   194
  shows "a +_f (b +_f c) = a +_f b +_f c"
472b1c91b09f +_f is associative and commutative
kleing
parents: 13006
diff changeset
   195
proof -
472b1c91b09f +_f is associative and commutative
kleing
parents: 13006
diff changeset
   196
  from a b have ab: "a +_f b \<in> A" ..
472b1c91b09f +_f is associative and commutative
kleing
parents: 13006
diff changeset
   197
  from this c have abc: "(a +_f b) +_f c \<in> A" ..
472b1c91b09f +_f is associative and commutative
kleing
parents: 13006
diff changeset
   198
  from b c have bc: "b +_f c \<in> A" ..
472b1c91b09f +_f is associative and commutative
kleing
parents: 13006
diff changeset
   199
  from a this have abc': "a +_f (b +_f c) \<in> A" ..
472b1c91b09f +_f is associative and commutative
kleing
parents: 13006
diff changeset
   200
13077
kleing
parents: 13074
diff changeset
   201
  show ?thesis
kleing
parents: 13074
diff changeset
   202
  proof    
13068
472b1c91b09f +_f is associative and commutative
kleing
parents: 13006
diff changeset
   203
    show "a +_f (b +_f c) <=_r (a +_f b) +_f c"
13074
96bf406fd3e5 Started to convert to locales
nipkow
parents: 13068
diff changeset
   204
    proof -
13068
472b1c91b09f +_f is associative and commutative
kleing
parents: 13006
diff changeset
   205
      from a b have "a <=_r a +_f b" .. 
472b1c91b09f +_f is associative and commutative
kleing
parents: 13006
diff changeset
   206
      also from ab c have "\<dots> <=_r \<dots> +_f c" ..
472b1c91b09f +_f is associative and commutative
kleing
parents: 13006
diff changeset
   207
      finally have "a<": "a <=_r (a +_f b) +_f c" .
472b1c91b09f +_f is associative and commutative
kleing
parents: 13006
diff changeset
   208
      from a b have "b <=_r a +_f b" ..
472b1c91b09f +_f is associative and commutative
kleing
parents: 13006
diff changeset
   209
      also from ab c have "\<dots> <=_r \<dots> +_f c" ..
472b1c91b09f +_f is associative and commutative
kleing
parents: 13006
diff changeset
   210
      finally have "b<": "b <=_r (a +_f b) +_f c" .
472b1c91b09f +_f is associative and commutative
kleing
parents: 13006
diff changeset
   211
      from ab c have "c<": "c <=_r (a +_f b) +_f c" ..    
472b1c91b09f +_f is associative and commutative
kleing
parents: 13006
diff changeset
   212
      from "b<" "c<" b c abc have "b +_f c <=_r (a +_f b) +_f c" ..
472b1c91b09f +_f is associative and commutative
kleing
parents: 13006
diff changeset
   213
      from "a<" this a bc abc show ?thesis ..
472b1c91b09f +_f is associative and commutative
kleing
parents: 13006
diff changeset
   214
    qed
472b1c91b09f +_f is associative and commutative
kleing
parents: 13006
diff changeset
   215
    show "(a +_f b) +_f c <=_r a +_f (b +_f c)" 
472b1c91b09f +_f is associative and commutative
kleing
parents: 13006
diff changeset
   216
    proof -
472b1c91b09f +_f is associative and commutative
kleing
parents: 13006
diff changeset
   217
      from b c have "b <=_r b +_f c" .. 
472b1c91b09f +_f is associative and commutative
kleing
parents: 13006
diff changeset
   218
      also from a bc have "\<dots> <=_r a +_f \<dots>" ..
472b1c91b09f +_f is associative and commutative
kleing
parents: 13006
diff changeset
   219
      finally have "b<": "b <=_r a +_f (b +_f c)" .
472b1c91b09f +_f is associative and commutative
kleing
parents: 13006
diff changeset
   220
      from b c have "c <=_r b +_f c" ..
472b1c91b09f +_f is associative and commutative
kleing
parents: 13006
diff changeset
   221
      also from a bc have "\<dots> <=_r a +_f \<dots>" ..
472b1c91b09f +_f is associative and commutative
kleing
parents: 13006
diff changeset
   222
      finally have "c<": "c <=_r a +_f (b +_f c)" .
472b1c91b09f +_f is associative and commutative
kleing
parents: 13006
diff changeset
   223
      from a bc have "a<": "a <=_r a +_f (b +_f c)" ..
472b1c91b09f +_f is associative and commutative
kleing
parents: 13006
diff changeset
   224
      from "a<" "b<" a b abc' have "a +_f b <=_r a +_f (b +_f c)" ..
472b1c91b09f +_f is associative and commutative
kleing
parents: 13006
diff changeset
   225
      from this "c<" ab c abc' show ?thesis ..
472b1c91b09f +_f is associative and commutative
kleing
parents: 13006
diff changeset
   226
    qed
472b1c91b09f +_f is associative and commutative
kleing
parents: 13006
diff changeset
   227
  qed
472b1c91b09f +_f is associative and commutative
kleing
parents: 13006
diff changeset
   228
qed
472b1c91b09f +_f is associative and commutative
kleing
parents: 13006
diff changeset
   229
27681
8cedebf55539 dropped locale (open)
haftmann
parents: 25592
diff changeset
   230
lemma (in Semilat) plus_com_lemma:
13074
96bf406fd3e5 Started to convert to locales
nipkow
parents: 13068
diff changeset
   231
  "\<lbrakk>a \<in> A; b \<in> A\<rbrakk> \<Longrightarrow> a +_f b <=_r b +_f a"
13068
472b1c91b09f +_f is associative and commutative
kleing
parents: 13006
diff changeset
   232
proof -
13074
96bf406fd3e5 Started to convert to locales
nipkow
parents: 13068
diff changeset
   233
  assume a: "a \<in> A" and b: "b \<in> A"  
13077
kleing
parents: 13074
diff changeset
   234
  from b a have "a <=_r b +_f a" .. 
kleing
parents: 13074
diff changeset
   235
  moreover from b a have "b <=_r b +_f a" ..
kleing
parents: 13074
diff changeset
   236
  moreover note a b
kleing
parents: 13074
diff changeset
   237
  moreover from b a have "b +_f a \<in> A" ..
kleing
parents: 13074
diff changeset
   238
  ultimately show ?thesis ..
13068
472b1c91b09f +_f is associative and commutative
kleing
parents: 13006
diff changeset
   239
qed
472b1c91b09f +_f is associative and commutative
kleing
parents: 13006
diff changeset
   240
27681
8cedebf55539 dropped locale (open)
haftmann
parents: 25592
diff changeset
   241
lemma (in Semilat) plus_commutative:
13074
96bf406fd3e5 Started to convert to locales
nipkow
parents: 13068
diff changeset
   242
  "\<lbrakk>a \<in> A; b \<in> A\<rbrakk> \<Longrightarrow> a +_f b = b +_f a"
96bf406fd3e5 Started to convert to locales
nipkow
parents: 13068
diff changeset
   243
by(blast intro: order_antisym plus_com_lemma)
13068
472b1c91b09f +_f is associative and commutative
kleing
parents: 13006
diff changeset
   244
10496
f2d304bdf3cc BCV integration (first step)
kleing
parents:
diff changeset
   245
lemma is_lubD:
22271
51a80e238b29 Adapted to new inductive definition package.
berghofe
parents: 16417
diff changeset
   246
  "is_lub r x y u \<Longrightarrow> is_ub r x y u & (!z. is_ub r x y z \<longrightarrow> r u z)"
10496
f2d304bdf3cc BCV integration (first step)
kleing
parents:
diff changeset
   247
  by (simp add: is_lub_def)
f2d304bdf3cc BCV integration (first step)
kleing
parents:
diff changeset
   248
f2d304bdf3cc BCV integration (first step)
kleing
parents:
diff changeset
   249
lemma is_ubI:
22271
51a80e238b29 Adapted to new inductive definition package.
berghofe
parents: 16417
diff changeset
   250
  "\<lbrakk> r x u; r y u \<rbrakk> \<Longrightarrow> is_ub r x y u"
10496
f2d304bdf3cc BCV integration (first step)
kleing
parents:
diff changeset
   251
  by (simp add: is_ub_def)
f2d304bdf3cc BCV integration (first step)
kleing
parents:
diff changeset
   252
f2d304bdf3cc BCV integration (first step)
kleing
parents:
diff changeset
   253
lemma is_ubD:
22271
51a80e238b29 Adapted to new inductive definition package.
berghofe
parents: 16417
diff changeset
   254
  "is_ub r x y u \<Longrightarrow> r x u & r y u"
10496
f2d304bdf3cc BCV integration (first step)
kleing
parents:
diff changeset
   255
  by (simp add: is_ub_def)
f2d304bdf3cc BCV integration (first step)
kleing
parents:
diff changeset
   256
f2d304bdf3cc BCV integration (first step)
kleing
parents:
diff changeset
   257
f2d304bdf3cc BCV integration (first step)
kleing
parents:
diff changeset
   258
lemma is_lub_bigger1 [iff]:  
22271
51a80e238b29 Adapted to new inductive definition package.
berghofe
parents: 16417
diff changeset
   259
  "is_lub (r^** ) x y y = r^** x y"
10496
f2d304bdf3cc BCV integration (first step)
kleing
parents:
diff changeset
   260
apply (unfold is_lub_def is_ub_def)
f2d304bdf3cc BCV integration (first step)
kleing
parents:
diff changeset
   261
apply blast
f2d304bdf3cc BCV integration (first step)
kleing
parents:
diff changeset
   262
done
f2d304bdf3cc BCV integration (first step)
kleing
parents:
diff changeset
   263
f2d304bdf3cc BCV integration (first step)
kleing
parents:
diff changeset
   264
lemma is_lub_bigger2 [iff]:
22271
51a80e238b29 Adapted to new inductive definition package.
berghofe
parents: 16417
diff changeset
   265
  "is_lub (r^** ) x y x = r^** y x"
10496
f2d304bdf3cc BCV integration (first step)
kleing
parents:
diff changeset
   266
apply (unfold is_lub_def is_ub_def)
f2d304bdf3cc BCV integration (first step)
kleing
parents:
diff changeset
   267
apply blast 
12542
ff5e3f11e1ef added exec_lub
nipkow
parents: 12516
diff changeset
   268
done
10496
f2d304bdf3cc BCV integration (first step)
kleing
parents:
diff changeset
   269
f2d304bdf3cc BCV integration (first step)
kleing
parents:
diff changeset
   270
lemma extend_lub:
22271
51a80e238b29 Adapted to new inductive definition package.
berghofe
parents: 16417
diff changeset
   271
  "\<lbrakk> single_valuedP r; is_lub (r^** ) x y u; r x' x \<rbrakk> 
51a80e238b29 Adapted to new inductive definition package.
berghofe
parents: 16417
diff changeset
   272
  \<Longrightarrow> EX v. is_lub (r^** ) x' y v"
10496
f2d304bdf3cc BCV integration (first step)
kleing
parents:
diff changeset
   273
apply (unfold is_lub_def is_ub_def)
22271
51a80e238b29 Adapted to new inductive definition package.
berghofe
parents: 16417
diff changeset
   274
apply (case_tac "r^** y x")
51a80e238b29 Adapted to new inductive definition package.
berghofe
parents: 16417
diff changeset
   275
 apply (case_tac "r^** y x'")
10496
f2d304bdf3cc BCV integration (first step)
kleing
parents:
diff changeset
   276
  apply blast
23757
087b0a241557 - Renamed inductive2 to inductive
berghofe
parents: 22271
diff changeset
   277
 apply (blast elim: converse_rtranclpE dest: single_valuedD)
10496
f2d304bdf3cc BCV integration (first step)
kleing
parents:
diff changeset
   278
apply (rule exI)
f2d304bdf3cc BCV integration (first step)
kleing
parents:
diff changeset
   279
apply (rule conjI)
23757
087b0a241557 - Renamed inductive2 to inductive
berghofe
parents: 22271
diff changeset
   280
 apply (blast intro: converse_rtranclp_into_rtranclp dest: single_valuedD)
087b0a241557 - Renamed inductive2 to inductive
berghofe
parents: 22271
diff changeset
   281
apply (blast intro: rtranclp.rtrancl_into_rtrancl converse_rtranclp_into_rtranclp
087b0a241557 - Renamed inductive2 to inductive
berghofe
parents: 22271
diff changeset
   282
             elim: converse_rtranclpE dest: single_valuedD)
12542
ff5e3f11e1ef added exec_lub
nipkow
parents: 12516
diff changeset
   283
done
10496
f2d304bdf3cc BCV integration (first step)
kleing
parents:
diff changeset
   284
10797
028d22926a41 ^^ -> ```
nipkow
parents: 10496
diff changeset
   285
lemma single_valued_has_lubs [rule_format]:
22271
51a80e238b29 Adapted to new inductive definition package.
berghofe
parents: 16417
diff changeset
   286
  "\<lbrakk> single_valuedP r; r^** x u \<rbrakk> \<Longrightarrow> (!y. r^** y u \<longrightarrow> 
51a80e238b29 Adapted to new inductive definition package.
berghofe
parents: 16417
diff changeset
   287
  (EX z. is_lub (r^** ) x y z))"
23757
087b0a241557 - Renamed inductive2 to inductive
berghofe
parents: 22271
diff changeset
   288
apply (erule converse_rtranclp_induct)
10496
f2d304bdf3cc BCV integration (first step)
kleing
parents:
diff changeset
   289
 apply clarify
23757
087b0a241557 - Renamed inductive2 to inductive
berghofe
parents: 22271
diff changeset
   290
 apply (erule converse_rtranclp_induct)
10496
f2d304bdf3cc BCV integration (first step)
kleing
parents:
diff changeset
   291
  apply blast
23757
087b0a241557 - Renamed inductive2 to inductive
berghofe
parents: 22271
diff changeset
   292
 apply (blast intro: converse_rtranclp_into_rtranclp)
10496
f2d304bdf3cc BCV integration (first step)
kleing
parents:
diff changeset
   293
apply (blast intro: extend_lub)
f2d304bdf3cc BCV integration (first step)
kleing
parents:
diff changeset
   294
done
f2d304bdf3cc BCV integration (first step)
kleing
parents:
diff changeset
   295
f2d304bdf3cc BCV integration (first step)
kleing
parents:
diff changeset
   296
lemma some_lub_conv:
22271
51a80e238b29 Adapted to new inductive definition package.
berghofe
parents: 16417
diff changeset
   297
  "\<lbrakk> acyclicP r; is_lub (r^** ) x y u \<rbrakk> \<Longrightarrow> some_lub (r^** ) x y = u"
10496
f2d304bdf3cc BCV integration (first step)
kleing
parents:
diff changeset
   298
apply (unfold some_lub_def is_lub_def)
f2d304bdf3cc BCV integration (first step)
kleing
parents:
diff changeset
   299
apply (rule someI2)
f2d304bdf3cc BCV integration (first step)
kleing
parents:
diff changeset
   300
 apply assumption
22271
51a80e238b29 Adapted to new inductive definition package.
berghofe
parents: 16417
diff changeset
   301
apply (blast intro: antisymD dest!: acyclic_impl_antisym_rtrancl [to_pred])
12542
ff5e3f11e1ef added exec_lub
nipkow
parents: 12516
diff changeset
   302
done
10496
f2d304bdf3cc BCV integration (first step)
kleing
parents:
diff changeset
   303
f2d304bdf3cc BCV integration (first step)
kleing
parents:
diff changeset
   304
lemma is_lub_some_lub:
22271
51a80e238b29 Adapted to new inductive definition package.
berghofe
parents: 16417
diff changeset
   305
  "\<lbrakk> single_valuedP r; acyclicP r; r^** x u; r^** y u \<rbrakk> 
51a80e238b29 Adapted to new inductive definition package.
berghofe
parents: 16417
diff changeset
   306
  \<Longrightarrow> is_lub (r^** ) x y (some_lub (r^** ) x y)";
10797
028d22926a41 ^^ -> ```
nipkow
parents: 10496
diff changeset
   307
  by (fastsimp dest: single_valued_has_lubs simp add: some_lub_conv)
10496
f2d304bdf3cc BCV integration (first step)
kleing
parents:
diff changeset
   308
12542
ff5e3f11e1ef added exec_lub
nipkow
parents: 12516
diff changeset
   309
subsection{*An executable lub-finder*}
ff5e3f11e1ef added exec_lub
nipkow
parents: 12516
diff changeset
   310
ff5e3f11e1ef added exec_lub
nipkow
parents: 12516
diff changeset
   311
constdefs
22271
51a80e238b29 Adapted to new inductive definition package.
berghofe
parents: 16417
diff changeset
   312
 exec_lub :: "('a \<Rightarrow> 'a \<Rightarrow> bool) \<Rightarrow> ('a \<Rightarrow> 'a) \<Rightarrow> 'a binop"
51a80e238b29 Adapted to new inductive definition package.
berghofe
parents: 16417
diff changeset
   313
"exec_lub r f x y == while (\<lambda>z. \<not> r\<^sup>*\<^sup>* x z) f y"
12542
ff5e3f11e1ef added exec_lub
nipkow
parents: 12516
diff changeset
   314
ff5e3f11e1ef added exec_lub
nipkow
parents: 12516
diff changeset
   315
ff5e3f11e1ef added exec_lub
nipkow
parents: 12516
diff changeset
   316
lemma acyclic_single_valued_finite:
22271
51a80e238b29 Adapted to new inductive definition package.
berghofe
parents: 16417
diff changeset
   317
 "\<lbrakk>acyclicP r; single_valuedP r; r\<^sup>*\<^sup>* x y \<rbrakk>
23757
087b0a241557 - Renamed inductive2 to inductive
berghofe
parents: 22271
diff changeset
   318
  \<Longrightarrow> finite ({(x, y). r x y} \<inter> {a. r\<^sup>*\<^sup>* x a} \<times> {b. r\<^sup>*\<^sup>* b y})"
087b0a241557 - Renamed inductive2 to inductive
berghofe
parents: 22271
diff changeset
   319
apply(erule converse_rtranclp_induct)
12542
ff5e3f11e1ef added exec_lub
nipkow
parents: 12516
diff changeset
   320
 apply(rule_tac B = "{}" in finite_subset)
22271
51a80e238b29 Adapted to new inductive definition package.
berghofe
parents: 16417
diff changeset
   321
  apply(simp only:acyclic_def [to_pred])
23757
087b0a241557 - Renamed inductive2 to inductive
berghofe
parents: 22271
diff changeset
   322
  apply(blast intro:rtranclp_into_tranclp2 rtranclp_tranclp_tranclp)
12542
ff5e3f11e1ef added exec_lub
nipkow
parents: 12516
diff changeset
   323
 apply simp
ff5e3f11e1ef added exec_lub
nipkow
parents: 12516
diff changeset
   324
apply(rename_tac x x')
23757
087b0a241557 - Renamed inductive2 to inductive
berghofe
parents: 22271
diff changeset
   325
apply(subgoal_tac "{(x, y). r x y} \<inter> {a. r\<^sup>*\<^sup>* x a} \<times> {b. r\<^sup>*\<^sup>* b y} =
087b0a241557 - Renamed inductive2 to inductive
berghofe
parents: 22271
diff changeset
   326
                   insert (x,x') ({(x, y). r x y} \<inter> {a. r\<^sup>*\<^sup>* x' a} \<times> {b. r\<^sup>*\<^sup>* b y})")
12542
ff5e3f11e1ef added exec_lub
nipkow
parents: 12516
diff changeset
   327
 apply simp
23757
087b0a241557 - Renamed inductive2 to inductive
berghofe
parents: 22271
diff changeset
   328
apply(blast intro:converse_rtranclp_into_rtranclp
087b0a241557 - Renamed inductive2 to inductive
berghofe
parents: 22271
diff changeset
   329
            elim:converse_rtranclpE dest:single_valuedD)
12542
ff5e3f11e1ef added exec_lub
nipkow
parents: 12516
diff changeset
   330
done
ff5e3f11e1ef added exec_lub
nipkow
parents: 12516
diff changeset
   331
ff5e3f11e1ef added exec_lub
nipkow
parents: 12516
diff changeset
   332
12773
a47f51daa6dc use exec_lub instead of some_lub
kleing
parents: 12566
diff changeset
   333
lemma exec_lub_conv:
22271
51a80e238b29 Adapted to new inductive definition package.
berghofe
parents: 16417
diff changeset
   334
  "\<lbrakk> acyclicP r; !x y. r x y \<longrightarrow> f x = y; is_lub (r\<^sup>*\<^sup>*) x y u \<rbrakk> \<Longrightarrow>
12773
a47f51daa6dc use exec_lub instead of some_lub
kleing
parents: 12566
diff changeset
   335
  exec_lub r f x y = u";
12542
ff5e3f11e1ef added exec_lub
nipkow
parents: 12516
diff changeset
   336
apply(unfold exec_lub_def)
22271
51a80e238b29 Adapted to new inductive definition package.
berghofe
parents: 16417
diff changeset
   337
apply(rule_tac P = "\<lambda>z. r\<^sup>*\<^sup>* y z \<and> r\<^sup>*\<^sup>* z u" and
23757
087b0a241557 - Renamed inductive2 to inductive
berghofe
parents: 22271
diff changeset
   338
               r = "({(x, y). r x y} \<inter> {(a,b). r\<^sup>*\<^sup>* y a \<and> r\<^sup>*\<^sup>* b u})^-1" in while_rule)
12542
ff5e3f11e1ef added exec_lub
nipkow
parents: 12516
diff changeset
   339
    apply(blast dest: is_lubD is_ubD)
ff5e3f11e1ef added exec_lub
nipkow
parents: 12516
diff changeset
   340
   apply(erule conjE)
23757
087b0a241557 - Renamed inductive2 to inductive
berghofe
parents: 22271
diff changeset
   341
   apply(erule_tac z = u in converse_rtranclpE)
12542
ff5e3f11e1ef added exec_lub
nipkow
parents: 12516
diff changeset
   342
    apply(blast dest: is_lubD is_ubD)
23757
087b0a241557 - Renamed inductive2 to inductive
berghofe
parents: 22271
diff changeset
   343
   apply(blast dest: rtranclp.rtrancl_into_rtrancl)
12542
ff5e3f11e1ef added exec_lub
nipkow
parents: 12516
diff changeset
   344
  apply(rename_tac s)
22271
51a80e238b29 Adapted to new inductive definition package.
berghofe
parents: 16417
diff changeset
   345
  apply(subgoal_tac "is_ub (r\<^sup>*\<^sup>*) x y s")
12542
ff5e3f11e1ef added exec_lub
nipkow
parents: 12516
diff changeset
   346
   prefer 2; apply(simp add:is_ub_def)
22271
51a80e238b29 Adapted to new inductive definition package.
berghofe
parents: 16417
diff changeset
   347
  apply(subgoal_tac "r\<^sup>*\<^sup>* u s")
12542
ff5e3f11e1ef added exec_lub
nipkow
parents: 12516
diff changeset
   348
   prefer 2; apply(blast dest:is_lubD)
23757
087b0a241557 - Renamed inductive2 to inductive
berghofe
parents: 22271
diff changeset
   349
  apply(erule converse_rtranclpE)
12542
ff5e3f11e1ef added exec_lub
nipkow
parents: 12516
diff changeset
   350
   apply blast
22271
51a80e238b29 Adapted to new inductive definition package.
berghofe
parents: 16417
diff changeset
   351
  apply(simp only:acyclic_def [to_pred])
23757
087b0a241557 - Renamed inductive2 to inductive
berghofe
parents: 22271
diff changeset
   352
  apply(blast intro:rtranclp_into_tranclp2 rtranclp_tranclp_tranclp)
12542
ff5e3f11e1ef added exec_lub
nipkow
parents: 12516
diff changeset
   353
 apply(rule finite_acyclic_wf)
ff5e3f11e1ef added exec_lub
nipkow
parents: 12516
diff changeset
   354
  apply simp
ff5e3f11e1ef added exec_lub
nipkow
parents: 12516
diff changeset
   355
  apply(erule acyclic_single_valued_finite)
ff5e3f11e1ef added exec_lub
nipkow
parents: 12516
diff changeset
   356
   apply(blast intro:single_valuedI)
ff5e3f11e1ef added exec_lub
nipkow
parents: 12516
diff changeset
   357
  apply(simp add:is_lub_def is_ub_def)
ff5e3f11e1ef added exec_lub
nipkow
parents: 12516
diff changeset
   358
 apply simp
ff5e3f11e1ef added exec_lub
nipkow
parents: 12516
diff changeset
   359
 apply(erule acyclic_subset)
ff5e3f11e1ef added exec_lub
nipkow
parents: 12516
diff changeset
   360
 apply blast
ff5e3f11e1ef added exec_lub
nipkow
parents: 12516
diff changeset
   361
apply simp
ff5e3f11e1ef added exec_lub
nipkow
parents: 12516
diff changeset
   362
apply(erule conjE)
23757
087b0a241557 - Renamed inductive2 to inductive
berghofe
parents: 22271
diff changeset
   363
apply(erule_tac z = u in converse_rtranclpE)
12542
ff5e3f11e1ef added exec_lub
nipkow
parents: 12516
diff changeset
   364
 apply(blast dest: is_lubD is_ubD)
22271
51a80e238b29 Adapted to new inductive definition package.
berghofe
parents: 16417
diff changeset
   365
apply blast
12542
ff5e3f11e1ef added exec_lub
nipkow
parents: 12516
diff changeset
   366
done
ff5e3f11e1ef added exec_lub
nipkow
parents: 12516
diff changeset
   367
12773
a47f51daa6dc use exec_lub instead of some_lub
kleing
parents: 12566
diff changeset
   368
lemma is_lub_exec_lub:
22271
51a80e238b29 Adapted to new inductive definition package.
berghofe
parents: 16417
diff changeset
   369
  "\<lbrakk> single_valuedP r; acyclicP r; r^** x u; r^** y u; !x y. r x y \<longrightarrow> f x = y \<rbrakk>
51a80e238b29 Adapted to new inductive definition package.
berghofe
parents: 16417
diff changeset
   370
  \<Longrightarrow> is_lub (r^** ) x y (exec_lub r f x y)"
12773
a47f51daa6dc use exec_lub instead of some_lub
kleing
parents: 12566
diff changeset
   371
  by (fastsimp dest: single_valued_has_lubs simp add: exec_lub_conv)
a47f51daa6dc use exec_lub instead of some_lub
kleing
parents: 12566
diff changeset
   372
10496
f2d304bdf3cc BCV integration (first step)
kleing
parents:
diff changeset
   373
end