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