doc-src/TutorialI/Types/Numbers.thy
author paulson
Wed, 06 Dec 2000 11:47:21 +0100
changeset 10603 539735ddaea9
child 10764 329d5f4aa43c
permissions -rw-r--r--
theory file for Numbers section
Ignore whitespace changes - Everywhere: Within whitespace: At end of lines:
10603
539735ddaea9 theory file for Numbers section
paulson
parents:
diff changeset
     1
(* ID:         $Id$ *)
539735ddaea9 theory file for Numbers section
paulson
parents:
diff changeset
     2
theory Numbers = Main:
539735ddaea9 theory file for Numbers section
paulson
parents:
diff changeset
     3
539735ddaea9 theory file for Numbers section
paulson
parents:
diff changeset
     4
ML "Pretty.setmargin 64"
539735ddaea9 theory file for Numbers section
paulson
parents:
diff changeset
     5
539735ddaea9 theory file for Numbers section
paulson
parents:
diff changeset
     6
539735ddaea9 theory file for Numbers section
paulson
parents:
diff changeset
     7
text{*
539735ddaea9 theory file for Numbers section
paulson
parents:
diff changeset
     8
539735ddaea9 theory file for Numbers section
paulson
parents:
diff changeset
     9
numeric literals; default simprules; can re-orient
539735ddaea9 theory file for Numbers section
paulson
parents:
diff changeset
    10
*}
539735ddaea9 theory file for Numbers section
paulson
parents:
diff changeset
    11
539735ddaea9 theory file for Numbers section
paulson
parents:
diff changeset
    12
lemma "#2 * m = m + m"
539735ddaea9 theory file for Numbers section
paulson
parents:
diff changeset
    13
oops
539735ddaea9 theory file for Numbers section
paulson
parents:
diff changeset
    14
539735ddaea9 theory file for Numbers section
paulson
parents:
diff changeset
    15
