Derivs.thy
author zhang
Fri, 03 Jun 2011 13:54:14 +0000
changeset 168 c47efadcaee1
parent 166 7743d2ad71d1
permissions -rw-r--r--
added
Ignore whitespace changes - Everywhere: Within whitespace: At end of lines:
162
e93760534354 added directory for journal version; took uptodate version of the theory files
urbanc
parents:
diff changeset
     1
theory Derivs
166
7743d2ad71d1 updated theories and itp-paper
urbanc
parents: 162
diff changeset
     2
imports Myhill_2
162
e93760534354 added directory for journal version; took uptodate version of the theory files
urbanc
parents:
diff changeset
     3
begin
e93760534354 added directory for journal version; took uptodate version of the theory files
urbanc
parents:
diff changeset
     4
166
7743d2ad71d1 updated theories and itp-paper
urbanc
parents: 162
diff changeset
     5
section {* Left-Quotients and Derivatives *}
162
e93760534354 added directory for journal version; took uptodate version of the theory files
urbanc
parents:
diff changeset
     6
e93760534354 added directory for journal version; took uptodate version of the theory files
urbanc
parents:
diff changeset
     7
subsection {* Left-Quotients *}
e93760534354 added directory for journal version; took uptodate version of the theory files
urbanc
parents:
diff changeset
     8
e93760534354 added directory for journal version; took uptodate version of the theory files
urbanc
parents:
diff changeset
     9
definition
e93760534354 added directory for journal version; took uptodate version of the theory files
urbanc
parents:
diff changeset
    10
  Delta :: "lang \<Rightarrow> lang"
e93760534354 added directory for journal version; took uptodate version of the theory files
urbanc
parents:
diff changeset
    11
where
e93760534354 added directory for journal version; took uptodate version of the theory files
urbanc
parents:
diff changeset
    12
  "Delta A = (if [] \<in> A then {[]} else {})"
e93760534354 added directory for journal version; took uptodate version of the theory files
urbanc
parents:
diff changeset
    13
e93760534354 added directory for journal version; took uptodate version of the theory files
urbanc
parents:
diff changeset
    14
definition
e93760534354 added directory for journal version; took uptodate version of the theory files
urbanc
parents:
diff changeset
    15
  Der :: "char \<Rightarrow> lang \<Rightarrow> lang"
e93760534354 added directory for journal version; took uptodate version of the theory files
urbanc
parents:
diff changeset
    16
where
e93760534354 added directory for journal version; took uptodate version of the theory files
urbanc
parents:
diff changeset
    17
  "Der c A \<equiv> {s. [c] @ s \<in> A}"
e93760534354 added directory for journal version; took uptodate version of the theory files
urbanc
parents:
diff changeset
    18
e93760534354 added directory for journal version; took uptodate version of the theory files
urbanc
parents:
diff changeset
    19
definition
e93760534354 added directory for journal version; took uptodate version of the theory files
urbanc
parents:
diff changeset
    20
  Ders :: "string \<Rightarrow> lang \<Rightarrow> lang"
e93760534354 added directory for journal version; took uptodate version of the theory files
urbanc
parents:
diff changeset
    21
where
e93760534354 added directory for journal version; took uptodate version of the theory files
urbanc
parents:
diff changeset
    22
  "Ders s A \<equiv> {s'. s @ s' \<in> A}"
e93760534354 added directory for journal version; took uptodate version of the theory files
urbanc
parents:
diff changeset
    23
e93760534354 added directory for journal version; took uptodate version of the theory files
urbanc
parents:
diff changeset
    24
definition
e93760534354 added directory for journal version; took uptodate version of the theory files
urbanc
parents:
diff changeset
    25
  Ders_set :: "lang \<Rightarrow> lang \<Rightarrow> lang"
e93760534354 added directory for journal version; took uptodate version of the theory files
urbanc
parents:
diff changeset
    26
where
e93760534354 added directory for journal version; took uptodate version of the theory files
urbanc
parents:
diff changeset
    27
  "Ders_set A B \<equiv> {s' | s s'. s @ s' \<in> B \<and> s \<in> A}"
e93760534354 added directory for journal version; took uptodate version of the theory files
urbanc
parents:
diff changeset
    28
e93760534354 added directory for journal version; took uptodate version of the theory files
urbanc
parents:
diff changeset
    29
lemma Ders_set_Ders:
e93760534354 added directory for journal version; took uptodate version of the theory files
urbanc
parents:
diff changeset
    30
  shows "Ders_set A B = (\<Union>s \<in> A. Ders s B)"
e93760534354 added directory for journal version; took uptodate version of the theory files
urbanc
parents:
diff changeset
    31
unfolding Ders_set_def Ders_def
e93760534354 added directory for journal version; took uptodate version of the theory files
urbanc
parents:
diff changeset
    32
by auto
e93760534354 added directory for journal version; took uptodate version of the theory files
urbanc
parents:
diff changeset
    33
e93760534354 added directory for journal version; took uptodate version of the theory files
urbanc
parents:
diff changeset
    34
lemma Der_null [simp]:
e93760534354 added directory for journal version; took uptodate version of the theory files
urbanc
parents:
diff changeset
    35
  shows "Der c {} = {}"
e93760534354 added directory for journal version; took uptodate version of the theory files
urbanc
parents:
diff changeset
    36
unfolding Der_def
e93760534354 added directory for journal version; took uptodate version of the theory files
urbanc
parents:
diff changeset
    37
by auto
e93760534354 added directory for journal version; took uptodate version of the theory files
urbanc
parents:
diff changeset
    38
e93760534354 added directory for journal version; took uptodate version of the theory files
urbanc
parents:
diff changeset
    39
lemma Der_empty [simp]:
e93760534354 added directory for journal version; took uptodate version of the theory files
urbanc
parents:
diff changeset
    40
  shows "Der c {[]} = {}"
e93760534354 added directory for journal version; took uptodate version of the theory files
urbanc
parents:
diff changeset
    41
unfolding Der_def
e93760534354 added directory for journal version; took uptodate version of the theory files
urbanc
parents:
diff changeset
    42
by auto
e93760534354 added directory for journal version; took uptodate version of the theory files
urbanc
parents:
diff changeset
    43
e93760534354 added directory for journal version; took uptodate version of the theory files
urbanc
parents:
diff changeset
    44
lemma Der_char [simp]:
e93760534354 added directory for journal version; took uptodate version of the theory files
urbanc
parents:
diff changeset
    45
  shows "Der c {[d]} = (if c = d then {[]} else {})"
e93760534354 added directory for journal version; took uptodate version of the theory files
urbanc
parents:
diff changeset
    46
unfolding Der_def
e93760534354 added directory for journal version; took uptodate version of the theory files
urbanc
parents:
diff changeset
    47
by auto
e93760534354 added directory for journal version; took uptodate version of the theory files
urbanc
parents:
diff changeset
    48
e93760534354 added directory for journal version; took uptodate version of the theory files
urbanc
parents:
diff changeset
    49
lemma Der_union [simp]:
e93760534354 added directory for journal version; took uptodate version of the theory files
urbanc
parents:
diff changeset
    50
  shows "Der c (A \<union> B) = Der c A \<union> Der c B"
e93760534354 added directory for journal version; took uptodate version of the theory files
urbanc
parents:
diff changeset
    51
unfolding Der_def
e93760534354 added directory for journal version; took uptodate version of the theory files
urbanc
parents:
diff changeset
    52
by auto
e93760534354 added directory for journal version; took uptodate version of the theory files
urbanc
parents:
diff changeset
    53
e93760534354 added directory for journal version; took uptodate version of the theory files
urbanc
parents:
diff changeset
    54
lemma Der_seq [simp]:
166
7743d2ad71d1 updated theories and itp-paper
urbanc
parents: 162
diff changeset
    55
  shows "Der c (A \<cdot> B) = (Der c A) \<cdot> B \<union> (Delta A \<cdot> Der c B)"
162
e93760534354 added directory for journal version; took uptodate version of the theory files
urbanc
parents:
diff changeset
    56
unfolding Der_def Delta_def
e93760534354 added directory for journal version; took uptodate version of the theory files
urbanc
parents:
diff changeset
    57
unfolding Seq_def
e93760534354 added directory for journal version; took uptodate version of the theory files
urbanc
parents:
diff changeset
    58
by (auto simp add: Cons_eq_append_conv)
e93760534354 added directory for journal version; took uptodate version of the theory files
urbanc
parents:
diff changeset
    59
e93760534354 added directory for journal version; took uptodate version of the theory files
urbanc
parents:
diff changeset
    60
lemma Der_star [simp]:
166
7743d2ad71d1 updated theories and itp-paper
urbanc
parents: 162
diff changeset
    61
  shows "Der c (A\<star>) = (Der c A) \<cdot> A\<star>"
162
e93760534354 added directory for journal version; took uptodate version of the theory files
urbanc
parents:
diff changeset
    62
proof -
166
7743d2ad71d1 updated theories and itp-paper
urbanc
parents: 162
diff changeset
    63
  have incl: "Delta A \<cdot> Der c (A\<star>) \<subseteq> (Der c A) \<cdot> A\<star>"
162
e93760534354 added directory for journal version; took uptodate version of the theory files
urbanc
parents:
diff changeset
    64
    unfolding Der_def Delta_def Seq_def
