lemmaDistinct.map {XY : Type*} {f : X→Y} (hf : Function.Injective f)
{x y z w : X} (h : Distinct x y z w) : Distinct (f x) (f y) (f z) (f w) :=by
proof · 3
lines
rcases h with ⟨hxy,hxz,hxw,hyz,hyw,hzw⟩
exact ⟨fun h => hxy (hf h),fun h => hxz (hf h),fun h => hxw (hf h),
fun h => hyz (hf h),fun h => hyw (hf h),fun h => hzw (hf h)⟩
lemmaControlled.inverse (f : X ≃ₜ Y) {η : Distortion} (hf : Controlled f η) :
Controlled f.symm (reciprocal η.symm) :=by
proof · 12
lines
intro x y z w hh
have hh' := hh.map f.symm.injective
haveH:= hf _ _ _ _ hh'.flip
simp only [f.apply_symm_apply] at H
rw [crossRatio_flip x y z w, crossRatio_flip (f.symm x) (f.symm y) (f.symm z) (f.symm w)] at HhaveH':= η.symm.monotone H
simp only [OrderIso.symm_apply_apply] at H'
change crossRatio (f.symm x) (f.symm y) (f.symm z) (f.symm w) ≤ (η.symm (crossRatio x y z w)⁻¹)⁻¹havehpos : 0 < η.symm (crossRatio x y z w)⁻¹:=by
simpa only [distortion_zero] using η.symm.strictMono (inv_pos.mpr (crossRatio_pos hh))
have hi := (inv_le_inv₀ (inv_pos.mpr (crossRatio_pos hh')) hpos).mpr H'
simpa only [inv_inv] using hi
lemmacontrolled_of_product_bound (f : X→Y) (hf : Function.Injective f)
(C : ℝ≥0) (hC : 0 < C)
(h : ∀ x y z w, Distinct x y z w →
nndist (f x) (f y)*nndist (f z) (f w)*nndist x w*nndist y z ≤C*(nndist (f x) (f w)*nndist (f y) (f z)*nndist x y*nndist z w)) :
Controlled f (OrderIso.mulLeft₀ C hC) :=by
proof · 8
lines
intro x y z w hh
have hhf := hh.map hf
change crossRatio (f x) (f y) (f z) (f w) ≤C*crossRatio x y z w
unfold crossRatio
rw [← mul_div_assoc,div_le_div_iff₀
(mul_pos (nndist_pos.mpr hhf.2.2.1) (nndist_pos.mpr hhf.2.2.2.1))
(mul_pos (nndist_pos.mpr hh.2.2.1) (nndist_pos.mpr hh.2.2.2.1))]
simpa only [mul_assoc,mul_left_comm,mul_comm] using h x y z w hh
lemmacycle_sorted_bounds {a b c d T : ℝ} (ha : 0 < a) (hb : 0 < b)
(hc : 0 < c) (hd : 0 < d) (hT : 1≤T)
(hab : a ≤ b) (hcd : c ≤ d) (hp : a*b ≤T*(c*d))
(hbt : b ≤ a+c+d) (hdt : d ≤ a+b+c) :
a ≤ (2*T+3)*c ∧ b ≤ (2*T+3)*d :=by
proof · 18
lines
havehT0 : 0 < T:=by linarith
constructor
· by_contra hn
havehn' : (2*T+3)*c < a := lt_of_not_ge hn
havehhdt : d ≤2*b+c :=by linarith
have hm := mul_le_mul_of_nonneg_left hhdt (mul_nonneg hT0.le hc.le)
havehTb : T*c < b :=by nlinarith
have hm1 := mul_pos (sub_pos.mpr hn') hb
have hm2 := mul_pos (sub_pos.mpr hTb) hc
nlinarith
· by_contra hn
havehn' : (2*T+3)*d < b := lt_of_not_ge hn
havehha : T*d < a :=by nlinarith
havehhb : d < b :=by nlinarith
have hm1 := mul_pos (sub_pos.mpr hha) hb
have hm2 := mul_nonneg (mul_nonneg hT0.le hd.le) (sub_nonneg.mpr hhb.le)
have hm3 := mul_le_mul_of_nonneg_left hcd (mul_nonneg hT0.le hd.le)
nlinarith
lemmacrossRatio_pair_bounds {X : Type*} [MetricSpaceX] (x y z w : X)
(hh : Distinct x y z w) {T : ℝ} (hT : 1≤T)
(hp : dist x y*dist z w ≤T*(dist x w*dist y z)) :
(dist x y ≤ (2*T+3)*dist x w ∧ dist z w ≤ (2*T+3)*dist y z) ∨
(dist x y ≤ (2*T+3)*dist y z ∧ dist z w ≤ (2*T+3)*dist x w) :=by
proof · 45
lines
let a := dist x y
let b := dist z w
let c := dist x w
let d := dist y z
haveha : 0 < a := dist_pos.mpr hh.1havehb : 0 < b := dist_pos.mpr hh.2.2.2.2.2havehc : 0 < c := dist_pos.mpr hh.2.2.1havehd : 0 < d := dist_pos.mpr hh.2.2.2.1haveht1 : a ≤ b+c+d :=byhave h1 := dist_triangle x w y
have h2 := dist_triangle w z y
dsimp [a,b,c,d]
rw [dist_comm w z,dist_comm z y] at h2
linarith
haveht2 : b ≤ a+c+d :=byhave h1 := dist_triangle z y w
have h2 := dist_triangle y x w
dsimp [a,b,c,d]
rw [dist_comm z y] at h1
rw [dist_comm y x] at h2
linarith
haveht3 : c ≤ a+b+d :=byhave h1 := dist_triangle x y w
have h2 := dist_triangle y z w
dsimp [a,b,c,d]
linarith
haveht4 : d ≤ a+b+c :=byhave h1 := dist_triangle y x z
have h2 := dist_triangle x w z
dsimp [a,b,c,d]
rw [dist_comm y x] at h1
rw [dist_comm w z] at h2
linarith
change (a ≤ (2*T+3)*c ∧ b ≤ (2*T+3)*d) ∨
(a ≤ (2*T+3)*d ∧ b ≤ (2*T+3)*c)
rcases le_total a b with hab | hba <;> rcases le_total c d with hcd | hdc
· exact Or.inl (cycle_sorted_bounds ha hb hc hd hT hab hcd hp ht2 ht4)
· exact Or.inr (cycle_sorted_bounds ha hb hd hc hT hab hdc (by nlinarith [hp])
(by linarith) ht3)
· have hh := cycle_sorted_bounds hb ha hc hd hT hba hcd (by nlinarith [hp])
(by linarith) (by linarith)
exact Or.inr ⟨hh.2,hh.1⟩
· have hh := cycle_sorted_bounds hb ha hd hc hT hba hdc (by nlinarith [hp])
(by linarith) (by linarith)
exact Or.inl ⟨hh.2,hh.1⟩