src/HOL/Tools/numeral_simprocs.ML
changeset 64240 eabf80376aab
parent 63950 cdc1e59aa513
child 67560 0fa87bd86566
equal deleted inserted replaced
64239:de5cd9217d4c 64240:eabf80376aab
   171 (*Maps 1 to Numeral1 so that arithmetic isn't complicated by the abstract 1.*)
   171 (*Maps 1 to Numeral1 so that arithmetic isn't complicated by the abstract 1.*)
   172 val numeral_syms = [@{thm numeral_One} RS sym];
   172 val numeral_syms = [@{thm numeral_One} RS sym];
   173 
   173 
   174 (*Simplify 0+n, n+0, Numeral1*n, n*Numeral1, 1*x, x*1, x/1 *)
   174 (*Simplify 0+n, n+0, Numeral1*n, n*Numeral1, 1*x, x*1, x/1 *)
   175 val add_0s =  @{thms add_0_left add_0_right};
   175 val add_0s =  @{thms add_0_left add_0_right};
   176 val mult_1s = @{thms mult_1s divide_numeral_1 mult_1_left mult_1_right mult_minus1 mult_minus1_right divide_1};
   176 val mult_1s = @{thms mult_1s divide_numeral_1 mult_1_left mult_1_right mult_minus1 mult_minus1_right div_by_1};
   177 
   177 
   178 (* For post-simplification of the rhs of simproc-generated rules *)
   178 (* For post-simplification of the rhs of simproc-generated rules *)
   179 val post_simps =
   179 val post_simps =
   180     [@{thm numeral_One},
   180     [@{thm numeral_One},
   181      @{thm add_0_left}, @{thm add_0_right},
   181      @{thm add_0_left}, @{thm add_0_right},
   182      @{thm mult_zero_left}, @{thm mult_zero_right},
   182      @{thm mult_zero_left}, @{thm mult_zero_right},
   183      @{thm mult_1_left}, @{thm mult_1_right},
   183      @{thm mult_1_left}, @{thm mult_1_right},
   184      @{thm mult_minus1}, @{thm mult_minus1_right}]
   184      @{thm mult_minus1}, @{thm mult_minus1_right}]
   185 
   185 
   186 val field_post_simps =
   186 val field_post_simps =
   187     post_simps @ [@{thm divide_zero_left}, @{thm divide_1}]
   187     post_simps @ [@{thm div_0}, @{thm div_by_1}]
   188 
   188 
   189 (*Simplify inverse Numeral1*)
   189 (*Simplify inverse Numeral1*)
   190 val inverse_1s = [@{thm inverse_numeral_1}];
   190 val inverse_1s = [@{thm inverse_numeral_1}];
   191 
   191 
   192 (*To perform binary arithmetic.  The "left" rewriting handles patterns
   192 (*To perform binary arithmetic.  The "left" rewriting handles patterns
   710     proc = K proc3}
   710     proc = K proc3}
   711 
   711 
   712 val ths =
   712 val ths =
   713  [@{thm "mult_numeral_1"}, @{thm "mult_numeral_1_right"},
   713  [@{thm "mult_numeral_1"}, @{thm "mult_numeral_1_right"},
   714   @{thm "divide_numeral_1"},
   714   @{thm "divide_numeral_1"},
   715   @{thm "divide_zero"}, @{thm divide_zero_left},
   715   @{thm "div_by_0"}, @{thm div_0},
   716   @{thm "divide_divide_eq_left"},
   716   @{thm "divide_divide_eq_left"},
   717   @{thm "times_divide_eq_left"}, @{thm "times_divide_eq_right"},
   717   @{thm "times_divide_eq_left"}, @{thm "times_divide_eq_right"},
   718   @{thm "times_divide_times_eq"},
   718   @{thm "times_divide_times_eq"},
   719   @{thm "divide_divide_eq_right"},
   719   @{thm "divide_divide_eq_right"},
   720   @{thm diff_conv_add_uminus}, @{thm "minus_divide_left"},
   720   @{thm diff_conv_add_uminus}, @{thm "minus_divide_left"},