# HG changeset patch # User huffman # Date 1274310521 25200 # Node ID 9316a18ec9319ec6b461e881838a2b3c2109a139 # Parent ca3172dbde8bcb92f3947719453ae191350d8d10 remove unnecessary constant Fixrec.bind diff -r ca3172dbde8b -r 9316a18ec931 src/HOLCF/Fixrec.thy --- a/src/HOLCF/Fixrec.thy Wed May 19 14:38:25 2010 -0700 +++ b/src/HOLCF/Fixrec.thy Wed May 19 16:08:41 2010 -0700 @@ -65,30 +65,6 @@ == "CONST maybe_when\t1\(\ x. t2)\m" -subsubsection {* Monadic bind operator *} - -definition - bind :: "'a maybe \ ('a \ 'b maybe) \ 'b maybe" where - "bind = (\ m f. case m of fail \ fail | return\x \ f\x)" - -text {* monad laws *} - -lemma bind_strict [simp]: "bind\\\f = \" -by (simp add: bind_def) - -lemma bind_fail [simp]: "bind\fail\f = fail" -by (simp add: bind_def) - -lemma left_unit [simp]: "bind\(return\a)\k = k\a" -by (simp add: bind_def) - -lemma right_unit [simp]: "bind\m\return = m" -by (rule_tac p=m in maybeE, simp_all) - -lemma bind_assoc: - "bind\(bind\m\k)\h = bind\m\(\ a. bind\(k\a)\h)" -by (rule_tac p=m in maybeE, simp_all) - subsubsection {* Run operator *} definition @@ -169,7 +145,7 @@ definition branch :: "('a \ 'b maybe) \ ('b \ 'c) \ ('a \ 'c maybe)" where - "branch p \ \ r x. bind\(p\x)\(\ y. return\(r\y))" + "branch p \ \ r x. maybe_when\fail\(\ y. return\(r\y))\(p\x)" lemma branch_rews: "p\x = \ \ branch p\r\x = \" @@ -277,7 +253,7 @@ definition cpair_pat :: "('a, 'c) pat \ ('b, 'd) pat \ ('a \ 'b, 'c \ 'd) pat" where "cpair_pat p1 p2 = (\(x, y). - bind\(p1\x)\(\ a. bind\(p2\y)\(\ b. return\(a, b))))" + maybe_when\fail\(\ a. maybe_when\fail\(\ b. return\(a, b))\(p2\y))\(p1\x))" definition spair_pat :: @@ -425,7 +401,7 @@ definition as_pat :: "('a \ 'b maybe) \ 'a \ ('a \ 'b) maybe" where - "as_pat p = (\ x. bind\(p\x)\(\ a. return\(x, a)))" + "as_pat p = (\ x. maybe_when\fail\(\ a. return\(x, a))\(p\x))" definition lazy_pat :: "('a \ 'b::pcpo maybe) \ ('a \ 'b maybe)" where @@ -608,7 +584,7 @@ (@{const_name UU}, @{const_name match_UU}) ] *} -hide_const (open) return bind fail run cases +hide_const (open) return fail run cases lemmas [fixrec_simp] = run_strict run_fail run_return diff -r ca3172dbde8b -r 9316a18ec931 src/HOLCF/Tools/Domain/domain_constructors.ML --- a/src/HOLCF/Tools/Domain/domain_constructors.ML Wed May 19 14:38:25 2010 -0700 +++ b/src/HOLCF/Tools/Domain/domain_constructors.ML Wed May 19 16:08:41 2010 -0700 @@ -952,7 +952,7 @@ val (fun1, fun2, taken) = pat_lhs (pat, args); val defs = @{thm branch_def} :: pat_defs; val goal = mk_trp (mk_strict fun1); - val rules = @{thm Fixrec.bind_strict} :: case_rews; + val rules = @{thms maybe_when_rews} @ case_rews; val tacs = [simp_tac (beta_ss addsimps rules) 1]; in prove thy defs goal (K tacs) end; fun pat_apps (i, (pat, (con, args))) = @@ -967,7 +967,7 @@ val concl = mk_trp (mk_eq (fun1 ` con_app, rhs)); val goal = Logic.list_implies (assms, concl); val defs = @{thm branch_def} :: pat_defs; - val rules = @{thms bind_fail left_unit} @ case_rews; + val rules = @{thms maybe_when_rews} @ case_rews; val tacs = [asm_simp_tac (beta_ss addsimps rules) 1]; in prove thy defs goal (K tacs) end; in map_index pat_app spec end;