Myhill.thy
author zhang
Mon, 24 Jan 2011 11:29:55 +0000
changeset 30 f5db9e08effc
parent 29 c64241fa4dff
child 31 b6815473ee2e
permissions -rw-r--r--
Directory [tphols-2011] is added to host the commented version of [Myhill.thy]. Directory [pres] is created to host a build session for logical image [ListP] which is essentially [Main] extended with [List_prefix.thy].
Ignore whitespace changes - Everywhere: Within whitespace: At end of lines:
30
f5db9e08effc Directory [tphols-2011] is added to host the commented version of [Myhill.thy]. Directory [pres] is created to host a build session for logical image [ListP] which is essentially [Main] extended with [List_prefix.thy].
zhang
parents: 29
diff changeset
     1
theory Myhill
f5db9e08effc Directory [tphols-2011] is added to host the commented version of [Myhill.thy]. Directory [pres] is created to host a build session for logical image [ListP] which is essentially [Main] extended with [List_prefix.thy].
zhang
parents: 29
diff changeset
     2
  imports Main List_Prefix
27
90a57a533b0c Add new file for the new definition of the hard direction's simplification.
wu
parents:
diff changeset
     3
begin
90a57a533b0c Add new file for the new definition of the hard direction's simplification.
wu
parents:
diff changeset
     4
30
f5db9e08effc Directory [tphols-2011] is added to host the commented version of [Myhill.thy]. Directory [pres] is created to host a build session for logical image [ListP] which is essentially [Main] extended with [List_prefix.thy].
zhang
parents: 29
diff changeset
     5
section {* Preliminary definitions *}
f5db9e08effc Directory [tphols-2011] is added to host the commented version of [Myhill.thy]. Directory [pres] is created to host a build session for logical image [ListP] which is essentially [Main] extended with [List_prefix.thy].
zhang
parents: 29
diff changeset
     6
f5db9e08effc Directory [tphols-2011] is added to host the commented version of [Myhill.thy]. Directory [pres] is created to host a build session for logical image [ListP] which is essentially [Main] extended with [List_prefix.thy].
zhang
parents: 29
diff changeset
     7
text {* Sequential composition of two languages @{text "L1"} and @{text "L2"} *}
29
c64241fa4dff Beautifying of the Other Direction is finished.
wu
parents: 28
diff changeset
     8
definition Seq :: "string set \<Rightarrow> string set \<Rightarrow> string set" ("_ ;; _" [100,100] 100)
27
90a57a533b0c Add new file for the new definition of the hard direction's simplification.
wu
parents:
diff changeset
     9
where 
90a57a533b0c Add new file for the new definition of the hard direction's simplification.
wu
parents:
diff changeset
    10
  "L1 ;; L2 = {s1 @ s2 | s1 s2. s1 \<in> L1 \<and> s2 \<in> L2}"
90a57a533b0c Add new file for the new definition of the hard direction's simplification.
wu
parents:
diff changeset
    11
30
f5db9e08effc Directory [tphols-2011] is added to host the commented version of [Myhill.thy]. Directory [pres] is created to host a build session for logical image [ListP] which is essentially [Main] extended with [List_prefix.thy].
zhang
parents: 29
diff changeset
    12
text {* Transitive closure of language @{text "L"}. *}
27
90a57a533b0c Add new file for the new definition of the hard direction's simplification.
wu
parents:
diff changeset
    13
inductive_set
90a57a533b0c Add new file for the new definition of the hard direction's simplification.
wu
parents:
diff changeset
    14
  Star :: "string set \<Rightarrow> string set" ("_\<star>" [101] 102)
90a57a533b0c Add new file for the new definition of the hard direction's simplification.
wu
parents:
diff changeset
    15
  for L :: "string set"
90a57a533b0c Add new file for the new definition of the hard direction's simplification.
wu
parents:
diff changeset
    16
where
90a57a533b0c Add new file for the new definition of the hard direction's simplification.
wu
parents:
diff changeset
    17
  start[intro]: "[] \<in> L\<star>"
90a57a533b0c Add new file for the new definition of the hard direction's simplification.
wu
parents:
diff changeset
    18
| step[intro]:  "\<lbrakk>s1 \<in> L; s2 \<in> L\<star>\<rbrakk> \<Longrightarrow> s1@s2 \<in> L\<star>" 
90a57a533b0c Add new file for the new definition of the hard direction's simplification.
wu
parents:
diff changeset
    19
30
f5db9e08effc Directory [tphols-2011] is added to host the commented version of [Myhill.thy]. Directory [pres] is created to host a build session for logical image [ListP] which is essentially [Main] extended with [List_prefix.thy].
zhang
parents: 29
diff changeset
    20
text {* Some properties of operator @{text ";;"}.*}
f5db9e08effc Directory [tphols-2011] is added to host the commented version of [Myhill.thy]. Directory [pres] is created to host a build session for logical image [ListP] which is essentially [Main] extended with [List_prefix.thy].
zhang
parents: 29
diff changeset
    21
28
cef2893f353b Rewritten of hard direction once more. To make it looking better.
wu
parents: 27
diff changeset
    22
lemma seq_union_distrib:
cef2893f353b Rewritten of hard direction once more. To make it looking better.
wu
parents: 27
diff changeset
    23
  "(A \<union> B) ;; C = (A ;; C) \<union> (B ;; C)"
cef2893f353b Rewritten of hard direction once more. To make it looking better.
wu
parents: 27
diff changeset
    24
by (auto simp:Seq_def)
cef2893f353b Rewritten of hard direction once more. To make it looking better.
wu
parents: 27
diff changeset
    25
29
c64241fa4dff Beautifying of the Other Direction is finished.
wu
parents: 28
diff changeset
    26
lemma seq_intro:
c64241fa4dff Beautifying of the Other Direction is finished.
wu
parents: 28
diff changeset
    27
  "\<lbrakk>x \<in> A; y \<in> B\<rbrakk> \<Longrightarrow> x @ y \<in> A ;; B "
c64241fa4dff Beautifying of the Other Direction is finished.
wu
parents: 28
diff changeset
    28
by (auto simp:Seq_def)
c64241fa4dff Beautifying of the Other Direction is finished.
wu
parents: 28
diff changeset
    29
28
cef2893f353b Rewritten of hard direction once more. To make it looking better.
wu
parents: 27
diff changeset
    30
lemma seq_assoc:
cef2893f353b Rewritten of hard direction once more. To make it looking better.
wu
parents: 27
diff changeset
    31
  "(A ;; B) ;; C = A ;; (B ;; C)"
29
c64241fa4dff Beautifying of the Other Direction is finished.
wu
parents: 28
diff changeset
    32
apply(auto simp:Seq_def)
c64241fa4dff Beautifying of the Other Direction is finished.
wu
parents: 28
diff changeset
    33
apply blast
28
cef2893f353b Rewritten of hard direction once more. To make it looking better.
wu
parents: 27
diff changeset
    34
by (metis append_assoc)
cef2893f353b Rewritten of hard direction once more. To make it looking better.
wu
parents: 27
diff changeset
    35
30
f5db9e08effc Directory [tphols-2011] is added to host the commented version of [Myhill.thy]. Directory [pres] is created to host a build session for logical image [ListP] which is essentially [Main] extended with [List_prefix.thy].
zhang
parents: 29
diff changeset
    36
lemma star_intro1[rule_format]: "x \<in> lang\<star> \<Longrightarrow> \<forall> y. y \<in> lang\<star> \<longrightarrow> x @ y \<in> lang\<star>"
f5db9e08effc Directory [tphols-2011] is added to host the commented version of [Myhill.thy]. Directory [pres] is created to host a build session for logical image [ListP] which is essentially [Main] extended with [List_prefix.thy].
zhang
parents: 29
diff changeset
    37
by (erule Star.induct, auto)
f5db9e08effc Directory [tphols-2011] is added to host the commented version of [Myhill.thy]. Directory [pres] is created to host a build session for logical image [ListP] which is essentially [Main] extended with [List_prefix.thy].
zhang
parents: 29
diff changeset
    38
f5db9e08effc Directory [tphols-2011] is added to host the commented version of [Myhill.thy]. Directory [pres] is created to host a build session for logical image [ListP] which is essentially [Main] extended with [List_prefix.thy].
zhang
parents: 29
diff changeset
    39
lemma star_intro2: "y \<in> lang \<Longrightarrow> y \<in> lang\<star>"
f5db9e08effc Directory [tphols-2011] is added to host the commented version of [Myhill.thy]. Directory [pres] is created to host a build session for logical image [ListP] which is essentially [Main] extended with [List_prefix.thy].
zhang
parents: 29
diff changeset
    40
by (drule step[of y lang "[]"], auto simp:start)
f5db9e08effc Directory [tphols-2011] is added to host the commented version of [Myhill.thy]. Directory [pres] is created to host a build session for logical image [ListP] which is essentially [Main] extended with [List_prefix.thy].
zhang
parents: 29
diff changeset
    41
f5db9e08effc Directory [tphols-2011] is added to host the commented version of [Myhill.thy]. Directory [pres] is created to host a build session for logical image [ListP] which is essentially [Main] extended with [List_prefix.thy].
zhang
parents: 29
diff changeset
    42
lemma star_intro3[rule_format]: 
f5db9e08effc Directory [tphols-2011] is added to host the commented version of [Myhill.thy]. Directory [pres] is created to host a build session for logical image [ListP] which is essentially [Main] extended with [List_prefix.thy].
zhang
parents: 29
diff changeset
    43
  "x \<in> lang\<star> \<Longrightarrow> \<forall>y . y \<in> lang \<longrightarrow> x @ y \<in> lang\<star>"
f5db9e08effc Directory [tphols-2011] is added to host the commented version of [Myhill.thy]. Directory [pres] is created to host a build session for logical image [ListP] which is essentially [Main] extended with [List_prefix.thy].
zhang
parents: 29
diff changeset
    44
by (erule Star.induct, auto intro:star_intro2)
f5db9e08effc Directory [tphols-2011] is added to host the commented version of [Myhill.thy]. Directory [pres] is created to host a build session for logical image [ListP] which is essentially [Main] extended with [List_prefix.thy].
zhang
parents: 29
diff changeset
    45
f5db9e08effc Directory [tphols-2011] is added to host the commented version of [Myhill.thy]. Directory [pres] is created to host a build session for logical image [ListP] which is essentially [Main] extended with [List_prefix.thy].
zhang
parents: 29
diff changeset
    46
lemma star_decom: 
f5db9e08effc Directory [tphols-2011] is added to host the commented version of [Myhill.thy]. Directory [pres] is created to host a build session for logical image [ListP] which is essentially [Main] extended with [List_prefix.thy].
zhang
parents: 29
diff changeset
    47
  "\<lbrakk>x \<in> lang\<star>; x \<noteq> []\<rbrakk> \<Longrightarrow>(\<exists> a b. x = a @ b \<and> a \<noteq> [] \<and> a \<in> lang \<and> b \<in> lang\<star>)"
f5db9e08effc Directory [tphols-2011] is added to host the commented version of [Myhill.thy]. Directory [pres] is created to host a build session for logical image [ListP] which is essentially [Main] extended with [List_prefix.thy].
zhang
parents: 29
diff changeset
    48
by (induct x rule: Star.induct, simp, blast)
f5db9e08effc Directory [tphols-2011] is added to host the commented version of [Myhill.thy]. Directory [pres] is created to host a build session for logical image [ListP] which is essentially [Main] extended with [List_prefix.thy].
zhang
parents: 29
diff changeset
    49
f5db9e08effc Directory [tphols-2011] is added to host the commented version of [Myhill.thy]. Directory [pres] is created to host a build session for logical image [ListP] which is essentially [Main] extended with [List_prefix.thy].
zhang
parents: 29
diff changeset
    50
lemma star_decom': 
f5db9e08effc Directory [tphols-2011] is added to host the commented version of [Myhill.thy]. Directory [pres] is created to host a build session for logical image [ListP] which is essentially [Main] extended with [List_prefix.thy].
zhang
parents: 29
diff changeset
    51
  "\<lbrakk>x \<in> lang\<star>; x \<noteq> []\<rbrakk> \<Longrightarrow> \<exists>a b. x = a @ b \<and> a \<in> lang\<star> \<and> b \<in> lang"
f5db9e08effc Directory [tphols-2011] is added to host the commented version of [Myhill.thy]. Directory [pres] is created to host a build session for logical image [ListP] which is essentially [Main] extended with [List_prefix.thy].
zhang
parents: 29
diff changeset
    52
apply (induct x rule:Star.induct, simp)
f5db9e08effc Directory [tphols-2011] is added to host the commented version of [Myhill.thy]. Directory [pres] is created to host a build session for logical image [ListP] which is essentially [Main] extended with [List_prefix.thy].
zhang
parents: 29
diff changeset
    53
apply (case_tac "s2 = []")
f5db9e08effc Directory [tphols-2011] is added to host the commented version of [Myhill.thy]. Directory [pres] is created to host a build session for logical image [ListP] which is essentially [Main] extended with [List_prefix.thy].
zhang
parents: 29
diff changeset
    54
apply (rule_tac x = "[]" in exI, rule_tac x = s1 in exI, simp add:start)
f5db9e08effc Directory [tphols-2011] is added to host the commented version of [Myhill.thy]. Directory [pres] is created to host a build session for logical image [ListP] which is essentially [Main] extended with [List_prefix.thy].
zhang
parents: 29
diff changeset
    55
apply (simp, (erule exE| erule conjE)+)
f5db9e08effc Directory [tphols-2011] is added to host the commented version of [Myhill.thy]. Directory [pres] is created to host a build session for logical image [ListP] which is essentially [Main] extended with [List_prefix.thy].
zhang
parents: 29
diff changeset
    56
by (rule_tac x = "s1 @ a" in exI, rule_tac x = b in exI, simp add:step)
f5db9e08effc Directory [tphols-2011] is added to host the commented version of [Myhill.thy]. Directory [pres] is created to host a build session for logical image [ListP] which is essentially [Main] extended with [List_prefix.thy].
zhang
parents: 29
diff changeset
    57
f5db9e08effc Directory [tphols-2011] is added to host the commented version of [Myhill.thy]. Directory [pres] is created to host a build session for logical image [ListP] which is essentially [Main] extended with [List_prefix.thy].
zhang
parents: 29
diff changeset
    58
text {* Ardens lemma expressed at the level of language, rather than the level of regular expression. *}
f5db9e08effc Directory [tphols-2011] is added to host the commented version of [Myhill.thy]. Directory [pres] is created to host a build session for logical image [ListP] which is essentially [Main] extended with [List_prefix.thy].
zhang
parents: 29
diff changeset
    59
27
90a57a533b0c Add new file for the new definition of the hard direction's simplification.
wu
parents:
diff changeset
    60
theorem ardens_revised:
90a57a533b0c Add new file for the new definition of the hard direction's simplification.
wu
parents:
diff changeset
    61
  assumes nemp: "[] \<notin> A"
90a57a533b0c Add new file for the new definition of the hard direction's simplification.
wu
parents:
diff changeset
    62
  shows "(X = X ;; A \<union> B) \<longleftrightarrow> (X = B ;; A\<star>)"
90a57a533b0c Add new file for the new definition of the hard direction's simplification.
wu
parents:
diff changeset
    63
proof
90a57a533b0c Add new file for the new definition of the hard direction's simplification.
wu
parents:
diff changeset
    64
  assume eq: "X = B ;; A\<star>"
30
f5db9e08effc Directory [tphols-2011] is added to host the commented version of [Myhill.thy]. Directory [pres] is created to host a build session for logical image [ListP] which is essentially [Main] extended with [List_prefix.thy].
zhang
parents: 29
diff changeset
    65
  have "A\<star> =  {[]} \<union> A\<star> ;; A" 
f5db9e08effc Directory [tphols-2011] is added to host the commented version of [Myhill.thy]. Directory [pres] is created to host a build session for logical image [ListP] which is essentially [Main] extended with [List_prefix.thy].
zhang
parents: 29
diff changeset
    66
    by (auto simp:Seq_def star_intro3 star_decom')  
f5db9e08effc Directory [tphols-2011] is added to host the commented version of [Myhill.thy]. Directory [pres] is created to host a build session for logical image [ListP] which is essentially [Main] extended with [List_prefix.thy].
zhang
parents: 29
diff changeset
    67
  then have "B ;; A\<star> = B ;; ({[]} \<union> A\<star> ;; A)" 
f5db9e08effc Directory [tphols-2011] is added to host the commented version of [Myhill.thy]. Directory [pres] is created to host a build session for logical image [ListP] which is essentially [Main] extended with [List_prefix.thy].
zhang
parents: 29
diff changeset
    68
    unfolding Seq_def by simp
f5db9e08effc Directory [tphols-2011] is added to host the commented version of [Myhill.thy]. Directory [pres] is created to host a build session for logical image [ListP] which is essentially [Main] extended with [List_prefix.thy].
zhang
parents: 29
diff changeset
    69
  also have "\<dots> = B \<union> B ;; (A\<star> ;; A)"  
f5db9e08effc Directory [tphols-2011] is added to host the commented version of [Myhill.thy]. Directory [pres] is created to host a build session for logical image [ListP] which is essentially [Main] extended with [List_prefix.thy].
zhang
parents: 29
diff changeset
    70
    unfolding Seq_def by auto
f5db9e08effc Directory [tphols-2011] is added to host the commented version of [Myhill.thy]. Directory [pres] is created to host a build session for logical image [ListP] which is essentially [Main] extended with [List_prefix.thy].
zhang
parents: 29
diff changeset
    71
  also have "\<dots> = B \<union> (B ;; A\<star>) ;; A" 
f5db9e08effc Directory [tphols-2011] is added to host the commented version of [Myhill.thy]. Directory [pres] is created to host a build session for logical image [ListP] which is essentially [Main] extended with [List_prefix.thy].
zhang
parents: 29
diff changeset
    72
    by (simp only:seq_assoc)
f5db9e08effc Directory [tphols-2011] is added to host the commented version of [Myhill.thy]. Directory [pres] is created to host a build session for logical image [ListP] which is essentially [Main] extended with [List_prefix.thy].
zhang
parents: 29
diff changeset
    73
  finally show "X = X ;; A \<union> B" 
f5db9e08effc Directory [tphols-2011] is added to host the commented version of [Myhill.thy]. Directory [pres] is created to host a build session for logical image [ListP] which is essentially [Main] extended with [List_prefix.thy].
zhang
parents: 29
diff changeset
    74
    using eq by blast 
27
90a57a533b0c Add new file for the new definition of the hard direction's simplification.
wu
parents:
diff changeset
    75
next
30
f5db9e08effc Directory [tphols-2011] is added to host the commented version of [Myhill.thy]. Directory [pres] is created to host a build session for logical image [ListP] which is essentially [Main] extended with [List_prefix.thy].
zhang
parents: 29
diff changeset
    76
  assume eq': "X = X ;; A \<union> B"
f5db9e08effc Directory [tphols-2011] is added to host the commented version of [Myhill.thy]. Directory [pres] is created to host a build session for logical image [ListP] which is essentially [Main] extended with [List_prefix.thy].
zhang
parents: 29
diff changeset
    77
  hence c1': "\<And> x. x \<in> B \<Longrightarrow> x \<in> X" 
f5db9e08effc Directory [tphols-2011] is added to host the commented version of [Myhill.thy]. Directory [pres] is created to host a build session for logical image [ListP] which is essentially [Main] extended with [List_prefix.thy].
zhang
parents: 29
diff changeset
    78
    and c2': "\<And> x y. \<lbrakk>x \<in> X; y \<in> A\<rbrakk> \<Longrightarrow> x @ y \<in> X" 
f5db9e08effc Directory [tphols-2011] is added to host the commented version of [Myhill.thy]. Directory [pres] is created to host a build session for logical image [ListP] which is essentially [Main] extended with [List_prefix.thy].
zhang
parents: 29
diff changeset
    79
    using Seq_def by auto
f5db9e08effc Directory [tphols-2011] is added to host the commented version of [Myhill.thy]. Directory [pres] is created to host a build session for logical image [ListP] which is essentially [Main] extended with [List_prefix.thy].
zhang
parents: 29
diff changeset
    80
  show "X = B ;; A\<star>" 
f5db9e08effc Directory [tphols-2011] is added to host the commented version of [Myhill.thy]. Directory [pres] is created to host a build session for logical image [ListP] which is essentially [Main] extended with [List_prefix.thy].
zhang
parents: 29
diff changeset
    81
  proof
f5db9e08effc Directory [tphols-2011] is added to host the commented version of [Myhill.thy]. Directory [pres] is created to host a build session for logical image [ListP] which is essentially [Main] extended with [List_prefix.thy].
zhang
parents: 29
diff changeset
    82
    show "B ;; A\<star> \<subseteq> X"
f5db9e08effc Directory [tphols-2011] is added to host the commented version of [Myhill.thy]. Directory [pres] is created to host a build session for logical image [ListP] which is essentially [Main] extended with [List_prefix.thy].
zhang
parents: 29
diff changeset
    83
    proof-
f5db9e08effc Directory [tphols-2011] is added to host the commented version of [Myhill.thy]. Directory [pres] is created to host a build session for logical image [ListP] which is essentially [Main] extended with [List_prefix.thy].
zhang
parents: 29
diff changeset
    84
      { fix x y
f5db9e08effc Directory [tphols-2011] is added to host the commented version of [Myhill.thy]. Directory [pres] is created to host a build session for logical image [ListP] which is essentially [Main] extended with [List_prefix.thy].
zhang
parents: 29
diff changeset
    85
        have "\<lbrakk>y \<in> A\<star>; x \<in> X\<rbrakk> \<Longrightarrow> x @ y \<in> X "
f5db9e08effc Directory [tphols-2011] is added to host the commented version of [Myhill.thy]. Directory [pres] is created to host a build session for logical image [ListP] which is essentially [Main] extended with [List_prefix.thy].
zhang
parents: 29
diff changeset
    86
          apply (induct arbitrary:x rule:Star.induct, simp)
f5db9e08effc Directory [tphols-2011] is added to host the commented version of [Myhill.thy]. Directory [pres] is created to host a build session for logical image [ListP] which is essentially [Main] extended with [List_prefix.thy].
zhang
parents: 29
diff changeset
    87
          by (auto simp only:append_assoc[THEN sym] dest:c2')
f5db9e08effc Directory [tphols-2011] is added to host the commented version of [Myhill.thy]. Directory [pres] is created to host a build session for logical image [ListP] which is essentially [Main] extended with [List_prefix.thy].
zhang
parents: 29
diff changeset
    88
      } thus ?thesis using c1' by (auto simp:Seq_def) 
f5db9e08effc Directory [tphols-2011] is added to host the commented version of [Myhill.thy]. Directory [pres] is created to host a build session for logical image [ListP] which is essentially [Main] extended with [List_prefix.thy].
zhang
parents: 29
diff changeset
    89
    qed
f5db9e08effc Directory [tphols-2011] is added to host the commented version of [Myhill.thy]. Directory [pres] is created to host a build session for logical image [ListP] which is essentially [Main] extended with [List_prefix.thy].
zhang
parents: 29
diff changeset
    90
  next
f5db9e08effc Directory [tphols-2011] is added to host the commented version of [Myhill.thy]. Directory [pres] is created to host a build session for logical image [ListP] which is essentially [Main] extended with [List_prefix.thy].
zhang
parents: 29
diff changeset
    91
    show "X \<subseteq> B ;; A\<star>"
f5db9e08effc Directory [tphols-2011] is added to host the commented version of [Myhill.thy]. Directory [pres] is created to host a build session for logical image [ListP] which is essentially [Main] extended with [List_prefix.thy].
zhang
parents: 29
diff changeset
    92
    proof-
f5db9e08effc Directory [tphols-2011] is added to host the commented version of [Myhill.thy]. Directory [pres] is created to host a build session for logical image [ListP] which is essentially [Main] extended with [List_prefix.thy].
zhang
parents: 29
diff changeset
    93
      { fix x 
f5db9e08effc Directory [tphols-2011] is added to host the commented version of [Myhill.thy]. Directory [pres] is created to host a build session for logical image [ListP] which is essentially [Main] extended with [List_prefix.thy].
zhang
parents: 29
diff changeset
    94
        have "x \<in> X \<Longrightarrow> x \<in> B ;; A\<star>"
f5db9e08effc Directory [tphols-2011] is added to host the commented version of [Myhill.thy]. Directory [pres] is created to host a build session for logical image [ListP] which is essentially [Main] extended with [List_prefix.thy].
zhang
parents: 29
diff changeset
    95
        proof (induct x taking:length rule:measure_induct)
f5db9e08effc Directory [tphols-2011] is added to host the commented version of [Myhill.thy]. Directory [pres] is created to host a build session for logical image [ListP] which is essentially [Main] extended with [List_prefix.thy].
zhang
parents: 29
diff changeset
    96
          fix z
f5db9e08effc Directory [tphols-2011] is added to host the commented version of [Myhill.thy]. Directory [pres] is created to host a build session for logical image [ListP] which is essentially [Main] extended with [List_prefix.thy].
zhang
parents: 29
diff changeset
    97
          assume hyps: 
f5db9e08effc Directory [tphols-2011] is added to host the commented version of [Myhill.thy]. Directory [pres] is created to host a build session for logical image [ListP] which is essentially [Main] extended with [List_prefix.thy].
zhang
parents: 29
diff changeset
    98
            "\<forall>y. length y < length z \<longrightarrow> y \<in> X \<longrightarrow> y \<in> B ;; A\<star>" 
f5db9e08effc Directory [tphols-2011] is added to host the commented version of [Myhill.thy]. Directory [pres] is created to host a build session for logical image [ListP] which is essentially [Main] extended with [List_prefix.thy].
zhang
parents: 29
diff changeset
    99
            and z_in: "z \<in> X"
f5db9e08effc Directory [tphols-2011] is added to host the commented version of [Myhill.thy]. Directory [pres] is created to host a build session for logical image [ListP] which is essentially [Main] extended with [List_prefix.thy].
zhang
parents: 29
diff changeset
   100
          show "z \<in> B ;; A\<star>"
f5db9e08effc Directory [tphols-2011] is added to host the commented version of [Myhill.thy]. Directory [pres] is created to host a build session for logical image [ListP] which is essentially [Main] extended with [List_prefix.thy].
zhang
parents: 29
diff changeset
   101
          proof (cases "z \<in> B")
f5db9e08effc Directory [tphols-2011] is added to host the commented version of [Myhill.thy]. Directory [pres] is created to host a build session for logical image [ListP] which is essentially [Main] extended with [List_prefix.thy].
zhang
parents: 29
diff changeset
   102
            case True thus ?thesis by (auto simp:Seq_def start)
f5db9e08effc Directory [tphols-2011] is added to host the commented version of [Myhill.thy]. Directory [pres] is created to host a build session for logical image [ListP] which is essentially [Main] extended with [List_prefix.thy].
zhang
parents: 29
diff changeset
   103
          next
f5db9e08effc Directory [tphols-2011] is added to host the commented version of [Myhill.thy]. Directory [pres] is created to host a build session for logical image [ListP] which is essentially [Main] extended with [List_prefix.thy].
zhang
parents: 29
diff changeset
   104
            case False hence "z \<in> X ;; A" using eq' z_in by auto
f5db9e08effc Directory [tphols-2011] is added to host the commented version of [Myhill.thy]. Directory [pres] is created to host a build session for logical image [ListP] which is essentially [Main] extended with [List_prefix.thy].
zhang
parents: 29
diff changeset
   105
            then obtain za zb where za_in: "za \<in> X" 
f5db9e08effc Directory [tphols-2011] is added to host the commented version of [Myhill.thy]. Directory [pres] is created to host a build session for logical image [ListP] which is essentially [Main] extended with [List_prefix.thy].
zhang
parents: 29
diff changeset
   106
              and zab: "z = za @ zb \<and> zb \<in> A" and zbne: "zb \<noteq> []" 
f5db9e08effc Directory [tphols-2011] is added to host the commented version of [Myhill.thy]. Directory [pres] is created to host a build session for logical image [ListP] which is essentially [Main] extended with [List_prefix.thy].
zhang
parents: 29
diff changeset
   107
              using nemp unfolding Seq_def by blast
f5db9e08effc Directory [tphols-2011] is added to host the commented version of [Myhill.thy]. Directory [pres] is created to host a build session for logical image [ListP] which is essentially [Main] extended with [List_prefix.thy].
zhang
parents: 29
diff changeset
   108
            from zbne zab have "length za < length z" by auto
f5db9e08effc Directory [tphols-2011] is added to host the commented version of [Myhill.thy]. Directory [pres] is created to host a build session for logical image [ListP] which is essentially [Main] extended with [List_prefix.thy].
zhang
parents: 29
diff changeset
   109
            with za_in hyps have "za \<in> B ;; A\<star>" by blast
f5db9e08effc Directory [tphols-2011] is added to host the commented version of [Myhill.thy]. Directory [pres] is created to host a build session for logical image [ListP] which is essentially [Main] extended with [List_prefix.thy].
zhang
parents: 29
diff changeset
   110
            hence "za @ zb \<in> B ;; A\<star>" using zab 
f5db9e08effc Directory [tphols-2011] is added to host the commented version of [Myhill.thy]. Directory [pres] is created to host a build session for logical image [ListP] which is essentially [Main] extended with [List_prefix.thy].
zhang
parents: 29
diff changeset
   111
              by (clarsimp simp:Seq_def, blast dest:star_intro3)
f5db9e08effc Directory [tphols-2011] is added to host the commented version of [Myhill.thy]. Directory [pres] is created to host a build session for logical image [ListP] which is essentially [Main] extended with [List_prefix.thy].
zhang
parents: 29
diff changeset
   112
            thus ?thesis using zab by simp       
f5db9e08effc Directory [tphols-2011] is added to host the commented version of [Myhill.thy]. Directory [pres] is created to host a build session for logical image [ListP] which is essentially [Main] extended with [List_prefix.thy].
zhang
parents: 29
diff changeset
   113
          qed
f5db9e08effc Directory [tphols-2011] is added to host the commented version of [Myhill.thy]. Directory [pres] is created to host a build session for logical image [ListP] which is essentially [Main] extended with [List_prefix.thy].
zhang
parents: 29
diff changeset
   114
        qed 
f5db9e08effc Directory [tphols-2011] is added to host the commented version of [Myhill.thy]. Directory [pres] is created to host a build session for logical image [ListP] which is essentially [Main] extended with [List_prefix.thy].
zhang
parents: 29
diff changeset
   115
      } thus ?thesis by blast
f5db9e08effc Directory [tphols-2011] is added to host the commented version of [Myhill.thy]. Directory [pres] is created to host a build session for logical image [ListP] which is essentially [Main] extended with [List_prefix.thy].
zhang
parents: 29
diff changeset
   116
    qed
f5db9e08effc Directory [tphols-2011] is added to host the commented version of [Myhill.thy]. Directory [pres] is created to host a build session for logical image [ListP] which is essentially [Main] extended with [List_prefix.thy].
zhang
parents: 29
diff changeset
   117
  qed
27
90a57a533b0c Add new file for the new definition of the hard direction's simplification.
wu
parents:
diff changeset
   118
qed
90a57a533b0c Add new file for the new definition of the hard direction's simplification.
wu
parents:
diff changeset
   119
30
f5db9e08effc Directory [tphols-2011] is added to host the commented version of [Myhill.thy]. Directory [pres] is created to host a build session for logical image [ListP] which is essentially [Main] extended with [List_prefix.thy].
zhang
parents: 29
diff changeset
   120
f5db9e08effc Directory [tphols-2011] is added to host the commented version of [Myhill.thy]. Directory [pres] is created to host a build session for logical image [ListP] which is essentially [Main] extended with [List_prefix.thy].
zhang
parents: 29
diff changeset
   121
text {* The syntax of regular expressions is defined by the datatype @{text "rexp"}. *}
27
90a57a533b0c Add new file for the new definition of the hard direction's simplification.
wu
parents:
diff changeset
   122
datatype rexp =
90a57a533b0c Add new file for the new definition of the hard direction's simplification.
wu
parents:
diff changeset
   123
  NULL
90a57a533b0c Add new file for the new definition of the hard direction's simplification.
wu
parents:
diff changeset
   124
| EMPTY
90a57a533b0c Add new file for the new definition of the hard direction's simplification.
wu
parents:
diff changeset
   125
| CHAR char
90a57a533b0c Add new file for the new definition of the hard direction's simplification.
wu
parents:
diff changeset
   126
| SEQ rexp rexp
90a57a533b0c Add new file for the new definition of the hard direction's simplification.
wu
parents:
diff changeset
   127
| ALT rexp rexp
90a57a533b0c Add new file for the new definition of the hard direction's simplification.
wu
parents:
diff changeset
   128
| STAR rexp
90a57a533b0c Add new file for the new definition of the hard direction's simplification.
wu
parents:
diff changeset
   129
30
f5db9e08effc Directory [tphols-2011] is added to host the commented version of [Myhill.thy]. Directory [pres] is created to host a build session for logical image [ListP] which is essentially [Main] extended with [List_prefix.thy].
zhang
parents: 29
diff changeset
   130
f5db9e08effc Directory [tphols-2011] is added to host the commented version of [Myhill.thy]. Directory [pres] is created to host a build session for logical image [ListP] which is essentially [Main] extended with [List_prefix.thy].
zhang
parents: 29
diff changeset
   131
text {* 
f5db9e08effc Directory [tphols-2011] is added to host the commented version of [Myhill.thy]. Directory [pres] is created to host a build session for logical image [ListP] which is essentially [Main] extended with [List_prefix.thy].
zhang
parents: 29
diff changeset
   132
  The following @{text "L"} is an overloaded operator, where @{text "L(x)"} evaluates to 
f5db9e08effc Directory [tphols-2011] is added to host the commented version of [Myhill.thy]. Directory [pres] is created to host a build session for logical image [ListP] which is essentially [Main] extended with [List_prefix.thy].
zhang
parents: 29
diff changeset
   133
  the language represented by the syntactic object @{text "x"}.
f5db9e08effc Directory [tphols-2011] is added to host the commented version of [Myhill.thy]. Directory [pres] is created to host a build session for logical image [ListP] which is essentially [Main] extended with [List_prefix.thy].
zhang
parents: 29
diff changeset
   134
*}
27
90a57a533b0c Add new file for the new definition of the hard direction's simplification.
wu
parents:
diff changeset
   135
consts L:: "'a \<Rightarrow> string set"
90a57a533b0c Add new file for the new definition of the hard direction's simplification.
wu
parents:
diff changeset
   136
30
f5db9e08effc Directory [tphols-2011] is added to host the commented version of [Myhill.thy]. Directory [pres] is created to host a build session for logical image [ListP] which is essentially [Main] extended with [List_prefix.thy].
zhang
parents: 29
diff changeset
   137
f5db9e08effc Directory [tphols-2011] is added to host the commented version of [Myhill.thy]. Directory [pres] is created to host a build session for logical image [ListP] which is essentially [Main] extended with [List_prefix.thy].
zhang
parents: 29
diff changeset
   138
text {* 
f5db9e08effc Directory [tphols-2011] is added to host the commented version of [Myhill.thy]. Directory [pres] is created to host a build session for logical image [ListP] which is essentially [Main] extended with [List_prefix.thy].
zhang
parents: 29
diff changeset
   139
  The @{text "L(rexp)"} for regular expression @{text "rexp"} is defined by the 
f5db9e08effc Directory [tphols-2011] is added to host the commented version of [Myhill.thy]. Directory [pres] is created to host a build session for logical image [ListP] which is essentially [Main] extended with [List_prefix.thy].
zhang
parents: 29
diff changeset
   140
  following overloading function @{text "L_rexp"}.
f5db9e08effc Directory [tphols-2011] is added to host the commented version of [Myhill.thy]. Directory [pres] is created to host a build session for logical image [ListP] which is essentially [Main] extended with [List_prefix.thy].
zhang
parents: 29
diff changeset
   141
*}
27
90a57a533b0c Add new file for the new definition of the hard direction's simplification.
wu
parents:
diff changeset
   142
overloading L_rexp \<equiv> "L::  rexp \<Rightarrow> string set"
90a57a533b0c Add new file for the new definition of the hard direction's simplification.
wu
parents:
diff changeset
   143
begin
90a57a533b0c Add new file for the new definition of the hard direction's simplification.
wu
parents:
diff changeset
   144
fun
90a57a533b0c Add new file for the new definition of the hard direction's simplification.
wu
parents:
diff changeset
   145
  L_rexp :: "rexp \<Rightarrow> string set"
90a57a533b0c Add new file for the new definition of the hard direction's simplification.
wu
parents:
diff changeset
   146
where
90a57a533b0c Add new file for the new definition of the hard direction's simplification.
wu
parents:
diff changeset
   147
    "L_rexp (NULL) = {}"
90a57a533b0c Add new file for the new definition of the hard direction's simplification.
wu
parents:
diff changeset
   148
  | "L_rexp (EMPTY) = {[]}"
90a57a533b0c Add new file for the new definition of the hard direction's simplification.
wu
parents:
diff changeset
   149
  | "L_rexp (CHAR c) = {[c]}"
90a57a533b0c Add new file for the new definition of the hard direction's simplification.
wu
parents:
diff changeset
   150
  | "L_rexp (SEQ r1 r2) = (L_rexp r1) ;; (L_rexp r2)"
90a57a533b0c Add new file for the new definition of the hard direction's simplification.
wu
parents:
diff changeset
   151
  | "L_rexp (ALT r1 r2) = (L_rexp r1) \<union> (L_rexp r2)"
90a57a533b0c Add new file for the new definition of the hard direction's simplification.
wu
parents:
diff changeset
   152
  | "L_rexp (STAR r) = (L_rexp r)\<star>"
90a57a533b0c Add new file for the new definition of the hard direction's simplification.
wu
parents:
diff changeset
   153
end
90a57a533b0c Add new file for the new definition of the hard direction's simplification.
wu
parents:
diff changeset
   154
30
f5db9e08effc Directory [tphols-2011] is added to host the commented version of [Myhill.thy]. Directory [pres] is created to host a build session for logical image [ListP] which is essentially [Main] extended with [List_prefix.thy].
zhang
parents: 29
diff changeset
   155
text {*
f5db9e08effc Directory [tphols-2011] is added to host the commented version of [Myhill.thy]. Directory [pres] is created to host a build session for logical image [ListP] which is essentially [Main] extended with [List_prefix.thy].
zhang
parents: 29
diff changeset
   156
  To obtain equational system out of finite set of equivalent classes, a fold operation
f5db9e08effc Directory [tphols-2011] is added to host the commented version of [Myhill.thy]. Directory [pres] is created to host a build session for logical image [ListP] which is essentially [Main] extended with [List_prefix.thy].
zhang
parents: 29
diff changeset
   157
  on finite set @{text "folds"} is defined. The use of @{text "SOME"} makes @{text "fold"}
f5db9e08effc Directory [tphols-2011] is added to host the commented version of [Myhill.thy]. Directory [pres] is created to host a build session for logical image [ListP] which is essentially [Main] extended with [List_prefix.thy].
zhang
parents: 29
diff changeset
   158
  more robust than the @{text "fold"} in Isabelle library. The expression @{text "folds f"}
f5db9e08effc Directory [tphols-2011] is added to host the commented version of [Myhill.thy]. Directory [pres] is created to host a build session for logical image [ListP] which is essentially [Main] extended with [List_prefix.thy].
zhang
parents: 29
diff changeset
   159
  makes sense when @{text "f"} is not @{text "associative"} and @{text "commutitive"},
f5db9e08effc Directory [tphols-2011] is added to host the commented version of [Myhill.thy]. Directory [pres] is created to host a build session for logical image [ListP] which is essentially [Main] extended with [List_prefix.thy].
zhang
parents: 29
diff changeset
   160
  while @{text "fold f"} does not.  
f5db9e08effc Directory [tphols-2011] is added to host the commented version of [Myhill.thy]. Directory [pres] is created to host a build session for logical image [ListP] which is essentially [Main] extended with [List_prefix.thy].
zhang
parents: 29
diff changeset
   161
*}
f5db9e08effc Directory [tphols-2011] is added to host the commented version of [Myhill.thy]. Directory [pres] is created to host a build session for logical image [ListP] which is essentially [Main] extended with [List_prefix.thy].
zhang
parents: 29
diff changeset
   162
27
90a57a533b0c Add new file for the new definition of the hard direction's simplification.
wu
parents:
diff changeset
   163
definition 
90a57a533b0c Add new file for the new definition of the hard direction's simplification.
wu
parents:
diff changeset
   164
  folds :: "('a \<Rightarrow> 'b \<Rightarrow> 'b) \<Rightarrow> 'b \<Rightarrow> 'a set \<Rightarrow> 'b"
90a57a533b0c Add new file for the new definition of the hard direction's simplification.
wu
parents:
diff changeset
   165
where
90a57a533b0c Add new file for the new definition of the hard direction's simplification.
wu
parents:
diff changeset
   166
  "folds f z S \<equiv> SOME x. fold_graph f z S x"
90a57a533b0c Add new file for the new definition of the hard direction's simplification.
wu
parents:
diff changeset
   167
30
f5db9e08effc Directory [tphols-2011] is added to host the commented version of [Myhill.thy]. Directory [pres] is created to host a build session for logical image [ListP] which is essentially [Main] extended with [List_prefix.thy].
zhang
parents: 29
diff changeset
   168
text {* 
f5db9e08effc Directory [tphols-2011] is added to host the commented version of [Myhill.thy]. Directory [pres] is created to host a build session for logical image [ListP] which is essentially [Main] extended with [List_prefix.thy].
zhang
parents: 29
diff changeset
   169
  The following lemma assures that the arbitrary choice made by the @{text "SOME"} in @{text "folds"}
f5db9e08effc Directory [tphols-2011] is added to host the commented version of [Myhill.thy]. Directory [pres] is created to host a build session for logical image [ListP] which is essentially [Main] extended with [List_prefix.thy].
zhang
parents: 29
diff changeset
   170
  does not affect the @{text "L"}-value of the resultant regular expression. 
f5db9e08effc Directory [tphols-2011] is added to host the commented version of [Myhill.thy]. Directory [pres] is created to host a build session for logical image [ListP] which is essentially [Main] extended with [List_prefix.thy].
zhang
parents: 29
diff changeset
   171
  *}
28
cef2893f353b Rewritten of hard direction once more. To make it looking better.
wu
parents: 27
diff changeset
   172
lemma folds_alt_simp [simp]:
cef2893f353b Rewritten of hard direction once more. To make it looking better.
wu
parents: 27
diff changeset
   173
  "finite rs \<Longrightarrow> L (folds ALT NULL rs) = \<Union> (L ` rs)"
cef2893f353b Rewritten of hard direction once more. To make it looking better.
wu
parents: 27
diff changeset
   174
apply (rule set_ext, simp add:folds_def)
cef2893f353b Rewritten of hard direction once more. To make it looking better.
wu
parents: 27
diff changeset
   175
apply (rule someI2_ex, erule finite_imp_fold_graph)
cef2893f353b Rewritten of hard direction once more. To make it looking better.
wu
parents: 27
diff changeset
   176
by (erule fold_graph.induct, auto)
27
90a57a533b0c Add new file for the new definition of the hard direction's simplification.
wu
parents:
diff changeset
   177
30
f5db9e08effc Directory [tphols-2011] is added to host the commented version of [Myhill.thy]. Directory [pres] is created to host a build session for logical image [ListP] which is essentially [Main] extended with [List_prefix.thy].
zhang
parents: 29
diff changeset
   178
(* Just a technical lemma. *)
27
90a57a533b0c Add new file for the new definition of the hard direction's simplification.
wu
parents:
diff changeset
   179
lemma [simp]:
90a57a533b0c Add new file for the new definition of the hard direction's simplification.
wu
parents:
diff changeset
   180
  shows "(x, y) \<in> {(x, y). P x y} \<longleftrightarrow> P x y"
90a57a533b0c Add new file for the new definition of the hard direction's simplification.
wu
parents:
diff changeset
   181
by simp
90a57a533b0c Add new file for the new definition of the hard direction's simplification.
wu
parents:
diff changeset
   182
90a57a533b0c Add new file for the new definition of the hard direction's simplification.
wu
parents:
diff changeset
   183
30
f5db9e08effc Directory [tphols-2011] is added to host the commented version of [Myhill.thy]. Directory [pres] is created to host a build session for logical image [ListP] which is essentially [Main] extended with [List_prefix.thy].
zhang
parents: 29
diff changeset
   184
text {*
f5db9e08effc Directory [tphols-2011] is added to host the commented version of [Myhill.thy]. Directory [pres] is created to host a build session for logical image [ListP] which is essentially [Main] extended with [List_prefix.thy].
zhang
parents: 29
diff changeset
   185
  @{text "\<approx>L"} is an equivalent class defined by language @{text "Lang"}.
f5db9e08effc Directory [tphols-2011] is added to host the commented version of [Myhill.thy]. Directory [pres] is created to host a build session for logical image [ListP] which is essentially [Main] extended with [List_prefix.thy].
zhang
parents: 29
diff changeset
   186
*}
27
90a57a533b0c Add new file for the new definition of the hard direction's simplification.
wu
parents:
diff changeset
   187
definition
90a57a533b0c Add new file for the new definition of the hard direction's simplification.
wu
parents:
diff changeset
   188
  str_eq_rel ("\<approx>_")
90a57a533b0c Add new file for the new definition of the hard direction's simplification.
wu
parents:
diff changeset
   189
where
30
f5db9e08effc Directory [tphols-2011] is added to host the commented version of [Myhill.thy]. Directory [pres] is created to host a build session for logical image [ListP] which is essentially [Main] extended with [List_prefix.thy].
zhang
parents: 29
diff changeset
   190
  "\<approx>Lang \<equiv> {(x, y).  (\<forall>z. x @ z \<in> Lang \<longleftrightarrow> y @ z \<in> Lang)}"
f5db9e08effc Directory [tphols-2011] is added to host the commented version of [Myhill.thy]. Directory [pres] is created to host a build session for logical image [ListP] which is essentially [Main] extended with [List_prefix.thy].
zhang
parents: 29
diff changeset
   191
f5db9e08effc Directory [tphols-2011] is added to host the commented version of [Myhill.thy]. Directory [pres] is created to host a build session for logical image [ListP] which is essentially [Main] extended with [List_prefix.thy].
zhang
parents: 29
diff changeset
   192
text {* 
f5db9e08effc Directory [tphols-2011] is added to host the commented version of [Myhill.thy]. Directory [pres] is created to host a build session for logical image [ListP] which is essentially [Main] extended with [List_prefix.thy].
zhang
parents: 29
diff changeset
   193
  Among equivlant clases of @{text "\<approx>Lang"}, the set @{text "finals(Lang)"} singles out 
f5db9e08effc Directory [tphols-2011] is added to host the commented version of [Myhill.thy]. Directory [pres] is created to host a build session for logical image [ListP] which is essentially [Main] extended with [List_prefix.thy].
zhang
parents: 29
diff changeset
   194
  those which contains strings from @{text "Lang"}.
f5db9e08effc Directory [tphols-2011] is added to host the commented version of [Myhill.thy]. Directory [pres] is created to host a build session for logical image [ListP] which is essentially [Main] extended with [List_prefix.thy].
zhang
parents: 29
diff changeset
   195
*}
27
90a57a533b0c Add new file for the new definition of the hard direction's simplification.
wu
parents:
diff changeset
   196
30
f5db9e08effc Directory [tphols-2011] is added to host the commented version of [Myhill.thy]. Directory [pres] is created to host a build session for logical image [ListP] which is essentially [Main] extended with [List_prefix.thy].
zhang
parents: 29
diff changeset
   197
definition 
f5db9e08effc Directory [tphols-2011] is added to host the commented version of [Myhill.thy]. Directory [pres] is created to host a build session for logical image [ListP] which is essentially [Main] extended with [List_prefix.thy].
zhang
parents: 29
diff changeset
   198
   "finals Lang \<equiv> {\<approx>Lang `` {x} | x . x \<in> Lang}"
27
90a57a533b0c Add new file for the new definition of the hard direction's simplification.
wu
parents:
diff changeset
   199
30
f5db9e08effc Directory [tphols-2011] is added to host the commented version of [Myhill.thy]. Directory [pres] is created to host a build session for logical image [ListP] which is essentially [Main] extended with [List_prefix.thy].
zhang
parents: 29
diff changeset
   200
text {* 
f5db9e08effc Directory [tphols-2011] is added to host the commented version of [Myhill.thy]. Directory [pres] is created to host a build session for logical image [ListP] which is essentially [Main] extended with [List_prefix.thy].
zhang
parents: 29
diff changeset
   201
  The following lemma show the relationshipt between @{text "finals(Lang)"} and @{text "Lang"}.
f5db9e08effc Directory [tphols-2011] is added to host the commented version of [Myhill.thy]. Directory [pres] is created to host a build session for logical image [ListP] which is essentially [Main] extended with [List_prefix.thy].
zhang
parents: 29
diff changeset
   202
*}
28
cef2893f353b Rewritten of hard direction once more. To make it looking better.
wu
parents: 27
diff changeset
   203
lemma lang_is_union_of_finals: 
30
f5db9e08effc Directory [tphols-2011] is added to host the commented version of [Myhill.thy]. Directory [pres] is created to host a build session for logical image [ListP] which is essentially [Main] extended with [List_prefix.thy].
zhang
parents: 29
diff changeset
   204
  "Lang = \<Union> finals(Lang)"
28
cef2893f353b Rewritten of hard direction once more. To make it looking better.
wu
parents: 27
diff changeset
   205
proof 
30
f5db9e08effc Directory [tphols-2011] is added to host the commented version of [Myhill.thy]. Directory [pres] is created to host a build session for logical image [ListP] which is essentially [Main] extended with [List_prefix.thy].
zhang
parents: 29
diff changeset
   206
  show "Lang \<subseteq> \<Union> (finals Lang)"
28
cef2893f353b Rewritten of hard direction once more. To make it looking better.
wu
parents: 27
diff changeset
   207
  proof
cef2893f353b Rewritten of hard direction once more. To make it looking better.
wu
parents: 27
diff changeset
   208
    fix x
cef2893f353b Rewritten of hard direction once more. To make it looking better.
wu
parents: 27
diff changeset
   209
    assume "x \<in> Lang"   
30
f5db9e08effc Directory [tphols-2011] is added to host the commented version of [Myhill.thy]. Directory [pres] is created to host a build session for logical image [ListP] which is essentially [Main] extended with [List_prefix.thy].
zhang
parents: 29
diff changeset
   210
    thus "x \<in> \<Union> (finals Lang)"
f5db9e08effc Directory [tphols-2011] is added to host the commented version of [Myhill.thy]. Directory [pres] is created to host a build session for logical image [ListP] which is essentially [Main] extended with [List_prefix.thy].
zhang
parents: 29
diff changeset
   211
      apply (simp add:finals_def, rule_tac x = "(\<approx>Lang) `` {x}" in exI)
f5db9e08effc Directory [tphols-2011] is added to host the commented version of [Myhill.thy]. Directory [pres] is created to host a build session for logical image [ListP] which is essentially [Main] extended with [List_prefix.thy].
zhang
parents: 29
diff changeset
   212
      by (auto simp:Image_def str_eq_rel_def)    
28
cef2893f353b Rewritten of hard direction once more. To make it looking better.
wu
parents: 27
diff changeset
   213
  qed
cef2893f353b Rewritten of hard direction once more. To make it looking better.
wu
parents: 27
diff changeset
   214
next
30
f5db9e08effc Directory [tphols-2011] is added to host the commented version of [Myhill.thy]. Directory [pres] is created to host a build session for logical image [ListP] which is essentially [Main] extended with [List_prefix.thy].
zhang
parents: 29
diff changeset
   215
  show "\<Union> (finals Lang) \<subseteq> Lang"
f5db9e08effc Directory [tphols-2011] is added to host the commented version of [Myhill.thy]. Directory [pres] is created to host a build session for logical image [ListP] which is essentially [Main] extended with [List_prefix.thy].
zhang
parents: 29
diff changeset
   216
    apply (clarsimp simp:finals_def str_eq_rel_def)
f5db9e08effc Directory [tphols-2011] is added to host the commented version of [Myhill.thy]. Directory [pres] is created to host a build session for logical image [ListP] which is essentially [Main] extended with [List_prefix.thy].
zhang
parents: 29
diff changeset
   217
    by (drule_tac x = "[]" in spec, auto)
28
cef2893f353b Rewritten of hard direction once more. To make it looking better.
wu
parents: 27
diff changeset
   218
qed
27
90a57a533b0c Add new file for the new definition of the hard direction's simplification.
wu
parents:
diff changeset
   219
30
f5db9e08effc Directory [tphols-2011] is added to host the commented version of [Myhill.thy]. Directory [pres] is created to host a build session for logical image [ListP] which is essentially [Main] extended with [List_prefix.thy].
zhang
parents: 29
diff changeset
   220
section {* Direction @{text "finite partition \<Rightarrow> regular language"}*}
f5db9e08effc Directory [tphols-2011] is added to host the commented version of [Myhill.thy]. Directory [pres] is created to host a build session for logical image [ListP] which is essentially [Main] extended with [List_prefix.thy].
zhang
parents: 29
diff changeset
   221
f5db9e08effc Directory [tphols-2011] is added to host the commented version of [Myhill.thy]. Directory [pres] is created to host a build session for logical image [ListP] which is essentially [Main] extended with [List_prefix.thy].
zhang
parents: 29
diff changeset
   222
text {* 
f5db9e08effc Directory [tphols-2011] is added to host the commented version of [Myhill.thy]. Directory [pres] is created to host a build session for logical image [ListP] which is essentially [Main] extended with [List_prefix.thy].
zhang
parents: 29
diff changeset
   223
  The relationship between equivalent classes can be described by an
f5db9e08effc Directory [tphols-2011] is added to host the commented version of [Myhill.thy]. Directory [pres] is created to host a build session for logical image [ListP] which is essentially [Main] extended with [List_prefix.thy].
zhang
parents: 29
diff changeset
   224
  equational system.
f5db9e08effc Directory [tphols-2011] is added to host the commented version of [Myhill.thy]. Directory [pres] is created to host a build session for logical image [ListP] which is essentially [Main] extended with [List_prefix.thy].
zhang
parents: 29
diff changeset
   225
  For example, in equational system \eqref{example_eqns},  $X_0, X_1$ are equivalent 
f5db9e08effc Directory [tphols-2011] is added to host the commented version of [Myhill.thy]. Directory [pres] is created to host a build session for logical image [ListP] which is essentially [Main] extended with [List_prefix.thy].
zhang
parents: 29
diff changeset
   226
  classes. The first equation says every string in $X_0$ is obtained either by
f5db9e08effc Directory [tphols-2011] is added to host the commented version of [Myhill.thy]. Directory [pres] is created to host a build session for logical image [ListP] which is essentially [Main] extended with [List_prefix.thy].
zhang
parents: 29
diff changeset
   227
  appending one $b$ to a string in $X_0$ or by appending one $a$ to a string in
f5db9e08effc Directory [tphols-2011] is added to host the commented version of [Myhill.thy]. Directory [pres] is created to host a build session for logical image [ListP] which is essentially [Main] extended with [List_prefix.thy].
zhang
parents: 29
diff changeset
   228
  $X_1$ or just be an empty string (represented by the regular expression $\lambda$). Similary,
f5db9e08effc Directory [tphols-2011] is added to host the commented version of [Myhill.thy]. Directory [pres] is created to host a build session for logical image [ListP] which is essentially [Main] extended with [List_prefix.thy].
zhang
parents: 29
diff changeset
   229
  the second equation tells how the strings inside $X_1$ are composed.
f5db9e08effc Directory [tphols-2011] is added to host the commented version of [Myhill.thy]. Directory [pres] is created to host a build session for logical image [ListP] which is essentially [Main] extended with [List_prefix.thy].
zhang
parents: 29
diff changeset
   230
  \begin{equation}\label{example_eqns}
f5db9e08effc Directory [tphols-2011] is added to host the commented version of [Myhill.thy]. Directory [pres] is created to host a build session for logical image [ListP] which is essentially [Main] extended with [List_prefix.thy].
zhang
parents: 29
diff changeset
   231
    \begin{aligned}
f5db9e08effc Directory [tphols-2011] is added to host the commented version of [Myhill.thy]. Directory [pres] is created to host a build session for logical image [ListP] which is essentially [Main] extended with [List_prefix.thy].
zhang
parents: 29
diff changeset
   232
      X_0 & = X_0 b + X_1 a + \lambda \\
f5db9e08effc Directory [tphols-2011] is added to host the commented version of [Myhill.thy]. Directory [pres] is created to host a build session for logical image [ListP] which is essentially [Main] extended with [List_prefix.thy].
zhang
parents: 29
diff changeset
   233
      X_1 & = X_0 a + X_1 b
f5db9e08effc Directory [tphols-2011] is added to host the commented version of [Myhill.thy]. Directory [pres] is created to host a build session for logical image [ListP] which is essentially [Main] extended with [List_prefix.thy].
zhang
parents: 29
diff changeset
   234
    \end{aligned}
f5db9e08effc Directory [tphols-2011] is added to host the commented version of [Myhill.thy]. Directory [pres] is created to host a build session for logical image [ListP] which is essentially [Main] extended with [List_prefix.thy].
zhang
parents: 29
diff changeset
   235
  \end{equation}
f5db9e08effc Directory [tphols-2011] is added to host the commented version of [Myhill.thy]. Directory [pres] is created to host a build session for logical image [ListP] which is essentially [Main] extended with [List_prefix.thy].
zhang
parents: 29
diff changeset
   236
  The summands on the right hand side is represented by the following data type
f5db9e08effc Directory [tphols-2011] is added to host the commented version of [Myhill.thy]. Directory [pres] is created to host a build session for logical image [ListP] which is essentially [Main] extended with [List_prefix.thy].
zhang
parents: 29
diff changeset
   237
  @{text "rhs_item"}, mnemonic for 'right hand side item'.
f5db9e08effc Directory [tphols-2011] is added to host the commented version of [Myhill.thy]. Directory [pres] is created to host a build session for logical image [ListP] which is essentially [Main] extended with [List_prefix.thy].
zhang
parents: 29
diff changeset
   238
  Generally, there are two kinds of right hand side items, one kind corresponds to
f5db9e08effc Directory [tphols-2011] is added to host the commented version of [Myhill.thy]. Directory [pres] is created to host a build session for logical image [ListP] which is essentially [Main] extended with [List_prefix.thy].
zhang
parents: 29
diff changeset
   239
  pure regular expressions, like the $\lambda$ in \eqref{example_eqns}, the other kind corresponds to
f5db9e08effc Directory [tphols-2011] is added to host the commented version of [Myhill.thy]. Directory [pres] is created to host a build session for logical image [ListP] which is essentially [Main] extended with [List_prefix.thy].
zhang
parents: 29
diff changeset
   240
  transitions from one one equivalent class to another, like the $X_0 b, X_1 a$ etc.
f5db9e08effc Directory [tphols-2011] is added to host the commented version of [Myhill.thy]. Directory [pres] is created to host a build session for logical image [ListP] which is essentially [Main] extended with [List_prefix.thy].
zhang
parents: 29
diff changeset
   241
  *}
27
90a57a533b0c Add new file for the new definition of the hard direction's simplification.
wu
parents:
diff changeset
   242
28
cef2893f353b Rewritten of hard direction once more. To make it looking better.
wu
parents: 27
diff changeset
   243
datatype rhs_item = 
cef2893f353b Rewritten of hard direction once more. To make it looking better.
wu
parents: 27
diff changeset
   244
   Lam "rexp"                           (* Lambda *)
30
f5db9e08effc Directory [tphols-2011] is added to host the commented version of [Myhill.thy]. Directory [pres] is created to host a build session for logical image [ListP] which is essentially [Main] extended with [List_prefix.thy].
zhang
parents: 29
diff changeset
   245
 | Trn "(string set)" "rexp"              (* Transition *)
27
90a57a533b0c Add new file for the new definition of the hard direction's simplification.
wu
parents:
diff changeset
   246
30
f5db9e08effc Directory [tphols-2011] is added to host the commented version of [Myhill.thy]. Directory [pres] is created to host a build session for logical image [ListP] which is essentially [Main] extended with [List_prefix.thy].
zhang
parents: 29
diff changeset
   247
text {*
f5db9e08effc Directory [tphols-2011] is added to host the commented version of [Myhill.thy]. Directory [pres] is created to host a build session for logical image [ListP] which is essentially [Main] extended with [List_prefix.thy].
zhang
parents: 29
diff changeset
   248
  In this formalization, pure regular expressions like $\lambda$ is 
f5db9e08effc Directory [tphols-2011] is added to host the commented version of [Myhill.thy]. Directory [pres] is created to host a build session for logical image [ListP] which is essentially [Main] extended with [List_prefix.thy].
zhang
parents: 29
diff changeset
   249
  repsented by @{text "Lam(EMPTY)"}, while transitions like $X_0 a$ is represented by $Trn~X_0~(CHAR~a)$.
f5db9e08effc Directory [tphols-2011] is added to host the commented version of [Myhill.thy]. Directory [pres] is created to host a build session for logical image [ListP] which is essentially [Main] extended with [List_prefix.thy].
zhang
parents: 29
diff changeset
   250
  *}
f5db9e08effc Directory [tphols-2011] is added to host the commented version of [Myhill.thy]. Directory [pres] is created to host a build session for logical image [ListP] which is essentially [Main] extended with [List_prefix.thy].
zhang
parents: 29
diff changeset
   251
f5db9e08effc Directory [tphols-2011] is added to host the commented version of [Myhill.thy]. Directory [pres] is created to host a build session for logical image [ListP] which is essentially [Main] extended with [List_prefix.thy].
zhang
parents: 29
diff changeset
   252
text {*
f5db9e08effc Directory [tphols-2011] is added to host the commented version of [Myhill.thy]. Directory [pres] is created to host a build session for logical image [ListP] which is essentially [Main] extended with [List_prefix.thy].
zhang
parents: 29
diff changeset
   253
  The functions @{text "the_r"} and @{text "the_Trn"} are used to extract
f5db9e08effc Directory [tphols-2011] is added to host the commented version of [Myhill.thy]. Directory [pres] is created to host a build session for logical image [ListP] which is essentially [Main] extended with [List_prefix.thy].
zhang
parents: 29
diff changeset
   254
  subcomponents from right hand side items.
f5db9e08effc Directory [tphols-2011] is added to host the commented version of [Myhill.thy]. Directory [pres] is created to host a build session for logical image [ListP] which is essentially [Main] extended with [List_prefix.thy].
zhang
parents: 29
diff changeset
   255
  *}
28
cef2893f353b Rewritten of hard direction once more. To make it looking better.
wu
parents: 27
diff changeset
   256
cef2893f353b Rewritten of hard direction once more. To make it looking better.
wu
parents: 27
diff changeset
   257
fun the_r :: "rhs_item \<Rightarrow> rexp"
cef2893f353b Rewritten of hard direction once more. To make it looking better.
wu
parents: 27
diff changeset
   258
where "the_r (Lam r) = r"
27
90a57a533b0c Add new file for the new definition of the hard direction's simplification.
wu
parents:
diff changeset
   259
30
f5db9e08effc Directory [tphols-2011] is added to host the commented version of [Myhill.thy]. Directory [pres] is created to host a build session for logical image [ListP] which is essentially [Main] extended with [List_prefix.thy].
zhang
parents: 29
diff changeset
   260
fun the_Trn:: "rhs_item \<Rightarrow> (string set \<times> rexp)"
f5db9e08effc Directory [tphols-2011] is added to host the commented version of [Myhill.thy]. Directory [pres] is created to host a build session for logical image [ListP] which is essentially [Main] extended with [List_prefix.thy].
zhang
parents: 29
diff changeset
   261
where "the_Trn (Trn Y r) = (Y, r)"
f5db9e08effc Directory [tphols-2011] is added to host the commented version of [Myhill.thy]. Directory [pres] is created to host a build session for logical image [ListP] which is essentially [Main] extended with [List_prefix.thy].
zhang
parents: 29
diff changeset
   262
f5db9e08effc Directory [tphols-2011] is added to host the commented version of [Myhill.thy]. Directory [pres] is created to host a build session for logical image [ListP] which is essentially [Main] extended with [List_prefix.thy].
zhang
parents: 29
diff changeset
   263
text {*
f5db9e08effc Directory [tphols-2011] is added to host the commented version of [Myhill.thy]. Directory [pres] is created to host a build session for logical image [ListP] which is essentially [Main] extended with [List_prefix.thy].
zhang
parents: 29
diff changeset
   264
  Every right hand side item @{text "itm"} defines a string set given 
f5db9e08effc Directory [tphols-2011] is added to host the commented version of [Myhill.thy]. Directory [pres] is created to host a build session for logical image [ListP] which is essentially [Main] extended with [List_prefix.thy].
zhang
parents: 29
diff changeset
   265
  @{text "L(itm)"}, defined as:
f5db9e08effc Directory [tphols-2011] is added to host the commented version of [Myhill.thy]. Directory [pres] is created to host a build session for logical image [ListP] which is essentially [Main] extended with [List_prefix.thy].
zhang
parents: 29
diff changeset
   266
*}
28
cef2893f353b Rewritten of hard direction once more. To make it looking better.
wu
parents: 27
diff changeset
   267
overloading L_rhs_e \<equiv> "L:: rhs_item \<Rightarrow> string set"
cef2893f353b Rewritten of hard direction once more. To make it looking better.
wu
parents: 27
diff changeset
   268
begin
30
f5db9e08effc Directory [tphols-2011] is added to host the commented version of [Myhill.thy]. Directory [pres] is created to host a build session for logical image [ListP] which is essentially [Main] extended with [List_prefix.thy].
zhang
parents: 29
diff changeset
   269
  fun L_rhs_e:: "rhs_item \<Rightarrow> string set"
f5db9e08effc Directory [tphols-2011] is added to host the commented version of [Myhill.thy]. Directory [pres] is created to host a build session for logical image [ListP] which is essentially [Main] extended with [List_prefix.thy].
zhang
parents: 29
diff changeset
   270
  where
f5db9e08effc Directory [tphols-2011] is added to host the commented version of [Myhill.thy]. Directory [pres] is created to host a build session for logical image [ListP] which is essentially [Main] extended with [List_prefix.thy].
zhang
parents: 29
diff changeset
   271
     "L_rhs_e (Lam r) = L r" |
f5db9e08effc Directory [tphols-2011] is added to host the commented version of [Myhill.thy]. Directory [pres] is created to host a build session for logical image [ListP] which is essentially [Main] extended with [List_prefix.thy].
zhang
parents: 29
diff changeset
   272
     "L_rhs_e (Trn X r) = X ;; L r"
28
cef2893f353b Rewritten of hard direction once more. To make it looking better.
wu
parents: 27
diff changeset
   273
end
27
90a57a533b0c Add new file for the new definition of the hard direction's simplification.
wu
parents:
diff changeset
   274
30
f5db9e08effc Directory [tphols-2011] is added to host the commented version of [Myhill.thy]. Directory [pres] is created to host a build session for logical image [ListP] which is essentially [Main] extended with [List_prefix.thy].
zhang
parents: 29
diff changeset
   275
text {*
f5db9e08effc Directory [tphols-2011] is added to host the commented version of [Myhill.thy]. Directory [pres] is created to host a build session for logical image [ListP] which is essentially [Main] extended with [List_prefix.thy].
zhang
parents: 29
diff changeset
   276
  The right hand side of every equation is represented by a set of
f5db9e08effc Directory [tphols-2011] is added to host the commented version of [Myhill.thy]. Directory [pres] is created to host a build session for logical image [ListP] which is essentially [Main] extended with [List_prefix.thy].
zhang
parents: 29
diff changeset
   277
  items. The string set defined by such a set @{text "itms"} is given
f5db9e08effc Directory [tphols-2011] is added to host the commented version of [Myhill.thy]. Directory [pres] is created to host a build session for logical image [ListP] which is essentially [Main] extended with [List_prefix.thy].
zhang
parents: 29
diff changeset
   278
  by @{text "L(itms)"}, defined as:
f5db9e08effc Directory [tphols-2011] is added to host the commented version of [Myhill.thy]. Directory [pres] is created to host a build session for logical image [ListP] which is essentially [Main] extended with [List_prefix.thy].
zhang
parents: 29
diff changeset
   279
*}
f5db9e08effc Directory [tphols-2011] is added to host the commented version of [Myhill.thy]. Directory [pres] is created to host a build session for logical image [ListP] which is essentially [Main] extended with [List_prefix.thy].
zhang
parents: 29
diff changeset
   280
28
cef2893f353b Rewritten of hard direction once more. To make it looking better.
wu
parents: 27
diff changeset
   281
overloading L_rhs \<equiv> "L:: rhs_item set \<Rightarrow> string set"
27
90a57a533b0c Add new file for the new definition of the hard direction's simplification.
wu
parents:
diff changeset
   282
begin
30
f5db9e08effc Directory [tphols-2011] is added to host the commented version of [Myhill.thy]. Directory [pres] is created to host a build session for logical image [ListP] which is essentially [Main] extended with [List_prefix.thy].
zhang
parents: 29
diff changeset
   283
   fun L_rhs:: "rhs_item set \<Rightarrow> string set"
f5db9e08effc Directory [tphols-2011] is added to host the commented version of [Myhill.thy]. Directory [pres] is created to host a build session for logical image [ListP] which is essentially [Main] extended with [List_prefix.thy].
zhang
parents: 29
diff changeset
   284
   where "L_rhs rhs = \<Union> (L ` rhs)"
27
90a57a533b0c Add new file for the new definition of the hard direction's simplification.
wu
parents:
diff changeset
   285
end
90a57a533b0c Add new file for the new definition of the hard direction's simplification.
wu
parents:
diff changeset
   286
30
f5db9e08effc Directory [tphols-2011] is added to host the commented version of [Myhill.thy]. Directory [pres] is created to host a build session for logical image [ListP] which is essentially [Main] extended with [List_prefix.thy].
zhang
parents: 29
diff changeset
   287
text {* 
f5db9e08effc Directory [tphols-2011] is added to host the commented version of [Myhill.thy]. Directory [pres] is created to host a build session for logical image [ListP] which is essentially [Main] extended with [List_prefix.thy].
zhang
parents: 29
diff changeset
   288
  Given a set of equivalent classses @{text "CS"} and one equivalent class @{text "X"} among
f5db9e08effc Directory [tphols-2011] is added to host the commented version of [Myhill.thy]. Directory [pres] is created to host a build session for logical image [ListP] which is essentially [Main] extended with [List_prefix.thy].
zhang
parents: 29
diff changeset
   289
  @{text "CS"}, the term @{text "init_rhs CS X"} is used to extract the right hand side of
f5db9e08effc Directory [tphols-2011] is added to host the commented version of [Myhill.thy]. Directory [pres] is created to host a build session for logical image [ListP] which is essentially [Main] extended with [List_prefix.thy].
zhang
parents: 29
diff changeset
   290
  the equation describing the formation of @{text "X"}. The definition of @{text "init_rhs"}
f5db9e08effc Directory [tphols-2011] is added to host the commented version of [Myhill.thy]. Directory [pres] is created to host a build session for logical image [ListP] which is essentially [Main] extended with [List_prefix.thy].
zhang
parents: 29
diff changeset
   291
  is:
f5db9e08effc Directory [tphols-2011] is added to host the commented version of [Myhill.thy]. Directory [pres] is created to host a build session for logical image [ListP] which is essentially [Main] extended with [List_prefix.thy].
zhang
parents: 29
diff changeset
   292
  *}
f5db9e08effc Directory [tphols-2011] is added to host the commented version of [Myhill.thy]. Directory [pres] is created to host a build session for logical image [ListP] which is essentially [Main] extended with [List_prefix.thy].
zhang
parents: 29
diff changeset
   293
27
90a57a533b0c Add new file for the new definition of the hard direction's simplification.
wu
parents:
diff changeset
   294
definition
30
f5db9e08effc Directory [tphols-2011] is added to host the commented version of [Myhill.thy]. Directory [pres] is created to host a build session for logical image [ListP] which is essentially [Main] extended with [List_prefix.thy].
zhang
parents: 29
diff changeset
   295
  "init_rhs CS X \<equiv>  
f5db9e08effc Directory [tphols-2011] is added to host the commented version of [Myhill.thy]. Directory [pres] is created to host a build session for logical image [ListP] which is essentially [Main] extended with [List_prefix.thy].
zhang
parents: 29
diff changeset
   296
      if ([] \<in> X) then 
f5db9e08effc Directory [tphols-2011] is added to host the commented version of [Myhill.thy]. Directory [pres] is created to host a build session for logical image [ListP] which is essentially [Main] extended with [List_prefix.thy].
zhang
parents: 29
diff changeset
   297
          {Lam(EMPTY)} \<union> {Trn Y (CHAR c) | Y c. Y \<in> CS \<and> Y ;; {[c]} \<subseteq> X}
f5db9e08effc Directory [tphols-2011] is added to host the commented version of [Myhill.thy]. Directory [pres] is created to host a build session for logical image [ListP] which is essentially [Main] extended with [List_prefix.thy].
zhang
parents: 29
diff changeset
   298
      else 
f5db9e08effc Directory [tphols-2011] is added to host the commented version of [Myhill.thy]. Directory [pres] is created to host a build session for logical image [ListP] which is essentially [Main] extended with [List_prefix.thy].
zhang
parents: 29
diff changeset
   299
          {Trn Y (CHAR c)| Y c. Y \<in> CS \<and> Y ;; {[c]} \<subseteq> X}"
27
90a57a533b0c Add new file for the new definition of the hard direction's simplification.
wu
parents:
diff changeset
   300
30
f5db9e08effc Directory [tphols-2011] is added to host the commented version of [Myhill.thy]. Directory [pres] is created to host a build session for logical image [ListP] which is essentially [Main] extended with [List_prefix.thy].
zhang
parents: 29
diff changeset
   301
text {*
f5db9e08effc Directory [tphols-2011] is added to host the commented version of [Myhill.thy]. Directory [pres] is created to host a build session for logical image [ListP] which is essentially [Main] extended with [List_prefix.thy].
zhang
parents: 29
diff changeset
   302
  In the definition of @{text "init_rhs"}, the term 
f5db9e08effc Directory [tphols-2011] is added to host the commented version of [Myhill.thy]. Directory [pres] is created to host a build session for logical image [ListP] which is essentially [Main] extended with [List_prefix.thy].
zhang
parents: 29
diff changeset
   303
  @{text "{Trn Y (CHAR c)| Y c. Y \<in> CS \<and> Y ;; {[c]} \<subseteq> X}"} appearing on both branches
f5db9e08effc Directory [tphols-2011] is added to host the commented version of [Myhill.thy]. Directory [pres] is created to host a build session for logical image [ListP] which is essentially [Main] extended with [List_prefix.thy].
zhang
parents: 29
diff changeset
   304
  describes the formation of strings in @{text "X"} out of transitions, while 
f5db9e08effc Directory [tphols-2011] is added to host the commented version of [Myhill.thy]. Directory [pres] is created to host a build session for logical image [ListP] which is essentially [Main] extended with [List_prefix.thy].
zhang
parents: 29
diff changeset
   305
  the term @{text "{Lam(EMPTY)}"} describes the empty string which is intrinsically contained in
f5db9e08effc Directory [tphols-2011] is added to host the commented version of [Myhill.thy]. Directory [pres] is created to host a build session for logical image [ListP] which is essentially [Main] extended with [List_prefix.thy].
zhang
parents: 29
diff changeset
   306
  @{text "X"} rather than by transition. This @{text "{Lam(EMPTY)}"} corresponds to 
f5db9e08effc Directory [tphols-2011] is added to host the commented version of [Myhill.thy]. Directory [pres] is created to host a build session for logical image [ListP] which is essentially [Main] extended with [List_prefix.thy].
zhang
parents: 29
diff changeset
   307
  the $\lambda$ in \eqref{example_eqns}.
27
90a57a533b0c Add new file for the new definition of the hard direction's simplification.
wu
parents:
diff changeset
   308
30
f5db9e08effc Directory [tphols-2011] is added to host the commented version of [Myhill.thy]. Directory [pres] is created to host a build session for logical image [ListP] which is essentially [Main] extended with [List_prefix.thy].
zhang
parents: 29
diff changeset
   309
  With the help of @{text "init_rhs"}, the equitional system descrbing the formation of every
f5db9e08effc Directory [tphols-2011] is added to host the commented version of [Myhill.thy]. Directory [pres] is created to host a build session for logical image [ListP] which is essentially [Main] extended with [List_prefix.thy].
zhang
parents: 29
diff changeset
   310
  equivalent class inside @{text "CS"} is given by the following @{text "eqs(CS)"}.
f5db9e08effc Directory [tphols-2011] is added to host the commented version of [Myhill.thy]. Directory [pres] is created to host a build session for logical image [ListP] which is essentially [Main] extended with [List_prefix.thy].
zhang
parents: 29
diff changeset
   311
  *}
f5db9e08effc Directory [tphols-2011] is added to host the commented version of [Myhill.thy]. Directory [pres] is created to host a build session for logical image [ListP] which is essentially [Main] extended with [List_prefix.thy].
zhang
parents: 29
diff changeset
   312
f5db9e08effc Directory [tphols-2011] is added to host the commented version of [Myhill.thy]. Directory [pres] is created to host a build session for logical image [ListP] which is essentially [Main] extended with [List_prefix.thy].
zhang
parents: 29
diff changeset
   313
definition "eqs CS \<equiv> {(X, init_rhs CS X) | X.  X \<in> CS}"
27
90a57a533b0c Add new file for the new definition of the hard direction's simplification.
wu
parents:
diff changeset
   314
(************ arden's lemma variation ********************)
28
cef2893f353b Rewritten of hard direction once more. To make it looking better.
wu
parents: 27
diff changeset
   315
30
f5db9e08effc Directory [tphols-2011] is added to host the commented version of [Myhill.thy]. Directory [pres] is created to host a build session for logical image [ListP] which is essentially [Main] extended with [List_prefix.thy].
zhang
parents: 29
diff changeset
   316
text {* 
f5db9e08effc Directory [tphols-2011] is added to host the commented version of [Myhill.thy]. Directory [pres] is created to host a build session for logical image [ListP] which is essentially [Main] extended with [List_prefix.thy].
zhang
parents: 29
diff changeset
   317
  The following @{text "items_of rhs X"} returns all @{text "X"}-items in @{text "rhs"}.
f5db9e08effc Directory [tphols-2011] is added to host the commented version of [Myhill.thy]. Directory [pres] is created to host a build session for logical image [ListP] which is essentially [Main] extended with [List_prefix.thy].
zhang
parents: 29
diff changeset
   318
  *}
28
cef2893f353b Rewritten of hard direction once more. To make it looking better.
wu
parents: 27
diff changeset
   319
definition
cef2893f353b Rewritten of hard direction once more. To make it looking better.
wu
parents: 27
diff changeset
   320
  "items_of rhs X \<equiv> {Trn X r | r. (Trn X r) \<in> rhs}"
cef2893f353b Rewritten of hard direction once more. To make it looking better.
wu
parents: 27
diff changeset
   321
30
f5db9e08effc Directory [tphols-2011] is added to host the commented version of [Myhill.thy]. Directory [pres] is created to host a build session for logical image [ListP] which is essentially [Main] extended with [List_prefix.thy].
zhang
parents: 29
diff changeset
   322
text {* 
f5db9e08effc Directory [tphols-2011] is added to host the commented version of [Myhill.thy]. Directory [pres] is created to host a build session for logical image [ListP] which is essentially [Main] extended with [List_prefix.thy].
zhang
parents: 29
diff changeset
   323
  The following @{text "rexp_of rhs X"} combines all regular expressions in @{text "X"}-items
f5db9e08effc Directory [tphols-2011] is added to host the commented version of [Myhill.thy]. Directory [pres] is created to host a build session for logical image [ListP] which is essentially [Main] extended with [List_prefix.thy].
zhang
parents: 29
diff changeset
   324
  using @{text "ALT"} to form a single regular expression. 
f5db9e08effc Directory [tphols-2011] is added to host the commented version of [Myhill.thy]. Directory [pres] is created to host a build session for logical image [ListP] which is essentially [Main] extended with [List_prefix.thy].
zhang
parents: 29
diff changeset
   325
  It will be used later to implement @{text "arden_variate"} and @{text "rhs_subst"}.
f5db9e08effc Directory [tphols-2011] is added to host the commented version of [Myhill.thy]. Directory [pres] is created to host a build session for logical image [ListP] which is essentially [Main] extended with [List_prefix.thy].
zhang
parents: 29
diff changeset
   326
  *}
f5db9e08effc Directory [tphols-2011] is added to host the commented version of [Myhill.thy]. Directory [pres] is created to host a build session for logical image [ListP] which is essentially [Main] extended with [List_prefix.thy].
zhang
parents: 29
diff changeset
   327
f5db9e08effc Directory [tphols-2011] is added to host the commented version of [Myhill.thy]. Directory [pres] is created to host a build session for logical image [ListP] which is essentially [Main] extended with [List_prefix.thy].
zhang
parents: 29
diff changeset
   328
definition 
f5db9e08effc Directory [tphols-2011] is added to host the commented version of [Myhill.thy]. Directory [pres] is created to host a build session for logical image [ListP] which is essentially [Main] extended with [List_prefix.thy].
zhang
parents: 29
diff changeset
   329
  "rexp_of rhs X \<equiv> folds ALT NULL ((snd o the_Trn) ` items_of rhs X)"
f5db9e08effc Directory [tphols-2011] is added to host the commented version of [Myhill.thy]. Directory [pres] is created to host a build session for logical image [ListP] which is essentially [Main] extended with [List_prefix.thy].
zhang
parents: 29
diff changeset
   330
f5db9e08effc Directory [tphols-2011] is added to host the commented version of [Myhill.thy]. Directory [pres] is created to host a build session for logical image [ListP] which is essentially [Main] extended with [List_prefix.thy].
zhang
parents: 29
diff changeset
   331
text {* 
f5db9e08effc Directory [tphols-2011] is added to host the commented version of [Myhill.thy]. Directory [pres] is created to host a build session for logical image [ListP] which is essentially [Main] extended with [List_prefix.thy].
zhang
parents: 29
diff changeset
   332
  The following @{text "lam_of rhs"} returns all pure regular expression items in @{text "rhs"}.
f5db9e08effc Directory [tphols-2011] is added to host the commented version of [Myhill.thy]. Directory [pres] is created to host a build session for logical image [ListP] which is essentially [Main] extended with [List_prefix.thy].
zhang
parents: 29
diff changeset
   333
  *}
f5db9e08effc Directory [tphols-2011] is added to host the commented version of [Myhill.thy]. Directory [pres] is created to host a build session for logical image [ListP] which is essentially [Main] extended with [List_prefix.thy].
zhang
parents: 29
diff changeset
   334
28
cef2893f353b Rewritten of hard direction once more. To make it looking better.
wu
parents: 27
diff changeset
   335
definition
cef2893f353b Rewritten of hard direction once more. To make it looking better.
wu
parents: 27
diff changeset
   336
  "lam_of rhs \<equiv> {Lam r | r. Lam r \<in> rhs}"
27
90a57a533b0c Add new file for the new definition of the hard direction's simplification.
wu
parents:
diff changeset
   337
30
f5db9e08effc Directory [tphols-2011] is added to host the commented version of [Myhill.thy]. Directory [pres] is created to host a build session for logical image [ListP] which is essentially [Main] extended with [List_prefix.thy].
zhang
parents: 29
diff changeset
   338
text {*
f5db9e08effc Directory [tphols-2011] is added to host the commented version of [Myhill.thy]. Directory [pres] is created to host a build session for logical image [ListP] which is essentially [Main] extended with [List_prefix.thy].
zhang
parents: 29
diff changeset
   339
  The following @{text "rexp_of_lam rhs"} combines pure regular expression items in @{text "rhs"}
f5db9e08effc Directory [tphols-2011] is added to host the commented version of [Myhill.thy]. Directory [pres] is created to host a build session for logical image [ListP] which is essentially [Main] extended with [List_prefix.thy].
zhang
parents: 29
diff changeset
   340
  using @{text "ALT"} to form a single regular expression. 
f5db9e08effc Directory [tphols-2011] is added to host the commented version of [Myhill.thy]. Directory [pres] is created to host a build session for logical image [ListP] which is essentially [Main] extended with [List_prefix.thy].
zhang
parents: 29
diff changeset
   341
  When all variables inside @{text "rhs"} are eliminated, @{text "rexp_of_lam rhs"}
f5db9e08effc Directory [tphols-2011] is added to host the commented version of [Myhill.thy]. Directory [pres] is created to host a build session for logical image [ListP] which is essentially [Main] extended with [List_prefix.thy].
zhang
parents: 29
diff changeset
   342
  is used to compute compute the regular expression corresponds to @{text "rhs"}.
f5db9e08effc Directory [tphols-2011] is added to host the commented version of [Myhill.thy]. Directory [pres] is created to host a build session for logical image [ListP] which is essentially [Main] extended with [List_prefix.thy].
zhang
parents: 29
diff changeset
   343
  *}
28
cef2893f353b Rewritten of hard direction once more. To make it looking better.
wu
parents: 27
diff changeset
   344
cef2893f353b Rewritten of hard direction once more. To make it looking better.
wu
parents: 27
diff changeset
   345
definition
cef2893f353b Rewritten of hard direction once more. To make it looking better.
wu
parents: 27
diff changeset
   346
  "rexp_of_lam rhs \<equiv> folds ALT NULL (the_r ` lam_of rhs)"
27
90a57a533b0c Add new file for the new definition of the hard direction's simplification.
wu
parents:
diff changeset
   347
30
f5db9e08effc Directory [tphols-2011] is added to host the commented version of [Myhill.thy]. Directory [pres] is created to host a build session for logical image [ListP] which is essentially [Main] extended with [List_prefix.thy].
zhang
parents: 29
diff changeset
   348
text {*
f5db9e08effc Directory [tphols-2011] is added to host the commented version of [Myhill.thy]. Directory [pres] is created to host a build session for logical image [ListP] which is essentially [Main] extended with [List_prefix.thy].
zhang
parents: 29
diff changeset
   349
  The following @{text "attach_rexp rexp' itm"} attach 
f5db9e08effc Directory [tphols-2011] is added to host the commented version of [Myhill.thy]. Directory [pres] is created to host a build session for logical image [ListP] which is essentially [Main] extended with [List_prefix.thy].
zhang
parents: 29
diff changeset
   350
  the regular expression @{text "rexp'"} to
f5db9e08effc Directory [tphols-2011] is added to host the commented version of [Myhill.thy]. Directory [pres] is created to host a build session for logical image [ListP] which is essentially [Main] extended with [List_prefix.thy].
zhang
parents: 29
diff changeset
   351
  the right of right hand side item @{text "itm"}.
f5db9e08effc Directory [tphols-2011] is added to host the commented version of [Myhill.thy]. Directory [pres] is created to host a build session for logical image [ListP] which is essentially [Main] extended with [List_prefix.thy].
zhang
parents: 29
diff changeset
   352
  *}
f5db9e08effc Directory [tphols-2011] is added to host the commented version of [Myhill.thy]. Directory [pres] is created to host a build session for logical image [ListP] which is essentially [Main] extended with [List_prefix.thy].
zhang
parents: 29
diff changeset
   353
28
cef2893f353b Rewritten of hard direction once more. To make it looking better.
wu
parents: 27
diff changeset
   354
fun attach_rexp :: "rexp \<Rightarrow> rhs_item \<Rightarrow> rhs_item"
cef2893f353b Rewritten of hard direction once more. To make it looking better.
wu
parents: 27
diff changeset
   355
where
30
f5db9e08effc Directory [tphols-2011] is added to host the commented version of [Myhill.thy]. Directory [pres] is created to host a build session for logical image [ListP] which is essentially [Main] extended with [List_prefix.thy].
zhang
parents: 29
diff changeset
   356
  "attach_rexp rexp' (Lam rexp)   = Lam (SEQ rexp rexp')"
f5db9e08effc Directory [tphols-2011] is added to host the commented version of [Myhill.thy]. Directory [pres] is created to host a build session for logical image [ListP] which is essentially [Main] extended with [List_prefix.thy].
zhang
parents: 29
diff changeset
   357
| "attach_rexp rexp' (Trn X rexp) = Trn X (SEQ rexp rexp')"
f5db9e08effc Directory [tphols-2011] is added to host the commented version of [Myhill.thy]. Directory [pres] is created to host a build session for logical image [ListP] which is essentially [Main] extended with [List_prefix.thy].
zhang
parents: 29
diff changeset
   358
f5db9e08effc Directory [tphols-2011] is added to host the commented version of [Myhill.thy]. Directory [pres] is created to host a build session for logical image [ListP] which is essentially [Main] extended with [List_prefix.thy].
zhang
parents: 29
diff changeset
   359
text {* 
f5db9e08effc Directory [tphols-2011] is added to host the commented version of [Myhill.thy]. Directory [pres] is created to host a build session for logical image [ListP] which is essentially [Main] extended with [List_prefix.thy].
zhang
parents: 29
diff changeset
   360
  The following @{text "append_rhs_rexp rhs rexp"} attaches 
f5db9e08effc Directory [tphols-2011] is added to host the commented version of [Myhill.thy]. Directory [pres] is created to host a build session for logical image [ListP] which is essentially [Main] extended with [List_prefix.thy].
zhang
parents: 29
diff changeset
   361
  @{text "rexp"} to every item in @{text "rhs"}.
f5db9e08effc Directory [tphols-2011] is added to host the commented version of [Myhill.thy]. Directory [pres] is created to host a build session for logical image [ListP] which is essentially [Main] extended with [List_prefix.thy].
zhang
parents: 29
diff changeset
   362
  *}
28
cef2893f353b Rewritten of hard direction once more. To make it looking better.
wu
parents: 27
diff changeset
   363
cef2893f353b Rewritten of hard direction once more. To make it looking better.
wu
parents: 27
diff changeset
   364
definition
30
f5db9e08effc Directory [tphols-2011] is added to host the commented version of [Myhill.thy]. Directory [pres] is created to host a build session for logical image [ListP] which is essentially [Main] extended with [List_prefix.thy].
zhang
parents: 29
diff changeset
   365
  "append_rhs_rexp rhs rexp \<equiv> (attach_rexp rexp) ` rhs"
27
90a57a533b0c Add new file for the new definition of the hard direction's simplification.
wu
parents:
diff changeset
   366
30
f5db9e08effc Directory [tphols-2011] is added to host the commented version of [Myhill.thy]. Directory [pres] is created to host a build session for logical image [ListP] which is essentially [Main] extended with [List_prefix.thy].
zhang
parents: 29
diff changeset
   367
text {*
f5db9e08effc Directory [tphols-2011] is added to host the commented version of [Myhill.thy]. Directory [pres] is created to host a build session for logical image [ListP] which is essentially [Main] extended with [List_prefix.thy].
zhang
parents: 29
diff changeset
   368
  With the help of the two functions immediately above, Ardens'
f5db9e08effc Directory [tphols-2011] is added to host the commented version of [Myhill.thy]. Directory [pres] is created to host a build session for logical image [ListP] which is essentially [Main] extended with [List_prefix.thy].
zhang
parents: 29
diff changeset
   369
  transformation on right hand side @{text "rhs"} is implemented
f5db9e08effc Directory [tphols-2011] is added to host the commented version of [Myhill.thy]. Directory [pres] is created to host a build session for logical image [ListP] which is essentially [Main] extended with [List_prefix.thy].
zhang
parents: 29
diff changeset
   370
  by the following function @{text "arden_variate X rhs"}.
f5db9e08effc Directory [tphols-2011] is added to host the commented version of [Myhill.thy]. Directory [pres] is created to host a build session for logical image [ListP] which is essentially [Main] extended with [List_prefix.thy].
zhang
parents: 29
diff changeset
   371
  After this transformation, the recursive occurent of @{text "X"}
f5db9e08effc Directory [tphols-2011] is added to host the commented version of [Myhill.thy]. Directory [pres] is created to host a build session for logical image [ListP] which is essentially [Main] extended with [List_prefix.thy].
zhang
parents: 29
diff changeset
   372
  in @{text "rhs"} will be eliminated, while the 
f5db9e08effc Directory [tphols-2011] is added to host the commented version of [Myhill.thy]. Directory [pres] is created to host a build session for logical image [ListP] which is essentially [Main] extended with [List_prefix.thy].
zhang
parents: 29
diff changeset
   373
  string set defined by @{text "rhs"} is kept unchanged.
f5db9e08effc Directory [tphols-2011] is added to host the commented version of [Myhill.thy]. Directory [pres] is created to host a build session for logical image [ListP] which is essentially [Main] extended with [List_prefix.thy].
zhang
parents: 29
diff changeset
   374
  *}
27
90a57a533b0c Add new file for the new definition of the hard direction's simplification.
wu
parents:
diff changeset
   375
definition 
30
f5db9e08effc Directory [tphols-2011] is added to host the commented version of [Myhill.thy]. Directory [pres] is created to host a build session for logical image [ListP] which is essentially [Main] extended with [List_prefix.thy].
zhang
parents: 29
diff changeset
   376
  "arden_variate X rhs \<equiv> 
f5db9e08effc Directory [tphols-2011] is added to host the commented version of [Myhill.thy]. Directory [pres] is created to host a build session for logical image [ListP] which is essentially [Main] extended with [List_prefix.thy].
zhang
parents: 29
diff changeset
   377
        append_rhs_rexp (rhs - items_of rhs X) (STAR (rexp_of rhs X))"
28
cef2893f353b Rewritten of hard direction once more. To make it looking better.
wu
parents: 27
diff changeset
   378
27
90a57a533b0c Add new file for the new definition of the hard direction's simplification.
wu
parents:
diff changeset
   379
90a57a533b0c Add new file for the new definition of the hard direction's simplification.
wu
parents:
diff changeset
   380
(*********** substitution of ES *************)
90a57a533b0c Add new file for the new definition of the hard direction's simplification.
wu
parents:
diff changeset
   381
30
f5db9e08effc Directory [tphols-2011] is added to host the commented version of [Myhill.thy]. Directory [pres] is created to host a build session for logical image [ListP] which is essentially [Main] extended with [List_prefix.thy].
zhang
parents: 29
diff changeset
   382
text {* 
f5db9e08effc Directory [tphols-2011] is added to host the commented version of [Myhill.thy]. Directory [pres] is created to host a build session for logical image [ListP] which is essentially [Main] extended with [List_prefix.thy].
zhang
parents: 29
diff changeset
   383
  Suppose the equation defining @{text "X"} is $X = xrhs$,
f5db9e08effc Directory [tphols-2011] is added to host the commented version of [Myhill.thy]. Directory [pres] is created to host a build session for logical image [ListP] which is essentially [Main] extended with [List_prefix.thy].
zhang
parents: 29
diff changeset
   384
  the purpose of @{text "rhs_subst"} is to substitute all occurences of @{text "X"} in
f5db9e08effc Directory [tphols-2011] is added to host the commented version of [Myhill.thy]. Directory [pres] is created to host a build session for logical image [ListP] which is essentially [Main] extended with [List_prefix.thy].
zhang
parents: 29
diff changeset
   385
  @{text "rhs"} by @{text "xrhs"}.
f5db9e08effc Directory [tphols-2011] is added to host the commented version of [Myhill.thy]. Directory [pres] is created to host a build session for logical image [ListP] which is essentially [Main] extended with [List_prefix.thy].
zhang
parents: 29
diff changeset
   386
  A litte thought may reveal that the final result
f5db9e08effc Directory [tphols-2011] is added to host the commented version of [Myhill.thy]. Directory [pres] is created to host a build session for logical image [ListP] which is essentially [Main] extended with [List_prefix.thy].
zhang
parents: 29
diff changeset
   387
  should be: first append $(a_1 | a_2 | \ldots | a_n)$ to every item of @{text "xrhs"} and then
f5db9e08effc Directory [tphols-2011] is added to host the commented version of [Myhill.thy]. Directory [pres] is created to host a build session for logical image [ListP] which is essentially [Main] extended with [List_prefix.thy].
zhang
parents: 29
diff changeset
   388
  union the result with all non-@{text "X"}-items of @{text "rhs"}.
f5db9e08effc Directory [tphols-2011] is added to host the commented version of [Myhill.thy]. Directory [pres] is created to host a build session for logical image [ListP] which is essentially [Main] extended with [List_prefix.thy].
zhang
parents: 29
diff changeset
   389
 *}
27
90a57a533b0c Add new file for the new definition of the hard direction's simplification.
wu
parents:
diff changeset
   390
definition 
30
f5db9e08effc Directory [tphols-2011] is added to host the commented version of [Myhill.thy]. Directory [pres] is created to host a build session for logical image [ListP] which is essentially [Main] extended with [List_prefix.thy].
zhang
parents: 29
diff changeset
   391
  "rhs_subst rhs X xrhs \<equiv> 
f5db9e08effc Directory [tphols-2011] is added to host the commented version of [Myhill.thy]. Directory [pres] is created to host a build session for logical image [ListP] which is essentially [Main] extended with [List_prefix.thy].
zhang
parents: 29
diff changeset
   392
        (rhs - (items_of rhs X)) \<union> (append_rhs_rexp xrhs (rexp_of rhs X))"
f5db9e08effc Directory [tphols-2011] is added to host the commented version of [Myhill.thy]. Directory [pres] is created to host a build session for logical image [ListP] which is essentially [Main] extended with [List_prefix.thy].
zhang
parents: 29
diff changeset
   393
f5db9e08effc Directory [tphols-2011] is added to host the commented version of [Myhill.thy]. Directory [pres] is created to host a build session for logical image [ListP] which is essentially [Main] extended with [List_prefix.thy].
zhang
parents: 29
diff changeset
   394
text {*
f5db9e08effc Directory [tphols-2011] is added to host the commented version of [Myhill.thy]. Directory [pres] is created to host a build session for logical image [ListP] which is essentially [Main] extended with [List_prefix.thy].
zhang
parents: 29
diff changeset
   395
  Suppose the equation defining @{text "X"} is $X = xrhs$, the follwing
f5db9e08effc Directory [tphols-2011] is added to host the commented version of [Myhill.thy]. Directory [pres] is created to host a build session for logical image [ListP] which is essentially [Main] extended with [List_prefix.thy].
zhang
parents: 29
diff changeset
   396
  @{text "eqs_subst ES X xrhs"} substitute @{text "xrhs"} into every equation
f5db9e08effc Directory [tphols-2011] is added to host the commented version of [Myhill.thy]. Directory [pres] is created to host a build session for logical image [ListP] which is essentially [Main] extended with [List_prefix.thy].
zhang
parents: 29
diff changeset
   397
  of the equational system @{text "ES"}.
f5db9e08effc Directory [tphols-2011] is added to host the commented version of [Myhill.thy]. Directory [pres] is created to host a build session for logical image [ListP] which is essentially [Main] extended with [List_prefix.thy].
zhang
parents: 29
diff changeset
   398
  *}
27
90a57a533b0c Add new file for the new definition of the hard direction's simplification.
wu
parents:
diff changeset
   399
90a57a533b0c Add new file for the new definition of the hard direction's simplification.
wu
parents:
diff changeset
   400
definition
90a57a533b0c Add new file for the new definition of the hard direction's simplification.
wu
parents:
diff changeset
   401
  "eqs_subst ES X xrhs \<equiv> {(Y, rhs_subst yrhs X xrhs) | Y yrhs. (Y, yrhs) \<in> ES}"
90a57a533b0c Add new file for the new definition of the hard direction's simplification.
wu
parents:
diff changeset
   402
90a57a533b0c Add new file for the new definition of the hard direction's simplification.
wu
parents:
diff changeset
   403
text {*
30
f5db9e08effc Directory [tphols-2011] is added to host the commented version of [Myhill.thy]. Directory [pres] is created to host a build session for logical image [ListP] which is essentially [Main] extended with [List_prefix.thy].
zhang
parents: 29
diff changeset
   404
  The computation of regular expressions for equivalent classes is accomplished
f5db9e08effc Directory [tphols-2011] is added to host the commented version of [Myhill.thy]. Directory [pres] is created to host a build session for logical image [ListP] which is essentially [Main] extended with [List_prefix.thy].
zhang
parents: 29
diff changeset
   405
  using a iteration principle given by the following lemma.
f5db9e08effc Directory [tphols-2011] is added to host the commented version of [Myhill.thy]. Directory [pres] is created to host a build session for logical image [ListP] which is essentially [Main] extended with [List_prefix.thy].
zhang
parents: 29
diff changeset
   406
  *}
27
90a57a533b0c Add new file for the new definition of the hard direction's simplification.
wu
parents:
diff changeset
   407
90a57a533b0c Add new file for the new definition of the hard direction's simplification.
wu
parents:
diff changeset
   408
lemma wf_iter [rule_format]: 
90a57a533b0c Add new file for the new definition of the hard direction's simplification.
wu
parents:
diff changeset
   409
  fixes f
90a57a533b0c Add new file for the new definition of the hard direction's simplification.
wu
parents:
diff changeset
   410
  assumes step: "\<And> e. \<lbrakk>P e; \<not> Q e\<rbrakk> \<Longrightarrow> (\<exists> e'. P e' \<and>  (f(e'), f(e)) \<in> less_than)"
90a57a533b0c Add new file for the new definition of the hard direction's simplification.
wu
parents:
diff changeset
   411
  shows pe:     "P e \<longrightarrow> (\<exists> e'. P e' \<and>  Q e')"
90a57a533b0c Add new file for the new definition of the hard direction's simplification.
wu
parents:
diff changeset
   412
proof(induct e rule: wf_induct 
90a57a533b0c Add new file for the new definition of the hard direction's simplification.
wu
parents:
diff changeset
   413
           [OF wf_inv_image[OF wf_less_than, where f = "f"]], clarify)
90a57a533b0c Add new file for the new definition of the hard direction's simplification.
wu
parents:
diff changeset
   414
  fix x 
90a57a533b0c Add new file for the new definition of the hard direction's simplification.
wu
parents:
diff changeset
   415
  assume h [rule_format]: 
90a57a533b0c Add new file for the new definition of the hard direction's simplification.
wu
parents:
diff changeset
   416
    "\<forall>y. (y, x) \<in> inv_image less_than f \<longrightarrow> P y \<longrightarrow> (\<exists>e'. P e' \<and> Q e')"
90a57a533b0c Add new file for the new definition of the hard direction's simplification.
wu
parents:
diff changeset
   417
    and px: "P x"
90a57a533b0c Add new file for the new definition of the hard direction's simplification.
wu
parents:
diff changeset
   418
  show "\<exists>e'. P e' \<and> Q e'"
90a57a533b0c Add new file for the new definition of the hard direction's simplification.
wu
parents:
diff changeset
   419
  proof(cases "Q x")
90a57a533b0c Add new file for the new definition of the hard direction's simplification.
wu
parents:
diff changeset
   420
    assume "Q x" with px show ?thesis by blast
90a57a533b0c Add new file for the new definition of the hard direction's simplification.
wu
parents:
diff changeset
   421
  next
90a57a533b0c Add new file for the new definition of the hard direction's simplification.
wu
parents:
diff changeset
   422
    assume nq: "\<not> Q x"
90a57a533b0c Add new file for the new definition of the hard direction's simplification.
wu
parents:
diff changeset
   423
    from step [OF px nq]
90a57a533b0c Add new file for the new definition of the hard direction's simplification.
wu
parents:
diff changeset
   424
    obtain e' where pe': "P e'" and ltf: "(f e', f x) \<in> less_than" by auto
90a57a533b0c Add new file for the new definition of the hard direction's simplification.
wu
parents:
diff changeset
   425
    show ?thesis
90a57a533b0c Add new file for the new definition of the hard direction's simplification.
wu
parents:
diff changeset
   426
    proof(rule h)
90a57a533b0c Add new file for the new definition of the hard direction's simplification.
wu
parents:
diff changeset
   427
      from ltf show "(e', x) \<in> inv_image less_than f" 
90a57a533b0c Add new file for the new definition of the hard direction's simplification.
wu
parents:
diff changeset
   428
	by (simp add:inv_image_def)
90a57a533b0c Add new file for the new definition of the hard direction's simplification.
wu
parents:
diff changeset
   429
    next
90a57a533b0c Add new file for the new definition of the hard direction's simplification.
wu
parents:
diff changeset
   430
      from pe' show "P e'" .
90a57a533b0c Add new file for the new definition of the hard direction's simplification.
wu
parents:
diff changeset
   431
    qed
90a57a533b0c Add new file for the new definition of the hard direction's simplification.
wu
parents:
diff changeset
   432
  qed
90a57a533b0c Add new file for the new definition of the hard direction's simplification.
wu
parents:
diff changeset
   433
qed
90a57a533b0c Add new file for the new definition of the hard direction's simplification.
wu
parents:
diff changeset
   434
30
f5db9e08effc Directory [tphols-2011] is added to host the commented version of [Myhill.thy]. Directory [pres] is created to host a build session for logical image [ListP] which is essentially [Main] extended with [List_prefix.thy].
zhang
parents: 29
diff changeset
   435
text {*
f5db9e08effc Directory [tphols-2011] is added to host the commented version of [Myhill.thy]. Directory [pres] is created to host a build session for logical image [ListP] which is essentially [Main] extended with [List_prefix.thy].
zhang
parents: 29
diff changeset
   436
  The @{text "P"} in lemma @{text "wf_iter"} is an invaiant kept throughout the iteration procedure.
f5db9e08effc Directory [tphols-2011] is added to host the commented version of [Myhill.thy]. Directory [pres] is created to host a build session for logical image [ListP] which is essentially [Main] extended with [List_prefix.thy].
zhang
parents: 29
diff changeset
   437
  The particular invariant used to solve our problem is defined by function @{text "Inv(ES)"},
f5db9e08effc Directory [tphols-2011] is added to host the commented version of [Myhill.thy]. Directory [pres] is created to host a build session for logical image [ListP] which is essentially [Main] extended with [List_prefix.thy].
zhang
parents: 29
diff changeset
   438
  an invariant over equal system @{text "ES"}.
f5db9e08effc Directory [tphols-2011] is added to host the commented version of [Myhill.thy]. Directory [pres] is created to host a build session for logical image [ListP] which is essentially [Main] extended with [List_prefix.thy].
zhang
parents: 29
diff changeset
   439
  Every definition starting next till @{text "Inv"} stipulates a property to be satisfied by @{text "ES"}.
f5db9e08effc Directory [tphols-2011] is added to host the commented version of [Myhill.thy]. Directory [pres] is created to host a build session for logical image [ListP] which is essentially [Main] extended with [List_prefix.thy].
zhang
parents: 29
diff changeset
   440
*}
f5db9e08effc Directory [tphols-2011] is added to host the commented version of [Myhill.thy]. Directory [pres] is created to host a build session for logical image [ListP] which is essentially [Main] extended with [List_prefix.thy].
zhang
parents: 29
diff changeset
   441
f5db9e08effc Directory [tphols-2011] is added to host the commented version of [Myhill.thy]. Directory [pres] is created to host a build session for logical image [ListP] which is essentially [Main] extended with [List_prefix.thy].
zhang
parents: 29
diff changeset
   442
text {* 
f5db9e08effc Directory [tphols-2011] is added to host the commented version of [Myhill.thy]. Directory [pres] is created to host a build session for logical image [ListP] which is essentially [Main] extended with [List_prefix.thy].
zhang
parents: 29
diff changeset
   443
  Every variable is defined at most onece in @{text "ES"}.
f5db9e08effc Directory [tphols-2011] is added to host the commented version of [Myhill.thy]. Directory [pres] is created to host a build session for logical image [ListP] which is essentially [Main] extended with [List_prefix.thy].
zhang
parents: 29
diff changeset
   444
  *}
f5db9e08effc Directory [tphols-2011] is added to host the commented version of [Myhill.thy]. Directory [pres] is created to host a build session for logical image [ListP] which is essentially [Main] extended with [List_prefix.thy].
zhang
parents: 29
diff changeset
   445
definition 
f5db9e08effc Directory [tphols-2011] is added to host the commented version of [Myhill.thy]. Directory [pres] is created to host a build session for logical image [ListP] which is essentially [Main] extended with [List_prefix.thy].
zhang
parents: 29
diff changeset
   446
  "distinct_equas ES \<equiv> 
f5db9e08effc Directory [tphols-2011] is added to host the commented version of [Myhill.thy]. Directory [pres] is created to host a build session for logical image [ListP] which is essentially [Main] extended with [List_prefix.thy].
zhang
parents: 29
diff changeset
   447
            \<forall> X rhs rhs'. (X, rhs) \<in> ES \<and> (X, rhs') \<in> ES \<longrightarrow> rhs = rhs'"
f5db9e08effc Directory [tphols-2011] is added to host the commented version of [Myhill.thy]. Directory [pres] is created to host a build session for logical image [ListP] which is essentially [Main] extended with [List_prefix.thy].
zhang
parents: 29
diff changeset
   448
text {* 
f5db9e08effc Directory [tphols-2011] is added to host the commented version of [Myhill.thy]. Directory [pres] is created to host a build session for logical image [ListP] which is essentially [Main] extended with [List_prefix.thy].
zhang
parents: 29
diff changeset
   449
  Every equation in @{text "ES"} (represented by @{text "(X, rhs)"}) is valid, i.e. @{text "(X = L rhs)"}.
f5db9e08effc Directory [tphols-2011] is added to host the commented version of [Myhill.thy]. Directory [pres] is created to host a build session for logical image [ListP] which is essentially [Main] extended with [List_prefix.thy].
zhang
parents: 29
diff changeset
   450
  *}
f5db9e08effc Directory [tphols-2011] is added to host the commented version of [Myhill.thy]. Directory [pres] is created to host a build session for logical image [ListP] which is essentially [Main] extended with [List_prefix.thy].
zhang
parents: 29
diff changeset
   451
definition 
f5db9e08effc Directory [tphols-2011] is added to host the commented version of [Myhill.thy]. Directory [pres] is created to host a build session for logical image [ListP] which is essentially [Main] extended with [List_prefix.thy].
zhang
parents: 29
diff changeset
   452
  "valid_eqns ES \<equiv> \<forall> X rhs. (X, rhs) \<in> ES \<longrightarrow> (X = L rhs)"
f5db9e08effc Directory [tphols-2011] is added to host the commented version of [Myhill.thy]. Directory [pres] is created to host a build session for logical image [ListP] which is essentially [Main] extended with [List_prefix.thy].
zhang
parents: 29
diff changeset
   453
f5db9e08effc Directory [tphols-2011] is added to host the commented version of [Myhill.thy]. Directory [pres] is created to host a build session for logical image [ListP] which is essentially [Main] extended with [List_prefix.thy].
zhang
parents: 29
diff changeset
   454
text {*
f5db9e08effc Directory [tphols-2011] is added to host the commented version of [Myhill.thy]. Directory [pres] is created to host a build session for logical image [ListP] which is essentially [Main] extended with [List_prefix.thy].
zhang
parents: 29
diff changeset
   455
  @{text "rhs_nonempty rhs"} requires regular expressions occuring in transitional 
f5db9e08effc Directory [tphols-2011] is added to host the commented version of [Myhill.thy]. Directory [pres] is created to host a build session for logical image [ListP] which is essentially [Main] extended with [List_prefix.thy].
zhang
parents: 29
diff changeset
   456
  items of @{text "rhs"} does not contain empty string. This is necessary for
f5db9e08effc Directory [tphols-2011] is added to host the commented version of [Myhill.thy]. Directory [pres] is created to host a build session for logical image [ListP] which is essentially [Main] extended with [List_prefix.thy].
zhang
parents: 29
diff changeset
   457
  the application of Arden's transformation to @{text "rhs"}.
f5db9e08effc Directory [tphols-2011] is added to host the commented version of [Myhill.thy]. Directory [pres] is created to host a build session for logical image [ListP] which is essentially [Main] extended with [List_prefix.thy].
zhang
parents: 29
diff changeset
   458
  *}
f5db9e08effc Directory [tphols-2011] is added to host the commented version of [Myhill.thy]. Directory [pres] is created to host a build session for logical image [ListP] which is essentially [Main] extended with [List_prefix.thy].
zhang
parents: 29
diff changeset
   459
definition 
f5db9e08effc Directory [tphols-2011] is added to host the commented version of [Myhill.thy]. Directory [pres] is created to host a build session for logical image [ListP] which is essentially [Main] extended with [List_prefix.thy].
zhang
parents: 29
diff changeset
   460
  "rhs_nonempty rhs \<equiv> (\<forall> Y r. Trn Y r \<in> rhs \<longrightarrow> [] \<notin> L r)"
f5db9e08effc Directory [tphols-2011] is added to host the commented version of [Myhill.thy]. Directory [pres] is created to host a build session for logical image [ListP] which is essentially [Main] extended with [List_prefix.thy].
zhang
parents: 29
diff changeset
   461
f5db9e08effc Directory [tphols-2011] is added to host the commented version of [Myhill.thy]. Directory [pres] is created to host a build session for logical image [ListP] which is essentially [Main] extended with [List_prefix.thy].
zhang
parents: 29
diff changeset
   462
text {*
f5db9e08effc Directory [tphols-2011] is added to host the commented version of [Myhill.thy]. Directory [pres] is created to host a build session for logical image [ListP] which is essentially [Main] extended with [List_prefix.thy].
zhang
parents: 29
diff changeset
   463
  @{text "ardenable ES"} requires that Arden's transformation is applicable
f5db9e08effc Directory [tphols-2011] is added to host the commented version of [Myhill.thy]. Directory [pres] is created to host a build session for logical image [ListP] which is essentially [Main] extended with [List_prefix.thy].
zhang
parents: 29
diff changeset
   464
  to every equation of equational system @{text "ES"}.
f5db9e08effc Directory [tphols-2011] is added to host the commented version of [Myhill.thy]. Directory [pres] is created to host a build session for logical image [ListP] which is essentially [Main] extended with [List_prefix.thy].
zhang
parents: 29
diff changeset
   465
  *}
f5db9e08effc Directory [tphols-2011] is added to host the commented version of [Myhill.thy]. Directory [pres] is created to host a build session for logical image [ListP] which is essentially [Main] extended with [List_prefix.thy].
zhang
parents: 29
diff changeset
   466
definition 
f5db9e08effc Directory [tphols-2011] is added to host the commented version of [Myhill.thy]. Directory [pres] is created to host a build session for logical image [ListP] which is essentially [Main] extended with [List_prefix.thy].
zhang
parents: 29
diff changeset
   467
  "ardenable ES \<equiv> \<forall> X rhs. (X, rhs) \<in> ES \<longrightarrow> rhs_nonempty rhs"
f5db9e08effc Directory [tphols-2011] is added to host the commented version of [Myhill.thy]. Directory [pres] is created to host a build session for logical image [ListP] which is essentially [Main] extended with [List_prefix.thy].
zhang
parents: 29
diff changeset
   468
f5db9e08effc Directory [tphols-2011] is added to host the commented version of [Myhill.thy]. Directory [pres] is created to host a build session for logical image [ListP] which is essentially [Main] extended with [List_prefix.thy].
zhang
parents: 29
diff changeset
   469
(* The following non_empty seems useless. *)
f5db9e08effc Directory [tphols-2011] is added to host the commented version of [Myhill.thy]. Directory [pres] is created to host a build session for logical image [ListP] which is essentially [Main] extended with [List_prefix.thy].
zhang
parents: 29
diff changeset
   470
definition 
f5db9e08effc Directory [tphols-2011] is added to host the commented version of [Myhill.thy]. Directory [pres] is created to host a build session for logical image [ListP] which is essentially [Main] extended with [List_prefix.thy].
zhang
parents: 29
diff changeset
   471
  "non_empty ES \<equiv> \<forall> X rhs. (X, rhs) \<in> ES \<longrightarrow> X \<noteq> {}"
f5db9e08effc Directory [tphols-2011] is added to host the commented version of [Myhill.thy]. Directory [pres] is created to host a build session for logical image [ListP] which is essentially [Main] extended with [List_prefix.thy].
zhang
parents: 29
diff changeset
   472
f5db9e08effc Directory [tphols-2011] is added to host the commented version of [Myhill.thy]. Directory [pres] is created to host a build session for logical image [ListP] which is essentially [Main] extended with [List_prefix.thy].
zhang
parents: 29
diff changeset
   473
text {*
f5db9e08effc Directory [tphols-2011] is added to host the commented version of [Myhill.thy]. Directory [pres] is created to host a build session for logical image [ListP] which is essentially [Main] extended with [List_prefix.thy].
zhang
parents: 29
diff changeset
   474
  The following @{text "finite_rhs ES"} requires every equation in @{text "rhs"} be finite.
f5db9e08effc Directory [tphols-2011] is added to host the commented version of [Myhill.thy]. Directory [pres] is created to host a build session for logical image [ListP] which is essentially [Main] extended with [List_prefix.thy].
zhang
parents: 29
diff changeset
   475
  *}
f5db9e08effc Directory [tphols-2011] is added to host the commented version of [Myhill.thy]. Directory [pres] is created to host a build session for logical image [ListP] which is essentially [Main] extended with [List_prefix.thy].
zhang
parents: 29
diff changeset
   476
definition
f5db9e08effc Directory [tphols-2011] is added to host the commented version of [Myhill.thy]. Directory [pres] is created to host a build session for logical image [ListP] which is essentially [Main] extended with [List_prefix.thy].
zhang
parents: 29
diff changeset
   477
  "finite_rhs ES \<equiv> \<forall> X rhs. (X, rhs) \<in> ES \<longrightarrow> finite rhs"
f5db9e08effc Directory [tphols-2011] is added to host the commented version of [Myhill.thy]. Directory [pres] is created to host a build session for logical image [ListP] which is essentially [Main] extended with [List_prefix.thy].
zhang
parents: 29
diff changeset
   478
f5db9e08effc Directory [tphols-2011] is added to host the commented version of [Myhill.thy]. Directory [pres] is created to host a build session for logical image [ListP] which is essentially [Main] extended with [List_prefix.thy].
zhang
parents: 29
diff changeset
   479
text {*
f5db9e08effc Directory [tphols-2011] is added to host the commented version of [Myhill.thy]. Directory [pres] is created to host a build session for logical image [ListP] which is essentially [Main] extended with [List_prefix.thy].
zhang
parents: 29
diff changeset
   480
  The following @{text "classes_of rhs"} returns all variables (or equivalent classes)
f5db9e08effc Directory [tphols-2011] is added to host the commented version of [Myhill.thy]. Directory [pres] is created to host a build session for logical image [ListP] which is essentially [Main] extended with [List_prefix.thy].
zhang
parents: 29
diff changeset
   481
  occuring in @{text "rhs"}.
f5db9e08effc Directory [tphols-2011] is added to host the commented version of [Myhill.thy]. Directory [pres] is created to host a build session for logical image [ListP] which is essentially [Main] extended with [List_prefix.thy].
zhang
parents: 29
diff changeset
   482
  *}
f5db9e08effc Directory [tphols-2011] is added to host the commented version of [Myhill.thy]. Directory [pres] is created to host a build session for logical image [ListP] which is essentially [Main] extended with [List_prefix.thy].
zhang
parents: 29
diff changeset
   483
definition 
f5db9e08effc Directory [tphols-2011] is added to host the commented version of [Myhill.thy]. Directory [pres] is created to host a build session for logical image [ListP] which is essentially [Main] extended with [List_prefix.thy].
zhang
parents: 29
diff changeset
   484
  "classes_of rhs \<equiv> {X. \<exists> r. Trn X r \<in> rhs}"
f5db9e08effc Directory [tphols-2011] is added to host the commented version of [Myhill.thy]. Directory [pres] is created to host a build session for logical image [ListP] which is essentially [Main] extended with [List_prefix.thy].
zhang
parents: 29
diff changeset
   485
f5db9e08effc Directory [tphols-2011] is added to host the commented version of [Myhill.thy]. Directory [pres] is created to host a build session for logical image [ListP] which is essentially [Main] extended with [List_prefix.thy].
zhang
parents: 29
diff changeset
   486
text {*
f5db9e08effc Directory [tphols-2011] is added to host the commented version of [Myhill.thy]. Directory [pres] is created to host a build session for logical image [ListP] which is essentially [Main] extended with [List_prefix.thy].
zhang
parents: 29
diff changeset
   487
  The following @{text "lefts_of ES"} returns all variables 
f5db9e08effc Directory [tphols-2011] is added to host the commented version of [Myhill.thy]. Directory [pres] is created to host a build session for logical image [ListP] which is essentially [Main] extended with [List_prefix.thy].
zhang
parents: 29
diff changeset
   488
  defined by equational system @{text "ES"}.
f5db9e08effc Directory [tphols-2011] is added to host the commented version of [Myhill.thy]. Directory [pres] is created to host a build session for logical image [ListP] which is essentially [Main] extended with [List_prefix.thy].
zhang
parents: 29
diff changeset
   489
  *}
f5db9e08effc Directory [tphols-2011] is added to host the commented version of [Myhill.thy]. Directory [pres] is created to host a build session for logical image [ListP] which is essentially [Main] extended with [List_prefix.thy].
zhang
parents: 29
diff changeset
   490
definition
f5db9e08effc Directory [tphols-2011] is added to host the commented version of [Myhill.thy]. Directory [pres] is created to host a build session for logical image [ListP] which is essentially [Main] extended with [List_prefix.thy].
zhang
parents: 29
diff changeset
   491
  "lefts_of ES \<equiv> {Y | Y yrhs. (Y, yrhs) \<in> ES}"
f5db9e08effc Directory [tphols-2011] is added to host the commented version of [Myhill.thy]. Directory [pres] is created to host a build session for logical image [ListP] which is essentially [Main] extended with [List_prefix.thy].
zhang
parents: 29
diff changeset
   492
f5db9e08effc Directory [tphols-2011] is added to host the commented version of [Myhill.thy]. Directory [pres] is created to host a build session for logical image [ListP] which is essentially [Main] extended with [List_prefix.thy].
zhang
parents: 29
diff changeset
   493
text {*
f5db9e08effc Directory [tphols-2011] is added to host the commented version of [Myhill.thy]. Directory [pres] is created to host a build session for logical image [ListP] which is essentially [Main] extended with [List_prefix.thy].
zhang
parents: 29
diff changeset
   494
  The following @{text "self_contained ES"} requires that every
f5db9e08effc Directory [tphols-2011] is added to host the commented version of [Myhill.thy]. Directory [pres] is created to host a build session for logical image [ListP] which is essentially [Main] extended with [List_prefix.thy].
zhang
parents: 29
diff changeset
   495
  variable occuring on the right hand side of equations is already defined by some
f5db9e08effc Directory [tphols-2011] is added to host the commented version of [Myhill.thy]. Directory [pres] is created to host a build session for logical image [ListP] which is essentially [Main] extended with [List_prefix.thy].
zhang
parents: 29
diff changeset
   496
  equation in @{text "ES"}.
f5db9e08effc Directory [tphols-2011] is added to host the commented version of [Myhill.thy]. Directory [pres] is created to host a build session for logical image [ListP] which is essentially [Main] extended with [List_prefix.thy].
zhang
parents: 29
diff changeset
   497
  *}
f5db9e08effc Directory [tphols-2011] is added to host the commented version of [Myhill.thy]. Directory [pres] is created to host a build session for logical image [ListP] which is essentially [Main] extended with [List_prefix.thy].
zhang
parents: 29
diff changeset
   498
definition 
f5db9e08effc Directory [tphols-2011] is added to host the commented version of [Myhill.thy]. Directory [pres] is created to host a build session for logical image [ListP] which is essentially [Main] extended with [List_prefix.thy].
zhang
parents: 29
diff changeset
   499
  "self_contained ES \<equiv> \<forall> (X, xrhs) \<in> ES. classes_of xrhs \<subseteq> lefts_of ES"
f5db9e08effc Directory [tphols-2011] is added to host the commented version of [Myhill.thy]. Directory [pres] is created to host a build session for logical image [ListP] which is essentially [Main] extended with [List_prefix.thy].
zhang
parents: 29
diff changeset
   500
f5db9e08effc Directory [tphols-2011] is added to host the commented version of [Myhill.thy]. Directory [pres] is created to host a build session for logical image [ListP] which is essentially [Main] extended with [List_prefix.thy].
zhang
parents: 29
diff changeset
   501
f5db9e08effc Directory [tphols-2011] is added to host the commented version of [Myhill.thy]. Directory [pres] is created to host a build session for logical image [ListP] which is essentially [Main] extended with [List_prefix.thy].
zhang
parents: 29
diff changeset
   502
text {*
f5db9e08effc Directory [tphols-2011] is added to host the commented version of [Myhill.thy]. Directory [pres] is created to host a build session for logical image [ListP] which is essentially [Main] extended with [List_prefix.thy].
zhang
parents: 29
diff changeset
   503
  The invariant @{text "Inv(ES)"} is obtained by conjunctioning all the previous
f5db9e08effc Directory [tphols-2011] is added to host the commented version of [Myhill.thy]. Directory [pres] is created to host a build session for logical image [ListP] which is essentially [Main] extended with [List_prefix.thy].
zhang
parents: 29
diff changeset
   504
  defined constaints on @{text "ES"}.
f5db9e08effc Directory [tphols-2011] is added to host the commented version of [Myhill.thy]. Directory [pres] is created to host a build session for logical image [ListP] which is essentially [Main] extended with [List_prefix.thy].
zhang
parents: 29
diff changeset
   505
  *}
f5db9e08effc Directory [tphols-2011] is added to host the commented version of [Myhill.thy]. Directory [pres] is created to host a build session for logical image [ListP] which is essentially [Main] extended with [List_prefix.thy].
zhang
parents: 29
diff changeset
   506
definition 
f5db9e08effc Directory [tphols-2011] is added to host the commented version of [Myhill.thy]. Directory [pres] is created to host a build session for logical image [ListP] which is essentially [Main] extended with [List_prefix.thy].
zhang
parents: 29
diff changeset
   507
  "Inv ES \<equiv> valid_eqns ES \<and> finite ES \<and> distinct_equas ES \<and> ardenable ES \<and> 
f5db9e08effc Directory [tphols-2011] is added to host the commented version of [Myhill.thy]. Directory [pres] is created to host a build session for logical image [ListP] which is essentially [Main] extended with [List_prefix.thy].
zhang
parents: 29
diff changeset
   508
                non_empty ES \<and> finite_rhs ES \<and> self_contained ES"
f5db9e08effc Directory [tphols-2011] is added to host the commented version of [Myhill.thy]. Directory [pres] is created to host a build session for logical image [ListP] which is essentially [Main] extended with [List_prefix.thy].
zhang
parents: 29
diff changeset
   509
f5db9e08effc Directory [tphols-2011] is added to host the commented version of [Myhill.thy]. Directory [pres] is created to host a build session for logical image [ListP] which is essentially [Main] extended with [List_prefix.thy].
zhang
parents: 29
diff changeset
   510
subsection {* Proof for this direction *}
f5db9e08effc Directory [tphols-2011] is added to host the commented version of [Myhill.thy]. Directory [pres] is created to host a build session for logical image [ListP] which is essentially [Main] extended with [List_prefix.thy].
zhang
parents: 29
diff changeset
   511
f5db9e08effc Directory [tphols-2011] is added to host the commented version of [Myhill.thy]. Directory [pres] is created to host a build session for logical image [ListP] which is essentially [Main] extended with [List_prefix.thy].
zhang
parents: 29
diff changeset
   512
f5db9e08effc Directory [tphols-2011] is added to host the commented version of [Myhill.thy]. Directory [pres] is created to host a build session for logical image [ListP] which is essentially [Main] extended with [List_prefix.thy].
zhang
parents: 29
diff changeset
   513
f5db9e08effc Directory [tphols-2011] is added to host the commented version of [Myhill.thy]. Directory [pres] is created to host a build session for logical image [ListP] which is essentially [Main] extended with [List_prefix.thy].
zhang
parents: 29
diff changeset
   514
text {*
f5db9e08effc Directory [tphols-2011] is added to host the commented version of [Myhill.thy]. Directory [pres] is created to host a build session for logical image [ListP] which is essentially [Main] extended with [List_prefix.thy].
zhang
parents: 29
diff changeset
   515
  The following are some basic properties of the above definitions.
f5db9e08effc Directory [tphols-2011] is added to host the commented version of [Myhill.thy]. Directory [pres] is created to host a build session for logical image [ListP] which is essentially [Main] extended with [List_prefix.thy].
zhang
parents: 29
diff changeset
   516
*}
28
cef2893f353b Rewritten of hard direction once more. To make it looking better.
wu
parents: 27
diff changeset
   517
cef2893f353b Rewritten of hard direction once more. To make it looking better.
wu
parents: 27
diff changeset
   518
lemma L_rhs_union_distrib:
cef2893f353b Rewritten of hard direction once more. To make it looking better.
wu
parents: 27
diff changeset
   519
  " L (A::rhs_item set) \<union> L B = L (A \<union> B)"
cef2893f353b Rewritten of hard direction once more. To make it looking better.
wu
parents: 27
diff changeset
   520
by simp
cef2893f353b Rewritten of hard direction once more. To make it looking better.
wu
parents: 27
diff changeset
   521
cef2893f353b Rewritten of hard direction once more. To make it looking better.
wu
parents: 27
diff changeset
   522
lemma finite_snd_Trn:
cef2893f353b Rewritten of hard direction once more. To make it looking better.
wu
parents: 27
diff changeset
   523
  assumes finite:"finite rhs"
cef2893f353b Rewritten of hard direction once more. To make it looking better.
wu
parents: 27
diff changeset
   524
  shows "finite {r\<^isub>2. Trn Y r\<^isub>2 \<in> rhs}" (is "finite ?B")
cef2893f353b Rewritten of hard direction once more. To make it looking better.
wu
parents: 27
diff changeset
   525
proof-
cef2893f353b Rewritten of hard direction once more. To make it looking better.
wu
parents: 27
diff changeset
   526
  def rhs' \<equiv> "{e \<in> rhs. \<exists> r. e = Trn Y r}"
cef2893f353b Rewritten of hard direction once more. To make it looking better.
wu
parents: 27
diff changeset
   527
  have "?B = (snd o the_Trn) ` rhs'" using rhs'_def by (auto simp:image_def)
cef2893f353b Rewritten of hard direction once more. To make it looking better.
wu
parents: 27
diff changeset
   528
  moreover have "finite rhs'" using finite rhs'_def by auto
cef2893f353b Rewritten of hard direction once more. To make it looking better.
wu
parents: 27
diff changeset
   529
  ultimately show ?thesis by simp
cef2893f353b Rewritten of hard direction once more. To make it looking better.
wu
parents: 27
diff changeset
   530
qed
cef2893f353b Rewritten of hard direction once more. To make it looking better.
wu
parents: 27
diff changeset
   531
cef2893f353b Rewritten of hard direction once more. To make it looking better.
wu
parents: 27
diff changeset
   532
lemma rexp_of_empty:
cef2893f353b Rewritten of hard direction once more. To make it looking better.
wu
parents: 27
diff changeset
   533
  assumes finite:"finite rhs"
cef2893f353b Rewritten of hard direction once more. To make it looking better.
wu
parents: 27
diff changeset
   534
  and nonempty:"rhs_nonempty rhs"
cef2893f353b Rewritten of hard direction once more. To make it looking better.
wu
parents: 27
diff changeset
   535
  shows "[] \<notin> L (rexp_of rhs X)"
cef2893f353b Rewritten of hard direction once more. To make it looking better.
wu
parents: 27
diff changeset
   536
using finite nonempty rhs_nonempty_def
cef2893f353b Rewritten of hard direction once more. To make it looking better.
wu
parents: 27
diff changeset
   537
by (drule_tac finite_snd_Trn[where Y = X], auto simp:rexp_of_def items_of_def)
cef2893f353b Rewritten of hard direction once more. To make it looking better.
wu
parents: 27
diff changeset
   538
cef2893f353b Rewritten of hard direction once more. To make it looking better.
wu
parents: 27
diff changeset
   539
lemma [intro!]:
cef2893f353b Rewritten of hard direction once more. To make it looking better.
wu
parents: 27
diff changeset
   540
  "P (Trn X r) \<Longrightarrow> (\<exists>a. (\<exists>r. a = Trn X r \<and> P a))" by auto
cef2893f353b Rewritten of hard direction once more. To make it looking better.
wu
parents: 27
diff changeset
   541
cef2893f353b Rewritten of hard direction once more. To make it looking better.
wu
parents: 27
diff changeset
   542
lemma finite_items_of:
cef2893f353b Rewritten of hard direction once more. To make it looking better.
wu
parents: 27
diff changeset
   543
  "finite rhs \<Longrightarrow> finite (items_of rhs X)"
cef2893f353b Rewritten of hard direction once more. To make it looking better.
wu
parents: 27
diff changeset
   544
by (auto simp:items_of_def intro:finite_subset)
cef2893f353b Rewritten of hard direction once more. To make it looking better.
wu
parents: 27
diff changeset
   545
cef2893f353b Rewritten of hard direction once more. To make it looking better.
wu
parents: 27
diff changeset
   546
lemma lang_of_rexp_of:
cef2893f353b Rewritten of hard direction once more. To make it looking better.
wu
parents: 27
diff changeset
   547
  assumes finite:"finite rhs"
cef2893f353b Rewritten of hard direction once more. To make it looking better.
wu
parents: 27
diff changeset
   548
  shows "L (items_of rhs X) = X ;; (L (rexp_of rhs X))"
cef2893f353b Rewritten of hard direction once more. To make it looking better.
wu
parents: 27
diff changeset
   549
proof -
cef2893f353b Rewritten of hard direction once more. To make it looking better.
wu
parents: 27
diff changeset
   550
  have "finite ((snd \<circ> the_Trn) ` items_of rhs X)" using finite_items_of[OF finite] by auto
cef2893f353b Rewritten of hard direction once more. To make it looking better.
wu
parents: 27
diff changeset
   551
  thus ?thesis
cef2893f353b Rewritten of hard direction once more. To make it looking better.
wu
parents: 27
diff changeset
   552
    apply (auto simp:rexp_of_def Seq_def items_of_def)
cef2893f353b Rewritten of hard direction once more. To make it looking better.
wu
parents: 27
diff changeset
   553
    apply (rule_tac x = s1 in exI, rule_tac x = s2 in exI, auto)
cef2893f353b Rewritten of hard direction once more. To make it looking better.
wu
parents: 27
diff changeset
   554
    by (rule_tac x= "Trn X r" in exI, auto simp:Seq_def)
cef2893f353b Rewritten of hard direction once more. To make it looking better.
wu
parents: 27
diff changeset
   555
qed
cef2893f353b Rewritten of hard direction once more. To make it looking better.
wu
parents: 27
diff changeset
   556
cef2893f353b Rewritten of hard direction once more. To make it looking better.
wu
parents: 27
diff changeset
   557
lemma rexp_of_lam_eq_lam_set:
cef2893f353b Rewritten of hard direction once more. To make it looking better.
wu
parents: 27
diff changeset
   558
  assumes finite: "finite rhs"
cef2893f353b Rewritten of hard direction once more. To make it looking better.
wu
parents: 27
diff changeset
   559
  shows "L (rexp_of_lam rhs) = L (lam_of rhs)"
cef2893f353b Rewritten of hard direction once more. To make it looking better.
wu
parents: 27
diff changeset
   560
proof -
cef2893f353b Rewritten of hard direction once more. To make it looking better.
wu
parents: 27
diff changeset
   561
  have "finite (the_r ` {Lam r |r. Lam r \<in> rhs})" using finite
cef2893f353b Rewritten of hard direction once more. To make it looking better.
wu
parents: 27
diff changeset
   562
    by (rule_tac finite_imageI, auto intro:finite_subset)
cef2893f353b Rewritten of hard direction once more. To make it looking better.
wu
parents: 27
diff changeset
   563
  thus ?thesis by (auto simp:rexp_of_lam_def lam_of_def)
cef2893f353b Rewritten of hard direction once more. To make it looking better.
wu
parents: 27
diff changeset
   564
qed
cef2893f353b Rewritten of hard direction once more. To make it looking better.
wu
parents: 27
diff changeset
   565
cef2893f353b Rewritten of hard direction once more. To make it looking better.
wu
parents: 27
diff changeset
   566
lemma [simp]:
cef2893f353b Rewritten of hard direction once more. To make it looking better.
wu
parents: 27
diff changeset
   567
  " L (attach_rexp r xb) = L xb ;; L r"
cef2893f353b Rewritten of hard direction once more. To make it looking better.
wu
parents: 27
diff changeset
   568
apply (cases xb, auto simp:Seq_def)
cef2893f353b Rewritten of hard direction once more. To make it looking better.
wu
parents: 27
diff changeset
   569
by (rule_tac x = "s1 @ s1a" in exI, rule_tac x = s2a in exI,auto simp:Seq_def)
cef2893f353b Rewritten of hard direction once more. To make it looking better.
wu
parents: 27
diff changeset
   570
cef2893f353b Rewritten of hard direction once more. To make it looking better.
wu
parents: 27
diff changeset
   571
lemma lang_of_append_rhs:
cef2893f353b Rewritten of hard direction once more. To make it looking better.
wu
parents: 27
diff changeset
   572
  "L (append_rhs_rexp rhs r) = L rhs ;; L r"
cef2893f353b Rewritten of hard direction once more. To make it looking better.
wu
parents: 27
diff changeset
   573
apply (auto simp:append_rhs_rexp_def image_def)
cef2893f353b Rewritten of hard direction once more. To make it looking better.
wu
parents: 27
diff changeset
   574
apply (auto simp:Seq_def)
cef2893f353b Rewritten of hard direction once more. To make it looking better.
wu
parents: 27
diff changeset
   575
apply (rule_tac x = "L xb ;; L r" in exI, auto simp add:Seq_def)
cef2893f353b Rewritten of hard direction once more. To make it looking better.
wu
parents: 27
diff changeset
   576
by (rule_tac x = "attach_rexp r xb" in exI, auto simp:Seq_def)
cef2893f353b Rewritten of hard direction once more. To make it looking better.
wu
parents: 27
diff changeset
   577
cef2893f353b Rewritten of hard direction once more. To make it looking better.
wu
parents: 27
diff changeset
   578
lemma classes_of_union_distrib:
cef2893f353b Rewritten of hard direction once more. To make it looking better.
wu
parents: 27
diff changeset
   579
  "classes_of A \<union> classes_of B = classes_of (A \<union> B)"
cef2893f353b Rewritten of hard direction once more. To make it looking better.
wu
parents: 27
diff changeset
   580
by (auto simp add:classes_of_def)
cef2893f353b Rewritten of hard direction once more. To make it looking better.
wu
parents: 27
diff changeset
   581
cef2893f353b Rewritten of hard direction once more. To make it looking better.
wu
parents: 27
diff changeset
   582
lemma lefts_of_union_distrib:
cef2893f353b Rewritten of hard direction once more. To make it looking better.
wu
parents: 27
diff changeset
   583
  "lefts_of A \<union> lefts_of B = lefts_of (A \<union> B)"
cef2893f353b Rewritten of hard direction once more. To make it looking better.
wu
parents: 27
diff changeset
   584
by (auto simp:lefts_of_def)
cef2893f353b Rewritten of hard direction once more. To make it looking better.
wu
parents: 27
diff changeset
   585
cef2893f353b Rewritten of hard direction once more. To make it looking better.
wu
parents: 27
diff changeset
   586
30
f5db9e08effc Directory [tphols-2011] is added to host the commented version of [Myhill.thy]. Directory [pres] is created to host a build session for logical image [ListP] which is essentially [Main] extended with [List_prefix.thy].
zhang
parents: 29
diff changeset
   587
text {*
f5db9e08effc Directory [tphols-2011] is added to host the commented version of [Myhill.thy]. Directory [pres] is created to host a build session for logical image [ListP] which is essentially [Main] extended with [List_prefix.thy].
zhang
parents: 29
diff changeset
   588
  The following several lemmas until @{text "init_ES_satisfy_Inv"} are
f5db9e08effc Directory [tphols-2011] is added to host the commented version of [Myhill.thy]. Directory [pres] is created to host a build session for logical image [ListP] which is essentially [Main] extended with [List_prefix.thy].
zhang
parents: 29
diff changeset
   589
  to prove that initial equational system satisfies invariant @{text "Inv"}.
f5db9e08effc Directory [tphols-2011] is added to host the commented version of [Myhill.thy]. Directory [pres] is created to host a build session for logical image [ListP] which is essentially [Main] extended with [List_prefix.thy].
zhang
parents: 29
diff changeset
   590
  *}
27
90a57a533b0c Add new file for the new definition of the hard direction's simplification.
wu
parents:
diff changeset
   591
28
cef2893f353b Rewritten of hard direction once more. To make it looking better.
wu
parents: 27
diff changeset
   592
lemma defined_by_str:
cef2893f353b Rewritten of hard direction once more. To make it looking better.
wu
parents: 27
diff changeset
   593
  "\<lbrakk>s \<in> X; X \<in> UNIV // (\<approx>Lang)\<rbrakk> \<Longrightarrow> X = (\<approx>Lang) `` {s}"
30
f5db9e08effc Directory [tphols-2011] is added to host the commented version of [Myhill.thy]. Directory [pres] is created to host a build session for logical image [ListP] which is essentially [Main] extended with [List_prefix.thy].
zhang
parents: 29
diff changeset
   594
by (auto simp:quotient_def Image_def str_eq_rel_def)
28
cef2893f353b Rewritten of hard direction once more. To make it looking better.
wu
parents: 27
diff changeset
   595
cef2893f353b Rewritten of hard direction once more. To make it looking better.
wu
parents: 27
diff changeset
   596
lemma every_eqclass_has_transition:
cef2893f353b Rewritten of hard direction once more. To make it looking better.
wu
parents: 27
diff changeset
   597
  assumes has_str: "s @ [c] \<in> X"
cef2893f353b Rewritten of hard direction once more. To make it looking better.
wu
parents: 27
diff changeset
   598
  and     in_CS:   "X \<in> UNIV // (\<approx>Lang)"
cef2893f353b Rewritten of hard direction once more. To make it looking better.
wu
parents: 27
diff changeset
   599
  obtains Y where "Y \<in> UNIV // (\<approx>Lang)" and "Y ;; {[c]} \<subseteq> X" and "s \<in> Y"
cef2893f353b Rewritten of hard direction once more. To make it looking better.
wu
parents: 27
diff changeset
   600
proof -
cef2893f353b Rewritten of hard direction once more. To make it looking better.
wu
parents: 27
diff changeset
   601
  def Y \<equiv> "(\<approx>Lang) `` {s}"
cef2893f353b Rewritten of hard direction once more. To make it looking better.
wu
parents: 27
diff changeset
   602
  have "Y \<in> UNIV // (\<approx>Lang)" 
cef2893f353b Rewritten of hard direction once more. To make it looking better.
wu
parents: 27
diff changeset
   603
    unfolding Y_def quotient_def by auto
cef2893f353b Rewritten of hard direction once more. To make it looking better.
wu
parents: 27
diff changeset
   604
  moreover
cef2893f353b Rewritten of hard direction once more. To make it looking better.
wu
parents: 27
diff changeset
   605
  have "X = (\<approx>Lang) `` {s @ [c]}" 
cef2893f353b Rewritten of hard direction once more. To make it looking better.
wu
parents: 27
diff changeset
   606
    using has_str in_CS defined_by_str by blast
cef2893f353b Rewritten of hard direction once more. To make it looking better.
wu
parents: 27
diff changeset
   607
  then have "Y ;; {[c]} \<subseteq> X" 
cef2893f353b Rewritten of hard direction once more. To make it looking better.
wu
parents: 27
diff changeset
   608
    unfolding Y_def Image_def Seq_def
cef2893f353b Rewritten of hard direction once more. To make it looking better.
wu
parents: 27
diff changeset
   609
    unfolding str_eq_rel_def
30
f5db9e08effc Directory [tphols-2011] is added to host the commented version of [Myhill.thy]. Directory [pres] is created to host a build session for logical image [ListP] which is essentially [Main] extended with [List_prefix.thy].
zhang
parents: 29
diff changeset
   610
    by clarsimp
28
cef2893f353b Rewritten of hard direction once more. To make it looking better.
wu
parents: 27
diff changeset
   611
  moreover
cef2893f353b Rewritten of hard direction once more. To make it looking better.
wu
parents: 27
diff changeset
   612
  have "s \<in> Y" unfolding Y_def 
30
f5db9e08effc Directory [tphols-2011] is added to host the commented version of [Myhill.thy]. Directory [pres] is created to host a build session for logical image [ListP] which is essentially [Main] extended with [List_prefix.thy].
zhang
parents: 29
diff changeset
   613
    unfolding Image_def str_eq_rel_def by simp
28
cef2893f353b Rewritten of hard direction once more. To make it looking better.
wu
parents: 27
diff changeset
   614
  ultimately show thesis by (blast intro: that)
cef2893f353b Rewritten of hard direction once more. To make it looking better.
wu
parents: 27
diff changeset
   615
qed
cef2893f353b Rewritten of hard direction once more. To make it looking better.
wu
parents: 27
diff changeset
   616
cef2893f353b Rewritten of hard direction once more. To make it looking better.
wu
parents: 27
diff changeset
   617
lemma l_eq_r_in_eqs:
cef2893f353b Rewritten of hard direction once more. To make it looking better.
wu
parents: 27
diff changeset
   618
  assumes X_in_eqs: "(X, xrhs) \<in> (eqs (UNIV // (\<approx>Lang)))"
cef2893f353b Rewritten of hard direction once more. To make it looking better.
wu
parents: 27
diff changeset
   619
  shows "X = L xrhs"
cef2893f353b Rewritten of hard direction once more. To make it looking better.
wu
parents: 27
diff changeset
   620
proof 
cef2893f353b Rewritten of hard direction once more. To make it looking better.
wu
parents: 27
diff changeset
   621
  show "X \<subseteq> L xrhs"
cef2893f353b Rewritten of hard direction once more. To make it looking better.
wu
parents: 27
diff changeset
   622
  proof
cef2893f353b Rewritten of hard direction once more. To make it looking better.
wu
parents: 27
diff changeset
   623
    fix x
cef2893f353b Rewritten of hard direction once more. To make it looking better.
wu
parents: 27
diff changeset
   624
    assume "(1)": "x \<in> X"
cef2893f353b Rewritten of hard direction once more. To make it looking better.
wu
parents: 27
diff changeset
   625
    show "x \<in> L xrhs"          
cef2893f353b Rewritten of hard direction once more. To make it looking better.
wu
parents: 27
diff changeset
   626
    proof (cases "x = []")
cef2893f353b Rewritten of hard direction once more. To make it looking better.
wu
parents: 27
diff changeset
   627
      assume empty: "x = []"
cef2893f353b Rewritten of hard direction once more. To make it looking better.
wu
parents: 27
diff changeset
   628
      thus ?thesis using X_in_eqs "(1)"
cef2893f353b Rewritten of hard direction once more. To make it looking better.
wu
parents: 27
diff changeset
   629
        by (auto simp:eqs_def init_rhs_def)
cef2893f353b Rewritten of hard direction once more. To make it looking better.
wu
parents: 27
diff changeset
   630
    next
cef2893f353b Rewritten of hard direction once more. To make it looking better.
wu
parents: 27
diff changeset
   631
      assume not_empty: "x \<noteq> []"
cef2893f353b Rewritten of hard direction once more. To make it looking better.
wu
parents: 27
diff changeset
   632
      then obtain clist c where decom: "x = clist @ [c]"
cef2893f353b Rewritten of hard direction once more. To make it looking better.
wu
parents: 27
diff changeset
   633
        by (case_tac x rule:rev_cases, auto)
cef2893f353b Rewritten of hard direction once more. To make it looking better.
wu
parents: 27
diff changeset
   634
      have "X \<in> UNIV // (\<approx>Lang)" using X_in_eqs by (auto simp:eqs_def)
cef2893f353b Rewritten of hard direction once more. To make it looking better.
wu
parents: 27
diff changeset
   635
      then obtain Y 
cef2893f353b Rewritten of hard direction once more. To make it looking better.
wu
parents: 27
diff changeset
   636
        where "Y \<in> UNIV // (\<approx>Lang)" 
cef2893f353b Rewritten of hard direction once more. To make it looking better.
wu
parents: 27
diff changeset
   637
        and "Y ;; {[c]} \<subseteq> X"
cef2893f353b Rewritten of hard direction once more. To make it looking better.
wu
parents: 27
diff changeset
   638
        and "clist \<in> Y"
cef2893f353b Rewritten of hard direction once more. To make it looking better.
wu
parents: 27
diff changeset
   639
        using decom "(1)" every_eqclass_has_transition by blast
30
f5db9e08effc Directory [tphols-2011] is added to host the commented version of [Myhill.thy]. Directory [pres] is created to host a build session for logical image [ListP] which is essentially [Main] extended with [List_prefix.thy].
zhang
parents: 29
diff changeset
   640
      hence 
f5db9e08effc Directory [tphols-2011] is added to host the commented version of [Myhill.thy]. Directory [pres] is created to host a build session for logical image [ListP] which is essentially [Main] extended with [List_prefix.thy].
zhang
parents: 29
diff changeset
   641
        "x \<in> L {Trn Y (CHAR c)| Y c. Y \<in> UNIV // (\<approx>Lang) \<and> Y ;; {[c]} \<subseteq> X}"
28
cef2893f353b Rewritten of hard direction once more. To make it looking better.
wu
parents: 27
diff changeset
   642
        using "(1)" decom
cef2893f353b Rewritten of hard direction once more. To make it looking better.
wu
parents: 27
diff changeset
   643
        by (simp, rule_tac x = "Trn Y (CHAR c)" in exI, simp add:Seq_def)
cef2893f353b Rewritten of hard direction once more. To make it looking better.
wu
parents: 27
diff changeset
   644
      thus ?thesis using X_in_eqs "(1)"
cef2893f353b Rewritten of hard direction once more. To make it looking better.
wu
parents: 27
diff changeset
   645
        by (simp add:eqs_def init_rhs_def)
cef2893f353b Rewritten of hard direction once more. To make it looking better.
wu
parents: 27
diff changeset
   646
    qed
cef2893f353b Rewritten of hard direction once more. To make it looking better.
wu
parents: 27
diff changeset
   647
  qed
cef2893f353b Rewritten of hard direction once more. To make it looking better.
wu
parents: 27
diff changeset
   648
next
cef2893f353b Rewritten of hard direction once more. To make it looking better.
wu
parents: 27
diff changeset
   649
  show "L xrhs \<subseteq> X" using X_in_eqs
cef2893f353b Rewritten of hard direction once more. To make it looking better.
wu
parents: 27
diff changeset
   650
    by (auto simp:eqs_def init_rhs_def) 
cef2893f353b Rewritten of hard direction once more. To make it looking better.
wu
parents: 27
diff changeset
   651
qed
cef2893f353b Rewritten of hard direction once more. To make it looking better.
wu
parents: 27
diff changeset
   652
cef2893f353b Rewritten of hard direction once more. To make it looking better.
wu
parents: 27
diff changeset
   653
lemma finite_init_rhs: 
cef2893f353b Rewritten of hard direction once more. To make it looking better.
wu
parents: 27
diff changeset
   654
  assumes finite: "finite CS"
cef2893f353b Rewritten of hard direction once more. To make it looking better.
wu
parents: 27
diff changeset
   655
  shows "finite (init_rhs CS X)"
cef2893f353b Rewritten of hard direction once more. To make it looking better.
wu
parents: 27
diff changeset
   656
proof-
cef2893f353b Rewritten of hard direction once more. To make it looking better.
wu
parents: 27
diff changeset
   657
  have "finite {Trn Y (CHAR c) |Y c. Y \<in> CS \<and> Y ;; {[c]} \<subseteq> X}" (is "finite ?A")
cef2893f353b Rewritten of hard direction once more. To make it looking better.
wu
parents: 27
diff changeset
   658
  proof -
cef2893f353b Rewritten of hard direction once more. To make it looking better.
wu
parents: 27
diff changeset
   659
    def S \<equiv> "{(Y, c)| Y c. Y \<in> CS \<and> Y ;; {[c]} \<subseteq> X}" 
cef2893f353b Rewritten of hard direction once more. To make it looking better.
wu
parents: 27
diff changeset
   660
    def h \<equiv> "\<lambda> (Y, c). Trn Y (CHAR c)"
cef2893f353b Rewritten of hard direction once more. To make it looking better.
wu
parents: 27
diff changeset
   661
    have "finite (CS \<times> (UNIV::char set))" using finite by auto
cef2893f353b Rewritten of hard direction once more. To make it looking better.
wu
parents: 27
diff changeset
   662
    hence "finite S" using S_def 
cef2893f353b Rewritten of hard direction once more. To make it looking better.
wu
parents: 27
diff changeset
   663
      by (rule_tac B = "CS \<times> UNIV" in finite_subset, auto)
cef2893f353b Rewritten of hard direction once more. To make it looking better.
wu
parents: 27
diff changeset
   664
    moreover have "?A = h ` S" by (auto simp: S_def h_def image_def)
cef2893f353b Rewritten of hard direction once more. To make it looking better.
wu
parents: 27
diff changeset
   665
    ultimately show ?thesis 
cef2893f353b Rewritten of hard direction once more. To make it looking better.
wu
parents: 27
diff changeset
   666
      by auto
cef2893f353b Rewritten of hard direction once more. To make it looking better.
wu
parents: 27
diff changeset
   667
  qed
cef2893f353b Rewritten of hard direction once more. To make it looking better.
wu
parents: 27
diff changeset
   668
  thus ?thesis by (simp add:init_rhs_def)
cef2893f353b Rewritten of hard direction once more. To make it looking better.
wu
parents: 27
diff changeset
   669
qed
cef2893f353b Rewritten of hard direction once more. To make it looking better.
wu
parents: 27
diff changeset
   670
27
90a57a533b0c Add new file for the new definition of the hard direction's simplification.
wu
parents:
diff changeset
   671
lemma init_ES_satisfy_Inv:
90a57a533b0c Add new file for the new definition of the hard direction's simplification.
wu
parents:
diff changeset
   672
  assumes finite_CS: "finite (UNIV // (\<approx>Lang))"
90a57a533b0c Add new file for the new definition of the hard direction's simplification.
wu
parents:
diff changeset
   673
  shows "Inv (eqs (UNIV // (\<approx>Lang)))"
90a57a533b0c Add new file for the new definition of the hard direction's simplification.
wu
parents:
diff changeset
   674
proof -
90a57a533b0c Add new file for the new definition of the hard direction's simplification.
wu
parents:
diff changeset
   675
  have "finite (eqs (UNIV // (\<approx>Lang)))" using finite_CS
28
cef2893f353b Rewritten of hard direction once more. To make it looking better.
wu
parents: 27
diff changeset
   676
    by (simp add:eqs_def)
27
90a57a533b0c Add new file for the new definition of the hard direction's simplification.
wu
parents:
diff changeset
   677
  moreover have "distinct_equas (eqs (UNIV // (\<approx>Lang)))"     
28
cef2893f353b Rewritten of hard direction once more. To make it looking better.
wu
parents: 27
diff changeset
   678
    by (simp add:distinct_equas_def eqs_def)
27
90a57a533b0c Add new file for the new definition of the hard direction's simplification.
wu
parents:
diff changeset
   679
  moreover have "ardenable (eqs (UNIV // (\<approx>Lang)))"
28
cef2893f353b Rewritten of hard direction once more. To make it looking better.
wu
parents: 27
diff changeset
   680
    by (auto simp add:ardenable_def eqs_def init_rhs_def rhs_nonempty_def del:L_rhs.simps)
cef2893f353b Rewritten of hard direction once more. To make it looking better.
wu
parents: 27
diff changeset
   681
  moreover have "valid_eqns (eqs (UNIV // (\<approx>Lang)))"
cef2893f353b Rewritten of hard direction once more. To make it looking better.
wu
parents: 27
diff changeset
   682
    using l_eq_r_in_eqs by (simp add:valid_eqns_def)
27
90a57a533b0c Add new file for the new definition of the hard direction's simplification.
wu
parents:
diff changeset
   683
  moreover have "non_empty (eqs (UNIV // (\<approx>Lang)))"
30
f5db9e08effc Directory [tphols-2011] is added to host the commented version of [Myhill.thy]. Directory [pres] is created to host a build session for logical image [ListP] which is essentially [Main] extended with [List_prefix.thy].
zhang
parents: 29
diff changeset
   684
    by (auto simp:non_empty_def eqs_def quotient_def Image_def str_eq_rel_def)
28
cef2893f353b Rewritten of hard direction once more. To make it looking better.
wu
parents: 27
diff changeset
   685
  moreover have "finite_rhs (eqs (UNIV // (\<approx>Lang)))"
cef2893f353b Rewritten of hard direction once more. To make it looking better.
wu
parents: 27
diff changeset
   686
    using finite_init_rhs[OF finite_CS] 
cef2893f353b Rewritten of hard direction once more. To make it looking better.
wu
parents: 27
diff changeset
   687
    by (auto simp:finite_rhs_def eqs_def)
27
90a57a533b0c Add new file for the new definition of the hard direction's simplification.
wu
parents:
diff changeset
   688
  moreover have "self_contained (eqs (UNIV // (\<approx>Lang)))"
28
cef2893f353b Rewritten of hard direction once more. To make it looking better.
wu
parents: 27
diff changeset
   689
    by (auto simp:self_contained_def eqs_def init_rhs_def classes_of_def lefts_of_def)
27
90a57a533b0c Add new file for the new definition of the hard direction's simplification.
wu
parents:
diff changeset
   690
  ultimately show ?thesis by (simp add:Inv_def)
90a57a533b0c Add new file for the new definition of the hard direction's simplification.
wu
parents:
diff changeset
   691
qed
90a57a533b0c Add new file for the new definition of the hard direction's simplification.
wu
parents:
diff changeset
   692
30
f5db9e08effc Directory [tphols-2011] is added to host the commented version of [Myhill.thy]. Directory [pres] is created to host a build session for logical image [ListP] which is essentially [Main] extended with [List_prefix.thy].
zhang
parents: 29
diff changeset
   693
text {*
f5db9e08effc Directory [tphols-2011] is added to host the commented version of [Myhill.thy]. Directory [pres] is created to host a build session for logical image [ListP] which is essentially [Main] extended with [List_prefix.thy].
zhang
parents: 29
diff changeset
   694
  From this point until @{text "iteration_step"}, we are trying to prove 
f5db9e08effc Directory [tphols-2011] is added to host the commented version of [Myhill.thy]. Directory [pres] is created to host a build session for logical image [ListP] which is essentially [Main] extended with [List_prefix.thy].
zhang
parents: 29
diff changeset
   695
  that there exists iteration steps which keep @{text "Inv(ES)"} while
f5db9e08effc Directory [tphols-2011] is added to host the commented version of [Myhill.thy]. Directory [pres] is created to host a build session for logical image [ListP] which is essentially [Main] extended with [List_prefix.thy].
zhang
parents: 29
diff changeset
   696
  decreasing the size of @{text "ES"} with every iteration.
f5db9e08effc Directory [tphols-2011] is added to host the commented version of [Myhill.thy]. Directory [pres] is created to host a build session for logical image [ListP] which is essentially [Main] extended with [List_prefix.thy].
zhang
parents: 29
diff changeset
   697
  *}
28
cef2893f353b Rewritten of hard direction once more. To make it looking better.
wu
parents: 27
diff changeset
   698
lemma arden_variate_keeps_eq:
cef2893f353b Rewritten of hard direction once more. To make it looking better.
wu
parents: 27
diff changeset
   699
  assumes l_eq_r: "X = L rhs"
cef2893f353b Rewritten of hard direction once more. To make it looking better.
wu
parents: 27
diff changeset
   700
  and not_empty: "[] \<notin> L (rexp_of rhs X)"
cef2893f353b Rewritten of hard direction once more. To make it looking better.
wu
parents: 27
diff changeset
   701
  and finite: "finite rhs"
cef2893f353b Rewritten of hard direction once more. To make it looking better.
wu
parents: 27
diff changeset
   702
  shows "X = L (arden_variate X rhs)"
cef2893f353b Rewritten of hard direction once more. To make it looking better.
wu
parents: 27
diff changeset
   703
proof -
cef2893f353b Rewritten of hard direction once more. To make it looking better.
wu
parents: 27
diff changeset
   704
  def A \<equiv> "L (rexp_of rhs X)"
cef2893f353b Rewritten of hard direction once more. To make it looking better.
wu
parents: 27
diff changeset
   705
  def b \<equiv> "rhs - items_of rhs X"
cef2893f353b Rewritten of hard direction once more. To make it looking better.
wu
parents: 27
diff changeset
   706
  def B \<equiv> "L b" 
cef2893f353b Rewritten of hard direction once more. To make it looking better.
wu
parents: 27
diff changeset
   707
  have "X = B ;; A\<star>"
cef2893f353b Rewritten of hard direction once more. To make it looking better.
wu
parents: 27
diff changeset
   708
  proof-
cef2893f353b Rewritten of hard direction once more. To make it looking better.
wu
parents: 27
diff changeset
   709
    have "rhs = items_of rhs X \<union> b" by (auto simp:b_def items_of_def)
cef2893f353b Rewritten of hard direction once more. To make it looking better.
wu
parents: 27
diff changeset
   710
    hence "L rhs = L(items_of rhs X \<union> b)" by simp
cef2893f353b Rewritten of hard direction once more. To make it looking better.
wu
parents: 27
diff changeset
   711
    hence "L rhs = L(items_of rhs X) \<union> B" by (simp only:L_rhs_union_distrib B_def)
cef2893f353b Rewritten of hard direction once more. To make it looking better.
wu
parents: 27
diff changeset
   712
    with lang_of_rexp_of
cef2893f353b Rewritten of hard direction once more. To make it looking better.
wu
parents: 27
diff changeset
   713
    have "L rhs = X ;; A \<union> B " using finite by (simp only:B_def b_def A_def)
cef2893f353b Rewritten of hard direction once more. To make it looking better.
wu
parents: 27
diff changeset
   714
    thus ?thesis
cef2893f353b Rewritten of hard direction once more. To make it looking better.
wu
parents: 27
diff changeset
   715
      using l_eq_r not_empty
cef2893f353b Rewritten of hard direction once more. To make it looking better.
wu
parents: 27
diff changeset
   716
      apply (drule_tac B = B and X = X in ardens_revised)
cef2893f353b Rewritten of hard direction once more. To make it looking better.
wu
parents: 27
diff changeset
   717
      by (auto simp:A_def simp del:L_rhs.simps)
cef2893f353b Rewritten of hard direction once more. To make it looking better.
wu
parents: 27
diff changeset
   718
  qed
cef2893f353b Rewritten of hard direction once more. To make it looking better.
wu
parents: 27
diff changeset
   719
  moreover have "L (arden_variate X rhs) = (B ;; A\<star>)" (is "?L = ?R")
cef2893f353b Rewritten of hard direction once more. To make it looking better.
wu
parents: 27
diff changeset
   720
    by (simp only:arden_variate_def L_rhs_union_distrib lang_of_append_rhs 
cef2893f353b Rewritten of hard direction once more. To make it looking better.
wu
parents: 27
diff changeset
   721
                  B_def A_def b_def L_rexp.simps seq_union_distrib)
cef2893f353b Rewritten of hard direction once more. To make it looking better.
wu
parents: 27
diff changeset
   722
   ultimately show ?thesis by simp
cef2893f353b Rewritten of hard direction once more. To make it looking better.
wu
parents: 27
diff changeset
   723
qed 
cef2893f353b Rewritten of hard direction once more. To make it looking better.
wu
parents: 27
diff changeset
   724
cef2893f353b Rewritten of hard direction once more. To make it looking better.
wu
parents: 27
diff changeset
   725
lemma append_keeps_finite:
cef2893f353b Rewritten of hard direction once more. To make it looking better.
wu
parents: 27
diff changeset
   726
  "finite rhs \<Longrightarrow> finite (append_rhs_rexp rhs r)"
cef2893f353b Rewritten of hard direction once more. To make it looking better.
wu
parents: 27
diff changeset
   727
by (auto simp:append_rhs_rexp_def)
cef2893f353b Rewritten of hard direction once more. To make it looking better.
wu
parents: 27
diff changeset
   728
cef2893f353b Rewritten of hard direction once more. To make it looking better.
wu
parents: 27
diff changeset
   729
lemma arden_variate_keeps_finite:
cef2893f353b Rewritten of hard direction once more. To make it looking better.
wu
parents: 27
diff changeset
   730
  "finite rhs \<Longrightarrow> finite (arden_variate X rhs)"
cef2893f353b Rewritten of hard direction once more. To make it looking better.
wu
parents: 27
diff changeset
   731
by (auto simp:arden_variate_def append_keeps_finite)
cef2893f353b Rewritten of hard direction once more. To make it looking better.
wu
parents: 27
diff changeset
   732
cef2893f353b Rewritten of hard direction once more. To make it looking better.
wu
parents: 27
diff changeset
   733
lemma append_keeps_nonempty:
cef2893f353b Rewritten of hard direction once more. To make it looking better.
wu
parents: 27
diff changeset
   734
  "rhs_nonempty rhs \<Longrightarrow> rhs_nonempty (append_rhs_rexp rhs r)"
cef2893f353b Rewritten of hard direction once more. To make it looking better.
wu
parents: 27
diff changeset
   735
apply (auto simp:rhs_nonempty_def append_rhs_rexp_def)
cef2893f353b Rewritten of hard direction once more. To make it looking better.
wu
parents: 27
diff changeset
   736
by (case_tac x, auto simp:Seq_def)
cef2893f353b Rewritten of hard direction once more. To make it looking better.
wu
parents: 27
diff changeset
   737
cef2893f353b Rewritten of hard direction once more. To make it looking better.
wu
parents: 27
diff changeset
   738
lemma nonempty_set_sub:
cef2893f353b Rewritten of hard direction once more. To make it looking better.
wu
parents: 27
diff changeset
   739
  "rhs_nonempty rhs \<Longrightarrow> rhs_nonempty (rhs - A)"
cef2893f353b Rewritten of hard direction once more. To make it looking better.
wu
parents: 27
diff changeset
   740
by (auto simp:rhs_nonempty_def)
cef2893f353b Rewritten of hard direction once more. To make it looking better.
wu
parents: 27
diff changeset
   741
cef2893f353b Rewritten of hard direction once more. To make it looking better.
wu
parents: 27
diff changeset
   742
lemma nonempty_set_union:
cef2893f353b Rewritten of hard direction once more. To make it looking better.
wu
parents: 27
diff changeset
   743
  "\<lbrakk>rhs_nonempty rhs; rhs_nonempty rhs'\<rbrakk> \<Longrightarrow> rhs_nonempty (rhs \<union> rhs')"
cef2893f353b Rewritten of hard direction once more. To make it looking better.
wu
parents: 27
diff changeset
   744
by (auto simp:rhs_nonempty_def)
cef2893f353b Rewritten of hard direction once more. To make it looking better.
wu
parents: 27
diff changeset
   745
cef2893f353b Rewritten of hard direction once more. To make it looking better.
wu
parents: 27
diff changeset
   746
lemma arden_variate_keeps_nonempty:
cef2893f353b Rewritten of hard direction once more. To make it looking better.
wu
parents: 27
diff changeset
   747
  "rhs_nonempty rhs \<Longrightarrow> rhs_nonempty (arden_variate X rhs)"
cef2893f353b Rewritten of hard direction once more. To make it looking better.
wu
parents: 27
diff changeset
   748
by (simp only:arden_variate_def append_keeps_nonempty nonempty_set_sub)
cef2893f353b Rewritten of hard direction once more. To make it looking better.
wu
parents: 27
diff changeset
   749
cef2893f353b Rewritten of hard direction once more. To make it looking better.
wu
parents: 27
diff changeset
   750
cef2893f353b Rewritten of hard direction once more. To make it looking better.
wu
parents: 27
diff changeset
   751
lemma rhs_subst_keeps_nonempty:
cef2893f353b Rewritten of hard direction once more. To make it looking better.
wu
parents: 27
diff changeset
   752
  "\<lbrakk>rhs_nonempty rhs; rhs_nonempty xrhs\<rbrakk> \<Longrightarrow> rhs_nonempty (rhs_subst rhs X xrhs)"
cef2893f353b Rewritten of hard direction once more. To make it looking better.
wu
parents: 27
diff changeset
   753
by (simp only:rhs_subst_def append_keeps_nonempty  nonempty_set_union nonempty_set_sub)
cef2893f353b Rewritten of hard direction once more. To make it looking better.
wu
parents: 27
diff changeset
   754
cef2893f353b Rewritten of hard direction once more. To make it looking better.
wu
parents: 27
diff changeset
   755
lemma rhs_subst_keeps_eq:
cef2893f353b Rewritten of hard direction once more. To make it looking better.
wu
parents: 27
diff changeset
   756
  assumes substor: "X = L xrhs"
cef2893f353b Rewritten of hard direction once more. To make it looking better.
wu
parents: 27
diff changeset
   757
  and finite: "finite rhs"
cef2893f353b Rewritten of hard direction once more. To make it looking better.
wu
parents: 27
diff changeset
   758
  shows "L (rhs_subst rhs X xrhs) = L rhs" (is "?Left = ?Right")
cef2893f353b Rewritten of hard direction once more. To make it looking better.
wu
parents: 27
diff changeset
   759
proof-
cef2893f353b Rewritten of hard direction once more. To make it looking better.
wu
parents: 27
diff changeset
   760
  def A \<equiv> "L (rhs - items_of rhs X)"
cef2893f353b Rewritten of hard direction once more. To make it looking better.
wu
parents: 27
diff changeset
   761
  have "?Left = A \<union> L (append_rhs_rexp xrhs (rexp_of rhs X))"
cef2893f353b Rewritten of hard direction once more. To make it looking better.
wu
parents: 27
diff changeset
   762
    by (simp only:rhs_subst_def L_rhs_union_distrib A_def)
cef2893f353b Rewritten of hard direction once more. To make it looking better.
wu
parents: 27
diff changeset
   763
  moreover have "?Right = A \<union> L (items_of rhs X)"
cef2893f353b Rewritten of hard direction once more. To make it looking better.
wu
parents: 27
diff changeset
   764
  proof-
cef2893f353b Rewritten of hard direction once more. To make it looking better.
wu
parents: 27
diff changeset
   765
    have "rhs = (rhs - items_of rhs X) \<union> (items_of rhs X)" by (auto simp:items_of_def)
cef2893f353b Rewritten of hard direction once more. To make it looking better.
wu
parents: 27
diff changeset
   766
    thus ?thesis by (simp only:L_rhs_union_distrib A_def)
cef2893f353b Rewritten of hard direction once more. To make it looking better.
wu
parents: 27
diff changeset
   767
  qed
cef2893f353b Rewritten of hard direction once more. To make it looking better.
wu
parents: 27
diff changeset
   768
  moreover have "L (append_rhs_rexp xrhs (rexp_of rhs X)) = L (items_of rhs X)" 
cef2893f353b Rewritten of hard direction once more. To make it looking better.
wu
parents: 27
diff changeset
   769
    using finite substor  by (simp only:lang_of_append_rhs lang_of_rexp_of)
cef2893f353b Rewritten of hard direction once more. To make it looking better.
wu
parents: 27
diff changeset
   770
  ultimately show ?thesis by simp
cef2893f353b Rewritten of hard direction once more. To make it looking better.
wu
parents: 27
diff changeset
   771
qed
cef2893f353b Rewritten of hard direction once more. To make it looking better.
wu
parents: 27
diff changeset
   772
cef2893f353b Rewritten of hard direction once more. To make it looking better.
wu
parents: 27
diff changeset
   773
lemma rhs_subst_keeps_finite_rhs:
cef2893f353b Rewritten of hard direction once more. To make it looking better.
wu
parents: 27
diff changeset
   774
  "\<lbrakk>finite rhs; finite yrhs\<rbrakk> \<Longrightarrow> finite (rhs_subst rhs Y yrhs)"
cef2893f353b Rewritten of hard direction once more. To make it looking better.
wu
parents: 27
diff changeset
   775
by (auto simp:rhs_subst_def append_keeps_finite)
cef2893f353b Rewritten of hard direction once more. To make it looking better.
wu
parents: 27
diff changeset
   776
cef2893f353b Rewritten of hard direction once more. To make it looking better.
wu
parents: 27
diff changeset
   777
lemma eqs_subst_keeps_finite:
cef2893f353b Rewritten of hard direction once more. To make it looking better.
wu
parents: 27
diff changeset
   778
  assumes finite:"finite (ES:: (string set \<times> rhs_item set) set)"
cef2893f353b Rewritten of hard direction once more. To make it looking better.
wu
parents: 27
diff changeset
   779
  shows "finite (eqs_subst ES Y yrhs)"
cef2893f353b Rewritten of hard direction once more. To make it looking better.
wu
parents: 27
diff changeset
   780
proof -
30
f5db9e08effc Directory [tphols-2011] is added to host the commented version of [Myhill.thy]. Directory [pres] is created to host a build session for logical image [ListP] which is essentially [Main] extended with [List_prefix.thy].
zhang
parents: 29
diff changeset
   781
  have "finite {(Ya, rhs_subst yrhsa Y yrhs) |Ya yrhsa. (Ya, yrhsa) \<in> ES}" 
f5db9e08effc Directory [tphols-2011] is added to host the commented version of [Myhill.thy]. Directory [pres] is created to host a build session for logical image [ListP] which is essentially [Main] extended with [List_prefix.thy].
zhang
parents: 29
diff changeset
   782
                                                                  (is "finite ?A")
28
cef2893f353b Rewritten of hard direction once more. To make it looking better.
wu
parents: 27
diff changeset
   783
  proof-
cef2893f353b Rewritten of hard direction once more. To make it looking better.
wu
parents: 27
diff changeset
   784
    def eqns' \<equiv> "{((Ya::string set), yrhsa)| Ya yrhsa. (Ya, yrhsa) \<in> ES}"
cef2893f353b Rewritten of hard direction once more. To make it looking better.
wu
parents: 27
diff changeset
   785
    def h \<equiv> "\<lambda> ((Ya::string set), yrhsa). (Ya, rhs_subst yrhsa Y yrhs)"
cef2893f353b Rewritten of hard direction once more. To make it looking better.
wu
parents: 27
diff changeset
   786
    have "finite (h ` eqns')" using finite h_def eqns'_def by auto
cef2893f353b Rewritten of hard direction once more. To make it looking better.
wu
parents: 27
diff changeset
   787
    moreover have "?A = h ` eqns'" by (auto simp:h_def eqns'_def)
cef2893f353b Rewritten of hard direction once more. To make it looking better.
wu
parents: 27
diff changeset
   788
    ultimately show ?thesis by auto      
cef2893f353b Rewritten of hard direction once more. To make it looking better.
wu
parents: 27
diff changeset
   789
  qed
cef2893f353b Rewritten of hard direction once more. To make it looking better.
wu
parents: 27
diff changeset
   790
  thus ?thesis by (simp add:eqs_subst_def)
cef2893f353b Rewritten of hard direction once more. To make it looking better.
wu
parents: 27
diff changeset
   791
qed
cef2893f353b Rewritten of hard direction once more. To make it looking better.
wu
parents: 27
diff changeset
   792
cef2893f353b Rewritten of hard direction once more. To make it looking better.
wu
parents: 27
diff changeset
   793
lemma eqs_subst_keeps_finite_rhs:
cef2893f353b Rewritten of hard direction once more. To make it looking better.
wu
parents: 27
diff changeset
   794
  "\<lbrakk>finite_rhs ES; finite yrhs\<rbrakk> \<Longrightarrow> finite_rhs (eqs_subst ES Y yrhs)"
cef2893f353b Rewritten of hard direction once more. To make it looking better.
wu
parents: 27
diff changeset
   795
by (auto intro:rhs_subst_keeps_finite_rhs simp add:eqs_subst_def finite_rhs_def)
cef2893f353b Rewritten of hard direction once more. To make it looking better.
wu
parents: 27
diff changeset
   796
cef2893f353b Rewritten of hard direction once more. To make it looking better.
wu
parents: 27
diff changeset
   797
lemma append_rhs_keeps_cls:
cef2893f353b Rewritten of hard direction once more. To make it looking better.
wu
parents: 27
diff changeset
   798
  "classes_of (append_rhs_rexp rhs r) = classes_of rhs"
cef2893f353b Rewritten of hard direction once more. To make it looking better.
wu
parents: 27
diff changeset
   799
apply (auto simp:classes_of_def append_rhs_rexp_def)
cef2893f353b Rewritten of hard direction once more. To make it looking better.
wu
parents: 27
diff changeset
   800
apply (case_tac xa, auto simp:image_def)
cef2893f353b Rewritten of hard direction once more. To make it looking better.
wu
parents: 27
diff changeset
   801
by (rule_tac x = "SEQ ra r" in exI, rule_tac x = "Trn x ra" in bexI, simp+)
cef2893f353b Rewritten of hard direction once more. To make it looking better.
wu
parents: 27
diff changeset
   802
cef2893f353b Rewritten of hard direction once more. To make it looking better.
wu
parents: 27
diff changeset
   803
lemma arden_variate_removes_cl:
cef2893f353b Rewritten of hard direction once more. To make it looking better.
wu
parents: 27
diff changeset
   804
  "classes_of (arden_variate Y yrhs) = classes_of yrhs - {Y}"
cef2893f353b Rewritten of hard direction once more. To make it looking better.
wu
parents: 27
diff changeset
   805
apply (simp add:arden_variate_def append_rhs_keeps_cls items_of_def)
cef2893f353b Rewritten of hard direction once more. To make it looking better.
wu
parents: 27
diff changeset
   806
by (auto simp:classes_of_def)
cef2893f353b Rewritten of hard direction once more. To make it looking better.
wu
parents: 27
diff changeset
   807
cef2893f353b Rewritten of hard direction once more. To make it looking better.
wu
parents: 27
diff changeset
   808
lemma lefts_of_keeps_cls:
cef2893f353b Rewritten of hard direction once more. To make it looking better.
wu
parents: 27
diff changeset
   809
  "lefts_of (eqs_subst ES Y yrhs) = lefts_of ES"
cef2893f353b Rewritten of hard direction once more. To make it looking better.
wu
parents: 27
diff changeset
   810
by (auto simp:lefts_of_def eqs_subst_def)
cef2893f353b Rewritten of hard direction once more. To make it looking better.
wu
parents: 27
diff changeset
   811
cef2893f353b Rewritten of hard direction once more. To make it looking better.
wu
parents: 27
diff changeset
   812
lemma rhs_subst_updates_cls:
30
f5db9e08effc Directory [tphols-2011] is added to host the commented version of [Myhill.thy]. Directory [pres] is created to host a build session for logical image [ListP] which is essentially [Main] extended with [List_prefix.thy].
zhang
parents: 29
diff changeset
   813
  "X \<notin> classes_of xrhs \<Longrightarrow> 
f5db9e08effc Directory [tphols-2011] is added to host the commented version of [Myhill.thy]. Directory [pres] is created to host a build session for logical image [ListP] which is essentially [Main] extended with [List_prefix.thy].
zhang
parents: 29
diff changeset
   814
      classes_of (rhs_subst rhs X xrhs) = classes_of rhs \<union> classes_of xrhs - {X}"
f5db9e08effc Directory [tphols-2011] is added to host the commented version of [Myhill.thy]. Directory [pres] is created to host a build session for logical image [ListP] which is essentially [Main] extended with [List_prefix.thy].
zhang
parents: 29
diff changeset
   815
apply (simp only:rhs_subst_def append_rhs_keeps_cls 
f5db9e08effc Directory [tphols-2011] is added to host the commented version of [Myhill.thy]. Directory [pres] is created to host a build session for logical image [ListP] which is essentially [Main] extended with [List_prefix.thy].
zhang
parents: 29
diff changeset
   816
                              classes_of_union_distrib[THEN sym])
28
cef2893f353b Rewritten of hard direction once more. To make it looking better.
wu
parents: 27
diff changeset
   817
by (auto simp:classes_of_def items_of_def)
cef2893f353b Rewritten of hard direction once more. To make it looking better.
wu
parents: 27
diff changeset
   818
cef2893f353b Rewritten of hard direction once more. To make it looking better.
wu
parents: 27
diff changeset
   819
lemma eqs_subst_keeps_self_contained:
cef2893f353b Rewritten of hard direction once more. To make it looking better.
wu
parents: 27
diff changeset
   820
  fixes Y
cef2893f353b Rewritten of hard direction once more. To make it looking better.
wu
parents: 27
diff changeset
   821
  assumes sc: "self_contained (ES \<union> {(Y, yrhs)})" (is "self_contained ?A")
30
f5db9e08effc Directory [tphols-2011] is added to host the commented version of [Myhill.thy]. Directory [pres] is created to host a build session for logical image [ListP] which is essentially [Main] extended with [List_prefix.thy].
zhang
parents: 29
diff changeset
   822
  shows "self_contained (eqs_subst ES Y (arden_variate Y yrhs))" 
f5db9e08effc Directory [tphols-2011] is added to host the commented version of [Myhill.thy]. Directory [pres] is created to host a build session for logical image [ListP] which is essentially [Main] extended with [List_prefix.thy].
zhang
parents: 29
diff changeset
   823
                                                   (is "self_contained ?B")
28
cef2893f353b Rewritten of hard direction once more. To make it looking better.
wu
parents: 27
diff changeset
   824
proof-
cef2893f353b Rewritten of hard direction once more. To make it looking better.
wu
parents: 27
diff changeset
   825
  { fix X xrhs'
cef2893f353b Rewritten of hard direction once more. To make it looking better.
wu
parents: 27
diff changeset
   826
    assume "(X, xrhs') \<in> ?B"
cef2893f353b Rewritten of hard direction once more. To make it looking better.
wu
parents: 27
diff changeset
   827
    then obtain xrhs 
cef2893f353b Rewritten of hard direction once more. To make it looking better.
wu
parents: 27
diff changeset
   828
      where xrhs_xrhs': "xrhs' = rhs_subst xrhs Y (arden_variate Y yrhs)"
cef2893f353b Rewritten of hard direction once more. To make it looking better.
wu
parents: 27
diff changeset
   829
      and X_in: "(X, xrhs) \<in> ES" by (simp add:eqs_subst_def, blast)    
cef2893f353b Rewritten of hard direction once more. To make it looking better.
wu
parents: 27
diff changeset
   830
    have "classes_of xrhs' \<subseteq> lefts_of ?B"
cef2893f353b Rewritten of hard direction once more. To make it looking better.
wu
parents: 27
diff changeset
   831
    proof-
cef2893f353b Rewritten of hard direction once more. To make it looking better.
wu
parents: 27
diff changeset
   832
      have "lefts_of ?B = lefts_of ES" by (auto simp add:lefts_of_def eqs_subst_def)
cef2893f353b Rewritten of hard direction once more. To make it looking better.
wu
parents: 27
diff changeset
   833
      moreover have "classes_of xrhs' \<subseteq> lefts_of ES"
cef2893f353b Rewritten of hard direction once more. To make it looking better.
wu
parents: 27
diff changeset
   834
      proof-
30
f5db9e08effc Directory [tphols-2011] is added to host the commented version of [Myhill.thy]. Directory [pres] is created to host a build session for logical image [ListP] which is essentially [Main] extended with [List_prefix.thy].
zhang
parents: 29
diff changeset
   835
        have "classes_of xrhs' \<subseteq> 
f5db9e08effc Directory [tphols-2011] is added to host the commented version of [Myhill.thy]. Directory [pres] is created to host a build session for logical image [ListP] which is essentially [Main] extended with [List_prefix.thy].
zhang
parents: 29
diff changeset
   836
                        classes_of xrhs \<union> classes_of (arden_variate Y yrhs) - {Y}"
28
cef2893f353b Rewritten of hard direction once more. To make it looking better.
wu
parents: 27
diff changeset
   837
        proof-
30
f5db9e08effc Directory [tphols-2011] is added to host the commented version of [Myhill.thy]. Directory [pres] is created to host a build session for logical image [ListP] which is essentially [Main] extended with [List_prefix.thy].
zhang
parents: 29
diff changeset
   838
          have "Y \<notin> classes_of (arden_variate Y yrhs)" 
f5db9e08effc Directory [tphols-2011] is added to host the commented version of [Myhill.thy]. Directory [pres] is created to host a build session for logical image [ListP] which is essentially [Main] extended with [List_prefix.thy].
zhang
parents: 29
diff changeset
   839
            using arden_variate_removes_cl by simp
28
cef2893f353b Rewritten of hard direction once more. To make it looking better.
wu
parents: 27
diff changeset
   840
          thus ?thesis using xrhs_xrhs' by (auto simp:rhs_subst_updates_cls)
cef2893f353b Rewritten of hard direction once more. To make it looking better.
wu
parents: 27
diff changeset
   841
        qed
cef2893f353b Rewritten of hard direction once more. To make it looking better.
wu
parents: 27
diff changeset
   842
        moreover have "classes_of xrhs \<subseteq> lefts_of ES \<union> {Y}" using X_in sc
cef2893f353b Rewritten of hard direction once more. To make it looking better.
wu
parents: 27
diff changeset
   843
          apply (simp only:self_contained_def lefts_of_union_distrib[THEN sym])
cef2893f353b Rewritten of hard direction once more. To make it looking better.
wu
parents: 27
diff changeset
   844
          by (drule_tac x = "(X, xrhs)" in bspec, auto simp:lefts_of_def)
30
f5db9e08effc Directory [tphols-2011] is added to host the commented version of [Myhill.thy]. Directory [pres] is created to host a build session for logical image [ListP] which is essentially [Main] extended with [List_prefix.thy].
zhang
parents: 29
diff changeset
   845
        moreover have "classes_of (arden_variate Y yrhs) \<subseteq> lefts_of ES \<union> {Y}" 
f5db9e08effc Directory [tphols-2011] is added to host the commented version of [Myhill.thy]. Directory [pres] is created to host a build session for logical image [ListP] which is essentially [Main] extended with [List_prefix.thy].
zhang
parents: 29
diff changeset
   846
          using sc 
28
cef2893f353b Rewritten of hard direction once more. To make it looking better.
wu
parents: 27
diff changeset
   847
          by (auto simp add:arden_variate_removes_cl self_contained_def lefts_of_def)
cef2893f353b Rewritten of hard direction once more. To make it looking better.
wu
parents: 27
diff changeset
   848
        ultimately show ?thesis by auto
cef2893f353b Rewritten of hard direction once more. To make it looking better.
wu
parents: 27
diff changeset
   849
      qed
cef2893f353b Rewritten of hard direction once more. To make it looking better.
wu
parents: 27
diff changeset
   850
      ultimately show ?thesis by simp
cef2893f353b Rewritten of hard direction once more. To make it looking better.
wu
parents: 27
diff changeset
   851
    qed
cef2893f353b Rewritten of hard direction once more. To make it looking better.
wu
parents: 27
diff changeset
   852
  } thus ?thesis by (auto simp only:eqs_subst_def self_contained_def)
cef2893f353b Rewritten of hard direction once more. To make it looking better.
wu
parents: 27
diff changeset
   853
qed
cef2893f353b Rewritten of hard direction once more. To make it looking better.
wu
parents: 27
diff changeset
   854
cef2893f353b Rewritten of hard direction once more. To make it looking better.
wu
parents: 27
diff changeset
   855
lemma eqs_subst_satisfy_Inv:
cef2893f353b Rewritten of hard direction once more. To make it looking better.
wu
parents: 27
diff changeset
   856
  assumes Inv_ES: "Inv (ES \<union> {(Y, yrhs)})"
cef2893f353b Rewritten of hard direction once more. To make it looking better.
wu
parents: 27
diff changeset
   857
  shows "Inv (eqs_subst ES Y (arden_variate Y yrhs))"
cef2893f353b Rewritten of hard direction once more. To make it looking better.
wu
parents: 27
diff changeset
   858
proof -  
30
f5db9e08effc Directory [tphols-2011] is added to host the commented version of [Myhill.thy]. Directory [pres] is created to host a build session for logical image [ListP] which is essentially [Main] extended with [List_prefix.thy].
zhang
parents: 29
diff changeset
   859
  have finite_yrhs: "finite yrhs" 
f5db9e08effc Directory [tphols-2011] is added to host the commented version of [Myhill.thy]. Directory [pres] is created to host a build session for logical image [ListP] which is essentially [Main] extended with [List_prefix.thy].
zhang
parents: 29
diff changeset
   860
    using Inv_ES by (auto simp:Inv_def finite_rhs_def)
f5db9e08effc Directory [tphols-2011] is added to host the commented version of [Myhill.thy]. Directory [pres] is created to host a build session for logical image [ListP] which is essentially [Main] extended with [List_prefix.thy].
zhang
parents: 29
diff changeset
   861
  have nonempty_yrhs: "rhs_nonempty yrhs" 
f5db9e08effc Directory [tphols-2011] is added to host the commented version of [Myhill.thy]. Directory [pres] is created to host a build session for logical image [ListP] which is essentially [Main] extended with [List_prefix.thy].
zhang
parents: 29
diff changeset
   862
    using Inv_ES by (auto simp:Inv_def ardenable_def)
f5db9e08effc Directory [tphols-2011] is added to host the commented version of [Myhill.thy]. Directory [pres] is created to host a build session for logical image [ListP] which is essentially [Main] extended with [List_prefix.thy].
zhang
parents: 29
diff changeset
   863
  have Y_eq_yrhs: "Y = L yrhs" 
f5db9e08effc Directory [tphols-2011] is added to host the commented version of [Myhill.thy]. Directory [pres] is created to host a build session for logical image [ListP] which is essentially [Main] extended with [List_prefix.thy].
zhang
parents: 29
diff changeset
   864
    using Inv_ES by (simp only:Inv_def valid_eqns_def, blast)
f5db9e08effc Directory [tphols-2011] is added to host the commented version of [Myhill.thy]. Directory [pres] is created to host a build session for logical image [ListP] which is essentially [Main] extended with [List_prefix.thy].
zhang
parents: 29
diff changeset
   865
  have "distinct_equas (eqs_subst ES Y (arden_variate Y yrhs))" 
f5db9e08effc Directory [tphols-2011] is added to host the commented version of [Myhill.thy]. Directory [pres] is created to host a build session for logical image [ListP] which is essentially [Main] extended with [List_prefix.thy].
zhang
parents: 29
diff changeset
   866
    using Inv_ES
28
cef2893f353b Rewritten of hard direction once more. To make it looking better.
wu
parents: 27
diff changeset
   867
    by (auto simp:distinct_equas_def eqs_subst_def Inv_def)
30
f5db9e08effc Directory [tphols-2011] is added to host the commented version of [Myhill.thy]. Directory [pres] is created to host a build session for logical image [ListP] which is essentially [Main] extended with [List_prefix.thy].
zhang
parents: 29
diff changeset
   868
  moreover have "finite (eqs_subst ES Y (arden_variate Y yrhs))" 
f5db9e08effc Directory [tphols-2011] is added to host the commented version of [Myhill.thy]. Directory [pres] is created to host a build session for logical image [ListP] which is essentially [Main] extended with [List_prefix.thy].
zhang
parents: 29
diff changeset
   869
    using Inv_ES by (simp add:Inv_def eqs_subst_keeps_finite)
28
cef2893f353b Rewritten of hard direction once more. To make it looking better.
wu
parents: 27
diff changeset
   870
  moreover have "finite_rhs (eqs_subst ES Y (arden_variate Y yrhs))"
cef2893f353b Rewritten of hard direction once more. To make it looking better.
wu
parents: 27
diff changeset
   871
  proof-
30
f5db9e08effc Directory [tphols-2011] is added to host the commented version of [Myhill.thy]. Directory [pres] is created to host a build session for logical image [ListP] which is essentially [Main] extended with [List_prefix.thy].
zhang
parents: 29
diff changeset
   872
    have "finite_rhs ES" using Inv_ES 
f5db9e08effc Directory [tphols-2011] is added to host the commented version of [Myhill.thy]. Directory [pres] is created to host a build session for logical image [ListP] which is essentially [Main] extended with [List_prefix.thy].
zhang
parents: 29
diff changeset
   873
      by (simp add:Inv_def finite_rhs_def)
28
cef2893f353b Rewritten of hard direction once more. To make it looking better.
wu
parents: 27
diff changeset
   874
    moreover have "finite (arden_variate Y yrhs)"
cef2893f353b Rewritten of hard direction once more. To make it looking better.
wu
parents: 27
diff changeset
   875
    proof -
30
f5db9e08effc Directory [tphols-2011] is added to host the commented version of [Myhill.thy]. Directory [pres] is created to host a build session for logical image [ListP] which is essentially [Main] extended with [List_prefix.thy].
zhang
parents: 29
diff changeset
   876
      have "finite yrhs" using Inv_ES 
f5db9e08effc Directory [tphols-2011] is added to host the commented version of [Myhill.thy]. Directory [pres] is created to host a build session for logical image [ListP] which is essentially [Main] extended with [List_prefix.thy].
zhang
parents: 29
diff changeset
   877
        by (auto simp:Inv_def finite_rhs_def)
28
cef2893f353b Rewritten of hard direction once more. To make it looking better.
wu
parents: 27
diff changeset
   878
      thus ?thesis using arden_variate_keeps_finite by simp
cef2893f353b Rewritten of hard direction once more. To make it looking better.
wu
parents: 27
diff changeset
   879
    qed
30
f5db9e08effc Directory [tphols-2011] is added to host the commented version of [Myhill.thy]. Directory [pres] is created to host a build session for logical image [ListP] which is essentially [Main] extended with [List_prefix.thy].
zhang
parents: 29
diff changeset
   880
    ultimately show ?thesis 
f5db9e08effc Directory [tphols-2011] is added to host the commented version of [Myhill.thy]. Directory [pres] is created to host a build session for logical image [ListP] which is essentially [Main] extended with [List_prefix.thy].
zhang
parents: 29
diff changeset
   881
      by (simp add:eqs_subst_keeps_finite_rhs)
28
cef2893f353b Rewritten of hard direction once more. To make it looking better.
wu
parents: 27
diff changeset
   882
  qed
cef2893f353b Rewritten of hard direction once more. To make it looking better.
wu
parents: 27
diff changeset
   883
  moreover have "ardenable (eqs_subst ES Y (arden_variate Y yrhs))"
cef2893f353b Rewritten of hard direction once more. To make it looking better.
wu
parents: 27
diff changeset
   884
  proof - 
cef2893f353b Rewritten of hard direction once more. To make it looking better.
wu
parents: 27
diff changeset
   885
    { fix X rhs
cef2893f353b Rewritten of hard direction once more. To make it looking better.
wu
parents: 27
diff changeset
   886
      assume "(X, rhs) \<in> ES"
30
f5db9e08effc Directory [tphols-2011] is added to host the commented version of [Myhill.thy]. Directory [pres] is created to host a build session for logical image [ListP] which is essentially [Main] extended with [List_prefix.thy].
zhang
parents: 29
diff changeset
   887
      hence "rhs_nonempty rhs"  using prems Inv_ES  
f5db9e08effc Directory [tphols-2011] is added to host the commented version of [Myhill.thy]. Directory [pres] is created to host a build session for logical image [ListP] which is essentially [Main] extended with [List_prefix.thy].
zhang
parents: 29
diff changeset
   888
        by (simp add:Inv_def ardenable_def)
f5db9e08effc Directory [tphols-2011] is added to host the commented version of [Myhill.thy]. Directory [pres] is created to host a build session for logical image [ListP] which is essentially [Main] extended with [List_prefix.thy].
zhang
parents: 29
diff changeset
   889
      with nonempty_yrhs 
f5db9e08effc Directory [tphols-2011] is added to host the commented version of [Myhill.thy]. Directory [pres] is created to host a build session for logical image [ListP] which is essentially [Main] extended with [List_prefix.thy].
zhang
parents: 29
diff changeset
   890
      have "rhs_nonempty (rhs_subst rhs Y (arden_variate Y yrhs))"
f5db9e08effc Directory [tphols-2011] is added to host the commented version of [Myhill.thy]. Directory [pres] is created to host a build session for logical image [ListP] which is essentially [Main] extended with [List_prefix.thy].
zhang
parents: 29
diff changeset
   891
        by (simp add:nonempty_yrhs 
f5db9e08effc Directory [tphols-2011] is added to host the commented version of [Myhill.thy]. Directory [pres] is created to host a build session for logical image [ListP] which is essentially [Main] extended with [List_prefix.thy].
zhang
parents: 29
diff changeset
   892
               rhs_subst_keeps_nonempty arden_variate_keeps_nonempty)
28
cef2893f353b Rewritten of hard direction once more. To make it looking better.
wu
parents: 27
diff changeset
   893
    } thus ?thesis by (auto simp add:ardenable_def eqs_subst_def)
cef2893f353b Rewritten of hard direction once more. To make it looking better.
wu
parents: 27
diff changeset
   894
  qed
cef2893f353b Rewritten of hard direction once more. To make it looking better.
wu
parents: 27
diff changeset
   895
  moreover have "valid_eqns (eqs_subst ES Y (arden_variate Y yrhs))"
cef2893f353b Rewritten of hard direction once more. To make it looking better.
wu
parents: 27
diff changeset
   896
  proof-
30
f5db9e08effc Directory [tphols-2011] is added to host the commented version of [Myhill.thy]. Directory [pres] is created to host a build session for logical image [ListP] which is essentially [Main] extended with [List_prefix.thy].
zhang
parents: 29
diff changeset
   897
    have "Y = L (arden_variate Y yrhs)" 
f5db9e08effc Directory [tphols-2011] is added to host the commented version of [Myhill.thy]. Directory [pres] is created to host a build session for logical image [ListP] which is essentially [Main] extended with [List_prefix.thy].
zhang
parents: 29
diff changeset
   898
      using Y_eq_yrhs Inv_ES finite_yrhs nonempty_yrhs      
f5db9e08effc Directory [tphols-2011] is added to host the commented version of [Myhill.thy]. Directory [pres] is created to host a build session for logical image [ListP] which is essentially [Main] extended with [List_prefix.thy].
zhang
parents: 29
diff changeset
   899
      by (rule_tac arden_variate_keeps_eq, (simp add:rexp_of_empty)+)
28
cef2893f353b Rewritten of hard direction once more. To make it looking better.
wu
parents: 27
diff changeset
   900
    thus ?thesis using Inv_ES 
30
f5db9e08effc Directory [tphols-2011] is added to host the commented version of [Myhill.thy]. Directory [pres] is created to host a build session for logical image [ListP] which is essentially [Main] extended with [List_prefix.thy].
zhang
parents: 29
diff changeset
   901
      by (clarsimp simp add:valid_eqns_def 
f5db9e08effc Directory [tphols-2011] is added to host the commented version of [Myhill.thy]. Directory [pres] is created to host a build session for logical image [ListP] which is essentially [Main] extended with [List_prefix.thy].
zhang
parents: 29
diff changeset
   902
              eqs_subst_def rhs_subst_keeps_eq Inv_def finite_rhs_def
28
cef2893f353b Rewritten of hard direction once more. To make it looking better.
wu
parents: 27
diff changeset
   903
                   simp del:L_rhs.simps)
cef2893f353b Rewritten of hard direction once more. To make it looking better.
wu
parents: 27
diff changeset
   904
  qed
30
f5db9e08effc Directory [tphols-2011] is added to host the commented version of [Myhill.thy]. Directory [pres] is created to host a build session for logical image [ListP] which is essentially [Main] extended with [List_prefix.thy].
zhang
parents: 29
diff changeset
   905
  moreover have 
f5db9e08effc Directory [tphols-2011] is added to host the commented version of [Myhill.thy]. Directory [pres] is created to host a build session for logical image [ListP] which is essentially [Main] extended with [List_prefix.thy].
zhang
parents: 29
diff changeset
   906
    non_empty_subst: "non_empty (eqs_subst ES Y (arden_variate Y yrhs))"
28
cef2893f353b Rewritten of hard direction once more. To make it looking better.
wu
parents: 27
diff changeset
   907
    using Inv_ES by (auto simp:Inv_def non_empty_def eqs_subst_def)
30
f5db9e08effc Directory [tphols-2011] is added to host the commented version of [Myhill.thy]. Directory [pres] is created to host a build session for logical image [ListP] which is essentially [Main] extended with [List_prefix.thy].
zhang
parents: 29
diff changeset
   908
  moreover 
f5db9e08effc Directory [tphols-2011] is added to host the commented version of [Myhill.thy]. Directory [pres] is created to host a build session for logical image [ListP] which is essentially [Main] extended with [List_prefix.thy].
zhang
parents: 29
diff changeset
   909
  have self_subst: "self_contained (eqs_subst ES Y (arden_variate Y yrhs))"
28
cef2893f353b Rewritten of hard direction once more. To make it looking better.
wu
parents: 27
diff changeset
   910
    using Inv_ES eqs_subst_keeps_self_contained by (simp add:Inv_def)
cef2893f353b Rewritten of hard direction once more. To make it looking better.
wu
parents: 27
diff changeset
   911
  ultimately show ?thesis using Inv_ES by (simp add:Inv_def)
cef2893f353b Rewritten of hard direction once more. To make it looking better.
wu
parents: 27
diff changeset
   912
qed
cef2893f353b Rewritten of hard direction once more. To make it looking better.
wu
parents: 27
diff changeset
   913
cef2893f353b Rewritten of hard direction once more. To make it looking better.
wu
parents: 27
diff changeset
   914
lemma eqs_subst_card_le: 
cef2893f353b Rewritten of hard direction once more. To make it looking better.
wu
parents: 27
diff changeset
   915
  assumes finite: "finite (ES::(string set \<times> rhs_item set) set)"
cef2893f353b Rewritten of hard direction once more. To make it looking better.
wu
parents: 27
diff changeset
   916
  shows "card (eqs_subst ES Y yrhs) <= card ES"
cef2893f353b Rewritten of hard direction once more. To make it looking better.
wu
parents: 27
diff changeset
   917
proof-
cef2893f353b Rewritten of hard direction once more. To make it looking better.
wu
parents: 27
diff changeset
   918
  def f \<equiv> "\<lambda> x. ((fst x)::string set, rhs_subst (snd x) Y yrhs)"
cef2893f353b Rewritten of hard direction once more. To make it looking better.
wu
parents: 27
diff changeset
   919
  have "eqs_subst ES Y yrhs = f ` ES" 
cef2893f353b Rewritten of hard direction once more. To make it looking better.
wu
parents: 27
diff changeset
   920
    apply (auto simp:eqs_subst_def f_def image_def)
cef2893f353b Rewritten of hard direction once more. To make it looking better.
wu
parents: 27
diff changeset
   921
    by (rule_tac x = "(Ya, yrhsa)" in bexI, simp+)
cef2893f353b Rewritten of hard direction once more. To make it looking better.
wu
parents: 27
diff changeset
   922
  thus ?thesis using finite by (auto intro:card_image_le)
cef2893f353b Rewritten of hard direction once more. To make it looking better.
wu
parents: 27
diff changeset
   923
qed
cef2893f353b Rewritten of hard direction once more. To make it looking better.
wu
parents: 27
diff changeset
   924
cef2893f353b Rewritten of hard direction once more. To make it looking better.
wu
parents: 27
diff changeset
   925
lemma eqs_subst_cls_remains: 
cef2893f353b Rewritten of hard direction once more. To make it looking better.
wu
parents: 27
diff changeset
   926
  "(X, xrhs) \<in> ES \<Longrightarrow> \<exists> xrhs'. (X, xrhs') \<in> (eqs_subst ES Y yrhs)"
cef2893f353b Rewritten of hard direction once more. To make it looking better.
wu
parents: 27
diff changeset
   927
by (auto simp:eqs_subst_def)
cef2893f353b Rewritten of hard direction once more. To make it looking better.
wu
parents: 27
diff changeset
   928
cef2893f353b Rewritten of hard direction once more. To make it looking better.
wu
parents: 27
diff changeset
   929
lemma card_noteq_1_has_more:
cef2893f353b Rewritten of hard direction once more. To make it looking better.
wu
parents: 27
diff changeset
   930
  assumes card:"card S \<noteq> 1"
cef2893f353b Rewritten of hard direction once more. To make it looking better.
wu
parents: 27
diff changeset
   931
  and e_in: "e \<in> S"
cef2893f353b Rewritten of hard direction once more. To make it looking better.
wu
parents: 27
diff changeset
   932
  and finite: "finite S"
cef2893f353b Rewritten of hard direction once more. To make it looking better.
wu
parents: 27
diff changeset
   933
  obtains e' where "e' \<in> S \<and> e \<noteq> e'" 
cef2893f353b Rewritten of hard direction once more. To make it looking better.
wu
parents: 27
diff changeset
   934
proof-
cef2893f353b Rewritten of hard direction once more. To make it looking better.
wu
parents: 27
diff changeset
   935
  have "card (S - {e}) > 0"
cef2893f353b Rewritten of hard direction once more. To make it looking better.
wu
parents: 27
diff changeset
   936
  proof -
30
f5db9e08effc Directory [tphols-2011] is added to host the commented version of [Myhill.thy]. Directory [pres] is created to host a build session for logical image [ListP] which is essentially [Main] extended with [List_prefix.thy].
zhang
parents: 29
diff changeset
   937
    have "card S > 1" using card e_in finite  
f5db9e08effc Directory [tphols-2011] is added to host the commented version of [Myhill.thy]. Directory [pres] is created to host a build session for logical image [ListP] which is essentially [Main] extended with [List_prefix.thy].
zhang
parents: 29
diff changeset
   938
      by (case_tac "card S", auto) 
28
cef2893f353b Rewritten of hard direction once more. To make it looking better.
wu
parents: 27
diff changeset
   939
    thus ?thesis using finite e_in by auto
cef2893f353b Rewritten of hard direction once more. To make it looking better.
wu
parents: 27
diff changeset
   940
  qed
cef2893f353b Rewritten of hard direction once more. To make it looking better.
wu
parents: 27
diff changeset
   941
  hence "S - {e} \<noteq> {}" using finite by (rule_tac notI, simp)
cef2893f353b Rewritten of hard direction once more. To make it looking better.
wu
parents: 27
diff changeset
   942
  thus "(\<And>e'. e' \<in> S \<and> e \<noteq> e' \<Longrightarrow> thesis) \<Longrightarrow> thesis" by auto
cef2893f353b Rewritten of hard direction once more. To make it looking better.
wu
parents: 27
diff changeset
   943
qed
27
90a57a533b0c Add new file for the new definition of the hard direction's simplification.
wu
parents:
diff changeset
   944
90a57a533b0c Add new file for the new definition of the hard direction's simplification.
wu
parents:
diff changeset
   945
lemma iteration_step: 
90a57a533b0c Add new file for the new definition of the hard direction's simplification.
wu
parents:
diff changeset
   946
  assumes Inv_ES: "Inv ES"
28
cef2893f353b Rewritten of hard direction once more. To make it looking better.
wu
parents: 27
diff changeset
   947
  and    X_in_ES: "(X, xrhs) \<in> ES"
cef2893f353b Rewritten of hard direction once more. To make it looking better.
wu
parents: 27
diff changeset
   948
  and    not_T: "card ES \<noteq> 1"
30
f5db9e08effc Directory [tphols-2011] is added to host the commented version of [Myhill.thy]. Directory [pres] is created to host a build session for logical image [ListP] which is essentially [Main] extended with [List_prefix.thy].
zhang
parents: 29
diff changeset
   949
  shows "\<exists> ES'. (Inv ES' \<and> (\<exists> xrhs'.(X, xrhs') \<in> ES')) \<and> 
f5db9e08effc Directory [tphols-2011] is added to host the commented version of [Myhill.thy]. Directory [pres] is created to host a build session for logical image [ListP] which is essentially [Main] extended with [List_prefix.thy].
zhang
parents: 29
diff changeset
   950
                (card ES', card ES) \<in> less_than" (is "\<exists> ES'. ?P ES'")
27
90a57a533b0c Add new file for the new definition of the hard direction's simplification.
wu
parents:
diff changeset
   951
proof -
28
cef2893f353b Rewritten of hard direction once more. To make it looking better.
wu
parents: 27
diff changeset
   952
  have finite_ES: "finite ES" using Inv_ES by (simp add:Inv_def)
30
f5db9e08effc Directory [tphols-2011] is added to host the commented version of [Myhill.thy]. Directory [pres] is created to host a build session for logical image [ListP] which is essentially [Main] extended with [List_prefix.thy].
zhang
parents: 29
diff changeset
   953
  then obtain Y yrhs 
f5db9e08effc Directory [tphols-2011] is added to host the commented version of [Myhill.thy]. Directory [pres] is created to host a build session for logical image [ListP] which is essentially [Main] extended with [List_prefix.thy].
zhang
parents: 29
diff changeset
   954
    where Y_in_ES: "(Y, yrhs) \<in> ES" and not_eq: "(X, xrhs) \<noteq> (Y, yrhs)" 
28
cef2893f353b Rewritten of hard direction once more. To make it looking better.
wu
parents: 27
diff changeset
   955
    using not_T X_in_ES by (drule_tac card_noteq_1_has_more, auto)
cef2893f353b Rewritten of hard direction once more. To make it looking better.
wu
parents: 27
diff changeset
   956
  def ES' == "ES - {(Y, yrhs)}"
cef2893f353b Rewritten of hard direction once more. To make it looking better.
wu
parents: 27
diff changeset
   957
  let ?ES'' = "eqs_subst ES' Y (arden_variate Y yrhs)"
cef2893f353b Rewritten of hard direction once more. To make it looking better.
wu
parents: 27
diff changeset
   958
  have "?P ?ES''"
cef2893f353b Rewritten of hard direction once more. To make it looking better.
wu
parents: 27
diff changeset
   959
  proof -
cef2893f353b Rewritten of hard direction once more. To make it looking better.
wu
parents: 27
diff changeset
   960
    have "Inv ?ES''" using Y_in_ES Inv_ES
cef2893f353b Rewritten of hard direction once more. To make it looking better.
wu
parents: 27
diff changeset
   961
      by (rule_tac eqs_subst_satisfy_Inv, simp add:ES'_def insert_absorb)
cef2893f353b Rewritten of hard direction once more. To make it looking better.
wu
parents: 27
diff changeset
   962
    moreover have "\<exists>xrhs'. (X, xrhs') \<in> ?ES''"  using not_eq X_in_ES
cef2893f353b Rewritten of hard direction once more. To make it looking better.
wu
parents: 27
diff changeset
   963
      by (rule_tac ES = ES' in eqs_subst_cls_remains, auto simp add:ES'_def)
cef2893f353b Rewritten of hard direction once more. To make it looking better.
wu
parents: 27
diff changeset
   964
    moreover have "(card ?ES'', card ES) \<in> less_than" 
cef2893f353b Rewritten of hard direction once more. To make it looking better.
wu
parents: 27
diff changeset
   965
    proof -
cef2893f353b Rewritten of hard direction once more. To make it looking better.
wu
parents: 27
diff changeset
   966
      have "finite ES'" using finite_ES ES'_def by auto
cef2893f353b Rewritten of hard direction once more. To make it looking better.
wu
parents: 27
diff changeset
   967
      moreover have "card ES' < card ES" using finite_ES Y_in_ES
cef2893f353b Rewritten of hard direction once more. To make it looking better.
wu
parents: 27
diff changeset
   968
        by (auto simp:ES'_def card_gt_0_iff intro:diff_Suc_less)
cef2893f353b Rewritten of hard direction once more. To make it looking better.
wu
parents: 27
diff changeset
   969
      ultimately show ?thesis 
cef2893f353b Rewritten of hard direction once more. To make it looking better.
wu
parents: 27
diff changeset
   970
        by (auto dest:eqs_subst_card_le elim:le_less_trans)
cef2893f353b Rewritten of hard direction once more. To make it looking better.
wu
parents: 27
diff changeset
   971
    qed
cef2893f353b Rewritten of hard direction once more. To make it looking better.
wu
parents: 27
diff changeset
   972
    ultimately show ?thesis by simp
cef2893f353b Rewritten of hard direction once more. To make it looking better.
wu
parents: 27
diff changeset
   973
  qed
cef2893f353b Rewritten of hard direction once more. To make it looking better.
wu
parents: 27
diff changeset
   974
  thus ?thesis by blast
cef2893f353b Rewritten of hard direction once more. To make it looking better.
wu
parents: 27
diff changeset
   975
qed
cef2893f353b Rewritten of hard direction once more. To make it looking better.
wu
parents: 27
diff changeset
   976
30
f5db9e08effc Directory [tphols-2011] is added to host the commented version of [Myhill.thy]. Directory [pres] is created to host a build session for logical image [ListP] which is essentially [Main] extended with [List_prefix.thy].
zhang
parents: 29
diff changeset
   977
text {*
f5db9e08effc Directory [tphols-2011] is added to host the commented version of [Myhill.thy]. Directory [pres] is created to host a build session for logical image [ListP] which is essentially [Main] extended with [List_prefix.thy].
zhang
parents: 29
diff changeset
   978
  From this point until @{text "hard_direction"}, the hard direction is proved
f5db9e08effc Directory [tphols-2011] is added to host the commented version of [Myhill.thy]. Directory [pres] is created to host a build session for logical image [ListP] which is essentially [Main] extended with [List_prefix.thy].
zhang
parents: 29
diff changeset
   979
  through a simple application of the iteration principle.
f5db9e08effc Directory [tphols-2011] is added to host the commented version of [Myhill.thy]. Directory [pres] is created to host a build session for logical image [ListP] which is essentially [Main] extended with [List_prefix.thy].
zhang
parents: 29
diff changeset
   980
*}
27
90a57a533b0c Add new file for the new definition of the hard direction's simplification.
wu
parents:
diff changeset
   981
28
cef2893f353b Rewritten of hard direction once more. To make it looking better.
wu
parents: 27
diff changeset
   982
lemma iteration_conc: 
cef2893f353b Rewritten of hard direction once more. To make it looking better.
wu
parents: 27
diff changeset
   983
  assumes history: "Inv ES"
cef2893f353b Rewritten of hard direction once more. To make it looking better.
wu
parents: 27
diff changeset
   984
  and    X_in_ES: "\<exists> xrhs. (X, xrhs) \<in> ES"
30
f5db9e08effc Directory [tphols-2011] is added to host the commented version of [Myhill.thy]. Directory [pres] is created to host a build session for logical image [ListP] which is essentially [Main] extended with [List_prefix.thy].
zhang
parents: 29
diff changeset
   985
  shows 
f5db9e08effc Directory [tphols-2011] is added to host the commented version of [Myhill.thy]. Directory [pres] is created to host a build session for logical image [ListP] which is essentially [Main] extended with [List_prefix.thy].
zhang
parents: 29
diff changeset
   986
  "\<exists> ES'. (Inv ES' \<and> (\<exists> xrhs'. (X, xrhs') \<in> ES')) \<and> card ES' = 1" 
f5db9e08effc Directory [tphols-2011] is added to host the commented version of [Myhill.thy]. Directory [pres] is created to host a build session for logical image [ListP] which is essentially [Main] extended with [List_prefix.thy].
zhang
parents: 29
diff changeset
   987
                                                          (is "\<exists> ES'. ?P ES'")
28
cef2893f353b Rewritten of hard direction once more. To make it looking better.
wu
parents: 27
diff changeset
   988
proof (cases "card ES = 1")
cef2893f353b Rewritten of hard direction once more. To make it looking better.
wu
parents: 27
diff changeset
   989
  case True
cef2893f353b Rewritten of hard direction once more. To make it looking better.
wu
parents: 27
diff changeset
   990
  thus ?thesis using history X_in_ES
cef2893f353b Rewritten of hard direction once more. To make it looking better.
wu
parents: 27
diff changeset
   991
    by blast
cef2893f353b Rewritten of hard direction once more. To make it looking better.
wu
parents: 27
diff changeset
   992
next
cef2893f353b Rewritten of hard direction once more. To make it looking better.
wu
parents: 27
diff changeset
   993
  case False  
cef2893f353b Rewritten of hard direction once more. To make it looking better.
wu
parents: 27
diff changeset
   994
  thus ?thesis using history iteration_step X_in_ES
cef2893f353b Rewritten of hard direction once more. To make it looking better.
wu
parents: 27
diff changeset
   995
    by (rule_tac f = card in wf_iter, auto)
cef2893f353b Rewritten of hard direction once more. To make it looking better.
wu
parents: 27
diff changeset
   996
qed
cef2893f353b Rewritten of hard direction once more. To make it looking better.
wu
parents: 27
diff changeset
   997
  
cef2893f353b Rewritten of hard direction once more. To make it looking better.
wu
parents: 27
diff changeset
   998
lemma last_cl_exists_rexp:
cef2893f353b Rewritten of hard direction once more. To make it looking better.
wu
parents: 27
diff changeset
   999
  assumes ES_single: "ES = {(X, xrhs)}" 
cef2893f353b Rewritten of hard direction once more. To make it looking better.
wu
parents: 27
diff changeset
  1000
  and Inv_ES: "Inv ES"
cef2893f353b Rewritten of hard direction once more. To make it looking better.
wu
parents: 27
diff changeset
  1001
  shows "\<exists> (r::rexp). L r = X" (is "\<exists> r. ?P r")
cef2893f353b Rewritten of hard direction once more. To make it looking better.
wu
parents: 27
diff changeset
  1002
proof-
cef2893f353b Rewritten of hard direction once more. To make it looking better.
wu
parents: 27
diff changeset
  1003
  let ?A = "arden_variate X xrhs"
cef2893f353b Rewritten of hard direction once more. To make it looking better.
wu
parents: 27
diff changeset
  1004
  have "?P (rexp_of_lam ?A)"
cef2893f353b Rewritten of hard direction once more. To make it looking better.
wu
parents: 27
diff changeset
  1005
  proof -
cef2893f353b Rewritten of hard direction once more. To make it looking better.
wu
parents: 27
diff changeset
  1006
    have "L (rexp_of_lam ?A) = L (lam_of ?A)"
cef2893f353b Rewritten of hard direction once more. To make it looking better.
wu
parents: 27
diff changeset
  1007
    proof(rule rexp_of_lam_eq_lam_set)
cef2893f353b Rewritten of hard direction once more. To make it looking better.
wu
parents: 27
diff changeset
  1008
      show "finite (arden_variate X xrhs)" using Inv_ES ES_single 
30
f5db9e08effc Directory [tphols-2011] is added to host the commented version of [Myhill.thy]. Directory [pres] is created to host a build session for logical image [ListP] which is essentially [Main] extended with [List_prefix.thy].
zhang
parents: 29
diff changeset
  1009
        by (rule_tac arden_variate_keeps_finite, 
f5db9e08effc Directory [tphols-2011] is added to host the commented version of [Myhill.thy]. Directory [pres] is created to host a build session for logical image [ListP] which is essentially [Main] extended with [List_prefix.thy].
zhang
parents: 29
diff changeset
  1010
                       auto simp add:Inv_def finite_rhs_def)
28
cef2893f353b Rewritten of hard direction once more. To make it looking better.
wu
parents: 27
diff changeset
  1011
    qed
cef2893f353b Rewritten of hard direction once more. To make it looking better.
wu
parents: 27
diff changeset
  1012
    also have "\<dots> = L ?A"
cef2893f353b Rewritten of hard direction once more. To make it looking better.
wu
parents: 27
diff changeset
  1013
    proof-
cef2893f353b Rewritten of hard direction once more. To make it looking better.
wu
parents: 27
diff changeset
  1014
      have "lam_of ?A = ?A"
cef2893f353b Rewritten of hard direction once more. To make it looking better.
wu
parents: 27
diff changeset
  1015
      proof-
cef2893f353b Rewritten of hard direction once more. To make it looking better.
wu
parents: 27
diff changeset
  1016
        have "classes_of ?A = {}" using Inv_ES ES_single
30
f5db9e08effc Directory [tphols-2011] is added to host the commented version of [Myhill.thy]. Directory [pres] is created to host a build session for logical image [ListP] which is essentially [Main] extended with [List_prefix.thy].
zhang
parents: 29
diff changeset
  1017
          by (simp add:arden_variate_removes_cl 
f5db9e08effc Directory [tphols-2011] is added to host the commented version of [Myhill.thy]. Directory [pres] is created to host a build session for logical image [ListP] which is essentially [Main] extended with [List_prefix.thy].
zhang
parents: 29
diff changeset
  1018
                       self_contained_def Inv_def lefts_of_def) 
f5db9e08effc Directory [tphols-2011] is added to host the commented version of [Myhill.thy]. Directory [pres] is created to host a build session for logical image [ListP] which is essentially [Main] extended with [List_prefix.thy].
zhang
parents: 29
diff changeset
  1019
        thus ?thesis 
f5db9e08effc Directory [tphols-2011] is added to host the commented version of [Myhill.thy]. Directory [pres] is created to host a build session for logical image [ListP] which is essentially [Main] extended with [List_prefix.thy].
zhang
parents: 29
diff changeset
  1020
          by (auto simp only:lam_of_def classes_of_def, case_tac x, auto)
28
cef2893f353b Rewritten of hard direction once more. To make it looking better.
wu
parents: 27
diff changeset
  1021
      qed
cef2893f353b Rewritten of hard direction once more. To make it looking better.
wu
parents: 27
diff changeset
  1022
      thus ?thesis by simp
cef2893f353b Rewritten of hard direction once more. To make it looking better.
wu
parents: 27
diff changeset
  1023
    qed
cef2893f353b Rewritten of hard direction once more. To make it looking better.
wu
parents: 27
diff changeset
  1024
    also have "\<dots> = X"
cef2893f353b Rewritten of hard direction once more. To make it looking better.
wu
parents: 27
diff changeset
  1025
    proof(rule arden_variate_keeps_eq [THEN sym])
30
f5db9e08effc Directory [tphols-2011] is added to host the commented version of [Myhill.thy]. Directory [pres] is created to host a build session for logical image [ListP] which is essentially [Main] extended with [List_prefix.thy].
zhang
parents: 29
diff changeset
  1026
      show "X = L xrhs" using Inv_ES ES_single 
f5db9e08effc Directory [tphols-2011] is added to host the commented version of [Myhill.thy]. Directory [pres] is created to host a build session for logical image [ListP] which is essentially [Main] extended with [List_prefix.thy].
zhang
parents: 29
diff changeset
  1027
        by (auto simp only:Inv_def valid_eqns_def)  
28
cef2893f353b Rewritten of hard direction once more. To make it looking better.
wu
parents: 27
diff changeset
  1028
    next
cef2893f353b Rewritten of hard direction once more. To make it looking better.
wu
parents: 27
diff changeset
  1029
      from Inv_ES ES_single show "[] \<notin> L (rexp_of xrhs X)"
cef2893f353b Rewritten of hard direction once more. To make it looking better.
wu
parents: 27
diff changeset
  1030
        by(simp add:Inv_def ardenable_def rexp_of_empty finite_rhs_def)
cef2893f353b Rewritten of hard direction once more. To make it looking better.
wu
parents: 27
diff changeset
  1031
    next
30
f5db9e08effc Directory [tphols-2011] is added to host the commented version of [Myhill.thy]. Directory [pres] is created to host a build session for logical image [ListP] which is essentially [Main] extended with [List_prefix.thy].
zhang
parents: 29
diff changeset
  1032
      from Inv_ES ES_single show "finite xrhs" 
f5db9e08effc Directory [tphols-2011] is added to host the commented version of [Myhill.thy]. Directory [pres] is created to host a build session for logical image [ListP] which is essentially [Main] extended with [List_prefix.thy].
zhang
parents: 29
diff changeset
  1033
        by (simp add:Inv_def finite_rhs_def)
28
cef2893f353b Rewritten of hard direction once more. To make it looking better.
wu
parents: 27
diff changeset
  1034
    qed
cef2893f353b Rewritten of hard direction once more. To make it looking better.
wu
parents: 27
diff changeset
  1035
    finally show ?thesis by simp
cef2893f353b Rewritten of hard direction once more. To make it looking better.
wu
parents: 27
diff changeset
  1036
  qed
cef2893f353b Rewritten of hard direction once more. To make it looking better.
wu
parents: 27
diff changeset
  1037
  thus ?thesis by auto
cef2893f353b Rewritten of hard direction once more. To make it looking better.
wu
parents: 27
diff changeset
  1038
qed
cef2893f353b Rewritten of hard direction once more. To make it looking better.
wu
parents: 27
diff changeset
  1039
   
cef2893f353b Rewritten of hard direction once more. To make it looking better.
wu
parents: 27
diff changeset
  1040
lemma every_eqcl_has_reg: 
cef2893f353b Rewritten of hard direction once more. To make it looking better.
wu
parents: 27
diff changeset
  1041
  assumes finite_CS: "finite (UNIV // (\<approx>Lang))"
cef2893f353b Rewritten of hard direction once more. To make it looking better.
wu
parents: 27
diff changeset
  1042
  and X_in_CS: "X \<in> (UNIV // (\<approx>Lang))"
cef2893f353b Rewritten of hard direction once more. To make it looking better.
wu
parents: 27
diff changeset
  1043
  shows "\<exists> (reg::rexp). L reg = X" (is "\<exists> r. ?E r")
cef2893f353b Rewritten of hard direction once more. To make it looking better.
wu
parents: 27
diff changeset
  1044
proof -
cef2893f353b Rewritten of hard direction once more. To make it looking better.
wu
parents: 27
diff changeset
  1045
  from X_in_CS have "\<exists> xrhs. (X, xrhs) \<in> (eqs (UNIV  // (\<approx>Lang)))"
cef2893f353b Rewritten of hard direction once more. To make it looking better.
wu
parents: 27
diff changeset
  1046
    by (auto simp:eqs_def init_rhs_def)
cef2893f353b Rewritten of hard direction once more. To make it looking better.
wu
parents: 27
diff changeset
  1047
  then obtain ES xrhs where Inv_ES: "Inv ES" 
cef2893f353b Rewritten of hard direction once more. To make it looking better.
wu
parents: 27
diff changeset
  1048
    and X_in_ES: "(X, xrhs) \<in> ES"
cef2893f353b Rewritten of hard direction once more. To make it looking better.
wu
parents: 27
diff changeset
  1049
    and card_ES: "card ES = 1"
cef2893f353b Rewritten of hard direction once more. To make it looking better.
wu
parents: 27
diff changeset
  1050
    using finite_CS X_in_CS init_ES_satisfy_Inv iteration_conc
cef2893f353b Rewritten of hard direction once more. To make it looking better.
wu
parents: 27
diff changeset
  1051
    by blast
cef2893f353b Rewritten of hard direction once more. To make it looking better.
wu
parents: 27
diff changeset
  1052
  hence ES_single_equa: "ES = {(X, xrhs)}" 
cef2893f353b Rewritten of hard direction once more. To make it looking better.
wu
parents: 27
diff changeset
  1053
    by (auto simp:Inv_def dest!:card_Suc_Diff1 simp:card_eq_0_iff) 
cef2893f353b Rewritten of hard direction once more. To make it looking better.
wu
parents: 27
diff changeset
  1054
  thus ?thesis using Inv_ES
cef2893f353b Rewritten of hard direction once more. To make it looking better.
wu
parents: 27
diff changeset
  1055
    by (rule last_cl_exists_rexp)
cef2893f353b Rewritten of hard direction once more. To make it looking better.
wu
parents: 27
diff changeset
  1056
qed
27
90a57a533b0c Add new file for the new definition of the hard direction's simplification.
wu
parents:
diff changeset
  1057
30
f5db9e08effc Directory [tphols-2011] is added to host the commented version of [Myhill.thy]. Directory [pres] is created to host a build session for logical image [ListP] which is essentially [Main] extended with [List_prefix.thy].
zhang
parents: 29
diff changeset
  1058
lemma finals_in_partitions:
f5db9e08effc Directory [tphols-2011] is added to host the commented version of [Myhill.thy]. Directory [pres] is created to host a build session for logical image [ListP] which is essentially [Main] extended with [List_prefix.thy].
zhang
parents: 29
diff changeset
  1059
  "finals Lang \<subseteq> (UNIV // (\<approx>Lang))"
f5db9e08effc Directory [tphols-2011] is added to host the commented version of [Myhill.thy]. Directory [pres] is created to host a build session for logical image [ListP] which is essentially [Main] extended with [List_prefix.thy].
zhang
parents: 29
diff changeset
  1060
  by (auto simp:finals_def quotient_def)   
f5db9e08effc Directory [tphols-2011] is added to host the commented version of [Myhill.thy]. Directory [pres] is created to host a build session for logical image [ListP] which is essentially [Main] extended with [List_prefix.thy].
zhang
parents: 29
diff changeset
  1061
28
cef2893f353b Rewritten of hard direction once more. To make it looking better.
wu
parents: 27
diff changeset
  1062
theorem hard_direction: 
cef2893f353b Rewritten of hard direction once more. To make it looking better.
wu
parents: 27
diff changeset
  1063
  assumes finite_CS: "finite (UNIV // (\<approx>Lang))"
cef2893f353b Rewritten of hard direction once more. To make it looking better.
wu
parents: 27
diff changeset
  1064
  shows   "\<exists> (reg::rexp). Lang = L reg"
cef2893f353b Rewritten of hard direction once more. To make it looking better.
wu
parents: 27
diff changeset
  1065
proof -
cef2893f353b Rewritten of hard direction once more. To make it looking better.
wu
parents: 27
diff changeset
  1066
  have "\<forall> X \<in> (UNIV // (\<approx>Lang)). \<exists> (reg::rexp). X = L reg" 
cef2893f353b Rewritten of hard direction once more. To make it looking better.
wu
parents: 27
diff changeset
  1067
    using finite_CS every_eqcl_has_reg by blast
30
f5db9e08effc Directory [tphols-2011] is added to host the commented version of [Myhill.thy]. Directory [pres] is created to host a build session for logical image [ListP] which is essentially [Main] extended with [List_prefix.thy].
zhang
parents: 29
diff changeset
  1068
  then obtain f 
f5db9e08effc Directory [tphols-2011] is added to host the commented version of [Myhill.thy]. Directory [pres] is created to host a build session for logical image [ListP] which is essentially [Main] extended with [List_prefix.thy].
zhang
parents: 29
diff changeset
  1069
    where f_prop: "\<forall> X \<in> (UNIV // (\<approx>Lang)). X = L ((f X)::rexp)" 
28
cef2893f353b Rewritten of hard direction once more. To make it looking better.
wu
parents: 27
diff changeset
  1070
    by (auto dest:bchoice)
30
f5db9e08effc Directory [tphols-2011] is added to host the commented version of [Myhill.thy]. Directory [pres] is created to host a build session for logical image [ListP] which is essentially [Main] extended with [List_prefix.thy].
zhang
parents: 29
diff changeset
  1071
  def rs \<equiv> "f ` (finals Lang)"  
f5db9e08effc Directory [tphols-2011] is added to host the commented version of [Myhill.thy]. Directory [pres] is created to host a build session for logical image [ListP] which is essentially [Main] extended with [List_prefix.thy].
zhang
parents: 29
diff changeset
  1072
  have "Lang = \<Union> (finals Lang)" using lang_is_union_of_finals by auto
28
cef2893f353b Rewritten of hard direction once more. To make it looking better.
wu
parents: 27
diff changeset
  1073
  also have "\<dots> = L (folds ALT NULL rs)" 
cef2893f353b Rewritten of hard direction once more. To make it looking better.
wu
parents: 27
diff changeset
  1074
  proof -
30
f5db9e08effc Directory [tphols-2011] is added to host the commented version of [Myhill.thy]. Directory [pres] is created to host a build session for logical image [ListP] which is essentially [Main] extended with [List_prefix.thy].
zhang
parents: 29
diff changeset
  1075
    have "finite rs"
f5db9e08effc Directory [tphols-2011] is added to host the commented version of [Myhill.thy]. Directory [pres] is created to host a build session for logical image [ListP] which is essentially [Main] extended with [List_prefix.thy].
zhang
parents: 29
diff changeset
  1076
    proof -
f5db9e08effc Directory [tphols-2011] is added to host the commented version of [Myhill.thy]. Directory [pres] is created to host a build session for logical image [ListP] which is essentially [Main] extended with [List_prefix.thy].
zhang
parents: 29
diff changeset
  1077
      have "finite (finals Lang)" 
f5db9e08effc Directory [tphols-2011] is added to host the commented version of [Myhill.thy]. Directory [pres] is created to host a build session for logical image [ListP] which is essentially [Main] extended with [List_prefix.thy].
zhang
parents: 29
diff changeset
  1078
        using finite_CS finals_in_partitions[of "Lang"]   
f5db9e08effc Directory [tphols-2011] is added to host the commented version of [Myhill.thy]. Directory [pres] is created to host a build session for logical image [ListP] which is essentially [Main] extended with [List_prefix.thy].
zhang
parents: 29
diff changeset
  1079
        by (erule_tac finite_subset, simp)
f5db9e08effc Directory [tphols-2011] is added to host the commented version of [Myhill.thy]. Directory [pres] is created to host a build session for logical image [ListP] which is essentially [Main] extended with [List_prefix.thy].
zhang
parents: 29
diff changeset
  1080
      thus ?thesis using rs_def by auto
f5db9e08effc Directory [tphols-2011] is added to host the commented version of [Myhill.thy]. Directory [pres] is created to host a build session for logical image [ListP] which is essentially [Main] extended with [List_prefix.thy].
zhang
parents: 29
diff changeset
  1081
    qed
f5db9e08effc Directory [tphols-2011] is added to host the commented version of [Myhill.thy]. Directory [pres] is created to host a build session for logical image [ListP] which is essentially [Main] extended with [List_prefix.thy].
zhang
parents: 29
diff changeset
  1082
    thus ?thesis 
f5db9e08effc Directory [tphols-2011] is added to host the commented version of [Myhill.thy]. Directory [pres] is created to host a build session for logical image [ListP] which is essentially [Main] extended with [List_prefix.thy].
zhang
parents: 29
diff changeset
  1083
      using f_prop rs_def finals_in_partitions[of "Lang"] by auto
28
cef2893f353b Rewritten of hard direction once more. To make it looking better.
wu
parents: 27
diff changeset
  1084
  qed
cef2893f353b Rewritten of hard direction once more. To make it looking better.
wu
parents: 27
diff changeset
  1085
  finally show ?thesis by blast
cef2893f353b Rewritten of hard direction once more. To make it looking better.
wu
parents: 27
diff changeset
  1086
qed 
27
90a57a533b0c Add new file for the new definition of the hard direction's simplification.
wu
parents:
diff changeset
  1087
30
f5db9e08effc Directory [tphols-2011] is added to host the commented version of [Myhill.thy]. Directory [pres] is created to host a build session for logical image [ListP] which is essentially [Main] extended with [List_prefix.thy].
zhang
parents: 29
diff changeset
  1088
section {* Direction: @{text "regular language \<Rightarrow>finite partition"} *}
f5db9e08effc Directory [tphols-2011] is added to host the commented version of [Myhill.thy]. Directory [pres] is created to host a build session for logical image [ListP] which is essentially [Main] extended with [List_prefix.thy].
zhang
parents: 29
diff changeset
  1089
f5db9e08effc Directory [tphols-2011] is added to host the commented version of [Myhill.thy]. Directory [pres] is created to host a build session for logical image [ListP] which is essentially [Main] extended with [List_prefix.thy].
zhang
parents: 29
diff changeset
  1090
subsection {* The scheme for this direction *}
28
cef2893f353b Rewritten of hard direction once more. To make it looking better.
wu
parents: 27
diff changeset
  1091
30
f5db9e08effc Directory [tphols-2011] is added to host the commented version of [Myhill.thy]. Directory [pres] is created to host a build session for logical image [ListP] which is essentially [Main] extended with [List_prefix.thy].
zhang
parents: 29
diff changeset
  1092
text {* 
f5db9e08effc Directory [tphols-2011] is added to host the commented version of [Myhill.thy]. Directory [pres] is created to host a build session for logical image [ListP] which is essentially [Main] extended with [List_prefix.thy].
zhang
parents: 29
diff changeset
  1093
  The following convenient notation @{text "x \<approx>Lang y"} means:
f5db9e08effc Directory [tphols-2011] is added to host the commented version of [Myhill.thy]. Directory [pres] is created to host a build session for logical image [ListP] which is essentially [Main] extended with [List_prefix.thy].
zhang
parents: 29
diff changeset
  1094
  string @{text "x"} and @{text "y"} are equivalent with respect to 
f5db9e08effc Directory [tphols-2011] is added to host the commented version of [Myhill.thy]. Directory [pres] is created to host a build session for logical image [ListP] which is essentially [Main] extended with [List_prefix.thy].
zhang
parents: 29
diff changeset
  1095
  language @{text "Lang"}.
f5db9e08effc Directory [tphols-2011] is added to host the commented version of [Myhill.thy]. Directory [pres] is created to host a build session for logical image [ListP] which is essentially [Main] extended with [List_prefix.thy].
zhang
parents: 29
diff changeset
  1096
  *}
f5db9e08effc Directory [tphols-2011] is added to host the commented version of [Myhill.thy]. Directory [pres] is created to host a build session for logical image [ListP] which is essentially [Main] extended with [List_prefix.thy].
zhang
parents: 29
diff changeset
  1097
f5db9e08effc Directory [tphols-2011] is added to host the commented version of [Myhill.thy]. Directory [pres] is created to host a build session for logical image [ListP] which is essentially [Main] extended with [List_prefix.thy].
zhang
parents: 29
diff changeset
  1098
definition
f5db9e08effc Directory [tphols-2011] is added to host the commented version of [Myhill.thy]. Directory [pres] is created to host a build session for logical image [ListP] which is essentially [Main] extended with [List_prefix.thy].
zhang
parents: 29
diff changeset
  1099
  str_eq ("_ \<approx>_ _")
f5db9e08effc Directory [tphols-2011] is added to host the commented version of [Myhill.thy]. Directory [pres] is created to host a build session for logical image [ListP] which is essentially [Main] extended with [List_prefix.thy].
zhang
parents: 29
diff changeset
  1100
where
f5db9e08effc Directory [tphols-2011] is added to host the commented version of [Myhill.thy]. Directory [pres] is created to host a build session for logical image [ListP] which is essentially [Main] extended with [List_prefix.thy].
zhang
parents: 29
diff changeset
  1101
  "x \<approx>Lang y \<equiv> (x, y) \<in> (\<approx>Lang)"
27
90a57a533b0c Add new file for the new definition of the hard direction's simplification.
wu
parents:
diff changeset
  1102
30
f5db9e08effc Directory [tphols-2011] is added to host the commented version of [Myhill.thy]. Directory [pres] is created to host a build session for logical image [ListP] which is essentially [Main] extended with [List_prefix.thy].
zhang
parents: 29
diff changeset
  1103
text {*
f5db9e08effc Directory [tphols-2011] is added to host the commented version of [Myhill.thy]. Directory [pres] is created to host a build session for logical image [ListP] which is essentially [Main] extended with [List_prefix.thy].
zhang
parents: 29
diff changeset
  1104
  The very basic scheme to show the finiteness of the partion generated by a language @{text "Lang"}
f5db9e08effc Directory [tphols-2011] is added to host the commented version of [Myhill.thy]. Directory [pres] is created to host a build session for logical image [ListP] which is essentially [Main] extended with [List_prefix.thy].
zhang
parents: 29
diff changeset
  1105
  is by attaching tags to every string. The set of tags are carfully choosen to make it finite.
f5db9e08effc Directory [tphols-2011] is added to host the commented version of [Myhill.thy]. Directory [pres] is created to host a build session for logical image [ListP] which is essentially [Main] extended with [List_prefix.thy].
zhang
parents: 29
diff changeset
  1106
  If it can be proved that strings with the same tag are equivlent with respect @{text "Lang"},
f5db9e08effc Directory [tphols-2011] is added to host the commented version of [Myhill.thy]. Directory [pres] is created to host a build session for logical image [ListP] which is essentially [Main] extended with [List_prefix.thy].
zhang
parents: 29
diff changeset
  1107
  then the partition given rise by @{text "Lang"} must be finite. The reason for this is a lemma 
f5db9e08effc Directory [tphols-2011] is added to host the commented version of [Myhill.thy]. Directory [pres] is created to host a build session for logical image [ListP] which is essentially [Main] extended with [List_prefix.thy].
zhang
parents: 29
diff changeset
  1108
  in standard library (@{text "finite_imageD"}), which says: if the image of an injective 
f5db9e08effc Directory [tphols-2011] is added to host the commented version of [Myhill.thy]. Directory [pres] is created to host a build session for logical image [ListP] which is essentially [Main] extended with [List_prefix.thy].
zhang
parents: 29
diff changeset
  1109
  function on a set @{text "A"} is finite, then @{text "A"} is finite. It can be shown that
f5db9e08effc Directory [tphols-2011] is added to host the commented version of [Myhill.thy]. Directory [pres] is created to host a build session for logical image [ListP] which is essentially [Main] extended with [List_prefix.thy].
zhang
parents: 29
diff changeset
  1110
  the function obtained by llifting @{text "tag"}
f5db9e08effc Directory [tphols-2011] is added to host the commented version of [Myhill.thy]. Directory [pres] is created to host a build session for logical image [ListP] which is essentially [Main] extended with [List_prefix.thy].
zhang
parents: 29
diff changeset
  1111
  to the level of equalent classes (i.e. @{text "((op `) tag)"}) is injective 
f5db9e08effc Directory [tphols-2011] is added to host the commented version of [Myhill.thy]. Directory [pres] is created to host a build session for logical image [ListP] which is essentially [Main] extended with [List_prefix.thy].
zhang
parents: 29
diff changeset
  1112
  (by lemma @{text "tag_image_injI"}) and the image of this function is finite 
f5db9e08effc Directory [tphols-2011] is added to host the commented version of [Myhill.thy]. Directory [pres] is created to host a build session for logical image [ListP] which is essentially [Main] extended with [List_prefix.thy].
zhang
parents: 29
diff changeset
  1113
  (with the help of lemma @{text "finite_tag_imageI"}).
27
90a57a533b0c Add new file for the new definition of the hard direction's simplification.
wu
parents:
diff changeset
  1114
30
f5db9e08effc Directory [tphols-2011] is added to host the commented version of [Myhill.thy]. Directory [pres] is created to host a build session for logical image [ListP] which is essentially [Main] extended with [List_prefix.thy].
zhang
parents: 29
diff changeset
  1115
  BUT, I think this argument can be encapsulated by one lemma instead of the current presentation.
f5db9e08effc Directory [tphols-2011] is added to host the commented version of [Myhill.thy]. Directory [pres] is created to host a build session for logical image [ListP] which is essentially [Main] extended with [List_prefix.thy].
zhang
parents: 29
diff changeset
  1116
  *}
27
90a57a533b0c Add new file for the new definition of the hard direction's simplification.
wu
parents:
diff changeset
  1117
29
c64241fa4dff Beautifying of the Other Direction is finished.
wu
parents: 28
diff changeset
  1118
lemma eq_class_equalI:
30
f5db9e08effc Directory [tphols-2011] is added to host the commented version of [Myhill.thy]. Directory [pres] is created to host a build session for logical image [ListP] which is essentially [Main] extended with [List_prefix.thy].
zhang
parents: 29
diff changeset
  1119
  "\<lbrakk>X \<in> UNIV // \<approx>lang; Y \<in> UNIV // \<approx>lang; x \<in> X; y \<in> Y; x \<approx>lang y\<rbrakk> 
f5db9e08effc Directory [tphols-2011] is added to host the commented version of [Myhill.thy]. Directory [pres] is created to host a build session for logical image [ListP] which is essentially [Main] extended with [List_prefix.thy].
zhang
parents: 29
diff changeset
  1120
                         \<Longrightarrow> X = Y"
29
c64241fa4dff Beautifying of the Other Direction is finished.
wu
parents: 28
diff changeset
  1121
by (auto simp:quotient_def str_eq_rel_def str_eq_def)
c64241fa4dff Beautifying of the Other Direction is finished.
wu
parents: 28
diff changeset
  1122
c64241fa4dff Beautifying of the Other Direction is finished.
wu
parents: 28
diff changeset
  1123
lemma tag_image_injI:
30
f5db9e08effc Directory [tphols-2011] is added to host the commented version of [Myhill.thy]. Directory [pres] is created to host a build session for logical image [ListP] which is essentially [Main] extended with [List_prefix.thy].
zhang
parents: 29
diff changeset
  1124
  assumes str_inj: "\<And> x y. tag x = tag (y::string) \<Longrightarrow> x \<approx>lang y"
29
c64241fa4dff Beautifying of the Other Direction is finished.
wu
parents: 28
diff changeset
  1125
  shows "inj_on ((op `) tag) (UNIV // \<approx>lang)"
c64241fa4dff Beautifying of the Other Direction is finished.
wu
parents: 28
diff changeset
  1126
proof-
c64241fa4dff Beautifying of the Other Direction is finished.
wu
parents: 28
diff changeset
  1127
  { fix X Y
c64241fa4dff Beautifying of the Other Direction is finished.
wu
parents: 28
diff changeset
  1128
    assume X_in: "X \<in> UNIV // \<approx>lang"
c64241fa4dff Beautifying of the Other Direction is finished.
wu
parents: 28
diff changeset
  1129
      and  Y_in: "Y \<in> UNIV // \<approx>lang"
c64241fa4dff Beautifying of the Other Direction is finished.
wu
parents: 28
diff changeset
  1130
      and  tag_eq: "tag ` X = tag ` Y"
c64241fa4dff Beautifying of the Other Direction is finished.
wu
parents: 28
diff changeset
  1131
    then obtain x y where "x \<in> X" and "y \<in> Y" and "tag x = tag y"
c64241fa4dff Beautifying of the Other Direction is finished.
wu
parents: 28
diff changeset
  1132
      unfolding quotient_def Image_def str_eq_rel_def str_eq_def image_def
c64241fa4dff Beautifying of the Other Direction is finished.
wu
parents: 28
diff changeset
  1133
      apply simp by blast
c64241fa4dff Beautifying of the Other Direction is finished.
wu
parents: 28
diff changeset
  1134
    with X_in Y_in str_inj
c64241fa4dff Beautifying of the Other Direction is finished.
wu
parents: 28
diff changeset
  1135
    have "X = Y" by (rule_tac eq_class_equalI, simp+)
c64241fa4dff Beautifying of the Other Direction is finished.
wu
parents: 28
diff changeset
  1136
  }
c64241fa4dff Beautifying of the Other Direction is finished.
wu
parents: 28
diff changeset
  1137
  thus ?thesis unfolding inj_on_def by auto
27
90a57a533b0c Add new file for the new definition of the hard direction's simplification.
wu
parents:
diff changeset
  1138
qed
90a57a533b0c Add new file for the new definition of the hard direction's simplification.
wu
parents:
diff changeset
  1139
30
f5db9e08effc Directory [tphols-2011] is added to host the commented version of [Myhill.thy]. Directory [pres] is created to host a build session for logical image [ListP] which is essentially [Main] extended with [List_prefix.thy].
zhang
parents: 29
diff changeset
  1140
lemma finite_tag_imageI: 
f5db9e08effc Directory [tphols-2011] is added to host the commented version of [Myhill.thy]. Directory [pres] is created to host a build session for logical image [ListP] which is essentially [Main] extended with [List_prefix.thy].
zhang
parents: 29
diff changeset
  1141
  "finite (range tag) \<Longrightarrow> finite (((op `) tag) ` S)"
f5db9e08effc Directory [tphols-2011] is added to host the commented version of [Myhill.thy]. Directory [pres] is created to host a build session for logical image [ListP] which is essentially [Main] extended with [List_prefix.thy].
zhang
parents: 29
diff changeset
  1142
apply (rule_tac B = "Pow (tag ` UNIV)" in finite_subset)
f5db9e08effc Directory [tphols-2011] is added to host the commented version of [Myhill.thy]. Directory [pres] is created to host a build session for logical image [ListP] which is essentially [Main] extended with [List_prefix.thy].
zhang
parents: 29
diff changeset
  1143
by (auto simp add:image_def Pow_def)
f5db9e08effc Directory [tphols-2011] is added to host the commented version of [Myhill.thy]. Directory [pres] is created to host a build session for logical image [ListP] which is essentially [Main] extended with [List_prefix.thy].
zhang
parents: 29
diff changeset
  1144
f5db9e08effc Directory [tphols-2011] is added to host the commented version of [Myhill.thy]. Directory [pres] is created to host a build session for logical image [ListP] which is essentially [Main] extended with [List_prefix.thy].
zhang
parents: 29
diff changeset
  1145
f5db9e08effc Directory [tphols-2011] is added to host the commented version of [Myhill.thy]. Directory [pres] is created to host a build session for logical image [ListP] which is essentially [Main] extended with [List_prefix.thy].
zhang
parents: 29
diff changeset
  1146
subsection {* A small theory for list difference *}
f5db9e08effc Directory [tphols-2011] is added to host the commented version of [Myhill.thy]. Directory [pres] is created to host a build session for logical image [ListP] which is essentially [Main] extended with [List_prefix.thy].
zhang
parents: 29
diff changeset
  1147
f5db9e08effc Directory [tphols-2011] is added to host the commented version of [Myhill.thy]. Directory [pres] is created to host a build session for logical image [ListP] which is essentially [Main] extended with [List_prefix.thy].
zhang
parents: 29
diff changeset
  1148
text {*
f5db9e08effc Directory [tphols-2011] is added to host the commented version of [Myhill.thy]. Directory [pres] is created to host a build session for logical image [ListP] which is essentially [Main] extended with [List_prefix.thy].
zhang
parents: 29
diff changeset
  1149
  The notion of list diffrence is need to make proofs more readable.
f5db9e08effc Directory [tphols-2011] is added to host the commented version of [Myhill.thy]. Directory [pres] is created to host a build session for logical image [ListP] which is essentially [Main] extended with [List_prefix.thy].
zhang
parents: 29
diff changeset
  1150
  *}
27
90a57a533b0c Add new file for the new definition of the hard direction's simplification.
wu
parents:
diff changeset
  1151
90a57a533b0c Add new file for the new definition of the hard direction's simplification.
wu
parents:
diff changeset
  1152
(* list_diff:: list substract, once different return tailer *)
90a57a533b0c Add new file for the new definition of the hard direction's simplification.
wu
parents:
diff changeset
  1153
fun list_diff :: "'a list \<Rightarrow> 'a list \<Rightarrow> 'a list" (infix "-" 51)
90a57a533b0c Add new file for the new definition of the hard direction's simplification.
wu
parents:
diff changeset
  1154
where
90a57a533b0c Add new file for the new definition of the hard direction's simplification.
wu
parents:
diff changeset
  1155
  "list_diff []  xs = []" |
90a57a533b0c Add new file for the new definition of the hard direction's simplification.
wu
parents:
diff changeset
  1156
  "list_diff (x#xs) [] = x#xs" |
90a57a533b0c Add new file for the new definition of the hard direction's simplification.
wu
parents:
diff changeset
  1157
  "list_diff (x#xs) (y#ys) = (if x = y then list_diff xs ys else (x#xs))"
90a57a533b0c Add new file for the new definition of the hard direction's simplification.
wu
parents:
diff changeset
  1158
90a57a533b0c Add new file for the new definition of the hard direction's simplification.
wu
parents:
diff changeset
  1159
lemma [simp]: "(x @ y) - x = y"
90a57a533b0c Add new file for the new definition of the hard direction's simplification.
wu
parents:
diff changeset
  1160
apply (induct x)
90a57a533b0c Add new file for the new definition of the hard direction's simplification.
wu
parents:
diff changeset
  1161
by (case_tac y, simp+)
90a57a533b0c Add new file for the new definition of the hard direction's simplification.
wu
parents:
diff changeset
  1162
90a57a533b0c Add new file for the new definition of the hard direction's simplification.
wu
parents:
diff changeset
  1163
lemma [simp]: "x - x = []"
90a57a533b0c Add new file for the new definition of the hard direction's simplification.
wu
parents:
diff changeset
  1164
by (induct x, auto)
90a57a533b0c Add new file for the new definition of the hard direction's simplification.
wu
parents:
diff changeset
  1165
90a57a533b0c Add new file for the new definition of the hard direction's simplification.
wu
parents:
diff changeset
  1166
lemma [simp]: "x = xa @ y \<Longrightarrow> x - xa = y "
90a57a533b0c Add new file for the new definition of the hard direction's simplification.
wu
parents:
diff changeset
  1167
by (induct x, auto)
90a57a533b0c Add new file for the new definition of the hard direction's simplification.
wu
parents:
diff changeset
  1168
90a57a533b0c Add new file for the new definition of the hard direction's simplification.
wu
parents:
diff changeset
  1169
lemma [simp]: "x - [] = x"
90a57a533b0c Add new file for the new definition of the hard direction's simplification.
wu
parents:
diff changeset
  1170
by (induct x, auto)
90a57a533b0c Add new file for the new definition of the hard direction's simplification.
wu
parents:
diff changeset
  1171
29
c64241fa4dff Beautifying of the Other Direction is finished.
wu
parents: 28
diff changeset
  1172
lemma [simp]: "(x - y = []) \<Longrightarrow> (x \<le> y)"
c64241fa4dff Beautifying of the Other Direction is finished.
wu
parents: 28
diff changeset
  1173
proof-   
c64241fa4dff Beautifying of the Other Direction is finished.
wu
parents: 28
diff changeset
  1174
  have "\<exists>xa. x = xa @ (x - y) \<and> xa \<le> y"
c64241fa4dff Beautifying of the Other Direction is finished.
wu
parents: 28
diff changeset
  1175
    apply (rule list_diff.induct[of _ x y], simp+)
c64241fa4dff Beautifying of the Other Direction is finished.
wu
parents: 28
diff changeset
  1176
    by (clarsimp, rule_tac x = "y # xa" in exI, simp+)
c64241fa4dff Beautifying of the Other Direction is finished.
wu
parents: 28
diff changeset
  1177
  thus "(x - y = []) \<Longrightarrow> (x \<le> y)" by simp
c64241fa4dff Beautifying of the Other Direction is finished.
wu
parents: 28
diff changeset
  1178
qed
c64241fa4dff Beautifying of the Other Direction is finished.
wu
parents: 28
diff changeset
  1179
c64241fa4dff Beautifying of the Other Direction is finished.
wu
parents: 28
diff changeset
  1180
lemma diff_prefix:
c64241fa4dff Beautifying of the Other Direction is finished.
wu
parents: 28
diff changeset
  1181
  "\<lbrakk>c \<le> a - b; b \<le> a\<rbrakk> \<Longrightarrow> b @ c \<le> a"
27
90a57a533b0c Add new file for the new definition of the hard direction's simplification.
wu
parents:
diff changeset
  1182
by (auto elim:prefixE)
90a57a533b0c Add new file for the new definition of the hard direction's simplification.
wu
parents:
diff changeset
  1183
29
c64241fa4dff Beautifying of the Other Direction is finished.
wu
parents: 28
diff changeset
  1184
lemma diff_diff_appd: 
c64241fa4dff Beautifying of the Other Direction is finished.
wu
parents: 28
diff changeset
  1185
  "\<lbrakk>c < a - b; b < a\<rbrakk> \<Longrightarrow> (a - b) - c = a - (b @ c)"
c64241fa4dff Beautifying of the Other Direction is finished.
wu
parents: 28
diff changeset
  1186
apply (clarsimp simp:strict_prefix_def)
c64241fa4dff Beautifying of the Other Direction is finished.
wu
parents: 28
diff changeset
  1187
by (drule diff_prefix, auto elim:prefixE)
27
90a57a533b0c Add new file for the new definition of the hard direction's simplification.
wu
parents:
diff changeset
  1188
29
c64241fa4dff Beautifying of the Other Direction is finished.
wu
parents: 28
diff changeset
  1189
lemma app_eq_cases[rule_format]:
c64241fa4dff Beautifying of the Other Direction is finished.
wu
parents: 28
diff changeset
  1190
  "\<forall> x . x @ y = m @ n \<longrightarrow> (x \<le> m \<or> m \<le> x)"
c64241fa4dff Beautifying of the Other Direction is finished.
wu
parents: 28
diff changeset
  1191
apply (induct y, simp)
c64241fa4dff Beautifying of the Other Direction is finished.
wu
parents: 28
diff changeset
  1192
apply (clarify, drule_tac x = "x @ [a]" in spec)
c64241fa4dff Beautifying of the Other Direction is finished.
wu
parents: 28
diff changeset
  1193
by (clarsimp, auto simp:prefix_def)
c64241fa4dff Beautifying of the Other Direction is finished.
wu
parents: 28
diff changeset
  1194
c64241fa4dff Beautifying of the Other Direction is finished.
wu
parents: 28
diff changeset
  1195
lemma app_eq_dest:
30
f5db9e08effc Directory [tphols-2011] is added to host the commented version of [Myhill.thy]. Directory [pres] is created to host a build session for logical image [ListP] which is essentially [Main] extended with [List_prefix.thy].
zhang
parents: 29
diff changeset
  1196
  "x @ y = m @ n \<Longrightarrow> 
f5db9e08effc Directory [tphols-2011] is added to host the commented version of [Myhill.thy]. Directory [pres] is created to host a build session for logical image [ListP] which is essentially [Main] extended with [List_prefix.thy].
zhang
parents: 29
diff changeset
  1197
               (x \<le> m \<and> (m - x) @ n = y) \<or> (m \<le> x \<and> (x - m) @ y = n)"
29
c64241fa4dff Beautifying of the Other Direction is finished.
wu
parents: 28
diff changeset
  1198
by (frule_tac app_eq_cases, auto elim:prefixE)
c64241fa4dff Beautifying of the Other Direction is finished.
wu
parents: 28
diff changeset
  1199
30
f5db9e08effc Directory [tphols-2011] is added to host the commented version of [Myhill.thy]. Directory [pres] is created to host a build session for logical image [ListP] which is essentially [Main] extended with [List_prefix.thy].
zhang
parents: 29
diff changeset
  1200
subsection {* Lemmas for basic cases *}
f5db9e08effc Directory [tphols-2011] is added to host the commented version of [Myhill.thy]. Directory [pres] is created to host a build session for logical image [ListP] which is essentially [Main] extended with [List_prefix.thy].
zhang
parents: 29
diff changeset
  1201
f5db9e08effc Directory [tphols-2011] is added to host the commented version of [Myhill.thy]. Directory [pres] is created to host a build session for logical image [ListP] which is essentially [Main] extended with [List_prefix.thy].
zhang
parents: 29
diff changeset
  1202
text {*
f5db9e08effc Directory [tphols-2011] is added to host the commented version of [Myhill.thy]. Directory [pres] is created to host a build session for logical image [ListP] which is essentially [Main] extended with [List_prefix.thy].
zhang
parents: 29
diff changeset
  1203
  The the final result of this direction is in @{text "easier_direction"}, which
f5db9e08effc Directory [tphols-2011] is added to host the commented version of [Myhill.thy]. Directory [pres] is created to host a build session for logical image [ListP] which is essentially [Main] extended with [List_prefix.thy].
zhang
parents: 29
diff changeset
  1204
  is an induction on the structure of regular expressions. There is one case 
f5db9e08effc Directory [tphols-2011] is added to host the commented version of [Myhill.thy]. Directory [pres] is created to host a build session for logical image [ListP] which is essentially [Main] extended with [List_prefix.thy].
zhang
parents: 29
diff changeset
  1205
  for each regular expression operator. For basic operators such as @{text "NULL, EMPTY, CHAR c"},
f5db9e08effc Directory [tphols-2011] is added to host the commented version of [Myhill.thy]. Directory [pres] is created to host a build session for logical image [ListP] which is essentially [Main] extended with [List_prefix.thy].
zhang
parents: 29
diff changeset
  1206
  the finiteness of their language partition can be established directly with no need
f5db9e08effc Directory [tphols-2011] is added to host the commented version of [Myhill.thy]. Directory [pres] is created to host a build session for logical image [ListP] which is essentially [Main] extended with [List_prefix.thy].
zhang
parents: 29
diff changeset
  1207
  of taggiing. This section contains several technical lemma for these base cases.
f5db9e08effc Directory [tphols-2011] is added to host the commented version of [Myhill.thy]. Directory [pres] is created to host a build session for logical image [ListP] which is essentially [Main] extended with [List_prefix.thy].
zhang
parents: 29
diff changeset
  1208
f5db9e08effc Directory [tphols-2011] is added to host the commented version of [Myhill.thy]. Directory [pres] is created to host a build session for logical image [ListP] which is essentially [Main] extended with [List_prefix.thy].
zhang
parents: 29
diff changeset
  1209
  The inductive cases involve operators @{text "ALT, SEQ"} and @{text "STAR"}. 
f5db9e08effc Directory [tphols-2011] is added to host the commented version of [Myhill.thy]. Directory [pres] is created to host a build session for logical image [ListP] which is essentially [Main] extended with [List_prefix.thy].
zhang
parents: 29
diff changeset
  1210
  Tagging functions need to be defined individually for each of them. There will be one
f5db9e08effc Directory [tphols-2011] is added to host the commented version of [Myhill.thy]. Directory [pres] is created to host a build session for logical image [ListP] which is essentially [Main] extended with [List_prefix.thy].
zhang
parents: 29
diff changeset
  1211
  dedicated section for each of these cases, and each section goes virtually the same way:
f5db9e08effc Directory [tphols-2011] is added to host the commented version of [Myhill.thy]. Directory [pres] is created to host a build session for logical image [ListP] which is essentially [Main] extended with [List_prefix.thy].
zhang
parents: 29
diff changeset
  1212
  gives definition of the tagging function and prove that strings 
f5db9e08effc Directory [tphols-2011] is added to host the commented version of [Myhill.thy]. Directory [pres] is created to host a build session for logical image [ListP] which is essentially [Main] extended with [List_prefix.thy].
zhang
parents: 29
diff changeset
  1213
  with the same tag are equivalent.
f5db9e08effc Directory [tphols-2011] is added to host the commented version of [Myhill.thy]. Directory [pres] is created to host a build session for logical image [ListP] which is essentially [Main] extended with [List_prefix.thy].
zhang
parents: 29
diff changeset
  1214
  *}
f5db9e08effc Directory [tphols-2011] is added to host the commented version of [Myhill.thy]. Directory [pres] is created to host a build session for logical image [ListP] which is essentially [Main] extended with [List_prefix.thy].
zhang
parents: 29
diff changeset
  1215
f5db9e08effc Directory [tphols-2011] is added to host the commented version of [Myhill.thy]. Directory [pres] is created to host a build session for logical image [ListP] which is essentially [Main] extended with [List_prefix.thy].
zhang
parents: 29
diff changeset
  1216
lemma quot_empty_subset:
f5db9e08effc Directory [tphols-2011] is added to host the commented version of [Myhill.thy]. Directory [pres] is created to host a build session for logical image [ListP] which is essentially [Main] extended with [List_prefix.thy].
zhang
parents: 29
diff changeset
  1217
  "UNIV // (\<approx>{[]}) \<subseteq> {{[]}, UNIV - {[]}}"
f5db9e08effc Directory [tphols-2011] is added to host the commented version of [Myhill.thy]. Directory [pres] is created to host a build session for logical image [ListP] which is essentially [Main] extended with [List_prefix.thy].
zhang
parents: 29
diff changeset
  1218
proof
f5db9e08effc Directory [tphols-2011] is added to host the commented version of [Myhill.thy]. Directory [pres] is created to host a build session for logical image [ListP] which is essentially [Main] extended with [List_prefix.thy].
zhang
parents: 29
diff changeset
  1219
  fix x
f5db9e08effc Directory [tphols-2011] is added to host the commented version of [Myhill.thy]. Directory [pres] is created to host a build session for logical image [ListP] which is essentially [Main] extended with [List_prefix.thy].
zhang
parents: 29
diff changeset
  1220
  assume "x \<in> UNIV // \<approx>{[]}"
f5db9e08effc Directory [tphols-2011] is added to host the commented version of [Myhill.thy]. Directory [pres] is created to host a build session for logical image [ListP] which is essentially [Main] extended with [List_prefix.thy].
zhang
parents: 29
diff changeset
  1221
  then obtain y where h: "x = {z. (y, z) \<in> \<approx>{[]}}" 
f5db9e08effc Directory [tphols-2011] is added to host the commented version of [Myhill.thy]. Directory [pres] is created to host a build session for logical image [ListP] which is essentially [Main] extended with [List_prefix.thy].
zhang
parents: 29
diff changeset
  1222
    unfolding quotient_def Image_def by blast
f5db9e08effc Directory [tphols-2011] is added to host the commented version of [Myhill.thy]. Directory [pres] is created to host a build session for logical image [ListP] which is essentially [Main] extended with [List_prefix.thy].
zhang
parents: 29
diff changeset
  1223
  show "x \<in> {{[]}, UNIV - {[]}}" 
f5db9e08effc Directory [tphols-2011] is added to host the commented version of [Myhill.thy]. Directory [pres] is created to host a build session for logical image [ListP] which is essentially [Main] extended with [List_prefix.thy].
zhang
parents: 29
diff changeset
  1224
  proof (cases "y = []")
f5db9e08effc Directory [tphols-2011] is added to host the commented version of [Myhill.thy]. Directory [pres] is created to host a build session for logical image [ListP] which is essentially [Main] extended with [List_prefix.thy].
zhang
parents: 29
diff changeset
  1225
    case True with h
f5db9e08effc Directory [tphols-2011] is added to host the commented version of [Myhill.thy]. Directory [pres] is created to host a build session for logical image [ListP] which is essentially [Main] extended with [List_prefix.thy].
zhang
parents: 29
diff changeset
  1226
    have "x = {[]}" by (auto simp:str_eq_rel_def)
f5db9e08effc Directory [tphols-2011] is added to host the commented version of [Myhill.thy]. Directory [pres] is created to host a build session for logical image [ListP] which is essentially [Main] extended with [List_prefix.thy].
zhang
parents: 29
diff changeset
  1227
    thus ?thesis by simp
f5db9e08effc Directory [tphols-2011] is added to host the commented version of [Myhill.thy]. Directory [pres] is created to host a build session for logical image [ListP] which is essentially [Main] extended with [List_prefix.thy].
zhang
parents: 29
diff changeset
  1228
  next
f5db9e08effc Directory [tphols-2011] is added to host the commented version of [Myhill.thy]. Directory [pres] is created to host a build session for logical image [ListP] which is essentially [Main] extended with [List_prefix.thy].
zhang
parents: 29
diff changeset
  1229
    case False with h
f5db9e08effc Directory [tphols-2011] is added to host the commented version of [Myhill.thy]. Directory [pres] is created to host a build session for logical image [ListP] which is essentially [Main] extended with [List_prefix.thy].
zhang
parents: 29
diff changeset
  1230
    have "x = UNIV - {[]}" by (auto simp:str_eq_rel_def)
f5db9e08effc Directory [tphols-2011] is added to host the commented version of [Myhill.thy]. Directory [pres] is created to host a build session for logical image [ListP] which is essentially [Main] extended with [List_prefix.thy].
zhang
parents: 29
diff changeset
  1231
    thus ?thesis by simp
f5db9e08effc Directory [tphols-2011] is added to host the commented version of [Myhill.thy]. Directory [pres] is created to host a build session for logical image [ListP] which is essentially [Main] extended with [List_prefix.thy].
zhang
parents: 29
diff changeset
  1232
  qed
f5db9e08effc Directory [tphols-2011] is added to host the commented version of [Myhill.thy]. Directory [pres] is created to host a build session for logical image [ListP] which is essentially [Main] extended with [List_prefix.thy].
zhang
parents: 29
diff changeset
  1233
qed
f5db9e08effc Directory [tphols-2011] is added to host the commented version of [Myhill.thy]. Directory [pres] is created to host a build session for logical image [ListP] which is essentially [Main] extended with [List_prefix.thy].
zhang
parents: 29
diff changeset
  1234
f5db9e08effc Directory [tphols-2011] is added to host the commented version of [Myhill.thy]. Directory [pres] is created to host a build session for logical image [ListP] which is essentially [Main] extended with [List_prefix.thy].
zhang
parents: 29
diff changeset
  1235
lemma quot_char_subset:
f5db9e08effc Directory [tphols-2011] is added to host the commented version of [Myhill.thy]. Directory [pres] is created to host a build session for logical image [ListP] which is essentially [Main] extended with [List_prefix.thy].
zhang
parents: 29
diff changeset
  1236
  "UNIV // (\<approx>{[c]}) \<subseteq> {{[]},{[c]}, UNIV - {[], [c]}}"
f5db9e08effc Directory [tphols-2011] is added to host the commented version of [Myhill.thy]. Directory [pres] is created to host a build session for logical image [ListP] which is essentially [Main] extended with [List_prefix.thy].
zhang
parents: 29
diff changeset
  1237
proof 
f5db9e08effc Directory [tphols-2011] is added to host the commented version of [Myhill.thy]. Directory [pres] is created to host a build session for logical image [ListP] which is essentially [Main] extended with [List_prefix.thy].
zhang
parents: 29
diff changeset
  1238
  fix x 
f5db9e08effc Directory [tphols-2011] is added to host the commented version of [Myhill.thy]. Directory [pres] is created to host a build session for logical image [ListP] which is essentially [Main] extended with [List_prefix.thy].
zhang
parents: 29
diff changeset
  1239
  assume "x \<in> UNIV // \<approx>{[c]}"
f5db9e08effc Directory [tphols-2011] is added to host the commented version of [Myhill.thy]. Directory [pres] is created to host a build session for logical image [ListP] which is essentially [Main] extended with [List_prefix.thy].
zhang
parents: 29
diff changeset
  1240
  then obtain y where h: "x = {z. (y, z) \<in> \<approx>{[c]}}" 
f5db9e08effc Directory [tphols-2011] is added to host the commented version of [Myhill.thy]. Directory [pres] is created to host a build session for logical image [ListP] which is essentially [Main] extended with [List_prefix.thy].
zhang
parents: 29
diff changeset
  1241
    unfolding quotient_def Image_def by blast
f5db9e08effc Directory [tphols-2011] is added to host the commented version of [Myhill.thy]. Directory [pres] is created to host a build session for logical image [ListP] which is essentially [Main] extended with [List_prefix.thy].
zhang
parents: 29
diff changeset
  1242
  show "x \<in> {{[]},{[c]}, UNIV - {[], [c]}}"
f5db9e08effc Directory [tphols-2011] is added to host the commented version of [Myhill.thy]. Directory [pres] is created to host a build session for logical image [ListP] which is essentially [Main] extended with [List_prefix.thy].
zhang
parents: 29
diff changeset
  1243
  proof -
f5db9e08effc Directory [tphols-2011] is added to host the commented version of [Myhill.thy]. Directory [pres] is created to host a build session for logical image [ListP] which is essentially [Main] extended with [List_prefix.thy].
zhang
parents: 29
diff changeset
  1244
    { assume "y = []" hence "x = {[]}" using h 
f5db9e08effc Directory [tphols-2011] is added to host the commented version of [Myhill.thy]. Directory [pres] is created to host a build session for logical image [ListP] which is essentially [Main] extended with [List_prefix.thy].
zhang
parents: 29
diff changeset
  1245
        by (auto simp:str_eq_rel_def)
f5db9e08effc Directory [tphols-2011] is added to host the commented version of [Myhill.thy]. Directory [pres] is created to host a build session for logical image [ListP] which is essentially [Main] extended with [List_prefix.thy].
zhang
parents: 29
diff changeset
  1246
    } moreover {
f5db9e08effc Directory [tphols-2011] is added to host the commented version of [Myhill.thy]. Directory [pres] is created to host a build session for logical image [ListP] which is essentially [Main] extended with [List_prefix.thy].
zhang
parents: 29
diff changeset
  1247
      assume "y = [c]" hence "x = {[c]}" using h 
f5db9e08effc Directory [tphols-2011] is added to host the commented version of [Myhill.thy]. Directory [pres] is created to host a build session for logical image [ListP] which is essentially [Main] extended with [List_prefix.thy].
zhang
parents: 29
diff changeset
  1248
        by (auto dest!:spec[where x = "[]"] simp:str_eq_rel_def)
f5db9e08effc Directory [tphols-2011] is added to host the commented version of [Myhill.thy]. Directory [pres] is created to host a build session for logical image [ListP] which is essentially [Main] extended with [List_prefix.thy].
zhang
parents: 29
diff changeset
  1249
    } moreover {
f5db9e08effc Directory [tphols-2011] is added to host the commented version of [Myhill.thy]. Directory [pres] is created to host a build session for logical image [ListP] which is essentially [Main] extended with [List_prefix.thy].
zhang
parents: 29
diff changeset
  1250
      assume "y \<noteq> []" and "y \<noteq> [c]"
f5db9e08effc Directory [tphols-2011] is added to host the commented version of [Myhill.thy]. Directory [pres] is created to host a build session for logical image [ListP] which is essentially [Main] extended with [List_prefix.thy].
zhang
parents: 29
diff changeset
  1251
      hence "\<forall> z. (y @ z) \<noteq> [c]" by (case_tac y, auto)
f5db9e08effc Directory [tphols-2011] is added to host the commented version of [Myhill.thy]. Directory [pres] is created to host a build session for logical image [ListP] which is essentially [Main] extended with [List_prefix.thy].
zhang
parents: 29
diff changeset
  1252
      moreover have "\<And> p. (p \<noteq> [] \<and> p \<noteq> [c]) = (\<forall> q. p @ q \<noteq> [c])" 
f5db9e08effc Directory [tphols-2011] is added to host the commented version of [Myhill.thy]. Directory [pres] is created to host a build session for logical image [ListP] which is essentially [Main] extended with [List_prefix.thy].
zhang
parents: 29
diff changeset
  1253
        by (case_tac p, auto)
f5db9e08effc Directory [tphols-2011] is added to host the commented version of [Myhill.thy]. Directory [pres] is created to host a build session for logical image [ListP] which is essentially [Main] extended with [List_prefix.thy].
zhang
parents: 29
diff changeset
  1254
      ultimately have "x = UNIV - {[],[c]}" using h
f5db9e08effc Directory [tphols-2011] is added to host the commented version of [Myhill.thy]. Directory [pres] is created to host a build session for logical image [ListP] which is essentially [Main] extended with [List_prefix.thy].
zhang
parents: 29
diff changeset
  1255
        by (auto simp add:str_eq_rel_def)
f5db9e08effc Directory [tphols-2011] is added to host the commented version of [Myhill.thy]. Directory [pres] is created to host a build session for logical image [ListP] which is essentially [Main] extended with [List_prefix.thy].
zhang
parents: 29
diff changeset
  1256
    } ultimately show ?thesis by blast
f5db9e08effc Directory [tphols-2011] is added to host the commented version of [Myhill.thy]. Directory [pres] is created to host a build session for logical image [ListP] which is essentially [Main] extended with [List_prefix.thy].
zhang
parents: 29
diff changeset
  1257
  qed
f5db9e08effc Directory [tphols-2011] is added to host the commented version of [Myhill.thy]. Directory [pres] is created to host a build session for logical image [ListP] which is essentially [Main] extended with [List_prefix.thy].
zhang
parents: 29
diff changeset
  1258
qed
f5db9e08effc Directory [tphols-2011] is added to host the commented version of [Myhill.thy]. Directory [pres] is created to host a build session for logical image [ListP] which is essentially [Main] extended with [List_prefix.thy].
zhang
parents: 29
diff changeset
  1259
f5db9e08effc Directory [tphols-2011] is added to host the commented version of [Myhill.thy]. Directory [pres] is created to host a build session for logical image [ListP] which is essentially [Main] extended with [List_prefix.thy].
zhang
parents: 29
diff changeset
  1260
subsection {* The case for @{text "SEQ"}*}
f5db9e08effc Directory [tphols-2011] is added to host the commented version of [Myhill.thy]. Directory [pres] is created to host a build session for logical image [ListP] which is essentially [Main] extended with [List_prefix.thy].
zhang
parents: 29
diff changeset
  1261
29
c64241fa4dff Beautifying of the Other Direction is finished.
wu
parents: 28
diff changeset
  1262
definition 
30
f5db9e08effc Directory [tphols-2011] is added to host the commented version of [Myhill.thy]. Directory [pres] is created to host a build session for logical image [ListP] which is essentially [Main] extended with [List_prefix.thy].
zhang
parents: 29
diff changeset
  1263
  "tag_str_SEQ L\<^isub>1 L\<^isub>2 x \<equiv> 
f5db9e08effc Directory [tphols-2011] is added to host the commented version of [Myhill.thy]. Directory [pres] is created to host a build session for logical image [ListP] which is essentially [Main] extended with [List_prefix.thy].
zhang
parents: 29
diff changeset
  1264
       ((\<approx>L\<^isub>1) `` {x}, {(\<approx>L\<^isub>2) `` {x - xa}| xa.  xa \<le> x \<and> xa \<in> L\<^isub>1})"
27
90a57a533b0c Add new file for the new definition of the hard direction's simplification.
wu
parents:
diff changeset
  1265
90a57a533b0c Add new file for the new definition of the hard direction's simplification.
wu
parents:
diff changeset
  1266
lemma tag_str_seq_range_finite:
30
f5db9e08effc Directory [tphols-2011] is added to host the commented version of [Myhill.thy]. Directory [pres] is created to host a build session for logical image [ListP] which is essentially [Main] extended with [List_prefix.thy].
zhang
parents: 29
diff changeset
  1267
  "\<lbrakk>finite (UNIV // \<approx>L\<^isub>1); finite (UNIV // \<approx>L\<^isub>2)\<rbrakk> 
f5db9e08effc Directory [tphols-2011] is added to host the commented version of [Myhill.thy]. Directory [pres] is created to host a build session for logical image [ListP] which is essentially [Main] extended with [List_prefix.thy].
zhang
parents: 29
diff changeset
  1268
                              \<Longrightarrow> finite (range (tag_str_SEQ L\<^isub>1 L\<^isub>2))"
29
c64241fa4dff Beautifying of the Other Direction is finished.
wu
parents: 28
diff changeset
  1269
apply (rule_tac B = "(UNIV // \<approx>L\<^isub>1) \<times> (Pow (UNIV // \<approx>L\<^isub>2))" in finite_subset)
c64241fa4dff Beautifying of the Other Direction is finished.
wu
parents: 28
diff changeset
  1270
by (auto simp:tag_str_SEQ_def Image_def quotient_def split:if_splits)
27
90a57a533b0c Add new file for the new definition of the hard direction's simplification.
wu
parents:
diff changeset
  1271
29
c64241fa4dff Beautifying of the Other Direction is finished.
wu
parents: 28
diff changeset
  1272
lemma append_seq_elim:
c64241fa4dff Beautifying of the Other Direction is finished.
wu
parents: 28
diff changeset
  1273
  assumes "x @ y \<in> L\<^isub>1 ;; L\<^isub>2"
30
f5db9e08effc Directory [tphols-2011] is added to host the commented version of [Myhill.thy]. Directory [pres] is created to host a build session for logical image [ListP] which is essentially [Main] extended with [List_prefix.thy].
zhang
parents: 29
diff changeset
  1274
  shows "(\<exists> xa \<le> x. xa \<in> L\<^isub>1 \<and> (x - xa) @ y \<in> L\<^isub>2) \<or> 
f5db9e08effc Directory [tphols-2011] is added to host the commented version of [Myhill.thy]. Directory [pres] is created to host a build session for logical image [ListP] which is essentially [Main] extended with [List_prefix.thy].
zhang
parents: 29
diff changeset
  1275
          (\<exists> ya \<le> y. (x @ ya) \<in> L\<^isub>1 \<and> (y - ya) \<in> L\<^isub>2)"
29
c64241fa4dff Beautifying of the Other Direction is finished.
wu
parents: 28
diff changeset
  1276
proof-
30
f5db9e08effc Directory [tphols-2011] is added to host the commented version of [Myhill.thy]. Directory [pres] is created to host a build session for logical image [ListP] which is essentially [Main] extended with [List_prefix.thy].
zhang
parents: 29
diff changeset
  1277
  from assms obtain s\<^isub>1 s\<^isub>2 
f5db9e08effc Directory [tphols-2011] is added to host the commented version of [Myhill.thy]. Directory [pres] is created to host a build session for logical image [ListP] which is essentially [Main] extended with [List_prefix.thy].
zhang
parents: 29
diff changeset
  1278
    where "x @ y = s\<^isub>1 @ s\<^isub>2" 
f5db9e08effc Directory [tphols-2011] is added to host the commented version of [Myhill.thy]. Directory [pres] is created to host a build session for logical image [ListP] which is essentially [Main] extended with [List_prefix.thy].
zhang
parents: 29
diff changeset
  1279
    and in_seq: "s\<^isub>1 \<in> L\<^isub>1 \<and> s\<^isub>2 \<in> L\<^isub>2" 
29
c64241fa4dff Beautifying of the Other Direction is finished.
wu
parents: 28
diff changeset
  1280
    by (auto simp:Seq_def)
c64241fa4dff Beautifying of the Other Direction is finished.
wu
parents: 28
diff changeset
  1281
  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)"
c64241fa4dff Beautifying of the Other Direction is finished.
wu
parents: 28
diff changeset
  1282
    using app_eq_dest by auto
30
f5db9e08effc Directory [tphols-2011] is added to host the commented version of [Myhill.thy]. Directory [pres] is created to host a build session for logical image [ListP] which is essentially [Main] extended with [List_prefix.thy].
zhang
parents: 29
diff changeset
  1283
  moreover have "\<lbrakk>x \<le> s\<^isub>1; (s\<^isub>1 - x) @ s\<^isub>2 = y\<rbrakk> \<Longrightarrow> 
f5db9e08effc Directory [tphols-2011] is added to host the commented version of [Myhill.thy]. Directory [pres] is created to host a build session for logical image [ListP] which is essentially [Main] extended with [List_prefix.thy].
zhang
parents: 29
diff changeset
  1284
                       \<exists> ya \<le> y. (x @ ya) \<in> L\<^isub>1 \<and> (y - ya) \<in> L\<^isub>2" 
f5db9e08effc Directory [tphols-2011] is added to host the commented version of [Myhill.thy]. Directory [pres] is created to host a build session for logical image [ListP] which is essentially [Main] extended with [List_prefix.thy].
zhang
parents: 29
diff changeset
  1285
    using in_seq by (rule_tac x = "s\<^isub>1 - x" in exI, auto elim:prefixE)
f5db9e08effc Directory [tphols-2011] is added to host the commented version of [Myhill.thy]. Directory [pres] is created to host a build session for logical image [ListP] which is essentially [Main] extended with [List_prefix.thy].
zhang
parents: 29
diff changeset
  1286
  moreover have "\<lbrakk>s\<^isub>1 \<le> x; (x - s\<^isub>1) @ y = s\<^isub>2\<rbrakk> \<Longrightarrow> 
f5db9e08effc Directory [tphols-2011] is added to host the commented version of [Myhill.thy]. Directory [pres] is created to host a build session for logical image [ListP] which is essentially [Main] extended with [List_prefix.thy].
zhang
parents: 29
diff changeset
  1287
                    \<exists> xa \<le> x. xa \<in> L\<^isub>1 \<and> (x - xa) @ y \<in> L\<^isub>2" 
f5db9e08effc Directory [tphols-2011] is added to host the commented version of [Myhill.thy]. Directory [pres] is created to host a build session for logical image [ListP] which is essentially [Main] extended with [List_prefix.thy].
zhang
parents: 29
diff changeset
  1288
    using in_seq by (rule_tac x = s\<^isub>1 in exI, auto)
29
c64241fa4dff Beautifying of the Other Direction is finished.
wu
parents: 28
diff changeset
  1289
  ultimately show ?thesis by blast
27
90a57a533b0c Add new file for the new definition of the hard direction's simplification.
wu
parents:
diff changeset
  1290
qed
90a57a533b0c Add new file for the new definition of the hard direction's simplification.
wu
parents:
diff changeset
  1291
29
c64241fa4dff Beautifying of the Other Direction is finished.
wu
parents: 28
diff changeset
  1292
lemma tag_str_SEQ_injI:
c64241fa4dff Beautifying of the Other Direction is finished.
wu
parents: 28
diff changeset
  1293
  "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"
c64241fa4dff Beautifying of the Other Direction is finished.
wu
parents: 28
diff changeset
  1294
proof-
c64241fa4dff Beautifying of the Other Direction is finished.
wu
parents: 28
diff changeset
  1295
  { fix x y z
c64241fa4dff Beautifying of the Other Direction is finished.
wu
parents: 28
diff changeset
  1296
    assume xz_in_seq: "x @ z \<in> L\<^isub>1 ;; L\<^isub>2"
c64241fa4dff Beautifying of the Other Direction is finished.
wu
parents: 28
diff changeset
  1297
    and tag_xy: "tag_str_SEQ L\<^isub>1 L\<^isub>2 x = tag_str_SEQ L\<^isub>1 L\<^isub>2 y"
c64241fa4dff Beautifying of the Other Direction is finished.
wu
parents: 28
diff changeset
  1298
    have"y @ z \<in> L\<^isub>1 ;; L\<^isub>2" 
c64241fa4dff Beautifying of the Other Direction is finished.
wu
parents: 28
diff changeset
  1299
    proof-
30
f5db9e08effc Directory [tphols-2011] is added to host the commented version of [Myhill.thy]. Directory [pres] is created to host a build session for logical image [ListP] which is essentially [Main] extended with [List_prefix.thy].
zhang
parents: 29
diff changeset
  1300
      have "(\<exists> xa \<le> x. xa \<in> L\<^isub>1 \<and> (x - xa) @ z \<in> L\<^isub>2) \<or> 
f5db9e08effc Directory [tphols-2011] is added to host the commented version of [Myhill.thy]. Directory [pres] is created to host a build session for logical image [ListP] which is essentially [Main] extended with [List_prefix.thy].
zhang
parents: 29
diff changeset
  1301
               (\<exists> za \<le> z. (x @ za) \<in> L\<^isub>1 \<and> (z - za) \<in> L\<^isub>2)"
29
c64241fa4dff Beautifying of the Other Direction is finished.
wu
parents: 28
diff changeset
  1302
        using xz_in_seq append_seq_elim by simp
c64241fa4dff Beautifying of the Other Direction is finished.
wu
parents: 28
diff changeset
  1303
      moreover {
c64241fa4dff Beautifying of the Other Direction is finished.
wu
parents: 28
diff changeset
  1304
        fix xa
c64241fa4dff Beautifying of the Other Direction is finished.
wu
parents: 28
diff changeset
  1305
        assume h1: "xa \<le> x" and h2: "xa \<in> L\<^isub>1" and h3: "(x - xa) @ z \<in> L\<^isub>2"
c64241fa4dff Beautifying of the Other Direction is finished.
wu
parents: 28
diff changeset
  1306
        obtain ya where "ya \<le> y" and "ya \<in> L\<^isub>1" and "(y - ya) @ z \<in> L\<^isub>2" 
c64241fa4dff Beautifying of the Other Direction is finished.
wu
parents: 28
diff changeset
  1307
        proof -
c64241fa4dff Beautifying of the Other Direction is finished.
wu
parents: 28
diff changeset
  1308
          have "\<exists> ya.  ya \<le> y \<and> ya \<in> L\<^isub>1 \<and> (x - xa) \<approx>L\<^isub>2 (y - ya)"
c64241fa4dff Beautifying of the Other Direction is finished.
wu
parents: 28
diff changeset
  1309
          proof -
c64241fa4dff Beautifying of the Other Direction is finished.
wu
parents: 28
diff changeset
  1310
            have "{\<approx>L\<^isub>2 `` {x - xa} |xa. xa \<le> x \<and> xa \<in> L\<^isub>1} = 
30
f5db9e08effc Directory [tphols-2011] is added to host the commented version of [Myhill.thy]. Directory [pres] is created to host a build session for logical image [ListP] which is essentially [Main] extended with [List_prefix.thy].
zhang
parents: 29
diff changeset
  1311
                  {\<approx>L\<^isub>2 `` {y - xa} |xa. xa \<le> y \<and> xa \<in> L\<^isub>1}" 
f5db9e08effc Directory [tphols-2011] is added to host the commented version of [Myhill.thy]. Directory [pres] is created to host a build session for logical image [ListP] which is essentially [Main] extended with [List_prefix.thy].
zhang
parents: 29
diff changeset
  1312
                          (is "?Left = ?Right") 
29
c64241fa4dff Beautifying of the Other Direction is finished.
wu
parents: 28
diff changeset
  1313
              using h1 tag_xy by (auto simp:tag_str_SEQ_def)
c64241fa4dff Beautifying of the Other Direction is finished.
wu
parents: 28
diff changeset
  1314
            moreover have "\<approx>L\<^isub>2 `` {x - xa} \<in> ?Left" using h1 h2 by auto
c64241fa4dff Beautifying of the Other Direction is finished.
wu
parents: 28
diff changeset
  1315
            ultimately have "\<approx>L\<^isub>2 `` {x - xa} \<in> ?Right" by simp
c64241fa4dff Beautifying of the Other Direction is finished.
wu
parents: 28
diff changeset
  1316
            thus ?thesis by (auto simp:Image_def str_eq_rel_def str_eq_def)
c64241fa4dff Beautifying of the Other Direction is finished.
wu
parents: 28
diff changeset
  1317
          qed
c64241fa4dff Beautifying of the Other Direction is finished.
wu
parents: 28
diff changeset
  1318
          with prems show ?thesis by (auto simp:str_eq_rel_def str_eq_def)
c64241fa4dff Beautifying of the Other Direction is finished.
wu
parents: 28
diff changeset
  1319
        qed
c64241fa4dff Beautifying of the Other Direction is finished.
wu
parents: 28
diff changeset
  1320
        hence "y @ z \<in> L\<^isub>1 ;; L\<^isub>2" by (erule_tac prefixE, auto simp:Seq_def)          
c64241fa4dff Beautifying of the Other Direction is finished.
wu
parents: 28
diff changeset
  1321
      } moreover {
c64241fa4dff Beautifying of the Other Direction is finished.
wu
parents: 28
diff changeset
  1322
        fix za
c64241fa4dff Beautifying of the Other Direction is finished.
wu
parents: 28
diff changeset
  1323
        assume h1: "za \<le> z" and h2: "(x @ za) \<in> L\<^isub>1" and h3: "z - za \<in> L\<^isub>2"
c64241fa4dff Beautifying of the Other Direction is finished.
wu
parents: 28
diff changeset
  1324
        hence "y @ za \<in> L\<^isub>1"
c64241fa4dff Beautifying of the Other Direction is finished.
wu
parents: 28
diff changeset
  1325
        proof-
30
f5db9e08effc Directory [tphols-2011] is added to host the commented version of [Myhill.thy]. Directory [pres] is created to host a build session for logical image [ListP] which is essentially [Main] extended with [List_prefix.thy].
zhang
parents: 29
diff changeset
  1326
          have "\<approx>L\<^isub>1 `` {x} = \<approx>L\<^isub>1 `` {y}" 
f5db9e08effc Directory [tphols-2011] is added to host the commented version of [Myhill.thy]. Directory [pres] is created to host a build session for logical image [ListP] which is essentially [Main] extended with [List_prefix.thy].
zhang
parents: 29
diff changeset
  1327
            using h1 tag_xy by (auto simp:tag_str_SEQ_def)
f5db9e08effc Directory [tphols-2011] is added to host the commented version of [Myhill.thy]. Directory [pres] is created to host a build session for logical image [ListP] which is essentially [Main] extended with [List_prefix.thy].
zhang
parents: 29
diff changeset
  1328
          with h2 show ?thesis 
f5db9e08effc Directory [tphols-2011] is added to host the commented version of [Myhill.thy]. Directory [pres] is created to host a build session for logical image [ListP] which is essentially [Main] extended with [List_prefix.thy].
zhang
parents: 29
diff changeset
  1329
            by (auto simp:Image_def str_eq_rel_def str_eq_def) 
29
c64241fa4dff Beautifying of the Other Direction is finished.
wu
parents: 28
diff changeset
  1330
        qed
30
f5db9e08effc Directory [tphols-2011] is added to host the commented version of [Myhill.thy]. Directory [pres] is created to host a build session for logical image [ListP] which is essentially [Main] extended with [List_prefix.thy].
zhang
parents: 29
diff changeset
  1331
        with h1 h3 have "y @ z \<in> L\<^isub>1 ;; L\<^isub>2" 
f5db9e08effc Directory [tphols-2011] is added to host the commented version of [Myhill.thy]. Directory [pres] is created to host a build session for logical image [ListP] which is essentially [Main] extended with [List_prefix.thy].
zhang
parents: 29
diff changeset
  1332
          by (drule_tac A = L\<^isub>1 in seq_intro, auto elim:prefixE)
29
c64241fa4dff Beautifying of the Other Direction is finished.
wu
parents: 28
diff changeset
  1333
      }
c64241fa4dff Beautifying of the Other Direction is finished.
wu
parents: 28
diff changeset
  1334
      ultimately show ?thesis by blast
c64241fa4dff Beautifying of the Other Direction is finished.
wu
parents: 28
diff changeset
  1335
    qed
c64241fa4dff Beautifying of the Other Direction is finished.
wu
parents: 28
diff changeset
  1336
  } 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" 
c64241fa4dff Beautifying of the Other Direction is finished.
wu
parents: 28
diff changeset
  1337
    by (auto simp add: str_eq_def str_eq_rel_def)
c64241fa4dff Beautifying of the Other Direction is finished.
wu
parents: 28
diff changeset
  1338
qed 
c64241fa4dff Beautifying of the Other Direction is finished.
wu
parents: 28
diff changeset
  1339
c64241fa4dff Beautifying of the Other Direction is finished.
wu
parents: 28
diff changeset
  1340
lemma quot_seq_finiteI:
c64241fa4dff Beautifying of the Other Direction is finished.
wu
parents: 28
diff changeset
  1341
  assumes finite1: "finite (UNIV // \<approx>(L\<^isub>1::string set))"
c64241fa4dff Beautifying of the Other Direction is finished.
wu
parents: 28
diff changeset
  1342
  and finite2: "finite (UNIV // \<approx>L\<^isub>2)"
c64241fa4dff Beautifying of the Other Direction is finished.
wu
parents: 28
diff changeset
  1343
  shows "finite (UNIV // \<approx>(L\<^isub>1 ;; L\<^isub>2))"
c64241fa4dff Beautifying of the Other Direction is finished.
wu
parents: 28
diff changeset
  1344
proof(rule_tac f = "(op `) (tag_str_SEQ L\<^isub>1 L\<^isub>2)" in finite_imageD)
30
f5db9e08effc Directory [tphols-2011] is added to host the commented version of [Myhill.thy]. Directory [pres] is created to host a build session for logical image [ListP] which is essentially [Main] extended with [List_prefix.thy].
zhang
parents: 29
diff changeset
  1345
  show "finite (op ` (tag_str_SEQ L\<^isub>1 L\<^isub>2) ` UNIV // \<approx>L\<^isub>1 ;; L\<^isub>2)" 
f5db9e08effc Directory [tphols-2011] is added to host the commented version of [Myhill.thy]. Directory [pres] is created to host a build session for logical image [ListP] which is essentially [Main] extended with [List_prefix.thy].
zhang
parents: 29
diff changeset
  1346
    using finite1 finite2
29
c64241fa4dff Beautifying of the Other Direction is finished.
wu
parents: 28
diff changeset
  1347
    by (auto intro:finite_tag_imageI tag_str_seq_range_finite)
27
90a57a533b0c Add new file for the new definition of the hard direction's simplification.
wu
parents:
diff changeset
  1348
next
29
c64241fa4dff Beautifying of the Other Direction is finished.
wu
parents: 28
diff changeset
  1349
  show  "inj_on (op ` (tag_str_SEQ L\<^isub>1 L\<^isub>2)) (UNIV // \<approx>L\<^isub>1 ;; L\<^isub>2)"
c64241fa4dff Beautifying of the Other Direction is finished.
wu
parents: 28
diff changeset
  1350
    apply (rule tag_image_injI)
c64241fa4dff Beautifying of the Other Direction is finished.
wu
parents: 28
diff changeset
  1351
    apply (rule tag_str_SEQ_injI)
c64241fa4dff Beautifying of the Other Direction is finished.
wu
parents: 28
diff changeset
  1352
    by (auto intro:tag_image_injI tag_str_SEQ_injI simp:)
27
90a57a533b0c Add new file for the new definition of the hard direction's simplification.
wu
parents:
diff changeset
  1353
qed
90a57a533b0c Add new file for the new definition of the hard direction's simplification.
wu
parents:
diff changeset
  1354
30
f5db9e08effc Directory [tphols-2011] is added to host the commented version of [Myhill.thy]. Directory [pres] is created to host a build session for logical image [ListP] which is essentially [Main] extended with [List_prefix.thy].
zhang
parents: 29
diff changeset
  1355
subsection {* The case for @{text "ALT"} *}
29
c64241fa4dff Beautifying of the Other Direction is finished.
wu
parents: 28
diff changeset
  1356
c64241fa4dff Beautifying of the Other Direction is finished.
wu
parents: 28
diff changeset
  1357
definition 
c64241fa4dff Beautifying of the Other Direction is finished.
wu
parents: 28
diff changeset
  1358
  "tag_str_ALT L\<^isub>1 L\<^isub>2 (x::string) \<equiv> ((\<approx>L\<^isub>1) `` {x}, (\<approx>L\<^isub>2) `` {x})"
27
90a57a533b0c Add new file for the new definition of the hard direction's simplification.
wu
parents:
diff changeset
  1359
29
c64241fa4dff Beautifying of the Other Direction is finished.
wu
parents: 28
diff changeset
  1360
lemma tag_str_alt_range_finite:
30
f5db9e08effc Directory [tphols-2011] is added to host the commented version of [Myhill.thy]. Directory [pres] is created to host a build session for logical image [ListP] which is essentially [Main] extended with [List_prefix.thy].
zhang
parents: 29
diff changeset
  1361
  "\<lbrakk>finite (UNIV // \<approx>L\<^isub>1); finite (UNIV // \<approx>L\<^isub>2)\<rbrakk> 
f5db9e08effc Directory [tphols-2011] is added to host the commented version of [Myhill.thy]. Directory [pres] is created to host a build session for logical image [ListP] which is essentially [Main] extended with [List_prefix.thy].
zhang
parents: 29
diff changeset
  1362
                              \<Longrightarrow> finite (range (tag_str_ALT L\<^isub>1 L\<^isub>2))"
29
c64241fa4dff Beautifying of the Other Direction is finished.
wu
parents: 28
diff changeset
  1363
apply (rule_tac B = "(UNIV // \<approx>L\<^isub>1) \<times> (UNIV // \<approx>L\<^isub>2)" in finite_subset)
c64241fa4dff Beautifying of the Other Direction is finished.
wu
parents: 28
diff changeset
  1364
by (auto simp:tag_str_ALT_def Image_def quotient_def)
27
90a57a533b0c Add new file for the new definition of the hard direction's simplification.
wu
parents:
diff changeset
  1365
29
c64241fa4dff Beautifying of the Other Direction is finished.
wu
parents: 28
diff changeset
  1366
lemma quot_union_finiteI:
c64241fa4dff Beautifying of the Other Direction is finished.
wu
parents: 28
diff changeset
  1367
  assumes finite1: "finite (UNIV // \<approx>(L\<^isub>1::string set))"
c64241fa4dff Beautifying of the Other Direction is finished.
wu
parents: 28
diff changeset
  1368
  and finite2: "finite (UNIV // \<approx>L\<^isub>2)"
c64241fa4dff Beautifying of the Other Direction is finished.
wu
parents: 28
diff changeset
  1369
  shows "finite (UNIV // \<approx>(L\<^isub>1 \<union> L\<^isub>2))"
c64241fa4dff Beautifying of the Other Direction is finished.
wu
parents: 28
diff changeset
  1370
proof(rule_tac f = "(op `) (tag_str_ALT L\<^isub>1 L\<^isub>2)" in finite_imageD)
30
f5db9e08effc Directory [tphols-2011] is added to host the commented version of [Myhill.thy]. Directory [pres] is created to host a build session for logical image [ListP] which is essentially [Main] extended with [List_prefix.thy].
zhang
parents: 29
diff changeset
  1371
  show "finite (op ` (tag_str_ALT L\<^isub>1 L\<^isub>2) ` UNIV // \<approx>L\<^isub>1 \<union> L\<^isub>2)" 
f5db9e08effc Directory [tphols-2011] is added to host the commented version of [Myhill.thy]. Directory [pres] is created to host a build session for logical image [ListP] which is essentially [Main] extended with [List_prefix.thy].
zhang
parents: 29
diff changeset
  1372
    using finite1 finite2
29
c64241fa4dff Beautifying of the Other Direction is finished.
wu
parents: 28
diff changeset
  1373
    by (auto intro:finite_tag_imageI tag_str_alt_range_finite)
c64241fa4dff Beautifying of the Other Direction is finished.
wu
parents: 28
diff changeset
  1374
next
c64241fa4dff Beautifying of the Other Direction is finished.
wu
parents: 28
diff changeset
  1375
  show "inj_on (op ` (tag_str_ALT L\<^isub>1 L\<^isub>2)) (UNIV // \<approx>L\<^isub>1 \<union> L\<^isub>2)"
c64241fa4dff Beautifying of the Other Direction is finished.
wu
parents: 28
diff changeset
  1376
  proof-
30
f5db9e08effc Directory [tphols-2011] is added to host the commented version of [Myhill.thy]. Directory [pres] is created to host a build session for logical image [ListP] which is essentially [Main] extended with [List_prefix.thy].
zhang
parents: 29
diff changeset
  1377
    have "\<And>m n. tag_str_ALT L\<^isub>1 L\<^isub>2 m = tag_str_ALT L\<^isub>1 L\<^isub>2 n 
f5db9e08effc Directory [tphols-2011] is added to host the commented version of [Myhill.thy]. Directory [pres] is created to host a build session for logical image [ListP] which is essentially [Main] extended with [List_prefix.thy].
zhang
parents: 29
diff changeset
  1378
                         \<Longrightarrow> m \<approx>(L\<^isub>1 \<union> L\<^isub>2) n"
29
c64241fa4dff Beautifying of the Other Direction is finished.
wu
parents: 28
diff changeset
  1379
      unfolding tag_str_ALT_def str_eq_def Image_def str_eq_rel_def by auto
c64241fa4dff Beautifying of the Other Direction is finished.
wu
parents: 28
diff changeset
  1380
    thus ?thesis by (auto intro:tag_image_injI)
c64241fa4dff Beautifying of the Other Direction is finished.
wu
parents: 28
diff changeset
  1381
  qed
27
90a57a533b0c Add new file for the new definition of the hard direction's simplification.
wu
parents:
diff changeset
  1382
qed
90a57a533b0c Add new file for the new definition of the hard direction's simplification.
wu
parents:
diff changeset
  1383
30
f5db9e08effc Directory [tphols-2011] is added to host the commented version of [Myhill.thy]. Directory [pres] is created to host a build session for logical image [ListP] which is essentially [Main] extended with [List_prefix.thy].
zhang
parents: 29
diff changeset
  1384
f5db9e08effc Directory [tphols-2011] is added to host the commented version of [Myhill.thy]. Directory [pres] is created to host a build session for logical image [ListP] which is essentially [Main] extended with [List_prefix.thy].
zhang
parents: 29
diff changeset
  1385
subsection {*
f5db9e08effc Directory [tphols-2011] is added to host the commented version of [Myhill.thy]. Directory [pres] is created to host a build session for logical image [ListP] which is essentially [Main] extended with [List_prefix.thy].
zhang
parents: 29
diff changeset
  1386
  The case for @{text "STAR"}
f5db9e08effc Directory [tphols-2011] is added to host the commented version of [Myhill.thy]. Directory [pres] is created to host a build session for logical image [ListP] which is essentially [Main] extended with [List_prefix.thy].
zhang
parents: 29
diff changeset
  1387
  *}
29
c64241fa4dff Beautifying of the Other Direction is finished.
wu
parents: 28
diff changeset
  1388
30
f5db9e08effc Directory [tphols-2011] is added to host the commented version of [Myhill.thy]. Directory [pres] is created to host a build session for logical image [ListP] which is essentially [Main] extended with [List_prefix.thy].
zhang
parents: 29
diff changeset
  1389
text {* 
f5db9e08effc Directory [tphols-2011] is added to host the commented version of [Myhill.thy]. Directory [pres] is created to host a build session for logical image [ListP] which is essentially [Main] extended with [List_prefix.thy].
zhang
parents: 29
diff changeset
  1390
  This turned out to be the most tricky case. 
f5db9e08effc Directory [tphols-2011] is added to host the commented version of [Myhill.thy]. Directory [pres] is created to host a build session for logical image [ListP] which is essentially [Main] extended with [List_prefix.thy].
zhang
parents: 29
diff changeset
  1391
  *} (* I will make some illustrations for it. *)
f5db9e08effc Directory [tphols-2011] is added to host the commented version of [Myhill.thy]. Directory [pres] is created to host a build session for logical image [ListP] which is essentially [Main] extended with [List_prefix.thy].
zhang
parents: 29
diff changeset
  1392
f5db9e08effc Directory [tphols-2011] is added to host the commented version of [Myhill.thy]. Directory [pres] is created to host a build session for logical image [ListP] which is essentially [Main] extended with [List_prefix.thy].
zhang
parents: 29
diff changeset
  1393
definition 
f5db9e08effc Directory [tphols-2011] is added to host the commented version of [Myhill.thy]. Directory [pres] is created to host a build session for logical image [ListP] which is essentially [Main] extended with [List_prefix.thy].
zhang
parents: 29
diff changeset
  1394
  "tag_str_STAR L\<^isub>1 x \<equiv> {(\<approx>L\<^isub>1) `` {x - xa} | xa. xa < x \<and> xa \<in> L\<^isub>1\<star>}"
f5db9e08effc Directory [tphols-2011] is added to host the commented version of [Myhill.thy]. Directory [pres] is created to host a build session for logical image [ListP] which is essentially [Main] extended with [List_prefix.thy].
zhang
parents: 29
diff changeset
  1395
f5db9e08effc Directory [tphols-2011] is added to host the commented version of [Myhill.thy]. Directory [pres] is created to host a build session for logical image [ListP] which is essentially [Main] extended with [List_prefix.thy].
zhang
parents: 29
diff changeset
  1396
lemma finite_set_has_max: "\<lbrakk>finite A; A \<noteq> {}\<rbrakk> \<Longrightarrow> 
f5db9e08effc Directory [tphols-2011] is added to host the commented version of [Myhill.thy]. Directory [pres] is created to host a build session for logical image [ListP] which is essentially [Main] extended with [List_prefix.thy].
zhang
parents: 29
diff changeset
  1397
           (\<exists> max \<in> A. \<forall> a \<in> A. f a <= (f max :: nat))"
29
c64241fa4dff Beautifying of the Other Direction is finished.
wu
parents: 28
diff changeset
  1398
proof (induct rule:finite.induct)
c64241fa4dff Beautifying of the Other Direction is finished.
wu
parents: 28
diff changeset
  1399
  case emptyI thus ?case by simp
c64241fa4dff Beautifying of the Other Direction is finished.
wu
parents: 28
diff changeset
  1400
next
c64241fa4dff Beautifying of the Other Direction is finished.
wu
parents: 28
diff changeset
  1401
  case (insertI A a)
c64241fa4dff Beautifying of the Other Direction is finished.
wu
parents: 28
diff changeset
  1402
  show ?case
c64241fa4dff Beautifying of the Other Direction is finished.
wu
parents: 28
diff changeset
  1403
  proof (cases "A = {}")
c64241fa4dff Beautifying of the Other Direction is finished.
wu
parents: 28
diff changeset
  1404
    case True thus ?thesis by (rule_tac x = a in bexI, auto)
c64241fa4dff Beautifying of the Other Direction is finished.
wu
parents: 28
diff changeset
  1405
  next
c64241fa4dff Beautifying of the Other Direction is finished.
wu
parents: 28
diff changeset
  1406
    case False
30
f5db9e08effc Directory [tphols-2011] is added to host the commented version of [Myhill.thy]. Directory [pres] is created to host a build session for logical image [ListP] which is essentially [Main] extended with [List_prefix.thy].
zhang
parents: 29
diff changeset
  1407
    with prems obtain max 
f5db9e08effc Directory [tphols-2011] is added to host the commented version of [Myhill.thy]. Directory [pres] is created to host a build session for logical image [ListP] which is essentially [Main] extended with [List_prefix.thy].
zhang
parents: 29
diff changeset
  1408
      where h1: "max \<in> A" 
f5db9e08effc Directory [tphols-2011] is added to host the commented version of [Myhill.thy]. Directory [pres] is created to host a build session for logical image [ListP] which is essentially [Main] extended with [List_prefix.thy].
zhang
parents: 29
diff changeset
  1409
      and h2: "\<forall>a\<in>A. f a \<le> f max" by blast
29
c64241fa4dff Beautifying of the Other Direction is finished.
wu
parents: 28
diff changeset
  1410
    show ?thesis
c64241fa4dff Beautifying of the Other Direction is finished.
wu
parents: 28
diff changeset
  1411
    proof (cases "f a \<le> f max")
c64241fa4dff Beautifying of the Other Direction is finished.
wu
parents: 28
diff changeset
  1412
      assume "f a \<le> f max"
c64241fa4dff Beautifying of the Other Direction is finished.
wu
parents: 28
diff changeset
  1413
      with h1 h2 show ?thesis by (rule_tac x = max in bexI, auto)
c64241fa4dff Beautifying of the Other Direction is finished.
wu
parents: 28
diff changeset
  1414
    next
c64241fa4dff Beautifying of the Other Direction is finished.
wu
parents: 28
diff changeset
  1415
      assume "\<not> (f a \<le> f max)"
c64241fa4dff Beautifying of the Other Direction is finished.
wu
parents: 28
diff changeset
  1416
      thus ?thesis using h2 by (rule_tac x = a in bexI, auto)
c64241fa4dff Beautifying of the Other Direction is finished.
wu
parents: 28
diff changeset
  1417
    qed
c64241fa4dff Beautifying of the Other Direction is finished.
wu
parents: 28
diff changeset
  1418
  qed
c64241fa4dff Beautifying of the Other Direction is finished.
wu
parents: 28
diff changeset
  1419
qed
c64241fa4dff Beautifying of the Other Direction is finished.
wu
parents: 28
diff changeset
  1420
c64241fa4dff Beautifying of the Other Direction is finished.
wu
parents: 28
diff changeset
  1421
lemma finite_strict_prefix_set: "finite {xa. xa < (x::string)}"
c64241fa4dff Beautifying of the Other Direction is finished.
wu
parents: 28
diff changeset
  1422
apply (induct x rule:rev_induct, simp)
c64241fa4dff Beautifying of the Other Direction is finished.
wu
parents: 28
diff changeset
  1423
apply (subgoal_tac "{xa. xa < xs @ [x]} = {xa. xa < xs} \<union> {xs}")
c64241fa4dff Beautifying of the Other Direction is finished.
wu
parents: 28
diff changeset
  1424
by (auto simp:strict_prefix_def)
c64241fa4dff Beautifying of the Other Direction is finished.
wu
parents: 28
diff changeset
  1425
c64241fa4dff Beautifying of the Other Direction is finished.
wu
parents: 28
diff changeset
  1426
c64241fa4dff Beautifying of the Other Direction is finished.
wu
parents: 28
diff changeset
  1427
lemma tag_str_star_range_finite:
c64241fa4dff Beautifying of the Other Direction is finished.
wu
parents: 28
diff changeset
  1428
  "finite (UNIV // \<approx>L\<^isub>1) \<Longrightarrow> finite (range (tag_str_STAR L\<^isub>1))"
c64241fa4dff Beautifying of the Other Direction is finished.
wu
parents: 28
diff changeset
  1429
apply (rule_tac B = "Pow (UNIV // \<approx>L\<^isub>1)" in finite_subset)
30
f5db9e08effc Directory [tphols-2011] is added to host the commented version of [Myhill.thy]. Directory [pres] is created to host a build session for logical image [ListP] which is essentially [Main] extended with [List_prefix.thy].
zhang
parents: 29
diff changeset
  1430
by (auto simp:tag_str_STAR_def Image_def 
f5db9e08effc Directory [tphols-2011] is added to host the commented version of [Myhill.thy]. Directory [pres] is created to host a build session for logical image [ListP] which is essentially [Main] extended with [List_prefix.thy].
zhang
parents: 29
diff changeset
  1431
                       quotient_def split:if_splits)
27
90a57a533b0c Add new file for the new definition of the hard direction's simplification.
wu
parents:
diff changeset
  1432
29
c64241fa4dff Beautifying of the Other Direction is finished.
wu
parents: 28
diff changeset
  1433
lemma tag_str_STAR_injI:
c64241fa4dff Beautifying of the Other Direction is finished.
wu
parents: 28
diff changeset
  1434
  "tag_str_STAR L\<^isub>1 m = tag_str_STAR L\<^isub>1 n \<Longrightarrow> m \<approx>(L\<^isub>1\<star>) n"
c64241fa4dff Beautifying of the Other Direction is finished.
wu
parents: 28
diff changeset
  1435
proof-
c64241fa4dff Beautifying of the Other Direction is finished.
wu
parents: 28
diff changeset
  1436
  { fix x y z
c64241fa4dff Beautifying of the Other Direction is finished.
wu
parents: 28
diff changeset
  1437
    assume xz_in_star: "x @ z \<in> L\<^isub>1\<star>"
c64241fa4dff Beautifying of the Other Direction is finished.
wu
parents: 28
diff changeset
  1438
    and tag_xy: "tag_str_STAR L\<^isub>1 x = tag_str_STAR L\<^isub>1 y"
c64241fa4dff Beautifying of the Other Direction is finished.
wu
parents: 28
diff changeset
  1439
    have "y @ z \<in> L\<^isub>1\<star>"
c64241fa4dff Beautifying of the Other Direction is finished.
wu
parents: 28
diff changeset
  1440
    proof(cases "x = []")
c64241fa4dff Beautifying of the Other Direction is finished.
wu
parents: 28
diff changeset
  1441
      case True
30
f5db9e08effc Directory [tphols-2011] is added to host the commented version of [Myhill.thy]. Directory [pres] is created to host a build session for logical image [ListP] which is essentially [Main] extended with [List_prefix.thy].
zhang
parents: 29
diff changeset
  1442
      with tag_xy have "y = []" 
f5db9e08effc Directory [tphols-2011] is added to host the commented version of [Myhill.thy]. Directory [pres] is created to host a build session for logical image [ListP] which is essentially [Main] extended with [List_prefix.thy].
zhang
parents: 29
diff changeset
  1443
        by (auto simp:tag_str_STAR_def strict_prefix_def)
29
c64241fa4dff Beautifying of the Other Direction is finished.
wu
parents: 28
diff changeset
  1444
      thus ?thesis using xz_in_star True by simp
c64241fa4dff Beautifying of the Other Direction is finished.
wu
parents: 28
diff changeset
  1445
    next
c64241fa4dff Beautifying of the Other Direction is finished.
wu
parents: 28
diff changeset
  1446
      case False
30
f5db9e08effc Directory [tphols-2011] is added to host the commented version of [Myhill.thy]. Directory [pres] is created to host a build session for logical image [ListP] which is essentially [Main] extended with [List_prefix.thy].
zhang
parents: 29
diff changeset
  1447
      obtain x_max 
f5db9e08effc Directory [tphols-2011] is added to host the commented version of [Myhill.thy]. Directory [pres] is created to host a build session for logical image [ListP] which is essentially [Main] extended with [List_prefix.thy].
zhang
parents: 29
diff changeset
  1448
        where h1: "x_max < x" 
f5db9e08effc Directory [tphols-2011] is added to host the commented version of [Myhill.thy]. Directory [pres] is created to host a build session for logical image [ListP] which is essentially [Main] extended with [List_prefix.thy].
zhang
parents: 29
diff changeset
  1449
        and h2: "x_max \<in> L\<^isub>1\<star>" 
f5db9e08effc Directory [tphols-2011] is added to host the commented version of [Myhill.thy]. Directory [pres] is created to host a build session for logical image [ListP] which is essentially [Main] extended with [List_prefix.thy].
zhang
parents: 29
diff changeset
  1450
        and h3: "(x - x_max) @ z \<in> L\<^isub>1\<star>" 
f5db9e08effc Directory [tphols-2011] is added to host the commented version of [Myhill.thy]. Directory [pres] is created to host a build session for logical image [ListP] which is essentially [Main] extended with [List_prefix.thy].
zhang
parents: 29
diff changeset
  1451
        and h4:"\<forall> xa < x. xa \<in> L\<^isub>1\<star> \<and> (x - xa) @ z \<in> L\<^isub>1\<star> 
f5db9e08effc Directory [tphols-2011] is added to host the commented version of [Myhill.thy]. Directory [pres] is created to host a build session for logical image [ListP] which is essentially [Main] extended with [List_prefix.thy].
zhang
parents: 29
diff changeset
  1452
                                     \<longrightarrow> length xa \<le> length x_max"
29
c64241fa4dff Beautifying of the Other Direction is finished.
wu
parents: 28
diff changeset
  1453
      proof-
c64241fa4dff Beautifying of the Other Direction is finished.
wu
parents: 28
diff changeset
  1454
        let ?S = "{xa. xa < x \<and> xa \<in> L\<^isub>1\<star> \<and> (x - xa) @ z \<in> L\<^isub>1\<star>}"
c64241fa4dff Beautifying of the Other Direction is finished.
wu
parents: 28
diff changeset
  1455
        have "finite ?S"
30
f5db9e08effc Directory [tphols-2011] is added to host the commented version of [Myhill.thy]. Directory [pres] is created to host a build session for logical image [ListP] which is essentially [Main] extended with [List_prefix.thy].
zhang
parents: 29
diff changeset
  1456
          by (rule_tac B = "{xa. xa < x}" in finite_subset, 
f5db9e08effc Directory [tphols-2011] is added to host the commented version of [Myhill.thy]. Directory [pres] is created to host a build session for logical image [ListP] which is essentially [Main] extended with [List_prefix.thy].
zhang
parents: 29
diff changeset
  1457
                                auto simp:finite_strict_prefix_set)
29
c64241fa4dff Beautifying of the Other Direction is finished.
wu
parents: 28
diff changeset
  1458
        moreover have "?S \<noteq> {}" using False xz_in_star
c64241fa4dff Beautifying of the Other Direction is finished.
wu
parents: 28
diff changeset
  1459
          by (simp, rule_tac x = "[]" in exI, auto simp:strict_prefix_def)
30
f5db9e08effc Directory [tphols-2011] is added to host the commented version of [Myhill.thy]. Directory [pres] is created to host a build session for logical image [ListP] which is essentially [Main] extended with [List_prefix.thy].
zhang
parents: 29
diff changeset
  1460
        ultimately have "\<exists> max \<in> ?S. \<forall> a \<in> ?S. length a \<le> length max" 
f5db9e08effc Directory [tphols-2011] is added to host the commented version of [Myhill.thy]. Directory [pres] is created to host a build session for logical image [ListP] which is essentially [Main] extended with [List_prefix.thy].
zhang
parents: 29
diff changeset
  1461
          using finite_set_has_max by blast
29
c64241fa4dff Beautifying of the Other Direction is finished.
wu
parents: 28
diff changeset
  1462
        with prems show ?thesis by blast
c64241fa4dff Beautifying of the Other Direction is finished.
wu
parents: 28
diff changeset
  1463
      qed
30
f5db9e08effc Directory [tphols-2011] is added to host the commented version of [Myhill.thy]. Directory [pres] is created to host a build session for logical image [ListP] which is essentially [Main] extended with [List_prefix.thy].
zhang
parents: 29
diff changeset
  1464
      obtain ya 
f5db9e08effc Directory [tphols-2011] is added to host the commented version of [Myhill.thy]. Directory [pres] is created to host a build session for logical image [ListP] which is essentially [Main] extended with [List_prefix.thy].
zhang
parents: 29
diff changeset
  1465
        where h5: "ya < y" and h6: "ya \<in> L\<^isub>1\<star>" and h7: "(x - x_max) \<approx>L\<^isub>1 (y - ya)"
29
c64241fa4dff Beautifying of the Other Direction is finished.
wu
parents: 28
diff changeset
  1466
      proof-
c64241fa4dff Beautifying of the Other Direction is finished.
wu
parents: 28
diff changeset
  1467
        from tag_xy have "{\<approx>L\<^isub>1 `` {x - xa} |xa. xa < x \<and> xa \<in> L\<^isub>1\<star>} = 
c64241fa4dff Beautifying of the Other Direction is finished.
wu
parents: 28
diff changeset
  1468
          {\<approx>L\<^isub>1 `` {y - xa} |xa. xa < y \<and> xa \<in> L\<^isub>1\<star>}" (is "?left = ?right")
c64241fa4dff Beautifying of the Other Direction is finished.
wu
parents: 28
diff changeset
  1469
          by (auto simp:tag_str_STAR_def)
c64241fa4dff Beautifying of the Other Direction is finished.
wu
parents: 28
diff changeset
  1470
        moreover have "\<approx>L\<^isub>1 `` {x - x_max} \<in> ?left" using h1 h2 by auto
c64241fa4dff Beautifying of the Other Direction is finished.
wu
parents: 28
diff changeset
  1471
        ultimately have "\<approx>L\<^isub>1 `` {x - x_max} \<in> ?right" by simp
30
f5db9e08effc Directory [tphols-2011] is added to host the commented version of [Myhill.thy]. Directory [pres] is created to host a build session for logical image [ListP] which is essentially [Main] extended with [List_prefix.thy].
zhang
parents: 29
diff changeset
  1472
        with prems show ?thesis apply 
f5db9e08effc Directory [tphols-2011] is added to host the commented version of [Myhill.thy]. Directory [pres] is created to host a build session for logical image [ListP] which is essentially [Main] extended with [List_prefix.thy].
zhang
parents: 29
diff changeset
  1473
          (simp add:Image_def str_eq_rel_def str_eq_def) by blast
29
c64241fa4dff Beautifying of the Other Direction is finished.
wu
parents: 28
diff changeset
  1474
      qed      
c64241fa4dff Beautifying of the Other Direction is finished.
wu
parents: 28
diff changeset
  1475
      have "(y - ya) @ z \<in> L\<^isub>1\<star>" 
c64241fa4dff Beautifying of the Other Direction is finished.
wu
parents: 28
diff changeset
  1476
      proof-
30
f5db9e08effc Directory [tphols-2011] is added to host the commented version of [Myhill.thy]. Directory [pres] is created to host a build session for logical image [ListP] which is essentially [Main] extended with [List_prefix.thy].
zhang
parents: 29
diff changeset
  1477
        from h3 h1 obtain a b where a_in: "a \<in> L\<^isub>1" 
f5db9e08effc Directory [tphols-2011] is added to host the commented version of [Myhill.thy]. Directory [pres] is created to host a build session for logical image [ListP] which is essentially [Main] extended with [List_prefix.thy].
zhang
parents: 29
diff changeset
  1478
          and a_neq: "a \<noteq> []" and b_in: "b \<in> L\<^isub>1\<star>" 
29
c64241fa4dff Beautifying of the Other Direction is finished.
wu
parents: 28
diff changeset
  1479
          and ab_max: "(x - x_max) @ z = a @ b" 
c64241fa4dff Beautifying of the Other Direction is finished.
wu
parents: 28
diff changeset
  1480
          by (drule_tac star_decom, auto simp:strict_prefix_def elim:prefixE)
c64241fa4dff Beautifying of the Other Direction is finished.
wu
parents: 28
diff changeset
  1481
        have "(x - x_max) \<le> a \<and> (a - (x - x_max)) @ b = z" 
c64241fa4dff Beautifying of the Other Direction is finished.
wu
parents: 28
diff changeset
  1482
        proof -
30
f5db9e08effc Directory [tphols-2011] is added to host the commented version of [Myhill.thy]. Directory [pres] is created to host a build session for logical image [ListP] which is essentially [Main] extended with [List_prefix.thy].
zhang
parents: 29
diff changeset
  1483
          have "((x - x_max) \<le> a \<and> (a - (x - x_max)) @ b = z) \<or> 
f5db9e08effc Directory [tphols-2011] is added to host the commented version of [Myhill.thy]. Directory [pres] is created to host a build session for logical image [ListP] which is essentially [Main] extended with [List_prefix.thy].
zhang
parents: 29
diff changeset
  1484
                            (a < (x - x_max) \<and> ((x - x_max) - a) @ z = b)" 
29
c64241fa4dff Beautifying of the Other Direction is finished.
wu
parents: 28
diff changeset
  1485
            using app_eq_dest[OF ab_max] by (auto simp:strict_prefix_def)
c64241fa4dff Beautifying of the Other Direction is finished.
wu
parents: 28
diff changeset
  1486
          moreover { 
c64241fa4dff Beautifying of the Other Direction is finished.
wu
parents: 28
diff changeset
  1487
            assume np: "a < (x - x_max)" and b_eqs: " ((x - x_max) - a) @ z = b"
c64241fa4dff Beautifying of the Other Direction is finished.
wu
parents: 28
diff changeset
  1488
            have "False"
c64241fa4dff Beautifying of the Other Direction is finished.
wu
parents: 28
diff changeset
  1489
            proof -
c64241fa4dff Beautifying of the Other Direction is finished.
wu
parents: 28
diff changeset
  1490
              let ?x_max' = "x_max @ a"
30
f5db9e08effc Directory [tphols-2011] is added to host the commented version of [Myhill.thy]. Directory [pres] is created to host a build session for logical image [ListP] which is essentially [Main] extended with [List_prefix.thy].
zhang
parents: 29
diff changeset
  1491
              have "?x_max' < x" 
f5db9e08effc Directory [tphols-2011] is added to host the commented version of [Myhill.thy]. Directory [pres] is created to host a build session for logical image [ListP] which is essentially [Main] extended with [List_prefix.thy].
zhang
parents: 29
diff changeset
  1492
                using np h1 by (clarsimp simp:strict_prefix_def diff_prefix) 
f5db9e08effc Directory [tphols-2011] is added to host the commented version of [Myhill.thy]. Directory [pres] is created to host a build session for logical image [ListP] which is essentially [Main] extended with [List_prefix.thy].
zhang
parents: 29
diff changeset
  1493
              moreover have "?x_max' \<in> L\<^isub>1\<star>" 
f5db9e08effc Directory [tphols-2011] is added to host the commented version of [Myhill.thy]. Directory [pres] is created to host a build session for logical image [ListP] which is essentially [Main] extended with [List_prefix.thy].
zhang
parents: 29
diff changeset
  1494
                using a_in h2 by (simp add:star_intro3) 
f5db9e08effc Directory [tphols-2011] is added to host the commented version of [Myhill.thy]. Directory [pres] is created to host a build session for logical image [ListP] which is essentially [Main] extended with [List_prefix.thy].
zhang
parents: 29
diff changeset
  1495
              moreover have "(x - ?x_max') @ z \<in> L\<^isub>1\<star>" 
f5db9e08effc Directory [tphols-2011] is added to host the commented version of [Myhill.thy]. Directory [pres] is created to host a build session for logical image [ListP] which is essentially [Main] extended with [List_prefix.thy].
zhang
parents: 29
diff changeset
  1496
                using b_eqs b_in np h1 by (simp add:diff_diff_appd)
f5db9e08effc Directory [tphols-2011] is added to host the commented version of [Myhill.thy]. Directory [pres] is created to host a build session for logical image [ListP] which is essentially [Main] extended with [List_prefix.thy].
zhang
parents: 29
diff changeset
  1497
              moreover have "\<not> (length ?x_max' \<le> length x_max)" 
f5db9e08effc Directory [tphols-2011] is added to host the commented version of [Myhill.thy]. Directory [pres] is created to host a build session for logical image [ListP] which is essentially [Main] extended with [List_prefix.thy].
zhang
parents: 29
diff changeset
  1498
                using a_neq by simp
29
c64241fa4dff Beautifying of the Other Direction is finished.
wu
parents: 28
diff changeset
  1499
              ultimately show ?thesis using h4 by blast
c64241fa4dff Beautifying of the Other Direction is finished.
wu
parents: 28
diff changeset
  1500
            qed 
c64241fa4dff Beautifying of the Other Direction is finished.
wu
parents: 28
diff changeset
  1501
          } ultimately show ?thesis by blast
c64241fa4dff Beautifying of the Other Direction is finished.
wu
parents: 28
diff changeset
  1502
        qed
30
f5db9e08effc Directory [tphols-2011] is added to host the commented version of [Myhill.thy]. Directory [pres] is created to host a build session for logical image [ListP] which is essentially [Main] extended with [List_prefix.thy].
zhang
parents: 29
diff changeset
  1503
        then obtain za where z_decom: "z = za @ b" 
f5db9e08effc Directory [tphols-2011] is added to host the commented version of [Myhill.thy]. Directory [pres] is created to host a build session for logical image [ListP] which is essentially [Main] extended with [List_prefix.thy].
zhang
parents: 29
diff changeset
  1504
          and x_za: "(x - x_max) @ za \<in> L\<^isub>1" 
29
c64241fa4dff Beautifying of the Other Direction is finished.
wu
parents: 28
diff changeset
  1505
          using a_in by (auto elim:prefixE)        
30
f5db9e08effc Directory [tphols-2011] is added to host the commented version of [Myhill.thy]. Directory [pres] is created to host a build session for logical image [ListP] which is essentially [Main] extended with [List_prefix.thy].
zhang
parents: 29
diff changeset
  1506
        from x_za h7 have "(y - ya) @ za \<in> L\<^isub>1" 
f5db9e08effc Directory [tphols-2011] is added to host the commented version of [Myhill.thy]. Directory [pres] is created to host a build session for logical image [ListP] which is essentially [Main] extended with [List_prefix.thy].
zhang
parents: 29
diff changeset
  1507
          by (auto simp:str_eq_def str_eq_rel_def)
29
c64241fa4dff Beautifying of the Other Direction is finished.
wu
parents: 28
diff changeset
  1508
        with z_decom b_in show ?thesis by (auto dest!:step[of "(y - ya) @ za"])
c64241fa4dff Beautifying of the Other Direction is finished.
wu
parents: 28
diff changeset
  1509
      qed
30
f5db9e08effc Directory [tphols-2011] is added to host the commented version of [Myhill.thy]. Directory [pres] is created to host a build session for logical image [ListP] which is essentially [Main] extended with [List_prefix.thy].
zhang
parents: 29
diff changeset
  1510
      with h5 h6 show ?thesis 
f5db9e08effc Directory [tphols-2011] is added to host the commented version of [Myhill.thy]. Directory [pres] is created to host a build session for logical image [ListP] which is essentially [Main] extended with [List_prefix.thy].
zhang
parents: 29
diff changeset
  1511
        by (drule_tac star_intro1, auto simp:strict_prefix_def elim:prefixE)
29
c64241fa4dff Beautifying of the Other Direction is finished.
wu
parents: 28
diff changeset
  1512
    qed      
c64241fa4dff Beautifying of the Other Direction is finished.
wu
parents: 28
diff changeset
  1513
  } thus "tag_str_STAR L\<^isub>1 m = tag_str_STAR L\<^isub>1 n \<Longrightarrow> m \<approx>(L\<^isub>1\<star>) n"
c64241fa4dff Beautifying of the Other Direction is finished.
wu
parents: 28
diff changeset
  1514
    by (auto simp add:str_eq_def str_eq_rel_def)
27
90a57a533b0c Add new file for the new definition of the hard direction's simplification.
wu
parents:
diff changeset
  1515
qed
90a57a533b0c Add new file for the new definition of the hard direction's simplification.
wu
parents:
diff changeset
  1516
29
c64241fa4dff Beautifying of the Other Direction is finished.
wu
parents: 28
diff changeset
  1517
lemma quot_star_finiteI:
c64241fa4dff Beautifying of the Other Direction is finished.
wu
parents: 28
diff changeset
  1518
  assumes finite: "finite (UNIV // \<approx>(L\<^isub>1::string set))"
c64241fa4dff Beautifying of the Other Direction is finished.
wu
parents: 28
diff changeset
  1519
  shows "finite (UNIV // \<approx>(L\<^isub>1\<star>))"
c64241fa4dff Beautifying of the Other Direction is finished.
wu
parents: 28
diff changeset
  1520
proof(rule_tac f = "(op `) (tag_str_STAR L\<^isub>1)" in finite_imageD)
c64241fa4dff Beautifying of the Other Direction is finished.
wu
parents: 28
diff changeset
  1521
  show "finite (op ` (tag_str_STAR L\<^isub>1) ` UNIV // \<approx>L\<^isub>1\<star>)" using finite
c64241fa4dff Beautifying of the Other Direction is finished.
wu
parents: 28
diff changeset
  1522
    by (auto intro:finite_tag_imageI tag_str_star_range_finite)
c64241fa4dff Beautifying of the Other Direction is finished.
wu
parents: 28
diff changeset
  1523
next
c64241fa4dff Beautifying of the Other Direction is finished.
wu
parents: 28
diff changeset
  1524
  show "inj_on (op ` (tag_str_STAR L\<^isub>1)) (UNIV // \<approx>L\<^isub>1\<star>)"
c64241fa4dff Beautifying of the Other Direction is finished.
wu
parents: 28
diff changeset
  1525
    by (auto intro:tag_image_injI tag_str_STAR_injI)
27
90a57a533b0c Add new file for the new definition of the hard direction's simplification.
wu
parents:
diff changeset
  1526
qed
90a57a533b0c Add new file for the new definition of the hard direction's simplification.
wu
parents:
diff changeset
  1527
30
f5db9e08effc Directory [tphols-2011] is added to host the commented version of [Myhill.thy]. Directory [pres] is created to host a build session for logical image [ListP] which is essentially [Main] extended with [List_prefix.thy].
zhang
parents: 29
diff changeset
  1528
subsection {*
f5db9e08effc Directory [tphols-2011] is added to host the commented version of [Myhill.thy]. Directory [pres] is created to host a build session for logical image [ListP] which is essentially [Main] extended with [List_prefix.thy].
zhang
parents: 29
diff changeset
  1529
  The main lemma
f5db9e08effc Directory [tphols-2011] is added to host the commented version of [Myhill.thy]. Directory [pres] is created to host a build session for logical image [ListP] which is essentially [Main] extended with [List_prefix.thy].
zhang
parents: 29
diff changeset
  1530
  *}
27
90a57a533b0c Add new file for the new definition of the hard direction's simplification.
wu
parents:
diff changeset
  1531
30
f5db9e08effc Directory [tphols-2011] is added to host the commented version of [Myhill.thy]. Directory [pres] is created to host a build session for logical image [ListP] which is essentially [Main] extended with [List_prefix.thy].
zhang
parents: 29
diff changeset
  1532
lemma easier_directio\<nu>:
29
c64241fa4dff Beautifying of the Other Direction is finished.
wu
parents: 28
diff changeset
  1533
  "Lang = L (r::rexp) \<Longrightarrow> finite (UNIV // (\<approx>Lang))"
c64241fa4dff Beautifying of the Other Direction is finished.
wu
parents: 28
diff changeset
  1534
proof (induct arbitrary:Lang rule:rexp.induct)
c64241fa4dff Beautifying of the Other Direction is finished.
wu
parents: 28
diff changeset
  1535
  case NULL
c64241fa4dff Beautifying of the Other Direction is finished.
wu
parents: 28
diff changeset
  1536
  have "UNIV // (\<approx>{}) \<subseteq> {UNIV} "
c64241fa4dff Beautifying of the Other Direction is finished.
wu
parents: 28
diff changeset
  1537
    by (auto simp:quotient_def str_eq_rel_def str_eq_def)
c64241fa4dff Beautifying of the Other Direction is finished.
wu
parents: 28
diff changeset
  1538
  with prems show "?case" by (auto intro:finite_subset)
c64241fa4dff Beautifying of the Other Direction is finished.
wu
parents: 28
diff changeset
  1539
next
c64241fa4dff Beautifying of the Other Direction is finished.
wu
parents: 28
diff changeset
  1540
  case EMPTY
30
f5db9e08effc Directory [tphols-2011] is added to host the commented version of [Myhill.thy]. Directory [pres] is created to host a build session for logical image [ListP] which is essentially [Main] extended with [List_prefix.thy].
zhang
parents: 29
diff changeset
  1541
  have "UNIV // (\<approx>{[]}) \<subseteq> {{[]}, UNIV - {[]}}" 
f5db9e08effc Directory [tphols-2011] is added to host the commented version of [Myhill.thy]. Directory [pres] is created to host a build session for logical image [ListP] which is essentially [Main] extended with [List_prefix.thy].
zhang
parents: 29
diff changeset
  1542
    by (rule quot_empty_subset)
29
c64241fa4dff Beautifying of the Other Direction is finished.
wu
parents: 28
diff changeset
  1543
  with prems show ?case by (auto intro:finite_subset)
c64241fa4dff Beautifying of the Other Direction is finished.
wu
parents: 28
diff changeset
  1544
next
c64241fa4dff Beautifying of the Other Direction is finished.
wu
parents: 28
diff changeset
  1545
  case (CHAR c)
30
f5db9e08effc Directory [tphols-2011] is added to host the commented version of [Myhill.thy]. Directory [pres] is created to host a build session for logical image [ListP] which is essentially [Main] extended with [List_prefix.thy].
zhang
parents: 29
diff changeset
  1546
  have "UNIV // (\<approx>{[c]}) \<subseteq> {{[]},{[c]}, UNIV - {[], [c]}}" 
f5db9e08effc Directory [tphols-2011] is added to host the commented version of [Myhill.thy]. Directory [pres] is created to host a build session for logical image [ListP] which is essentially [Main] extended with [List_prefix.thy].
zhang
parents: 29
diff changeset
  1547
    by (rule quot_char_subset)
29
c64241fa4dff Beautifying of the Other Direction is finished.
wu
parents: 28
diff changeset
  1548
  with prems show ?case by (auto intro:finite_subset)
c64241fa4dff Beautifying of the Other Direction is finished.
wu
parents: 28
diff changeset
  1549
next
c64241fa4dff Beautifying of the Other Direction is finished.
wu
parents: 28
diff changeset
  1550
  case (SEQ r\<^isub>1 r\<^isub>2)
30
f5db9e08effc Directory [tphols-2011] is added to host the commented version of [Myhill.thy]. Directory [pres] is created to host a build session for logical image [ListP] which is essentially [Main] extended with [List_prefix.thy].
zhang
parents: 29
diff changeset
  1551
  have "\<lbrakk>finite (UNIV // \<approx>(L r\<^isub>1)); finite (UNIV // \<approx>(L r\<^isub>2))\<rbrakk> 
f5db9e08effc Directory [tphols-2011] is added to host the commented version of [Myhill.thy]. Directory [pres] is created to host a build session for logical image [ListP] which is essentially [Main] extended with [List_prefix.thy].
zhang
parents: 29
diff changeset
  1552
            \<Longrightarrow> finite (UNIV // \<approx>(L r\<^isub>1 ;; L r\<^isub>2))"
29
c64241fa4dff Beautifying of the Other Direction is finished.
wu
parents: 28
diff changeset
  1553
    by (erule quot_seq_finiteI, simp)
c64241fa4dff Beautifying of the Other Direction is finished.
wu
parents: 28
diff changeset
  1554
  with prems show ?case by simp
c64241fa4dff Beautifying of the Other Direction is finished.
wu
parents: 28
diff changeset
  1555
next
c64241fa4dff Beautifying of the Other Direction is finished.
wu
parents: 28
diff changeset
  1556
  case (ALT r\<^isub>1 r\<^isub>2)
30
f5db9e08effc Directory [tphols-2011] is added to host the commented version of [Myhill.thy]. Directory [pres] is created to host a build session for logical image [ListP] which is essentially [Main] extended with [List_prefix.thy].
zhang
parents: 29
diff changeset
  1557
  have "\<lbrakk>finite (UNIV // \<approx>(L r\<^isub>1)); finite (UNIV // \<approx>(L r\<^isub>2))\<rbrakk> 
f5db9e08effc Directory [tphols-2011] is added to host the commented version of [Myhill.thy]. Directory [pres] is created to host a build session for logical image [ListP] which is essentially [Main] extended with [List_prefix.thy].
zhang
parents: 29
diff changeset
  1558
            \<Longrightarrow> finite (UNIV // \<approx>(L r\<^isub>1 \<union> L r\<^isub>2))"
29
c64241fa4dff Beautifying of the Other Direction is finished.
wu
parents: 28
diff changeset
  1559
    by (erule quot_union_finiteI, simp)
c64241fa4dff Beautifying of the Other Direction is finished.
wu
parents: 28
diff changeset
  1560
  with prems show ?case by simp  
c64241fa4dff Beautifying of the Other Direction is finished.
wu
parents: 28
diff changeset
  1561
next
c64241fa4dff Beautifying of the Other Direction is finished.
wu
parents: 28
diff changeset
  1562
  case (STAR r)
30
f5db9e08effc Directory [tphols-2011] is added to host the commented version of [Myhill.thy]. Directory [pres] is created to host a build session for logical image [ListP] which is essentially [Main] extended with [List_prefix.thy].
zhang
parents: 29
diff changeset
  1563
  have "finite (UNIV // \<approx>(L r)) 
f5db9e08effc Directory [tphols-2011] is added to host the commented version of [Myhill.thy]. Directory [pres] is created to host a build session for logical image [ListP] which is essentially [Main] extended with [List_prefix.thy].
zhang
parents: 29
diff changeset
  1564
            \<Longrightarrow> finite (UNIV // \<approx>((L r)\<star>))"
29
c64241fa4dff Beautifying of the Other Direction is finished.
wu
parents: 28
diff changeset
  1565
    by (erule quot_star_finiteI)
c64241fa4dff Beautifying of the Other Direction is finished.
wu
parents: 28
diff changeset
  1566
  with prems show ?case by simp
c64241fa4dff Beautifying of the Other Direction is finished.
wu
parents: 28
diff changeset
  1567
qed 
27
90a57a533b0c Add new file for the new definition of the hard direction's simplification.
wu
parents:
diff changeset
  1568
30
f5db9e08effc Directory [tphols-2011] is added to host the commented version of [Myhill.thy]. Directory [pres] is created to host a build session for logical image [ListP] which is essentially [Main] extended with [List_prefix.thy].
zhang
parents: 29
diff changeset
  1569
end
f5db9e08effc Directory [tphols-2011] is added to host the commented version of [Myhill.thy]. Directory [pres] is created to host a build session for logical image [ListP] which is essentially [Main] extended with [List_prefix.thy].
zhang
parents: 29
diff changeset
  1570