thys/Exercises.thy
author Christian Urban <urbanc@in.tum.de>
Fri, 12 Jan 2018 02:33:35 +0000
changeset 282 bfab5aded21d
parent 268 6746f5e1f1f8
child 283 c4d821c6309d
permissions -rw-r--r--
updated
Ignore whitespace changes - Everywhere: Within whitespace: At end of lines:
259
78dd6bca5627 updated
Christian Urban <urbanc@in.tum.de>
parents: 258
diff changeset
     1
theory Exercises
266
fff2e1b40dfc updated
Christian Urban <urbanc@in.tum.de>
parents: 260
diff changeset
     2
  imports Spec "~~/src/HOL/Library/Infinite_Set"
258
Christian Urban <urbanc@in.tum.de>
parents:
diff changeset
     3
begin
Christian Urban <urbanc@in.tum.de>
parents:
diff changeset
     4
260
160d0b08471c updated
Christian Urban <urbanc@in.tum.de>
parents: 259
diff changeset
     5
section {* Some Fun Facts *}
258
Christian Urban <urbanc@in.tum.de>
parents:
diff changeset
     6
Christian Urban <urbanc@in.tum.de>
parents:
diff changeset
     7
fun
259
78dd6bca5627 updated
Christian Urban <urbanc@in.tum.de>
parents: 258
diff changeset
     8
 zeroable :: "rexp \<Rightarrow> bool"
258
Christian Urban <urbanc@in.tum.de>
parents:
diff changeset
     9
where
259
78dd6bca5627 updated
Christian Urban <urbanc@in.tum.de>
parents: 258
diff changeset
    10
  "zeroable (ZERO) \<longleftrightarrow> True"
78dd6bca5627 updated
Christian Urban <urbanc@in.tum.de>
parents: 258
diff changeset
    11
| "zeroable (ONE) \<longleftrightarrow> False"
78dd6bca5627 updated
Christian Urban <urbanc@in.tum.de>
parents: 258
diff changeset
    12
| "zeroable (CHAR c) \<longleftrightarrow> False"
78dd6bca5627 updated
Christian Urban <urbanc@in.tum.de>
parents: 258
diff changeset
    13
| "zeroable (ALT r1 r2) \<longleftrightarrow> zeroable r1 \<and> zeroable r2"
78dd6bca5627 updated
Christian Urban <urbanc@in.tum.de>
parents: 258
diff changeset
    14
| "zeroable (SEQ r1 r2) \<longleftrightarrow> zeroable r1 \<or> zeroable r2"
78dd6bca5627 updated
Christian Urban <urbanc@in.tum.de>
parents: 258
diff changeset
    15
| "zeroable (STAR r) \<longleftrightarrow> False"
258
Christian Urban <urbanc@in.tum.de>
parents:
diff changeset
    16
Christian Urban <urbanc@in.tum.de>
parents:
diff changeset
    17
lemma zeroable_correctness:
259
78dd6bca5627 updated
Christian Urban <urbanc@in.tum.de>
parents: 258
diff changeset
    18
  shows "zeroable r \<longleftrightarrow> L r = {}"
260
160d0b08471c updated
Christian Urban <urbanc@in.tum.de>
parents: 259
diff changeset
    19
by(induct r)(auto simp add: Sequ_def)
160d0b08471c updated
Christian Urban <urbanc@in.tum.de>
parents: 259
diff changeset
    20
258
Christian Urban <urbanc@in.tum.de>
parents:
diff changeset
    21
Christian Urban <urbanc@in.tum.de>
parents:
diff changeset
    22
fun
259
78dd6bca5627 updated
Christian Urban <urbanc@in.tum.de>
parents: 258
diff changeset
    23
 atmostempty :: "rexp \<Rightarrow> bool"
258
Christian Urban <urbanc@in.tum.de>
parents:
diff changeset
    24
where
259
78dd6bca5627 updated
Christian Urban <urbanc@in.tum.de>
parents: 258
diff changeset
    25
  "atmostempty (ZERO) \<longleftrightarrow> True"
78dd6bca5627 updated
Christian Urban <urbanc@in.tum.de>
parents: 258
diff changeset
    26
