src/HOL/Integ/Bin.ML
author paulson
Mon, 23 Sep 1996 17:42:56 +0200
changeset 2003 b48f066d52dc
parent 1894 c2c8279d40f0
child 2224 4fc4b465be5b
permissions -rw-r--r--
Addition of gensym
Ignore whitespace changes - Everywhere: Within whitespace: At end of lines:
1632
39e146ac224c Binary integers and their numeric syntax
paulson
parents:
diff changeset
     1
(*  Title:	HOL/Integ/Bin.ML
39e146ac224c Binary integers and their numeric syntax
paulson
parents:
diff changeset
     2
    Authors:	Lawrence C Paulson, Cambridge University Computer Laboratory
39e146ac224c Binary integers and their numeric syntax
paulson
parents:
diff changeset
     3
		David Spelt, University of Twente 
39e146ac224c Binary integers and their numeric syntax
paulson
parents:
diff changeset
     4
    Copyright   1994  University of Cambridge
39e146ac224c Binary integers and their numeric syntax
paulson
parents:
diff changeset
     5
    Copyright   1996 University of Twente
39e146ac224c Binary integers and their numeric syntax
paulson
parents:
diff changeset
     6
39e146ac224c Binary integers and their numeric syntax
paulson
parents:
diff changeset
     7
Arithmetic on binary integers.
39e146ac224c Binary integers and their numeric syntax
paulson
parents:
diff changeset
     8
*)
39e146ac224c Binary integers and their numeric syntax
paulson
parents:
diff changeset
     9
39e146ac224c Binary integers and their numeric syntax
paulson
parents:
diff changeset
    10
open Bin;
39e146ac224c Binary integers and their numeric syntax
paulson
parents:
diff changeset
    11
39e146ac224c Binary integers and their numeric syntax
paulson
parents:
diff changeset
    12
(** extra rules for bin_succ, bin_pred, bin_add, bin_mult **)
39e146ac224c Binary integers and their numeric syntax
paulson
parents:
diff changeset
    13
39e146ac224c Binary integers and their numeric syntax
paulson
parents:
diff changeset
    14
qed_goal "norm_Bcons_Plus_0" Bin.thy "norm_Bcons Plus False = Plus"
39e146ac224c Binary integers and their numeric syntax
paulson
parents:
diff changeset
    15
	(fn prem => [(Simp_tac 1)]);
39e146ac224c Binary integers and their numeric syntax
paulson
parents:
diff changeset
    16
39e146ac224c Binary integers and their numeric syntax
paulson
parents:
diff changeset
    17
qed_goal "norm_Bcons_Plus_1" Bin.thy "norm_Bcons Plus True = Bcons Plus True"
39e146ac224c Binary integers and their numeric syntax
paulson
parents:
diff changeset
    18
	(fn prem => [(Simp_tac 1)]);
39e146ac224c Binary integers and their numeric syntax
paulson
parents:
diff changeset
    19
39e146ac224c Binary integers and their numeric syntax
paulson
parents:
diff changeset
    20
qed_goal "norm_Bcons_Minus_0" Bin.thy "norm_Bcons Minus False = Bcons Minus False"
39e146ac224c Binary integers and their numeric syntax
paulson
parents:
diff changeset
    21
	(fn prem => [(Simp_tac 1)]);
39e146ac224c Binary integers and their numeric syntax
paulson
parents:
diff changeset
    22
39e146ac224c Binary integers and their numeric syntax
paulson
parents:
diff changeset
    23
qed_goal "norm_Bcons_Minus_1" Bin.thy "norm_Bcons Minus True = Minus"
39e146ac224c Binary integers and their numeric syntax
paulson
parents:
diff changeset
    24
	(fn prem => [(Simp_tac 1)]);
39e146ac224c Binary integers and their numeric syntax
paulson
parents:
diff changeset
    25
39e146ac224c Binary integers and their numeric syntax
paulson
parents:
diff changeset
    26
