src/HOL/Integ/IntDef.thy
author paulson
Fri, 09 Jan 2004 10:46:18 +0100
changeset 14348 744c868ee0b7
parent 14341 a09441bd4f1e
child 14378 69c4d5997669
permissions -rw-r--r--
Defining the type class "ringpower" and deleting superseded theorems for types nat, int, real, hypreal
Ignore whitespace changes - Everywhere: Within whitespace: At end of lines:
5508
691c70898518 new files in Integ
paulson
parents:
diff changeset
     1
(*  Title:      IntDef.thy
691c70898518 new files in Integ
paulson
parents:
diff changeset
     2
    ID:         $Id$
691c70898518 new files in Integ
paulson
parents:
diff changeset
     3
    Author:     Lawrence C Paulson, Cambridge University Computer Laboratory
691c70898518 new files in Integ
paulson
parents:
diff changeset
     4
    Copyright   1996  University of Cambridge
691c70898518 new files in Integ
paulson
parents:
diff changeset
     5
691c70898518 new files in Integ
paulson
parents:
diff changeset
     6
*)
691c70898518 new files in Integ
paulson
parents:
diff changeset
     7
14271
8ed6989228bb Simplification of the development of Integers
paulson
parents: 14269
diff changeset
     8
header{*The Integers as Equivalence Classes over Pairs of Natural Numbers*}
8ed6989228bb Simplification of the development of Integers
paulson
parents: 14269
diff changeset
     9
14259
79f7d3451b1e conversion of ML to Isar scripts
paulson
parents: 13487
diff changeset
    10
theory IntDef = Equiv + NatArith:
5508
691c70898518 new files in Integ
paulson
parents:
diff changeset
    11
constdefs
14271
8ed6989228bb Simplification of the development of Integers
paulson
parents: 14269
diff changeset
    12
  intrel :: "((nat * nat) * (nat * nat)) set"
8ed6989228bb Simplification of the development of Integers
paulson
parents: 14269
diff changeset
    13
    "intrel == {p. \<exists>x1 y1 x2 y2. p = ((x1,y1),(x2,y2)) & x1+y2 = x2+y1}"
5508
691c70898518 new files in Integ
paulson
parents:
diff changeset
    14
691c70898518 new files in Integ
paulson
parents:
diff changeset
    15
typedef (Integ)
14259
79f7d3451b1e conversion of ML to Isar scripts
paulson
parents: 13487
diff changeset
    16
  int = "UNIV//intrel"
79f7d3451b1e conversion of ML to Isar scripts
paulson
parents: 13487
diff changeset
    17
    by (auto simp add: quotient_def) 
5508
691c70898518 new files in Integ
paulson
parents:
diff changeset
    18
14259
79f7d3451b1e conversion of ML to Isar scripts
paulson
parents: 13487
diff changeset
    19
instance int :: ord ..
79f7d3451b1e conversion of ML to Isar scripts
paulson
parents: 13487
diff changeset
    20
instance int :: zero ..
79f7d3451b1e conversion of ML to Isar scripts
paulson
parents: 13487
diff changeset
    21
instance int :: one ..
79f7d3451b1e conversion of ML to Isar scripts
paulson
parents: 13487
diff changeset
    22
instance int :: plus ..
79f7d3451b1e conversion of ML to Isar scripts
paulson
parents: 13487
diff changeset
    23
instance int :: times ..
79f7d3451b1e conversion of ML to Isar scripts
paulson
parents: 13487
diff changeset
    24
instance int :: minus ..
5508
691c70898518 new files in Integ
paulson
parents:
diff changeset
    25
691c70898518 new files in Integ
paulson
parents:
diff changeset
    26
constdefs
691c70898518 new files in Integ
paulson
parents:
diff changeset
    27
14259
79f7d3451b1e conversion of ML to Isar scripts
paulson
parents: 13487
diff changeset
    28
  int :: "nat => int"
10834
a7897aebbffc *** empty log message ***
nipkow
parents: 10797
diff changeset
    29
  "int m == Abs_Integ(intrel `` {(m,0)})"
5508
691c70898518 new files in Integ
paulson
parents:
diff changeset
    30
14259
79f7d3451b1e conversion of ML to Isar scripts
paulson
parents: 13487
diff changeset
    31
  neg   :: "int => bool"
14271
8ed6989228bb Simplification of the development of Integers
paulson
parents: 14269
diff changeset
    32
  "neg(Z) == \<exists>x y. x<y & (x,y::nat):Rep_Integ(Z)"
5508
691c70898518 new files in Integ
paulson
parents:
diff changeset
    33
691c70898518 new files in Integ
paulson
parents:
diff changeset
    34
  (*For simplifying equalities*)
14259
79f7d3451b1e conversion of ML to Isar scripts
paulson
parents: 13487
diff changeset
    35
  iszero :: "int => bool"
11868
56db9f3a6b3e Numerals now work for the integers: the binary numerals for 0 and 1 rewrite
paulson
parents: 11713
diff changeset
    36
  "iszero z == z = (0::int)"
5508
691c70898518 new files in Integ
paulson
parents:
diff changeset
    37
  
14269
502a7c95de73 conversion of some Real theories to Isar scripts
paulson
parents: 14259
diff changeset
    38
defs (overloaded)
9392
c8e6529cc082 changed / to // for quotienting
paulson
parents: 8937
diff changeset
    39
  
14271
8ed6989228bb Simplification of the development of Integers
paulson
parents: 14269
diff changeset
    40
  zminus_def:    "- Z == Abs_Integ(\<Union>(x,y) \<in> Rep_Integ(Z). intrel``{(y,x)})"
8ed6989228bb Simplification of the development of Integers
paulson
parents: 14269
diff changeset
    41
14259
79f7d3451b1e conversion of ML to Isar scripts
paulson
parents: 13487
diff changeset
    42
  Zero_int_def:  "0 == int 0"
14271
8ed6989228bb Simplification of the development of Integers
paulson
parents: 14269
diff changeset
    43
  One_int_def:   "1 == int 1"
8937
7328d7c8d201 defining 0::int to be (int 0)
paulson
parents: 7375
diff changeset
    44
14259
79f7d3451b1e conversion of ML to Isar scripts
paulson
parents: 13487
diff changeset
    45
  zadd_def:
5594
e4439230af67 much tidying
paulson
parents: 5582
diff changeset
    46
   "z + w == 
14271
8ed6989228bb Simplification of the development of Integers
paulson
parents: 14269
diff changeset
    47
       Abs_Integ(\<Union>(x1,y1) \<in> Rep_Integ(z). \<Union>(x2,y2) \<in> Rep_Integ(w).   
10834
a7897aebbffc *** empty log message ***
nipkow
parents: 10797
diff changeset
    48
		 intrel``{(x1+x2, y1+y2)})"
5508
691c70898518 new files in Integ
paulson
parents:
diff changeset
    49
14259
79f7d3451b1e conversion of ML to Isar scripts
paulson
parents: 13487
diff changeset
    50
  zdiff_def:  "z - (w::int) == z + (-w)"
5508
691c70898518 new files in Integ
paulson
parents:
diff changeset
    51
14259
79f7d3451b1e conversion of ML to Isar scripts
paulson
parents: 13487
diff changeset
    52
  zless_def:  "z<w == neg(z - w)"
5508
691c70898518 new files in Integ
paulson
parents:
diff changeset
    53
14259
79f7d3451b1e conversion of ML to Isar scripts
paulson
parents: 13487
diff changeset
    54
  zle_def:    "z <= (w::int) == ~(w < z)"
5508
691c70898518 new files in Integ
paulson
parents:
diff changeset
    55
14259
79f7d3451b1e conversion of ML to Isar scripts
paulson
parents: 13487
diff changeset
    56
  zmult_def:
5594
e4439230af67 much tidying
paulson
parents: 5582
diff changeset
    57
   "z * w == 
14271
8ed6989228bb Simplification of the development of Integers
paulson
parents: 14269
diff changeset
    58
       Abs_Integ(\<Union>(x1,y1) \<in> Rep_Integ(z). \<Union>(x2,y2) \<in> Rep_Integ(w).   
10834
a7897aebbffc *** empty log message ***
nipkow
parents: 10797
diff changeset
    59
		 intrel``{(x1*x2 + y1*y2, x1*y2 + y1*x2)})"
5508
691c70898518 new files in Integ
paulson
parents:
diff changeset
    60
14271
8ed6989228bb Simplification of the development of Integers
paulson
parents: 14269
diff changeset
    61
lemma intrel_iff [simp]: "(((x1,y1),(x2,y2)) \<in>  intrel) = (x1+y2 = x2+y1)"
14259
79f7d3451b1e conversion of ML to Isar scripts
paulson
parents: 13487
diff changeset
    62
by (unfold intrel_def, blast)
79f7d3451b1e conversion of ML to Isar scripts
paulson
parents: 13487
diff changeset
    63
79f7d3451b1e conversion of ML to Isar scripts
paulson
parents: 13487
diff changeset
    64
lemma equiv_intrel: "equiv UNIV intrel"
79f7d3451b1e conversion of ML to Isar scripts
paulson
parents: 13487
diff changeset
    65
by (unfold intrel_def equiv_def refl_def sym_def trans_def, auto)
79f7d3451b1e conversion of ML to Isar scripts
paulson
parents: 13487
diff changeset
    66
79f7d3451b1e conversion of ML to Isar scripts
paulson
parents: 13487
diff changeset
    67
lemmas equiv_intrel_iff =
79f7d3451b1e conversion of ML to Isar scripts
paulson
parents: 13487
diff changeset
    68
       eq_equiv_class_iff [OF equiv_intrel UNIV_I UNIV_I, simp]
79f7d3451b1e conversion of ML to Isar scripts
paulson
parents: 13487
diff changeset
    69
79f7d3451b1e conversion of ML to Isar scripts
paulson
parents: 13487
diff changeset
    70
lemma intrel_in_integ [simp]: "intrel``{(x,y)}:Integ"
79f7d3451b1e conversion of ML to Isar scripts
paulson
parents: 13487
diff changeset
    71
by (unfold Integ_def intrel_def quotient_def, fast)
79f7d3451b1e conversion of ML to Isar scripts
paulson
parents: 13487
diff changeset
    72
79f7d3451b1e conversion of ML to Isar scripts
paulson
parents: 13487
diff changeset
    73
lemma inj_on_Abs_Integ: "inj_on Abs_Integ Integ"
79f7d3451b1e conversion of ML to Isar scripts
paulson
parents: 13487
diff changeset
    74
apply (rule inj_on_inverseI)
79f7d3451b1e conversion of ML to Isar scripts
paulson
parents: 13487
diff changeset
    75
apply (erule Abs_Integ_inverse)
79f7d3451b1e conversion of ML to Isar scripts
paulson
parents: 13487
diff changeset
    76
done
79f7d3451b1e conversion of ML to Isar scripts
paulson
parents: 13487
diff changeset
    77
79f7d3451b1e conversion of ML to Isar scripts
paulson
parents: 13487
diff changeset
    78
declare inj_on_Abs_Integ [THEN inj_on_iff, simp] 
79f7d3451b1e conversion of ML to Isar scripts
paulson
parents: 13487
diff changeset
    79
        Abs_Integ_inverse [simp]
