src/HOL/Integ/IntDef.ML
author wenzelm
Fri, 06 Oct 2000 17:35:58 +0200
changeset 10168 50be659d4222
parent 9544 f9202e219a29
child 10451 226d474e644d
permissions -rw-r--r--
final tuning;
Ignore whitespace changes - Everywhere: Within whitespace: At end of lines:
5508
691c70898518 new files in Integ
paulson
parents:
diff changeset
     1
(*  Title:      IntDef.ML
691c70898518 new files in Integ
paulson
parents:
diff changeset
     2
    ID:         $Id$
691c70898518 new files in Integ
paulson
parents:
diff changeset
     3
    Authors:    Lawrence C Paulson, Cambridge University Computer Laboratory
691c70898518 new files in Integ
paulson
parents:
diff changeset
     4
    Copyright   1993  University of Cambridge
691c70898518 new files in Integ
paulson
parents:
diff changeset
     5
691c70898518 new files in Integ
paulson
parents:
diff changeset
     6
The integers as equivalence classes over nat*nat.
691c70898518 new files in Integ
paulson
parents:
diff changeset
     7
*)
691c70898518 new files in Integ
paulson
parents:
diff changeset
     8
691c70898518 new files in Integ
paulson
parents:
diff changeset
     9
8937
7328d7c8d201 defining 0::int to be (int 0)
paulson
parents: 7428
diff changeset
    10
(*Rewrite the overloaded 0::int to (int 0)*)
7328d7c8d201 defining 0::int to be (int 0)
paulson
parents: 7428
diff changeset
    11
Addsimps [Zero_def];
7328d7c8d201 defining 0::int to be (int 0)
paulson
parents: 7428
diff changeset
    12
9392
c8e6529cc082 changed / to // for quotienting
paulson
parents: 9366
diff changeset
    13
Goalw  [intrel_def] "((x1,y1),(x2,y2)): intrel = (x1+y2 = x2+y1)";
c8e6529cc082 changed / to // for quotienting
paulson
parents: 9366
diff changeset
    14
by (Blast_tac 1);
5508
691c70898518 new files in Integ
paulson
parents:
diff changeset
    15
qed "intrel_iff";
691c70898518 new files in Integ
paulson
parents:
diff changeset
    16
9392
c8e6529cc082 changed / to // for quotienting
paulson
parents: 9366
diff changeset
    17
Goalw  [intrel_def] "(x,x): intrel";
9366
a83f3abbfc93 use pair_tac;
wenzelm
parents: 9108
diff changeset
    18
by (pair_tac "x" 1);
9392
c8e6529cc082 changed / to // for quotienting
paulson
parents: 9366
diff changeset
    19
by (Blast_tac 1);
5508
691c70898518 new files in Integ
paulson
parents:
diff changeset
    20
qed "intrel_refl";
691c70898518 new files in Integ
paulson
parents:
diff changeset
    21
9392
c8e6529cc082 changed / to // for quotienting
paulson
parents: 9366
diff changeset
    22
Goalw [intrel_def, equiv_def, refl_def, sym_def, trans_def]
7375
2cb340e66d15 tidied, allowing pattern-matching in defs of zadd and zmult
paulson
parents: 7127
diff changeset
    23
    "equiv UNIV intrel";
9392
c8e6529cc082 changed / to // for quotienting
paulson
parents: 9366
diff changeset
    24
by Auto_tac;
5508
691c70898518 new files in Integ
paulson
parents:
diff changeset
    25
qed "equiv_intrel";
691c70898518 new files in Integ
paulson
parents:
diff changeset
    26
9392
c8e6529cc082 changed / to // for quotienting
paulson
parents: 9366
diff changeset
    27
bind_thm ("equiv_intrel_iff", 
c8e6529cc082 changed / to // for quotienting
paulson
parents: 9366
diff changeset
    28
	  [equiv_intrel, UNIV_I, UNIV_I] MRS eq_equiv_class_iff);
5508
691c70898518 new files in Integ
paulson
parents:
diff changeset
    29
9392
c8e6529cc082 changed / to // for quotienting
paulson
parents: 9366
diff changeset
    30
Goalw [Integ_def,intrel_def,quotient_def]
c8e6529cc082 changed / to // for quotienting
paulson
parents: 9366
diff changeset
    31
     "intrel^^{(x,y)}:Integ";
5508
691c70898518 new files in Integ
paulson
parents:
diff changeset
    32
by (Fast_tac 1);
691c70898518 new files in Integ
paulson
parents:
diff changeset
    33
qed "intrel_in_integ";
691c70898518 new files in Integ
paulson
parents:
diff changeset
    34
691c70898518 new files in Integ
paulson
parents:
diff changeset
    35
Goal "inj_on Abs_Integ Integ";
691c70898518 new files in Integ
paulson
parents:
diff changeset
    36
by (rtac inj_on_inverseI 1);
691c70898518 new files in Integ
paulson
parents:
diff changeset
    37
by (etac Abs_Integ_inverse 1);
691c70898518 new files in Integ
paulson
parents:
diff changeset
    38
qed "inj_on_Abs_Integ";
691c70898518 new files in Integ
paulson
parents:
diff changeset
    39
691c70898518 new files in Integ
paulson
parents:
diff changeset
    40
Addsimps [equiv_intrel_iff, inj_on_Abs_Integ RS inj_on_iff,
691c70898518 new files in Integ
paulson
parents:
diff changeset
    41
          intrel_iff, intrel_in_integ, Abs_Integ_inverse];
691c70898518 new files in Integ
paulson
parents:
diff changeset
    42
691c70898518 new files in Integ
paulson
parents:
diff changeset
    43
Goal "inj(Rep_Integ)";
691c70898518 new files in Integ
paulson
parents:
diff changeset
    44
by (rtac inj_inverseI 1);
691c70898518 new files in Integ
paulson
parents:
diff changeset
    45
by (rtac Rep_Integ_inverse 1);
691c70898518 new files in Integ
paulson
parents:
diff changeset
    46
qed "inj_Rep_Integ";
691c70898518 new files in Integ
paulson
parents:
diff changeset
    47
691c70898518 new files in Integ
paulson
parents:
diff changeset
    48
5562
02261e6880d1 Renaming of Integ/Integ.* to Integ/Int.*, and renaming of related constants
paulson
parents: 5540
diff changeset
    49
(** int: the injection from "nat" to "int" **)
5508
691c70898518 new files in Integ
paulson
parents:
diff changeset
    50
5562
02261e6880d1 Renaming of Integ/Integ.* to Integ/Int.*, and renaming of related constants
paulson
parents: 5540
diff changeset
    51
Goal "inj int";
5508
691c70898518 new files in Integ
paulson
parents:
diff changeset
    52
by (rtac injI 1);
5562
02261e6880d1 Renaming of Integ/Integ.* to Integ/Int.*, and renaming of related constants
paulson
parents: 5540
diff changeset
    53
by (rewtac int_def);
5508
691c70898518 new files in Integ
paulson
parents:
diff changeset
    54
by (dtac (inj_on_Abs_Integ RS inj_onD) 1);
691c70898518 new files in Integ
paulson
parents:
diff changeset
    55
by (REPEAT (rtac intrel_in_integ 1));
691c70898518 new files in Integ
paulson
parents:
diff changeset
    56
by (dtac eq_equiv_class 1);
691c70898518 new files in Integ
paulson
parents:
diff changeset
    57
by (rtac equiv_intrel 1);
691c70898518 new files in Integ
paulson
parents:
diff changeset
    58
by (Fast_tac 1);
9392
c8e6529cc082 changed / to // for quotienting
paulson
parents: 9366
diff changeset
    59
by (asm_full_simp_tac (simpset() addsimps [intrel_def]) 1);
6991
500038b6063b renamed inj_nat to inj_int
paulson
parents: 6917
diff changeset
    60
qed "inj_int";
5508
691c70898518 new files in Integ
paulson
parents:
diff changeset
    61
691c70898518 new files in Integ
paulson
parents:
diff changeset
    62
691c70898518 new files in Integ
paulson
parents:
diff changeset
    63
(**** zminus: unary negation on Integ ****)
691c70898518 new files in Integ
paulson
parents:
diff changeset
    64
9392
c8e6529cc082 changed / to // for quotienting
paulson
parents: 9366
diff changeset
    65
Goalw [congruent_def, intrel_def]
c8e6529cc082 changed / to // for quotienting
paulson
parents: 9366
diff changeset
    66
     "congruent intrel (%(x,y). intrel^^{(y,x)})";
c8e6529cc082 changed / to // for quotienting
paulson
parents: 9366
diff changeset
    67
by (auto_tac (claset(), simpset() addsimps add_ac));
5508
691c70898518 new files in Integ
paulson
parents:
diff changeset
    68
qed "zminus_congruent";
691c70898518 new files in Integ
paulson
parents:
diff changeset
    69
691c70898518 new files in Integ
paulson
parents:
diff changeset
    70
Goalw [zminus_def]
691c70898518 new files in Integ
paulson
parents:
diff changeset
    71
      "- Abs_Integ(intrel^^{(x,y)}) = Abs_Integ(intrel ^^ {(y,x)})";
691c70898518 new files in Integ
paulson
parents:
diff changeset
    72
by (simp_tac (simpset() addsimps 
7375
2cb340e66d15 tidied, allowing pattern-matching in defs of zadd and zmult
paulson
parents: 7127
diff changeset
    73
	      [equiv_intrel RS UN_equiv_class, zminus_congruent]) 1);
5508
691c70898518 new files in Integ
paulson
parents:
diff changeset
    74
qed "zminus";
691c70898518 new files in Integ
paulson
parents:
diff changeset
    75
