src/HOL/Number_Theory/Primes.thy
changeset 55337 5d45fb978d5a
parent 55242 413ec965f95d
child 57512 cc97b347b301
equal deleted inserted replaced
55334:5f5104069b33 55337:5d45fb978d5a
    29 
    29 
    30 theory Primes
    30 theory Primes
    31 imports "~~/src/HOL/GCD"
    31 imports "~~/src/HOL/GCD"
    32 begin
    32 begin
    33 
    33 
    34 declare One_nat_def [simp]
       
    35 declare [[coercion int]]
    34 declare [[coercion int]]
    36 declare [[coercion_enabled]]
    35 declare [[coercion_enabled]]
    37 
    36 
    38 definition prime :: "nat \<Rightarrow> bool"
    37 definition prime :: "nat \<Rightarrow> bool"
    39   where "prime p = (1 < p \<and> (\<forall>m. m dvd p --> m = 1 \<or> m = p))"
    38   where "prime p = (1 < p \<and> (\<forall>m. m dvd p --> m = 1 \<or> m = p))"
   406   let ?x = "v * a * x1 + u * b * x2"
   405   let ?x = "v * a * x1 + u * b * x2"
   407   let ?q1 = "v * x1 + u * y2"
   406   let ?q1 = "v * x1 + u * y2"
   408   let ?q2 = "v * y1 + u * x2"
   407   let ?q2 = "v * y1 + u * x2"
   409   from dxy2(3)[simplified d12] dxy1(3)[simplified d12] 
   408   from dxy2(3)[simplified d12] dxy1(3)[simplified d12] 
   410   have "?x = u + ?q1 * a" "?x = v + ?q2 * b"
   409   have "?x = u + ?q1 * a" "?x = v + ?q2 * b"
   411     apply (auto simp add: algebra_simps) 
   410     by algebra+
   412     apply (metis mult_Suc_right nat_mult_assoc nat_mult_commute)+
       
   413     done
       
   414   thus ?thesis by blast
   411   thus ?thesis by blast
   415 qed
   412 qed
   416 
   413 
   417 text {* Primality *}
   414 text {* Primality *}
   418 
   415