| "atmostempty (ONE) \<longleftrightarrow> True"
78dd6bca5627 updated
Christian Urban <urbanc@in.tum.de>
parents: 258
diff changeset
    27
| "atmostempty (CHAR c) \<longleftrightarrow> False"
78dd6bca5627 updated
Christian Urban <urbanc@in.tum.de>
parents: 258
diff changeset
    28
| "atmostempty (ALT r1 r2) \<longleftrightarrow> atmostempty r1 \<and> atmostempty r2"
78dd6bca5627 updated
Christian Urban <urbanc@in.tum.de>
parents: 258
diff changeset
    29
| "atmostempty (SEQ r1 r2) \<longleftrightarrow> 
78dd6bca5627 updated
Christian Urban <urbanc@in.tum.de>
parents: 258
diff changeset
    30
     zeroable r1 \<or> zeroable r2 \<or> (atmostempty r1 \<and> atmostempty r2)"
258
Christian Urban <urbanc@in.tum.de>
parents:
diff changeset
    31
| "atmostempty (STAR r) = atmostempty r"
Christian Urban <urbanc@in.tum.de>
parents:
diff changeset
    32
Christian Urban <urbanc@in.tum.de>
parents:
diff changeset
    33
fun
259
78dd6bca5627 updated
Christian Urban <urbanc@in.tum.de>
parents: 258
diff changeset
    34
 somechars :: "rexp \<Rightarrow> bool"
258
Christian Urban <urbanc@in.tum.de>
parents:
diff changeset
    35
where
259
78dd6bca5627 updated
Christian Urban <urbanc@in.tum.de>
parents: 258
diff changeset
    36
  "somechars (ZERO) \<longleftrightarrow> False"
78dd6bca5627 updated
Christian Urban <urbanc@in.tum.de>
parents: 258
diff changeset
    37
| "somechars (ONE) \<longleftrightarrow> False"
78dd6bca5627 updated
Christian Urban <urbanc@in.tum.de>
parents: 258
diff changeset
    38
| "somechars (CHAR c) \<longleftrightarrow> True"
78dd6bca5627 updated
Christian Urban <urbanc@in.tum.de>
parents: 258
diff changeset
    39
| "somechars (ALT r1 r2) \<longleftrightarrow> somechars r1 \<or> somechars r2"
78dd6bca5627 updated
Christian Urban <urbanc@in.tum.de>
parents: 258
diff changeset
    40
| "somechars (SEQ r1 r2) \<longleftrightarrow> 
78dd6bca5627 updated
Christian Urban <urbanc@in.tum.de>
parents: 258
diff changeset
    41
      (\<not> zeroable r1 \<and> somechars r2) \<or> (\<not> zeroable r2 \<and> somechars r1) \<or> 
78dd6bca5627 updated
Christian Urban <urbanc@in.tum.de>
parents: 258
diff changeset
    42
      (somechars r1 \<and> nullable r2) \<or> (somechars r2 \<and> nullable r1)"
78dd6bca5627 updated
Christian Urban <urbanc@in.tum.de>
parents: 258
diff changeset
    43
| "somechars (STAR r) \<longleftrightarrow> somechars r"
258
Christian Urban <urbanc@in.tum.de>
parents:
diff changeset
    44
Christian Urban <urbanc@in.tum.de>
parents:
diff changeset
    45
lemma somechars_correctness:
259
78dd6bca5627 updated
Christian Urban <urbanc@in.tum.de>
parents: 258
diff changeset
    46
  shows "somechars r \<longleftrightarrow> (\<exists>s. s \<noteq> [] \<and> s \<in> L r)"
260
160d0b08471c updated
Christian Urban <urbanc@in.tum.de>
parents: 259
diff changeset
    47
apply(induct r)
160d0b08471c updated
Christian Urban <urbanc@in.tum.de>
parents: 259
diff changeset
    48
apply(simp_all add: zeroable_correctness nullable_correctness Sequ_def)
160d0b08471c updated
Christian Urban <urbanc@in.tum.de>
parents: 259
diff changeset
    49
using Nil_is_append_conv apply blast
160d0b08471c updated
Christian Urban <urbanc@in.tum.de>
parents: 259
diff changeset
    50
