src/HOL/Number_Theory/Cong.thy
changeset 62349 7c23469b5118
parent 62348 9a5f43dac883
child 62353 7f927120b5a2
equal deleted inserted replaced
62348:9a5f43dac883 62349:7c23469b5118
   525   apply (cases "n \<ge> 0")
   525   apply (cases "n \<ge> 0")
   526   apply auto
   526   apply auto
   527   apply (metis cong_solve_int)
   527   apply (metis cong_solve_int)
   528   done
   528   done
   529 
   529 
   530 lemma coprime_iff_invertible_nat: "m > 0 \<Longrightarrow> coprime a m = (EX x. [a * x = Suc 0] (mod m))"
   530 lemma coprime_iff_invertible_nat:
   531   apply (auto intro: cong_solve_coprime_nat)
   531   "m > 0 \<Longrightarrow> coprime a m = (EX x. [a * x = Suc 0] (mod m))"
   532   apply (metis cong_Suc_0_nat cong_solve_nat gcd_nat.left_neutral)
   532   by (metis One_nat_def cong_gcd_eq_nat cong_solve_coprime_nat coprime_lmult_nat gcd.commute gcd_Suc_0)
   533   apply (metis One_nat_def cong_gcd_eq_nat coprime_lmult_nat 
   533   
   534       gcd_lcm_complete_lattice_nat.inf_bot_right gcd.commute)
       
   535   done
       
   536 
       
   537 lemma coprime_iff_invertible_int: "m > (0::int) \<Longrightarrow> coprime a m = (EX x. [a * x = 1] (mod m))"
   534 lemma coprime_iff_invertible_int: "m > (0::int) \<Longrightarrow> coprime a m = (EX x. [a * x = 1] (mod m))"
   538   apply (auto intro: cong_solve_coprime_int)
   535   apply (auto intro: cong_solve_coprime_int)
   539   apply (metis cong_int_def coprime_mul_eq_int gcd_1_int gcd.commute gcd_red_int)
   536   apply (metis cong_int_def coprime_mul_eq_int gcd_1_int gcd.commute gcd_red_int)
   540   done
   537   done
   541 
   538 
   556 
   553 
   557 lemma cong_cong_lcm_nat: "[(x::nat) = y] (mod a) \<Longrightarrow>
   554 lemma cong_cong_lcm_nat: "[(x::nat) = y] (mod a) \<Longrightarrow>
   558     [x = y] (mod b) \<Longrightarrow> [x = y] (mod lcm a b)"
   555     [x = y] (mod b) \<Longrightarrow> [x = y] (mod lcm a b)"
   559   apply (cases "y \<le> x")
   556   apply (cases "y \<le> x")
   560   apply (metis cong_altdef_nat lcm_least)
   557   apply (metis cong_altdef_nat lcm_least)
   561   apply (metis cong_altdef_nat cong_diff_cong_0'_nat lcm_semilattice_nat.sup.bounded_iff le0 minus_nat.diff_0)
   558   apply (meson cong_altdef_nat cong_sym_nat lcm_least_iff nat_le_linear)
   562   done
   559   done
   563 
   560 
   564 lemma cong_cong_lcm_int: "[(x::int) = y] (mod a) \<Longrightarrow>
   561 lemma cong_cong_lcm_int: "[(x::int) = y] (mod a) \<Longrightarrow>
   565     [x = y] (mod b) \<Longrightarrow> [x = y] (mod lcm a b)"
   562     [x = y] (mod b) \<Longrightarrow> [x = y] (mod lcm a b)"
   566   by (auto simp add: cong_altdef_int lcm_least) [1]
   563   by (auto simp add: cong_altdef_int lcm_least) [1]