Myhill_2.thy
author urbanc
Wed, 03 Aug 2011 00:52:41 +0000
changeset 183 c4893e84c88e
parent 182 560712a29a36
child 184 2455db3b06ac
permissions -rw-r--r--
cleaned up the proofs in Myhill_2
Ignore whitespace changes - Everywhere: Within whitespace: At end of lines:
63
649ff0b8766d Myhill_2.thy added
zhang
parents:
diff changeset
     1
theory Myhill_2
182
560712a29a36 a version of the proof which dispenses with the notion of string-subtraction
urbanc
parents: 181
diff changeset
     2
  imports Myhill_1 
560712a29a36 a version of the proof which dispenses with the notion of string-subtraction
urbanc
parents: 181
diff changeset
     3
  "~~/src/HOL/Library/List_Prefix"
63
649ff0b8766d Myhill_2.thy added
zhang
parents:
diff changeset
     4
begin
649ff0b8766d Myhill_2.thy added
zhang
parents:
diff changeset
     5
166
7743d2ad71d1 updated theories and itp-paper
urbanc
parents: 162
diff changeset
     6
section {* Direction @{text "regular language \<Rightarrow> finite partition"} *}
63
649ff0b8766d Myhill_2.thy added
zhang
parents:
diff changeset
     7
649ff0b8766d Myhill_2.thy added
zhang
parents:
diff changeset
     8
definition 
181
97090fc7aa9f some experiments with the proofs in Myhill_2
urbanc
parents: 180
diff changeset
     9
   tag_eq :: "('a list \<Rightarrow> 'b) \<Rightarrow> ('a list \<times> 'a list) set" ("=_=")
63
649ff0b8766d Myhill_2.thy added
zhang
parents:
diff changeset
    10
where
166
7743d2ad71d1 updated theories and itp-paper
urbanc
parents: 162
diff changeset
    11
   "=tag= \<equiv> {(x, y). tag x = tag y}"
117
22ba25b808c8 updated second direction
urbanc
parents: 113
diff changeset
    12
181
97090fc7aa9f some experiments with the proofs in Myhill_2
urbanc
parents: 180
diff changeset
    13
abbreviation
97090fc7aa9f some experiments with the proofs in Myhill_2
urbanc
parents: 180
diff changeset
    14
   tag_eq_applied :: "'a list \<Rightarrow> ('a list \<Rightarrow> 'b) \<Rightarrow> 'a list \<Rightarrow> bool" ("_ =_= _")
97090fc7aa9f some experiments with the proofs in Myhill_2
urbanc
parents: 180
diff changeset
    15
where
97090fc7aa9f some experiments with the proofs in Myhill_2
urbanc
parents: 180
diff changeset
    16
   "x =tag= y \<equiv> (x, y) \<in> =tag="
97090fc7aa9f some experiments with the proofs in Myhill_2
urbanc
parents: 180
diff changeset
    17
183
c4893e84c88e cleaned up the proofs in Myhill_2
urbanc
parents: 182
diff changeset
    18
lemma [simp]:
181
97090fc7aa9f some experiments with the proofs in Myhill_2
urbanc
parents: 180
diff changeset
    19
  shows "(\<approx>A) `` {x} = (\<approx>A) `` {y} \<longleftrightarrow> x \<approx>A y"
183
c4893e84c88e cleaned up the proofs in Myhill_2
urbanc
parents: 182
diff changeset
    20
unfolding str_eq_def by auto
181
97090fc7aa9f some experiments with the proofs in Myhill_2
urbanc
parents: 180
diff changeset
    21
183
c4893e84c88e cleaned up the proofs in Myhill_2
urbanc
parents: 182
diff changeset
    22
lemma refined_intro:
181
97090fc7aa9f some experiments with the proofs in Myhill_2
urbanc
parents: 180
diff changeset
    23
  assumes "\<And>x y z. \<lbrakk>x =tag= y; x @ z \<in> A\<rbrakk> \<Longrightarrow> y @ z \<in> A"
97090fc7aa9f some experiments with the proofs in Myhill_2
urbanc
parents: 180
diff changeset
    24
  shows "=tag= \<subseteq> \<approx>A"
183
c4893e84c88e cleaned up the proofs in Myhill_2
urbanc
parents: 182
diff changeset
    25
using assms unfolding str_eq_def tag_eq_def
181
97090fc7aa9f some experiments with the proofs in Myhill_2
urbanc
parents: 180
diff changeset
    26
apply(clarify, simp (no_asm_use))
97090fc7aa9f some experiments with the proofs in Myhill_2
urbanc
parents: 180
diff changeset
    27
by metis
97090fc7aa9f some experiments with the proofs in Myhill_2
urbanc
parents: 180
diff changeset
    28
117
22ba25b808c8 updated second direction
urbanc
parents: 113
diff changeset
    29
lemma finite_eq_tag_rel:
63
649ff0b8766d Myhill_2.thy added
zhang
parents:
diff changeset
    30
  assumes rng_fnt: "finite (range tag)"
109
79b37ef9505f minor updated
urbanc
parents: 99
diff changeset
    31
  shows "finite (UNIV // =tag=)"
63
649ff0b8766d Myhill_2.thy added
zhang
parents:
diff changeset
    32
proof -
119
ece3f197b92b first two proofs in 2 direction
urbanc
parents: 118
diff changeset
    33
  let "?f" =  "\<lambda>X. tag ` X" and ?A = "(UNIV // =tag=)"
118
c3fa11ee776e first proof
urbanc
parents: 117
diff changeset
    34
  have "finite (?f ` ?A)" 
c3fa11ee776e first proof
urbanc
parents: 117
diff changeset
    35
  proof -
119
ece3f197b92b first two proofs in 2 direction
urbanc
parents: 118
diff changeset
    36
    have "range ?f \<subseteq> (Pow (range tag))" unfolding Pow_def by auto
ece3f197b92b first two proofs in 2 direction
urbanc
parents: 118
diff changeset
    37
    moreover 
ece3f197b92b first two proofs in 2 direction
urbanc
parents: 118
diff changeset
    38
    have "finite (Pow (range tag))" using rng_fnt by simp
ece3f197b92b first two proofs in 2 direction
urbanc
parents: 118
diff changeset
    39
    ultimately 
ece3f197b92b first two proofs in 2 direction
urbanc
parents: 118
diff changeset
    40
    have "finite (range ?f)" unfolding image_def by (blast intro: finite_subset)
ece3f197b92b first two proofs in 2 direction
urbanc
parents: 118
diff changeset
    41
    moreover
ece3f197b92b first two proofs in 2 direction
urbanc
parents: 118
diff changeset
    42
    have "?f ` ?A \<subseteq> range ?f" by auto
ece3f197b92b first two proofs in 2 direction
urbanc
parents: 118
diff changeset
    43
    ultimately show "finite (?f ` ?A)" by (rule rev_finite_subset) 
63
649ff0b8766d Myhill_2.thy added
zhang
parents:
diff changeset
    44
  qed
118
c3fa11ee776e first proof
urbanc
parents: 117
diff changeset
    45
  moreover
119
ece3f197b92b first two proofs in 2 direction
urbanc
parents: 118
diff changeset
    46
  have "inj_on ?f ?A"
118
c3fa11ee776e first proof
urbanc
parents: 117
diff changeset
    47
  proof -
c3fa11ee776e first proof
urbanc
parents: 117
diff changeset
    48
    { fix X Y
c3fa11ee776e first proof
urbanc
parents: 117
diff changeset
    49
      assume X_in: "X \<in> ?A"
c3fa11ee776e first proof
urbanc
parents: 117
diff changeset
    50
        and  Y_in: "Y \<in> ?A"
c3fa11ee776e first proof
urbanc
parents: 117
diff changeset
    51
        and  tag_eq: "?f X = ?f Y"
162
e93760534354 added directory for journal version; took uptodate version of the theory files
urbanc
parents: 160
diff changeset
    52
      then obtain x y 
119
ece3f197b92b first two proofs in 2 direction
urbanc
parents: 118
diff changeset
    53
        where "x \<in> X" "y \<in> Y" "tag x = tag y"
181
97090fc7aa9f some experiments with the proofs in Myhill_2
urbanc
parents: 180
diff changeset
    54
        unfolding quotient_def Image_def image_def tag_eq_def
119
ece3f197b92b first two proofs in 2 direction
urbanc
parents: 118
diff changeset
    55
        by (simp) (blast)
ece3f197b92b first two proofs in 2 direction
urbanc
parents: 118
diff changeset
    56
      with X_in Y_in 
118
c3fa11ee776e first proof
urbanc
parents: 117
diff changeset
    57
      have "X = Y"
181
97090fc7aa9f some experiments with the proofs in Myhill_2
urbanc
parents: 180
diff changeset
    58
	unfolding quotient_def tag_eq_def by auto
162
e93760534354 added directory for journal version; took uptodate version of the theory files
urbanc
parents: 160
diff changeset
    59
    } 
e93760534354 added directory for journal version; took uptodate version of the theory files
urbanc
parents: 160
diff changeset
    60
    then show "inj_on ?f ?A" unfolding inj_on_def by auto
118
c3fa11ee776e first proof
urbanc
parents: 117
diff changeset
    61
  qed
162
e93760534354 added directory for journal version; took uptodate version of the theory files
urbanc
parents: 160
diff changeset
    62
  ultimately show "finite (UNIV // =tag=)" by (rule finite_imageD)
63
649ff0b8766d Myhill_2.thy added
zhang
parents:
diff changeset
    63
qed
649ff0b8766d Myhill_2.thy added
zhang
parents:
diff changeset
    64
649ff0b8766d Myhill_2.thy added
zhang
parents:
diff changeset
    65
