Myhill.thy
author urbanc
Thu, 27 Jan 2011 16:58:11 +0000
changeset 43 cb4403fabda7
parent 42 f809cb54de4e
child 45 7aa6c20e6d31
permissions -rw-r--r--
added my changes again
Ignore whitespace changes - Everywhere: Within whitespace: At end of lines:
31
b6815473ee2e 1. Myhill.thy is proved to correct some typos. 2. Some sections are added to the first direction. 3. The small theory of list difference is now separated into Prefix_subtract.thy and the ROOT.ML
zhang
parents: 30
diff changeset
     1
theory Myhill
42
f809cb54de4e Trying to solve the confict
zhang
parents: 40
diff changeset
     2
  imports Myhill_1
31
b6815473ee2e 1. Myhill.thy is proved to correct some typos. 2. Some sections are added to the first direction. 3. The small theory of list difference is now separated into Prefix_subtract.thy and the ROOT.ML
zhang
parents: 30
diff changeset
     3
begin
b6815473ee2e 1. Myhill.thy is proved to correct some typos. 2. Some sections are added to the first direction. 3. The small theory of list difference is now separated into Prefix_subtract.thy and the ROOT.ML
zhang
parents: 30
diff changeset
     4
42
f809cb54de4e Trying to solve the confict
zhang
parents: 40
diff changeset
     5
section {* Direction: @{text "regular language \<Rightarrow>finite partition"} *}
31
b6815473ee2e 1. Myhill.thy is proved to correct some typos. 2. Some sections are added to the first direction. 3. The small theory of list difference is now separated into Prefix_subtract.thy and the ROOT.ML
zhang
parents: 30
diff changeset
     6
b6815473ee2e 1. Myhill.thy is proved to correct some typos. 2. Some sections are added to the first direction. 3. The small theory of list difference is now separated into Prefix_subtract.thy and the ROOT.ML
zhang
parents: 30
diff changeset
     7
subsection {* The scheme for this direction *}
b6815473ee2e 1. Myhill.thy is proved to correct some typos. 2. Some sections are added to the first direction. 3. The small theory of list difference is now separated into Prefix_subtract.thy and the ROOT.ML
zhang
parents: 30
diff changeset
     8
b6815473ee2e 1. Myhill.thy is proved to correct some typos. 2. Some sections are added to the first direction. 3. The small theory of list difference is now separated into Prefix_subtract.thy and the ROOT.ML
zhang
parents: 30
diff changeset
     9
text {* 
b6815473ee2e 1. Myhill.thy is proved to correct some typos. 2. Some sections are added to the first direction. 3. The small theory of list difference is now separated into Prefix_subtract.thy and the ROOT.ML
zhang
parents: 30
diff changeset
    10
  The following convenient notation @{text "x \<approx>Lang y"} means:
b6815473ee2e 1. Myhill.thy is proved to correct some typos. 2. Some sections are added to the first direction. 3. The small theory of list difference is now separated into Prefix_subtract.thy and the ROOT.ML
zhang
parents: 30
diff changeset
    11
  string @{text "x"} and @{text "y"} are equivalent with respect to 
b6815473ee2e 1. Myhill.thy is proved to correct some typos. 2. Some sections are added to the first direction. 3. The small theory of list difference is now separated into Prefix_subtract.thy and the ROOT.ML
zhang
parents: 30
diff changeset
    12
  language @{text "Lang"}.
b6815473ee2e 1. Myhill.thy is proved to correct some typos. 2. Some sections are added to the first direction. 3. The small theory of list difference is now separated into Prefix_subtract.thy and the ROOT.ML
zhang
parents: 30
diff changeset
    13
  *}
b6815473ee2e 1. Myhill.thy is proved to correct some typos. 2. Some sections are added to the first direction. 3. The small theory of list difference is now separated into Prefix_subtract.thy and the ROOT.ML
zhang
parents: 30
diff changeset
    14
b6815473ee2e 1. Myhill.thy is proved to correct some typos. 2. Some sections are added to the first direction. 3. The small theory of list difference is now separated into Prefix_subtract.thy and the ROOT.ML
zhang
parents: 30
diff changeset
    15
definition
43
cb4403fabda7 added my changes again
urbanc
parents: 42
diff changeset
    16
  str_eq :: "string \<Rightarrow> lang \<Rightarrow> string \<Rightarrow> bool" ("_ \<approx>_ _")
31
b6815473ee2e 1. Myhill.thy is proved to correct some typos. 2. Some sections are added to the first direction. 3. The small theory of list difference is now separated into Prefix_subtract.thy and the ROOT.ML
zhang
parents: 30
diff changeset
    17
where
b6815473ee2e 1. Myhill.thy is proved to correct some typos. 2. Some sections are added to the first direction. 3. The small theory of list difference is now separated into Prefix_subtract.thy and the ROOT.ML
zhang
parents: 30
diff changeset
    18
  "x \<approx>Lang y \<equiv> (x, y) \<in> (\<approx>Lang)"
b6815473ee2e 1. Myhill.thy is proved to correct some typos. 2. Some sections are added to the first direction. 3. The small theory of list difference is now separated into Prefix_subtract.thy and the ROOT.ML
zhang
parents: 30
diff changeset
    19
b6815473ee2e 1. Myhill.thy is proved to correct some typos. 2. Some sections are added to the first direction. 3. The small theory of list difference is now separated into Prefix_subtract.thy and the ROOT.ML
zhang
parents: 30
diff changeset
    20
text {*
42
f809cb54de4e Trying to solve the confict
zhang
parents: 40
diff changeset
    21
  The very basic scheme to show the finiteness of the partion generated by a language @{text "Lang"}
f809cb54de4e Trying to solve the confict
zhang
parents: 40
diff changeset
    22
  is by attaching a tag to every string. The set of tags are carfully choosen to be finite so that
f809cb54de4e Trying to solve the confict
zhang
parents: 40
diff changeset
    23
  the range of tagging function is finite. If it can be proved that strings with the same tag 
f809cb54de4e Trying to solve the confict
zhang
parents: 40
diff changeset
    24
  are equivlent with respect @{text "Lang"}, then the partition given rise by @{text "Lang"} must be finite. 
f809cb54de4e Trying to solve the confict
zhang
parents: 40
diff changeset
    25
  The detailed argjument for this is formalized by the following lemma @{text "tag_finite_imageD"}.
f809cb54de4e Trying to solve the confict
zhang
parents: 40
diff changeset
    26
  The basic idea is using lemma @{thm [source] "finite_imageD"}
f809cb54de4e Trying to solve the confict
zhang
parents: 40
diff changeset
    27
  from standard library:
f809cb54de4e Trying to solve the confict
zhang
parents: 40
diff changeset
    28
  \[
f809cb54de4e Trying to solve the confict
zhang
parents: 40
diff changeset
    29
  @{thm "finite_imageD" [no_vars]}
f809cb54de4e Trying to solve the confict
zhang
parents: 40
diff changeset
    30
  \]
f809cb54de4e Trying to solve the confict
zhang
parents: 40
diff changeset
    31
  which says: if the image of injective function @{text "f"} over set @{text "A"} is 
f809cb54de4e Trying to solve the confict
zhang
parents: 40
diff changeset
    32
  finite, then @{text "A"} must be finte.
f809cb54de4e Trying to solve the confict
zhang
parents: 40
diff changeset
    33
  *}
39
a59473f0229d tuned a little bit the section about finite partitions
urbanc
parents: 35
diff changeset
    34
a59473f0229d tuned a little bit the section about finite partitions
urbanc
parents: 35
diff changeset
    35
42
f809cb54de4e Trying to solve the confict
zhang
parents: 40
diff changeset
    36
f809cb54de4e Trying to solve the confict
zhang
parents: 40
diff changeset
    37
(* I am trying to reduce the following proof to even simpler principles. But not yet succeed. *)
f809cb54de4e Trying to solve the confict
zhang
parents: 40
diff changeset
    38
definition 
f809cb54de4e Trying to solve the confict
zhang
parents: 40
diff changeset
    39
   f_eq_rel ("\<cong>_")
f809cb54de4e Trying to solve the confict
zhang
parents: 40
diff changeset
    40
where
f809cb54de4e Trying to solve the confict
zhang
parents: 40
diff changeset
    41
   "\<cong>(f::'a \<Rightarrow> 'b) = {(x, y) | x y. f x = f y}"
f809cb54de4e Trying to solve the confict
zhang
parents: 40
diff changeset
    42
f809cb54de4e Trying to solve the confict
zhang
parents: 40
diff changeset
    43
thm finite.induct
f809cb54de4e Trying to solve the confict
zhang
parents: 40
diff changeset
    44
f809cb54de4e Trying to solve the confict
zhang
parents: 40
diff changeset
    45
lemma finite_range_image: "finite (range f) \<Longrightarrow> finite (f ` A)"
f809cb54de4e Trying to solve the confict
zhang
parents: 40
diff changeset
    46
  by (rule_tac B = "{y. \<exists>x. y = f x}" in finite_subset, auto simp:image_def)
f809cb54de4e Trying to solve the confict
zhang
parents: 40
diff changeset
    47
f809cb54de4e Trying to solve the confict
zhang
parents: 40
diff changeset
    48
lemma "equiv UNIV (\<cong>f)"
f809cb54de4e Trying to solve the confict
zhang
parents: 40
diff changeset
    49
  by (auto simp:equiv_def f_eq_rel_def refl_on_def sym_def trans_def)
f809cb54de4e Trying to solve the confict
zhang
parents: 40
diff changeset
    50
f809cb54de4e Trying to solve the confict
zhang
parents: 40
diff changeset
    51
lemma 
f809cb54de4e Trying to solve the confict
zhang
parents: 40
diff changeset
    52
  assumes rng_fnt: "finite (range tag)"
f809cb54de4e Trying to solve the confict
zhang
parents: 40
diff changeset
    53
  shows "finite (UNIV // (\<cong>tag))"
f809cb54de4e Trying to solve the confict
zhang
parents: 40
diff changeset
    54
proof -
f809cb54de4e Trying to solve the confict
zhang
parents: 40
diff changeset
    55
  let "?f" =  "op ` tag" and ?A = "(UNIV // (\<cong>tag))"
f809cb54de4e Trying to solve the confict
zhang
parents: 40
diff changeset
    56
  show ?thesis
f809cb54de4e Trying to solve the confict
zhang
parents: 40
diff changeset
    57
  proof (rule_tac f = "?f" and A = ?A in finite_imageD) 
f809cb54de4e Trying to solve the confict
zhang
parents: 40
diff changeset
    58
    -- {* 
f809cb54de4e Trying to solve the confict
zhang
parents: 40
diff changeset
    59
      The finiteness of @{text "f"}-image is a simple consequence of assumption @{text "rng_fnt"}:
f809cb54de4e Trying to solve the confict
zhang
parents: 40
diff changeset
    60
      *}
f809cb54de4e Trying to solve the confict
zhang
parents: 40
diff changeset
    61
    show "finite (?f ` ?A)" 
f809cb54de4e Trying to solve the confict
zhang
parents: 40
diff changeset
    62
    proof -
f809cb54de4e Trying to solve the confict
zhang
parents: 40
diff changeset
    63
      have "\<forall> X. ?f X \<in> (Pow (range tag))" by (auto simp:image_def Pow_def)
f809cb54de4e Trying to solve the confict
zhang
parents: 40
diff changeset
    64
      moreover from rng_fnt have "finite (Pow (range tag))" by simp
f809cb54de4e Trying to solve the confict
zhang
parents: 40
diff changeset
    65
      ultimately have "finite (range ?f)"
f809cb54de4e Trying to solve the confict
zhang
parents: 40
diff changeset
    66
        by (auto simp only:image_def intro:finite_subset)
f809cb54de4e Trying to solve the confict
zhang
parents: 40
diff changeset
    67
      from finite_range_image [OF this] show ?thesis .
f809cb54de4e Trying to solve the confict
zhang
parents: 40
diff changeset
    68
    qed
f809cb54de4e Trying to solve the confict
zhang
parents: 40
diff changeset
    69
  next
f809cb54de4e Trying to solve the confict
zhang
parents: 40
diff changeset
    70
    -- {* 
f809cb54de4e Trying to solve the confict
zhang
parents: 40
diff changeset
    71
      The injectivity of @{text "f"}-image is a consequence of the definition of @{text "\<cong>tag"}
f809cb54de4e Trying to solve the confict
zhang
parents: 40
diff changeset
    72
      *}
f809cb54de4e Trying to solve the confict
zhang
parents: 40
diff changeset
    73
    show "inj_on ?f ?A" 
f809cb54de4e Trying to solve the confict
zhang
parents: 40
diff changeset
    74
    proof-
f809cb54de4e Trying to solve the confict
zhang
parents: 40
diff changeset
    75
      { fix X Y
f809cb54de4e Trying to solve the confict
zhang
parents: 40
diff changeset
    76
        assume X_in: "X \<in> ?A"
f809cb54de4e Trying to solve the confict
zhang
parents: 40
diff changeset
    77
          and  Y_in: "Y \<in> ?A"
f809cb54de4e Trying to solve the confict
zhang
parents: 40
diff changeset
    78
          and  tag_eq: "?f X = ?f Y"
f809cb54de4e Trying to solve the confict
zhang
parents: 40
diff changeset
    79
        have "X = Y"
f809cb54de4e Trying to solve the confict
zhang
parents: 40
diff changeset
    80
        proof -
f809cb54de4e Trying to solve the confict
zhang
parents: 40
diff changeset
    81
          from X_in Y_in tag_eq 
f809cb54de4e Trying to solve the confict
zhang
parents: 40
diff changeset
    82
          obtain x y where x_in: "x \<in> X" and y_in: "y \<in> Y" and eq_tg: "tag x = tag y"
f809cb54de4e Trying to solve the confict
zhang
parents: 40
diff changeset
    83
            unfolding quotient_def Image_def str_eq_rel_def str_eq_def image_def f_eq_rel_def
f809cb54de4e Trying to solve the confict
zhang
parents: 40
diff changeset
    84
            apply simp by blast
f809cb54de4e Trying to solve the confict
zhang
parents: 40
diff changeset
    85
          with X_in Y_in show ?thesis 
f809cb54de4e Trying to solve the confict
zhang
parents: 40
diff changeset
    86
            by (auto simp:quotient_def str_eq_rel_def str_eq_def f_eq_rel_def) 
f809cb54de4e Trying to solve the confict
zhang
parents: 40
diff changeset
    87
        qed
f809cb54de4e Trying to solve the confict
zhang
parents: 40
diff changeset
    88
      } thus ?thesis unfolding inj_on_def by auto