qed_goal "norm_Bcons_Bcons" Bin.thy "norm_Bcons (Bcons w x) b = Bcons (Bcons w x) b"
39e146ac224c Binary integers and their numeric syntax
paulson
parents:
diff changeset
    27
	(fn prem => [(Simp_tac 1)]);
39e146ac224c Binary integers and their numeric syntax
paulson
parents:
diff changeset
    28
39e146ac224c Binary integers and their numeric syntax
paulson
parents:
diff changeset
    29
qed_goal "bin_succ_Bcons1" Bin.thy "bin_succ(Bcons w True) = Bcons (bin_succ w) False"
39e146ac224c Binary integers and their numeric syntax
paulson
parents:
diff changeset
    30
	(fn prem => [(Simp_tac 1)]);
39e146ac224c Binary integers and their numeric syntax
paulson
parents:
diff changeset
    31
39e146ac224c Binary integers and their numeric syntax
paulson
parents:
diff changeset
    32
qed_goal "bin_succ_Bcons0" Bin.thy "bin_succ(Bcons w False) =  norm_Bcons w True"
39e146ac224c Binary integers and their numeric syntax
paulson
parents:
diff changeset
    33
	(fn prem => [(Simp_tac 1)]);
39e146ac224c Binary integers and their numeric syntax
paulson
parents:
diff changeset
    34
39e146ac224c Binary integers and their numeric syntax
paulson
parents:
diff changeset
    35
qed_goal "bin_pred_Bcons1" Bin.thy "bin_pred(Bcons w True) = norm_Bcons w False"
39e146ac224c Binary integers and their numeric syntax
paulson
parents:
diff changeset
    36
	(fn prem => [(Simp_tac 1)]);
39e146ac224c Binary integers and their numeric syntax
paulson
parents:
diff changeset
    37
39e146ac224c Binary integers and their numeric syntax
paulson
parents:
diff changeset
    38
qed_goal "bin_pred_Bcons0" Bin.thy "bin_pred(Bcons w False) = Bcons (bin_pred w) True"
39e146ac224c Binary integers and their numeric syntax
paulson
parents:
diff changeset
    39
	(fn prem => [(Simp_tac 1)]);
39e146ac224c Binary integers and their numeric syntax
paulson
parents:
diff changeset
    40
39e146ac224c Binary integers and their numeric syntax
paulson
parents:
diff changeset
    41
qed_goal "bin_minus_Bcons1" Bin.thy "bin_minus(Bcons w True) = bin_pred (Bcons(bin_minus w) False)"
39e146ac224c Binary integers and their numeric syntax
paulson
parents:
diff changeset
    42
	(fn prem => [(Simp_tac 1)]);
39e146ac224c Binary integers and their numeric syntax
paulson
parents:
diff changeset
    43
39e146ac224c Binary integers and their numeric syntax
paulson
parents:
diff changeset
    44
qed_goal "bin_minus_Bcons0" Bin.thy "bin_minus(Bcons w False) = Bcons (bin_minus w) False"
39e146ac224c Binary integers and their numeric syntax
paulson
parents:
diff changeset
    45
	(fn prem => [(Simp_tac 1)]);
39e146ac224c Binary integers and their numeric syntax
paulson
parents:
diff changeset
    46
39e146ac224c Binary integers and their numeric syntax
paulson
parents:
diff changeset
    47
(*** bin_add: binary addition ***)
39e146ac224c Binary integers and their numeric syntax
paulson
parents:
diff changeset
    48
39e146ac224c Binary integers and their numeric syntax
paulson
parents:
diff changeset
    49
qed_goal "bin_add_Bcons_Bcons11" Bin.thy "bin_add (Bcons v True) (Bcons w True) = norm_Bcons (bin_add v (bin_succ w)) False"
39e146ac224c Binary integers and their numeric syntax
paulson
parents:
diff changeset
    50
	(fn prem => [(Simp_tac 1)]);
39e146ac224c Binary integers and their numeric syntax
paulson
parents:
diff changeset
    51
39e146ac224c Binary integers and their numeric syntax
paulson
parents:
diff changeset
    52