79f7d3451b1e conversion of ML to Isar scripts
paulson
parents: 13487
diff changeset
    80
79f7d3451b1e conversion of ML to Isar scripts
paulson
parents: 13487
diff changeset
    81
lemma inj_Rep_Integ: "inj(Rep_Integ)"
79f7d3451b1e conversion of ML to Isar scripts
paulson
parents: 13487
diff changeset
    82
apply (rule inj_on_inverseI)
79f7d3451b1e conversion of ML to Isar scripts
paulson
parents: 13487
diff changeset
    83
apply (rule Rep_Integ_inverse)
79f7d3451b1e conversion of ML to Isar scripts
paulson
parents: 13487
diff changeset
    84
done
79f7d3451b1e conversion of ML to Isar scripts
paulson
parents: 13487
diff changeset
    85
79f7d3451b1e conversion of ML to Isar scripts
paulson
parents: 13487
diff changeset
    86
79f7d3451b1e conversion of ML to Isar scripts
paulson
parents: 13487
diff changeset
    87
(** int: the injection from "nat" to "int" **)
79f7d3451b1e conversion of ML to Isar scripts
paulson
parents: 13487
diff changeset
    88
79f7d3451b1e conversion of ML to Isar scripts
paulson
parents: 13487
diff changeset
    89
lemma inj_int: "inj int"
79f7d3451b1e conversion of ML to Isar scripts
paulson
parents: 13487
diff changeset
    90
apply (rule inj_onI)
79f7d3451b1e conversion of ML to Isar scripts
paulson
parents: 13487
diff changeset
    91
apply (unfold int_def)
79f7d3451b1e conversion of ML to Isar scripts
paulson
parents: 13487
diff changeset
    92
apply (drule inj_on_Abs_Integ [THEN inj_onD])
79f7d3451b1e conversion of ML to Isar scripts
paulson
parents: 13487
diff changeset
    93
apply (rule intrel_in_integ)+
79f7d3451b1e conversion of ML to Isar scripts
paulson
parents: 13487
diff changeset
    94
apply (drule eq_equiv_class)
79f7d3451b1e conversion of ML to Isar scripts
paulson
parents: 13487
diff changeset
    95
apply (rule equiv_intrel, fast)
79f7d3451b1e conversion of ML to Isar scripts
paulson
parents: 13487
diff changeset
    96
apply (simp add: intrel_def)
79f7d3451b1e conversion of ML to Isar scripts
paulson
parents: 13487
diff changeset
    97
done
79f7d3451b1e conversion of ML to Isar scripts
paulson
parents: 13487
diff changeset
    98
14341
a09441bd4f1e Ring_and_Field now requires axiom add_left_imp_eq for semirings.
paulson
parents: 14271
diff changeset
    99
lemma int_int_eq [iff]: "(int m = int n) = (m = n)"
a09441bd4f1e Ring_and_Field now requires axiom add_left_imp_eq for semirings.
paulson
parents: 14271
diff changeset
   100
by (fast elim!: inj_int [THEN injD])
a09441bd4f1e Ring_and_Field now requires axiom add_left_imp_eq for semirings.
paulson
parents: 14271
diff changeset
   101
a09441bd4f1e Ring_and_Field now requires axiom add_left_imp_eq for semirings.
paulson
parents: 14271
diff changeset
   102
14259
79f7d3451b1e conversion of ML to Isar scripts
paulson
parents: 13487
diff changeset
   103
79f7d3451b1e conversion of ML to Isar scripts
paulson
parents: 13487
diff changeset
   104
subsection{*zminus: unary negation on Integ*}
79f7d3451b1e conversion of ML to Isar scripts
paulson
parents: 13487
diff changeset
   105
79f7d3451b1e conversion of ML to Isar scripts
paulson
parents: 13487
diff changeset
   106
lemma zminus_congruent: "congruent intrel (%(x,y). intrel``{(y,x)})"
79f7d3451b1e conversion of ML to Isar scripts
paulson
parents: 13487
diff changeset
   107
apply (unfold congruent_def intrel_def)
79f7d3451b1e conversion of ML to Isar scripts
paulson
parents: 13487
diff changeset
   108
apply (auto simp add: add_ac)
79f7d3451b1e conversion of ML to Isar scripts
paulson
parents: 13487
diff changeset
   109
done
79f7d3451b1e conversion of ML to Isar scripts
paulson
parents: 13487
diff changeset
   110
79f7d3451b1e conversion of ML to Isar scripts
paulson
parents: 13487
diff changeset
   111
lemma zminus: "- Abs_Integ(intrel``{(x,y)}) = Abs_Integ(intrel `` {(y,x)})"
79f7d3451b1e conversion of ML to Isar scripts
paulson
parents: 13487
diff changeset
   112
by (simp add: zminus_def equiv_intrel [THEN UN_equiv_class] zminus_congruent)
79f7d3451b1e conversion of ML to Isar scripts
paulson
parents: 13487
diff changeset
   113
79f7d3451b1e conversion of ML to Isar scripts
paulson
parents: 13487
diff changeset
   114
(*Every integer can be written in the form Abs_Integ(...) *)
79f7d3451b1e conversion of ML to Isar scripts
paulson
parents: 13487
diff changeset
   115
lemma eq_Abs_Integ: 
79f7d3451b1e conversion of ML to Isar scripts
paulson
parents: 13487
diff changeset
   116
     "(!!x y. z = Abs_Integ(intrel``{(x,y)}) ==> P) ==> P"
79f7d3451b1e conversion of ML to Isar scripts
paulson
parents: 13487
diff changeset
   117
apply (rule_tac x1=z in Rep_Integ [unfolded Integ_def, THEN quotientE]) 
79f7d3451b1e conversion of ML to Isar scripts
paulson
parents: 13487
diff changeset
   118
apply (drule_tac f = Abs_Integ in arg_cong)
79f7d3451b1e conversion of ML to Isar scripts
paulson
parents: 13487
diff changeset
   119
apply (rule_tac p = x in PairE)
79f7d3451b1e conversion of ML to Isar scripts
paulson
parents: 13487
diff changeset
   120
apply (simp add: Rep_Integ_inverse)
79f7d3451b1e conversion of ML to Isar scripts
paulson
parents: 13487
diff changeset
   121
done
79f7d3451b1e conversion of ML to Isar scripts
paulson
parents: 13487
diff changeset
   122
79f7d3451b1e conversion of ML to Isar scripts
paulson
parents: 13487
diff changeset
   123
lemma zminus_zminus [simp]: "- (- z) = (z::int)"
79f7d3451b1e conversion of ML to Isar scripts
paulson
parents: 13487
diff changeset
   124
apply (rule_tac z = z in eq_Abs_Integ)
79f7d3451b1e conversion of ML to Isar scripts
paulson
parents: 13487
diff changeset
   125
apply (simp (no_asm_simp) add: zminus)
79f7d3451b1e conversion of ML to Isar scripts
paulson
parents: 13487
diff changeset
   126
done
79f7d3451b1e conversion of ML to Isar scripts
paulson
parents: 13487
diff changeset
   127
79f7d3451b1e conversion of ML to Isar scripts
paulson
parents: 13487
diff changeset
   128
lemma inj_zminus: "inj(%z::int. -z)"
79f7d3451b1e conversion of ML to Isar scripts
paulson
parents: 13487
diff changeset
   129
apply (rule inj_onI)
79f7d3451b1e conversion of ML to Isar scripts
paulson
parents: 13487
diff changeset
   130
apply (drule_tac f = uminus in arg_cong, simp)
79f7d3451b1e conversion of ML to Isar scripts
paulson
parents: 13487
diff changeset
   131
done
79f7d3451b1e conversion of ML to Isar scripts
paulson
parents: 13487
diff changeset
   132
79f7d3451b1e conversion of ML to Isar scripts
paulson
parents: 13487
diff changeset
   133
lemma zminus_0 [simp]: "- 0 = (0::int)"
79f7d3451b1e conversion of ML to Isar scripts
paulson
parents: 13487
diff changeset
   134
by (simp add: int_def Zero_int_def zminus)
79f7d3451b1e conversion of ML to Isar scripts
paulson
parents: 13487
diff changeset
   135
79f7d3451b1e conversion of ML to Isar scripts
paulson
parents: 13487
diff changeset
   136
79f7d3451b1e conversion of ML to Isar scripts
paulson
parents: 13487
diff changeset
   137
subsection{*neg: the test for negative integers*}
79f7d3451b1e conversion of ML to Isar scripts
paulson
parents: 13487
diff changeset
   138
79f7d3451b1e conversion of ML to Isar scripts
paulson
parents: 13487
diff changeset
   139
79f7d3451b1e conversion of ML to Isar scripts
paulson
parents: 13487
diff changeset
   140
lemma not_neg_int [simp]: "~ neg(int n)"
79f7d3451b1e conversion of ML to Isar scripts
paulson
parents: 13487
diff changeset
   141
by (simp add: neg_def int_def)
79f7d3451b1e conversion of ML to Isar scripts
paulson
parents: 13487
diff changeset
   142
79f7d3451b1e conversion of ML to Isar scripts
paulson
parents: 13487
diff changeset
   143
lemma neg_zminus_int [simp]: "neg(- (int (Suc n)))"
79f7d3451b1e conversion of ML to Isar scripts
paulson
parents: 13487
diff changeset
   144
by (simp add: neg_def int_def zminus)
79f7d3451b1e conversion of ML to Isar scripts
paulson
parents: 13487
diff changeset
   145
79f7d3451b1e conversion of ML to Isar scripts
paulson
parents: 13487
diff changeset
   146
79f7d3451b1e conversion of ML to Isar scripts
paulson
parents: 13487
diff changeset
   147
subsection{*zadd: addition on Integ*}
79f7d3451b1e conversion of ML to Isar scripts
paulson
parents: 13487
diff changeset
   148
79f7d3451b1e conversion of ML to Isar scripts
paulson
parents: 13487
diff changeset
   149
lemma zadd: 
79f7d3451b1e conversion of ML to Isar scripts
paulson
parents: 13487
diff changeset
   150
  "Abs_Integ(intrel``{(x1,y1)}) + Abs_Integ(intrel``{(x2,y2)}) =  
79f7d3451b1e conversion of ML to Isar scripts
paulson
parents: 13487
diff changeset
   151
   Abs_Integ(intrel``{(x1+x2, y1+y2)})"
79f7d3451b1e conversion of ML to Isar scripts
paulson
parents: 13487
diff changeset
   152
apply (simp add: zadd_def UN_UN_split_split_eq)
79f7d3451b1e conversion of ML to Isar scripts
paulson
parents: 13487
diff changeset
   153
apply (subst equiv_intrel [THEN UN_equiv_class2])
79f7d3451b1e conversion of ML to Isar scripts
paulson
parents: 13487
diff changeset
   154
apply (auto simp add: congruent2_def)
79f7d3451b1e conversion of ML to Isar scripts
paulson
parents: 13487
diff changeset
   155
done
79f7d3451b1e conversion of ML to Isar scripts
paulson
parents: 13487
diff changeset
   156
