Cookies disclaimer

I agree Our site saves small pieces of text information (cookies) on your device in order to deliver better content and for statistical purposes. You can disable the usage of cookies by changing the settings of your browser. By browsing our website without changing the browser settings you grant us permission to store that information on your device.

[2018-Oct] One more Prime

Isabelle recently learned what prime numbers are, and was thinking about the prime-counting function π(n).

To start, she wanted to examine the difference between π(n+1) and π(n) and show that it either grows by one or stays the same.


Download Files

Definitions File

theory Defs
  imports Main 

definition prime :: "nat \<Rightarrow> bool" where
  "prime n = (1 < n \<and> (\<forall>m. m dvd n \<longrightarrow> m = 1 \<or> m = n))"

definition "\<pi> n = card { i. prime i \<and> i \<le> n }"


Template File

theory Submission
  imports Defs

lemma pi: "\<pi> (Suc n) - \<pi> n = (if prime (Suc n) then 1 else 0)"


Check File

theory Check
imports Submission

lemma "\<pi> (Suc n) - \<pi> n = (if prime (Suc n) then 1 else 0)"
by (rule Submission.pi)

Terms and Conditions