qed_goal "bin_add_Bcons_Bcons10" Bin.thy "bin_add (Bcons v True) (Bcons w False) = norm_Bcons (bin_add v w) True"
39e146ac224c Binary integers and their numeric syntax
paulson
parents:
diff changeset
    53
	(fn prem => [(Simp_tac 1)]);
39e146ac224c Binary integers and their numeric syntax
paulson
parents:
diff changeset
    54
39e146ac224c Binary integers and their numeric syntax
paulson
parents:
diff changeset
    55
(* SHOULD THIS THEOREM BE ADDED TO HOL_SS ? *)
39e146ac224c Binary integers and their numeric syntax
paulson
parents:
diff changeset
    56
val my = prove_goal HOL.thy "(False = (~P)) = P"
1894
c2c8279d40f0 Classical tactics now use default claset.
berghofe
parents: 1632
diff changeset
    57
	(fn prem => [(Fast_tac 1)]);
1632
39e146ac224c Binary integers and their numeric syntax
paulson
parents:
diff changeset
    58
39e146ac224c Binary integers and their numeric syntax
paulson
parents:
diff changeset
    59
qed_goal "bin_add_Bcons_Bcons0" Bin.thy "bin_add (Bcons v False) (Bcons w y) = norm_Bcons (bin_add v w) y"
39e146ac224c Binary integers and their numeric syntax
paulson
parents:
diff changeset
    60
	(fn prem => [(simp_tac (!simpset addsimps [my]) 1)]);
39e146ac224c Binary integers and their numeric syntax
paulson
parents:
diff changeset
    61
39e146ac224c Binary integers and their numeric syntax
paulson
parents:
diff changeset
    62
qed_goal "bin_add_Bcons_Plus" Bin.thy "bin_add (Bcons v x) Plus = Bcons v x"
39e146ac224c Binary integers and their numeric syntax
paulson
parents:
diff changeset
    63
	(fn prems => [(Simp_tac 1)]);
39e146ac224c Binary integers and their numeric syntax
paulson
parents:
diff changeset
    64
39e146ac224c Binary integers and their numeric syntax
paulson
parents:
diff changeset
    65
qed_goal "bin_add_Bcons_Minus" Bin.thy "bin_add (Bcons v x) Minus = bin_pred (Bcons v x)"
39e146ac224c Binary integers and their numeric syntax
paulson
parents:
diff changeset
    66
	(fn prems => [(Simp_tac 1)]);
39e146ac224c Binary integers and their numeric syntax
paulson
parents:
diff changeset
    67
39e146ac224c Binary integers and their numeric syntax
paulson
parents:
diff changeset
    68
qed_goal "bin_add_Bcons_Bcons" Bin.thy "bin_add (Bcons v x) (Bcons w y) = norm_Bcons(bin_add v (if x & y then (bin_succ w) else w)) (x~= y)"
39e146ac224c Binary integers and their numeric syntax
paulson
parents:
diff changeset
    69
	(fn prems => [(Simp_tac 1)]);
39e146ac224c Binary integers and their numeric syntax
paulson
parents:
diff changeset
    70
39e146ac224c Binary integers and their numeric syntax
paulson
parents:
diff changeset
    71
39e146ac224c Binary integers and their numeric syntax
paulson
parents:
diff changeset
    72
(*** bin_add: binary multiplication ***)
39e146ac224c Binary integers and their numeric syntax
paulson
parents:
diff changeset
    73
39e146ac224c Binary integers and their numeric syntax
paulson
parents:
diff changeset
    74
qed_goal "bin_mult_Bcons1" Bin.thy "bin_mult (Bcons v True) w = bin_add (norm_Bcons (bin_mult v w) False) w"
39e146ac224c Binary integers and their numeric syntax
paulson
parents:
diff changeset
    75
	(fn prem => [(Simp_tac 1)]);
39e146ac224c Binary integers and their numeric syntax
paulson
parents:
diff changeset
    76
39e146ac224c Binary integers and their numeric syntax
paulson
parents:
diff changeset
    77
