equal
  deleted
  inserted
  replaced
  
    
    
|    474 lemma eval_single [simp]: |    474 lemma eval_single [simp]: | 
|    475   "eval (single x) = (op =) x" |    475   "eval (single x) = (op =) x" | 
|    476   by (simp add: single_def) |    476   by (simp add: single_def) | 
|    477  |    477  | 
|    478 definition bind :: "'a pred \<Rightarrow> ('a \<Rightarrow> 'b pred) \<Rightarrow> 'b pred" (infixl "\<guillemotright>=" 70) where |    478 definition bind :: "'a pred \<Rightarrow> ('a \<Rightarrow> 'b pred) \<Rightarrow> 'b pred" (infixl "\<guillemotright>=" 70) where | 
|    479   "P \<guillemotright>= f = (SUPR (Predicate.eval P) f)" |    479   "P \<guillemotright>= f = (SUPR {x. Predicate.eval P x} f)" | 
|    480  |    480  | 
|    481 lemma eval_bind [simp]: |    481 lemma eval_bind [simp]: | 
|    482   "eval (P \<guillemotright>= f) = Predicate.eval (SUPR (Predicate.eval P) f)" |    482   "eval (P \<guillemotright>= f) = Predicate.eval (SUPR {x. Predicate.eval P x} f)" | 
|    483   by (simp add: bind_def) |    483   by (simp add: bind_def) | 
|    484  |    484  | 
|    485 lemma bind_bind: |    485 lemma bind_bind: | 
|    486   "(P \<guillemotright>= Q) \<guillemotright>= R = P \<guillemotright>= (\<lambda>x. Q x \<guillemotright>= R)" |    486   "(P \<guillemotright>= Q) \<guillemotright>= R = P \<guillemotright>= (\<lambda>x. Q x \<guillemotright>= R)" | 
|    487   by (rule pred_eqI) simp |    487   by (rule pred_eqI) auto | 
|    488  |    488  | 
|    489 lemma bind_single: |    489 lemma bind_single: | 
|    490   "P \<guillemotright>= single = P" |    490   "P \<guillemotright>= single = P" | 
|    491   by (rule pred_eqI) auto |    491   by (rule pred_eqI) auto | 
|    492  |    492  | 
|    494   "single x \<guillemotright>= P = P x" |    494   "single x \<guillemotright>= P = P x" | 
|    495   by (rule pred_eqI) auto |    495   by (rule pred_eqI) auto | 
|    496  |    496  | 
|    497 lemma bottom_bind: |    497 lemma bottom_bind: | 
|    498   "\<bottom> \<guillemotright>= P = \<bottom>" |    498   "\<bottom> \<guillemotright>= P = \<bottom>" | 
|    499   by (rule pred_eqI) simp |    499   by (rule pred_eqI) auto | 
|    500  |    500  | 
|    501 lemma sup_bind: |    501 lemma sup_bind: | 
|    502   "(P \<squnion> Q) \<guillemotright>= R = P \<guillemotright>= R \<squnion> Q \<guillemotright>= R" |    502   "(P \<squnion> Q) \<guillemotright>= R = P \<guillemotright>= R \<squnion> Q \<guillemotright>= R" | 
|    503   by (rule pred_eqI) simp |    503   by (rule pred_eqI) auto | 
|    504  |    504  | 
|    505 lemma Sup_bind: |    505 lemma Sup_bind: | 
|    506   "(\<Squnion>A \<guillemotright>= f) = \<Squnion>((\<lambda>x. x \<guillemotright>= f) ` A)" |    506   "(\<Squnion>A \<guillemotright>= f) = \<Squnion>((\<lambda>x. x \<guillemotright>= f) ` A)" | 
|    507   by (rule pred_eqI) simp |    507   by (rule pred_eqI) auto | 
|    508  |    508  | 
|    509 lemma pred_iffI: |    509 lemma pred_iffI: | 
|    510   assumes "\<And>x. eval A x \<Longrightarrow> eval B x" |    510   assumes "\<And>x. eval A x \<Longrightarrow> eval B x" | 
|    511   and "\<And>x. eval B x \<Longrightarrow> eval A x" |    511   and "\<And>x. eval B x \<Longrightarrow> eval A x" | 
|    512   shows "A = B" |    512   shows "A = B" | 
|    931  |    931  | 
|    932 definition the :: "'a pred => 'a" |    932 definition the :: "'a pred => 'a" | 
|    933 where |    933 where | 
|    934   "the A = (THE x. eval A x)" |    934   "the A = (THE x. eval A x)" | 
|    935  |    935  | 
|    936 lemma the_eq[code]: "the A = singleton (\<lambda>x. not_unique A) A" |    936 lemma the_eqI: | 
|    937 by (auto simp add: the_def singleton_def not_unique_def) |    937   "(THE x. Predicate.eval P x) = x \<Longrightarrow> Predicate.the P = x" | 
|         |    938   by (simp add: the_def) | 
|         |    939  | 
|         |    940 lemma the_eq [code]: "the A = singleton (\<lambda>x. not_unique A) A" | 
|         |    941   by (rule the_eqI) (simp add: singleton_def not_unique_def) | 
|    938  |    942  | 
|    939 code_abort not_unique |    943 code_abort not_unique | 
|    940  |    944  | 
|    941 code_reflect Predicate |    945 code_reflect Predicate | 
|    942   datatypes pred = Seq and seq = Empty | Insert | Join |    946   datatypes pred = Seq and seq = Empty | Insert | Join |