79f7d3451b1e conversion of ML to Isar scripts
paulson
parents: 13487
diff changeset
   157
lemma zminus_zadd_distrib [simp]: "- (z + w) = (- z) + (- w::int)"
79f7d3451b1e conversion of ML to Isar scripts
paulson
parents: 13487
diff changeset
   158
apply (rule_tac z = z in eq_Abs_Integ)
79f7d3451b1e conversion of ML to Isar scripts
paulson
parents: 13487
diff changeset
   159
apply (rule_tac z = w in eq_Abs_Integ)
79f7d3451b1e conversion of ML to Isar scripts
paulson
parents: 13487
diff changeset
   160
apply (simp (no_asm_simp) add: zminus zadd)
79f7d3451b1e conversion of ML to Isar scripts
paulson
parents: 13487
diff changeset
   161
done
79f7d3451b1e conversion of ML to Isar scripts
paulson
parents: 13487
diff changeset
   162
79f7d3451b1e conversion of ML to Isar scripts
paulson
parents: 13487
diff changeset
   163
lemma zadd_commute: "(z::int) + w = w + z"
79f7d3451b1e conversion of ML to Isar scripts
paulson
parents: 13487
diff changeset
   164
apply (rule_tac z = z in eq_Abs_Integ)
79f7d3451b1e conversion of ML to Isar scripts
paulson
parents: 13487
diff changeset
   165
apply (rule_tac z = w in eq_Abs_Integ)
79f7d3451b1e conversion of ML to Isar scripts
paulson
parents: 13487
diff changeset
   166
apply (simp (no_asm_simp) add: add_ac zadd)
79f7d3451b1e conversion of ML to Isar scripts
paulson
parents: 13487
diff changeset
   167
done
79f7d3451b1e conversion of ML to Isar scripts
paulson
parents: 13487
diff changeset
   168
79f7d3451b1e conversion of ML to Isar scripts
paulson
parents: 13487
diff changeset
   169
lemma zadd_assoc: "((z1::int) + z2) + z3 = z1 + (z2 + z3)"
79f7d3451b1e conversion of ML to Isar scripts
paulson
parents: 13487
diff changeset
   170
apply (rule_tac z = z1 in eq_Abs_Integ)
79f7d3451b1e conversion of ML to Isar scripts
paulson
parents: 13487
diff changeset
   171
apply (rule_tac z = z2 in eq_Abs_Integ)
79f7d3451b1e conversion of ML to Isar scripts
paulson
parents: 13487
diff changeset
   172
apply (rule_tac z = z3 in eq_Abs_Integ)
79f7d3451b1e conversion of ML to Isar scripts
paulson
parents: 13487
diff changeset
   173
apply (simp (no_asm_simp) add: zadd add_assoc)
79f7d3451b1e conversion of ML to Isar scripts
paulson
parents: 13487
diff changeset
   174
done
79f7d3451b1e conversion of ML to Isar scripts
paulson
parents: 13487
diff changeset
   175
79f7d3451b1e conversion of ML to Isar scripts
paulson
parents: 13487
diff changeset
   176
(*For AC rewriting*)
14271
8ed6989228bb Simplification of the development of Integers
paulson
parents: 14269
diff changeset
   177
lemma zadd_left_commute: "x + (y + z) = y + ((x + z)  ::int)"
14259
79f7d3451b1e conversion of ML to Isar scripts
paulson
parents: 13487
diff changeset
   178
  apply (rule mk_left_commute [of "op +"])
79f7d3451b1e conversion of ML to Isar scripts
paulson
parents: 13487
diff changeset
   179
  apply (rule zadd_assoc)
79f7d3451b1e conversion of ML to Isar scripts
paulson
parents: 13487
diff changeset
   180
  apply (rule zadd_commute)
79f7d3451b1e conversion of ML to Isar scripts
paulson
parents: 13487
diff changeset
   181
  done
79f7d3451b1e conversion of ML to Isar scripts
paulson
parents: 13487
diff changeset
   182
79f7d3451b1e conversion of ML to Isar scripts
paulson
parents: 13487
diff changeset
   183
(*Integer addition is an AC operator*)
79f7d3451b1e conversion of ML to Isar scripts
paulson
parents: 13487
diff changeset
   184
lemmas zadd_ac = zadd_assoc zadd_commute zadd_left_commute
79f7d3451b1e conversion of ML to Isar scripts
paulson
parents: 13487
diff changeset
   185
14271
8ed6989228bb Simplification of the development of Integers
paulson
parents: 14269
diff changeset
   186
lemmas zmult_ac = Ring_and_Field.mult_ac
8ed6989228bb Simplification of the development of Integers
paulson
parents: 14269
diff changeset
   187
14259
79f7d3451b1e conversion of ML to Isar scripts
paulson
parents: 13487
diff changeset
   188
lemma zadd_int: "(int m) + (int n) = int (m + n)"
79f7d3451b1e conversion of ML to Isar scripts
paulson
parents: 13487
diff changeset
   189
by (simp add: int_def zadd)
79f7d3451b1e conversion of ML to Isar scripts
paulson
parents: 13487
diff changeset
   190
79f7d3451b1e conversion of ML to Isar scripts
paulson
parents: 13487
diff changeset
   191
lemma zadd_int_left: "(int m) + (int n + z) = int (m + n) + z"
79f7d3451b1e conversion of ML to Isar scripts
paulson
parents: 13487
diff changeset
   192
by (simp add: zadd_int zadd_assoc [symmetric])
79f7d3451b1e conversion of ML to Isar scripts
paulson
parents: 13487
diff changeset
   193
79f7d3451b1e conversion of ML to Isar scripts
paulson
parents: 13487
diff changeset
   194
lemma int_Suc: "int (Suc m) = 1 + (int m)"
79f7d3451b1e conversion of ML to Isar scripts
paulson
parents: 13487
diff changeset
   195
by (simp add: One_int_def zadd_int)
79f7d3451b1e conversion of ML to Isar scripts
paulson
parents: 13487
diff changeset
   196
79f7d3451b1e conversion of ML to Isar scripts
paulson
parents: 13487
diff changeset
   197
(*also for the instance declaration int :: plus_ac0*)
79f7d3451b1e conversion of ML to Isar scripts
paulson
parents: 13487
diff changeset
   198
lemma zadd_0 [simp]: "(0::int) + z = z"
79f7d3451b1e conversion of ML to Isar scripts
paulson
parents: 13487
diff changeset
   199
apply (unfold Zero_int_def int_def)
79f7d3451b1e conversion of ML to Isar scripts
paulson
parents: 13487
diff changeset
   200
apply (rule_tac z = z in eq_Abs_Integ)
79f7d3451b1e conversion of ML to Isar scripts
paulson
parents: 13487
diff changeset
   201
apply (simp (no_asm_simp) add: zadd)
79f7d3451b1e conversion of ML to Isar scripts
paulson
parents: 13487
diff changeset
   202
done
79f7d3451b1e conversion of ML to Isar scripts
paulson
parents: 13487
diff changeset
   203
79f7d3451b1e conversion of ML to Isar scripts
paulson
parents: 13487
diff changeset
   204
lemma zadd_0_right [simp]: "z + (0::int) = z"
79f7d3451b1e conversion of ML to Isar scripts
paulson
parents: 13487
diff changeset
   205
by (rule trans [OF zadd_commute zadd_0])
79f7d3451b1e conversion of ML to Isar scripts
paulson
parents: 13487
diff changeset
   206
79f7d3451b1e conversion of ML to Isar scripts
paulson
parents: 13487
diff changeset
   207
lemma zadd_zminus_inverse [simp]: "z + (- z) = (0::int)"
79f7d3451b1e conversion of ML to Isar scripts
paulson
parents: 13487
diff changeset
   208
apply (unfold int_def Zero_int_def)
79f7d3451b1e conversion of ML to Isar scripts
paulson
parents: 13487
diff changeset
   209
apply (rule_tac z = z in eq_Abs_Integ)
79f7d3451b1e conversion of ML to Isar scripts
paulson
parents: 13487
diff changeset
   210
apply (simp (no_asm_simp) add: zminus zadd add_commute)
79f7d3451b1e conversion of ML to Isar scripts
paulson
parents: 13487
diff changeset
   211
done
79f7d3451b1e conversion of ML to Isar scripts
paulson
parents: 13487
diff changeset
   212
79f7d3451b1e conversion of ML to Isar scripts
paulson
parents: 13487
diff changeset
   213
lemma zadd_zminus_inverse2 [simp]: "(- z) + z = (0::int)"
79f7d3451b1e conversion of ML to Isar scripts
paulson
parents: 13487
diff changeset
   214
apply (rule zadd_commute [THEN trans])
79f7d3451b1e conversion of ML to Isar scripts
paulson
parents: 13487
diff changeset
   215
apply (rule zadd_zminus_inverse)
79f7d3451b1e conversion of ML to Isar scripts
paulson
parents: 13487
diff changeset
   216
done
79f7d3451b1e conversion of ML to Isar scripts
paulson
parents: 13487
diff changeset
   217
79f7d3451b1e conversion of ML to Isar scripts
paulson
parents: 13487
diff changeset
   218
lemma zadd_zminus_cancel [simp]: "z + (- z + w) = (w::int)"
79f7d3451b1e conversion of ML to Isar scripts
paulson
parents: 13487
diff changeset
   219
by (simp add: zadd_assoc [symmetric] zadd_0)
79f7d3451b1e conversion of ML to Isar scripts
paulson
parents: 13487
diff changeset
   220
79f7d3451b1e conversion of ML to Isar scripts
paulson
parents: 13487
diff changeset
   221
lemma zminus_zadd_cancel [simp]: "(-z) + (z + w) = (w::int)"
79f7d3451b1e conversion of ML to Isar scripts
paulson
parents: 13487
diff changeset
   222
by (simp add: zadd_assoc [symmetric] zadd_0)
79f7d3451b1e conversion of ML to Isar scripts
paulson
parents: 13487
diff changeset
   223
79f7d3451b1e conversion of ML to Isar scripts
paulson
parents: 13487
diff changeset
   224
lemma zdiff0 [simp]: "(0::int) - x = -x"
79f7d3451b1e conversion of ML to Isar scripts
paulson
parents: 13487
diff changeset
   225
by (simp add: zdiff_def)
79f7d3451b1e conversion of ML to Isar scripts
paulson
parents: 13487
diff changeset
   226
79f7d3451b1e conversion of ML to Isar scripts
paulson
parents: 13487
diff changeset
   227
lemma zdiff0_right [simp]: "x - (0::int) = x"
79f7d3451b1e conversion of ML to Isar scripts
paulson
parents: 13487
diff changeset
   228
by (simp add: zdiff_def)
79f7d3451b1e conversion of ML to Isar scripts
paulson
parents: 13487
diff changeset
   229
79f7d3451b1e conversion of ML to Isar scripts
paulson
parents: 13487
diff changeset
   230
lemma zdiff_self [simp]: "x - x = (0::int)"
79f7d3451b1e conversion of ML to Isar scripts
paulson
parents: 13487
diff changeset
   231
by (simp add: zdiff_def Zero_int_def)
79f7d3451b1e conversion of ML to Isar scripts
paulson
parents: 13487
diff changeset
   232
