src/CTT/Bool.ML
author lcp
Wed May 04 17:47:30 1994 +0200 (1994-05-04)
changeset 360 2b74eebdbdb8
parent 0 a5a9c433f639
child 1294 1358dc040edb
permissions -rw-r--r--
Bool.ML: replaced many rewrite_goals_tac calls by prove_goalw
clasohm@0
     1
(*  Title: 	CTT/bool
clasohm@0
     2
    ID:         $Id$
clasohm@0
     3
    Author: 	Lawrence C Paulson, Cambridge University Computer Laboratory
clasohm@0
     4
    Copyright   1991  University of Cambridge
clasohm@0
     5
clasohm@0
     6
Theorems for bool.thy (booleans and conditionals)
clasohm@0
     7
*)
clasohm@0
     8
clasohm@0
     9
open Bool;
clasohm@0
    10
clasohm@0
    11
val bool_defs = [Bool_def,true_def,false_def,cond_def];
clasohm@0
    12
clasohm@0
    13
(*Derivation of rules for the type Bool*)
clasohm@0
    14
clasohm@0
    15
(*formation rule*)
lcp@360
    16
val boolF = prove_goalw Bool.thy bool_defs 
clasohm@0
    17
    "Bool type"
lcp@360
    18
 (fn _ => [ (typechk_tac []) ]);
clasohm@0
    19
clasohm@0
    20
clasohm@0
    21
(*introduction rules for true, false*)
clasohm@0
    22
lcp@360
    23
val boolI_true = prove_goalw Bool.thy bool_defs 
clasohm@0
    24
    "true : Bool"
lcp@360
    25
 (fn _ => [ (typechk_tac []) ]);
clasohm@0
    26
lcp@360
    27
val boolI_false = prove_goalw Bool.thy bool_defs 
clasohm@0
    28
    "false : Bool"
lcp@360
    29
 (fn _ => [ (typechk_tac []) ]);
clasohm@0
    30
clasohm@0
    31
(*elimination rule: typing of cond*)
lcp@360
    32
val boolE = prove_goalw Bool.thy bool_defs 
lcp@360
    33
    "!!C. [| p:Bool;  a : C(true);  b : C(false) |] ==> cond(p,a,b) : C(p)"
lcp@360
    34
 (fn _ =>
lcp@360
    35
  [ (typechk_tac []),
clasohm@0
    36
    (ALLGOALS (etac TE)),
lcp@360
    37
    (typechk_tac []) ]);
clasohm@0
    38
lcp@360
    39
val boolEL = prove_goalw Bool.thy bool_defs 
lcp@360
    40
    "!!C. [| p = q : Bool;  a = c : C(true);  b = d : C(false) |] ==> \
lcp@360
    41
\         cond(p,a,b) = cond(q,c,d) : C(p)"
lcp@360
    42
 (fn _ =>
lcp@360
    43
  [ (resolve_tac [PlusEL] 1),
clasohm@0
    44
    (REPEAT (eresolve_tac [asm_rl, refl_elem RS TEL] 1)) ]);
clasohm@0
    45
clasohm@0
    46
(*computation rules for true, false*)
clasohm@0
    47
lcp@360
    48
val boolC_true = prove_goalw Bool.thy bool_defs 
lcp@360
    49
    "!!C. [| a : C(true);  b : C(false) |] ==> cond(true,a,b) = a : C(true)"
lcp@360
    50
 (fn _ =>
lcp@360
    51
  [ (resolve_tac comp_rls 1),
lcp@360
    52
    (typechk_tac []),
clasohm@0
    53
    (ALLGOALS (etac TE)),
lcp@360
    54
    (typechk_tac []) ]);
clasohm@0
    55
lcp@360
    56
val boolC_false = prove_goalw Bool.thy bool_defs 
lcp@360
    57
    "!!C. [| a : C(true);  b : C(false) |] ==> cond(false,a,b) = b : C(false)"
lcp@360
    58
 (fn _ =>
lcp@360
    59
  [ (resolve_tac comp_rls 1),
lcp@360
    60
    (typechk_tac []),
clasohm@0
    61
    (ALLGOALS (etac TE)),
lcp@360
    62
    (typechk_tac []) ]);
clasohm@0
    63
clasohm@0
    64
writeln"Reached end of file.";
clasohm@0
    65