apply blast
160d0b08471c updated
Christian Urban <urbanc@in.tum.de>
parents: 259
diff changeset
    51
apply(auto)
268
6746f5e1f1f8 updated
Christian Urban <urbanc@in.tum.de>
parents: 266
diff changeset
    52
using Star_cstring
6746f5e1f1f8 updated
Christian Urban <urbanc@in.tum.de>
parents: 266
diff changeset
    53
by (metis concat_eq_Nil_conv) 
260
160d0b08471c updated
Christian Urban <urbanc@in.tum.de>
parents: 259
diff changeset
    54
258
Christian Urban <urbanc@in.tum.de>
parents:
diff changeset
    55
Christian Urban <urbanc@in.tum.de>
parents:
diff changeset
    56
lemma atmostempty_correctness_aux:
259
78dd6bca5627 updated
Christian Urban <urbanc@in.tum.de>
parents: 258
diff changeset
    57
  shows "atmostempty r \<longleftrightarrow> \<not> somechars r"
258
Christian Urban <urbanc@in.tum.de>
parents:
diff changeset
    58
apply(induct r)
Christian Urban <urbanc@in.tum.de>
parents:
diff changeset
    59
apply(simp_all)
Christian Urban <urbanc@in.tum.de>
parents:
diff changeset
    60
apply(auto simp add: zeroable_correctness nullable_correctness somechars_correctness)
Christian Urban <urbanc@in.tum.de>
parents:
diff changeset
    61
done
Christian Urban <urbanc@in.tum.de>
parents:
diff changeset
    62
Christian Urban <urbanc@in.tum.de>
parents:
diff changeset
    63
lemma atmostempty_correctness:
259
78dd6bca5627 updated
Christian Urban <urbanc@in.tum.de>
parents: 258
diff changeset
    64
  shows "atmostempty r \<longleftrightarrow> L r \<subseteq> {[]}"
258
Christian Urban <urbanc@in.tum.de>
parents:
diff changeset
    65
by(auto simp add: atmostempty_correctness_aux somechars_correctness)
Christian Urban <urbanc@in.tum.de>
parents:
diff changeset
    66
Christian Urban <urbanc@in.tum.de>
parents:
diff changeset
    67
fun
259
78dd6bca5627 updated
Christian Urban <urbanc@in.tum.de>
parents: 258
diff changeset
    68
 infinitestrings :: "rexp \<Rightarrow> bool"
258
Christian Urban <urbanc@in.tum.de>
parents:
diff changeset
    69
where
Christian Urban <urbanc@in.tum.de>
parents:
diff changeset
    70
  "infinitestrings (ZERO) = False"
Christian Urban <urbanc@in.tum.de>
parents:
diff changeset
    71
| "infinitestrings (ONE) = False"
Christian Urban <urbanc@in.tum.de>
parents:
diff changeset
    72
| "infinitestrings (CHAR c) = False"
259
78dd6bca5627 updated
Christian Urban <urbanc@in.tum.de>
parents: 258
diff changeset
    73
| "infinitestrings (ALT r1 r2) = (infinitestrings r1 \<or> infinitestrings r2)"
78dd6bca5627 updated
Christian Urban <urbanc@in.tum.de>
parents: 258
diff changeset
    74
| "infinitestrings (SEQ r1 r2) \<longleftrightarrow> 
78dd6bca5627 updated
Christian Urban <urbanc@in.tum.de>
parents: 258
diff changeset
    75
      (\<not> zeroable r1 \<and> infinitestrings r2) \<or> (\<not> zeroable r2 \<and> infinitestrings r1)"
78dd6bca5627 updated
Christian Urban <urbanc@in.tum.de>
parents: 258
diff changeset
    76
| "infinitestrings (STAR r) = (\<not> atmostempty r)"
258
Christian Urban <urbanc@in.tum.de>
parents:
diff changeset
    77
282
bfab5aded21d updated
Christian Urban <urbanc@in.tum.de>
parents: 268
diff changeset
    78
bfab5aded21d updated
Christian Urban <urbanc@in.tum.de>
parents: 268
diff changeset
    79
bfab5aded21d updated
Christian Urban <urbanc@in.tum.de>
parents: 268
diff changeset
    80