text{*
539735ddaea9 theory file for Numbers section
paulson
parents:
diff changeset
    16
proof\ {\isacharparenleft}prove{\isacharparenright}{\isacharcolon}\ step\ {\isadigit{0}}\isanewline
539735ddaea9 theory file for Numbers section
paulson
parents:
diff changeset
    17
\isanewline
539735ddaea9 theory file for Numbers section
paulson
parents:
diff changeset
    18
goal\ {\isacharparenleft}lemma{\isacharparenright}{\isacharcolon}\isanewline
539735ddaea9 theory file for Numbers section
paulson
parents:
diff changeset
    19
{\isacharparenleft}{\isacharhash}{\isadigit{2}}{\isasymColon}{\isacharprime}a{\isacharparenright}\ {\isacharasterisk}\ m\ {\isacharequal}\ m\ {\isacharplus}\ m\isanewline
539735ddaea9 theory file for Numbers section
paulson
parents:
diff changeset
    20
\ {\isadigit{1}}{\isachardot}\ {\isacharparenleft}{\isacharhash}{\isadigit{2}}{\isasymColon}{\isacharprime}a{\isacharparenright}\ {\isacharasterisk}\ m\ {\isacharequal}\ m\ {\isacharplus}\ m
539735ddaea9 theory file for Numbers section
paulson
parents:
diff changeset
    21
539735ddaea9 theory file for Numbers section
paulson
parents:
diff changeset
    22
539735ddaea9 theory file for Numbers section
paulson
parents:
diff changeset
    23
@{thm[display] numeral_0_eq_0[no_vars]}
539735ddaea9 theory file for Numbers section
paulson
parents:
diff changeset
    24
\rulename{numeral_0_eq_0}
539735ddaea9 theory file for Numbers section
paulson
parents:
diff changeset
    25
539735ddaea9 theory file for Numbers section
paulson
parents:
diff changeset
    26
@{thm[display] numeral_1_eq_1[no_vars]}
539735ddaea9 theory file for Numbers section
paulson
parents:
diff changeset
    27
\rulename{numeral_1_eq_1}
539735ddaea9 theory file for Numbers section
paulson
parents:
diff changeset
    28
539735ddaea9 theory file for Numbers section
paulson
parents:
diff changeset
    29
@{thm[display] add_2_eq_Suc[no_vars]}
539735ddaea9 theory file for Numbers section
paulson
parents:
diff changeset
    30
\rulename{add_2_eq_Suc}
539735ddaea9 theory file for Numbers section
paulson
parents:
diff changeset
    31
539735ddaea9 theory file for Numbers section
paulson
parents:
diff changeset
    32
@{thm[display] add_2_eq_Suc'[no_vars]}
539735ddaea9 theory file for Numbers section
paulson
parents:
diff changeset
    33
\rulename{add_2_eq_Suc'}
539735ddaea9 theory file for Numbers section
paulson
parents:
diff changeset
    34
539735ddaea9 theory file for Numbers section
paulson
parents:
diff changeset
    35
@{thm[display] add_assoc[no_vars]}
539735ddaea9 theory file for Numbers section
paulson
parents:
diff changeset
    36
\rulename{add_assoc}
539735ddaea9 theory file for Numbers section
paulson
parents:
diff changeset
    37
539735ddaea9 theory file for Numbers section
paulson
parents:
diff changeset
    38
@{thm[display] add_commute[no_vars]}
539735ddaea9 theory file for Numbers section
paulson
parents:
diff changeset
    39
\rulename{add_commute}
539735ddaea9 theory file for Numbers section
paulson
parents:
diff changeset
    40
539735ddaea9 theory file for Numbers section
paulson
parents:
diff changeset
    41
@{thm[display] add_left_commute[no_vars]}
539735ddaea9 theory file for Numbers section
paulson
parents:
diff changeset
    42
\rulename{add_left_commute}
539735ddaea9 theory file for Numbers section
paulson
parents:
diff changeset
    43
539735ddaea9 theory file for Numbers section
paulson
parents:
diff changeset
    44
these form add_ac; similarly there is mult_ac
539735ddaea9 theory file for Numbers section
paulson
parents:
diff changeset
    45
*}
539735ddaea9 theory file for Numbers section
paulson
parents:
diff changeset
    46
539735ddaea9 theory file for Numbers section
paulson
parents:
diff changeset
    47
lemma "Suc(i + j*l*k + m*n) = f (n*m + i + k*j*l)"
539735ddaea9 theory file for Numbers section
paulson
parents:
diff changeset
    48
apply (simp add: add_ac mult_ac)
539735ddaea9 theory file for Numbers section
paulson
parents:
diff changeset
    49
oops
539735ddaea9 theory file for Numbers section
paulson
parents:
diff changeset
    50
539735ddaea9 theory file for Numbers section
paulson
parents:
diff changeset
    51
text{*
539735ddaea9 theory file for Numbers section
paulson
parents:
diff changeset
    52
proof\ {\isacharparenleft}prove{\isacharparenright}{\isacharcolon}\ step\ {\isadigit{0}}\isanewline
539735ddaea9 theory file for Numbers section
paulson
parents:
diff changeset
    53
\isanewline
539735ddaea9 theory file for Numbers section
paulson
parents:
diff changeset
    54
goal\ {\isacharparenleft}lemma{\isacharparenright}{\isacharcolon}\isanewline
539735ddaea9 theory file for Numbers section
paulson
parents:
diff changeset
    55
Suc\ {\isacharparenleft}i\ {\isacharplus}\ j\ {\isacharasterisk}\ l\ {\isacharasterisk}\ k\ {\isacharplus}\ m\ {\isacharasterisk}\ n{\isacharparenright}\ {\isacharequal}\ f\ {\isacharparenleft}n\ {\isacharasterisk}\ m\ {\isacharplus}\ i\ {\isacharplus}\ k\ {\isacharasterisk}\ j\ {\isacharasterisk}\ l{\isacharparenright}\isanewline
539735ddaea9 theory file for Numbers section
paulson
parents:
diff changeset
    56
\ {\isadigit{1}}{\isachardot}\ Suc\ {\isacharparenleft}i\ {\isacharplus}\ j\ {\isacharasterisk}\ l\ {\isacharasterisk}\ k\ {\isacharplus}\ m\ {\isacharasterisk}\ n{\isacharparenright}\ {\isacharequal}\ f\ {\isacharparenleft}n\ {\isacharasterisk}\ m\ {\isacharplus}\ i\ {\isacharplus}\ k\ {\isacharasterisk}\ j\ {\isacharasterisk}\ l{\isacharparenright}
539735ddaea9 theory file for Numbers section
paulson
parents:
diff changeset
    57
539735ddaea9 theory file for Numbers section
paulson
parents:
diff changeset
    58
proof\ {\isacharparenleft}prove{\isacharparenright}{\isacharcolon}\ step\ {\isadigit{1}}\isanewline
539735ddaea9 theory file for Numbers section
paulson
parents:
diff changeset
    59
\isanewline
539735ddaea9 theory file for Numbers section
paulson
parents:
diff changeset
    60
goal\ {\isacharparenleft}lemma{\isacharparenright}{\isacharcolon}\isanewline
539735ddaea9 theory file for Numbers section
paulson
parents:
diff changeset
    61
Suc\ {\isacharparenleft}i\ {\isacharplus}\ j\ {\isacharasterisk}\ l\ {\isacharasterisk}\ k\ {\isacharplus}\ m\ {\isacharasterisk}\ n{\isacharparenright}\ {\isacharequal}\ f\ {\isacharparenleft}n\ {\isacharasterisk}\ m\ {\isacharplus}\ i\ {\isacharplus}\ k\ {\isacharasterisk}\ j\ {\isacharasterisk}\ l{\isacharparenright}\isanewline
539735ddaea9 theory file for Numbers section
paulson
parents:
diff changeset
    62
\ {\isadigit{1}}{\isachardot}\ Suc\ {\isacharparenleft}i\ {\isacharplus}\ {\isacharparenleft}m\ {\isacharasterisk}\ n\ {\isacharplus}\ j\ {\isacharasterisk}\ {\isacharparenleft}k\ {\isacharasterisk}\ l{\isacharparenright}{\isacharparenright}{\isacharparenright}\ {\isacharequal}\isanewline
539735ddaea9 theory file for Numbers section
paulson
parents:
diff changeset
    63
\ \ \ \ f\ {\isacharparenleft}i\ {\isacharplus}\ {\isacharparenleft}m\ {\isacharasterisk}\ n\ {\isacharplus}\ j\ {\isacharasterisk}\ {\isacharparenleft}k\ {\isacharasterisk}\ l{\isacharparenright}{\isacharparenright}{\isacharparenright}
539735ddaea9 theory file for Numbers section
paulson
parents:
diff changeset
    64
*}
539735ddaea9 theory file for Numbers section
paulson
parents:
diff changeset
    65
539735ddaea9 theory file for Numbers section
paulson
parents:
diff changeset
    66
text{*
539735ddaea9 theory file for Numbers section
paulson
parents:
diff changeset
    67
539735ddaea9 theory file for Numbers section
paulson
parents:
diff changeset
    68
@{thm[display] mult_le_mono[no_vars]}
539735ddaea9 theory file for Numbers section
paulson
parents:
diff changeset
    69
\rulename{mult_le_mono}
539735ddaea9 theory file for Numbers section
paulson
parents:
diff changeset
    70
539735ddaea9 theory file for Numbers section
paulson
parents:
diff changeset
    71
@{thm[display] mult_less_mono1[no_vars]}
539735ddaea9 theory file for Numbers section
paulson
parents:
diff changeset
    72
\rulename{mult_less_mono1}
539735ddaea9 theory file for Numbers section
paulson
parents:
diff changeset
    73
539735ddaea9 theory file for Numbers section
paulson
parents:
diff changeset
    74
@{thm[display] div_le_mono[no_vars]}
539735ddaea9 theory file for Numbers section
paulson
parents:
diff changeset
    75
\rulename{div_le_mono}
539735ddaea9 theory file for Numbers section
paulson
parents:
diff changeset
    76
539735ddaea9 theory file for Numbers section
paulson
parents:
diff changeset
    77
@{thm[display] add_mult_distrib[no_vars]}
539735ddaea9 theory file for Numbers section
paulson
parents:
diff changeset
    78
\rulename{add_mult_distrib}
539735ddaea9 theory file for Numbers section
paulson
parents:
diff changeset
    79
539735ddaea9 theory file for Numbers section
paulson
parents:
diff changeset
    80
@{thm[display] diff_mult_distrib[no_vars]}
539735ddaea9 theory file for Numbers section
paulson
parents:
diff changeset
    81
\rulename{diff_mult_distrib}
539735ddaea9 theory file for Numbers section
paulson
parents:
diff changeset
    82
539735ddaea9 theory file for Numbers section
paulson
parents:
diff changeset
    83
@{thm[display] mod_mult_distrib[no_vars]}
539735ddaea9 theory file for Numbers section
paulson
parents:
diff changeset
    84
\rulename{mod_mult_distrib}
539735ddaea9 theory file for Numbers section
paulson
parents:
diff changeset
    85
539735ddaea9 theory file for Numbers section
paulson
parents:
diff changeset
    86
@{thm[display] nat_diff_split[no_vars]}
539735ddaea9 theory file for Numbers section
paulson
parents:
diff changeset
    87
\rulename{nat_diff_split}
539735ddaea9 theory file for Numbers section
paulson
parents:
diff changeset
    88
*}
539735ddaea9 theory file for Numbers section
paulson
parents:
diff changeset
    89
539735ddaea9 theory file for Numbers section
paulson
parents:
diff changeset
    90
539735ddaea9 theory file for Numbers section
paulson
parents:
diff changeset
    91
lemma "(n-1)*(n+1) = n*n - 1"
539735ddaea9 theory file for Numbers section
paulson
parents:
diff changeset
    92
apply (simp split: nat_diff_split)
539735ddaea9 theory file for Numbers section
paulson
parents:
diff changeset
    93
done
539735ddaea9 theory file for Numbers section
paulson
parents:
diff changeset
    94
539735ddaea9 theory file for Numbers section
paulson
parents:
diff changeset
    95
text{*
539735ddaea9 theory file for Numbers section
paulson
parents:
diff changeset
    96
@{thm[display] mod_if[no_vars]}
539735ddaea9 theory file for Numbers section
paulson
parents:
diff changeset
    97
\rulename{mod_if}
539735ddaea9 theory file for Numbers section
paulson
parents:
diff changeset
    98
539735ddaea9 theory file for Numbers section
paulson
parents:
diff changeset
    99
@{thm[display] mod_div_equality[no_vars]}
539735ddaea9 theory file for Numbers section
paulson
parents:
diff changeset
   100
\rulename{mod_div_equality}
539735ddaea9 theory file for Numbers section
paulson
parents:
diff changeset
   101
539735ddaea9 theory file for Numbers section
paulson
parents:
diff changeset
   102
539735ddaea9 theory file for Numbers section
paulson
parents:
diff changeset
   103
@{thm[display] div_mult1_eq[no_vars]}
539735ddaea9 theory file for Numbers section
paulson
parents:
diff changeset
   104
\rulename{div_mult1_eq}
539735ddaea9 theory file for Numbers section
paulson
parents:
diff changeset
   105
539735ddaea9 theory file for Numbers section
paulson
parents:
diff changeset
   106
@{thm[display] mod_mult1_eq[no_vars]}
539735ddaea9 theory file for Numbers section
paulson
parents:
diff changeset
   107
\rulename{mod_mult1_eq}
539735ddaea9 theory file for Numbers section
paulson
parents:
diff changeset
   108
539735ddaea9 theory file for Numbers section
paulson
parents:
diff changeset
   109
@{thm[display] div_mult2_eq[no_vars]}
539735ddaea9 theory file for Numbers section
paulson
parents:
diff changeset
   110
\rulename{div_mult2_eq}
539735ddaea9 theory file for Numbers section
paulson
parents:
diff changeset
   111
539735ddaea9 theory file for Numbers section
paulson
parents:
diff changeset
   112
@{thm[display] mod_mult2_eq[no_vars]}
539735ddaea9 theory file for Numbers section
paulson
parents:
diff changeset
   113
\rulename{mod_mult2_eq}
539735ddaea9 theory file for Numbers section
paulson
parents:
diff changeset
   114
539735ddaea9 theory file for Numbers section
paulson
parents:
diff changeset
   115
@{thm[display] div_mult_mult1[no_vars]}
539735ddaea9 theory file for Numbers section
paulson
parents:
diff changeset
   116
\rulename{div_mult_mult1}
539735ddaea9 theory file for Numbers section
paulson
parents:
diff changeset
   117
539735ddaea9 theory file for Numbers section
paulson
parents:
diff changeset
   118
@{thm[display] DIVISION_BY_ZERO_DIV[no_vars]}
539735ddaea9 theory file for Numbers section
paulson
parents:
diff changeset
   119
\rulename{DIVISION_BY_ZERO_DIV}
539735ddaea9 theory file for Numbers section
paulson
parents:
diff changeset
   120
539735ddaea9 theory file for Numbers section
paulson
parents:
diff changeset
   121
@{thm[display] DIVISION_BY_ZERO_MOD[no_vars]}
539735ddaea9 theory file for Numbers section
paulson
parents:
diff changeset
   122
\rulename{DIVISION_BY_ZERO_MOD}
539735ddaea9 theory file for Numbers section
paulson
parents:
diff changeset
   123
539735ddaea9 theory file for Numbers section
paulson
parents:
diff changeset
   124
@{thm[display] dvd_anti_sym[no_vars]}
539735ddaea9 theory file for Numbers section
paulson
parents:
diff changeset
   125
\rulename{dvd_anti_sym}
539735ddaea9 theory file for Numbers section
paulson
parents:
diff changeset
   126
539735ddaea9 theory file for Numbers section
paulson
parents:
diff changeset
   127
@{thm[display] dvd_add[no_vars]}
539735ddaea9 theory file for Numbers section
paulson
parents:
diff changeset
   128
\rulename{dvd_add}
539735ddaea9 theory file for Numbers section
paulson
parents:
diff changeset
   129
539735ddaea9 theory file for Numbers section
paulson
parents:
diff changeset
   130
For the integers, I'd list a few theorems that somehow involve negative 
539735ddaea9 theory file for Numbers section
paulson
parents:
diff changeset
   131
numbers.  
539735ddaea9 theory file for Numbers section
paulson
parents:
diff changeset
   132
539735ddaea9 theory file for Numbers section
paulson
parents:
diff changeset
   133
Division, remainder of negatives
539735ddaea9 theory file for Numbers section
paulson
parents:
diff changeset
   134
539735ddaea9 theory file for Numbers section
paulson
parents:
diff changeset
   135
539735ddaea9 theory file for Numbers section
paulson
parents:
diff changeset
   136
@{thm[display] pos_mod_sign[no_vars]}
539735ddaea9 theory file for Numbers section
paulson
parents:
diff changeset
   137
\rulename{pos_mod_sign}
539735ddaea9 theory file for Numbers section
paulson
parents:
diff changeset
   138
539735ddaea9 theory file for Numbers section
paulson
parents:
diff changeset
   139
@{thm[display] pos_mod_bound[no_vars]}
539735ddaea9 theory file for Numbers section
paulson
parents:
diff changeset
   140
\rulename{pos_mod_bound}
539735ddaea9 theory file for Numbers section
paulson
parents:
diff changeset
   141
539735ddaea9 theory file for Numbers section
paulson
parents:
diff changeset
   142
@{thm[display] neg_mod_sign[no_vars]}
539735ddaea9 theory file for Numbers section
paulson
parents:
diff changeset
   143
\rulename{neg_mod_sign}
539735ddaea9 theory file for Numbers section
paulson
parents:
diff changeset
   144
539735ddaea9 theory file for Numbers section
paulson
parents:
diff changeset
   145
@{thm[display] neg_mod_bound[no_vars]}
539735ddaea9 theory file for Numbers section
paulson
parents:
diff changeset
   146
\rulename{neg_mod_bound}
539735ddaea9 theory file for Numbers section
paulson
parents:
diff changeset
   147
539735ddaea9 theory file for Numbers section
paulson
parents:
diff changeset
   148
@{thm[display] zdiv_zadd1_eq[no_vars]}
539735ddaea9 theory file for Numbers section
paulson
parents:
diff changeset
   149
\rulename{zdiv_zadd1_eq}
539735ddaea9 theory file for Numbers section
paulson
parents:
diff changeset
   150
539735ddaea9 theory file for Numbers section
paulson
parents:
diff changeset
   151
@{thm[display] zmod_zadd1_eq[no_vars]}
539735ddaea9 theory file for Numbers section
paulson
parents:
diff changeset
   152
\rulename{zmod_zadd1_eq}
539735ddaea9 theory file for Numbers section
paulson
parents:
diff changeset
   153
539735ddaea9 theory file for Numbers section
paulson
parents:
diff changeset
   154
@{thm[display] zdiv_zmult1_eq[no_vars]}
539735ddaea9 theory file for Numbers section
paulson
parents:
diff changeset
   155
\rulename{zdiv_zmult1_eq}
539735ddaea9 theory file for Numbers section
paulson
parents:
diff changeset
   156
539735ddaea9 theory file for Numbers section
paulson
parents:
diff changeset
   157
@{thm[display] zmod_zmult1_eq[no_vars]}
539735ddaea9 theory file for Numbers section
paulson
parents:
diff changeset
   158
\rulename{zmod_zmult1_eq}
539735ddaea9 theory file for Numbers section
paulson
parents:
diff changeset
   159
539735ddaea9 theory file for Numbers section
paulson
parents:
diff changeset
   160
@{thm[display] zdiv_zmult2_eq[no_vars]}
539735ddaea9 theory file for Numbers section
paulson
parents:
diff changeset
   161
\rulename{zdiv_zmult2_eq}
539735ddaea9 theory file for Numbers section
paulson
parents:
diff changeset
   162
539735ddaea9 theory file for Numbers section
paulson
parents:
diff changeset
   163
@{thm[display] zmod_zmult2_eq[no_vars]}
539735ddaea9 theory file for Numbers section
paulson
parents:
diff changeset
   164
\rulename{zmod_zmult2_eq}
539735ddaea9 theory file for Numbers section
paulson
parents:
diff changeset
   165
539735ddaea9 theory file for Numbers section
paulson
parents:
diff changeset
   166
@{thm[display] abs_mult[no_vars]}
539735ddaea9 theory file for Numbers section
paulson
parents:
diff changeset
   167
\rulename{abs_mult}
539735ddaea9 theory file for Numbers section
paulson
parents:
diff changeset
   168
*}  
539735ddaea9 theory file for Numbers section
paulson
parents:
diff changeset
   169
539735ddaea9 theory file for Numbers section
paulson
parents:
diff changeset
   170
(*NO REALS YET;  Needs HOL-Real as parent
539735ddaea9 theory file for Numbers section
paulson
parents:
diff changeset
   171
For the reals, perhaps just a few results to indicate what is there.
539735ddaea9 theory file for Numbers section
paulson
parents:
diff changeset
   172
539735ddaea9 theory file for Numbers section
paulson
parents:
diff changeset
   173
@{thm[display] realpow_abs[no_vars]}
539735ddaea9 theory file for Numbers section
paulson
parents:
diff changeset
   174
\rulename{realpow_abs}
539735ddaea9 theory file for Numbers section
paulson
parents:
diff changeset
   175
539735ddaea9 theory file for Numbers section
paulson
parents:
diff changeset
   176
More once rinv (the most important constant) is sorted.
539735ddaea9 theory file for Numbers section
paulson
parents:
diff changeset
   177
*)  
539735ddaea9 theory file for Numbers section
paulson
parents:
diff changeset
   178
539735ddaea9 theory file for Numbers section
paulson
parents:
diff changeset
   179
end