f809cb54de4e Trying to solve the confict
zhang
parents: 40
diff changeset
    89
    qed
f809cb54de4e Trying to solve the confict
zhang
parents: 40
diff changeset
    90
  qed
f809cb54de4e Trying to solve the confict
zhang
parents: 40
diff changeset
    91
qed
f809cb54de4e Trying to solve the confict
zhang
parents: 40
diff changeset
    92
f809cb54de4e Trying to solve the confict
zhang
parents: 40
diff changeset
    93
43
cb4403fabda7 added my changes again
urbanc
parents: 42
diff changeset
    94
(*
42
f809cb54de4e Trying to solve the confict
zhang
parents: 40
diff changeset
    95
lemma finite_range_image: "finite (range f) \<Longrightarrow> finite (f ` A)"
f809cb54de4e Trying to solve the confict
zhang
parents: 40
diff changeset
    96
  by (rule_tac B = "{y. \<exists>x. y = f x}" in finite_subset, auto simp:image_def)
43
cb4403fabda7 added my changes again
urbanc
parents: 42
diff changeset
    97
*)
31
b6815473ee2e 1. Myhill.thy is proved to correct some typos. 2. Some sections are added to the first direction. 3. The small theory of list difference is now separated into Prefix_subtract.thy and the ROOT.ML
zhang
parents: 30
diff changeset
    98
b6815473ee2e 1. Myhill.thy is proved to correct some typos. 2. Some sections are added to the first direction. 3. The small theory of list difference is now separated into Prefix_subtract.thy and the ROOT.ML
zhang
parents: 30
diff changeset
    99
lemma tag_finite_imageD:
43
cb4403fabda7 added my changes again
urbanc
parents: 42
diff changeset
   100
  fixes L :: "lang"
42
f809cb54de4e Trying to solve the confict
zhang
parents: 40
diff changeset
   101
  assumes rng_fnt: "finite (range tag)" 
43
cb4403fabda7 added my changes again
urbanc
parents: 42
diff changeset
   102
  -- {* Suppose the range of tagging fucntion @{text "tag"} is finite. *}
cb4403fabda7 added my changes again
urbanc
parents: 42
diff changeset
   103
  and same_tag_eqvt: "\<And> m n. tag m = tag n \<Longrightarrow> m \<approx>L n"
42
f809cb54de4e Trying to solve the confict
zhang
parents: 40
diff changeset
   104
  -- {* And strings with same tag are equivalent *}
43
cb4403fabda7 added my changes again
urbanc
parents: 42
diff changeset
   105
  shows "finite (UNIV // \<approx>L)"
cb4403fabda7 added my changes again
urbanc
parents: 42
diff changeset
   106
  -- {* Then the partition generated by @{text "\<approx>L"} is finite. *}
42
f809cb54de4e Trying to solve the confict
zhang
parents: 40
diff changeset
   107
proof -
f809cb54de4e Trying to solve the confict
zhang
parents: 40
diff changeset
   108
  -- {* The particular @{text "f"} and @{text "A"} used in @{thm [source] "finite_imageD"} are:*}
43
cb4403fabda7 added my changes again
urbanc
parents: 42
diff changeset
   109
  let "?f" =  "op ` tag" and ?A = "(UNIV // \<approx>L)"
42
f809cb54de4e Trying to solve the confict
zhang
parents: 40
diff changeset
   110
  show ?thesis
f809cb54de4e Trying to solve the confict
zhang
parents: 40
diff changeset
   111
  proof (rule_tac f = "?f" and A = ?A in finite_imageD) 
f809cb54de4e Trying to solve the confict
zhang
parents: 40
diff changeset
   112
    -- {* 
f809cb54de4e Trying to solve the confict
zhang
parents: 40
diff changeset
   113
      The finiteness of @{text "f"}-image is a simple consequence of assumption @{text "rng_fnt"}:
f809cb54de4e Trying to solve the confict
zhang
parents: 40
diff changeset
   114
      *}
f809cb54de4e Trying to solve the confict
zhang
parents: 40
diff changeset
   115
    show "finite (?f ` ?A)" 
f809cb54de4e Trying to solve the confict
zhang
parents: 40
diff changeset
   116
    proof -
f809cb54de4e Trying to solve the confict
zhang
parents: 40
diff changeset
   117
      have "\<forall> X. ?f X \<in> (Pow (range tag))" by (auto simp:image_def Pow_def)
f809cb54de4e Trying to solve the confict
zhang
parents: 40
diff changeset
   118
      moreover from rng_fnt have "finite (Pow (range tag))" by simp
f809cb54de4e Trying to solve the confict
zhang
parents: 40
diff changeset
   119
      ultimately have "finite (range ?f)"
f809cb54de4e Trying to solve the confict
zhang
parents: 40
diff changeset
   120
        by (auto simp only:image_def intro:finite_subset)
f809cb54de4e Trying to solve the confict
zhang
parents: 40
diff changeset
   121
      from finite_range_image [OF this] show ?thesis .
f809cb54de4e Trying to solve the confict
zhang
parents: 40
diff changeset
   122
    qed
f809cb54de4e Trying to solve the confict
zhang
parents: 40
diff changeset
   123
  next
f809cb54de4e Trying to solve the confict
zhang
parents: 40
diff changeset
   124
    -- {* 
f809cb54de4e Trying to solve the confict
zhang
parents: 40
diff changeset
   125
      The injectivity of @{text "f"} is the consequence of assumption @{text "same_tag_eqvt"}:
f809cb54de4e Trying to solve the confict
zhang
parents: 40
diff changeset
   126
      *}
f809cb54de4e Trying to solve the confict
zhang
parents: 40
diff changeset
   127
    show "inj_on ?f ?A" 
f809cb54de4e Trying to solve the confict
zhang
parents: 40
diff changeset
   128
    proof-
f809cb54de4e Trying to solve the confict
zhang
parents: 40
diff changeset
   129
      { fix X Y
f809cb54de4e Trying to solve the confict
zhang
parents: 40
diff changeset
   130
        assume X_in: "X \<in> ?A"
f809cb54de4e Trying to solve the confict
zhang
parents: 40
diff changeset
   131
          and  Y_in: "Y \<in> ?A"
f809cb54de4e Trying to solve the confict
zhang
parents: 40
diff changeset
   132
          and  tag_eq: "?f X = ?f Y"
f809cb54de4e Trying to solve the confict
zhang
parents: 40
diff changeset
   133
        have "X = Y"
f809cb54de4e Trying to solve the confict
zhang
parents: 40
diff changeset
   134
        proof -
f809cb54de4e Trying to solve the confict
zhang
parents: 40
diff changeset
   135
          from X_in Y_in tag_eq 
f809cb54de4e Trying to solve the confict
zhang
parents: 40
diff changeset
   136
          obtain x y where x_in: "x \<in> X" and y_in: "y \<in> Y" and eq_tg: "tag x = tag y"
f809cb54de4e Trying to solve the confict
zhang
parents: 40
diff changeset
   137
            unfolding quotient_def Image_def str_eq_rel_def str_eq_def image_def
f809cb54de4e Trying to solve the confict
zhang
parents: 40
diff changeset
   138
            apply simp by blast 
43
cb4403fabda7 added my changes again
urbanc
parents: 42
diff changeset
   139
          from same_tag_eqvt [OF eq_tg] have "x \<approx>L y" .
42
f809cb54de4e Trying to solve the confict
zhang
parents: 40
diff changeset
   140
          with X_in Y_in x_in y_in
f809cb54de4e Trying to solve the confict
zhang
parents: 40
diff changeset
   141
          show ?thesis by (auto simp:quotient_def str_eq_rel_def str_eq_def) 
f809cb54de4e Trying to solve the confict
zhang
parents: 40
diff changeset
   142
        qed
f809cb54de4e Trying to solve the confict
zhang
parents: 40
diff changeset
   143
      } thus ?thesis unfolding inj_on_def by auto
f809cb54de4e Trying to solve the confict
zhang
parents: 40
diff changeset
   144
    qed
31
b6815473ee2e 1. Myhill.thy is proved to correct some typos. 2. Some sections are added to the first direction. 3. The small theory of list difference is now separated into Prefix_subtract.thy and the ROOT.ML
zhang
parents: 30
diff changeset
   145
  qed
b6815473ee2e 1. Myhill.thy is proved to correct some typos. 2. Some sections are added to the first direction. 3. The small theory of list difference is now separated into Prefix_subtract.thy and the ROOT.ML
zhang
parents: 30
diff changeset
   146
qed
b6815473ee2e 1. Myhill.thy is proved to correct some typos. 2. Some sections are added to the first direction. 3. The small theory of list difference is now separated into Prefix_subtract.thy and the ROOT.ML
zhang
parents: 30
diff changeset
   147
b6815473ee2e 1. Myhill.thy is proved to correct some typos. 2. Some sections are added to the first direction. 3. The small theory of list difference is now separated into Prefix_subtract.thy and the ROOT.ML
zhang
parents: 30
diff changeset
   148
subsection {* Lemmas for basic cases *}
b6815473ee2e 1. Myhill.thy is proved to correct some typos. 2. Some sections are added to the first direction. 3. The small theory of list difference is now separated into Prefix_subtract.thy and the ROOT.ML
zhang
parents: 30
diff changeset
   149
b6815473ee2e 1. Myhill.thy is proved to correct some typos. 2. Some sections are added to the first direction. 3. The small theory of list difference is now separated into Prefix_subtract.thy and the ROOT.ML
zhang
parents: 30
diff changeset
   150
text {*
43
cb4403fabda7 added my changes again
urbanc
parents: 42
diff changeset
   151
  The the final result of this direction is in @{text "rexp_imp_finite"},
cb4403fabda7 added my changes again
urbanc
parents: 42
diff changeset
   152
  which is an induction on the structure of regular expressions. There is one
cb4403fabda7 added my changes again
urbanc
parents: 42
diff changeset
   153
  case for each regular expression operator. For basic operators such as
cb4403fabda7 added my changes again
urbanc
parents: 42
diff changeset
   154
  @{const NULL}, @{const EMPTY}, @{const CHAR}, the finiteness of their 
cb4403fabda7 added my changes again
urbanc
parents: 42
diff changeset
   155
  language partition can be established directly with no need of tagging. 
cb4403fabda7 added my changes again
urbanc
parents: 42
diff changeset
   156
  This section contains several technical lemma for these base cases.
cb4403fabda7 added my changes again
urbanc
parents: 42
diff changeset
   157
cb4403fabda7 added my changes again
urbanc
parents: 42
diff changeset
   158
  The inductive cases involve operators @{const ALT}, @{const SEQ} and @{const
cb4403fabda7 added my changes again
urbanc
parents: 42
diff changeset
   159
  STAR}. Tagging functions need to be defined individually for each of
cb4403fabda7 added my changes again
urbanc
parents: 42
diff changeset
   160
  them. There will be one dedicated section for each of these cases, and each
cb4403fabda7 added my changes again
urbanc
parents: 42
diff changeset
   161
  section goes virtually the same way: gives definition of the tagging
cb4403fabda7 added my changes again
urbanc
parents: 42
diff changeset
   162
  function and prove that strings with the same tag are equivalent.
cb4403fabda7 added my changes again
urbanc
parents: 42
diff changeset
   163
*}
31
b6815473ee2e 1. Myhill.thy is proved to correct some typos. 2. Some sections are added to the first direction. 3. The small theory of list difference is now separated into Prefix_subtract.thy and the ROOT.ML
zhang
parents: 30
diff changeset
   164
43
cb4403fabda7 added my changes again
urbanc
parents: 42
diff changeset
   165
subsection {* The case for @{const "NULL"} *}
cb4403fabda7 added my changes again
urbanc
parents: 42
diff changeset
   166
cb4403fabda7 added my changes again
urbanc
parents: 42
diff changeset
   167
lemma quot_null_eq:
cb4403fabda7 added my changes again
urbanc
parents: 42
diff changeset
   168
  shows "(UNIV // \<approx>{}) = ({UNIV}::lang set)"
cb4403fabda7 added my changes again
urbanc
parents: 42
diff changeset
   169
  unfolding quotient_def Image_def str_eq_rel_def by auto
cb4403fabda7 added my changes again
urbanc
parents: 42
diff changeset
   170
cb4403fabda7 added my changes again
urbanc
parents: 42
diff changeset
   171
lemma quot_null_finiteI [intro]:
cb4403fabda7 added my changes again
urbanc
parents: 42
diff changeset
   172
  shows "finite ((UNIV // \<approx>{})::lang set)"
cb4403fabda7 added my changes again
urbanc
parents: 42
diff changeset
   173
unfolding quot_null_eq by simp
cb4403fabda7 added my changes again
urbanc
parents: 42
diff changeset
   174
cb4403fabda7 added my changes again
urbanc
parents: 42
diff changeset
   175
cb4403fabda7 added my changes again
urbanc
parents: 42
diff changeset
   176
subsection {* The case for @{const "EMPTY"} *}
cb4403fabda7 added my changes again
urbanc
parents: 42
diff changeset
   177
31
b6815473ee2e 1. Myhill.thy is proved to correct some typos. 2. Some sections are added to the first direction. 3. The small theory of list difference is now separated into Prefix_subtract.thy and the ROOT.ML
zhang
parents: 30
diff changeset
   178
b6815473ee2e 1. Myhill.thy is proved to correct some typos. 2. Some sections are added to the first direction. 3. The small theory of list difference is now separated into Prefix_subtract.thy and the ROOT.ML
zhang
parents: 30
diff changeset
   179