qed_goal "bin_mult_Bcons0" Bin.thy "bin_mult (Bcons v False) w = norm_Bcons (bin_mult v w) False"
39e146ac224c Binary integers and their numeric syntax
paulson
parents:
diff changeset
    78
	(fn prem => [(Simp_tac 1)]);
39e146ac224c Binary integers and their numeric syntax
paulson
parents:
diff changeset
    79
39e146ac224c Binary integers and their numeric syntax
paulson
parents:
diff changeset
    80
39e146ac224c Binary integers and their numeric syntax
paulson
parents:
diff changeset
    81
(**** The carry/borrow functions, bin_succ and bin_pred ****)
39e146ac224c Binary integers and their numeric syntax
paulson
parents:
diff changeset
    82
39e146ac224c Binary integers and their numeric syntax
paulson
parents:
diff changeset
    83
(** Lemmas **)
39e146ac224c Binary integers and their numeric syntax
paulson
parents:
diff changeset
    84
39e146ac224c Binary integers and their numeric syntax
paulson
parents:
diff changeset
    85
qed_goal "zadd_assoc_cong" Integ.thy "(z::int) + v = z' + v' ==> z + (v + w) = z' + (v' + w)"
39e146ac224c Binary integers and their numeric syntax
paulson
parents:
diff changeset
    86
  (fn prems => [(asm_simp_tac (!simpset addsimps (prems @ [zadd_assoc RS sym])) 1)]);
39e146ac224c Binary integers and their numeric syntax
paulson
parents:
diff changeset
    87
39e146ac224c Binary integers and their numeric syntax
paulson
parents:
diff changeset
    88
qed_goal "zadd_assoc_swap" Integ.thy "(z::int) + (v + w) = v + (z + w)"
39e146ac224c Binary integers and their numeric syntax
paulson
parents:
diff changeset
    89
   (fn prems => [(REPEAT (ares_tac [zadd_commute RS zadd_assoc_cong] 1))]);
39e146ac224c Binary integers and their numeric syntax
paulson
parents:
diff changeset
    90
39e146ac224c Binary integers and their numeric syntax
paulson
parents:
diff changeset
    91
39e146ac224c Binary integers and their numeric syntax
paulson
parents:
diff changeset
    92
val my_ss = !simpset setloop (split_tac [expand_if]) ;
39e146ac224c Binary integers and their numeric syntax
paulson
parents:
diff changeset
    93
39e146ac224c Binary integers and their numeric syntax
paulson
parents:
diff changeset
    94
39e146ac224c Binary integers and their numeric syntax
paulson
parents:
diff changeset
    95
(**** integ_of_bin ****)
39e146ac224c Binary integers and their numeric syntax
paulson
parents:
diff changeset
    96
39e146ac224c Binary integers and their numeric syntax
paulson
parents:
diff changeset
    97
39e146ac224c Binary integers and their numeric syntax
paulson
parents:
diff changeset
    98
qed_goal "integ_of_bin_norm_Bcons" Bin.thy "integ_of_bin(norm_Bcons w b) = integ_of_bin(Bcons w b)"
39e146ac224c Binary integers and their numeric syntax
paulson
parents:
diff changeset
    99
   (fn prems=>[	(bin.induct_tac "w" 1),
39e146ac224c Binary integers and their numeric syntax
paulson
parents:
diff changeset
   100
		(REPEAT(simp_tac (!simpset setloop (split_tac [expand_if])) 1)) ]);
39e146ac224c Binary integers and their numeric syntax
paulson
parents:
diff changeset
   101
39e146ac224c Binary integers and their numeric syntax
paulson
parents:
diff changeset
   102
qed_goal "integ_of_bin_succ" Bin.thy "integ_of_bin(bin_succ w) = $#1 + integ_of_bin w"
39e146ac224c Binary integers and their numeric syntax
paulson
parents:
diff changeset
   103
   (fn prems=>[	(rtac bin.induct 1),
39e146ac224c Binary integers and their numeric syntax
paulson
parents:
diff changeset
   104
		(REPEAT(asm_simp_tac (!simpset addsimps (integ_of_bin_norm_Bcons::zadd_ac)
39e146ac224c Binary integers and their numeric syntax
paulson
parents:
diff changeset
   105
					       setloop (split_tac [expand_if])) 1)) ]);