lemma refined_partition_finite:
118
c3fa11ee776e first proof
urbanc
parents: 117
diff changeset
    66
  assumes fnt: "finite (UNIV // R1)"
63
649ff0b8766d Myhill_2.thy added
zhang
parents:
diff changeset
    67
  and refined: "R1 \<subseteq> R2"
118
c3fa11ee776e first proof
urbanc
parents: 117
diff changeset
    68
  and eq1: "equiv UNIV R1" and eq2: "equiv UNIV R2"
c3fa11ee776e first proof
urbanc
parents: 117
diff changeset
    69
  shows "finite (UNIV // R2)"
63
649ff0b8766d Myhill_2.thy added
zhang
parents:
diff changeset
    70
proof -
118
c3fa11ee776e first proof
urbanc
parents: 117
diff changeset
    71
  let ?f = "\<lambda>X. {R1 `` {x} | x. x \<in> X}" 
c3fa11ee776e first proof
urbanc
parents: 117
diff changeset
    72
    and ?A = "UNIV // R2" and ?B = "UNIV // R1"
c3fa11ee776e first proof
urbanc
parents: 117
diff changeset
    73
  have "?f ` ?A \<subseteq> Pow ?B"
c3fa11ee776e first proof
urbanc
parents: 117
diff changeset
    74
    unfolding image_def Pow_def quotient_def by auto
c3fa11ee776e first proof
urbanc
parents: 117
diff changeset
    75
  moreover
c3fa11ee776e first proof
urbanc
parents: 117
diff changeset
    76
  have "finite (Pow ?B)" using fnt by simp
c3fa11ee776e first proof
urbanc
parents: 117
diff changeset
    77
  ultimately  
c3fa11ee776e first proof
urbanc
parents: 117
diff changeset
    78
  have "finite (?f ` ?A)" by (rule finite_subset)
c3fa11ee776e first proof
urbanc
parents: 117
diff changeset
    79
  moreover
c3fa11ee776e first proof
urbanc
parents: 117
diff changeset
    80
  have "inj_on ?f ?A"
c3fa11ee776e first proof
urbanc
parents: 117
diff changeset
    81
  proof -
c3fa11ee776e first proof
urbanc
parents: 117
diff changeset
    82
    { fix X Y
c3fa11ee776e first proof
urbanc
parents: 117
diff changeset
    83
      assume X_in: "X \<in> ?A" and Y_in: "Y \<in> ?A" and eq_f: "?f X = ?f Y"
c3fa11ee776e first proof
urbanc
parents: 117
diff changeset
    84
      from quotientE [OF X_in]
c3fa11ee776e first proof
urbanc
parents: 117
diff changeset
    85
      obtain x where "X = R2 `` {x}" by blast
c3fa11ee776e first proof
urbanc
parents: 117
diff changeset
    86
      with equiv_class_self[OF eq2] have x_in: "x \<in> X" by simp
c3fa11ee776e first proof
urbanc
parents: 117
diff changeset
    87
      then have "R1 ``{x} \<in> ?f X" by auto
c3fa11ee776e first proof
urbanc
parents: 117
diff changeset
    88
      with eq_f have "R1 `` {x} \<in> ?f Y" by simp
c3fa11ee776e first proof
urbanc
parents: 117
diff changeset
    89
      then obtain y 
c3fa11ee776e first proof
urbanc
parents: 117
diff changeset
    90
        where y_in: "y \<in> Y" and eq_r1_xy: "R1 `` {x} = R1 `` {y}" by auto
c3fa11ee776e first proof
urbanc
parents: 117
diff changeset
    91
      with eq_equiv_class[OF _ eq1] 
c3fa11ee776e first proof
urbanc
parents: 117
diff changeset
    92
      have "(x, y) \<in> R1" by blast
c3fa11ee776e first proof
urbanc
parents: 117
diff changeset
    93
      with refined have "(x, y) \<in> R2" by auto
c3fa11ee776e first proof
urbanc
parents: 117
diff changeset
    94
      with quotient_eqI [OF eq2 X_in Y_in x_in y_in]
c3fa11ee776e first proof
urbanc
parents: 117
diff changeset
    95
      have "X = Y" .
c3fa11ee776e first proof
urbanc
parents: 117
diff changeset
    96
    } 
c3fa11ee776e first proof
urbanc
parents: 117
diff changeset
    97
    then show "inj_on ?f ?A" unfolding inj_on_def by blast 
63
649ff0b8766d Myhill_2.thy added
zhang
parents:
diff changeset
    98
  qed
118
c3fa11ee776e first proof
urbanc
parents: 117
diff changeset
    99
  ultimately show "finite (UNIV // R2)" by (rule finite_imageD)
63
649ff0b8766d Myhill_2.thy added
zhang
parents:
diff changeset
   100
qed
649ff0b8766d Myhill_2.thy added
zhang
parents:
diff changeset
   101
649ff0b8766d Myhill_2.thy added
zhang
parents:
diff changeset
   102
lemma tag_finite_imageD:
649ff0b8766d Myhill_2.thy added
zhang
parents:
diff changeset
   103
  assumes rng_fnt: "finite (range tag)" 
183
c4893e84c88e cleaned up the proofs in Myhill_2
urbanc
parents: 182
diff changeset
   104
  and same_tag_eqvt: "=tag=  \<subseteq> \<approx>A"
119
ece3f197b92b first two proofs in 2 direction
urbanc
parents: 118
diff changeset
   105
  shows "finite (UNIV // \<approx>A)"
ece3f197b92b first two proofs in 2 direction
urbanc
parents: 118
diff changeset
   106
proof (rule_tac refined_partition_finite [of "=tag="])
ece3f197b92b first two proofs in 2 direction
urbanc
parents: 118
diff changeset
   107
  show "finite (UNIV // =tag=)" by (rule finite_eq_tag_rel[OF rng_fnt])
ece3f197b92b first two proofs in 2 direction
urbanc
parents: 118
diff changeset
   108
next
ece3f197b92b first two proofs in 2 direction
urbanc
parents: 118
diff changeset
   109
  from same_tag_eqvt
183
c4893e84c88e cleaned up the proofs in Myhill_2
urbanc
parents: 182
diff changeset
   110
  show "=tag= \<subseteq> \<approx>A" .
119
ece3f197b92b first two proofs in 2 direction
urbanc
parents: 118
diff changeset
   111
next
ece3f197b92b first two proofs in 2 direction
urbanc
parents: 118
diff changeset
   112
  show "equiv UNIV =tag="
181
97090fc7aa9f some experiments with the proofs in Myhill_2
urbanc
parents: 180
diff changeset
   113
    unfolding equiv_def tag_eq_def refl_on_def sym_def trans_def
119
ece3f197b92b first two proofs in 2 direction
urbanc
parents: 118
diff changeset
   114
    by auto
ece3f197b92b first two proofs in 2 direction
urbanc
parents: 118
diff changeset
   115
next
ece3f197b92b first two proofs in 2 direction
urbanc
parents: 118
diff changeset
   116
  show "equiv UNIV (\<approx>A)" 
181
97090fc7aa9f some experiments with the proofs in Myhill_2
urbanc
parents: 180
diff changeset
   117
    unfolding equiv_def str_eq_def sym_def refl_on_def trans_def
119
ece3f197b92b first two proofs in 2 direction
urbanc
parents: 118
diff changeset
   118
    by blast
63
649ff0b8766d Myhill_2.thy added
zhang
parents:
diff changeset
   119
qed
649ff0b8766d Myhill_2.thy added
zhang
parents:
diff changeset
   120
649ff0b8766d Myhill_2.thy added
zhang
parents:
diff changeset
   121
162
e93760534354 added directory for journal version; took uptodate version of the theory files
urbanc
parents: 160
diff changeset
   122
subsection {* The proof *}
63
649ff0b8766d Myhill_2.thy added
zhang
parents:
diff changeset
   123
170
b1258b7d2789 made the theories compatible with the existing developments in the AFP; old theories are in the directory Attic
urbanc
parents: 166
diff changeset
   124
subsubsection {* The base case for @{const "Zero"} *}
63
649ff0b8766d Myhill_2.thy added
zhang
parents:
diff changeset
   125
170
b1258b7d2789 made the theories compatible with the existing developments in the AFP; old theories are in the directory Attic
urbanc
parents: 166
diff changeset
   126
lemma quot_zero_eq:
162
e93760534354 added directory for journal version; took uptodate version of the theory files
urbanc
parents: 160
diff changeset
   127
  shows "UNIV // \<approx>{} = {UNIV}"
181
97090fc7aa9f some experiments with the proofs in Myhill_2
urbanc
parents: 180
diff changeset
   128
unfolding quotient_def Image_def str_eq_def by auto
63
649ff0b8766d Myhill_2.thy added
zhang
parents:
diff changeset
   129
170
b1258b7d2789 made the theories compatible with the existing developments in the AFP; old theories are in the directory Attic
urbanc
parents: 166
diff changeset
   130
lemma quot_zero_finiteI [intro]:
162
e93760534354 added directory for journal version; took uptodate version of the theory files
urbanc
parents: 160
diff changeset
   131
  shows "finite (UNIV // \<approx>{})"
170
b1258b7d2789 made the theories compatible with the existing developments in the AFP; old theories are in the directory Attic
urbanc
parents: 166
diff changeset
   132
unfolding quot_zero_eq by simp
63
649ff0b8766d Myhill_2.thy added
zhang
parents:
diff changeset
   133
649ff0b8766d Myhill_2.thy added
zhang
parents:
diff changeset
   134
170
b1258b7d2789 made the theories compatible with the existing developments in the AFP; old theories are in the directory Attic
urbanc
parents: 166
diff changeset
   135
subsubsection {* The base case for @{const "One"} *}
63
649ff0b8766d Myhill_2.thy added
zhang
parents:
diff changeset
   136
