src/HOL/Predicate_Compile_Examples/Reg_Exp_Example.thy
changeset 58310 91ea607a34d8
parent 58249 180f1b3508ed
child 63167 0909deb8059b
equal deleted inserted replaced
58309:a09ec6daaa19 58310:91ea607a34d8
     7 text {* An example from the experiments from SmallCheck (@{url "http://www.cs.york.ac.uk/fp/smallcheck/"}) *}
     7 text {* An example from the experiments from SmallCheck (@{url "http://www.cs.york.ac.uk/fp/smallcheck/"}) *}
     8 text {* The example (original in Haskell) was imported with Haskabelle and
     8 text {* The example (original in Haskell) was imported with Haskabelle and
     9   manually slightly adapted.
     9   manually slightly adapted.
    10 *}
    10 *}
    11  
    11  
    12 datatype_new Nat = Zer
    12 datatype Nat = Zer
    13              | Suc Nat
    13              | Suc Nat
    14 
    14 
    15 fun sub :: "Nat \<Rightarrow> Nat \<Rightarrow> Nat"
    15 fun sub :: "Nat \<Rightarrow> Nat \<Rightarrow> Nat"
    16 where
    16 where
    17   "sub x y = (case y of
    17   "sub x y = (case y of
    18                  Zer \<Rightarrow> x
    18                  Zer \<Rightarrow> x
    19                | Suc y' \<Rightarrow> case x of
    19                | Suc y' \<Rightarrow> case x of
    20                                          Zer \<Rightarrow> Zer
    20                                          Zer \<Rightarrow> Zer
    21                                        | Suc x' \<Rightarrow> sub x' y')"
    21                                        | Suc x' \<Rightarrow> sub x' y')"
    22 
    22 
    23 datatype_new Sym = N0
    23 datatype Sym = N0
    24              | N1 Sym
    24              | N1 Sym
    25 
    25 
    26 datatype_new RE = Sym Sym
    26 datatype RE = Sym Sym
    27             | Or RE RE
    27             | Or RE RE
    28             | Seq RE RE
    28             | Seq RE RE
    29             | And RE RE
    29             | And RE RE
    30             | Star RE
    30             | Star RE
    31             | Empty
    31             | Empty