39e146ac224c Binary integers and their numeric syntax
paulson
parents:
diff changeset
   106
39e146ac224c Binary integers and their numeric syntax
paulson
parents:
diff changeset
   107
qed_goal "integ_of_bin_pred" Bin.thy "integ_of_bin(bin_pred w) = $~ ($#1) + integ_of_bin w"
39e146ac224c Binary integers and their numeric syntax
paulson
parents:
diff changeset
   108
   (fn prems=>[	(rtac bin.induct 1),
39e146ac224c Binary integers and their numeric syntax
paulson
parents:
diff changeset
   109
		(REPEAT(asm_simp_tac (!simpset addsimps (integ_of_bin_norm_Bcons::zadd_ac)
39e146ac224c Binary integers and their numeric syntax
paulson
parents:
diff changeset
   110
					       setloop (split_tac [expand_if])) 1)) ]);
39e146ac224c Binary integers and their numeric syntax
paulson
parents:
diff changeset
   111
39e146ac224c Binary integers and their numeric syntax
paulson
parents:
diff changeset
   112
qed_goal "integ_of_bin_minus" Bin.thy "integ_of_bin(bin_minus w) = $~ (integ_of_bin w)"
39e146ac224c Binary integers and their numeric syntax
paulson
parents:
diff changeset
   113
   (fn prems=>[	(rtac bin.induct 1),
39e146ac224c Binary integers and their numeric syntax
paulson
parents:
diff changeset
   114
		(Simp_tac 1),
39e146ac224c Binary integers and their numeric syntax
paulson
parents:
diff changeset
   115
		(Simp_tac 1),
39e146ac224c Binary integers and their numeric syntax
paulson
parents:
diff changeset
   116
		(asm_simp_tac (!simpset
39e146ac224c Binary integers and their numeric syntax
paulson
parents:
diff changeset
   117
				delsimps [pred_Plus,pred_Minus,pred_Bcons]
39e146ac224c Binary integers and their numeric syntax
paulson
parents:
diff changeset
   118
				addsimps [integ_of_bin_succ,integ_of_bin_pred,
39e146ac224c Binary integers and their numeric syntax
paulson
parents:
diff changeset
   119
					  zadd_assoc]
39e146ac224c Binary integers and their numeric syntax
paulson
parents:
diff changeset
   120
				setloop (split_tac [expand_if])) 1)]);
39e146ac224c Binary integers and their numeric syntax
paulson
parents:
diff changeset
   121
39e146ac224c Binary integers and their numeric syntax
paulson
parents:
diff changeset
   122
 
39e146ac224c Binary integers and their numeric syntax
paulson
parents:
diff changeset
   123
val bin_add_simps = [add_Plus,add_Minus,bin_add_Bcons_Plus,bin_add_Bcons_Minus,bin_add_Bcons_Bcons,
39e146ac224c Binary integers and their numeric syntax
paulson
parents:
diff changeset
   124
		     integ_of_bin_succ, integ_of_bin_pred,
39e146ac224c Binary integers and their numeric syntax
paulson
parents:
diff changeset
   125
		     integ_of_bin_norm_Bcons];
39e146ac224c Binary integers and their numeric syntax
paulson
parents:
diff changeset
   126
val bin_simps = [iob_Plus,iob_Minus,iob_Bcons];
39e146ac224c Binary integers and their numeric syntax
paulson
parents:
diff changeset
   127
39e146ac224c Binary integers and their numeric syntax
paulson
parents:
diff changeset
   128
goal Bin.thy "! w. integ_of_bin(bin_add v w) = integ_of_bin v + integ_of_bin w";
39e146ac224c Binary integers and their numeric syntax
paulson
parents:
diff changeset
   129
by (bin.induct_tac "v" 1);
39e146ac224c Binary integers and their numeric syntax
paulson
parents:
diff changeset
   130
by (simp_tac (my_ss addsimps bin_add_simps) 1);
39e146ac224c Binary integers and their numeric syntax
paulson
parents:
diff changeset
   131