170
b1258b7d2789 made the theories compatible with the existing developments in the AFP; old theories are in the directory Attic
urbanc
parents: 166
diff changeset
   137
lemma quot_one_subset:
162
e93760534354 added directory for journal version; took uptodate version of the theory files
urbanc
parents: 160
diff changeset
   138
  shows "UNIV // \<approx>{[]} \<subseteq> {{[]}, UNIV - {[]}}"
63
649ff0b8766d Myhill_2.thy added
zhang
parents:
diff changeset
   139
proof
649ff0b8766d Myhill_2.thy added
zhang
parents:
diff changeset
   140
  fix x
649ff0b8766d Myhill_2.thy added
zhang
parents:
diff changeset
   141
  assume "x \<in> UNIV // \<approx>{[]}"
649ff0b8766d Myhill_2.thy added
zhang
parents:
diff changeset
   142
  then obtain y where h: "x = {z. (y, z) \<in> \<approx>{[]}}" 
649ff0b8766d Myhill_2.thy added
zhang
parents:
diff changeset
   143
    unfolding quotient_def Image_def by blast
649ff0b8766d Myhill_2.thy added
zhang
parents:
diff changeset
   144
  show "x \<in> {{[]}, UNIV - {[]}}"
649ff0b8766d Myhill_2.thy added
zhang
parents:
diff changeset
   145
  proof (cases "y = []")
649ff0b8766d Myhill_2.thy added
zhang
parents:
diff changeset
   146
    case True with h
181
97090fc7aa9f some experiments with the proofs in Myhill_2
urbanc
parents: 180
diff changeset
   147
    have "x = {[]}" by (auto simp: str_eq_def)
63
649ff0b8766d Myhill_2.thy added
zhang
parents:
diff changeset
   148
    thus ?thesis by simp
649ff0b8766d Myhill_2.thy added
zhang
parents:
diff changeset
   149
  next
649ff0b8766d Myhill_2.thy added
zhang
parents:
diff changeset
   150
    case False with h
181
97090fc7aa9f some experiments with the proofs in Myhill_2
urbanc
parents: 180
diff changeset
   151
    have "x = UNIV - {[]}" by (auto simp: str_eq_def)
63
649ff0b8766d Myhill_2.thy added
zhang
parents:
diff changeset
   152
    thus ?thesis by simp
649ff0b8766d Myhill_2.thy added
zhang
parents:
diff changeset
   153
  qed
649ff0b8766d Myhill_2.thy added
zhang
parents:
diff changeset
   154
qed
649ff0b8766d Myhill_2.thy added
zhang
parents:
diff changeset
   155
170
b1258b7d2789 made the theories compatible with the existing developments in the AFP; old theories are in the directory Attic
urbanc
parents: 166
diff changeset
   156
lemma quot_one_finiteI [intro]:
162
e93760534354 added directory for journal version; took uptodate version of the theory files
urbanc
parents: 160
diff changeset
   157
  shows "finite (UNIV // \<approx>{[]})"
170
b1258b7d2789 made the theories compatible with the existing developments in the AFP; old theories are in the directory Attic
urbanc
parents: 166
diff changeset
   158
by (rule finite_subset[OF quot_one_subset]) (simp)
63
649ff0b8766d Myhill_2.thy added
zhang
parents:
diff changeset
   159
649ff0b8766d Myhill_2.thy added
zhang
parents:
diff changeset
   160
170
b1258b7d2789 made the theories compatible with the existing developments in the AFP; old theories are in the directory Attic
urbanc
parents: 166
diff changeset
   161
subsubsection {* The base case for @{const "Atom"} *}
63
649ff0b8766d Myhill_2.thy added
zhang
parents:
diff changeset
   162
170
b1258b7d2789 made the theories compatible with the existing developments in the AFP; old theories are in the directory Attic
urbanc
parents: 166
diff changeset
   163
lemma quot_atom_subset:
63
649ff0b8766d Myhill_2.thy added
zhang
parents:
diff changeset
   164
  "UNIV // (\<approx>{[c]}) \<subseteq> {{[]},{[c]}, UNIV - {[], [c]}}"
649ff0b8766d Myhill_2.thy added
zhang
parents:
diff changeset
   165
proof 
649ff0b8766d Myhill_2.thy added
zhang
parents:
diff changeset
   166
  fix x 
649ff0b8766d Myhill_2.thy added
zhang
parents:
diff changeset
   167
  assume "x \<in> UNIV // \<approx>{[c]}"
649ff0b8766d Myhill_2.thy added
zhang
parents:
diff changeset
   168
  then obtain y where h: "x = {z. (y, z) \<in> \<approx>{[c]}}" 
649ff0b8766d Myhill_2.thy added
zhang
parents:
diff changeset
   169
    unfolding quotient_def Image_def by blast
649ff0b8766d Myhill_2.thy added
zhang
parents:
diff changeset
   170
  show "x \<in> {{[]},{[c]}, UNIV - {[], [c]}}"
649ff0b8766d Myhill_2.thy added
zhang
parents:
diff changeset
   171
  proof -
649ff0b8766d Myhill_2.thy added
zhang
parents:
diff changeset
   172
    { assume "y = []" hence "x = {[]}" using h 
181
97090fc7aa9f some experiments with the proofs in Myhill_2
urbanc
parents: 180
diff changeset
   173
        by (auto simp: str_eq_def) } 
162
e93760534354 added directory for journal version; took uptodate version of the theory files
urbanc
parents: 160
diff changeset
   174
    moreover 
e93760534354 added directory for journal version; took uptodate version of the theory files
urbanc
parents: 160
diff changeset
   175
    { assume "y = [c]" hence "x = {[c]}" using h 
181
97090fc7aa9f some experiments with the proofs in Myhill_2
urbanc
parents: 180
diff changeset
   176
        by (auto dest!: spec[where x = "[]"] simp: str_eq_def) } 
162
e93760534354 added directory for journal version; took uptodate version of the theory files
urbanc
parents: 160
diff changeset
   177
    moreover 
e93760534354 added directory for journal version; took uptodate version of the theory files
urbanc
parents: 160
diff changeset
   178
    { assume "y \<noteq> []" and "y \<noteq> [c]"
63
649ff0b8766d Myhill_2.thy added
zhang
parents:
diff changeset
   179
      hence "\<forall> z. (y @ z) \<noteq> [c]" by (case_tac y, auto)
649ff0b8766d Myhill_2.thy added
zhang
parents:
diff changeset
   180
      moreover have "\<And> p. (p \<noteq> [] \<and> p \<noteq> [c]) = (\<forall> q. p @ q \<noteq> [c])" 
649ff0b8766d Myhill_2.thy added
zhang
parents:
diff changeset
   181
        by (case_tac p, auto)
649ff0b8766d Myhill_2.thy added
zhang
parents:
diff changeset
   182
      ultimately have "x = UNIV - {[],[c]}" using h
181
97090fc7aa9f some experiments with the proofs in Myhill_2
urbanc
parents: 180
diff changeset
   183
        by (auto simp add: str_eq_def)
162
e93760534354 added directory for journal version; took uptodate version of the theory files
urbanc
parents: 160
diff changeset
   184
    } 
e93760534354 added directory for journal version; took uptodate version of the theory files
urbanc
parents: 160
diff changeset
   185
    ultimately show ?thesis by blast
63
649ff0b8766d Myhill_2.thy added
zhang
parents:
diff changeset
   186
  qed
649ff0b8766d Myhill_2.thy added
zhang
parents:
diff changeset
   187
qed
649ff0b8766d Myhill_2.thy added
zhang
parents:
diff changeset
   188
170
b1258b7d2789 made the theories compatible with the existing developments in the AFP; old theories are in the directory Attic
urbanc
parents: 166
diff changeset
   189
lemma quot_atom_finiteI [intro]:
162
e93760534354 added directory for journal version; took uptodate version of the theory files
urbanc
parents: 160
diff changeset
   190
  shows "finite (UNIV // \<approx>{[c]})"
170
b1258b7d2789 made the theories compatible with the existing developments in the AFP; old theories are in the directory Attic
urbanc
parents: 166
diff changeset
   191
by (rule finite_subset[OF quot_atom_subset]) (simp)
63
649ff0b8766d Myhill_2.thy added
zhang
parents:
diff changeset
   192
649ff0b8766d Myhill_2.thy added
zhang
parents:
diff changeset
   193
170
b1258b7d2789 made the theories compatible with the existing developments in the AFP; old theories are in the directory Attic
urbanc
parents: 166
diff changeset
   194
subsubsection {* The inductive case for @{const Plus} *}
63
649ff0b8766d Myhill_2.thy added
zhang
parents:
diff changeset
   195
649ff0b8766d Myhill_2.thy added
zhang
parents:
diff changeset
   196
definition 
181
97090fc7aa9f some experiments with the proofs in Myhill_2
urbanc
parents: 180
diff changeset
   197
  tag_Plus :: "'a lang \<Rightarrow> 'a lang \<Rightarrow> 'a list \<Rightarrow> ('a lang \<times> 'a lang)"
63
649ff0b8766d Myhill_2.thy added
zhang
parents:
diff changeset
   198
where
183
c4893e84c88e cleaned up the proofs in Myhill_2
urbanc
parents: 182
diff changeset
   199
  "tag_Plus A B \<equiv> \<lambda>x. (\<approx>A `` {x}, \<approx>B `` {x})"
63
649ff0b8766d Myhill_2.thy added
zhang
parents:
diff changeset
   200
181
97090fc7aa9f some experiments with the proofs in Myhill_2
urbanc
parents: 180
diff changeset
   201
lemma quot_plus_finiteI [intro]:
119
ece3f197b92b first two proofs in 2 direction
urbanc
parents: 118
diff changeset
   202
  assumes finite1: "finite (UNIV // \<approx>A)"
