url
stringclasses
147 values
commit
stringclasses
147 values
file_path
stringlengths
7
101
full_name
stringlengths
1
94
start
stringlengths
6
10
end
stringlengths
6
11
tactic
stringlengths
1
11.2k
state_before
stringlengths
3
2.09M
state_after
stringlengths
6
2.09M
https://github.com/pandaman64/QuickSortInLean.git
ab0aaee0aed280959328844f9a6cd13bf00c5935
QuickSortInLean/Sorted.lean
quickSort_sorted
[371, 1]
[379, 42]
let sr := quickSort'_sortedRange (arr : Vec α arr.size)
α : Type inst✝ : Order α arr : Array α ⊢ sorted (quickSort arr)
α : Type inst✝ : Order α arr : Array α sr : sortedRange (quickSort' ⟨arr, ⋯⟩) 0 (arr.size - 1) := quickSort'_sortedRange ⟨arr, instCoeDepArrayVecSize.proof_1⟩ ⊢ sorted (quickSort arr)
https://github.com/pandaman64/QuickSortInLean.git
ab0aaee0aed280959328844f9a6cd13bf00c5935
QuickSortInLean/Sorted.lean
quickSort_sorted
[371, 1]
[379, 42]
intro i j ij
α : Type inst✝ : Order α arr : Array α sr : sortedRange (quickSort' ⟨arr, ⋯⟩) 0 (arr.size - 1) := quickSort'_sortedRange ⟨arr, instCoeDepArrayVecSize.proof_1⟩ ⊢ sorted (quickSort arr)
α : Type inst✝ : Order α arr : Array α sr : sortedRange (quickSort' ⟨arr, ⋯⟩) 0 (arr.size - 1) := quickSort'_sortedRange ⟨arr, instCoeDepArrayVecSize.proof_1⟩ i j : Fin (quickSort arr).size ij : i ≤ j ⊢ (compare (quickSort arr)[i] (quickSort arr)[j]).isLE = true
https://github.com/pandaman64/QuickSortInLean.git
ab0aaee0aed280959328844f9a6cd13bf00c5935
QuickSortInLean/Sorted.lean
quickSort_sorted
[371, 1]
[379, 42]
have hi : 0 ≤ i.val := Nat.zero_le i.val
α : Type inst✝ : Order α arr : Array α sr : sortedRange (quickSort' ⟨arr, ⋯⟩) 0 (arr.size - 1) := quickSort'_sortedRange ⟨arr, instCoeDepArrayVecSize.proof_1⟩ i j : Fin (quickSort arr).size ij : i ≤ j ⊢ (compare (quickSort arr)[i] (quickSort arr)[j]).isLE = true
α : Type inst✝ : Order α arr : Array α sr : sortedRange (quickSort' ⟨arr, ⋯⟩) 0 (arr.size - 1) := quickSort'_sortedRange ⟨arr, instCoeDepArrayVecSize.proof_1⟩ i j : Fin (quickSort arr).size ij : i ≤ j hi : 0 ≤ ↑i ⊢ (compare (quickSort arr)[i] (quickSort arr)[j]).isLE = true
https://github.com/pandaman64/QuickSortInLean.git
ab0aaee0aed280959328844f9a6cd13bf00c5935
QuickSortInLean/Sorted.lean
quickSort_sorted
[371, 1]
[379, 42]
have s : (quickSort arr).size = arr.size := quickSort_size arr
α : Type inst✝ : Order α arr : Array α sr : sortedRange (quickSort' ⟨arr, ⋯⟩) 0 (arr.size - 1) := quickSort'_sortedRange ⟨arr, instCoeDepArrayVecSize.proof_1⟩ i j : Fin (quickSort arr).size ij : i ≤ j hi : 0 ≤ ↑i ⊢ (compare (quickSort arr)[i] (quickSort arr)[j]).isLE = true
α : Type inst✝ : Order α arr : Array α sr : sortedRange (quickSort' ⟨arr, ⋯⟩) 0 (arr.size - 1) := quickSort'_sortedRange ⟨arr, instCoeDepArrayVecSize.proof_1⟩ i j : Fin (quickSort arr).size ij : i ≤ j hi : 0 ≤ ↑i s : (quickSort arr).size = arr.size ⊢ (compare (quickSort arr)[i] (quickSort arr)[j]).isLE = true
https://github.com/pandaman64/QuickSortInLean.git
ab0aaee0aed280959328844f9a6cd13bf00c5935
QuickSortInLean/Sorted.lean
quickSort_sorted
[371, 1]
[379, 42]
have hj : j.val ≤ arr.size - 1 := Nat.le_sub_one_of_lt (s ▸ j.isLt)
α : Type inst✝ : Order α arr : Array α sr : sortedRange (quickSort' ⟨arr, ⋯⟩) 0 (arr.size - 1) := quickSort'_sortedRange ⟨arr, instCoeDepArrayVecSize.proof_1⟩ i j : Fin (quickSort arr).size ij : i ≤ j hi : 0 ≤ ↑i s : (quickSort arr).size = arr.size ⊢ (compare (quickSort arr)[i] (quickSort arr)[j]).isLE = true
α : Type inst✝ : Order α arr : Array α sr : sortedRange (quickSort' ⟨arr, ⋯⟩) 0 (arr.size - 1) := quickSort'_sortedRange ⟨arr, instCoeDepArrayVecSize.proof_1⟩ i j : Fin (quickSort arr).size ij : i ≤ j hi : 0 ≤ ↑i s : (quickSort arr).size = arr.size hj : ↑j ≤ arr.size - 1 ⊢ (compare (quickSort arr)[i] (quickSort arr)[j]).isLE = true
https://github.com/pandaman64/QuickSortInLean.git
ab0aaee0aed280959328844f9a6cd13bf00c5935
QuickSortInLean/Sorted.lean
quickSort_sorted
[371, 1]
[379, 42]
exact sr (i.cast s) (j.cast s) hi ij hj
α : Type inst✝ : Order α arr : Array α sr : sortedRange (quickSort' ⟨arr, ⋯⟩) 0 (arr.size - 1) := quickSort'_sortedRange ⟨arr, instCoeDepArrayVecSize.proof_1⟩ i j : Fin (quickSort arr).size ij : i ≤ j hi : 0 ≤ ↑i s : (quickSort arr).size = arr.size hj : ↑j ≤ arr.size - 1 ⊢ (compare (quickSort arr)[i] (quickSort arr)[j]).isLE = true
no goals
https://github.com/pandaman64/QuickSortInLean.git
ab0aaee0aed280959328844f9a6cd13bf00c5935
QuickSortInLean/QuickSort.lean
Nat.sub_add_eq_add_sub
[32, 1]
[37, 64]
induction km with | refl => simp [Nat.add_sub_cancel_left] | @step m km ih => have : k ≤ m + n := Nat.le_trans km (Nat.le_add_right ..) simp [Nat.succ_sub km, Nat.succ_add, ih, Nat.succ_sub this]
m n k : Nat km : k ≤ m ⊢ m - k + n = m + n - k
no goals
https://github.com/pandaman64/QuickSortInLean.git
ab0aaee0aed280959328844f9a6cd13bf00c5935
QuickSortInLean/QuickSort.lean
Nat.sub_add_eq_add_sub
[32, 1]
[37, 64]
simp [Nat.add_sub_cancel_left]
case refl m n k : Nat ⊢ k - k + n = k + n - k
no goals
https://github.com/pandaman64/QuickSortInLean.git
ab0aaee0aed280959328844f9a6cd13bf00c5935
QuickSortInLean/QuickSort.lean
Nat.sub_add_eq_add_sub
[32, 1]
[37, 64]
have : k ≤ m + n := Nat.le_trans km (Nat.le_add_right ..)
case step m✝ n k m : Nat km : k.le m ih : m - k + n = m + n - k ⊢ m.succ - k + n = m.succ + n - k
case step m✝ n k m : Nat km : k.le m ih : m - k + n = m + n - k this : k ≤ m + n ⊢ m.succ - k + n = m.succ + n - k
https://github.com/pandaman64/QuickSortInLean.git
ab0aaee0aed280959328844f9a6cd13bf00c5935
QuickSortInLean/QuickSort.lean
Nat.sub_add_eq_add_sub
[32, 1]
[37, 64]
simp [Nat.succ_sub km, Nat.succ_add, ih, Nat.succ_sub this]
case step m✝ n k m : Nat km : k.le m ih : m - k + n = m + n - k this : k ≤ m + n ⊢ m.succ - k + n = m.succ + n - k
no goals
https://github.com/pandaman64/QuickSortInLean.git
ab0aaee0aed280959328844f9a6cd13bf00c5935
QuickSortInLean/QuickSort.lean
Nat.lt_sub_right
[39, 1]
[43, 32]
show m - k + 1 ≤ n - k
m n k : Nat mk : k ≤ m mn : m < n ⊢ m - k < n - k
m n k : Nat mk : k ≤ m mn : m < n ⊢ m - k + 1 ≤ n - k
https://github.com/pandaman64/QuickSortInLean.git
ab0aaee0aed280959328844f9a6cd13bf00c5935
QuickSortInLean/QuickSort.lean
Nat.lt_sub_right
[39, 1]
[43, 32]
have : m - k + 1 = m + 1 - k := Nat.sub_add_eq_add_sub mk
m n k : Nat mk : k ≤ m mn : m < n ⊢ m - k + 1 ≤ n - k
m n k : Nat mk : k ≤ m mn : m < n this : m - k + 1 = m + 1 - k ⊢ m - k + 1 ≤ n - k
https://github.com/pandaman64/QuickSortInLean.git
ab0aaee0aed280959328844f9a6cd13bf00c5935
QuickSortInLean/QuickSort.lean
Nat.lt_sub_right
[39, 1]
[43, 32]
rw [this]
m n k : Nat mk : k ≤ m mn : m < n this : m - k + 1 = m + 1 - k ⊢ m - k + 1 ≤ n - k
m n k : Nat mk : k ≤ m mn : m < n this : m - k + 1 = m + 1 - k ⊢ m + 1 - k ≤ n - k
https://github.com/pandaman64/QuickSortInLean.git
ab0aaee0aed280959328844f9a6cd13bf00c5935
QuickSortInLean/QuickSort.lean
Nat.lt_sub_right
[39, 1]
[43, 32]
apply Nat.sub_le_sub_right mn
m n k : Nat mk : k ≤ m mn : m < n this : m - k + 1 = m + 1 - k ⊢ m + 1 - k ≤ n - k
no goals
https://github.com/pandaman64/QuickSortInLean.git
ab0aaee0aed280959328844f9a6cd13bf00c5935
QuickSortInLean/Induction.lean
partitionImpl.simp_base
[39, 1]
[46, 29]
assumption
α : Type inst✝ : Ord α n : Nat arr : Vec α n first i j : Fin n fi : first ≤ i ij : i ≤ j h : ¬first < i ⊢ ↑first ≤ ↑i
no goals
https://github.com/pandaman64/QuickSortInLean.git
ab0aaee0aed280959328844f9a6cd13bf00c5935
QuickSortInLean/Induction.lean
partitionImpl.simp_base
[39, 1]
[46, 29]
unfold partitionImpl
α : Type inst✝ : Ord α n : Nat arr : Vec α n first i j : Fin n fi : first ≤ i ij : i ≤ j h : ¬first < i ⊢ partitionImpl arr first i j fi ij = (⟨j, ⋯⟩, arr)
α : Type inst✝ : Ord α n : Nat arr : Vec α n first i j : Fin n fi : first ≤ i ij : i ≤ j h : ¬first < i ⊢ (if h : first < i then let_fun this := ⋯; if arr[i] < arr[first] then let_fun this_1 := ⋯; partitionImpl arr first i.prev j this this_1 else let arr := (dbgTraceIfShared "swap1" arr).swap i j; match partitionImpl arr first i.prev j.prev this ⋯ with | (⟨mid, hm⟩, arr) => (⟨mid, ⋯⟩, arr) else (⟨j, ⋯⟩, arr)) = (⟨j, ⋯⟩, arr)
https://github.com/pandaman64/QuickSortInLean.git
ab0aaee0aed280959328844f9a6cd13bf00c5935
QuickSortInLean/Induction.lean
partitionImpl.simp_base
[39, 1]
[46, 29]
simp [*, dbgTraceIfShared]
α : Type inst✝ : Ord α n : Nat arr : Vec α n first i j : Fin n fi : first ≤ i ij : i ≤ j h : ¬first < i ⊢ (if h : first < i then let_fun this := ⋯; if arr[i] < arr[first] then let_fun this_1 := ⋯; partitionImpl arr first i.prev j this this_1 else let arr := (dbgTraceIfShared "swap1" arr).swap i j; match partitionImpl arr first i.prev j.prev this ⋯ with | (⟨mid, hm⟩, arr) => (⟨mid, ⋯⟩, arr) else (⟨j, ⋯⟩, arr)) = (⟨j, ⋯⟩, arr)
no goals
https://github.com/pandaman64/QuickSortInLean.git
ab0aaee0aed280959328844f9a6cd13bf00c5935
QuickSortInLean/Induction.lean
partitionImpl.simp_step_lt
[49, 1]
[55, 11]
rw [partitionImpl]
α : Type inst✝ : Ord α n : Nat arr : Vec α n first i j : Fin n fi : first ≤ i ij : i ≤ j h : first < i x✝ : arr[i] < arr[first] ⊢ partitionImpl arr first i j fi ij = partitionImpl arr first i.prev j ⋯ ⋯
α : Type inst✝ : Ord α n : Nat arr : Vec α n first i j : Fin n fi : first ≤ i ij : i ≤ j h : first < i x✝ : arr[i] < arr[first] ⊢ (if h : first < i then let_fun this := ⋯; if arr[i] < arr[first] then let_fun this_1 := ⋯; partitionImpl arr first i.prev j this this_1 else let arr := (dbgTraceIfShared "swap1" arr).swap i j; match partitionImpl arr first i.prev j.prev this ⋯ with | (⟨mid, hm⟩, arr) => (⟨mid, ⋯⟩, arr) else (⟨j, ⋯⟩, arr)) = partitionImpl arr first i.prev j ⋯ ⋯
https://github.com/pandaman64/QuickSortInLean.git
ab0aaee0aed280959328844f9a6cd13bf00c5935
QuickSortInLean/Induction.lean
partitionImpl.simp_step_lt
[49, 1]
[55, 11]
simp [*]
α : Type inst✝ : Ord α n : Nat arr : Vec α n first i j : Fin n fi : first ≤ i ij : i ≤ j h : first < i x✝ : arr[i] < arr[first] ⊢ (if h : first < i then let_fun this := ⋯; if arr[i] < arr[first] then let_fun this_1 := ⋯; partitionImpl arr first i.prev j this this_1 else let arr := (dbgTraceIfShared "swap1" arr).swap i j; match partitionImpl arr first i.prev j.prev this ⋯ with | (⟨mid, hm⟩, arr) => (⟨mid, ⋯⟩, arr) else (⟨j, ⋯⟩, arr)) = partitionImpl arr first i.prev j ⋯ ⋯
no goals
https://github.com/pandaman64/QuickSortInLean.git
ab0aaee0aed280959328844f9a6cd13bf00c5935
QuickSortInLean/Induction.lean
partitionImpl.simp_step_ge
[58, 1]
[67, 29]
rw [partitionImpl]
α : Type inst✝ : Ord α n : Nat arr : Vec α n first i j : Fin n fi : first ≤ i ij : i ≤ j h : first < i x✝ : ¬arr[i] < arr[first] ⊢ partitionImpl arr first i j fi ij = match partitionImpl (arr.swap i j) first i.prev j.prev ⋯ ⋯ with | (⟨mid, hm⟩, arr) => (⟨mid, ⋯⟩, arr)
α : Type inst✝ : Ord α n : Nat arr : Vec α n first i j : Fin n fi : first ≤ i ij : i ≤ j h : first < i x✝ : ¬arr[i] < arr[first] ⊢ (if h : first < i then let_fun this := ⋯; if arr[i] < arr[first] then let_fun this_1 := ⋯; partitionImpl arr first i.prev j this this_1 else let arr := (dbgTraceIfShared "swap1" arr).swap i j; match partitionImpl arr first i.prev j.prev this ⋯ with | (⟨mid, hm⟩, arr) => (⟨mid, ⋯⟩, arr) else (⟨j, ⋯⟩, arr)) = match partitionImpl (arr.swap i j) first i.prev j.prev ⋯ ⋯ with | (⟨mid, hm⟩, arr) => (⟨mid, ⋯⟩, arr)
https://github.com/pandaman64/QuickSortInLean.git
ab0aaee0aed280959328844f9a6cd13bf00c5935
QuickSortInLean/Induction.lean
partitionImpl.simp_step_ge
[58, 1]
[67, 29]
simp [*, dbgTraceIfShared]
α : Type inst✝ : Ord α n : Nat arr : Vec α n first i j : Fin n fi : first ≤ i ij : i ≤ j h : first < i x✝ : ¬arr[i] < arr[first] ⊢ (if h : first < i then let_fun this := ⋯; if arr[i] < arr[first] then let_fun this_1 := ⋯; partitionImpl arr first i.prev j this this_1 else let arr := (dbgTraceIfShared "swap1" arr).swap i j; match partitionImpl arr first i.prev j.prev this ⋯ with | (⟨mid, hm⟩, arr) => (⟨mid, ⋯⟩, arr) else (⟨j, ⋯⟩, arr)) = match partitionImpl (arr.swap i j) first i.prev j.prev ⋯ ⋯ with | (⟨mid, hm⟩, arr) => (⟨mid, ⋯⟩, arr)
no goals
https://github.com/pandaman64/QuickSortInLean.git
ab0aaee0aed280959328844f9a6cd13bf00c5935
QuickSortInLean/Induction.lean
quickSortImpl.simp_base
[102, 1]
[107, 11]
unfold quickSortImpl
α : Type inst✝ : Ord α n : Nat arr : Vec α n first : Nat last : Fin n h : ¬first < ↑last ⊢ quickSortImpl arr first last = arr
α : Type inst✝ : Ord α n : Nat arr : Vec α n first : Nat last : Fin n h : ¬first < ↑last ⊢ (if lt : first < ↑last then let parted := partition arr ⟨first, ⋯⟩ last ⋯; let mid := parted.fst.val; let hm := ⋯; let arr_1 := parted.snd; let_fun this := ⋯; let_fun this_1 := ⋯; let arr_2 := quickSortImpl arr_1 first mid.prev; quickSortImpl arr_2 (↑mid + 1) last else arr) = arr
https://github.com/pandaman64/QuickSortInLean.git
ab0aaee0aed280959328844f9a6cd13bf00c5935
QuickSortInLean/Induction.lean
quickSortImpl.simp_base
[102, 1]
[107, 11]
simp [*]
α : Type inst✝ : Ord α n : Nat arr : Vec α n first : Nat last : Fin n h : ¬first < ↑last ⊢ (if lt : first < ↑last then let parted := partition arr ⟨first, ⋯⟩ last ⋯; let mid := parted.fst.val; let hm := ⋯; let arr_1 := parted.snd; let_fun this := ⋯; let_fun this_1 := ⋯; let arr_2 := quickSortImpl arr_1 first mid.prev; quickSortImpl arr_2 (↑mid + 1) last else arr) = arr
no goals
https://github.com/pandaman64/QuickSortInLean.git
ab0aaee0aed280959328844f9a6cd13bf00c5935
QuickSortInLean/Induction.lean
quickSortImpl.simp_step
[110, 1]
[117, 11]
rw [quickSortImpl]
α : Type inst✝ : Ord α n : Nat arr : Vec α n first : Nat last : Fin n lt : first < ↑last ⊢ let parted := partition arr ⟨first, ⋯⟩ last ⋯; let mid := parted.fst.val; quickSortImpl arr first last = quickSortImpl (quickSortImpl parted.snd first mid.prev) (↑mid + 1) last
α : Type inst✝ : Ord α n : Nat arr : Vec α n first : Nat last : Fin n lt : first < ↑last ⊢ let parted := partition arr ⟨first, ⋯⟩ last ⋯; let mid := parted.fst.val; (if lt : first < ↑last then let parted := partition arr ⟨first, ⋯⟩ last ⋯; let mid := parted.fst.val; let hm := ⋯; let arr_1 := parted.snd; let_fun this := ⋯; let_fun this_1 := ⋯; let arr_2 := quickSortImpl arr_1 first mid.prev; quickSortImpl arr_2 (↑mid + 1) last else arr) = quickSortImpl (quickSortImpl parted.snd first mid.prev) (↑mid + 1) last
https://github.com/pandaman64/QuickSortInLean.git
ab0aaee0aed280959328844f9a6cd13bf00c5935
QuickSortInLean/Induction.lean
quickSortImpl.simp_step
[110, 1]
[117, 11]
simp [*]
α : Type inst✝ : Ord α n : Nat arr : Vec α n first : Nat last : Fin n lt : first < ↑last ⊢ let parted := partition arr ⟨first, ⋯⟩ last ⋯; let mid := parted.fst.val; (if lt : first < ↑last then let parted := partition arr ⟨first, ⋯⟩ last ⋯; let mid := parted.fst.val; let hm := ⋯; let arr_1 := parted.snd; let_fun this := ⋯; let_fun this_1 := ⋯; let arr_2 := quickSortImpl arr_1 first mid.prev; quickSortImpl arr_2 (↑mid + 1) last else arr) = quickSortImpl (quickSortImpl parted.snd first mid.prev) (↑mid + 1) last
no goals
https://github.com/jvlmdr/from_the_book.git
9fb6080539a2f32bb24719600a9e7531abf2328d
FromTheBook/Ch02/Bertrand/Util.lean
prodPrimesSplit
[11, 1]
[20, 46]
rw [← Nat.Ico_succ_succ]
b a : ℕ ha : a ≤ b ⊢ prodPrimes b = prodPrimes a * ∏ p in primes (Finset.Ioc a b), p
b a : ℕ ha : a ≤ b ⊢ prodPrimes b = prodPrimes a * ∏ p in primes (Finset.Ico (Nat.succ a) (Nat.succ b)), p
https://github.com/jvlmdr/from_the_book.git
9fb6080539a2f32bb24719600a9e7531abf2328d
FromTheBook/Ch02/Bertrand/Util.lean
prodPrimesSplit
[11, 1]
[20, 46]
simp [prodPrimes, primes]
b a : ℕ ha : a ≤ b ⊢ prodPrimes b = prodPrimes a * ∏ p in primes (Finset.Ico (Nat.succ a) (Nat.succ b)), p
b a : ℕ ha : a ≤ b ⊢ ∏ p in Finset.filter Nat.Prime (Finset.range (Nat.succ b)), p = (∏ p in Finset.filter Nat.Prime (Finset.range (Nat.succ a)), p) * ∏ p in Finset.filter Nat.Prime (Finset.Ico (Nat.succ a) (Nat.succ b)), p
https://github.com/jvlmdr/from_the_book.git
9fb6080539a2f32bb24719600a9e7531abf2328d
FromTheBook/Ch02/Bertrand/Util.lean
prodPrimesSplit
[11, 1]
[20, 46]
rw [Finset.range_eq_Ico]
b a : ℕ ha : a ≤ b ⊢ ∏ p in Finset.filter Nat.Prime (Finset.range (Nat.succ b)), p = (∏ p in Finset.filter Nat.Prime (Finset.range (Nat.succ a)), p) * ∏ p in Finset.filter Nat.Prime (Finset.Ico (Nat.succ a) (Nat.succ b)), p
b a : ℕ ha : a ≤ b ⊢ ∏ p in Finset.filter Nat.Prime (Finset.Ico 0 (Nat.succ b)), p = (∏ p in Finset.filter Nat.Prime (Finset.Ico 0 (Nat.succ a)), p) * ∏ p in Finset.filter Nat.Prime (Finset.Ico (Nat.succ a) (Nat.succ b)), p
https://github.com/jvlmdr/from_the_book.git
9fb6080539a2f32bb24719600a9e7531abf2328d
FromTheBook/Ch02/Bertrand/Util.lean
prodPrimesSplit
[11, 1]
[20, 46]
rw [← Finset.prod_union]
b a : ℕ ha : a ≤ b ⊢ ∏ p in Finset.filter Nat.Prime (Finset.Ico 0 (Nat.succ b)), p = (∏ p in Finset.filter Nat.Prime (Finset.Ico 0 (Nat.succ a)), p) * ∏ p in Finset.filter Nat.Prime (Finset.Ico (Nat.succ a) (Nat.succ b)), p
b a : ℕ ha : a ≤ b ⊢ ∏ p in Finset.filter Nat.Prime (Finset.Ico 0 (Nat.succ b)), p = ∏ x in Finset.filter Nat.Prime (Finset.Ico 0 (Nat.succ a)) ∪ Finset.filter Nat.Prime (Finset.Ico (Nat.succ a) (Nat.succ b)), x b a : ℕ ha : a ≤ b ⊢ Disjoint (Finset.filter Nat.Prime (Finset.Ico 0 (Nat.succ a))) (Finset.filter Nat.Prime (Finset.Ico (Nat.succ a) (Nat.succ b)))
https://github.com/jvlmdr/from_the_book.git
9fb6080539a2f32bb24719600a9e7531abf2328d
FromTheBook/Ch02/Bertrand/Util.lean
prodPrimesSplit
[11, 1]
[20, 46]
. rw [← Finset.filter_union] rw [Finset.Ico_union_Ico_eq_Ico (Nat.zero_le a.succ) (Nat.succ_le_succ ha)]
b a : ℕ ha : a ≤ b ⊢ ∏ p in Finset.filter Nat.Prime (Finset.Ico 0 (Nat.succ b)), p = ∏ x in Finset.filter Nat.Prime (Finset.Ico 0 (Nat.succ a)) ∪ Finset.filter Nat.Prime (Finset.Ico (Nat.succ a) (Nat.succ b)), x b a : ℕ ha : a ≤ b ⊢ Disjoint (Finset.filter Nat.Prime (Finset.Ico 0 (Nat.succ a))) (Finset.filter Nat.Prime (Finset.Ico (Nat.succ a) (Nat.succ b)))
b a : ℕ ha : a ≤ b ⊢ Disjoint (Finset.filter Nat.Prime (Finset.Ico 0 (Nat.succ a))) (Finset.filter Nat.Prime (Finset.Ico (Nat.succ a) (Nat.succ b)))
https://github.com/jvlmdr/from_the_book.git
9fb6080539a2f32bb24719600a9e7531abf2328d
FromTheBook/Ch02/Bertrand/Util.lean
prodPrimesSplit
[11, 1]
[20, 46]
. apply Finset.disjoint_filter_filter apply Finset.Ico_disjoint_Ico_consecutive
b a : ℕ ha : a ≤ b ⊢ Disjoint (Finset.filter Nat.Prime (Finset.Ico 0 (Nat.succ a))) (Finset.filter Nat.Prime (Finset.Ico (Nat.succ a) (Nat.succ b)))
no goals
https://github.com/jvlmdr/from_the_book.git
9fb6080539a2f32bb24719600a9e7531abf2328d
FromTheBook/Ch02/Bertrand/Util.lean
prodPrimesSplit
[11, 1]
[20, 46]
rw [← Finset.filter_union]
b a : ℕ ha : a ≤ b ⊢ ∏ p in Finset.filter Nat.Prime (Finset.Ico 0 (Nat.succ b)), p = ∏ x in Finset.filter Nat.Prime (Finset.Ico 0 (Nat.succ a)) ∪ Finset.filter Nat.Prime (Finset.Ico (Nat.succ a) (Nat.succ b)), x
b a : ℕ ha : a ≤ b ⊢ ∏ p in Finset.filter Nat.Prime (Finset.Ico 0 (Nat.succ b)), p = ∏ x in Finset.filter Nat.Prime (Finset.Ico 0 (Nat.succ a) ∪ Finset.Ico (Nat.succ a) (Nat.succ b)), x
https://github.com/jvlmdr/from_the_book.git
9fb6080539a2f32bb24719600a9e7531abf2328d
FromTheBook/Ch02/Bertrand/Util.lean
prodPrimesSplit
[11, 1]
[20, 46]
rw [Finset.Ico_union_Ico_eq_Ico (Nat.zero_le a.succ) (Nat.succ_le_succ ha)]
b a : ℕ ha : a ≤ b ⊢ ∏ p in Finset.filter Nat.Prime (Finset.Ico 0 (Nat.succ b)), p = ∏ x in Finset.filter Nat.Prime (Finset.Ico 0 (Nat.succ a) ∪ Finset.Ico (Nat.succ a) (Nat.succ b)), x
no goals
https://github.com/jvlmdr/from_the_book.git
9fb6080539a2f32bb24719600a9e7531abf2328d
FromTheBook/Ch02/Bertrand/Util.lean
prodPrimesSplit
[11, 1]
[20, 46]
apply Finset.disjoint_filter_filter
b a : ℕ ha : a ≤ b ⊢ Disjoint (Finset.filter Nat.Prime (Finset.Ico 0 (Nat.succ a))) (Finset.filter Nat.Prime (Finset.Ico (Nat.succ a) (Nat.succ b)))
case a b a : ℕ ha : a ≤ b ⊢ Disjoint (Finset.Ico 0 (Nat.succ a)) (Finset.Ico (Nat.succ a) (Nat.succ b))
https://github.com/jvlmdr/from_the_book.git
9fb6080539a2f32bb24719600a9e7531abf2328d
FromTheBook/Ch02/Bertrand/Util.lean
prodPrimesSplit
[11, 1]
[20, 46]
apply Finset.Ico_disjoint_Ico_consecutive
case a b a : ℕ ha : a ≤ b ⊢ Disjoint (Finset.Ico 0 (Nat.succ a)) (Finset.Ico (Nat.succ a) (Nat.succ b))
no goals
https://github.com/jvlmdr/from_the_book.git
9fb6080539a2f32bb24719600a9e7531abf2328d
FromTheBook/Ch02/Bertrand/Bertrand.lean
natRealCoeLtCoe
[20, 1]
[20, 71]
simp
a b : ℕ ⊢ ↑a < ↑b ↔ a < b
no goals
https://github.com/jvlmdr/from_the_book.git
9fb6080539a2f32bb24719600a9e7531abf2328d
FromTheBook/Ch02/Bertrand/Bertrand.lean
natRealCoeLeCoe
[22, 1]
[22, 71]
simp
a b : ℕ ⊢ ↑a ≤ ↑b ↔ a ≤ b
no goals
https://github.com/jvlmdr/from_the_book.git
9fb6080539a2f32bb24719600a9e7531abf2328d
FromTheBook/Ch02/Bertrand/Bertrand.lean
rpowDivThreeLe
[24, 1]
[58, 62]
rw [← natRealCoeLeCoe] at h
n : ℕ hn : 0 < n h : 4 ^ n ≤ (2 * n) ^ (1 + Nat.sqrt (2 * n)) * 4 ^ Nat.pred (2 * n / 3) ⊢ 4 ^ (↑n / 3) ≤ (2 * ↑n) ^ (1 + Real.sqrt (2 * ↑n))
n : ℕ hn : 0 < n h : ↑(4 ^ n) ≤ ↑((2 * n) ^ (1 + Nat.sqrt (2 * n)) * 4 ^ Nat.pred (2 * n / 3)) ⊢ 4 ^ (↑n / 3) ≤ (2 * ↑n) ^ (1 + Real.sqrt (2 * ↑n))
https://github.com/jvlmdr/from_the_book.git
9fb6080539a2f32bb24719600a9e7531abf2328d
FromTheBook/Ch02/Bertrand/Bertrand.lean
rpowDivThreeLe
[24, 1]
[58, 62]
have : 4^(↑n/3 : ℝ) = 4^(↑n : ℝ) / 4^(2*↑n/3 : ℝ)
n : ℕ hn : 0 < n h : ↑(4 ^ n) ≤ ↑((2 * n) ^ (1 + Nat.sqrt (2 * n)) * 4 ^ Nat.pred (2 * n / 3)) ⊢ 4 ^ (↑n / 3) ≤ (2 * ↑n) ^ (1 + Real.sqrt (2 * ↑n))
case this n : ℕ hn : 0 < n h : ↑(4 ^ n) ≤ ↑((2 * n) ^ (1 + Nat.sqrt (2 * n)) * 4 ^ Nat.pred (2 * n / 3)) ⊢ 4 ^ (↑n / 3) = 4 ^ ↑n / 4 ^ (2 * ↑n / 3) n : ℕ hn : 0 < n h : ↑(4 ^ n) ≤ ↑((2 * n) ^ (1 + Nat.sqrt (2 * n)) * 4 ^ Nat.pred (2 * n / 3)) this : 4 ^ (↑n / 3) = 4 ^ ↑n / 4 ^ (2 * ↑n / 3) ⊢ 4 ^ (↑n / 3) ≤ (2 * ↑n) ^ (1 + Real.sqrt (2 * ↑n))
https://github.com/jvlmdr/from_the_book.git
9fb6080539a2f32bb24719600a9e7531abf2328d
FromTheBook/Ch02/Bertrand/Bertrand.lean
rpowDivThreeLe
[24, 1]
[58, 62]
. rw [eq_div_iff] swap; {apply ne_of_gt; apply Real.rpow_pos_of_pos (by norm_num)} rw [← Real.rpow_add (by norm_num)] simp [Real.rpow_def_of_pos] norm_num push_cast simp [div_add_div_same] norm_cast rw [(by linarith : n + 2*n = n*3)] simp
case this n : ℕ hn : 0 < n h : ↑(4 ^ n) ≤ ↑((2 * n) ^ (1 + Nat.sqrt (2 * n)) * 4 ^ Nat.pred (2 * n / 3)) ⊢ 4 ^ (↑n / 3) = 4 ^ ↑n / 4 ^ (2 * ↑n / 3) n : ℕ hn : 0 < n h : ↑(4 ^ n) ≤ ↑((2 * n) ^ (1 + Nat.sqrt (2 * n)) * 4 ^ Nat.pred (2 * n / 3)) this : 4 ^ (↑n / 3) = 4 ^ ↑n / 4 ^ (2 * ↑n / 3) ⊢ 4 ^ (↑n / 3) ≤ (2 * ↑n) ^ (1 + Real.sqrt (2 * ↑n))
n : ℕ hn : 0 < n h : ↑(4 ^ n) ≤ ↑((2 * n) ^ (1 + Nat.sqrt (2 * n)) * 4 ^ Nat.pred (2 * n / 3)) this : 4 ^ (↑n / 3) = 4 ^ ↑n / 4 ^ (2 * ↑n / 3) ⊢ 4 ^ (↑n / 3) ≤ (2 * ↑n) ^ (1 + Real.sqrt (2 * ↑n))
https://github.com/jvlmdr/from_the_book.git
9fb6080539a2f32bb24719600a9e7531abf2328d
FromTheBook/Ch02/Bertrand/Bertrand.lean
rpowDivThreeLe
[24, 1]
[58, 62]
rw [this]
n : ℕ hn : 0 < n h : ↑(4 ^ n) ≤ ↑((2 * n) ^ (1 + Nat.sqrt (2 * n)) * 4 ^ Nat.pred (2 * n / 3)) this : 4 ^ (↑n / 3) = 4 ^ ↑n / 4 ^ (2 * ↑n / 3) ⊢ 4 ^ (↑n / 3) ≤ (2 * ↑n) ^ (1 + Real.sqrt (2 * ↑n))
n : ℕ hn : 0 < n h : ↑(4 ^ n) ≤ ↑((2 * n) ^ (1 + Nat.sqrt (2 * n)) * 4 ^ Nat.pred (2 * n / 3)) this : 4 ^ (↑n / 3) = 4 ^ ↑n / 4 ^ (2 * ↑n / 3) ⊢ 4 ^ ↑n / 4 ^ (2 * ↑n / 3) ≤ (2 * ↑n) ^ (1 + Real.sqrt (2 * ↑n))
https://github.com/jvlmdr/from_the_book.git
9fb6080539a2f32bb24719600a9e7531abf2328d
FromTheBook/Ch02/Bertrand/Bertrand.lean
rpowDivThreeLe
[24, 1]
[58, 62]
clear this
n : ℕ hn : 0 < n h : ↑(4 ^ n) ≤ ↑((2 * n) ^ (1 + Nat.sqrt (2 * n)) * 4 ^ Nat.pred (2 * n / 3)) this : 4 ^ (↑n / 3) = 4 ^ ↑n / 4 ^ (2 * ↑n / 3) ⊢ 4 ^ ↑n / 4 ^ (2 * ↑n / 3) ≤ (2 * ↑n) ^ (1 + Real.sqrt (2 * ↑n))
n : ℕ hn : 0 < n h : ↑(4 ^ n) ≤ ↑((2 * n) ^ (1 + Nat.sqrt (2 * n)) * 4 ^ Nat.pred (2 * n / 3)) ⊢ 4 ^ ↑n / 4 ^ (2 * ↑n / 3) ≤ (2 * ↑n) ^ (1 + Real.sqrt (2 * ↑n))
https://github.com/jvlmdr/from_the_book.git
9fb6080539a2f32bb24719600a9e7531abf2328d
FromTheBook/Ch02/Bertrand/Bertrand.lean
rpowDivThreeLe
[24, 1]
[58, 62]
rw [div_le_iff]
n : ℕ hn : 0 < n h : ↑(4 ^ n) ≤ ↑((2 * n) ^ (1 + Nat.sqrt (2 * n)) * 4 ^ Nat.pred (2 * n / 3)) ⊢ 4 ^ ↑n / 4 ^ (2 * ↑n / 3) ≤ (2 * ↑n) ^ (1 + Real.sqrt (2 * ↑n))
n : ℕ hn : 0 < n h : ↑(4 ^ n) ≤ ↑((2 * n) ^ (1 + Nat.sqrt (2 * n)) * 4 ^ Nat.pred (2 * n / 3)) ⊢ 4 ^ ↑n ≤ (2 * ↑n) ^ (1 + Real.sqrt (2 * ↑n)) * 4 ^ (2 * ↑n / 3) n : ℕ hn : 0 < n h : ↑(4 ^ n) ≤ ↑((2 * n) ^ (1 + Nat.sqrt (2 * n)) * 4 ^ Nat.pred (2 * n / 3)) ⊢ 0 < 4 ^ (2 * ↑n / 3)
https://github.com/jvlmdr/from_the_book.git
9fb6080539a2f32bb24719600a9e7531abf2328d
FromTheBook/Ch02/Bertrand/Bertrand.lean
rpowDivThreeLe
[24, 1]
[58, 62]
swap
n : ℕ hn : 0 < n h : ↑(4 ^ n) ≤ ↑((2 * n) ^ (1 + Nat.sqrt (2 * n)) * 4 ^ Nat.pred (2 * n / 3)) ⊢ 4 ^ ↑n ≤ (2 * ↑n) ^ (1 + Real.sqrt (2 * ↑n)) * 4 ^ (2 * ↑n / 3) n : ℕ hn : 0 < n h : ↑(4 ^ n) ≤ ↑((2 * n) ^ (1 + Nat.sqrt (2 * n)) * 4 ^ Nat.pred (2 * n / 3)) ⊢ 0 < 4 ^ (2 * ↑n / 3)
n : ℕ hn : 0 < n h : ↑(4 ^ n) ≤ ↑((2 * n) ^ (1 + Nat.sqrt (2 * n)) * 4 ^ Nat.pred (2 * n / 3)) ⊢ 0 < 4 ^ (2 * ↑n / 3) n : ℕ hn : 0 < n h : ↑(4 ^ n) ≤ ↑((2 * n) ^ (1 + Nat.sqrt (2 * n)) * 4 ^ Nat.pred (2 * n / 3)) ⊢ 4 ^ ↑n ≤ (2 * ↑n) ^ (1 + Real.sqrt (2 * ↑n)) * 4 ^ (2 * ↑n / 3)
https://github.com/jvlmdr/from_the_book.git
9fb6080539a2f32bb24719600a9e7531abf2328d
FromTheBook/Ch02/Bertrand/Bertrand.lean
rpowDivThreeLe
[24, 1]
[58, 62]
{apply Real.rpow_pos_of_pos; norm_num}
n : ℕ hn : 0 < n h : ↑(4 ^ n) ≤ ↑((2 * n) ^ (1 + Nat.sqrt (2 * n)) * 4 ^ Nat.pred (2 * n / 3)) ⊢ 0 < 4 ^ (2 * ↑n / 3) n : ℕ hn : 0 < n h : ↑(4 ^ n) ≤ ↑((2 * n) ^ (1 + Nat.sqrt (2 * n)) * 4 ^ Nat.pred (2 * n / 3)) ⊢ 4 ^ ↑n ≤ (2 * ↑n) ^ (1 + Real.sqrt (2 * ↑n)) * 4 ^ (2 * ↑n / 3)
n : ℕ hn : 0 < n h : ↑(4 ^ n) ≤ ↑((2 * n) ^ (1 + Nat.sqrt (2 * n)) * 4 ^ Nat.pred (2 * n / 3)) ⊢ 4 ^ ↑n ≤ (2 * ↑n) ^ (1 + Real.sqrt (2 * ↑n)) * 4 ^ (2 * ↑n / 3)
https://github.com/jvlmdr/from_the_book.git
9fb6080539a2f32bb24719600a9e7531abf2328d
FromTheBook/Ch02/Bertrand/Bertrand.lean
rpowDivThreeLe
[24, 1]
[58, 62]
rw [Real.rpow_nat_cast]
n : ℕ hn : 0 < n h : ↑(4 ^ n) ≤ ↑((2 * n) ^ (1 + Nat.sqrt (2 * n)) * 4 ^ Nat.pred (2 * n / 3)) ⊢ 4 ^ ↑n ≤ (2 * ↑n) ^ (1 + Real.sqrt (2 * ↑n)) * 4 ^ (2 * ↑n / 3)
n : ℕ hn : 0 < n h : ↑(4 ^ n) ≤ ↑((2 * n) ^ (1 + Nat.sqrt (2 * n)) * 4 ^ Nat.pred (2 * n / 3)) ⊢ 4 ^ n ≤ (2 * ↑n) ^ (1 + Real.sqrt (2 * ↑n)) * 4 ^ (2 * ↑n / 3)
https://github.com/jvlmdr/from_the_book.git
9fb6080539a2f32bb24719600a9e7531abf2328d
FromTheBook/Ch02/Bertrand/Bertrand.lean
rpowDivThreeLe
[24, 1]
[58, 62]
norm_cast
n : ℕ hn : 0 < n h : ↑(4 ^ n) ≤ ↑((2 * n) ^ (1 + Nat.sqrt (2 * n)) * 4 ^ Nat.pred (2 * n / 3)) ⊢ 4 ^ n ≤ (2 * ↑n) ^ (1 + Real.sqrt (2 * ↑n)) * 4 ^ (2 * ↑n / 3)
n : ℕ hn : 0 < n h : ↑(4 ^ n) ≤ ↑((2 * n) ^ (1 + Nat.sqrt (2 * n)) * 4 ^ Nat.pred (2 * n / 3)) ⊢ ↑(4 ^ n) ≤ ↑(2 * n) ^ (1 + Real.sqrt ↑(2 * n)) * 4 ^ (↑(2 * n) / 3)
https://github.com/jvlmdr/from_the_book.git
9fb6080539a2f32bb24719600a9e7531abf2328d
FromTheBook/Ch02/Bertrand/Bertrand.lean
rpowDivThreeLe
[24, 1]
[58, 62]
apply le_trans h
n : ℕ hn : 0 < n h : ↑(4 ^ n) ≤ ↑((2 * n) ^ (1 + Nat.sqrt (2 * n)) * 4 ^ Nat.pred (2 * n / 3)) ⊢ ↑(4 ^ n) ≤ ↑(2 * n) ^ (1 + Real.sqrt ↑(2 * n)) * 4 ^ (↑(2 * n) / 3)
n : ℕ hn : 0 < n h : ↑(4 ^ n) ≤ ↑((2 * n) ^ (1 + Nat.sqrt (2 * n)) * 4 ^ Nat.pred (2 * n / 3)) ⊢ ↑((2 * n) ^ (1 + Nat.sqrt (2 * n)) * 4 ^ Nat.pred (2 * n / 3)) ≤ ↑(2 * n) ^ (1 + Real.sqrt ↑(2 * n)) * 4 ^ (↑(2 * n) / 3)
https://github.com/jvlmdr/from_the_book.git
9fb6080539a2f32bb24719600a9e7531abf2328d
FromTheBook/Ch02/Bertrand/Bertrand.lean
rpowDivThreeLe
[24, 1]
[58, 62]
clear h
n : ℕ hn : 0 < n h : ↑(4 ^ n) ≤ ↑((2 * n) ^ (1 + Nat.sqrt (2 * n)) * 4 ^ Nat.pred (2 * n / 3)) ⊢ ↑((2 * n) ^ (1 + Nat.sqrt (2 * n)) * 4 ^ Nat.pred (2 * n / 3)) ≤ ↑(2 * n) ^ (1 + Real.sqrt ↑(2 * n)) * 4 ^ (↑(2 * n) / 3)
n : ℕ hn : 0 < n ⊢ ↑((2 * n) ^ (1 + Nat.sqrt (2 * n)) * 4 ^ Nat.pred (2 * n / 3)) ≤ ↑(2 * n) ^ (1 + Real.sqrt ↑(2 * n)) * 4 ^ (↑(2 * n) / 3)
https://github.com/jvlmdr/from_the_book.git
9fb6080539a2f32bb24719600a9e7531abf2328d
FromTheBook/Ch02/Bertrand/Bertrand.lean
rpowDivThreeLe
[24, 1]
[58, 62]
push_cast
n : ℕ hn : 0 < n ⊢ ↑((2 * n) ^ (1 + Nat.sqrt (2 * n)) * 4 ^ Nat.pred (2 * n / 3)) ≤ ↑(2 * n) ^ (1 + Real.sqrt ↑(2 * n)) * 4 ^ (↑(2 * n) / 3)
n : ℕ hn : 0 < n ⊢ (2 * ↑n) ^ (1 + Nat.sqrt (2 * n)) * 4 ^ Nat.pred (2 * n / 3) ≤ (2 * ↑n) ^ (1 + Real.sqrt (2 * ↑n)) * 4 ^ (2 * ↑n / 3)
https://github.com/jvlmdr/from_the_book.git
9fb6080539a2f32bb24719600a9e7531abf2328d
FromTheBook/Ch02/Bertrand/Bertrand.lean
rpowDivThreeLe
[24, 1]
[58, 62]
apply mul_le_mul
n : ℕ hn : 0 < n ⊢ (2 * ↑n) ^ (1 + Nat.sqrt (2 * n)) * 4 ^ Nat.pred (2 * n / 3) ≤ (2 * ↑n) ^ (1 + Real.sqrt (2 * ↑n)) * 4 ^ (2 * ↑n / 3)
case h₁ n : ℕ hn : 0 < n ⊢ (2 * ↑n) ^ (1 + Nat.sqrt (2 * n)) ≤ (2 * ↑n) ^ (1 + Real.sqrt (2 * ↑n)) case h₂ n : ℕ hn : 0 < n ⊢ 4 ^ Nat.pred (2 * n / 3) ≤ 4 ^ (2 * ↑n / 3) case c0 n : ℕ hn : 0 < n ⊢ 0 ≤ 4 ^ Nat.pred (2 * n / 3) case b0 n : ℕ hn : 0 < n ⊢ 0 ≤ (2 * ↑n) ^ (1 + Real.sqrt (2 * ↑n))
https://github.com/jvlmdr/from_the_book.git
9fb6080539a2f32bb24719600a9e7531abf2328d
FromTheBook/Ch02/Bertrand/Bertrand.lean
rpowDivThreeLe
[24, 1]
[58, 62]
. rw [← Real.rpow_nat_cast] rw [Real.rpow_le_rpow_left_iff (by norm_cast; linarith)] simp [-Real.sqrt_mul'] norm_cast apply Real.nat_sqrt_le_real_sqrt
case h₁ n : ℕ hn : 0 < n ⊢ (2 * ↑n) ^ (1 + Nat.sqrt (2 * n)) ≤ (2 * ↑n) ^ (1 + Real.sqrt (2 * ↑n)) case h₂ n : ℕ hn : 0 < n ⊢ 4 ^ Nat.pred (2 * n / 3) ≤ 4 ^ (2 * ↑n / 3) case c0 n : ℕ hn : 0 < n ⊢ 0 ≤ 4 ^ Nat.pred (2 * n / 3) case b0 n : ℕ hn : 0 < n ⊢ 0 ≤ (2 * ↑n) ^ (1 + Real.sqrt (2 * ↑n))
case h₂ n : ℕ hn : 0 < n ⊢ 4 ^ Nat.pred (2 * n / 3) ≤ 4 ^ (2 * ↑n / 3) case c0 n : ℕ hn : 0 < n ⊢ 0 ≤ 4 ^ Nat.pred (2 * n / 3) case b0 n : ℕ hn : 0 < n ⊢ 0 ≤ (2 * ↑n) ^ (1 + Real.sqrt (2 * ↑n))
https://github.com/jvlmdr/from_the_book.git
9fb6080539a2f32bb24719600a9e7531abf2328d
FromTheBook/Ch02/Bertrand/Bertrand.lean
rpowDivThreeLe
[24, 1]
[58, 62]
. rw [← Real.rpow_nat_cast] rw [Real.rpow_le_rpow_left_iff (by norm_cast)] rw [le_div_iff (by norm_num)] norm_cast apply Nat.le_trans (Nat.mul_le_mul_right 3 (Nat.pred_le _)) apply Nat.div_mul_le_self
case h₂ n : ℕ hn : 0 < n ⊢ 4 ^ Nat.pred (2 * n / 3) ≤ 4 ^ (2 * ↑n / 3) case c0 n : ℕ hn : 0 < n ⊢ 0 ≤ 4 ^ Nat.pred (2 * n / 3) case b0 n : ℕ hn : 0 < n ⊢ 0 ≤ (2 * ↑n) ^ (1 + Real.sqrt (2 * ↑n))
case c0 n : ℕ hn : 0 < n ⊢ 0 ≤ 4 ^ Nat.pred (2 * n / 3) case b0 n : ℕ hn : 0 < n ⊢ 0 ≤ (2 * ↑n) ^ (1 + Real.sqrt (2 * ↑n))
https://github.com/jvlmdr/from_the_book.git
9fb6080539a2f32bb24719600a9e7531abf2328d
FromTheBook/Ch02/Bertrand/Bertrand.lean
rpowDivThreeLe
[24, 1]
[58, 62]
. apply pow_nonneg (by norm_num)
case c0 n : ℕ hn : 0 < n ⊢ 0 ≤ 4 ^ Nat.pred (2 * n / 3) case b0 n : ℕ hn : 0 < n ⊢ 0 ≤ (2 * ↑n) ^ (1 + Real.sqrt (2 * ↑n))
case b0 n : ℕ hn : 0 < n ⊢ 0 ≤ (2 * ↑n) ^ (1 + Real.sqrt (2 * ↑n))
https://github.com/jvlmdr/from_the_book.git
9fb6080539a2f32bb24719600a9e7531abf2328d
FromTheBook/Ch02/Bertrand/Bertrand.lean
rpowDivThreeLe
[24, 1]
[58, 62]
. apply Real.rpow_nonneg_of_nonneg (by norm_cast; linarith)
case b0 n : ℕ hn : 0 < n ⊢ 0 ≤ (2 * ↑n) ^ (1 + Real.sqrt (2 * ↑n))
no goals
https://github.com/jvlmdr/from_the_book.git
9fb6080539a2f32bb24719600a9e7531abf2328d
FromTheBook/Ch02/Bertrand/Bertrand.lean
rpowDivThreeLe
[24, 1]
[58, 62]
rw [eq_div_iff]
case this n : ℕ hn : 0 < n h : ↑(4 ^ n) ≤ ↑((2 * n) ^ (1 + Nat.sqrt (2 * n)) * 4 ^ Nat.pred (2 * n / 3)) ⊢ 4 ^ (↑n / 3) = 4 ^ ↑n / 4 ^ (2 * ↑n / 3)
case this n : ℕ hn : 0 < n h : ↑(4 ^ n) ≤ ↑((2 * n) ^ (1 + Nat.sqrt (2 * n)) * 4 ^ Nat.pred (2 * n / 3)) ⊢ 4 ^ (↑n / 3) * 4 ^ (2 * ↑n / 3) = 4 ^ ↑n case this n : ℕ hn : 0 < n h : ↑(4 ^ n) ≤ ↑((2 * n) ^ (1 + Nat.sqrt (2 * n)) * 4 ^ Nat.pred (2 * n / 3)) ⊢ 4 ^ (2 * ↑n / 3) ≠ 0
https://github.com/jvlmdr/from_the_book.git
9fb6080539a2f32bb24719600a9e7531abf2328d
FromTheBook/Ch02/Bertrand/Bertrand.lean
rpowDivThreeLe
[24, 1]
[58, 62]
swap
case this n : ℕ hn : 0 < n h : ↑(4 ^ n) ≤ ↑((2 * n) ^ (1 + Nat.sqrt (2 * n)) * 4 ^ Nat.pred (2 * n / 3)) ⊢ 4 ^ (↑n / 3) * 4 ^ (2 * ↑n / 3) = 4 ^ ↑n case this n : ℕ hn : 0 < n h : ↑(4 ^ n) ≤ ↑((2 * n) ^ (1 + Nat.sqrt (2 * n)) * 4 ^ Nat.pred (2 * n / 3)) ⊢ 4 ^ (2 * ↑n / 3) ≠ 0
case this n : ℕ hn : 0 < n h : ↑(4 ^ n) ≤ ↑((2 * n) ^ (1 + Nat.sqrt (2 * n)) * 4 ^ Nat.pred (2 * n / 3)) ⊢ 4 ^ (2 * ↑n / 3) ≠ 0 case this n : ℕ hn : 0 < n h : ↑(4 ^ n) ≤ ↑((2 * n) ^ (1 + Nat.sqrt (2 * n)) * 4 ^ Nat.pred (2 * n / 3)) ⊢ 4 ^ (↑n / 3) * 4 ^ (2 * ↑n / 3) = 4 ^ ↑n
https://github.com/jvlmdr/from_the_book.git
9fb6080539a2f32bb24719600a9e7531abf2328d
FromTheBook/Ch02/Bertrand/Bertrand.lean
rpowDivThreeLe
[24, 1]
[58, 62]
{apply ne_of_gt; apply Real.rpow_pos_of_pos (by norm_num)}
case this n : ℕ hn : 0 < n h : ↑(4 ^ n) ≤ ↑((2 * n) ^ (1 + Nat.sqrt (2 * n)) * 4 ^ Nat.pred (2 * n / 3)) ⊢ 4 ^ (2 * ↑n / 3) ≠ 0 case this n : ℕ hn : 0 < n h : ↑(4 ^ n) ≤ ↑((2 * n) ^ (1 + Nat.sqrt (2 * n)) * 4 ^ Nat.pred (2 * n / 3)) ⊢ 4 ^ (↑n / 3) * 4 ^ (2 * ↑n / 3) = 4 ^ ↑n
case this n : ℕ hn : 0 < n h : ↑(4 ^ n) ≤ ↑((2 * n) ^ (1 + Nat.sqrt (2 * n)) * 4 ^ Nat.pred (2 * n / 3)) ⊢ 4 ^ (↑n / 3) * 4 ^ (2 * ↑n / 3) = 4 ^ ↑n
https://github.com/jvlmdr/from_the_book.git
9fb6080539a2f32bb24719600a9e7531abf2328d
FromTheBook/Ch02/Bertrand/Bertrand.lean
rpowDivThreeLe
[24, 1]
[58, 62]
rw [← Real.rpow_add (by norm_num)]
case this n : ℕ hn : 0 < n h : ↑(4 ^ n) ≤ ↑((2 * n) ^ (1 + Nat.sqrt (2 * n)) * 4 ^ Nat.pred (2 * n / 3)) ⊢ 4 ^ (↑n / 3) * 4 ^ (2 * ↑n / 3) = 4 ^ ↑n
case this n : ℕ hn : 0 < n h : ↑(4 ^ n) ≤ ↑((2 * n) ^ (1 + Nat.sqrt (2 * n)) * 4 ^ Nat.pred (2 * n / 3)) ⊢ 4 ^ (↑n / 3 + 2 * ↑n / 3) = 4 ^ ↑n
https://github.com/jvlmdr/from_the_book.git
9fb6080539a2f32bb24719600a9e7531abf2328d
FromTheBook/Ch02/Bertrand/Bertrand.lean
rpowDivThreeLe
[24, 1]
[58, 62]
simp [Real.rpow_def_of_pos]
case this n : ℕ hn : 0 < n h : ↑(4 ^ n) ≤ ↑((2 * n) ^ (1 + Nat.sqrt (2 * n)) * 4 ^ Nat.pred (2 * n / 3)) ⊢ 4 ^ (↑n / 3 + 2 * ↑n / 3) = 4 ^ ↑n
case this n : ℕ hn : 0 < n h : ↑(4 ^ n) ≤ ↑((2 * n) ^ (1 + Nat.sqrt (2 * n)) * 4 ^ Nat.pred (2 * n / 3)) ⊢ ↑n / 3 + 2 * ↑n / 3 = ↑n ∨ 4 = -1
https://github.com/jvlmdr/from_the_book.git
9fb6080539a2f32bb24719600a9e7531abf2328d
FromTheBook/Ch02/Bertrand/Bertrand.lean
rpowDivThreeLe
[24, 1]
[58, 62]
norm_num
case this n : ℕ hn : 0 < n h : ↑(4 ^ n) ≤ ↑((2 * n) ^ (1 + Nat.sqrt (2 * n)) * 4 ^ Nat.pred (2 * n / 3)) ⊢ ↑n / 3 + 2 * ↑n / 3 = ↑n ∨ 4 = -1
case this n : ℕ hn : 0 < n h : ↑(4 ^ n) ≤ ↑((2 * n) ^ (1 + Nat.sqrt (2 * n)) * 4 ^ Nat.pred (2 * n / 3)) ⊢ ↑n / 3 + 2 * ↑n / 3 = ↑n
https://github.com/jvlmdr/from_the_book.git
9fb6080539a2f32bb24719600a9e7531abf2328d
FromTheBook/Ch02/Bertrand/Bertrand.lean
rpowDivThreeLe
[24, 1]
[58, 62]
simp [div_add_div_same]
case this n : ℕ hn : 0 < n h : ↑(4 ^ n) ≤ ↑((2 * n) ^ (1 + Nat.sqrt (2 * n)) * 4 ^ Nat.pred (2 * n / 3)) ⊢ ↑n / 3 + 2 * ↑n / 3 = ↑n
case this n : ℕ hn : 0 < n h : ↑(4 ^ n) ≤ ↑((2 * n) ^ (1 + Nat.sqrt (2 * n)) * 4 ^ Nat.pred (2 * n / 3)) ⊢ (↑n + 2 * ↑n) / 3 = ↑n
https://github.com/jvlmdr/from_the_book.git
9fb6080539a2f32bb24719600a9e7531abf2328d
FromTheBook/Ch02/Bertrand/Bertrand.lean
rpowDivThreeLe
[24, 1]
[58, 62]
norm_cast
case this n : ℕ hn : 0 < n h : ↑(4 ^ n) ≤ ↑((2 * n) ^ (1 + Nat.sqrt (2 * n)) * 4 ^ Nat.pred (2 * n / 3)) ⊢ (↑n + 2 * ↑n) / 3 = ↑n
case this n : ℕ hn : 0 < n h : ↑(4 ^ n) ≤ ↑((2 * n) ^ (1 + Nat.sqrt (2 * n)) * 4 ^ Nat.pred (2 * n / 3)) ⊢ ↑(n + 2 * n) / 3 = ↑n
https://github.com/jvlmdr/from_the_book.git
9fb6080539a2f32bb24719600a9e7531abf2328d
FromTheBook/Ch02/Bertrand/Bertrand.lean
rpowDivThreeLe
[24, 1]
[58, 62]
rw [(by linarith : n + 2*n = n*3)]
case this n : ℕ hn : 0 < n h : ↑(4 ^ n) ≤ ↑((2 * n) ^ (1 + Nat.sqrt (2 * n)) * 4 ^ Nat.pred (2 * n / 3)) ⊢ ↑(n + 2 * n) / 3 = ↑n
case this n : ℕ hn : 0 < n h : ↑(4 ^ n) ≤ ↑((2 * n) ^ (1 + Nat.sqrt (2 * n)) * 4 ^ Nat.pred (2 * n / 3)) ⊢ ↑(n * 3) / 3 = ↑n
https://github.com/jvlmdr/from_the_book.git
9fb6080539a2f32bb24719600a9e7531abf2328d
FromTheBook/Ch02/Bertrand/Bertrand.lean
rpowDivThreeLe
[24, 1]
[58, 62]
simp
case this n : ℕ hn : 0 < n h : ↑(4 ^ n) ≤ ↑((2 * n) ^ (1 + Nat.sqrt (2 * n)) * 4 ^ Nat.pred (2 * n / 3)) ⊢ ↑(n * 3) / 3 = ↑n
no goals
https://github.com/jvlmdr/from_the_book.git
9fb6080539a2f32bb24719600a9e7531abf2328d
FromTheBook/Ch02/Bertrand/Bertrand.lean
rpowDivThreeLe
[24, 1]
[58, 62]
apply ne_of_gt
case this n : ℕ hn : 0 < n h : ↑(4 ^ n) ≤ ↑((2 * n) ^ (1 + Nat.sqrt (2 * n)) * 4 ^ Nat.pred (2 * n / 3)) ⊢ 4 ^ (2 * ↑n / 3) ≠ 0
case this.h n : ℕ hn : 0 < n h : ↑(4 ^ n) ≤ ↑((2 * n) ^ (1 + Nat.sqrt (2 * n)) * 4 ^ Nat.pred (2 * n / 3)) ⊢ 0 < 4 ^ (2 * ↑n / 3)
https://github.com/jvlmdr/from_the_book.git
9fb6080539a2f32bb24719600a9e7531abf2328d
FromTheBook/Ch02/Bertrand/Bertrand.lean
rpowDivThreeLe
[24, 1]
[58, 62]
apply Real.rpow_pos_of_pos (by norm_num)
case this.h n : ℕ hn : 0 < n h : ↑(4 ^ n) ≤ ↑((2 * n) ^ (1 + Nat.sqrt (2 * n)) * 4 ^ Nat.pred (2 * n / 3)) ⊢ 0 < 4 ^ (2 * ↑n / 3)
no goals
https://github.com/jvlmdr/from_the_book.git
9fb6080539a2f32bb24719600a9e7531abf2328d
FromTheBook/Ch02/Bertrand/Bertrand.lean
rpowDivThreeLe
[24, 1]
[58, 62]
norm_num
n : ℕ hn : 0 < n h : ↑(4 ^ n) ≤ ↑((2 * n) ^ (1 + Nat.sqrt (2 * n)) * 4 ^ Nat.pred (2 * n / 3)) ⊢ 0 < 4
no goals
https://github.com/jvlmdr/from_the_book.git
9fb6080539a2f32bb24719600a9e7531abf2328d
FromTheBook/Ch02/Bertrand/Bertrand.lean
rpowDivThreeLe
[24, 1]
[58, 62]
linarith
n : ℕ hn : 0 < n h : ↑(4 ^ n) ≤ ↑((2 * n) ^ (1 + Nat.sqrt (2 * n)) * 4 ^ Nat.pred (2 * n / 3)) ⊢ n + 2 * n = n * 3
no goals
https://github.com/jvlmdr/from_the_book.git
9fb6080539a2f32bb24719600a9e7531abf2328d
FromTheBook/Ch02/Bertrand/Bertrand.lean
rpowDivThreeLe
[24, 1]
[58, 62]
apply Real.rpow_pos_of_pos
n : ℕ hn : 0 < n h : ↑(4 ^ n) ≤ ↑((2 * n) ^ (1 + Nat.sqrt (2 * n)) * 4 ^ Nat.pred (2 * n / 3)) ⊢ 0 < 4 ^ (2 * ↑n / 3)
case hx n : ℕ hn : 0 < n h : ↑(4 ^ n) ≤ ↑((2 * n) ^ (1 + Nat.sqrt (2 * n)) * 4 ^ Nat.pred (2 * n / 3)) ⊢ 0 < 4
https://github.com/jvlmdr/from_the_book.git
9fb6080539a2f32bb24719600a9e7531abf2328d
FromTheBook/Ch02/Bertrand/Bertrand.lean
rpowDivThreeLe
[24, 1]
[58, 62]
norm_num
case hx n : ℕ hn : 0 < n h : ↑(4 ^ n) ≤ ↑((2 * n) ^ (1 + Nat.sqrt (2 * n)) * 4 ^ Nat.pred (2 * n / 3)) ⊢ 0 < 4
no goals
https://github.com/jvlmdr/from_the_book.git
9fb6080539a2f32bb24719600a9e7531abf2328d
FromTheBook/Ch02/Bertrand/Bertrand.lean
rpowDivThreeLe
[24, 1]
[58, 62]
rw [← Real.rpow_nat_cast]
case h₁ n : ℕ hn : 0 < n ⊢ (2 * ↑n) ^ (1 + Nat.sqrt (2 * n)) ≤ (2 * ↑n) ^ (1 + Real.sqrt (2 * ↑n))
case h₁ n : ℕ hn : 0 < n ⊢ (2 * ↑n) ^ ↑(1 + Nat.sqrt (2 * n)) ≤ (2 * ↑n) ^ (1 + Real.sqrt (2 * ↑n))
https://github.com/jvlmdr/from_the_book.git
9fb6080539a2f32bb24719600a9e7531abf2328d
FromTheBook/Ch02/Bertrand/Bertrand.lean
rpowDivThreeLe
[24, 1]
[58, 62]
rw [Real.rpow_le_rpow_left_iff (by norm_cast; linarith)]
case h₁ n : ℕ hn : 0 < n ⊢ (2 * ↑n) ^ ↑(1 + Nat.sqrt (2 * n)) ≤ (2 * ↑n) ^ (1 + Real.sqrt (2 * ↑n))
case h₁ n : ℕ hn : 0 < n ⊢ ↑(1 + Nat.sqrt (2 * n)) ≤ 1 + Real.sqrt (2 * ↑n)
https://github.com/jvlmdr/from_the_book.git
9fb6080539a2f32bb24719600a9e7531abf2328d
FromTheBook/Ch02/Bertrand/Bertrand.lean
rpowDivThreeLe
[24, 1]
[58, 62]
simp [-Real.sqrt_mul']
case h₁ n : ℕ hn : 0 < n ⊢ ↑(1 + Nat.sqrt (2 * n)) ≤ 1 + Real.sqrt (2 * ↑n)
case h₁ n : ℕ hn : 0 < n ⊢ ↑(Nat.sqrt (2 * n)) ≤ Real.sqrt (2 * ↑n)
https://github.com/jvlmdr/from_the_book.git
9fb6080539a2f32bb24719600a9e7531abf2328d
FromTheBook/Ch02/Bertrand/Bertrand.lean
rpowDivThreeLe
[24, 1]
[58, 62]
norm_cast
case h₁ n : ℕ hn : 0 < n ⊢ ↑(Nat.sqrt (2 * n)) ≤ Real.sqrt (2 * ↑n)
case h₁ n : ℕ hn : 0 < n ⊢ ↑(Nat.sqrt (2 * n)) ≤ Real.sqrt ↑(2 * n)
https://github.com/jvlmdr/from_the_book.git
9fb6080539a2f32bb24719600a9e7531abf2328d
FromTheBook/Ch02/Bertrand/Bertrand.lean
rpowDivThreeLe
[24, 1]
[58, 62]
apply Real.nat_sqrt_le_real_sqrt
case h₁ n : ℕ hn : 0 < n ⊢ ↑(Nat.sqrt (2 * n)) ≤ Real.sqrt ↑(2 * n)
no goals
https://github.com/jvlmdr/from_the_book.git
9fb6080539a2f32bb24719600a9e7531abf2328d
FromTheBook/Ch02/Bertrand/Bertrand.lean
rpowDivThreeLe
[24, 1]
[58, 62]
norm_cast
n : ℕ hn : 0 < n ⊢ 1 < 2 * ↑n
n : ℕ hn : 0 < n ⊢ 1 < 2 * n
https://github.com/jvlmdr/from_the_book.git
9fb6080539a2f32bb24719600a9e7531abf2328d
FromTheBook/Ch02/Bertrand/Bertrand.lean
rpowDivThreeLe
[24, 1]
[58, 62]
linarith
n : ℕ hn : 0 < n ⊢ 1 < 2 * n
no goals
https://github.com/jvlmdr/from_the_book.git
9fb6080539a2f32bb24719600a9e7531abf2328d
FromTheBook/Ch02/Bertrand/Bertrand.lean
rpowDivThreeLe
[24, 1]
[58, 62]
rw [← Real.rpow_nat_cast]
case h₂ n : ℕ hn : 0 < n ⊢ 4 ^ Nat.pred (2 * n / 3) ≤ 4 ^ (2 * ↑n / 3)
case h₂ n : ℕ hn : 0 < n ⊢ 4 ^ ↑(Nat.pred (2 * n / 3)) ≤ 4 ^ (2 * ↑n / 3)
https://github.com/jvlmdr/from_the_book.git
9fb6080539a2f32bb24719600a9e7531abf2328d
FromTheBook/Ch02/Bertrand/Bertrand.lean
rpowDivThreeLe
[24, 1]
[58, 62]
rw [Real.rpow_le_rpow_left_iff (by norm_cast)]
case h₂ n : ℕ hn : 0 < n ⊢ 4 ^ ↑(Nat.pred (2 * n / 3)) ≤ 4 ^ (2 * ↑n / 3)
case h₂ n : ℕ hn : 0 < n ⊢ ↑(Nat.pred (2 * n / 3)) ≤ 2 * ↑n / 3
https://github.com/jvlmdr/from_the_book.git
9fb6080539a2f32bb24719600a9e7531abf2328d
FromTheBook/Ch02/Bertrand/Bertrand.lean
rpowDivThreeLe
[24, 1]
[58, 62]
rw [le_div_iff (by norm_num)]
case h₂ n : ℕ hn : 0 < n ⊢ ↑(Nat.pred (2 * n / 3)) ≤ 2 * ↑n / 3
case h₂ n : ℕ hn : 0 < n ⊢ ↑(Nat.pred (2 * n / 3)) * 3 ≤ 2 * ↑n
https://github.com/jvlmdr/from_the_book.git
9fb6080539a2f32bb24719600a9e7531abf2328d
FromTheBook/Ch02/Bertrand/Bertrand.lean
rpowDivThreeLe
[24, 1]
[58, 62]
norm_cast
case h₂ n : ℕ hn : 0 < n ⊢ ↑(Nat.pred (2 * n / 3)) * 3 ≤ 2 * ↑n
case h₂ n : ℕ hn : 0 < n ⊢ Nat.pred (2 * n / 3) * 3 ≤ 2 * n
https://github.com/jvlmdr/from_the_book.git
9fb6080539a2f32bb24719600a9e7531abf2328d
FromTheBook/Ch02/Bertrand/Bertrand.lean
rpowDivThreeLe
[24, 1]
[58, 62]
apply Nat.le_trans (Nat.mul_le_mul_right 3 (Nat.pred_le _))
case h₂ n : ℕ hn : 0 < n ⊢ Nat.pred (2 * n / 3) * 3 ≤ 2 * n
case h₂ n : ℕ hn : 0 < n ⊢ 2 * n / 3 * 3 ≤ 2 * n
https://github.com/jvlmdr/from_the_book.git
9fb6080539a2f32bb24719600a9e7531abf2328d
FromTheBook/Ch02/Bertrand/Bertrand.lean
rpowDivThreeLe
[24, 1]
[58, 62]
apply Nat.div_mul_le_self
case h₂ n : ℕ hn : 0 < n ⊢ 2 * n / 3 * 3 ≤ 2 * n
no goals
https://github.com/jvlmdr/from_the_book.git
9fb6080539a2f32bb24719600a9e7531abf2328d
FromTheBook/Ch02/Bertrand/Bertrand.lean
rpowDivThreeLe
[24, 1]
[58, 62]
norm_cast
n : ℕ hn : 0 < n ⊢ 1 < 4
no goals
https://github.com/jvlmdr/from_the_book.git
9fb6080539a2f32bb24719600a9e7531abf2328d
FromTheBook/Ch02/Bertrand/Bertrand.lean
rpowDivThreeLe
[24, 1]
[58, 62]
norm_num
n : ℕ hn : 0 < n ⊢ 0 < 3
no goals
https://github.com/jvlmdr/from_the_book.git
9fb6080539a2f32bb24719600a9e7531abf2328d
FromTheBook/Ch02/Bertrand/Bertrand.lean
rpowDivThreeLe
[24, 1]
[58, 62]
apply pow_nonneg (by norm_num)
case c0 n : ℕ hn : 0 < n ⊢ 0 ≤ 4 ^ Nat.pred (2 * n / 3)
no goals
https://github.com/jvlmdr/from_the_book.git
9fb6080539a2f32bb24719600a9e7531abf2328d
FromTheBook/Ch02/Bertrand/Bertrand.lean
rpowDivThreeLe
[24, 1]
[58, 62]
norm_num
n : ℕ hn : 0 < n ⊢ 0 ≤ 4
no goals
https://github.com/jvlmdr/from_the_book.git
9fb6080539a2f32bb24719600a9e7531abf2328d
FromTheBook/Ch02/Bertrand/Bertrand.lean
rpowDivThreeLe
[24, 1]
[58, 62]
apply Real.rpow_nonneg_of_nonneg (by norm_cast; linarith)
case b0 n : ℕ hn : 0 < n ⊢ 0 ≤ (2 * ↑n) ^ (1 + Real.sqrt (2 * ↑n))
no goals
https://github.com/jvlmdr/from_the_book.git
9fb6080539a2f32bb24719600a9e7531abf2328d
FromTheBook/Ch02/Bertrand/Bertrand.lean
rpowDivThreeLe
[24, 1]
[58, 62]
norm_cast
n : ℕ hn : 0 < n ⊢ 0 ≤ 2 * ↑n
n : ℕ hn : 0 < n ⊢ 0 ≤ 2 * n
https://github.com/jvlmdr/from_the_book.git
9fb6080539a2f32bb24719600a9e7531abf2328d
FromTheBook/Ch02/Bertrand/Bertrand.lean
rpowDivThreeLe
[24, 1]
[58, 62]
linarith
n : ℕ hn : 0 < n ⊢ 0 ≤ 2 * n
no goals
https://github.com/jvlmdr/from_the_book.git
9fb6080539a2f32bb24719600a9e7531abf2328d
FromTheBook/Ch02/Bertrand/Bertrand.lean
succLtTwoPow
[60, 1]
[71, 38]
replace h2 := Nat.exists_eq_add_of_le h2
a : ℕ h2 : 2 ≤ a ⊢ Nat.succ a < 2 ^ a
a : ℕ h2 : ∃ k, a = 2 + k ⊢ Nat.succ a < 2 ^ a
https://github.com/jvlmdr/from_the_book.git
9fb6080539a2f32bb24719600a9e7531abf2328d
FromTheBook/Ch02/Bertrand/Bertrand.lean
succLtTwoPow
[60, 1]
[71, 38]
cases h2 with | intro u hu => rw [hu] clear a hu induction u with | zero => simp | succ u h => rw [Nat.add_succ, Nat.pow_succ, Nat.mul_two] rw [← Nat.add_one] apply Nat.add_lt_add h apply Nat.one_lt_pow <;> linarith
a : ℕ h2 : ∃ k, a = 2 + k ⊢ Nat.succ a < 2 ^ a
no goals
https://github.com/jvlmdr/from_the_book.git
9fb6080539a2f32bb24719600a9e7531abf2328d
FromTheBook/Ch02/Bertrand/Bertrand.lean
succLtTwoPow
[60, 1]
[71, 38]
rw [hu]
case intro a u : ℕ hu : a = 2 + u ⊢ Nat.succ a < 2 ^ a
case intro a u : ℕ hu : a = 2 + u ⊢ Nat.succ (2 + u) < 2 ^ (2 + u)
https://github.com/jvlmdr/from_the_book.git
9fb6080539a2f32bb24719600a9e7531abf2328d
FromTheBook/Ch02/Bertrand/Bertrand.lean
succLtTwoPow
[60, 1]
[71, 38]
clear a hu
case intro a u : ℕ hu : a = 2 + u ⊢ Nat.succ (2 + u) < 2 ^ (2 + u)
case intro u : ℕ ⊢ Nat.succ (2 + u) < 2 ^ (2 + u)
https://github.com/jvlmdr/from_the_book.git
9fb6080539a2f32bb24719600a9e7531abf2328d
FromTheBook/Ch02/Bertrand/Bertrand.lean
succLtTwoPow
[60, 1]
[71, 38]
induction u with | zero => simp | succ u h => rw [Nat.add_succ, Nat.pow_succ, Nat.mul_two] rw [← Nat.add_one] apply Nat.add_lt_add h apply Nat.one_lt_pow <;> linarith
case intro u : ℕ ⊢ Nat.succ (2 + u) < 2 ^ (2 + u)
no goals
https://github.com/jvlmdr/from_the_book.git
9fb6080539a2f32bb24719600a9e7531abf2328d
FromTheBook/Ch02/Bertrand/Bertrand.lean
succLtTwoPow
[60, 1]
[71, 38]
simp
case intro.zero ⊢ Nat.succ (2 + Nat.zero) < 2 ^ (2 + Nat.zero)
no goals
https://github.com/jvlmdr/from_the_book.git
9fb6080539a2f32bb24719600a9e7531abf2328d
FromTheBook/Ch02/Bertrand/Bertrand.lean
succLtTwoPow
[60, 1]
[71, 38]
rw [Nat.add_succ, Nat.pow_succ, Nat.mul_two]
case intro.succ u : ℕ h : Nat.succ (2 + u) < 2 ^ (2 + u) ⊢ Nat.succ (2 + Nat.succ u) < 2 ^ (2 + Nat.succ u)
case intro.succ u : ℕ h : Nat.succ (2 + u) < 2 ^ (2 + u) ⊢ Nat.succ (Nat.succ (2 + u)) < 2 ^ (2 + u) + 2 ^ (2 + u)
https://github.com/jvlmdr/from_the_book.git
9fb6080539a2f32bb24719600a9e7531abf2328d
FromTheBook/Ch02/Bertrand/Bertrand.lean
succLtTwoPow
[60, 1]
[71, 38]
rw [← Nat.add_one]
case intro.succ u : ℕ h : Nat.succ (2 + u) < 2 ^ (2 + u) ⊢ Nat.succ (Nat.succ (2 + u)) < 2 ^ (2 + u) + 2 ^ (2 + u)
case intro.succ u : ℕ h : Nat.succ (2 + u) < 2 ^ (2 + u) ⊢ 2 + u + 1 + 1 < 2 ^ (2 + u) + 2 ^ (2 + u)
https://github.com/jvlmdr/from_the_book.git
9fb6080539a2f32bb24719600a9e7531abf2328d
FromTheBook/Ch02/Bertrand/Bertrand.lean
succLtTwoPow
[60, 1]
[71, 38]
apply Nat.add_lt_add h
case intro.succ u : ℕ h : Nat.succ (2 + u) < 2 ^ (2 + u) ⊢ 2 + u + 1 + 1 < 2 ^ (2 + u) + 2 ^ (2 + u)
case intro.succ u : ℕ h : Nat.succ (2 + u) < 2 ^ (2 + u) ⊢ 1 < 2 ^ (2 + u)