@@ -37,8 +37,7 @@ def step.continuous : Continuous step where
3737theorem step.minimalPeriod_one : step.minimalPeriod 1 = 3 := by
3838 apply Function.minimalPeriod_eq_prime <;> decide
3939
40- theorem step.one_had_period_3 : step.IsPeriodicPt 3 1 := by
41- decide
40+ theorem step.one_had_period_3 : step.IsPeriodicPt 3 1 := by decide
4241
4342theorem step.isPeriodicPt_one : 1 ∈ step.periodicPts := by
4443 rw [Function.mem_periodicPts]
@@ -96,7 +95,7 @@ def GoesTo.flow : Flow ℕ ℕ :=
9695theorem GoesTo.even_path : (n * 2 ) |=> n := ⟨1 , by simp [step]⟩
9796
9897
99- theorem GoesTo.odd_path : n ≡ 4 [MOD 6 ] -> (n - 1 ) / 3 |=> n := by
98+ theorem GoesTo.odd_path : n ≡ 4 [MOD 6 ] -> (n - 1 ) / 3 |=> n := by
10099 intro hm
101100 have : ¬Even ((n-1 )/3 ) := by
102101 apply Nat.not_even_iff_odd.mpr
@@ -109,15 +108,13 @@ theorem GoesTo.odd_path: n ≡ 4 [MOD 6] -> (n - 1) / 3 |=> n := by
109108 rw [Nat.add_one]
110109 simpa
111110 calc (Nat.succ k - 1 ) / 3 % 2
112- _ = k / 3 % 2 := by simp
113- _ = k % 6 / 3 := by
114- -- rw [ Nat.div_mod_eq_mod_mul_div ] -- This theorem is gone now :/
115- sorry
111+ _ = k / 3 % 2 := by omega
112+ _ = k % 6 / 3 := by omega
116113 _ = 3 % 6 / 3 := by rw [hm']
117114 _ = 1 := by norm_num
118115 have onelen : 1 ≤ n := by
119116 calc
120- _ ≤ 4 := by simp
117+ _ ≤ 4 := by decide
121118 _ = 4 % 6 := by decide
122119 _ = n % 6 := by rw [hm]
123120 _ ≤ n := Nat.mod_le n 6
@@ -126,19 +123,17 @@ theorem GoesTo.odd_path: n ≡ 4 [MOD 6] -> (n - 1) / 3 |=> n := by
126123 rw [Nat.ModEq.comm] at hm
127124 apply Nat.ModEq.of_dvd ((by decide): 3 ∣ 6 ) hm
128125 use 1
129- rw [Function.iterate_one, step, if_neg this, Nat.mul_div_cancel' three_dvd_n_sub_one, Nat.sub_add_cancel onelen]
130-
131- theorem GoesTo.even_family : ∀k, (n * 2 ^k) |=> n := by sorry
132-
133- -- -- Complains that this does not terminate
134- -- theorem GoesTo.even_family : ∀k, (n * 2^k) |=> n := by
135- -- rintro (_ | i)
136- -- · simp; rfl
137- -- · calc n * 2 ^ Nat.succ i
138- -- _ = n * 2 ^ i * 2 := by rw [Nat.pow_succ, <- mul_assoc]
139- -- _ |=> n * 2 ^ i := even_path
140- -- _ |=> _ := by
141- -- apply even_family _
126+ rw [Function.iterate_one, step, if_neg this,
127+ Nat.mul_div_cancel' three_dvd_n_sub_one, Nat.sub_add_cancel onelen]
128+
129+ theorem GoesTo.even_family : ∀k, (n * 2 ^k) |=> n := by
130+ intro k
131+ induction' k with i hi
132+ · rw [pow_zero, mul_one]
133+ · calc n * 2 ^ Nat.succ i
134+ _ = n * 2 ^ i * 2 := by rw [Nat.pow_succ, <- mul_assoc]
135+ _ |=> n * 2 ^ i := even_path
136+ _ |=> n := hi
142137
143138theorem GoesTo.odd_family : n ≡ 1 [MOD 6 ] -> ∀k, (n * 2 ^(2 *k+2 ) - 1 )/3 |=> n := by
144139 intro hn k
0 commit comments