7375
2cb340e66d15 tidied, allowing pattern-matching in defs of zadd and zmult
paulson
parents: 7127
diff changeset
    76
(*Every integer can be written in the form Abs_Integ(...) *)
5508
691c70898518 new files in Integ
paulson
parents:
diff changeset
    77
val [prem] = Goal "(!!x y. z = Abs_Integ(intrel^^{(x,y)}) ==> P) ==> P";
691c70898518 new files in Integ
paulson
parents:
diff changeset
    78
by (res_inst_tac [("x1","z")] 
691c70898518 new files in Integ
paulson
parents:
diff changeset
    79
    (rewrite_rule [Integ_def] Rep_Integ RS quotientE) 1);
691c70898518 new files in Integ
paulson
parents:
diff changeset
    80
by (dres_inst_tac [("f","Abs_Integ")] arg_cong 1);
691c70898518 new files in Integ
paulson
parents:
diff changeset
    81
by (res_inst_tac [("p","x")] PairE 1);
691c70898518 new files in Integ
paulson
parents:
diff changeset
    82
by (rtac prem 1);
691c70898518 new files in Integ
paulson
parents:
diff changeset
    83
by (asm_full_simp_tac (simpset() addsimps [Rep_Integ_inverse]) 1);
691c70898518 new files in Integ
paulson
parents:
diff changeset
    84
qed "eq_Abs_Integ";
691c70898518 new files in Integ
paulson
parents:
diff changeset
    85
691c70898518 new files in Integ
paulson
parents:
diff changeset
    86
Goal "- (- z) = (z::int)";
691c70898518 new files in Integ
paulson
parents:
diff changeset
    87
by (res_inst_tac [("z","z")] eq_Abs_Integ 1);
691c70898518 new files in Integ
paulson
parents:
diff changeset
    88
by (asm_simp_tac (simpset() addsimps [zminus]) 1);
691c70898518 new files in Integ
paulson
parents:
diff changeset
    89
qed "zminus_zminus";
691c70898518 new files in Integ
paulson
parents:
diff changeset
    90
Addsimps [zminus_zminus];
691c70898518 new files in Integ
paulson
parents:
diff changeset
    91
5594
e4439230af67 much tidying
paulson
parents: 5582
diff changeset
    92
Goal "inj(%z::int. -z)";
5508
691c70898518 new files in Integ
paulson
parents:
diff changeset
    93
by (rtac injI 1);
691c70898518 new files in Integ
paulson
parents:
diff changeset
    94
by (dres_inst_tac [("f","uminus")] arg_cong 1);
691c70898518 new files in Integ
paulson
parents:
diff changeset
    95
by (Asm_full_simp_tac 1);
691c70898518 new files in Integ
paulson
parents:
diff changeset
    96
qed "inj_zminus";
691c70898518 new files in Integ
paulson
parents:
diff changeset
    97
5582
a356fb49e69e many renamings and changes. Simproc for cancelling common terms in relations
paulson
parents: 5562
diff changeset
    98
Goalw [int_def] "- (int 0) = int 0";
5508
691c70898518 new files in Integ
paulson
parents:
diff changeset
    99
by (simp_tac (simpset() addsimps [zminus]) 1);
6917
eba301caceea Introduction of integer division algorithm
paulson
parents: 6839
diff changeset
   100
qed "zminus_int0";
5508
691c70898518 new files in Integ
paulson
parents:
diff changeset
   101
6917
eba301caceea Introduction of integer division algorithm
paulson
parents: 6839
diff changeset
   102
Addsimps [zminus_int0];
5508
691c70898518 new files in Integ
paulson
parents:
diff changeset
   103
691c70898518 new files in Integ
paulson
parents:
diff changeset
   104
5540
0f16c3b66ab4 much renaming and reorganization
paulson
parents: 5508
diff changeset
   105
(**** neg: the test for negative integers ****)
5508
691c70898518 new files in Integ
paulson
parents:
diff changeset
   106
691c70898518 new files in Integ
paulson
parents:
diff changeset
   107
5582
a356fb49e69e many renamings and changes. Simproc for cancelling common terms in relations
paulson
parents: 5562
diff changeset
   108
Goalw [neg_def, int_def] "~ neg(int n)";
5508
691c70898518 new files in Integ
paulson
parents:
diff changeset
   109