lemma quot_empty_subset:
b6815473ee2e 1. Myhill.thy is proved to correct some typos. 2. Some sections are added to the first direction. 3. The small theory of list difference is now separated into Prefix_subtract.thy and the ROOT.ML
zhang
parents: 30
diff changeset
   180
  "UNIV // (\<approx>{[]}) \<subseteq> {{[]}, UNIV - {[]}}"
b6815473ee2e 1. Myhill.thy is proved to correct some typos. 2. Some sections are added to the first direction. 3. The small theory of list difference is now separated into Prefix_subtract.thy and the ROOT.ML
zhang
parents: 30
diff changeset
   181
proof
b6815473ee2e 1. Myhill.thy is proved to correct some typos. 2. Some sections are added to the first direction. 3. The small theory of list difference is now separated into Prefix_subtract.thy and the ROOT.ML
zhang
parents: 30
diff changeset
   182
  fix x
b6815473ee2e 1. Myhill.thy is proved to correct some typos. 2. Some sections are added to the first direction. 3. The small theory of list difference is now separated into Prefix_subtract.thy and the ROOT.ML
zhang
parents: 30
diff changeset
   183
  assume "x \<in> UNIV // \<approx>{[]}"
b6815473ee2e 1. Myhill.thy is proved to correct some typos. 2. Some sections are added to the first direction. 3. The small theory of list difference is now separated into Prefix_subtract.thy and the ROOT.ML
zhang
parents: 30
diff changeset
   184
  then obtain y where h: "x = {z. (y, z) \<in> \<approx>{[]}}" 
b6815473ee2e 1. Myhill.thy is proved to correct some typos. 2. Some sections are added to the first direction. 3. The small theory of list difference is now separated into Prefix_subtract.thy and the ROOT.ML
zhang
parents: 30
diff changeset
   185
    unfolding quotient_def Image_def by blast
43
cb4403fabda7 added my changes again
urbanc
parents: 42
diff changeset
   186
  show "x \<in> {{[]}, UNIV - {[]}}"
31
b6815473ee2e 1. Myhill.thy is proved to correct some typos. 2. Some sections are added to the first direction. 3. The small theory of list difference is now separated into Prefix_subtract.thy and the ROOT.ML
zhang
parents: 30
diff changeset
   187
  proof (cases "y = []")
b6815473ee2e 1. Myhill.thy is proved to correct some typos. 2. Some sections are added to the first direction. 3. The small theory of list difference is now separated into Prefix_subtract.thy and the ROOT.ML
zhang
parents: 30
diff changeset
   188
    case True with h
43
cb4403fabda7 added my changes again
urbanc
parents: 42
diff changeset
   189
    have "x = {[]}" by (auto simp: str_eq_rel_def)
31
b6815473ee2e 1. Myhill.thy is proved to correct some typos. 2. Some sections are added to the first direction. 3. The small theory of list difference is now separated into Prefix_subtract.thy and the ROOT.ML
zhang
parents: 30
diff changeset
   190
    thus ?thesis by simp
b6815473ee2e 1. Myhill.thy is proved to correct some typos. 2. Some sections are added to the first direction. 3. The small theory of list difference is now separated into Prefix_subtract.thy and the ROOT.ML
zhang
parents: 30
diff changeset
   191
  next
b6815473ee2e 1. Myhill.thy is proved to correct some typos. 2. Some sections are added to the first direction. 3. The small theory of list difference is now separated into Prefix_subtract.thy and the ROOT.ML
zhang
parents: 30
diff changeset
   192
    case False with h
43
cb4403fabda7 added my changes again
urbanc
parents: 42
diff changeset
   193
    have "x = UNIV - {[]}" by (auto simp: str_eq_rel_def)
31
b6815473ee2e 1. Myhill.thy is proved to correct some typos. 2. Some sections are added to the first direction. 3. The small theory of list difference is now separated into Prefix_subtract.thy and the ROOT.ML
zhang
parents: 30
diff changeset
   194
    thus ?thesis by simp
b6815473ee2e 1. Myhill.thy is proved to correct some typos. 2. Some sections are added to the first direction. 3. The small theory of list difference is now separated into Prefix_subtract.thy and the ROOT.ML
zhang
parents: 30
diff changeset
   195
  qed
b6815473ee2e 1. Myhill.thy is proved to correct some typos. 2. Some sections are added to the first direction. 3. The small theory of list difference is now separated into Prefix_subtract.thy and the ROOT.ML
zhang
parents: 30
diff changeset
   196
qed
b6815473ee2e 1. Myhill.thy is proved to correct some typos. 2. Some sections are added to the first direction. 3. The small theory of list difference is now separated into Prefix_subtract.thy and the ROOT.ML
zhang
parents: 30
diff changeset
   197
43
cb4403fabda7 added my changes again
urbanc
parents: 42
diff changeset
   198
lemma quot_empty_finiteI [intro]:
cb4403fabda7 added my changes again
urbanc
parents: 42
diff changeset
   199
  shows "finite (UNIV // (\<approx>{[]}))"
cb4403fabda7 added my changes again
urbanc
parents: 42
diff changeset
   200
by (rule finite_subset[OF quot_empty_subset]) (simp)
cb4403fabda7 added my changes again
urbanc
parents: 42
diff changeset
   201
cb4403fabda7 added my changes again
urbanc
parents: 42
diff changeset
   202
cb4403fabda7 added my changes again
urbanc
parents: 42
diff changeset
   203
subsection {* The case for @{const "CHAR"} *}
cb4403fabda7 added my changes again
urbanc
parents: 42
diff changeset
   204
31
b6815473ee2e 1. Myhill.thy is proved to correct some typos. 2. Some sections are added to the first direction. 3. The small theory of list difference is now separated into Prefix_subtract.thy and the ROOT.ML
zhang
parents: 30
diff changeset
   205
lemma quot_char_subset:
b6815473ee2e 1. Myhill.thy is proved to correct some typos. 2. Some sections are added to the first direction. 3. The small theory of list difference is now separated into Prefix_subtract.thy and the ROOT.ML
zhang
parents: 30
diff changeset
   206
  "UNIV // (\<approx>{[c]}) \<subseteq> {{[]},{[c]}, UNIV - {[], [c]}}"
b6815473ee2e 1. Myhill.thy is proved to correct some typos. 2. Some sections are added to the first direction. 3. The small theory of list difference is now separated into Prefix_subtract.thy and the ROOT.ML
zhang
parents: 30
diff changeset
   207
proof 
b6815473ee2e 1. Myhill.thy is proved to correct some typos. 2. Some sections are added to the first direction. 3. The small theory of list difference is now separated into Prefix_subtract.thy and the ROOT.ML
zhang
parents: 30
diff changeset
   208
  fix x 
b6815473ee2e 1. Myhill.thy is proved to correct some typos. 2. Some sections are added to the first direction. 3. The small theory of list difference is now separated into Prefix_subtract.thy and the ROOT.ML
zhang
parents: 30
diff changeset
   209
  assume "x \<in> UNIV // \<approx>{[c]}"
b6815473ee2e 1. Myhill.thy is proved to correct some typos. 2. Some sections are added to the first direction. 3. The small theory of list difference is now separated into Prefix_subtract.thy and the ROOT.ML
zhang
parents: 30
diff changeset
   210
  then obtain y where h: "x = {z. (y, z) \<in> \<approx>{[c]}}" 
b6815473ee2e 1. Myhill.thy is proved to correct some typos. 2. Some sections are added to the first direction. 3. The small theory of list difference is now separated into Prefix_subtract.thy and the ROOT.ML
zhang
parents: 30
diff changeset
   211
    unfolding quotient_def Image_def by blast
b6815473ee2e 1. Myhill.thy is proved to correct some typos. 2. Some sections are added to the first direction. 3. The small theory of list difference is now separated into Prefix_subtract.thy and the ROOT.ML
zhang
parents: 30
diff changeset
   212
  show "x \<in> {{[]},{[c]}, UNIV - {[], [c]}}"
b6815473ee2e 1. Myhill.thy is proved to correct some typos. 2. Some sections are added to the first direction. 3. The small theory of list difference is now separated into Prefix_subtract.thy and the ROOT.ML
zhang
parents: 30
diff changeset
   213
  proof -
b6815473ee2e 1. Myhill.thy is proved to correct some typos. 2. Some sections are added to the first direction. 3. The small theory of list difference is now separated into Prefix_subtract.thy and the ROOT.ML
zhang
parents: 30
diff changeset
   214
    { assume "y = []" hence "x = {[]}" using h 
b6815473ee2e 1. Myhill.thy is proved to correct some typos. 2. Some sections are added to the first direction. 3. The small theory of list difference is now separated into Prefix_subtract.thy and the ROOT.ML
zhang
parents: 30
diff changeset
   215
        by (auto simp:str_eq_rel_def)
b6815473ee2e 1. Myhill.thy is proved to correct some typos. 2. Some sections are added to the first direction. 3. The small theory of list difference is now separated into Prefix_subtract.thy and the ROOT.ML
zhang
parents: 30
diff changeset
   216
    } moreover {
b6815473ee2e 1. Myhill.thy is proved to correct some typos. 2. Some sections are added to the first direction. 3. The small theory of list difference is now separated into Prefix_subtract.thy and the ROOT.ML
zhang
parents: 30
diff changeset
   217
      assume "y = [c]" hence "x = {[c]}" using h 
b6815473ee2e 1. Myhill.thy is proved to correct some typos. 2. Some sections are added to the first direction. 3. The small theory of list difference is now separated into Prefix_subtract.thy and the ROOT.ML
zhang
parents: 30
diff changeset
   218
        by (auto dest!:spec[where x = "[]"] simp:str_eq_rel_def)
b6815473ee2e 1. Myhill.thy is proved to correct some typos. 2. Some sections are added to the first direction. 3. The small theory of list difference is now separated into Prefix_subtract.thy and the ROOT.ML
zhang
parents: 30
diff changeset
   219
    } moreover {
b6815473ee2e 1. Myhill.thy is proved to correct some typos. 2. Some sections are added to the first direction. 3. The small theory of list difference is now separated into Prefix_subtract.thy and the ROOT.ML
zhang
parents: 30
diff changeset
   220
      assume "y \<noteq> []" and "y \<noteq> [c]"
b6815473ee2e 1. Myhill.thy is proved to correct some typos. 2. Some sections are added to the first direction. 3. The small theory of list difference is now separated into Prefix_subtract.thy and the ROOT.ML
zhang
parents: 30
diff changeset
   221
      hence "\<forall> z. (y @ z) \<noteq> [c]" by (case_tac y, auto)
b6815473ee2e 1. Myhill.thy is proved to correct some typos. 2. Some sections are added to the first direction. 3. The small theory of list difference is now separated into Prefix_subtract.thy and the ROOT.ML
zhang
parents: 30
diff changeset
   222
      moreover have "\<And> p. (p \<noteq> [] \<and> p \<noteq> [c]) = (\<forall> q. p @ q \<noteq> [c])" 
b6815473ee2e 1. Myhill.thy is proved to correct some typos. 2. Some sections are added to the first direction. 3. The small theory of list difference is now separated into Prefix_subtract.thy and the ROOT.ML
zhang
parents: 30
diff changeset
   223
        by (case_tac p, auto)
b6815473ee2e 1. Myhill.thy is proved to correct some typos. 2. Some sections are added to the first direction. 3. The small theory of list difference is now separated into Prefix_subtract.thy and the ROOT.ML
zhang
parents: 30
diff changeset
   224
      ultimately have "x = UNIV - {[],[c]}" using h
b6815473ee2e 1. Myhill.thy is proved to correct some typos. 2. Some sections are added to the first direction. 3. The small theory of list difference is now separated into Prefix_subtract.thy and the ROOT.ML
zhang
parents: 30
diff changeset
   225
        by (auto simp add:str_eq_rel_def)
b6815473ee2e 1. Myhill.thy is proved to correct some typos. 2. Some sections are added to the first direction. 3. The small theory of list difference is now separated into Prefix_subtract.thy and the ROOT.ML
zhang
parents: 30
diff changeset
   226
    } ultimately show ?thesis by blast
b6815473ee2e 1. Myhill.thy is proved to correct some typos. 2. Some sections are added to the first direction. 3. The small theory of list difference is now separated into Prefix_subtract.thy and the ROOT.ML
zhang
parents: 30
diff changeset
   227
  qed
b6815473ee2e 1. Myhill.thy is proved to correct some typos. 2. Some sections are added to the first direction. 3. The small theory of list difference is now separated into Prefix_subtract.thy and the ROOT.ML
zhang
parents: 30
diff changeset
   228
qed
b6815473ee2e 1. Myhill.thy is proved to correct some typos. 2. Some sections are added to the first direction. 3. The small theory of list difference is now separated into Prefix_subtract.thy and the ROOT.ML
zhang
parents: 30
diff changeset
   229
43
cb4403fabda7 added my changes again
urbanc
parents: 42
diff changeset
   230
lemma quot_char_finiteI [intro]:
cb4403fabda7 added my changes again
urbanc
parents: 42
diff changeset
   231
  shows "finite (UNIV // (\<approx>{[c]}))"
cb4403fabda7 added my changes again
urbanc
parents: 42
diff changeset
   232
by (rule finite_subset[OF quot_char_subset]) (simp)
cb4403fabda7 added my changes again
urbanc
parents: 42
diff changeset
   233
cb4403fabda7 added my changes again
urbanc
parents: 42
diff changeset
   234
cb4403fabda7 added my changes again
urbanc
parents: 42
diff changeset
   235
subsection {* The case for @{const SEQ}*}
31
b6815473ee2e 1. Myhill.thy is proved to correct some typos. 2. Some sections are added to the first direction. 3. The small theory of list difference is now separated into Prefix_subtract.thy and the ROOT.ML
zhang
parents: 30
diff changeset
   236
b6815473ee2e 1. Myhill.thy is proved to correct some typos. 2. Some sections are added to the first direction. 3. The small theory of list difference is now separated into Prefix_subtract.thy and the ROOT.ML
zhang
parents: 30
diff changeset
   237
definition 
43
cb4403fabda7 added my changes again
urbanc
parents: 42
diff changeset
   238
  tag_str_SEQ :: "lang \<Rightarrow> lang \<Rightarrow> string \<Rightarrow> (lang \<times> lang set)"
