more on paper; modified schs functions; it is still compatible with the old definition
(* Author: Tobias Nipkow
Copyright 1998 TUM
*)
header "Regular expressions"
theory Regular_Exp
imports Regular_Set
begin
datatype 'a rexp =
Zero |
One |
Atom 'a |
Plus "('a rexp)" "('a rexp)" |
Times "('a rexp)" "('a rexp)" |
Star "('a rexp)"
primrec lang :: "'a rexp => 'a lang" where
"lang Zero = {}" |
"lang One = {[]}" |
"lang (Atom a) = {[a]}" |
"lang (Plus r s) = (lang r) Un (lang s)" |
"lang (Times r s) = conc (lang r) (lang s)" |
"lang (Star r) = star(lang r)"
primrec atoms :: "'a rexp \<Rightarrow> 'a set"
where
"atoms Zero = {}" |
"atoms One = {}" |
"atoms (Atom a) = {a}" |
"atoms (Plus r s) = atoms r \<union> atoms s" |
"atoms (Times r s) = atoms r \<union> atoms s" |
"atoms (Star r) = atoms r"
end