e93760534354 added directory for journal version; took uptodate version of the theory files
urbanc
parents:
diff changeset
    65
    apply(auto)
e93760534354 added directory for journal version; took uptodate version of the theory files
urbanc
parents:
diff changeset
    66
    apply(drule star_decom)
e93760534354 added directory for journal version; took uptodate version of the theory files
urbanc
parents:
diff changeset
    67
    apply(auto simp add: Cons_eq_append_conv)
e93760534354 added directory for journal version; took uptodate version of the theory files
urbanc
parents:
diff changeset
    68
    done
e93760534354 added directory for journal version; took uptodate version of the theory files
urbanc
parents:
diff changeset
    69
    
166
7743d2ad71d1 updated theories and itp-paper
urbanc
parents: 162
diff changeset
    70
  have "Der c (A\<star>) = Der c ({[]} \<union> A \<cdot> A\<star>)"
162
e93760534354 added directory for journal version; took uptodate version of the theory files
urbanc
parents:
diff changeset
    71
    by (simp only: star_cases[symmetric])
166
7743d2ad71d1 updated theories and itp-paper
urbanc
parents: 162
diff changeset
    72
  also have "... = Der c (A \<cdot> A\<star>)"
162
e93760534354 added directory for journal version; took uptodate version of the theory files
urbanc
parents:
diff changeset
    73
    by (simp only: Der_union Der_empty) (simp)
166
7743d2ad71d1 updated theories and itp-paper
urbanc
parents: 162
diff changeset
    74
  also have "... = (Der c A) \<cdot> A\<star> \<union> (Delta A \<cdot> Der c (A\<star>))"
162
e93760534354 added directory for journal version; took uptodate version of the theory files
urbanc
parents:
diff changeset
    75
    by simp
166
7743d2ad71d1 updated theories and itp-paper
urbanc
parents: 162
diff changeset
    76
  also have "... =  (Der c A) \<cdot> A\<star>"
162
e93760534354 added directory for journal version; took uptodate version of the theory files
urbanc
parents:
diff changeset
    77
    using incl by auto
166
7743d2ad71d1 updated theories and itp-paper
urbanc
parents: 162
diff changeset
    78
  finally show "Der c (A\<star>) = (Der c A) \<cdot> A\<star>" . 
162
e93760534354 added directory for journal version; took uptodate version of the theory files
urbanc
parents:
diff changeset
    79
qed
e93760534354 added directory for journal version; took uptodate version of the theory files
urbanc
parents:
diff changeset
    80
e93760534354 added directory for journal version; took uptodate version of the theory files
urbanc
parents:
diff changeset
    81
e93760534354 added directory for journal version; took uptodate version of the theory files
urbanc
parents:
diff changeset
    82
lemma Ders_singleton:
e93760534354 added directory for journal version; took uptodate version of the theory files
urbanc
parents:
diff changeset
    83
  shows "Ders [c] A = Der c A"
e93760534354 added directory for journal version; took uptodate version of the theory files
urbanc
parents:
diff changeset
    84
unfolding Der_def Ders_def
e93760534354 added directory for journal version; took uptodate version of the theory files
urbanc
parents:
diff changeset
    85
by simp
e93760534354 added directory for journal version; took uptodate version of the theory files
urbanc
parents:
diff changeset
    86
e93760534354 added directory for journal version; took uptodate version of the theory files
urbanc
parents:
diff changeset
    87
lemma Ders_append:
e93760534354 added directory for journal version; took uptodate version of the theory files
urbanc
parents:
diff changeset
    88
  shows "Ders (s1 @ s2) A = Ders s2 (Ders s1 A)"
e93760534354 added directory for journal version; took uptodate version of the theory files
urbanc
parents:
diff changeset
    89
unfolding Ders_def by simp 
e93760534354 added directory for journal version; took uptodate version of the theory files
urbanc
parents:
diff changeset
    90
e93760534354 added directory for journal version; took uptodate version of the theory files
urbanc
parents:
diff changeset
    91
lemma MN_Rel_Ders:
e93760534354 added directory for journal version; took uptodate version of the theory files
urbanc
parents:
diff changeset
    92
  shows "x \<approx>A y \<longleftrightarrow> Ders x A = Ders y A"
e93760534354 added directory for journal version; took uptodate version of the theory files
urbanc
parents:
diff changeset
    93
unfolding Ders_def str_eq_def str_eq_rel_def
e93760534354 added directory for journal version; took uptodate version of the theory files
urbanc
parents:
diff changeset
    94
by auto
e93760534354 added directory for journal version; took uptodate version of the theory files
urbanc
parents:
diff changeset
    95
e93760534354 added directory for journal version; took uptodate version of the theory files
urbanc
parents:
diff changeset
    96
