src/HOL/UNITY/ListOrder.thy
author krauss
Mon Jul 27 21:47:41 2009 +0200 (2009-07-27 ago)
changeset 32235 8f9b8d14fc9f
parent 30198 922f944f03b2
child 32960 69916a850301
permissions -rw-r--r--
"more standard" argument order of relation composition (op O)
paulson@6708
     1
(*  Title:      HOL/UNITY/ListOrder
paulson@6708
     2
    ID:         $Id$
paulson@6708
     3
    Author:     Lawrence C Paulson, Cambridge University Computer Laboratory
paulson@6708
     4
    Copyright   1998  University of Cambridge
paulson@6708
     5
paulson@13798
     6
Lists are partially ordered by Charpentier's Generalized Prefix Relation
paulson@13798
     7
   (xs,ys) : genPrefix(r)
paulson@13798
     8
     if ys = xs' @ zs where length xs = length xs'
paulson@13798
     9
     and corresponding elements of xs, xs' are pairwise related by r
paulson@13798
    10
paulson@13798
    11
Also overloads <= and < for lists!
paulson@13798
    12
paulson@13798
    13
Based on Lex/Prefix
paulson@6708
    14
*)
paulson@6708
    15
paulson@13798
    16
header {*The Prefix Ordering on Lists*}
paulson@13798
    17
haftmann@27682
    18
theory ListOrder
haftmann@27682
    19
imports Main
haftmann@27682
    20
begin
paulson@13798
    21
berghofe@23767
    22
inductive_set
paulson@13798
    23
  genPrefix :: "('a * 'a)set => ('a list * 'a list)set"
berghofe@23767
    24
  for r :: "('a * 'a)set"
berghofe@23767
    25
 where
paulson@13798
    26
   Nil:     "([],[]) : genPrefix(r)"
paulson@13798
    27
berghofe@23767
    28
 | prepend: "[| (xs,ys) : genPrefix(r);  (x,y) : r |] ==>
