src/HOL/Integ/IntArith.ML
author wenzelm
Sun, 14 Oct 2001 22:08:29 +0200
changeset 11770 b6bb7a853dd2
parent 11704 3c50a2cd6f00
child 11868 56db9f3a6b3e
permissions -rw-r--r--
moved rulify to ObjectLogic;
Ignore whitespace changes - Everywhere: Within whitespace: At end of lines:
9436
62bb04ab4b01 rearranged setup of arithmetic procedures, avoiding global reference values;
wenzelm
parents: 9269
diff changeset
     1
(*  Title:      HOL/Integ/IntArith.ML
7707
1f4b67fdfdae simprocs now in IntArith;
wenzelm
parents:
diff changeset
     2
    ID:         $Id$
1f4b67fdfdae simprocs now in IntArith;
wenzelm
parents:
diff changeset
     3
    Authors:    Larry Paulson and Tobias Nipkow
1f4b67fdfdae simprocs now in IntArith;
wenzelm
parents:
diff changeset
     4
*)
1f4b67fdfdae simprocs now in IntArith;
wenzelm
parents:
diff changeset
     5
9269
b62d5265b959 added zabs to arith_tac
nipkow
parents: 9214
diff changeset
     6
Goal "abs(abs(x::int)) = abs(x)";
b62d5265b959 added zabs to arith_tac
nipkow
parents: 9214
diff changeset
     7
by(arith_tac 1);
9214
9454f30eacc7 Defined abs on int.
nipkow
parents: 9079
diff changeset
     8
qed "abs_abs";
9454f30eacc7 Defined abs on int.
nipkow
parents: 9079
diff changeset
     9
Addsimps [abs_abs];
9454f30eacc7 Defined abs on int.
nipkow
parents: 9079
diff changeset
    10
9269
b62d5265b959 added zabs to arith_tac
nipkow
parents: 9214
diff changeset
    11
Goal "abs(-(x::int)) = abs(x)";
b62d5265b959 added zabs to arith_tac
nipkow
parents: 9214
diff changeset
    12
by(arith_tac 1);
9214
9454f30eacc7 Defined abs on int.
nipkow
parents: 9079
diff changeset
    13
qed "abs_minus";
9454f30eacc7 Defined abs on int.
nipkow
parents: 9079
diff changeset
    14
Addsimps [abs_minus];
9454f30eacc7 Defined abs on int.
nipkow
parents: 9079
diff changeset
    15
9269
b62d5265b959 added zabs to arith_tac
nipkow
parents: 9214
diff changeset
    16
Goal "abs(x+y) <= abs(x) + abs(y::int)";
b62d5265b959 added zabs to arith_tac
nipkow
parents: 9214
diff changeset
    17
by(arith_tac 1);
b62d5265b959 added zabs to arith_tac
nipkow
parents: 9214
diff changeset
    18
qed "triangle_ineq";
b62d5265b959 added zabs to arith_tac
nipkow
parents: 9214
diff changeset
    19
9214
9454f30eacc7 Defined abs on int.
nipkow
parents: 9079
diff changeset
    20
10228
e653cb933293 added intermediate value thms
nipkow
parents: 9633
diff changeset
    21
(*** Intermediate value theorems ***)
e653cb933293 added intermediate value thms
nipkow
parents: 9633
diff changeset
    22
11701
3d51fbf81c17 sane numerals (stage 1): added generic 1, removed 1' and 2 on nat,
wenzelm
parents: 10702
diff changeset
    23
Goal "(ALL i<n::nat. abs(f(i+1) - f i) <= Numeral1) --> \
10228
e653cb933293 added intermediate value thms
nipkow
parents: 9633
diff changeset
    24
\     f 0 <= k --> k <= f n --> (EX i <= n. f i = (k::int))";
e653cb933293 added intermediate value thms
nipkow
parents: 9633
diff changeset
    25
by(induct_tac "n" 1);
e653cb933293 added intermediate value thms
nipkow
parents: 9633
diff changeset
    26
 by(Asm_simp_tac 1);
e653cb933293 added intermediate value thms
nipkow
parents: 9633
diff changeset
    27
by(strip_tac 1);
e653cb933293 added intermediate value thms
nipkow
parents: 9633
diff changeset
    28