cb4403fabda7 added my changes again
urbanc
parents: 42
diff changeset
   239
where
cb4403fabda7 added my changes again
urbanc
parents: 42
diff changeset
   240
  "tag_str_SEQ L1 L2 = (\<lambda>x. (\<approx>L1 `` {x}, {(\<approx>L2 `` {x - xa}) | xa.  xa \<le> x \<and> xa \<in> L1}))"
42
f809cb54de4e Trying to solve the confict
zhang
parents: 40
diff changeset
   241
31
b6815473ee2e 1. Myhill.thy is proved to correct some typos. 2. Some sections are added to the first direction. 3. The small theory of list difference is now separated into Prefix_subtract.thy and the ROOT.ML
zhang
parents: 30
diff changeset
   242
b6815473ee2e 1. Myhill.thy is proved to correct some typos. 2. Some sections are added to the first direction. 3. The small theory of list difference is now separated into Prefix_subtract.thy and the ROOT.ML
zhang
parents: 30
diff changeset
   243
lemma append_seq_elim:
b6815473ee2e 1. Myhill.thy is proved to correct some typos. 2. Some sections are added to the first direction. 3. The small theory of list difference is now separated into Prefix_subtract.thy and the ROOT.ML
zhang
parents: 30
diff changeset
   244
  assumes "x @ y \<in> L\<^isub>1 ;; L\<^isub>2"
b6815473ee2e 1. Myhill.thy is proved to correct some typos. 2. Some sections are added to the first direction. 3. The small theory of list difference is now separated into Prefix_subtract.thy and the ROOT.ML
zhang
parents: 30
diff changeset
   245
  shows "(\<exists> xa \<le> x. xa \<in> L\<^isub>1 \<and> (x - xa) @ y \<in> L\<^isub>2) \<or> 
b6815473ee2e 1. Myhill.thy is proved to correct some typos. 2. Some sections are added to the first direction. 3. The small theory of list difference is now separated into Prefix_subtract.thy and the ROOT.ML
zhang
parents: 30
diff changeset
   246
          (\<exists> ya \<le> y. (x @ ya) \<in> L\<^isub>1 \<and> (y - ya) \<in> L\<^isub>2)"
b6815473ee2e 1. Myhill.thy is proved to correct some typos. 2. Some sections are added to the first direction. 3. The small theory of list difference is now separated into Prefix_subtract.thy and the ROOT.ML
zhang
parents: 30
diff changeset
   247
proof-
b6815473ee2e 1. Myhill.thy is proved to correct some typos. 2. Some sections are added to the first direction. 3. The small theory of list difference is now separated into Prefix_subtract.thy and the ROOT.ML
zhang
parents: 30
diff changeset
   248
  from assms obtain s\<^isub>1 s\<^isub>2 
b6815473ee2e 1. Myhill.thy is proved to correct some typos. 2. Some sections are added to the first direction. 3. The small theory of list difference is now separated into Prefix_subtract.thy and the ROOT.ML
zhang
parents: 30
diff changeset
   249
    where "x @ y = s\<^isub>1 @ s\<^isub>2" 
b6815473ee2e 1. Myhill.thy is proved to correct some typos. 2. Some sections are added to the first direction. 3. The small theory of list difference is now separated into Prefix_subtract.thy and the ROOT.ML
zhang
parents: 30
diff changeset
   250
    and in_seq: "s\<^isub>1 \<in> L\<^isub>1 \<and> s\<^isub>2 \<in> L\<^isub>2" 
b6815473ee2e 1. Myhill.thy is proved to correct some typos. 2. Some sections are added to the first direction. 3. The small theory of list difference is now separated into Prefix_subtract.thy and the ROOT.ML
zhang
parents: 30
diff changeset
   251
    by (auto simp:Seq_def)
b6815473ee2e 1. Myhill.thy is proved to correct some typos. 2. Some sections are added to the first direction. 3. The small theory of list difference is now separated into Prefix_subtract.thy and the ROOT.ML
zhang
parents: 30
diff changeset
   252
  hence "(x \<le> s\<^isub>1 \<and> (s\<^isub>1 - x) @ s\<^isub>2 = y) \<or> (s\<^isub>1 \<le> x \<and> (x - s\<^isub>1) @ y = s\<^isub>2)"
b6815473ee2e 1. Myhill.thy is proved to correct some typos. 2. Some sections are added to the first direction. 3. The small theory of list difference is now separated into Prefix_subtract.thy and the ROOT.ML
zhang
parents: 30
diff changeset
   253
    using app_eq_dest by auto
b6815473ee2e 1. Myhill.thy is proved to correct some typos. 2. Some sections are added to the first direction. 3. The small theory of list difference is now separated into Prefix_subtract.thy and the ROOT.ML
zhang
parents: 30
diff changeset
   254
  moreover have "\<lbrakk>x \<le> s\<^isub>1; (s\<^isub>1 - x) @ s\<^isub>2 = y\<rbrakk> \<Longrightarrow> 
b6815473ee2e 1. Myhill.thy is proved to correct some typos. 2. Some sections are added to the first direction. 3. The small theory of list difference is now separated into Prefix_subtract.thy and the ROOT.ML
zhang
parents: 30
diff changeset
   255
                       \<exists> ya \<le> y. (x @ ya) \<in> L\<^isub>1 \<and> (y - ya) \<in> L\<^isub>2" 
b6815473ee2e 1. Myhill.thy is proved to correct some typos. 2. Some sections are added to the first direction. 3. The small theory of list difference is now separated into Prefix_subtract.thy and the ROOT.ML
zhang
parents: 30
diff changeset
   256
    using in_seq by (rule_tac x = "s\<^isub>1 - x" in exI, auto elim:prefixE)
b6815473ee2e 1. Myhill.thy is proved to correct some typos. 2. Some sections are added to the first direction. 3. The small theory of list difference is now separated into Prefix_subtract.thy and the ROOT.ML
zhang
parents: 30
diff changeset
   257
  moreover have "\<lbrakk>s\<^isub>1 \<le> x; (x - s\<^isub>1) @ y = s\<^isub>2\<rbrakk> \<Longrightarrow> 
b6815473ee2e 1. Myhill.thy is proved to correct some typos. 2. Some sections are added to the first direction. 3. The small theory of list difference is now separated into Prefix_subtract.thy and the ROOT.ML
zhang
parents: 30
diff changeset
   258
                    \<exists> xa \<le> x. xa \<in> L\<^isub>1 \<and> (x - xa) @ y \<in> L\<^isub>2" 
b6815473ee2e 1. Myhill.thy is proved to correct some typos. 2. Some sections are added to the first direction. 3. The small theory of list difference is now separated into Prefix_subtract.thy and the ROOT.ML
zhang
parents: 30
diff changeset
   259
    using in_seq by (rule_tac x = s\<^isub>1 in exI, auto)
b6815473ee2e 1. Myhill.thy is proved to correct some typos. 2. Some sections are added to the first direction. 3. The small theory of list difference is now separated into Prefix_subtract.thy and the ROOT.ML
zhang
parents: 30
diff changeset
   260
  ultimately show ?thesis by blast
b6815473ee2e 1. Myhill.thy is proved to correct some typos. 2. Some sections are added to the first direction. 3. The small theory of list difference is now separated into Prefix_subtract.thy and the ROOT.ML
zhang
parents: 30
diff changeset
   261
qed
b6815473ee2e 1. Myhill.thy is proved to correct some typos. 2. Some sections are added to the first direction. 3. The small theory of list difference is now separated into Prefix_subtract.thy and the ROOT.ML
zhang
parents: 30
diff changeset
   262
b6815473ee2e 1. Myhill.thy is proved to correct some typos. 2. Some sections are added to the first direction. 3. The small theory of list difference is now separated into Prefix_subtract.thy and the ROOT.ML
zhang
parents: 30
diff changeset
   263
lemma tag_str_SEQ_injI:
b6815473ee2e 1. Myhill.thy is proved to correct some typos. 2. Some sections are added to the first direction. 3. The small theory of list difference is now separated into Prefix_subtract.thy and the ROOT.ML
zhang
parents: 30
diff changeset
   264
  "tag_str_SEQ L\<^isub>1 L\<^isub>2 m = tag_str_SEQ L\<^isub>1 L\<^isub>2 n \<Longrightarrow> m \<approx>(L\<^isub>1 ;; L\<^isub>2) n"
b6815473ee2e 1. Myhill.thy is proved to correct some typos. 2. Some sections are added to the first direction. 3. The small theory of list difference is now separated into Prefix_subtract.thy and the ROOT.ML
zhang
parents: 30
diff changeset
   265