by (simp_tac (my_ss addsimps bin_add_simps) 1);
39e146ac224c Binary integers and their numeric syntax
paulson
parents:
diff changeset
   132
by (rtac allI 1);
39e146ac224c Binary integers and their numeric syntax
paulson
parents:
diff changeset
   133
by (bin.induct_tac "w" 1);
39e146ac224c Binary integers and their numeric syntax
paulson
parents:
diff changeset
   134
by (asm_simp_tac (my_ss addsimps (bin_add_simps)) 1);
39e146ac224c Binary integers and their numeric syntax
paulson
parents:
diff changeset
   135
by (asm_simp_tac (my_ss addsimps (bin_add_simps @ zadd_ac)) 1);
39e146ac224c Binary integers and their numeric syntax
paulson
parents:
diff changeset
   136
by (cut_inst_tac [("P","bool")] True_or_False 1);
39e146ac224c Binary integers and their numeric syntax
paulson
parents:
diff changeset
   137
by (etac disjE 1);
39e146ac224c Binary integers and their numeric syntax
paulson
parents:
diff changeset
   138
by (asm_simp_tac (my_ss addsimps (bin_add_simps @ zadd_ac)) 1);
39e146ac224c Binary integers and their numeric syntax
paulson
parents:
diff changeset
   139
by (asm_simp_tac (my_ss addsimps (bin_add_simps @ zadd_ac)) 1);
39e146ac224c Binary integers and their numeric syntax
paulson
parents:
diff changeset
   140
val integ_of_bin_add_lemma = result();
39e146ac224c Binary integers and their numeric syntax
paulson
parents:
diff changeset
   141
39e146ac224c Binary integers and their numeric syntax
paulson
parents:
diff changeset
   142
goal Bin.thy "integ_of_bin(bin_add v w) = integ_of_bin v + integ_of_bin w";
39e146ac224c Binary integers and their numeric syntax
paulson
parents:
diff changeset
   143
by (cut_facts_tac [integ_of_bin_add_lemma] 1);
1894
c2c8279d40f0 Classical tactics now use default claset.
berghofe
parents: 1632
diff changeset
   144
by (Fast_tac 1);
1632
39e146ac224c Binary integers and their numeric syntax
paulson
parents:
diff changeset
   145
qed "integ_of_bin_add";
39e146ac224c Binary integers and their numeric syntax
paulson
parents:
diff changeset
   146
39e146ac224c Binary integers and their numeric syntax
paulson
parents:
diff changeset
   147
val bin_mult_simps = [integ_of_bin_minus, integ_of_bin_add,integ_of_bin_norm_Bcons];
39e146ac224c Binary integers and their numeric syntax
paulson
parents:
diff changeset
   148
39e146ac224c Binary integers and their numeric syntax
paulson
parents:
diff changeset
   149
goal Bin.thy "integ_of_bin(bin_mult v w) = integ_of_bin v * integ_of_bin w";
39e146ac224c Binary integers and their numeric syntax
paulson
parents:
diff changeset
   150
by (bin.induct_tac "v" 1);
39e146ac224c Binary integers and their numeric syntax
paulson
parents:
diff changeset
   151
by (simp_tac (my_ss addsimps bin_mult_simps) 1);
39e146ac224c Binary integers and their numeric syntax
paulson
parents:
diff changeset
   152
by (simp_tac (my_ss addsimps bin_mult_simps) 1);
39e146ac224c Binary integers and their numeric syntax
paulson
parents:
diff changeset
   153
by (cut_inst_tac [("P","bool")] True_or_False 1);
39e146ac224c Binary integers and their numeric syntax
paulson
parents:
diff changeset
   154
by (etac disjE 1);
39e146ac224c Binary integers and their numeric syntax
paulson
parents:
diff changeset
   155
by (asm_simp_tac (my_ss addsimps (bin_mult_simps @ [zadd_zmult_distrib])) 2);
39e146ac224c Binary integers and their numeric syntax
paulson
parents:
diff changeset
   156