by(etac impE 1);
e653cb933293 added intermediate value thms
nipkow
parents: 9633
diff changeset
    29
 by(Asm_full_simp_tac 1);
e653cb933293 added intermediate value thms
nipkow
parents: 9633
diff changeset
    30
by(eres_inst_tac [("x","n")] allE 1);
e653cb933293 added intermediate value thms
nipkow
parents: 9633
diff changeset
    31
by(Asm_full_simp_tac 1);
e653cb933293 added intermediate value thms
nipkow
parents: 9633
diff changeset
    32
by(case_tac "k = f(n+1)" 1);
e653cb933293 added intermediate value thms
nipkow
parents: 9633
diff changeset
    33
 by(Force_tac 1);
e653cb933293 added intermediate value thms
nipkow
parents: 9633
diff changeset
    34
by(etac impE 1);
10702
9e6898befad4 new simprule zero_less_abs_iff
paulson
parents: 10646
diff changeset
    35
 by(asm_full_simp_tac (simpset() addsimps [zabs_def] 
9e6898befad4 new simprule zero_less_abs_iff
paulson
parents: 10646
diff changeset
    36
                                 addsplits [split_if_asm]) 1);
10228
e653cb933293 added intermediate value thms
nipkow
parents: 9633
diff changeset
    37
 by(arith_tac 1);
e653cb933293 added intermediate value thms
nipkow
parents: 9633
diff changeset
    38
by(blast_tac (claset() addIs [le_SucI]) 1);
e653cb933293 added intermediate value thms
nipkow
parents: 9633
diff changeset
    39
val lemma = result();
e653cb933293 added intermediate value thms
nipkow
parents: 9633
diff changeset
    40
11770
b6bb7a853dd2 moved rulify to ObjectLogic;
wenzelm
parents: 11704
diff changeset
    41
bind_thm("nat0_intermed_int_val", ObjectLogic.rulify_no_asm lemma);
10228
e653cb933293 added intermediate value thms
nipkow
parents: 9633
diff changeset
    42
11701
3d51fbf81c17 sane numerals (stage 1): added generic 1, removed 1' and 2 on nat,
wenzelm
parents: 10702
diff changeset
    43
Goal "[| !i. m <= i & i < n --> abs(f(i + 1::nat) - f i) <= Numeral1; m < n; \
10228
e653cb933293 added intermediate value thms
nipkow
parents: 9633
diff changeset
    44
\        f m <= k; k <= f n |] ==> ? i. m <= i & i <= n & f i = (k::int)";
e653cb933293 added intermediate value thms
nipkow
parents: 9633
diff changeset
    45
by(cut_inst_tac [("n","n-m"),("f", "%i. f(i+m)"),("k","k")]lemma 1);
e653cb933293 added intermediate value thms
nipkow
parents: 9633
diff changeset
    46
by(Asm_full_simp_tac 1);
e653cb933293 added intermediate value thms
nipkow
parents: 9633
diff changeset
    47
by(etac impE 1);
e653cb933293 added intermediate value thms
nipkow
parents: 9633
diff changeset
    48
 by(strip_tac 1);
e653cb933293 added intermediate value thms
nipkow
parents: 9633
diff changeset
    49
 by(eres_inst_tac [("x","i+m")] allE 1);
e653cb933293 added intermediate value thms
nipkow
parents: 9633
diff changeset
    50
 by(arith_tac 1);
e653cb933293 added intermediate value thms
nipkow
parents: 9633
diff changeset
    51
by(etac exE 1);
e653cb933293 added intermediate value thms
nipkow
parents: 9633
diff changeset
    52
by(res_inst_tac [("x","i+m")] exI 1);
e653cb933293 added intermediate value thms
nipkow
parents: 9633
diff changeset
    53
by(arith_tac 1);
e653cb933293 added intermediate value thms
nipkow
parents: 9633
diff changeset
    54
qed "nat_intermed_int_val";
e653cb933293 added intermediate value thms
nipkow
parents: 9633
diff changeset
    55
e653cb933293 added intermediate value thms
nipkow
parents: 9633
diff changeset
    56
9063
0d7628966069 new lemmas for signs of products
paulson
parents: 9000
diff changeset
    57