proof-
b6815473ee2e 1. Myhill.thy is proved to correct some typos. 2. Some sections are added to the first direction. 3. The small theory of list difference is now separated into Prefix_subtract.thy and the ROOT.ML
zhang
parents: 30
diff changeset
   266
  { fix x y z
b6815473ee2e 1. Myhill.thy is proved to correct some typos. 2. Some sections are added to the first direction. 3. The small theory of list difference is now separated into Prefix_subtract.thy and the ROOT.ML
zhang
parents: 30
diff changeset
   267
    assume xz_in_seq: "x @ z \<in> L\<^isub>1 ;; L\<^isub>2"
b6815473ee2e 1. Myhill.thy is proved to correct some typos. 2. Some sections are added to the first direction. 3. The small theory of list difference is now separated into Prefix_subtract.thy and the ROOT.ML
zhang
parents: 30
diff changeset
   268
    and tag_xy: "tag_str_SEQ L\<^isub>1 L\<^isub>2 x = tag_str_SEQ L\<^isub>1 L\<^isub>2 y"
b6815473ee2e 1. Myhill.thy is proved to correct some typos. 2. Some sections are added to the first direction. 3. The small theory of list difference is now separated into Prefix_subtract.thy and the ROOT.ML
zhang
parents: 30
diff changeset
   269
    have"y @ z \<in> L\<^isub>1 ;; L\<^isub>2" 
b6815473ee2e 1. Myhill.thy is proved to correct some typos. 2. Some sections are added to the first direction. 3. The small theory of list difference is now separated into Prefix_subtract.thy and the ROOT.ML
zhang
parents: 30
diff changeset
   270
    proof-
b6815473ee2e 1. Myhill.thy is proved to correct some typos. 2. Some sections are added to the first direction. 3. The small theory of list difference is now separated into Prefix_subtract.thy and the ROOT.ML
zhang
parents: 30
diff changeset
   271
      have "(\<exists> xa \<le> x. xa \<in> L\<^isub>1 \<and> (x - xa) @ z \<in> L\<^isub>2) \<or> 
b6815473ee2e 1. Myhill.thy is proved to correct some typos. 2. Some sections are added to the first direction. 3. The small theory of list difference is now separated into Prefix_subtract.thy and the ROOT.ML
zhang
parents: 30
diff changeset
   272
               (\<exists> za \<le> z. (x @ za) \<in> L\<^isub>1 \<and> (z - za) \<in> L\<^isub>2)"
b6815473ee2e 1. Myhill.thy is proved to correct some typos. 2. Some sections are added to the first direction. 3. The small theory of list difference is now separated into Prefix_subtract.thy and the ROOT.ML
zhang
parents: 30
diff changeset
   273
        using xz_in_seq append_seq_elim by simp
b6815473ee2e 1. Myhill.thy is proved to correct some typos. 2. Some sections are added to the first direction. 3. The small theory of list difference is now separated into Prefix_subtract.thy and the ROOT.ML
zhang
parents: 30
diff changeset
   274
      moreover {
b6815473ee2e 1. Myhill.thy is proved to correct some typos. 2. Some sections are added to the first direction. 3. The small theory of list difference is now separated into Prefix_subtract.thy and the ROOT.ML
zhang
parents: 30
diff changeset
   275
        fix xa
b6815473ee2e 1. Myhill.thy is proved to correct some typos. 2. Some sections are added to the first direction. 3. The small theory of list difference is now separated into Prefix_subtract.thy and the ROOT.ML
zhang
parents: 30
diff changeset
   276
        assume h1: "xa \<le> x" and h2: "xa \<in> L\<^isub>1" and h3: "(x - xa) @ z \<in> L\<^isub>2"
b6815473ee2e 1. Myhill.thy is proved to correct some typos. 2. Some sections are added to the first direction. 3. The small theory of list difference is now separated into Prefix_subtract.thy and the ROOT.ML
zhang
parents: 30
diff changeset
   277
        obtain ya where "ya \<le> y" and "ya \<in> L\<^isub>1" and "(y - ya) @ z \<in> L\<^isub>2" 
b6815473ee2e 1. Myhill.thy is proved to correct some typos. 2. Some sections are added to the first direction. 3. The small theory of list difference is now separated into Prefix_subtract.thy and the ROOT.ML
zhang
parents: 30
diff changeset
   278
        proof -
b6815473ee2e 1. Myhill.thy is proved to correct some typos. 2. Some sections are added to the first direction. 3. The small theory of list difference is now separated into Prefix_subtract.thy and the ROOT.ML
zhang
parents: 30
diff changeset
   279
          have "\<exists> ya.  ya \<le> y \<and> ya \<in> L\<^isub>1 \<and> (x - xa) \<approx>L\<^isub>2 (y - ya)"
b6815473ee2e 1. Myhill.thy is proved to correct some typos. 2. Some sections are added to the first direction. 3. The small theory of list difference is now separated into Prefix_subtract.thy and the ROOT.ML
zhang
parents: 30
diff changeset
   280
          proof -
b6815473ee2e 1. Myhill.thy is proved to correct some typos. 2. Some sections are added to the first direction. 3. The small theory of list difference is now separated into Prefix_subtract.thy and the ROOT.ML
zhang
parents: 30
diff changeset
   281
            have "{\<approx>L\<^isub>2 `` {x - xa} |xa. xa \<le> x \<and> xa \<in> L\<^isub>1} = 
b6815473ee2e 1. Myhill.thy is proved to correct some typos. 2. Some sections are added to the first direction. 3. The small theory of list difference is now separated into Prefix_subtract.thy and the ROOT.ML
zhang
parents: 30
diff changeset
   282
                  {\<approx>L\<^isub>2 `` {y - xa} |xa. xa \<le> y \<and> xa \<in> L\<^isub>1}" 
b6815473ee2e 1. Myhill.thy is proved to correct some typos. 2. Some sections are added to the first direction. 3. The small theory of list difference is now separated into Prefix_subtract.thy and the ROOT.ML
zhang
parents: 30
diff changeset
   283
                          (is "?Left = ?Right") 
b6815473ee2e 1. Myhill.thy is proved to correct some typos. 2. Some sections are added to the first direction. 3. The small theory of list difference is now separated into Prefix_subtract.thy and the ROOT.ML
zhang
parents: 30
diff changeset
   284
              using h1 tag_xy by (auto simp:tag_str_SEQ_def)
b6815473ee2e 1. Myhill.thy is proved to correct some typos. 2. Some sections are added to the first direction. 3. The small theory of list difference is now separated into Prefix_subtract.thy and the ROOT.ML
zhang
parents: 30
diff changeset
   285
            moreover have "\<approx>L\<^isub>2 `` {x - xa} \<in> ?Left" using h1 h2 by auto
b6815473ee2e 1. Myhill.thy is proved to correct some typos. 2. Some sections are added to the first direction. 3. The small theory of list difference is now separated into Prefix_subtract.thy and the ROOT.ML
zhang
parents: 30
diff changeset
   286
            ultimately have "\<approx>L\<^isub>2 `` {x - xa} \<in> ?Right" by simp
b6815473ee2e 1. Myhill.thy is proved to correct some typos. 2. Some sections are added to the first direction. 3. The small theory of list difference is now separated into Prefix_subtract.thy and the ROOT.ML
zhang
parents: 30
diff changeset
   287
            thus ?thesis by (auto simp:Image_def str_eq_rel_def str_eq_def)
b6815473ee2e 1. Myhill.thy is proved to correct some typos. 2. Some sections are added to the first direction. 3. The small theory of list difference is now separated into Prefix_subtract.thy and the ROOT.ML
zhang
parents: 30
diff changeset
   288
          qed
b6815473ee2e 1. Myhill.thy is proved to correct some typos. 2. Some sections are added to the first direction. 3. The small theory of list difference is now separated into Prefix_subtract.thy and the ROOT.ML
zhang
parents: 30
diff changeset
   289
          with prems show ?thesis by (auto simp:str_eq_rel_def str_eq_def)
b6815473ee2e 1. Myhill.thy is proved to correct some typos. 2. Some sections are added to the first direction. 3. The small theory of list difference is now separated into Prefix_subtract.thy and the ROOT.ML
zhang
parents: 30
diff changeset
   290
        qed
b6815473ee2e 1. Myhill.thy is proved to correct some typos. 2. Some sections are added to the first direction. 3. The small theory of list difference is now separated into Prefix_subtract.thy and the ROOT.ML
zhang
parents: 30
diff changeset
   291
        hence "y @ z \<in> L\<^isub>1 ;; L\<^isub>2" by (erule_tac prefixE, auto simp:Seq_def)          
b6815473ee2e 1. Myhill.thy is proved to correct some typos. 2. Some sections are added to the first direction. 3. The small theory of list difference is now separated into Prefix_subtract.thy and the ROOT.ML
zhang
parents: 30
diff changeset
   292
      } moreover {
b6815473ee2e 1. Myhill.thy is proved to correct some typos. 2. Some sections are added to the first direction. 3. The small theory of list difference is now separated into Prefix_subtract.thy and the ROOT.ML
zhang
parents: 30
diff changeset
   293
        fix za
b6815473ee2e 1. Myhill.thy is proved to correct some typos. 2. Some sections are added to the first direction. 3. The small theory of list difference is now separated into Prefix_subtract.thy and the ROOT.ML
zhang
parents: 30
diff changeset
   294
        assume h1: "za \<le> z" and h2: "(x @ za) \<in> L\<^isub>1" and h3: "z - za \<in> L\<^isub>2"
b6815473ee2e 1. Myhill.thy is proved to correct some typos. 2. Some sections are added to the first direction. 3. The small theory of list difference is now separated into Prefix_subtract.thy and the ROOT.ML
zhang
parents: 30
diff changeset
   295
        hence "y @ za \<in> L\<^isub>1"
b6815473ee2e 1. Myhill.thy is proved to correct some typos. 2. Some sections are added to the first direction. 3. The small theory of list difference is now separated into Prefix_subtract.thy and the ROOT.ML
zhang
parents: 30
diff changeset
   296
        proof-
b6815473ee2e 1. Myhill.thy is proved to correct some typos. 2. Some sections are added to the first direction. 3. The small theory of list difference is now separated into Prefix_subtract.thy and the ROOT.ML
zhang
parents: 30
diff changeset
   297
          have "\<approx>L\<^isub>1 `` {x} = \<approx>L\<^isub>1 `` {y}" 
b6815473ee2e 1. Myhill.thy is proved to correct some typos. 2. Some sections are added to the first direction. 3. The small theory of list difference is now separated into Prefix_subtract.thy and the ROOT.ML
zhang
parents: 30
diff changeset
   298
            using h1 tag_xy by (auto simp:tag_str_SEQ_def)
b6815473ee2e 1. Myhill.thy is proved to correct some typos. 2. Some sections are added to the first direction. 3. The small theory of list difference is now separated into Prefix_subtract.thy and the ROOT.ML
zhang
parents: 30
diff changeset
   299
          with h2 show ?thesis 
b6815473ee2e 1. Myhill.thy is proved to correct some typos. 2. Some sections are added to the first direction. 3. The small theory of list difference is now separated into Prefix_subtract.thy and the ROOT.ML
zhang
parents: 30
diff changeset
   300
            by (auto simp:Image_def str_eq_rel_def str_eq_def) 
b6815473ee2e 1. Myhill.thy is proved to correct some typos. 2. Some sections are added to the first direction. 3. The small theory of list difference is now separated into Prefix_subtract.thy and the ROOT.ML
zhang
parents: 30
diff changeset
   301
        qed
b6815473ee2e 1. Myhill.thy is proved to correct some typos. 2. Some sections are added to the first direction. 3. The small theory of list difference is now separated into Prefix_subtract.thy and the ROOT.ML
zhang
parents: 30
diff changeset
   302
        with h1 h3 have "y @ z \<in> L\<^isub>1 ;; L\<^isub>2" 
b6815473ee2e 1. Myhill.thy is proved to correct some typos. 2. Some sections are added to the first direction. 3. The small theory of list difference is now separated into Prefix_subtract.thy and the ROOT.ML
zhang
parents: 30
diff changeset
   303
          by (drule_tac A = L\<^isub>1 in seq_intro, auto elim:prefixE)
b6815473ee2e 1. Myhill.thy is proved to correct some typos. 2. Some sections are added to the first direction. 3. The small theory of list difference is now separated into Prefix_subtract.thy and the ROOT.ML
zhang
parents: 30
diff changeset
   304
      }
b6815473ee2e 1. Myhill.thy is proved to correct some typos. 2. Some sections are added to the first direction. 3. The small theory of list difference is now separated into Prefix_subtract.thy and the ROOT.ML
zhang
parents: 30
diff changeset
   305
      ultimately show ?thesis by blast
b6815473ee2e 1. Myhill.thy is proved to correct some typos. 2. Some sections are added to the first direction. 3. The small theory of list difference is now separated into Prefix_subtract.thy and the ROOT.ML
zhang
parents: 30
diff changeset
   306
    qed
b6815473ee2e 1. Myhill.thy is proved to correct some typos. 2. Some sections are added to the first direction. 3. The small theory of list difference is now separated into Prefix_subtract.thy and the ROOT.ML
zhang
parents: 30
diff changeset
   307
  } thus "tag_str_SEQ L\<^isub>1 L\<^isub>2 m = tag_str_SEQ L\<^isub>1 L\<^isub>2 n \<Longrightarrow> m \<approx>(L\<^isub>1 ;; L\<^isub>2) n" 
b6815473ee2e 1. Myhill.thy is proved to correct some typos. 2. Some sections are added to the first direction. 3. The small theory of list difference is now separated into Prefix_subtract.thy and the ROOT.ML
zhang
parents: 30
diff changeset
   308
    by (auto simp add: str_eq_def str_eq_rel_def)
43
cb4403fabda7 added my changes again
urbanc
parents: 42
diff changeset
   309
qed
31
b6815473ee2e 1. Myhill.thy is proved to correct some typos. 2. Some sections are added to the first direction. 3. The small theory of list difference is now separated into Prefix_subtract.thy and the ROOT.ML
zhang
parents: 30
diff changeset
   310
43
cb4403fabda7 added my changes again
urbanc
parents: 42
diff changeset
   311
lemma quot_seq_finiteI [intro]:
cb4403fabda7 added my changes again
urbanc
parents: 42
diff changeset
   312
  fixes L1 L2::"lang"
cb4403fabda7 added my changes again
urbanc
parents: 42
diff changeset
   313
  assumes fin1: "finite (UNIV // \<approx>L1)" 
cb4403fabda7 added my changes again
urbanc
parents: 42
diff changeset
   314
  and     fin2: "finite (UNIV // \<approx>L2)" 
cb4403fabda7 added my changes again
urbanc
parents: 42
diff changeset
   315
  shows "finite (UNIV // \<approx>(L1 ;; L2))"
cb4403fabda7 added my changes again
urbanc
parents: 42
diff changeset
   316
proof (rule_tac tag = "tag_str_SEQ L1 L2" in tag_finite_imageD)
cb4403fabda7 added my changes again
urbanc
parents: 42
diff changeset
   317
  show "\<And>x y. tag_str_SEQ L1 L2 x = tag_str_SEQ L1 L2 y \<Longrightarrow> x \<approx>(L1 ;; L2) y"
cb4403fabda7 added my changes again
urbanc
parents: 42
diff changeset
   318
    by (rule tag_str_SEQ_injI)
cb4403fabda7 added my changes again
urbanc
parents: 42
diff changeset
   319
next
cb4403fabda7 added my changes again
urbanc
parents: 42
diff changeset
   320
  have *: "finite ((UNIV // \<approx>L1) \<times> (Pow (UNIV // \<approx>L2)))" 
cb4403fabda7 added my changes again
urbanc
parents: 42
diff changeset
   321
    using fin1 fin2 by auto
cb4403fabda7 added my changes again
urbanc
parents: 42
diff changeset
   322
  show "finite (range (tag_str_SEQ L1 L2))" 
cb4403fabda7 added my changes again
urbanc
parents: 42
diff changeset
   323
    unfolding tag_str_SEQ_def
cb4403fabda7 added my changes again
urbanc
parents: 42
diff changeset
   324
    apply(rule finite_subset[OF _ *])
cb4403fabda7 added my changes again
urbanc
parents: 42
diff changeset
   325
    unfolding quotient_def
cb4403fabda7 added my changes again
urbanc
parents: 42
diff changeset
   326
    by auto
cb4403fabda7 added my changes again
urbanc
parents: 42
diff changeset
   327
qed
31
b6815473ee2e 1. Myhill.thy is proved to correct some typos. 2. Some sections are added to the first direction. 3. The small theory of list difference is now separated into Prefix_subtract.thy and the ROOT.ML
zhang
parents: 30
diff changeset
   328
43
cb4403fabda7 added my changes again
urbanc
parents: 42
diff changeset
   329
cb4403fabda7 added my changes again
urbanc
parents: 42
diff changeset
   330
subsection {* The case for @{const ALT} *}
31
b6815473ee2e 1. Myhill.thy is proved to correct some typos. 2. Some sections are added to the first direction. 3. The small theory of list difference is now separated into Prefix_subtract.thy and the ROOT.ML
zhang
parents: 30
diff changeset
   331
b6815473ee2e 1. Myhill.thy is proved to correct some typos. 2. Some sections are added to the first direction. 3. The small theory of list difference is now separated into Prefix_subtract.thy and the ROOT.ML
zhang
parents: 30
diff changeset
   332
definition 
43
cb4403fabda7 added my changes again
urbanc
parents: 42
diff changeset
   333
  tag_str_ALT :: "lang \<Rightarrow> lang \<Rightarrow> string \<Rightarrow> (lang \<times> lang)"
cb4403fabda7 added my changes again
urbanc
parents: 42
diff changeset
   334
where
cb4403fabda7 added my changes again
urbanc
parents: 42
diff changeset
   335
  "tag_str_ALT L1 L2 = (\<lambda>x. (\<approx>L1 `` {x}, \<approx>L2 `` {x}))"
cb4403fabda7 added my changes again
urbanc
parents: 42
diff changeset
   336
31
b6815473ee2e 1. Myhill.thy is proved to correct some typos. 2. Some sections are added to the first direction. 3. The small theory of list difference is now separated into Prefix_subtract.thy and the ROOT.ML
zhang
parents: 30
diff changeset
   337
43
cb4403fabda7 added my changes again
urbanc
parents: 42
diff changeset
   338
lemma quot_union_finiteI [intro]:
cb4403fabda7 added my changes again
urbanc
parents: 42
diff changeset
   339
  fixes L1 L2::"lang"
cb4403fabda7 added my changes again
urbanc
parents: 42
diff changeset
   340
  assumes finite1: "finite (UNIV // \<approx>L1)"
cb4403fabda7 added my changes again
urbanc
parents: 42
diff changeset
   341
  and     finite2: "finite (UNIV // \<approx>L2)"
cb4403fabda7 added my changes again
urbanc
parents: 42
diff changeset
   342
  shows "finite (UNIV // \<approx>(L1 \<union> L2))"
cb4403fabda7 added my changes again
urbanc
parents: 42
diff changeset
   343
proof (rule_tac tag = "tag_str_ALT L1 L2" in tag_finite_imageD)
cb4403fabda7 added my changes again
urbanc
parents: 42
diff changeset
   344
  show "\<And>x y. tag_str_ALT L1 L2 x = tag_str_ALT L1 L2 y \<Longrightarrow> x \<approx>(L1 \<union> L2) y"
cb4403fabda7 added my changes again
urbanc
parents: 42
diff changeset
   345
    unfolding tag_str_ALT_def 