bfab5aded21d updated
Christian Urban <urbanc@in.tum.de>
parents: 268
diff changeset
    81
258
Christian Urban <urbanc@in.tum.de>
parents:
diff changeset
    82
lemma Star_atmostempty:
259
78dd6bca5627 updated
Christian Urban <urbanc@in.tum.de>
parents: 258
diff changeset
    83
  assumes "A \<subseteq> {[]}"
78dd6bca5627 updated
Christian Urban <urbanc@in.tum.de>
parents: 258
diff changeset
    84
  shows "A\<star> \<subseteq> {[]}"
258
Christian Urban <urbanc@in.tum.de>
parents:
diff changeset
    85
using assms
268
6746f5e1f1f8 updated
Christian Urban <urbanc@in.tum.de>
parents: 266
diff changeset
    86
using Star_cstring concat_eq_Nil_conv empty_iff insert_iff subsetI subset_singletonD by fastforce
258
Christian Urban <urbanc@in.tum.de>
parents:
diff changeset
    87
Christian Urban <urbanc@in.tum.de>
parents:
diff changeset
    88
lemma Star_empty_string_finite:
259
78dd6bca5627 updated
Christian Urban <urbanc@in.tum.de>
parents: 258
diff changeset
    89
  shows "finite ({[]}\<star>)"
258
Christian Urban <urbanc@in.tum.de>
parents:
diff changeset
    90
using Star_atmostempty infinite_super by auto
Christian Urban <urbanc@in.tum.de>
parents:
diff changeset
    91
Christian Urban <urbanc@in.tum.de>
parents:
diff changeset
    92
lemma Star_empty_finite:
259
78dd6bca5627 updated
Christian Urban <urbanc@in.tum.de>
parents: 258
diff changeset
    93
  shows "finite ({}\<star>)"
258
Christian Urban <urbanc@in.tum.de>
parents:
diff changeset
    94
using Star_atmostempty infinite_super by auto
Christian Urban <urbanc@in.tum.de>
parents:
diff changeset
    95
Christian Urban <urbanc@in.tum.de>
parents:
diff changeset
    96
lemma Star_concat_replicate:
259
78dd6bca5627 updated
Christian Urban <urbanc@in.tum.de>
parents: 258
diff changeset
    97
  assumes "s \<in> A"
78dd6bca5627 updated
Christian Urban <urbanc@in.tum.de>
parents: 258
diff changeset
    98
  shows "concat (replicate n s) \<in> A\<star>"
258
Christian Urban <urbanc@in.tum.de>
parents:
diff changeset
    99
using assms
Christian Urban <urbanc@in.tum.de>
parents:
diff changeset
   100
by (induct n) (auto)
Christian Urban <urbanc@in.tum.de>
parents:
diff changeset
   101
Christian Urban <urbanc@in.tum.de>
parents:
diff changeset
   102
Christian Urban <urbanc@in.tum.de>
parents:
diff changeset
   103
lemma concat_replicate_inj:
259
78dd6bca5627 updated
Christian Urban <urbanc@in.tum.de>
parents: 258
diff changeset
   104
  assumes "concat (replicate n s) = concat (replicate m s)" "s \<noteq> []"
258
Christian Urban <urbanc@in.tum.de>
parents:
diff changeset
   105
  shows "n = m"
Christian Urban <urbanc@in.tum.de>
parents:
diff changeset
   106
using assms
Christian Urban <urbanc@in.tum.de>
parents:
diff changeset
   107
apply(induct n arbitrary: m)
Christian Urban <urbanc@in.tum.de>
parents:
diff changeset
   108
apply(auto)[1]
Christian Urban <urbanc@in.tum.de>
parents:
diff changeset
   109
apply(auto)
Christian Urban <urbanc@in.tum.de>
parents:
diff changeset
   110
apply(case_tac m)
Christian Urban <urbanc@in.tum.de>
parents:
diff changeset
   111
apply(clarify)
Christian Urban <urbanc@in.tum.de>
parents:
diff changeset
   112
apply(simp only: replicate.simps concat.simps)
Christian Urban <urbanc@in.tum.de>
parents:
diff changeset
   113
apply blast
Christian Urban <urbanc@in.tum.de>
parents:
diff changeset
   114