ece3f197b92b first two proofs in 2 direction
urbanc
parents: 118
diff changeset
   203
  and     finite2: "finite (UNIV // \<approx>B)"
ece3f197b92b first two proofs in 2 direction
urbanc
parents: 118
diff changeset
   204
  shows "finite (UNIV // \<approx>(A \<union> B))"
181
97090fc7aa9f some experiments with the proofs in Myhill_2
urbanc
parents: 180
diff changeset
   205
proof (rule_tac tag = "tag_Plus A B" in tag_finite_imageD)
119
ece3f197b92b first two proofs in 2 direction
urbanc
parents: 118
diff changeset
   206
  have "finite ((UNIV // \<approx>A) \<times> (UNIV // \<approx>B))" 
ece3f197b92b first two proofs in 2 direction
urbanc
parents: 118
diff changeset
   207
    using finite1 finite2 by auto
181
97090fc7aa9f some experiments with the proofs in Myhill_2
urbanc
parents: 180
diff changeset
   208
  then show "finite (range (tag_Plus A B))"
97090fc7aa9f some experiments with the proofs in Myhill_2
urbanc
parents: 180
diff changeset
   209
    unfolding tag_Plus_def quotient_def
119
ece3f197b92b first two proofs in 2 direction
urbanc
parents: 118
diff changeset
   210
    by (rule rev_finite_subset) (auto)
ece3f197b92b first two proofs in 2 direction
urbanc
parents: 118
diff changeset
   211
next
183
c4893e84c88e cleaned up the proofs in Myhill_2
urbanc
parents: 182
diff changeset
   212
  show "=tag_Plus A B= \<subseteq> \<approx>(A \<union> B)"
c4893e84c88e cleaned up the proofs in Myhill_2
urbanc
parents: 182
diff changeset
   213
    unfolding tag_eq_def tag_Plus_def str_eq_def by auto
63
649ff0b8766d Myhill_2.thy added
zhang
parents:
diff changeset
   214
qed
649ff0b8766d Myhill_2.thy added
zhang
parents:
diff changeset
   215
162
e93760534354 added directory for journal version; took uptodate version of the theory files
urbanc
parents: 160
diff changeset
   216
183
c4893e84c88e cleaned up the proofs in Myhill_2
urbanc
parents: 182
diff changeset
   217
subsubsection {* The inductive case for @{text "Times"} *}
63
649ff0b8766d Myhill_2.thy added
zhang
parents:
diff changeset
   218
181
97090fc7aa9f some experiments with the proofs in Myhill_2
urbanc
parents: 180
diff changeset
   219
definition
97090fc7aa9f some experiments with the proofs in Myhill_2
urbanc
parents: 180
diff changeset
   220
  "Partitions s \<equiv> {(u, v). u @ v = s}"
97090fc7aa9f some experiments with the proofs in Myhill_2
urbanc
parents: 180
diff changeset
   221
182
560712a29a36 a version of the proof which dispenses with the notion of string-subtraction
urbanc
parents: 181
diff changeset
   222
lemma conc_partitions_elim:
181
97090fc7aa9f some experiments with the proofs in Myhill_2
urbanc
parents: 180
diff changeset
   223
  assumes "x \<in> A \<cdot> B"
97090fc7aa9f some experiments with the proofs in Myhill_2
urbanc
parents: 180
diff changeset
   224
  shows "\<exists>(u, v) \<in> Partitions x. u \<in> A \<and> v \<in> B"
183
c4893e84c88e cleaned up the proofs in Myhill_2
urbanc
parents: 182
diff changeset
   225
using assms unfolding conc_def Partitions_def
181
97090fc7aa9f some experiments with the proofs in Myhill_2
urbanc
parents: 180
diff changeset
   226
by auto
97090fc7aa9f some experiments with the proofs in Myhill_2
urbanc
parents: 180
diff changeset
   227
182
560712a29a36 a version of the proof which dispenses with the notion of string-subtraction
urbanc
parents: 181
diff changeset
   228
lemma conc_partitions_intro:
181
97090fc7aa9f some experiments with the proofs in Myhill_2
urbanc
parents: 180
diff changeset
   229
  assumes "(u, v) \<in> Partitions x \<and> u \<in> A \<and>  v \<in> B"
97090fc7aa9f some experiments with the proofs in Myhill_2
urbanc
parents: 180
diff changeset
   230
  shows "x \<in> A \<cdot> B"
183
c4893e84c88e cleaned up the proofs in Myhill_2
urbanc
parents: 182
diff changeset
   231
using assms unfolding conc_def Partitions_def
181
97090fc7aa9f some experiments with the proofs in Myhill_2
urbanc
parents: 180
diff changeset
   232
by auto
97090fc7aa9f some experiments with the proofs in Myhill_2
urbanc
parents: 180
diff changeset
   233
182
560712a29a36 a version of the proof which dispenses with the notion of string-subtraction
urbanc
parents: 181
diff changeset
   234
lemma equiv_class_member:
560712a29a36 a version of the proof which dispenses with the notion of string-subtraction
urbanc
parents: 181
diff changeset
   235
  assumes "x \<in> A"
560712a29a36 a version of the proof which dispenses with the notion of string-subtraction
urbanc
parents: 181
diff changeset
   236
  and "\<approx>A `` {x} = \<approx>A `` {y}" 
560712a29a36 a version of the proof which dispenses with the notion of string-subtraction
urbanc
parents: 181
diff changeset
   237
  shows "y \<in> A"
560712a29a36 a version of the proof which dispenses with the notion of string-subtraction
urbanc
parents: 181
diff changeset
   238
using assms
183
c4893e84c88e cleaned up the proofs in Myhill_2
urbanc
parents: 182
diff changeset
   239
apply(simp)
c4893e84c88e cleaned up the proofs in Myhill_2
urbanc
parents: 182
diff changeset
   240
apply(simp add: str_eq_def)
182
560712a29a36 a version of the proof which dispenses with the notion of string-subtraction
urbanc
parents: 181
diff changeset
   241
apply(metis append_Nil2)
181
97090fc7aa9f some experiments with the proofs in Myhill_2
urbanc
parents: 180
diff changeset
   242
done
97090fc7aa9f some experiments with the proofs in Myhill_2
urbanc
parents: 180
diff changeset
   243
182
560712a29a36 a version of the proof which dispenses with the notion of string-subtraction
urbanc
parents: 181
diff changeset
   244
560712a29a36 a version of the proof which dispenses with the notion of string-subtraction
urbanc
parents: 181
diff changeset
   245
abbreviation
560712a29a36 a version of the proof which dispenses with the notion of string-subtraction
urbanc
parents: 181
diff changeset
   246
  tag_Times_1 :: "'a lang \<Rightarrow> 'a lang \<Rightarrow> 'a list \<Rightarrow> 'a lang"
181
97090fc7aa9f some experiments with the proofs in Myhill_2
urbanc
parents: 180
diff changeset
   247
where
182
560712a29a36 a version of the proof which dispenses with the notion of string-subtraction
urbanc
parents: 181
diff changeset
   248
  "tag_Times_1 A B \<equiv> \<lambda>x. \<approx>A `` {x}"
560712a29a36 a version of the proof which dispenses with the notion of string-subtraction
urbanc
parents: 181
diff changeset
   249
560712a29a36 a version of the proof which dispenses with the notion of string-subtraction
urbanc
parents: 181
diff changeset
   250
abbreviation
560712a29a36 a version of the proof which dispenses with the notion of string-subtraction
urbanc
parents: 181
diff changeset
   251
  tag_Times_2 :: "'a lang \<Rightarrow> 'a lang \<Rightarrow> 'a list \<Rightarrow> ('a lang \<times> 'a lang) set"
560712a29a36 a version of the proof which dispenses with the notion of string-subtraction
urbanc
parents: 181
diff changeset
   252
where
560712a29a36 a version of the proof which dispenses with the notion of string-subtraction
urbanc
parents: 181
diff changeset
   253
  "tag_Times_2 A B \<equiv> \<lambda>x. {(\<approx>A `` {u}, \<approx>B `` {v}) | u v. (u, v) \<in> Partitions x}"
181
97090fc7aa9f some experiments with the proofs in Myhill_2
urbanc
parents: 180
diff changeset
   254
97090fc7aa9f some experiments with the proofs in Myhill_2
urbanc
parents: 180
diff changeset
   255
definition 
182
560712a29a36 a version of the proof which dispenses with the notion of string-subtraction
urbanc
parents: 181
diff changeset
   256
  tag_Times :: "'a lang \<Rightarrow> 'a lang \<Rightarrow> 'a list \<Rightarrow> 'a lang \<times> ('a lang \<times> 'a lang) set"
181
97090fc7aa9f some experiments with the proofs in Myhill_2
urbanc
parents: 180
diff changeset
   257
where
182
560712a29a36 a version of the proof which dispenses with the notion of string-subtraction
urbanc
parents: 181
diff changeset
   258
  "tag_Times A B \<equiv> \<lambda>x. (tag_Times_1 A B x, tag_Times_2 A B x)"
181
97090fc7aa9f some experiments with the proofs in Myhill_2
urbanc
parents: 180
diff changeset
   259
182
560712a29a36 a version of the proof which dispenses with the notion of string-subtraction
urbanc
parents: 181
diff changeset
   260
lemma tag_Times_injI:
560712a29a36 a version of the proof which dispenses with the notion of string-subtraction
urbanc
parents: 181
diff changeset
   261
  assumes a: "tag_Times_1 A B x = tag_Times_1 A B y"
560712a29a36 a version of the proof which dispenses with the notion of string-subtraction
urbanc
parents: 181
diff changeset
   262
  and     b: "tag_Times_2 A B x = tag_Times_2 A B y"
