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