cb4403fabda7 added my changes again
urbanc
parents: 42
diff changeset
   346
    unfolding str_eq_def
cb4403fabda7 added my changes again
urbanc
parents: 42
diff changeset
   347
    unfolding Image_def 
cb4403fabda7 added my changes again
urbanc
parents: 42
diff changeset
   348
    unfolding str_eq_rel_def
cb4403fabda7 added my changes again
urbanc
parents: 42
diff changeset
   349
    by auto
31
b6815473ee2e 1. Myhill.thy is proved to correct some typos. 2. Some sections are added to the first direction. 3. The small theory of list difference is now separated into Prefix_subtract.thy and the ROOT.ML
zhang
parents: 30
diff changeset
   350
next
43
cb4403fabda7 added my changes again
urbanc
parents: 42
diff changeset
   351
  have *: "finite ((UNIV // \<approx>L1) \<times> (UNIV // \<approx>L2))" 
cb4403fabda7 added my changes again
urbanc
parents: 42
diff changeset
   352
    using finite1 finite2 by auto
cb4403fabda7 added my changes again
urbanc
parents: 42
diff changeset
   353
  show "finite (range (tag_str_ALT L1 L2))"
cb4403fabda7 added my changes again
urbanc
parents: 42
diff changeset
   354
    unfolding tag_str_ALT_def
cb4403fabda7 added my changes again
urbanc
parents: 42
diff changeset
   355
    apply(rule finite_subset[OF _ *])
cb4403fabda7 added my changes again
urbanc
parents: 42
diff changeset
   356
    unfolding quotient_def
cb4403fabda7 added my changes again
urbanc
parents: 42
diff changeset
   357
    by auto
31
b6815473ee2e 1. Myhill.thy is proved to correct some typos. 2. Some sections are added to the first direction. 3. The small theory of list difference is now separated into Prefix_subtract.thy and the ROOT.ML
zhang
parents: 30
diff changeset
   358
qed
b6815473ee2e 1. Myhill.thy is proved to correct some typos. 2. Some sections are added to the first direction. 3. The small theory of list difference is now separated into Prefix_subtract.thy and the ROOT.ML
zhang
parents: 30
diff changeset
   359
43
cb4403fabda7 added my changes again
urbanc
parents: 42
diff changeset
   360
subsection {* The case for @{const "STAR"} *}
31
b6815473ee2e 1. Myhill.thy is proved to correct some typos. 2. Some sections are added to the first direction. 3. The small theory of list difference is now separated into Prefix_subtract.thy and the ROOT.ML
zhang
parents: 30
diff changeset
   361
b6815473ee2e 1. Myhill.thy is proved to correct some typos. 2. Some sections are added to the first direction. 3. The small theory of list difference is now separated into Prefix_subtract.thy and the ROOT.ML
zhang
parents: 30
diff changeset
   362
text {* 
b6815473ee2e 1. Myhill.thy is proved to correct some typos. 2. Some sections are added to the first direction. 3. The small theory of list difference is now separated into Prefix_subtract.thy and the ROOT.ML
zhang
parents: 30
diff changeset
   363
  This turned out to be the trickiest case. 
b6815473ee2e 1. Myhill.thy is proved to correct some typos. 2. Some sections are added to the first direction. 3. The small theory of list difference is now separated into Prefix_subtract.thy and the ROOT.ML
zhang
parents: 30
diff changeset
   364
  *} (* I will make some illustrations for it. *)
b6815473ee2e 1. Myhill.thy is proved to correct some typos. 2. Some sections are added to the first direction. 3. The small theory of list difference is now separated into Prefix_subtract.thy and the ROOT.ML
zhang
parents: 30
diff changeset
   365
b6815473ee2e 1. Myhill.thy is proved to correct some typos. 2. Some sections are added to the first direction. 3. The small theory of list difference is now separated into Prefix_subtract.thy and the ROOT.ML
zhang
parents: 30
diff changeset
   366
definition 
43
cb4403fabda7 added my changes again
urbanc
parents: 42
diff changeset
   367
  tag_str_STAR :: "lang \<Rightarrow> string \<Rightarrow> lang set"
cb4403fabda7 added my changes again
urbanc
parents: 42
diff changeset
   368
where
cb4403fabda7 added my changes again
urbanc
parents: 42
diff changeset
   369
  "tag_str_STAR L1 = (\<lambda>x. {\<approx>L1 `` {x - xa} | xa. xa < x \<and> xa \<in> L1\<star>})"
31
b6815473ee2e 1. Myhill.thy is proved to correct some typos. 2. Some sections are added to the first direction. 3. The small theory of list difference is now separated into Prefix_subtract.thy and the ROOT.ML
zhang
parents: 30
diff changeset
   370
43
cb4403fabda7 added my changes again
urbanc
parents: 42
diff changeset
   371
cb4403fabda7 added my changes again
urbanc
parents: 42
diff changeset
   372
lemma finite_set_has_max: 
cb4403fabda7 added my changes again
urbanc
parents: 42
diff changeset
   373
  "\<lbrakk>finite A; A \<noteq> {}\<rbrakk> \<Longrightarrow> (\<exists> max \<in> A. \<forall> a \<in> A. f a <= (f max :: nat))"
31
b6815473ee2e 1. Myhill.thy is proved to correct some typos. 2. Some sections are added to the first direction. 3. The small theory of list difference is now separated into Prefix_subtract.thy and the ROOT.ML
zhang
parents: 30
diff changeset
   374
proof (induct rule:finite.induct)
b6815473ee2e 1. Myhill.thy is proved to correct some typos. 2. Some sections are added to the first direction. 3. The small theory of list difference is now separated into Prefix_subtract.thy and the ROOT.ML
zhang
parents: 30
diff changeset
   375
  case emptyI thus ?case by simp
b6815473ee2e 1. Myhill.thy is proved to correct some typos. 2. Some sections are added to the first direction. 3. The small theory of list difference is now separated into Prefix_subtract.thy and the ROOT.ML
zhang
parents: 30
diff changeset
   376
next
b6815473ee2e 1. Myhill.thy is proved to correct some typos. 2. Some sections are added to the first direction. 3. The small theory of list difference is now separated into Prefix_subtract.thy and the ROOT.ML
zhang
parents: 30
diff changeset
   377
  case (insertI A a)
b6815473ee2e 1. Myhill.thy is proved to correct some typos. 2. Some sections are added to the first direction. 3. The small theory of list difference is now separated into Prefix_subtract.thy and the ROOT.ML
zhang
parents: 30
diff changeset
   378
  show ?case
b6815473ee2e 1. Myhill.thy is proved to correct some typos. 2. Some sections are added to the first direction. 3. The small theory of list difference is now separated into Prefix_subtract.thy and the ROOT.ML
zhang
parents: 30
diff changeset
   379
  proof (cases "A = {}")
b6815473ee2e 1. Myhill.thy is proved to correct some typos. 2. Some sections are added to the first direction. 3. The small theory of list difference is now separated into Prefix_subtract.thy and the ROOT.ML
zhang
parents: 30
diff changeset
   380
    case True thus ?thesis by (rule_tac x = a in bexI, auto)
b6815473ee2e 1. Myhill.thy is proved to correct some typos. 2. Some sections are added to the first direction. 3. The small theory of list difference is now separated into Prefix_subtract.thy and the ROOT.ML
zhang
parents: 30
diff changeset
   381
  next
b6815473ee2e 1. Myhill.thy is proved to correct some typos. 2. Some sections are added to the first direction. 3. The small theory of list difference is now separated into Prefix_subtract.thy and the ROOT.ML
zhang
parents: 30
diff changeset
   382
    case False
b6815473ee2e 1. Myhill.thy is proved to correct some typos. 2. Some sections are added to the first direction. 3. The small theory of list difference is now separated into Prefix_subtract.thy and the ROOT.ML
zhang
parents: 30
diff changeset
   383
    with prems obtain max 
b6815473ee2e 1. Myhill.thy is proved to correct some typos. 2. Some sections are added to the first direction. 3. The small theory of list difference is now separated into Prefix_subtract.thy and the ROOT.ML
zhang
parents: 30
diff changeset
   384
      where h1: "max \<in> A" 
b6815473ee2e 1. Myhill.thy is proved to correct some typos. 2. Some sections are added to the first direction. 3. The small theory of list difference is now separated into Prefix_subtract.thy and the ROOT.ML
zhang
parents: 30
diff changeset
   385
      and h2: "\<forall>a\<in>A. f a \<le> f max" by blast
b6815473ee2e 1. Myhill.thy is proved to correct some typos. 2. Some sections are added to the first direction. 3. The small theory of list difference is now separated into Prefix_subtract.thy and the ROOT.ML
zhang
parents: 30
diff changeset
   386
    show ?thesis
b6815473ee2e 1. Myhill.thy is proved to correct some typos. 2. Some sections are added to the first direction. 3. The small theory of list difference is now separated into Prefix_subtract.thy and the ROOT.ML
zhang
parents: 30
diff changeset
   387
    proof (cases "f a \<le> f max")
b6815473ee2e 1. Myhill.thy is proved to correct some typos. 2. Some sections are added to the first direction. 3. The small theory of list difference is now separated into Prefix_subtract.thy and the ROOT.ML
zhang
parents: 30
diff changeset
   388
      assume "f a \<le> f max"
b6815473ee2e 1. Myhill.thy is proved to correct some typos. 2. Some sections are added to the first direction. 3. The small theory of list difference is now separated into Prefix_subtract.thy and the ROOT.ML
zhang
parents: 30
diff changeset
   389
      with h1 h2 show ?thesis by (rule_tac x = max in bexI, auto)
b6815473ee2e 1. Myhill.thy is proved to correct some typos. 2. Some sections are added to the first direction. 3. The small theory of list difference is now separated into Prefix_subtract.thy and the ROOT.ML
zhang
parents: 30
diff changeset
   390
    next
b6815473ee2e 1. Myhill.thy is proved to correct some typos. 2. Some sections are added to the first direction. 3. The small theory of list difference is now separated into Prefix_subtract.thy and the ROOT.ML
zhang
parents: 30
diff changeset
   391
      assume "\<not> (f a \<le> f max)"
b6815473ee2e 1. Myhill.thy is proved to correct some typos. 2. Some sections are added to the first direction. 3. The small theory of list difference is now separated into Prefix_subtract.thy and the ROOT.ML
zhang
parents: 30
diff changeset
   392
      thus ?thesis using h2 by (rule_tac x = a in bexI, auto)
b6815473ee2e 1. Myhill.thy is proved to correct some typos. 2. Some sections are added to the first direction. 3. The small theory of list difference is now separated into Prefix_subtract.thy and the ROOT.ML
zhang
parents: 30
diff changeset
   393
    qed
b6815473ee2e 1. Myhill.thy is proved to correct some typos. 2. Some sections are added to the first direction. 3. The small theory of list difference is now separated into Prefix_subtract.thy and the ROOT.ML
zhang
parents: 30
diff changeset
   394
  qed
b6815473ee2e 1. Myhill.thy is proved to correct some typos. 2. Some sections are added to the first direction. 3. The small theory of list difference is now separated into Prefix_subtract.thy and the ROOT.ML
zhang
parents: 30
diff changeset
   395
qed
b6815473ee2e 1. Myhill.thy is proved to correct some typos. 2. Some sections are added to the first direction. 3. The small theory of list difference is now separated into Prefix_subtract.thy and the ROOT.ML
zhang
parents: 30
diff changeset
   396
b6815473ee2e 1. Myhill.thy is proved to correct some typos. 2. Some sections are added to the first direction. 3. The small theory of list difference is now separated into Prefix_subtract.thy and the ROOT.ML
zhang
parents: 30
diff changeset
   397
lemma finite_strict_prefix_set: "finite {xa. xa < (x::string)}"
b6815473ee2e 1. Myhill.thy is proved to correct some typos. 2. Some sections are added to the first direction. 3. The small theory of list difference is now separated into Prefix_subtract.thy and the ROOT.ML
zhang
parents: 30
diff changeset
   398
apply (induct x rule:rev_induct, simp)
b6815473ee2e 1. Myhill.thy is proved to correct some typos. 2. Some sections are added to the first direction. 3. The small theory of list difference is now separated into Prefix_subtract.thy and the ROOT.ML
zhang
parents: 30
diff changeset
   399
apply (subgoal_tac "{xa. xa < xs @ [x]} = {xa. xa < xs} \<union> {xs}")
b6815473ee2e 1. Myhill.thy is proved to correct some typos. 2. Some sections are added to the first direction. 3. The small theory of list difference is now separated into Prefix_subtract.thy and the ROOT.ML
zhang
parents: 30
diff changeset
   400
by (auto simp:strict_prefix_def)
b6815473ee2e 1. Myhill.thy is proved to correct some typos. 2. Some sections are added to the first direction. 3. The small theory of list difference is now separated into Prefix_subtract.thy and the ROOT.ML
zhang
parents: 30
diff changeset
   401
b6815473ee2e 1. Myhill.thy is proved to correct some typos. 2. Some sections are added to the first direction. 3. The small theory of list difference is now separated into Prefix_subtract.thy and the ROOT.ML
zhang
parents: 30
diff changeset
   402
lemma tag_str_STAR_injI:
b6815473ee2e 1. Myhill.thy is proved to correct some typos. 2. Some sections are added to the first direction. 3. The small theory of list difference is now separated into Prefix_subtract.thy and the ROOT.ML
zhang
parents: 30
diff changeset
   403
  "tag_str_STAR L\<^isub>1 m = tag_str_STAR L\<^isub>1 n \<Longrightarrow> m \<approx>(L\<^isub>1\<star>) n"
b6815473ee2e 1. Myhill.thy is proved to correct some typos. 2. Some sections are added to the first direction. 3. The small theory of list difference is now separated into Prefix_subtract.thy and the ROOT.ML
zhang
parents: 30
diff changeset
   404