79f7d3451b1e conversion of ML to Isar scripts
paulson
parents: 13487
diff changeset
   233
79f7d3451b1e conversion of ML to Isar scripts
paulson
parents: 13487
diff changeset
   234
(** Lemmas **)
79f7d3451b1e conversion of ML to Isar scripts
paulson
parents: 13487
diff changeset
   235
79f7d3451b1e conversion of ML to Isar scripts
paulson
parents: 13487
diff changeset
   236
lemma zadd_assoc_cong: "(z::int) + v = z' + v' ==> z + (v + w) = z' + (v' + w)"
79f7d3451b1e conversion of ML to Isar scripts
paulson
parents: 13487
diff changeset
   237
by (simp add: zadd_assoc [symmetric])
79f7d3451b1e conversion of ML to Isar scripts
paulson
parents: 13487
diff changeset
   238
79f7d3451b1e conversion of ML to Isar scripts
paulson
parents: 13487
diff changeset
   239
lemma zadd_assoc_swap: "(z::int) + (v + w) = v + (z + w)"
79f7d3451b1e conversion of ML to Isar scripts
paulson
parents: 13487
diff changeset
   240
by (rule zadd_commute [THEN zadd_assoc_cong])
79f7d3451b1e conversion of ML to Isar scripts
paulson
parents: 13487
diff changeset
   241
79f7d3451b1e conversion of ML to Isar scripts
paulson
parents: 13487
diff changeset
   242
79f7d3451b1e conversion of ML to Isar scripts
paulson
parents: 13487
diff changeset
   243
subsection{*zmult: multiplication on Integ*}
79f7d3451b1e conversion of ML to Isar scripts
paulson
parents: 13487
diff changeset
   244
79f7d3451b1e conversion of ML to Isar scripts
paulson
parents: 13487
diff changeset
   245
(*Congruence property for multiplication*)
79f7d3451b1e conversion of ML to Isar scripts
paulson
parents: 13487
diff changeset
   246
lemma zmult_congruent2: "congruent2 intrel  
79f7d3451b1e conversion of ML to Isar scripts
paulson
parents: 13487
diff changeset
   247
        (%p1 p2. (%(x1,y1). (%(x2,y2).    
79f7d3451b1e conversion of ML to Isar scripts
paulson
parents: 13487
diff changeset
   248
                    intrel``{(x1*x2 + y1*y2, x1*y2 + y1*x2)}) p2) p1)"
79f7d3451b1e conversion of ML to Isar scripts
paulson
parents: 13487
diff changeset
   249
apply (rule equiv_intrel [THEN congruent2_commuteI])
79f7d3451b1e conversion of ML to Isar scripts
paulson
parents: 13487
diff changeset
   250
apply (rule_tac [2] p=w in PairE)  
79f7d3451b1e conversion of ML to Isar scripts
paulson
parents: 13487
diff changeset
   251
apply (force simp add: add_ac mult_ac, clarify) 
79f7d3451b1e conversion of ML to Isar scripts
paulson
parents: 13487
diff changeset
   252
apply (simp (no_asm_simp) del: equiv_intrel_iff add: add_ac mult_ac)
79f7d3451b1e conversion of ML to Isar scripts
paulson
parents: 13487
diff changeset
   253
apply (rename_tac x1 x2 y1 y2 z1 z2)
79f7d3451b1e conversion of ML to Isar scripts
paulson
parents: 13487
diff changeset
   254
apply (rule equiv_class_eq [OF equiv_intrel intrel_iff [THEN iffD2]])
79f7d3451b1e conversion of ML to Isar scripts
paulson
parents: 13487
diff changeset
   255
apply (simp add: intrel_def)
79f7d3451b1e conversion of ML to Isar scripts
paulson
parents: 13487
diff changeset
   256
apply (subgoal_tac "x1*z1 + y2*z1 = y1*z1 + x2*z1 & x1*z2 + y2*z2 = y1*z2 + x2*z2", arith)
79f7d3451b1e conversion of ML to Isar scripts
paulson
parents: 13487
diff changeset
   257
apply (simp add: add_mult_distrib [symmetric])
79f7d3451b1e conversion of ML to Isar scripts
paulson
parents: 13487
diff changeset
   258
done
79f7d3451b1e conversion of ML to Isar scripts
paulson
parents: 13487
diff changeset
   259
79f7d3451b1e conversion of ML to Isar scripts
paulson
parents: 13487
diff changeset
   260
lemma zmult: 
79f7d3451b1e conversion of ML to Isar scripts
paulson
parents: 13487
diff changeset
   261
   "Abs_Integ((intrel``{(x1,y1)})) * Abs_Integ((intrel``{(x2,y2)})) =    
79f7d3451b1e conversion of ML to Isar scripts
paulson
parents: 13487
diff changeset
   262
    Abs_Integ(intrel `` {(x1*x2 + y1*y2, x1*y2 + y1*x2)})"
79f7d3451b1e conversion of ML to Isar scripts
paulson
parents: 13487
diff changeset
   263
apply (unfold zmult_def)
79f7d3451b1e conversion of ML to Isar scripts
paulson
parents: 13487
diff changeset
   264
apply (simp (no_asm_simp) add: UN_UN_split_split_eq zmult_congruent2 equiv_intrel [THEN UN_equiv_class2])
79f7d3451b1e conversion of ML to Isar scripts
paulson
parents: 13487
diff changeset
   265
done
79f7d3451b1e conversion of ML to Isar scripts
paulson
parents: 13487
diff changeset
   266
79f7d3451b1e conversion of ML to Isar scripts
paulson
parents: 13487
diff changeset
   267
lemma zmult_zminus: "(- z) * w = - (z * (w::int))"
79f7d3451b1e conversion of ML to Isar scripts
paulson
parents: 13487
diff changeset
   268
apply (rule_tac z = z in eq_Abs_Integ)
79f7d3451b1e conversion of ML to Isar scripts
paulson
parents: 13487
diff changeset
   269
apply (rule_tac z = w in eq_Abs_Integ)
79f7d3451b1e conversion of ML to Isar scripts
paulson
parents: 13487
diff changeset
   270
apply (simp (no_asm_simp) add: zminus zmult add_ac)
79f7d3451b1e conversion of ML to Isar scripts
paulson
parents: 13487
diff changeset
   271
done
79f7d3451b1e conversion of ML to Isar scripts
paulson
parents: 13487
diff changeset
   272
79f7d3451b1e conversion of ML to Isar scripts
paulson
parents: 13487
diff changeset
   273
lemma zmult_commute: "(z::int) * w = w * z"
79f7d3451b1e conversion of ML to Isar scripts
paulson
parents: 13487
diff changeset
   274
apply (rule_tac z = z in eq_Abs_Integ)
79f7d3451b1e conversion of ML to Isar scripts
paulson
parents: 13487
diff changeset
   275
apply (rule_tac z = w in eq_Abs_Integ)
79f7d3451b1e conversion of ML to Isar scripts
paulson
parents: 13487
diff changeset
   276
apply (simp (no_asm_simp) add: zmult add_ac mult_ac)
79f7d3451b1e conversion of ML to Isar scripts
paulson
parents: 13487
diff changeset
   277
done
79f7d3451b1e conversion of ML to Isar scripts
paulson
parents: 13487
diff changeset
   278
79f7d3451b1e conversion of ML to Isar scripts
paulson
parents: 13487
diff changeset
   279
lemma zmult_assoc: "((z1::int) * z2) * z3 = z1 * (z2 * z3)"
79f7d3451b1e conversion of ML to Isar scripts
paulson
parents: 13487
diff changeset
   280
apply (rule_tac z = z1 in eq_Abs_Integ)
79f7d3451b1e conversion of ML to Isar scripts
paulson
parents: 13487
diff changeset
   281
apply (rule_tac z = z2 in eq_Abs_Integ)
79f7d3451b1e conversion of ML to Isar scripts
paulson
parents: 13487
diff changeset
   282
apply (rule_tac z = z3 in eq_Abs_Integ)
79f7d3451b1e conversion of ML to Isar scripts
paulson
parents: 13487
diff changeset
   283
apply (simp (no_asm_simp) add: add_mult_distrib2 zmult add_ac mult_ac)
79f7d3451b1e conversion of ML to Isar scripts
paulson
parents: 13487
diff changeset
   284
done
79f7d3451b1e conversion of ML to Isar scripts
paulson
parents: 13487
diff changeset
   285
79f7d3451b1e conversion of ML to Isar scripts
paulson
parents: 13487
diff changeset
   286
lemma zadd_zmult_distrib: "((z1::int) + z2) * w = (z1 * w) + (z2 * w)"
79f7d3451b1e conversion of ML to Isar scripts
paulson
parents: 13487
diff changeset
   287
apply (rule_tac z = z1 in eq_Abs_Integ)
79f7d3451b1e conversion of ML to Isar scripts
paulson
parents: 13487
diff changeset
   288
apply (rule_tac z = z2 in eq_Abs_Integ)
79f7d3451b1e conversion of ML to Isar scripts
paulson
parents: 13487
diff changeset
   289
apply (rule_tac z = w in eq_Abs_Integ)
79f7d3451b1e conversion of ML to Isar scripts
paulson
parents: 13487
diff changeset
   290
apply (simp add: add_mult_distrib2 zadd zmult add_ac mult_ac)
79f7d3451b1e conversion of ML to Isar scripts
paulson
parents: 13487
diff changeset
   291
done
79f7d3451b1e conversion of ML to Isar scripts
paulson
parents: 13487
diff changeset
   292
79f7d3451b1e conversion of ML to Isar scripts
paulson
parents: 13487
diff changeset
   293
lemma zmult_zminus_right: "w * (- z) = - (w * (z::int))"
79f7d3451b1e conversion of ML to Isar scripts
paulson
parents: 13487
diff changeset
   294
by (simp add: zmult_commute [of w] zmult_zminus)
79f7d3451b1e conversion of ML to Isar scripts
paulson
parents: 13487
diff changeset
   295
79f7d3451b1e conversion of ML to Isar scripts
paulson
parents: 13487
diff changeset
   296
lemma zadd_zmult_distrib2: "(w::int) * (z1 + z2) = (w * z1) + (w * z2)"
79f7d3451b1e conversion of ML to Isar scripts
paulson
parents: 13487
diff changeset
   297
by (simp add: zmult_commute [of w] zadd_zmult_distrib)
79f7d3451b1e conversion of ML to Isar scripts
paulson
parents: 13487
diff changeset
   298
79f7d3451b1e conversion of ML to Isar scripts
paulson
parents: 13487
diff changeset
   299
lemma zdiff_zmult_distrib: "((z1::int) - z2) * w = (z1 * w) - (z2 * w)"
79f7d3451b1e conversion of ML to Isar scripts
paulson
parents: 13487
diff changeset
   300
apply (unfold zdiff_def)
79f7d3451b1e conversion of ML to Isar scripts
paulson
parents: 13487
diff changeset
   301
apply (subst zadd_zmult_distrib)
79f7d3451b1e conversion of ML to Isar scripts
paulson
parents: 13487
diff changeset
   302
apply (simp add: zmult_zminus)
79f7d3451b1e conversion of ML to Isar scripts
paulson
parents: 13487
diff changeset
   303
