src/HOL/MiniML/Maybe.ML
author nipkow
Fri, 24 Nov 2000 16:49:27 +0100
changeset 10519 ade64af4c57c
parent 5184 9b8547a9496a
permissions -rw-r--r--
hide many names from Datatype_Universe.

(* Title:     HOL/MiniML/Maybe.ML
   ID:        $Id$
   Author:    Wolfgang Naraschewski and Tobias Nipkow
   Copyright  1996 TU Muenchen
*)

(* constructor laws for option_bind *)
Goalw [option_bind_def] "option_bind (Some s) f = (f s)";
by (Simp_tac 1);
qed "option_bind_Some";

Goalw [option_bind_def] "option_bind None f = None";
by (Simp_tac 1);
qed "option_bind_None";

Addsimps [option_bind_Some,option_bind_None];

(* expansion of option_bind *)
Goalw [option_bind_def] "P(option_bind res f) = \
\         ((res = None --> P None) & (!s. res = Some s --> P(f s)))";
by (rtac option.split 1);
qed "split_option_bind";

Goal
  "((option_bind m f) = None) = ((m=None) | (? p. m = Some p & f p = None))";
by (simp_tac (simpset() addsplits [split_option_bind]) 1);
qed "option_bind_eq_None";

Addsimps [option_bind_eq_None];

(* auxiliary lemma *)
Goal "(y = Some x) = (Some x = y)";
by ( simp_tac (simpset() addsimps [eq_sym_conv]) 1);
qed "rotate_Some";