[GOAL]
α : Type u_1
inst✝ : OrderedAddCommGroup α
a b c : α
⊢ (fun x => a + x) ⁻¹' Icc b c = Icc (b - a) (c - a)
[PROOFSTEP]
simp [← Ici_inter_Iic]
[GOAL]
α : Type u_1
inst✝ : OrderedAddCommGroup α
a b c : α
⊢ (fun x => a + x) ⁻¹' Ico b c = Ico (b - a) (c - a)
[PROOFSTEP]
simp [← Ici_inter_Iio]
[GOAL]
α : Type u_1
inst✝ : OrderedAddCommGroup α
a b c : α
⊢ (fun x => a + x) ⁻¹' Ioc b c = Ioc (b - a) (c - a)
[PROOFSTEP]
simp [← Ioi_inter_Iic]
[GOAL]
α : Type u_1
inst✝ : OrderedAddCommGroup α
a b c : α
⊢ (fun x => a + x) ⁻¹' Ioo b c = Ioo (b - a) (c - a)
[PROOFSTEP]
simp [← Ioi_inter_Iio]
[GOAL]
α : Type u_1
inst✝ : OrderedAddCommGroup α
a b c : α
⊢ (fun x => x + a) ⁻¹' Icc b c = Icc (b - a) (c - a)
[PROOFSTEP]
simp [← Ici_inter_Iic]
[GOAL]
α : Type u_1
inst✝ : OrderedAddCommGroup α
a b c : α
⊢ (fun x => x + a) ⁻¹' Ico b c = Ico (b - a) (c - a)
[PROOFSTEP]
simp [← Ici_inter_Iio]
[GOAL]
α : Type u_1
inst✝ : OrderedAddCommGroup α
a b c : α
⊢ (fun x => x + a) ⁻¹' Ioc b c = Ioc (b - a) (c - a)
[PROOFSTEP]
simp [← Ioi_inter_Iic]
[GOAL]
α : Type u_1
inst✝ : OrderedAddCommGroup α
a b c : α
⊢ (fun x => x + a) ⁻¹' Ioo b c = Ioo (b - a) (c - a)
[PROOFSTEP]
simp [← Ioi_inter_Iio]
[GOAL]
α : Type u_1
inst✝ : OrderedAddCommGroup α
a b c : α
⊢ -Icc a b = Icc (-b) (-a)
[PROOFSTEP]
simp [← Ici_inter_Iic, inter_comm]
[GOAL]
α : Type u_1
inst✝ : OrderedAddCommGroup α
a b c : α
⊢ -Ico a b = Ioc (-b) (-a)
[PROOFSTEP]
simp [← Ici_inter_Iio, ← Ioi_inter_Iic, inter_comm]
[GOAL]
α : Type u_1
inst✝ : OrderedAddCommGroup α
a b c : α
⊢ -Ioc a b = Ico (-b) (-a)
[PROOFSTEP]
simp [← Ioi_inter_Iic, ← Ici_inter_Iio, inter_comm]
[GOAL]
α : Type u_1
inst✝ : OrderedAddCommGroup α
a b c : α
⊢ -Ioo a b = Ioo (-b) (-a)
[PROOFSTEP]
simp [← Ioi_inter_Iio, inter_comm]
[GOAL]
α : Type u_1
inst✝ : OrderedAddCommGroup α
a b c : α
⊢ (fun x => x - a) ⁻¹' Ici b = Ici (b + a)
[PROOFSTEP]
simp [sub_eq_add_neg]
[GOAL]
α : Type u_1
inst✝ : OrderedAddCommGroup α
a b c : α
⊢ (fun x => x - a) ⁻¹' Ioi b = Ioi (b + a)
[PROOFSTEP]
simp [sub_eq_add_neg]
[GOAL]
α : Type u_1
inst✝ : OrderedAddCommGroup α
a b c : α
⊢ (fun x => x - a) ⁻¹' Iic b = Iic (b + a)
[PROOFSTEP]
simp [sub_eq_add_neg]
[GOAL]
α : Type u_1
inst✝ : OrderedAddCommGroup α
a b c : α
⊢ (fun x => x - a) ⁻¹' Iio b = Iio (b + a)
[PROOFSTEP]
simp [sub_eq_add_neg]
[GOAL]
α : Type u_1
inst✝ : OrderedAddCommGroup α
a b c : α
⊢ (fun x => x - a) ⁻¹' Icc b c = Icc (b + a) (c + a)
[PROOFSTEP]
simp [sub_eq_add_neg]
[GOAL]
α : Type u_1
inst✝ : OrderedAddCommGroup α
a b c : α
⊢ (fun x => x - a) ⁻¹' Ico b c = Ico (b + a) (c + a)
[PROOFSTEP]
simp [sub_eq_add_neg]
[GOAL]
α : Type u_1
inst✝ : OrderedAddCommGroup α
a b c : α
⊢ (fun x => x - a) ⁻¹' Ioc b c = Ioc (b + a) (c + a)
[PROOFSTEP]
simp [sub_eq_add_neg]
[GOAL]
α : Type u_1
inst✝ : OrderedAddCommGroup α
a b c : α
⊢ (fun x => x - a) ⁻¹' Ioo b c = Ioo (b + a) (c + a)
[PROOFSTEP]
simp [sub_eq_add_neg]
[GOAL]
α : Type u_1
inst✝ : OrderedAddCommGroup α
a b c : α
⊢ (fun x => a - x) ⁻¹' Icc b c = Icc (a - c) (a - b)
[PROOFSTEP]
simp [← Ici_inter_Iic, inter_comm]
[GOAL]
α : Type u_1
inst✝ : OrderedAddCommGroup α
a b c : α
⊢ (fun x => a - x) ⁻¹' Ico b c = Ioc (a - c) (a - b)
[PROOFSTEP]
simp [← Ioi_inter_Iic, ← Ici_inter_Iio, inter_comm]
[GOAL]
α : Type u_1
inst✝ : OrderedAddCommGroup α
a b c : α
⊢ (fun x => a - x) ⁻¹' Ioc b c = Ico (a - c) (a - b)
[PROOFSTEP]
simp [← Ioi_inter_Iic, ← Ici_inter_Iio, inter_comm]
[GOAL]
α : Type u_1
inst✝ : OrderedAddCommGroup α
a b c : α
⊢ (fun x => a - x) ⁻¹' Ioo b c = Ioo (a - c) (a - b)
[PROOFSTEP]
simp [← Ioi_inter_Iio, inter_comm]
[GOAL]
α : Type u_1
inst✝ : OrderedAddCommGroup α
a b c : α
⊢ (fun x => a + x) '' Iic b = Iic (a + b)
[PROOFSTEP]
simp [add_comm]
[GOAL]
α : Type u_1
inst✝ : OrderedAddCommGroup α
a b c : α
⊢ (fun x => a + x) '' Iio b = Iio (a + b)
[PROOFSTEP]
simp [add_comm]
[GOAL]
α : Type u_1
inst✝ : OrderedAddCommGroup α
a b c : α
⊢ (fun x => x + a) '' Iic b = Iic (b + a)
[PROOFSTEP]
simp
[GOAL]
α : Type u_1
inst✝ : OrderedAddCommGroup α
a b c : α
⊢ (fun x => x + a) '' Iio b = Iio (b + a)
[PROOFSTEP]
simp
[GOAL]
α : Type u_1
inst✝ : OrderedAddCommGroup α
a b c : α
⊢ Neg.neg '' Ici a = Iic (-a)
[PROOFSTEP]
simp
[GOAL]
α : Type u_1
inst✝ : OrderedAddCommGroup α
a b c : α
⊢ Neg.neg '' Iic a = Ici (-a)
[PROOFSTEP]
simp
[GOAL]
α : Type u_1
inst✝ : OrderedAddCommGroup α
a b c : α
⊢ Neg.neg '' Ioi a = Iio (-a)
[PROOFSTEP]
simp
[GOAL]
α : Type u_1
inst✝ : OrderedAddCommGroup α
a b c : α
⊢ Neg.neg '' Iio a = Ioi (-a)
[PROOFSTEP]
simp
[GOAL]
α : Type u_1
inst✝ : OrderedAddCommGroup α
a b c : α
⊢ Neg.neg '' Icc a b = Icc (-b) (-a)
[PROOFSTEP]
simp
[GOAL]
α : Type u_1
inst✝ : OrderedAddCommGroup α
a b c : α
⊢ Neg.neg '' Ico a b = Ioc (-b) (-a)
[PROOFSTEP]
simp
[GOAL]
α : Type u_1
inst✝ : OrderedAddCommGroup α
a b c : α
⊢ Neg.neg '' Ioc a b = Ico (-b) (-a)
[PROOFSTEP]
simp
[GOAL]
α : Type u_1
inst✝ : OrderedAddCommGroup α
a b c : α
⊢ Neg.neg '' Ioo a b = Ioo (-b) (-a)
[PROOFSTEP]
simp
[GOAL]
α : Type u_1
inst✝ : OrderedAddCommGroup α
a b c : α
⊢ (fun x => a - x) '' Ici b = Iic (a - b)
[PROOFSTEP]
have := image_comp (fun x => a + x) fun x => -x
[GOAL]
α : Type u_1
inst✝ : OrderedAddCommGroup α
a b c : α
this : ∀ (a_1 : Set α), ((fun x => a + x) ∘ fun x => -x) '' a_1 = (fun x => a + x) '' ((fun x => -x) '' a_1)
⊢ (fun x => a - x) '' Ici b = Iic (a - b)
[PROOFSTEP]
dsimp [Function.comp] at this
[GOAL]
α : Type u_1
inst✝ : OrderedAddCommGroup α
a b c : α
this : ∀ (a_1 : Set α), (fun x => a + -x) '' a_1 = (fun x => a + x) '' ((fun x => -x) '' a_1)
⊢ (fun x => a - x) '' Ici b = Iic (a - b)
[PROOFSTEP]
simp [sub_eq_add_neg, this, add_comm]
[GOAL]
α : Type u_1
inst✝ : OrderedAddCommGroup α
a b c : α
⊢ (fun x => a - x) '' Iic b = Ici (a - b)
[PROOFSTEP]
have := image_comp (fun x => a + x) fun x => -x
[GOAL]
α : Type u_1
inst✝ : OrderedAddCommGroup α
a b c : α
this : ∀ (a_1 : Set α), ((fun x => a + x) ∘ fun x => -x) '' a_1 = (fun x => a + x) '' ((fun x => -x) '' a_1)
⊢ (fun x => a - x) '' Iic b = Ici (a - b)
[PROOFSTEP]
dsimp [Function.comp] at this
[GOAL]
α : Type u_1
inst✝ : OrderedAddCommGroup α
a b c : α
this : ∀ (a_1 : Set α), (fun x => a + -x) '' a_1 = (fun x => a + x) '' ((fun x => -x) '' a_1)
⊢ (fun x => a - x) '' Iic b = Ici (a - b)
[PROOFSTEP]
simp [sub_eq_add_neg, this, add_comm]
[GOAL]
α : Type u_1
inst✝ : OrderedAddCommGroup α
a b c : α
⊢ (fun x => a - x) '' Ioi b = Iio (a - b)
[PROOFSTEP]
have := image_comp (fun x => a + x) fun x => -x
[GOAL]
α : Type u_1
inst✝ : OrderedAddCommGroup α
a b c : α
this : ∀ (a_1 : Set α), ((fun x => a + x) ∘ fun x => -x) '' a_1 = (fun x => a + x) '' ((fun x => -x) '' a_1)
⊢ (fun x => a - x) '' Ioi b = Iio (a - b)
[PROOFSTEP]
dsimp [Function.comp] at this
[GOAL]
α : Type u_1
inst✝ : OrderedAddCommGroup α
a b c : α
this : ∀ (a_1 : Set α), (fun x => a + -x) '' a_1 = (fun x => a + x) '' ((fun x => -x) '' a_1)
⊢ (fun x => a - x) '' Ioi b = Iio (a - b)
[PROOFSTEP]
simp [sub_eq_add_neg, this, add_comm]
[GOAL]
α : Type u_1
inst✝ : OrderedAddCommGroup α
a b c : α
⊢ (fun x => a - x) '' Iio b = Ioi (a - b)
[PROOFSTEP]
have := image_comp (fun x => a + x) fun x => -x
[GOAL]
α : Type u_1
inst✝ : OrderedAddCommGroup α
a b c : α
this : ∀ (a_1 : Set α), ((fun x => a + x) ∘ fun x => -x) '' a_1 = (fun x => a + x) '' ((fun x => -x) '' a_1)
⊢ (fun x => a - x) '' Iio b = Ioi (a - b)
[PROOFSTEP]
dsimp [Function.comp] at this
[GOAL]
α : Type u_1
inst✝ : OrderedAddCommGroup α
a b c : α
this : ∀ (a_1 : Set α), (fun x => a + -x) '' a_1 = (fun x => a + x) '' ((fun x => -x) '' a_1)
⊢ (fun x => a - x) '' Iio b = Ioi (a - b)
[PROOFSTEP]
simp [sub_eq_add_neg, this, add_comm]
[GOAL]
α : Type u_1
inst✝ : OrderedAddCommGroup α
a b c : α
⊢ (fun x => a - x) '' Icc b c = Icc (a - c) (a - b)
[PROOFSTEP]
have := image_comp (fun x => a + x) fun x => -x
[GOAL]
α : Type u_1
inst✝ : OrderedAddCommGroup α
a b c : α
this : ∀ (a_1 : Set α), ((fun x => a + x) ∘ fun x => -x) '' a_1 = (fun x => a + x) '' ((fun x => -x) '' a_1)
⊢ (fun x => a - x) '' Icc b c = Icc (a - c) (a - b)
[PROOFSTEP]
dsimp [Function.comp] at this
[GOAL]
α : Type u_1
inst✝ : OrderedAddCommGroup α
a b c : α
this : ∀ (a_1 : Set α), (fun x => a + -x) '' a_1 = (fun x => a + x) '' ((fun x => -x) '' a_1)
⊢ (fun x => a - x) '' Icc b c = Icc (a - c) (a - b)
[PROOFSTEP]
simp [sub_eq_add_neg, this, add_comm]
[GOAL]
α : Type u_1
inst✝ : OrderedAddCommGroup α
a b c : α
⊢ (fun x => a - x) '' Ico b c = Ioc (a - c) (a - b)
[PROOFSTEP]
have := image_comp (fun x => a + x) fun x => -x
[GOAL]
α : Type u_1
inst✝ : OrderedAddCommGroup α
a b c : α
this : ∀ (a_1 : Set α), ((fun x => a + x) ∘ fun x => -x) '' a_1 = (fun x => a + x) '' ((fun x => -x) '' a_1)
⊢ (fun x => a - x) '' Ico b c = Ioc (a - c) (a - b)
[PROOFSTEP]
dsimp [Function.comp] at this
[GOAL]
α : Type u_1
inst✝ : OrderedAddCommGroup α
a b c : α
this : ∀ (a_1 : Set α), (fun x => a + -x) '' a_1 = (fun x => a + x) '' ((fun x => -x) '' a_1)
⊢ (fun x => a - x) '' Ico b c = Ioc (a - c) (a - b)
[PROOFSTEP]
simp [sub_eq_add_neg, this, add_comm]
[GOAL]
α : Type u_1
inst✝ : OrderedAddCommGroup α
a b c : α
⊢ (fun x => a - x) '' Ioc b c = Ico (a - c) (a - b)
[PROOFSTEP]
have := image_comp (fun x => a + x) fun x => -x
[GOAL]
α : Type u_1
inst✝ : OrderedAddCommGroup α
a b c : α
this : ∀ (a_1 : Set α), ((fun x => a + x) ∘ fun x => -x) '' a_1 = (fun x => a + x) '' ((fun x => -x) '' a_1)
⊢ (fun x => a - x) '' Ioc b c = Ico (a - c) (a - b)
[PROOFSTEP]
dsimp [Function.comp] at this
[GOAL]
α : Type u_1
inst✝ : OrderedAddCommGroup α
a b c : α
this : ∀ (a_1 : Set α), (fun x => a + -x) '' a_1 = (fun x => a + x) '' ((fun x => -x) '' a_1)
⊢ (fun x => a - x) '' Ioc b c = Ico (a - c) (a - b)
[PROOFSTEP]
simp [sub_eq_add_neg, this, add_comm]
[GOAL]
α : Type u_1
inst✝ : OrderedAddCommGroup α
a b c : α
⊢ (fun x => a - x) '' Ioo b c = Ioo (a - c) (a - b)
[PROOFSTEP]
have := image_comp (fun x => a + x) fun x => -x
[GOAL]
α : Type u_1
inst✝ : OrderedAddCommGroup α
a b c : α
this : ∀ (a_1 : Set α), ((fun x => a + x) ∘ fun x => -x) '' a_1 = (fun x => a + x) '' ((fun x => -x) '' a_1)
⊢ (fun x => a - x) '' Ioo b c = Ioo (a - c) (a - b)
[PROOFSTEP]
dsimp [Function.comp] at this
[GOAL]
α : Type u_1
inst✝ : OrderedAddCommGroup α
a b c : α
this : ∀ (a_1 : Set α), (fun x => a + -x) '' a_1 = (fun x => a + x) '' ((fun x => -x) '' a_1)
⊢ (fun x => a - x) '' Ioo b c = Ioo (a - c) (a - b)
[PROOFSTEP]
simp [sub_eq_add_neg, this, add_comm]
[GOAL]
α : Type u_1
inst✝ : OrderedAddCommGroup α
a b c : α
⊢ (fun x => x - a) '' Ici b = Ici (b - a)
[PROOFSTEP]
simp [sub_eq_neg_add]
[GOAL]
α : Type u_1
inst✝ : OrderedAddCommGroup α
a b c : α
⊢ (fun x => x - a) '' Iic b = Iic (b - a)
[PROOFSTEP]
simp [sub_eq_neg_add]
[GOAL]
α : Type u_1
inst✝ : OrderedAddCommGroup α
a b c : α
⊢ (fun x => x - a) '' Ioi b = Ioi (b - a)
[PROOFSTEP]
simp [sub_eq_neg_add]
[GOAL]
α : Type u_1
inst✝ : OrderedAddCommGroup α
a b c : α
⊢ (fun x => x - a) '' Iio b = Iio (b - a)
[PROOFSTEP]
simp [sub_eq_neg_add]
[GOAL]
α : Type u_1
inst✝ : OrderedAddCommGroup α
a b c : α
⊢ (fun x => x - a) '' Icc b c = Icc (b - a) (c - a)
[PROOFSTEP]
simp [sub_eq_neg_add]
[GOAL]
α : Type u_1
inst✝ : OrderedAddCommGroup α
a b c : α
⊢ (fun x => x - a) '' Ico b c = Ico (b - a) (c - a)
[PROOFSTEP]
simp [sub_eq_neg_add]
[GOAL]
α : Type u_1
inst✝ : OrderedAddCommGroup α
a b c : α
⊢ (fun x => x - a) '' Ioc b c = Ioc (b - a) (c - a)
[PROOFSTEP]
simp [sub_eq_neg_add]
[GOAL]
α : Type u_1
inst✝ : OrderedAddCommGroup α
a b c : α
⊢ (fun x => x - a) '' Ioo b c = Ioo (b - a) (c - a)
[PROOFSTEP]
simp [sub_eq_neg_add]
[GOAL]
α : Type u_1
inst✝ : LinearOrderedAddCommGroup α
a b c d : α
⊢ (fun x => a + x) ⁻¹' [[b, c]] = [[b - a, c - a]]
[PROOFSTEP]
simp only [← Icc_min_max, preimage_const_add_Icc, min_sub_sub_right, max_sub_sub_right]
[GOAL]
α : Type u_1
inst✝ : LinearOrderedAddCommGroup α
a b c d : α
⊢ (fun x => x + a) ⁻¹' [[b, c]] = [[b - a, c - a]]
[PROOFSTEP]
simpa only [add_comm] using preimage_const_add_uIcc a b c
[GOAL]
α : Type u_1
inst✝ : LinearOrderedAddCommGroup α
a b c d : α
⊢ -[[a, b]] = [[-a, -b]]
[PROOFSTEP]
simp only [← Icc_min_max, preimage_neg_Icc, min_neg_neg, max_neg_neg]
[GOAL]
α : Type u_1
inst✝ : LinearOrderedAddCommGroup α
a b c d : α
⊢ (fun x => x - a) ⁻¹' [[b, c]] = [[b + a, c + a]]
[PROOFSTEP]
simp [sub_eq_add_neg]
[GOAL]
α : Type u_1
inst✝ : LinearOrderedAddCommGroup α
a b c d : α
⊢ (fun x => a - x) ⁻¹' [[b, c]] = [[a - b, a - c]]
[PROOFSTEP]
simp_rw [← Icc_min_max, preimage_const_sub_Icc]
[GOAL]
α : Type u_1
inst✝ : LinearOrderedAddCommGroup α
a b c d : α
⊢ Icc (a - max b c) (a - min b c) = Icc (min (a - b) (a - c)) (max (a - b) (a - c))
[PROOFSTEP]
simp only [sub_eq_add_neg, min_add_add_left, max_add_add_left, min_neg_neg, max_neg_neg]
[GOAL]
α : Type u_1
inst✝ : LinearOrderedAddCommGroup α
a b c d : α
⊢ (fun x => a + x) '' [[b, c]] = [[a + b, a + c]]
[PROOFSTEP]
simp [add_comm]
[GOAL]
α : Type u_1
inst✝ : LinearOrderedAddCommGroup α
a b c d : α
⊢ (fun x => x + a) '' [[b, c]] = [[b + a, c + a]]
[PROOFSTEP]
simp
[GOAL]
α : Type u_1
inst✝ : LinearOrderedAddCommGroup α
a b c d : α
⊢ (fun x => a - x) '' [[b, c]] = [[a - b, a - c]]
[PROOFSTEP]
have := image_comp (fun x => a + x) fun x => -x
[GOAL]
α : Type u_1
inst✝ : LinearOrderedAddCommGroup α
a b c d : α
this : ∀ (a_1 : Set α), ((fun x => a + x) ∘ fun x => -x) '' a_1 = (fun x => a + x) '' ((fun x => -x) '' a_1)
⊢ (fun x => a - x) '' [[b, c]] = [[a - b, a - c]]
[PROOFSTEP]
dsimp [Function.comp] at this
[GOAL]
α : Type u_1
inst✝ : LinearOrderedAddCommGroup α
a b c d : α
this : ∀ (a_1 : Set α), (fun x => a + -x) '' a_1 = (fun x => a + x) '' ((fun x => -x) '' a_1)
⊢ (fun x => a - x) '' [[b, c]] = [[a - b, a - c]]
[PROOFSTEP]
simp [sub_eq_add_neg, this, add_comm]
[GOAL]
α : Type u_1
inst✝ : LinearOrderedAddCommGroup α
a b c d : α
⊢ (fun x => x - a) '' [[b, c]] = [[b - a, c - a]]
[PROOFSTEP]
simp [sub_eq_add_neg, add_comm]
[GOAL]
α : Type u_1
inst✝ : LinearOrderedAddCommGroup α
a b c d : α
⊢ Neg.neg '' [[a, b]] = [[-a, -b]]
[PROOFSTEP]
simp
[GOAL]
α : Type u_1
inst✝ : LinearOrderedAddCommGroup α
a b c d : α
h : [[c, d]] ⊆ [[a, b]]
⊢ |d - c| ≤ |b - a|
[PROOFSTEP]
rw [← max_sub_min_eq_abs, ← max_sub_min_eq_abs]
[GOAL]
α : Type u_1
inst✝ : LinearOrderedAddCommGroup α
a b c d : α
h : [[c, d]] ⊆ [[a, b]]
⊢ max c d - min c d ≤ max a b - min a b
[PROOFSTEP]
rw [uIcc_subset_uIcc_iff_le] at h
[GOAL]
α : Type u_1
inst✝ : LinearOrderedAddCommGroup α
a b c d : α
h : min a b ≤ min c d ∧ max c d ≤ max a b
⊢ max c d - min c d ≤ max a b - min a b
[PROOFSTEP]
exact sub_le_sub h.2 h.1
[GOAL]
α : Type u_1
inst✝ : LinearOrderedField α
a✝ a b c : α
h : 0 < c
⊢ (fun x => x * c) ⁻¹' Ioo a b = Ioo (a / c) (b / c)
[PROOFSTEP]
simp [← Ioi_inter_Iio, h]
[GOAL]
α : Type u_1
inst✝ : LinearOrderedField α
a✝ a b c : α
h : 0 < c
⊢ (fun x => x * c) ⁻¹' Ioc a b = Ioc (a / c) (b / c)
[PROOFSTEP]
simp [← Ioi_inter_Iic, h]
[GOAL]
α : Type u_1
inst✝ : LinearOrderedField α
a✝ a b c : α
h : 0 < c
⊢ (fun x => x * c) ⁻¹' Ico a b = Ico (a / c) (b / c)
[PROOFSTEP]
simp [← Ici_inter_Iio, h]
[GOAL]
α : Type u_1
inst✝ : LinearOrderedField α
a✝ a b c : α
h : 0 < c
⊢ (fun x => x * c) ⁻¹' Icc a b = Icc (a / c) (b / c)
[PROOFSTEP]
simp [← Ici_inter_Iic, h]
[GOAL]
α : Type u_1
inst✝ : LinearOrderedField α
a✝ a b c : α
h : c < 0
⊢ (fun x => x * c) ⁻¹' Ioo a b = Ioo (b / c) (a / c)
[PROOFSTEP]
simp [← Ioi_inter_Iio, h, inter_comm]
[GOAL]
α : Type u_1
inst✝ : LinearOrderedField α
a✝ a b c : α
h : c < 0
⊢ (fun x => x * c) ⁻¹' Ioc a b = Ico (b / c) (a / c)
[PROOFSTEP]
simp [← Ioi_inter_Iic, ← Ici_inter_Iio, h, inter_comm]
[GOAL]
α : Type u_1
inst✝ : LinearOrderedField α
a✝ a b c : α
h : c < 0
⊢ (fun x => x * c) ⁻¹' Ico a b = Ioc (b / c) (a / c)
[PROOFSTEP]
simp [← Ici_inter_Iio, ← Ioi_inter_Iic, h, inter_comm]
[GOAL]
α : Type u_1
inst✝ : LinearOrderedField α
a✝ a b c : α
h : c < 0
⊢ (fun x => x * c) ⁻¹' Icc a b = Icc (b / c) (a / c)
[PROOFSTEP]
simp [← Ici_inter_Iic, h, inter_comm]
[GOAL]
α : Type u_1
inst✝ : LinearOrderedField α
a✝ a b c : α
h : 0 < c
⊢ (fun x x_1 => x * x_1) c ⁻¹' Ioo a b = Ioo (a / c) (b / c)
[PROOFSTEP]
simp [← Ioi_inter_Iio, h]
[GOAL]
α : Type u_1
inst✝ : LinearOrderedField α
a✝ a b c : α
h : 0 < c
⊢ (fun x x_1 => x * x_1) c ⁻¹' Ioc a b = Ioc (a / c) (b / c)
[PROOFSTEP]
simp [← Ioi_inter_Iic, h]
[GOAL]
α : Type u_1
inst✝ : LinearOrderedField α
a✝ a b c : α
h : 0 < c
⊢ (fun x x_1 => x * x_1) c ⁻¹' Ico a b = Ico (a / c) (b / c)
[PROOFSTEP]
simp [← Ici_inter_Iio, h]
[GOAL]
α : Type u_1
inst✝ : LinearOrderedField α
a✝ a b c : α
h : 0 < c
⊢ (fun x x_1 => x * x_1) c ⁻¹' Icc a b = Icc (a / c) (b / c)
[PROOFSTEP]
simp [← Ici_inter_Iic, h]
[GOAL]
α : Type u_1
inst✝ : LinearOrderedField α
a✝ a c : α
h : c < 0
⊢ (fun x x_1 => x * x_1) c ⁻¹' Iio a = Ioi (a / c)
[PROOFSTEP]
simpa only [mul_comm] using preimage_mul_const_Iio_of_neg a h
[GOAL]
α : Type u_1
inst✝ : LinearOrderedField α
a✝ a c : α
h : c < 0
⊢ (fun x x_1 => x * x_1) c ⁻¹' Ioi a = Iio (a / c)
[PROOFSTEP]
simpa only [mul_comm] using preimage_mul_const_Ioi_of_neg a h
[GOAL]
α : Type u_1
inst✝ : LinearOrderedField α
a✝ a c : α
h : c < 0
⊢ (fun x x_1 => x * x_1) c ⁻¹' Iic a = Ici (a / c)
[PROOFSTEP]
simpa only [mul_comm] using preimage_mul_const_Iic_of_neg a h
[GOAL]
α : Type u_1
inst✝ : LinearOrderedField α
a✝ a c : α
h : c < 0
⊢ (fun x x_1 => x * x_1) c ⁻¹' Ici a = Iic (a / c)
[PROOFSTEP]
simpa only [mul_comm] using preimage_mul_const_Ici_of_neg a h
[GOAL]
α : Type u_1
inst✝ : LinearOrderedField α
a✝ a b c : α
h : c < 0
⊢ (fun x x_1 => x * x_1) c ⁻¹' Ioo a b = Ioo (b / c) (a / c)
[PROOFSTEP]
simpa only [mul_comm] using preimage_mul_const_Ioo_of_neg a b h
[GOAL]
α : Type u_1
inst✝ : LinearOrderedField α
a✝ a b c : α
h : c < 0
⊢ (fun x x_1 => x * x_1) c ⁻¹' Ioc a b = Ico (b / c) (a / c)
[PROOFSTEP]
simpa only [mul_comm] using preimage_mul_const_Ioc_of_neg a b h
[GOAL]
α : Type u_1
inst✝ : LinearOrderedField α
a✝ a b c : α
h : c < 0
⊢ (fun x x_1 => x * x_1) c ⁻¹' Ico a b = Ioc (b / c) (a / c)
[PROOFSTEP]
simpa only [mul_comm] using preimage_mul_const_Ico_of_neg a b h
[GOAL]
α : Type u_1
inst✝ : LinearOrderedField α
a✝ a b c : α
h : c < 0
⊢ (fun x x_1 => x * x_1) c ⁻¹' Icc a b = Icc (b / c) (a / c)
[PROOFSTEP]
simpa only [mul_comm] using preimage_mul_const_Icc_of_neg a b h
[GOAL]
α : Type u_1
inst✝ : LinearOrderedField α
a : α
ha : a ≠ 0
b c : α
h : a < 0
⊢ (fun x => x * a) ⁻¹' [[b, c]] = [[b / a, c / a]]
[PROOFSTEP]
simp [← Icc_min_max, h, h.le, min_div_div_right_of_nonpos, max_div_div_right_of_nonpos]
[GOAL]
α : Type u_1
inst✝ : LinearOrderedField α
a : α
ha✝ : a ≠ 0
b c : α
ha : 0 < a
⊢ (fun x => x * a) ⁻¹' [[b, c]] = [[b / a, c / a]]
[PROOFSTEP]
simp [← Icc_min_max, ha, ha.le, min_div_div_right, max_div_div_right]
[GOAL]
α : Type u_1
inst✝ : LinearOrderedField α
a : α
ha : a ≠ 0
b c : α
⊢ (fun x => a * x) ⁻¹' [[b, c]] = [[b / a, c / a]]
[PROOFSTEP]
simp only [← preimage_mul_const_uIcc ha, mul_comm]
[GOAL]
α : Type u_1
inst✝ : LinearOrderedField α
a : α
ha : a ≠ 0
b c : α
⊢ (fun x => x / a) ⁻¹' [[b, c]] = [[b * a, c * a]]
[PROOFSTEP]
simp only [div_eq_mul_inv, preimage_mul_const_uIcc (inv_ne_zero ha), inv_inv]
[GOAL]
α : Type u_1
inst✝ : LinearOrderedField α
a✝ a b c : α
ha : a = 0
⊢ (fun x => x * a) '' [[b, c]] = [[b * a, c * a]]
[PROOFSTEP]
simp [ha]
[GOAL]
α : Type u_1
inst✝ : LinearOrderedField α
a✝ a b c : α
ha : ¬a = 0
⊢ (fun x => x * a⁻¹) ⁻¹' [[b, c]] = (fun x => x / a) ⁻¹' [[b, c]]
[PROOFSTEP]
simp only [div_eq_mul_inv]
[GOAL]
α : Type u_1
inst✝ : LinearOrderedField α
a✝ a b c : α
⊢ (fun x => a * x) '' [[b, c]] = [[a * b, a * c]]
[PROOFSTEP]
simpa only [mul_comm] using image_mul_const_uIcc a b c
[GOAL]
α : Type u_1
inst✝ : LinearOrderedField α
a✝ a b c : α
⊢ (fun x => x / a) '' [[b, c]] = [[b / a, c / a]]
[PROOFSTEP]
simp only [div_eq_mul_inv, image_mul_const_uIcc]
[GOAL]
α : Type u_1
inst✝ : LinearOrderedField α
a✝ a b c : α
h : 0 < c
⊢ ↑(Units.mulRight (Units.mk0 c (_ : c ≠ 0))).symm ⁻¹' Icc a b = Icc (a * c) (b * c)
[PROOFSTEP]
simp [h, division_def]
[GOAL]
α : Type u_1
inst✝ : LinearOrderedField α
a✝ a b c : α
hab : a ≤ b
hc : 0 ≤ c
⊢ (fun x => x * c) '' Icc a b = Icc (a * c) (b * c)
[PROOFSTEP]
cases eq_or_lt_of_le hc
[GOAL]
case inl
α : Type u_1
inst✝ : LinearOrderedField α
a✝ a b c : α
hab : a ≤ b
hc : 0 ≤ c
h✝ : 0 = c
⊢ (fun x => x * c) '' Icc a b = Icc (a * c) (b * c)
[PROOFSTEP]
subst c
[GOAL]
case inl
α : Type u_1
inst✝ : LinearOrderedField α
a✝ a b : α
hab : a ≤ b
hc : 0 ≤ 0
⊢ (fun x => x * 0) '' Icc a b = Icc (a * 0) (b * 0)
[PROOFSTEP]
simp [(nonempty_Icc.2 hab).image_const]
[GOAL]
case inr
α : Type u_1
inst✝ : LinearOrderedField α
a✝ a b c : α
hab : a ≤ b
hc : 0 ≤ c
h✝ : 0 < c
⊢ (fun x => x * c) '' Icc a b = Icc (a * c) (b * c)
[PROOFSTEP]
exact image_mul_right_Icc' a b ‹0 < c›
[GOAL]
α : Type u_1
inst✝ : LinearOrderedField α
a✝ a : α
h : 0 < a
b c : α
⊢ (fun x x_1 => x * x_1) a '' Icc b c = Icc (a * b) (a * c)
[PROOFSTEP]
convert image_mul_right_Icc' b c h using 1
[GOAL]
case h.e'_2
α : Type u_1
inst✝ : LinearOrderedField α
a✝ a : α
h : 0 < a
b c : α
⊢ (fun x x_1 => x * x_1) a '' Icc b c = (fun x => x * a) '' Icc b c
[PROOFSTEP]
simp only [mul_comm _ a]
[GOAL]
case h.e'_3
α : Type u_1
inst✝ : LinearOrderedField α
a✝ a : α
h : 0 < a
b c : α
⊢ Icc (a * b) (a * c) = Icc (b * a) (c * a)
[PROOFSTEP]
simp only [mul_comm _ a]
[GOAL]
α : Type u_1
inst✝ : LinearOrderedField α
a✝ a b c : α
ha : 0 ≤ a
hbc : b ≤ c
⊢ (fun x x_1 => x * x_1) a '' Icc b c = Icc (a * b) (a * c)
[PROOFSTEP]
convert image_mul_right_Icc hbc ha using 1
[GOAL]
case h.e'_2
α : Type u_1
inst✝ : LinearOrderedField α
a✝ a b c : α
ha : 0 ≤ a
hbc : b ≤ c
⊢ (fun x x_1 => x * x_1) a '' Icc b c = (fun x => x * a) '' Icc b c
[PROOFSTEP]
simp only [mul_comm _ a]
[GOAL]
case h.e'_3
α : Type u_1
inst✝ : LinearOrderedField α
a✝ a b c : α
ha : 0 ≤ a
hbc : b ≤ c
⊢ Icc (a * b) (a * c) = Icc (b * a) (c * a)
[PROOFSTEP]
simp only [mul_comm _ a]
[GOAL]
α : Type u_1
inst✝ : LinearOrderedField α
a✝ a b c : α
h : 0 < c
⊢ ↑(Units.mulRight (Units.mk0 c (_ : c ≠ 0))).symm ⁻¹' Ioo a b = Ioo (a * c) (b * c)
[PROOFSTEP]
simp [h, division_def]
[GOAL]
α : Type u_1
inst✝ : LinearOrderedField α
a✝ a : α
h : 0 < a
b c : α
⊢ (fun x x_1 => x * x_1) a '' Ioo b c = Ioo (a * b) (a * c)
[PROOFSTEP]
convert image_mul_right_Ioo b c h using 1
[GOAL]
case h.e'_2
α : Type u_1
inst✝ : LinearOrderedField α
a✝ a : α
h : 0 < a
b c : α
⊢ (fun x x_1 => x * x_1) a '' Ioo b c = (fun x => x * a) '' Ioo b c
[PROOFSTEP]
simp only [mul_comm _ a]
[GOAL]
case h.e'_3
α : Type u_1
inst✝ : LinearOrderedField α
a✝ a : α
h : 0 < a
b c : α
⊢ Ioo (a * b) (a * c) = Ioo (b * a) (c * a)
[PROOFSTEP]
simp only [mul_comm _ a]
[GOAL]
α : Type u_1
inst✝ : LinearOrderedField α
a✝ a : α
ha : 0 < a
⊢ (Ioo 0 a)⁻¹ = Ioi a⁻¹
[PROOFSTEP]
ext x
[GOAL]
case h
α : Type u_1
inst✝ : LinearOrderedField α
a✝ a : α
ha : 0 < a
x : α
⊢ x ∈ (Ioo 0 a)⁻¹ ↔ x ∈ Ioi a⁻¹
[PROOFSTEP]
exact
  ⟨fun h => inv_inv x ▸ (inv_lt_inv ha h.1).2 h.2, fun h =>
    ⟨inv_pos.2 <| (inv_pos.2 ha).trans h, inv_inv a ▸ (inv_lt_inv ((inv_pos.2 ha).trans h) (inv_pos.2 ha)).2 h⟩⟩