done
79f7d3451b1e conversion of ML to Isar scripts
paulson
parents: 13487
diff changeset
   304
79f7d3451b1e conversion of ML to Isar scripts
paulson
parents: 13487
diff changeset
   305
lemma zdiff_zmult_distrib2: "(w::int) * (z1 - z2) = (w * z1) - (w * z2)"
79f7d3451b1e conversion of ML to Isar scripts
paulson
parents: 13487
diff changeset
   306
by (simp add: zmult_commute [of w] zdiff_zmult_distrib)
79f7d3451b1e conversion of ML to Isar scripts
paulson
parents: 13487
diff changeset
   307
79f7d3451b1e conversion of ML to Isar scripts
paulson
parents: 13487
diff changeset
   308
lemmas int_distrib =
79f7d3451b1e conversion of ML to Isar scripts
paulson
parents: 13487
diff changeset
   309
  zadd_zmult_distrib zadd_zmult_distrib2 
79f7d3451b1e conversion of ML to Isar scripts
paulson
parents: 13487
diff changeset
   310
  zdiff_zmult_distrib zdiff_zmult_distrib2
79f7d3451b1e conversion of ML to Isar scripts
paulson
parents: 13487
diff changeset
   311
79f7d3451b1e conversion of ML to Isar scripts
paulson
parents: 13487
diff changeset
   312
lemma zmult_int: "(int m) * (int n) = int (m * n)"
79f7d3451b1e conversion of ML to Isar scripts
paulson
parents: 13487
diff changeset
   313
by (simp add: int_def zmult)
79f7d3451b1e conversion of ML to Isar scripts
paulson
parents: 13487
diff changeset
   314
79f7d3451b1e conversion of ML to Isar scripts
paulson
parents: 13487
diff changeset
   315
lemma zmult_0 [simp]: "0 * z = (0::int)"
79f7d3451b1e conversion of ML to Isar scripts
paulson
parents: 13487
diff changeset
   316
apply (unfold Zero_int_def int_def)
79f7d3451b1e conversion of ML to Isar scripts
paulson
parents: 13487
diff changeset
   317
apply (rule_tac z = z in eq_Abs_Integ)
79f7d3451b1e conversion of ML to Isar scripts
paulson
parents: 13487
diff changeset
   318
apply (simp (no_asm_simp) add: zmult)
79f7d3451b1e conversion of ML to Isar scripts
paulson
parents: 13487
diff changeset
   319
done
79f7d3451b1e conversion of ML to Isar scripts
paulson
parents: 13487
diff changeset
   320
79f7d3451b1e conversion of ML to Isar scripts
paulson
parents: 13487
diff changeset
   321
lemma zmult_1 [simp]: "(1::int) * z = z"
79f7d3451b1e conversion of ML to Isar scripts
paulson
parents: 13487
diff changeset
   322
apply (unfold One_int_def int_def)
79f7d3451b1e conversion of ML to Isar scripts
paulson
parents: 13487
diff changeset
   323
apply (rule_tac z = z in eq_Abs_Integ)
79f7d3451b1e conversion of ML to Isar scripts
paulson
parents: 13487
diff changeset
   324
apply (simp (no_asm_simp) add: zmult)
79f7d3451b1e conversion of ML to Isar scripts
paulson
parents: 13487
diff changeset
   325
done
79f7d3451b1e conversion of ML to Isar scripts
paulson
parents: 13487
diff changeset
   326
79f7d3451b1e conversion of ML to Isar scripts
paulson
parents: 13487
diff changeset
   327
lemma zmult_0_right [simp]: "z * 0 = (0::int)"
79f7d3451b1e conversion of ML to Isar scripts
paulson
parents: 13487
diff changeset
   328
by (rule trans [OF zmult_commute zmult_0])
79f7d3451b1e conversion of ML to Isar scripts
paulson
parents: 13487
diff changeset
   329
79f7d3451b1e conversion of ML to Isar scripts
paulson
parents: 13487
diff changeset
   330
lemma zmult_1_right [simp]: "z * (1::int) = z"
79f7d3451b1e conversion of ML to Isar scripts
paulson
parents: 13487
diff changeset
   331
by (rule trans [OF zmult_commute zmult_1])
79f7d3451b1e conversion of ML to Isar scripts
paulson
parents: 13487
diff changeset
   332
79f7d3451b1e conversion of ML to Isar scripts
paulson
parents: 13487
diff changeset
   333
14341
a09441bd4f1e Ring_and_Field now requires axiom add_left_imp_eq for semirings.
paulson
parents: 14271
diff changeset
   334
text{*The Integers Form A Ring*}
a09441bd4f1e Ring_and_Field now requires axiom add_left_imp_eq for semirings.
paulson
parents: 14271
diff changeset
   335
instance int :: ring
a09441bd4f1e Ring_and_Field now requires axiom add_left_imp_eq for semirings.
paulson
parents: 14271
diff changeset
   336
proof
a09441bd4f1e Ring_and_Field now requires axiom add_left_imp_eq for semirings.
paulson
parents: 14271
diff changeset
   337
  fix i j k :: int
a09441bd4f1e Ring_and_Field now requires axiom add_left_imp_eq for semirings.
paulson
parents: 14271
diff changeset
   338
  show "(i + j) + k = i + (j + k)" by (simp add: zadd_assoc)
a09441bd4f1e Ring_and_Field now requires axiom add_left_imp_eq for semirings.
paulson
parents: 14271
diff changeset
   339
  show "i + j = j + i" by (simp add: zadd_commute)
a09441bd4f1e Ring_and_Field now requires axiom add_left_imp_eq for semirings.
paulson
parents: 14271
diff changeset
   340
  show "0 + i = i" by simp
a09441bd4f1e Ring_and_Field now requires axiom add_left_imp_eq for semirings.
paulson
parents: 14271
diff changeset
   341
  show "- i + i = 0" by simp
a09441bd4f1e Ring_and_Field now requires axiom add_left_imp_eq for semirings.
paulson
parents: 14271
diff changeset
   342
  show "i - j = i + (-j)" by (simp add: zdiff_def)
a09441bd4f1e Ring_and_Field now requires axiom add_left_imp_eq for semirings.
paulson
parents: 14271
diff changeset
   343
  show "(i * j) * k = i * (j * k)" by (rule zmult_assoc)
a09441bd4f1e Ring_and_Field now requires axiom add_left_imp_eq for semirings.
paulson
parents: 14271
diff changeset
   344
  show "i * j = j * i" by (rule zmult_commute)
a09441bd4f1e Ring_and_Field now requires axiom add_left_imp_eq for semirings.
paulson
parents: 14271
diff changeset
   345
  show "1 * i = i" by simp
a09441bd4f1e Ring_and_Field now requires axiom add_left_imp_eq for semirings.
paulson
parents: 14271
diff changeset
   346
  show "(i + j) * k = i * k + j * k" by (simp add: int_distrib)
14348
744c868ee0b7 Defining the type class "ringpower" and deleting superseded theorems for
paulson
parents: 14341
diff changeset
   347
  show "0 \<noteq> (1::int)" 
744c868ee0b7 Defining the type class "ringpower" and deleting superseded theorems for
paulson
parents: 14341
diff changeset
   348
    by (simp only: Zero_int_def One_int_def One_nat_def int_int_eq)
14341
a09441bd4f1e Ring_and_Field now requires axiom add_left_imp_eq for semirings.
paulson
parents: 14271
diff changeset
   349
  assume eq: "k+i = k+j" 
a09441bd4f1e Ring_and_Field now requires axiom add_left_imp_eq for semirings.
paulson
parents: 14271
diff changeset
   350
    hence "(-k + k) + i = (-k + k) + j" by (simp only: eq zadd_assoc)
a09441bd4f1e Ring_and_Field now requires axiom add_left_imp_eq for semirings.
paulson
parents: 14271
diff changeset
   351
    thus "i = j" by simp
a09441bd4f1e Ring_and_Field now requires axiom add_left_imp_eq for semirings.
paulson
parents: 14271
diff changeset
   352
qed
a09441bd4f1e Ring_and_Field now requires axiom add_left_imp_eq for semirings.
paulson
parents: 14271
diff changeset
   353
a09441bd4f1e Ring_and_Field now requires axiom add_left_imp_eq for semirings.
paulson
parents: 14271
diff changeset
   354
a09441bd4f1e Ring_and_Field now requires axiom add_left_imp_eq for semirings.
paulson
parents: 14271
diff changeset
   355
subsection{*Theorems about the Ordering*}
14259
79f7d3451b1e conversion of ML to Isar scripts
paulson
parents: 13487
diff changeset
   356
79f7d3451b1e conversion of ML to Isar scripts
paulson
parents: 13487
diff changeset
   357
(*This lemma allows direct proofs of other <-properties*)
79f7d3451b1e conversion of ML to Isar scripts
paulson
parents: 13487
diff changeset
   358
lemma zless_iff_Suc_zadd: 
14271
8ed6989228bb Simplification of the development of Integers
paulson
parents: 14269
diff changeset
   359
    "(w < z) = (\<exists>n. z = w + int(Suc n))"
14259
79f7d3451b1e conversion of ML to Isar scripts
paulson
parents: 13487
diff changeset
   360
apply (unfold zless_def neg_def zdiff_def int_def)
79f7d3451b1e conversion of ML to Isar scripts
paulson
parents: 13487
diff changeset
   361
apply (rule_tac z = z in eq_Abs_Integ)
79f7d3451b1e conversion of ML to Isar scripts
paulson
parents: 13487
diff changeset
   362
apply (rule_tac z = w in eq_Abs_Integ, clarify)
79f7d3451b1e conversion of ML to Isar scripts
paulson
parents: 13487
diff changeset
   363
apply (simp add: zadd zminus)
79f7d3451b1e conversion of ML to Isar scripts
paulson
parents: 13487
diff changeset
   364
apply (safe dest!: less_imp_Suc_add)
79f7d3451b1e conversion of ML to Isar scripts
paulson
parents: 13487
diff changeset
   365
apply (rule_tac x = k in exI)
79f7d3451b1e conversion of ML to Isar scripts
paulson
parents: 13487
diff changeset
   366
apply (simp_all add: add_ac)
79f7d3451b1e conversion of ML to Isar scripts
paulson
parents: 13487
diff changeset
   367
done
79f7d3451b1e conversion of ML to Isar scripts
paulson
parents: 13487
diff changeset
   368
79f7d3451b1e conversion of ML to Isar scripts
paulson
parents: 13487
diff changeset
   369
lemma zless_zadd_Suc: "z < z + int (Suc n)"
79f7d3451b1e conversion of ML to Isar scripts
paulson
parents: 13487
diff changeset
   370
by (auto simp add: zless_iff_Suc_zadd zadd_assoc zadd_int)
79f7d3451b1e conversion of ML to Isar scripts
paulson
parents: 13487
diff changeset
   371
79f7d3451b1e conversion of ML to Isar scripts
paulson
parents: 13487
diff changeset
   372
lemma zless_trans: "[| z1<z2; z2<z3 |] ==> z1 < (z3::int)"
79f7d3451b1e conversion of ML to Isar scripts
paulson
parents: 13487
diff changeset
   373