by (Simp_tac 1);
7010
63120b6dca50 more renaming of theorems from _nat to _int (corresponding to a function that
paulson
parents: 6991
diff changeset
   110
qed "not_neg_int";
5508
691c70898518 new files in Integ
paulson
parents:
diff changeset
   111
5582
a356fb49e69e many renamings and changes. Simproc for cancelling common terms in relations
paulson
parents: 5562
diff changeset
   112
Goalw [neg_def, int_def] "neg(- (int (Suc n)))";
5508
691c70898518 new files in Integ
paulson
parents:
diff changeset
   113
by (simp_tac (simpset() addsimps [zminus]) 1);
7010
63120b6dca50 more renaming of theorems from _nat to _int (corresponding to a function that
paulson
parents: 6991
diff changeset
   114
qed "neg_zminus_int";
5508
691c70898518 new files in Integ
paulson
parents:
diff changeset
   115
7010
63120b6dca50 more renaming of theorems from _nat to _int (corresponding to a function that
paulson
parents: 6991
diff changeset
   116
Addsimps [neg_zminus_int, not_neg_int]; 
5508
691c70898518 new files in Integ
paulson
parents:
diff changeset
   117
691c70898518 new files in Integ
paulson
parents:
diff changeset
   118
691c70898518 new files in Integ
paulson
parents:
diff changeset
   119
(**** zadd: addition on Integ ****)
691c70898518 new files in Integ
paulson
parents:
diff changeset
   120
691c70898518 new files in Integ
paulson
parents:
diff changeset
   121
Goalw [zadd_def]
691c70898518 new files in Integ
paulson
parents:
diff changeset
   122
  "Abs_Integ(intrel^^{(x1,y1)}) + Abs_Integ(intrel^^{(x2,y2)}) = \
691c70898518 new files in Integ
paulson
parents:
diff changeset
   123
\  Abs_Integ(intrel^^{(x1+x2, y1+y2)})";
7375
2cb340e66d15 tidied, allowing pattern-matching in defs of zadd and zmult
paulson
parents: 7127
diff changeset
   124
by (asm_simp_tac (simpset() addsimps [UN_UN_split_split_eq]) 1);
2cb340e66d15 tidied, allowing pattern-matching in defs of zadd and zmult
paulson
parents: 7127
diff changeset
   125
by (stac (equiv_intrel RS UN_equiv_class2) 1);
2cb340e66d15 tidied, allowing pattern-matching in defs of zadd and zmult
paulson
parents: 7127
diff changeset
   126
by (auto_tac (claset(), simpset() addsimps [congruent2_def]));
5508
691c70898518 new files in Integ
paulson
parents:
diff changeset
   127
qed "zadd";
691c70898518 new files in Integ
paulson
parents:
diff changeset
   128
7127
48e235179ffb added parentheses to cope with a possible reduction of the precedence of unary
paulson
parents: 7010
diff changeset
   129
Goal "- (z + w) = (- z) + (- w::int)";
5508
691c70898518 new files in Integ
paulson
parents:
diff changeset
   130
by (res_inst_tac [("z","z")] eq_Abs_Integ 1);
691c70898518 new files in Integ
paulson
parents:
diff changeset
   131
by (res_inst_tac [("z","w")] eq_Abs_Integ 1);
691c70898518 new files in Integ
paulson
parents:
diff changeset
   132
by (asm_simp_tac (simpset() addsimps [zminus,zadd]) 1);
691c70898518 new files in Integ
paulson
parents:
diff changeset
   133
qed "zminus_zadd_distrib";
691c70898518 new files in Integ
paulson
parents:
diff changeset
   134
Addsimps [zminus_zadd_distrib];
691c70898518 new files in Integ
paulson
parents:
diff changeset
   135
691c70898518 new files in Integ
paulson
parents:
diff changeset
   136
Goal "(z::int) + w = w + z";
691c70898518 new files in Integ
paulson
parents:
diff changeset
   137
by (res_inst_tac [("z","z")] eq_Abs_Integ 1);
691c70898518 new files in Integ
paulson
parents:
diff changeset
   138
by (res_inst_tac [("z","w")] eq_Abs_Integ 1);
5540
0f16c3b66ab4 much renaming and reorganization
paulson
parents: 5508
diff changeset
   139
by (asm_simp_tac (simpset() addsimps add_ac @ [zadd]) 1);
5508
691c70898518 new files in Integ
paulson
parents:
diff changeset
   140
qed "zadd_commute";
691c70898518 new files in Integ
paulson
parents:
diff changeset
   141
691c70898518 new files in Integ
paulson
parents:
diff changeset
   142
Goal "((z1::int) + z2) + z3 = z1 + (z2 + z3)";
691c70898518 new files in Integ
paulson
parents:
diff changeset
   143
by (res_inst_tac [("z","z1")] eq_Abs_Integ 1);
691c70898518 new files in Integ
paulson
parents:
diff changeset
   144
by (res_inst_tac [("z","z2")] eq_Abs_Integ 1);
691c70898518 new files in Integ
paulson
parents:
diff changeset
   145
by (res_inst_tac [("z","z3")] eq_Abs_Integ 1);
691c70898518 new files in Integ
paulson
parents:
diff changeset
   146
by (asm_simp_tac (simpset() addsimps [zadd, add_assoc]) 1);
691c70898518 new files in Integ
paulson
parents:
diff changeset
   147
qed "zadd_assoc";
691c70898518 new files in Integ
paulson
parents:
diff changeset
   148
691c70898518 new files in Integ
paulson
parents:
diff changeset
   149
(*For AC rewriting*)
691c70898518 new files in Integ
paulson
parents:
diff changeset
   150
Goal "(x::int)+(y+z)=y+(x+z)";
691c70898518 new files in Integ
paulson
parents:
diff changeset
   151
by (rtac (zadd_commute RS trans) 1);
691c70898518 new files in Integ
paulson
parents:
diff changeset
   152
by (rtac (zadd_assoc RS trans) 1);
691c70898518 new files in Integ
paulson
parents:
diff changeset
   153
by (rtac (zadd_commute RS arg_cong) 1);
691c70898518 new files in Integ
paulson
parents:
diff changeset
   154
qed "zadd_left_commute";
691c70898518 new files in Integ
paulson
parents:
diff changeset
   155
691c70898518 new files in Integ
paulson
parents:
diff changeset
   156
(*Integer addition is an AC operator*)
7428
80838c2af97b bind_thms;
wenzelm
parents: 7375
diff changeset
   157
bind_thms ("zadd_ac", [zadd_assoc,zadd_commute,zadd_left_commute]);
5508
691c70898518 new files in Integ
paulson
parents:
diff changeset
   158
5582
a356fb49e69e many renamings and changes. Simproc for cancelling common terms in relations
paulson
parents: 5562
diff changeset
   159
Goalw [int_def] "(int m) + (int n) = int (m + n)";
5508
691c70898518 new files in Integ
paulson
parents:
diff changeset
   160
by (simp_tac (simpset() addsimps [zadd]) 1);
5582
a356fb49e69e many renamings and changes. Simproc for cancelling common terms in relations
paulson
parents: 5562
diff changeset
   161
qed "zadd_int";
5508
691c70898518 new files in Integ
paulson
parents:
diff changeset
   162
5594
e4439230af67 much tidying
paulson
parents: 5582
diff changeset
   163
Goal "(int m) + (int n + z) = int (m + n) + z";
e4439230af67 much tidying
paulson
parents: 5582
diff changeset
   164
by (simp_tac (simpset() addsimps [zadd_int, zadd_assoc RS sym]) 1);
e4439230af67 much tidying
paulson
parents: 5582
diff changeset
   165
qed "zadd_int_left";
e4439230af67 much tidying
paulson
parents: 5582
diff changeset
   166
5582
a356fb49e69e many renamings and changes. Simproc for cancelling common terms in relations
paulson
parents: 5562
diff changeset
   167
Goal "int (Suc m) = int 1 + (int m)";
a356fb49e69e many renamings and changes. Simproc for cancelling common terms in relations
paulson
parents: 5562
diff changeset
   168
by (simp_tac (simpset() addsimps [zadd_int]) 1);
6717
70b251dc7055 int_Suc->int_Suc_int_1 avoiding confusion with the more useful Bin.int_Suc
paulson
parents: 6674
diff changeset
   169
qed "int_Suc_int_1";
5508
691c70898518 new files in Integ
paulson
parents:
diff changeset
   170
5582
a356fb49e69e many renamings and changes. Simproc for cancelling common terms in relations
paulson
parents: 5562
diff changeset
   171
Goalw [int_def] "int 0 + z = z";
5508
691c70898518 new files in Integ
paulson
parents:
diff changeset
   172
by (res_inst_tac [("z","z")] eq_Abs_Integ 1);
691c70898518 new files in Integ
paulson
parents:
diff changeset
   173
by (asm_simp_tac (simpset() addsimps [zadd]) 1);
6917
eba301caceea Introduction of integer division algorithm
paulson
parents: 6839
diff changeset
   174
qed "zadd_int0";
5508
691c70898518 new files in Integ
paulson
parents:
diff changeset
   175
5582
a356fb49e69e many renamings and changes. Simproc for cancelling common terms in relations
paulson
parents: 5562
diff changeset
   176
Goal "z + int 0 = z";
5508
691c70898518 new files in Integ
paulson
parents:
diff changeset
   177
by (rtac (zadd_commute RS trans) 1);
6917
eba301caceea Introduction of integer division algorithm
paulson
parents: 6839
diff changeset
   178
by (rtac zadd_int0 1);
eba301caceea Introduction of integer division algorithm
paulson
parents: 6839
diff changeset
   179
qed "zadd_int0_right";
5508
691c70898518 new files in Integ
paulson
parents:
diff changeset
   180
5582
a356fb49e69e many renamings and changes. Simproc for cancelling common terms in relations
paulson
parents: 5562
diff changeset
   181
Goalw [int_def] "z + (- z) = int 0";
5508
691c70898518 new files in Integ
paulson
parents:
diff changeset
   182
by (res_inst_tac [("z","z")] eq_Abs_Integ 1);
691c70898518 new files in Integ
paulson
parents:
diff changeset
   183
by (asm_simp_tac (simpset() addsimps [zminus, zadd, add_commute]) 1);
5594
e4439230af67 much tidying
paulson
parents: 5582
diff changeset
   184
qed "zadd_zminus_inverse";
5508
691c70898518 new files in Integ
paulson
parents:
diff changeset
   185
5582
a356fb49e69e many renamings and changes. Simproc for cancelling common terms in relations
paulson
parents: 5562
diff changeset
   186
Goal "(- z) + z = int 0";
5508
691c70898518 new files in Integ
paulson
parents:
diff changeset
   187
by (rtac (zadd_commute RS trans) 1);
5594
e4439230af67 much tidying
paulson
parents: 5582
diff changeset
   188
by (rtac zadd_zminus_inverse 1);
e4439230af67 much tidying
paulson
parents: 5582
diff changeset
   189
qed "zadd_zminus_inverse2";
5508
691c70898518 new files in Integ
paulson
parents:
diff changeset
   190
6917
eba301caceea Introduction of integer division algorithm
paulson
parents: 6839
diff changeset
   191
Addsimps [zadd_int0, zadd_int0_right,
5594
e4439230af67 much tidying
paulson
parents: 5582
diff changeset
   192
	  zadd_zminus_inverse, zadd_zminus_inverse2];
5508
691c70898518 new files in Integ
paulson
parents:
diff changeset
   193
8949
d46adac29b71 installing plus_ac0 for int
paulson
parents: 8937
diff changeset
   194
(*for the instance declaration int :: plus_ac0*)
d46adac29b71 installing plus_ac0 for int
paulson
parents: 8937
diff changeset
   195
Goal "0 + z = (z::int)";
d46adac29b71 installing plus_ac0 for int
paulson
parents: 8937
diff changeset
   196
by (Simp_tac 1);
d46adac29b71 installing plus_ac0 for int
paulson
parents: 8937
diff changeset
   197
qed "zadd_zero";
d46adac29b71 installing plus_ac0 for int
paulson
parents: 8937
diff changeset
   198
5508
691c70898518 new files in Integ
paulson
parents:
diff changeset
   199
Goal "z + (- z + w) = (w::int)";
5582
a356fb49e69e many renamings and changes. Simproc for cancelling common terms in relations
paulson
parents: 5562
diff changeset
   200
by (simp_tac (simpset() addsimps [zadd_assoc RS sym]) 1);
5508
691c70898518 new files in Integ
paulson
parents:
diff changeset
   201
qed "zadd_zminus_cancel";
691c70898518 new files in Integ
paulson
parents:
diff changeset
   202
691c70898518 new files in Integ
paulson
parents:
diff changeset
   203
Goal "(-z) + (z + w) = (w::int)";
5582
a356fb49e69e many renamings and changes. Simproc for cancelling common terms in relations
paulson
parents: 5562
diff changeset
   204
by (simp_tac (simpset() addsimps [zadd_assoc RS sym]) 1);
5508
691c70898518 new files in Integ
paulson
parents:
diff changeset
   205
qed "zminus_zadd_cancel";
691c70898518 new files in Integ
paulson
parents:
diff changeset
   206
691c70898518 new files in Integ
paulson
parents:
diff changeset
   207
Addsimps [zadd_zminus_cancel, zminus_zadd_cancel];
691c70898518 new files in Integ
paulson
parents:
diff changeset
   208
5582
a356fb49e69e many renamings and changes. Simproc for cancelling common terms in relations
paulson
parents: 5562
diff changeset
   209
Goal "int 0 - x = -x";
a356fb49e69e many renamings and changes. Simproc for cancelling common terms in relations
paulson
parents: 5562
diff changeset
   210
by (simp_tac (simpset() addsimps [zdiff_def]) 1);
6917
eba301caceea Introduction of integer division algorithm
paulson
parents: 6839
diff changeset
   211
qed "zdiff_int0";
5582
a356fb49e69e many renamings and changes. Simproc for cancelling common terms in relations
paulson
parents: 5562
diff changeset
   212
a356fb49e69e many renamings and changes. Simproc for cancelling common terms in relations
paulson
parents: 5562
diff changeset
   213
Goal "x - int 0 = x";
a356fb49e69e many renamings and changes. Simproc for cancelling common terms in relations
paulson
parents: 5562
diff changeset
   214
by (simp_tac (simpset() addsimps [zdiff_def]) 1);
6917
eba301caceea Introduction of integer division algorithm
paulson
parents: 6839
diff changeset
   215
qed "zdiff_int0_right";
5582
a356fb49e69e many renamings and changes. Simproc for cancelling common terms in relations
paulson
parents: 5562
diff changeset
   216
5594
e4439230af67 much tidying
paulson
parents: 5582
diff changeset
   217
Goal "x - x = int 0";
e4439230af67 much tidying
paulson
parents: 5582
diff changeset
   218
by (simp_tac (simpset() addsimps [zdiff_def]) 1);
e4439230af67 much tidying
paulson
parents: 5582
diff changeset
   219
qed "zdiff_self";
e4439230af67 much tidying
paulson
parents: 5582
diff changeset
   220
6917
eba301caceea Introduction of integer division algorithm
paulson
parents: 6839
diff changeset
   221
Addsimps [zdiff_int0, zdiff_int0_right, zdiff_self];
5582
a356fb49e69e many renamings and changes. Simproc for cancelling common terms in relations
paulson
parents: 5562
diff changeset
   222
5508
691c70898518 new files in Integ
paulson
parents:
diff changeset
   223
691c70898518 new files in Integ
paulson
parents:
diff changeset
   224
(** Lemmas **)
691c70898518 new files in Integ
paulson
parents:
diff changeset
   225
691c70898518 new files in Integ
paulson
parents:
diff changeset
   226
Goal "(z::int) + v = z' + v' ==> z + (v + w) = z' + (v' + w)";
691c70898518 new files in Integ
paulson
parents:
diff changeset
   227
by (asm_simp_tac (simpset() addsimps [zadd_assoc RS sym]) 1);
691c70898518 new files in Integ
paulson
parents:
diff changeset
   228
qed "zadd_assoc_cong";
691c70898518 new files in Integ
paulson
parents:
diff changeset
   229
691c70898518 new files in Integ
paulson
parents:
diff changeset
   230
Goal "(z::int) + (v + w) = v + (z + w)";
691c70898518 new files in Integ
paulson
parents:
diff changeset
   231
by (REPEAT (ares_tac [zadd_commute RS zadd_assoc_cong] 1));
691c70898518 new files in Integ
paulson
parents:
diff changeset
   232
qed "zadd_assoc_swap";
691c70898518 new files in Integ
paulson
parents:
diff changeset
   233
691c70898518 new files in Integ
paulson
parents:
diff changeset
   234
691c70898518 new files in Integ
paulson
parents:
diff changeset
   235
(**** zmult: multiplication on Integ ****)
691c70898518 new files in Integ
paulson
parents:
diff changeset
   236
7375
2cb340e66d15 tidied, allowing pattern-matching in defs of zadd and zmult
paulson
parents: 7127
diff changeset
   237
(*Congruence property for multiplication*)
2cb340e66d15 tidied, allowing pattern-matching in defs of zadd and zmult
paulson
parents: 7127
diff changeset
   238
Goal "congruent2 intrel \
2cb340e66d15 tidied, allowing pattern-matching in defs of zadd and zmult
paulson
parents: 7127
diff changeset
   239
\       (%p1 p2. (%(x1,y1). (%(x2,y2).   \
5508
691c70898518 new files in Integ
paulson
parents:
diff changeset
   240
\                   intrel^^{(x1*x2 + y1*y2, x1*y2 + y1*x2)}) p2) p1)";
691c70898518 new files in Integ
paulson
parents:
diff changeset
   241
by (rtac (equiv_intrel RS congruent2_commuteI) 1);
691c70898518 new files in Integ
paulson
parents:
diff changeset
   242
by (pair_tac "w" 2);
7375
2cb340e66d15 tidied, allowing pattern-matching in defs of zadd and zmult
paulson
parents: 7127
diff changeset
   243
by (ALLGOALS Clarify_tac);
5508
691c70898518 new files in Integ
paulson
parents:
diff changeset
   244
by (simp_tac (simpset() addsimps add_ac@mult_ac) 1);
691c70898518 new files in Integ
paulson
parents:
diff changeset
   245
by (asm_simp_tac (simpset() delsimps [equiv_intrel_iff]
7375
2cb340e66d15 tidied, allowing pattern-matching in defs of zadd and zmult
paulson
parents: 7127
diff changeset
   246
                            addsimps add_ac@mult_ac) 1);
9392
c8e6529cc082 changed / to // for quotienting
paulson
parents: 9366
diff changeset
   247
by (rename_tac "x1 x2 y1 y2 z1 z2" 1);
c8e6529cc082 changed / to // for quotienting
paulson
parents: 9366
diff changeset
   248
by (rtac ([equiv_intrel, intrel_iff RS iffD2] MRS equiv_class_eq) 1);
c8e6529cc082 changed / to // for quotienting
paulson
parents: 9366
diff changeset
   249
by (asm_full_simp_tac (simpset() addsimps [intrel_def]) 1);
c8e6529cc082 changed / to // for quotienting
paulson
parents: 9366
diff changeset
   250
by (subgoal_tac 
c8e6529cc082 changed / to // for quotienting
paulson
parents: 9366
diff changeset
   251
    "x1*z1 + y2*z1 = y1*z1 + x2*z1 & x1*z2 + y2*z2 = y1*z2 + x2*z2" 1);
c8e6529cc082 changed / to // for quotienting
paulson
parents: 9366
diff changeset
   252
by (asm_simp_tac (simpset() addsimps [add_mult_distrib RS sym]) 2);
c8e6529cc082 changed / to // for quotienting
paulson
parents: 9366
diff changeset
   253
by (arith_tac 1);
5508
691c70898518 new files in Integ
paulson
parents:
diff changeset
   254
qed "zmult_congruent2";
691c70898518 new files in Integ
paulson
parents:
diff changeset
   255
691c70898518 new files in Integ
paulson
parents:
diff changeset
   256
Goalw [zmult_def]
691c70898518 new files in Integ
paulson
parents:
diff changeset
   257
   "Abs_Integ((intrel^^{(x1,y1)})) * Abs_Integ((intrel^^{(x2,y2)})) =   \
691c70898518 new files in Integ
paulson
parents:
diff changeset
   258
\   Abs_Integ(intrel ^^ {(x1*x2 + y1*y2, x1*y2 + y1*x2)})";
7375
2cb340e66d15 tidied, allowing pattern-matching in defs of zadd and zmult
paulson
parents: 7127
diff changeset
   259
by (asm_simp_tac
2cb340e66d15 tidied, allowing pattern-matching in defs of zadd and zmult
paulson
parents: 7127
diff changeset
   260
    (simpset() addsimps [UN_UN_split_split_eq, zmult_congruent2,
2cb340e66d15 tidied, allowing pattern-matching in defs of zadd and zmult
paulson
parents: 7127
diff changeset
   261
			 equiv_intrel RS UN_equiv_class2]) 1);
5508
691c70898518 new files in Integ
paulson
parents:
diff changeset
   262
qed "zmult";
691c70898518 new files in Integ
paulson
parents:
diff changeset
   263
691c70898518 new files in Integ
paulson
parents:
diff changeset
   264
Goal "(- z) * w = - (z * (w::int))";
691c70898518 new files in Integ
paulson
parents:
diff changeset
   265
by (res_inst_tac [("z","z")] eq_Abs_Integ 1);
691c70898518 new files in Integ
paulson
parents:
diff changeset
   266
by (res_inst_tac [("z","w")] eq_Abs_Integ 1);
5540
0f16c3b66ab4 much renaming and reorganization
paulson
parents: 5508
diff changeset
   267
by (asm_simp_tac (simpset() addsimps [zminus, zmult] @ add_ac) 1);
5508
691c70898518 new files in Integ
paulson
parents:
diff changeset
   268
qed "zmult_zminus";
691c70898518 new files in Integ
paulson
parents:
diff changeset
   269
691c70898518 new files in Integ
paulson
parents:
diff changeset
   270
Goal "(z::int) * w = w * z";
691c70898518 new files in Integ
paulson
parents:
diff changeset
   271
by (res_inst_tac [("z","z")] eq_Abs_Integ 1);
691c70898518 new files in Integ
paulson
parents:
diff changeset
   272
by (res_inst_tac [("z","w")] eq_Abs_Integ 1);
5540
0f16c3b66ab4 much renaming and reorganization
paulson
parents: 5508
diff changeset
   273
by (asm_simp_tac (simpset() addsimps [zmult] @ add_ac @ mult_ac) 1);
5508
691c70898518 new files in Integ
paulson
parents:
diff changeset
   274
qed "zmult_commute";
691c70898518 new files in Integ
paulson
parents:
diff changeset
   275
691c70898518 new files in Integ
paulson
parents:
diff changeset
   276
Goal "((z1::int) * z2) * z3 = z1 * (z2 * z3)";
691c70898518 new files in Integ
paulson
parents:
diff changeset
   277
by (res_inst_tac [("z","z1")] eq_Abs_Integ 1);
691c70898518 new files in Integ
paulson
parents:
diff changeset
   278
by (res_inst_tac [("z","z2")] eq_Abs_Integ 1);
691c70898518 new files in Integ
paulson
parents:
diff changeset
   279
by (res_inst_tac [("z","z3")] eq_Abs_Integ 1);
5540
0f16c3b66ab4 much renaming and reorganization
paulson
parents: 5508
diff changeset
   280
by (asm_simp_tac (simpset() addsimps [add_mult_distrib2,zmult] @ 
0f16c3b66ab4 much renaming and reorganization
paulson
parents: 5508
diff changeset
   281
                                     add_ac @ mult_ac) 1);
5508
691c70898518 new files in Integ
paulson
parents:
diff changeset
   282
qed "zmult_assoc";
691c70898518 new files in Integ
paulson
parents:
diff changeset
   283
691c70898518 new files in Integ
paulson
parents:
diff changeset
   284
(*For AC rewriting*)
691c70898518 new files in Integ
paulson
parents:
diff changeset
   285
Goal "(z1::int)*(z2*z3) = z2*(z1*z3)";
691c70898518 new files in Integ
paulson
parents:
diff changeset
   286
by (rtac (zmult_commute RS trans) 1);
691c70898518 new files in Integ
paulson
parents:
diff changeset
   287
by (rtac (zmult_assoc RS trans) 1);
691c70898518 new files in Integ
paulson
parents:
diff changeset
   288
by (rtac (zmult_commute RS arg_cong) 1);
691c70898518 new files in Integ
paulson
parents:
diff changeset
   289
qed "zmult_left_commute";
691c70898518 new files in Integ
paulson
parents:
diff changeset
   290
691c70898518 new files in Integ
paulson
parents:
diff changeset
   291
(*Integer multiplication is an AC operator*)
7428
80838c2af97b bind_thms;
wenzelm
parents: 7375
diff changeset
   292
bind_thms ("zmult_ac", [zmult_assoc, zmult_commute, zmult_left_commute]);
5508
691c70898518 new files in Integ
paulson
parents:
diff changeset
   293
691c70898518 new files in Integ
paulson
parents:
diff changeset
   294
Goal "((z1::int) + z2) * w = (z1 * w) + (z2 * w)";
691c70898518 new files in Integ
paulson
parents:
diff changeset
   295
by (res_inst_tac [("z","z1")] eq_Abs_Integ 1);
691c70898518 new files in Integ
paulson
parents:
diff changeset
   296
by (res_inst_tac [("z","z2")] eq_Abs_Integ 1);
691c70898518 new files in Integ
paulson
parents:
diff changeset
   297
by (res_inst_tac [("z","w")] eq_Abs_Integ 1);
691c70898518 new files in Integ
paulson
parents:
diff changeset
   298
by (asm_simp_tac 
5540
0f16c3b66ab4 much renaming and reorganization
paulson
parents: 5508
diff changeset
   299
    (simpset() addsimps [add_mult_distrib2, zadd, zmult] @ 
0f16c3b66ab4 much renaming and reorganization
paulson
parents: 5508
diff changeset
   300
                        add_ac @ mult_ac) 1);
5508
691c70898518 new files in Integ
paulson
parents:
diff changeset
   301
qed "zadd_zmult_distrib";
691c70898518 new files in Integ
paulson
parents:
diff changeset
   302
9544
f9202e219a29 added a dummy "thm list" argument to prove_conv for the new interface to
paulson
parents: 9392
diff changeset
   303
val zmult_commute'= inst "z" "w" zmult_commute;
5508
691c70898518 new files in Integ
paulson
parents:
diff changeset
   304
691c70898518 new files in Integ
paulson
parents:
diff changeset
   305
Goal "w * (- z) = - (w * (z::int))";
691c70898518 new files in Integ
paulson
parents:
diff changeset
   306
by (simp_tac (simpset() addsimps [zmult_commute', zmult_zminus]) 1);
691c70898518 new files in Integ
paulson
parents:
diff changeset
   307
qed "zmult_zminus_right";
691c70898518 new files in Integ
paulson
parents:
diff changeset
   308
691c70898518 new files in Integ
paulson
parents:
diff changeset
   309
Goal "(w::int) * (z1 + z2) = (w * z1) + (w * z2)";
691c70898518 new files in Integ
paulson
parents:
diff changeset
   310
by (simp_tac (simpset() addsimps [zmult_commute',zadd_zmult_distrib]) 1);
691c70898518 new files in Integ
paulson
parents:
diff changeset
   311
qed "zadd_zmult_distrib2";
691c70898518 new files in Integ
paulson
parents:
diff changeset
   312
6839
da8a39302686 new distributive laws involving * and -
paulson
parents: 6717
diff changeset
   313
Goalw [zdiff_def] "((z1::int) - z2) * w = (z1 * w) - (z2 * w)";
da8a39302686 new distributive laws involving * and -
paulson
parents: 6717
diff changeset
   314
by (stac zadd_zmult_distrib 1);
da8a39302686 new distributive laws involving * and -
paulson
parents: 6717
diff changeset
   315
by (simp_tac (simpset() addsimps [zmult_zminus]) 1);
da8a39302686 new distributive laws involving * and -
paulson
parents: 6717
diff changeset
   316
qed "zdiff_zmult_distrib";
da8a39302686 new distributive laws involving * and -
paulson
parents: 6717
diff changeset
   317
da8a39302686 new distributive laws involving * and -
paulson
parents: 6717
diff changeset
   318
Goal "(w::int) * (z1 - z2) = (w * z1) - (w * z2)";
da8a39302686 new distributive laws involving * and -
paulson
parents: 6717
diff changeset
   319
by (simp_tac (simpset() addsimps [zmult_commute',zdiff_zmult_distrib]) 1);
da8a39302686 new distributive laws involving * and -
paulson
parents: 6717
diff changeset
   320
qed "zdiff_zmult_distrib2";
da8a39302686 new distributive laws involving * and -
paulson
parents: 6717
diff changeset
   321
7010
63120b6dca50 more renaming of theorems from _nat to _int (corresponding to a function that
paulson
parents: 6991
diff changeset
   322
Goalw [int_def] "(int m) * (int n) = int (m * n)";
63120b6dca50 more renaming of theorems from _nat to _int (corresponding to a function that
paulson
parents: 6991
diff changeset
   323
by (simp_tac (simpset() addsimps [zmult]) 1);
63120b6dca50 more renaming of theorems from _nat to _int (corresponding to a function that
paulson
parents: 6991
diff changeset
   324
qed "zmult_int";
63120b6dca50 more renaming of theorems from _nat to _int (corresponding to a function that
paulson
parents: 6991
diff changeset
   325
5582
a356fb49e69e many renamings and changes. Simproc for cancelling common terms in relations
paulson
parents: 5562
diff changeset
   326
Goalw [int_def] "int 0 * z = int 0";
5508
691c70898518 new files in Integ
paulson
parents:
diff changeset
   327
by (res_inst_tac [("z","z")] eq_Abs_Integ 1);
691c70898518 new files in Integ
paulson
parents:
diff changeset
   328
by (asm_simp_tac (simpset() addsimps [zmult]) 1);
6917
eba301caceea Introduction of integer division algorithm
paulson
parents: 6839
diff changeset
   329
qed "zmult_int0";
5508
691c70898518 new files in Integ
paulson
parents:
diff changeset
   330
5582
a356fb49e69e many renamings and changes. Simproc for cancelling common terms in relations
paulson
parents: 5562
diff changeset
   331
Goalw [int_def] "int 1 * z = z";
5508
691c70898518 new files in Integ
paulson
parents:
diff changeset
   332
by (res_inst_tac [("z","z")] eq_Abs_Integ 1);
691c70898518 new files in Integ
paulson
parents:
diff changeset
   333
by (asm_simp_tac (simpset() addsimps [zmult]) 1);
6917
eba301caceea Introduction of integer division algorithm
paulson
parents: 6839
diff changeset
   334
qed "zmult_int1";
5508
691c70898518 new files in Integ
paulson
parents:
diff changeset
   335
5582
a356fb49e69e many renamings and changes. Simproc for cancelling common terms in relations
paulson
parents: 5562
diff changeset
   336
Goal "z * int 0 = int 0";
6917
eba301caceea Introduction of integer division algorithm
paulson
parents: 6839
diff changeset
   337
by (rtac ([zmult_commute, zmult_int0] MRS trans) 1);
eba301caceea Introduction of integer division algorithm
paulson
parents: 6839
diff changeset
   338
qed "zmult_int0_right";
5508
691c70898518 new files in Integ
paulson
parents:
diff changeset
   339
5582
a356fb49e69e many renamings and changes. Simproc for cancelling common terms in relations
paulson
parents: 5562
diff changeset
   340
Goal "z * int 1 = z";
6917
eba301caceea Introduction of integer division algorithm
paulson
parents: 6839
diff changeset
   341
by (rtac ([zmult_commute, zmult_int1] MRS trans) 1);
eba301caceea Introduction of integer division algorithm
paulson
parents: 6839
diff changeset
   342
qed "zmult_int1_right";
5508
691c70898518 new files in Integ
paulson
parents:
diff changeset
   343
6917
eba301caceea Introduction of integer division algorithm
paulson
parents: 6839
diff changeset
   344
Addsimps [zmult_int0, zmult_int0_right, zmult_int1, zmult_int1_right];
5508
691c70898518 new files in Integ
paulson
parents:
diff changeset
   345
691c70898518 new files in Integ
paulson
parents:
diff changeset
   346
691c70898518 new files in Integ
paulson
parents:
diff changeset
   347
(* Theorems about less and less_equal *)
691c70898518 new files in Integ
paulson
parents:
diff changeset
   348
691c70898518 new files in Integ
paulson
parents:
diff changeset
   349
(*This lemma allows direct proofs of other <-properties*)
5562
02261e6880d1 Renaming of Integ/Integ.* to Integ/Int.*, and renaming of related constants
paulson
parents: 5540
diff changeset
   350
Goalw [zless_def, neg_def, zdiff_def, int_def] 
5582
a356fb49e69e many renamings and changes. Simproc for cancelling common terms in relations
paulson
parents: 5562
diff changeset
   351
    "(w < z) = (EX n. z = w + int(Suc n))";
5508
691c70898518 new files in Integ
paulson
parents:
diff changeset
   352
by (res_inst_tac [("z","z")] eq_Abs_Integ 1);
691c70898518 new files in Integ
paulson
parents:
diff changeset
   353
by (res_inst_tac [("z","w")] eq_Abs_Integ 1);
691c70898518 new files in Integ
paulson
parents:
diff changeset
   354
by (Clarify_tac 1);
691c70898518 new files in Integ
paulson
parents:
diff changeset
   355
by (asm_full_simp_tac (simpset() addsimps [zadd, zminus]) 1);
691c70898518 new files in Integ
paulson
parents:
diff changeset
   356
by (safe_tac (claset() addSDs [less_eq_Suc_add]));
691c70898518 new files in Integ
paulson
parents:
diff changeset
   357
by (res_inst_tac [("x","k")] exI 1);
691c70898518 new files in Integ
paulson
parents:
diff changeset
   358
by (ALLGOALS (asm_full_simp_tac (simpset() addsimps add_ac)));
691c70898518 new files in Integ
paulson
parents:
diff changeset
   359
qed "zless_iff_Suc_zadd";
691c70898518 new files in Integ
paulson
parents:
diff changeset
   360
5582
a356fb49e69e many renamings and changes. Simproc for cancelling common terms in relations
paulson
parents: 5562
diff changeset
   361
Goal "z < z + int (Suc n)";
5508
691c70898518 new files in Integ
paulson
parents:
diff changeset
   362
by (auto_tac (claset(),
691c70898518 new files in Integ
paulson
parents:
diff changeset
   363
	      simpset() addsimps [zless_iff_Suc_zadd, zadd_assoc, 
5582
a356fb49e69e many renamings and changes. Simproc for cancelling common terms in relations
paulson
parents: 5562
diff changeset
   364
				  zadd_int]));
5508
691c70898518 new files in Integ
paulson
parents:
diff changeset
   365
qed "zless_zadd_Suc";
691c70898518 new files in Integ
paulson
parents:
diff changeset
   366
691c70898518 new files in Integ
paulson
parents:
diff changeset
   367
Goal "[| z1<z2; z2<z3 |] ==> z1 < (z3::int)";
691c70898518 new files in Integ
paulson
parents:
diff changeset
   368
by (auto_tac (claset(),
691c70898518 new files in Integ
paulson
parents:
diff changeset
   369
	      simpset() addsimps [zless_iff_Suc_zadd, zadd_assoc, 
5582
a356fb49e69e many renamings and changes. Simproc for cancelling common terms in relations
paulson
parents: 5562
diff changeset
   370
				  zadd_int]));
5508
691c70898518 new files in Integ
paulson
parents:
diff changeset
   371
qed "zless_trans";
691c70898518 new files in Integ
paulson
parents:
diff changeset
   372
691c70898518 new files in Integ
paulson
parents:
diff changeset
   373
Goal "!!w::int. z<w ==> ~w<z";
691c70898518 new files in Integ
paulson
parents:
diff changeset
   374
by (safe_tac (claset() addSDs [zless_iff_Suc_zadd RS iffD1]));
691c70898518 new files in Integ
paulson
parents:
diff changeset
   375
by (res_inst_tac [("z","z")] eq_Abs_Integ 1);
691c70898518 new files in Integ
paulson
parents:
diff changeset
   376
by Safe_tac;
5562
02261e6880d1 Renaming of Integ/Integ.* to Integ/Int.*, and renaming of related constants
paulson
parents: 5540
diff changeset
   377
by (asm_full_simp_tac (simpset() addsimps [int_def, zadd]) 1);
5508
691c70898518 new files in Integ
paulson
parents:
diff changeset
   378
qed "zless_not_sym";
691c70898518 new files in Integ
paulson
parents:
diff changeset
   379
691c70898518 new files in Integ
paulson
parents:
diff changeset
   380
(* [| n<m;  ~P ==> m<n |] ==> P *)
5540
0f16c3b66ab4 much renaming and reorganization
paulson
parents: 5508
diff changeset
   381
bind_thm ("zless_asym", zless_not_sym RS swap);
5508
691c70898518 new files in Integ
paulson
parents:
diff changeset
   382
691c70898518 new files in Integ
paulson
parents:
diff changeset
   383
Goal "!!z::int. ~ z<z";
691c70898518 new files in Integ
paulson
parents:
diff changeset
   384
by (resolve_tac [zless_asym RS notI] 1);
691c70898518 new files in Integ
paulson
parents:
diff changeset
   385
by (REPEAT (assume_tac 1));
691c70898518 new files in Integ
paulson
parents:
diff changeset
   386
qed "zless_not_refl";
691c70898518 new files in Integ
paulson
parents:
diff changeset
   387
691c70898518 new files in Integ
paulson
parents:
diff changeset
   388
(* z<z ==> R *)
5594
e4439230af67 much tidying
paulson
parents: 5582
diff changeset
   389
bind_thm ("zless_irrefl", zless_not_refl RS notE);
5508
691c70898518 new files in Integ
paulson
parents:
diff changeset
   390
AddSEs [zless_irrefl];
691c70898518 new files in Integ
paulson
parents:
diff changeset
   391
691c70898518 new files in Integ
paulson
parents:
diff changeset
   392
Goal "z<w ==> w ~= (z::int)";
691c70898518 new files in Integ
paulson
parents:
diff changeset
   393
by (Blast_tac 1);
691c70898518 new files in Integ
paulson
parents:
diff changeset
   394
qed "zless_not_refl2";
691c70898518 new files in Integ
paulson
parents:
diff changeset
   395
691c70898518 new files in Integ
paulson
parents:
diff changeset
   396
(* s < t ==> s ~= t *)
691c70898518 new files in Integ
paulson
parents:
diff changeset
   397
bind_thm ("zless_not_refl3", zless_not_refl2 RS not_sym);
691c70898518 new files in Integ
paulson
parents:
diff changeset
   398
691c70898518 new files in Integ
paulson
parents:
diff changeset
   399
691c70898518 new files in Integ
paulson
parents:
diff changeset
   400
(*"Less than" is a linear ordering*)
5540
0f16c3b66ab4 much renaming and reorganization
paulson
parents: 5508
diff changeset
   401
Goalw [zless_def, neg_def, zdiff_def] 
5508
691c70898518 new files in Integ
paulson
parents:
diff changeset
   402
    "z<w | z=w | w<(z::int)";
691c70898518 new files in Integ
paulson
parents:
diff changeset
   403
by (res_inst_tac [("z","z")] eq_Abs_Integ 1);
691c70898518 new files in Integ
paulson
parents:
diff changeset
   404
by (res_inst_tac [("z","w")] eq_Abs_Integ 1);
691c70898518 new files in Integ
paulson
parents:
diff changeset
   405
by Safe_tac;
691c70898518 new files in Integ
paulson
parents:
diff changeset
   406
by (asm_full_simp_tac
691c70898518 new files in Integ
paulson
parents:
diff changeset
   407
    (simpset() addsimps [zadd, zminus, Image_iff, Bex_def]) 1);
691c70898518 new files in Integ
paulson
parents:
diff changeset
   408
by (res_inst_tac [("m1", "x+ya"), ("n1", "xa+y")] (less_linear RS disjE) 1);
5758
27a2b36efd95 corrected auto_tac (applications of unsafe wrappers)
oheimb
parents: 5594
diff changeset
   409
by (ALLGOALS (force_tac (claset(), simpset() addsimps add_ac)));
5508
691c70898518 new files in Integ
paulson
parents:
diff changeset
   410
qed "zless_linear";
691c70898518 new files in Integ
paulson
parents:
diff changeset
   411
691c70898518 new files in Integ
paulson
parents:
diff changeset
   412
Goal "!!w::int. (w ~= z) = (w<z | z<w)";
691c70898518 new files in Integ
paulson
parents:
diff changeset
   413
by (cut_facts_tac [zless_linear] 1);
691c70898518 new files in Integ
paulson
parents:
diff changeset
   414
by (Blast_tac 1);
691c70898518 new files in Integ
paulson
parents:
diff changeset
   415
qed "int_neq_iff";
691c70898518 new files in Integ
paulson
parents:
diff changeset
   416
691c70898518 new files in Integ
paulson
parents:
diff changeset
   417
(*** eliminates ~= in premises ***)
691c70898518 new files in Integ
paulson
parents:
diff changeset
   418
bind_thm("int_neqE", int_neq_iff RS iffD1 RS disjE);
691c70898518 new files in Integ
paulson
parents:
diff changeset
   419
5582
a356fb49e69e many renamings and changes. Simproc for cancelling common terms in relations
paulson
parents: 5562
diff changeset
   420
Goal "(int m = int n) = (m = n)"; 
6991
500038b6063b renamed inj_nat to inj_int
paulson
parents: 6917
diff changeset
   421
by (fast_tac (claset() addSEs [inj_int RS injD]) 1); 
5562
02261e6880d1 Renaming of Integ/Integ.* to Integ/Int.*, and renaming of related constants
paulson
parents: 5540
diff changeset
   422
qed "int_int_eq"; 
02261e6880d1 Renaming of Integ/Integ.* to Integ/Int.*, and renaming of related constants
paulson
parents: 5540
diff changeset
   423
AddIffs [int_int_eq]; 
5508
691c70898518 new files in Integ
paulson
parents:
diff changeset
   424
5582
a356fb49e69e many renamings and changes. Simproc for cancelling common terms in relations
paulson
parents: 5562
diff changeset
   425
Goal "(int m < int n) = (m<n)";
5508
691c70898518 new files in Integ
paulson
parents:
diff changeset
   426
by (simp_tac (simpset() addsimps [less_iff_Suc_add, zless_iff_Suc_zadd, 
5582
a356fb49e69e many renamings and changes. Simproc for cancelling common terms in relations
paulson
parents: 5562
diff changeset
   427
				  zadd_int]) 1);
a356fb49e69e many renamings and changes. Simproc for cancelling common terms in relations
paulson
parents: 5562
diff changeset
   428
qed "zless_int";
a356fb49e69e many renamings and changes. Simproc for cancelling common terms in relations
paulson
parents: 5562
diff changeset
   429
Addsimps [zless_int];
5508
691c70898518 new files in Integ
paulson
parents:
diff changeset
   430
691c70898518 new files in Integ
paulson
parents:
diff changeset
   431
691c70898518 new files in Integ
paulson
parents:
diff changeset
   432
(*** Properties of <= ***)
691c70898518 new files in Integ
paulson
parents:
diff changeset
   433
5582
a356fb49e69e many renamings and changes. Simproc for cancelling common terms in relations
paulson
parents: 5562
diff changeset
   434
Goalw [zle_def, le_def] "(int m <= int n) = (m<=n)";
5508
691c70898518 new files in Integ
paulson
parents:
diff changeset
   435
by (Simp_tac 1);
5582
a356fb49e69e many renamings and changes. Simproc for cancelling common terms in relations
paulson
parents: 5562
diff changeset
   436
qed "zle_int";
a356fb49e69e many renamings and changes. Simproc for cancelling common terms in relations
paulson
parents: 5562
diff changeset
   437
Addsimps [zle_int];
5508
691c70898518 new files in Integ
paulson
parents:
diff changeset
   438
691c70898518 new files in Integ
paulson
parents:
diff changeset
   439
Goalw [zle_def] "z <= w ==> z < w | z=(w::int)";
691c70898518 new files in Integ
paulson
parents:
diff changeset
   440
by (cut_facts_tac [zless_linear] 1);
691c70898518 new files in Integ
paulson
parents:
diff changeset
   441
by (blast_tac (claset() addEs [zless_asym]) 1);
691c70898518 new files in Integ
paulson
parents:
diff changeset
   442
qed "zle_imp_zless_or_eq";
691c70898518 new files in Integ
paulson
parents:
diff changeset
   443
691c70898518 new files in Integ
paulson
parents:
diff changeset
   444
Goalw [zle_def] "z<w | z=w ==> z <= (w::int)";
691c70898518 new files in Integ
paulson
parents:
diff changeset
   445
by (cut_facts_tac [zless_linear] 1);
691c70898518 new files in Integ
paulson
parents:
diff changeset
   446
by (blast_tac (claset() addEs [zless_asym]) 1);
691c70898518 new files in Integ
paulson
parents:
diff changeset
   447
qed "zless_or_eq_imp_zle";
691c70898518 new files in Integ
paulson
parents:
diff changeset
   448
691c70898518 new files in Integ
paulson
parents:
diff changeset
   449
Goal "(x <= (y::int)) = (x < y | x=y)";
691c70898518 new files in Integ
paulson
parents:
diff changeset
   450
by (REPEAT(ares_tac [iffI, zless_or_eq_imp_zle, zle_imp_zless_or_eq] 1));
5540
0f16c3b66ab4 much renaming and reorganization
paulson
parents: 5508
diff changeset
   451
qed "integ_le_less";
5508
691c70898518 new files in Integ
paulson
parents:
diff changeset
   452
691c70898518 new files in Integ
paulson
parents:
diff changeset
   453
Goal "w <= (w::int)";
5540
0f16c3b66ab4 much renaming and reorganization
paulson
parents: 5508
diff changeset
   454
by (simp_tac (simpset() addsimps [integ_le_less]) 1);
5508
691c70898518 new files in Integ
paulson
parents:
diff changeset
   455
qed "zle_refl";
691c70898518 new files in Integ
paulson
parents:
diff changeset
   456
691c70898518 new files in Integ
paulson
parents:
diff changeset
   457
Goalw [zle_def] "z < w ==> z <= (w::int)";
691c70898518 new files in Integ
paulson
parents:
diff changeset
   458
by (blast_tac (claset() addEs [zless_asym]) 1);
691c70898518 new files in Integ
paulson
parents:
diff changeset
   459
qed "zless_imp_zle";
691c70898518 new files in Integ
paulson
parents:
diff changeset
   460
691c70898518 new files in Integ
paulson
parents:
diff changeset
   461
(* Axiom 'linorder_linear' of class 'linorder': *)
691c70898518 new files in Integ
paulson
parents:
diff changeset
   462
Goal "(z::int) <= w | w <= z";
5540
0f16c3b66ab4 much renaming and reorganization
paulson
parents: 5508
diff changeset
   463
by (simp_tac (simpset() addsimps [integ_le_less]) 1);
5508
691c70898518 new files in Integ
paulson
parents:
diff changeset
   464
by (cut_facts_tac [zless_linear] 1);
691c70898518 new files in Integ
paulson
parents:
diff changeset
   465
by (Blast_tac 1);
691c70898518 new files in Integ
paulson
parents:
diff changeset
   466
qed "zle_linear";
691c70898518 new files in Integ
paulson
parents:
diff changeset
   467
691c70898518 new files in Integ
paulson
parents:
diff changeset
   468
Goal "[| i <= j; j < k |] ==> i < (k::int)";
691c70898518 new files in Integ
paulson
parents:
diff changeset
   469
by (dtac zle_imp_zless_or_eq 1);
691c70898518 new files in Integ
paulson
parents:
diff changeset
   470
by (blast_tac (claset() addIs [zless_trans]) 1);
691c70898518 new files in Integ
paulson
parents:
diff changeset
   471
qed "zle_zless_trans";
691c70898518 new files in Integ
paulson
parents:
diff changeset
   472
691c70898518 new files in Integ
paulson
parents:
diff changeset
   473
Goal "[| i < j; j <= k |] ==> i < (k::int)";
691c70898518 new files in Integ
paulson
parents:
diff changeset
   474
by (dtac zle_imp_zless_or_eq 1);
691c70898518 new files in Integ
paulson
parents:
diff changeset
   475
by (blast_tac (claset() addIs [zless_trans]) 1);
691c70898518 new files in Integ
paulson
parents:
diff changeset
   476
qed "zless_zle_trans";
691c70898518 new files in Integ
paulson
parents:
diff changeset
   477
691c70898518 new files in Integ
paulson
parents:
diff changeset
   478
Goal "[| i <= j; j <= k |] ==> i <= (k::int)";
691c70898518 new files in Integ
paulson
parents:
diff changeset
   479
by (EVERY1 [dtac zle_imp_zless_or_eq, dtac zle_imp_zless_or_eq,
691c70898518 new files in Integ
paulson
parents:
diff changeset
   480
            rtac zless_or_eq_imp_zle, 
691c70898518 new files in Integ
paulson
parents:
diff changeset
   481
	    blast_tac (claset() addIs [zless_trans])]);
691c70898518 new files in Integ
paulson
parents:
diff changeset
   482
qed "zle_trans";
691c70898518 new files in Integ
paulson
parents:
diff changeset
   483
691c70898518 new files in Integ
paulson
parents:
diff changeset
   484
Goal "[| z <= w; w <= z |] ==> z = (w::int)";
691c70898518 new files in Integ
paulson
parents:
diff changeset
   485
by (EVERY1 [dtac zle_imp_zless_or_eq, dtac zle_imp_zless_or_eq,
691c70898518 new files in Integ
paulson
parents:
diff changeset
   486
            blast_tac (claset() addEs [zless_asym])]);
691c70898518 new files in Integ
paulson
parents:
diff changeset
   487
qed "zle_anti_sym";
691c70898518 new files in Integ
paulson
parents:
diff changeset
   488
691c70898518 new files in Integ
paulson
parents:
diff changeset
   489
(* Axiom 'order_less_le' of class 'order': *)
691c70898518 new files in Integ
paulson
parents:
diff changeset
   490
Goal "(w::int) < z = (w <= z & w ~= z)";
691c70898518 new files in Integ
paulson
parents:
diff changeset
   491
by (simp_tac (simpset() addsimps [zle_def, int_neq_iff]) 1);
691c70898518 new files in Integ
paulson
parents:
diff changeset
   492
by (blast_tac (claset() addSEs [zless_asym]) 1);
691c70898518 new files in Integ
paulson
parents:
diff changeset
   493
qed "int_less_le";
691c70898518 new files in Integ
paulson
parents:
diff changeset
   494
691c70898518 new files in Integ
paulson
parents:
diff changeset
   495
(* [| w <= z; w ~= z |] ==> w < z *)
691c70898518 new files in Integ
paulson
parents:
diff changeset
   496
bind_thm ("zle_neq_implies_zless", [int_less_le, conjI] MRS iffD2);
691c70898518 new files in Integ
paulson
parents:
diff changeset
   497
691c70898518 new files in Integ
paulson
parents:
diff changeset
   498
691c70898518 new files in Integ
paulson
parents:
diff changeset
   499
691c70898518 new files in Integ
paulson
parents:
diff changeset
   500
(*** Subtraction laws ***)
691c70898518 new files in Integ
paulson
parents:
diff changeset
   501
691c70898518 new files in Integ
paulson
parents:
diff changeset
   502
Goal "x + (y - z) = (x + y) - (z::int)";
5540
0f16c3b66ab4 much renaming and reorganization
paulson
parents: 5508
diff changeset
   503
by (simp_tac (simpset() addsimps zdiff_def::zadd_ac) 1);
5508
691c70898518 new files in Integ
paulson
parents:
diff changeset
   504
qed "zadd_zdiff_eq";
691c70898518 new files in Integ
paulson
parents:
diff changeset
   505
691c70898518 new files in Integ
paulson
parents:
diff changeset
   506
Goal "(x - y) + z = (x + z) - (y::int)";
5540
0f16c3b66ab4 much renaming and reorganization
paulson
parents: 5508
diff changeset
   507
by (simp_tac (simpset() addsimps zdiff_def::zadd_ac) 1);
5508
691c70898518 new files in Integ
paulson
parents:
diff changeset
   508
qed "zdiff_zadd_eq";
691c70898518 new files in Integ
paulson
parents:
diff changeset
   509
691c70898518 new files in Integ
paulson
parents:
diff changeset
   510
Goal "(x - y) - z = x - (y + (z::int))";
5540
0f16c3b66ab4 much renaming and reorganization
paulson
parents: 5508
diff changeset
   511
by (simp_tac (simpset() addsimps zdiff_def::zadd_ac) 1);
5508
691c70898518 new files in Integ
paulson
parents:
diff changeset
   512
qed "zdiff_zdiff_eq";
691c70898518 new files in Integ
paulson
parents:
diff changeset
   513
691c70898518 new files in Integ
paulson
parents:
diff changeset
   514
Goal "x - (y - z) = (x + z) - (y::int)";
5540
0f16c3b66ab4 much renaming and reorganization
paulson
parents: 5508
diff changeset
   515
by (simp_tac (simpset() addsimps zdiff_def::zadd_ac) 1);
5508
691c70898518 new files in Integ
paulson
parents:
diff changeset
   516
qed "zdiff_zdiff_eq2";
691c70898518 new files in Integ
paulson
parents:
diff changeset
   517
691c70898518 new files in Integ
paulson
parents:
diff changeset
   518
Goalw [zless_def, zdiff_def] "(x-y < z) = (x < z + (y::int))";
691c70898518 new files in Integ
paulson
parents:
diff changeset
   519
by (simp_tac (simpset() addsimps zadd_ac) 1);
691c70898518 new files in Integ
paulson
parents:
diff changeset
   520
qed "zdiff_zless_eq";
691c70898518 new files in Integ
paulson
parents:
diff changeset
   521
691c70898518 new files in Integ
paulson
parents:
diff changeset
   522
Goalw [zless_def, zdiff_def] "(x < z-y) = (x + (y::int) < z)";
691c70898518 new files in Integ
paulson
parents:
diff changeset
   523
by (simp_tac (simpset() addsimps zadd_ac) 1);
691c70898518 new files in Integ
paulson
parents:
diff changeset
   524
qed "zless_zdiff_eq";
691c70898518 new files in Integ
paulson
parents:
diff changeset
   525
691c70898518 new files in Integ
paulson
parents:
diff changeset
   526
Goalw [zle_def] "(x-y <= z) = (x <= z + (y::int))";
691c70898518 new files in Integ
paulson
parents:
diff changeset
   527
by (simp_tac (simpset() addsimps [zless_zdiff_eq]) 1);
691c70898518 new files in Integ
paulson
parents:
diff changeset
   528
qed "zdiff_zle_eq";
691c70898518 new files in Integ
paulson
parents:
diff changeset
   529
691c70898518 new files in Integ
paulson
parents:
diff changeset
   530
Goalw [zle_def] "(x <= z-y) = (x + (y::int) <= z)";
691c70898518 new files in Integ
paulson
parents:
diff changeset
   531
by (simp_tac (simpset() addsimps [zdiff_zless_eq]) 1);
691c70898518 new files in Integ
paulson
parents:
diff changeset
   532
qed "zle_zdiff_eq";
691c70898518 new files in Integ
paulson
parents:
diff changeset
   533
691c70898518 new files in Integ
paulson
parents:
diff changeset
   534
Goalw [zdiff_def] "(x-y = z) = (x = z + (y::int))";
691c70898518 new files in Integ
paulson
parents:
diff changeset
   535
by (auto_tac (claset(), simpset() addsimps [zadd_assoc]));
691c70898518 new files in Integ
paulson
parents:
diff changeset
   536
qed "zdiff_eq_eq";
691c70898518 new files in Integ
paulson
parents:
diff changeset
   537
691c70898518 new files in Integ
paulson
parents:
diff changeset
   538
Goalw [zdiff_def] "(x = z-y) = (x + (y::int) = z)";
691c70898518 new files in Integ
paulson
parents:
diff changeset
   539
by (auto_tac (claset(), simpset() addsimps [zadd_assoc]));
691c70898518 new files in Integ
paulson
parents:
diff changeset
   540
qed "eq_zdiff_eq";
691c70898518 new files in Integ
paulson
parents:
diff changeset
   541
691c70898518 new files in Integ
paulson
parents:
diff changeset
   542
(*This list of rewrites simplifies (in)equalities by bringing subtractions
691c70898518 new files in Integ
paulson
parents:
diff changeset
   543
  to the top and then moving negative terms to the other side.  
691c70898518 new files in Integ
paulson
parents:
diff changeset
   544
  Use with zadd_ac*)
9108
9fff97d29837 bind_thm(s);
wenzelm
parents: 8949
diff changeset
   545
bind_thms ("zcompare_rls",
5508
691c70898518 new files in Integ
paulson
parents:
diff changeset
   546
    [symmetric zdiff_def,
691c70898518 new files in Integ
paulson
parents:
diff changeset
   547
     zadd_zdiff_eq, zdiff_zadd_eq, zdiff_zdiff_eq, zdiff_zdiff_eq2, 
691c70898518 new files in Integ
paulson
parents:
diff changeset
   548
     zdiff_zless_eq, zless_zdiff_eq, zdiff_zle_eq, zle_zdiff_eq, 
9108
9fff97d29837 bind_thm(s);
wenzelm
parents: 8949
diff changeset
   549
     zdiff_eq_eq, eq_zdiff_eq]);
5508
691c70898518 new files in Integ
paulson
parents:
diff changeset
   550
691c70898518 new files in Integ
paulson
parents:
diff changeset
   551
691c70898518 new files in Integ
paulson
parents:
diff changeset
   552
(** Cancellation laws **)
691c70898518 new files in Integ
paulson
parents:
diff changeset
   553
691c70898518 new files in Integ
paulson
parents:
diff changeset
   554
Goal "!!w::int. (z + w' = z + w) = (w' = w)";
691c70898518 new files in Integ
paulson
parents:
diff changeset
   555
by Safe_tac;
7127
48e235179ffb added parentheses to cope with a possible reduction of the precedence of unary
paulson
parents: 7010
diff changeset
   556
by (dres_inst_tac [("f", "%x. x + (-z)")] arg_cong 1);
5508
691c70898518 new files in Integ
paulson
parents:
diff changeset
   557
by (asm_full_simp_tac (simpset() addsimps zadd_ac) 1);
691c70898518 new files in Integ
paulson
parents:
diff changeset
   558
qed "zadd_left_cancel";
691c70898518 new files in Integ
paulson
parents:
diff changeset
   559
691c70898518 new files in Integ
paulson
parents:
diff changeset
   560
Addsimps [zadd_left_cancel];
691c70898518 new files in Integ
paulson
parents:
diff changeset
   561
691c70898518 new files in Integ
paulson
parents:
diff changeset
   562
Goal "!!z::int. (w' + z = w + z) = (w' = w)";
691c70898518 new files in Integ
paulson
parents:
diff changeset
   563
by (asm_full_simp_tac (simpset() addsimps zadd_ac) 1);
691c70898518 new files in Integ
paulson
parents:
diff changeset
   564
qed "zadd_right_cancel";
691c70898518 new files in Integ
paulson
parents:
diff changeset
   565
691c70898518 new files in Integ
paulson
parents:
diff changeset
   566
Addsimps [zadd_right_cancel];
691c70898518 new files in Integ
paulson
parents:
diff changeset
   567
691c70898518 new files in Integ
paulson
parents:
diff changeset
   568
5594
e4439230af67 much tidying
paulson
parents: 5582
diff changeset
   569
(** For the cancellation simproc.
e4439230af67 much tidying
paulson
parents: 5582
diff changeset
   570
    The idea is to cancel like terms on opposite sides by subtraction **)
e4439230af67 much tidying
paulson
parents: 5582
diff changeset
   571
e4439230af67 much tidying
paulson
parents: 5582
diff changeset
   572
Goal "(x::int) - y = x' - y' ==> (x<y) = (x'<y')";
e4439230af67 much tidying
paulson
parents: 5582
diff changeset
   573
by (asm_simp_tac (simpset() addsimps [zless_def]) 1);
e4439230af67 much tidying
paulson
parents: 5582
diff changeset
   574
qed "zless_eqI";
5508
691c70898518 new files in Integ
paulson
parents:
diff changeset
   575
5594
e4439230af67 much tidying
paulson
parents: 5582
diff changeset
   576
Goal "(x::int) - y = x' - y' ==> (y<=x) = (y'<=x')";
e4439230af67 much tidying
paulson
parents: 5582
diff changeset
   577
by (dtac zless_eqI 1);
e4439230af67 much tidying
paulson
parents: 5582
diff changeset
   578
by (asm_simp_tac (simpset() addsimps [zle_def]) 1);
e4439230af67 much tidying
paulson
parents: 5582
diff changeset
   579
qed "zle_eqI";
5508
691c70898518 new files in Integ
paulson
parents:
diff changeset
   580
5594
e4439230af67 much tidying
paulson
parents: 5582
diff changeset
   581
Goal "(x::int) - y = x' - y' ==> (x=y) = (x'=y')";
e4439230af67 much tidying
paulson
parents: 5582
diff changeset
   582
by Safe_tac;
e4439230af67 much tidying
paulson
parents: 5582
diff changeset
   583
by (ALLGOALS
e4439230af67 much tidying
paulson
parents: 5582
diff changeset
   584
    (asm_full_simp_tac (simpset() addsimps [eq_zdiff_eq, zdiff_eq_eq])));
e4439230af67 much tidying
paulson
parents: 5582
diff changeset
   585
qed "zeq_eqI";
5582
a356fb49e69e many renamings and changes. Simproc for cancelling common terms in relations
paulson
parents: 5562
diff changeset
   586