src/HOL/Arith.ML
changeset 1301 42782316d510
parent 1264 3eb91524b938
child 1327 6c29cfab679c
equal deleted inserted replaced
1300:c7a8f374339b 1301:42782316d510
    12 (*** Basic rewrite rules for the arithmetic operators ***)
    12 (*** Basic rewrite rules for the arithmetic operators ***)
    13 
    13 
    14 val [pred_0, pred_Suc] = nat_recs pred_def;
    14 val [pred_0, pred_Suc] = nat_recs pred_def;
    15 val [add_0,add_Suc] = nat_recs add_def; 
    15 val [add_0,add_Suc] = nat_recs add_def; 
    16 val [mult_0,mult_Suc] = nat_recs mult_def; 
    16 val [mult_0,mult_Suc] = nat_recs mult_def; 
       
    17 Addsimps [pred_0,pred_Suc,add_0,add_Suc,mult_0,mult_Suc];
       
    18 
       
    19 (** pred **)
       
    20 
       
    21 val prems = goal Arith.thy "n ~= 0 ==> Suc(pred n) = n";
       
    22 by(res_inst_tac [("n","n")] natE 1);
       
    23 by(cut_facts_tac prems 1);
       
    24 by(ALLGOALS Asm_full_simp_tac);
       
    25 qed "Suc_pred";
       
    26 Addsimps [Suc_pred];
    17 
    27 
    18 (** Difference **)
    28 (** Difference **)
    19 
    29 
    20 val diff_0 = diff_def RS def_nat_rec_0;
    30 val diff_0 = diff_def RS def_nat_rec_0;
    21 
    31 
    28 qed_goalw "diff_Suc_Suc" Arith.thy [diff_def, pred_def]
    38 qed_goalw "diff_Suc_Suc" Arith.thy [diff_def, pred_def]
    29     "Suc(m) - Suc(n) = m - n"
    39     "Suc(m) - Suc(n) = m - n"
    30  (fn _ =>
    40  (fn _ =>
    31   [Simp_tac 1, nat_ind_tac "n" 1, ALLGOALS Asm_simp_tac]);
    41   [Simp_tac 1, nat_ind_tac "n" 1, ALLGOALS Asm_simp_tac]);
    32 
    42 
    33 (*** Simplification over add, mult, diff ***)
    43 Addsimps [diff_0, diff_0_eq_0, diff_Suc_Suc];
    34 
       
    35 Addsimps [pred_0, pred_Suc, add_0, add_Suc, mult_0, mult_Suc, diff_0,
       
    36           diff_0_eq_0, diff_Suc_Suc];
       
    37 
    44 
    38 
    45 
    39 (**** Inductive properties of the operators ****)
    46 (**** Inductive properties of the operators ****)
    40 
    47 
    41 (*** Addition ***)
    48 (*** Addition ***)