by (auto simp add: zless_iff_Suc_zadd zadd_assoc zadd_int)
79f7d3451b1e conversion of ML to Isar scripts
paulson
parents: 13487
diff changeset
   374
79f7d3451b1e conversion of ML to Isar scripts
paulson
parents: 13487
diff changeset
   375
lemma zless_not_sym: "!!w::int. z<w ==> ~w<z"
79f7d3451b1e conversion of ML to Isar scripts
paulson
parents: 13487
diff changeset
   376
apply (safe dest!: zless_iff_Suc_zadd [THEN iffD1])
79f7d3451b1e conversion of ML to Isar scripts
paulson
parents: 13487
diff changeset
   377
apply (rule_tac z = z in eq_Abs_Integ, safe)
79f7d3451b1e conversion of ML to Isar scripts
paulson
parents: 13487
diff changeset
   378
apply (simp add: int_def zadd)
79f7d3451b1e conversion of ML to Isar scripts
paulson
parents: 13487
diff changeset
   379
done
79f7d3451b1e conversion of ML to Isar scripts
paulson
parents: 13487
diff changeset
   380
79f7d3451b1e conversion of ML to Isar scripts
paulson
parents: 13487
diff changeset
   381
(* [| n<m;  ~P ==> m<n |] ==> P *)
79f7d3451b1e conversion of ML to Isar scripts
paulson
parents: 13487
diff changeset
   382
lemmas zless_asym = zless_not_sym [THEN swap, standard]
79f7d3451b1e conversion of ML to Isar scripts
paulson
parents: 13487
diff changeset
   383
79f7d3451b1e conversion of ML to Isar scripts
paulson
parents: 13487
diff changeset
   384
lemma zless_not_refl: "!!z::int. ~ z<z"
79f7d3451b1e conversion of ML to Isar scripts
paulson
parents: 13487
diff changeset
   385
apply (rule zless_asym [THEN notI])
79f7d3451b1e conversion of ML to Isar scripts
paulson
parents: 13487
diff changeset
   386
apply (assumption+)
79f7d3451b1e conversion of ML to Isar scripts
paulson
parents: 13487
diff changeset
   387
done
79f7d3451b1e conversion of ML to Isar scripts
paulson
parents: 13487
diff changeset
   388
79f7d3451b1e conversion of ML to Isar scripts
paulson
parents: 13487
diff changeset
   389
(* z<z ==> R *)
79f7d3451b1e conversion of ML to Isar scripts
paulson
parents: 13487
diff changeset
   390
lemmas zless_irrefl = zless_not_refl [THEN notE, standard, elim!]
79f7d3451b1e conversion of ML to Isar scripts
paulson
parents: 13487
diff changeset
   391
79f7d3451b1e conversion of ML to Isar scripts
paulson
parents: 13487
diff changeset
   392
79f7d3451b1e conversion of ML to Isar scripts
paulson
parents: 13487
diff changeset
   393
(*"Less than" is a linear ordering*)
79f7d3451b1e conversion of ML to Isar scripts
paulson
parents: 13487
diff changeset
   394
lemma zless_linear: 
79f7d3451b1e conversion of ML to Isar scripts
paulson
parents: 13487
diff changeset
   395
    "z<w | z=w | w<(z::int)"
79f7d3451b1e conversion of ML to Isar scripts
paulson
parents: 13487
diff changeset
   396
apply (unfold zless_def neg_def zdiff_def)
79f7d3451b1e conversion of ML to Isar scripts
paulson
parents: 13487
diff changeset
   397
apply (rule_tac z = z in eq_Abs_Integ)
79f7d3451b1e conversion of ML to Isar scripts
paulson
parents: 13487
diff changeset
   398
apply (rule_tac z = w in eq_Abs_Integ, safe)
79f7d3451b1e conversion of ML to Isar scripts
paulson
parents: 13487
diff changeset
   399
apply (simp add: zadd zminus Image_iff Bex_def)
79f7d3451b1e conversion of ML to Isar scripts
paulson
parents: 13487
diff changeset
   400
apply (rule_tac m1 = "x+ya" and n1 = "xa+y" in less_linear [THEN disjE])
79f7d3451b1e conversion of ML to Isar scripts
paulson
parents: 13487
diff changeset
   401
apply (force simp add: add_ac)+
79f7d3451b1e conversion of ML to Isar scripts
paulson
parents: 13487
diff changeset
   402
done
79f7d3451b1e conversion of ML to Isar scripts
paulson
parents: 13487
diff changeset
   403
79f7d3451b1e conversion of ML to Isar scripts
paulson
parents: 13487
diff changeset
   404
lemma int_neq_iff: "!!w::int. (w ~= z) = (w<z | z<w)"
79f7d3451b1e conversion of ML to Isar scripts
paulson
parents: 13487
diff changeset
   405
by (cut_tac zless_linear, blast)
79f7d3451b1e conversion of ML to Isar scripts
paulson
parents: 13487
diff changeset
   406
79f7d3451b1e conversion of ML to Isar scripts
paulson
parents: 13487
diff changeset
   407
(*** eliminates ~= in premises ***)
79f7d3451b1e conversion of ML to Isar scripts
paulson
parents: 13487
diff changeset
   408
lemmas int_neqE = int_neq_iff [THEN iffD1, THEN disjE, standard]
79f7d3451b1e conversion of ML to Isar scripts
paulson
parents: 13487
diff changeset
   409
79f7d3451b1e conversion of ML to Isar scripts
paulson
parents: 13487
diff changeset
   410
lemma int_eq_0_conv [simp]: "(int n = 0) = (n = 0)"
79f7d3451b1e conversion of ML to Isar scripts
paulson
parents: 13487
diff changeset
   411
by (simp add: Zero_int_def)
79f7d3451b1e conversion of ML to Isar scripts
paulson
parents: 13487
diff changeset
   412
79f7d3451b1e conversion of ML to Isar scripts
paulson
parents: 13487
diff changeset
   413
lemma zless_int [simp]: "(int m < int n) = (m<n)"
79f7d3451b1e conversion of ML to Isar scripts
paulson
parents: 13487
diff changeset
   414
by (simp add: less_iff_Suc_add zless_iff_Suc_zadd zadd_int)
79f7d3451b1e conversion of ML to Isar scripts
paulson
parents: 13487
diff changeset
   415
79f7d3451b1e conversion of ML to Isar scripts
paulson
parents: 13487
diff changeset
   416
lemma int_less_0_conv [simp]: "~ (int k < 0)"
79f7d3451b1e conversion of ML to Isar scripts
paulson
parents: 13487
diff changeset
   417
by (simp add: Zero_int_def)
79f7d3451b1e conversion of ML to Isar scripts
paulson
parents: 13487
diff changeset
   418
79f7d3451b1e conversion of ML to Isar scripts
paulson
parents: 13487
diff changeset
   419
lemma zero_less_int_conv [simp]: "(0 < int n) = (0 < n)"
79f7d3451b1e conversion of ML to Isar scripts
paulson
parents: 13487
diff changeset
   420
by (simp add: Zero_int_def)
79f7d3451b1e conversion of ML to Isar scripts
paulson
parents: 13487
diff changeset
   421
14341
a09441bd4f1e Ring_and_Field now requires axiom add_left_imp_eq for semirings.
paulson
parents: 14271
diff changeset
   422
lemma int_0_less_1: "0 < (1::int)"
a09441bd4f1e Ring_and_Field now requires axiom add_left_imp_eq for semirings.
paulson
parents: 14271
diff changeset
   423
by (simp only: Zero_int_def One_int_def One_nat_def zless_int)
14259
79f7d3451b1e conversion of ML to Isar scripts
paulson
parents: 13487
diff changeset
   424
14341
a09441bd4f1e Ring_and_Field now requires axiom add_left_imp_eq for semirings.
paulson
parents: 14271
diff changeset
   425
lemma int_0_neq_1 [simp]: "0 \<noteq> (1::int)"
a09441bd4f1e Ring_and_Field now requires axiom add_left_imp_eq for semirings.
paulson
parents: 14271
diff changeset
   426
by (simp only: Zero_int_def One_int_def One_nat_def int_int_eq)
a09441bd4f1e Ring_and_Field now requires axiom add_left_imp_eq for semirings.
paulson
parents: 14271
diff changeset
   427
a09441bd4f1e Ring_and_Field now requires axiom add_left_imp_eq for semirings.
paulson
parents: 14271
diff changeset
   428
a09441bd4f1e Ring_and_Field now requires axiom add_left_imp_eq for semirings.
paulson
parents: 14271
diff changeset
   429
subsection{*Properties of the @{text "\<le>"} Relation*}
14259
79f7d3451b1e conversion of ML to Isar scripts
paulson
parents: 13487
diff changeset
   430
79f7d3451b1e conversion of ML to Isar scripts
paulson
parents: 13487
diff changeset
   431
lemma zle_int [simp]: "(int m <= int n) = (m<=n)"
79f7d3451b1e conversion of ML to Isar scripts
paulson
parents: 13487
diff changeset
   432
by (simp add: zle_def le_def)
79f7d3451b1e conversion of ML to Isar scripts
paulson
parents: 13487
diff changeset
   433
79f7d3451b1e conversion of ML to Isar scripts
paulson
parents: 13487
diff changeset
   434
lemma zero_zle_int [simp]: "(0 <= int n)"
79f7d3451b1e conversion of ML to Isar scripts
paulson
parents: 13487
diff changeset
   435
by (simp add: Zero_int_def)
79f7d3451b1e conversion of ML to Isar scripts
paulson
parents: 13487
diff changeset
   436
79f7d3451b1e conversion of ML to Isar scripts
paulson
parents: 13487
diff changeset
   437
lemma int_le_0_conv [simp]: "(int n <= 0) = (n = 0)"
79f7d3451b1e conversion of ML to Isar scripts
paulson
parents: 13487
diff changeset
   438
by (simp add: Zero_int_def)
79f7d3451b1e conversion of ML to Isar scripts
paulson
parents: 13487
diff changeset
   439
79f7d3451b1e conversion of ML to Isar scripts
paulson
parents: 13487
diff changeset
   440
lemma zle_imp_zless_or_eq: "z <= w ==> z < w | z=(w::int)"
79f7d3451b1e conversion of ML to Isar scripts
paulson
parents: 13487
diff changeset
   441
apply (unfold zle_def)
79f7d3451b1e conversion of ML to Isar scripts
paulson
parents: 13487
diff changeset
   442
apply (cut_tac zless_linear)
79f7d3451b1e conversion of ML to Isar scripts
paulson
parents: 13487
diff changeset
   443
apply (blast elim: zless_asym)
79f7d3451b1e conversion of ML to Isar scripts
paulson
parents: 13487
diff changeset
   444
done
79f7d3451b1e conversion of ML to Isar scripts
paulson
parents: 13487
diff changeset
   445
79f7d3451b1e conversion of ML to Isar scripts
paulson
parents: 13487
diff changeset
   446
lemma zless_or_eq_imp_zle: "z<w | z=w ==> z <= (w::int)"
79f7d3451b1e conversion of ML to Isar scripts
paulson
parents: 13487
diff changeset
   447