by simp
Christian Urban <urbanc@in.tum.de>
parents:
diff changeset
   115
Christian Urban <urbanc@in.tum.de>
parents:
diff changeset
   116
lemma A0:
259
78dd6bca5627 updated
Christian Urban <urbanc@in.tum.de>
parents: 258
diff changeset
   117
  assumes "finite (A ;; B)" "B \<noteq> {}"
258
Christian Urban <urbanc@in.tum.de>
parents:
diff changeset
   118
  shows "finite A"
259
78dd6bca5627 updated
Christian Urban <urbanc@in.tum.de>
parents: 258
diff changeset
   119
apply(subgoal_tac "\<exists>s. s \<in> B")
258
Christian Urban <urbanc@in.tum.de>
parents:
diff changeset
   120
apply(erule exE)
259
78dd6bca5627 updated
Christian Urban <urbanc@in.tum.de>
parents: 258
diff changeset
   121
apply(subgoal_tac "finite {s1 @ s |s1. s1 \<in> A}")
78dd6bca5627 updated
Christian Urban <urbanc@in.tum.de>
parents: 258
diff changeset
   122
apply(rule_tac f="\<lambda>s1. s1 @ s" in finite_imageD)
258
Christian Urban <urbanc@in.tum.de>
parents:
diff changeset
   123
apply(simp add: image_def)
Christian Urban <urbanc@in.tum.de>
parents:
diff changeset
   124
apply(smt Collect_cong)
Christian Urban <urbanc@in.tum.de>
parents:
diff changeset
   125
apply(simp add: inj_on_def)
Christian Urban <urbanc@in.tum.de>
parents:
diff changeset
   126
apply(rule_tac B="A ;; B" in finite_subset)
Christian Urban <urbanc@in.tum.de>
parents:
diff changeset
   127
apply(auto simp add: Sequ_def)[1]
Christian Urban <urbanc@in.tum.de>
parents:
diff changeset
   128
apply(rule assms(1))
Christian Urban <urbanc@in.tum.de>
parents:
diff changeset
   129
using assms(2) by auto
Christian Urban <urbanc@in.tum.de>
parents:
diff changeset
   130
Christian Urban <urbanc@in.tum.de>
parents:
diff changeset
   131
lemma A1:
259
78dd6bca5627 updated
Christian Urban <urbanc@in.tum.de>
parents: 258
diff changeset
   132
  assumes "finite (A ;; B)" "A \<noteq> {}"
258
Christian Urban <urbanc@in.tum.de>
parents:
diff changeset
   133
  shows "finite B"
259
78dd6bca5627 updated
Christian Urban <urbanc@in.tum.de>
parents: 258
diff changeset
   134
apply(subgoal_tac "\<exists>s. s \<in> A")
258
Christian Urban <urbanc@in.tum.de>
parents:
diff changeset
   135
apply(erule exE)
259
78dd6bca5627 updated
Christian Urban <urbanc@in.tum.de>
parents: 258
diff changeset
   136
apply(subgoal_tac "finite {s @ s1 |s1. s1 \<in> B}")
78dd6bca5627 updated
Christian Urban <urbanc@in.tum.de>
parents: 258
diff changeset
   137
apply(rule_tac f="\<lambda>s1. s @ s1" in finite_imageD)
258
Christian Urban <urbanc@in.tum.de>
parents:
diff changeset
   138
apply(simp add: image_def)
Christian Urban <urbanc@in.tum.de>
parents:
diff changeset
   139
apply(smt Collect_cong)
Christian Urban <urbanc@in.tum.de>
parents:
diff changeset
   140
apply(simp add: inj_on_def)
Christian Urban <urbanc@in.tum.de>
parents:
diff changeset
   141
apply(rule_tac B="A ;; B" in finite_subset)
Christian Urban <urbanc@in.tum.de>
parents:
diff changeset
   142
apply(auto simp add: Sequ_def)[1]
Christian Urban <urbanc@in.tum.de>
parents:
diff changeset
   143
apply(rule assms(1))
Christian Urban <urbanc@in.tum.de>
parents:
diff changeset
   144
using assms(2) by auto
Christian Urban <urbanc@in.tum.de>
parents:
diff changeset
   145
