src/HOL/Library/Primes.thy
changeset 11374 2badb9b2a8ec
parent 11369 2c4bb701546a
child 11464 ddea204de5bc
equal deleted inserted replaced
11373:ef11fb6e6c58 11374:2badb9b2a8ec
    70   done
    70   done
    71 
    71 
    72 lemmas gcd_dvd1 [iff] = gcd_dvd_both [THEN conjunct1, standard]
    72 lemmas gcd_dvd1 [iff] = gcd_dvd_both [THEN conjunct1, standard]
    73 lemmas gcd_dvd2 [iff] = gcd_dvd_both [THEN conjunct2, standard]
    73 lemmas gcd_dvd2 [iff] = gcd_dvd_both [THEN conjunct2, standard]
    74 
    74 
    75 lemma gcd_zero: "(gcd (m, n) = 0) = (m = 0 \<and> n = 0)"
       
    76 proof
       
    77   have "gcd (m, n) dvd m \<and> gcd (m, n) dvd n" by simp
       
    78   also assume "gcd (m, n) = 0"
       
    79   finally have "0 dvd m \<and> 0 dvd n" .
       
    80   thus "m = 0 \<and> n = 0" by (simp add: dvd_0_left)
       
    81 next
       
    82   assume "m = 0 \<and> n = 0"
       
    83   thus "gcd (m, n) = 0" by simp
       
    84 qed
       
    85 
       
    86 
    75 
    87 text {*
    76 text {*
    88   \medskip Maximality: for all @{term m}, @{term n}, @{term k}
    77   \medskip Maximality: for all @{term m}, @{term n}, @{term k}
    89   naturals, if @{term k} divides @{term m} and @{term k} divides
    78   naturals, if @{term k} divides @{term m} and @{term k} divides
    90   @{term n} then @{term k} divides @{term "gcd (m, n)"}.
    79   @{term n} then @{term k} divides @{term "gcd (m, n)"}.
    96   done
    85   done
    97 
    86 
    98 lemma gcd_greatest_iff [iff]: "(k dvd gcd (m, n)) = (k dvd m \<and> k dvd n)"
    87 lemma gcd_greatest_iff [iff]: "(k dvd gcd (m, n)) = (k dvd m \<and> k dvd n)"
    99   apply (blast intro!: gcd_greatest intro: dvd_trans)
    88   apply (blast intro!: gcd_greatest intro: dvd_trans)
   100   done
    89   done
       
    90 
       
    91 lemma gcd_zero: "(gcd (m, n) = 0) = (m = 0 \<and> n = 0)"
       
    92   by (simp only: dvd_0_left_iff [THEN sym] gcd_greatest_iff)
   101 
    93 
   102 
    94 
   103 text {*
    95 text {*
   104   \medskip Function gcd yields the Greatest Common Divisor.
    96   \medskip Function gcd yields the Greatest Common Divisor.
   105 *}
    97 *}