[GOAL]
α : Type u_1
inst✝ : LinearOrderedField α
a✝ a : α
ha : 0 < a
⊢ (Ioi a)⁻¹ = Ioo 0 a⁻¹
[PROOFSTEP]
rw [inv_eq_iff_eq_inv, inv_Ioo_0_left (inv_pos.2 ha), inv_inv]
[GOAL]
α : Type u_1
inst✝¹ : LinearOrderedField α
a : α
k : Type u_2
inst✝ : LinearOrderedField k
x : k
hx : 0 < x
⊢ (fun y => x * y) '' Ioi 0 = Ioi 0
[PROOFSTEP]
erw [(Units.mk0 x hx.ne').mulLeft.image_eq_preimage, preimage_const_mul_Ioi 0 (inv_pos.mpr hx), zero_div]
[GOAL]
α : Type u_1
inst✝ : LinearOrderedField α
a✝ a : α
h : 0 < a
b c d : α
⊢ (fun x => a * x + b) '' Icc c d = Icc (a * c + b) (a * d + b)
[PROOFSTEP]
suffices (fun x => x + b) '' ((fun x => a * x) '' Icc c d) = Icc (a * c + b) (a * d + b) by
  rwa [Set.image_image] at this
[GOAL]
α : Type u_1
inst✝ : LinearOrderedField α
a✝ a : α
h : 0 < a
b c d : α
this : (fun x => x + b) '' ((fun x => a * x) '' Icc c d) = Icc (a * c + b) (a * d + b)
⊢ (fun x => a * x + b) '' Icc c d = Icc (a * c + b) (a * d + b)
[PROOFSTEP]
rwa [Set.image_image] at this
[GOAL]
α : Type u_1
inst✝ : LinearOrderedField α
a✝ a : α
h : 0 < a
b c d : α
⊢ (fun x => x + b) '' ((fun x => a * x) '' Icc c d) = Icc (a * c + b) (a * d + b)
[PROOFSTEP]
rw [image_mul_left_Icc' h, image_add_const_Icc]


[GOAL]
k : Type u
inst✝² : Field k
A : Type w
inst✝¹ : Ring A
inst✝ : Algebra k A
⊢ ∀ (X Y Z : ModuleCat A) (r : k) (f : X ⟶ Y) (g : Y ⟶ Z), (r • f) ≫ g = r • f ≫ g
[PROOFSTEP]
aesop_cat_nonterminal
[GOAL]
case h
k : Type u
inst : Field k
A : Type w
inst_1 : Ring A
inst_2 : Algebra k A
X Y Z : ModuleCat A
r : k
f : X ⟶ Y
g : Y ⟶ Z
x✝ : ↑X
⊢ ↑g (↑(r • f) x✝) = ↑(r • f ≫ g) x✝
[PROOFSTEP]
rw [LinearMap.smul_apply, LinearMap.smul_apply, LinearMap.map_smul_of_tower]
[GOAL]
case h
k : Type u
inst : Field k
A : Type w
inst_1 : Ring A
inst_2 : Algebra k A
X Y Z : ModuleCat A
r : k
f : X ⟶ Y
g : Y ⟶ Z
x✝ : ↑X
⊢ r • ↑g (↑f x✝) = r • ↑(f ≫ g) x✝
[PROOFSTEP]
rfl


[GOAL]
M : Type u_1
N : Type u_2
P : Type u_3
E : Type u_4
α✝ : Type u_5
β : Type u_6
inst✝⁶ : SMul M α✝
inst✝⁵ : SMul M β
inst✝⁴ : SMul N α✝
inst✝³ : SMul N β
a✝ : M
x : α✝ × β
α : Type u_7
inst✝² : Monoid M
inst✝¹ : AddMonoid α
inst✝ : DistribMulAction M α
a : M
c : β
⊢ a • (0, c) = (0, a • c)
[PROOFSTEP]
rw [Prod.smul_mk, smul_zero]
[GOAL]
M : Type u_1
N : Type u_2
P : Type u_3
E : Type u_4
α : Type u_5
β✝ : Type u_6
inst✝⁶ : SMul M α
inst✝⁵ : SMul M β✝
inst✝⁴ : SMul N α
inst✝³ : SMul N β✝
a✝ : M
x : α × β✝
β : Type u_7
inst✝² : Monoid M
inst✝¹ : AddMonoid β
inst✝ : DistribMulAction M β
a : M
b : α
⊢ a • (b, 0) = (a • b, 0)
[PROOFSTEP]
rw [Prod.smul_mk, smul_zero]
[GOAL]
M : Type u_1
N : Type u_2
P : Type u_3
E : Type u_4
α : Type u_5
β : Type u_6
inst✝⁷ : SMul M α
inst✝⁶ : SMul M β
inst✝⁵ : SMul N α
inst✝⁴ : SMul N β
a✝ : M
x : α × β
inst✝³ : Pow α E
inst✝² : Pow β E
inst✝¹ : FaithfulSMul M α
inst✝ : Nonempty β
m₁✝ m₂✝ : M
h : ∀ (a : α × β), m₁✝ • a = m₂✝ • a
b : β
a : α
⊢ m₁✝ • a = m₂✝ • a
[PROOFSTEP]
injection h (a, b)
[GOAL]
M : Type u_1
N : Type u_2
P : Type u_3
E : Type u_4
α : Type u_5
β : Type u_6
inst✝⁷ : SMul M α
inst✝⁶ : SMul M β
inst✝⁵ : SMul N α
inst✝⁴ : SMul N β
a✝ : M
x : α × β
inst✝³ : Pow α E
inst✝² : Pow β E
inst✝¹ : Nonempty α
inst✝ : FaithfulSMul M β
m₁✝ m₂✝ : M
h : ∀ (a : α × β), m₁✝ • a = m₂✝ • a
a : α
b : β
⊢ m₁✝ • b = m₂✝ • b
[PROOFSTEP]
injection h (a, b)
[GOAL]
M : Type u_1
N : Type u_2
P : Type u_3
E : Type u_4
α : Type u_5
β : Type u_6
inst✝⁵ : Mul N
inst✝⁴ : Mul P
inst✝³ : SMul M N
inst✝² : SMul M P
inst✝¹ : SMulCommClass M N N
inst✝ : SMulCommClass M P P
c : M
x y : N × P
⊢ c • x • y = x • c • y
[PROOFSTEP]
simp [smul_def, mul_def, mul_smul_comm]
[GOAL]
M : Type u_1
N : Type u_2
P : Type u_3
E : Type u_4
α : Type u_5
β : Type u_6
inst✝⁵ : Mul N
inst✝⁴ : Mul P
inst✝³ : SMul M N
inst✝² : SMul M P
inst✝¹ : IsScalarTower M N N
inst✝ : IsScalarTower M P P
c : M
x y : N × P
⊢ (c • x) • y = c • x • y
[PROOFSTEP]
simp [smul_def, mul_def, smul_mul_assoc]


[GOAL]
α α' : Sort u
β β' : Sort v
h : α = α'
h' : α' → β = β'
⊢ (α → β) = (α' → β')
[PROOFSTEP]
cases h
[GOAL]
case refl
α : Sort u
β β' : Sort v
h' : α → β = β'
⊢ (α → β) = (α → β')
[PROOFSTEP]
show (∀ (x : α), (fun _ => β) x) = _
[GOAL]
case refl
α : Sort u
β β' : Sort v
h' : α → β = β'
⊢ ((x : α) → (fun x => β) x) = (α → β')
[PROOFSTEP]
rw [funext h']
[GOAL]
α✝ : Sort u_1
x y : α✝
p : HEq x y → Prop
h : ∀ (he : x = y), p (_ : HEq x y)
he : HEq x y
⊢ p he
[PROOFSTEP]
cases he
[GOAL]
case refl
α✝ : Sort u_1
x : α✝
p : HEq x x → Prop
h : ∀ (he : x = x), p (_ : HEq x x)
⊢ p (_ : HEq x x)
[PROOFSTEP]
exact h rfl
[GOAL]
x y : Prop
p : x = y → Prop
h : ∀ (he : x ↔ y), p (_ : x = y)
he : x = y
⊢ p he
[PROOFSTEP]
cases he
[GOAL]
case refl
x : Prop
p : x = x → Prop
h : ∀ (he : x ↔ x), p (_ : x = x)
⊢ p (_ : x = x)
[PROOFSTEP]
exact h Iff.rfl


[GOAL]
S : Type u_1
inst✝ : Semiring S
a b : ℕ
⊢ ↑(ascFactorial a b) = Polynomial.eval (↑a + 1) (pochhammer S b)
[PROOFSTEP]
rw [← pochhammer_nat_eq_ascFactorial, pochhammer_eval_cast, Nat.cast_add, Nat.cast_one]
[GOAL]
S : Type u_1
inst✝ : Semiring S
a b : ℕ
⊢ ↑(descFactorial a b) = Polynomial.eval (↑(a - (b - 1))) (pochhammer S b)
[PROOFSTEP]
rw [← pochhammer_eval_cast, pochhammer_nat_eq_descFactorial]
[GOAL]
S : Type u_1
inst✝ : Semiring S
a b : ℕ
⊢ ↑(descFactorial a b) = ↑(descFactorial (a - (b - 1) + b - 1) b)
[PROOFSTEP]
induction' b with b
[GOAL]
case zero
S : Type u_1
inst✝ : Semiring S
a b : ℕ
⊢ ↑(descFactorial a zero) = ↑(descFactorial (a - (zero - 1) + zero - 1) zero)
[PROOFSTEP]
simp
[GOAL]
case succ
S : Type u_1
inst✝ : Semiring S
a b✝ b : ℕ
n_ih✝ : ↑(descFactorial a b) = ↑(descFactorial (a - (b - 1) + b - 1) b)
⊢ ↑(descFactorial a (succ b)) = ↑(descFactorial (a - (succ b - 1) + succ b - 1) (succ b))
[PROOFSTEP]
simp_rw [add_succ, succ_sub_one]
[GOAL]
case succ
S : Type u_1
inst✝ : Semiring S
a b✝ b : ℕ
n_ih✝ : ↑(descFactorial a b) = ↑(descFactorial (a - (b - 1) + b - 1) b)
⊢ ↑(descFactorial a (succ b)) = ↑(descFactorial (a - b + b) (succ b))
[PROOFSTEP]
obtain h | h := le_total a b
[GOAL]
case succ.inl
S : Type u_1
inst✝ : Semiring S
a b✝ b : ℕ
n_ih✝ : ↑(descFactorial a b) = ↑(descFactorial (a - (b - 1) + b - 1) b)
h : a ≤ b
⊢ ↑(descFactorial a (succ b)) = ↑(descFactorial (a - b + b) (succ b))
[PROOFSTEP]
rw [descFactorial_of_lt (lt_succ_of_le h), descFactorial_of_lt (lt_succ_of_le _)]
[GOAL]
S : Type u_1
inst✝ : Semiring S
a b✝ b : ℕ
n_ih✝ : ↑(descFactorial a b) = ↑(descFactorial (a - (b - 1) + b - 1) b)
h : a ≤ b
⊢ a - b + b ≤ b
[PROOFSTEP]
rw [tsub_eq_zero_iff_le.mpr h, zero_add]
[GOAL]
case succ.inr
S : Type u_1
inst✝ : Semiring S
a b✝ b : ℕ
n_ih✝ : ↑(descFactorial a b) = ↑(descFactorial (a - (b - 1) + b - 1) b)
h : b ≤ a
⊢ ↑(descFactorial a (succ b)) = ↑(descFactorial (a - b + b) (succ b))
[PROOFSTEP]
rw [tsub_add_cancel_of_le h]
[GOAL]
S : Type u_1
inst✝ : Semiring S
a b : ℕ
⊢ ↑a ! = Polynomial.eval 1 (pochhammer S a)
[PROOFSTEP]
rw [← zero_ascFactorial, cast_ascFactorial, cast_zero, zero_add]
[GOAL]
S : Type u_1
inst✝ : Ring S
a b : ℕ
⊢ ↑(descFactorial a 2) = ↑a * (↑a - 1)
[PROOFSTEP]
rw [cast_descFactorial]
[GOAL]
S : Type u_1
inst✝ : Ring S
a b : ℕ
⊢ Polynomial.eval (↑(a - (2 - 1))) (pochhammer S 2) = ↑a * (↑a - 1)
[PROOFSTEP]
cases a
[GOAL]
case zero
S : Type u_1
inst✝ : Ring S
b : ℕ
⊢ Polynomial.eval (↑(zero - (2 - 1))) (pochhammer S 2) = ↑zero * (↑zero - 1)
[PROOFSTEP]
simp
[GOAL]
case succ
S : Type u_1
inst✝ : Ring S
b n✝ : ℕ
⊢ Polynomial.eval (↑(succ n✝ - (2 - 1))) (pochhammer S 2) = ↑(succ n✝) * (↑(succ n✝) - 1)
[PROOFSTEP]
rw [succ_sub_succ, tsub_zero, cast_succ, add_sub_cancel, pochhammer_succ_right, pochhammer_one, Polynomial.X_mul,
  Polynomial.eval_mul_X, Polynomial.eval_add, Polynomial.eval_X, cast_one, Polynomial.eval_one]


[GOAL]
m n : ℕ∞
⊢ ↑(↑toNat ⊤) = ⊤ ↔ ⊤ ≠ ⊤
[PROOFSTEP]
simp
[GOAL]
m n : ℕ∞
x✝ : ℕ
⊢ ↑(↑toNat ↑x✝) = ↑x✝ ↔ ↑x✝ ≠ ⊤
[PROOFSTEP]
simp [toNat_coe]
[GOAL]
m✝ n✝ m n : ℕ∞
hm : m ≠ ⊤
hn : n ≠ ⊤
⊢ ↑toNat (m + n) = ↑toNat m + ↑toNat n
[PROOFSTEP]
lift m to ℕ using hm
[GOAL]
case intro
m✝ n✝ n : ℕ∞
hn : n ≠ ⊤
m : ℕ
⊢ ↑toNat (↑m + n) = ↑toNat ↑m + ↑toNat n
[PROOFSTEP]
lift n to ℕ using hn
[GOAL]
case intro.intro
m✝ n✝ : ℕ∞
m n : ℕ
⊢ ↑toNat (↑m + ↑n) = ↑toNat ↑m + ↑toNat ↑n
[PROOFSTEP]
rfl
[GOAL]
m✝ n✝ n : ℕ∞
hn : n ≠ ⊤
m : ℕ∞
⊢ ↑toNat (m - n) = ↑toNat m - ↑toNat n
[PROOFSTEP]
lift n to ℕ using hn
[GOAL]
case intro
m✝ n✝ m : ℕ∞
n : ℕ
⊢ ↑toNat (m - ↑n) = ↑toNat m - ↑toNat ↑n
[PROOFSTEP]
induction m using ENat.recTopCoe
[GOAL]
case intro.h₁
m n✝ : ℕ∞
n : ℕ
⊢ ↑toNat (⊤ - ↑n) = ↑toNat ⊤ - ↑toNat ↑n
[PROOFSTEP]
rw [top_sub_coe, toNat_top, zero_tsub]
[GOAL]
case intro.h₂
m n✝ : ℕ∞
n a✝ : ℕ
⊢ ↑toNat (↑a✝ - ↑n) = ↑toNat ↑a✝ - ↑toNat ↑n
[PROOFSTEP]
rw [← coe_sub, toNat_coe, toNat_coe, toNat_coe]
[GOAL]
m✝ n✝ m : ℕ∞
n : ℕ
hn : n ≠ 0
⊢ ↑toNat m = n ↔ m = ↑n
[PROOFSTEP]
induction m using ENat.recTopCoe
[GOAL]
case h₁
m n✝ : ℕ∞
n : ℕ
hn : n ≠ 0
⊢ ↑toNat ⊤ = n ↔ ⊤ = ↑n
[PROOFSTEP]
simp [hn.symm]
[GOAL]
case h₂
m n✝ : ℕ∞
n : ℕ
hn : n ≠ 0
a✝ : ℕ
⊢ ↑toNat ↑a✝ = n ↔ ↑a✝ = ↑n
[PROOFSTEP]
simp [hn.symm]
[GOAL]
m✝ n m : ℕ∞
⊢ Order.succ m = m + 1
[PROOFSTEP]
cases m
[GOAL]
case none
m n : ℕ∞
⊢ Order.succ none = none + 1
[PROOFSTEP]
rfl
[GOAL]
case some
m n : ℕ∞
val✝ : ℕ
⊢ Order.succ (some val✝) = some val✝ + 1
[PROOFSTEP]
rfl
[GOAL]
m n : ℕ∞
hm : m ≠ ⊤
⊢ ¬IsMax m
[PROOFSTEP]
rwa [isMax_iff_eq_top]
[GOAL]
m n : ℕ∞
P : ℕ∞ → Prop
a : ℕ∞
h0 : P 0
hsuc : ∀ (n : ℕ), P ↑n → P ↑(Nat.succ n)
htop : (∀ (n : ℕ), P ↑n) → P ⊤
⊢ P a
[PROOFSTEP]
have A : ∀ n : ℕ, P n := fun n => Nat.recOn n h0 hsuc
[GOAL]
m n : ℕ∞
P : ℕ∞ → Prop
a : ℕ∞
h0 : P 0
hsuc : ∀ (n : ℕ), P ↑n → P ↑(Nat.succ n)
htop : (∀ (n : ℕ), P ↑n) → P ⊤
A : ∀ (n : ℕ), P ↑n
⊢ P a
[PROOFSTEP]
cases a
[GOAL]
case none
m n : ℕ∞
P : ℕ∞ → Prop
h0 : P 0
hsuc : ∀ (n : ℕ), P ↑n → P ↑(Nat.succ n)
htop : (∀ (n : ℕ), P ↑n) → P ⊤
A : ∀ (n : ℕ), P ↑n
⊢ P none
[PROOFSTEP]
exact htop A
[GOAL]
case some
m n : ℕ∞
P : ℕ∞ → Prop
h0 : P 0
hsuc : ∀ (n : ℕ), P ↑n → P ↑(Nat.succ n)
htop : (∀ (n : ℕ), P ↑n) → P ⊤
A : ∀ (n : ℕ), P ↑n
val✝ : ℕ
⊢ P (some val✝)
[PROOFSTEP]
exact A _


[GOAL]
n : ℕ
⊢ bodd (succ n) = !bodd n
[PROOFSTEP]
simp only [bodd, boddDiv2]
[GOAL]
n : ℕ
⊢ (match boddDiv2 n with
      | (false, m) => (true, m)
      | (true, m) => (false, succ m)).fst =
    !(boddDiv2 n).fst
[PROOFSTEP]
let ⟨b, m⟩ := boddDiv2 n
[GOAL]
n : ℕ
b : Bool
m : ℕ
⊢ (match (b, m) with
      | (false, m) => (true, m)
      | (true, m) => (false, succ m)).fst =
    !(b, m).fst
[PROOFSTEP]
cases b
[GOAL]
case false
n m : ℕ
⊢ (match (false, m) with
      | (false, m) => (true, m)
      | (true, m) => (false, succ m)).fst =
    !(false, m).fst
[PROOFSTEP]
rfl
[GOAL]
case true
n m : ℕ
⊢ (match (true, m) with
      | (false, m) => (true, m)
      | (true, m) => (false, succ m)).fst =
    !(true, m).fst
[PROOFSTEP]
rfl
[GOAL]
m n : ℕ
⊢ bodd (m + n) = bxor (bodd m) (bodd n)
[PROOFSTEP]
induction' n with n IH
[GOAL]
case zero
m : ℕ
⊢ bodd (m + zero) = bxor (bodd m) (bodd zero)
[PROOFSTEP]
simp
[GOAL]
case succ
m n : ℕ
IH : bodd (m + n) = bxor (bodd m) (bodd n)
⊢ bodd (m + succ n) = bxor (bodd m) (bodd (succ n))
[PROOFSTEP]
simp [add_succ, IH]
[GOAL]
case succ
m n : ℕ
IH : bodd (m + n) = bxor (bodd m) (bodd n)
⊢ (!bxor (bodd m) (bodd n)) = bxor (bodd m) !bodd n
[PROOFSTEP]
cases bodd m
[GOAL]
case succ.false
m n : ℕ
IH : bodd (m + n) = bxor (bodd m) (bodd n)
⊢ (!bxor false (bodd n)) = bxor false !bodd n
[PROOFSTEP]
cases bodd n
[GOAL]
case succ.true
m n : ℕ
IH : bodd (m + n) = bxor (bodd m) (bodd n)
⊢ (!bxor true (bodd n)) = bxor true !bodd n
[PROOFSTEP]
cases bodd n
[GOAL]
case succ.false.false
m n : ℕ
IH : bodd (m + n) = bxor (bodd m) (bodd n)
⊢ (!bxor false false) = bxor false !false
[PROOFSTEP]
rfl
[GOAL]
case succ.false.true
m n : ℕ
IH : bodd (m + n) = bxor (bodd m) (bodd n)
⊢ (!bxor false true) = bxor false !true
[PROOFSTEP]
rfl
[GOAL]
case succ.true.false
m n : ℕ
IH : bodd (m + n) = bxor (bodd m) (bodd n)
⊢ (!bxor true false) = bxor true !false
[PROOFSTEP]
rfl
[GOAL]
case succ.true.true
m n : ℕ
IH : bodd (m + n) = bxor (bodd m) (bodd n)
⊢ (!bxor true true) = bxor true !true
[PROOFSTEP]
rfl
[GOAL]
m n : ℕ
⊢ bodd (m * n) = (bodd m && bodd n)
[PROOFSTEP]
induction' n with n IH
[GOAL]
case zero
m : ℕ
⊢ bodd (m * zero) = (bodd m && bodd zero)
[PROOFSTEP]
simp
[GOAL]
case succ
m n : ℕ
IH : bodd (m * n) = (bodd m && bodd n)
⊢ bodd (m * succ n) = (bodd m && bodd (succ n))
[PROOFSTEP]
simp [mul_succ, IH]
[GOAL]
case succ
m n : ℕ
IH : bodd (m * n) = (bodd m && bodd n)
⊢ bxor (bodd m && bodd n) (bodd m) = (bodd m && !bodd n)
[PROOFSTEP]
cases bodd m
[GOAL]
case succ.false
m n : ℕ
IH : bodd (m * n) = (bodd m && bodd n)
⊢ bxor (false && bodd n) false = (false && !bodd n)
[PROOFSTEP]
cases bodd n
[GOAL]
case succ.true
m n : ℕ
IH : bodd (m * n) = (bodd m && bodd n)
⊢ bxor (true && bodd n) true = (true && !bodd n)
[PROOFSTEP]
cases bodd n
[GOAL]
case succ.false.false
m n : ℕ
IH : bodd (m * n) = (bodd m && bodd n)
⊢ bxor (false && false) false = (false && !false)
[PROOFSTEP]
rfl
[GOAL]
case succ.false.true
m n : ℕ
IH : bodd (m * n) = (bodd m && bodd n)
⊢ bxor (false && true) false = (false && !true)
[PROOFSTEP]
rfl
[GOAL]
case succ.true.false
m n : ℕ
IH : bodd (m * n) = (bodd m && bodd n)
⊢ bxor (true && false) true = (true && !false)
[PROOFSTEP]
rfl
[GOAL]
case succ.true.true
m n : ℕ
IH : bodd (m * n) = (bodd m && bodd n)
⊢ bxor (true && true) true = (true && !true)
[PROOFSTEP]
rfl
[GOAL]
n : ℕ
⊢ n % 2 = bif bodd n then 1 else 0
[PROOFSTEP]
have := congr_arg bodd (mod_add_div n 2)
[GOAL]
n : ℕ
this : bodd (n % 2 + 2 * (n / 2)) = bodd n
⊢ n % 2 = bif bodd n then 1 else 0
[PROOFSTEP]
simp [not] at this
[GOAL]
n : ℕ
this : bodd (n % 2) = bodd n
⊢ n % 2 = bif bodd n then 1 else 0
[PROOFSTEP]
have _ : ∀ b, and false b = false := by
  intro b
  cases b <;> rfl
[GOAL]
n : ℕ
this : bodd (n % 2) = bodd n
⊢ ∀ (b : Bool), (false && b) = false
[PROOFSTEP]
intro b
[GOAL]
n : ℕ
this : bodd (n % 2) = bodd n
b : Bool
⊢ (false && b) = false
[PROOFSTEP]
cases b
[GOAL]
case false
n : ℕ
this : bodd (n % 2) = bodd n
⊢ (false && false) = false
[PROOFSTEP]
rfl
[GOAL]
case true
n : ℕ
this : bodd (n % 2) = bodd n
⊢ (false && true) = false
[PROOFSTEP]
rfl
[GOAL]
n : ℕ
this : bodd (n % 2) = bodd n
x✝ : ∀ (b : Bool), (false && b) = false
⊢ n % 2 = bif bodd n then 1 else 0
[PROOFSTEP]
have _ : ∀ b, bxor b false = b := by
  intro b
  cases b <;> rfl
[GOAL]
n : ℕ
this : bodd (n % 2) = bodd n
x✝ : ∀ (b : Bool), (false && b) = false
⊢ ∀ (b : Bool), bxor b false = b
[PROOFSTEP]
intro b
[GOAL]
n : ℕ
this : bodd (n % 2) = bodd n
x✝ : ∀ (b : Bool), (false && b) = false
b : Bool
⊢ bxor b false = b
[PROOFSTEP]
cases b
[GOAL]
case false
n : ℕ
this : bodd (n % 2) = bodd n
x✝ : ∀ (b : Bool), (false && b) = false
⊢ bxor false false = false
[PROOFSTEP]
rfl
[GOAL]
case true
n : ℕ
this : bodd (n % 2) = bodd n
x✝ : ∀ (b : Bool), (false && b) = false
⊢ bxor true false = true
[PROOFSTEP]
rfl
[GOAL]
n : ℕ
this : bodd (n % 2) = bodd n
x✝¹ : ∀ (b : Bool), (false && b) = false
x✝ : ∀ (b : Bool), bxor b false = b
⊢ n % 2 = bif bodd n then 1 else 0
[PROOFSTEP]
rw [← this]
[GOAL]
n : ℕ
this : bodd (n % 2) = bodd n
x✝¹ : ∀ (b : Bool), (false && b) = false
x✝ : ∀ (b : Bool), bxor b false = b
⊢ n % 2 = bif bodd (n % 2) then 1 else 0
[PROOFSTEP]
cases' mod_two_eq_zero_or_one n with h h
[GOAL]
case inl
n : ℕ
this : bodd (n % 2) = bodd n
x✝¹ : ∀ (b : Bool), (false && b) = false
x✝ : ∀ (b : Bool), bxor b false = b
h : n % 2 = 0
⊢ n % 2 = bif bodd (n % 2) then 1 else 0
[PROOFSTEP]
rw [h]
[GOAL]
case inr
n : ℕ
this : bodd (n % 2) = bodd n
x✝¹ : ∀ (b : Bool), (false && b) = false
x✝ : ∀ (b : Bool), bxor b false = b
h : n % 2 = 1
⊢ n % 2 = bif bodd (n % 2) then 1 else 0
[PROOFSTEP]
rw [h]
[GOAL]
case inl
n : ℕ
this : bodd (n % 2) = bodd n
x✝¹ : ∀ (b : Bool), (false && b) = false
x✝ : ∀ (b : Bool), bxor b false = b
h : n % 2 = 0
⊢ 0 = bif bodd 0 then 1 else 0
[PROOFSTEP]
rfl
[GOAL]
case inr
n : ℕ
this : bodd (n % 2) = bodd n
x✝¹ : ∀ (b : Bool), (false && b) = false
x✝ : ∀ (b : Bool), bxor b false = b
h : n % 2 = 1
⊢ 1 = bif bodd 1 then 1 else 0
[PROOFSTEP]
rfl
[GOAL]
n : ℕ
⊢ div2 (succ n) = bif bodd n then succ (div2 n) else div2 n
[PROOFSTEP]
simp only [bodd, boddDiv2, div2]
[GOAL]
n : ℕ
⊢ (match boddDiv2 n with
      | (false, m) => (true, m)
      | (true, m) => (false, succ m)).snd =
    bif (boddDiv2 n).fst then succ (boddDiv2 n).snd else (boddDiv2 n).snd
[PROOFSTEP]
cases' boddDiv2 n with fst snd
[GOAL]
case mk
n : ℕ
fst : Bool
snd : ℕ
⊢ (match (fst, snd) with
      | (false, m) => (true, m)
      | (true, m) => (false, succ m)).snd =
    bif (fst, snd).fst then succ (fst, snd).snd else (fst, snd).snd
[PROOFSTEP]
cases fst
[GOAL]
case mk.false
n snd : ℕ
⊢ (match (false, snd) with
      | (false, m) => (true, m)
      | (true, m) => (false, succ m)).snd =
    bif (false, snd).fst then succ (false, snd).snd else (false, snd).snd
case mk.true
n snd : ℕ
⊢ (match (true, snd) with
      | (false, m) => (true, m)
      | (true, m) => (false, succ m)).snd =
    bif (true, snd).fst then succ (true, snd).snd else (true, snd).snd
[PROOFSTEP]
case mk.false => simp
[GOAL]
n snd : ℕ
⊢ (match (false, snd) with
      | (false, m) => (true, m)
      | (true, m) => (false, succ m)).snd =
    bif (false, snd).fst then succ (false, snd).snd else (false, snd).snd
[PROOFSTEP]
case mk.false => simp
[GOAL]
n snd : ℕ
⊢ (match (false, snd) with
      | (false, m) => (true, m)
      | (true, m) => (false, succ m)).snd =
    bif (false, snd).fst then succ (false, snd).snd else (false, snd).snd
[PROOFSTEP]
simp
[GOAL]
case mk.true
n snd : ℕ
⊢ (match (true, snd) with
      | (false, m) => (true, m)
      | (true, m) => (false, succ m)).snd =
    bif (true, snd).fst then succ (true, snd).snd else (true, snd).snd
[PROOFSTEP]
case mk.true => simp
[GOAL]
n snd : ℕ
⊢ (match (true, snd) with
      | (false, m) => (true, m)
      | (true, m) => (false, succ m)).snd =
    bif (true, snd).fst then succ (true, snd).snd else (true, snd).snd
[PROOFSTEP]
case mk.true => simp
[GOAL]
n snd : ℕ
⊢ (match (true, snd) with
      | (false, m) => (true, m)
      | (true, m) => (false, succ m)).snd =
    bif (true, snd).fst then succ (true, snd).snd else (true, snd).snd
[PROOFSTEP]
simp
[GOAL]
n : ℕ
⊢ (bif bodd (succ n) then 1 else 0) + 2 * div2 (succ n) = succ n
[PROOFSTEP]
simp
[GOAL]
n : ℕ
⊢ (bif bodd n then 0 else 1) + (bif bodd n then succ (div2 n) else div2 n) * 2 = succ n
[PROOFSTEP]
refine' Eq.trans _ (congr_arg succ (bodd_add_div2 n))
[GOAL]
n : ℕ
⊢ (bif bodd n then 0 else 1) + (bif bodd n then succ (div2 n) else div2 n) * 2 =
    succ ((bif bodd n then 1 else 0) + 2 * div2 n)
[PROOFSTEP]
cases bodd n
[GOAL]
case false
n : ℕ
⊢ (bif false then 0 else 1) + (bif false then succ (div2 n) else div2 n) * 2 =
    succ ((bif false then 1 else 0) + 2 * div2 n)
[PROOFSTEP]
simp [cond, not]
[GOAL]
case true
n : ℕ
⊢ (bif true then 0 else 1) + (bif true then succ (div2 n) else div2 n) * 2 =
    succ ((bif true then 1 else 0) + 2 * div2 n)
[PROOFSTEP]
simp [cond, not]
[GOAL]
case false
n : ℕ
⊢ 1 + div2 n * 2 = succ (div2 n * 2)
[PROOFSTEP]
rw [Nat.add_comm, Nat.add_succ]
[GOAL]
case true
n : ℕ
⊢ succ (div2 n) * 2 = succ (1 + div2 n * 2)
[PROOFSTEP]
rw [succ_mul, Nat.add_comm 1, Nat.add_succ]
[GOAL]
n : ℕ
⊢ div2 n = n / 2
[PROOFSTEP]
refine' Nat.eq_of_mul_eq_mul_left (by decide) (Nat.add_left_cancel (Eq.trans _ (Nat.mod_add_div n 2).symm))
[GOAL]
n : ℕ
⊢ 0 < 2
[PROOFSTEP]
decide
[GOAL]
n : ℕ
⊢ n % 2 + 2 * div2 n = n
[PROOFSTEP]
rw [mod_two_of_bodd, bodd_add_div2]
[GOAL]
n : ℕ
⊢ n + n = 0 + n + n
[PROOFSTEP]
rw [Nat.zero_add]
[GOAL]
b : Bool
n : ℕ
⊢ bit b n = 2 * n + bif b then 1 else 0
[PROOFSTEP]
cases b
[GOAL]
case false
n : ℕ
⊢ bit false n = 2 * n + bif false then 1 else 0
case true n : ℕ ⊢ bit true n = 2 * n + bif true then 1 else 0
[PROOFSTEP]
apply bit0_val
[GOAL]
case true
n : ℕ
⊢ bit true n = 2 * n + bif true then 1 else 0
[PROOFSTEP]
apply bit1_val
[GOAL]
⊢ ∀ (n : ℕ), shiftr 0 n = 0
[PROOFSTEP]
intro n
[GOAL]
n : ℕ
⊢ shiftr 0 n = 0
[PROOFSTEP]
induction' n with n IH
[GOAL]
case zero
⊢ shiftr 0 zero = 0
case succ n : ℕ IH : shiftr 0 n = 0 ⊢ shiftr 0 (succ n) = 0
[PROOFSTEP]
case zero => rw [shiftr]
[GOAL]
⊢ shiftr 0 zero = 0
[PROOFSTEP]
case zero => rw [shiftr]
[GOAL]
⊢ shiftr 0 zero = 0
[PROOFSTEP]
rw [shiftr]
[GOAL]
case succ
n : ℕ
IH : shiftr 0 n = 0
⊢ shiftr 0 (succ n) = 0
[PROOFSTEP]
case succ =>
  rw [shiftr, div2, IH]
  rfl
[GOAL]
n : ℕ
IH : shiftr 0 n = 0
⊢ shiftr 0 (succ n) = 0
[PROOFSTEP]
case succ =>
  rw [shiftr, div2, IH]
  rfl
[GOAL]
n : ℕ
IH : shiftr 0 n = 0
⊢ shiftr 0 (succ n) = 0
[PROOFSTEP]
rw [shiftr, div2, IH]
[GOAL]
n : ℕ
IH : shiftr 0 n = 0
⊢ (boddDiv2 0).snd = 0
[PROOFSTEP]
rfl
[GOAL]
n : ℕ
h : n ≠ 0
⊢ div2 n < n
[PROOFSTEP]
rw [div2_val]
[GOAL]
n : ℕ
h : n ≠ 0
⊢ n / 2 < n
[PROOFSTEP]
apply (div_lt_iff_lt_mul <| succ_pos 1).2
[GOAL]
n : ℕ
h : n ≠ 0
⊢ n < n * succ 1
[PROOFSTEP]
have := Nat.mul_lt_mul_of_pos_left (lt_succ_self 1) (lt_of_le_of_ne n.zero_le h.symm)
[GOAL]
n : ℕ
h : n ≠ 0
this : n * 1 < n * succ 1
⊢ n < n * succ 1
[PROOFSTEP]
rwa [Nat.mul_one] at this
[GOAL]
C : ℕ → Sort u
z : C 0
f : (b : Bool) → (n : ℕ) → C n → C (bit b n)
n : ℕ
n0 : n = 0
⊢ C n
[PROOFSTEP]
simp [n0]
[GOAL]
C : ℕ → Sort u
z : C 0
f : (b : Bool) → (n : ℕ) → C n → C (bit b n)
n : ℕ
n0 : n = 0
⊢ C 0
[PROOFSTEP]
exact z
[GOAL]
C : ℕ → Sort u
z : C 0
f : (b : Bool) → (n : ℕ) → C n → C (bit b n)
n : ℕ
n0 : ¬n = 0
⊢ C n
[PROOFSTEP]
let n' := div2 n
[GOAL]
C : ℕ → Sort u
z : C 0
f : (b : Bool) → (n : ℕ) → C n → C (bit b n)
n : ℕ
n0 : ¬n = 0
n' : ℕ := div2 n
⊢ C n
[PROOFSTEP]
have _x : bit (bodd n) n' = n := by apply bit_decomp n
[GOAL]
C : ℕ → Sort u
z : C 0
f : (b : Bool) → (n : ℕ) → C n → C (bit b n)
n : ℕ
n0 : ¬n = 0
n' : ℕ := div2 n
⊢ bit (bodd n) n' = n
[PROOFSTEP]
apply bit_decomp n
[GOAL]
C : ℕ → Sort u
z : C 0
f : (b : Bool) → (n : ℕ) → C n → C (bit b n)
n : ℕ
n0 : ¬n = 0
n' : ℕ := div2 n
_x : bit (bodd n) n' = n
⊢ C n
[PROOFSTEP]
rw [← _x]
[GOAL]
C : ℕ → Sort u
z : C 0
f : (b : Bool) → (n : ℕ) → C n → C (bit b n)
n : ℕ
n0 : ¬n = 0
n' : ℕ := div2 n
_x : bit (bodd n) n' = n
⊢ C (bit (bodd n) n')
[PROOFSTEP]
exact f (bodd n) n' (binaryRec z f n')
[GOAL]
n : ℕ
n0 : ¬n = 0
n' : ℕ := div2 n
_x : bit (bodd n) n' = n
⊢ (invImage (fun a => sizeOf a) instWellFoundedRelation).1 n' n
[PROOFSTEP]
exact binaryRec_decreasing n0
[GOAL]
C : ℕ → Sort u
z : C 0
f : (b : Bool) → (n : ℕ) → C n → C (bit b n)
⊢ binaryRec z f 0 = z
[PROOFSTEP]
rw [binaryRec]
[GOAL]
C : ℕ → Sort u
z : C 0
f : (b : Bool) → (n : ℕ) → C n → C (bit b n)
⊢ (if n0 : 0 = 0 then Eq.mpr (_ : C 0 = C 0) z
    else
      let n' := div2 0;
      let_fun _x := (_ : bit (bodd 0) (div2 0) = 0);
      Eq.mpr (_ : C 0 = C (bit (bodd 0) n')) (f (bodd 0) n' (binaryRec z f n'))) =
    z
[PROOFSTEP]
rfl
[GOAL]
b : Bool
n : ℕ
⊢ bodd (bit b n) = b
[PROOFSTEP]
rw [bit_val]
[GOAL]
b : Bool
n : ℕ
⊢ bodd (2 * n + bif b then 1 else 0) = b
[PROOFSTEP]
simp
[GOAL]
b : Bool
n : ℕ
⊢ bodd (bif b then 1 else 0) = b
[PROOFSTEP]
cases b
[GOAL]
case false
n : ℕ
⊢ bodd (bif false then 1 else 0) = false
[PROOFSTEP]
cases bodd n
[GOAL]
case true
n : ℕ
⊢ bodd (bif true then 1 else 0) = true
[PROOFSTEP]
cases bodd n
[GOAL]
case false.false
n : ℕ
⊢ bodd (bif false then 1 else 0) = false
[PROOFSTEP]
rfl
[GOAL]
case false.true
n : ℕ
⊢ bodd (bif false then 1 else 0) = false
[PROOFSTEP]
rfl
[GOAL]
case true.false
n : ℕ
⊢ bodd (bif true then 1 else 0) = true
[PROOFSTEP]
rfl
[GOAL]
case true.true
n : ℕ
⊢ bodd (bif true then 1 else 0) = true
[PROOFSTEP]
rfl
[GOAL]
b : Bool
n : ℕ
⊢ div2 (bit b n) = n
[PROOFSTEP]
rw [bit_val, div2_val, Nat.add_comm, add_mul_div_left, div_eq_of_lt, Nat.zero_add]
[GOAL]
b : Bool
n : ℕ
⊢ (bif b then 1 else 0) < 2
[PROOFSTEP]
cases b
[GOAL]
case H
b : Bool
n : ℕ
⊢ 0 < 2
[PROOFSTEP]
cases b
[GOAL]
case false
n : ℕ
⊢ (bif false then 1 else 0) < 2
[PROOFSTEP]
exact by decide
[GOAL]
n : ℕ
⊢ (bif false then 1 else 0) < 2
[PROOFSTEP]
decide
[GOAL]
case true
n : ℕ
⊢ (bif true then 1 else 0) < 2
[PROOFSTEP]
exact by decide
[GOAL]
n : ℕ
⊢ (bif true then 1 else 0) < 2
[PROOFSTEP]
decide
[GOAL]
case H.false
n : ℕ
⊢ 0 < 2
[PROOFSTEP]
exact by decide
[GOAL]
n : ℕ
⊢ 0 < 2
[PROOFSTEP]
decide
[GOAL]
case H.true
n : ℕ
⊢ 0 < 2
[PROOFSTEP]
exact by decide
[GOAL]
n : ℕ
⊢ 0 < 2
[PROOFSTEP]
decide
[GOAL]
b : Bool
m n k : ℕ
h : k + 1 ≤ n + 1
⊢ shiftl' b m (n + 1 - (k + 1)) = shiftr (shiftl' b m (n + 1)) (k + 1)
[PROOFSTEP]
simp [shiftl']
[GOAL]
b : Bool
m n k : ℕ
h : k + 1 ≤ n + 1
⊢ shiftl' b m (n - k) = shiftr (bit b (shiftl' b m n)) (k + 1)
[PROOFSTEP]
rw [Nat.add_comm, shiftr_add]
[GOAL]
b : Bool
m n k : ℕ
h : k + 1 ≤ n + 1
⊢ shiftl' b m (n - k) = shiftr (shiftr (bit b (shiftl' b m n)) 1) k
[PROOFSTEP]
simp [shiftr, div2_bit]
[GOAL]
b : Bool
m n k : ℕ
h : k + 1 ≤ n + 1
⊢ shiftl' b m (n - k) = shiftr (shiftl' b m n) k
[PROOFSTEP]
simp [shiftl'_sub, (Nat.le_of_succ_le_succ h)]
[GOAL]
m : ℕ
b : Bool
n : ℕ
⊢ testBit (bit b n) (succ m) = testBit n m
[PROOFSTEP]
have : bodd (shiftr (shiftr (bit b n) 1) m) = bodd (shiftr n m) :=
  by
  dsimp [shiftr]
  rw [div2_bit]
[GOAL]
m : ℕ
b : Bool
n : ℕ
⊢ bodd (shiftr (shiftr (bit b n) 1) m) = bodd (shiftr n m)
[PROOFSTEP]
dsimp [shiftr]
[GOAL]
m : ℕ
b : Bool
n : ℕ
⊢ bodd (shiftr (div2 (bit b n)) m) = bodd (shiftr n m)
[PROOFSTEP]
rw [div2_bit]
[GOAL]
m : ℕ
b : Bool
n : ℕ
this : bodd (shiftr (shiftr (bit b n) 1) m) = bodd (shiftr n m)
⊢ testBit (bit b n) (succ m) = testBit n m
[PROOFSTEP]
rw [← shiftr_add, Nat.add_comm] at this
[GOAL]
m : ℕ
b : Bool
n : ℕ
this : bodd (shiftr (bit b n) (m + 1)) = bodd (shiftr n m)
⊢ testBit (bit b n) (succ m) = testBit n m
[PROOFSTEP]
exact this
[GOAL]
C : ℕ → Sort u
z : C 0
f : (b : Bool) → (n : ℕ) → C n → C (bit b n)
h : f false 0 z = z
b : Bool
n : ℕ
⊢ binaryRec z f (bit b n) = f b n (binaryRec z f n)
[PROOFSTEP]
rw [binaryRec]
[GOAL]
C : ℕ → Sort u
z : C 0
f : (b : Bool) → (n : ℕ) → C n → C (bit b n)
h : f false 0 z = z
b : Bool
n : ℕ
⊢ (if n0 : bit b n = 0 then Eq.mpr (_ : C (bit b n) = C 0) z
    else
      let n' := div2 (bit b n);
      let_fun _x := (_ : bit (bodd (bit b n)) (div2 (bit b n)) = bit b n);
      Eq.mpr (_ : C (bit b n) = C (bit (bodd (bit b n)) n')) (f (bodd (bit b n)) n' (binaryRec z f n'))) =
    f b n (binaryRec z f n)
[PROOFSTEP]
by_cases h :
  bit b n =
    0
      -- Note: this renames the original `h : f false 0 z = z` to `h'` and leaves `h : bit b n = 0`
[GOAL]
case pos
C : ℕ → Sort u
z : C 0
f : (b : Bool) → (n : ℕ) → C n → C (bit b n)
h✝ : f false 0 z = z
b : Bool
n : ℕ
h : bit b n = 0
⊢ (if n0 : bit b n = 0 then Eq.mpr (_ : C (bit b n) = C 0) z
    else
      let n' := div2 (bit b n);
      let_fun _x := (_ : bit (bodd (bit b n)) (div2 (bit b n)) = bit b n);
      Eq.mpr (_ : C (bit b n) = C (bit (bodd (bit b n)) n')) (f (bodd (bit b n)) n' (binaryRec z f n'))) =
    f b n (binaryRec z f n)
case neg
C : ℕ → Sort u
z : C 0
f : (b : Bool) → (n : ℕ) → C n → C (bit b n)
h✝ : f false 0 z = z
b : Bool
n : ℕ
h : ¬bit b n = 0
⊢ (if n0 : bit b n = 0 then Eq.mpr (_ : C (bit b n) = C 0) z
    else
      let n' := div2 (bit b n);
      let_fun _x := (_ : bit (bodd (bit b n)) (div2 (bit b n)) = bit b n);
      Eq.mpr (_ : C (bit b n) = C (bit (bodd (bit b n)) n')) (f (bodd (bit b n)) n' (binaryRec z f n'))) =
    f b n (binaryRec z f n)
[PROOFSTEP]
case pos h' =>
  simp [dif_pos h]
  generalize binaryRec z f (bit b n) = e
  revert e
  have bf := bodd_bit b n
  have n0 := div2_bit b n
  rw [h] at bf n0
  simp at bf n0
  subst bf n0
  rw [binaryRec_zero]
  intros
  rw [h']
  rfl
[GOAL]
C : ℕ → Sort u
z : C 0
f : (b : Bool) → (n : ℕ) → C n → C (bit b n)
h' : f false 0 z = z
b : Bool
n : ℕ
h : bit b n = 0
⊢ (if n0 : bit b n = 0 then Eq.mpr (_ : C (bit b n) = C 0) z
    else
      let n' := div2 (bit b n);
      let_fun _x := (_ : bit (bodd (bit b n)) (div2 (bit b n)) = bit b n);
      Eq.mpr (_ : C (bit b n) = C (bit (bodd (bit b n)) n')) (f (bodd (bit b n)) n' (binaryRec z f n'))) =
    f b n (binaryRec z f n)
[PROOFSTEP]
case pos h' =>
  simp [dif_pos h]
  generalize binaryRec z f (bit b n) = e
  revert e
  have bf := bodd_bit b n
  have n0 := div2_bit b n
  rw [h] at bf n0
  simp at bf n0
  subst bf n0
  rw [binaryRec_zero]
  intros
  rw [h']
  rfl
[GOAL]
C : ℕ → Sort u
z : C 0
f : (b : Bool) → (n : ℕ) → C n → C (bit b n)
h' : f false 0 z = z
b : Bool
n : ℕ
h : bit b n = 0
⊢ (if n0 : bit b n = 0 then Eq.mpr (_ : C (bit b n) = C 0) z
    else
      let n' := div2 (bit b n);
      let_fun _x := (_ : bit (bodd (bit b n)) (div2 (bit b n)) = bit b n);
      Eq.mpr (_ : C (bit b n) = C (bit (bodd (bit b n)) n')) (f (bodd (bit b n)) n' (binaryRec z f n'))) =
    f b n (binaryRec z f n)
[PROOFSTEP]
simp [dif_pos h]
[GOAL]
C : ℕ → Sort u
z : C 0
f : (b : Bool) → (n : ℕ) → C n → C (bit b n)
h' : f false 0 z = z
b : Bool
n : ℕ
h : bit b n = 0
⊢ Eq.mpr (_ : C (bit b n) = C 0) z = f b n (binaryRec z f n)
[PROOFSTEP]
generalize binaryRec z f (bit b n) = e
[GOAL]
C : ℕ → Sort u
z : C 0
f : (b : Bool) → (n : ℕ) → C n → C (bit b n)
h' : f false 0 z = z
b : Bool
n : ℕ
h : bit b n = 0
e : C (bit b n)
⊢ Eq.mpr (_ : C (bit b n) = C 0) z = f b n (binaryRec z f n)
[PROOFSTEP]
revert e
[GOAL]
C : ℕ → Sort u
z : C 0
f : (b : Bool) → (n : ℕ) → C n → C (bit b n)
h' : f false 0 z = z
b : Bool
n : ℕ
h : bit b n = 0
⊢ C (bit b n) → Eq.mpr (_ : C (bit b n) = C 0) z = f b n (binaryRec z f n)
[PROOFSTEP]
have bf := bodd_bit b n
[GOAL]
C : ℕ → Sort u
z : C 0
f : (b : Bool) → (n : ℕ) → C n → C (bit b n)
h' : f false 0 z = z
b : Bool
n : ℕ
h : bit b n = 0
bf : bodd (bit b n) = b
⊢ C (bit b n) → Eq.mpr (_ : C (bit b n) = C 0) z = f b n (binaryRec z f n)
[PROOFSTEP]
have n0 := div2_bit b n
[GOAL]
C : ℕ → Sort u
z : C 0
f : (b : Bool) → (n : ℕ) → C n → C (bit b n)
h' : f false 0 z = z
b : Bool
n : ℕ
h : bit b n = 0
bf : bodd (bit b n) = b
n0 : div2 (bit b n) = n
⊢ C (bit b n) → Eq.mpr (_ : C (bit b n) = C 0) z = f b n (binaryRec z f n)
[PROOFSTEP]
rw [h] at bf n0
[GOAL]
C : ℕ → Sort u
z : C 0
f : (b : Bool) → (n : ℕ) → C n → C (bit b n)
h' : f false 0 z = z
b : Bool
n : ℕ
h : bit b n = 0
bf : bodd 0 = b
n0 : div2 0 = n
⊢ C (bit b n) → Eq.mpr (_ : C (bit b n) = C 0) z = f b n (binaryRec z f n)
[PROOFSTEP]
simp at bf n0
[GOAL]
C : ℕ → Sort u
z : C 0
f : (b : Bool) → (n : ℕ) → C n → C (bit b n)
h' : f false 0 z = z
b : Bool
n : ℕ
h : bit b n = 0
bf : false = b
n0 : 0 = n
⊢ C (bit b n) → Eq.mpr (_ : C (bit b n) = C 0) z = f b n (binaryRec z f n)
[PROOFSTEP]
subst bf n0
[GOAL]
C : ℕ → Sort u
z : C 0
f : (b : Bool) → (n : ℕ) → C n → C (bit b n)
h' : f false 0 z = z
h : bit false 0 = 0
⊢ C (bit false 0) → Eq.mpr (_ : C (bit false 0) = C 0) z = f false 0 (binaryRec z f 0)
[PROOFSTEP]
rw [binaryRec_zero]
[GOAL]
C : ℕ → Sort u
z : C 0
f : (b : Bool) → (n : ℕ) → C n → C (bit b n)
h' : f false 0 z = z
h : bit false 0 = 0
⊢ C (bit false 0) → Eq.mpr (_ : C (bit false 0) = C 0) z = f false 0 z
[PROOFSTEP]
intros
[GOAL]
C : ℕ → Sort u
z : C 0
f : (b : Bool) → (n : ℕ) → C n → C (bit b n)
h' : f false 0 z = z
h : bit false 0 = 0
e✝ : C (bit false 0)
⊢ Eq.mpr (_ : C (bit false 0) = C 0) z = f false 0 z
[PROOFSTEP]
rw [h']
[GOAL]
C : ℕ → Sort u
z : C 0
f : (b : Bool) → (n : ℕ) → C n → C (bit b n)
h' : f false 0 z = z
h : bit false 0 = 0
e✝ : C (bit false 0)
⊢ Eq.mpr (_ : C (bit false 0) = C 0) z = z
[PROOFSTEP]
rfl
[GOAL]
case neg
C : ℕ → Sort u
z : C 0
f : (b : Bool) → (n : ℕ) → C n → C (bit b n)
h✝ : f false 0 z = z
b : Bool
n : ℕ
h : ¬bit b n = 0
⊢ (if n0 : bit b n = 0 then Eq.mpr (_ : C (bit b n) = C 0) z
    else
      let n' := div2 (bit b n);
      let_fun _x := (_ : bit (bodd (bit b n)) (div2 (bit b n)) = bit b n);
      Eq.mpr (_ : C (bit b n) = C (bit (bodd (bit b n)) n')) (f (bodd (bit b n)) n' (binaryRec z f n'))) =
    f b n (binaryRec z f n)
[PROOFSTEP]
case neg h' =>
  simp [dif_neg h]
  generalize
    @id (C (bit b n) = C (bit (bodd (bit b n)) (div2 (bit b n))))
      (Eq.symm (bit_decomp (bit b n)) ▸ Eq.refl (C (bit b n))) =
    e
  revert e
  rw [bodd_bit, div2_bit]
  intros; rfl
[GOAL]
C : ℕ → Sort u
z : C 0
f : (b : Bool) → (n : ℕ) → C n → C (bit b n)
h' : f false 0 z = z
b : Bool
n : ℕ
h : ¬bit b n = 0
⊢ (if n0 : bit b n = 0 then Eq.mpr (_ : C (bit b n) = C 0) z
    else
      let n' := div2 (bit b n);
      let_fun _x := (_ : bit (bodd (bit b n)) (div2 (bit b n)) = bit b n);
      Eq.mpr (_ : C (bit b n) = C (bit (bodd (bit b n)) n')) (f (bodd (bit b n)) n' (binaryRec z f n'))) =
    f b n (binaryRec z f n)
[PROOFSTEP]
case neg h' =>
  simp [dif_neg h]
  generalize
    @id (C (bit b n) = C (bit (bodd (bit b n)) (div2 (bit b n))))
      (Eq.symm (bit_decomp (bit b n)) ▸ Eq.refl (C (bit b n))) =
    e
  revert e
  rw [bodd_bit, div2_bit]
  intros; rfl
[GOAL]
C : ℕ → Sort u
z : C 0
f : (b : Bool) → (n : ℕ) → C n → C (bit b n)
h' : f false 0 z = z
b : Bool
n : ℕ
h : ¬bit b n = 0
⊢ (if n0 : bit b n = 0 then Eq.mpr (_ : C (bit b n) = C 0) z
    else
      let n' := div2 (bit b n);
      let_fun _x := (_ : bit (bodd (bit b n)) (div2 (bit b n)) = bit b n);
      Eq.mpr (_ : C (bit b n) = C (bit (bodd (bit b n)) n')) (f (bodd (bit b n)) n' (binaryRec z f n'))) =
    f b n (binaryRec z f n)
[PROOFSTEP]
simp [dif_neg h]
[GOAL]
C : ℕ → Sort u
z : C 0
f : (b : Bool) → (n : ℕ) → C n → C (bit b n)
h' : f false 0 z = z
b : Bool
n : ℕ
h : ¬bit b n = 0
⊢ Eq.mpr (_ : C (bit b n) = C (bit (bodd (bit b n)) (div2 (bit b n))))
      (f (bodd (bit b n)) (div2 (bit b n)) (binaryRec z f (div2 (bit b n)))) =
    f b n (binaryRec z f n)
[PROOFSTEP]
generalize
  @id (C (bit b n) = C (bit (bodd (bit b n)) (div2 (bit b n))))
    (Eq.symm (bit_decomp (bit b n)) ▸ Eq.refl (C (bit b n))) =
  e
[GOAL]
C : ℕ → Sort u
z : C 0
f : (b : Bool) → (n : ℕ) → C n → C (bit b n)
h' : f false 0 z = z
b : Bool
n : ℕ
h : ¬bit b n = 0
e : C (bit b n) = C (bit (bodd (bit b n)) (div2 (bit b n)))
⊢ Eq.mpr e (f (bodd (bit b n)) (div2 (bit b n)) (binaryRec z f (div2 (bit b n)))) = f b n (binaryRec z f n)
[PROOFSTEP]
revert e
[GOAL]
C : ℕ → Sort u
z : C 0
f : (b : Bool) → (n : ℕ) → C n → C (bit b n)
h' : f false 0 z = z
b : Bool
n : ℕ
h : ¬bit b n = 0
⊢ ∀ (e : C (bit b n) = C (bit (bodd (bit b n)) (div2 (bit b n)))),
    Eq.mpr e (f (bodd (bit b n)) (div2 (bit b n)) (binaryRec z f (div2 (bit b n)))) = f b n (binaryRec z f n)
[PROOFSTEP]
rw [bodd_bit, div2_bit]
[GOAL]
C : ℕ → Sort u
z : C 0
f : (b : Bool) → (n : ℕ) → C n → C (bit b n)
h' : f false 0 z = z
b : Bool
n : ℕ
h : ¬bit b n = 0
⊢ ∀ (e : C (bit b n) = C (bit b n)), Eq.mpr e (f b n (binaryRec z f n)) = f b n (binaryRec z f n)
[PROOFSTEP]
intros
[GOAL]
C : ℕ → Sort u
z : C 0
f : (b : Bool) → (n : ℕ) → C n → C (bit b n)
h' : f false 0 z = z
b : Bool
n : ℕ
h : ¬bit b n = 0
e✝ : C (bit b n) = C (bit b n)
⊢ Eq.mpr e✝ (f b n (binaryRec z f n)) = f b n (binaryRec z f n)
[PROOFSTEP]
rfl
[GOAL]
f : Bool → Bool → Bool
h : f false false = false
⊢ (binaryRec (bif f true false then bit false 0 else 0) fun b n x => bit (f false b) (bif f false true then n else 0)) =
    fun n => bif f false true then n else 0
[PROOFSTEP]
funext n
[GOAL]
case h
f : Bool → Bool → Bool
h : f false false = false
n : ℕ
⊢ binaryRec (bif f true false then bit false 0 else 0) (fun b n x => bit (f false b) (bif f false true then n else 0))
      n =
    bif f false true then n else 0
[PROOFSTEP]
apply bitCasesOn n
[GOAL]
case h
f : Bool → Bool → Bool
h : f false false = false
n : ℕ
⊢ ∀ (b : Bool) (n : ℕ),
    binaryRec (bif f true false then bit false 0 else 0) (fun b n x => bit (f false b) (bif f false true then n else 0))
        (bit b n) =
      bif f false true then bit b n else 0
[PROOFSTEP]
intro b n
[GOAL]
case h
f : Bool → Bool → Bool
h : f false false = false
n✝ : ℕ
b : Bool
n : ℕ
⊢ binaryRec (bif f true false then bit false 0 else 0) (fun b n x => bit (f false b) (bif f false true then n else 0))
      (bit b n) =
    bif f false true then bit b n else 0
[PROOFSTEP]
rw [binaryRec_eq]
[GOAL]
case h
f : Bool → Bool → Bool
h : f false false = false
n✝ : ℕ
b : Bool
n : ℕ
⊢ bit (f false b) (bif f false true then n else 0) = bif f false true then bit b n else 0
[PROOFSTEP]
cases b
[GOAL]
case h.false
f : Bool → Bool → Bool
h : f false false = false
n✝ n : ℕ
⊢ bit (f false false) (bif f false true then n else 0) = bif f false true then bit false n else 0
[PROOFSTEP]
try rw [h] <;> induction' fft : f false true <;> simp [cond]
[GOAL]
case h.false
f : Bool → Bool → Bool
h : f false false = false
n✝ n : ℕ
⊢ bit (f false false) (bif f false true then n else 0) = bif f false true then bit false n else 0
[PROOFSTEP]
rw [h]
[GOAL]
case h.false
f : Bool → Bool → Bool
h : f false false = false
n✝ n : ℕ
⊢ bit false (bif f false true then n else 0) = bif f false true then bit false n else 0
[PROOFSTEP]
induction' fft : f false true
[GOAL]
case h.false.false
f : Bool → Bool → Bool
h : f false false = false
n✝ n : ℕ
x✝ : Bool
fft✝ : f false true = x✝
fft : f false true = false
⊢ bit false (bif false then n else 0) = bif false then bit false n else 0
[PROOFSTEP]
simp [cond]
[GOAL]
case h.false.true
f : Bool → Bool → Bool
h : f false false = false
n✝ n : ℕ
x✝ : Bool
fft✝ : f false true = x✝
fft : f false true = true
⊢ bit false (bif true then n else 0) = bif true then bit false n else 0
[PROOFSTEP]
simp [cond]
[GOAL]
case h.true
f : Bool → Bool → Bool
h : f false false = false
n✝ n : ℕ
⊢ bit (f false true) (bif f false true then n else 0) = bif f false true then bit true n else 0
[PROOFSTEP]
try rw [h] <;> induction' fft : f false true <;> simp [cond]
[GOAL]
case h.true
f : Bool → Bool → Bool
h : f false false = false
n✝ n : ℕ
⊢ bit (f false true) (bif f false true then n else 0) = bif f false true then bit true n else 0
[PROOFSTEP]
rw [h]
[GOAL]
case h.true
f : Bool → Bool → Bool
h : f false false = false
n✝ n : ℕ
⊢ bit (f false true) (bif f false true then n else 0) = bif f false true then bit true n else 0
[PROOFSTEP]
cases f false true
[GOAL]
case h.true.false
f : Bool → Bool → Bool
h : f false false = false
n✝ n : ℕ
⊢ bit false (bif false then n else 0) = bif false then bit true n else 0
case h.true.true
f : Bool → Bool → Bool
h : f false false = false
n✝ n : ℕ
⊢ bit true (bif true then n else 0) = bif true then bit true n else 0
[PROOFSTEP]
case h.true.false => simp
[GOAL]
f : Bool → Bool → Bool
h : f false false = false
n✝ n : ℕ
⊢ bit false (bif false then n else 0) = bif false then bit true n else 0
[PROOFSTEP]
case h.true.false => simp
[GOAL]
f : Bool → Bool → Bool
h : f false false = false
n✝ n : ℕ
⊢ bit false (bif false then n else 0) = bif false then bit true n else 0
[PROOFSTEP]
simp
[GOAL]
case h.true.true
f : Bool → Bool → Bool
h : f false false = false
n✝ n : ℕ
⊢ bit true (bif true then n else 0) = bif true then bit true n else 0
[PROOFSTEP]
case h.true.true => simp
[GOAL]
f : Bool → Bool → Bool
h : f false false = false
n✝ n : ℕ
⊢ bit true (bif true then n else 0) = bif true then bit true n else 0
[PROOFSTEP]
case h.true.true => simp
[GOAL]
f : Bool → Bool → Bool
h : f false false = false
n✝ n : ℕ
⊢ bit true (bif true then n else 0) = bif true then bit true n else 0
[PROOFSTEP]
simp
[GOAL]
case h.h
f : Bool → Bool → Bool
h : f false false = false
n✝ : ℕ
b : Bool
n : ℕ
⊢ bit (f false false) (bif f false true then 0 else 0) = bif f true false then bit false 0 else 0
[PROOFSTEP]
rw [h, show cond (f false true) 0 0 = 0 by cases f false true <;> rfl,
  show cond (f true false) (bit false 0) 0 = 0 by cases f true false <;> rfl]
[GOAL]
f : Bool → Bool → Bool
h : f false false = false
n✝ : ℕ
b : Bool
n : ℕ
⊢ (bif f false true then 0 else 0) = 0
[PROOFSTEP]
cases f false true
[GOAL]
case false
f : Bool → Bool → Bool
h : f false false = false
n✝ : ℕ
b : Bool
n : ℕ
⊢ (bif false then 0 else 0) = 0
[PROOFSTEP]
rfl
[GOAL]
case true
f : Bool → Bool → Bool
h : f false false = false
n✝ : ℕ
b : Bool
n : ℕ
⊢ (bif true then 0 else 0) = 0
[PROOFSTEP]
rfl
[GOAL]
f : Bool → Bool → Bool
h : f false false = false
n✝ : ℕ
b : Bool
n : ℕ
⊢ (bif f true false then bit false 0 else 0) = 0
[PROOFSTEP]
cases f true false
[GOAL]
case false
f : Bool → Bool → Bool
h : f false false = false
n✝ : ℕ
b : Bool
n : ℕ
⊢ (bif false then bit false 0 else 0) = 0
[PROOFSTEP]
rfl
[GOAL]
case true
f : Bool → Bool → Bool
h : f false false = false
n✝ : ℕ
b : Bool
n : ℕ
⊢ (bif true then bit false 0 else 0) = 0
[PROOFSTEP]
rfl
[GOAL]
case h.h
f : Bool → Bool → Bool
h : f false false = false
n✝ : ℕ
b : Bool
n : ℕ
⊢ bit false 0 = 0
[PROOFSTEP]
rfl
[GOAL]
f : Bool → Bool → Bool
n : ℕ
⊢ bitwise' f 0 n = bif f false true then n else 0
[PROOFSTEP]
unfold bitwise'
[GOAL]
f : Bool → Bool → Bool
n : ℕ
⊢ binaryRec (fun n => bif f false true then n else 0)
      (fun a m Ia => binaryRec (bif f true false then bit a m else 0) fun b n x => bit (f a b) (Ia n)) 0 n =
    bif f false true then n else 0
[PROOFSTEP]
rw [binaryRec_zero]
[GOAL]
f : Bool → Bool → Bool
h : f false false = false
m : ℕ
⊢ bitwise' f m 0 = bif f true false then m else 0
[PROOFSTEP]
unfold bitwise'
[GOAL]
f : Bool → Bool → Bool
h : f false false = false
m : ℕ
⊢ binaryRec (fun n => bif f false true then n else 0)
      (fun a m Ia => binaryRec (bif f true false then bit a m else 0) fun b n x => bit (f a b) (Ia n)) m 0 =
    bif f true false then m else 0
[PROOFSTEP]
apply bitCasesOn m
[GOAL]
f : Bool → Bool → Bool
h : f false false = false
m : ℕ
⊢ ∀ (b : Bool) (n : ℕ),
    binaryRec (fun n => bif f false true then n else 0)
        (fun a m Ia => binaryRec (bif f true false then bit a m else 0) fun b n x => bit (f a b) (Ia n)) (bit b n) 0 =
      bif f true false then bit b n else 0
[PROOFSTEP]
intros
[GOAL]
f : Bool → Bool → Bool
h : f false false = false
m : ℕ
b✝ : Bool
n✝ : ℕ
⊢ binaryRec (fun n => bif f false true then n else 0)
      (fun a m Ia => binaryRec (bif f true false then bit a m else 0) fun b n x => bit (f a b) (Ia n)) (bit b✝ n✝) 0 =
    bif f true false then bit b✝ n✝ else 0
[PROOFSTEP]
rw [binaryRec_eq, binaryRec_zero]
[GOAL]
case h
f : Bool → Bool → Bool
h : f false false = false
m : ℕ
b✝ : Bool
n✝ : ℕ
⊢ (binaryRec (bif f true false then bit false 0 else 0) fun b n x => bit (f false b) (bif f false true then n else 0)) =
    fun n => bif f false true then n else 0
[PROOFSTEP]
exact bitwise'_bit_aux h
[GOAL]
f : Bool → Bool → Bool
⊢ bitwise' f 0 0 = 0
[PROOFSTEP]
rw [bitwise'_zero_left]
[GOAL]
f : Bool → Bool → Bool
⊢ (bif f false true then 0 else 0) = 0
[PROOFSTEP]
cases f false true
[GOAL]
case false
f : Bool → Bool → Bool
⊢ (bif false then 0 else 0) = 0
[PROOFSTEP]
rfl
[GOAL]
case true
f : Bool → Bool → Bool
⊢ (bif true then 0 else 0) = 0
[PROOFSTEP]
rfl
[GOAL]
f : Bool → Bool → Bool
h : f false false = false
a : Bool
m : ℕ
b : Bool
n : ℕ
⊢ bitwise' f (bit a m) (bit b n) = bit (f a b) (bitwise' f m n)
[PROOFSTEP]
unfold bitwise'
[GOAL]
f : Bool → Bool → Bool
h : f false false = false
a : Bool
m : ℕ
b : Bool
n : ℕ
⊢ binaryRec (fun n => bif f false true then n else 0)
      (fun a m Ia => binaryRec (bif f true false then bit a m else 0) fun b n x => bit (f a b) (Ia n)) (bit a m)
      (bit b n) =
    bit (f a b)
      (binaryRec (fun n => bif f false true then n else 0)
        (fun a m Ia => binaryRec (bif f true false then bit a m else 0) fun b n x => bit (f a b) (Ia n)) m n)
[PROOFSTEP]
rw [binaryRec_eq, binaryRec_eq]
[GOAL]
case h
f : Bool → Bool → Bool
h : f false false = false
a : Bool
m : ℕ
b : Bool
n : ℕ
⊢ bit (f a false)
      (binaryRec (fun n => bif f false true then n else 0)
        (fun a m Ia => binaryRec (bif f true false then bit a m else 0) fun b n x => bit (f a b) (Ia n)) m 0) =
    bif f true false then bit a m else 0
[PROOFSTEP]
induction' ftf : f true false
[GOAL]
case h.false
f : Bool → Bool → Bool
h : f false false = false
a : Bool
m : ℕ
b : Bool
n : ℕ
x✝ : Bool
ftf✝ : f true false = x✝
ftf : f true false = false
⊢ bit (f a false)
      (binaryRec (fun n => bif f false true then n else 0)
        (fun a m Ia => binaryRec (bif false then bit a m else 0) fun b n x => bit (f a b) (Ia n)) m 0) =
    bif false then bit a m else 0
case h.true
f : Bool → Bool → Bool
h : f false false = false
a : Bool
m : ℕ
b : Bool
n : ℕ
x✝ : Bool
ftf✝ : f true false = x✝
ftf : f true false = true
⊢ bit (f a false)
      (binaryRec (fun n => bif f false true then n else 0)
        (fun a m Ia => binaryRec (bif true then bit a m else 0) fun b n x => bit (f a b) (Ia n)) m 0) =
    bif true then bit a m else 0
[PROOFSTEP]
rw [show f a false = false by cases a <;> assumption]
[GOAL]
f : Bool → Bool → Bool
h : f false false = false
a : Bool
m : ℕ
b : Bool
n : ℕ
x✝ : Bool
ftf✝ : f true false = x✝
ftf : f true false = false
⊢ f a false = false
[PROOFSTEP]
cases a
[GOAL]
case false
f : Bool → Bool → Bool
h : f false false = false
m : ℕ
b : Bool
n : ℕ
x✝ : Bool
ftf✝ : f true false = x✝
ftf : f true false = false
⊢ f false false = false
[PROOFSTEP]
assumption
[GOAL]
case true
f : Bool → Bool → Bool
h : f false false = false
m : ℕ
b : Bool
n : ℕ
x✝ : Bool
ftf✝ : f true false = x✝
ftf : f true false = false
⊢ f true false = false
[PROOFSTEP]
assumption
[GOAL]
case h.false
f : Bool → Bool → Bool
h : f false false = false
a : Bool
m : ℕ
b : Bool
n : ℕ
x✝ : Bool
ftf✝ : f true false = x✝
ftf : f true false = false
⊢ bit false
      (binaryRec (fun n => bif f false true then n else 0)
        (fun a m Ia => binaryRec (bif false then bit a m else 0) fun b n x => bit (f a b) (Ia n)) m 0) =
    bif false then bit a m else 0
case h.true
f : Bool → Bool → Bool
h : f false false = false
a : Bool
m : ℕ
b : Bool
n : ℕ
x✝ : Bool
ftf✝ : f true false = x✝
ftf : f true false = true
⊢ bit (f a false)
      (binaryRec (fun n => bif f false true then n else 0)
        (fun a m Ia => binaryRec (bif true then bit a m else 0) fun b n x => bit (f a b) (Ia n)) m 0) =
    bif true then bit a m else 0
[PROOFSTEP]
apply @congr_arg _ _ _ 0 (bit false)
[GOAL]
case h.false
f : Bool → Bool → Bool
h : f false false = false
a : Bool
m : ℕ
b : Bool
n : ℕ
x✝ : Bool
ftf✝ : f true false = x✝
ftf : f true false = false
⊢ binaryRec (fun n => bif f false true then n else 0)
      (fun a m Ia => binaryRec (bif false then bit a m else 0) fun b n x => bit (f a b) (Ia n)) m 0 =
    0
case h.true
f : Bool → Bool → Bool
h : f false false = false
a : Bool
m : ℕ
b : Bool
n : ℕ
x✝ : Bool
ftf✝ : f true false = x✝
ftf : f true false = true
⊢ bit (f a false)
      (binaryRec (fun n => bif f false true then n else 0)
        (fun a m Ia => binaryRec (bif true then bit a m else 0) fun b n x => bit (f a b) (Ia n)) m 0) =
    bif true then bit a m else 0
[PROOFSTEP]
swap
[GOAL]
case h.true
f : Bool → Bool → Bool
h : f false false = false
a : Bool
m : ℕ
b : Bool
n : ℕ
x✝ : Bool
ftf✝ : f true false = x✝
ftf : f true false = true
⊢ bit (f a false)
      (binaryRec (fun n => bif f false true then n else 0)
        (fun a m Ia => binaryRec (bif true then bit a m else 0) fun b n x => bit (f a b) (Ia n)) m 0) =
    bif true then bit a m else 0
case h.false
f : Bool → Bool → Bool
h : f false false = false
a : Bool
m : ℕ
b : Bool
n : ℕ
x✝ : Bool
ftf✝ : f true false = x✝
ftf : f true false = false
⊢ binaryRec (fun n => bif f false true then n else 0)
      (fun a m Ia => binaryRec (bif false then bit a m else 0) fun b n x => bit (f a b) (Ia n)) m 0 =
    0
[PROOFSTEP]
rw [show f a false = a by cases a <;> assumption]
[GOAL]
f : Bool → Bool → Bool
h : f false false = false
a : Bool
m : ℕ
b : Bool
n : ℕ
x✝ : Bool
ftf✝ : f true false = x✝
ftf : f true false = true
⊢ f a false = a
[PROOFSTEP]
cases a
[GOAL]
case false
f : Bool → Bool → Bool
h : f false false = false
m : ℕ
b : Bool
n : ℕ
x✝ : Bool
ftf✝ : f true false = x✝
ftf : f true false = true
⊢ f false false = false
[PROOFSTEP]
assumption
[GOAL]
case true
f : Bool → Bool → Bool
h : f false false = false
m : ℕ
b : Bool
n : ℕ
x✝ : Bool
ftf✝ : f true false = x✝
ftf : f true false = true
⊢ f true false = true
[PROOFSTEP]
assumption
[GOAL]
case h.true
f : Bool → Bool → Bool
h : f false false = false
a : Bool
m : ℕ
b : Bool
n : ℕ
x✝ : Bool
ftf✝ : f true false = x✝
ftf : f true false = true
⊢ bit a
      (binaryRec (fun n => bif f false true then n else 0)
        (fun a m Ia => binaryRec (bif true then bit a m else 0) fun b n x => bit (f a b) (Ia n)) m 0) =
    bif true then bit a m else 0
case h.false
f : Bool → Bool → Bool
h : f false false = false
a : Bool
m : ℕ
b : Bool
n : ℕ
x✝ : Bool
ftf✝ : f true false = x✝
ftf : f true false = false
⊢ binaryRec (fun n => bif f false true then n else 0)
      (fun a m Ia => binaryRec (bif false then bit a m else 0) fun b n x => bit (f a b) (Ia n)) m 0 =
    0
[PROOFSTEP]
apply congr_arg (bit a)
[GOAL]
case h.true
f : Bool → Bool → Bool
h : f false false = false
a : Bool
m : ℕ
b : Bool
n : ℕ
x✝ : Bool
ftf✝ : f true false = x✝
ftf : f true false = true
⊢ binaryRec (fun n => bif f false true then n else 0)
      (fun a m Ia => binaryRec (bif true then bit a m else 0) fun b n x => bit (f a b) (Ia n)) m 0 =
    m
case h.false
f : Bool → Bool → Bool
h : f false false = false
a : Bool
m : ℕ
b : Bool
n : ℕ
x✝ : Bool
ftf✝ : f true false = x✝
ftf : f true false = false
⊢ binaryRec (fun n => bif f false true then n else 0)
      (fun a m Ia => binaryRec (bif false then bit a m else 0) fun b n x => bit (f a b) (Ia n)) m 0 =
    0
[PROOFSTEP]
all_goals {
  apply bitCasesOn m
  intro a m
  rw [binaryRec_eq, binaryRec_zero]
  · rfl
  · rw [← bitwise'_bit_aux h, ftf]
}
[GOAL]
case h.true
f : Bool → Bool → Bool
h : f false false = false
a : Bool
m : ℕ
b : Bool
n : ℕ
x✝ : Bool
ftf✝ : f true false = x✝
ftf : f true false = true
⊢ binaryRec (fun n => bif f false true then n else 0)
      (fun a m Ia => binaryRec (bif true then bit a m else 0) fun b n x => bit (f a b) (Ia n)) m 0 =
    m
[PROOFSTEP]
{ apply bitCasesOn m
  intro a m
  rw [binaryRec_eq, binaryRec_zero]
  · rfl
  · rw [← bitwise'_bit_aux h, ftf]
}
[GOAL]
case h.true
f : Bool → Bool → Bool
h : f false false = false
a : Bool
m : ℕ
b : Bool
n : ℕ
x✝ : Bool
ftf✝ : f true false = x✝
ftf : f true false = true
⊢ binaryRec (fun n => bif f false true then n else 0)
      (fun a m Ia => binaryRec (bif true then bit a m else 0) fun b n x => bit (f a b) (Ia n)) m 0 =
    m
[PROOFSTEP]
apply bitCasesOn m
[GOAL]
case h.true
f : Bool → Bool → Bool
h : f false false = false
a : Bool
m : ℕ
b : Bool
n : ℕ
x✝ : Bool
ftf✝ : f true false = x✝
ftf : f true false = true
⊢ ∀ (b : Bool) (n : ℕ),
    binaryRec (fun n => bif f false true then n else 0)
        (fun a m Ia => binaryRec (bif true then bit a m else 0) fun b n x => bit (f a b) (Ia n)) (bit b n) 0 =
      bit b n
[PROOFSTEP]
intro a m
[GOAL]
case h.true
f : Bool → Bool → Bool
h : f false false = false
a✝ : Bool
m✝ : ℕ
b : Bool
n : ℕ
x✝ : Bool
ftf✝ : f true false = x✝
ftf : f true false = true
a : Bool
m : ℕ
⊢ binaryRec (fun n => bif f false true then n else 0)
      (fun a m Ia => binaryRec (bif true then bit a m else 0) fun b n x => bit (f a b) (Ia n)) (bit a m) 0 =
    bit a m
[PROOFSTEP]
rw [binaryRec_eq, binaryRec_zero]
[GOAL]
case h.true
f : Bool → Bool → Bool
h : f false false = false
a✝ : Bool
m✝ : ℕ
b : Bool
n : ℕ
x✝ : Bool
ftf✝ : f true false = x✝
ftf : f true false = true
a : Bool
m : ℕ
⊢ (bif true then bit a m else 0) = bit a m
[PROOFSTEP]
rfl
[GOAL]
case h.true.h
f : Bool → Bool → Bool
h : f false false = false
a✝ : Bool
m✝ : ℕ
b : Bool
n : ℕ
x✝ : Bool
ftf✝ : f true false = x✝
ftf : f true false = true
a : Bool
m : ℕ
⊢ (binaryRec (bif true then bit false 0 else 0) fun b n x => bit (f false b) (bif f false true then n else 0)) =
    fun n => bif f false true then n else 0
[PROOFSTEP]
rw [← bitwise'_bit_aux h, ftf]
[GOAL]
case h.false
f : Bool → Bool → Bool
h : f false false = false
a : Bool
m : ℕ
b : Bool
n : ℕ
x✝ : Bool
ftf✝ : f true false = x✝
ftf : f true false = false
⊢ binaryRec (fun n => bif f false true then n else 0)
      (fun a m Ia => binaryRec (bif false then bit a m else 0) fun b n x => bit (f a b) (Ia n)) m 0 =
    0
[PROOFSTEP]
{ apply bitCasesOn m
  intro a m
  rw [binaryRec_eq, binaryRec_zero]
  · rfl
  · rw [← bitwise'_bit_aux h, ftf]
}
[GOAL]
case h.false
f : Bool → Bool → Bool
h : f false false = false
a : Bool
m : ℕ
b : Bool
n : ℕ
x✝ : Bool
ftf✝ : f true false = x✝
ftf : f true false = false
⊢ binaryRec (fun n => bif f false true then n else 0)
      (fun a m Ia => binaryRec (bif false then bit a m else 0) fun b n x => bit (f a b) (Ia n)) m 0 =
    0
[PROOFSTEP]
apply bitCasesOn m
[GOAL]
case h.false
f : Bool → Bool → Bool
h : f false false = false
a : Bool
m : ℕ
b : Bool
n : ℕ
x✝ : Bool
ftf✝ : f true false = x✝
ftf : f true false = false
⊢ ∀ (b : Bool) (n : ℕ),
    binaryRec (fun n => bif f false true then n else 0)
        (fun a m Ia => binaryRec (bif false then bit a m else 0) fun b n x => bit (f a b) (Ia n)) (bit b n) 0 =
      0
[PROOFSTEP]
intro a m
[GOAL]
case h.false
f : Bool → Bool → Bool
h : f false false = false
a✝ : Bool
m✝ : ℕ
b : Bool
n : ℕ
x✝ : Bool
ftf✝ : f true false = x✝
ftf : f true false = false
a : Bool
m : ℕ
⊢ binaryRec (fun n => bif f false true then n else 0)
      (fun a m Ia => binaryRec (bif false then bit a m else 0) fun b n x => bit (f a b) (Ia n)) (bit a m) 0 =
    0
[PROOFSTEP]
rw [binaryRec_eq, binaryRec_zero]
[GOAL]
case h.false
f : Bool → Bool → Bool
h : f false false = false
a✝ : Bool
m✝ : ℕ
b : Bool
n : ℕ
x✝ : Bool
ftf✝ : f true false = x✝
ftf : f true false = false
a : Bool
m : ℕ
⊢ (bif false then bit a m else 0) = 0
[PROOFSTEP]
rfl
[GOAL]
case h.false.h
f : Bool → Bool → Bool
h : f false false = false
a✝ : Bool
m✝ : ℕ
b : Bool
n : ℕ
x✝ : Bool
ftf✝ : f true false = x✝
ftf : f true false = false
a : Bool
m : ℕ
⊢ (binaryRec (bif false then bit false 0 else 0) fun b n x => bit (f false b) (bif f false true then n else 0)) =
    fun n => bif f false true then n else 0
[PROOFSTEP]
rw [← bitwise'_bit_aux h, ftf]
[GOAL]
case h
f : Bool → Bool → Bool
h : f false false = false
a : Bool
m : ℕ
b : Bool
n : ℕ
⊢ (binaryRec (bif f true false then bit false 0 else 0) fun b n x => bit (f false b) (bif f false true then n else 0)) =
    fun n => bif f false true then n else 0
[PROOFSTEP]
exact bitwise'_bit_aux h
[GOAL]
f : Bool → Bool → Bool
h : f false false = false
⊢ bitwise' (Function.swap f) = Function.swap (bitwise' f)
[PROOFSTEP]
funext m n
[GOAL]
case h.h
f : Bool → Bool → Bool
h : f false false = false
m n : ℕ
⊢ bitwise' (Function.swap f) m n = Function.swap (bitwise' f) m n
[PROOFSTEP]
revert n
[GOAL]
case h.h
f : Bool → Bool → Bool
h : f false false = false
m : ℕ
⊢ ∀ (n : ℕ), bitwise' (Function.swap f) m n = Function.swap (bitwise' f) m n
[PROOFSTEP]
dsimp [Function.swap]
[GOAL]
case h.h
f : Bool → Bool → Bool
h : f false false = false
m : ℕ
⊢ ∀ (n : ℕ), bitwise' (fun y x => f x y) m n = bitwise' f n m
[PROOFSTEP]
apply binaryRec _ _ m
[GOAL]
f : Bool → Bool → Bool
h : f false false = false
m : ℕ
⊢ ∀ (n : ℕ), bitwise' (fun y x => f x y) 0 n = bitwise' f n 0
[PROOFSTEP]
intro n
[GOAL]
f : Bool → Bool → Bool
h : f false false = false
m : ℕ
⊢ ∀ (b : Bool) (n : ℕ),
    (∀ (n_1 : ℕ), bitwise' (fun y x => f x y) n n_1 = bitwise' f n_1 n) →
      ∀ (n_1 : ℕ), bitwise' (fun y x => f x y) (bit b n) n_1 = bitwise' f n_1 (bit b n)
[PROOFSTEP]
intro n
[GOAL]
f : Bool → Bool → Bool
h : f false false = false
m n : ℕ
⊢ bitwise' (fun y x => f x y) 0 n = bitwise' f n 0
[PROOFSTEP]
rw [bitwise'_zero_left, bitwise'_zero_right]
[GOAL]
case h
f : Bool → Bool → Bool
h : f false false = false
m n : ℕ
⊢ f false false = false
[PROOFSTEP]
exact h
[GOAL]
f : Bool → Bool → Bool
h : f false false = false
m : ℕ
n : Bool
⊢ ∀ (n_1 : ℕ),
    (∀ (n : ℕ), bitwise' (fun y x => f x y) n_1 n = bitwise' f n n_1) →
      ∀ (n_2 : ℕ), bitwise' (fun y x => f x y) (bit n n_1) n_2 = bitwise' f n_2 (bit n n_1)
[PROOFSTEP]
intros a ih m'
[GOAL]
f : Bool → Bool → Bool
h : f false false = false
m : ℕ
n : Bool
a : ℕ
ih : ∀ (n : ℕ), bitwise' (fun y x => f x y) a n = bitwise' f n a
m' : ℕ
⊢ bitwise' (fun y x => f x y) (bit n a) m' = bitwise' f m' (bit n a)
[PROOFSTEP]
apply bitCasesOn m'
[GOAL]
f : Bool → Bool → Bool
h : f false false = false
m : ℕ
n : Bool
a : ℕ
ih : ∀ (n : ℕ), bitwise' (fun y x => f x y) a n = bitwise' f n a
m' : ℕ
⊢ ∀ (b : Bool) (n_1 : ℕ), bitwise' (fun y x => f x y) (bit n a) (bit b n_1) = bitwise' f (bit b n_1) (bit n a)
[PROOFSTEP]
intro b n'
[GOAL]
f : Bool → Bool → Bool
h : f false false = false
m : ℕ
n : Bool
a : ℕ
ih : ∀ (n : ℕ), bitwise' (fun y x => f x y) a n = bitwise' f n a
m' : ℕ
b : Bool
n' : ℕ
⊢ bitwise' (fun y x => f x y) (bit n a) (bit b n') = bitwise' f (bit b n') (bit n a)
[PROOFSTEP]
rw [bitwise'_bit, bitwise'_bit, ih]
[GOAL]
case h
f : Bool → Bool → Bool
h : f false false = false
m : ℕ
n : Bool
a : ℕ
ih : ∀ (n : ℕ), bitwise' (fun y x => f x y) a n = bitwise' f n a
m' : ℕ
b : Bool
n' : ℕ
⊢ f false false = false
[PROOFSTEP]
exact h
[GOAL]
case h
f : Bool → Bool → Bool
h : f false false = false
m : ℕ
n : Bool
a : ℕ
ih : ∀ (n : ℕ), bitwise' (fun y x => f x y) a n = bitwise' f n a
m' : ℕ
b : Bool
n' : ℕ
⊢ f false false = false
[PROOFSTEP]
exact h
[GOAL]
f : Bool → Bool → Bool
h : f false false = false
m n k : ℕ
⊢ testBit (bitwise' f m n) k = f (testBit m k) (testBit n k)
[PROOFSTEP]
revert m n
[GOAL]
f : Bool → Bool → Bool
h : f false false = false
k : ℕ
⊢ ∀ (m n : ℕ), testBit (bitwise' f m n) k = f (testBit m k) (testBit n k)
[PROOFSTEP]
induction' k with k IH
[GOAL]
case zero
f : Bool → Bool → Bool
h : f false false = false
⊢ ∀ (m n : ℕ), testBit (bitwise' f m n) zero = f (testBit m zero) (testBit n zero)
[PROOFSTEP]
intros m n
[GOAL]
case succ
f : Bool → Bool → Bool
h : f false false = false
k : ℕ
IH : ∀ (m n : ℕ), testBit (bitwise' f m n) k = f (testBit m k) (testBit n k)
⊢ ∀ (m n : ℕ), testBit (bitwise' f m n) (succ k) = f (testBit m (succ k)) (testBit n (succ k))
[PROOFSTEP]
intros m n
[GOAL]
case zero
f : Bool → Bool → Bool
h : f false false = false
m n : ℕ
⊢ testBit (bitwise' f m n) zero = f (testBit m zero) (testBit n zero)
[PROOFSTEP]
apply bitCasesOn m
[GOAL]
case succ
f : Bool → Bool → Bool
h : f false false = false
k : ℕ
IH : ∀ (m n : ℕ), testBit (bitwise' f m n) k = f (testBit m k) (testBit n k)
m n : ℕ
⊢ testBit (bitwise' f m n) (succ k) = f (testBit m (succ k)) (testBit n (succ k))
[PROOFSTEP]
apply bitCasesOn m
[GOAL]
case zero
f : Bool → Bool → Bool
h : f false false = false
m n : ℕ
⊢ ∀ (b : Bool) (n_1 : ℕ), testBit (bitwise' f (bit b n_1) n) zero = f (testBit (bit b n_1) zero) (testBit n zero)
[PROOFSTEP]
intros a m'
[GOAL]
case succ
f : Bool → Bool → Bool
h : f false false = false
k : ℕ
IH : ∀ (m n : ℕ), testBit (bitwise' f m n) k = f (testBit m k) (testBit n k)
m n : ℕ
⊢ ∀ (b : Bool) (n_1 : ℕ),
    testBit (bitwise' f (bit b n_1) n) (succ k) = f (testBit (bit b n_1) (succ k)) (testBit n (succ k))
[PROOFSTEP]
intros a m'
[GOAL]
case zero
f : Bool → Bool → Bool
h : f false false = false
m n : ℕ
a : Bool
m' : ℕ
⊢ testBit (bitwise' f (bit a m') n) zero = f (testBit (bit a m') zero) (testBit n zero)
[PROOFSTEP]
apply bitCasesOn n
[GOAL]
case succ
f : Bool → Bool → Bool
h : f false false = false
k : ℕ
IH : ∀ (m n : ℕ), testBit (bitwise' f m n) k = f (testBit m k) (testBit n k)
m n : ℕ
a : Bool
m' : ℕ
⊢ testBit (bitwise' f (bit a m') n) (succ k) = f (testBit (bit a m') (succ k)) (testBit n (succ k))
[PROOFSTEP]
apply bitCasesOn n
[GOAL]
case zero
f : Bool → Bool → Bool
h : f false false = false
m n : ℕ
a : Bool
m' : ℕ
⊢ ∀ (b : Bool) (n : ℕ),
    testBit (bitwise' f (bit a m') (bit b n)) zero = f (testBit (bit a m') zero) (testBit (bit b n) zero)
[PROOFSTEP]
intros b n'
[GOAL]
case succ
f : Bool → Bool → Bool
h : f false false = false
k : ℕ
IH : ∀ (m n : ℕ), testBit (bitwise' f m n) k = f (testBit m k) (testBit n k)
m n : ℕ
a : Bool
m' : ℕ
⊢ ∀ (b : Bool) (n : ℕ),
    testBit (bitwise' f (bit a m') (bit b n)) (succ k) = f (testBit (bit a m') (succ k)) (testBit (bit b n) (succ k))
[PROOFSTEP]
intros b n'
[GOAL]
case zero
f : Bool → Bool → Bool
h : f false false = false
m n : ℕ
a : Bool
m' : ℕ
b : Bool
n' : ℕ
⊢ testBit (bitwise' f (bit a m') (bit b n')) zero = f (testBit (bit a m') zero) (testBit (bit b n') zero)
[PROOFSTEP]
rw [bitwise'_bit h]
[GOAL]
case succ
f : Bool → Bool → Bool
h : f false false = false
k : ℕ
IH : ∀ (m n : ℕ), testBit (bitwise' f m n) k = f (testBit m k) (testBit n k)
m n : ℕ
a : Bool
m' : ℕ
b : Bool
n' : ℕ
⊢ testBit (bitwise' f (bit a m') (bit b n')) (succ k) = f (testBit (bit a m') (succ k)) (testBit (bit b n') (succ k))
[PROOFSTEP]
rw [bitwise'_bit h]
[GOAL]
case zero
f : Bool → Bool → Bool
h : f false false = false
m n : ℕ
a : Bool
m' : ℕ
b : Bool
n' : ℕ
⊢ testBit (bit (f a b) (bitwise' f m' n')) zero = f (testBit (bit a m') zero) (testBit (bit b n') zero)
[PROOFSTEP]
simp [testBit_zero]
[GOAL]
case succ
f : Bool → Bool → Bool
h : f false false = false
k : ℕ
IH : ∀ (m n : ℕ), testBit (bitwise' f m n) k = f (testBit m k) (testBit n k)
m n : ℕ
a : Bool
m' : ℕ
b : Bool
n' : ℕ
⊢ testBit (bit (f a b) (bitwise' f m' n')) (succ k) = f (testBit (bit a m') (succ k)) (testBit (bit b n') (succ k))
[PROOFSTEP]
simp [testBit_succ, IH]