Skip to content

Commit 61d5a95

Browse files
committed
extract aux lemma
1 parent 40477ba commit 61d5a95

1 file changed

Lines changed: 33 additions & 35 deletions

File tree

  • Mathlib/LinearAlgebra/AffineSpace/AffineSubspace

Mathlib/LinearAlgebra/AffineSpace/AffineSubspace/Shift.lean

Lines changed: 33 additions & 35 deletions
Original file line numberDiff line numberDiff line change
@@ -241,56 +241,54 @@ section Field
241241
variable [Field k] [LinearOrder k] [IsOrderedRing k] [AddCommGroup V] [AddTorsor V P]
242242
[Module k V] {n : ℕ} [NeZero n] (s : Affine.Simplex k P n) (i : Fin (n + 1)) {x : k}
243243

244+
private theorem closedInterior_inter_shift_aux {n : ℕ} (i : Fin n) {x : k} (hxpos : 0 < x)
245+
(hx1 : x ≤ 1) {w : Fin n → k} (hw : ∑ i, w i = 1) :
246+
(∀ j, w j ∈ Set.Icc 0 1) ∧ w i = 1 - x ↔
247+
(∀ j, j ≠ i → x⁻¹ * w j ∈ Set.Icc 0 1) ∧ x⁻¹ * (w i - 1) + 1 = 0 := by
248+
refine ⟨fun ⟨hj, hi⟩ ↦ ⟨fun j hji ↦ ⟨?_, ?_⟩, ?_⟩, fun ⟨hj, hi⟩ ↦ ?_⟩
249+
· exact mul_nonneg (by simpa using hxpos.le) (hj j).1
250+
· rw [eq_sub_iff_add_eq, add_comm, ← eq_sub_iff_add_eq] at hi
251+
rw [inv_mul_le_one₀ hxpos, hi, le_sub_iff_add_le, ← hw]
252+
apply add_le_sum (fun i _ ↦ (hj i).1) (mem_univ j) (mem_univ i)
253+
simpa using hji
254+
· simp [hi, hxpos.ne.symm]
255+
· have hix : w i = 1 - x := by grind
256+
refine ⟨?_, hix⟩
257+
suffices ∀ (j : Fin n), 0 ≤ w j by
258+
refine fun j ↦ ⟨this j, ?_⟩
259+
contrapose! hw
260+
apply ne_of_gt
261+
rw [← sum_erase_add _ _ (mem_univ j)]
262+
apply lt_add_of_nonneg_of_lt (sum_nonneg fun i _ ↦ this i) hw
263+
intro j
264+
by_cases hji : j = i
265+
· rw [hji, hix]
266+
simpa using hx1
267+
· specialize hj j (by simpa using hji)
268+
apply nonneg_of_mul_nonneg_right hj.1
269+
simpa using hxpos
270+
244271
theorem closedInterior_inter_shift (hx : x ∈ Set.Icc 0 1) :
245272
s.closedInterior ∩ (affineSpan k (Set.range (s.faceOpposite i).points)).shift (s.points i) x =
246273
homothety (s.points i) x '' (s.faceOpposite i).closedInterior := by
247-
by_cases! hx0 : x = 0
248-
· simpa [hx0, (s.faceOpposite i).nonempty_closedInterior]
274+
rcases eq_or_lt_of_le hx.1 with hx0 | hxpos
275+
· simpa [hx0.symm, (s.faceOpposite i).nonempty_closedInterior]
249276
using s.closedInterior_inter_shift_zero i
250-
have hxpos : 0 < x := lt_of_le_of_ne hx.1 hx0.symm
251277
ext p
252278
by_cases hp : p ∈ affineSpan k (Set.range s.points)
253279
· obtain ⟨w, hw, rfl⟩ := eq_affineCombination_of_mem_affineSpan_of_fintype hp
254280
rw [Set.mem_inter_iff, range_faceOpposite_points, SetLike.mem_coe,
255281
s.independent.affineCombination_mem_shift_iff i hw,
256282
affineCombination_mem_closedInterior_iff hw, Set.mem_image]
257-
simp_rw [AffineMap.homothety_eq_iff_of_mul_eq_one (mul_inv_cancel₀ hx0),
283+
simp_rw [AffineMap.homothety_eq_iff_of_mul_eq_one (mul_inv_cancel₀ hxpos.ne.symm),
258284
univ.homothety_affineCombination _ _ (mem_univ i)]
259285
simp only [↓existsAndEq, and_true]
260286
rw [faceOpposite, affineCombination_mem_closedInterior_face_iff_mem_Icc _ _ (by
261287
simp [AffineMap.lineMap_apply, Finset.sum_add_distrib, ← Finset.mul_sum,
262288
Finset.sum_sub_distrib, hw])]
263-
trans (∀ j ∈ ({i}ᶜ : Finset _), x⁻¹ * w j ∈ Set.Icc 0 1) ∧
264-
∀ j ∉ ({i}ᶜ : Finset _), x⁻¹ * (w j - 1) + 1 = 0
265-
· refine ⟨fun ⟨hj, hi⟩ ↦ ⟨fun j hji ↦ ⟨?_, ?_⟩, fun j hji ↦ ?_⟩, fun ⟨hj, hi⟩ ↦ ?_⟩
266-
· exact mul_nonneg (by simpa using hx.1) (hj j).1
267-
· rw [eq_sub_iff_add_eq, add_comm, ← eq_sub_iff_add_eq] at hi
268-
rw [inv_mul_le_one₀ hxpos, hi, le_sub_iff_add_le, ← hw]
269-
apply Finset.add_le_sum (fun i _ ↦ (hj i).1) (mem_univ j) (mem_univ i)
270-
simpa using hji
271-
· have hji : j = i := by simpa using hji
272-
simp [hji, hi, hx0]
273-
· specialize hi i (by simp)
274-
have hix : w i = 1 - x := by grind
275-
refine ⟨?_, hix⟩
276-
suffices ∀ (j : Fin (n + 1)), 0 ≤ w j by
277-
refine fun j ↦ ⟨this j, ?_⟩
278-
contrapose! hw
279-
apply ne_of_gt
280-
rw [← Finset.sum_erase_add _ _ (mem_univ j)]
281-
apply lt_add_of_nonneg_of_lt (sum_nonneg fun i _ ↦ this i) hw
282-
intro j
283-
by_cases hji : j = i
284-
· rw [hji, hix]
285-
simpa using hx.2
286-
· specialize hj j (by simpa using hji)
287-
apply nonneg_of_mul_nonneg_right hj.1
288-
simpa using hxpos
289-
· congrm (∀ j, (hj : _) → ?_) ∧ ∀ j, (hj : _) → ?_
290-
· have hj : j ≠ i := by simpa using hj
291-
simp [lineMap_apply, hj]
292-
· have hj : j = i := by simpa using hj
293-
simp [lineMap_apply, hj]
289+
rw [closedInterior_inter_shift_aux i hxpos hx.2 hw]
290+
simp only [mem_compl, mem_singleton, not_not, forall_eq]
291+
congrm (∀ j, (hj : _) → $(by simp [lineMap_apply, hj])) ∧ $(by simp [lineMap_apply])
294292
· apply iff_of_false
295293
· apply not_and_of_not_left
296294
contrapose hp

0 commit comments

Comments
 (0)