181
97090fc7aa9f some experiments with the proofs in Myhill_2
urbanc
parents: 180
diff changeset
   263
  and     c: "x @ z \<in> A \<cdot> B"
97090fc7aa9f some experiments with the proofs in Myhill_2
urbanc
parents: 180
diff changeset
   264
  shows "y @ z \<in> A \<cdot> B"
97090fc7aa9f some experiments with the proofs in Myhill_2
urbanc
parents: 180
diff changeset
   265
proof -
97090fc7aa9f some experiments with the proofs in Myhill_2
urbanc
parents: 180
diff changeset
   266
  from c obtain u v where 
97090fc7aa9f some experiments with the proofs in Myhill_2
urbanc
parents: 180
diff changeset
   267
    h1: "(u, v) \<in> Partitions (x @ z)" and
97090fc7aa9f some experiments with the proofs in Myhill_2
urbanc
parents: 180
diff changeset
   268
    h2: "u \<in> A" and
182
560712a29a36 a version of the proof which dispenses with the notion of string-subtraction
urbanc
parents: 181
diff changeset
   269
    h3: "v \<in> B" by (auto dest: conc_partitions_elim)
181
97090fc7aa9f some experiments with the proofs in Myhill_2
urbanc
parents: 180
diff changeset
   270
  from h1 have "x @ z = u @ v" unfolding Partitions_def by simp
97090fc7aa9f some experiments with the proofs in Myhill_2
urbanc
parents: 180
diff changeset
   271
  then obtain us 
97090fc7aa9f some experiments with the proofs in Myhill_2
urbanc
parents: 180
diff changeset
   272
    where "(x = u @ us \<and> us @ z = v) \<or> (x @ us = u \<and> z = us @ v)"
97090fc7aa9f some experiments with the proofs in Myhill_2
urbanc
parents: 180
diff changeset
   273
    by (auto simp add: append_eq_append_conv2)
97090fc7aa9f some experiments with the proofs in Myhill_2
urbanc
parents: 180
diff changeset
   274
  moreover
97090fc7aa9f some experiments with the proofs in Myhill_2
urbanc
parents: 180
diff changeset
   275
  { assume eq: "x = u @ us" "us @ z = v"
182
560712a29a36 a version of the proof which dispenses with the notion of string-subtraction
urbanc
parents: 181
diff changeset
   276
    have "(\<approx>A `` {u}, \<approx>B `` {us}) \<in> tag_Times_2 A B x"
183
c4893e84c88e cleaned up the proofs in Myhill_2
urbanc
parents: 182
diff changeset
   277
      unfolding Partitions_def using eq by (auto simp add: str_eq_def)
182
560712a29a36 a version of the proof which dispenses with the notion of string-subtraction
urbanc
parents: 181
diff changeset
   278
    then have "(\<approx>A `` {u}, \<approx>B `` {us}) \<in> tag_Times_2 A B y"
181
97090fc7aa9f some experiments with the proofs in Myhill_2
urbanc
parents: 180
diff changeset
   279
      using b by simp
97090fc7aa9f some experiments with the proofs in Myhill_2
urbanc
parents: 180
diff changeset
   280
    then obtain u' us' where
97090fc7aa9f some experiments with the proofs in Myhill_2
urbanc
parents: 180
diff changeset
   281
      q1: "\<approx>A `` {u} = \<approx>A `` {u'}" and
97090fc7aa9f some experiments with the proofs in Myhill_2
urbanc
parents: 180
diff changeset
   282
      q2: "\<approx>B `` {us} = \<approx>B `` {us'}" and
182
560712a29a36 a version of the proof which dispenses with the notion of string-subtraction
urbanc
parents: 181
diff changeset
   283
      q3: "(u', us') \<in> Partitions y" by auto
181
97090fc7aa9f some experiments with the proofs in Myhill_2
urbanc
parents: 180
diff changeset
   284
    from q1 h2 have "u' \<in> A" 
182
560712a29a36 a version of the proof which dispenses with the notion of string-subtraction
urbanc
parents: 181
diff changeset
   285
      using equiv_class_member by auto
181
97090fc7aa9f some experiments with the proofs in Myhill_2
urbanc
parents: 180
diff changeset
   286
    moreover from q2 h3 eq 
97090fc7aa9f some experiments with the proofs in Myhill_2
urbanc
parents: 180
diff changeset
   287
    have "us' @ z \<in> B"
97090fc7aa9f some experiments with the proofs in Myhill_2
urbanc
parents: 180
diff changeset
   288
      unfolding Image_def str_eq_def by auto
97090fc7aa9f some experiments with the proofs in Myhill_2
urbanc
parents: 180
diff changeset
   289
    ultimately have "y @ z \<in> A \<cdot> B" using q3 
97090fc7aa9f some experiments with the proofs in Myhill_2
urbanc
parents: 180
diff changeset
   290
      unfolding Partitions_def by auto
97090fc7aa9f some experiments with the proofs in Myhill_2
urbanc
parents: 180
diff changeset
   291
  }
97090fc7aa9f some experiments with the proofs in Myhill_2
urbanc
parents: 180
diff changeset
   292
  moreover
97090fc7aa9f some experiments with the proofs in Myhill_2
urbanc
parents: 180
diff changeset
   293
  { assume eq: "x @ us = u" "z = us @ v"
182
560712a29a36 a version of the proof which dispenses with the notion of string-subtraction
urbanc
parents: 181
diff changeset
   294
    have "(\<approx>A `` {x}) = tag_Times_1 A B x" by simp
560712a29a36 a version of the proof which dispenses with the notion of string-subtraction
urbanc
parents: 181
diff changeset
   295
    then have "(\<approx>A `` {x}) = tag_Times_1 A B y"
181
97090fc7aa9f some experiments with the proofs in Myhill_2
urbanc
parents: 180
diff changeset
   296
      using a by simp
182
560712a29a36 a version of the proof which dispenses with the notion of string-subtraction
urbanc
parents: 181
diff changeset
   297
    then have "\<approx>A `` {x} = \<approx>A `` {y}" by simp
181
97090fc7aa9f some experiments with the proofs in Myhill_2
urbanc
parents: 180
diff changeset
   298
    moreover 
97090fc7aa9f some experiments with the proofs in Myhill_2
urbanc
parents: 180
diff changeset
   299
    have "x @ us \<in> A" using h2 eq by simp
97090fc7aa9f some experiments with the proofs in Myhill_2
urbanc
parents: 180
diff changeset
   300
    ultimately 
182
560712a29a36 a version of the proof which dispenses with the notion of string-subtraction
urbanc
parents: 181
diff changeset
   301
    have "y @ us \<in> A" using equiv_class_member 
181
97090fc7aa9f some experiments with the proofs in Myhill_2
urbanc
parents: 180
diff changeset
   302
      unfolding Image_def str_eq_def by blast
97090fc7aa9f some experiments with the proofs in Myhill_2
urbanc
parents: 180
diff changeset
   303
    then have "(y @ us) @ v \<in> A \<cdot> B" 
97090fc7aa9f some experiments with the proofs in Myhill_2
urbanc
parents: 180
diff changeset
   304
      using h3 unfolding conc_def by blast
97090fc7aa9f some experiments with the proofs in Myhill_2
urbanc
parents: 180
diff changeset
   305
    then have "y @ z \<in> A \<cdot> B" using eq by simp 
97090fc7aa9f some experiments with the proofs in Myhill_2
urbanc
parents: 180
diff changeset
   306
  }
97090fc7aa9f some experiments with the proofs in Myhill_2
urbanc
parents: 180
diff changeset
   307
  ultimately show "y @ z \<in> A \<cdot> B" by blast
97090fc7aa9f some experiments with the proofs in Myhill_2
urbanc
parents: 180
diff changeset
   308
qed
97090fc7aa9f some experiments with the proofs in Myhill_2
urbanc
parents: 180
diff changeset
   309
97090fc7aa9f some experiments with the proofs in Myhill_2
urbanc
parents: 180
diff changeset
   310
lemma quot_conc_finiteI [intro]:
97090fc7aa9f some experiments with the proofs in Myhill_2
urbanc
parents: 180
diff changeset
   311
  assumes fin1: "finite (UNIV // \<approx>A)" 
97090fc7aa9f some experiments with the proofs in Myhill_2
urbanc
parents: 180
diff changeset
   312
  and     fin2: "finite (UNIV // \<approx>B)" 
97090fc7aa9f some experiments with the proofs in Myhill_2
urbanc
parents: 180
diff changeset
   313
  shows "finite (UNIV // \<approx>(A \<cdot> B))"
97090fc7aa9f some experiments with the proofs in Myhill_2
urbanc
parents: 180
diff changeset
   314
proof (rule_tac tag = "tag_Times A B" in tag_finite_imageD)
183
c4893e84c88e cleaned up the proofs in Myhill_2
urbanc
parents: 182
diff changeset
   315
  have "\<And>x y z. \<lbrakk>tag_Times A B x = tag_Times A B y; x @ z \<in> A \<cdot> B\<rbrakk> \<Longrightarrow> y @ z \<in> A \<cdot> B"
c4893e84c88e cleaned up the proofs in Myhill_2
urbanc
parents: 182
diff changeset
   316
    by (rule tag_Times_injI)
c4893e84c88e cleaned up the proofs in Myhill_2
urbanc
parents: 182
diff changeset
   317
       (auto simp add: tag_Times_def tag_eq_def)
c4893e84c88e cleaned up the proofs in Myhill_2
urbanc
parents: 182
diff changeset
   318
  then show "=tag_Times A B= \<subseteq> \<approx>(A \<cdot> B)"
c4893e84c88e cleaned up the proofs in Myhill_2
urbanc
parents: 182
diff changeset
   319
    by (rule refined_intro)
c4893e84c88e cleaned up the proofs in Myhill_2
urbanc
parents: 182
diff changeset
   320
       (auto simp add: tag_eq_def)