by (asm_simp_tac (my_ss addsimps (bin_mult_simps @ [zadd_zmult_distrib] @ zadd_ac)) 1);
39e146ac224c Binary integers and their numeric syntax
paulson
parents:
diff changeset
   157
qed "integ_of_bin_mult";
39e146ac224c Binary integers and their numeric syntax
paulson
parents:
diff changeset
   158
39e146ac224c Binary integers and their numeric syntax
paulson
parents:
diff changeset
   159
39e146ac224c Binary integers and their numeric syntax
paulson
parents:
diff changeset
   160
Delsimps [succ_Bcons,pred_Bcons,min_Bcons,add_Bcons,mult_Bcons,
39e146ac224c Binary integers and their numeric syntax
paulson
parents:
diff changeset
   161
	  iob_Plus,iob_Minus,iob_Bcons,
39e146ac224c Binary integers and their numeric syntax
paulson
parents:
diff changeset
   162
	  norm_Plus,norm_Minus,norm_Bcons];
39e146ac224c Binary integers and their numeric syntax
paulson
parents:
diff changeset
   163
39e146ac224c Binary integers and their numeric syntax
paulson
parents:
diff changeset
   164
Addsimps [integ_of_bin_add RS sym,
39e146ac224c Binary integers and their numeric syntax
paulson
parents:
diff changeset
   165
	  integ_of_bin_minus RS sym,
39e146ac224c Binary integers and their numeric syntax
paulson
parents:
diff changeset
   166
	  integ_of_bin_mult RS sym,
39e146ac224c Binary integers and their numeric syntax
paulson
parents:
diff changeset
   167
	  bin_succ_Bcons1,bin_succ_Bcons0,
39e146ac224c Binary integers and their numeric syntax
paulson
parents:
diff changeset
   168
	  bin_pred_Bcons1,bin_pred_Bcons0,
39e146ac224c Binary integers and their numeric syntax
paulson
parents:
diff changeset
   169
	  bin_minus_Bcons1,bin_minus_Bcons0, 
39e146ac224c Binary integers and their numeric syntax
paulson
parents:
diff changeset
   170
	  bin_add_Bcons_Plus,bin_add_Bcons_Minus,
39e146ac224c Binary integers and their numeric syntax
paulson
parents:
diff changeset
   171
	  bin_add_Bcons_Bcons0,bin_add_Bcons_Bcons10,bin_add_Bcons_Bcons11,
39e146ac224c Binary integers and their numeric syntax
paulson
parents:
diff changeset
   172
	  bin_mult_Bcons1,bin_mult_Bcons0,
39e146ac224c Binary integers and their numeric syntax
paulson
parents:
diff changeset
   173
	  norm_Bcons_Plus_0,norm_Bcons_Plus_1,
39e146ac224c Binary integers and their numeric syntax
paulson
parents:
diff changeset
   174
	  norm_Bcons_Minus_0,norm_Bcons_Minus_1,
39e146ac224c Binary integers and their numeric syntax
paulson
parents:
diff changeset
   175
	  norm_Bcons_Bcons];
39e146ac224c Binary integers and their numeric syntax
paulson
parents:
diff changeset
   176
39e146ac224c Binary integers and their numeric syntax
paulson
parents:
diff changeset
   177
(*** Examples of performing binary arithmetic by simplification ***)
39e146ac224c Binary integers and their numeric syntax
paulson
parents:
diff changeset
   178
39e146ac224c Binary integers and their numeric syntax
paulson
parents:
diff changeset
   179
goal Bin.thy "#13  +  #19 = #32";
39e146ac224c Binary integers and their numeric syntax
paulson
parents:
diff changeset
   180
by (Simp_tac 1);
39e146ac224c Binary integers and their numeric syntax
paulson
parents:
diff changeset
   181
result();
39e146ac224c Binary integers and their numeric syntax
paulson
parents:
diff changeset
   182
39e146ac224c Binary integers and their numeric syntax
paulson
parents:
diff changeset
   183
goal Bin.thy "#1234  +  #5678 = #6912";
39e146ac224c Binary integers and their numeric syntax
paulson
parents:
diff changeset
   184
