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.

## Resources

### Definitions File

```theory Defs
imports Main
begin

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 }"

end
```

### Template File

```theory Submission
imports Defs
begin

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

end
```

### Check File

```theory Check
imports Submission
begin

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

end
```

### Definitions File

```theory Defs
imports Main
begin

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 }"

end
```

### Template File

```theory Submission
imports Defs
begin

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

end
```

### Check File

```theory Check
imports Submission
begin

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

end
```

Terms and Conditions