63
649ff0b8766d Myhill_2.thy added
zhang
parents:
diff changeset
   321
next
182
560712a29a36 a version of the proof which dispenses with the notion of string-subtraction
urbanc
parents: 181
diff changeset
   322
  have *: "finite ((UNIV // \<approx>A) \<times> (Pow (UNIV // \<approx>A \<times> UNIV // \<approx>B)))" 
63
649ff0b8766d Myhill_2.thy added
zhang
parents:
diff changeset
   323
    using fin1 fin2 by auto
181
97090fc7aa9f some experiments with the proofs in Myhill_2
urbanc
parents: 180
diff changeset
   324
  show "finite (range (tag_Times A B))" 
97090fc7aa9f some experiments with the proofs in Myhill_2
urbanc
parents: 180
diff changeset
   325
    unfolding tag_Times_def
63
649ff0b8766d Myhill_2.thy added
zhang
parents:
diff changeset
   326
    apply(rule finite_subset[OF _ *])
649ff0b8766d Myhill_2.thy added
zhang
parents:
diff changeset
   327
    unfolding quotient_def
649ff0b8766d Myhill_2.thy added
zhang
parents:
diff changeset
   328
    by auto
649ff0b8766d Myhill_2.thy added
zhang
parents:
diff changeset
   329
qed
649ff0b8766d Myhill_2.thy added
zhang
parents:
diff changeset
   330
162
e93760534354 added directory for journal version; took uptodate version of the theory files
urbanc
parents: 160
diff changeset
   331
170
b1258b7d2789 made the theories compatible with the existing developments in the AFP; old theories are in the directory Attic
urbanc
parents: 166
diff changeset
   332
subsubsection {* The inductive case for @{const "Star"} *}
63
649ff0b8766d Myhill_2.thy added
zhang
parents:
diff changeset
   333
183
c4893e84c88e cleaned up the proofs in Myhill_2
urbanc
parents: 182
diff changeset
   334
lemma star_partitions_elim:
182
560712a29a36 a version of the proof which dispenses with the notion of string-subtraction
urbanc
parents: 181
diff changeset
   335
  assumes "x @ z \<in> A\<star>" "x \<noteq> []"
560712a29a36 a version of the proof which dispenses with the notion of string-subtraction
urbanc
parents: 181
diff changeset
   336
  shows "\<exists>(u, v) \<in> Partitions (x @ z). u < x \<and> u \<in> A\<star> \<and> v \<in> A\<star>"
560712a29a36 a version of the proof which dispenses with the notion of string-subtraction
urbanc
parents: 181
diff changeset
   337
proof -
560712a29a36 a version of the proof which dispenses with the notion of string-subtraction
urbanc
parents: 181
diff changeset
   338
  have "([], x @ z) \<in> Partitions (x @ z)" "[] < x" "[] \<in> A\<star>" "x @ z \<in> A\<star>"
560712a29a36 a version of the proof which dispenses with the notion of string-subtraction
urbanc
parents: 181
diff changeset
   339
    using assms by (auto simp add: Partitions_def strict_prefix_def)
560712a29a36 a version of the proof which dispenses with the notion of string-subtraction
urbanc
parents: 181
diff changeset
   340
  then show "\<exists>(u, v) \<in> Partitions (x @ z). u < x \<and> u \<in> A\<star> \<and> v \<in> A\<star>"
560712a29a36 a version of the proof which dispenses with the notion of string-subtraction
urbanc
parents: 181
diff changeset
   341
    by blast
63
649ff0b8766d Myhill_2.thy added
zhang
parents:
diff changeset
   342
qed
649ff0b8766d Myhill_2.thy added
zhang
parents:
diff changeset
   343
182
560712a29a36 a version of the proof which dispenses with the notion of string-subtraction
urbanc
parents: 181
diff changeset
   344
lemma finite_set_has_max2: 
560712a29a36 a version of the proof which dispenses with the notion of string-subtraction
urbanc
parents: 181
diff changeset
   345
  "\<lbrakk>finite A; A \<noteq> {}\<rbrakk> \<Longrightarrow> \<exists> max \<in> A. \<forall> a \<in> A. length a \<le> length max"
560712a29a36 a version of the proof which dispenses with the notion of string-subtraction
urbanc
parents: 181
diff changeset
   346
apply(induct rule:finite.induct)
560712a29a36 a version of the proof which dispenses with the notion of string-subtraction
urbanc
parents: 181
diff changeset
   347
apply(simp)
560712a29a36 a version of the proof which dispenses with the notion of string-subtraction
urbanc
parents: 181
diff changeset
   348
by (metis (full_types) all_not_in_conv insert_iff linorder_linear order_trans)
162
e93760534354 added directory for journal version; took uptodate version of the theory files
urbanc
parents: 160
diff changeset
   349
170
b1258b7d2789 made the theories compatible with the existing developments in the AFP; old theories are in the directory Attic
urbanc
parents: 166
diff changeset
   350
lemma finite_strict_prefix_set: 
b1258b7d2789 made the theories compatible with the existing developments in the AFP; old theories are in the directory Attic
urbanc
parents: 166
diff changeset
   351
  shows "finite {xa. xa < (x::'a list)}"
63
649ff0b8766d Myhill_2.thy added
zhang
parents:
diff changeset
   352
apply (induct x rule:rev_induct, simp)
649ff0b8766d Myhill_2.thy added
zhang
parents:
diff changeset
   353
apply (subgoal_tac "{xa. xa < xs @ [x]} = {xa. xa < xs} \<union> {xs}")
649ff0b8766d Myhill_2.thy added
zhang
parents:
diff changeset
   354
by (auto simp:strict_prefix_def)
649ff0b8766d Myhill_2.thy added
zhang
parents:
diff changeset
   355
182
560712a29a36 a version of the proof which dispenses with the notion of string-subtraction
urbanc
parents: 181
diff changeset
   356
lemma append_eq_cases:
560712a29a36 a version of the proof which dispenses with the notion of string-subtraction
urbanc
parents: 181
diff changeset
   357
  assumes a: "x @ y = m @ n" "m \<noteq> []"  
560712a29a36 a version of the proof which dispenses with the notion of string-subtraction
urbanc
parents: 181
diff changeset
   358
  shows "x \<le> m \<or> m < x"
560712a29a36 a version of the proof which dispenses with the notion of string-subtraction
urbanc
parents: 181
diff changeset
   359
unfolding prefix_def strict_prefix_def using a
560712a29a36 a version of the proof which dispenses with the notion of string-subtraction
urbanc
parents: 181
diff changeset
   360
by (auto simp add: append_eq_append_conv2)
560712a29a36 a version of the proof which dispenses with the notion of string-subtraction
urbanc
parents: 181
diff changeset
   361
560712a29a36 a version of the proof which dispenses with the notion of string-subtraction
urbanc
parents: 181
diff changeset
   362
lemma star_spartitions_elim2:
560712a29a36 a version of the proof which dispenses with the notion of string-subtraction
urbanc
parents: 181
diff changeset
   363
  assumes a: "x @ z \<in> A\<star>" 
560712a29a36 a version of the proof which dispenses with the notion of string-subtraction
urbanc
parents: 181
diff changeset
   364
  and     b: "x \<noteq> []"
560712a29a36 a version of the proof which dispenses with the notion of string-subtraction
urbanc
parents: 181
diff changeset
   365
  shows "\<exists>(u, v) \<in> Partitions x. \<exists> (u', v') \<in> Partitions z. u < x \<and> u \<in> A\<star> \<and> v @ u' \<in> A \<and> v' \<in> A\<star>"
560712a29a36 a version of the proof which dispenses with the notion of string-subtraction
urbanc
parents: 181
diff changeset
   366
proof -
560712a29a36 a version of the proof which dispenses with the notion of string-subtraction
urbanc
parents: 181
diff changeset
   367
  def S \<equiv> "{u | u v. (u, v) \<in> Partitions x \<and> u < x \<and> u \<in> A\<star> \<and> v @ z \<in> A\<star>}"
560712a29a36 a version of the proof which dispenses with the notion of string-subtraction
urbanc
parents: 181
diff changeset
   368
  have "finite {u. u < x}" by (rule finite_strict_prefix_set)
560712a29a36 a version of the proof which dispenses with the notion of string-subtraction
urbanc
parents: 181
diff changeset
   369
  then have "finite S" unfolding S_def
560712a29a36 a version of the proof which dispenses with the notion of string-subtraction
urbanc
parents: 181
diff changeset
   370
    by (rule rev_finite_subset) (auto)
560712a29a36 a version of the proof which dispenses with the notion of string-subtraction
urbanc
parents: 181
diff changeset
   371
  moreover 
560712a29a36 a version of the proof which dispenses with the notion of string-subtraction
urbanc
parents: 181
diff changeset
   372
  have "S \<noteq> {}" using a b unfolding S_def Partitions_def
560712a29a36 a version of the proof which dispenses with the notion of string-subtraction
urbanc
parents: 181
diff changeset
   373
    by (auto simp: strict_prefix_def)
560712a29a36 a version of the proof which dispenses with the notion of string-subtraction
urbanc
parents: 181
diff changeset
   374
  ultimately have "\<exists> u_max \<in> S. \<forall> u \<in> S. length u \<le> length u_max"  
560712a29a36 a version of the proof which dispenses with the notion of string-subtraction
urbanc
parents: 181
diff changeset
   375
    using finite_set_has_max2 by blast
560712a29a36 a version of the proof which dispenses with the notion of string-subtraction
urbanc
parents: 181
diff changeset
   376
  then obtain u_max v 
560712a29a36 a version of the proof which dispenses with the notion of string-subtraction
urbanc
parents: 181
diff changeset
   377
    where h0: "(u_max, v) \<in> Partitions x"