Christian Urban <urbanc@in.tum.de>
parents:
diff changeset
   146
lemma Sequ_Prod_finite:
259
78dd6bca5627 updated
Christian Urban <urbanc@in.tum.de>
parents: 258
diff changeset
   147
  assumes "A \<noteq> {}" "B \<noteq> {}"
78dd6bca5627 updated
Christian Urban <urbanc@in.tum.de>
parents: 258
diff changeset
   148
  shows "finite (A ;; B) \<longleftrightarrow> (finite (A \<times> B))"
258
Christian Urban <urbanc@in.tum.de>
parents:
diff changeset
   149
apply(rule iffI)
Christian Urban <urbanc@in.tum.de>
parents:
diff changeset
   150
apply(rule finite_cartesian_product)
Christian Urban <urbanc@in.tum.de>
parents:
diff changeset
   151
apply(erule A0)
Christian Urban <urbanc@in.tum.de>
parents:
diff changeset
   152
apply(rule assms(2))
Christian Urban <urbanc@in.tum.de>
parents:
diff changeset
   153
apply(erule A1)
Christian Urban <urbanc@in.tum.de>
parents:
diff changeset
   154
apply(rule assms(1))
Christian Urban <urbanc@in.tum.de>
parents:
diff changeset
   155
apply(simp add: Sequ_def)
Christian Urban <urbanc@in.tum.de>
parents:
diff changeset
   156
apply(rule finite_image_set2)
Christian Urban <urbanc@in.tum.de>
parents:
diff changeset
   157
apply(drule finite_cartesian_productD1)
Christian Urban <urbanc@in.tum.de>
parents:
diff changeset
   158
apply(rule assms(2))
Christian Urban <urbanc@in.tum.de>
parents:
diff changeset
   159
apply(simp)
Christian Urban <urbanc@in.tum.de>
parents:
diff changeset
   160
apply(drule finite_cartesian_productD2)
Christian Urban <urbanc@in.tum.de>
parents:
diff changeset
   161
apply(rule assms(1))
Christian Urban <urbanc@in.tum.de>
parents:
diff changeset
   162
apply(simp)
Christian Urban <urbanc@in.tum.de>
parents:
diff changeset
   163
done
Christian Urban <urbanc@in.tum.de>
parents:
diff changeset
   164
Christian Urban <urbanc@in.tum.de>
parents:
diff changeset
   165
Christian Urban <urbanc@in.tum.de>
parents:
diff changeset
   166
lemma Star_non_empty_string_infinite:
259
78dd6bca5627 updated
Christian Urban <urbanc@in.tum.de>
parents: 258
diff changeset
   167
  assumes "s \<in> A" " s \<noteq> []"
78dd6bca5627 updated
Christian Urban <urbanc@in.tum.de>
parents: 258
diff changeset
   168
  shows "infinite (A\<star>)"
258
Christian Urban <urbanc@in.tum.de>
parents:
diff changeset
   169
proof -
259
78dd6bca5627 updated
Christian Urban <urbanc@in.tum.de>
parents: 258
diff changeset
   170
  have "inj (\<lambda>n. concat (replicate n s))" 
258
Christian Urban <urbanc@in.tum.de>
parents:
diff changeset
   171
  using assms(2) concat_replicate_inj
Christian Urban <urbanc@in.tum.de>
parents:
diff changeset
   172
    by(auto simp add: inj_on_def)
Christian Urban <urbanc@in.tum.de>
parents:
diff changeset
   173
  moreover
Christian Urban <urbanc@in.tum.de>
parents:
diff changeset
   174
  have "infinite (UNIV::nat set)" by simp
Christian Urban <urbanc@in.tum.de>
parents:
diff changeset
   175
  ultimately
259
78dd6bca5627 updated
Christian Urban <urbanc@in.tum.de>
parents: 258
diff changeset
   176
  have "infinite ((\<lambda>n. concat (replicate n s)) ` UNIV)"
258
Christian Urban <urbanc@in.tum.de>
parents:
diff changeset
   177
   by (simp add: range_inj_infinite)
Christian Urban <urbanc@in.tum.de>
parents:
diff changeset
   178
  moreover