paulson@13798
    29
	     (x#xs, y#ys) : genPrefix(r)"
paulson@13798
    30
berghofe@23767
    31
 | append:  "(xs,ys) : genPrefix(r) ==> (xs, ys@zs) : genPrefix(r)"
paulson@13798
    32
haftmann@27682
    33
instantiation list :: (type) ord 
haftmann@27682
    34
begin
paulson@13798
    35
haftmann@27682
    36
definition
haftmann@27682
    37
  prefix_def:        "xs <= zs \<longleftrightarrow>  (xs, zs) : genPrefix Id"
paulson@13798
    38
haftmann@27682
    39
definition
haftmann@27682
    40
  strict_prefix_def: "xs < zs  \<longleftrightarrow>  xs \<le> zs \<and> \<not> zs \<le> (xs :: 'a list)"
haftmann@27682
    41
haftmann@27682
    42
instance ..  
paulson@13798
    43
paulson@13798
    44
(*Constants for the <= and >= relations, used below in translations*)
haftmann@27682
    45
haftmann@27682
    46
end
haftmann@27682
    47
paulson@13798
    48
constdefs
paulson@13798
    49
  Le :: "(nat*nat) set"
paulson@13798
    50
    "Le == {(x,y). x <= y}"
paulson@13798
    51
paulson@13798
    52
  Ge :: "(nat*nat) set"
paulson@13798
    53
    "Ge == {(x,y). y <= x}"
paulson@13798
    54
berghofe@23767
    55
abbreviation
berghofe@23767
    56
  pfixLe :: "[nat list, nat list] => bool"  (infixl "pfixLe" 50)  where
berghofe@23767
    57
  "xs pfixLe ys == (xs,ys) : genPrefix Le"
paulson@13798
    58
berghofe@23767
    59
abbreviation
berghofe@23767
    60
  pfixGe :: "[nat list, nat list] => bool"  (infixl "pfixGe" 50)  where
berghofe@23767
    61
  "xs pfixGe ys == (xs,ys) : genPrefix Ge"
paulson@13798
    62
paulson@13798
    63
paulson@13798
    64
subsection{*preliminary lemmas*}
paulson@13798
    65
paulson@13798
    66
lemma Nil_genPrefix [iff]: "([], xs) : genPrefix r"
paulson@13798
    67
by (cut_tac genPrefix.Nil [THEN genPrefix.append], auto)
paulson@13798
    68
paulson@13798
    69
lemma genPrefix_length_le: "(xs,ys) : genPrefix r ==> length xs <= length ys"
paulson@13798
    70
by (erule genPrefix.induct, auto)
paulson@13798
    71
paulson@13798
    72
lemma cdlemma:
paulson@13798
    73
     "[| (xs', ys'): genPrefix r |]  
paulson@13798
    74
      ==> (ALL x xs. xs' = x#xs --> (EX y ys. ys' = y#ys & (x,y) : r & (xs, ys) : genPrefix r))"
paulson@13798
    75
apply (erule genPrefix.induct, blast, blast)
paulson@13798
    76
apply (force intro: genPrefix.append)
paulson@13798
    77
done
paulson@13798
    78
paulson@13798
    79
(*As usual converting it to an elimination rule is tiresome*)
paulson@13798
    80
lemma cons_genPrefixE [elim!]: 
paulson@13798
    81
     "[| (x#xs, zs): genPrefix r;   
paulson@13798
    82
         !!y ys. [| zs = y#ys;  (x,y) : r;  (xs, ys) : genPrefix r |] ==> P  
paulson@13798
    83
      |] ==> P"
paulson@13798
    84
by (drule cdlemma, simp, blast)
paulson@13798
    85
paulson@13798
    86
lemma Cons_genPrefix_Cons [iff]:
paulson@13798
    87
     "((x#xs,y#ys) : genPrefix r) = ((x,y) : r & (xs,ys) : genPrefix r)"
paulson@13798
    88
by (blast intro: genPrefix.prepend)
paulson@13798
    89
paulson@13798
    90
paulson@13798
    91
subsection{*genPrefix is a partial order*}
paulson@13798
    92
nipkow@30198
    93
lemma refl_genPrefix: "refl r ==> refl (genPrefix r)"
nipkow@30198
    94
apply (unfold refl_on_def, auto)
paulson@13798
    95
apply (induct_tac "x")
paulson@13798
    96
prefer 2 apply (blast intro: genPrefix.prepend)
paulson@13798
    97
apply (blast intro: genPrefix.Nil)
paulson@13798
    98
done
paulson@13798
    99
nipkow@30198
   100
lemma genPrefix_refl [simp]: "refl r ==> (l,l) : genPrefix r"
nipkow@30198
   101
by (erule refl_onD [OF refl_genPrefix UNIV_I])
paulson@13798
   102
paulson@13798
   103
lemma genPrefix_mono: "r<=s ==> genPrefix r <= genPrefix s"
paulson@13798
   104
apply clarify
paulson@13798
   105
apply (erule genPrefix.induct)
paulson@13798
   106
apply (auto intro: genPrefix.append)
paulson@13798
   107
done
paulson@13798
   108
paulson@13798
   109
paulson@13798
   110
(** Transitivity **)
paulson@13798
   111
paulson@13798
   112
(*A lemma for proving genPrefix_trans_O*)
paulson@13798
   113
lemma append_genPrefix [rule_format]:
paulson@13798
   114
     "ALL zs. (xs @ ys, zs) : genPrefix r --> (xs, zs) : genPrefix r"
paulson@13798
   115
by (induct_tac "xs", auto)
paulson@13798
   116
paulson@13798
   117
(*Lemma proving transitivity and more*)
paulson@13798
   118
lemma genPrefix_trans_O [rule_format]: 
paulson@13798
   119
     "(x, y) : genPrefix r  
krauss@32235
   120
      ==> ALL z. (y,z) : genPrefix s --> (x, z) : genPrefix (r O s)"
paulson@13798
   121
apply (erule genPrefix.induct)
paulson@13798
   122
  prefer 3 apply (blast dest: append_genPrefix)
paulson@13798
   123
 prefer 2 apply (blast intro: genPrefix.prepend, blast)
paulson@13798
   124
done
paulson@13798
   125
paulson@13798
   126
lemma genPrefix_trans [rule_format]:
paulson@13798
   127
     "[| (x,y) : genPrefix r;  (y,z) : genPrefix r;  trans r |]  
paulson@13798
   128
      ==> (x,z) : genPrefix r"
paulson@13798
   129
apply (rule trans_O_subset [THEN genPrefix_mono, THEN subsetD])
paulson@13798
   130
 apply assumption
paulson@13798
   131
apply (blast intro: genPrefix_trans_O)
paulson@13798
   132
done
paulson@13798
   133
paulson@13798
   134
lemma prefix_genPrefix_trans [rule_format]: 
paulson@13798
   135
     "[| x<=y;  (y,z) : genPrefix r |] ==> (x, z) : genPrefix r"
paulson@13798
   136
apply (unfold prefix_def)
krauss@32235
   137
apply (drule genPrefix_trans_O, assumption)
krauss@32235
   138
apply simp
paulson@13798
   139
done
paulson@13798
   140
paulson@13798
   141
lemma genPrefix_prefix_trans [rule_format]: 
paulson@13798
   142
     "[| (x,y) : genPrefix r;  y<=z |] ==> (x,z) : genPrefix r"
paulson@13798
   143
apply (unfold prefix_def)
krauss@32235
   144
apply (drule genPrefix_trans_O, assumption)
krauss@32235
   145
apply simp
paulson@13798
   146
done
paulson@13798
   147
paulson@13798
   148
lemma trans_genPrefix: "trans r ==> trans (genPrefix r)"
paulson@13798
   149
by (blast intro: transI genPrefix_trans)
paulson@13798
   150
paulson@13798
   151
paulson@13798
   152
(** Antisymmetry **)
paulson@13798
   153
paulson@13798
   154
lemma genPrefix_antisym [rule_format]:
paulson@13798
   155
     "[| (xs,ys) : genPrefix r;  antisym r |]  
paulson@13798
   156
      ==> (ys,xs) : genPrefix r --> xs = ys"
paulson@13798
   157
apply (erule genPrefix.induct)
paulson@13798
   158
  txt{*Base case*}
paulson@13798
   159
  apply blast
paulson@13798
   160
 txt{*prepend case*}
paulson@13798
   161
 apply (simp add: antisym_def)
paulson@13798
   162
txt{*append case is the hardest*}
paulson@13798
   163
apply clarify
paulson@13798
   164
apply (subgoal_tac "length zs = 0", force)
paulson@13798
   165
apply (drule genPrefix_length_le)+
paulson@13798
   166
apply (simp del: length_0_conv)
paulson@13798
   167
done
paulson@13798
   168
paulson@13798
   169
lemma antisym_genPrefix: "antisym r ==> antisym (genPrefix r)"
paulson@13798
   170
by (blast intro: antisymI genPrefix_antisym)
paulson@13798
   171
paulson@13798
   172
paulson@13798
   173
subsection{*recursion equations*}
paulson@13798
   174
paulson@13798
   175
lemma genPrefix_Nil [simp]: "((xs, []) : genPrefix r) = (xs = [])"
paulson@13798
   176
apply (induct_tac "xs")
paulson@13798
   177
prefer 2 apply blast
paulson@13798
   178
apply simp
paulson@13798
   179
done
paulson@13798
   180
paulson@13798
   181
lemma same_genPrefix_genPrefix [simp]: 
nipkow@30198
   182
    "refl r ==> ((xs@ys, xs@zs) : genPrefix r) = ((ys,zs) : genPrefix r)"
nipkow@30198
   183
apply (unfold refl_on_def)
paulson@13798
   184
apply (induct_tac "xs")
paulson@13798
   185
apply (simp_all (no_asm_simp))
paulson@13798
   186
done
paulson@13798
   187
paulson@13798
   188
lemma genPrefix_Cons:
paulson@13798
   189
     "((xs, y#ys) : genPrefix r) =  
paulson@13798
   190
      (xs=[] | (EX z zs. xs=z#zs & (z,y) : r & (zs,ys) : genPrefix r))"
paulson@13798
   191
by (case_tac "xs", auto)
paulson@13798
   192
paulson@13798
   193
lemma genPrefix_take_append:
nipkow@30198
   194
     "[| refl r;  (xs,ys) : genPrefix r |]  
paulson@13798
   195
      ==>  (xs@zs, take (length xs) ys @ zs) : genPrefix r"
paulson@13798
   196
apply (erule genPrefix.induct)
paulson@13798
   197
apply (frule_tac [3] genPrefix_length_le)
paulson@13798
   198
apply (simp_all (no_asm_simp) add: diff_is_0_eq [THEN iffD2])
paulson@13798
   199
done
paulson@13798
   200
paulson@13798
   201
lemma genPrefix_append_both:
nipkow@30198
   202
     "[| refl r;  (xs,ys) : genPrefix r;  length xs = length ys |]  
paulson@13798
   203
      ==>  (xs@zs, ys @ zs) : genPrefix r"
paulson@13798
   204
apply (drule genPrefix_take_append, assumption)
paulson@13798
   205
apply (simp add: take_all)
paulson@13798
   206
done
paulson@13798
   207
paulson@13798
   208
paulson@13798
   209
(*NOT suitable for rewriting since [y] has the form y#ys*)
paulson@13798
   210
lemma append_cons_eq: "xs @ y # ys = (xs @ [y]) @ ys"
paulson@13798
   211
by auto
paulson@13798
   212
paulson@13798
   213
lemma aolemma:
nipkow@30198
   214
     "[| (xs,ys) : genPrefix r;  refl r |]  
paulson@13798
   215
      ==> length xs < length ys --> (xs @ [ys ! length xs], ys) : genPrefix r"
paulson@13798
   216
apply (erule genPrefix.induct)
paulson@13798
   217
  apply blast
paulson@13798
   218
 apply simp
paulson@13798
   219
txt{*Append case is hardest*}
paulson@13798
   220
apply simp
paulson@13798
   221
apply (frule genPrefix_length_le [THEN le_imp_less_or_eq])
paulson@13798
   222
apply (erule disjE)
paulson@13798
   223
apply (simp_all (no_asm_simp) add: neq_Nil_conv nth_append)
paulson@13798
   224
apply (blast intro: genPrefix.append, auto)
paulson@15481
   225
apply (subst append_cons_eq, fast intro: genPrefix_append_both genPrefix.append)
paulson@13798
   226
done
paulson@13798
   227
paulson@13798
   228
lemma append_one_genPrefix:
nipkow@30198
   229
     "[| (xs,ys) : genPrefix r;  length xs < length ys;  refl r |]  
paulson@13798
   230
      ==> (xs @ [ys ! length xs], ys) : genPrefix r"
paulson@13798
   231
by (blast intro: aolemma [THEN mp])
paulson@13798
   232
paulson@13798
   233
paulson@13798
   234
(** Proving the equivalence with Charpentier's definition **)
paulson@13798
   235
paulson@13798
   236
lemma genPrefix_imp_nth [rule_format]:
paulson@13798
   237
     "ALL i ys. i < length xs  
paulson@13798
   238
                --> (xs, ys) : genPrefix r --> (xs ! i, ys ! i) : r"
paulson@13798
   239
apply (induct_tac "xs", auto)
paulson@13798
   240
apply (case_tac "i", auto)
paulson@13798
   241
done
paulson@13798
   242
paulson@13798
   243
lemma nth_imp_genPrefix [rule_format]:
paulson@13798
   244
     "ALL ys. length xs <= length ys   
paulson@13798
   245
      --> (ALL i. i < length xs --> (xs ! i, ys ! i) : r)   
paulson@13798
   246
      --> (xs, ys) : genPrefix r"
paulson@13798
   247
apply (induct_tac "xs")
paulson@13798
   248
apply (simp_all (no_asm_simp) add: less_Suc_eq_0_disj all_conj_distrib)
paulson@13798
   249
apply clarify
paulson@13798
   250
apply (case_tac "ys")
paulson@13798
   251
apply (force+)
paulson@13798
   252
done
paulson@13798
   253
paulson@13798
   254
lemma genPrefix_iff_nth:
paulson@13798
   255
     "((xs,ys) : genPrefix r) =  
paulson@13798
   256
      (length xs <= length ys & (ALL i. i < length xs --> (xs!i, ys!i) : r))"
paulson@13798
   257
apply (blast intro: genPrefix_length_le genPrefix_imp_nth nth_imp_genPrefix)
paulson@13798
   258
done
paulson@13798
   259
paulson@13798
   260
paulson@13798
   261
subsection{*The type of lists is partially ordered*}
paulson@13798
   262
nipkow@30198
   263
declare refl_Id [iff] 
paulson@13798
   264
        antisym_Id [iff] 
paulson@13798
   265
        trans_Id [iff]
paulson@13798
   266
paulson@13798
   267
lemma prefix_refl [iff]: "xs <= (xs::'a list)"
paulson@13798
   268
by (simp add: prefix_def)
paulson@13798
   269
paulson@13798
   270
lemma prefix_trans: "!!xs::'a list. [| xs <= ys; ys <= zs |] ==> xs <= zs"
paulson@13798
   271
apply (unfold prefix_def)
paulson@13798
   272
apply (blast intro: genPrefix_trans)
paulson@13798
   273
done
paulson@13798
   274
paulson@13798
   275
lemma prefix_antisym: "!!xs::'a list. [| xs <= ys; ys <= xs |] ==> xs = ys"
paulson@13798
   276
apply (unfold prefix_def)
paulson@13798
   277
apply (blast intro: genPrefix_antisym)
paulson@13798
   278
done
paulson@13798
   279
haftmann@27682
   280
lemma prefix_less_le_not_le: "!!xs::'a list. (xs < zs) = (xs <= zs & \<not> zs \<le> xs)"
paulson@13798
   281
by (unfold strict_prefix_def, auto)
paulson@6708
   282
wenzelm@12338
   283
instance list :: (type) order
paulson@13798
   284
  by (intro_classes,
paulson@13798
   285
      (assumption | rule prefix_refl prefix_trans prefix_antisym
haftmann@27682
   286
                     prefix_less_le_not_le)+)
paulson@13798
   287
paulson@13798
   288
(*Monotonicity of "set" operator WRT prefix*)
paulson@13798
   289
lemma set_mono: "xs <= ys ==> set xs <= set ys"
paulson@13798
   290
apply (unfold prefix_def)
paulson@13798
   291
apply (erule genPrefix.induct, auto)
paulson@13798
   292
done
paulson@13798
   293
paulson@13798
   294
paulson@13798
   295
(** recursion equations **)
paulson@13798
   296
paulson@13798
   297
lemma Nil_prefix [iff]: "[] <= xs"
paulson@13798
   298
apply (unfold prefix_def)
paulson@13798
   299
apply (simp add: Nil_genPrefix)
paulson@13798
   300
done
paulson@13798
   301
paulson@13798
   302
lemma prefix_Nil [simp]: "(xs <= []) = (xs = [])"
paulson@13798
   303
apply (unfold prefix_def)
paulson@13798
   304
apply (simp add: genPrefix_Nil)
paulson@13798
   305
done
paulson@13798
   306
paulson@13798
   307
lemma Cons_prefix_Cons [simp]: "(x#xs <= y#ys) = (x=y & xs<=ys)"
paulson@13798
   308
by (simp add: prefix_def)
paulson@13798
   309
paulson@13798
   310
lemma same_prefix_prefix [simp]: "(xs@ys <= xs@zs) = (ys <= zs)"
paulson@13798
   311
by (simp add: prefix_def)
paulson@13798
   312
paulson@13798
   313
lemma append_prefix [iff]: "(xs@ys <= xs) = (ys <= [])"
paulson@13798
   314
by (insert same_prefix_prefix [of xs ys "[]"], simp)
paulson@13798
   315
paulson@13798
   316
lemma prefix_appendI [simp]: "xs <= ys ==> xs <= ys@zs"
paulson@13798
   317
apply (unfold prefix_def)
paulson@13798
   318
apply (erule genPrefix.append)
paulson@13798
   319
done
paulson@13798
   320
paulson@13798
   321
lemma prefix_Cons: 
paulson@13798
   322
   "(xs <= y#ys) = (xs=[] | (? zs. xs=y#zs & zs <= ys))"
paulson@13798
   323
by (simp add: prefix_def genPrefix_Cons)
paulson@13798
   324
paulson@13798
   325
lemma append_one_prefix: 
paulson@13798
   326
  "[| xs <= ys; length xs < length ys |] ==> xs @ [ys ! length xs] <= ys"
paulson@13798
   327
apply (unfold prefix_def)
paulson@13798
   328
apply (simp add: append_one_genPrefix)
paulson@13798
   329
done
paulson@13798
   330
paulson@13798
   331
lemma prefix_length_le: "xs <= ys ==> length xs <= length ys"
paulson@13798
   332
apply (unfold prefix_def)
paulson@13798
   333
apply (erule genPrefix_length_le)
paulson@13798
   334
done
paulson@13798
   335
paulson@13798
   336
lemma splemma: "xs<=ys ==> xs~=ys --> length xs < length ys"
paulson@13798
   337
apply (unfold prefix_def)
paulson@13798
   338
apply (erule genPrefix.induct, auto)
paulson@13798
   339
done
paulson@13798
   340
paulson@13798
   341
lemma strict_prefix_length_less: "xs < ys ==> length xs < length ys"
paulson@13798
   342
apply (unfold strict_prefix_def)
paulson@13798
   343
apply (blast intro: splemma [THEN mp])
paulson@13798
   344
done
paulson@13798
   345
paulson@13798
   346
lemma mono_length: "mono length"
paulson@13798
   347
by (blast intro: monoI prefix_length_le)
paulson@13798
   348
paulson@13798
   349
(*Equivalence to the definition used in Lex/Prefix.thy*)
paulson@13798
   350
lemma prefix_iff: "(xs <= zs) = (EX ys. zs = xs@ys)"
paulson@13798
   351
apply (unfold prefix_def)
paulson@13798
   352
apply (auto simp add: genPrefix_iff_nth nth_append)
paulson@13798
   353
apply (rule_tac x = "drop (length xs) zs" in exI)
paulson@13798
   354
apply (rule nth_equalityI)
paulson@13798
   355
apply (simp_all (no_asm_simp) add: nth_append)
paulson@13798
   356
done
paulson@13798
   357
paulson@13798
   358
lemma prefix_snoc [simp]: "(xs <= ys@[y]) = (xs = ys@[y] | xs <= ys)"
paulson@13798
   359
apply (simp add: prefix_iff)
paulson@13798
   360
apply (rule iffI)
paulson@13798
   361
 apply (erule exE)
paulson@13798
   362
 apply (rename_tac "zs")
paulson@13798
   363
 apply (rule_tac xs = zs in rev_exhaust)
paulson@13798
   364
  apply simp
paulson@13798
   365
 apply clarify
paulson@13798
   366
 apply (simp del: append_assoc add: append_assoc [symmetric], force)
paulson@13798
   367
done
paulson@13798
   368
paulson@13798
   369
lemma prefix_append_iff:
paulson@13798
   370
     "(xs <= ys@zs) = (xs <= ys | (? us. xs = ys@us & us <= zs))"
paulson@13798
   371
apply (rule_tac xs = zs in rev_induct)
paulson@13798
   372
 apply force
paulson@13798
   373
apply (simp del: append_assoc add: append_assoc [symmetric], force)
paulson@13798
   374
done
paulson@13798
   375
paulson@13798
   376
(*Although the prefix ordering is not linear, the prefixes of a list
paulson@13798
   377
  are linearly ordered.*)
paulson@13798
   378
lemma common_prefix_linear [rule_format]:
paulson@13798
   379
     "!!zs::'a list. xs <= zs --> ys <= zs --> xs <= ys | ys <= xs"
paulson@13798
   380
by (rule_tac xs = zs in rev_induct, auto)
paulson@13798
   381
paulson@13798
   382
paulson@13798
   383
subsection{*pfixLe, pfixGe: properties inherited from the translations*}
paulson@13798
   384
paulson@13798
   385
(** pfixLe **)
paulson@13798
   386
nipkow@30198
   387
lemma refl_Le [iff]: "refl Le"
nipkow@30198
   388
by (unfold refl_on_def Le_def, auto)
paulson@13798
   389
paulson@13798
   390
lemma antisym_Le [iff]: "antisym Le"
paulson@13798
   391
by (unfold antisym_def Le_def, auto)
paulson@13798
   392
paulson@13798
   393
lemma trans_Le [iff]: "trans Le"
paulson@13798
   394
by (unfold trans_def Le_def, auto)
paulson@13798
   395
paulson@13798
   396
lemma pfixLe_refl [iff]: "x pfixLe x"
paulson@13798
   397
by simp
paulson@13798
   398
paulson@13798
   399
lemma pfixLe_trans: "[| x pfixLe y; y pfixLe z |] ==> x pfixLe z"
paulson@13798
   400
by (blast intro: genPrefix_trans)
paulson@13798
   401
paulson@13798
   402
lemma pfixLe_antisym: "[| x pfixLe y; y pfixLe x |] ==> x = y"
paulson@13798
   403
by (blast intro: genPrefix_antisym)
paulson@13798
   404
paulson@13798
   405
lemma prefix_imp_pfixLe: "xs<=ys ==> xs pfixLe ys"
paulson@13798
   406
apply (unfold prefix_def Le_def)
paulson@13798
   407
apply (blast intro: genPrefix_mono [THEN [2] rev_subsetD])
paulson@13798
   408
done
paulson@13798
   409
nipkow@30198
   410
lemma refl_Ge [iff]: "refl Ge"
nipkow@30198
   411
by (unfold refl_on_def Ge_def, auto)
paulson@13798
   412
paulson@13798
   413
lemma antisym_Ge [iff]: "antisym Ge"
paulson@13798
   414
by (unfold antisym_def Ge_def, auto)
paulson@13798
   415
paulson@13798
   416
lemma trans_Ge [iff]: "trans Ge"
paulson@13798
   417
by (unfold trans_def Ge_def, auto)
paulson@13798
   418
paulson@13798
   419
lemma pfixGe_refl [iff]: "x pfixGe x"
paulson@13798
   420
by simp
paulson@13798
   421
paulson@13798
   422
lemma pfixGe_trans: "[| x pfixGe y; y pfixGe z |] ==> x pfixGe z"
paulson@13798
   423
by (blast intro: genPrefix_trans)
paulson@13798
   424
paulson@13798
   425
lemma pfixGe_antisym: "[| x pfixGe y; y pfixGe x |] ==> x = y"
paulson@13798
   426
by (blast intro: genPrefix_antisym)
paulson@13798
   427
paulson@13798
   428
lemma prefix_imp_pfixGe: "xs<=ys ==> xs pfixGe ys"
paulson@13798
   429
apply (unfold prefix_def Ge_def)
paulson@13798
   430
apply (blast intro: genPrefix_mono [THEN [2] rev_subsetD])
paulson@13798
   431
done
paulson@6708
   432
paulson@6708
   433
end