560712a29a36 a version of the proof which dispenses with the notion of string-subtraction
urbanc
parents: 181
diff changeset
   378
    and h1: "u_max < x" 
560712a29a36 a version of the proof which dispenses with the notion of string-subtraction
urbanc
parents: 181
diff changeset
   379
    and h2: "u_max \<in> A\<star>" 
560712a29a36 a version of the proof which dispenses with the notion of string-subtraction
urbanc
parents: 181
diff changeset
   380
    and h3: "v @ z \<in> A\<star>"  
560712a29a36 a version of the proof which dispenses with the notion of string-subtraction
urbanc
parents: 181
diff changeset
   381
    and h4: "\<forall> u v. (u, v) \<in> Partitions x \<and> u < x \<and> u \<in> A\<star> \<and> v @ z \<in> A\<star> \<longrightarrow> length u \<le> length u_max"
560712a29a36 a version of the proof which dispenses with the notion of string-subtraction
urbanc
parents: 181
diff changeset
   382
    unfolding S_def Partitions_def by blast
560712a29a36 a version of the proof which dispenses with the notion of string-subtraction
urbanc
parents: 181
diff changeset
   383
  have q: "v \<noteq> []" using h0 h1 b unfolding Partitions_def by auto
560712a29a36 a version of the proof which dispenses with the notion of string-subtraction
urbanc
parents: 181
diff changeset
   384
  from h3 obtain a b
560712a29a36 a version of the proof which dispenses with the notion of string-subtraction
urbanc
parents: 181
diff changeset
   385
    where i1: "(a, b) \<in> Partitions (v @ z)"
560712a29a36 a version of the proof which dispenses with the notion of string-subtraction
urbanc
parents: 181
diff changeset
   386
    and   i2: "a \<in> A"
560712a29a36 a version of the proof which dispenses with the notion of string-subtraction
urbanc
parents: 181
diff changeset
   387
    and   i3: "b \<in> A\<star>"
560712a29a36 a version of the proof which dispenses with the notion of string-subtraction
urbanc
parents: 181
diff changeset
   388
    and   i4: "a \<noteq> []"
560712a29a36 a version of the proof which dispenses with the notion of string-subtraction
urbanc
parents: 181
diff changeset
   389
    unfolding Partitions_def
560712a29a36 a version of the proof which dispenses with the notion of string-subtraction
urbanc
parents: 181
diff changeset
   390
    using q by (auto dest: star_decom)
560712a29a36 a version of the proof which dispenses with the notion of string-subtraction
urbanc
parents: 181
diff changeset
   391
  have "v \<le> a"
560712a29a36 a version of the proof which dispenses with the notion of string-subtraction
urbanc
parents: 181
diff changeset
   392
  proof (rule ccontr)
560712a29a36 a version of the proof which dispenses with the notion of string-subtraction
urbanc
parents: 181
diff changeset
   393
    assume a: "\<not>(v \<le> a)"
560712a29a36 a version of the proof which dispenses with the notion of string-subtraction
urbanc
parents: 181
diff changeset
   394
    from i1 have i1': "a @ b = v @ z" unfolding Partitions_def by simp
560712a29a36 a version of the proof which dispenses with the notion of string-subtraction
urbanc
parents: 181
diff changeset
   395
    then have "a \<le> v \<or> v < a" using append_eq_cases q by blast
560712a29a36 a version of the proof which dispenses with the notion of string-subtraction
urbanc
parents: 181
diff changeset
   396
    then have q: "a < v" using a unfolding strict_prefix_def prefix_def by auto
560712a29a36 a version of the proof which dispenses with the notion of string-subtraction
urbanc
parents: 181
diff changeset
   397
    then obtain as where eq: "a @ as = v" unfolding strict_prefix_def prefix_def by auto
560712a29a36 a version of the proof which dispenses with the notion of string-subtraction
urbanc
parents: 181
diff changeset
   398
    have "(u_max @ a, as) \<in> Partitions x" using eq h0 unfolding Partitions_def by auto
560712a29a36 a version of the proof which dispenses with the notion of string-subtraction
urbanc
parents: 181
diff changeset
   399
    moreover
560712a29a36 a version of the proof which dispenses with the notion of string-subtraction
urbanc
parents: 181
diff changeset
   400
    have "u_max @ a < x" using h0 eq q unfolding Partitions_def strict_prefix_def prefix_def by auto
560712a29a36 a version of the proof which dispenses with the notion of string-subtraction
urbanc
parents: 181
diff changeset
   401
    moreover
560712a29a36 a version of the proof which dispenses with the notion of string-subtraction
urbanc
parents: 181
diff changeset
   402
    have "u_max @ a \<in> A\<star>" using i2 h2 by simp
560712a29a36 a version of the proof which dispenses with the notion of string-subtraction
urbanc
parents: 181
diff changeset
   403
    moreover
560712a29a36 a version of the proof which dispenses with the notion of string-subtraction
urbanc
parents: 181
diff changeset
   404
    have "as @ z \<in> A\<star>" using i1' i2 i3 eq by auto
560712a29a36 a version of the proof which dispenses with the notion of string-subtraction
urbanc
parents: 181
diff changeset
   405
    ultimately have "length (u_max @ a) \<le> length u_max" using h4 by blast
183
c4893e84c88e cleaned up the proofs in Myhill_2
urbanc
parents: 182
diff changeset
   406
    with i4 show "False" by auto
182
560712a29a36 a version of the proof which dispenses with the notion of string-subtraction
urbanc
parents: 181
diff changeset
   407
  qed
560712a29a36 a version of the proof which dispenses with the notion of string-subtraction
urbanc
parents: 181
diff changeset
   408
  with i1 obtain za zb
560712a29a36 a version of the proof which dispenses with the notion of string-subtraction
urbanc
parents: 181
diff changeset
   409
    where k1: "v @ za = a"
560712a29a36 a version of the proof which dispenses with the notion of string-subtraction
urbanc
parents: 181
diff changeset
   410
    and   k2: "(za, zb) \<in> Partitions z" 
560712a29a36 a version of the proof which dispenses with the notion of string-subtraction
urbanc
parents: 181
diff changeset
   411
    and   k4: "zb = b" 
560712a29a36 a version of the proof which dispenses with the notion of string-subtraction
urbanc
parents: 181
diff changeset
   412
    unfolding Partitions_def prefix_def
560712a29a36 a version of the proof which dispenses with the notion of string-subtraction
urbanc
parents: 181
diff changeset
   413
    by (auto simp add: append_eq_append_conv2)
560712a29a36 a version of the proof which dispenses with the notion of string-subtraction
urbanc
parents: 181
diff changeset
   414
  show "\<exists> (u, v) \<in> Partitions x. \<exists> (u', v') \<in> Partitions z. u < x \<and> u \<in> A\<star> \<and> v @ u' \<in> A \<and> v' \<in> A\<star>"
183
c4893e84c88e cleaned up the proofs in Myhill_2
urbanc
parents: 182
diff changeset
   415
    using h0 h1 h2 i2 i3 k1 k2 k4 unfolding Partitions_def by blast
182
560712a29a36 a version of the proof which dispenses with the notion of string-subtraction
urbanc
parents: 181
diff changeset
   416
qed
560712a29a36 a version of the proof which dispenses with the notion of string-subtraction
urbanc
parents: 181
diff changeset
   417
560712a29a36 a version of the proof which dispenses with the notion of string-subtraction
urbanc
parents: 181
diff changeset
   418
definition 
560712a29a36 a version of the proof which dispenses with the notion of string-subtraction
urbanc
parents: 181
diff changeset
   419
  tag_Star :: "'a lang \<Rightarrow> 'a list \<Rightarrow> ('a lang) set"
560712a29a36 a version of the proof which dispenses with the notion of string-subtraction
urbanc
parents: 181
diff changeset
   420
where
560712a29a36 a version of the proof which dispenses with the notion of string-subtraction
urbanc
parents: 181
diff changeset
   421
  "tag_Star A \<equiv> (\<lambda>x. {\<approx>A `` {v} | u v. u < x \<and> u \<in> A\<star> \<and> (u, v) \<in> Partitions x})"
560712a29a36 a version of the proof which dispenses with the notion of string-subtraction
urbanc
parents: 181
diff changeset
   422
183
c4893e84c88e cleaned up the proofs in Myhill_2
urbanc
parents: 182
diff changeset
   423
lemma tag_Star_non_empty_injI:
182
560712a29a36 a version of the proof which dispenses with the notion of string-subtraction
urbanc
parents: 181
diff changeset
   424
  assumes a: "tag_Star A x = tag_Star A y"
560712a29a36 a version of the proof which dispenses with the notion of string-subtraction
urbanc
parents: 181
diff changeset
   425
  and     c: "x @ z \<in> A\<star>"
560712a29a36 a version of the proof which dispenses with the notion of string-subtraction
urbanc
parents: 181
diff changeset
   426
  and     d: "x \<noteq> []"
560712a29a36 a version of the proof which dispenses with the notion of string-subtraction
urbanc
parents: 181
diff changeset
   427
  shows "y @ z \<in> A\<star>"
183
c4893e84c88e cleaned up the proofs in Myhill_2
urbanc
parents: 182
diff changeset
   428
proof -
c4893e84c88e cleaned up the proofs in Myhill_2
urbanc
parents: 182
diff changeset
   429
  obtain u v u' v' 
c4893e84c88e cleaned up the proofs in Myhill_2
urbanc
parents: 182
diff changeset
   430
    where a1: "(u,  v) \<in> Partitions x" "(u', v')\<in> Partitions z"
c4893e84c88e cleaned up the proofs in Myhill_2
urbanc
parents: 182
diff changeset
   431
    and   a2: "u < x"
