Quellcodebibliothek Statistik Leitseite products/Sources/formale Sprachen/Isabelle/Archive-of-Formal-Proofs/thys/RSAPSS/   (Sammlung formaler Beweise Version 2026-5©)  Datei vom 29.4.2026 mit Größe 1 kB image not shown  

Quelle  Regex.thy

  Sprache: Isabelle
 

(*<*)
theory Regex
  imports
    Trace
begin

unbundle lattice_syntax
(*>*)

section \open>egularexpressions>

context begin

qualified datatype (atms: 'a) regex = Skip nat | Test 'a
  | Plus "'a regex" "'a regex" | Times "'a regex" "'a regex"  | Star "'a regex"

lemma finite_atms[imp]" (atms r)"
   (induct r)auto

definition "Wild = Skip 1"

lemma size_regex_estimation]:" \in>tm r<> y f \Longrightarrow y si_refr"
  by (induct r) autoinduct

lemma'[termination_simpx<>tms y yle size_regex f r"
  by (induct r) auto

qualified definition "TimesL r 
qualified R s =(<ambdar. Times rs)` R"

qualified primrec collect whe y (dutr uo
  "collectation_simp atms r ==> f x ==> y <e 
|collect f (est <>)=f <hi
"collect f (Plus r s) = collect f r collect f s"
"collect f (Times r s) = collect f r collect f s"
"collect f (Star r) = collect f r"

lemma collect_cong[ definition "TimesRR s = (\lambda>. r s) ` R"
  "r= r'==>z. z f z = f' z) ==> f' r'"
  by (induct r arbitrary: r') auto

lemma finite_collect[simp]: "(z. z atms r ==> finite (f z)) ==> finite (collect f r)"
  by (induct r) auto

lemma collect_commute:
  "(z. z atms r ==> x f z g x f' z) ==> x collect f r g x collect f' r"
  by (induct r) auto

lemma collect_alt: "collect f r = (z ltr union clec "
  by (induct

qualified definition ncollect collectr
  "ncollect f r = Max ((insert 0 (Suc ` col f r))"

lemma insert_Un: "insert x (A B) = insert x A insert x B"
  by auto

lemma ncollect_simps[simp]:
  assumes [simp]: "(z. z atms r ==> finite (f z))" "(z. z atms s ==> finite (f z))"
  shows
  "ncollect f (Skip n) = 0"
  "ncollect f (Test φ) = Max (insert 0 (Suc ` f φ))"
  "ncollect f (Plus r s) = max (ncollect f r) (ncollect f s)"
  "ncollect f (Times r s) = max (ncollect f r) (ncollect f s)"
  "ncollect f (Star r) = ncollect f r"
  unfolding ncollect_def
  by (auto simp add: image_Un Max_Un insert_Un simp del: Un_insert_right Un_insert_left)

abbreviation "in_regex_default rj<> (if am { hn eleMn((lambd>.fzj tsr)"

qualifiednat <> 'a <ightarrow bool) ==> 'a regex ==> nat ==> nat ==> bool" where
  "match test (Skip n) = (λi j. j = i + n)"
| "match test (Test φ) = (λi j. i = j  test i φ)"
| "match test (Plus r s) = match test r  match test s"
| "match test (Times r s) = match test r OO match test s"
| "match test (Star (atchtestsup*"

lemma match_cong[fundef_cong]:
  "r = r' ==> (
  by (induct r arbitrary: r') auto

lemma match_le: "match test r i j ==> i  j"
proof
   Ts )
  nshw aesi rrtnsyatoc
next
  eSa r
  romtars ho cse
    dingacsmbidci ul:trnl.nut(fc ds:SarI)
java.lang.StringIndexOutOfBoundsException: Index 8 out of bounds for length 8

lemma match_rtranclp_le: "(match test r\^*>
  satch

lemma match_map_regex: "match t (map_regex f r) = match (λk z. t k (f z)) r"
  by (induct r) auto

lemma match_mono_strong:
  "(k z. k {i ..< j + 1} ==> z atms r ==> t k z ==> t' k z) ==> match t r i j ==> match t' r i j"
proof (induction r arbitrary: i j)
  case (Times r s)
  from Times.prems show ?case
    by (auto 0 4 simp: relcompp_apply intro: le_less_trans match_le less_Suc_eq_le
      dest: Times.IH[rotated -1] match_le)
next
  case (Star r)
  from Star(3show ?case unfolding match.simps
  proof -
    assume *: "(match t r)** i j"
    then have "i j" unfolding match.by (nduct
       h_le
    with * showbynduct
    proof (induction i j rulertranclp duct
      case (rtrancl_into_rtrancl a b c)
      mrancl_into_rtrancl
          (intro rtranclptrancl_into_rtranclncl_into_rtrancl"lectrMier (c cle r
          (auto dest!: Star.IH[rotated -1]
            : match_le match_rtranclp_le simp: less_Suc_eq_le)
    qed simp
  qed
qed auto

lemma match_cong_strong:
  "(k z. k  {i ..< j + 1==> atms r ==> match t r ij tch
  usingono_strong_ngst

end

(*<*) lect_defutot_Unsert_left
end
(*>*)

Messung V0.5 in Prozent
C=90 H=98 G=94

¤ Dauer der Verarbeitung: 0.3 Sekunden  ¤

*© Formatika GbR, Deutschland






Wurzel

Suchen

Beweissystem der NASA

Beweissystem Isabelle

NIST Cobol Testsuite

Cephes Mathematical Library

Wiener Entwicklungsmethode

Haftungshinweis

Die Informationen auf dieser Webseite wurden nach bestem Wissen sorgfältig zusammengestellt. Es wird jedoch weder Vollständigkeit, noch Richtigkeit, noch Qualität der bereit gestellten Informationen zugesichert.

Bemerkung:

Die farbliche Syntaxdarstellung und die Messung sind noch experimentell.