(*** Some convenient biconditionals for products of signs ***)
7707
1f4b67fdfdae simprocs now in IntArith;
wenzelm
parents:
diff changeset
    58
11701
3d51fbf81c17 sane numerals (stage 1): added generic 1, removed 1' and 2 on nat,
wenzelm
parents: 10702
diff changeset
    59
Goal "[| (Numeral0::int) < i; Numeral0 < j |] ==> Numeral0 < i*j";
9063
0d7628966069 new lemmas for signs of products
paulson
parents: 9000
diff changeset
    60
by (dtac zmult_zless_mono1 1);
0d7628966069 new lemmas for signs of products
paulson
parents: 9000
diff changeset
    61
by Auto_tac; 
0d7628966069 new lemmas for signs of products
paulson
parents: 9000
diff changeset
    62
qed "zmult_pos";
7707
1f4b67fdfdae simprocs now in IntArith;
wenzelm
parents:
diff changeset
    63
11701
3d51fbf81c17 sane numerals (stage 1): added generic 1, removed 1' and 2 on nat,
wenzelm
parents: 10702
diff changeset
    64
Goal "[| i < (Numeral0::int); j < Numeral0 |] ==> Numeral0 < i*j";
9063
0d7628966069 new lemmas for signs of products
paulson
parents: 9000
diff changeset
    65
by (dtac zmult_zless_mono1_neg 1);
0d7628966069 new lemmas for signs of products
paulson
parents: 9000
diff changeset
    66
by Auto_tac; 
0d7628966069 new lemmas for signs of products
paulson
parents: 9000
diff changeset
    67
qed "zmult_neg";
7707
1f4b67fdfdae simprocs now in IntArith;
wenzelm
parents:
diff changeset
    68
11701
3d51fbf81c17 sane numerals (stage 1): added generic 1, removed 1' and 2 on nat,
wenzelm
parents: 10702
diff changeset
    69
Goal "[| (Numeral0::int) < i; j < Numeral0 |] ==> i*j < Numeral0";
9063
0d7628966069 new lemmas for signs of products
paulson
parents: 9000
diff changeset
    70
by (dtac zmult_zless_mono1_neg 1);
0d7628966069 new lemmas for signs of products
paulson
parents: 9000
diff changeset
    71
by Auto_tac; 
0d7628966069 new lemmas for signs of products
paulson
parents: 9000
diff changeset
    72
qed "zmult_pos_neg";
7707
1f4b67fdfdae simprocs now in IntArith;
wenzelm
parents:
diff changeset
    73
11701
3d51fbf81c17 sane numerals (stage 1): added generic 1, removed 1' and 2 on nat,
wenzelm
parents: 10702
diff changeset
    74
Goal "((Numeral0::int) < x*y) = (Numeral0 < x & Numeral0 < y | x < Numeral0 & y < Numeral0)";
9063
0d7628966069 new lemmas for signs of products
paulson
parents: 9000
diff changeset
    75
by (auto_tac (claset(), 
0d7628966069 new lemmas for signs of products
paulson
parents: 9000
diff changeset
    76
              simpset() addsimps [order_le_less, linorder_not_less,
0d7628966069 new lemmas for signs of products
paulson
parents: 9000
diff changeset
    77
	                          zmult_pos, zmult_neg]));
0d7628966069 new lemmas for signs of products
paulson
parents: 9000
diff changeset
    78
by (ALLGOALS (rtac ccontr)); 
0d7628966069 new lemmas for signs of products
paulson
parents: 9000
diff changeset
    79
by (auto_tac (claset(), 
0d7628966069 new lemmas for signs of products
paulson
parents: 9000
diff changeset
    80
	      simpset() addsimps [order_le_less, linorder_not_less]));
0d7628966069 new lemmas for signs of products
paulson
parents: 9000
diff changeset
    81
by (ALLGOALS (etac rev_mp)); 
0d7628966069 new lemmas for signs of products
paulson
parents: 9000
diff changeset
    82
