src/HOL/OrderedGroup.thy
changeset 27250 7eef2b183032
parent 26480 544cef16045b
child 27474 a89d755b029d
equal deleted inserted replaced
27249:f339dc43ce9f 27250:7eef2b183032
  1370 lemmas diff_less_0_iff_less [simp] = less_iff_diff_less_0 [symmetric]
  1370 lemmas diff_less_0_iff_less [simp] = less_iff_diff_less_0 [symmetric]
  1371 lemmas diff_eq_0_iff_eq [simp, noatp] = eq_iff_diff_eq_0 [symmetric]
  1371 lemmas diff_eq_0_iff_eq [simp, noatp] = eq_iff_diff_eq_0 [symmetric]
  1372 lemmas diff_le_0_iff_le [simp] = le_iff_diff_le_0 [symmetric]
  1372 lemmas diff_le_0_iff_le [simp] = le_iff_diff_le_0 [symmetric]
  1373 
  1373 
  1374 ML {*
  1374 ML {*
  1375 structure ab_group_add_cancel = Abel_Cancel(
  1375 structure ab_group_add_cancel = Abel_Cancel
  1376 struct
  1376 (
  1377 
  1377 
  1378 (* term order for abelian groups *)
  1378 (* term order for abelian groups *)
  1379 
  1379 
  1380 fun agrp_ord (Const (a, _)) = find_index (fn a' => a = a')
  1380 fun agrp_ord (Const (a, _)) = find_index (fn a' => a = a')
  1381       [@{const_name HOL.zero}, @{const_name HOL.plus},
  1381       [@{const_name HOL.zero}, @{const_name HOL.plus},
  1398 in
  1398 in
  1399   val add_ac_proc = Simplifier.simproc @{theory}
  1399   val add_ac_proc = Simplifier.simproc @{theory}
  1400     "add_ac_proc" ["x + y::'a::ab_semigroup_add"] solve_add_ac;
  1400     "add_ac_proc" ["x + y::'a::ab_semigroup_add"] solve_add_ac;
  1401 end;
  1401 end;
  1402 
  1402 
       
  1403 val eq_reflection = @{thm eq_reflection};
       
  1404   
       
  1405 val T = @{typ "'a::ab_group_add"};
       
  1406 
  1403 val cancel_ss = HOL_basic_ss settermless termless_agrp
  1407 val cancel_ss = HOL_basic_ss settermless termless_agrp
  1404   addsimprocs [add_ac_proc] addsimps
  1408   addsimprocs [add_ac_proc] addsimps
  1405   [@{thm add_0_left}, @{thm add_0_right}, @{thm diff_def},
  1409   [@{thm add_0_left}, @{thm add_0_right}, @{thm diff_def},
  1406    @{thm minus_add_distrib}, @{thm minus_minus}, @{thm minus_zero},
  1410    @{thm minus_add_distrib}, @{thm minus_minus}, @{thm minus_zero},
  1407    @{thm right_minus}, @{thm left_minus}, @{thm add_minus_cancel},
  1411    @{thm right_minus}, @{thm left_minus}, @{thm add_minus_cancel},
  1408    @{thm minus_add_cancel}];
  1412    @{thm minus_add_cancel}];
       
  1413 
       
  1414 val sum_pats = [@{cterm "x + y::'a::ab_group_add"}, @{cterm "x - y::'a::ab_group_add"}];
  1409   
  1415   
  1410 val eq_reflection = @{thm eq_reflection};
       
  1411   
       
  1412 val thy_ref = Theory.check_thy @{theory};
       
  1413 
       
  1414 val T = @{typ "'a\<Colon>ab_group_add"};
       
  1415 
       
  1416 val eqI_rules = [@{thm less_eqI}, @{thm le_eqI}, @{thm eq_eqI}];
  1416 val eqI_rules = [@{thm less_eqI}, @{thm le_eqI}, @{thm eq_eqI}];
  1417 
  1417 
  1418 val dest_eqI = 
  1418 val dest_eqI = 
  1419   fst o HOLogic.dest_bin "op =" HOLogic.boolT o HOLogic.dest_Trueprop o concl_of;
  1419   fst o HOLogic.dest_bin "op =" HOLogic.boolT o HOLogic.dest_Trueprop o concl_of;
  1420 
  1420 
  1421 end);
  1421 );
  1422 *}
  1422 *}
  1423 
  1423 
  1424 ML {*
  1424 ML {*
  1425   Addsimprocs [ab_group_add_cancel.sum_conv, ab_group_add_cancel.rel_conv];
  1425   Addsimprocs [ab_group_add_cancel.sum_conv, ab_group_add_cancel.rel_conv];
  1426 *}
  1426 *}