subsection {* Brozowsky's derivatives of regular expressions *}
e93760534354 added directory for journal version; took uptodate version of the theory files
urbanc
parents:
diff changeset
    97
e93760534354 added directory for journal version; took uptodate version of the theory files
urbanc
parents:
diff changeset
    98
fun
e93760534354 added directory for journal version; took uptodate version of the theory files
urbanc
parents:
diff changeset
    99
  nullable :: "rexp \<Rightarrow> bool"
e93760534354 added directory for journal version; took uptodate version of the theory files
urbanc
parents:
diff changeset
   100
where
e93760534354 added directory for journal version; took uptodate version of the theory files
urbanc
parents:
diff changeset
   101
  "nullable (NULL) = False"
e93760534354 added directory for journal version; took uptodate version of the theory files
urbanc
parents:
diff changeset
   102
| "nullable (EMPTY) = True"
e93760534354 added directory for journal version; took uptodate version of the theory files
urbanc
parents:
diff changeset
   103
| "nullable (CHAR c) = False"
e93760534354 added directory for journal version; took uptodate version of the theory files
urbanc
parents:
diff changeset
   104
| "nullable (ALT r1 r2) = (nullable r1 \<or> nullable r2)"
e93760534354 added directory for journal version; took uptodate version of the theory files
urbanc
parents:
diff changeset
   105
| "nullable (SEQ r1 r2) = (nullable r1 \<and> nullable r2)"
e93760534354 added directory for journal version; took uptodate version of the theory files
urbanc
parents:
diff changeset
   106
| "nullable (STAR r) = True"
e93760534354 added directory for journal version; took uptodate version of the theory files
urbanc
parents:
diff changeset
   107
e93760534354 added directory for journal version; took uptodate version of the theory files
urbanc
parents:
diff changeset
   108
fun
e93760534354 added directory for journal version; took uptodate version of the theory files
urbanc
parents:
diff changeset
   109
  der :: "char \<Rightarrow> rexp \<Rightarrow> rexp"
e93760534354 added directory for journal version; took uptodate version of the theory files
urbanc
parents:
diff changeset
   110
where
e93760534354 added directory for journal version; took uptodate version of the theory files
urbanc
parents:
diff changeset
   111
  "der c (NULL) = NULL"
e93760534354 added directory for journal version; took uptodate version of the theory files
urbanc
parents:
diff changeset
   112
| "der c (EMPTY) = NULL"
e93760534354 added directory for journal version; took uptodate version of the theory files
urbanc
parents:
diff changeset
   113
| "der c (CHAR c') = (if c = c' then EMPTY else NULL)"
e93760534354 added directory for journal version; took uptodate version of the theory files
urbanc
parents:
diff changeset
   114
| "der c (ALT r1 r2) = ALT (der c r1) (der c r2)"
e93760534354 added directory for journal version; took uptodate version of the theory files
urbanc
parents:
diff changeset
   115
| "der c (SEQ r1 r2) = ALT (SEQ (der c r1) r2) (if nullable r1 then der c r2 else NULL)"
e93760534354 added directory for journal version; took uptodate version of the theory files
urbanc
parents:
diff changeset
   116
| "der c (STAR r) = SEQ (der c r) (STAR r)"
e93760534354 added directory for journal version; took uptodate version of the theory files
urbanc
parents:
diff changeset
   117
e93760534354 added directory for journal version; took uptodate version of the theory files
urbanc
parents:
diff changeset
   118
function 
e93760534354 added directory for journal version; took uptodate version of the theory files
urbanc
parents:
diff changeset
   119
  ders :: "string \<Rightarrow> rexp \<Rightarrow> rexp"
e93760534354 added directory for journal version; took uptodate version of the theory files
urbanc
parents:
diff changeset
   120
where
e93760534354 added directory for journal version; took uptodate version of the theory files
urbanc
parents:
diff changeset
   121
  "ders [] r = r"
e93760534354 added directory for journal version; took uptodate version of the theory files
urbanc
parents:
diff changeset
   122
| "ders (s @ [c]) r = der c (ders s r)"
e93760534354 added directory for journal version; took uptodate version of the theory files
urbanc
parents:
diff changeset
   123
by (auto) (metis rev_cases)
e93760534354 added directory for journal version; took uptodate version of the theory files
urbanc
parents:
diff changeset
   124
e93760534354 added directory for journal version; took uptodate version of the theory files
urbanc
parents:
diff changeset
   125
termination
e93760534354 added directory for journal version; took uptodate version of the theory files
urbanc
parents:
diff changeset
   126
  by (relation "measure (length o fst)") (auto)
e93760534354 added directory for journal version; took uptodate version of the theory files
urbanc
parents:
diff changeset
   127
e93760534354 added directory for journal version; took uptodate version of the theory files
urbanc
parents:
diff changeset
   128
lemma Delta_nullable:
166
7743d2ad71d1 updated theories and itp-paper
urbanc
parents: 162
diff changeset
   129
  shows "Delta (L_rexp r) = (if nullable r then {[]} else {})"
162
e93760534354 added directory for journal version; took uptodate version of the theory files
urbanc
parents:
diff changeset
   130
unfolding Delta_def
e93760534354 added directory for journal version; took uptodate version of the theory files
urbanc
parents:
diff changeset
   131
by (induct r) (auto simp add: Seq_def split: if_splits)
e93760534354 added directory for journal version; took uptodate version of the theory files
urbanc
parents:
diff changeset
   132
e93760534354 added directory for journal version; took uptodate version of the theory files
urbanc
parents:
diff changeset
   133
lemma Der_der:
e93760534354 added directory for journal version; took uptodate version of the theory files
urbanc
parents:
diff changeset
   134
  fixes r::rexp
166
7743d2ad71d1 updated theories and itp-paper
urbanc
parents: 162
diff changeset
   135
  shows "Der c (L_rexp r) = L_rexp (der c r)"
162
e93760534354 added directory for journal version; took uptodate version of the theory files
urbanc
parents:
diff changeset
   136
by (induct r) (simp_all add: Delta_nullable)
e93760534354 added directory for journal version; took uptodate version of the theory files
urbanc
parents:
diff changeset
   137
e93760534354 added directory for journal version; took uptodate version of the theory files
urbanc
parents:
diff changeset
   138
lemma Ders_ders:
e93760534354 added directory for journal version; took uptodate version of the theory files
urbanc
parents:
diff changeset
   139
  fixes r::rexp
166
7743d2ad71d1 updated theories and itp-paper
urbanc
parents: 162
diff changeset
   140
  shows "Ders s (L_rexp r) = L_rexp (ders s r)"
162
e93760534354 added directory for journal version; took uptodate version of the theory files
urbanc
parents:
diff changeset
   141
apply(induct s rule: rev_induct)
e93760534354 added directory for journal version; took uptodate version of the theory files
urbanc
parents:
diff changeset
   142
apply(simp add: Ders_def)
e93760534354 added directory for journal version; took uptodate version of the theory files
urbanc
parents:
diff changeset
   143
apply(simp only: ders.simps)
e93760534354 added directory for journal version; took uptodate version of the theory files
urbanc
parents:
diff changeset
   144
apply(simp only: Ders_append)
e93760534354 added directory for journal version; took uptodate version of the theory files
urbanc
parents:
diff changeset
   145
apply(simp only: Ders_singleton)
e93760534354 added directory for journal version; took uptodate version of the theory files
urbanc
parents:
diff changeset
   146
apply(simp only: Der_der)
e93760534354 added directory for journal version; took uptodate version of the theory files
urbanc
parents:
diff changeset
   147
done
e93760534354 added directory for journal version; took uptodate version of the theory files
urbanc
parents:
diff changeset
   148
e93760534354 added directory for journal version; took uptodate version of the theory files
urbanc
parents:
diff changeset
   149
e93760534354 added directory for journal version; took uptodate version of the theory files
urbanc
parents:
diff changeset
   150
subsection {* Antimirov's Partial Derivatives *}
e93760534354 added directory for journal version; took uptodate version of the theory files
urbanc
parents:
diff changeset
   151
e93760534354 added directory for journal version; took uptodate version of the theory files
urbanc
parents:
diff changeset
   152
abbreviation
e93760534354 added directory for journal version; took uptodate version of the theory files
urbanc
parents:
diff changeset
   153
  "SEQS R r \<equiv> {SEQ r' r | r'. r' \<in> R}"
e93760534354 added directory for journal version; took uptodate version of the theory files
urbanc
parents:
diff changeset
   154
e93760534354 added directory for journal version; took uptodate version of the theory files
urbanc
parents:
diff changeset
   155
fun
e93760534354 added directory for journal version; took uptodate version of the theory files
urbanc
parents:
diff changeset
   156
  pder :: "char \<Rightarrow> rexp \<Rightarrow> rexp set"
e93760534354 added directory for journal version; took uptodate version of the theory files
urbanc
parents:
diff changeset
   157
where
e93760534354 added directory for journal version; took uptodate version of the theory files
urbanc
parents:
diff changeset
   158
  "pder c NULL = {NULL}"
e93760534354 added directory for journal version; took uptodate version of the theory files
urbanc
parents:
diff changeset
   159
| "pder c EMPTY = {NULL}"
e93760534354 added directory for journal version; took uptodate version of the theory files
urbanc
parents:
diff changeset
   160
| "pder c (CHAR c') = (if c = c' then {EMPTY} else {NULL})"
e93760534354 added directory for journal version; took uptodate version of the theory files
urbanc
parents:
diff changeset
   161
| "pder c (ALT r1 r2) = (pder c r1) \<union> (pder c r2)"
e93760534354 added directory for journal version; took uptodate version of the theory files
urbanc
parents:
diff changeset
   162
| "pder c (SEQ r1 r2) = SEQS (pder c r1) r2 \<union> (if nullable r1 then pder c r2 else {})"
e93760534354 added directory for journal version; took uptodate version of the theory files
urbanc
parents:
diff changeset
   163
| "pder c (STAR r) = SEQS (pder c r) (STAR r)"
e93760534354 added directory for journal version; took uptodate version of the theory files
urbanc
parents:
diff changeset
   164
e93760534354 added directory for journal version; took uptodate version of the theory files
urbanc
parents:
diff changeset
   165
abbreviation
e93760534354 added directory for journal version; took uptodate version of the theory files
urbanc
parents:
diff changeset
   166
  "pder_set c R \<equiv> \<Union>r \<in> R. pder c r"
e93760534354 added directory for journal version; took uptodate version of the theory files
urbanc
parents:
diff changeset
   167
e93760534354 added directory for journal version; took uptodate version of the theory files
urbanc
parents:
diff changeset
   168
function 
e93760534354 added directory for journal version; took uptodate version of the theory files
urbanc
parents:
diff changeset
   169
  pders :: "string \<Rightarrow> rexp \<Rightarrow> rexp set"
e93760534354 added directory for journal version; took uptodate version of the theory files
urbanc
parents:
diff changeset
   170
where
e93760534354 added directory for journal version; took uptodate version of the theory files
urbanc
parents:
diff changeset
   171
  "pders [] r = {r}"
e93760534354 added directory for journal version; took uptodate version of the theory files
urbanc
parents:
diff changeset
   172
| "pders (s @ [c]) r = pder_set c (pders s r)"
e93760534354 added directory for journal version; took uptodate version of the theory files
urbanc
parents:
diff changeset
   173
by (auto) (metis rev_cases)
e93760534354 added directory for journal version; took uptodate version of the theory files
urbanc
parents:
diff changeset
   174
e93760534354 added directory for journal version; took uptodate version of the theory files
urbanc
parents:
diff changeset
   175
termination
e93760534354 added directory for journal version; took uptodate version of the theory files
urbanc
parents:
diff changeset
   176
  by (relation "measure (length o fst)") (auto)
e93760534354 added directory for journal version; took uptodate version of the theory files
urbanc
parents:
diff changeset
   177
e93760534354 added directory for journal version; took uptodate version of the theory files
urbanc
parents:
diff changeset
   178
abbreviation
e93760534354 added directory for journal version; took uptodate version of the theory files
urbanc
parents:
diff changeset
   179
  "pders_set A r \<equiv> \<Union>s \<in> A. pders s r"
e93760534354 added directory for journal version; took uptodate version of the theory files
urbanc
parents:
diff changeset
   180
e93760534354 added directory for journal version; took uptodate version of the theory files
urbanc
parents:
diff changeset
   181
lemma pders_append:
e93760534354 added directory for journal version; took uptodate version of the theory files
urbanc
parents:
diff changeset
   182
  "pders (s1 @ s2) r = \<Union> (pders s2) ` (pders s1 r)"
e93760534354 added directory for journal version; took uptodate version of the theory files
urbanc
parents:
diff changeset
   183
apply(induct s2 arbitrary: s1 r rule: rev_induct)
e93760534354 added directory for journal version; took uptodate version of the theory files
urbanc
parents:
diff changeset
   184
apply(simp)
e93760534354 added directory for journal version; took uptodate version of the theory files
urbanc
parents:
diff changeset
   185
apply(subst append_assoc[symmetric])
e93760534354 added directory for journal version; took uptodate version of the theory files
urbanc
parents:
diff changeset
   186
apply(simp only: pders.simps)
e93760534354 added directory for journal version; took uptodate version of the theory files
urbanc
parents:
diff changeset
   187
apply(auto)
e93760534354 added directory for journal version; took uptodate version of the theory files
urbanc
parents:
diff changeset
   188
done
e93760534354 added directory for journal version; took uptodate version of the theory files
urbanc
parents:
diff changeset
   189
e93760534354 added directory for journal version; took uptodate version of the theory files
urbanc
parents:
diff changeset
   190
lemma pders_singleton:
e93760534354 added directory for journal version; took uptodate version of the theory files
urbanc
parents:
diff changeset
   191
  "pders [c] r = pder c r"
e93760534354 added directory for journal version; took uptodate version of the theory files
urbanc
parents:
diff changeset
   192
apply(subst append_Nil[symmetric])
e93760534354 added directory for journal version; took uptodate version of the theory files
urbanc
parents:
diff changeset
   193
apply(simp only: pders.simps)
e93760534354 added directory for journal version; took uptodate version of the theory files
urbanc
parents:
diff changeset
   194
apply(simp)
e93760534354 added directory for journal version; took uptodate version of the theory files
urbanc
parents:
diff changeset
   195
done
e93760534354 added directory for journal version; took uptodate version of the theory files
urbanc
parents:
diff changeset
   196
e93760534354 added directory for journal version; took uptodate version of the theory files
urbanc
parents:
diff changeset
   197
lemma pder_set_lang:
166
7743d2ad71d1 updated theories and itp-paper
urbanc
parents: 162
diff changeset
   198
  shows "(\<Union> (L_rexp ` pder_set c R)) = (\<Union>r \<in> R. (\<Union>L_rexp ` (pder c r)))"
162
e93760534354 added directory for journal version; took uptodate version of the theory files
urbanc
parents:
diff changeset
   199
unfolding image_def 
e93760534354 added directory for journal version; took uptodate version of the theory files
urbanc
parents:
diff changeset
   200
by auto
e93760534354 added directory for journal version; took uptodate version of the theory files
urbanc
parents:
diff changeset
   201
e93760534354 added directory for journal version; took uptodate version of the theory files
urbanc
parents:
diff changeset
   202
lemma
166
7743d2ad71d1 updated theories and itp-paper
urbanc
parents: 162
diff changeset
   203
  shows seq_UNION_left:  "B \<cdot> (\<Union>n\<in>C. A n) = (\<Union>n\<in>C. B \<cdot> A n)"
7743d2ad71d1 updated theories and itp-paper
urbanc
parents: 162
diff changeset
   204
  and   seq_UNION_right: "(\<Union>n\<in>C. A n) \<cdot> B = (\<Union>n\<in>C. A n \<cdot> B)"
162
e93760534354 added directory for journal version; took uptodate version of the theory files
urbanc
parents:
diff changeset
   205
unfolding Seq_def by auto
e93760534354 added directory for journal version; took uptodate version of the theory files
urbanc
parents:
diff changeset
   206
e93760534354 added directory for journal version; took uptodate version of the theory files
urbanc
parents:
diff changeset
   207
lemma Der_pder:
e93760534354 added directory for journal version; took uptodate version of the theory files
urbanc
parents:
diff changeset
   208
  fixes r::rexp
166
7743d2ad71d1 updated theories and itp-paper
urbanc
parents: 162
diff changeset
   209
  shows "Der c (L_rexp r) = \<Union> L_rexp ` (pder c r)"
162
e93760534354 added directory for journal version; took uptodate version of the theory files
urbanc
parents:
diff changeset
   210
by (induct r) (auto simp add: Delta_nullable seq_UNION_right)
e93760534354 added directory for journal version; took uptodate version of the theory files
urbanc
parents:
diff changeset
   211
e93760534354 added directory for journal version; took uptodate version of the theory files
urbanc
parents:
diff changeset
   212
lemma Ders_pders:
e93760534354 added directory for journal version; took uptodate version of the theory files
urbanc
parents:
diff changeset
   213
  fixes r::rexp
166
7743d2ad71d1 updated theories and itp-paper
urbanc
parents: 162
diff changeset
   214
  shows "Ders s (L_rexp r) = \<Union> L_rexp ` (pders s r)"
162
e93760534354 added directory for journal version; took uptodate version of the theory files
urbanc
parents:
diff changeset
   215
proof (induct s rule: rev_induct)
e93760534354 added directory for journal version; took uptodate version of the theory files
urbanc
parents:
diff changeset
   216
  case (snoc c s)
166
7743d2ad71d1 updated theories and itp-paper
urbanc
parents: 162
diff changeset
   217
  have ih: "Ders s (L_rexp r) = \<Union> L_rexp ` (pders s r)" by fact
7743d2ad71d1 updated theories and itp-paper
urbanc
parents: 162
diff changeset
   218
  have "Ders (s @ [c]) (L_rexp r) = Ders [c] (Ders s (L_rexp r))"
162
e93760534354 added directory for journal version; took uptodate version of the theory files
urbanc
parents:
diff changeset
   219
    by (simp add: Ders_append)
166
7743d2ad71d1 updated theories and itp-paper
urbanc
parents: 162
diff changeset
   220
  also have "\<dots> = Der c (\<Union> L_rexp ` (pders s r))" using ih
162
e93760534354 added directory for journal version; took uptodate version of the theory files
urbanc
parents:
diff changeset
   221
    by (simp add: Ders_singleton)
166
7743d2ad71d1 updated theories and itp-paper
urbanc
parents: 162
diff changeset
   222
  also have "\<dots> = (\<Union>r\<in>pders s r. Der c (L_rexp r))" 
162
e93760534354 added directory for journal version; took uptodate version of the theory files
urbanc
parents:
diff changeset
   223
    unfolding Der_def image_def by auto
166
7743d2ad71d1 updated theories and itp-paper
urbanc
parents: 162
diff changeset
   224
  also have "\<dots> = (\<Union>r\<in>pders s r. (\<Union> L_rexp `  (pder c r)))"
162
e93760534354 added directory for journal version; took uptodate version of the theory files
urbanc
parents:
diff changeset
   225
    by (simp add: Der_pder)
166
7743d2ad71d1 updated theories and itp-paper
urbanc
parents: 162
diff changeset
   226
  also have "\<dots> = (\<Union>L_rexp ` (pder_set c (pders s r)))"
162
e93760534354 added directory for journal version; took uptodate version of the theory files
urbanc
parents:
diff changeset
   227
    by (simp add: pder_set_lang)
166
7743d2ad71d1 updated theories and itp-paper
urbanc
parents: 162
diff changeset
   228
  also have "\<dots> = (\<Union>L_rexp ` (pders (s @ [c]) r))"
162
e93760534354 added directory for journal version; took uptodate version of the theory files
urbanc
parents:
diff changeset
   229
    by simp
166
7743d2ad71d1 updated theories and itp-paper
urbanc
parents: 162
diff changeset
   230
  finally show "Ders (s @ [c]) (L_rexp r) = \<Union> L_rexp ` pders (s @ [c]) r" .
162
e93760534354 added directory for journal version; took uptodate version of the theory files
urbanc
parents:
diff changeset
   231
qed (simp add: Ders_def)
e93760534354 added directory for journal version; took uptodate version of the theory files
urbanc
parents:
diff changeset
   232
e93760534354 added directory for journal version; took uptodate version of the theory files
urbanc
parents:
diff changeset
   233
lemma Ders_set_pders_set:
e93760534354 added directory for journal version; took uptodate version of the theory files
urbanc
parents:
diff changeset
   234
  fixes r::rexp
166
7743d2ad71d1 updated theories and itp-paper
urbanc
parents: 162
diff changeset
   235
  shows "Ders_set A (L_rexp r) = (\<Union> L_rexp ` (pders_set A r))"
162
e93760534354 added directory for journal version; took uptodate version of the theory files
urbanc
parents:
diff changeset
   236
by (simp add: Ders_set_Ders Ders_pders)
e93760534354 added directory for journal version; took uptodate version of the theory files
urbanc
parents:
diff changeset
   237
e93760534354 added directory for journal version; took uptodate version of the theory files
urbanc
parents:
diff changeset
   238
lemma pders_NULL [simp]:
e93760534354 added directory for journal version; took uptodate version of the theory files
urbanc
parents:
diff changeset
   239
  shows "pders s NULL = {NULL}"
e93760534354 added directory for journal version; took uptodate version of the theory files
urbanc
parents:
diff changeset
   240
by (induct s rule: rev_induct) (simp_all)
e93760534354 added directory for journal version; took uptodate version of the theory files
urbanc
parents:
diff changeset
   241
e93760534354 added directory for journal version; took uptodate version of the theory files
urbanc
parents:
diff changeset
   242
lemma pders_EMPTY [simp]:
e93760534354 added directory for journal version; took uptodate version of the theory files
urbanc
parents:
diff changeset
   243
  shows "pders s EMPTY = (if s = [] then {EMPTY} else {NULL})"
e93760534354 added directory for journal version; took uptodate version of the theory files
urbanc
parents:
diff changeset
   244
by (induct s rule: rev_induct) (auto)
e93760534354 added directory for journal version; took uptodate version of the theory files
urbanc
parents:
diff changeset
   245
e93760534354 added directory for journal version; took uptodate version of the theory files
urbanc
parents:
diff changeset
   246
lemma pders_CHAR [simp]:
e93760534354 added directory for journal version; took uptodate version of the theory files
urbanc
parents:
diff changeset
   247
  shows "pders s (CHAR c) = (if s = [] then {CHAR c} else (if s = [c] then {EMPTY} else {NULL}))"
e93760534354 added directory for journal version; took uptodate version of the theory files
urbanc
parents:
diff changeset
   248
by (induct s rule: rev_induct) (auto)
e93760534354 added directory for journal version; took uptodate version of the theory files
urbanc
parents:
diff changeset
   249
e93760534354 added directory for journal version; took uptodate version of the theory files
urbanc
parents:
diff changeset
   250
lemma pders_ALT [simp]:
e93760534354 added directory for journal version; took uptodate version of the theory files
urbanc
parents:
diff changeset
   251
  shows "pders s (ALT r1 r2) = (if s = [] then {ALT r1 r2} else (pders s r1) \<union> (pders s r2))"
e93760534354 added directory for journal version; took uptodate version of the theory files
urbanc
parents:
diff changeset
   252
by (induct s rule: rev_induct) (auto)
e93760534354 added directory for journal version; took uptodate version of the theory files
urbanc
parents:
diff changeset
   253
e93760534354 added directory for journal version; took uptodate version of the theory files
urbanc
parents:
diff changeset
   254
definition
e93760534354 added directory for journal version; took uptodate version of the theory files
urbanc
parents:
diff changeset
   255
  "Suf s \<equiv> {v. v \<noteq> [] \<and> (\<exists>u. u @ v = s)}"
e93760534354 added directory for journal version; took uptodate version of the theory files
urbanc
parents:
diff changeset
   256
e93760534354 added directory for journal version; took uptodate version of the theory files
urbanc
parents:
diff changeset
   257
lemma Suf:
166
7743d2ad71d1 updated theories and itp-paper
urbanc
parents: 162
diff changeset
   258
  shows "Suf (s @ [c]) = (Suf s) \<cdot> {[c]} \<union> {[c]}"
162
e93760534354 added directory for journal version; took uptodate version of the theory files
urbanc
parents:
diff changeset
   259
unfolding Suf_def Seq_def
e93760534354 added directory for journal version; took uptodate version of the theory files
urbanc
parents:
diff changeset
   260
by (auto simp add: append_eq_append_conv2 append_eq_Cons_conv)
e93760534354 added directory for journal version; took uptodate version of the theory files
urbanc
parents:
diff changeset
   261
e93760534354 added directory for journal version; took uptodate version of the theory files
urbanc
parents:
diff changeset
   262
lemma Suf_Union:
166
7743d2ad71d1 updated theories and itp-paper
urbanc
parents: 162
diff changeset
   263
  shows "(\<Union>v \<in> Suf s \<cdot> {[c]}. P v) = (\<Union>v \<in> Suf s. P (v @ [c]))"
162
e93760534354 added directory for journal version; took uptodate version of the theory files
urbanc
parents:
diff changeset
   264
by (auto simp add: Seq_def)
e93760534354 added directory for journal version; took uptodate version of the theory files
urbanc
parents:
diff changeset
   265
e93760534354 added directory for journal version; took uptodate version of the theory files
urbanc
parents:
diff changeset
   266
lemma inclusion1:
e93760534354 added directory for journal version; took uptodate version of the theory files
urbanc
parents:
diff changeset
   267
  shows "pder_set c (SEQS R r2) \<subseteq> SEQS (pder_set c R) r2 \<union> (pder c r2)"
e93760534354 added directory for journal version; took uptodate version of the theory files
urbanc
parents:
diff changeset
   268
apply(auto simp add: if_splits)
e93760534354 added directory for journal version; took uptodate version of the theory files
urbanc
parents:
diff changeset
   269
apply(blast)
e93760534354 added directory for journal version; took uptodate version of the theory files
urbanc
parents:
diff changeset
   270
done
e93760534354 added directory for journal version; took uptodate version of the theory files
urbanc
parents:
diff changeset
   271
e93760534354 added directory for journal version; took uptodate version of the theory files
urbanc
parents:
diff changeset
   272
lemma pders_SEQ:
e93760534354 added directory for journal version; took uptodate version of the theory files
urbanc
parents:
diff changeset
   273
  shows "pders s (SEQ r1 r2) \<subseteq> SEQS (pders s r1) r2 \<union> (\<Union>v \<in> Suf s. pders v r2)"
e93760534354 added directory for journal version; took uptodate version of the theory files
urbanc
parents:
diff changeset
   274
proof (induct s rule: rev_induct)
e93760534354 added directory for journal version; took uptodate version of the theory files
urbanc
parents:
diff changeset
   275
  case (snoc c s)
e93760534354 added directory for journal version; took uptodate version of the theory files
urbanc
parents:
diff changeset
   276
  have ih: "pders s (SEQ r1 r2) \<subseteq> SEQS (pders s r1) r2 \<union> (\<Union>v \<in> Suf s. pders v r2)" 
e93760534354 added directory for journal version; took uptodate version of the theory files
urbanc
parents:
diff changeset
   277
    by fact
e93760534354 added directory for journal version; took uptodate version of the theory files
urbanc
parents:
diff changeset
   278
  have "pders (s @ [c]) (SEQ r1 r2) = pder_set c (pders s (SEQ r1 r2))" by simp
e93760534354 added directory for journal version; took uptodate version of the theory files
urbanc
parents:
diff changeset
   279
  also have "\<dots> \<subseteq> pder_set c (SEQS (pders s r1) r2 \<union> (\<Union>v \<in> Suf s. pders v r2))"
166
7743d2ad71d1 updated theories and itp-paper
urbanc
parents: 162
diff changeset
   280
    using ih by (auto) (blast)
162
e93760534354 added directory for journal version; took uptodate version of the theory files
urbanc
parents:
diff changeset
   281
  also have "\<dots> = pder_set c (SEQS (pders s r1) r2) \<union> pder_set c (\<Union>v \<in> Suf s. pders v r2)"
e93760534354 added directory for journal version; took uptodate version of the theory files
urbanc
parents:
diff changeset
   282
    by (simp)
e93760534354 added directory for journal version; took uptodate version of the theory files
urbanc
parents:
diff changeset
   283
  also have "\<dots> = pder_set c (SEQS (pders s r1) r2) \<union> (\<Union>v \<in> Suf s. pder_set c (pders v r2))"
e93760534354 added directory for journal version; took uptodate version of the theory files
urbanc
parents:
diff changeset
   284
    by (simp)
e93760534354 added directory for journal version; took uptodate version of the theory files
urbanc
parents:
diff changeset
   285
  also have "\<dots> \<subseteq> pder_set c (SEQS (pders s r1) r2) \<union> (pder c r2) \<union> (\<Union>v \<in> Suf s. pders (v @ [c]) r2)"
e93760534354 added directory for journal version; took uptodate version of the theory files
urbanc
parents:
diff changeset
   286
    by (auto)
e93760534354 added directory for journal version; took uptodate version of the theory files
urbanc
parents:
diff changeset
   287
  also have "\<dots> \<subseteq> SEQS (pder_set c (pders s r1)) r2 \<union> (pder c r2) \<union> (\<Union>v \<in> Suf s. pders (v @ [c]) r2)"
e93760534354 added directory for journal version; took uptodate version of the theory files
urbanc
parents:
diff changeset
   288
    using inclusion1 by blast
e93760534354 added directory for journal version; took uptodate version of the theory files
urbanc
parents:
diff changeset
   289
  also have "\<dots> = SEQS (pders (s @ [c]) r1) r2 \<union> (\<Union>v \<in> Suf (s @ [c]). pders v r2)"
e93760534354 added directory for journal version; took uptodate version of the theory files
urbanc
parents:
diff changeset
   290
    apply(subst (2) pders.simps)
e93760534354 added directory for journal version; took uptodate version of the theory files
urbanc
parents:
diff changeset
   291
    apply(simp only: Suf)
e93760534354 added directory for journal version; took uptodate version of the theory files
urbanc
parents:
diff changeset
   292
    apply(simp add: Suf_Union pders_singleton)
e93760534354 added directory for journal version; took uptodate version of the theory files
urbanc
parents:
diff changeset
   293
    apply(auto)
e93760534354 added directory for journal version; took uptodate version of the theory files
urbanc
parents:
diff changeset
   294
    done
e93760534354 added directory for journal version; took uptodate version of the theory files
urbanc
parents:
diff changeset
   295
  finally show ?case .
e93760534354 added directory for journal version; took uptodate version of the theory files
urbanc
parents:
diff changeset
   296
qed (simp)
e93760534354 added directory for journal version; took uptodate version of the theory files
urbanc
parents:
diff changeset
   297
e93760534354 added directory for journal version; took uptodate version of the theory files
urbanc
parents:
diff changeset
   298
lemma pders_STAR:
e93760534354 added directory for journal version; took uptodate version of the theory files
urbanc
parents:
diff changeset
   299
  assumes a: "s \<noteq> []"
e93760534354 added directory for journal version; took uptodate version of the theory files
urbanc
parents:
diff changeset
   300
  shows "pders s (STAR r) \<subseteq> (\<Union>v \<in> Suf s. SEQS (pders v r) (STAR r))"
e93760534354 added directory for journal version; took uptodate version of the theory files
urbanc
parents:
diff changeset
   301
using a
e93760534354 added directory for journal version; took uptodate version of the theory files
urbanc
parents:
diff changeset
   302
proof (induct s rule: rev_induct)
e93760534354 added directory for journal version; took uptodate version of the theory files
urbanc
parents:
diff changeset
   303
  case (snoc c s)
e93760534354 added directory for journal version; took uptodate version of the theory files
urbanc
parents:
diff changeset
   304
  have ih: "s \<noteq> [] \<Longrightarrow> pders s (STAR r) \<subseteq> (\<Union>v\<in>Suf s. SEQS (pders v r) (STAR r))" by fact
e93760534354 added directory for journal version; took uptodate version of the theory files
urbanc
parents:
diff changeset
   305
  { assume asm: "s \<noteq> []"
e93760534354 added directory for journal version; took uptodate version of the theory files
urbanc
parents:
diff changeset
   306
    have "pders (s @ [c]) (STAR r) = pder_set c (pders s (STAR r))" by simp
e93760534354 added directory for journal version; took uptodate version of the theory files
urbanc
parents:
diff changeset
   307
    also have "\<dots> \<subseteq> (pder_set c (\<Union>v\<in>Suf s. SEQS (pders v r) (STAR r)))"
e93760534354 added directory for journal version; took uptodate version of the theory files
urbanc
parents:
diff changeset
   308
      using ih[OF asm] by blast
e93760534354 added directory for journal version; took uptodate version of the theory files
urbanc
parents:
diff changeset
   309
    also have "\<dots> = (\<Union>v\<in>Suf s. pder_set c (SEQS (pders v r) (STAR r)))"
e93760534354 added directory for journal version; took uptodate version of the theory files
urbanc
parents:
diff changeset
   310
      by simp
e93760534354 added directory for journal version; took uptodate version of the theory files
urbanc
parents:
diff changeset
   311
    also have "\<dots> \<subseteq> (\<Union>v\<in>Suf s. (SEQS (pder_set c (pders v r)) (STAR r) \<union> pder c (STAR r)))"
166
7743d2ad71d1 updated theories and itp-paper
urbanc
parents: 162
diff changeset
   312
      using inclusion1 by (auto split: if_splits) 
162
e93760534354 added directory for journal version; took uptodate version of the theory files
urbanc
parents:
diff changeset
   313
    also have "\<dots> = (\<Union>v\<in>Suf s. (SEQS (pder_set c (pders v r)) (STAR r))) \<union> pder c (STAR r)"
e93760534354 added directory for journal version; took uptodate version of the theory files
urbanc
parents:
diff changeset
   314
      using asm by (auto simp add: Suf_def)
e93760534354 added directory for journal version; took uptodate version of the theory files
urbanc
parents:
diff changeset
   315
    also have "\<dots> = (\<Union>v\<in>Suf s. (SEQS (pders (v @ [c]) r) (STAR r))) \<union> (SEQS (pder c r) (STAR r))"
e93760534354 added directory for journal version; took uptodate version of the theory files
urbanc
parents:
diff changeset
   316
      by simp
e93760534354 added directory for journal version; took uptodate version of the theory files
urbanc
parents:
diff changeset
   317
    also have "\<dots> = (\<Union>v\<in>Suf (s @ [c]). (SEQS (pders v r) (STAR r)))"
e93760534354 added directory for journal version; took uptodate version of the theory files
urbanc
parents:
diff changeset
   318
      apply(simp only: Suf)
e93760534354 added directory for journal version; took uptodate version of the theory files
urbanc
parents:
diff changeset
   319
      apply(simp add: Suf_Union pders_singleton)
e93760534354 added directory for journal version; took uptodate version of the theory files
urbanc
parents:
diff changeset
   320
      apply(auto)
e93760534354 added directory for journal version; took uptodate version of the theory files
urbanc
parents:
diff changeset
   321
      done
e93760534354 added directory for journal version; took uptodate version of the theory files
urbanc
parents:
diff changeset
   322
    finally have ?case .
e93760534354 added directory for journal version; took uptodate version of the theory files
urbanc
parents:
diff changeset
   323
  }
e93760534354 added directory for journal version; took uptodate version of the theory files
urbanc
parents:
diff changeset
   324
  moreover
e93760534354 added directory for journal version; took uptodate version of the theory files
urbanc
parents:
diff changeset
   325
  { assume asm: "s = []"
e93760534354 added directory for journal version; took uptodate version of the theory files
urbanc
parents:
diff changeset
   326
    then have ?case
e93760534354 added directory for journal version; took uptodate version of the theory files
urbanc
parents:
diff changeset
   327
      apply(simp add: pders_singleton Suf_def)
e93760534354 added directory for journal version; took uptodate version of the theory files
urbanc
parents:
diff changeset
   328
      apply(auto)
e93760534354 added directory for journal version; took uptodate version of the theory files
urbanc
parents:
diff changeset
   329
      apply(rule_tac x="[c]" in exI)
e93760534354 added directory for journal version; took uptodate version of the theory files
urbanc
parents:
diff changeset
   330
      apply(simp add: pders_singleton)
e93760534354 added directory for journal version; took uptodate version of the theory files
urbanc
parents:
diff changeset
   331
      done
e93760534354 added directory for journal version; took uptodate version of the theory files
urbanc
parents:
diff changeset
   332
  }
e93760534354 added directory for journal version; took uptodate version of the theory files
urbanc
parents:
diff changeset
   333
  ultimately show ?case by blast
e93760534354 added directory for journal version; took uptodate version of the theory files
urbanc
parents:
diff changeset
   334
qed (simp)
e93760534354 added directory for journal version; took uptodate version of the theory files
urbanc
parents:
diff changeset
   335
e93760534354 added directory for journal version; took uptodate version of the theory files
urbanc
parents:
diff changeset
   336
abbreviation 
e93760534354 added directory for journal version; took uptodate version of the theory files
urbanc
parents:
diff changeset
   337
  "UNIV1 \<equiv> UNIV - {[]}"
e93760534354 added directory for journal version; took uptodate version of the theory files
urbanc
parents:
diff changeset
   338
e93760534354 added directory for journal version; took uptodate version of the theory files
urbanc
parents:
diff changeset
   339
lemma pders_set_NULL:
e93760534354 added directory for journal version; took uptodate version of the theory files
urbanc
parents:
diff changeset
   340
  shows "pders_set UNIV1 NULL = {NULL}"
e93760534354 added directory for journal version; took uptodate version of the theory files
urbanc
parents:
diff changeset
   341
by auto
e93760534354 added directory for journal version; took uptodate version of the theory files
urbanc
parents:
diff changeset
   342
e93760534354 added directory for journal version; took uptodate version of the theory files
urbanc
parents:
diff changeset
   343
lemma pders_set_EMPTY:
e93760534354 added directory for journal version; took uptodate version of the theory files
urbanc
parents:
diff changeset
   344
  shows "pders_set UNIV1 EMPTY = {NULL}"
e93760534354 added directory for journal version; took uptodate version of the theory files
urbanc
parents:
diff changeset
   345
by (auto split: if_splits)
e93760534354 added directory for journal version; took uptodate version of the theory files
urbanc
parents:
diff changeset
   346
e93760534354 added directory for journal version; took uptodate version of the theory files
urbanc
parents:
diff changeset
   347
lemma pders_set_CHAR:
e93760534354 added directory for journal version; took uptodate version of the theory files
urbanc
parents:
diff changeset
   348
  shows "pders_set UNIV1 (CHAR c) \<subseteq> {EMPTY, NULL}"
e93760534354 added directory for journal version; took uptodate version of the theory files
urbanc
parents:
diff changeset
   349
by (auto split: if_splits)
e93760534354 added directory for journal version; took uptodate version of the theory files
urbanc
parents:
diff changeset
   350
e93760534354 added directory for journal version; took uptodate version of the theory files
urbanc
parents:
diff changeset
   351
lemma pders_set_ALT:
e93760534354 added directory for journal version; took uptodate version of the theory files
urbanc
parents:
diff changeset
   352
  shows "pders_set UNIV1 (ALT r1 r2) = pders_set UNIV1 r1 \<union> pders_set UNIV1 r2"
e93760534354 added directory for journal version; took uptodate version of the theory files
urbanc
parents:
diff changeset
   353
by auto
e93760534354 added directory for journal version; took uptodate version of the theory files
urbanc
parents:
diff changeset
   354
e93760534354 added directory for journal version; took uptodate version of the theory files
urbanc
parents:
diff changeset
   355
lemma pders_set_SEQ_aux:
e93760534354 added directory for journal version; took uptodate version of the theory files
urbanc
parents:
diff changeset
   356
  assumes a: "s \<in> UNIV1"
e93760534354 added directory for journal version; took uptodate version of the theory files
urbanc
parents:
diff changeset
   357
  shows "pders_set (Suf s) r2 \<subseteq> pders_set UNIV1 r2"
e93760534354 added directory for journal version; took uptodate version of the theory files
urbanc
parents:
diff changeset
   358
using a by (auto simp add: Suf_def)
e93760534354 added directory for journal version; took uptodate version of the theory files
urbanc
parents:
diff changeset
   359
e93760534354 added directory for journal version; took uptodate version of the theory files
urbanc
parents:
diff changeset
   360
lemma pders_set_SEQ:
e93760534354 added directory for journal version; took uptodate version of the theory files
urbanc
parents:
diff changeset
   361
  shows "pders_set UNIV1 (SEQ r1 r2) \<subseteq> SEQS (pders_set UNIV1 r1) r2 \<union> pders_set UNIV1 r2"
e93760534354 added directory for journal version; took uptodate version of the theory files
urbanc
parents:
diff changeset
   362
apply(rule UN_least)
e93760534354 added directory for journal version; took uptodate version of the theory files
urbanc
parents:
diff changeset
   363
apply(rule subset_trans)
e93760534354 added directory for journal version; took uptodate version of the theory files
urbanc
parents:
diff changeset
   364
apply(rule pders_SEQ)
e93760534354 added directory for journal version; took uptodate version of the theory files
urbanc
parents:
diff changeset
   365
apply(simp)
e93760534354 added directory for journal version; took uptodate version of the theory files
urbanc
parents:
diff changeset
   366
apply(rule conjI) 
e93760534354 added directory for journal version; took uptodate version of the theory files
urbanc
parents:
diff changeset
   367
apply(auto)[1]
e93760534354 added directory for journal version; took uptodate version of the theory files
urbanc
parents:
diff changeset
   368
apply(rule subset_trans)
e93760534354 added directory for journal version; took uptodate version of the theory files
urbanc
parents:
diff changeset
   369
apply(rule pders_set_SEQ_aux)
e93760534354 added directory for journal version; took uptodate version of the theory files
urbanc
parents:
diff changeset
   370
apply(auto)
e93760534354 added directory for journal version; took uptodate version of the theory files
urbanc
parents:
diff changeset
   371
done
e93760534354 added directory for journal version; took uptodate version of the theory files
urbanc
parents:
diff changeset
   372
e93760534354 added directory for journal version; took uptodate version of the theory files
urbanc
parents:
diff changeset
   373
lemma pders_set_STAR:
e93760534354 added directory for journal version; took uptodate version of the theory files
urbanc
parents:
diff changeset
   374
  shows "pders_set UNIV1 (STAR r) \<subseteq> SEQS (pders_set UNIV1 r) (STAR r)"
e93760534354 added directory for journal version; took uptodate version of the theory files
urbanc
parents:
diff changeset
   375
apply(rule UN_least)
e93760534354 added directory for journal version; took uptodate version of the theory files
urbanc
parents:
diff changeset
   376
apply(rule subset_trans)
e93760534354 added directory for journal version; took uptodate version of the theory files
urbanc
parents:
diff changeset
   377
apply(rule pders_STAR)
e93760534354 added directory for journal version; took uptodate version of the theory files
urbanc
parents:
diff changeset
   378
apply(simp)
e93760534354 added directory for journal version; took uptodate version of the theory files
urbanc
parents:
diff changeset
   379
apply(simp add: Suf_def)
e93760534354 added directory for journal version; took uptodate version of the theory files
urbanc
parents:
diff changeset
   380
apply(auto)
e93760534354 added directory for journal version; took uptodate version of the theory files
urbanc
parents:
diff changeset
   381
done
e93760534354 added directory for journal version; took uptodate version of the theory files
urbanc
parents:
diff changeset
   382
e93760534354 added directory for journal version; took uptodate version of the theory files
urbanc
parents:
diff changeset
   383
lemma finite_SEQS:
e93760534354 added directory for journal version; took uptodate version of the theory files
urbanc
parents:
diff changeset
   384
  assumes a: "finite A"
e93760534354 added directory for journal version; took uptodate version of the theory files
urbanc
parents:
diff changeset
   385
  shows "finite (SEQS A r)"
e93760534354 added directory for journal version; took uptodate version of the theory files
urbanc
parents:
diff changeset
   386
using a by (auto)
e93760534354 added directory for journal version; took uptodate version of the theory files
urbanc
parents:
diff changeset
   387
e93760534354 added directory for journal version; took uptodate version of the theory files
urbanc
parents:
diff changeset
   388
lemma finite_pders_set_UNIV1:
e93760534354 added directory for journal version; took uptodate version of the theory files
urbanc
parents:
diff changeset
   389
  shows "finite (pders_set UNIV1 r)"
e93760534354 added directory for journal version; took uptodate version of the theory files
urbanc
parents:
diff changeset
   390
apply(induct r)
e93760534354 added directory for journal version; took uptodate version of the theory files
urbanc
parents:
diff changeset
   391
apply(simp)
e93760534354 added directory for journal version; took uptodate version of the theory files
urbanc
parents:
diff changeset
   392
apply(simp only: pders_set_EMPTY)
e93760534354 added directory for journal version; took uptodate version of the theory files
urbanc
parents:
diff changeset
   393
apply(simp)
e93760534354 added directory for journal version; took uptodate version of the theory files
urbanc
parents:
diff changeset
   394
apply(rule finite_subset)
e93760534354 added directory for journal version; took uptodate version of the theory files
urbanc
parents:
diff changeset
   395
apply(rule pders_set_CHAR)
e93760534354 added directory for journal version; took uptodate version of the theory files
urbanc
parents:
diff changeset
   396
apply(simp)
e93760534354 added directory for journal version; took uptodate version of the theory files
urbanc
parents:
diff changeset
   397
apply(rule finite_subset)
e93760534354 added directory for journal version; took uptodate version of the theory files
urbanc
parents:
diff changeset
   398
apply(rule pders_set_SEQ)
e93760534354 added directory for journal version; took uptodate version of the theory files
urbanc
parents:
diff changeset
   399
apply(simp only: finite_SEQS finite_Un)
e93760534354 added directory for journal version; took uptodate version of the theory files
urbanc
parents:
diff changeset
   400
apply(simp)
e93760534354 added directory for journal version; took uptodate version of the theory files
urbanc
parents:
diff changeset
   401
apply(simp only: pders_set_ALT)
e93760534354 added directory for journal version; took uptodate version of the theory files
urbanc
parents:
diff changeset
   402
apply(simp)
e93760534354 added directory for journal version; took uptodate version of the theory files
urbanc
parents:
diff changeset
   403
apply(rule finite_subset)
e93760534354 added directory for journal version; took uptodate version of the theory files
urbanc
parents:
diff changeset
   404
apply(rule pders_set_STAR)
e93760534354 added directory for journal version; took uptodate version of the theory files
urbanc
parents:
diff changeset
   405
apply(simp only: finite_SEQS)
e93760534354 added directory for journal version; took uptodate version of the theory files
urbanc
parents:
diff changeset
   406
done
e93760534354 added directory for journal version; took uptodate version of the theory files
urbanc
parents:
diff changeset
   407
    
e93760534354 added directory for journal version; took uptodate version of the theory files
urbanc
parents:
diff changeset
   408
lemma pders_set_UNIV_UNIV1:
e93760534354 added directory for journal version; took uptodate version of the theory files
urbanc
parents:
diff changeset
   409
  shows "pders_set UNIV r = pders [] r \<union> pders_set UNIV1 r"
e93760534354 added directory for journal version; took uptodate version of the theory files
urbanc
parents:
diff changeset
   410
apply(auto)
e93760534354 added directory for journal version; took uptodate version of the theory files
urbanc
parents:
diff changeset
   411
apply(rule_tac x="[]" in exI)
e93760534354 added directory for journal version; took uptodate version of the theory files
urbanc
parents:
diff changeset
   412
apply(simp)
e93760534354 added directory for journal version; took uptodate version of the theory files
urbanc
parents:
diff changeset
   413
done
e93760534354 added directory for journal version; took uptodate version of the theory files
urbanc
parents:
diff changeset
   414
e93760534354 added directory for journal version; took uptodate version of the theory files
urbanc
parents:
diff changeset
   415
lemma finite_pders_set_UNIV:
e93760534354 added directory for journal version; took uptodate version of the theory files
urbanc
parents:
diff changeset
   416
  shows "finite (pders_set UNIV r)"
e93760534354 added directory for journal version; took uptodate version of the theory files
urbanc
parents:
diff changeset
   417
unfolding pders_set_UNIV_UNIV1
e93760534354 added directory for journal version; took uptodate version of the theory files
urbanc
parents:
diff changeset
   418
by (simp add: finite_pders_set_UNIV1)
e93760534354 added directory for journal version; took uptodate version of the theory files
urbanc
parents:
diff changeset
   419
e93760534354 added directory for journal version; took uptodate version of the theory files
urbanc
parents:
diff changeset
   420
lemma finite_pders_set:
e93760534354 added directory for journal version; took uptodate version of the theory files
urbanc
parents:
diff changeset
   421
  shows "finite (pders_set A r)"
e93760534354 added directory for journal version; took uptodate version of the theory files
urbanc
parents:
diff changeset
   422
apply(rule rev_finite_subset)
e93760534354 added directory for journal version; took uptodate version of the theory files
urbanc
parents:
diff changeset
   423
apply(rule_tac r="r" in finite_pders_set_UNIV)
e93760534354 added directory for journal version; took uptodate version of the theory files
urbanc
parents:
diff changeset
   424
apply(auto)
e93760534354 added directory for journal version; took uptodate version of the theory files
urbanc
parents:
diff changeset
   425
done
e93760534354 added directory for journal version; took uptodate version of the theory files
urbanc
parents:
diff changeset
   426
e93760534354 added directory for journal version; took uptodate version of the theory files
urbanc
parents:
diff changeset
   427
lemma finite_pders:
e93760534354 added directory for journal version; took uptodate version of the theory files
urbanc
parents:
diff changeset
   428
  shows "finite (pders s r)"
e93760534354 added directory for journal version; took uptodate version of the theory files
urbanc
parents:
diff changeset
   429
using finite_pders_set[where A="{s}" and r="r"]
e93760534354 added directory for journal version; took uptodate version of the theory files
urbanc
parents:
diff changeset
   430
by simp
e93760534354 added directory for journal version; took uptodate version of the theory files
urbanc
parents:
diff changeset
   431
e93760534354 added directory for journal version; took uptodate version of the theory files
urbanc
parents:
diff changeset
   432
lemma finite_pders2:
e93760534354 added directory for journal version; took uptodate version of the theory files
urbanc
parents:
diff changeset
   433
  shows "finite {pders s r | s. s \<in> A}"
e93760534354 added directory for journal version; took uptodate version of the theory files
urbanc
parents:
diff changeset
   434
proof -
e93760534354 added directory for journal version; took uptodate version of the theory files
urbanc
parents:
diff changeset
   435
  have "{pders s r | s. s \<in> A} \<subseteq> Pow (pders_set A r)" by auto
e93760534354 added directory for journal version; took uptodate version of the theory files
urbanc
parents:
diff changeset
   436
  moreover
e93760534354 added directory for journal version; took uptodate version of the theory files
urbanc
parents:
diff changeset
   437
  have "finite (Pow (pders_set A r))"
e93760534354 added directory for journal version; took uptodate version of the theory files
urbanc
parents:
diff changeset
   438
    using finite_pders_set by simp
e93760534354 added directory for journal version; took uptodate version of the theory files
urbanc
parents:
diff changeset
   439
  ultimately 
e93760534354 added directory for journal version; took uptodate version of the theory files
urbanc
parents:
diff changeset
   440
  show "finite {pders s r | s. s \<in> A}"
e93760534354 added directory for journal version; took uptodate version of the theory files
urbanc
parents:
diff changeset
   441
    by(rule finite_subset)
e93760534354 added directory for journal version; took uptodate version of the theory files
urbanc
parents:
diff changeset
   442
qed
e93760534354 added directory for journal version; took uptodate version of the theory files
urbanc
parents:
diff changeset
   443
e93760534354 added directory for journal version; took uptodate version of the theory files
urbanc
parents:
diff changeset
   444
e93760534354 added directory for journal version; took uptodate version of the theory files
urbanc
parents:
diff changeset
   445
lemma Myhill_Nerode3:
e93760534354 added directory for journal version; took uptodate version of the theory files
urbanc
parents:
diff changeset
   446
  fixes r::"rexp"
166
7743d2ad71d1 updated theories and itp-paper
urbanc
parents: 162
diff changeset
   447
  shows "finite (UNIV // \<approx>(L_rexp r))"
162
e93760534354 added directory for journal version; took uptodate version of the theory files
urbanc
parents:
diff changeset
   448
proof -
e93760534354 added directory for journal version; took uptodate version of the theory files
urbanc
parents:
diff changeset
   449
  have "finite (UNIV // =(\<lambda>x. pders x r)=)"
e93760534354 added directory for journal version; took uptodate version of the theory files
urbanc
parents:
diff changeset
   450
  proof - 
166
7743d2ad71d1 updated theories and itp-paper
urbanc
parents: 162
diff changeset
   451
    have "range (\<lambda>x. pders x r) = {pders s r | s. s \<in> UNIV}" by auto
162
e93760534354 added directory for journal version; took uptodate version of the theory files
urbanc
parents:
diff changeset
   452
    moreover 
e93760534354 added directory for journal version; took uptodate version of the theory files
urbanc
parents:
diff changeset
   453
    have "finite {pders s r | s. s \<in> UNIV}" by (rule finite_pders2)
e93760534354 added directory for journal version; took uptodate version of the theory files
urbanc
parents:
diff changeset
   454
    ultimately
e93760534354 added directory for journal version; took uptodate version of the theory files
urbanc
parents:
diff changeset
   455
    have "finite (range (\<lambda>x. pders x r))"
166
7743d2ad71d1 updated theories and itp-paper
urbanc
parents: 162
diff changeset
   456
      by simp
162
e93760534354 added directory for journal version; took uptodate version of the theory files
urbanc
parents:
diff changeset
   457
    then show "finite (UNIV // =(\<lambda>x. pders x r)=)" 
e93760534354 added directory for journal version; took uptodate version of the theory files
urbanc
parents:
diff changeset
   458
      by (rule finite_eq_tag_rel)
e93760534354 added directory for journal version; took uptodate version of the theory files
urbanc
parents:
diff changeset
   459
  qed
e93760534354 added directory for journal version; took uptodate version of the theory files
urbanc
parents:
diff changeset
   460
  moreover 
166
7743d2ad71d1 updated theories and itp-paper
urbanc
parents: 162
diff changeset
   461
  have "=(\<lambda>x. pders x r)= \<subseteq> \<approx>(L_rexp r)"
162
e93760534354 added directory for journal version; took uptodate version of the theory files
urbanc
parents:
diff changeset
   462
    unfolding tag_eq_rel_def
166
7743d2ad71d1 updated theories and itp-paper
urbanc
parents: 162
diff changeset
   463
    unfolding str_eq_def2
7743d2ad71d1 updated theories and itp-paper
urbanc
parents: 162
diff changeset
   464
    unfolding MN_Rel_Ders
7743d2ad71d1 updated theories and itp-paper
urbanc
parents: 162
diff changeset
   465
    unfolding Ders_pders
7743d2ad71d1 updated theories and itp-paper
urbanc
parents: 162
diff changeset
   466
    by auto
162
e93760534354 added directory for journal version; took uptodate version of the theory files
urbanc
parents:
diff changeset
   467
  moreover 
e93760534354 added directory for journal version; took uptodate version of the theory files
urbanc
parents:
diff changeset
   468
  have "equiv UNIV =(\<lambda>x. pders x r)="
e93760534354 added directory for journal version; took uptodate version of the theory files
urbanc
parents:
diff changeset
   469
    unfolding equiv_def refl_on_def sym_def trans_def
e93760534354 added directory for journal version; took uptodate version of the theory files
urbanc
parents:
diff changeset
   470
    unfolding tag_eq_rel_def
e93760534354 added directory for journal version; took uptodate version of the theory files
urbanc
parents:
diff changeset
   471
    by auto
e93760534354 added directory for journal version; took uptodate version of the theory files
urbanc
parents:
diff changeset
   472
  moreover
166
7743d2ad71d1 updated theories and itp-paper
urbanc
parents: 162
diff changeset
   473
  have "equiv UNIV (\<approx>(L_rexp r))"
162
e93760534354 added directory for journal version; took uptodate version of the theory files
urbanc
parents:
diff changeset
   474
    unfolding equiv_def refl_on_def sym_def trans_def
e93760534354 added directory for journal version; took uptodate version of the theory files
urbanc
parents:
diff changeset
   475
    unfolding str_eq_rel_def
e93760534354 added directory for journal version; took uptodate version of the theory files
urbanc
parents:
diff changeset
   476
    by auto
166
7743d2ad71d1 updated theories and itp-paper
urbanc
parents: 162
diff changeset
   477
  ultimately show "finite (UNIV // \<approx>(L_rexp r))" 
162
e93760534354 added directory for journal version; took uptodate version of the theory files
urbanc
parents:
diff changeset
   478
    by (rule refined_partition_finite)
e93760534354 added directory for journal version; took uptodate version of the theory files
urbanc
parents:
diff changeset
   479
qed
e93760534354 added directory for journal version; took uptodate version of the theory files
urbanc
parents:
diff changeset
   480
e93760534354 added directory for journal version; took uptodate version of the theory files
urbanc
parents:
diff changeset
   481
166
7743d2ad71d1 updated theories and itp-paper
urbanc
parents: 162
diff changeset
   482
section {* Relating derivatives and partial derivatives *}
162
e93760534354 added directory for journal version; took uptodate version of the theory files
urbanc
parents:
diff changeset
   483
e93760534354 added directory for journal version; took uptodate version of the theory files
urbanc
parents:
diff changeset
   484
lemma
166
7743d2ad71d1 updated theories and itp-paper
urbanc
parents: 162
diff changeset
   485
  shows "(\<Union> L_rexp ` (pder c r)) = L_rexp (der c r)"
162
e93760534354 added directory for journal version; took uptodate version of the theory files
urbanc
parents:
diff changeset
   486
unfolding Der_der[symmetric] Der_pder by simp
e93760534354 added directory for journal version; took uptodate version of the theory files
urbanc
parents:
diff changeset
   487
e93760534354 added directory for journal version; took uptodate version of the theory files
urbanc
parents:
diff changeset
   488
lemma
166
7743d2ad71d1 updated theories and itp-paper
urbanc
parents: 162
diff changeset
   489
  shows "(\<Union> L_rexp ` (pders s r)) = L_rexp (ders s r)"
162
e93760534354 added directory for journal version; took uptodate version of the theory files
urbanc
parents:
diff changeset
   490
unfolding Ders_ders[symmetric] Ders_pders by simp
e93760534354 added directory for journal version; took uptodate version of the theory files
urbanc
parents:
diff changeset
   491
e93760534354 added directory for journal version; took uptodate version of the theory files
urbanc
parents:
diff changeset
   492
end