src/Doc/Corec/Corec.thy
changeset 67051 e7e54a0b9197
parent 66453 cc19f7ca2ed6
child 67399 eab6ce8368fa
equal deleted inserted replaced
67050:1e29e2666a15 67051:e7e54a0b9197
   332           SCons n (primes (m * n) (n + 1))
   332           SCons n (primes (m * n) (n + 1))
   333         else
   333         else
   334           primes m (n + 1))"
   334           primes m (n + 1))"
   335       apply (relation "measure (\<lambda>(m, n).
   335       apply (relation "measure (\<lambda>(m, n).
   336         if n = 0 then 1 else if coprime m n then 0 else m - n mod m)")
   336         if n = 0 then 1 else if coprime m n then 0 else m - n mod m)")
   337        apply (auto simp: mod_Suc intro: Suc_lessI)
   337        apply (auto simp: mod_Suc diff_less_mono2 intro: Suc_lessI elim!: not_coprimeE)
   338        apply (metis One_nat_def coprime_Suc_nat gcd.commute gcd_red_nat)
   338       apply (metis dvd_1_iff_1 dvd_eq_mod_eq_0 mod_0 mod_Suc mod_Suc_eq mod_mod_cancel)
   339       by (metis diff_less_mono2 lessI mod_less_divisor)
   339       done
   340 
   340 
   341 text \<open>
   341 text \<open>
   342 \noindent
   342 \noindent
   343 The @{command corecursive} command is a variant of @{command corec} that allows
   343 The @{command corecursive} command is a variant of @{command corec} that allows
   344 us to specify a termination argument for any unguarded self-call.
   344 us to specify a termination argument for any unguarded self-call.