@@ -53,10 +53,9 @@ open MiuAtom List Nat
5353where `count I w` is a power of 2.
5454-/
5555private theorem der_cons_replicate (n : ℕ) : Derivable (M :: replicate (2 ^ n) I) := by
56- induction' n with k hk
57- · -- base case
58- constructor
59- · -- inductive step
56+ induction n with
57+ | zero => constructor
58+ | succ k hk =>
6059 rw [pow_add, pow_one 2 , mul_two, replicate_add]
6160 exact Derivable.r2 hk
6261
@@ -84,10 +83,12 @@ to produce another `Derivable` `Miustr`.
8483-/
8584theorem der_of_der_append_replicate_U_even {z : Miustr} {m : ℕ}
8685 (h : Derivable (z ++ ↑(replicate (m * 2 ) U))) : Derivable z := by
87- induction' m with k hk
88- · revert h
86+ induction m with
87+ | zero =>
88+ revert h
8989 rw [replicate, append_nil]; exact id
90- · apply hk
90+ | succ k hk =>
91+ apply hk
9192 simp only [succ_mul, replicate_add] at h
9293 rw [← append_nil ↑(z ++ ↑(replicate (k * 2 ) U))]
9394 apply Derivable.r4
@@ -109,9 +110,11 @@ theorem der_cons_replicate_I_replicate_U_append_of_der_cons_replicate_I_append (
109110 (hder : Derivable (↑(M :: replicate (c + 3 * k) I) ++ xs)) :
110111 Derivable (↑(M :: (replicate c I ++ replicate k U)) ++ xs) := by
111112 revert xs
112- induction' k with a ha
113- · simp only [replicate, zero_eq, mul_zero, add_zero, append_nil, forall_true_iff, imp_self]
114- · intro xs
113+ induction k with
114+ | zero =>
115+ simp only [replicate, zero_eq, mul_zero, add_zero, append_nil, forall_true_iff, imp_self]
116+ | succ a ha =>
117+ intro xs
115118 specialize ha (U :: xs)
116119 intro h₂
117120 -- We massage the goal into a form amenable to the application of `ha`.
@@ -141,18 +144,20 @@ theorem add_mod2 (a : ℕ) : ∃ t, a + a % 2 = t * 2 := by
141144
142145private theorem le_pow2_and_pow2_eq_mod3' (c : ℕ) (x : ℕ) (h : c = 1 ∨ c = 2 ) :
143146 ∃ m : ℕ, c + 3 * x ≤ 2 ^ m ∧ 2 ^ m % 3 = c % 3 := by
144- induction' x with k hk
145- · use c + 1
147+ induction x with
148+ | zero =>
149+ use c + 1
146150 rcases h with hc | hc <;> · rw [hc]; norm_num
147- rcases hk with ⟨g, hkg, hgmod⟩
148- by_cases hp : c + 3 * (k + 1 ) ≤ 2 ^ g
149- · use g, hp, hgmod
150- refine ⟨g + 2 , ?_, ?_⟩
151- · rw [mul_succ, ← add_assoc, pow_add]
152- change c + 3 * k + 3 ≤ 2 ^ g * (1 + 3 ); rw [mul_add (2 ^ g) 1 3 , mul_one]
153- linarith [hkg, @Nat.one_le_two_pow g]
154- · rw [pow_add, ← mul_one c]
155- exact ModEq.mul hgmod rfl
151+ | succ k hk =>
152+ rcases hk with ⟨g, hkg, hgmod⟩
153+ by_cases hp : c + 3 * (k + 1 ) ≤ 2 ^ g
154+ · use g, hp, hgmod
155+ refine ⟨g + 2 , ?_, ?_⟩
156+ · rw [mul_succ, ← add_assoc, pow_add]
157+ change c + 3 * k + 3 ≤ 2 ^ g * (1 + 3 ); rw [mul_add (2 ^ g) 1 3 , mul_one]
158+ linarith [hkg, @Nat.one_le_two_pow g]
159+ · rw [pow_add, ← mul_one c]
160+ exact ModEq.mul hgmod rfl
156161
157162/-- If `a` is 1 or 2 modulo 3, then exists `k` a power of 2 for which `a ≤ k` and `a ≡ k [MOD 3]`.
158163-/
@@ -245,9 +250,10 @@ conditions under which `count I ys = length ys`.
245250-/
246251theorem count_I_eq_length_of_count_U_zero_and_neg_mem {ys : Miustr} (hu : count U ys = 0 )
247252 (hm : M ∉ ys) : count I ys = length ys := by
248- induction' ys with x xs hxs
249- · rfl
250- · cases x
253+ induction ys with
254+ | nil => rfl
255+ | cons x xs hxs =>
256+ cases x
251257 · -- case `x = M` gives a contradiction.
252258 exfalso; exact hm mem_cons_self
253259 · -- case `x = I`
@@ -282,9 +288,10 @@ relate to `count U`.
282288
283289
284290theorem mem_of_count_U_eq_succ {xs : Miustr} {k : ℕ} (h : count U xs = succ k) : U ∈ xs := by
285- induction' xs with z zs hzs
286- · exfalso; rw [count] at h; contradiction
287- · rw [mem_cons]
291+ induction xs with
292+ | nil => exfalso; rw [count] at h; contradiction
293+ | cons z zs hzs =>
294+ rw [mem_cons]
288295 cases z <;> try exact Or.inl rfl
289296 all_goals right; simp only [count_cons, if_false] at h; exact hzs h
290297
@@ -327,11 +334,10 @@ theorem der_of_decstr {en : Miustr} (h : Decstr en) : Derivable en := by
327334 for induction -/
328335 have hu : ∃ n, count U en = n := exists_eq'
329336 obtain ⟨n, hu⟩ := hu
330- revert en -- Crucially, we need the induction hypothesis to quantify over `en`
331- induction' n with k hk
332- · exact base_case_suf _
333- · intro ys hdec hus
334- rcases ind_hyp_suf k ys hus hdec with ⟨as, bs, hyab, habuc, hdecab⟩
337+ induction n generalizing en with
338+ | zero => exact base_case_suf _ h hu
339+ | succ k hk =>
340+ rcases ind_hyp_suf k en hu h with ⟨as, bs, hyab, habuc, hdecab⟩
335341 have h₂ : Derivable (↑(M :: as) ++ ↑[I, I, I] ++ bs) := hk hdecab habuc
336342 rw [hyab]
337343 exact Derivable.r3 h₂
0 commit comments