c4893e84c88e cleaned up the proofs in Myhill_2
urbanc
parents: 182
diff changeset
   432
    and   a3: "u \<in> A\<star>"
c4893e84c88e cleaned up the proofs in Myhill_2
urbanc
parents: 182
diff changeset
   433
    and   a4: "v @ u' \<in> A" 
c4893e84c88e cleaned up the proofs in Myhill_2
urbanc
parents: 182
diff changeset
   434
    and   a5: "v' \<in> A\<star>"
c4893e84c88e cleaned up the proofs in Myhill_2
urbanc
parents: 182
diff changeset
   435
    using c d by (auto dest: star_spartitions_elim2)
c4893e84c88e cleaned up the proofs in Myhill_2
urbanc
parents: 182
diff changeset
   436
  have "(\<approx>A) `` {v} \<in> tag_Star A x" 
c4893e84c88e cleaned up the proofs in Myhill_2
urbanc
parents: 182
diff changeset
   437
    apply(simp add: tag_Star_def Partitions_def str_eq_def)
c4893e84c88e cleaned up the proofs in Myhill_2
urbanc
parents: 182
diff changeset
   438
    using a1 a2 a3 by (auto simp add: Partitions_def)
c4893e84c88e cleaned up the proofs in Myhill_2
urbanc
parents: 182
diff changeset
   439
  then have "(\<approx>A) `` {v} \<in> tag_Star A y" using a by simp
c4893e84c88e cleaned up the proofs in Myhill_2
urbanc
parents: 182
diff changeset
   440
  then obtain u1 v1 
c4893e84c88e cleaned up the proofs in Myhill_2
urbanc
parents: 182
diff changeset
   441
    where b1: "v \<approx>A v1"
c4893e84c88e cleaned up the proofs in Myhill_2
urbanc
parents: 182
diff changeset
   442
    and   b3: "u1 \<in> A\<star>"
c4893e84c88e cleaned up the proofs in Myhill_2
urbanc
parents: 182
diff changeset
   443
    and   b4: "(u1, v1) \<in> Partitions y"
c4893e84c88e cleaned up the proofs in Myhill_2
urbanc
parents: 182
diff changeset
   444
    unfolding tag_Star_def by auto
c4893e84c88e cleaned up the proofs in Myhill_2
urbanc
parents: 182
diff changeset
   445
  have c: "v1 @ u' \<in> A\<star>" using b1 a4 unfolding str_eq_def by simp
c4893e84c88e cleaned up the proofs in Myhill_2
urbanc
parents: 182
diff changeset
   446
  have "u1 @ (v1 @ u') @ v' \<in> A\<star>"
c4893e84c88e cleaned up the proofs in Myhill_2
urbanc
parents: 182
diff changeset
   447
    using b3 c a5 by (simp only: append_in_starI)
c4893e84c88e cleaned up the proofs in Myhill_2
urbanc
parents: 182
diff changeset
   448
  then show "y @ z \<in> A\<star>" using b4 a1 
c4893e84c88e cleaned up the proofs in Myhill_2
urbanc
parents: 182
diff changeset
   449
    unfolding Partitions_def by auto
c4893e84c88e cleaned up the proofs in Myhill_2
urbanc
parents: 182
diff changeset
   450
qed
c4893e84c88e cleaned up the proofs in Myhill_2
urbanc
parents: 182
diff changeset
   451
    
c4893e84c88e cleaned up the proofs in Myhill_2
urbanc
parents: 182
diff changeset
   452
lemma tag_Star_empty_injI:
182
560712a29a36 a version of the proof which dispenses with the notion of string-subtraction
urbanc
parents: 181
diff changeset
   453
  assumes a: "tag_Star A x = tag_Star A y"
560712a29a36 a version of the proof which dispenses with the notion of string-subtraction
urbanc
parents: 181
diff changeset
   454
  and     c: "x @ z \<in> A\<star>"
560712a29a36 a version of the proof which dispenses with the notion of string-subtraction
urbanc
parents: 181
diff changeset
   455
  and     d: "x = []"
560712a29a36 a version of the proof which dispenses with the notion of string-subtraction
urbanc
parents: 181
diff changeset
   456
  shows "y @ z \<in> A\<star>"
183
c4893e84c88e cleaned up the proofs in Myhill_2
urbanc
parents: 182
diff changeset
   457
using assms
182
560712a29a36 a version of the proof which dispenses with the notion of string-subtraction
urbanc
parents: 181
diff changeset
   458
apply(simp)
560712a29a36 a version of the proof which dispenses with the notion of string-subtraction
urbanc
parents: 181
diff changeset
   459
apply(simp add: tag_Star_def strict_prefix_def)
560712a29a36 a version of the proof which dispenses with the notion of string-subtraction
urbanc
parents: 181
diff changeset
   460
apply(auto simp add: prefix_def Partitions_def)
560712a29a36 a version of the proof which dispenses with the notion of string-subtraction
urbanc
parents: 181
diff changeset
   461
by (metis Nil_in_star append_self_conv2)
560712a29a36 a version of the proof which dispenses with the notion of string-subtraction
urbanc
parents: 181
diff changeset
   462
63
649ff0b8766d Myhill_2.thy added
zhang
parents:
diff changeset
   463
lemma quot_star_finiteI [intro]:
166
7743d2ad71d1 updated theories and itp-paper
urbanc
parents: 162
diff changeset
   464
  assumes finite1: "finite (UNIV // \<approx>A)"
7743d2ad71d1 updated theories and itp-paper
urbanc
parents: 162
diff changeset
   465
  shows "finite (UNIV // \<approx>(A\<star>))"
181
97090fc7aa9f some experiments with the proofs in Myhill_2
urbanc
parents: 180
diff changeset
   466
proof (rule_tac tag = "tag_Star A" in tag_finite_imageD)
183
c4893e84c88e cleaned up the proofs in Myhill_2
urbanc
parents: 182
diff changeset
   467
  have "\<And>x y z. \<lbrakk>tag_Star A x = tag_Star A y; x @ z \<in> A\<star>\<rbrakk> \<Longrightarrow> y @ z \<in> A\<star>"
c4893e84c88e cleaned up the proofs in Myhill_2
urbanc
parents: 182
diff changeset
   468
    by (case_tac "x = []") (blast intro: tag_Star_empty_injI tag_Star_non_empty_injI)+
c4893e84c88e cleaned up the proofs in Myhill_2
urbanc
parents: 182
diff changeset
   469
  then show "=(tag_Star A)= \<subseteq> \<approx>(A\<star>)"
c4893e84c88e cleaned up the proofs in Myhill_2
urbanc
parents: 182
diff changeset
   470
    by (rule refined_intro) (auto simp add: tag_eq_def)
63
649ff0b8766d Myhill_2.thy added
zhang
parents:
diff changeset
   471
next
166
7743d2ad71d1 updated theories and itp-paper
urbanc
parents: 162
diff changeset
   472
  have *: "finite (Pow (UNIV // \<approx>A))" 
182
560712a29a36 a version of the proof which dispenses with the notion of string-subtraction
urbanc
parents: 181
diff changeset
   473
     using finite1 by auto
181
97090fc7aa9f some experiments with the proofs in Myhill_2
urbanc
parents: 180
diff changeset
   474
  show "finite (range (tag_Star A))"
183
c4893e84c88e cleaned up the proofs in Myhill_2
urbanc
parents: 182
diff changeset
   475
    unfolding tag_Star_def 
c4893e84c88e cleaned up the proofs in Myhill_2
urbanc
parents: 182
diff changeset
   476
    by (rule finite_subset[OF _ *])
c4893e84c88e cleaned up the proofs in Myhill_2
urbanc
parents: 182
diff changeset
   477
       (auto simp add: quotient_def)
63
649ff0b8766d Myhill_2.thy added
zhang
parents:
diff changeset
   478
qed
649ff0b8766d Myhill_2.thy added
zhang
parents:
diff changeset
   479
649ff0b8766d Myhill_2.thy added
zhang
parents:
diff changeset
   480
subsubsection{* The conclusion *}
649ff0b8766d Myhill_2.thy added
zhang
parents:
diff changeset
   481
112
62fdb4bf7239 more on the conclusion
urbanc
parents: 109
diff changeset
   482
lemma Myhill_Nerode2:
183
c4893e84c88e cleaned up the proofs in Myhill_2
urbanc
parents: 182
diff changeset
   483
  fixes r::"'a rexp"
170
b1258b7d2789 made the theories compatible with the existing developments in the AFP; old theories are in the directory Attic
urbanc
parents: 166
diff changeset
   484
  shows "finite (UNIV // \<approx>(lang r))"
63
649ff0b8766d Myhill_2.thy added
zhang
parents:
diff changeset
   485
by (induct r) (auto)
649ff0b8766d Myhill_2.thy added
zhang
parents:
diff changeset
   486
132
f77a7138f791 comments by Xingyuan
urbanc
parents: 128
diff changeset
   487
theorem Myhill_Nerode:
170
b1258b7d2789 made the theories compatible with the existing developments in the AFP; old theories are in the directory Attic
urbanc
parents: 166
diff changeset
   488
  fixes A::"('a::finite) lang"
b1258b7d2789 made the theories compatible with the existing developments in the AFP; old theories are in the directory Attic
urbanc
parents: 166
diff changeset
   489
  shows "(\<exists>r. A = lang r) \<longleftrightarrow> finite (UNIV // \<approx>A)"
162
e93760534354 added directory for journal version; took uptodate version of the theory files
urbanc
parents: 160
diff changeset
   490
using Myhill_Nerode1 Myhill_Nerode2 by auto
112
62fdb4bf7239 more on the conclusion
urbanc
parents: 109
diff changeset
   491
183
c4893e84c88e cleaned up the proofs in Myhill_2
urbanc
parents: 182
diff changeset
   492
end