by (ALLGOALS (dtac zmult_pos_neg THEN' assume_tac));
0d7628966069 new lemmas for signs of products
paulson
parents: 9000
diff changeset
    83
by (auto_tac (claset() addDs [order_less_not_sym], 
0d7628966069 new lemmas for signs of products
paulson
parents: 9000
diff changeset
    84
              simpset() addsimps [zmult_commute]));  
0d7628966069 new lemmas for signs of products
paulson
parents: 9000
diff changeset
    85
qed "int_0_less_mult_iff";
7707
1f4b67fdfdae simprocs now in IntArith;
wenzelm
parents:
diff changeset
    86
11701
3d51fbf81c17 sane numerals (stage 1): added generic 1, removed 1' and 2 on nat,
wenzelm
parents: 10702
diff changeset
    87
Goal "((Numeral0::int) <= x*y) = (Numeral0 <= x & Numeral0 <= y | x <= Numeral0 & y <= Numeral0)";
9063
0d7628966069 new lemmas for signs of products
paulson
parents: 9000
diff changeset
    88
by (auto_tac (claset(), 
0d7628966069 new lemmas for signs of products
paulson
parents: 9000
diff changeset
    89
              simpset() addsimps [order_le_less, linorder_not_less,  
0d7628966069 new lemmas for signs of products
paulson
parents: 9000
diff changeset
    90
                                  int_0_less_mult_iff]));
0d7628966069 new lemmas for signs of products
paulson
parents: 9000
diff changeset
    91
qed "int_0_le_mult_iff";
7707
1f4b67fdfdae simprocs now in IntArith;
wenzelm
parents:
diff changeset
    92
11701
3d51fbf81c17 sane numerals (stage 1): added generic 1, removed 1' and 2 on nat,
wenzelm
parents: 10702
diff changeset
    93
Goal "(x*y < (Numeral0::int)) = (Numeral0 < x & y < Numeral0 | x < Numeral0 & Numeral0 < y)";
9063
0d7628966069 new lemmas for signs of products
paulson
parents: 9000
diff changeset
    94
by (auto_tac (claset(), 
0d7628966069 new lemmas for signs of products
paulson
parents: 9000
diff changeset
    95
              simpset() addsimps [int_0_le_mult_iff, 
0d7628966069 new lemmas for signs of products
paulson
parents: 9000
diff changeset
    96
                                  linorder_not_le RS sym]));
0d7628966069 new lemmas for signs of products
paulson
parents: 9000
diff changeset
    97
by (auto_tac (claset() addDs [order_less_not_sym],  
0d7628966069 new lemmas for signs of products
paulson
parents: 9000
diff changeset
    98
              simpset() addsimps [linorder_not_le]));
0d7628966069 new lemmas for signs of products
paulson
parents: 9000
diff changeset
    99
qed "zmult_less_0_iff";
7707
1f4b67fdfdae simprocs now in IntArith;
wenzelm
parents:
diff changeset
   100
11701
3d51fbf81c17 sane numerals (stage 1): added generic 1, removed 1' and 2 on nat,
wenzelm
parents: 10702
diff changeset
   101
Goal "(x*y <= (Numeral0::int)) = (Numeral0 <= x & y <= Numeral0 | x <= Numeral0 & Numeral0 <= y)";
9063
0d7628966069 new lemmas for signs of products
paulson
parents: 9000
diff changeset
   102
by (auto_tac (claset() addDs [order_less_not_sym], 
0d7628966069 new lemmas for signs of products
paulson
parents: 9000
diff changeset
   103
              simpset() addsimps [int_0_less_mult_iff, 
0d7628966069 new lemmas for signs of products
paulson
parents: 9000
diff changeset
   104
                                  linorder_not_less RS sym]));
0d7628966069 new lemmas for signs of products
paulson
parents: 9000
diff changeset
   105
qed "zmult_le_0_iff";
9509
0f3ee1f89ca8 introduction of integer exponentiation
paulson
parents: 9436
diff changeset
   106
10476
dbc181a32702 added abs_mult, abs_eq_0, square_nonzero;
wenzelm
parents: 10228
diff changeset
   107
Goal "abs (x * y) = abs x * abs (y::int)";
10702
9e6898befad4 new simprule zero_less_abs_iff
paulson
parents: 10646
diff changeset
   108
by (simp_tac (simpset () addsplits [zabs_split] 
9e6898befad4 new simprule zero_less_abs_iff
paulson
parents: 10646
diff changeset
   109
                         addsimps [zmult_less_0_iff, zle_def]) 1);
10476
dbc181a32702 added abs_mult, abs_eq_0, square_nonzero;
wenzelm
parents: 10228
diff changeset
   110
qed "abs_mult";
dbc181a32702 added abs_mult, abs_eq_0, square_nonzero;
wenzelm
parents: 10228
diff changeset
   111
11701
3d51fbf81c17 sane numerals (stage 1): added generic 1, removed 1' and 2 on nat,
wenzelm
parents: 10702
diff changeset
   112
Goal "(abs x = Numeral0) = (x = (Numeral0::int))";
10476
dbc181a32702 added abs_mult, abs_eq_0, square_nonzero;
wenzelm
parents: 10228
diff changeset
   113
by (simp_tac (simpset () addsplits [zabs_split]) 1);
dbc181a32702 added abs_mult, abs_eq_0, square_nonzero;
wenzelm
parents: 10228
diff changeset
   114
qed "abs_eq_0";
dbc181a32702 added abs_mult, abs_eq_0, square_nonzero;
wenzelm
parents: 10228
diff changeset
   115
AddIffs [abs_eq_0];
dbc181a32702 added abs_mult, abs_eq_0, square_nonzero;
wenzelm
parents: 10228
diff changeset
   116
11701
3d51fbf81c17 sane numerals (stage 1): added generic 1, removed 1' and 2 on nat,
wenzelm
parents: 10702
diff changeset
   117
Goal "(Numeral0 < abs x) = (x ~= (Numeral0::int))";
10702
9e6898befad4 new simprule zero_less_abs_iff
paulson
parents: 10646
diff changeset
   118
by (simp_tac (simpset () addsplits [zabs_split]) 1);
9e6898befad4 new simprule zero_less_abs_iff
paulson
parents: 10646
diff changeset
   119
by (arith_tac 1);
9e6898befad4 new simprule zero_less_abs_iff
paulson
parents: 10646
diff changeset
   120
qed "zero_less_abs_iff";
9e6898befad4 new simprule zero_less_abs_iff
paulson
parents: 10646
diff changeset
   121
AddIffs [zero_less_abs_iff];
9e6898befad4 new simprule zero_less_abs_iff
paulson
parents: 10646
diff changeset
   122
11701
3d51fbf81c17 sane numerals (stage 1): added generic 1, removed 1' and 2 on nat,
wenzelm
parents: 10702
diff changeset
   123
Goal "Numeral0 <= x * (x::int)";
3d51fbf81c17 sane numerals (stage 1): added generic 1, removed 1' and 2 on nat,
wenzelm
parents: 10702
diff changeset
   124
by (subgoal_tac "(- x) * x <= Numeral0" 1);
10476
dbc181a32702 added abs_mult, abs_eq_0, square_nonzero;
wenzelm
parents: 10228
diff changeset
   125
 by (Asm_full_simp_tac 1);
dbc181a32702 added abs_mult, abs_eq_0, square_nonzero;
wenzelm
parents: 10228
diff changeset
   126
by (simp_tac (HOL_basic_ss addsimps [zmult_le_0_iff]) 1);
dbc181a32702 added abs_mult, abs_eq_0, square_nonzero;
wenzelm
parents: 10228
diff changeset
   127
by Auto_tac;
dbc181a32702 added abs_mult, abs_eq_0, square_nonzero;
wenzelm
parents: 10228
diff changeset
   128
qed "square_nonzero";
dbc181a32702 added abs_mult, abs_eq_0, square_nonzero;
wenzelm
parents: 10228
diff changeset
   129
Addsimps [square_nonzero];
dbc181a32702 added abs_mult, abs_eq_0, square_nonzero;
wenzelm
parents: 10228
diff changeset
   130
AddIs [square_nonzero];
dbc181a32702 added abs_mult, abs_eq_0, square_nonzero;
wenzelm
parents: 10228
diff changeset
   131
dbc181a32702 added abs_mult, abs_eq_0, square_nonzero;
wenzelm
parents: 10228
diff changeset
   132
9509
0f3ee1f89ca8 introduction of integer exponentiation
paulson
parents: 9436
diff changeset
   133
(*** Products and 1, by T. M. Rasmussen ***)
0f3ee1f89ca8 introduction of integer exponentiation
paulson
parents: 9436
diff changeset
   134
11701
3d51fbf81c17 sane numerals (stage 1): added generic 1, removed 1' and 2 on nat,
wenzelm
parents: 10702
diff changeset
   135
Goal "(m = m*(n::int)) = (n = Numeral1 | m = Numeral0)";
9509
0f3ee1f89ca8 introduction of integer exponentiation
paulson
parents: 9436
diff changeset
   136
by Auto_tac;
11701
3d51fbf81c17 sane numerals (stage 1): added generic 1, removed 1' and 2 on nat,
wenzelm
parents: 10702
diff changeset
   137
by (subgoal_tac "m*Numeral1 = m*n" 1);
9633
a71a83253997 better rules for cancellation of common factors across comparisons
paulson
parents: 9509
diff changeset
   138
by (dtac (zmult_cancel1 RS iffD1) 1); 
9509
0f3ee1f89ca8 introduction of integer exponentiation
paulson
parents: 9436
diff changeset
   139
by Auto_tac;
0f3ee1f89ca8 introduction of integer exponentiation
paulson
parents: 9436
diff changeset
   140
qed "zmult_eq_self_iff";
0f3ee1f89ca8 introduction of integer exponentiation
paulson
parents: 9436
diff changeset
   141
11701
3d51fbf81c17 sane numerals (stage 1): added generic 1, removed 1' and 2 on nat,
wenzelm
parents: 10702
diff changeset
   142
Goal "[| Numeral1 < m; Numeral1 < n |] ==> Numeral1 < m*(n::int)";
3d51fbf81c17 sane numerals (stage 1): added generic 1, removed 1' and 2 on nat,
wenzelm
parents: 10702
diff changeset
   143
by (res_inst_tac [("y","Numeral1*n")] order_less_trans 1);
9509
0f3ee1f89ca8 introduction of integer exponentiation
paulson
parents: 9436
diff changeset
   144
by (rtac zmult_zless_mono1 2);
0f3ee1f89ca8 introduction of integer exponentiation
paulson
parents: 9436
diff changeset
   145
by (ALLGOALS Asm_simp_tac);
0f3ee1f89ca8 introduction of integer exponentiation
paulson
parents: 9436
diff changeset
   146
qed "zless_1_zmult";
0f3ee1f89ca8 introduction of integer exponentiation
paulson
parents: 9436
diff changeset
   147
11701
3d51fbf81c17 sane numerals (stage 1): added generic 1, removed 1' and 2 on nat,
wenzelm
parents: 10702
diff changeset
   148
Goal "[| Numeral0 < n; n ~= Numeral1 |] ==> Numeral1 < (n::int)";
9509
0f3ee1f89ca8 introduction of integer exponentiation
paulson
parents: 9436
diff changeset
   149
by (arith_tac 1);
0f3ee1f89ca8 introduction of integer exponentiation
paulson
parents: 9436
diff changeset
   150
val lemma = result();
0f3ee1f89ca8 introduction of integer exponentiation
paulson
parents: 9436
diff changeset
   151
11701
3d51fbf81c17 sane numerals (stage 1): added generic 1, removed 1' and 2 on nat,
wenzelm
parents: 10702
diff changeset
   152
Goal "Numeral0 < (m::int) ==> (m * n = Numeral1) = (m = Numeral1 & n = Numeral1)";
9509
0f3ee1f89ca8 introduction of integer exponentiation
paulson
parents: 9436
diff changeset
   153
by Auto_tac;
11701
3d51fbf81c17 sane numerals (stage 1): added generic 1, removed 1' and 2 on nat,
wenzelm
parents: 10702
diff changeset
   154
by (case_tac "m=Numeral1" 1);
3d51fbf81c17 sane numerals (stage 1): added generic 1, removed 1' and 2 on nat,
wenzelm
parents: 10702
diff changeset
   155
by (case_tac "n=Numeral1" 2);
3d51fbf81c17 sane numerals (stage 1): added generic 1, removed 1' and 2 on nat,
wenzelm
parents: 10702
diff changeset
   156
by (case_tac "m=Numeral1" 4);
3d51fbf81c17 sane numerals (stage 1): added generic 1, removed 1' and 2 on nat,
wenzelm
parents: 10702
diff changeset
   157
by (case_tac "n=Numeral1" 5);
9509
0f3ee1f89ca8 introduction of integer exponentiation
paulson
parents: 9436
diff changeset
   158
by Auto_tac;
0f3ee1f89ca8 introduction of integer exponentiation
paulson
parents: 9436
diff changeset
   159
by distinct_subgoals_tac;
11701
3d51fbf81c17 sane numerals (stage 1): added generic 1, removed 1' and 2 on nat,
wenzelm
parents: 10702
diff changeset
   160
by (subgoal_tac "Numeral1<m*n" 1);
9509
0f3ee1f89ca8 introduction of integer exponentiation
paulson
parents: 9436
diff changeset
   161
by (Asm_full_simp_tac 1);
0f3ee1f89ca8 introduction of integer exponentiation
paulson
parents: 9436
diff changeset
   162
by (rtac zless_1_zmult 1);
0f3ee1f89ca8 introduction of integer exponentiation
paulson
parents: 9436
diff changeset
   163
by (ALLGOALS (rtac lemma));
0f3ee1f89ca8 introduction of integer exponentiation
paulson
parents: 9436
diff changeset
   164
by Auto_tac;  
11701
3d51fbf81c17 sane numerals (stage 1): added generic 1, removed 1' and 2 on nat,
wenzelm
parents: 10702
diff changeset
   165
by (subgoal_tac "Numeral0<m*n" 1);
9509
0f3ee1f89ca8 introduction of integer exponentiation
paulson
parents: 9436
diff changeset
   166
by (Asm_simp_tac 2);
0f3ee1f89ca8 introduction of integer exponentiation
paulson
parents: 9436
diff changeset
   167
by (dtac (int_0_less_mult_iff RS iffD1) 1);
0f3ee1f89ca8 introduction of integer exponentiation
paulson
parents: 9436
diff changeset
   168
by Auto_tac;  
0f3ee1f89ca8 introduction of integer exponentiation
paulson
parents: 9436
diff changeset
   169
qed "pos_zmult_eq_1_iff";
0f3ee1f89ca8 introduction of integer exponentiation
paulson
parents: 9436
diff changeset
   170
11704
3c50a2cd6f00 * sane numerals (stage 2): plain "num" syntax (removed "#");
wenzelm
parents: 11701
diff changeset
   171
Goal "(m*n = (Numeral1::int)) = ((m = Numeral1 & n = Numeral1) | (m = -1 & n = -1))";
11701
3d51fbf81c17 sane numerals (stage 1): added generic 1, removed 1' and 2 on nat,
wenzelm
parents: 10702
diff changeset
   172
by (case_tac "Numeral0<m" 1);
9509
0f3ee1f89ca8 introduction of integer exponentiation
paulson
parents: 9436
diff changeset
   173
by (asm_simp_tac (simpset() addsimps [pos_zmult_eq_1_iff]) 1);
11701
3d51fbf81c17 sane numerals (stage 1): added generic 1, removed 1' and 2 on nat,
wenzelm
parents: 10702
diff changeset
   174
by (case_tac "m=Numeral0" 1);
9509
0f3ee1f89ca8 introduction of integer exponentiation
paulson
parents: 9436
diff changeset
   175
by (Asm_simp_tac 1);
11701
3d51fbf81c17 sane numerals (stage 1): added generic 1, removed 1' and 2 on nat,
wenzelm
parents: 10702
diff changeset
   176
by (subgoal_tac "Numeral0 < -m" 1);
9509
0f3ee1f89ca8 introduction of integer exponentiation
paulson
parents: 9436
diff changeset
   177
by (arith_tac 2);
0f3ee1f89ca8 introduction of integer exponentiation
paulson
parents: 9436
diff changeset
   178
by (dres_inst_tac [("n","-n")] pos_zmult_eq_1_iff 1); 
0f3ee1f89ca8 introduction of integer exponentiation
paulson
parents: 9436
diff changeset
   179
by Auto_tac;  
0f3ee1f89ca8 introduction of integer exponentiation
paulson
parents: 9436
diff changeset
   180
qed "zmult_eq_1_iff";
0f3ee1f89ca8 introduction of integer exponentiation
paulson
parents: 9436
diff changeset
   181