File tree Expand file tree Collapse file tree 1 file changed +21
-3
lines changed Expand file tree Collapse file tree 1 file changed +21
-3
lines changed Original file line number Diff line number Diff line change @@ -28,10 +28,28 @@ def segment (n : ℕ) : ℕ := match n with
28
28
have order : 2 * n' - 2 < n := by
29
29
simp [n'_def]
30
30
by_cases n_le_1 : n ≤ 1
31
- · sorry
32
- · --
31
+ · have cases : n = 0 ∨ n = 1 := by exact le_one_iff_eq_zero_or_eq_one.mp n_le_1
32
+ rcases cases with n_eq_0|n_eq_1
33
+ · simp [n_eq_0, size, binaryRec] at *
34
+ simp [n'_def] at h
35
+ · simp [n_eq_1, size, binaryRec] at *
36
+ · have n_ge_2 : n ≥ 2 := by
37
+ have : n > 1 := by exact Nat.lt_of_not_le n_le_1
38
+ exact this
39
+ have nsize2 : (n + 2 ).size ≥ 2 := by
40
+ have t1 : (n + 2 ).size ≥ (2 + 2 ).size := by
41
+ refine size_le_size ?_
42
+ · exact Nat.add_le_add_right n_ge_2 2
43
+ have t2 : (2 + 2 ).size = 3 := by simp [size, binaryRec]
44
+ simp [t2] at t1
45
+ exact le_of_add_left_le t1
33
46
have : 2 * 2 ^ ((n + 2 ).size - 2 ) = 2 ^ ((n + 2 ).size - 1 ) := by
34
- sorry
47
+ have : 2 * 2 ^ ((n + 2 ).size - 2 ) = 2 ^ ((n + 2 ).size - 2 + 1 ) := by
48
+ exact Eq.symm Nat.pow_succ'
49
+ simp [this]
50
+ rw [add_comm]
51
+ refine Eq.symm ((fun {b a c} h ↦ (Nat.sub_eq_iff_eq_add' h).mp) ?_ rfl)
52
+ · exact le_sub_one_of_lt nsize2
35
53
simp [this]
36
54
replace :(n + 2 ).size = n.size := by sorry
37
55
simp [this]
You can’t perform that action at this time.
0 commit comments