apply (unfold zle_def)
79f7d3451b1e conversion of ML to Isar scripts
paulson
parents: 13487
diff changeset
   448
apply (cut_tac zless_linear)
79f7d3451b1e conversion of ML to Isar scripts
paulson
parents: 13487
diff changeset
   449
apply (blast elim: zless_asym)
79f7d3451b1e conversion of ML to Isar scripts
paulson
parents: 13487
diff changeset
   450
done
79f7d3451b1e conversion of ML to Isar scripts
paulson
parents: 13487
diff changeset
   451
79f7d3451b1e conversion of ML to Isar scripts
paulson
parents: 13487
diff changeset
   452
lemma int_le_less: "(x <= (y::int)) = (x < y | x=y)"
79f7d3451b1e conversion of ML to Isar scripts
paulson
parents: 13487
diff changeset
   453
apply (rule iffI) 
79f7d3451b1e conversion of ML to Isar scripts
paulson
parents: 13487
diff changeset
   454
apply (erule zle_imp_zless_or_eq) 
79f7d3451b1e conversion of ML to Isar scripts
paulson
parents: 13487
diff changeset
   455
apply (erule zless_or_eq_imp_zle) 
79f7d3451b1e conversion of ML to Isar scripts
paulson
parents: 13487
diff changeset
   456
done
79f7d3451b1e conversion of ML to Isar scripts
paulson
parents: 13487
diff changeset
   457
79f7d3451b1e conversion of ML to Isar scripts
paulson
parents: 13487
diff changeset
   458
lemma zle_refl: "w <= (w::int)"
79f7d3451b1e conversion of ML to Isar scripts
paulson
parents: 13487
diff changeset
   459
by (simp add: int_le_less)
79f7d3451b1e conversion of ML to Isar scripts
paulson
parents: 13487
diff changeset
   460
79f7d3451b1e conversion of ML to Isar scripts
paulson
parents: 13487
diff changeset
   461
(* Axiom 'linorder_linear' of class 'linorder': *)
79f7d3451b1e conversion of ML to Isar scripts
paulson
parents: 13487
diff changeset
   462
lemma zle_linear: "(z::int) <= w | w <= z"
79f7d3451b1e conversion of ML to Isar scripts
paulson
parents: 13487
diff changeset
   463
apply (simp add: int_le_less)
79f7d3451b1e conversion of ML to Isar scripts
paulson
parents: 13487
diff changeset
   464
apply (cut_tac zless_linear, blast)
79f7d3451b1e conversion of ML to Isar scripts
paulson
parents: 13487
diff changeset
   465
done
79f7d3451b1e conversion of ML to Isar scripts
paulson
parents: 13487
diff changeset
   466
79f7d3451b1e conversion of ML to Isar scripts
paulson
parents: 13487
diff changeset
   467