proof-
b6815473ee2e 1. Myhill.thy is proved to correct some typos. 2. Some sections are added to the first direction. 3. The small theory of list difference is now separated into Prefix_subtract.thy and the ROOT.ML
zhang
parents: 30
diff changeset
   405
  { fix x y z
b6815473ee2e 1. Myhill.thy is proved to correct some typos. 2. Some sections are added to the first direction. 3. The small theory of list difference is now separated into Prefix_subtract.thy and the ROOT.ML
zhang
parents: 30
diff changeset
   406
    assume xz_in_star: "x @ z \<in> L\<^isub>1\<star>"
b6815473ee2e 1. Myhill.thy is proved to correct some typos. 2. Some sections are added to the first direction. 3. The small theory of list difference is now separated into Prefix_subtract.thy and the ROOT.ML
zhang
parents: 30
diff changeset
   407
    and tag_xy: "tag_str_STAR L\<^isub>1 x = tag_str_STAR L\<^isub>1 y"
b6815473ee2e 1. Myhill.thy is proved to correct some typos. 2. Some sections are added to the first direction. 3. The small theory of list difference is now separated into Prefix_subtract.thy and the ROOT.ML
zhang
parents: 30
diff changeset
   408
    have "y @ z \<in> L\<^isub>1\<star>"
b6815473ee2e 1. Myhill.thy is proved to correct some typos. 2. Some sections are added to the first direction. 3. The small theory of list difference is now separated into Prefix_subtract.thy and the ROOT.ML
zhang
parents: 30
diff changeset
   409
    proof(cases "x = []")
b6815473ee2e 1. Myhill.thy is proved to correct some typos. 2. Some sections are added to the first direction. 3. The small theory of list difference is now separated into Prefix_subtract.thy and the ROOT.ML
zhang
parents: 30
diff changeset
   410
      case True
b6815473ee2e 1. Myhill.thy is proved to correct some typos. 2. Some sections are added to the first direction. 3. The small theory of list difference is now separated into Prefix_subtract.thy and the ROOT.ML
zhang
parents: 30
diff changeset
   411
      with tag_xy have "y = []" 
b6815473ee2e 1. Myhill.thy is proved to correct some typos. 2. Some sections are added to the first direction. 3. The small theory of list difference is now separated into Prefix_subtract.thy and the ROOT.ML
zhang
parents: 30
diff changeset
   412
        by (auto simp:tag_str_STAR_def strict_prefix_def)
b6815473ee2e 1. Myhill.thy is proved to correct some typos. 2. Some sections are added to the first direction. 3. The small theory of list difference is now separated into Prefix_subtract.thy and the ROOT.ML
zhang
parents: 30
diff changeset
   413
      thus ?thesis using xz_in_star True by simp
b6815473ee2e 1. Myhill.thy is proved to correct some typos. 2. Some sections are added to the first direction. 3. The small theory of list difference is now separated into Prefix_subtract.thy and the ROOT.ML
zhang
parents: 30
diff changeset
   414
    next
b6815473ee2e 1. Myhill.thy is proved to correct some typos. 2. Some sections are added to the first direction. 3. The small theory of list difference is now separated into Prefix_subtract.thy and the ROOT.ML
zhang
parents: 30
diff changeset
   415
      case False
b6815473ee2e 1. Myhill.thy is proved to correct some typos. 2. Some sections are added to the first direction. 3. The small theory of list difference is now separated into Prefix_subtract.thy and the ROOT.ML
zhang
parents: 30
diff changeset
   416
      obtain x_max 
b6815473ee2e 1. Myhill.thy is proved to correct some typos. 2. Some sections are added to the first direction. 3. The small theory of list difference is now separated into Prefix_subtract.thy and the ROOT.ML
zhang
parents: 30
diff changeset
   417
        where h1: "x_max < x" 
b6815473ee2e 1. Myhill.thy is proved to correct some typos. 2. Some sections are added to the first direction. 3. The small theory of list difference is now separated into Prefix_subtract.thy and the ROOT.ML
zhang
parents: 30
diff changeset
   418
        and h2: "x_max \<in> L\<^isub>1\<star>" 
b6815473ee2e 1. Myhill.thy is proved to correct some typos. 2. Some sections are added to the first direction. 3. The small theory of list difference is now separated into Prefix_subtract.thy and the ROOT.ML
zhang
parents: 30
diff changeset
   419
        and h3: "(x - x_max) @ z \<in> L\<^isub>1\<star>" 
b6815473ee2e 1. Myhill.thy is proved to correct some typos. 2. Some sections are added to the first direction. 3. The small theory of list difference is now separated into Prefix_subtract.thy and the ROOT.ML
zhang
parents: 30
diff changeset
   420
        and h4:"\<forall> xa < x. xa \<in> L\<^isub>1\<star> \<and> (x - xa) @ z \<in> L\<^isub>1\<star> 
b6815473ee2e 1. Myhill.thy is proved to correct some typos. 2. Some sections are added to the first direction. 3. The small theory of list difference is now separated into Prefix_subtract.thy and the ROOT.ML
zhang
parents: 30
diff changeset
   421
                                     \<longrightarrow> length xa \<le> length x_max"
b6815473ee2e 1. Myhill.thy is proved to correct some typos. 2. Some sections are added to the first direction. 3. The small theory of list difference is now separated into Prefix_subtract.thy and the ROOT.ML
zhang
parents: 30
diff changeset
   422
      proof-
b6815473ee2e 1. Myhill.thy is proved to correct some typos. 2. Some sections are added to the first direction. 3. The small theory of list difference is now separated into Prefix_subtract.thy and the ROOT.ML
zhang
parents: 30
diff changeset
   423
        let ?S = "{xa. xa < x \<and> xa \<in> L\<^isub>1\<star> \<and> (x - xa) @ z \<in> L\<^isub>1\<star>}"
b6815473ee2e 1. Myhill.thy is proved to correct some typos. 2. Some sections are added to the first direction. 3. The small theory of list difference is now separated into Prefix_subtract.thy and the ROOT.ML
zhang
parents: 30
diff changeset
   424
        have "finite ?S"
b6815473ee2e 1. Myhill.thy is proved to correct some typos. 2. Some sections are added to the first direction. 3. The small theory of list difference is now separated into Prefix_subtract.thy and the ROOT.ML
zhang
parents: 30
diff changeset
   425
          by (rule_tac B = "{xa. xa < x}" in finite_subset, 
b6815473ee2e 1. Myhill.thy is proved to correct some typos. 2. Some sections are added to the first direction. 3. The small theory of list difference is now separated into Prefix_subtract.thy and the ROOT.ML
zhang
parents: 30
diff changeset
   426
                                auto simp:finite_strict_prefix_set)
b6815473ee2e 1. Myhill.thy is proved to correct some typos. 2. Some sections are added to the first direction. 3. The small theory of list difference is now separated into Prefix_subtract.thy and the ROOT.ML
zhang
parents: 30
diff changeset
   427
        moreover have "?S \<noteq> {}" using False xz_in_star
b6815473ee2e 1. Myhill.thy is proved to correct some typos. 2. Some sections are added to the first direction. 3. The small theory of list difference is now separated into Prefix_subtract.thy and the ROOT.ML
zhang
parents: 30
diff changeset
   428
          by (simp, rule_tac x = "[]" in exI, auto simp:strict_prefix_def)
b6815473ee2e 1. Myhill.thy is proved to correct some typos. 2. Some sections are added to the first direction. 3. The small theory of list difference is now separated into Prefix_subtract.thy and the ROOT.ML
zhang
parents: 30
diff changeset
   429
        ultimately have "\<exists> max \<in> ?S. \<forall> a \<in> ?S. length a \<le> length max" 
b6815473ee2e 1. Myhill.thy is proved to correct some typos. 2. Some sections are added to the first direction. 3. The small theory of list difference is now separated into Prefix_subtract.thy and the ROOT.ML
zhang
parents: 30
diff changeset
   430
          using finite_set_has_max by blast
b6815473ee2e 1. Myhill.thy is proved to correct some typos. 2. Some sections are added to the first direction. 3. The small theory of list difference is now separated into Prefix_subtract.thy and the ROOT.ML
zhang
parents: 30
diff changeset
   431
        with prems show ?thesis by blast
b6815473ee2e 1. Myhill.thy is proved to correct some typos. 2. Some sections are added to the first direction. 3. The small theory of list difference is now separated into Prefix_subtract.thy and the ROOT.ML
zhang
parents: 30
diff changeset
   432
      qed
b6815473ee2e 1. Myhill.thy is proved to correct some typos. 2. Some sections are added to the first direction. 3. The small theory of list difference is now separated into Prefix_subtract.thy and the ROOT.ML
zhang
parents: 30
diff changeset
   433
      obtain ya 
b6815473ee2e 1. Myhill.thy is proved to correct some typos. 2. Some sections are added to the first direction. 3. The small theory of list difference is now separated into Prefix_subtract.thy and the ROOT.ML
zhang
parents: 30
diff changeset
   434
        where h5: "ya < y" and h6: "ya \<in> L\<^isub>1\<star>" and h7: "(x - x_max) \<approx>L\<^isub>1 (y - ya)"
b6815473ee2e 1. Myhill.thy is proved to correct some typos. 2. Some sections are added to the first direction. 3. The small theory of list difference is now separated into Prefix_subtract.thy and the ROOT.ML
zhang
parents: 30
diff changeset
   435
      proof-
b6815473ee2e 1. Myhill.thy is proved to correct some typos. 2. Some sections are added to the first direction. 3. The small theory of list difference is now separated into Prefix_subtract.thy and the ROOT.ML
zhang
parents: 30
diff changeset
   436
        from tag_xy have "{\<approx>L\<^isub>1 `` {x - xa} |xa. xa < x \<and> xa \<in> L\<^isub>1\<star>} = 
b6815473ee2e 1. Myhill.thy is proved to correct some typos. 2. Some sections are added to the first direction. 3. The small theory of list difference is now separated into Prefix_subtract.thy and the ROOT.ML
zhang
parents: 30
diff changeset
   437
          {\<approx>L\<^isub>1 `` {y - xa} |xa. xa < y \<and> xa \<in> L\<^isub>1\<star>}" (is "?left = ?right")
b6815473ee2e 1. Myhill.thy is proved to correct some typos. 2. Some sections are added to the first direction. 3. The small theory of list difference is now separated into Prefix_subtract.thy and the ROOT.ML
zhang
parents: 30
diff changeset
   438
          by (auto simp:tag_str_STAR_def)
b6815473ee2e 1. Myhill.thy is proved to correct some typos. 2. Some sections are added to the first direction. 3. The small theory of list difference is now separated into Prefix_subtract.thy and the ROOT.ML
zhang
parents: 30
diff changeset
   439
        moreover have "\<approx>L\<^isub>1 `` {x - x_max} \<in> ?left" using h1 h2 by auto
b6815473ee2e 1. Myhill.thy is proved to correct some typos. 2. Some sections are added to the first direction. 3. The small theory of list difference is now separated into Prefix_subtract.thy and the ROOT.ML
zhang
parents: 30
diff changeset
   440
        ultimately have "\<approx>L\<^isub>1 `` {x - x_max} \<in> ?right" by simp
b6815473ee2e 1. Myhill.thy is proved to correct some typos. 2. Some sections are added to the first direction. 3. The small theory of list difference is now separated into Prefix_subtract.thy and the ROOT.ML
zhang
parents: 30
diff changeset
   441
        with prems show ?thesis apply 
b6815473ee2e 1. Myhill.thy is proved to correct some typos. 2. Some sections are added to the first direction. 3. The small theory of list difference is now separated into Prefix_subtract.thy and the ROOT.ML
zhang
parents: 30
diff changeset
   442
          (simp add:Image_def str_eq_rel_def str_eq_def) by blast
b6815473ee2e 1. Myhill.thy is proved to correct some typos. 2. Some sections are added to the first direction. 3. The small theory of list difference is now separated into Prefix_subtract.thy and the ROOT.ML
zhang
parents: 30
diff changeset
   443
      qed      
b6815473ee2e 1. Myhill.thy is proved to correct some typos. 2. Some sections are added to the first direction. 3. The small theory of list difference is now separated into Prefix_subtract.thy and the ROOT.ML
zhang
parents: 30
diff changeset
   444
      have "(y - ya) @ z \<in> L\<^isub>1\<star>" 
b6815473ee2e 1. Myhill.thy is proved to correct some typos. 2. Some sections are added to the first direction. 3. The small theory of list difference is now separated into Prefix_subtract.thy and the ROOT.ML
zhang
parents: 30
diff changeset
   445
      proof-
b6815473ee2e 1. Myhill.thy is proved to correct some typos. 2. Some sections are added to the first direction. 3. The small theory of list difference is now separated into Prefix_subtract.thy and the ROOT.ML
zhang
parents: 30
diff changeset
   446
        from h3 h1 obtain a b where a_in: "a \<in> L\<^isub>1" 
b6815473ee2e 1. Myhill.thy is proved to correct some typos. 2. Some sections are added to the first direction. 3. The small theory of list difference is now separated into Prefix_subtract.thy and the ROOT.ML
zhang
parents: 30
diff changeset
   447
          and a_neq: "a \<noteq> []" and b_in: "b \<in> L\<^isub>1\<star>" 
b6815473ee2e 1. Myhill.thy is proved to correct some typos. 2. Some sections are added to the first direction. 3. The small theory of list difference is now separated into Prefix_subtract.thy and the ROOT.ML
zhang
parents: 30
diff changeset
   448
          and ab_max: "(x - x_max) @ z = a @ b" 
b6815473ee2e 1. Myhill.thy is proved to correct some typos. 2. Some sections are added to the first direction. 3. The small theory of list difference is now separated into Prefix_subtract.thy and the ROOT.ML
zhang
parents: 30
diff changeset
   449
          by (drule_tac star_decom, auto simp:strict_prefix_def elim:prefixE)
b6815473ee2e 1. Myhill.thy is proved to correct some typos. 2. Some sections are added to the first direction. 3. The small theory of list difference is now separated into Prefix_subtract.thy and the ROOT.ML
zhang
parents: 30
diff changeset
   450
        have "(x - x_max) \<le> a \<and> (a - (x - x_max)) @ b = z" 
b6815473ee2e 1. Myhill.thy is proved to correct some typos. 2. Some sections are added to the first direction. 3. The small theory of list difference is now separated into Prefix_subtract.thy and the ROOT.ML
zhang
parents: 30
diff changeset
   451
        proof -
b6815473ee2e 1. Myhill.thy is proved to correct some typos. 2. Some sections are added to the first direction. 3. The small theory of list difference is now separated into Prefix_subtract.thy and the ROOT.ML
zhang
parents: 30
diff changeset
   452
          have "((x - x_max) \<le> a \<and> (a - (x - x_max)) @ b = z) \<or> 
b6815473ee2e 1. Myhill.thy is proved to correct some typos. 2. Some sections are added to the first direction. 3. The small theory of list difference is now separated into Prefix_subtract.thy and the ROOT.ML
zhang
parents: 30
diff changeset
   453
                            (a < (x - x_max) \<and> ((x - x_max) - a) @ z = b)" 
b6815473ee2e 1. Myhill.thy is proved to correct some typos. 2. Some sections are added to the first direction. 3. The small theory of list difference is now separated into Prefix_subtract.thy and the ROOT.ML
zhang
parents: 30
diff changeset
   454
            using app_eq_dest[OF ab_max] by (auto simp:strict_prefix_def)
b6815473ee2e 1. Myhill.thy is proved to correct some typos. 2. Some sections are added to the first direction. 3. The small theory of list difference is now separated into Prefix_subtract.thy and the ROOT.ML
zhang
parents: 30
diff changeset
   455
          moreover { 
b6815473ee2e 1. Myhill.thy is proved to correct some typos. 2. Some sections are added to the first direction. 3. The small theory of list difference is now separated into Prefix_subtract.thy and the ROOT.ML
zhang
parents: 30
diff changeset
   456
            assume np: "a < (x - x_max)" and b_eqs: " ((x - x_max) - a) @ z = b"
b6815473ee2e 1. Myhill.thy is proved to correct some typos. 2. Some sections are added to the first direction. 3. The small theory of list difference is now separated into Prefix_subtract.thy and the ROOT.ML
zhang
parents: 30
diff changeset
   457
            have "False"
b6815473ee2e 1. Myhill.thy is proved to correct some typos. 2. Some sections are added to the first direction. 3. The small theory of list difference is now separated into Prefix_subtract.thy and the ROOT.ML
zhang
parents: 30
diff changeset
   458
            proof -
b6815473ee2e 1. Myhill.thy is proved to correct some typos. 2. Some sections are added to the first direction. 3. The small theory of list difference is now separated into Prefix_subtract.thy and the ROOT.ML
zhang
parents: 30
diff changeset
   459
              let ?x_max' = "x_max @ a"
b6815473ee2e 1. Myhill.thy is proved to correct some typos. 2. Some sections are added to the first direction. 3. The small theory of list difference is now separated into Prefix_subtract.thy and the ROOT.ML
zhang
parents: 30
diff changeset
   460
              have "?x_max' < x" 
b6815473ee2e 1. Myhill.thy is proved to correct some typos. 2. Some sections are added to the first direction. 3. The small theory of list difference is now separated into Prefix_subtract.thy and the ROOT.ML
zhang
parents: 30
diff changeset
   461
                using np h1 by (clarsimp simp:strict_prefix_def diff_prefix) 
b6815473ee2e 1. Myhill.thy is proved to correct some typos. 2. Some sections are added to the first direction. 3. The small theory of list difference is now separated into Prefix_subtract.thy and the ROOT.ML
zhang
parents: 30
diff changeset
   462
              moreover have "?x_max' \<in> L\<^isub>1\<star>" 
b6815473ee2e 1. Myhill.thy is proved to correct some typos. 2. Some sections are added to the first direction. 3. The small theory of list difference is now separated into Prefix_subtract.thy and the ROOT.ML
zhang
parents: 30
diff changeset
   463
                using a_in h2 by (simp add:star_intro3) 
b6815473ee2e 1. Myhill.thy is proved to correct some typos. 2. Some sections are added to the first direction. 3. The small theory of list difference is now separated into Prefix_subtract.thy and the ROOT.ML
zhang
parents: 30
diff changeset
   464
              moreover have "(x - ?x_max') @ z \<in> L\<^isub>1\<star>" 
b6815473ee2e 1. Myhill.thy is proved to correct some typos. 2. Some sections are added to the first direction. 3. The small theory of list difference is now separated into Prefix_subtract.thy and the ROOT.ML
zhang
parents: 30
diff changeset
   465
                using b_eqs b_in np h1 by (simp add:diff_diff_appd)
b6815473ee2e 1. Myhill.thy is proved to correct some typos. 2. Some sections are added to the first direction. 3. The small theory of list difference is now separated into Prefix_subtract.thy and the ROOT.ML
zhang
parents: 30
diff changeset
   466
              moreover have "\<not> (length ?x_max' \<le> length x_max)" 
b6815473ee2e 1. Myhill.thy is proved to correct some typos. 2. Some sections are added to the first direction. 3. The small theory of list difference is now separated into Prefix_subtract.thy and the ROOT.ML
zhang
parents: 30
diff changeset
   467
                using a_neq by simp
b6815473ee2e 1. Myhill.thy is proved to correct some typos. 2. Some sections are added to the first direction. 3. The small theory of list difference is now separated into Prefix_subtract.thy and the ROOT.ML
zhang
parents: 30
diff changeset
   468
              ultimately show ?thesis using h4 by blast
b6815473ee2e 1. Myhill.thy is proved to correct some typos. 2. Some sections are added to the first direction. 3. The small theory of list difference is now separated into Prefix_subtract.thy and the ROOT.ML
zhang
parents: 30
diff changeset
   469
            qed 
b6815473ee2e 1. Myhill.thy is proved to correct some typos. 2. Some sections are added to the first direction. 3. The small theory of list difference is now separated into Prefix_subtract.thy and the ROOT.ML
zhang
parents: 30
diff changeset
   470
          } ultimately show ?thesis by blast
b6815473ee2e 1. Myhill.thy is proved to correct some typos. 2. Some sections are added to the first direction. 3. The small theory of list difference is now separated into Prefix_subtract.thy and the ROOT.ML
zhang
parents: 30
diff changeset
   471
        qed
b6815473ee2e 1. Myhill.thy is proved to correct some typos. 2. Some sections are added to the first direction. 3. The small theory of list difference is now separated into Prefix_subtract.thy and the ROOT.ML
zhang
parents: 30
diff changeset
   472
        then obtain za where z_decom: "z = za @ b" 
b6815473ee2e 1. Myhill.thy is proved to correct some typos. 2. Some sections are added to the first direction. 3. The small theory of list difference is now separated into Prefix_subtract.thy and the ROOT.ML
zhang
parents: 30
diff changeset
   473
          and x_za: "(x - x_max) @ za \<in> L\<^isub>1" 
b6815473ee2e 1. Myhill.thy is proved to correct some typos. 2. Some sections are added to the first direction. 3. The small theory of list difference is now separated into Prefix_subtract.thy and the ROOT.ML
zhang
parents: 30
diff changeset
   474
          using a_in by (auto elim:prefixE)        
b6815473ee2e 1. Myhill.thy is proved to correct some typos. 2. Some sections are added to the first direction. 3. The small theory of list difference is now separated into Prefix_subtract.thy and the ROOT.ML
zhang
parents: 30
diff changeset
   475
        from x_za h7 have "(y - ya) @ za \<in> L\<^isub>1" 
b6815473ee2e 1. Myhill.thy is proved to correct some typos. 2. Some sections are added to the first direction. 3. The small theory of list difference is now separated into Prefix_subtract.thy and the ROOT.ML
zhang
parents: 30
diff changeset
   476
          by (auto simp:str_eq_def str_eq_rel_def)
b6815473ee2e 1. Myhill.thy is proved to correct some typos. 2. Some sections are added to the first direction. 3. The small theory of list difference is now separated into Prefix_subtract.thy and the ROOT.ML
zhang
parents: 30
diff changeset
   477
        with z_decom b_in show ?thesis by (auto dest!:step[of "(y - ya) @ za"])
b6815473ee2e 1. Myhill.thy is proved to correct some typos. 2. Some sections are added to the first direction. 3. The small theory of list difference is now separated into Prefix_subtract.thy and the ROOT.ML
zhang
parents: 30
diff changeset
   478
      qed
b6815473ee2e 1. Myhill.thy is proved to correct some typos. 2. Some sections are added to the first direction. 3. The small theory of list difference is now separated into Prefix_subtract.thy and the ROOT.ML
zhang
parents: 30
diff changeset
   479
      with h5 h6 show ?thesis 
b6815473ee2e 1. Myhill.thy is proved to correct some typos. 2. Some sections are added to the first direction. 3. The small theory of list difference is now separated into Prefix_subtract.thy and the ROOT.ML
zhang
parents: 30
diff changeset
   480
        by (drule_tac star_intro1, auto simp:strict_prefix_def elim:prefixE)
b6815473ee2e 1. Myhill.thy is proved to correct some typos. 2. Some sections are added to the first direction. 3. The small theory of list difference is now separated into Prefix_subtract.thy and the ROOT.ML
zhang
parents: 30
diff changeset
   481
    qed      
b6815473ee2e 1. Myhill.thy is proved to correct some typos. 2. Some sections are added to the first direction. 3. The small theory of list difference is now separated into Prefix_subtract.thy and the ROOT.ML
zhang
parents: 30
diff changeset
   482
  } thus "tag_str_STAR L\<^isub>1 m = tag_str_STAR L\<^isub>1 n \<Longrightarrow> m \<approx>(L\<^isub>1\<star>) n"