259
78dd6bca5627 updated
Christian Urban <urbanc@in.tum.de>
parents: 258
diff changeset
   179
  have "((\<lambda>n. concat (replicate n s)) ` UNIV) \<subseteq> (A\<star>)"
258
Christian Urban <urbanc@in.tum.de>
parents:
diff changeset
   180
    using Star_concat_replicate assms(1) by auto
259
78dd6bca5627 updated
Christian Urban <urbanc@in.tum.de>
parents: 258
diff changeset
   181
  ultimately show "infinite (A\<star>)" 
258
Christian Urban <urbanc@in.tum.de>
parents:
diff changeset
   182
  using infinite_super by auto
Christian Urban <urbanc@in.tum.de>
parents:
diff changeset
   183
qed
Christian Urban <urbanc@in.tum.de>
parents:
diff changeset
   184
Christian Urban <urbanc@in.tum.de>
parents:
diff changeset
   185
lemma infinitestrings_correctness:
259
78dd6bca5627 updated
Christian Urban <urbanc@in.tum.de>
parents: 258
diff changeset
   186
  shows "infinitestrings r \<longleftrightarrow> infinite (L r)"
258
Christian Urban <urbanc@in.tum.de>
parents:
diff changeset
   187
apply(induct r)
Christian Urban <urbanc@in.tum.de>
parents:
diff changeset
   188
apply(simp_all)
Christian Urban <urbanc@in.tum.de>
parents:
diff changeset
   189
apply(simp add: zeroable_correctness)
Christian Urban <urbanc@in.tum.de>
parents:
diff changeset
   190
apply(rule iffI)
Christian Urban <urbanc@in.tum.de>
parents:
diff changeset
   191
apply(erule disjE)
Christian Urban <urbanc@in.tum.de>
parents:
diff changeset
   192
apply(subst Sequ_Prod_finite)
Christian Urban <urbanc@in.tum.de>
parents:
diff changeset
   193
apply(auto)[2]
Christian Urban <urbanc@in.tum.de>
parents:
diff changeset
   194
using finite_cartesian_productD2 apply blast
Christian Urban <urbanc@in.tum.de>
parents:
diff changeset
   195
apply(subst Sequ_Prod_finite)
Christian Urban <urbanc@in.tum.de>
parents:
diff changeset
   196
apply(auto)[2]
Christian Urban <urbanc@in.tum.de>
parents:
diff changeset
   197
using finite_cartesian_productD1 apply blast
259
78dd6bca5627 updated
Christian Urban <urbanc@in.tum.de>
parents: 258
diff changeset
   198
apply(subgoal_tac "L r1 \<noteq> {} \<and> L r2 \<noteq> {}")
258
Christian Urban <urbanc@in.tum.de>
parents:
diff changeset
   199
prefer 2
Christian Urban <urbanc@in.tum.de>
parents:
diff changeset
   200
apply(auto simp add: Sequ_def)[1]
Christian Urban <urbanc@in.tum.de>
parents:
diff changeset
   201
apply(subst (asm) Sequ_Prod_finite)
Christian Urban <urbanc@in.tum.de>
parents:
diff changeset
   202
apply(auto)[2]
Christian Urban <urbanc@in.tum.de>
parents:
diff changeset
   203
apply(auto)[1]
Christian Urban <urbanc@in.tum.de>
parents:
diff changeset
   204
apply(simp add: atmostempty_correctness)
Christian Urban <urbanc@in.tum.de>
parents:
diff changeset
   205
apply(rule iffI)
Christian Urban <urbanc@in.tum.de>
parents:
diff changeset
   206
apply (metis Star_empty_finite Star_empty_string_finite subset_singletonD)
Christian Urban <urbanc@in.tum.de>
parents:
diff changeset
   207
using Star_non_empty_string_infinite apply blast
Christian Urban <urbanc@in.tum.de>
parents:
diff changeset
   208
done
Christian Urban <urbanc@in.tum.de>
parents:
diff changeset
   209
260
160d0b08471c updated
Christian Urban <urbanc@in.tum.de>
parents: 259
diff changeset
   210
unused_thms
258
Christian Urban <urbanc@in.tum.de>
parents:
diff changeset
   211
Christian Urban <urbanc@in.tum.de>
parents:
diff changeset
   212
end