by (Simp_tac 1);
39e146ac224c Binary integers and their numeric syntax
paulson
parents:
diff changeset
   185
result();
39e146ac224c Binary integers and their numeric syntax
paulson
parents:
diff changeset
   186
39e146ac224c Binary integers and their numeric syntax
paulson
parents:
diff changeset
   187
goal Bin.thy "#1359  +  #~2468 = #~1109";
39e146ac224c Binary integers and their numeric syntax
paulson
parents:
diff changeset
   188
by (Simp_tac 1);
39e146ac224c Binary integers and their numeric syntax
paulson
parents:
diff changeset
   189
result();
39e146ac224c Binary integers and their numeric syntax
paulson
parents:
diff changeset
   190
39e146ac224c Binary integers and their numeric syntax
paulson
parents:
diff changeset
   191
goal Bin.thy "#93746 +  #~46375 = #47371";
39e146ac224c Binary integers and their numeric syntax
paulson
parents:
diff changeset
   192
by (Simp_tac 1);
39e146ac224c Binary integers and their numeric syntax
paulson
parents:
diff changeset
   193
result();
39e146ac224c Binary integers and their numeric syntax
paulson
parents:
diff changeset
   194
39e146ac224c Binary integers and their numeric syntax
paulson
parents:
diff changeset
   195
goal Bin.thy "$~ #65745 = #~65745";
39e146ac224c Binary integers and their numeric syntax
paulson
parents:
diff changeset
   196
by (Simp_tac 1);
39e146ac224c Binary integers and their numeric syntax
paulson
parents:
diff changeset
   197
result();
39e146ac224c Binary integers and their numeric syntax
paulson
parents:
diff changeset
   198
39e146ac224c Binary integers and their numeric syntax
paulson
parents:
diff changeset
   199
goal Bin.thy "$~ #~54321 = #54321";
39e146ac224c Binary integers and their numeric syntax
paulson
parents:
diff changeset
   200
by (Simp_tac 1);
39e146ac224c Binary integers and their numeric syntax
paulson
parents:
diff changeset
   201
result();
39e146ac224c Binary integers and their numeric syntax
paulson
parents:
diff changeset
   202
39e146ac224c Binary integers and their numeric syntax
paulson
parents:
diff changeset
   203
goal Bin.thy "#13  *  #19 = #247";
39e146ac224c Binary integers and their numeric syntax
paulson
parents:
diff changeset
   204
by (Simp_tac 1);
39e146ac224c Binary integers and their numeric syntax
paulson
parents:
diff changeset
   205
result();
39e146ac224c Binary integers and their numeric syntax
paulson
parents:
diff changeset
   206
39e146ac224c Binary integers and their numeric syntax
paulson
parents:
diff changeset
   207
goal Bin.thy "#~84  *  #51 = #~4284";
39e146ac224c Binary integers and their numeric syntax
paulson
parents:
diff changeset
   208
by (Simp_tac 1);
39e146ac224c Binary integers and their numeric syntax
paulson
parents:
diff changeset
   209
result();
39e146ac224c Binary integers and their numeric syntax
paulson
parents:
diff changeset
   210
39e146ac224c Binary integers and their numeric syntax
paulson
parents:
diff changeset
   211
goal Bin.thy "#255  *  #255 = #65025";
39e146ac224c Binary integers and their numeric syntax
paulson
parents:
diff changeset
   212
by (Simp_tac 1);
39e146ac224c Binary integers and their numeric syntax
paulson
parents:
diff changeset
   213
result();
39e146ac224c Binary integers and their numeric syntax
paulson
parents:
diff changeset
   214
39e146ac224c Binary integers and their numeric syntax
paulson
parents:
diff changeset
   215
goal Bin.thy "#1359  *  #~2468 = #~3354012";
39e146ac224c Binary integers and their numeric syntax
paulson
parents:
diff changeset
   216
by (Simp_tac 1);
39e146ac224c Binary integers and their numeric syntax
paulson
parents:
diff changeset
   217
result();