(* Axiom 'order_trans of class 'order': *)
79f7d3451b1e conversion of ML to Isar scripts
paulson
parents: 13487
diff changeset
   468
lemma zle_trans: "[| i <= j; j <= k |] ==> i <= (k::int)"
79f7d3451b1e conversion of ML to Isar scripts
paulson
parents: 13487
diff changeset
   469
apply (drule zle_imp_zless_or_eq) 
79f7d3451b1e conversion of ML to Isar scripts
paulson
parents: 13487
diff changeset
   470
apply (drule zle_imp_zless_or_eq) 
79f7d3451b1e conversion of ML to Isar scripts
paulson
parents: 13487
diff changeset
   471
apply (rule zless_or_eq_imp_zle) 
79f7d3451b1e conversion of ML to Isar scripts
paulson
parents: 13487
diff changeset
   472
apply (blast intro: zless_trans) 
79f7d3451b1e conversion of ML to Isar scripts
paulson
parents: 13487
diff changeset
   473
done
79f7d3451b1e conversion of ML to Isar scripts
paulson
parents: 13487
diff changeset
   474
79f7d3451b1e conversion of ML to Isar scripts
paulson
parents: 13487
diff changeset
   475
lemma zle_anti_sym: "[| z <= w; w <= z |] ==> z = (w::int)"
79f7d3451b1e conversion of ML to Isar scripts
paulson
parents: 13487
diff changeset
   476
apply (drule zle_imp_zless_or_eq) 
79f7d3451b1e conversion of ML to Isar scripts
paulson
parents: 13487
diff changeset
   477
apply (drule zle_imp_zless_or_eq) 
79f7d3451b1e conversion of ML to Isar scripts
paulson
parents: 13487
diff changeset
   478
apply (blast elim: zless_asym) 
79f7d3451b1e conversion of ML to Isar scripts
paulson
parents: 13487
diff changeset
   479
done
79f7d3451b1e conversion of ML to Isar scripts
paulson
parents: 13487
diff changeset
   480
79f7d3451b1e conversion of ML to Isar scripts
paulson
parents: 13487
diff changeset
   481
(* Axiom 'order_less_le' of class 'order': *)
79f7d3451b1e conversion of ML to Isar scripts
paulson
parents: 13487
diff changeset
   482
lemma int_less_le: "((w::int) < z) = (w <= z & w ~= z)"
79f7d3451b1e conversion of ML to Isar scripts
paulson
parents: 13487
diff changeset
   483
apply (simp add: zle_def int_neq_iff)
79f7d3451b1e conversion of ML to Isar scripts
paulson
parents: 13487
diff changeset
   484
apply (blast elim!: zless_asym)
79f7d3451b1e conversion of ML to Isar scripts
paulson
parents: 13487
diff changeset
   485
done
79f7d3451b1e conversion of ML to Isar scripts
paulson
parents: 13487
diff changeset
   486
14271
8ed6989228bb Simplification of the development of Integers
paulson
parents: 14269
diff changeset
   487
instance int :: order
8ed6989228bb Simplification of the development of Integers
paulson
parents: 14269
diff changeset
   488
proof qed (assumption | rule zle_refl zle_trans zle_anti_sym int_less_le)+
14259
79f7d3451b1e conversion of ML to Isar scripts
paulson
parents: 13487
diff changeset
   489
14271
8ed6989228bb Simplification of the development of Integers
paulson
parents: 14269
diff changeset
   490
instance int :: plus_ac0
8ed6989228bb Simplification of the development of Integers
paulson
parents: 14269
diff changeset
   491
proof qed (rule zadd_commute zadd_assoc zadd_0)+
14259
79f7d3451b1e conversion of ML to Isar scripts
paulson
parents: 13487
diff changeset
   492
14271
8ed6989228bb Simplification of the development of Integers
paulson
parents: 14269
diff changeset
   493
instance int :: linorder
8ed6989228bb Simplification of the development of Integers
paulson
parents: 14269
diff changeset
   494
proof qed (rule zle_linear)
8ed6989228bb Simplification of the development of Integers
paulson
parents: 14269
diff changeset
   495
14259
79f7d3451b1e conversion of ML to Isar scripts
paulson
parents: 13487
diff changeset
   496
14341
a09441bd4f1e Ring_and_Field now requires axiom add_left_imp_eq for semirings.
paulson
parents: 14271
diff changeset
   497
lemma zadd_left_cancel [simp]: "!!w::int. (z + w' = z + w) = (w' = w)"
a09441bd4f1e Ring_and_Field now requires axiom add_left_imp_eq for semirings.
paulson
parents: 14271
diff changeset
   498
  by (rule add_left_cancel) 
a09441bd4f1e Ring_and_Field now requires axiom add_left_imp_eq for semirings.
paulson
parents: 14271
diff changeset
   499
a09441bd4f1e Ring_and_Field now requires axiom add_left_imp_eq for semirings.
paulson
parents: 14271
diff changeset
   500
14259
79f7d3451b1e conversion of ML to Isar scripts
paulson
parents: 13487
diff changeset
   501
ML
79f7d3451b1e conversion of ML to Isar scripts
paulson
parents: 13487
diff changeset
   502
{*
79f7d3451b1e conversion of ML to Isar scripts
paulson
parents: 13487
diff changeset
   503
val int_def = thm "int_def";
79f7d3451b1e conversion of ML to Isar scripts
paulson
parents: 13487
diff changeset
   504
val neg_def = thm "neg_def";
79f7d3451b1e conversion of ML to Isar scripts
paulson
parents: 13487
diff changeset
   505
val iszero_def = thm "iszero_def";
79f7d3451b1e conversion of ML to Isar scripts
paulson
parents: 13487
diff changeset
   506
val Zero_int_def = thm "Zero_int_def";
79f7d3451b1e conversion of ML to Isar scripts
paulson
parents: 13487
diff changeset
   507
val One_int_def = thm "One_int_def";
79f7d3451b1e conversion of ML to Isar scripts
paulson
parents: 13487
diff changeset
   508
val zadd_def = thm "zadd_def";
79f7d3451b1e conversion of ML to Isar scripts
paulson
parents: 13487
diff changeset
   509
val zdiff_def = thm "zdiff_def";
79f7d3451b1e conversion of ML to Isar scripts
paulson
parents: 13487
diff changeset
   510
val zless_def = thm "zless_def";
79f7d3451b1e conversion of ML to Isar scripts
paulson
parents: 13487
diff changeset
   511
val zle_def = thm "zle_def";
79f7d3451b1e conversion of ML to Isar scripts
paulson
parents: 13487
diff changeset
   512
val zmult_def = thm "zmult_def";
79f7d3451b1e conversion of ML to Isar scripts
paulson
parents: 13487
diff changeset
   513
79f7d3451b1e conversion of ML to Isar scripts
paulson
parents: 13487
diff changeset
   514
val intrel_iff = thm "intrel_iff";
79f7d3451b1e conversion of ML to Isar scripts
paulson
parents: 13487
diff changeset
   515
val equiv_intrel = thm "equiv_intrel";
79f7d3451b1e conversion of ML to Isar scripts
paulson
parents: 13487
diff changeset
   516
val equiv_intrel_iff = thm "equiv_intrel_iff";
79f7d3451b1e conversion of ML to Isar scripts
paulson
parents: 13487
diff changeset
   517
val intrel_in_integ = thm "intrel_in_integ";
79f7d3451b1e conversion of ML to Isar scripts
paulson
parents: 13487
diff changeset
   518
val inj_on_Abs_Integ = thm "inj_on_Abs_Integ";
79f7d3451b1e conversion of ML to Isar scripts
paulson
parents: 13487
diff changeset
   519
val inj_Rep_Integ = thm "inj_Rep_Integ";
79f7d3451b1e conversion of ML to Isar scripts
paulson
parents: 13487
diff changeset
   520
val inj_int = thm "inj_int";
79f7d3451b1e conversion of ML to Isar scripts
paulson
parents: 13487
diff changeset
   521
val zminus_congruent = thm "zminus_congruent";
79f7d3451b1e conversion of ML to Isar scripts
paulson
parents: 13487
diff changeset
   522
val zminus = thm "zminus";
79f7d3451b1e conversion of ML to Isar scripts
paulson
parents: 13487
diff changeset
   523
val eq_Abs_Integ = thm "eq_Abs_Integ";
79f7d3451b1e conversion of ML to Isar scripts
paulson
parents: 13487
diff changeset
   524
val zminus_zminus = thm "zminus_zminus";
79f7d3451b1e conversion of ML to Isar scripts
paulson
parents: 13487
diff changeset
   525
val inj_zminus = thm "inj_zminus";
79f7d3451b1e conversion of ML to Isar scripts
paulson
parents: 13487
diff changeset
   526
val zminus_0 = thm "zminus_0";
79f7d3451b1e conversion of ML to Isar scripts
paulson
parents: 13487
diff changeset
   527
val not_neg_int = thm "not_neg_int";
79f7d3451b1e conversion of ML to Isar scripts
paulson
parents: 13487
diff changeset
   528
val neg_zminus_int = thm "neg_zminus_int";
79f7d3451b1e conversion of ML to Isar scripts
paulson
parents: 13487
diff changeset
   529
val zadd = thm "zadd";
79f7d3451b1e conversion of ML to Isar scripts
paulson
parents: 13487
diff changeset
   530
val zminus_zadd_distrib = thm "zminus_zadd_distrib";
79f7d3451b1e conversion of ML to Isar scripts
paulson
parents: 13487
diff changeset
   531
val zadd_commute = thm "zadd_commute";
79f7d3451b1e conversion of ML to Isar scripts
paulson
parents: 13487
diff changeset
   532
val zadd_assoc = thm "zadd_assoc";
79f7d3451b1e conversion of ML to Isar scripts
paulson
parents: 13487
diff changeset
   533
val zadd_left_commute = thm "zadd_left_commute";
79f7d3451b1e conversion of ML to Isar scripts
paulson
parents: 13487
diff changeset
   534
val zadd_ac = thms "zadd_ac";
14271
8ed6989228bb Simplification of the development of Integers
paulson
parents: 14269
diff changeset
   535
val zmult_ac = thms "zmult_ac";
14259
79f7d3451b1e conversion of ML to Isar scripts
paulson
parents: 13487
diff changeset
   536
val zadd_int = thm "zadd_int";
79f7d3451b1e conversion of ML to Isar scripts
paulson
parents: 13487
diff changeset
   537
val zadd_int_left = thm "zadd_int_left";
79f7d3451b1e conversion of ML to Isar scripts
paulson
parents: 13487
diff changeset
   538
val int_Suc = thm "int_Suc";
79f7d3451b1e conversion of ML to Isar scripts
paulson
parents: 13487
diff changeset
   539
val zadd_0 = thm "zadd_0";
79f7d3451b1e conversion of ML to Isar scripts
paulson
parents: 13487
diff changeset
   540
val zadd_0_right = thm "zadd_0_right";
79f7d3451b1e conversion of ML to Isar scripts
paulson
parents: 13487
diff changeset
   541
val zadd_zminus_inverse = thm "zadd_zminus_inverse";
79f7d3451b1e conversion of ML to Isar scripts
paulson
parents: 13487
diff changeset
   542
val zadd_zminus_inverse2 = thm "zadd_zminus_inverse2";
79f7d3451b1e conversion of ML to Isar scripts
paulson
parents: 13487
diff changeset
   543
val zadd_zminus_cancel = thm "zadd_zminus_cancel";
79f7d3451b1e conversion of ML to Isar scripts
paulson
parents: 13487
diff changeset
   544
val zminus_zadd_cancel = thm "zminus_zadd_cancel";
79f7d3451b1e conversion of ML to Isar scripts
paulson
parents: 13487
diff changeset
   545
val zdiff0 = thm "zdiff0";
79f7d3451b1e conversion of ML to Isar scripts
paulson
parents: 13487
diff changeset
   546
val zdiff0_right = thm "zdiff0_right";
79f7d3451b1e conversion of ML to Isar scripts
paulson
parents: 13487
diff changeset
   547
val zdiff_self = thm "zdiff_self";
79f7d3451b1e conversion of ML to Isar scripts
paulson
parents: 13487
diff changeset
   548
val zadd_assoc_cong = thm "zadd_assoc_cong";
79f7d3451b1e conversion of ML to Isar scripts
paulson
parents: 13487
diff changeset
   549
val zadd_assoc_swap = thm "zadd_assoc_swap";
79f7d3451b1e conversion of ML to Isar scripts
paulson
parents: 13487
diff changeset
   550
val zmult_congruent2 = thm "zmult_congruent2";
79f7d3451b1e conversion of ML to Isar scripts
paulson
parents: 13487
diff changeset
   551
val zmult = thm "zmult";
79f7d3451b1e conversion of ML to Isar scripts
paulson
parents: 13487
diff changeset
   552
val zmult_zminus = thm "zmult_zminus";
79f7d3451b1e conversion of ML to Isar scripts
paulson
parents: 13487
diff changeset
   553
val zmult_commute = thm "zmult_commute";
79f7d3451b1e conversion of ML to Isar scripts
paulson
parents: 13487
diff changeset
   554
val zmult_assoc = thm "zmult_assoc";
79f7d3451b1e conversion of ML to Isar scripts
paulson
parents: 13487
diff changeset
   555
val zadd_zmult_distrib = thm "zadd_zmult_distrib";
79f7d3451b1e conversion of ML to Isar scripts
paulson
parents: 13487
diff changeset
   556
val zmult_zminus_right = thm "zmult_zminus_right";
79f7d3451b1e conversion of ML to Isar scripts
paulson
parents: 13487
diff changeset
   557
val zadd_zmult_distrib2 = thm "zadd_zmult_distrib2";
79f7d3451b1e conversion of ML to Isar scripts
paulson
parents: 13487
diff changeset
   558
val zdiff_zmult_distrib = thm "zdiff_zmult_distrib";
79f7d3451b1e conversion of ML to Isar scripts
paulson
parents: 13487
diff changeset
   559
val zdiff_zmult_distrib2 = thm "zdiff_zmult_distrib2";
79f7d3451b1e conversion of ML to Isar scripts
paulson
parents: 13487
diff changeset
   560
val int_distrib = thms "int_distrib";
79f7d3451b1e conversion of ML to Isar scripts
paulson
parents: 13487
diff changeset
   561
val zmult_int = thm "zmult_int";
79f7d3451b1e conversion of ML to Isar scripts
paulson
parents: 13487
diff changeset
   562
val zmult_0 = thm "zmult_0";
79f7d3451b1e conversion of ML to Isar scripts
paulson
parents: 13487
diff changeset
   563
val zmult_1 = thm "zmult_1";
79f7d3451b1e conversion of ML to Isar scripts
paulson
parents: 13487
diff changeset
   564
val zmult_0_right = thm "zmult_0_right";
79f7d3451b1e conversion of ML to Isar scripts
paulson
parents: 13487
diff changeset
   565
val zmult_1_right = thm "zmult_1_right";
79f7d3451b1e conversion of ML to Isar scripts
paulson
parents: 13487
diff changeset
   566
val zless_iff_Suc_zadd = thm "zless_iff_Suc_zadd";
79f7d3451b1e conversion of ML to Isar scripts
paulson
parents: 13487
diff changeset
   567
val zless_zadd_Suc = thm "zless_zadd_Suc";
79f7d3451b1e conversion of ML to Isar scripts
paulson
parents: 13487
diff changeset
   568
val zless_trans = thm "zless_trans";
79f7d3451b1e conversion of ML to Isar scripts
paulson
parents: 13487
diff changeset
   569
val zless_not_sym = thm "zless_not_sym";
79f7d3451b1e conversion of ML to Isar scripts
paulson
parents: 13487
diff changeset
   570
val zless_asym = thm "zless_asym";
79f7d3451b1e conversion of ML to Isar scripts
paulson
parents: 13487
diff changeset
   571
val zless_not_refl = thm "zless_not_refl";
79f7d3451b1e conversion of ML to Isar scripts
paulson
parents: 13487
diff changeset
   572
val zless_irrefl = thm "zless_irrefl";
79f7d3451b1e conversion of ML to Isar scripts
paulson
parents: 13487
diff changeset
   573
val zless_linear = thm "zless_linear";
79f7d3451b1e conversion of ML to Isar scripts
paulson
parents: 13487
diff changeset
   574
val int_neq_iff = thm "int_neq_iff";
79f7d3451b1e conversion of ML to Isar scripts
paulson
parents: 13487
diff changeset
   575
val int_neqE = thm "int_neqE";
79f7d3451b1e conversion of ML to Isar scripts
paulson
parents: 13487
diff changeset
   576
val int_int_eq = thm "int_int_eq";
79f7d3451b1e conversion of ML to Isar scripts
paulson
parents: 13487
diff changeset
   577
val int_eq_0_conv = thm "int_eq_0_conv";
79f7d3451b1e conversion of ML to Isar scripts
paulson
parents: 13487
diff changeset
   578
val zless_int = thm "zless_int";
79f7d3451b1e conversion of ML to Isar scripts
paulson
parents: 13487
diff changeset
   579
val int_less_0_conv = thm "int_less_0_conv";
79f7d3451b1e conversion of ML to Isar scripts
paulson
parents: 13487
diff changeset
   580
val zero_less_int_conv = thm "zero_less_int_conv";
79f7d3451b1e conversion of ML to Isar scripts
paulson
parents: 13487
diff changeset
   581
val zle_int = thm "zle_int";
79f7d3451b1e conversion of ML to Isar scripts
paulson
parents: 13487
diff changeset
   582
val zero_zle_int = thm "zero_zle_int";
79f7d3451b1e conversion of ML to Isar scripts
paulson
parents: 13487
diff changeset
   583
val int_le_0_conv = thm "int_le_0_conv";
79f7d3451b1e conversion of ML to Isar scripts
paulson
parents: 13487
diff changeset
   584
val zle_imp_zless_or_eq = thm "zle_imp_zless_or_eq";
79f7d3451b1e conversion of ML to Isar scripts
paulson
parents: 13487
diff changeset
   585
val zless_or_eq_imp_zle = thm "zless_or_eq_imp_zle";
79f7d3451b1e conversion of ML to Isar scripts
paulson
parents: 13487
diff changeset
   586
val int_le_less = thm "int_le_less";
79f7d3451b1e conversion of ML to Isar scripts
paulson
parents: 13487
diff changeset
   587
val zle_refl = thm "zle_refl";
79f7d3451b1e conversion of ML to Isar scripts
paulson
parents: 13487
diff changeset
   588
val zle_linear = thm "zle_linear";
79f7d3451b1e conversion of ML to Isar scripts
paulson
parents: 13487
diff changeset
   589
val zle_trans = thm "zle_trans";
79f7d3451b1e conversion of ML to Isar scripts
paulson
parents: 13487
diff changeset
   590
val zle_anti_sym = thm "zle_anti_sym";
79f7d3451b1e conversion of ML to Isar scripts
paulson
parents: 13487
diff changeset
   591
val int_less_le = thm "int_less_le";
79f7d3451b1e conversion of ML to Isar scripts
paulson
parents: 13487
diff changeset
   592
val zadd_left_cancel = thm "zadd_left_cancel";
79f7d3451b1e conversion of ML to Isar scripts
paulson
parents: 13487
diff changeset
   593
*}
79f7d3451b1e conversion of ML to Isar scripts
paulson
parents: 13487
diff changeset
   594
5508
691c70898518 new files in Integ
paulson
parents:
diff changeset
   595
end