src/HOL/Predicate.thy
changeset 58310 91ea607a34d8
parent 58152 6fe60a9a5bad
child 58334 7553a1bcecb7
equal deleted inserted replaced
58309:a09ec6daaa19 58310:91ea607a34d8
     8 imports String
     8 imports String
     9 begin
     9 begin
    10 
    10 
    11 subsection {* The type of predicate enumerations (a monad) *}
    11 subsection {* The type of predicate enumerations (a monad) *}
    12 
    12 
    13 datatype_new 'a pred = Pred "'a \<Rightarrow> bool"
    13 datatype 'a pred = Pred "'a \<Rightarrow> bool"
    14 
    14 
    15 primrec eval :: "'a pred \<Rightarrow> 'a \<Rightarrow> bool" where
    15 primrec eval :: "'a pred \<Rightarrow> 'a \<Rightarrow> bool" where
    16   eval_pred: "eval (Pred f) = f"
    16   eval_pred: "eval (Pred f) = f"
    17 
    17 
    18 lemma Pred_eval [simp]:
    18 lemma Pred_eval [simp]:
   400   by (rule ext, rule pred_eqI, auto)+
   400   by (rule ext, rule pred_eqI, auto)+
   401 
   401 
   402 
   402 
   403 subsection {* Implementation *}
   403 subsection {* Implementation *}
   404 
   404 
   405 datatype_new 'a seq = Empty | Insert "'a" "'a pred" | Join "'a pred" "'a seq"
   405 datatype 'a seq = Empty | Insert "'a" "'a pred" | Join "'a pred" "'a seq"
   406 
   406 
   407 primrec pred_of_seq :: "'a seq \<Rightarrow> 'a pred" where
   407 primrec pred_of_seq :: "'a seq \<Rightarrow> 'a pred" where
   408   "pred_of_seq Empty = \<bottom>"
   408   "pred_of_seq Empty = \<bottom>"
   409 | "pred_of_seq (Insert x P) = single x \<squnion> P"
   409 | "pred_of_seq (Insert x P) = single x \<squnion> P"
   410 | "pred_of_seq (Join P xq) = P \<squnion> pred_of_seq xq"
   410 | "pred_of_seq (Join P xq) = P \<squnion> pred_of_seq xq"