Myhill_1.thy
changeset 104 5bd73aa805a7
parent 103 f460d5f75cb5
child 105 ae6ad1363eb9
equal deleted inserted replaced
103:f460d5f75cb5 104:5bd73aa805a7
   507   Every equation in @{text ES} (represented by @{text "(X, rhs)"}) 
   507   Every equation in @{text ES} (represented by @{text "(X, rhs)"}) 
   508   is valid, i.e. @{text "X = L rhs"}.
   508   is valid, i.e. @{text "X = L rhs"}.
   509 *}
   509 *}
   510 
   510 
   511 definition 
   511 definition 
   512   "valid_eqns ES \<equiv> \<forall>(X, rhs) \<in> ES. X = L rhs"
   512   "sound_eqs ES \<equiv> \<forall>(X, rhs) \<in> ES. X = L rhs"
   513 
   513 
   514 text {*
   514 text {*
   515   @{text "rhs_nonempty rhs"} requires regular expressions occuring in 
   515   @{text "rhs_nonempty rhs"} requires regular expressions occuring in 
   516   transitional items of @{text "rhs"} do not contain empty string. This is 
   516   transitional items of @{text "rhs"} do not contain empty string. This is 
   517   necessary for the application of Arden's transformation to @{text "rhs"}.
   517   necessary for the application of Arden's transformation to @{text "rhs"}.
   544   @{text "classes_of rhs"} returns all variables (or equivalent classes)
   544   @{text "classes_of rhs"} returns all variables (or equivalent classes)
   545   occuring in @{text "rhs"}.
   545   occuring in @{text "rhs"}.
   546   *}
   546   *}
   547 
   547 
   548 definition 
   548 definition 
   549   "classes_of rhs \<equiv> {X | X r. Trn X r \<in> rhs}"
   549   "rhss rhs \<equiv> {X | X r. Trn X r \<in> rhs}"
   550 
   550 
   551 text {*
   551 text {*
   552   @{text "lefts_of ES"} returns all variables defined by an 
   552   @{text "lefts_of ES"} returns all variables defined by an 
   553   equational system @{text "ES"}.
   553   equational system @{text "ES"}.
   554 *}
   554 *}
   555 definition
   555 definition
   556   "lhss ES \<equiv> {Y | Y yrhs. (Y, yrhs) \<in> ES}"
   556   "lhss ES \<equiv> {Y | Y yrhs. (Y, yrhs) \<in> ES}"
   557 
   557 
   558 text {*
   558 text {*
   559   The following @{text "self_contained ES"} requires that every variable occuring 
   559   The following @{text "valid_eqs ES"} requires that every variable occuring 
   560   on the right hand side of equations is already defined by some equation in @{text "ES"}.
   560   on the right hand side of equations is already defined by some equation in @{text "ES"}.
   561 *}
   561 *}
   562 definition 
   562 definition 
   563   "self_contained ES \<equiv> \<forall>(X, xrhs) \<in> ES. classes_of xrhs \<subseteq> lhss ES"
   563   "valid_eqs ES \<equiv> \<forall>(X, rhs) \<in> ES. rhss rhs \<subseteq> lhss ES"
   564 
   564 
   565 
   565 
   566 text {*
   566 text {*
   567   The invariant @{text "invariant(ES)"} is a conjunction of all the previously defined constaints.
   567   The invariant @{text "invariant(ES)"} is a conjunction of all the previously defined constaints.
   568   *}
   568   *}
   569 definition 
   569 definition 
   570   "invariant ES \<equiv> finite ES
   570   "invariant ES \<equiv> finite ES
   571                 \<and> finite_rhs ES
   571                 \<and> finite_rhs ES
   572                 \<and> valid_eqns ES 
   572                 \<and> sound_eqs ES 
   573                 \<and> distinct_equas ES 
   573                 \<and> distinct_equas ES 
   574                 \<and> ardenable ES 
   574                 \<and> ardenable ES 
   575                 \<and> self_contained ES"
   575                 \<and> valid_eqs ES"
   576 
   576 
   577 
   577 
   578 lemma invariantI:
   578 lemma invariantI:
   579   assumes "valid_eqns ES" "finite ES" "distinct_equas ES" "ardenable ES" 
   579   assumes "sound_eqs ES" "finite ES" "distinct_equas ES" "ardenable ES" 
   580           "finite_rhs ES" "self_contained ES"
   580           "finite_rhs ES" "valid_eqs ES"
   581   shows "invariant ES"
   581   shows "invariant ES"
   582 using assms by (simp add: invariant_def)
   582 using assms by (simp add: invariant_def)
   583 
   583 
   584 subsection {* The proof of this direction *}
   584 subsection {* The proof of this direction *}
   585 
   585 
   648 lemma lang_of_append_rhs:
   648 lemma lang_of_append_rhs:
   649   "L (append_rhs_rexp rhs r) = L rhs ;; L r"
   649   "L (append_rhs_rexp rhs r) = L rhs ;; L r"
   650 unfolding append_rhs_rexp_def
   650 unfolding append_rhs_rexp_def
   651 by (auto simp add: Seq_def lang_of_append)
   651 by (auto simp add: Seq_def lang_of_append)
   652 
   652 
   653 lemma classes_of_union_distrib:
   653 lemma rhss_union_distrib:
   654   shows "classes_of (A \<union> B) = classes_of A \<union> classes_of B"
   654   shows "rhss (A \<union> B) = rhss A \<union> rhss B"
   655 by (auto simp add: classes_of_def)
   655 by (auto simp add: rhss_def)
   656 
   656 
   657 lemma lhss_union_distrib:
   657 lemma lhss_union_distrib:
   658   shows "lhss (A \<union> B) = lhss A \<union> lhss B"
   658   shows "lhss (A \<union> B) = lhss A \<union> lhss B"
   659 by (auto simp add: lhss_def)
   659 by (auto simp add: lhss_def)
   660 
   660 
   758 
   758 
   759 lemma Init_ES_satisfies_invariant:
   759 lemma Init_ES_satisfies_invariant:
   760   assumes finite_CS: "finite (UNIV // \<approx>A)"
   760   assumes finite_CS: "finite (UNIV // \<approx>A)"
   761   shows "invariant (Init (UNIV // \<approx>A))"
   761   shows "invariant (Init (UNIV // \<approx>A))"
   762 proof (rule invariantI)
   762 proof (rule invariantI)
   763   show "valid_eqns (Init (UNIV // \<approx>A))"
   763   show "sound_eqs (Init (UNIV // \<approx>A))"
   764     unfolding valid_eqns_def 
   764     unfolding sound_eqs_def 
   765     using l_eq_r_in_eqs by auto
   765     using l_eq_r_in_eqs by auto
   766   show "finite (Init (UNIV // \<approx>A))" using finite_CS
   766   show "finite (Init (UNIV // \<approx>A))" using finite_CS
   767     unfolding Init_def by simp
   767     unfolding Init_def by simp
   768   show "distinct_equas (Init (UNIV // \<approx>A))"     
   768   show "distinct_equas (Init (UNIV // \<approx>A))"     
   769     unfolding distinct_equas_def Init_def by simp
   769     unfolding distinct_equas_def Init_def by simp
   771     unfolding ardenable_def Init_def Init_rhs_def rhs_nonempty_def
   771     unfolding ardenable_def Init_def Init_rhs_def rhs_nonempty_def
   772    by auto 
   772    by auto 
   773   show "finite_rhs (Init (UNIV // \<approx>A))"
   773   show "finite_rhs (Init (UNIV // \<approx>A))"
   774     using finite_Init_rhs[OF finite_CS]
   774     using finite_Init_rhs[OF finite_CS]
   775     unfolding finite_rhs_def Init_def by auto
   775     unfolding finite_rhs_def Init_def by auto
   776   show "self_contained (Init (UNIV // \<approx>A))"
   776   show "valid_eqs (Init (UNIV // \<approx>A))"
   777     unfolding self_contained_def Init_def Init_rhs_def classes_of_def lhss_def
   777     unfolding valid_eqs_def Init_def Init_rhs_def rhss_def lhss_def
   778     by auto
   778     by auto
   779 qed
   779 qed
   780 
   780 
   781 subsubsection {* Interation step *}
   781 subsubsection {* Interation step *}
   782 
   782 
   889 lemma Subst_all_keeps_finite_rhs:
   889 lemma Subst_all_keeps_finite_rhs:
   890   "\<lbrakk>finite_rhs ES; finite yrhs\<rbrakk> \<Longrightarrow> finite_rhs (Subst_all ES Y yrhs)"
   890   "\<lbrakk>finite_rhs ES; finite yrhs\<rbrakk> \<Longrightarrow> finite_rhs (Subst_all ES Y yrhs)"
   891 by (auto intro:Subst_keeps_finite_rhs simp add:Subst_all_def finite_rhs_def)
   891 by (auto intro:Subst_keeps_finite_rhs simp add:Subst_all_def finite_rhs_def)
   892 
   892 
   893 lemma append_rhs_keeps_cls:
   893 lemma append_rhs_keeps_cls:
   894   "classes_of (append_rhs_rexp rhs r) = classes_of rhs"
   894   "rhss (append_rhs_rexp rhs r) = rhss rhs"
   895 apply (auto simp:classes_of_def append_rhs_rexp_def)
   895 apply (auto simp:rhss_def append_rhs_rexp_def)
   896 apply (case_tac xa, auto simp:image_def)
   896 apply (case_tac xa, auto simp:image_def)
   897 by (rule_tac x = "SEQ ra r" in exI, rule_tac x = "Trn x ra" in bexI, simp+)
   897 by (rule_tac x = "SEQ ra r" in exI, rule_tac x = "Trn x ra" in bexI, simp+)
   898 
   898 
   899 lemma Arden_removes_cl:
   899 lemma Arden_removes_cl:
   900   "classes_of (Arden Y yrhs) = classes_of yrhs - {Y}"
   900   "rhss (Arden Y yrhs) = rhss yrhs - {Y}"
   901 apply (simp add:Arden_def append_rhs_keeps_cls)
   901 apply (simp add:Arden_def append_rhs_keeps_cls)
   902 by (auto simp:classes_of_def)
   902 by (auto simp:rhss_def)
   903 
   903 
   904 lemma lhss_keeps_cls:
   904 lemma lhss_keeps_cls:
   905   "lhss (Subst_all ES Y yrhs) = lhss ES"
   905   "lhss (Subst_all ES Y yrhs) = lhss ES"
   906 by (auto simp:lhss_def Subst_all_def)
   906 by (auto simp:lhss_def Subst_all_def)
   907 
   907 
   908 lemma Subst_updates_cls:
   908 lemma Subst_updates_cls:
   909   "X \<notin> classes_of xrhs \<Longrightarrow> 
   909   "X \<notin> rhss xrhs \<Longrightarrow> 
   910       classes_of (Subst rhs X xrhs) = classes_of rhs \<union> classes_of xrhs - {X}"
   910       rhss (Subst rhs X xrhs) = rhss rhs \<union> rhss xrhs - {X}"
   911 apply (simp only:Subst_def append_rhs_keeps_cls classes_of_union_distrib)
   911 apply (simp only:Subst_def append_rhs_keeps_cls rhss_union_distrib)
   912 by (auto simp:classes_of_def)
   912 by (auto simp:rhss_def)
   913 
   913 
   914 lemma Subst_all_keeps_self_contained:
   914 lemma Subst_all_keeps_valid_eqs:
   915   assumes sc: "self_contained (ES \<union> {(Y, yrhs)})" (is "self_contained ?A")
   915   assumes sc: "valid_eqs (ES \<union> {(Y, yrhs)})" (is "valid_eqs ?A")
   916   shows "self_contained (Subst_all ES Y (Arden Y yrhs))" 
   916   shows "valid_eqs (Subst_all ES Y (Arden Y yrhs))" 
   917                                                    (is "self_contained ?B")
   917                                                    (is "valid_eqs ?B")
   918 proof-
   918 proof-
   919   { fix X xrhs'
   919   { fix X xrhs'
   920     assume "(X, xrhs') \<in> ?B"
   920     assume "(X, xrhs') \<in> ?B"
   921     then obtain xrhs 
   921     then obtain xrhs 
   922       where xrhs_xrhs': "xrhs' = Subst xrhs Y (Arden Y yrhs)"
   922       where xrhs_xrhs': "xrhs' = Subst xrhs Y (Arden Y yrhs)"
   923       and X_in: "(X, xrhs) \<in> ES" by (simp add:Subst_all_def, blast)    
   923       and X_in: "(X, xrhs) \<in> ES" by (simp add:Subst_all_def, blast)    
   924     have "classes_of xrhs' \<subseteq> lhss ?B"
   924     have "rhss xrhs' \<subseteq> lhss ?B"
   925     proof-
   925     proof-
   926       have "lhss ?B = lhss ES" by (auto simp add:lhss_def Subst_all_def)
   926       have "lhss ?B = lhss ES" by (auto simp add:lhss_def Subst_all_def)
   927       moreover have "classes_of xrhs' \<subseteq> lhss ES"
   927       moreover have "rhss xrhs' \<subseteq> lhss ES"
   928       proof-
   928       proof-
   929         have "classes_of xrhs' \<subseteq> 
   929         have "rhss xrhs' \<subseteq> 
   930                         classes_of xrhs \<union> classes_of (Arden Y yrhs) - {Y}"
   930                         rhss xrhs \<union> rhss (Arden Y yrhs) - {Y}"
   931         proof-
   931         proof-
   932           have "Y \<notin> classes_of (Arden Y yrhs)" 
   932           have "Y \<notin> rhss (Arden Y yrhs)" 
   933             using Arden_removes_cl by simp
   933             using Arden_removes_cl by simp
   934           thus ?thesis using xrhs_xrhs' by (auto simp:Subst_updates_cls)
   934           thus ?thesis using xrhs_xrhs' by (auto simp:Subst_updates_cls)
   935         qed
   935         qed
   936         moreover have "classes_of xrhs \<subseteq> lhss ES \<union> {Y}" using X_in sc
   936         moreover have "rhss xrhs \<subseteq> lhss ES \<union> {Y}" using X_in sc
   937           apply (simp only:self_contained_def lhss_union_distrib)
   937           apply (simp only:valid_eqs_def lhss_union_distrib)
   938           by (drule_tac x = "(X, xrhs)" in bspec, auto simp:lhss_def)
   938           by (drule_tac x = "(X, xrhs)" in bspec, auto simp:lhss_def)
   939         moreover have "classes_of (Arden Y yrhs) \<subseteq> lhss ES \<union> {Y}" 
   939         moreover have "rhss (Arden Y yrhs) \<subseteq> lhss ES \<union> {Y}" 
   940           using sc 
   940           using sc 
   941           by (auto simp add:Arden_removes_cl self_contained_def lhss_def)
   941           by (auto simp add:Arden_removes_cl valid_eqs_def lhss_def)
   942         ultimately show ?thesis by auto
   942         ultimately show ?thesis by auto
   943       qed
   943       qed
   944       ultimately show ?thesis by simp
   944       ultimately show ?thesis by simp
   945     qed
   945     qed
   946   } thus ?thesis by (auto simp only:Subst_all_def self_contained_def)
   946   } thus ?thesis by (auto simp only:Subst_all_def valid_eqs_def)
   947 qed
   947 qed
   948 
   948 
   949 lemma Subst_all_satisfies_invariant:
   949 lemma Subst_all_satisfies_invariant:
   950   assumes invariant_ES: "invariant (ES \<union> {(Y, yrhs)})"
   950   assumes invariant_ES: "invariant (ES \<union> {(Y, yrhs)})"
   951   shows "invariant (Subst_all ES Y (Arden Y yrhs))"
   951   shows "invariant (Subst_all ES Y (Arden Y yrhs))"
   952 proof (rule invariantI)
   952 proof (rule invariantI)
   953   have Y_eq_yrhs: "Y = L yrhs" 
   953   have Y_eq_yrhs: "Y = L yrhs" 
   954     using invariant_ES by (simp only:invariant_def valid_eqns_def, blast)
   954     using invariant_ES by (simp only:invariant_def sound_eqs_def, blast)
   955    have finite_yrhs: "finite yrhs" 
   955    have finite_yrhs: "finite yrhs" 
   956     using invariant_ES by (auto simp:invariant_def finite_rhs_def)
   956     using invariant_ES by (auto simp:invariant_def finite_rhs_def)
   957   have nonempty_yrhs: "rhs_nonempty yrhs" 
   957   have nonempty_yrhs: "rhs_nonempty yrhs" 
   958     using invariant_ES by (auto simp:invariant_def ardenable_def)
   958     using invariant_ES by (auto simp:invariant_def ardenable_def)
   959   show "valid_eqns (Subst_all ES Y (Arden Y yrhs))"
   959   show "sound_eqs (Subst_all ES Y (Arden Y yrhs))"
   960   proof-
   960   proof-
   961     have "Y = L (Arden Y yrhs)" 
   961     have "Y = L (Arden Y yrhs)" 
   962       using Y_eq_yrhs invariant_ES finite_yrhs
   962       using Y_eq_yrhs invariant_ES finite_yrhs
   963       using finite_Trn[OF finite_yrhs]
   963       using finite_Trn[OF finite_yrhs]
   964       apply(rule_tac Arden_keeps_eq)
   964       apply(rule_tac Arden_keeps_eq)
   965       apply(simp_all)
   965       apply(simp_all)
   966       unfolding invariant_def ardenable_def rhs_nonempty_def
   966       unfolding invariant_def ardenable_def rhs_nonempty_def
   967       apply(auto)
   967       apply(auto)
   968       done
   968       done
   969     thus ?thesis using invariant_ES
   969     thus ?thesis using invariant_ES
   970       unfolding  invariant_def finite_rhs_def2 valid_eqns_def Subst_all_def
   970       unfolding  invariant_def finite_rhs_def2 sound_eqs_def Subst_all_def
   971       by (auto simp add: Subst_keeps_eq simp del: L_rhs.simps)
   971       by (auto simp add: Subst_keeps_eq simp del: L_rhs.simps)
   972   qed
   972   qed
   973   show "finite (Subst_all ES Y (Arden Y yrhs))" 
   973   show "finite (Subst_all ES Y (Arden Y yrhs))" 
   974     using invariant_ES by (simp add:invariant_def Subst_all_keeps_finite)
   974     using invariant_ES by (simp add:invariant_def Subst_all_keeps_finite)
   975   show "distinct_equas (Subst_all ES Y (Arden Y yrhs))" 
   975   show "distinct_equas (Subst_all ES Y (Arden Y yrhs))" 
   998       thus ?thesis using Arden_keeps_finite by simp
   998       thus ?thesis using Arden_keeps_finite by simp
   999     qed
   999     qed
  1000     ultimately show ?thesis 
  1000     ultimately show ?thesis 
  1001       by (simp add:Subst_all_keeps_finite_rhs)
  1001       by (simp add:Subst_all_keeps_finite_rhs)
  1002   qed
  1002   qed
  1003   show "self_contained (Subst_all ES Y (Arden Y yrhs))"
  1003   show "valid_eqs (Subst_all ES Y (Arden Y yrhs))"
  1004     using invariant_ES Subst_all_keeps_self_contained by (simp add:invariant_def)
  1004     using invariant_ES Subst_all_keeps_valid_eqs by (simp add:invariant_def)
  1005 qed
  1005 qed
  1006 
  1006 
  1007 lemma Remove_in_card_measure:
  1007 lemma Remove_in_card_measure:
  1008   assumes finite: "finite ES"
  1008   assumes finite: "finite ES"
  1009   and     in_ES: "(X, rhs) \<in> ES"
  1009   and     in_ES: "(X, rhs) \<in> ES"
  1111 subsubsection {* Conclusion of the proof *}
  1111 subsubsection {* Conclusion of the proof *}
  1112 
  1112 
  1113 lemma Solve:
  1113 lemma Solve:
  1114   assumes fin: "finite (UNIV // \<approx>A)"
  1114   assumes fin: "finite (UNIV // \<approx>A)"
  1115   and     X_in: "X \<in> (UNIV // \<approx>A)"
  1115   and     X_in: "X \<in> (UNIV // \<approx>A)"
  1116   shows "\<exists>xrhs. Solve X (Init (UNIV // \<approx>A)) = {(X, xrhs)} \<and> invariant {(X, xrhs)}"
  1116   shows "\<exists>rhs. Solve X (Init (UNIV // \<approx>A)) = {(X, rhs)} \<and> invariant {(X, rhs)}"
  1117 proof -
  1117 proof -
  1118   def Inv \<equiv> "\<lambda>ES. invariant ES \<and> (\<exists>xrhs. (X, xrhs) \<in> ES)"
  1118   def Inv \<equiv> "\<lambda>ES. invariant ES \<and> (\<exists>rhs. (X, rhs) \<in> ES)"
  1119   have "Inv (Init (UNIV // \<approx>A))" unfolding Inv_def
  1119   have "Inv (Init (UNIV // \<approx>A))" unfolding Inv_def
  1120       using fin X_in by (simp add: Init_ES_satisfies_invariant, simp add: Init_def)
  1120       using fin X_in by (simp add: Init_ES_satisfies_invariant, simp add: Init_def)
  1121   moreover
  1121   moreover
  1122   { fix ES
  1122   { fix ES
  1123     assume inv: "Inv ES" and crd: "Cond ES"
  1123     assume inv: "Inv ES" and crd: "Cond ES"
  1125       unfolding Inv_def
  1125       unfolding Inv_def
  1126       by (auto simp add: iteration_step_invariant iteration_step_ex) }
  1126       by (auto simp add: iteration_step_invariant iteration_step_ex) }
  1127   moreover
  1127   moreover
  1128   { fix ES
  1128   { fix ES
  1129     assume "Inv ES" and "\<not> Cond ES"
  1129     assume "Inv ES" and "\<not> Cond ES"
  1130     then have "\<exists>xrhs'. ES = {(X, xrhs')} \<and> invariant ES"
  1130     then have "\<exists>rhs'. ES = {(X, rhs')} \<and> invariant ES"
  1131       unfolding Inv_def invariant_def
  1131       unfolding Inv_def invariant_def
  1132       apply (auto, rule_tac x = xrhs in exI)
  1132       apply (auto, rule_tac x = rhs in exI)
  1133       apply (auto dest!: card_Suc_Diff1 simp: card_eq_0_iff) 
  1133       apply (auto dest!: card_Suc_Diff1 simp: card_eq_0_iff) 
  1134       done
  1134       done
  1135     then have "\<exists>xrhs'. ES = {(X, xrhs')} \<and> invariant {(X, xrhs')}"
  1135     then have "\<exists>rhs'. ES = {(X, rhs')} \<and> invariant {(X, rhs')}"
  1136       by auto }
  1136       by auto }
  1137   moreover
  1137   moreover
  1138     have "wf (measure card)" by simp
  1138     have "wf (measure card)" by simp
  1139   moreover
  1139   moreover
  1140   { fix ES
  1140   { fix ES
  1144       apply(clarify)
  1144       apply(clarify)
  1145       apply(rule_tac iteration_step_measure)
  1145       apply(rule_tac iteration_step_measure)
  1146       apply(auto)
  1146       apply(auto)
  1147       done }
  1147       done }
  1148   ultimately 
  1148   ultimately 
  1149   show "\<exists>xrhs. Solve X (Init (UNIV // \<approx>A)) = {(X, xrhs)} \<and> invariant {(X, xrhs)}" 
  1149   show "\<exists>rhs. Solve X (Init (UNIV // \<approx>A)) = {(X, rhs)} \<and> invariant {(X, rhs)}" 
  1150     unfolding Solve_def by (rule while_rule)
  1150     unfolding Solve_def by (rule while_rule)
  1151 qed
  1151 qed
  1152 
  1152 
  1153 lemma last_cl_exists_rexp:
  1153 lemma last_cl_exists_rexp:
  1154   assumes Inv_ES: "invariant {(X, xrhs)}"
  1154   assumes Inv_ES: "invariant {(X, xrhs)}"
  1155   shows "\<exists>r::rexp. L r = X" 
  1155   shows "\<exists>r::rexp. L r = X" 
  1156 proof-
  1156 proof-
  1157   def A \<equiv> "Arden X xrhs"
  1157   def A \<equiv> "Arden X xrhs"
  1158   have eq: "{Lam r | r. Lam r \<in> A} = A"
  1158   have eq: "{Lam r | r. Lam r \<in> A} = A"
  1159   proof -
  1159   proof -
  1160     have "classes_of A = {}" using Inv_ES 
  1160     have "rhss A = {}" using Inv_ES 
  1161       unfolding A_def self_contained_def invariant_def lhss_def
  1161       unfolding A_def valid_eqs_def invariant_def lhss_def
  1162       by (simp add: Arden_removes_cl) 
  1162       by (simp add: Arden_removes_cl) 
  1163     thus ?thesis unfolding A_def classes_of_def
  1163     thus ?thesis unfolding A_def rhss_def
  1164       apply(auto simp only:)
  1164       apply(auto simp only:)
  1165       apply(case_tac x)
  1165       apply(case_tac x)
  1166       apply(auto)
  1166       apply(auto)
  1167       done
  1167       done
  1168   qed
  1168   qed
  1172   then have "L (\<Uplus>{r. Lam r \<in> A}) = L ({Lam r | r. Lam r \<in>  A})"
  1172   then have "L (\<Uplus>{r. Lam r \<in> A}) = L ({Lam r | r. Lam r \<in>  A})"
  1173     by auto
  1173     by auto
  1174   also have "\<dots> = L A" by (simp add: eq)
  1174   also have "\<dots> = L A" by (simp add: eq)
  1175   also have "\<dots> = X" 
  1175   also have "\<dots> = X" 
  1176   proof -
  1176   proof -
  1177     have "X = L xrhs" using Inv_ES unfolding invariant_def valid_eqns_def
  1177     have "X = L xrhs" using Inv_ES unfolding invariant_def sound_eqs_def
  1178       by auto
  1178       by auto
  1179     moreover
  1179     moreover
  1180     from Inv_ES have "[] \<notin> L (\<Uplus>{r. Trn X r \<in> xrhs})"
  1180     from Inv_ES have "[] \<notin> L (\<Uplus>{r. Trn X r \<in> xrhs})"
  1181       unfolding invariant_def ardenable_def finite_rhs_def
  1181       unfolding invariant_def ardenable_def finite_rhs_def
  1182       by(simp add: rexp_of_empty)
  1182       by(simp add: rexp_of_empty)