src/HOL/W0/Maybe.ML
author nipkow
Thu, 24 Apr 1997 18:51:14 +0200
changeset 3044 3e3087aa69e7
parent 2520 aecaa76e7eff
child 3919 c036caebfc75
permissions -rw-r--r--
Updates because nat_ind_tac no longer appends "1" to the ind.var.

(* Title:     HOL/W0/Maybe.ML
   ID:        $Id$
   Author:    Dieter Nazareth and Tobias Nipkow
   Copyright  1995 TU Muenchen
*)


(* constructor laws for bind *)
goalw thy [bind_def] "(Ok s) bind f = (f s)";
by (Simp_tac 1);
qed "bind_Ok";

goalw thy [bind_def] "Fail bind f = Fail";
by (Simp_tac 1);
qed "bind_Fail";

Addsimps [bind_Ok,bind_Fail];

(* expansion of bind *)
goal thy
  "P(res bind f) = ((res = Fail --> P Fail) & (!s. res = Ok s --> P(f s)))";
by (maybe.induct_tac "res" 1);
by (fast_tac (HOL_cs addss !simpset) 1);
by (Asm_simp_tac 1);
qed "expand_bind";

goal Maybe.thy
  "((m bind f) = Fail) = ((m=Fail) | (? p. m = Ok p & f p = Fail))";
by (simp_tac (!simpset setloop (split_tac [expand_bind])) 1);
qed "bind_eq_Fail";

Addsimps [bind_eq_Fail];