b6815473ee2e 1. Myhill.thy is proved to correct some typos. 2. Some sections are added to the first direction. 3. The small theory of list difference is now separated into Prefix_subtract.thy and the ROOT.ML
zhang
parents: 30
diff changeset
   483
    by (auto simp add:str_eq_def str_eq_rel_def)
b6815473ee2e 1. Myhill.thy is proved to correct some typos. 2. Some sections are added to the first direction. 3. The small theory of list difference is now separated into Prefix_subtract.thy and the ROOT.ML
zhang
parents: 30
diff changeset
   484
qed
b6815473ee2e 1. Myhill.thy is proved to correct some typos. 2. Some sections are added to the first direction. 3. The small theory of list difference is now separated into Prefix_subtract.thy and the ROOT.ML
zhang
parents: 30
diff changeset
   485
43
cb4403fabda7 added my changes again
urbanc
parents: 42
diff changeset
   486
lemma quot_star_finiteI [intro]:
cb4403fabda7 added my changes again
urbanc
parents: 42
diff changeset
   487
  fixes L1::"lang"
cb4403fabda7 added my changes again
urbanc
parents: 42
diff changeset
   488
  assumes finite1: "finite (UNIV // \<approx>L1)"
cb4403fabda7 added my changes again
urbanc
parents: 42
diff changeset
   489
  shows "finite (UNIV // \<approx>(L1\<star>))"
cb4403fabda7 added my changes again
urbanc
parents: 42
diff changeset
   490
proof (rule_tac tag = "tag_str_STAR L1" in tag_finite_imageD)
cb4403fabda7 added my changes again
urbanc
parents: 42
diff changeset
   491
  show "\<And>x y. tag_str_STAR L1 x = tag_str_STAR L1 y \<Longrightarrow> x \<approx>(L1\<star>) y"
cb4403fabda7 added my changes again
urbanc
parents: 42
diff changeset
   492
    by (rule tag_str_STAR_injI)
40
50d00d7dc413 tuned a bit more the last STAR-proof
wu
parents: 39
diff changeset
   493
next
43
cb4403fabda7 added my changes again
urbanc
parents: 42
diff changeset
   494
  have *: "finite (Pow (UNIV // \<approx>L1))" 
cb4403fabda7 added my changes again
urbanc
parents: 42
diff changeset
   495
    using finite1 by auto
cb4403fabda7 added my changes again
urbanc
parents: 42
diff changeset
   496
  show "finite (range (tag_str_STAR L1))"
cb4403fabda7 added my changes again
urbanc
parents: 42
diff changeset
   497
    unfolding tag_str_STAR_def
cb4403fabda7 added my changes again
urbanc
parents: 42
diff changeset
   498
    apply(rule finite_subset[OF _ *])
cb4403fabda7 added my changes again
urbanc
parents: 42
diff changeset
   499
    unfolding quotient_def
cb4403fabda7 added my changes again
urbanc
parents: 42
diff changeset
   500
    by auto
cb4403fabda7 added my changes again
urbanc
parents: 42
diff changeset
   501
qed
cb4403fabda7 added my changes again
urbanc
parents: 42
diff changeset
   502
cb4403fabda7 added my changes again
urbanc
parents: 42
diff changeset
   503
cb4403fabda7 added my changes again
urbanc
parents: 42
diff changeset
   504
subsection {* The main lemma *}
cb4403fabda7 added my changes again
urbanc
parents: 42
diff changeset
   505
cb4403fabda7 added my changes again
urbanc
parents: 42
diff changeset
   506
lemma rexp_imp_finite:
cb4403fabda7 added my changes again
urbanc
parents: 42
diff changeset
   507
  fixes r::"rexp"
cb4403fabda7 added my changes again
urbanc
parents: 42
diff changeset
   508
  shows "finite (UNIV // \<approx>(L r))"
cb4403fabda7 added my changes again
urbanc
parents: 42
diff changeset
   509
by (induct r) (auto)
cb4403fabda7 added my changes again
urbanc
parents: 42
diff changeset
   510
31
b6815473ee2e 1. Myhill.thy is proved to correct some typos. 2. Some sections are added to the first direction. 3. The small theory of list difference is now separated into Prefix_subtract.thy and the ROOT.ML
zhang
parents: 30
diff changeset
   511
b6815473ee2e 1. Myhill.thy is proved to correct some typos. 2. Some sections are added to the first direction. 3. The small theory of list difference is now separated into Prefix_subtract.thy and the ROOT.ML
zhang
parents: 30
diff changeset
   512
end
b6815473ee2e 1. Myhill.thy is proved to correct some typos. 2. Some sections are added to the first direction. 3. The small theory of list difference is now separated into Prefix_subtract.thy and the ROOT.ML
zhang
parents: 30
diff changeset
   513