Datasets:
AI4M
/

text
stringlengths
0
3.34M
using Test using JMPS include("test_function.jl") # include("test_JMPS.jl") # include("test_CUDA.jl")
\subsection{CMake} \begin{minted}[linenos]{python} checking.add_steps( cmake=CMake(), make=Make(build_dir='build'), solution=RunSolution(executable='build/untitled', stdout='out'), diff=Diff(), ) status_code, detailed_result = checking.run() \end{minted} \code{CMake} without any arguments sets the source directory to the current directory, and a build directory to \code{build}. \code{Make} receives the build directory name as the argument, since its default is set to the current directory. Then, assuming the project name in \code{CMakeLists.txt} is set to \code{untitled}, the \code{Makefile} (generated via the \shell{cmake} command) builds the executable named \code{untitled}. Path to this executable is then passed to the \code{RunSolution}, and the \shell{stdout} is redirected to the file called \shell{out}. Finally, the \code{Diff} command -- which defaults to \shell{wzo} and \shell{out} as the file names -- compares the output with the expected answer. The \shell{wzo} file needs to be provided by the test case, just as the source files required by \code{CMakeLists.txt}, and the \code{CMakeLists.txt} file itself.
[GOAL] z : ZMod 4 ⊢ z * z ≠ 2 [PROOFSTEP] change Fin 4 at z [GOAL] z : Fin 4 ⊢ z * z ≠ 2 [PROOFSTEP] fin_cases z [GOAL] case head ⊢ { val := 0, isLt := (_ : 0 < 4) } * { val := 0, isLt := (_ : 0 < 4) } ≠ 2 [PROOFSTEP] norm_num [Fin.ext_iff, Fin.val_bit0, Fin.val_bit1] [GOAL] case tail.head ⊢ { val := 1, isLt := (_ : (fun a => a < 4) 1) } * { val := 1, isLt := (_ : (fun a => a < 4) 1) } ≠ 2 [PROOFSTEP] norm_num [Fin.ext_iff, Fin.val_bit0, Fin.val_bit1] [GOAL] case tail.tail.head ⊢ { val := 2, isLt := (_ : (fun a => (fun a => a < 4) a) 2) } * { val := 2, isLt := (_ : (fun a => (fun a => a < 4) a) 2) } ≠ 2 [PROOFSTEP] norm_num [Fin.ext_iff, Fin.val_bit0, Fin.val_bit1] [GOAL] case tail.tail.tail.head ⊢ { val := 3, isLt := (_ : (fun a => (fun a => (fun a => a < 4) a) a) 3) } * { val := 3, isLt := (_ : (fun a => (fun a => (fun a => a < 4) a) a) 3) } ≠ 2 [PROOFSTEP] norm_num [Fin.ext_iff, Fin.val_bit0, Fin.val_bit1] [GOAL] z : ℤ ⊢ z * z % 4 ≠ 2 [PROOFSTEP] suffices ¬z * z % (4 : ℕ) = 2 % (4 : ℕ) by exact this [GOAL] z : ℤ this : ¬z * z % ↑4 = 2 % ↑4 ⊢ z * z % 4 ≠ 2 [PROOFSTEP] exact this [GOAL] z : ℤ ⊢ ¬z * z % ↑4 = 2 % ↑4 [PROOFSTEP] rw [← ZMod.int_cast_eq_int_cast_iff'] [GOAL] z : ℤ ⊢ ¬↑(z * z) = ↑2 [PROOFSTEP] simpa using sq_ne_two_fin_zmod_four _ [GOAL] x y z : ℤ ⊢ PythagoreanTriple x y z ↔ PythagoreanTriple y x z [PROOFSTEP] delta PythagoreanTriple [GOAL] x y z : ℤ ⊢ x * x + y * y = z * z ↔ y * y + x * x = z * z [PROOFSTEP] rw [add_comm] [GOAL] ⊢ PythagoreanTriple 0 0 0 [PROOFSTEP] simp only [PythagoreanTriple, zero_mul, zero_add] [GOAL] x y z : ℤ h : PythagoreanTriple x y z ⊢ PythagoreanTriple y x z [PROOFSTEP] rwa [pythagoreanTriple_comm] [GOAL] x y z : ℤ h : PythagoreanTriple x y z k : ℤ ⊢ k * x * (k * x) + k * y * (k * y) = k ^ 2 * (x * x + y * y) [PROOFSTEP] ring [GOAL] x y z : ℤ h : PythagoreanTriple x y z k : ℤ ⊢ k ^ 2 * (x * x + y * y) = k ^ 2 * (z * z) [PROOFSTEP] rw [h.eq] [GOAL] x y z : ℤ h : PythagoreanTriple x y z k : ℤ ⊢ k ^ 2 * (z * z) = k * z * (k * z) [PROOFSTEP] ring [GOAL] x y z : ℤ h : PythagoreanTriple x y z k : ℤ hk : k ≠ 0 ⊢ PythagoreanTriple (k * x) (k * y) (k * z) ↔ PythagoreanTriple x y z [PROOFSTEP] refine' ⟨_, fun h => h.mul k⟩ [GOAL] x y z : ℤ h : PythagoreanTriple x y z k : ℤ hk : k ≠ 0 ⊢ PythagoreanTriple (k * x) (k * y) (k * z) → PythagoreanTriple x y z [PROOFSTEP] simp only [PythagoreanTriple] [GOAL] x y z : ℤ h : PythagoreanTriple x y z k : ℤ hk : k ≠ 0 ⊢ k * x * (k * x) + k * y * (k * y) = k * z * (k * z) → x * x + y * y = z * z [PROOFSTEP] intro h [GOAL] x y z : ℤ h✝ : PythagoreanTriple x y z k : ℤ hk : k ≠ 0 h : k * x * (k * x) + k * y * (k * y) = k * z * (k * z) ⊢ x * x + y * y = z * z [PROOFSTEP] rw [← mul_left_inj' (mul_ne_zero hk hk)] [GOAL] x y z : ℤ h✝ : PythagoreanTriple x y z k : ℤ hk : k ≠ 0 h : k * x * (k * x) + k * y * (k * y) = k * z * (k * z) ⊢ (x * x + y * y) * (k * k) = z * z * (k * k) [PROOFSTEP] convert h using 1 [GOAL] case h.e'_2 x y z : ℤ h✝ : PythagoreanTriple x y z k : ℤ hk : k ≠ 0 h : k * x * (k * x) + k * y * (k * y) = k * z * (k * z) ⊢ (x * x + y * y) * (k * k) = k * x * (k * x) + k * y * (k * y) [PROOFSTEP] ring [GOAL] case h.e'_3 x y z : ℤ h✝ : PythagoreanTriple x y z k : ℤ hk : k ≠ 0 h : k * x * (k * x) + k * y * (k * y) = k * z * (k * z) ⊢ z * z * (k * k) = k * z * (k * z) [PROOFSTEP] ring [GOAL] x y z : ℤ h : PythagoreanTriple x y z k : ℤ hc : IsClassified h ⊢ IsClassified (_ : PythagoreanTriple (k * x) (k * y) (k * z)) [PROOFSTEP] obtain ⟨l, m, n, ⟨⟨rfl, rfl⟩ | ⟨rfl, rfl⟩, co⟩⟩ := hc [GOAL] case intro.intro.intro.intro.inl.intro z k l m n : ℤ co : Int.gcd m n = 1 h : PythagoreanTriple (l * (m ^ 2 - n ^ 2)) (l * (2 * m * n)) z ⊢ IsClassified (_ : PythagoreanTriple (k * (l * (m ^ 2 - n ^ 2))) (k * (l * (2 * m * n))) (k * z)) [PROOFSTEP] use k * l, m, n [GOAL] case h z k l m n : ℤ co : Int.gcd m n = 1 h : PythagoreanTriple (l * (m ^ 2 - n ^ 2)) (l * (2 * m * n)) z ⊢ (k * (l * (m ^ 2 - n ^ 2)) = k * l * (m ^ 2 - n ^ 2) ∧ k * (l * (2 * m * n)) = k * l * (2 * m * n) ∨ k * (l * (m ^ 2 - n ^ 2)) = k * l * (2 * m * n) ∧ k * (l * (2 * m * n)) = k * l * (m ^ 2 - n ^ 2)) ∧ Int.gcd m n = 1 [PROOFSTEP] apply And.intro _ co [GOAL] z k l m n : ℤ co : Int.gcd m n = 1 h : PythagoreanTriple (l * (m ^ 2 - n ^ 2)) (l * (2 * m * n)) z ⊢ k * (l * (m ^ 2 - n ^ 2)) = k * l * (m ^ 2 - n ^ 2) ∧ k * (l * (2 * m * n)) = k * l * (2 * m * n) ∨ k * (l * (m ^ 2 - n ^ 2)) = k * l * (2 * m * n) ∧ k * (l * (2 * m * n)) = k * l * (m ^ 2 - n ^ 2) [PROOFSTEP] left [GOAL] case h z k l m n : ℤ co : Int.gcd m n = 1 h : PythagoreanTriple (l * (m ^ 2 - n ^ 2)) (l * (2 * m * n)) z ⊢ k * (l * (m ^ 2 - n ^ 2)) = k * l * (m ^ 2 - n ^ 2) ∧ k * (l * (2 * m * n)) = k * l * (2 * m * n) [PROOFSTEP] constructor [GOAL] case h.left z k l m n : ℤ co : Int.gcd m n = 1 h : PythagoreanTriple (l * (m ^ 2 - n ^ 2)) (l * (2 * m * n)) z ⊢ k * (l * (m ^ 2 - n ^ 2)) = k * l * (m ^ 2 - n ^ 2) [PROOFSTEP] ring [GOAL] case h.right z k l m n : ℤ co : Int.gcd m n = 1 h : PythagoreanTriple (l * (m ^ 2 - n ^ 2)) (l * (2 * m * n)) z ⊢ k * (l * (2 * m * n)) = k * l * (2 * m * n) [PROOFSTEP] ring [GOAL] case intro.intro.intro.intro.inr.intro z k l m n : ℤ co : Int.gcd m n = 1 h : PythagoreanTriple (l * (2 * m * n)) (l * (m ^ 2 - n ^ 2)) z ⊢ IsClassified (_ : PythagoreanTriple (k * (l * (2 * m * n))) (k * (l * (m ^ 2 - n ^ 2))) (k * z)) [PROOFSTEP] use k * l, m, n [GOAL] case h z k l m n : ℤ co : Int.gcd m n = 1 h : PythagoreanTriple (l * (2 * m * n)) (l * (m ^ 2 - n ^ 2)) z ⊢ (k * (l * (2 * m * n)) = k * l * (m ^ 2 - n ^ 2) ∧ k * (l * (m ^ 2 - n ^ 2)) = k * l * (2 * m * n) ∨ k * (l * (2 * m * n)) = k * l * (2 * m * n) ∧ k * (l * (m ^ 2 - n ^ 2)) = k * l * (m ^ 2 - n ^ 2)) ∧ Int.gcd m n = 1 [PROOFSTEP] apply And.intro _ co [GOAL] z k l m n : ℤ co : Int.gcd m n = 1 h : PythagoreanTriple (l * (2 * m * n)) (l * (m ^ 2 - n ^ 2)) z ⊢ k * (l * (2 * m * n)) = k * l * (m ^ 2 - n ^ 2) ∧ k * (l * (m ^ 2 - n ^ 2)) = k * l * (2 * m * n) ∨ k * (l * (2 * m * n)) = k * l * (2 * m * n) ∧ k * (l * (m ^ 2 - n ^ 2)) = k * l * (m ^ 2 - n ^ 2) [PROOFSTEP] right [GOAL] case h z k l m n : ℤ co : Int.gcd m n = 1 h : PythagoreanTriple (l * (2 * m * n)) (l * (m ^ 2 - n ^ 2)) z ⊢ k * (l * (2 * m * n)) = k * l * (2 * m * n) ∧ k * (l * (m ^ 2 - n ^ 2)) = k * l * (m ^ 2 - n ^ 2) [PROOFSTEP] constructor [GOAL] case h.left z k l m n : ℤ co : Int.gcd m n = 1 h : PythagoreanTriple (l * (2 * m * n)) (l * (m ^ 2 - n ^ 2)) z ⊢ k * (l * (2 * m * n)) = k * l * (2 * m * n) [PROOFSTEP] ring [GOAL] case h.right z k l m n : ℤ co : Int.gcd m n = 1 h : PythagoreanTriple (l * (2 * m * n)) (l * (m ^ 2 - n ^ 2)) z ⊢ k * (l * (m ^ 2 - n ^ 2)) = k * l * (m ^ 2 - n ^ 2) [PROOFSTEP] ring [GOAL] x y z : ℤ h : PythagoreanTriple x y z hc : Int.gcd x y = 1 ⊢ x % 2 = 0 ∧ y % 2 = 1 ∨ x % 2 = 1 ∧ y % 2 = 0 [PROOFSTEP] cases' Int.emod_two_eq_zero_or_one x with hx hx [GOAL] case inl x y z : ℤ h : PythagoreanTriple x y z hc : Int.gcd x y = 1 hx : x % 2 = 0 ⊢ x % 2 = 0 ∧ y % 2 = 1 ∨ x % 2 = 1 ∧ y % 2 = 0 [PROOFSTEP] cases' Int.emod_two_eq_zero_or_one y with hy hy [GOAL] case inr x y z : ℤ h : PythagoreanTriple x y z hc : Int.gcd x y = 1 hx : x % 2 = 1 ⊢ x % 2 = 0 ∧ y % 2 = 1 ∨ x % 2 = 1 ∧ y % 2 = 0 [PROOFSTEP] cases' Int.emod_two_eq_zero_or_one y with hy hy [GOAL] case inl.inl x y z : ℤ h : PythagoreanTriple x y z hc : Int.gcd x y = 1 hx : x % 2 = 0 hy : y % 2 = 0 ⊢ x % 2 = 0 ∧ y % 2 = 1 ∨ x % 2 = 1 ∧ y % 2 = 0 [PROOFSTEP] exfalso [GOAL] case inl.inl.h x y z : ℤ h : PythagoreanTriple x y z hc : Int.gcd x y = 1 hx : x % 2 = 0 hy : y % 2 = 0 ⊢ False [PROOFSTEP] apply Nat.not_coprime_of_dvd_of_dvd (by decide : 1 < 2) _ _ hc [GOAL] x y z : ℤ h : PythagoreanTriple x y z hc : Int.gcd x y = 1 hx : x % 2 = 0 hy : y % 2 = 0 ⊢ 1 < 2 [PROOFSTEP] decide [GOAL] x y z : ℤ h : PythagoreanTriple x y z hc : Int.gcd x y = 1 hx : x % 2 = 0 hy : y % 2 = 0 ⊢ 2 ∣ Int.natAbs x [PROOFSTEP] apply Int.coe_nat_dvd_left.1 [GOAL] x y z : ℤ h : PythagoreanTriple x y z hc : Int.gcd x y = 1 hx : x % 2 = 0 hy : y % 2 = 0 ⊢ ↑2 ∣ x [PROOFSTEP] apply Int.dvd_of_emod_eq_zero hx [GOAL] x y z : ℤ h : PythagoreanTriple x y z hc : Int.gcd x y = 1 hx : x % 2 = 0 hy : y % 2 = 0 ⊢ 2 ∣ Int.natAbs y [PROOFSTEP] apply Int.coe_nat_dvd_left.1 [GOAL] x y z : ℤ h : PythagoreanTriple x y z hc : Int.gcd x y = 1 hx : x % 2 = 0 hy : y % 2 = 0 ⊢ ↑2 ∣ y [PROOFSTEP] apply Int.dvd_of_emod_eq_zero hy [GOAL] case inl.inr x y z : ℤ h : PythagoreanTriple x y z hc : Int.gcd x y = 1 hx : x % 2 = 0 hy : y % 2 = 1 ⊢ x % 2 = 0 ∧ y % 2 = 1 ∨ x % 2 = 1 ∧ y % 2 = 0 [PROOFSTEP] left [GOAL] case inl.inr.h x y z : ℤ h : PythagoreanTriple x y z hc : Int.gcd x y = 1 hx : x % 2 = 0 hy : y % 2 = 1 ⊢ x % 2 = 0 ∧ y % 2 = 1 [PROOFSTEP] exact ⟨hx, hy⟩ -- x odd, y even [GOAL] case inr.inl x y z : ℤ h : PythagoreanTriple x y z hc : Int.gcd x y = 1 hx : x % 2 = 1 hy : y % 2 = 0 ⊢ x % 2 = 0 ∧ y % 2 = 1 ∨ x % 2 = 1 ∧ y % 2 = 0 [PROOFSTEP] right [GOAL] case inr.inl.h x y z : ℤ h : PythagoreanTriple x y z hc : Int.gcd x y = 1 hx : x % 2 = 1 hy : y % 2 = 0 ⊢ x % 2 = 1 ∧ y % 2 = 0 [PROOFSTEP] exact ⟨hx, hy⟩ -- x odd, y odd [GOAL] case inr.inr x y z : ℤ h : PythagoreanTriple x y z hc : Int.gcd x y = 1 hx : x % 2 = 1 hy : y % 2 = 1 ⊢ x % 2 = 0 ∧ y % 2 = 1 ∨ x % 2 = 1 ∧ y % 2 = 0 [PROOFSTEP] exfalso [GOAL] case inr.inr.h x y z : ℤ h : PythagoreanTriple x y z hc : Int.gcd x y = 1 hx : x % 2 = 1 hy : y % 2 = 1 ⊢ False [PROOFSTEP] obtain ⟨x0, y0, rfl, rfl⟩ : ∃ x0 y0, x = x0 * 2 + 1 ∧ y = y0 * 2 + 1 := by cases' exists_eq_mul_left_of_dvd (Int.dvd_sub_of_emod_eq hx) with x0 hx2 cases' exists_eq_mul_left_of_dvd (Int.dvd_sub_of_emod_eq hy) with y0 hy2 rw [sub_eq_iff_eq_add] at hx2 hy2 exact ⟨x0, y0, hx2, hy2⟩ [GOAL] x y z : ℤ h : PythagoreanTriple x y z hc : Int.gcd x y = 1 hx : x % 2 = 1 hy : y % 2 = 1 ⊢ ∃ x0 y0, x = x0 * 2 + 1 ∧ y = y0 * 2 + 1 [PROOFSTEP] cases' exists_eq_mul_left_of_dvd (Int.dvd_sub_of_emod_eq hx) with x0 hx2 [GOAL] case intro x y z : ℤ h : PythagoreanTriple x y z hc : Int.gcd x y = 1 hx : x % 2 = 1 hy : y % 2 = 1 x0 : ℤ hx2 : x - 1 = x0 * 2 ⊢ ∃ x0 y0, x = x0 * 2 + 1 ∧ y = y0 * 2 + 1 [PROOFSTEP] cases' exists_eq_mul_left_of_dvd (Int.dvd_sub_of_emod_eq hy) with y0 hy2 [GOAL] case intro.intro x y z : ℤ h : PythagoreanTriple x y z hc : Int.gcd x y = 1 hx : x % 2 = 1 hy : y % 2 = 1 x0 : ℤ hx2 : x - 1 = x0 * 2 y0 : ℤ hy2 : y - 1 = y0 * 2 ⊢ ∃ x0 y0, x = x0 * 2 + 1 ∧ y = y0 * 2 + 1 [PROOFSTEP] rw [sub_eq_iff_eq_add] at hx2 hy2 [GOAL] case intro.intro x y z : ℤ h : PythagoreanTriple x y z hc : Int.gcd x y = 1 hx : x % 2 = 1 hy : y % 2 = 1 x0 : ℤ hx2 : x = x0 * 2 + 1 y0 : ℤ hy2 : y = y0 * 2 + 1 ⊢ ∃ x0 y0, x = x0 * 2 + 1 ∧ y = y0 * 2 + 1 [PROOFSTEP] exact ⟨x0, y0, hx2, hy2⟩ [GOAL] case inr.inr.h.intro.intro.intro z x0 y0 : ℤ hx : (x0 * 2 + 1) % 2 = 1 hy : (y0 * 2 + 1) % 2 = 1 h : PythagoreanTriple (x0 * 2 + 1) (y0 * 2 + 1) z hc : Int.gcd (x0 * 2 + 1) (y0 * 2 + 1) = 1 ⊢ False [PROOFSTEP] apply Int.sq_ne_two_mod_four z [GOAL] case inr.inr.h.intro.intro.intro z x0 y0 : ℤ hx : (x0 * 2 + 1) % 2 = 1 hy : (y0 * 2 + 1) % 2 = 1 h : PythagoreanTriple (x0 * 2 + 1) (y0 * 2 + 1) z hc : Int.gcd (x0 * 2 + 1) (y0 * 2 + 1) = 1 ⊢ z * z % 4 = 2 [PROOFSTEP] rw [show z * z = 4 * (x0 * x0 + x0 + y0 * y0 + y0) + 2 by rw [← h.eq] ring] [GOAL] z x0 y0 : ℤ hx : (x0 * 2 + 1) % 2 = 1 hy : (y0 * 2 + 1) % 2 = 1 h : PythagoreanTriple (x0 * 2 + 1) (y0 * 2 + 1) z hc : Int.gcd (x0 * 2 + 1) (y0 * 2 + 1) = 1 ⊢ z * z = 4 * (x0 * x0 + x0 + y0 * y0 + y0) + 2 [PROOFSTEP] rw [← h.eq] [GOAL] z x0 y0 : ℤ hx : (x0 * 2 + 1) % 2 = 1 hy : (y0 * 2 + 1) % 2 = 1 h : PythagoreanTriple (x0 * 2 + 1) (y0 * 2 + 1) z hc : Int.gcd (x0 * 2 + 1) (y0 * 2 + 1) = 1 ⊢ (x0 * 2 + 1) * (x0 * 2 + 1) + (y0 * 2 + 1) * (y0 * 2 + 1) = 4 * (x0 * x0 + x0 + y0 * y0 + y0) + 2 [PROOFSTEP] ring [GOAL] case inr.inr.h.intro.intro.intro z x0 y0 : ℤ hx : (x0 * 2 + 1) % 2 = 1 hy : (y0 * 2 + 1) % 2 = 1 h : PythagoreanTriple (x0 * 2 + 1) (y0 * 2 + 1) z hc : Int.gcd (x0 * 2 + 1) (y0 * 2 + 1) = 1 ⊢ (4 * (x0 * x0 + x0 + y0 * y0 + y0) + 2) % 4 = 2 [PROOFSTEP] field_simp [Int.add_emod] -- Porting note: norm_num is not enough to close this [GOAL] x y z : ℤ h : PythagoreanTriple x y z ⊢ ↑(Int.gcd x y) ∣ z [PROOFSTEP] by_cases h0 : Int.gcd x y = 0 [GOAL] case pos x y z : ℤ h : PythagoreanTriple x y z h0 : Int.gcd x y = 0 ⊢ ↑(Int.gcd x y) ∣ z [PROOFSTEP] have hx : x = 0 := by apply Int.natAbs_eq_zero.mp apply Nat.eq_zero_of_gcd_eq_zero_left h0 [GOAL] x y z : ℤ h : PythagoreanTriple x y z h0 : Int.gcd x y = 0 ⊢ x = 0 [PROOFSTEP] apply Int.natAbs_eq_zero.mp [GOAL] x y z : ℤ h : PythagoreanTriple x y z h0 : Int.gcd x y = 0 ⊢ Int.natAbs x = 0 [PROOFSTEP] apply Nat.eq_zero_of_gcd_eq_zero_left h0 [GOAL] case pos x y z : ℤ h : PythagoreanTriple x y z h0 : Int.gcd x y = 0 hx : x = 0 ⊢ ↑(Int.gcd x y) ∣ z [PROOFSTEP] have hy : y = 0 := by apply Int.natAbs_eq_zero.mp apply Nat.eq_zero_of_gcd_eq_zero_right h0 [GOAL] x y z : ℤ h : PythagoreanTriple x y z h0 : Int.gcd x y = 0 hx : x = 0 ⊢ y = 0 [PROOFSTEP] apply Int.natAbs_eq_zero.mp [GOAL] x y z : ℤ h : PythagoreanTriple x y z h0 : Int.gcd x y = 0 hx : x = 0 ⊢ Int.natAbs y = 0 [PROOFSTEP] apply Nat.eq_zero_of_gcd_eq_zero_right h0 [GOAL] case pos x y z : ℤ h : PythagoreanTriple x y z h0 : Int.gcd x y = 0 hx : x = 0 hy : y = 0 ⊢ ↑(Int.gcd x y) ∣ z [PROOFSTEP] have hz : z = 0 := by simpa only [PythagoreanTriple, hx, hy, add_zero, zero_eq_mul, mul_zero, or_self_iff] using h [GOAL] x y z : ℤ h : PythagoreanTriple x y z h0 : Int.gcd x y = 0 hx : x = 0 hy : y = 0 ⊢ z = 0 [PROOFSTEP] simpa only [PythagoreanTriple, hx, hy, add_zero, zero_eq_mul, mul_zero, or_self_iff] using h [GOAL] case pos x y z : ℤ h : PythagoreanTriple x y z h0 : Int.gcd x y = 0 hx : x = 0 hy : y = 0 hz : z = 0 ⊢ ↑(Int.gcd x y) ∣ z [PROOFSTEP] simp only [hz, dvd_zero] [GOAL] case neg x y z : ℤ h : PythagoreanTriple x y z h0 : ¬Int.gcd x y = 0 ⊢ ↑(Int.gcd x y) ∣ z [PROOFSTEP] obtain ⟨k, x0, y0, _, h2, rfl, rfl⟩ : ∃ (k : ℕ) (x0 y0 : _), 0 < k ∧ Int.gcd x0 y0 = 1 ∧ x = x0 * k ∧ y = y0 * k := Int.exists_gcd_one' (Nat.pos_of_ne_zero h0) [GOAL] case neg.intro.intro.intro.intro.intro.intro z : ℤ k : ℕ x0 y0 : ℤ left✝ : 0 < k h2 : Int.gcd x0 y0 = 1 h : PythagoreanTriple (x0 * ↑k) (y0 * ↑k) z h0 : ¬Int.gcd (x0 * ↑k) (y0 * ↑k) = 0 ⊢ ↑(Int.gcd (x0 * ↑k) (y0 * ↑k)) ∣ z [PROOFSTEP] rw [Int.gcd_mul_right, h2, Int.natAbs_ofNat, one_mul] [GOAL] case neg.intro.intro.intro.intro.intro.intro z : ℤ k : ℕ x0 y0 : ℤ left✝ : 0 < k h2 : Int.gcd x0 y0 = 1 h : PythagoreanTriple (x0 * ↑k) (y0 * ↑k) z h0 : ¬Int.gcd (x0 * ↑k) (y0 * ↑k) = 0 ⊢ ↑k ∣ z [PROOFSTEP] rw [← Int.pow_dvd_pow_iff zero_lt_two, sq z, ← h.eq] [GOAL] case neg.intro.intro.intro.intro.intro.intro z : ℤ k : ℕ x0 y0 : ℤ left✝ : 0 < k h2 : Int.gcd x0 y0 = 1 h : PythagoreanTriple (x0 * ↑k) (y0 * ↑k) z h0 : ¬Int.gcd (x0 * ↑k) (y0 * ↑k) = 0 ⊢ ↑k ^ 2 ∣ x0 * ↑k * (x0 * ↑k) + y0 * ↑k * (y0 * ↑k) [PROOFSTEP] rw [(by ring : x0 * k * (x0 * k) + y0 * k * (y0 * k) = (k : ℤ) ^ 2 * (x0 * x0 + y0 * y0))] [GOAL] z : ℤ k : ℕ x0 y0 : ℤ left✝ : 0 < k h2 : Int.gcd x0 y0 = 1 h : PythagoreanTriple (x0 * ↑k) (y0 * ↑k) z h0 : ¬Int.gcd (x0 * ↑k) (y0 * ↑k) = 0 ⊢ x0 * ↑k * (x0 * ↑k) + y0 * ↑k * (y0 * ↑k) = ↑k ^ 2 * (x0 * x0 + y0 * y0) [PROOFSTEP] ring [GOAL] case neg.intro.intro.intro.intro.intro.intro z : ℤ k : ℕ x0 y0 : ℤ left✝ : 0 < k h2 : Int.gcd x0 y0 = 1 h : PythagoreanTriple (x0 * ↑k) (y0 * ↑k) z h0 : ¬Int.gcd (x0 * ↑k) (y0 * ↑k) = 0 ⊢ ↑k ^ 2 ∣ ↑k ^ 2 * (x0 * x0 + y0 * y0) [PROOFSTEP] exact dvd_mul_right _ _ [GOAL] x y z : ℤ h : PythagoreanTriple x y z ⊢ PythagoreanTriple (x / ↑(Int.gcd x y)) (y / ↑(Int.gcd x y)) (z / ↑(Int.gcd x y)) [PROOFSTEP] by_cases h0 : Int.gcd x y = 0 [GOAL] case pos x y z : ℤ h : PythagoreanTriple x y z h0 : Int.gcd x y = 0 ⊢ PythagoreanTriple (x / ↑(Int.gcd x y)) (y / ↑(Int.gcd x y)) (z / ↑(Int.gcd x y)) [PROOFSTEP] have hx : x = 0 := by apply Int.natAbs_eq_zero.mp apply Nat.eq_zero_of_gcd_eq_zero_left h0 [GOAL] x y z : ℤ h : PythagoreanTriple x y z h0 : Int.gcd x y = 0 ⊢ x = 0 [PROOFSTEP] apply Int.natAbs_eq_zero.mp [GOAL] x y z : ℤ h : PythagoreanTriple x y z h0 : Int.gcd x y = 0 ⊢ Int.natAbs x = 0 [PROOFSTEP] apply Nat.eq_zero_of_gcd_eq_zero_left h0 [GOAL] case pos x y z : ℤ h : PythagoreanTriple x y z h0 : Int.gcd x y = 0 hx : x = 0 ⊢ PythagoreanTriple (x / ↑(Int.gcd x y)) (y / ↑(Int.gcd x y)) (z / ↑(Int.gcd x y)) [PROOFSTEP] have hy : y = 0 := by apply Int.natAbs_eq_zero.mp apply Nat.eq_zero_of_gcd_eq_zero_right h0 [GOAL] x y z : ℤ h : PythagoreanTriple x y z h0 : Int.gcd x y = 0 hx : x = 0 ⊢ y = 0 [PROOFSTEP] apply Int.natAbs_eq_zero.mp [GOAL] x y z : ℤ h : PythagoreanTriple x y z h0 : Int.gcd x y = 0 hx : x = 0 ⊢ Int.natAbs y = 0 [PROOFSTEP] apply Nat.eq_zero_of_gcd_eq_zero_right h0 [GOAL] case pos x y z : ℤ h : PythagoreanTriple x y z h0 : Int.gcd x y = 0 hx : x = 0 hy : y = 0 ⊢ PythagoreanTriple (x / ↑(Int.gcd x y)) (y / ↑(Int.gcd x y)) (z / ↑(Int.gcd x y)) [PROOFSTEP] have hz : z = 0 := by simpa only [PythagoreanTriple, hx, hy, add_zero, zero_eq_mul, mul_zero, or_self_iff] using h [GOAL] x y z : ℤ h : PythagoreanTriple x y z h0 : Int.gcd x y = 0 hx : x = 0 hy : y = 0 ⊢ z = 0 [PROOFSTEP] simpa only [PythagoreanTriple, hx, hy, add_zero, zero_eq_mul, mul_zero, or_self_iff] using h [GOAL] case pos x y z : ℤ h : PythagoreanTriple x y z h0 : Int.gcd x y = 0 hx : x = 0 hy : y = 0 hz : z = 0 ⊢ PythagoreanTriple (x / ↑(Int.gcd x y)) (y / ↑(Int.gcd x y)) (z / ↑(Int.gcd x y)) [PROOFSTEP] simp only [hx, hy, hz, Int.zero_div] [GOAL] case pos x y z : ℤ h : PythagoreanTriple x y z h0 : Int.gcd x y = 0 hx : x = 0 hy : y = 0 hz : z = 0 ⊢ PythagoreanTriple (0 / ↑(Int.gcd 0 0)) (0 / ↑(Int.gcd 0 0)) (0 / ↑(Int.gcd 0 0)) [PROOFSTEP] exact zero [GOAL] case neg x y z : ℤ h : PythagoreanTriple x y z h0 : ¬Int.gcd x y = 0 ⊢ PythagoreanTriple (x / ↑(Int.gcd x y)) (y / ↑(Int.gcd x y)) (z / ↑(Int.gcd x y)) [PROOFSTEP] rcases h.gcd_dvd with ⟨z0, rfl⟩ [GOAL] case neg.intro x y : ℤ h0 : ¬Int.gcd x y = 0 z0 : ℤ h : PythagoreanTriple x y (↑(Int.gcd x y) * z0) ⊢ PythagoreanTriple (x / ↑(Int.gcd x y)) (y / ↑(Int.gcd x y)) (↑(Int.gcd x y) * z0 / ↑(Int.gcd x y)) [PROOFSTEP] obtain ⟨k, x0, y0, k0, h2, rfl, rfl⟩ : ∃ (k : ℕ) (x0 y0 : _), 0 < k ∧ Int.gcd x0 y0 = 1 ∧ x = x0 * k ∧ y = y0 * k := Int.exists_gcd_one' (Nat.pos_of_ne_zero h0) [GOAL] case neg.intro.intro.intro.intro.intro.intro.intro z0 : ℤ k : ℕ x0 y0 : ℤ k0 : 0 < k h2 : Int.gcd x0 y0 = 1 h0 : ¬Int.gcd (x0 * ↑k) (y0 * ↑k) = 0 h : PythagoreanTriple (x0 * ↑k) (y0 * ↑k) (↑(Int.gcd (x0 * ↑k) (y0 * ↑k)) * z0) ⊢ PythagoreanTriple (x0 * ↑k / ↑(Int.gcd (x0 * ↑k) (y0 * ↑k))) (y0 * ↑k / ↑(Int.gcd (x0 * ↑k) (y0 * ↑k))) (↑(Int.gcd (x0 * ↑k) (y0 * ↑k)) * z0 / ↑(Int.gcd (x0 * ↑k) (y0 * ↑k))) [PROOFSTEP] have hk : (k : ℤ) ≠ 0 := by norm_cast rwa [pos_iff_ne_zero] at k0 [GOAL] z0 : ℤ k : ℕ x0 y0 : ℤ k0 : 0 < k h2 : Int.gcd x0 y0 = 1 h0 : ¬Int.gcd (x0 * ↑k) (y0 * ↑k) = 0 h : PythagoreanTriple (x0 * ↑k) (y0 * ↑k) (↑(Int.gcd (x0 * ↑k) (y0 * ↑k)) * z0) ⊢ ↑k ≠ 0 [PROOFSTEP] norm_cast [GOAL] z0 : ℤ k : ℕ x0 y0 : ℤ k0 : 0 < k h2 : Int.gcd x0 y0 = 1 h0 : ¬Int.gcd (x0 * ↑k) (y0 * ↑k) = 0 h : PythagoreanTriple (x0 * ↑k) (y0 * ↑k) (↑(Int.gcd (x0 * ↑k) (y0 * ↑k)) * z0) ⊢ ¬k = 0 [PROOFSTEP] rwa [pos_iff_ne_zero] at k0 [GOAL] case neg.intro.intro.intro.intro.intro.intro.intro z0 : ℤ k : ℕ x0 y0 : ℤ k0 : 0 < k h2 : Int.gcd x0 y0 = 1 h0 : ¬Int.gcd (x0 * ↑k) (y0 * ↑k) = 0 h : PythagoreanTriple (x0 * ↑k) (y0 * ↑k) (↑(Int.gcd (x0 * ↑k) (y0 * ↑k)) * z0) hk : ↑k ≠ 0 ⊢ PythagoreanTriple (x0 * ↑k / ↑(Int.gcd (x0 * ↑k) (y0 * ↑k))) (y0 * ↑k / ↑(Int.gcd (x0 * ↑k) (y0 * ↑k))) (↑(Int.gcd (x0 * ↑k) (y0 * ↑k)) * z0 / ↑(Int.gcd (x0 * ↑k) (y0 * ↑k))) [PROOFSTEP] rw [Int.gcd_mul_right, h2, Int.natAbs_ofNat, one_mul] at h ⊢ [GOAL] case neg.intro.intro.intro.intro.intro.intro.intro z0 : ℤ k : ℕ x0 y0 : ℤ k0 : 0 < k h2 : Int.gcd x0 y0 = 1 h0 : ¬Int.gcd (x0 * ↑k) (y0 * ↑k) = 0 h : PythagoreanTriple (x0 * ↑k) (y0 * ↑k) (↑k * z0) hk : ↑k ≠ 0 ⊢ PythagoreanTriple (x0 * ↑k / ↑k) (y0 * ↑k / ↑k) (↑k * z0 / ↑k) [PROOFSTEP] rw [mul_comm x0, mul_comm y0, mul_iff k hk] at h [GOAL] case neg.intro.intro.intro.intro.intro.intro.intro z0 : ℤ k : ℕ x0 y0 : ℤ k0 : 0 < k h2 : Int.gcd x0 y0 = 1 h0 : ¬Int.gcd (x0 * ↑k) (y0 * ↑k) = 0 h : PythagoreanTriple x0 y0 z0 hk : ↑k ≠ 0 ⊢ PythagoreanTriple (x0 * ↑k / ↑k) (y0 * ↑k / ↑k) (↑k * z0 / ↑k) [PROOFSTEP] rwa [Int.mul_ediv_cancel _ hk, Int.mul_ediv_cancel _ hk, Int.mul_ediv_cancel_left _ hk] [GOAL] x y z : ℤ h : PythagoreanTriple x y z hp : IsPrimitiveClassified h ⊢ IsClassified h [PROOFSTEP] obtain ⟨m, n, H⟩ := hp [GOAL] case intro.intro x y z : ℤ h : PythagoreanTriple x y z m n : ℤ H : (x = m ^ 2 - n ^ 2 ∧ y = 2 * m * n ∨ x = 2 * m * n ∧ y = m ^ 2 - n ^ 2) ∧ Int.gcd m n = 1 ∧ (m % 2 = 0 ∧ n % 2 = 1 ∨ m % 2 = 1 ∧ n % 2 = 0) ⊢ IsClassified h [PROOFSTEP] use 1, m, n [GOAL] case h x y z : ℤ h : PythagoreanTriple x y z m n : ℤ H : (x = m ^ 2 - n ^ 2 ∧ y = 2 * m * n ∨ x = 2 * m * n ∧ y = m ^ 2 - n ^ 2) ∧ Int.gcd m n = 1 ∧ (m % 2 = 0 ∧ n % 2 = 1 ∨ m % 2 = 1 ∧ n % 2 = 0) ⊢ (x = 1 * (m ^ 2 - n ^ 2) ∧ y = 1 * (2 * m * n) ∨ x = 1 * (2 * m * n) ∧ y = 1 * (m ^ 2 - n ^ 2)) ∧ Int.gcd m n = 1 [PROOFSTEP] rcases H with ⟨t, co, _⟩ [GOAL] case h.intro.intro x y z : ℤ h : PythagoreanTriple x y z m n : ℤ t : x = m ^ 2 - n ^ 2 ∧ y = 2 * m * n ∨ x = 2 * m * n ∧ y = m ^ 2 - n ^ 2 co : Int.gcd m n = 1 right✝ : m % 2 = 0 ∧ n % 2 = 1 ∨ m % 2 = 1 ∧ n % 2 = 0 ⊢ (x = 1 * (m ^ 2 - n ^ 2) ∧ y = 1 * (2 * m * n) ∨ x = 1 * (2 * m * n) ∧ y = 1 * (m ^ 2 - n ^ 2)) ∧ Int.gcd m n = 1 [PROOFSTEP] rw [one_mul, one_mul] [GOAL] case h.intro.intro x y z : ℤ h : PythagoreanTriple x y z m n : ℤ t : x = m ^ 2 - n ^ 2 ∧ y = 2 * m * n ∨ x = 2 * m * n ∧ y = m ^ 2 - n ^ 2 co : Int.gcd m n = 1 right✝ : m % 2 = 0 ∧ n % 2 = 1 ∨ m % 2 = 1 ∧ n % 2 = 0 ⊢ (x = m ^ 2 - n ^ 2 ∧ y = 2 * m * n ∨ x = 2 * m * n ∧ y = m ^ 2 - n ^ 2) ∧ Int.gcd m n = 1 [PROOFSTEP] exact ⟨t, co⟩ [GOAL] x y z : ℤ h : PythagoreanTriple x y z hc : IsPrimitiveClassified (_ : PythagoreanTriple (x / ↑(Int.gcd x y)) (y / ↑(Int.gcd x y)) (z / ↑(Int.gcd x y))) ⊢ IsClassified h [PROOFSTEP] convert h.normalize.mul_isClassified (Int.gcd x y) (isClassified_of_isPrimitiveClassified h.normalize hc) [GOAL] case h.e'_1 x y z : ℤ h : PythagoreanTriple x y z hc : IsPrimitiveClassified (_ : PythagoreanTriple (x / ↑(Int.gcd x y)) (y / ↑(Int.gcd x y)) (z / ↑(Int.gcd x y))) ⊢ x = ↑(Int.gcd x y) * (x / ↑(Int.gcd x y)) [PROOFSTEP] rw [Int.mul_ediv_cancel'] [GOAL] case h.e'_2 x y z : ℤ h : PythagoreanTriple x y z hc : IsPrimitiveClassified (_ : PythagoreanTriple (x / ↑(Int.gcd x y)) (y / ↑(Int.gcd x y)) (z / ↑(Int.gcd x y))) ⊢ y = ↑(Int.gcd x y) * (y / ↑(Int.gcd x y)) [PROOFSTEP] rw [Int.mul_ediv_cancel'] [GOAL] case h.e'_3 x y z : ℤ h : PythagoreanTriple x y z hc : IsPrimitiveClassified (_ : PythagoreanTriple (x / ↑(Int.gcd x y)) (y / ↑(Int.gcd x y)) (z / ↑(Int.gcd x y))) ⊢ z = ↑(Int.gcd x y) * (z / ↑(Int.gcd x y)) [PROOFSTEP] rw [Int.mul_ediv_cancel'] [GOAL] case h.e'_1 x y z : ℤ h : PythagoreanTriple x y z hc : IsPrimitiveClassified (_ : PythagoreanTriple (x / ↑(Int.gcd x y)) (y / ↑(Int.gcd x y)) (z / ↑(Int.gcd x y))) ⊢ ↑(Int.gcd x y) ∣ x [PROOFSTEP] exact Int.gcd_dvd_left x y [GOAL] case h.e'_2 x y z : ℤ h : PythagoreanTriple x y z hc : IsPrimitiveClassified (_ : PythagoreanTriple (x / ↑(Int.gcd x y)) (y / ↑(Int.gcd x y)) (z / ↑(Int.gcd x y))) ⊢ ↑(Int.gcd x y) ∣ y [PROOFSTEP] exact Int.gcd_dvd_right x y [GOAL] case h.e'_3 x y z : ℤ h : PythagoreanTriple x y z hc : IsPrimitiveClassified (_ : PythagoreanTriple (x / ↑(Int.gcd x y)) (y / ↑(Int.gcd x y)) (z / ↑(Int.gcd x y))) ⊢ ↑(Int.gcd x y) ∣ z [PROOFSTEP] exact h.gcd_dvd [GOAL] x y z : ℤ h : PythagoreanTriple x y z hc : Int.gcd x y = 1 ⊢ z ≠ 0 [PROOFSTEP] suffices 0 < z * z by rintro rfl norm_num at this [GOAL] x y z : ℤ h : PythagoreanTriple x y z hc : Int.gcd x y = 1 this : 0 < z * z ⊢ z ≠ 0 [PROOFSTEP] rintro rfl [GOAL] x y : ℤ hc : Int.gcd x y = 1 h : PythagoreanTriple x y 0 this : 0 < 0 * 0 ⊢ False [PROOFSTEP] norm_num at this [GOAL] x y z : ℤ h : PythagoreanTriple x y z hc : Int.gcd x y = 1 ⊢ 0 < z * z [PROOFSTEP] rw [← h.eq, ← sq, ← sq] [GOAL] x y z : ℤ h : PythagoreanTriple x y z hc : Int.gcd x y = 1 ⊢ 0 < x ^ 2 + y ^ 2 [PROOFSTEP] have hc' : Int.gcd x y ≠ 0 := by rw [hc] exact one_ne_zero [GOAL] x y z : ℤ h : PythagoreanTriple x y z hc : Int.gcd x y = 1 ⊢ Int.gcd x y ≠ 0 [PROOFSTEP] rw [hc] [GOAL] x y z : ℤ h : PythagoreanTriple x y z hc : Int.gcd x y = 1 ⊢ 1 ≠ 0 [PROOFSTEP] exact one_ne_zero [GOAL] x y z : ℤ h : PythagoreanTriple x y z hc : Int.gcd x y = 1 hc' : Int.gcd x y ≠ 0 ⊢ 0 < x ^ 2 + y ^ 2 [PROOFSTEP] cases' Int.ne_zero_of_gcd hc' with hxz hyz [GOAL] case inl x y z : ℤ h : PythagoreanTriple x y z hc : Int.gcd x y = 1 hc' : Int.gcd x y ≠ 0 hxz : x ≠ 0 ⊢ 0 < x ^ 2 + y ^ 2 [PROOFSTEP] apply lt_add_of_pos_of_le (sq_pos_of_ne_zero x hxz) (sq_nonneg y) [GOAL] case inr x y z : ℤ h : PythagoreanTriple x y z hc : Int.gcd x y = 1 hc' : Int.gcd x y ≠ 0 hyz : y ≠ 0 ⊢ 0 < x ^ 2 + y ^ 2 [PROOFSTEP] apply lt_add_of_le_of_pos (sq_nonneg x) (sq_pos_of_ne_zero y hyz) [GOAL] x y z : ℤ h : PythagoreanTriple x y z hc : Int.gcd x y = 1 hx : x = 0 ⊢ IsPrimitiveClassified h [PROOFSTEP] subst x [GOAL] y z : ℤ h : PythagoreanTriple 0 y z hc : Int.gcd 0 y = 1 ⊢ IsPrimitiveClassified h [PROOFSTEP] change Nat.gcd 0 (Int.natAbs y) = 1 at hc [GOAL] y z : ℤ h : PythagoreanTriple 0 y z hc : Nat.gcd 0 (Int.natAbs y) = 1 ⊢ IsPrimitiveClassified h [PROOFSTEP] rw [Nat.gcd_zero_left (Int.natAbs y)] at hc [GOAL] y z : ℤ h : PythagoreanTriple 0 y z hc : Int.natAbs y = 1 ⊢ IsPrimitiveClassified h [PROOFSTEP] cases' Int.natAbs_eq y with hy hy [GOAL] case inl y z : ℤ h : PythagoreanTriple 0 y z hc : Int.natAbs y = 1 hy : y = ↑(Int.natAbs y) ⊢ IsPrimitiveClassified h [PROOFSTEP] use 1, 0 [GOAL] case h y z : ℤ h : PythagoreanTriple 0 y z hc : Int.natAbs y = 1 hy : y = ↑(Int.natAbs y) ⊢ (0 = 1 ^ 2 - 0 ^ 2 ∧ y = 2 * 1 * 0 ∨ 0 = 2 * 1 * 0 ∧ y = 1 ^ 2 - 0 ^ 2) ∧ Int.gcd 1 0 = 1 ∧ (1 % 2 = 0 ∧ 0 % 2 = 1 ∨ 1 % 2 = 1 ∧ 0 % 2 = 0) [PROOFSTEP] rw [hy, hc, Int.gcd_zero_right] [GOAL] case h y z : ℤ h : PythagoreanTriple 0 y z hc : Int.natAbs y = 1 hy : y = ↑(Int.natAbs y) ⊢ (0 = 1 ^ 2 - 0 ^ 2 ∧ ↑1 = 2 * 1 * 0 ∨ 0 = 2 * 1 * 0 ∧ ↑1 = 1 ^ 2 - 0 ^ 2) ∧ Int.natAbs 1 = 1 ∧ (1 % 2 = 0 ∧ 0 % 2 = 1 ∨ 1 % 2 = 1 ∧ 0 % 2 = 0) [PROOFSTEP] norm_num [GOAL] case inr y z : ℤ h : PythagoreanTriple 0 y z hc : Int.natAbs y = 1 hy : y = -↑(Int.natAbs y) ⊢ IsPrimitiveClassified h [PROOFSTEP] use 0, 1 [GOAL] case h y z : ℤ h : PythagoreanTriple 0 y z hc : Int.natAbs y = 1 hy : y = -↑(Int.natAbs y) ⊢ (0 = 0 ^ 2 - 1 ^ 2 ∧ y = 2 * 0 * 1 ∨ 0 = 2 * 0 * 1 ∧ y = 0 ^ 2 - 1 ^ 2) ∧ Int.gcd 0 1 = 1 ∧ (0 % 2 = 0 ∧ 1 % 2 = 1 ∨ 0 % 2 = 1 ∧ 1 % 2 = 0) [PROOFSTEP] rw [hy, hc, Int.gcd_zero_left] [GOAL] case h y z : ℤ h : PythagoreanTriple 0 y z hc : Int.natAbs y = 1 hy : y = -↑(Int.natAbs y) ⊢ (0 = 0 ^ 2 - 1 ^ 2 ∧ -↑1 = 2 * 0 * 1 ∨ 0 = 2 * 0 * 1 ∧ -↑1 = 0 ^ 2 - 1 ^ 2) ∧ Int.natAbs 1 = 1 ∧ (0 % 2 = 0 ∧ 1 % 2 = 1 ∨ 0 % 2 = 1 ∧ 1 % 2 = 0) [PROOFSTEP] norm_num [GOAL] x y z : ℤ h : PythagoreanTriple x y z hc : Int.gcd x y = 1 ⊢ Int.gcd y z = 1 [PROOFSTEP] by_contra H [GOAL] x y z : ℤ h : PythagoreanTriple x y z hc : Int.gcd x y = 1 H : ¬Int.gcd y z = 1 ⊢ False [PROOFSTEP] obtain ⟨p, hp, hpy, hpz⟩ := Nat.Prime.not_coprime_iff_dvd.mp H [GOAL] case intro.intro.intro x y z : ℤ h : PythagoreanTriple x y z hc : Int.gcd x y = 1 H : ¬Int.gcd y z = 1 p : ℕ hp : Nat.Prime p hpy : p ∣ Int.natAbs y hpz : p ∣ Int.natAbs z ⊢ False [PROOFSTEP] apply hp.not_dvd_one [GOAL] case intro.intro.intro x y z : ℤ h : PythagoreanTriple x y z hc : Int.gcd x y = 1 H : ¬Int.gcd y z = 1 p : ℕ hp : Nat.Prime p hpy : p ∣ Int.natAbs y hpz : p ∣ Int.natAbs z ⊢ p ∣ 1 [PROOFSTEP] rw [← hc] [GOAL] case intro.intro.intro x y z : ℤ h : PythagoreanTriple x y z hc : Int.gcd x y = 1 H : ¬Int.gcd y z = 1 p : ℕ hp : Nat.Prime p hpy : p ∣ Int.natAbs y hpz : p ∣ Int.natAbs z ⊢ p ∣ Int.gcd x y [PROOFSTEP] apply Nat.dvd_gcd (Int.Prime.dvd_natAbs_of_coe_dvd_sq hp _ _) hpy [GOAL] x y z : ℤ h : PythagoreanTriple x y z hc : Int.gcd x y = 1 H : ¬Int.gcd y z = 1 p : ℕ hp : Nat.Prime p hpy : p ∣ Int.natAbs y hpz : p ∣ Int.natAbs z ⊢ ↑p ∣ x ^ 2 [PROOFSTEP] rw [sq, eq_sub_of_add_eq h] [GOAL] x y z : ℤ h : PythagoreanTriple x y z hc : Int.gcd x y = 1 H : ¬Int.gcd y z = 1 p : ℕ hp : Nat.Prime p hpy : p ∣ Int.natAbs y hpz : p ∣ Int.natAbs z ⊢ ↑p ∣ z * z - y * y [PROOFSTEP] rw [← Int.coe_nat_dvd_left] at hpy hpz [GOAL] x y z : ℤ h : PythagoreanTriple x y z hc : Int.gcd x y = 1 H : ¬Int.gcd y z = 1 p : ℕ hp : Nat.Prime p hpy : ↑p ∣ y hpz : ↑p ∣ z ⊢ ↑p ∣ z * z - y * y [PROOFSTEP] exact dvd_sub (hpz.mul_right _) (hpy.mul_right _) [GOAL] K : Type u_1 inst✝ : Field K hk : ∀ (x : K), 1 + x ^ 2 ≠ 0 x : K ⊢ (2 * x / (1 + x ^ 2), (1 - x ^ 2) / (1 + x ^ 2)).fst ^ 2 + (2 * x / (1 + x ^ 2), (1 - x ^ 2) / (1 + x ^ 2)).snd ^ 2 = 1 [PROOFSTEP] field_simp [hk x, div_pow] [GOAL] K : Type u_1 inst✝ : Field K hk : ∀ (x : K), 1 + x ^ 2 ≠ 0 x : K ⊢ (2 * x) ^ 2 + (1 - x ^ 2) ^ 2 = (1 + x ^ 2) ^ 2 [PROOFSTEP] ring [GOAL] K : Type u_1 inst✝ : Field K hk : ∀ (x : K), 1 + x ^ 2 ≠ 0 x : K ⊢ (2 * x / (1 + x ^ 2), (1 - x ^ 2) / (1 + x ^ 2)).snd ≠ -1 [PROOFSTEP] simp only [Ne.def, div_eq_iff (hk x), neg_mul, one_mul, neg_add, sub_eq_add_neg, add_left_inj] [GOAL] K : Type u_1 inst✝ : Field K hk : ∀ (x : K), 1 + x ^ 2 ≠ 0 x : K ⊢ ¬1 = -1 [PROOFSTEP] simpa only [eq_neg_iff_add_eq_zero, one_pow] using hk 1 [GOAL] K : Type u_1 inst✝ : Field K hk : ∀ (x : K), 1 + x ^ 2 ≠ 0 x : K ⊢ (fun p => (↑p).fst / ((↑p).snd + 1)) ((fun x => { val := (2 * x / (1 + x ^ 2), (1 - x ^ 2) / (1 + x ^ 2)), property := (_ : (2 * x / (1 + x ^ 2), (1 - x ^ 2) / (1 + x ^ 2)).fst ^ 2 + (2 * x / (1 + x ^ 2), (1 - x ^ 2) / (1 + x ^ 2)).snd ^ 2 = 1 ∧ (2 * x / (1 + x ^ 2), (1 - x ^ 2) / (1 + x ^ 2)).snd ≠ -1) }) x) = x [PROOFSTEP] have h2 : (1 + 1 : K) = 2 := by norm_num -- Porting note: rfl is not enough to close this [GOAL] K : Type u_1 inst✝ : Field K hk : ∀ (x : K), 1 + x ^ 2 ≠ 0 x : K ⊢ 1 + 1 = 2 [PROOFSTEP] norm_num -- Porting note: rfl is not enough to close this [GOAL] K : Type u_1 inst✝ : Field K hk : ∀ (x : K), 1 + x ^ 2 ≠ 0 x : K h2 : 1 + 1 = 2 ⊢ (fun p => (↑p).fst / ((↑p).snd + 1)) ((fun x => { val := (2 * x / (1 + x ^ 2), (1 - x ^ 2) / (1 + x ^ 2)), property := (_ : (2 * x / (1 + x ^ 2), (1 - x ^ 2) / (1 + x ^ 2)).fst ^ 2 + (2 * x / (1 + x ^ 2), (1 - x ^ 2) / (1 + x ^ 2)).snd ^ 2 = 1 ∧ (2 * x / (1 + x ^ 2), (1 - x ^ 2) / (1 + x ^ 2)).snd ≠ -1) }) x) = x [PROOFSTEP] have h3 : (2 : K) ≠ 0 := by convert hk 1 rw [one_pow 2, h2] [GOAL] K : Type u_1 inst✝ : Field K hk : ∀ (x : K), 1 + x ^ 2 ≠ 0 x : K h2 : 1 + 1 = 2 ⊢ 2 ≠ 0 [PROOFSTEP] convert hk 1 [GOAL] case h.e'_2 K : Type u_1 inst✝ : Field K hk : ∀ (x : K), 1 + x ^ 2 ≠ 0 x : K h2 : 1 + 1 = 2 ⊢ 2 = 1 + 1 ^ 2 [PROOFSTEP] rw [one_pow 2, h2] [GOAL] K : Type u_1 inst✝ : Field K hk : ∀ (x : K), 1 + x ^ 2 ≠ 0 x : K h2 : 1 + 1 = 2 h3 : 2 ≠ 0 ⊢ (fun p => (↑p).fst / ((↑p).snd + 1)) ((fun x => { val := (2 * x / (1 + x ^ 2), (1 - x ^ 2) / (1 + x ^ 2)), property := (_ : (2 * x / (1 + x ^ 2), (1 - x ^ 2) / (1 + x ^ 2)).fst ^ 2 + (2 * x / (1 + x ^ 2), (1 - x ^ 2) / (1 + x ^ 2)).snd ^ 2 = 1 ∧ (2 * x / (1 + x ^ 2), (1 - x ^ 2) / (1 + x ^ 2)).snd ≠ -1) }) x) = x [PROOFSTEP] field_simp [hk x, h2, add_assoc, add_comm, add_sub_cancel'_right, mul_comm] [GOAL] K : Type u_1 inst✝ : Field K hk : ∀ (x : K), 1 + x ^ 2 ≠ 0 x✝ : { p // p.fst ^ 2 + p.snd ^ 2 = 1 ∧ p.snd ≠ -1 } x y : K hxy : (x, y).fst ^ 2 + (x, y).snd ^ 2 = 1 hy : (x, y).snd ≠ -1 ⊢ (fun x => { val := (2 * x / (1 + x ^ 2), (1 - x ^ 2) / (1 + x ^ 2)), property := (_ : (2 * x / (1 + x ^ 2), (1 - x ^ 2) / (1 + x ^ 2)).fst ^ 2 + (2 * x / (1 + x ^ 2), (1 - x ^ 2) / (1 + x ^ 2)).snd ^ 2 = 1 ∧ (2 * x / (1 + x ^ 2), (1 - x ^ 2) / (1 + x ^ 2)).snd ≠ -1) }) ((fun p => (↑p).fst / ((↑p).snd + 1)) { val := (x, y), property := (_ : (x, y).fst ^ 2 + (x, y).snd ^ 2 = 1 ∧ (x, y).snd ≠ -1) }) = { val := (x, y), property := (_ : (x, y).fst ^ 2 + (x, y).snd ^ 2 = 1 ∧ (x, y).snd ≠ -1) } [PROOFSTEP] change x ^ 2 + y ^ 2 = 1 at hxy [GOAL] K : Type u_1 inst✝ : Field K hk : ∀ (x : K), 1 + x ^ 2 ≠ 0 x✝ : { p // p.fst ^ 2 + p.snd ^ 2 = 1 ∧ p.snd ≠ -1 } x y : K hy : (x, y).snd ≠ -1 hxy : x ^ 2 + y ^ 2 = 1 ⊢ (fun x => { val := (2 * x / (1 + x ^ 2), (1 - x ^ 2) / (1 + x ^ 2)), property := (_ : (2 * x / (1 + x ^ 2), (1 - x ^ 2) / (1 + x ^ 2)).fst ^ 2 + (2 * x / (1 + x ^ 2), (1 - x ^ 2) / (1 + x ^ 2)).snd ^ 2 = 1 ∧ (2 * x / (1 + x ^ 2), (1 - x ^ 2) / (1 + x ^ 2)).snd ≠ -1) }) ((fun p => (↑p).fst / ((↑p).snd + 1)) { val := (x, y), property := (_ : (x, y).fst ^ 2 + (x, y).snd ^ 2 = 1 ∧ (x, y).snd ≠ -1) }) = { val := (x, y), property := (_ : (x, y).fst ^ 2 + (x, y).snd ^ 2 = 1 ∧ (x, y).snd ≠ -1) } [PROOFSTEP] have h2 : y + 1 ≠ 0 := mt eq_neg_of_add_eq_zero_left hy [GOAL] K : Type u_1 inst✝ : Field K hk : ∀ (x : K), 1 + x ^ 2 ≠ 0 x✝ : { p // p.fst ^ 2 + p.snd ^ 2 = 1 ∧ p.snd ≠ -1 } x y : K hy : (x, y).snd ≠ -1 hxy : x ^ 2 + y ^ 2 = 1 h2 : y + 1 ≠ 0 ⊢ (fun x => { val := (2 * x / (1 + x ^ 2), (1 - x ^ 2) / (1 + x ^ 2)), property := (_ : (2 * x / (1 + x ^ 2), (1 - x ^ 2) / (1 + x ^ 2)).fst ^ 2 + (2 * x / (1 + x ^ 2), (1 - x ^ 2) / (1 + x ^ 2)).snd ^ 2 = 1 ∧ (2 * x / (1 + x ^ 2), (1 - x ^ 2) / (1 + x ^ 2)).snd ≠ -1) }) ((fun p => (↑p).fst / ((↑p).snd + 1)) { val := (x, y), property := (_ : (x, y).fst ^ 2 + (x, y).snd ^ 2 = 1 ∧ (x, y).snd ≠ -1) }) = { val := (x, y), property := (_ : (x, y).fst ^ 2 + (x, y).snd ^ 2 = 1 ∧ (x, y).snd ≠ -1) } [PROOFSTEP] have h3 : (y + 1) ^ 2 + x ^ 2 = 2 * (y + 1) := by rw [(add_neg_eq_iff_eq_add.mpr hxy.symm).symm] ring [GOAL] K : Type u_1 inst✝ : Field K hk : ∀ (x : K), 1 + x ^ 2 ≠ 0 x✝ : { p // p.fst ^ 2 + p.snd ^ 2 = 1 ∧ p.snd ≠ -1 } x y : K hy : (x, y).snd ≠ -1 hxy : x ^ 2 + y ^ 2 = 1 h2 : y + 1 ≠ 0 ⊢ (y + 1) ^ 2 + x ^ 2 = 2 * (y + 1) [PROOFSTEP] rw [(add_neg_eq_iff_eq_add.mpr hxy.symm).symm] [GOAL] K : Type u_1 inst✝ : Field K hk : ∀ (x : K), 1 + x ^ 2 ≠ 0 x✝ : { p // p.fst ^ 2 + p.snd ^ 2 = 1 ∧ p.snd ≠ -1 } x y : K hy : (x, y).snd ≠ -1 hxy : x ^ 2 + y ^ 2 = 1 h2 : y + 1 ≠ 0 ⊢ (y + 1) ^ 2 + (1 + -y ^ 2) = 2 * (y + 1) [PROOFSTEP] ring [GOAL] K : Type u_1 inst✝ : Field K hk : ∀ (x : K), 1 + x ^ 2 ≠ 0 x✝ : { p // p.fst ^ 2 + p.snd ^ 2 = 1 ∧ p.snd ≠ -1 } x y : K hy : (x, y).snd ≠ -1 hxy : x ^ 2 + y ^ 2 = 1 h2 : y + 1 ≠ 0 h3 : (y + 1) ^ 2 + x ^ 2 = 2 * (y + 1) ⊢ (fun x => { val := (2 * x / (1 + x ^ 2), (1 - x ^ 2) / (1 + x ^ 2)), property := (_ : (2 * x / (1 + x ^ 2), (1 - x ^ 2) / (1 + x ^ 2)).fst ^ 2 + (2 * x / (1 + x ^ 2), (1 - x ^ 2) / (1 + x ^ 2)).snd ^ 2 = 1 ∧ (2 * x / (1 + x ^ 2), (1 - x ^ 2) / (1 + x ^ 2)).snd ≠ -1) }) ((fun p => (↑p).fst / ((↑p).snd + 1)) { val := (x, y), property := (_ : (x, y).fst ^ 2 + (x, y).snd ^ 2 = 1 ∧ (x, y).snd ≠ -1) }) = { val := (x, y), property := (_ : (x, y).fst ^ 2 + (x, y).snd ^ 2 = 1 ∧ (x, y).snd ≠ -1) } [PROOFSTEP] have h4 : (2 : K) ≠ 0 := by convert hk 1 rw [one_pow 2] ring -- Porting note: rfl is not enough to close this [GOAL] K : Type u_1 inst✝ : Field K hk : ∀ (x : K), 1 + x ^ 2 ≠ 0 x✝ : { p // p.fst ^ 2 + p.snd ^ 2 = 1 ∧ p.snd ≠ -1 } x y : K hy : (x, y).snd ≠ -1 hxy : x ^ 2 + y ^ 2 = 1 h2 : y + 1 ≠ 0 h3 : (y + 1) ^ 2 + x ^ 2 = 2 * (y + 1) ⊢ 2 ≠ 0 [PROOFSTEP] convert hk 1 [GOAL] case h.e'_2 K : Type u_1 inst✝ : Field K hk : ∀ (x : K), 1 + x ^ 2 ≠ 0 x✝ : { p // p.fst ^ 2 + p.snd ^ 2 = 1 ∧ p.snd ≠ -1 } x y : K hy : (x, y).snd ≠ -1 hxy : x ^ 2 + y ^ 2 = 1 h2 : y + 1 ≠ 0 h3 : (y + 1) ^ 2 + x ^ 2 = 2 * (y + 1) ⊢ 2 = 1 + 1 ^ 2 [PROOFSTEP] rw [one_pow 2] [GOAL] case h.e'_2 K : Type u_1 inst✝ : Field K hk : ∀ (x : K), 1 + x ^ 2 ≠ 0 x✝ : { p // p.fst ^ 2 + p.snd ^ 2 = 1 ∧ p.snd ≠ -1 } x y : K hy : (x, y).snd ≠ -1 hxy : x ^ 2 + y ^ 2 = 1 h2 : y + 1 ≠ 0 h3 : (y + 1) ^ 2 + x ^ 2 = 2 * (y + 1) ⊢ 2 = 1 + 1 [PROOFSTEP] ring -- Porting note: rfl is not enough to close this [GOAL] K : Type u_1 inst✝ : Field K hk : ∀ (x : K), 1 + x ^ 2 ≠ 0 x✝ : { p // p.fst ^ 2 + p.snd ^ 2 = 1 ∧ p.snd ≠ -1 } x y : K hy : (x, y).snd ≠ -1 hxy : x ^ 2 + y ^ 2 = 1 h2 : y + 1 ≠ 0 h3 : (y + 1) ^ 2 + x ^ 2 = 2 * (y + 1) h4 : 2 ≠ 0 ⊢ (fun x => { val := (2 * x / (1 + x ^ 2), (1 - x ^ 2) / (1 + x ^ 2)), property := (_ : (2 * x / (1 + x ^ 2), (1 - x ^ 2) / (1 + x ^ 2)).fst ^ 2 + (2 * x / (1 + x ^ 2), (1 - x ^ 2) / (1 + x ^ 2)).snd ^ 2 = 1 ∧ (2 * x / (1 + x ^ 2), (1 - x ^ 2) / (1 + x ^ 2)).snd ≠ -1) }) ((fun p => (↑p).fst / ((↑p).snd + 1)) { val := (x, y), property := (_ : (x, y).fst ^ 2 + (x, y).snd ^ 2 = 1 ∧ (x, y).snd ≠ -1) }) = { val := (x, y), property := (_ : (x, y).fst ^ 2 + (x, y).snd ^ 2 = 1 ∧ (x, y).snd ≠ -1) } [PROOFSTEP] simp only [Prod.mk.inj_iff, Subtype.mk_eq_mk] [GOAL] K : Type u_1 inst✝ : Field K hk : ∀ (x : K), 1 + x ^ 2 ≠ 0 x✝ : { p // p.fst ^ 2 + p.snd ^ 2 = 1 ∧ p.snd ≠ -1 } x y : K hy : (x, y).snd ≠ -1 hxy : x ^ 2 + y ^ 2 = 1 h2 : y + 1 ≠ 0 h3 : (y + 1) ^ 2 + x ^ 2 = 2 * (y + 1) h4 : 2 ≠ 0 ⊢ 2 * (x / (y + 1)) / (1 + (x / (y + 1)) ^ 2) = x ∧ (1 - (x / (y + 1)) ^ 2) / (1 + (x / (y + 1)) ^ 2) = y [PROOFSTEP] constructor [GOAL] case left K : Type u_1 inst✝ : Field K hk : ∀ (x : K), 1 + x ^ 2 ≠ 0 x✝ : { p // p.fst ^ 2 + p.snd ^ 2 = 1 ∧ p.snd ≠ -1 } x y : K hy : (x, y).snd ≠ -1 hxy : x ^ 2 + y ^ 2 = 1 h2 : y + 1 ≠ 0 h3 : (y + 1) ^ 2 + x ^ 2 = 2 * (y + 1) h4 : 2 ≠ 0 ⊢ 2 * (x / (y + 1)) / (1 + (x / (y + 1)) ^ 2) = x [PROOFSTEP] field_simp [h3] [GOAL] case left K : Type u_1 inst✝ : Field K hk : ∀ (x : K), 1 + x ^ 2 ≠ 0 x✝ : { p // p.fst ^ 2 + p.snd ^ 2 = 1 ∧ p.snd ≠ -1 } x y : K hy : (x, y).snd ≠ -1 hxy : x ^ 2 + y ^ 2 = 1 h2 : y + 1 ≠ 0 h3 : (y + 1) ^ 2 + x ^ 2 = 2 * (y + 1) h4 : 2 ≠ 0 ⊢ 2 * x * (y + 1) ^ 2 = x * ((y + 1) * (2 * (y + 1))) [PROOFSTEP] ring [GOAL] case right K : Type u_1 inst✝ : Field K hk : ∀ (x : K), 1 + x ^ 2 ≠ 0 x✝ : { p // p.fst ^ 2 + p.snd ^ 2 = 1 ∧ p.snd ≠ -1 } x y : K hy : (x, y).snd ≠ -1 hxy : x ^ 2 + y ^ 2 = 1 h2 : y + 1 ≠ 0 h3 : (y + 1) ^ 2 + x ^ 2 = 2 * (y + 1) h4 : 2 ≠ 0 ⊢ (1 - (x / (y + 1)) ^ 2) / (1 + (x / (y + 1)) ^ 2) = y [PROOFSTEP] field_simp [h3] [GOAL] case right K : Type u_1 inst✝ : Field K hk : ∀ (x : K), 1 + x ^ 2 ≠ 0 x✝ : { p // p.fst ^ 2 + p.snd ^ 2 = 1 ∧ p.snd ≠ -1 } x y : K hy : (x, y).snd ≠ -1 hxy : x ^ 2 + y ^ 2 = 1 h2 : y + 1 ≠ 0 h3 : (y + 1) ^ 2 + x ^ 2 = 2 * (y + 1) h4 : 2 ≠ 0 ⊢ (y + 1) ^ 2 - x ^ 2 = y * (2 * (y + 1)) [PROOFSTEP] rw [← add_neg_eq_iff_eq_add.mpr hxy.symm] [GOAL] case right K : Type u_1 inst✝ : Field K hk : ∀ (x : K), 1 + x ^ 2 ≠ 0 x✝ : { p // p.fst ^ 2 + p.snd ^ 2 = 1 ∧ p.snd ≠ -1 } x y : K hy : (x, y).snd ≠ -1 hxy : x ^ 2 + y ^ 2 = 1 h2 : y + 1 ≠ 0 h3 : (y + 1) ^ 2 + x ^ 2 = 2 * (y + 1) h4 : 2 ≠ 0 ⊢ (y + 1) ^ 2 - (1 + -y ^ 2) = y * (2 * (y + 1)) [PROOFSTEP] ring [GOAL] m n : ℤ h : Int.gcd m n = 1 hm : m % 2 = 0 hn : n % 2 = 1 ⊢ Int.gcd (m ^ 2 - n ^ 2) (m ^ 2 + n ^ 2) = 1 [PROOFSTEP] by_contra H [GOAL] m n : ℤ h : Int.gcd m n = 1 hm : m % 2 = 0 hn : n % 2 = 1 H : ¬Int.gcd (m ^ 2 - n ^ 2) (m ^ 2 + n ^ 2) = 1 ⊢ False [PROOFSTEP] obtain ⟨p, hp, hp1, hp2⟩ := Nat.Prime.not_coprime_iff_dvd.mp H [GOAL] case intro.intro.intro m n : ℤ h : Int.gcd m n = 1 hm : m % 2 = 0 hn : n % 2 = 1 H : ¬Int.gcd (m ^ 2 - n ^ 2) (m ^ 2 + n ^ 2) = 1 p : ℕ hp : Nat.Prime p hp1 : p ∣ Int.natAbs (m ^ 2 - n ^ 2) hp2 : p ∣ Int.natAbs (m ^ 2 + n ^ 2) ⊢ False [PROOFSTEP] rw [← Int.coe_nat_dvd_left] at hp1 hp2 [GOAL] case intro.intro.intro m n : ℤ h : Int.gcd m n = 1 hm : m % 2 = 0 hn : n % 2 = 1 H : ¬Int.gcd (m ^ 2 - n ^ 2) (m ^ 2 + n ^ 2) = 1 p : ℕ hp : Nat.Prime p hp1 : ↑p ∣ m ^ 2 - n ^ 2 hp2 : ↑p ∣ m ^ 2 + n ^ 2 ⊢ False [PROOFSTEP] have h2m : (p : ℤ) ∣ 2 * m ^ 2 := by convert dvd_add hp2 hp1 using 1 ring [GOAL] m n : ℤ h : Int.gcd m n = 1 hm : m % 2 = 0 hn : n % 2 = 1 H : ¬Int.gcd (m ^ 2 - n ^ 2) (m ^ 2 + n ^ 2) = 1 p : ℕ hp : Nat.Prime p hp1 : ↑p ∣ m ^ 2 - n ^ 2 hp2 : ↑p ∣ m ^ 2 + n ^ 2 ⊢ ↑p ∣ 2 * m ^ 2 [PROOFSTEP] convert dvd_add hp2 hp1 using 1 [GOAL] case h.e'_4 m n : ℤ h : Int.gcd m n = 1 hm : m % 2 = 0 hn : n % 2 = 1 H : ¬Int.gcd (m ^ 2 - n ^ 2) (m ^ 2 + n ^ 2) = 1 p : ℕ hp : Nat.Prime p hp1 : ↑p ∣ m ^ 2 - n ^ 2 hp2 : ↑p ∣ m ^ 2 + n ^ 2 ⊢ 2 * m ^ 2 = m ^ 2 + n ^ 2 + (m ^ 2 - n ^ 2) [PROOFSTEP] ring [GOAL] case intro.intro.intro m n : ℤ h : Int.gcd m n = 1 hm : m % 2 = 0 hn : n % 2 = 1 H : ¬Int.gcd (m ^ 2 - n ^ 2) (m ^ 2 + n ^ 2) = 1 p : ℕ hp : Nat.Prime p hp1 : ↑p ∣ m ^ 2 - n ^ 2 hp2 : ↑p ∣ m ^ 2 + n ^ 2 h2m : ↑p ∣ 2 * m ^ 2 ⊢ False [PROOFSTEP] have h2n : (p : ℤ) ∣ 2 * n ^ 2 := by convert dvd_sub hp2 hp1 using 1 ring [GOAL] m n : ℤ h : Int.gcd m n = 1 hm : m % 2 = 0 hn : n % 2 = 1 H : ¬Int.gcd (m ^ 2 - n ^ 2) (m ^ 2 + n ^ 2) = 1 p : ℕ hp : Nat.Prime p hp1 : ↑p ∣ m ^ 2 - n ^ 2 hp2 : ↑p ∣ m ^ 2 + n ^ 2 h2m : ↑p ∣ 2 * m ^ 2 ⊢ ↑p ∣ 2 * n ^ 2 [PROOFSTEP] convert dvd_sub hp2 hp1 using 1 [GOAL] case h.e'_4 m n : ℤ h : Int.gcd m n = 1 hm : m % 2 = 0 hn : n % 2 = 1 H : ¬Int.gcd (m ^ 2 - n ^ 2) (m ^ 2 + n ^ 2) = 1 p : ℕ hp : Nat.Prime p hp1 : ↑p ∣ m ^ 2 - n ^ 2 hp2 : ↑p ∣ m ^ 2 + n ^ 2 h2m : ↑p ∣ 2 * m ^ 2 ⊢ 2 * n ^ 2 = m ^ 2 + n ^ 2 - (m ^ 2 - n ^ 2) [PROOFSTEP] ring [GOAL] case intro.intro.intro m n : ℤ h : Int.gcd m n = 1 hm : m % 2 = 0 hn : n % 2 = 1 H : ¬Int.gcd (m ^ 2 - n ^ 2) (m ^ 2 + n ^ 2) = 1 p : ℕ hp : Nat.Prime p hp1 : ↑p ∣ m ^ 2 - n ^ 2 hp2 : ↑p ∣ m ^ 2 + n ^ 2 h2m : ↑p ∣ 2 * m ^ 2 h2n : ↑p ∣ 2 * n ^ 2 ⊢ False [PROOFSTEP] have hmc : p = 2 ∨ p ∣ Int.natAbs m := prime_two_or_dvd_of_dvd_two_mul_pow_self_two hp h2m [GOAL] case intro.intro.intro m n : ℤ h : Int.gcd m n = 1 hm : m % 2 = 0 hn : n % 2 = 1 H : ¬Int.gcd (m ^ 2 - n ^ 2) (m ^ 2 + n ^ 2) = 1 p : ℕ hp : Nat.Prime p hp1 : ↑p ∣ m ^ 2 - n ^ 2 hp2 : ↑p ∣ m ^ 2 + n ^ 2 h2m : ↑p ∣ 2 * m ^ 2 h2n : ↑p ∣ 2 * n ^ 2 hmc : p = 2 ∨ p ∣ Int.natAbs m ⊢ False [PROOFSTEP] have hnc : p = 2 ∨ p ∣ Int.natAbs n := prime_two_or_dvd_of_dvd_two_mul_pow_self_two hp h2n [GOAL] case intro.intro.intro m n : ℤ h : Int.gcd m n = 1 hm : m % 2 = 0 hn : n % 2 = 1 H : ¬Int.gcd (m ^ 2 - n ^ 2) (m ^ 2 + n ^ 2) = 1 p : ℕ hp : Nat.Prime p hp1 : ↑p ∣ m ^ 2 - n ^ 2 hp2 : ↑p ∣ m ^ 2 + n ^ 2 h2m : ↑p ∣ 2 * m ^ 2 h2n : ↑p ∣ 2 * n ^ 2 hmc : p = 2 ∨ p ∣ Int.natAbs m hnc : p = 2 ∨ p ∣ Int.natAbs n ⊢ False [PROOFSTEP] by_cases h2 : p = 2 -- Porting note: norm_num is not enough to close h3 [GOAL] case pos m n : ℤ h : Int.gcd m n = 1 hm : m % 2 = 0 hn : n % 2 = 1 H : ¬Int.gcd (m ^ 2 - n ^ 2) (m ^ 2 + n ^ 2) = 1 p : ℕ hp : Nat.Prime p hp1 : ↑p ∣ m ^ 2 - n ^ 2 hp2 : ↑p ∣ m ^ 2 + n ^ 2 h2m : ↑p ∣ 2 * m ^ 2 h2n : ↑p ∣ 2 * n ^ 2 hmc : p = 2 ∨ p ∣ Int.natAbs m hnc : p = 2 ∨ p ∣ Int.natAbs n h2 : p = 2 ⊢ False [PROOFSTEP] have h3 : (m ^ 2 + n ^ 2) % 2 = 1 := by field_simp [sq, Int.add_emod, Int.mul_emod, hm, hn] [GOAL] m n : ℤ h : Int.gcd m n = 1 hm : m % 2 = 0 hn : n % 2 = 1 H : ¬Int.gcd (m ^ 2 - n ^ 2) (m ^ 2 + n ^ 2) = 1 p : ℕ hp : Nat.Prime p hp1 : ↑p ∣ m ^ 2 - n ^ 2 hp2 : ↑p ∣ m ^ 2 + n ^ 2 h2m : ↑p ∣ 2 * m ^ 2 h2n : ↑p ∣ 2 * n ^ 2 hmc : p = 2 ∨ p ∣ Int.natAbs m hnc : p = 2 ∨ p ∣ Int.natAbs n h2 : p = 2 ⊢ (m ^ 2 + n ^ 2) % 2 = 1 [PROOFSTEP] field_simp [sq, Int.add_emod, Int.mul_emod, hm, hn] [GOAL] case pos m n : ℤ h : Int.gcd m n = 1 hm : m % 2 = 0 hn : n % 2 = 1 H : ¬Int.gcd (m ^ 2 - n ^ 2) (m ^ 2 + n ^ 2) = 1 p : ℕ hp : Nat.Prime p hp1 : ↑p ∣ m ^ 2 - n ^ 2 hp2 : ↑p ∣ m ^ 2 + n ^ 2 h2m : ↑p ∣ 2 * m ^ 2 h2n : ↑p ∣ 2 * n ^ 2 hmc : p = 2 ∨ p ∣ Int.natAbs m hnc : p = 2 ∨ p ∣ Int.natAbs n h2 : p = 2 h3 : (m ^ 2 + n ^ 2) % 2 = 1 ⊢ False [PROOFSTEP] have h4 : (m ^ 2 + n ^ 2) % 2 = 0 := by apply Int.emod_eq_zero_of_dvd rwa [h2] at hp2 [GOAL] m n : ℤ h : Int.gcd m n = 1 hm : m % 2 = 0 hn : n % 2 = 1 H : ¬Int.gcd (m ^ 2 - n ^ 2) (m ^ 2 + n ^ 2) = 1 p : ℕ hp : Nat.Prime p hp1 : ↑p ∣ m ^ 2 - n ^ 2 hp2 : ↑p ∣ m ^ 2 + n ^ 2 h2m : ↑p ∣ 2 * m ^ 2 h2n : ↑p ∣ 2 * n ^ 2 hmc : p = 2 ∨ p ∣ Int.natAbs m hnc : p = 2 ∨ p ∣ Int.natAbs n h2 : p = 2 h3 : (m ^ 2 + n ^ 2) % 2 = 1 ⊢ (m ^ 2 + n ^ 2) % 2 = 0 [PROOFSTEP] apply Int.emod_eq_zero_of_dvd [GOAL] case a m n : ℤ h : Int.gcd m n = 1 hm : m % 2 = 0 hn : n % 2 = 1 H : ¬Int.gcd (m ^ 2 - n ^ 2) (m ^ 2 + n ^ 2) = 1 p : ℕ hp : Nat.Prime p hp1 : ↑p ∣ m ^ 2 - n ^ 2 hp2 : ↑p ∣ m ^ 2 + n ^ 2 h2m : ↑p ∣ 2 * m ^ 2 h2n : ↑p ∣ 2 * n ^ 2 hmc : p = 2 ∨ p ∣ Int.natAbs m hnc : p = 2 ∨ p ∣ Int.natAbs n h2 : p = 2 h3 : (m ^ 2 + n ^ 2) % 2 = 1 ⊢ 2 ∣ m ^ 2 + n ^ 2 [PROOFSTEP] rwa [h2] at hp2 [GOAL] case pos m n : ℤ h : Int.gcd m n = 1 hm : m % 2 = 0 hn : n % 2 = 1 H : ¬Int.gcd (m ^ 2 - n ^ 2) (m ^ 2 + n ^ 2) = 1 p : ℕ hp : Nat.Prime p hp1 : ↑p ∣ m ^ 2 - n ^ 2 hp2 : ↑p ∣ m ^ 2 + n ^ 2 h2m : ↑p ∣ 2 * m ^ 2 h2n : ↑p ∣ 2 * n ^ 2 hmc : p = 2 ∨ p ∣ Int.natAbs m hnc : p = 2 ∨ p ∣ Int.natAbs n h2 : p = 2 h3 : (m ^ 2 + n ^ 2) % 2 = 1 h4 : (m ^ 2 + n ^ 2) % 2 = 0 ⊢ False [PROOFSTEP] rw [h4] at h3 [GOAL] case pos m n : ℤ h : Int.gcd m n = 1 hm : m % 2 = 0 hn : n % 2 = 1 H : ¬Int.gcd (m ^ 2 - n ^ 2) (m ^ 2 + n ^ 2) = 1 p : ℕ hp : Nat.Prime p hp1 : ↑p ∣ m ^ 2 - n ^ 2 hp2 : ↑p ∣ m ^ 2 + n ^ 2 h2m : ↑p ∣ 2 * m ^ 2 h2n : ↑p ∣ 2 * n ^ 2 hmc : p = 2 ∨ p ∣ Int.natAbs m hnc : p = 2 ∨ p ∣ Int.natAbs n h2 : p = 2 h3 : 0 = 1 h4 : (m ^ 2 + n ^ 2) % 2 = 0 ⊢ False [PROOFSTEP] exact zero_ne_one h3 [GOAL] case neg m n : ℤ h : Int.gcd m n = 1 hm : m % 2 = 0 hn : n % 2 = 1 H : ¬Int.gcd (m ^ 2 - n ^ 2) (m ^ 2 + n ^ 2) = 1 p : ℕ hp : Nat.Prime p hp1 : ↑p ∣ m ^ 2 - n ^ 2 hp2 : ↑p ∣ m ^ 2 + n ^ 2 h2m : ↑p ∣ 2 * m ^ 2 h2n : ↑p ∣ 2 * n ^ 2 hmc : p = 2 ∨ p ∣ Int.natAbs m hnc : p = 2 ∨ p ∣ Int.natAbs n h2 : ¬p = 2 ⊢ False [PROOFSTEP] apply hp.not_dvd_one [GOAL] case neg m n : ℤ h : Int.gcd m n = 1 hm : m % 2 = 0 hn : n % 2 = 1 H : ¬Int.gcd (m ^ 2 - n ^ 2) (m ^ 2 + n ^ 2) = 1 p : ℕ hp : Nat.Prime p hp1 : ↑p ∣ m ^ 2 - n ^ 2 hp2 : ↑p ∣ m ^ 2 + n ^ 2 h2m : ↑p ∣ 2 * m ^ 2 h2n : ↑p ∣ 2 * n ^ 2 hmc : p = 2 ∨ p ∣ Int.natAbs m hnc : p = 2 ∨ p ∣ Int.natAbs n h2 : ¬p = 2 ⊢ p ∣ 1 [PROOFSTEP] rw [← h] [GOAL] case neg m n : ℤ h : Int.gcd m n = 1 hm : m % 2 = 0 hn : n % 2 = 1 H : ¬Int.gcd (m ^ 2 - n ^ 2) (m ^ 2 + n ^ 2) = 1 p : ℕ hp : Nat.Prime p hp1 : ↑p ∣ m ^ 2 - n ^ 2 hp2 : ↑p ∣ m ^ 2 + n ^ 2 h2m : ↑p ∣ 2 * m ^ 2 h2n : ↑p ∣ 2 * n ^ 2 hmc : p = 2 ∨ p ∣ Int.natAbs m hnc : p = 2 ∨ p ∣ Int.natAbs n h2 : ¬p = 2 ⊢ p ∣ Int.gcd m n [PROOFSTEP] exact Nat.dvd_gcd (Or.resolve_left hmc h2) (Or.resolve_left hnc h2) [GOAL] m n : ℤ h : Int.gcd m n = 1 hm : m % 2 = 1 hn : n % 2 = 0 ⊢ Int.gcd (m ^ 2 - n ^ 2) (m ^ 2 + n ^ 2) = 1 [PROOFSTEP] rw [Int.gcd, ← Int.natAbs_neg (m ^ 2 - n ^ 2)] [GOAL] m n : ℤ h : Int.gcd m n = 1 hm : m % 2 = 1 hn : n % 2 = 0 ⊢ Nat.gcd (Int.natAbs (-(m ^ 2 - n ^ 2))) (Int.natAbs (m ^ 2 + n ^ 2)) = 1 [PROOFSTEP] rw [(by ring : -(m ^ 2 - n ^ 2) = n ^ 2 - m ^ 2), add_comm] [GOAL] m n : ℤ h : Int.gcd m n = 1 hm : m % 2 = 1 hn : n % 2 = 0 ⊢ -(m ^ 2 - n ^ 2) = n ^ 2 - m ^ 2 [PROOFSTEP] ring [GOAL] m n : ℤ h : Int.gcd m n = 1 hm : m % 2 = 1 hn : n % 2 = 0 ⊢ Nat.gcd (Int.natAbs (n ^ 2 - m ^ 2)) (Int.natAbs (n ^ 2 + m ^ 2)) = 1 [PROOFSTEP] apply coprime_sq_sub_sq_add_of_even_odd _ hn hm [GOAL] m n : ℤ h : Int.gcd m n = 1 hm : m % 2 = 1 hn : n % 2 = 0 ⊢ Int.gcd n m = 1 [PROOFSTEP] rwa [Int.gcd_comm] [GOAL] m n : ℤ h : Int.gcd m n = 1 hm : m % 2 = 0 hn : n % 2 = 1 ⊢ Int.gcd (m ^ 2 - n ^ 2) (2 * m * n) = 1 [PROOFSTEP] by_contra H [GOAL] m n : ℤ h : Int.gcd m n = 1 hm : m % 2 = 0 hn : n % 2 = 1 H : ¬Int.gcd (m ^ 2 - n ^ 2) (2 * m * n) = 1 ⊢ False [PROOFSTEP] obtain ⟨p, hp, hp1, hp2⟩ := Nat.Prime.not_coprime_iff_dvd.mp H [GOAL] case intro.intro.intro m n : ℤ h : Int.gcd m n = 1 hm : m % 2 = 0 hn : n % 2 = 1 H : ¬Int.gcd (m ^ 2 - n ^ 2) (2 * m * n) = 1 p : ℕ hp : Nat.Prime p hp1 : p ∣ Int.natAbs (m ^ 2 - n ^ 2) hp2 : p ∣ Int.natAbs (2 * m * n) ⊢ False [PROOFSTEP] rw [← Int.coe_nat_dvd_left] at hp1 hp2 [GOAL] case intro.intro.intro m n : ℤ h : Int.gcd m n = 1 hm : m % 2 = 0 hn : n % 2 = 1 H : ¬Int.gcd (m ^ 2 - n ^ 2) (2 * m * n) = 1 p : ℕ hp : Nat.Prime p hp1 : ↑p ∣ m ^ 2 - n ^ 2 hp2 : ↑p ∣ 2 * m * n ⊢ False [PROOFSTEP] have hnp : ¬(p : ℤ) ∣ Int.gcd m n := by rw [h] norm_cast exact mt Nat.dvd_one.mp (Nat.Prime.ne_one hp) [GOAL] m n : ℤ h : Int.gcd m n = 1 hm : m % 2 = 0 hn : n % 2 = 1 H : ¬Int.gcd (m ^ 2 - n ^ 2) (2 * m * n) = 1 p : ℕ hp : Nat.Prime p hp1 : ↑p ∣ m ^ 2 - n ^ 2 hp2 : ↑p ∣ 2 * m * n ⊢ ¬↑p ∣ ↑(Int.gcd m n) [PROOFSTEP] rw [h] [GOAL] m n : ℤ h : Int.gcd m n = 1 hm : m % 2 = 0 hn : n % 2 = 1 H : ¬Int.gcd (m ^ 2 - n ^ 2) (2 * m * n) = 1 p : ℕ hp : Nat.Prime p hp1 : ↑p ∣ m ^ 2 - n ^ 2 hp2 : ↑p ∣ 2 * m * n ⊢ ¬↑p ∣ ↑1 [PROOFSTEP] norm_cast [GOAL] m n : ℤ h : Int.gcd m n = 1 hm : m % 2 = 0 hn : n % 2 = 1 H : ¬Int.gcd (m ^ 2 - n ^ 2) (2 * m * n) = 1 p : ℕ hp : Nat.Prime p hp1 : ↑p ∣ m ^ 2 - n ^ 2 hp2 : ↑p ∣ 2 * m * n ⊢ ¬p ∣ 1 [PROOFSTEP] exact mt Nat.dvd_one.mp (Nat.Prime.ne_one hp) [GOAL] case intro.intro.intro m n : ℤ h : Int.gcd m n = 1 hm : m % 2 = 0 hn : n % 2 = 1 H : ¬Int.gcd (m ^ 2 - n ^ 2) (2 * m * n) = 1 p : ℕ hp : Nat.Prime p hp1 : ↑p ∣ m ^ 2 - n ^ 2 hp2 : ↑p ∣ 2 * m * n hnp : ¬↑p ∣ ↑(Int.gcd m n) ⊢ False [PROOFSTEP] cases' Int.Prime.dvd_mul hp hp2 with hp2m hpn [GOAL] case intro.intro.intro.inl m n : ℤ h : Int.gcd m n = 1 hm : m % 2 = 0 hn : n % 2 = 1 H : ¬Int.gcd (m ^ 2 - n ^ 2) (2 * m * n) = 1 p : ℕ hp : Nat.Prime p hp1 : ↑p ∣ m ^ 2 - n ^ 2 hp2 : ↑p ∣ 2 * m * n hnp : ¬↑p ∣ ↑(Int.gcd m n) hp2m : p ∣ Int.natAbs (2 * m) ⊢ False [PROOFSTEP] rw [Int.natAbs_mul] at hp2m [GOAL] case intro.intro.intro.inl m n : ℤ h : Int.gcd m n = 1 hm : m % 2 = 0 hn : n % 2 = 1 H : ¬Int.gcd (m ^ 2 - n ^ 2) (2 * m * n) = 1 p : ℕ hp : Nat.Prime p hp1 : ↑p ∣ m ^ 2 - n ^ 2 hp2 : ↑p ∣ 2 * m * n hnp : ¬↑p ∣ ↑(Int.gcd m n) hp2m : p ∣ Int.natAbs 2 * Int.natAbs m ⊢ False [PROOFSTEP] cases' (Nat.Prime.dvd_mul hp).mp hp2m with hp2 hpm [GOAL] case intro.intro.intro.inl.inl m n : ℤ h : Int.gcd m n = 1 hm : m % 2 = 0 hn : n % 2 = 1 H : ¬Int.gcd (m ^ 2 - n ^ 2) (2 * m * n) = 1 p : ℕ hp : Nat.Prime p hp1 : ↑p ∣ m ^ 2 - n ^ 2 hp2✝ : ↑p ∣ 2 * m * n hnp : ¬↑p ∣ ↑(Int.gcd m n) hp2m : p ∣ Int.natAbs 2 * Int.natAbs m hp2 : p ∣ Int.natAbs 2 ⊢ False [PROOFSTEP] have hp2' : p = 2 := (Nat.le_of_dvd zero_lt_two hp2).antisymm hp.two_le [GOAL] case intro.intro.intro.inl.inl m n : ℤ h : Int.gcd m n = 1 hm : m % 2 = 0 hn : n % 2 = 1 H : ¬Int.gcd (m ^ 2 - n ^ 2) (2 * m * n) = 1 p : ℕ hp : Nat.Prime p hp1 : ↑p ∣ m ^ 2 - n ^ 2 hp2✝ : ↑p ∣ 2 * m * n hnp : ¬↑p ∣ ↑(Int.gcd m n) hp2m : p ∣ Int.natAbs 2 * Int.natAbs m hp2 : p ∣ Int.natAbs 2 hp2' : p = 2 ⊢ False [PROOFSTEP] revert hp1 [GOAL] case intro.intro.intro.inl.inl m n : ℤ h : Int.gcd m n = 1 hm : m % 2 = 0 hn : n % 2 = 1 H : ¬Int.gcd (m ^ 2 - n ^ 2) (2 * m * n) = 1 p : ℕ hp : Nat.Prime p hp2✝ : ↑p ∣ 2 * m * n hnp : ¬↑p ∣ ↑(Int.gcd m n) hp2m : p ∣ Int.natAbs 2 * Int.natAbs m hp2 : p ∣ Int.natAbs 2 hp2' : p = 2 ⊢ ↑p ∣ m ^ 2 - n ^ 2 → False [PROOFSTEP] rw [hp2'] [GOAL] case intro.intro.intro.inl.inl m n : ℤ h : Int.gcd m n = 1 hm : m % 2 = 0 hn : n % 2 = 1 H : ¬Int.gcd (m ^ 2 - n ^ 2) (2 * m * n) = 1 p : ℕ hp : Nat.Prime p hp2✝ : ↑p ∣ 2 * m * n hnp : ¬↑p ∣ ↑(Int.gcd m n) hp2m : p ∣ Int.natAbs 2 * Int.natAbs m hp2 : p ∣ Int.natAbs 2 hp2' : p = 2 ⊢ ↑2 ∣ m ^ 2 - n ^ 2 → False [PROOFSTEP] apply mt Int.emod_eq_zero_of_dvd [GOAL] case intro.intro.intro.inl.inl m n : ℤ h : Int.gcd m n = 1 hm : m % 2 = 0 hn : n % 2 = 1 H : ¬Int.gcd (m ^ 2 - n ^ 2) (2 * m * n) = 1 p : ℕ hp : Nat.Prime p hp2✝ : ↑p ∣ 2 * m * n hnp : ¬↑p ∣ ↑(Int.gcd m n) hp2m : p ∣ Int.natAbs 2 * Int.natAbs m hp2 : p ∣ Int.natAbs 2 hp2' : p = 2 ⊢ ¬(m ^ 2 - n ^ 2) % ↑2 = 0 [PROOFSTEP] field_simp [sq, Int.sub_emod, Int.mul_emod, hm, hn] [GOAL] case intro.intro.intro.inl.inr m n : ℤ h : Int.gcd m n = 1 hm : m % 2 = 0 hn : n % 2 = 1 H : ¬Int.gcd (m ^ 2 - n ^ 2) (2 * m * n) = 1 p : ℕ hp : Nat.Prime p hp1 : ↑p ∣ m ^ 2 - n ^ 2 hp2 : ↑p ∣ 2 * m * n hnp : ¬↑p ∣ ↑(Int.gcd m n) hp2m : p ∣ Int.natAbs 2 * Int.natAbs m hpm : p ∣ Int.natAbs m ⊢ False [PROOFSTEP] apply mt (Int.dvd_gcd (Int.coe_nat_dvd_left.mpr hpm)) hnp [GOAL] case intro.intro.intro.inl.inr m n : ℤ h : Int.gcd m n = 1 hm : m % 2 = 0 hn : n % 2 = 1 H : ¬Int.gcd (m ^ 2 - n ^ 2) (2 * m * n) = 1 p : ℕ hp : Nat.Prime p hp1 : ↑p ∣ m ^ 2 - n ^ 2 hp2 : ↑p ∣ 2 * m * n hnp : ¬↑p ∣ ↑(Int.gcd m n) hp2m : p ∣ Int.natAbs 2 * Int.natAbs m hpm : p ∣ Int.natAbs m ⊢ ↑p ∣ n [PROOFSTEP] apply (or_self_iff _).mp [GOAL] case intro.intro.intro.inl.inr m n : ℤ h : Int.gcd m n = 1 hm : m % 2 = 0 hn : n % 2 = 1 H : ¬Int.gcd (m ^ 2 - n ^ 2) (2 * m * n) = 1 p : ℕ hp : Nat.Prime p hp1 : ↑p ∣ m ^ 2 - n ^ 2 hp2 : ↑p ∣ 2 * m * n hnp : ¬↑p ∣ ↑(Int.gcd m n) hp2m : p ∣ Int.natAbs 2 * Int.natAbs m hpm : p ∣ Int.natAbs m ⊢ ↑p ∣ n ∨ ↑p ∣ n [PROOFSTEP] apply Int.Prime.dvd_mul' hp [GOAL] case intro.intro.intro.inl.inr m n : ℤ h : Int.gcd m n = 1 hm : m % 2 = 0 hn : n % 2 = 1 H : ¬Int.gcd (m ^ 2 - n ^ 2) (2 * m * n) = 1 p : ℕ hp : Nat.Prime p hp1 : ↑p ∣ m ^ 2 - n ^ 2 hp2 : ↑p ∣ 2 * m * n hnp : ¬↑p ∣ ↑(Int.gcd m n) hp2m : p ∣ Int.natAbs 2 * Int.natAbs m hpm : p ∣ Int.natAbs m ⊢ ↑p ∣ n * n [PROOFSTEP] rw [(by ring : n * n = -(m ^ 2 - n ^ 2) + m * m)] [GOAL] m n : ℤ h : Int.gcd m n = 1 hm : m % 2 = 0 hn : n % 2 = 1 H : ¬Int.gcd (m ^ 2 - n ^ 2) (2 * m * n) = 1 p : ℕ hp : Nat.Prime p hp1 : ↑p ∣ m ^ 2 - n ^ 2 hp2 : ↑p ∣ 2 * m * n hnp : ¬↑p ∣ ↑(Int.gcd m n) hp2m : p ∣ Int.natAbs 2 * Int.natAbs m hpm : p ∣ Int.natAbs m ⊢ n * n = -(m ^ 2 - n ^ 2) + m * m [PROOFSTEP] ring [GOAL] case intro.intro.intro.inl.inr m n : ℤ h : Int.gcd m n = 1 hm : m % 2 = 0 hn : n % 2 = 1 H : ¬Int.gcd (m ^ 2 - n ^ 2) (2 * m * n) = 1 p : ℕ hp : Nat.Prime p hp1 : ↑p ∣ m ^ 2 - n ^ 2 hp2 : ↑p ∣ 2 * m * n hnp : ¬↑p ∣ ↑(Int.gcd m n) hp2m : p ∣ Int.natAbs 2 * Int.natAbs m hpm : p ∣ Int.natAbs m ⊢ ↑p ∣ -(m ^ 2 - n ^ 2) + m * m [PROOFSTEP] exact hp1.neg_right.add ((Int.coe_nat_dvd_left.2 hpm).mul_right _) [GOAL] case intro.intro.intro.inr m n : ℤ h : Int.gcd m n = 1 hm : m % 2 = 0 hn : n % 2 = 1 H : ¬Int.gcd (m ^ 2 - n ^ 2) (2 * m * n) = 1 p : ℕ hp : Nat.Prime p hp1 : ↑p ∣ m ^ 2 - n ^ 2 hp2 : ↑p ∣ 2 * m * n hnp : ¬↑p ∣ ↑(Int.gcd m n) hpn : p ∣ Int.natAbs n ⊢ False [PROOFSTEP] rw [Int.gcd_comm] at hnp [GOAL] case intro.intro.intro.inr m n : ℤ h : Int.gcd m n = 1 hm : m % 2 = 0 hn : n % 2 = 1 H : ¬Int.gcd (m ^ 2 - n ^ 2) (2 * m * n) = 1 p : ℕ hp : Nat.Prime p hp1 : ↑p ∣ m ^ 2 - n ^ 2 hp2 : ↑p ∣ 2 * m * n hnp : ¬↑p ∣ ↑(Int.gcd n m) hpn : p ∣ Int.natAbs n ⊢ False [PROOFSTEP] apply mt (Int.dvd_gcd (Int.coe_nat_dvd_left.mpr hpn)) hnp [GOAL] case intro.intro.intro.inr m n : ℤ h : Int.gcd m n = 1 hm : m % 2 = 0 hn : n % 2 = 1 H : ¬Int.gcd (m ^ 2 - n ^ 2) (2 * m * n) = 1 p : ℕ hp : Nat.Prime p hp1 : ↑p ∣ m ^ 2 - n ^ 2 hp2 : ↑p ∣ 2 * m * n hnp : ¬↑p ∣ ↑(Int.gcd n m) hpn : p ∣ Int.natAbs n ⊢ ↑p ∣ m [PROOFSTEP] apply (or_self_iff _).mp [GOAL] case intro.intro.intro.inr m n : ℤ h : Int.gcd m n = 1 hm : m % 2 = 0 hn : n % 2 = 1 H : ¬Int.gcd (m ^ 2 - n ^ 2) (2 * m * n) = 1 p : ℕ hp : Nat.Prime p hp1 : ↑p ∣ m ^ 2 - n ^ 2 hp2 : ↑p ∣ 2 * m * n hnp : ¬↑p ∣ ↑(Int.gcd n m) hpn : p ∣ Int.natAbs n ⊢ ↑p ∣ m ∨ ↑p ∣ m [PROOFSTEP] apply Int.Prime.dvd_mul' hp [GOAL] case intro.intro.intro.inr m n : ℤ h : Int.gcd m n = 1 hm : m % 2 = 0 hn : n % 2 = 1 H : ¬Int.gcd (m ^ 2 - n ^ 2) (2 * m * n) = 1 p : ℕ hp : Nat.Prime p hp1 : ↑p ∣ m ^ 2 - n ^ 2 hp2 : ↑p ∣ 2 * m * n hnp : ¬↑p ∣ ↑(Int.gcd n m) hpn : p ∣ Int.natAbs n ⊢ ↑p ∣ m * m [PROOFSTEP] rw [(by ring : m * m = m ^ 2 - n ^ 2 + n * n)] [GOAL] m n : ℤ h : Int.gcd m n = 1 hm : m % 2 = 0 hn : n % 2 = 1 H : ¬Int.gcd (m ^ 2 - n ^ 2) (2 * m * n) = 1 p : ℕ hp : Nat.Prime p hp1 : ↑p ∣ m ^ 2 - n ^ 2 hp2 : ↑p ∣ 2 * m * n hnp : ¬↑p ∣ ↑(Int.gcd n m) hpn : p ∣ Int.natAbs n ⊢ m * m = m ^ 2 - n ^ 2 + n * n [PROOFSTEP] ring [GOAL] case intro.intro.intro.inr m n : ℤ h : Int.gcd m n = 1 hm : m % 2 = 0 hn : n % 2 = 1 H : ¬Int.gcd (m ^ 2 - n ^ 2) (2 * m * n) = 1 p : ℕ hp : Nat.Prime p hp1 : ↑p ∣ m ^ 2 - n ^ 2 hp2 : ↑p ∣ 2 * m * n hnp : ¬↑p ∣ ↑(Int.gcd n m) hpn : p ∣ Int.natAbs n ⊢ ↑p ∣ m ^ 2 - n ^ 2 + n * n [PROOFSTEP] apply dvd_add hp1 [GOAL] case intro.intro.intro.inr m n : ℤ h : Int.gcd m n = 1 hm : m % 2 = 0 hn : n % 2 = 1 H : ¬Int.gcd (m ^ 2 - n ^ 2) (2 * m * n) = 1 p : ℕ hp : Nat.Prime p hp1 : ↑p ∣ m ^ 2 - n ^ 2 hp2 : ↑p ∣ 2 * m * n hnp : ¬↑p ∣ ↑(Int.gcd n m) hpn : p ∣ Int.natAbs n ⊢ ↑p ∣ n * n [PROOFSTEP] exact (Int.coe_nat_dvd_left.mpr hpn).mul_right n [GOAL] m n : ℤ h : Int.gcd m n = 1 hm : m % 2 = 1 hn : n % 2 = 0 ⊢ Int.gcd (m ^ 2 - n ^ 2) (2 * m * n) = 1 [PROOFSTEP] rw [Int.gcd, ← Int.natAbs_neg (m ^ 2 - n ^ 2)] [GOAL] m n : ℤ h : Int.gcd m n = 1 hm : m % 2 = 1 hn : n % 2 = 0 ⊢ Nat.gcd (Int.natAbs (-(m ^ 2 - n ^ 2))) (Int.natAbs (2 * m * n)) = 1 [PROOFSTEP] rw [(by ring : 2 * m * n = 2 * n * m), (by ring : -(m ^ 2 - n ^ 2) = n ^ 2 - m ^ 2)] [GOAL] m n : ℤ h : Int.gcd m n = 1 hm : m % 2 = 1 hn : n % 2 = 0 ⊢ 2 * m * n = 2 * n * m [PROOFSTEP] ring [GOAL] m n : ℤ h : Int.gcd m n = 1 hm : m % 2 = 1 hn : n % 2 = 0 ⊢ -(m ^ 2 - n ^ 2) = n ^ 2 - m ^ 2 [PROOFSTEP] ring [GOAL] m n : ℤ h : Int.gcd m n = 1 hm : m % 2 = 1 hn : n % 2 = 0 ⊢ Nat.gcd (Int.natAbs (n ^ 2 - m ^ 2)) (Int.natAbs (2 * n * m)) = 1 [PROOFSTEP] apply coprime_sq_sub_mul_of_even_odd _ hn hm [GOAL] m n : ℤ h : Int.gcd m n = 1 hm : m % 2 = 1 hn : n % 2 = 0 ⊢ Int.gcd n m = 1 [PROOFSTEP] rwa [Int.gcd_comm] [GOAL] m n : ℤ h : Int.gcd m n = 1 hmn : m % 2 = 0 ∧ n % 2 = 1 ∨ m % 2 = 1 ∧ n % 2 = 0 ⊢ Int.gcd (m ^ 2 - n ^ 2) (2 * m * n) = 1 [PROOFSTEP] cases' hmn with h1 h2 [GOAL] case inl m n : ℤ h : Int.gcd m n = 1 h1 : m % 2 = 0 ∧ n % 2 = 1 ⊢ Int.gcd (m ^ 2 - n ^ 2) (2 * m * n) = 1 [PROOFSTEP] exact coprime_sq_sub_mul_of_even_odd h h1.left h1.right [GOAL] case inr m n : ℤ h : Int.gcd m n = 1 h2 : m % 2 = 1 ∧ n % 2 = 0 ⊢ Int.gcd (m ^ 2 - n ^ 2) (2 * m * n) = 1 [PROOFSTEP] exact coprime_sq_sub_mul_of_odd_even h h2.left h2.right [GOAL] m n : ℤ h : Int.gcd m n = 1 hm : m % 2 = 1 hn : n % 2 = 1 ⊢ 2 ∣ m ^ 2 + n ^ 2 ∧ 2 ∣ m ^ 2 - n ^ 2 ∧ (m ^ 2 - n ^ 2) / 2 % 2 = 0 ∧ Int.gcd ((m ^ 2 - n ^ 2) / 2) ((m ^ 2 + n ^ 2) / 2) = 1 [PROOFSTEP] cases' exists_eq_mul_left_of_dvd (Int.dvd_sub_of_emod_eq hm) with m0 hm2 [GOAL] case intro m n : ℤ h : Int.gcd m n = 1 hm : m % 2 = 1 hn : n % 2 = 1 m0 : ℤ hm2 : m - 1 = m0 * 2 ⊢ 2 ∣ m ^ 2 + n ^ 2 ∧ 2 ∣ m ^ 2 - n ^ 2 ∧ (m ^ 2 - n ^ 2) / 2 % 2 = 0 ∧ Int.gcd ((m ^ 2 - n ^ 2) / 2) ((m ^ 2 + n ^ 2) / 2) = 1 [PROOFSTEP] cases' exists_eq_mul_left_of_dvd (Int.dvd_sub_of_emod_eq hn) with n0 hn2 [GOAL] case intro.intro m n : ℤ h : Int.gcd m n = 1 hm : m % 2 = 1 hn : n % 2 = 1 m0 : ℤ hm2 : m - 1 = m0 * 2 n0 : ℤ hn2 : n - 1 = n0 * 2 ⊢ 2 ∣ m ^ 2 + n ^ 2 ∧ 2 ∣ m ^ 2 - n ^ 2 ∧ (m ^ 2 - n ^ 2) / 2 % 2 = 0 ∧ Int.gcd ((m ^ 2 - n ^ 2) / 2) ((m ^ 2 + n ^ 2) / 2) = 1 [PROOFSTEP] rw [sub_eq_iff_eq_add] at hm2 hn2 [GOAL] case intro.intro m n : ℤ h : Int.gcd m n = 1 hm : m % 2 = 1 hn : n % 2 = 1 m0 : ℤ hm2 : m = m0 * 2 + 1 n0 : ℤ hn2 : n = n0 * 2 + 1 ⊢ 2 ∣ m ^ 2 + n ^ 2 ∧ 2 ∣ m ^ 2 - n ^ 2 ∧ (m ^ 2 - n ^ 2) / 2 % 2 = 0 ∧ Int.gcd ((m ^ 2 - n ^ 2) / 2) ((m ^ 2 + n ^ 2) / 2) = 1 [PROOFSTEP] subst m [GOAL] case intro.intro n : ℤ hn : n % 2 = 1 m0 n0 : ℤ hn2 : n = n0 * 2 + 1 h : Int.gcd (m0 * 2 + 1) n = 1 hm : (m0 * 2 + 1) % 2 = 1 ⊢ 2 ∣ (m0 * 2 + 1) ^ 2 + n ^ 2 ∧ 2 ∣ (m0 * 2 + 1) ^ 2 - n ^ 2 ∧ ((m0 * 2 + 1) ^ 2 - n ^ 2) / 2 % 2 = 0 ∧ Int.gcd (((m0 * 2 + 1) ^ 2 - n ^ 2) / 2) (((m0 * 2 + 1) ^ 2 + n ^ 2) / 2) = 1 [PROOFSTEP] subst n [GOAL] case intro.intro m0 n0 : ℤ hm : (m0 * 2 + 1) % 2 = 1 hn : (n0 * 2 + 1) % 2 = 1 h : Int.gcd (m0 * 2 + 1) (n0 * 2 + 1) = 1 ⊢ 2 ∣ (m0 * 2 + 1) ^ 2 + (n0 * 2 + 1) ^ 2 ∧ 2 ∣ (m0 * 2 + 1) ^ 2 - (n0 * 2 + 1) ^ 2 ∧ ((m0 * 2 + 1) ^ 2 - (n0 * 2 + 1) ^ 2) / 2 % 2 = 0 ∧ Int.gcd (((m0 * 2 + 1) ^ 2 - (n0 * 2 + 1) ^ 2) / 2) (((m0 * 2 + 1) ^ 2 + (n0 * 2 + 1) ^ 2) / 2) = 1 [PROOFSTEP] have h1 : (m0 * 2 + 1) ^ 2 + (n0 * 2 + 1) ^ 2 = 2 * (2 * (m0 ^ 2 + n0 ^ 2 + m0 + n0) + 1) := by ring [GOAL] m0 n0 : ℤ hm : (m0 * 2 + 1) % 2 = 1 hn : (n0 * 2 + 1) % 2 = 1 h : Int.gcd (m0 * 2 + 1) (n0 * 2 + 1) = 1 ⊢ (m0 * 2 + 1) ^ 2 + (n0 * 2 + 1) ^ 2 = 2 * (2 * (m0 ^ 2 + n0 ^ 2 + m0 + n0) + 1) [PROOFSTEP] ring [GOAL] case intro.intro m0 n0 : ℤ hm : (m0 * 2 + 1) % 2 = 1 hn : (n0 * 2 + 1) % 2 = 1 h : Int.gcd (m0 * 2 + 1) (n0 * 2 + 1) = 1 h1 : (m0 * 2 + 1) ^ 2 + (n0 * 2 + 1) ^ 2 = 2 * (2 * (m0 ^ 2 + n0 ^ 2 + m0 + n0) + 1) ⊢ 2 ∣ (m0 * 2 + 1) ^ 2 + (n0 * 2 + 1) ^ 2 ∧ 2 ∣ (m0 * 2 + 1) ^ 2 - (n0 * 2 + 1) ^ 2 ∧ ((m0 * 2 + 1) ^ 2 - (n0 * 2 + 1) ^ 2) / 2 % 2 = 0 ∧ Int.gcd (((m0 * 2 + 1) ^ 2 - (n0 * 2 + 1) ^ 2) / 2) (((m0 * 2 + 1) ^ 2 + (n0 * 2 + 1) ^ 2) / 2) = 1 [PROOFSTEP] have h2 : (m0 * 2 + 1) ^ 2 - (n0 * 2 + 1) ^ 2 = 2 * (2 * (m0 ^ 2 - n0 ^ 2 + m0 - n0)) := by ring [GOAL] m0 n0 : ℤ hm : (m0 * 2 + 1) % 2 = 1 hn : (n0 * 2 + 1) % 2 = 1 h : Int.gcd (m0 * 2 + 1) (n0 * 2 + 1) = 1 h1 : (m0 * 2 + 1) ^ 2 + (n0 * 2 + 1) ^ 2 = 2 * (2 * (m0 ^ 2 + n0 ^ 2 + m0 + n0) + 1) ⊢ (m0 * 2 + 1) ^ 2 - (n0 * 2 + 1) ^ 2 = 2 * (2 * (m0 ^ 2 - n0 ^ 2 + m0 - n0)) [PROOFSTEP] ring [GOAL] case intro.intro m0 n0 : ℤ hm : (m0 * 2 + 1) % 2 = 1 hn : (n0 * 2 + 1) % 2 = 1 h : Int.gcd (m0 * 2 + 1) (n0 * 2 + 1) = 1 h1 : (m0 * 2 + 1) ^ 2 + (n0 * 2 + 1) ^ 2 = 2 * (2 * (m0 ^ 2 + n0 ^ 2 + m0 + n0) + 1) h2 : (m0 * 2 + 1) ^ 2 - (n0 * 2 + 1) ^ 2 = 2 * (2 * (m0 ^ 2 - n0 ^ 2 + m0 - n0)) ⊢ 2 ∣ (m0 * 2 + 1) ^ 2 + (n0 * 2 + 1) ^ 2 ∧ 2 ∣ (m0 * 2 + 1) ^ 2 - (n0 * 2 + 1) ^ 2 ∧ ((m0 * 2 + 1) ^ 2 - (n0 * 2 + 1) ^ 2) / 2 % 2 = 0 ∧ Int.gcd (((m0 * 2 + 1) ^ 2 - (n0 * 2 + 1) ^ 2) / 2) (((m0 * 2 + 1) ^ 2 + (n0 * 2 + 1) ^ 2) / 2) = 1 [PROOFSTEP] have h3 : ((m0 * 2 + 1) ^ 2 - (n0 * 2 + 1) ^ 2) / 2 % 2 = 0 := by rw [h2, Int.mul_ediv_cancel_left, Int.mul_emod_right] exact by decide [GOAL] m0 n0 : ℤ hm : (m0 * 2 + 1) % 2 = 1 hn : (n0 * 2 + 1) % 2 = 1 h : Int.gcd (m0 * 2 + 1) (n0 * 2 + 1) = 1 h1 : (m0 * 2 + 1) ^ 2 + (n0 * 2 + 1) ^ 2 = 2 * (2 * (m0 ^ 2 + n0 ^ 2 + m0 + n0) + 1) h2 : (m0 * 2 + 1) ^ 2 - (n0 * 2 + 1) ^ 2 = 2 * (2 * (m0 ^ 2 - n0 ^ 2 + m0 - n0)) ⊢ ((m0 * 2 + 1) ^ 2 - (n0 * 2 + 1) ^ 2) / 2 % 2 = 0 [PROOFSTEP] rw [h2, Int.mul_ediv_cancel_left, Int.mul_emod_right] [GOAL] case H m0 n0 : ℤ hm : (m0 * 2 + 1) % 2 = 1 hn : (n0 * 2 + 1) % 2 = 1 h : Int.gcd (m0 * 2 + 1) (n0 * 2 + 1) = 1 h1 : (m0 * 2 + 1) ^ 2 + (n0 * 2 + 1) ^ 2 = 2 * (2 * (m0 ^ 2 + n0 ^ 2 + m0 + n0) + 1) h2 : (m0 * 2 + 1) ^ 2 - (n0 * 2 + 1) ^ 2 = 2 * (2 * (m0 ^ 2 - n0 ^ 2 + m0 - n0)) ⊢ 2 ≠ 0 [PROOFSTEP] exact by decide [GOAL] m0 n0 : ℤ hm : (m0 * 2 + 1) % 2 = 1 hn : (n0 * 2 + 1) % 2 = 1 h : Int.gcd (m0 * 2 + 1) (n0 * 2 + 1) = 1 h1 : (m0 * 2 + 1) ^ 2 + (n0 * 2 + 1) ^ 2 = 2 * (2 * (m0 ^ 2 + n0 ^ 2 + m0 + n0) + 1) h2 : (m0 * 2 + 1) ^ 2 - (n0 * 2 + 1) ^ 2 = 2 * (2 * (m0 ^ 2 - n0 ^ 2 + m0 - n0)) ⊢ 2 ≠ 0 [PROOFSTEP] decide [GOAL] case intro.intro m0 n0 : ℤ hm : (m0 * 2 + 1) % 2 = 1 hn : (n0 * 2 + 1) % 2 = 1 h : Int.gcd (m0 * 2 + 1) (n0 * 2 + 1) = 1 h1 : (m0 * 2 + 1) ^ 2 + (n0 * 2 + 1) ^ 2 = 2 * (2 * (m0 ^ 2 + n0 ^ 2 + m0 + n0) + 1) h2 : (m0 * 2 + 1) ^ 2 - (n0 * 2 + 1) ^ 2 = 2 * (2 * (m0 ^ 2 - n0 ^ 2 + m0 - n0)) h3 : ((m0 * 2 + 1) ^ 2 - (n0 * 2 + 1) ^ 2) / 2 % 2 = 0 ⊢ 2 ∣ (m0 * 2 + 1) ^ 2 + (n0 * 2 + 1) ^ 2 ∧ 2 ∣ (m0 * 2 + 1) ^ 2 - (n0 * 2 + 1) ^ 2 ∧ ((m0 * 2 + 1) ^ 2 - (n0 * 2 + 1) ^ 2) / 2 % 2 = 0 ∧ Int.gcd (((m0 * 2 + 1) ^ 2 - (n0 * 2 + 1) ^ 2) / 2) (((m0 * 2 + 1) ^ 2 + (n0 * 2 + 1) ^ 2) / 2) = 1 [PROOFSTEP] refine' ⟨⟨_, h1⟩, ⟨_, h2⟩, h3, _⟩ [GOAL] case intro.intro m0 n0 : ℤ hm : (m0 * 2 + 1) % 2 = 1 hn : (n0 * 2 + 1) % 2 = 1 h : Int.gcd (m0 * 2 + 1) (n0 * 2 + 1) = 1 h1 : (m0 * 2 + 1) ^ 2 + (n0 * 2 + 1) ^ 2 = 2 * (2 * (m0 ^ 2 + n0 ^ 2 + m0 + n0) + 1) h2 : (m0 * 2 + 1) ^ 2 - (n0 * 2 + 1) ^ 2 = 2 * (2 * (m0 ^ 2 - n0 ^ 2 + m0 - n0)) h3 : ((m0 * 2 + 1) ^ 2 - (n0 * 2 + 1) ^ 2) / 2 % 2 = 0 ⊢ Int.gcd (((m0 * 2 + 1) ^ 2 - (n0 * 2 + 1) ^ 2) / 2) (((m0 * 2 + 1) ^ 2 + (n0 * 2 + 1) ^ 2) / 2) = 1 [PROOFSTEP] have h20 : (2 : ℤ) ≠ 0 := by decide [GOAL] m0 n0 : ℤ hm : (m0 * 2 + 1) % 2 = 1 hn : (n0 * 2 + 1) % 2 = 1 h : Int.gcd (m0 * 2 + 1) (n0 * 2 + 1) = 1 h1 : (m0 * 2 + 1) ^ 2 + (n0 * 2 + 1) ^ 2 = 2 * (2 * (m0 ^ 2 + n0 ^ 2 + m0 + n0) + 1) h2 : (m0 * 2 + 1) ^ 2 - (n0 * 2 + 1) ^ 2 = 2 * (2 * (m0 ^ 2 - n0 ^ 2 + m0 - n0)) h3 : ((m0 * 2 + 1) ^ 2 - (n0 * 2 + 1) ^ 2) / 2 % 2 = 0 ⊢ 2 ≠ 0 [PROOFSTEP] decide [GOAL] case intro.intro m0 n0 : ℤ hm : (m0 * 2 + 1) % 2 = 1 hn : (n0 * 2 + 1) % 2 = 1 h : Int.gcd (m0 * 2 + 1) (n0 * 2 + 1) = 1 h1 : (m0 * 2 + 1) ^ 2 + (n0 * 2 + 1) ^ 2 = 2 * (2 * (m0 ^ 2 + n0 ^ 2 + m0 + n0) + 1) h2 : (m0 * 2 + 1) ^ 2 - (n0 * 2 + 1) ^ 2 = 2 * (2 * (m0 ^ 2 - n0 ^ 2 + m0 - n0)) h3 : ((m0 * 2 + 1) ^ 2 - (n0 * 2 + 1) ^ 2) / 2 % 2 = 0 h20 : 2 ≠ 0 ⊢ Int.gcd (((m0 * 2 + 1) ^ 2 - (n0 * 2 + 1) ^ 2) / 2) (((m0 * 2 + 1) ^ 2 + (n0 * 2 + 1) ^ 2) / 2) = 1 [PROOFSTEP] rw [h1, h2, Int.mul_ediv_cancel_left _ h20, Int.mul_ediv_cancel_left _ h20] [GOAL] case intro.intro m0 n0 : ℤ hm : (m0 * 2 + 1) % 2 = 1 hn : (n0 * 2 + 1) % 2 = 1 h : Int.gcd (m0 * 2 + 1) (n0 * 2 + 1) = 1 h1 : (m0 * 2 + 1) ^ 2 + (n0 * 2 + 1) ^ 2 = 2 * (2 * (m0 ^ 2 + n0 ^ 2 + m0 + n0) + 1) h2 : (m0 * 2 + 1) ^ 2 - (n0 * 2 + 1) ^ 2 = 2 * (2 * (m0 ^ 2 - n0 ^ 2 + m0 - n0)) h3 : ((m0 * 2 + 1) ^ 2 - (n0 * 2 + 1) ^ 2) / 2 % 2 = 0 h20 : 2 ≠ 0 ⊢ Int.gcd (2 * (m0 ^ 2 - n0 ^ 2 + m0 - n0)) (2 * (m0 ^ 2 + n0 ^ 2 + m0 + n0) + 1) = 1 [PROOFSTEP] by_contra h4 [GOAL] case intro.intro m0 n0 : ℤ hm : (m0 * 2 + 1) % 2 = 1 hn : (n0 * 2 + 1) % 2 = 1 h : Int.gcd (m0 * 2 + 1) (n0 * 2 + 1) = 1 h1 : (m0 * 2 + 1) ^ 2 + (n0 * 2 + 1) ^ 2 = 2 * (2 * (m0 ^ 2 + n0 ^ 2 + m0 + n0) + 1) h2 : (m0 * 2 + 1) ^ 2 - (n0 * 2 + 1) ^ 2 = 2 * (2 * (m0 ^ 2 - n0 ^ 2 + m0 - n0)) h3 : ((m0 * 2 + 1) ^ 2 - (n0 * 2 + 1) ^ 2) / 2 % 2 = 0 h20 : 2 ≠ 0 h4 : ¬Int.gcd (2 * (m0 ^ 2 - n0 ^ 2 + m0 - n0)) (2 * (m0 ^ 2 + n0 ^ 2 + m0 + n0) + 1) = 1 ⊢ False [PROOFSTEP] obtain ⟨p, hp, hp1, hp2⟩ := Nat.Prime.not_coprime_iff_dvd.mp h4 [GOAL] case intro.intro.intro.intro.intro m0 n0 : ℤ hm : (m0 * 2 + 1) % 2 = 1 hn : (n0 * 2 + 1) % 2 = 1 h : Int.gcd (m0 * 2 + 1) (n0 * 2 + 1) = 1 h1 : (m0 * 2 + 1) ^ 2 + (n0 * 2 + 1) ^ 2 = 2 * (2 * (m0 ^ 2 + n0 ^ 2 + m0 + n0) + 1) h2 : (m0 * 2 + 1) ^ 2 - (n0 * 2 + 1) ^ 2 = 2 * (2 * (m0 ^ 2 - n0 ^ 2 + m0 - n0)) h3 : ((m0 * 2 + 1) ^ 2 - (n0 * 2 + 1) ^ 2) / 2 % 2 = 0 h20 : 2 ≠ 0 h4 : ¬Int.gcd (2 * (m0 ^ 2 - n0 ^ 2 + m0 - n0)) (2 * (m0 ^ 2 + n0 ^ 2 + m0 + n0) + 1) = 1 p : ℕ hp : Nat.Prime p hp1 : p ∣ Int.natAbs (2 * (m0 ^ 2 - n0 ^ 2 + m0 - n0)) hp2 : p ∣ Int.natAbs (2 * (m0 ^ 2 + n0 ^ 2 + m0 + n0) + 1) ⊢ False [PROOFSTEP] apply hp.not_dvd_one [GOAL] case intro.intro.intro.intro.intro m0 n0 : ℤ hm : (m0 * 2 + 1) % 2 = 1 hn : (n0 * 2 + 1) % 2 = 1 h : Int.gcd (m0 * 2 + 1) (n0 * 2 + 1) = 1 h1 : (m0 * 2 + 1) ^ 2 + (n0 * 2 + 1) ^ 2 = 2 * (2 * (m0 ^ 2 + n0 ^ 2 + m0 + n0) + 1) h2 : (m0 * 2 + 1) ^ 2 - (n0 * 2 + 1) ^ 2 = 2 * (2 * (m0 ^ 2 - n0 ^ 2 + m0 - n0)) h3 : ((m0 * 2 + 1) ^ 2 - (n0 * 2 + 1) ^ 2) / 2 % 2 = 0 h20 : 2 ≠ 0 h4 : ¬Int.gcd (2 * (m0 ^ 2 - n0 ^ 2 + m0 - n0)) (2 * (m0 ^ 2 + n0 ^ 2 + m0 + n0) + 1) = 1 p : ℕ hp : Nat.Prime p hp1 : p ∣ Int.natAbs (2 * (m0 ^ 2 - n0 ^ 2 + m0 - n0)) hp2 : p ∣ Int.natAbs (2 * (m0 ^ 2 + n0 ^ 2 + m0 + n0) + 1) ⊢ p ∣ 1 [PROOFSTEP] rw [← h] [GOAL] case intro.intro.intro.intro.intro m0 n0 : ℤ hm : (m0 * 2 + 1) % 2 = 1 hn : (n0 * 2 + 1) % 2 = 1 h : Int.gcd (m0 * 2 + 1) (n0 * 2 + 1) = 1 h1 : (m0 * 2 + 1) ^ 2 + (n0 * 2 + 1) ^ 2 = 2 * (2 * (m0 ^ 2 + n0 ^ 2 + m0 + n0) + 1) h2 : (m0 * 2 + 1) ^ 2 - (n0 * 2 + 1) ^ 2 = 2 * (2 * (m0 ^ 2 - n0 ^ 2 + m0 - n0)) h3 : ((m0 * 2 + 1) ^ 2 - (n0 * 2 + 1) ^ 2) / 2 % 2 = 0 h20 : 2 ≠ 0 h4 : ¬Int.gcd (2 * (m0 ^ 2 - n0 ^ 2 + m0 - n0)) (2 * (m0 ^ 2 + n0 ^ 2 + m0 + n0) + 1) = 1 p : ℕ hp : Nat.Prime p hp1 : p ∣ Int.natAbs (2 * (m0 ^ 2 - n0 ^ 2 + m0 - n0)) hp2 : p ∣ Int.natAbs (2 * (m0 ^ 2 + n0 ^ 2 + m0 + n0) + 1) ⊢ p ∣ Int.gcd (m0 * 2 + 1) (n0 * 2 + 1) [PROOFSTEP] rw [← Int.coe_nat_dvd_left] at hp1 hp2 [GOAL] case intro.intro.intro.intro.intro m0 n0 : ℤ hm : (m0 * 2 + 1) % 2 = 1 hn : (n0 * 2 + 1) % 2 = 1 h : Int.gcd (m0 * 2 + 1) (n0 * 2 + 1) = 1 h1 : (m0 * 2 + 1) ^ 2 + (n0 * 2 + 1) ^ 2 = 2 * (2 * (m0 ^ 2 + n0 ^ 2 + m0 + n0) + 1) h2 : (m0 * 2 + 1) ^ 2 - (n0 * 2 + 1) ^ 2 = 2 * (2 * (m0 ^ 2 - n0 ^ 2 + m0 - n0)) h3 : ((m0 * 2 + 1) ^ 2 - (n0 * 2 + 1) ^ 2) / 2 % 2 = 0 h20 : 2 ≠ 0 h4 : ¬Int.gcd (2 * (m0 ^ 2 - n0 ^ 2 + m0 - n0)) (2 * (m0 ^ 2 + n0 ^ 2 + m0 + n0) + 1) = 1 p : ℕ hp : Nat.Prime p hp1 : ↑p ∣ 2 * (m0 ^ 2 - n0 ^ 2 + m0 - n0) hp2 : ↑p ∣ 2 * (m0 ^ 2 + n0 ^ 2 + m0 + n0) + 1 ⊢ p ∣ Int.gcd (m0 * 2 + 1) (n0 * 2 + 1) [PROOFSTEP] apply Nat.dvd_gcd [GOAL] case intro.intro.intro.intro.intro.a m0 n0 : ℤ hm : (m0 * 2 + 1) % 2 = 1 hn : (n0 * 2 + 1) % 2 = 1 h : Int.gcd (m0 * 2 + 1) (n0 * 2 + 1) = 1 h1 : (m0 * 2 + 1) ^ 2 + (n0 * 2 + 1) ^ 2 = 2 * (2 * (m0 ^ 2 + n0 ^ 2 + m0 + n0) + 1) h2 : (m0 * 2 + 1) ^ 2 - (n0 * 2 + 1) ^ 2 = 2 * (2 * (m0 ^ 2 - n0 ^ 2 + m0 - n0)) h3 : ((m0 * 2 + 1) ^ 2 - (n0 * 2 + 1) ^ 2) / 2 % 2 = 0 h20 : 2 ≠ 0 h4 : ¬Int.gcd (2 * (m0 ^ 2 - n0 ^ 2 + m0 - n0)) (2 * (m0 ^ 2 + n0 ^ 2 + m0 + n0) + 1) = 1 p : ℕ hp : Nat.Prime p hp1 : ↑p ∣ 2 * (m0 ^ 2 - n0 ^ 2 + m0 - n0) hp2 : ↑p ∣ 2 * (m0 ^ 2 + n0 ^ 2 + m0 + n0) + 1 ⊢ p ∣ Int.natAbs (m0 * 2 + 1) [PROOFSTEP] apply Int.Prime.dvd_natAbs_of_coe_dvd_sq hp [GOAL] case intro.intro.intro.intro.intro.a.h m0 n0 : ℤ hm : (m0 * 2 + 1) % 2 = 1 hn : (n0 * 2 + 1) % 2 = 1 h : Int.gcd (m0 * 2 + 1) (n0 * 2 + 1) = 1 h1 : (m0 * 2 + 1) ^ 2 + (n0 * 2 + 1) ^ 2 = 2 * (2 * (m0 ^ 2 + n0 ^ 2 + m0 + n0) + 1) h2 : (m0 * 2 + 1) ^ 2 - (n0 * 2 + 1) ^ 2 = 2 * (2 * (m0 ^ 2 - n0 ^ 2 + m0 - n0)) h3 : ((m0 * 2 + 1) ^ 2 - (n0 * 2 + 1) ^ 2) / 2 % 2 = 0 h20 : 2 ≠ 0 h4 : ¬Int.gcd (2 * (m0 ^ 2 - n0 ^ 2 + m0 - n0)) (2 * (m0 ^ 2 + n0 ^ 2 + m0 + n0) + 1) = 1 p : ℕ hp : Nat.Prime p hp1 : ↑p ∣ 2 * (m0 ^ 2 - n0 ^ 2 + m0 - n0) hp2 : ↑p ∣ 2 * (m0 ^ 2 + n0 ^ 2 + m0 + n0) + 1 ⊢ ↑p ∣ (m0 * 2 + 1) ^ 2 [PROOFSTEP] convert dvd_add hp1 hp2 [GOAL] case h.e'_4 m0 n0 : ℤ hm : (m0 * 2 + 1) % 2 = 1 hn : (n0 * 2 + 1) % 2 = 1 h : Int.gcd (m0 * 2 + 1) (n0 * 2 + 1) = 1 h1 : (m0 * 2 + 1) ^ 2 + (n0 * 2 + 1) ^ 2 = 2 * (2 * (m0 ^ 2 + n0 ^ 2 + m0 + n0) + 1) h2 : (m0 * 2 + 1) ^ 2 - (n0 * 2 + 1) ^ 2 = 2 * (2 * (m0 ^ 2 - n0 ^ 2 + m0 - n0)) h3 : ((m0 * 2 + 1) ^ 2 - (n0 * 2 + 1) ^ 2) / 2 % 2 = 0 h20 : 2 ≠ 0 h4 : ¬Int.gcd (2 * (m0 ^ 2 - n0 ^ 2 + m0 - n0)) (2 * (m0 ^ 2 + n0 ^ 2 + m0 + n0) + 1) = 1 p : ℕ hp : Nat.Prime p hp1 : ↑p ∣ 2 * (m0 ^ 2 - n0 ^ 2 + m0 - n0) hp2 : ↑p ∣ 2 * (m0 ^ 2 + n0 ^ 2 + m0 + n0) + 1 ⊢ (m0 * 2 + 1) ^ 2 = 2 * (m0 ^ 2 - n0 ^ 2 + m0 - n0) + (2 * (m0 ^ 2 + n0 ^ 2 + m0 + n0) + 1) [PROOFSTEP] ring [GOAL] case intro.intro.intro.intro.intro.a m0 n0 : ℤ hm : (m0 * 2 + 1) % 2 = 1 hn : (n0 * 2 + 1) % 2 = 1 h : Int.gcd (m0 * 2 + 1) (n0 * 2 + 1) = 1 h1 : (m0 * 2 + 1) ^ 2 + (n0 * 2 + 1) ^ 2 = 2 * (2 * (m0 ^ 2 + n0 ^ 2 + m0 + n0) + 1) h2 : (m0 * 2 + 1) ^ 2 - (n0 * 2 + 1) ^ 2 = 2 * (2 * (m0 ^ 2 - n0 ^ 2 + m0 - n0)) h3 : ((m0 * 2 + 1) ^ 2 - (n0 * 2 + 1) ^ 2) / 2 % 2 = 0 h20 : 2 ≠ 0 h4 : ¬Int.gcd (2 * (m0 ^ 2 - n0 ^ 2 + m0 - n0)) (2 * (m0 ^ 2 + n0 ^ 2 + m0 + n0) + 1) = 1 p : ℕ hp : Nat.Prime p hp1 : ↑p ∣ 2 * (m0 ^ 2 - n0 ^ 2 + m0 - n0) hp2 : ↑p ∣ 2 * (m0 ^ 2 + n0 ^ 2 + m0 + n0) + 1 ⊢ p ∣ Int.natAbs (n0 * 2 + 1) [PROOFSTEP] apply Int.Prime.dvd_natAbs_of_coe_dvd_sq hp [GOAL] case intro.intro.intro.intro.intro.a.h m0 n0 : ℤ hm : (m0 * 2 + 1) % 2 = 1 hn : (n0 * 2 + 1) % 2 = 1 h : Int.gcd (m0 * 2 + 1) (n0 * 2 + 1) = 1 h1 : (m0 * 2 + 1) ^ 2 + (n0 * 2 + 1) ^ 2 = 2 * (2 * (m0 ^ 2 + n0 ^ 2 + m0 + n0) + 1) h2 : (m0 * 2 + 1) ^ 2 - (n0 * 2 + 1) ^ 2 = 2 * (2 * (m0 ^ 2 - n0 ^ 2 + m0 - n0)) h3 : ((m0 * 2 + 1) ^ 2 - (n0 * 2 + 1) ^ 2) / 2 % 2 = 0 h20 : 2 ≠ 0 h4 : ¬Int.gcd (2 * (m0 ^ 2 - n0 ^ 2 + m0 - n0)) (2 * (m0 ^ 2 + n0 ^ 2 + m0 + n0) + 1) = 1 p : ℕ hp : Nat.Prime p hp1 : ↑p ∣ 2 * (m0 ^ 2 - n0 ^ 2 + m0 - n0) hp2 : ↑p ∣ 2 * (m0 ^ 2 + n0 ^ 2 + m0 + n0) + 1 ⊢ ↑p ∣ (n0 * 2 + 1) ^ 2 [PROOFSTEP] convert dvd_sub hp2 hp1 [GOAL] case h.e'_4 m0 n0 : ℤ hm : (m0 * 2 + 1) % 2 = 1 hn : (n0 * 2 + 1) % 2 = 1 h : Int.gcd (m0 * 2 + 1) (n0 * 2 + 1) = 1 h1 : (m0 * 2 + 1) ^ 2 + (n0 * 2 + 1) ^ 2 = 2 * (2 * (m0 ^ 2 + n0 ^ 2 + m0 + n0) + 1) h2 : (m0 * 2 + 1) ^ 2 - (n0 * 2 + 1) ^ 2 = 2 * (2 * (m0 ^ 2 - n0 ^ 2 + m0 - n0)) h3 : ((m0 * 2 + 1) ^ 2 - (n0 * 2 + 1) ^ 2) / 2 % 2 = 0 h20 : 2 ≠ 0 h4 : ¬Int.gcd (2 * (m0 ^ 2 - n0 ^ 2 + m0 - n0)) (2 * (m0 ^ 2 + n0 ^ 2 + m0 + n0) + 1) = 1 p : ℕ hp : Nat.Prime p hp1 : ↑p ∣ 2 * (m0 ^ 2 - n0 ^ 2 + m0 - n0) hp2 : ↑p ∣ 2 * (m0 ^ 2 + n0 ^ 2 + m0 + n0) + 1 ⊢ (n0 * 2 + 1) ^ 2 = 2 * (m0 ^ 2 + n0 ^ 2 + m0 + n0) + 1 - 2 * (m0 ^ 2 - n0 ^ 2 + m0 - n0) [PROOFSTEP] ring [GOAL] x y z : ℤ h : PythagoreanTriple x y z hc : Int.gcd x y = 1 hzpos : 0 < z m n : ℤ hm2n2 : 0 < m ^ 2 + n ^ 2 hv2 : ↑x / ↑z = 2 * ↑m * ↑n / (↑m ^ 2 + ↑n ^ 2) hw2 : ↑y / ↑z = (↑m ^ 2 - ↑n ^ 2) / (↑m ^ 2 + ↑n ^ 2) H : Int.gcd (m ^ 2 - n ^ 2) (m ^ 2 + n ^ 2) = 1 co : Int.gcd m n = 1 pp : m % 2 = 0 ∧ n % 2 = 1 ∨ m % 2 = 1 ∧ n % 2 = 0 ⊢ IsPrimitiveClassified h [PROOFSTEP] have hz : z ≠ 0 [GOAL] case hz x y z : ℤ h : PythagoreanTriple x y z hc : Int.gcd x y = 1 hzpos : 0 < z m n : ℤ hm2n2 : 0 < m ^ 2 + n ^ 2 hv2 : ↑x / ↑z = 2 * ↑m * ↑n / (↑m ^ 2 + ↑n ^ 2) hw2 : ↑y / ↑z = (↑m ^ 2 - ↑n ^ 2) / (↑m ^ 2 + ↑n ^ 2) H : Int.gcd (m ^ 2 - n ^ 2) (m ^ 2 + n ^ 2) = 1 co : Int.gcd m n = 1 pp : m % 2 = 0 ∧ n % 2 = 1 ∨ m % 2 = 1 ∧ n % 2 = 0 ⊢ z ≠ 0 x y z : ℤ h : PythagoreanTriple x y z hc : Int.gcd x y = 1 hzpos : 0 < z m n : ℤ hm2n2 : 0 < m ^ 2 + n ^ 2 hv2 : ↑x / ↑z = 2 * ↑m * ↑n / (↑m ^ 2 + ↑n ^ 2) hw2 : ↑y / ↑z = (↑m ^ 2 - ↑n ^ 2) / (↑m ^ 2 + ↑n ^ 2) H : Int.gcd (m ^ 2 - n ^ 2) (m ^ 2 + n ^ 2) = 1 co : Int.gcd m n = 1 pp : m % 2 = 0 ∧ n % 2 = 1 ∨ m % 2 = 1 ∧ n % 2 = 0 hz : z ≠ 0 ⊢ IsPrimitiveClassified h [PROOFSTEP] apply ne_of_gt hzpos [GOAL] x y z : ℤ h : PythagoreanTriple x y z hc : Int.gcd x y = 1 hzpos : 0 < z m n : ℤ hm2n2 : 0 < m ^ 2 + n ^ 2 hv2 : ↑x / ↑z = 2 * ↑m * ↑n / (↑m ^ 2 + ↑n ^ 2) hw2 : ↑y / ↑z = (↑m ^ 2 - ↑n ^ 2) / (↑m ^ 2 + ↑n ^ 2) H : Int.gcd (m ^ 2 - n ^ 2) (m ^ 2 + n ^ 2) = 1 co : Int.gcd m n = 1 pp : m % 2 = 0 ∧ n % 2 = 1 ∨ m % 2 = 1 ∧ n % 2 = 0 hz : z ≠ 0 ⊢ IsPrimitiveClassified h [PROOFSTEP] have h2 : y = m ^ 2 - n ^ 2 ∧ z = m ^ 2 + n ^ 2 := by apply Rat.div_int_inj hzpos hm2n2 (h.coprime_of_coprime hc) H rw [hw2] norm_cast [GOAL] x y z : ℤ h : PythagoreanTriple x y z hc : Int.gcd x y = 1 hzpos : 0 < z m n : ℤ hm2n2 : 0 < m ^ 2 + n ^ 2 hv2 : ↑x / ↑z = 2 * ↑m * ↑n / (↑m ^ 2 + ↑n ^ 2) hw2 : ↑y / ↑z = (↑m ^ 2 - ↑n ^ 2) / (↑m ^ 2 + ↑n ^ 2) H : Int.gcd (m ^ 2 - n ^ 2) (m ^ 2 + n ^ 2) = 1 co : Int.gcd m n = 1 pp : m % 2 = 0 ∧ n % 2 = 1 ∨ m % 2 = 1 ∧ n % 2 = 0 hz : z ≠ 0 ⊢ y = m ^ 2 - n ^ 2 ∧ z = m ^ 2 + n ^ 2 [PROOFSTEP] apply Rat.div_int_inj hzpos hm2n2 (h.coprime_of_coprime hc) H [GOAL] x y z : ℤ h : PythagoreanTriple x y z hc : Int.gcd x y = 1 hzpos : 0 < z m n : ℤ hm2n2 : 0 < m ^ 2 + n ^ 2 hv2 : ↑x / ↑z = 2 * ↑m * ↑n / (↑m ^ 2 + ↑n ^ 2) hw2 : ↑y / ↑z = (↑m ^ 2 - ↑n ^ 2) / (↑m ^ 2 + ↑n ^ 2) H : Int.gcd (m ^ 2 - n ^ 2) (m ^ 2 + n ^ 2) = 1 co : Int.gcd m n = 1 pp : m % 2 = 0 ∧ n % 2 = 1 ∨ m % 2 = 1 ∧ n % 2 = 0 hz : z ≠ 0 ⊢ ↑y / ↑z = ↑(m ^ 2 - n ^ 2) / ↑(m ^ 2 + n ^ 2) [PROOFSTEP] rw [hw2] [GOAL] x y z : ℤ h : PythagoreanTriple x y z hc : Int.gcd x y = 1 hzpos : 0 < z m n : ℤ hm2n2 : 0 < m ^ 2 + n ^ 2 hv2 : ↑x / ↑z = 2 * ↑m * ↑n / (↑m ^ 2 + ↑n ^ 2) hw2 : ↑y / ↑z = (↑m ^ 2 - ↑n ^ 2) / (↑m ^ 2 + ↑n ^ 2) H : Int.gcd (m ^ 2 - n ^ 2) (m ^ 2 + n ^ 2) = 1 co : Int.gcd m n = 1 pp : m % 2 = 0 ∧ n % 2 = 1 ∨ m % 2 = 1 ∧ n % 2 = 0 hz : z ≠ 0 ⊢ (↑m ^ 2 - ↑n ^ 2) / (↑m ^ 2 + ↑n ^ 2) = ↑(m ^ 2 - n ^ 2) / ↑(m ^ 2 + n ^ 2) [PROOFSTEP] norm_cast [GOAL] x y z : ℤ h : PythagoreanTriple x y z hc : Int.gcd x y = 1 hzpos : 0 < z m n : ℤ hm2n2 : 0 < m ^ 2 + n ^ 2 hv2 : ↑x / ↑z = 2 * ↑m * ↑n / (↑m ^ 2 + ↑n ^ 2) hw2 : ↑y / ↑z = (↑m ^ 2 - ↑n ^ 2) / (↑m ^ 2 + ↑n ^ 2) H : Int.gcd (m ^ 2 - n ^ 2) (m ^ 2 + n ^ 2) = 1 co : Int.gcd m n = 1 pp : m % 2 = 0 ∧ n % 2 = 1 ∨ m % 2 = 1 ∧ n % 2 = 0 hz : z ≠ 0 h2 : y = m ^ 2 - n ^ 2 ∧ z = m ^ 2 + n ^ 2 ⊢ IsPrimitiveClassified h [PROOFSTEP] use m, n [GOAL] case h x y z : ℤ h : PythagoreanTriple x y z hc : Int.gcd x y = 1 hzpos : 0 < z m n : ℤ hm2n2 : 0 < m ^ 2 + n ^ 2 hv2 : ↑x / ↑z = 2 * ↑m * ↑n / (↑m ^ 2 + ↑n ^ 2) hw2 : ↑y / ↑z = (↑m ^ 2 - ↑n ^ 2) / (↑m ^ 2 + ↑n ^ 2) H : Int.gcd (m ^ 2 - n ^ 2) (m ^ 2 + n ^ 2) = 1 co : Int.gcd m n = 1 pp : m % 2 = 0 ∧ n % 2 = 1 ∨ m % 2 = 1 ∧ n % 2 = 0 hz : z ≠ 0 h2 : y = m ^ 2 - n ^ 2 ∧ z = m ^ 2 + n ^ 2 ⊢ (x = m ^ 2 - n ^ 2 ∧ y = 2 * m * n ∨ x = 2 * m * n ∧ y = m ^ 2 - n ^ 2) ∧ Int.gcd m n = 1 ∧ (m % 2 = 0 ∧ n % 2 = 1 ∨ m % 2 = 1 ∧ n % 2 = 0) [PROOFSTEP] apply And.intro _ (And.intro co pp) [GOAL] x y z : ℤ h : PythagoreanTriple x y z hc : Int.gcd x y = 1 hzpos : 0 < z m n : ℤ hm2n2 : 0 < m ^ 2 + n ^ 2 hv2 : ↑x / ↑z = 2 * ↑m * ↑n / (↑m ^ 2 + ↑n ^ 2) hw2 : ↑y / ↑z = (↑m ^ 2 - ↑n ^ 2) / (↑m ^ 2 + ↑n ^ 2) H : Int.gcd (m ^ 2 - n ^ 2) (m ^ 2 + n ^ 2) = 1 co : Int.gcd m n = 1 pp : m % 2 = 0 ∧ n % 2 = 1 ∨ m % 2 = 1 ∧ n % 2 = 0 hz : z ≠ 0 h2 : y = m ^ 2 - n ^ 2 ∧ z = m ^ 2 + n ^ 2 ⊢ x = m ^ 2 - n ^ 2 ∧ y = 2 * m * n ∨ x = 2 * m * n ∧ y = m ^ 2 - n ^ 2 [PROOFSTEP] right [GOAL] case h x y z : ℤ h : PythagoreanTriple x y z hc : Int.gcd x y = 1 hzpos : 0 < z m n : ℤ hm2n2 : 0 < m ^ 2 + n ^ 2 hv2 : ↑x / ↑z = 2 * ↑m * ↑n / (↑m ^ 2 + ↑n ^ 2) hw2 : ↑y / ↑z = (↑m ^ 2 - ↑n ^ 2) / (↑m ^ 2 + ↑n ^ 2) H : Int.gcd (m ^ 2 - n ^ 2) (m ^ 2 + n ^ 2) = 1 co : Int.gcd m n = 1 pp : m % 2 = 0 ∧ n % 2 = 1 ∨ m % 2 = 1 ∧ n % 2 = 0 hz : z ≠ 0 h2 : y = m ^ 2 - n ^ 2 ∧ z = m ^ 2 + n ^ 2 ⊢ x = 2 * m * n ∧ y = m ^ 2 - n ^ 2 [PROOFSTEP] refine' ⟨_, h2.left⟩ [GOAL] case h x y z : ℤ h : PythagoreanTriple x y z hc : Int.gcd x y = 1 hzpos : 0 < z m n : ℤ hm2n2 : 0 < m ^ 2 + n ^ 2 hv2 : ↑x / ↑z = 2 * ↑m * ↑n / (↑m ^ 2 + ↑n ^ 2) hw2 : ↑y / ↑z = (↑m ^ 2 - ↑n ^ 2) / (↑m ^ 2 + ↑n ^ 2) H : Int.gcd (m ^ 2 - n ^ 2) (m ^ 2 + n ^ 2) = 1 co : Int.gcd m n = 1 pp : m % 2 = 0 ∧ n % 2 = 1 ∨ m % 2 = 1 ∧ n % 2 = 0 hz : z ≠ 0 h2 : y = m ^ 2 - n ^ 2 ∧ z = m ^ 2 + n ^ 2 ⊢ x = 2 * m * n [PROOFSTEP] rw [← Rat.coe_int_inj _ _, ← div_left_inj' ((mt (Rat.coe_int_inj z 0).mp) hz), hv2, h2.right] [GOAL] case h x y z : ℤ h : PythagoreanTriple x y z hc : Int.gcd x y = 1 hzpos : 0 < z m n : ℤ hm2n2 : 0 < m ^ 2 + n ^ 2 hv2 : ↑x / ↑z = 2 * ↑m * ↑n / (↑m ^ 2 + ↑n ^ 2) hw2 : ↑y / ↑z = (↑m ^ 2 - ↑n ^ 2) / (↑m ^ 2 + ↑n ^ 2) H : Int.gcd (m ^ 2 - n ^ 2) (m ^ 2 + n ^ 2) = 1 co : Int.gcd m n = 1 pp : m % 2 = 0 ∧ n % 2 = 1 ∨ m % 2 = 1 ∧ n % 2 = 0 hz : z ≠ 0 h2 : y = m ^ 2 - n ^ 2 ∧ z = m ^ 2 + n ^ 2 ⊢ 2 * ↑m * ↑n / (↑m ^ 2 + ↑n ^ 2) = ↑(2 * m * n) / ↑(m ^ 2 + n ^ 2) [PROOFSTEP] norm_cast [GOAL] x y z : ℤ h : PythagoreanTriple x y z hc : Int.gcd x y = 1 hyo : y % 2 = 1 hzpos : 0 < z ⊢ IsPrimitiveClassified h [PROOFSTEP] by_cases h0 : x = 0 [GOAL] case pos x y z : ℤ h : PythagoreanTriple x y z hc : Int.gcd x y = 1 hyo : y % 2 = 1 hzpos : 0 < z h0 : x = 0 ⊢ IsPrimitiveClassified h [PROOFSTEP] exact h.isPrimitiveClassified_of_coprime_of_zero_left hc h0 [GOAL] case neg x y z : ℤ h : PythagoreanTriple x y z hc : Int.gcd x y = 1 hyo : y % 2 = 1 hzpos : 0 < z h0 : ¬x = 0 ⊢ IsPrimitiveClassified h [PROOFSTEP] let v := (x : ℚ) / z [GOAL] case neg x y z : ℤ h : PythagoreanTriple x y z hc : Int.gcd x y = 1 hyo : y % 2 = 1 hzpos : 0 < z h0 : ¬x = 0 v : ℚ := ↑x / ↑z ⊢ IsPrimitiveClassified h [PROOFSTEP] let w := (y : ℚ) / z [GOAL] case neg x y z : ℤ h : PythagoreanTriple x y z hc : Int.gcd x y = 1 hyo : y % 2 = 1 hzpos : 0 < z h0 : ¬x = 0 v : ℚ := ↑x / ↑z w : ℚ := ↑y / ↑z ⊢ IsPrimitiveClassified h [PROOFSTEP] have hz : z ≠ 0 [GOAL] case hz x y z : ℤ h : PythagoreanTriple x y z hc : Int.gcd x y = 1 hyo : y % 2 = 1 hzpos : 0 < z h0 : ¬x = 0 v : ℚ := ↑x / ↑z w : ℚ := ↑y / ↑z ⊢ z ≠ 0 case neg x y z : ℤ h : PythagoreanTriple x y z hc : Int.gcd x y = 1 hyo : y % 2 = 1 hzpos : 0 < z h0 : ¬x = 0 v : ℚ := ↑x / ↑z w : ℚ := ↑y / ↑z hz : z ≠ 0 ⊢ IsPrimitiveClassified h [PROOFSTEP] apply ne_of_gt hzpos [GOAL] case neg x y z : ℤ h : PythagoreanTriple x y z hc : Int.gcd x y = 1 hyo : y % 2 = 1 hzpos : 0 < z h0 : ¬x = 0 v : ℚ := ↑x / ↑z w : ℚ := ↑y / ↑z hz : z ≠ 0 ⊢ IsPrimitiveClassified h [PROOFSTEP] have hq : v ^ 2 + w ^ 2 = 1 := by field_simp [hz, sq] norm_cast [GOAL] x y z : ℤ h : PythagoreanTriple x y z hc : Int.gcd x y = 1 hyo : y % 2 = 1 hzpos : 0 < z h0 : ¬x = 0 v : ℚ := ↑x / ↑z w : ℚ := ↑y / ↑z hz : z ≠ 0 ⊢ v ^ 2 + w ^ 2 = 1 [PROOFSTEP] field_simp [hz, sq] [GOAL] x y z : ℤ h : PythagoreanTriple x y z hc : Int.gcd x y = 1 hyo : y % 2 = 1 hzpos : 0 < z h0 : ¬x = 0 v : ℚ := ↑x / ↑z w : ℚ := ↑y / ↑z hz : z ≠ 0 ⊢ ↑x * ↑x + ↑y * ↑y = ↑z * ↑z [PROOFSTEP] norm_cast [GOAL] case neg x y z : ℤ h : PythagoreanTriple x y z hc : Int.gcd x y = 1 hyo : y % 2 = 1 hzpos : 0 < z h0 : ¬x = 0 v : ℚ := ↑x / ↑z w : ℚ := ↑y / ↑z hz : z ≠ 0 hq : v ^ 2 + w ^ 2 = 1 ⊢ IsPrimitiveClassified h [PROOFSTEP] have hvz : v ≠ 0 := by field_simp [hz] exact h0 [GOAL] x y z : ℤ h : PythagoreanTriple x y z hc : Int.gcd x y = 1 hyo : y % 2 = 1 hzpos : 0 < z h0 : ¬x = 0 v : ℚ := ↑x / ↑z w : ℚ := ↑y / ↑z hz : z ≠ 0 hq : v ^ 2 + w ^ 2 = 1 ⊢ v ≠ 0 [PROOFSTEP] field_simp [hz] [GOAL] x y z : ℤ h : PythagoreanTriple x y z hc : Int.gcd x y = 1 hyo : y % 2 = 1 hzpos : 0 < z h0 : ¬x = 0 v : ℚ := ↑x / ↑z w : ℚ := ↑y / ↑z hz : z ≠ 0 hq : v ^ 2 + w ^ 2 = 1 ⊢ ¬x = 0 [PROOFSTEP] exact h0 [GOAL] case neg x y z : ℤ h : PythagoreanTriple x y z hc : Int.gcd x y = 1 hyo : y % 2 = 1 hzpos : 0 < z h0 : ¬x = 0 v : ℚ := ↑x / ↑z w : ℚ := ↑y / ↑z hz : z ≠ 0 hq : v ^ 2 + w ^ 2 = 1 hvz : v ≠ 0 ⊢ IsPrimitiveClassified h [PROOFSTEP] have hw1 : w ≠ -1 := by contrapose! hvz with hw1 replace hw1 : w = -1 := hw1; show v = 0 rw [hw1, neg_sq, one_pow, add_left_eq_self] at hq exact pow_eq_zero hq [GOAL] x y z : ℤ h : PythagoreanTriple x y z hc : Int.gcd x y = 1 hyo : y % 2 = 1 hzpos : 0 < z h0 : ¬x = 0 v : ℚ := ↑x / ↑z w : ℚ := ↑y / ↑z hz : z ≠ 0 hq : v ^ 2 + w ^ 2 = 1 hvz : v ≠ 0 ⊢ w ≠ -1 [PROOFSTEP] contrapose! hvz with hw1 [GOAL] x y z : ℤ h : PythagoreanTriple x y z hc : Int.gcd x y = 1 hyo : y % 2 = 1 hzpos : 0 < z h0 : ¬x = 0 v : ℚ := ↑x / ↑z w : ℚ := ↑y / ↑z hz : z ≠ 0 hq : v ^ 2 + w ^ 2 = 1 hw1 : ↑y / ↑z = -1 ⊢ ↑x / ↑z = 0 [PROOFSTEP] replace hw1 : w = -1 := hw1 [GOAL] x y z : ℤ h : PythagoreanTriple x y z hc : Int.gcd x y = 1 hyo : y % 2 = 1 hzpos : 0 < z h0 : ¬x = 0 v : ℚ := ↑x / ↑z w : ℚ := ↑y / ↑z hz : z ≠ 0 hq : v ^ 2 + w ^ 2 = 1 hw1 : w = -1 ⊢ ↑x / ↑z = 0 [PROOFSTEP] show v = 0 [GOAL] x y z : ℤ h : PythagoreanTriple x y z hc : Int.gcd x y = 1 hyo : y % 2 = 1 hzpos : 0 < z h0 : ¬x = 0 v : ℚ := ↑x / ↑z w : ℚ := ↑y / ↑z hz : z ≠ 0 hq : v ^ 2 + w ^ 2 = 1 hw1 : w = -1 ⊢ v = 0 [PROOFSTEP] rw [hw1, neg_sq, one_pow, add_left_eq_self] at hq [GOAL] x y z : ℤ h : PythagoreanTriple x y z hc : Int.gcd x y = 1 hyo : y % 2 = 1 hzpos : 0 < z h0 : ¬x = 0 v : ℚ := ↑x / ↑z w : ℚ := ↑y / ↑z hz : z ≠ 0 hq : v ^ 2 = 0 hw1 : w = -1 ⊢ v = 0 [PROOFSTEP] exact pow_eq_zero hq [GOAL] case neg x y z : ℤ h : PythagoreanTriple x y z hc : Int.gcd x y = 1 hyo : y % 2 = 1 hzpos : 0 < z h0 : ¬x = 0 v : ℚ := ↑x / ↑z w : ℚ := ↑y / ↑z hz : z ≠ 0 hq : v ^ 2 + w ^ 2 = 1 hvz : v ≠ 0 hw1 : w ≠ -1 ⊢ IsPrimitiveClassified h [PROOFSTEP] have hQ : ∀ x : ℚ, 1 + x ^ 2 ≠ 0 := by intro q apply ne_of_gt exact lt_add_of_pos_of_le zero_lt_one (sq_nonneg q) [GOAL] x y z : ℤ h : PythagoreanTriple x y z hc : Int.gcd x y = 1 hyo : y % 2 = 1 hzpos : 0 < z h0 : ¬x = 0 v : ℚ := ↑x / ↑z w : ℚ := ↑y / ↑z hz : z ≠ 0 hq : v ^ 2 + w ^ 2 = 1 hvz : v ≠ 0 hw1 : w ≠ -1 ⊢ ∀ (x : ℚ), 1 + x ^ 2 ≠ 0 [PROOFSTEP] intro q [GOAL] x y z : ℤ h : PythagoreanTriple x y z hc : Int.gcd x y = 1 hyo : y % 2 = 1 hzpos : 0 < z h0 : ¬x = 0 v : ℚ := ↑x / ↑z w : ℚ := ↑y / ↑z hz : z ≠ 0 hq : v ^ 2 + w ^ 2 = 1 hvz : v ≠ 0 hw1 : w ≠ -1 q : ℚ ⊢ 1 + q ^ 2 ≠ 0 [PROOFSTEP] apply ne_of_gt [GOAL] case h x y z : ℤ h : PythagoreanTriple x y z hc : Int.gcd x y = 1 hyo : y % 2 = 1 hzpos : 0 < z h0 : ¬x = 0 v : ℚ := ↑x / ↑z w : ℚ := ↑y / ↑z hz : z ≠ 0 hq : v ^ 2 + w ^ 2 = 1 hvz : v ≠ 0 hw1 : w ≠ -1 q : ℚ ⊢ 0 < 1 + q ^ 2 [PROOFSTEP] exact lt_add_of_pos_of_le zero_lt_one (sq_nonneg q) [GOAL] case neg x y z : ℤ h : PythagoreanTriple x y z hc : Int.gcd x y = 1 hyo : y % 2 = 1 hzpos : 0 < z h0 : ¬x = 0 v : ℚ := ↑x / ↑z w : ℚ := ↑y / ↑z hz : z ≠ 0 hq : v ^ 2 + w ^ 2 = 1 hvz : v ≠ 0 hw1 : w ≠ -1 hQ : ∀ (x : ℚ), 1 + x ^ 2 ≠ 0 ⊢ IsPrimitiveClassified h [PROOFSTEP] have hp : (⟨v, w⟩ : ℚ × ℚ) ∈ {p : ℚ × ℚ | p.1 ^ 2 + p.2 ^ 2 = 1 ∧ p.2 ≠ -1} := ⟨hq, hw1⟩ [GOAL] case neg x y z : ℤ h : PythagoreanTriple x y z hc : Int.gcd x y = 1 hyo : y % 2 = 1 hzpos : 0 < z h0 : ¬x = 0 v : ℚ := ↑x / ↑z w : ℚ := ↑y / ↑z hz : z ≠ 0 hq : v ^ 2 + w ^ 2 = 1 hvz : v ≠ 0 hw1 : w ≠ -1 hQ : ∀ (x : ℚ), 1 + x ^ 2 ≠ 0 hp : (v, w) ∈ {p | p.fst ^ 2 + p.snd ^ 2 = 1 ∧ p.snd ≠ -1} ⊢ IsPrimitiveClassified h [PROOFSTEP] let q := (circleEquivGen hQ).symm ⟨⟨v, w⟩, hp⟩ [GOAL] case neg x y z : ℤ h : PythagoreanTriple x y z hc : Int.gcd x y = 1 hyo : y % 2 = 1 hzpos : 0 < z h0 : ¬x = 0 v : ℚ := ↑x / ↑z w : ℚ := ↑y / ↑z hz : z ≠ 0 hq : v ^ 2 + w ^ 2 = 1 hvz : v ≠ 0 hw1 : w ≠ -1 hQ : ∀ (x : ℚ), 1 + x ^ 2 ≠ 0 hp : (v, w) ∈ {p | p.fst ^ 2 + p.snd ^ 2 = 1 ∧ p.snd ≠ -1} q : (fun x => ℚ) { val := (v, w), property := hp } := ↑(circleEquivGen hQ).symm { val := (v, w), property := hp } ⊢ IsPrimitiveClassified h [PROOFSTEP] have ht4 : v = 2 * q / (1 + q ^ 2) ∧ w = (1 - q ^ 2) / (1 + q ^ 2) := by apply Prod.mk.inj have := ((circleEquivGen hQ).apply_symm_apply ⟨⟨v, w⟩, hp⟩).symm exact congr_arg Subtype.val this [GOAL] x y z : ℤ h : PythagoreanTriple x y z hc : Int.gcd x y = 1 hyo : y % 2 = 1 hzpos : 0 < z h0 : ¬x = 0 v : ℚ := ↑x / ↑z w : ℚ := ↑y / ↑z hz : z ≠ 0 hq : v ^ 2 + w ^ 2 = 1 hvz : v ≠ 0 hw1 : w ≠ -1 hQ : ∀ (x : ℚ), 1 + x ^ 2 ≠ 0 hp : (v, w) ∈ {p | p.fst ^ 2 + p.snd ^ 2 = 1 ∧ p.snd ≠ -1} q : (fun x => ℚ) { val := (v, w), property := hp } := ↑(circleEquivGen hQ).symm { val := (v, w), property := hp } ⊢ v = 2 * q / (1 + q ^ 2) ∧ w = (1 - q ^ 2) / (1 + q ^ 2) [PROOFSTEP] apply Prod.mk.inj [GOAL] case x x y z : ℤ h : PythagoreanTriple x y z hc : Int.gcd x y = 1 hyo : y % 2 = 1 hzpos : 0 < z h0 : ¬x = 0 v : ℚ := ↑x / ↑z w : ℚ := ↑y / ↑z hz : z ≠ 0 hq : v ^ 2 + w ^ 2 = 1 hvz : v ≠ 0 hw1 : w ≠ -1 hQ : ∀ (x : ℚ), 1 + x ^ 2 ≠ 0 hp : (v, w) ∈ {p | p.fst ^ 2 + p.snd ^ 2 = 1 ∧ p.snd ≠ -1} q : (fun x => ℚ) { val := (v, w), property := hp } := ↑(circleEquivGen hQ).symm { val := (v, w), property := hp } ⊢ (v, w) = (2 * q / (1 + q ^ 2), (1 - q ^ 2) / (1 + q ^ 2)) [PROOFSTEP] have := ((circleEquivGen hQ).apply_symm_apply ⟨⟨v, w⟩, hp⟩).symm [GOAL] case x x y z : ℤ h : PythagoreanTriple x y z hc : Int.gcd x y = 1 hyo : y % 2 = 1 hzpos : 0 < z h0 : ¬x = 0 v : ℚ := ↑x / ↑z w : ℚ := ↑y / ↑z hz : z ≠ 0 hq : v ^ 2 + w ^ 2 = 1 hvz : v ≠ 0 hw1 : w ≠ -1 hQ : ∀ (x : ℚ), 1 + x ^ 2 ≠ 0 hp : (v, w) ∈ {p | p.fst ^ 2 + p.snd ^ 2 = 1 ∧ p.snd ≠ -1} q : (fun x => ℚ) { val := (v, w), property := hp } := ↑(circleEquivGen hQ).symm { val := (v, w), property := hp } this : { val := (v, w), property := hp } = ↑(circleEquivGen hQ) (↑(circleEquivGen hQ).symm { val := (v, w), property := hp }) ⊢ (v, w) = (2 * q / (1 + q ^ 2), (1 - q ^ 2) / (1 + q ^ 2)) [PROOFSTEP] exact congr_arg Subtype.val this [GOAL] case neg x y z : ℤ h : PythagoreanTriple x y z hc : Int.gcd x y = 1 hyo : y % 2 = 1 hzpos : 0 < z h0 : ¬x = 0 v : ℚ := ↑x / ↑z w : ℚ := ↑y / ↑z hz : z ≠ 0 hq : v ^ 2 + w ^ 2 = 1 hvz : v ≠ 0 hw1 : w ≠ -1 hQ : ∀ (x : ℚ), 1 + x ^ 2 ≠ 0 hp : (v, w) ∈ {p | p.fst ^ 2 + p.snd ^ 2 = 1 ∧ p.snd ≠ -1} q : (fun x => ℚ) { val := (v, w), property := hp } := ↑(circleEquivGen hQ).symm { val := (v, w), property := hp } ht4 : v = 2 * q / (1 + q ^ 2) ∧ w = (1 - q ^ 2) / (1 + q ^ 2) ⊢ IsPrimitiveClassified h [PROOFSTEP] let m := (q.den : ℤ) [GOAL] case neg x y z : ℤ h : PythagoreanTriple x y z hc : Int.gcd x y = 1 hyo : y % 2 = 1 hzpos : 0 < z h0 : ¬x = 0 v : ℚ := ↑x / ↑z w : ℚ := ↑y / ↑z hz : z ≠ 0 hq : v ^ 2 + w ^ 2 = 1 hvz : v ≠ 0 hw1 : w ≠ -1 hQ : ∀ (x : ℚ), 1 + x ^ 2 ≠ 0 hp : (v, w) ∈ {p | p.fst ^ 2 + p.snd ^ 2 = 1 ∧ p.snd ≠ -1} q : (fun x => ℚ) { val := (v, w), property := hp } := ↑(circleEquivGen hQ).symm { val := (v, w), property := hp } ht4 : v = 2 * q / (1 + q ^ 2) ∧ w = (1 - q ^ 2) / (1 + q ^ 2) m : ℤ := ↑q.den ⊢ IsPrimitiveClassified h [PROOFSTEP] let n := q.num [GOAL] case neg x y z : ℤ h : PythagoreanTriple x y z hc : Int.gcd x y = 1 hyo : y % 2 = 1 hzpos : 0 < z h0 : ¬x = 0 v : ℚ := ↑x / ↑z w : ℚ := ↑y / ↑z hz : z ≠ 0 hq : v ^ 2 + w ^ 2 = 1 hvz : v ≠ 0 hw1 : w ≠ -1 hQ : ∀ (x : ℚ), 1 + x ^ 2 ≠ 0 hp : (v, w) ∈ {p | p.fst ^ 2 + p.snd ^ 2 = 1 ∧ p.snd ≠ -1} q : (fun x => ℚ) { val := (v, w), property := hp } := ↑(circleEquivGen hQ).symm { val := (v, w), property := hp } ht4 : v = 2 * q / (1 + q ^ 2) ∧ w = (1 - q ^ 2) / (1 + q ^ 2) m : ℤ := ↑q.den n : ℤ := q.num ⊢ IsPrimitiveClassified h [PROOFSTEP] have hm0 : m ≠ 0 := by norm_cast apply Rat.den_nz q [GOAL] x y z : ℤ h : PythagoreanTriple x y z hc : Int.gcd x y = 1 hyo : y % 2 = 1 hzpos : 0 < z h0 : ¬x = 0 v : ℚ := ↑x / ↑z w : ℚ := ↑y / ↑z hz : z ≠ 0 hq : v ^ 2 + w ^ 2 = 1 hvz : v ≠ 0 hw1 : w ≠ -1 hQ : ∀ (x : ℚ), 1 + x ^ 2 ≠ 0 hp : (v, w) ∈ {p | p.fst ^ 2 + p.snd ^ 2 = 1 ∧ p.snd ≠ -1} q : (fun x => ℚ) { val := (v, w), property := hp } := ↑(circleEquivGen hQ).symm { val := (v, w), property := hp } ht4 : v = 2 * q / (1 + q ^ 2) ∧ w = (1 - q ^ 2) / (1 + q ^ 2) m : ℤ := ↑q.den n : ℤ := q.num ⊢ m ≠ 0 [PROOFSTEP] norm_cast [GOAL] x y z : ℤ h : PythagoreanTriple x y z hc : Int.gcd x y = 1 hyo : y % 2 = 1 hzpos : 0 < z h0 : ¬x = 0 v : ℚ := ↑x / ↑z w : ℚ := ↑y / ↑z hz : z ≠ 0 hq : v ^ 2 + w ^ 2 = 1 hvz : v ≠ 0 hw1 : w ≠ -1 hQ : ∀ (x : ℚ), 1 + x ^ 2 ≠ 0 hp : (v, w) ∈ {p | p.fst ^ 2 + p.snd ^ 2 = 1 ∧ p.snd ≠ -1} q : (fun x => ℚ) { val := (v, w), property := hp } := ↑(circleEquivGen hQ).symm { val := (v, w), property := hp } ht4 : v = 2 * q / (1 + q ^ 2) ∧ w = (1 - q ^ 2) / (1 + q ^ 2) m : ℤ := ↑q.den n : ℤ := q.num ⊢ ¬q.den = 0 [PROOFSTEP] apply Rat.den_nz q [GOAL] case neg x y z : ℤ h : PythagoreanTriple x y z hc : Int.gcd x y = 1 hyo : y % 2 = 1 hzpos : 0 < z h0 : ¬x = 0 v : ℚ := ↑x / ↑z w : ℚ := ↑y / ↑z hz : z ≠ 0 hq : v ^ 2 + w ^ 2 = 1 hvz : v ≠ 0 hw1 : w ≠ -1 hQ : ∀ (x : ℚ), 1 + x ^ 2 ≠ 0 hp : (v, w) ∈ {p | p.fst ^ 2 + p.snd ^ 2 = 1 ∧ p.snd ≠ -1} q : (fun x => ℚ) { val := (v, w), property := hp } := ↑(circleEquivGen hQ).symm { val := (v, w), property := hp } ht4 : v = 2 * q / (1 + q ^ 2) ∧ w = (1 - q ^ 2) / (1 + q ^ 2) m : ℤ := ↑q.den n : ℤ := q.num hm0 : m ≠ 0 ⊢ IsPrimitiveClassified h [PROOFSTEP] have hq2 : q = n / m := (Rat.num_div_den q).symm [GOAL] case neg x y z : ℤ h : PythagoreanTriple x y z hc : Int.gcd x y = 1 hyo : y % 2 = 1 hzpos : 0 < z h0 : ¬x = 0 v : ℚ := ↑x / ↑z w : ℚ := ↑y / ↑z hz : z ≠ 0 hq : v ^ 2 + w ^ 2 = 1 hvz : v ≠ 0 hw1 : w ≠ -1 hQ : ∀ (x : ℚ), 1 + x ^ 2 ≠ 0 hp : (v, w) ∈ {p | p.fst ^ 2 + p.snd ^ 2 = 1 ∧ p.snd ≠ -1} q : (fun x => ℚ) { val := (v, w), property := hp } := ↑(circleEquivGen hQ).symm { val := (v, w), property := hp } ht4 : v = 2 * q / (1 + q ^ 2) ∧ w = (1 - q ^ 2) / (1 + q ^ 2) m : ℤ := ↑q.den n : ℤ := q.num hm0 : m ≠ 0 hq2 : q = ↑n / ↑m ⊢ IsPrimitiveClassified h [PROOFSTEP] have hm2n2 : 0 < m ^ 2 + n ^ 2 := by apply lt_add_of_pos_of_le _ (sq_nonneg n) exact lt_of_le_of_ne (sq_nonneg m) (Ne.symm (pow_ne_zero 2 hm0)) [GOAL] x y z : ℤ h : PythagoreanTriple x y z hc : Int.gcd x y = 1 hyo : y % 2 = 1 hzpos : 0 < z h0 : ¬x = 0 v : ℚ := ↑x / ↑z w : ℚ := ↑y / ↑z hz : z ≠ 0 hq : v ^ 2 + w ^ 2 = 1 hvz : v ≠ 0 hw1 : w ≠ -1 hQ : ∀ (x : ℚ), 1 + x ^ 2 ≠ 0 hp : (v, w) ∈ {p | p.fst ^ 2 + p.snd ^ 2 = 1 ∧ p.snd ≠ -1} q : (fun x => ℚ) { val := (v, w), property := hp } := ↑(circleEquivGen hQ).symm { val := (v, w), property := hp } ht4 : v = 2 * q / (1 + q ^ 2) ∧ w = (1 - q ^ 2) / (1 + q ^ 2) m : ℤ := ↑q.den n : ℤ := q.num hm0 : m ≠ 0 hq2 : q = ↑n / ↑m ⊢ 0 < m ^ 2 + n ^ 2 [PROOFSTEP] apply lt_add_of_pos_of_le _ (sq_nonneg n) [GOAL] x y z : ℤ h : PythagoreanTriple x y z hc : Int.gcd x y = 1 hyo : y % 2 = 1 hzpos : 0 < z h0 : ¬x = 0 v : ℚ := ↑x / ↑z w : ℚ := ↑y / ↑z hz : z ≠ 0 hq : v ^ 2 + w ^ 2 = 1 hvz : v ≠ 0 hw1 : w ≠ -1 hQ : ∀ (x : ℚ), 1 + x ^ 2 ≠ 0 hp : (v, w) ∈ {p | p.fst ^ 2 + p.snd ^ 2 = 1 ∧ p.snd ≠ -1} q : (fun x => ℚ) { val := (v, w), property := hp } := ↑(circleEquivGen hQ).symm { val := (v, w), property := hp } ht4 : v = 2 * q / (1 + q ^ 2) ∧ w = (1 - q ^ 2) / (1 + q ^ 2) m : ℤ := ↑q.den n : ℤ := q.num hm0 : m ≠ 0 hq2 : q = ↑n / ↑m ⊢ 0 < m ^ 2 [PROOFSTEP] exact lt_of_le_of_ne (sq_nonneg m) (Ne.symm (pow_ne_zero 2 hm0)) [GOAL] case neg x y z : ℤ h : PythagoreanTriple x y z hc : Int.gcd x y = 1 hyo : y % 2 = 1 hzpos : 0 < z h0 : ¬x = 0 v : ℚ := ↑x / ↑z w : ℚ := ↑y / ↑z hz : z ≠ 0 hq : v ^ 2 + w ^ 2 = 1 hvz : v ≠ 0 hw1 : w ≠ -1 hQ : ∀ (x : ℚ), 1 + x ^ 2 ≠ 0 hp : (v, w) ∈ {p | p.fst ^ 2 + p.snd ^ 2 = 1 ∧ p.snd ≠ -1} q : (fun x => ℚ) { val := (v, w), property := hp } := ↑(circleEquivGen hQ).symm { val := (v, w), property := hp } ht4 : v = 2 * q / (1 + q ^ 2) ∧ w = (1 - q ^ 2) / (1 + q ^ 2) m : ℤ := ↑q.den n : ℤ := q.num hm0 : m ≠ 0 hq2 : q = ↑n / ↑m hm2n2 : 0 < m ^ 2 + n ^ 2 ⊢ IsPrimitiveClassified h [PROOFSTEP] have hm2n20 : (m : ℚ) ^ 2 + (n : ℚ) ^ 2 ≠ 0 := by norm_cast simpa only [Int.coe_nat_pow] using ne_of_gt hm2n2 [GOAL] x y z : ℤ h : PythagoreanTriple x y z hc : Int.gcd x y = 1 hyo : y % 2 = 1 hzpos : 0 < z h0 : ¬x = 0 v : ℚ := ↑x / ↑z w : ℚ := ↑y / ↑z hz : z ≠ 0 hq : v ^ 2 + w ^ 2 = 1 hvz : v ≠ 0 hw1 : w ≠ -1 hQ : ∀ (x : ℚ), 1 + x ^ 2 ≠ 0 hp : (v, w) ∈ {p | p.fst ^ 2 + p.snd ^ 2 = 1 ∧ p.snd ≠ -1} q : (fun x => ℚ) { val := (v, w), property := hp } := ↑(circleEquivGen hQ).symm { val := (v, w), property := hp } ht4 : v = 2 * q / (1 + q ^ 2) ∧ w = (1 - q ^ 2) / (1 + q ^ 2) m : ℤ := ↑q.den n : ℤ := q.num hm0 : m ≠ 0 hq2 : q = ↑n / ↑m hm2n2 : 0 < m ^ 2 + n ^ 2 ⊢ ↑m ^ 2 + ↑n ^ 2 ≠ 0 [PROOFSTEP] norm_cast [GOAL] x y z : ℤ h : PythagoreanTriple x y z hc : Int.gcd x y = 1 hyo : y % 2 = 1 hzpos : 0 < z h0 : ¬x = 0 v : ℚ := ↑x / ↑z w : ℚ := ↑y / ↑z hz : z ≠ 0 hq : v ^ 2 + w ^ 2 = 1 hvz : v ≠ 0 hw1 : w ≠ -1 hQ : ∀ (x : ℚ), 1 + x ^ 2 ≠ 0 hp : (v, w) ∈ {p | p.fst ^ 2 + p.snd ^ 2 = 1 ∧ p.snd ≠ -1} q : (fun x => ℚ) { val := (v, w), property := hp } := ↑(circleEquivGen hQ).symm { val := (v, w), property := hp } ht4 : v = 2 * q / (1 + q ^ 2) ∧ w = (1 - q ^ 2) / (1 + q ^ 2) m : ℤ := ↑q.den n : ℤ := q.num hm0 : m ≠ 0 hq2 : q = ↑n / ↑m hm2n2 : 0 < m ^ 2 + n ^ 2 ⊢ ¬↑(q.den ^ 2) + n ^ 2 = 0 [PROOFSTEP] simpa only [Int.coe_nat_pow] using ne_of_gt hm2n2 [GOAL] case neg x y z : ℤ h : PythagoreanTriple x y z hc : Int.gcd x y = 1 hyo : y % 2 = 1 hzpos : 0 < z h0 : ¬x = 0 v : ℚ := ↑x / ↑z w : ℚ := ↑y / ↑z hz : z ≠ 0 hq : v ^ 2 + w ^ 2 = 1 hvz : v ≠ 0 hw1 : w ≠ -1 hQ : ∀ (x : ℚ), 1 + x ^ 2 ≠ 0 hp : (v, w) ∈ {p | p.fst ^ 2 + p.snd ^ 2 = 1 ∧ p.snd ≠ -1} q : (fun x => ℚ) { val := (v, w), property := hp } := ↑(circleEquivGen hQ).symm { val := (v, w), property := hp } ht4 : v = 2 * q / (1 + q ^ 2) ∧ w = (1 - q ^ 2) / (1 + q ^ 2) m : ℤ := ↑q.den n : ℤ := q.num hm0 : m ≠ 0 hq2 : q = ↑n / ↑m hm2n2 : 0 < m ^ 2 + n ^ 2 hm2n20 : ↑m ^ 2 + ↑n ^ 2 ≠ 0 ⊢ IsPrimitiveClassified h [PROOFSTEP] have hx1 {j k : ℚ} (h₁ : k ≠ 0) (h₂ : k ^ 2 + j ^ 2 ≠ 0) : (1 - (j / k) ^ 2) / (1 + (j / k) ^ 2) = (k ^ 2 - j ^ 2) / (k ^ 2 + j ^ 2) := by field_simp [GOAL] x y z : ℤ h : PythagoreanTriple x y z hc : Int.gcd x y = 1 hyo : y % 2 = 1 hzpos : 0 < z h0 : ¬x = 0 v : ℚ := ↑x / ↑z w : ℚ := ↑y / ↑z hz : z ≠ 0 hq : v ^ 2 + w ^ 2 = 1 hvz : v ≠ 0 hw1 : w ≠ -1 hQ : ∀ (x : ℚ), 1 + x ^ 2 ≠ 0 hp : (v, w) ∈ {p | p.fst ^ 2 + p.snd ^ 2 = 1 ∧ p.snd ≠ -1} q : (fun x => ℚ) { val := (v, w), property := hp } := ↑(circleEquivGen hQ).symm { val := (v, w), property := hp } ht4 : v = 2 * q / (1 + q ^ 2) ∧ w = (1 - q ^ 2) / (1 + q ^ 2) m : ℤ := ↑q.den n : ℤ := q.num hm0 : m ≠ 0 hq2 : q = ↑n / ↑m hm2n2 : 0 < m ^ 2 + n ^ 2 hm2n20 : ↑m ^ 2 + ↑n ^ 2 ≠ 0 j k : ℚ h₁ : k ≠ 0 h₂ : k ^ 2 + j ^ 2 ≠ 0 ⊢ (1 - (j / k) ^ 2) / (1 + (j / k) ^ 2) = (k ^ 2 - j ^ 2) / (k ^ 2 + j ^ 2) [PROOFSTEP] field_simp [GOAL] case neg x y z : ℤ h : PythagoreanTriple x y z hc : Int.gcd x y = 1 hyo : y % 2 = 1 hzpos : 0 < z h0 : ¬x = 0 v : ℚ := ↑x / ↑z w : ℚ := ↑y / ↑z hz : z ≠ 0 hq : v ^ 2 + w ^ 2 = 1 hvz : v ≠ 0 hw1 : w ≠ -1 hQ : ∀ (x : ℚ), 1 + x ^ 2 ≠ 0 hp : (v, w) ∈ {p | p.fst ^ 2 + p.snd ^ 2 = 1 ∧ p.snd ≠ -1} q : (fun x => ℚ) { val := (v, w), property := hp } := ↑(circleEquivGen hQ).symm { val := (v, w), property := hp } ht4 : v = 2 * q / (1 + q ^ 2) ∧ w = (1 - q ^ 2) / (1 + q ^ 2) m : ℤ := ↑q.den n : ℤ := q.num hm0 : m ≠ 0 hq2 : q = ↑n / ↑m hm2n2 : 0 < m ^ 2 + n ^ 2 hm2n20 : ↑m ^ 2 + ↑n ^ 2 ≠ 0 hx1 : ∀ {j k : ℚ}, k ≠ 0 → k ^ 2 + j ^ 2 ≠ 0 → (1 - (j / k) ^ 2) / (1 + (j / k) ^ 2) = (k ^ 2 - j ^ 2) / (k ^ 2 + j ^ 2) ⊢ IsPrimitiveClassified h [PROOFSTEP] have hw2 : w = ((m : ℚ) ^ 2 - (n : ℚ) ^ 2) / ((m : ℚ) ^ 2 + (n : ℚ) ^ 2) := by calc w = (1 - q ^ 2) / (1 + q ^ 2) := by apply ht4.2 _ = (1 - (↑n / ↑m) ^ 2) / (1 + (↑n / ↑m) ^ 2) := by rw [hq2] _ = _ := by exact hx1 (Int.cast_ne_zero.mpr hm0) hm2n20 [GOAL] x y z : ℤ h : PythagoreanTriple x y z hc : Int.gcd x y = 1 hyo : y % 2 = 1 hzpos : 0 < z h0 : ¬x = 0 v : ℚ := ↑x / ↑z w : ℚ := ↑y / ↑z hz : z ≠ 0 hq : v ^ 2 + w ^ 2 = 1 hvz : v ≠ 0 hw1 : w ≠ -1 hQ : ∀ (x : ℚ), 1 + x ^ 2 ≠ 0 hp : (v, w) ∈ {p | p.fst ^ 2 + p.snd ^ 2 = 1 ∧ p.snd ≠ -1} q : (fun x => ℚ) { val := (v, w), property := hp } := ↑(circleEquivGen hQ).symm { val := (v, w), property := hp } ht4 : v = 2 * q / (1 + q ^ 2) ∧ w = (1 - q ^ 2) / (1 + q ^ 2) m : ℤ := ↑q.den n : ℤ := q.num hm0 : m ≠ 0 hq2 : q = ↑n / ↑m hm2n2 : 0 < m ^ 2 + n ^ 2 hm2n20 : ↑m ^ 2 + ↑n ^ 2 ≠ 0 hx1 : ∀ {j k : ℚ}, k ≠ 0 → k ^ 2 + j ^ 2 ≠ 0 → (1 - (j / k) ^ 2) / (1 + (j / k) ^ 2) = (k ^ 2 - j ^ 2) / (k ^ 2 + j ^ 2) ⊢ w = (↑m ^ 2 - ↑n ^ 2) / (↑m ^ 2 + ↑n ^ 2) [PROOFSTEP] calc w = (1 - q ^ 2) / (1 + q ^ 2) := by apply ht4.2 _ = (1 - (↑n / ↑m) ^ 2) / (1 + (↑n / ↑m) ^ 2) := by rw [hq2] _ = _ := by exact hx1 (Int.cast_ne_zero.mpr hm0) hm2n20 [GOAL] x y z : ℤ h : PythagoreanTriple x y z hc : Int.gcd x y = 1 hyo : y % 2 = 1 hzpos : 0 < z h0 : ¬x = 0 v : ℚ := ↑x / ↑z w : ℚ := ↑y / ↑z hz : z ≠ 0 hq : v ^ 2 + w ^ 2 = 1 hvz : v ≠ 0 hw1 : w ≠ -1 hQ : ∀ (x : ℚ), 1 + x ^ 2 ≠ 0 hp : (v, w) ∈ {p | p.fst ^ 2 + p.snd ^ 2 = 1 ∧ p.snd ≠ -1} q : (fun x => ℚ) { val := (v, w), property := hp } := ↑(circleEquivGen hQ).symm { val := (v, w), property := hp } ht4 : v = 2 * q / (1 + q ^ 2) ∧ w = (1 - q ^ 2) / (1 + q ^ 2) m : ℤ := ↑q.den n : ℤ := q.num hm0 : m ≠ 0 hq2 : q = ↑n / ↑m hm2n2 : 0 < m ^ 2 + n ^ 2 hm2n20 : ↑m ^ 2 + ↑n ^ 2 ≠ 0 hx1 : ∀ {j k : ℚ}, k ≠ 0 → k ^ 2 + j ^ 2 ≠ 0 → (1 - (j / k) ^ 2) / (1 + (j / k) ^ 2) = (k ^ 2 - j ^ 2) / (k ^ 2 + j ^ 2) ⊢ w = (1 - q ^ 2) / (1 + q ^ 2) [PROOFSTEP] apply ht4.2 [GOAL] x y z : ℤ h : PythagoreanTriple x y z hc : Int.gcd x y = 1 hyo : y % 2 = 1 hzpos : 0 < z h0 : ¬x = 0 v : ℚ := ↑x / ↑z w : ℚ := ↑y / ↑z hz : z ≠ 0 hq : v ^ 2 + w ^ 2 = 1 hvz : v ≠ 0 hw1 : w ≠ -1 hQ : ∀ (x : ℚ), 1 + x ^ 2 ≠ 0 hp : (v, w) ∈ {p | p.fst ^ 2 + p.snd ^ 2 = 1 ∧ p.snd ≠ -1} q : (fun x => ℚ) { val := (v, w), property := hp } := ↑(circleEquivGen hQ).symm { val := (v, w), property := hp } ht4 : v = 2 * q / (1 + q ^ 2) ∧ w = (1 - q ^ 2) / (1 + q ^ 2) m : ℤ := ↑q.den n : ℤ := q.num hm0 : m ≠ 0 hq2 : q = ↑n / ↑m hm2n2 : 0 < m ^ 2 + n ^ 2 hm2n20 : ↑m ^ 2 + ↑n ^ 2 ≠ 0 hx1 : ∀ {j k : ℚ}, k ≠ 0 → k ^ 2 + j ^ 2 ≠ 0 → (1 - (j / k) ^ 2) / (1 + (j / k) ^ 2) = (k ^ 2 - j ^ 2) / (k ^ 2 + j ^ 2) ⊢ (1 - q ^ 2) / (1 + q ^ 2) = (1 - (↑n / ↑m) ^ 2) / (1 + (↑n / ↑m) ^ 2) [PROOFSTEP] rw [hq2] [GOAL] x y z : ℤ h : PythagoreanTriple x y z hc : Int.gcd x y = 1 hyo : y % 2 = 1 hzpos : 0 < z h0 : ¬x = 0 v : ℚ := ↑x / ↑z w : ℚ := ↑y / ↑z hz : z ≠ 0 hq : v ^ 2 + w ^ 2 = 1 hvz : v ≠ 0 hw1 : w ≠ -1 hQ : ∀ (x : ℚ), 1 + x ^ 2 ≠ 0 hp : (v, w) ∈ {p | p.fst ^ 2 + p.snd ^ 2 = 1 ∧ p.snd ≠ -1} q : (fun x => ℚ) { val := (v, w), property := hp } := ↑(circleEquivGen hQ).symm { val := (v, w), property := hp } ht4 : v = 2 * q / (1 + q ^ 2) ∧ w = (1 - q ^ 2) / (1 + q ^ 2) m : ℤ := ↑q.den n : ℤ := q.num hm0 : m ≠ 0 hq2 : q = ↑n / ↑m hm2n2 : 0 < m ^ 2 + n ^ 2 hm2n20 : ↑m ^ 2 + ↑n ^ 2 ≠ 0 hx1 : ∀ {j k : ℚ}, k ≠ 0 → k ^ 2 + j ^ 2 ≠ 0 → (1 - (j / k) ^ 2) / (1 + (j / k) ^ 2) = (k ^ 2 - j ^ 2) / (k ^ 2 + j ^ 2) ⊢ (1 - (↑n / ↑m) ^ 2) / (1 + (↑n / ↑m) ^ 2) = (↑m ^ 2 - ↑n ^ 2) / (↑m ^ 2 + ↑n ^ 2) [PROOFSTEP] exact hx1 (Int.cast_ne_zero.mpr hm0) hm2n20 [GOAL] case neg x y z : ℤ h : PythagoreanTriple x y z hc : Int.gcd x y = 1 hyo : y % 2 = 1 hzpos : 0 < z h0 : ¬x = 0 v : ℚ := ↑x / ↑z w : ℚ := ↑y / ↑z hz : z ≠ 0 hq : v ^ 2 + w ^ 2 = 1 hvz : v ≠ 0 hw1 : w ≠ -1 hQ : ∀ (x : ℚ), 1 + x ^ 2 ≠ 0 hp : (v, w) ∈ {p | p.fst ^ 2 + p.snd ^ 2 = 1 ∧ p.snd ≠ -1} q : (fun x => ℚ) { val := (v, w), property := hp } := ↑(circleEquivGen hQ).symm { val := (v, w), property := hp } ht4 : v = 2 * q / (1 + q ^ 2) ∧ w = (1 - q ^ 2) / (1 + q ^ 2) m : ℤ := ↑q.den n : ℤ := q.num hm0 : m ≠ 0 hq2 : q = ↑n / ↑m hm2n2 : 0 < m ^ 2 + n ^ 2 hm2n20 : ↑m ^ 2 + ↑n ^ 2 ≠ 0 hx1 : ∀ {j k : ℚ}, k ≠ 0 → k ^ 2 + j ^ 2 ≠ 0 → (1 - (j / k) ^ 2) / (1 + (j / k) ^ 2) = (k ^ 2 - j ^ 2) / (k ^ 2 + j ^ 2) hw2 : w = (↑m ^ 2 - ↑n ^ 2) / (↑m ^ 2 + ↑n ^ 2) ⊢ IsPrimitiveClassified h [PROOFSTEP] have hx2 {j k : ℚ} (h₁ : k ≠ 0) (h₂ : k ^ 2 + j ^ 2 ≠ 0) : 2 * (j / k) / (1 + (j / k) ^ 2) = 2 * k * j / (k ^ 2 + j ^ 2) := have h₃ : k * (k ^ 2 + j ^ 2) ≠ 0 := mul_ne_zero h₁ h₂ by field_simp; ring [GOAL] x y z : ℤ h : PythagoreanTriple x y z hc : Int.gcd x y = 1 hyo : y % 2 = 1 hzpos : 0 < z h0 : ¬x = 0 v : ℚ := ↑x / ↑z w : ℚ := ↑y / ↑z hz : z ≠ 0 hq : v ^ 2 + w ^ 2 = 1 hvz : v ≠ 0 hw1 : w ≠ -1 hQ : ∀ (x : ℚ), 1 + x ^ 2 ≠ 0 hp : (v, w) ∈ {p | p.fst ^ 2 + p.snd ^ 2 = 1 ∧ p.snd ≠ -1} q : (fun x => ℚ) { val := (v, w), property := hp } := ↑(circleEquivGen hQ).symm { val := (v, w), property := hp } ht4 : v = 2 * q / (1 + q ^ 2) ∧ w = (1 - q ^ 2) / (1 + q ^ 2) m : ℤ := ↑q.den n : ℤ := q.num hm0 : m ≠ 0 hq2 : q = ↑n / ↑m hm2n2 : 0 < m ^ 2 + n ^ 2 hm2n20 : ↑m ^ 2 + ↑n ^ 2 ≠ 0 hx1 : ∀ {j k : ℚ}, k ≠ 0 → k ^ 2 + j ^ 2 ≠ 0 → (1 - (j / k) ^ 2) / (1 + (j / k) ^ 2) = (k ^ 2 - j ^ 2) / (k ^ 2 + j ^ 2) hw2 : w = (↑m ^ 2 - ↑n ^ 2) / (↑m ^ 2 + ↑n ^ 2) j k : ℚ h₁ : k ≠ 0 h₂ : k ^ 2 + j ^ 2 ≠ 0 h₃ : k * (k ^ 2 + j ^ 2) ≠ 0 ⊢ 2 * (j / k) / (1 + (j / k) ^ 2) = 2 * k * j / (k ^ 2 + j ^ 2) [PROOFSTEP] field_simp [GOAL] x y z : ℤ h : PythagoreanTriple x y z hc : Int.gcd x y = 1 hyo : y % 2 = 1 hzpos : 0 < z h0 : ¬x = 0 v : ℚ := ↑x / ↑z w : ℚ := ↑y / ↑z hz : z ≠ 0 hq : v ^ 2 + w ^ 2 = 1 hvz : v ≠ 0 hw1 : w ≠ -1 hQ : ∀ (x : ℚ), 1 + x ^ 2 ≠ 0 hp : (v, w) ∈ {p | p.fst ^ 2 + p.snd ^ 2 = 1 ∧ p.snd ≠ -1} q : (fun x => ℚ) { val := (v, w), property := hp } := ↑(circleEquivGen hQ).symm { val := (v, w), property := hp } ht4 : v = 2 * q / (1 + q ^ 2) ∧ w = (1 - q ^ 2) / (1 + q ^ 2) m : ℤ := ↑q.den n : ℤ := q.num hm0 : m ≠ 0 hq2 : q = ↑n / ↑m hm2n2 : 0 < m ^ 2 + n ^ 2 hm2n20 : ↑m ^ 2 + ↑n ^ 2 ≠ 0 hx1 : ∀ {j k : ℚ}, k ≠ 0 → k ^ 2 + j ^ 2 ≠ 0 → (1 - (j / k) ^ 2) / (1 + (j / k) ^ 2) = (k ^ 2 - j ^ 2) / (k ^ 2 + j ^ 2) hw2 : w = (↑m ^ 2 - ↑n ^ 2) / (↑m ^ 2 + ↑n ^ 2) j k : ℚ h₁ : k ≠ 0 h₂ : k ^ 2 + j ^ 2 ≠ 0 h₃ : k * (k ^ 2 + j ^ 2) ≠ 0 ⊢ 2 * j * k ^ 2 * (k ^ 2 + j ^ 2) = 2 * k * j * (k * (k ^ 2 + j ^ 2)) [PROOFSTEP] ring [GOAL] case neg x y z : ℤ h : PythagoreanTriple x y z hc : Int.gcd x y = 1 hyo : y % 2 = 1 hzpos : 0 < z h0 : ¬x = 0 v : ℚ := ↑x / ↑z w : ℚ := ↑y / ↑z hz : z ≠ 0 hq : v ^ 2 + w ^ 2 = 1 hvz : v ≠ 0 hw1 : w ≠ -1 hQ : ∀ (x : ℚ), 1 + x ^ 2 ≠ 0 hp : (v, w) ∈ {p | p.fst ^ 2 + p.snd ^ 2 = 1 ∧ p.snd ≠ -1} q : (fun x => ℚ) { val := (v, w), property := hp } := ↑(circleEquivGen hQ).symm { val := (v, w), property := hp } ht4 : v = 2 * q / (1 + q ^ 2) ∧ w = (1 - q ^ 2) / (1 + q ^ 2) m : ℤ := ↑q.den n : ℤ := q.num hm0 : m ≠ 0 hq2 : q = ↑n / ↑m hm2n2 : 0 < m ^ 2 + n ^ 2 hm2n20 : ↑m ^ 2 + ↑n ^ 2 ≠ 0 hx1 : ∀ {j k : ℚ}, k ≠ 0 → k ^ 2 + j ^ 2 ≠ 0 → (1 - (j / k) ^ 2) / (1 + (j / k) ^ 2) = (k ^ 2 - j ^ 2) / (k ^ 2 + j ^ 2) hw2 : w = (↑m ^ 2 - ↑n ^ 2) / (↑m ^ 2 + ↑n ^ 2) hx2 : ∀ {j k : ℚ}, k ≠ 0 → k ^ 2 + j ^ 2 ≠ 0 → 2 * (j / k) / (1 + (j / k) ^ 2) = 2 * k * j / (k ^ 2 + j ^ 2) ⊢ IsPrimitiveClassified h [PROOFSTEP] have hv2 : v = 2 * m * n / ((m : ℚ) ^ 2 + (n : ℚ) ^ 2) := by calc v = 2 * q / (1 + q ^ 2) := by apply ht4.1 _ = 2 * (n / m) / (1 + (↑n / ↑m) ^ 2) := by rw [hq2] _ = _ := by exact hx2 (Int.cast_ne_zero.mpr hm0) hm2n20 [GOAL] x y z : ℤ h : PythagoreanTriple x y z hc : Int.gcd x y = 1 hyo : y % 2 = 1 hzpos : 0 < z h0 : ¬x = 0 v : ℚ := ↑x / ↑z w : ℚ := ↑y / ↑z hz : z ≠ 0 hq : v ^ 2 + w ^ 2 = 1 hvz : v ≠ 0 hw1 : w ≠ -1 hQ : ∀ (x : ℚ), 1 + x ^ 2 ≠ 0 hp : (v, w) ∈ {p | p.fst ^ 2 + p.snd ^ 2 = 1 ∧ p.snd ≠ -1} q : (fun x => ℚ) { val := (v, w), property := hp } := ↑(circleEquivGen hQ).symm { val := (v, w), property := hp } ht4 : v = 2 * q / (1 + q ^ 2) ∧ w = (1 - q ^ 2) / (1 + q ^ 2) m : ℤ := ↑q.den n : ℤ := q.num hm0 : m ≠ 0 hq2 : q = ↑n / ↑m hm2n2 : 0 < m ^ 2 + n ^ 2 hm2n20 : ↑m ^ 2 + ↑n ^ 2 ≠ 0 hx1 : ∀ {j k : ℚ}, k ≠ 0 → k ^ 2 + j ^ 2 ≠ 0 → (1 - (j / k) ^ 2) / (1 + (j / k) ^ 2) = (k ^ 2 - j ^ 2) / (k ^ 2 + j ^ 2) hw2 : w = (↑m ^ 2 - ↑n ^ 2) / (↑m ^ 2 + ↑n ^ 2) hx2 : ∀ {j k : ℚ}, k ≠ 0 → k ^ 2 + j ^ 2 ≠ 0 → 2 * (j / k) / (1 + (j / k) ^ 2) = 2 * k * j / (k ^ 2 + j ^ 2) ⊢ v = 2 * ↑m * ↑n / (↑m ^ 2 + ↑n ^ 2) [PROOFSTEP] calc v = 2 * q / (1 + q ^ 2) := by apply ht4.1 _ = 2 * (n / m) / (1 + (↑n / ↑m) ^ 2) := by rw [hq2] _ = _ := by exact hx2 (Int.cast_ne_zero.mpr hm0) hm2n20 [GOAL] x y z : ℤ h : PythagoreanTriple x y z hc : Int.gcd x y = 1 hyo : y % 2 = 1 hzpos : 0 < z h0 : ¬x = 0 v : ℚ := ↑x / ↑z w : ℚ := ↑y / ↑z hz : z ≠ 0 hq : v ^ 2 + w ^ 2 = 1 hvz : v ≠ 0 hw1 : w ≠ -1 hQ : ∀ (x : ℚ), 1 + x ^ 2 ≠ 0 hp : (v, w) ∈ {p | p.fst ^ 2 + p.snd ^ 2 = 1 ∧ p.snd ≠ -1} q : (fun x => ℚ) { val := (v, w), property := hp } := ↑(circleEquivGen hQ).symm { val := (v, w), property := hp } ht4 : v = 2 * q / (1 + q ^ 2) ∧ w = (1 - q ^ 2) / (1 + q ^ 2) m : ℤ := ↑q.den n : ℤ := q.num hm0 : m ≠ 0 hq2 : q = ↑n / ↑m hm2n2 : 0 < m ^ 2 + n ^ 2 hm2n20 : ↑m ^ 2 + ↑n ^ 2 ≠ 0 hx1 : ∀ {j k : ℚ}, k ≠ 0 → k ^ 2 + j ^ 2 ≠ 0 → (1 - (j / k) ^ 2) / (1 + (j / k) ^ 2) = (k ^ 2 - j ^ 2) / (k ^ 2 + j ^ 2) hw2 : w = (↑m ^ 2 - ↑n ^ 2) / (↑m ^ 2 + ↑n ^ 2) hx2 : ∀ {j k : ℚ}, k ≠ 0 → k ^ 2 + j ^ 2 ≠ 0 → 2 * (j / k) / (1 + (j / k) ^ 2) = 2 * k * j / (k ^ 2 + j ^ 2) ⊢ v = 2 * q / (1 + q ^ 2) [PROOFSTEP] apply ht4.1 [GOAL] x y z : ℤ h : PythagoreanTriple x y z hc : Int.gcd x y = 1 hyo : y % 2 = 1 hzpos : 0 < z h0 : ¬x = 0 v : ℚ := ↑x / ↑z w : ℚ := ↑y / ↑z hz : z ≠ 0 hq : v ^ 2 + w ^ 2 = 1 hvz : v ≠ 0 hw1 : w ≠ -1 hQ : ∀ (x : ℚ), 1 + x ^ 2 ≠ 0 hp : (v, w) ∈ {p | p.fst ^ 2 + p.snd ^ 2 = 1 ∧ p.snd ≠ -1} q : (fun x => ℚ) { val := (v, w), property := hp } := ↑(circleEquivGen hQ).symm { val := (v, w), property := hp } ht4 : v = 2 * q / (1 + q ^ 2) ∧ w = (1 - q ^ 2) / (1 + q ^ 2) m : ℤ := ↑q.den n : ℤ := q.num hm0 : m ≠ 0 hq2 : q = ↑n / ↑m hm2n2 : 0 < m ^ 2 + n ^ 2 hm2n20 : ↑m ^ 2 + ↑n ^ 2 ≠ 0 hx1 : ∀ {j k : ℚ}, k ≠ 0 → k ^ 2 + j ^ 2 ≠ 0 → (1 - (j / k) ^ 2) / (1 + (j / k) ^ 2) = (k ^ 2 - j ^ 2) / (k ^ 2 + j ^ 2) hw2 : w = (↑m ^ 2 - ↑n ^ 2) / (↑m ^ 2 + ↑n ^ 2) hx2 : ∀ {j k : ℚ}, k ≠ 0 → k ^ 2 + j ^ 2 ≠ 0 → 2 * (j / k) / (1 + (j / k) ^ 2) = 2 * k * j / (k ^ 2 + j ^ 2) ⊢ 2 * q / (1 + q ^ 2) = 2 * (↑n / ↑m) / (1 + (↑n / ↑m) ^ 2) [PROOFSTEP] rw [hq2] [GOAL] x y z : ℤ h : PythagoreanTriple x y z hc : Int.gcd x y = 1 hyo : y % 2 = 1 hzpos : 0 < z h0 : ¬x = 0 v : ℚ := ↑x / ↑z w : ℚ := ↑y / ↑z hz : z ≠ 0 hq : v ^ 2 + w ^ 2 = 1 hvz : v ≠ 0 hw1 : w ≠ -1 hQ : ∀ (x : ℚ), 1 + x ^ 2 ≠ 0 hp : (v, w) ∈ {p | p.fst ^ 2 + p.snd ^ 2 = 1 ∧ p.snd ≠ -1} q : (fun x => ℚ) { val := (v, w), property := hp } := ↑(circleEquivGen hQ).symm { val := (v, w), property := hp } ht4 : v = 2 * q / (1 + q ^ 2) ∧ w = (1 - q ^ 2) / (1 + q ^ 2) m : ℤ := ↑q.den n : ℤ := q.num hm0 : m ≠ 0 hq2 : q = ↑n / ↑m hm2n2 : 0 < m ^ 2 + n ^ 2 hm2n20 : ↑m ^ 2 + ↑n ^ 2 ≠ 0 hx1 : ∀ {j k : ℚ}, k ≠ 0 → k ^ 2 + j ^ 2 ≠ 0 → (1 - (j / k) ^ 2) / (1 + (j / k) ^ 2) = (k ^ 2 - j ^ 2) / (k ^ 2 + j ^ 2) hw2 : w = (↑m ^ 2 - ↑n ^ 2) / (↑m ^ 2 + ↑n ^ 2) hx2 : ∀ {j k : ℚ}, k ≠ 0 → k ^ 2 + j ^ 2 ≠ 0 → 2 * (j / k) / (1 + (j / k) ^ 2) = 2 * k * j / (k ^ 2 + j ^ 2) ⊢ 2 * (↑n / ↑m) / (1 + (↑n / ↑m) ^ 2) = 2 * ↑m * ↑n / (↑m ^ 2 + ↑n ^ 2) [PROOFSTEP] exact hx2 (Int.cast_ne_zero.mpr hm0) hm2n20 [GOAL] case neg x y z : ℤ h : PythagoreanTriple x y z hc : Int.gcd x y = 1 hyo : y % 2 = 1 hzpos : 0 < z h0 : ¬x = 0 v : ℚ := ↑x / ↑z w : ℚ := ↑y / ↑z hz : z ≠ 0 hq : v ^ 2 + w ^ 2 = 1 hvz : v ≠ 0 hw1 : w ≠ -1 hQ : ∀ (x : ℚ), 1 + x ^ 2 ≠ 0 hp : (v, w) ∈ {p | p.fst ^ 2 + p.snd ^ 2 = 1 ∧ p.snd ≠ -1} q : (fun x => ℚ) { val := (v, w), property := hp } := ↑(circleEquivGen hQ).symm { val := (v, w), property := hp } ht4 : v = 2 * q / (1 + q ^ 2) ∧ w = (1 - q ^ 2) / (1 + q ^ 2) m : ℤ := ↑q.den n : ℤ := q.num hm0 : m ≠ 0 hq2 : q = ↑n / ↑m hm2n2 : 0 < m ^ 2 + n ^ 2 hm2n20 : ↑m ^ 2 + ↑n ^ 2 ≠ 0 hx1 : ∀ {j k : ℚ}, k ≠ 0 → k ^ 2 + j ^ 2 ≠ 0 → (1 - (j / k) ^ 2) / (1 + (j / k) ^ 2) = (k ^ 2 - j ^ 2) / (k ^ 2 + j ^ 2) hw2 : w = (↑m ^ 2 - ↑n ^ 2) / (↑m ^ 2 + ↑n ^ 2) hx2 : ∀ {j k : ℚ}, k ≠ 0 → k ^ 2 + j ^ 2 ≠ 0 → 2 * (j / k) / (1 + (j / k) ^ 2) = 2 * k * j / (k ^ 2 + j ^ 2) hv2 : v = 2 * ↑m * ↑n / (↑m ^ 2 + ↑n ^ 2) ⊢ IsPrimitiveClassified h [PROOFSTEP] have hnmcp : Int.gcd n m = 1 := q.reduced [GOAL] case neg x y z : ℤ h : PythagoreanTriple x y z hc : Int.gcd x y = 1 hyo : y % 2 = 1 hzpos : 0 < z h0 : ¬x = 0 v : ℚ := ↑x / ↑z w : ℚ := ↑y / ↑z hz : z ≠ 0 hq : v ^ 2 + w ^ 2 = 1 hvz : v ≠ 0 hw1 : w ≠ -1 hQ : ∀ (x : ℚ), 1 + x ^ 2 ≠ 0 hp : (v, w) ∈ {p | p.fst ^ 2 + p.snd ^ 2 = 1 ∧ p.snd ≠ -1} q : (fun x => ℚ) { val := (v, w), property := hp } := ↑(circleEquivGen hQ).symm { val := (v, w), property := hp } ht4 : v = 2 * q / (1 + q ^ 2) ∧ w = (1 - q ^ 2) / (1 + q ^ 2) m : ℤ := ↑q.den n : ℤ := q.num hm0 : m ≠ 0 hq2 : q = ↑n / ↑m hm2n2 : 0 < m ^ 2 + n ^ 2 hm2n20 : ↑m ^ 2 + ↑n ^ 2 ≠ 0 hx1 : ∀ {j k : ℚ}, k ≠ 0 → k ^ 2 + j ^ 2 ≠ 0 → (1 - (j / k) ^ 2) / (1 + (j / k) ^ 2) = (k ^ 2 - j ^ 2) / (k ^ 2 + j ^ 2) hw2 : w = (↑m ^ 2 - ↑n ^ 2) / (↑m ^ 2 + ↑n ^ 2) hx2 : ∀ {j k : ℚ}, k ≠ 0 → k ^ 2 + j ^ 2 ≠ 0 → 2 * (j / k) / (1 + (j / k) ^ 2) = 2 * k * j / (k ^ 2 + j ^ 2) hv2 : v = 2 * ↑m * ↑n / (↑m ^ 2 + ↑n ^ 2) hnmcp : Int.gcd n m = 1 ⊢ IsPrimitiveClassified h [PROOFSTEP] have hmncp : Int.gcd m n = 1 := by rw [Int.gcd_comm] exact hnmcp [GOAL] x y z : ℤ h : PythagoreanTriple x y z hc : Int.gcd x y = 1 hyo : y % 2 = 1 hzpos : 0 < z h0 : ¬x = 0 v : ℚ := ↑x / ↑z w : ℚ := ↑y / ↑z hz : z ≠ 0 hq : v ^ 2 + w ^ 2 = 1 hvz : v ≠ 0 hw1 : w ≠ -1 hQ : ∀ (x : ℚ), 1 + x ^ 2 ≠ 0 hp : (v, w) ∈ {p | p.fst ^ 2 + p.snd ^ 2 = 1 ∧ p.snd ≠ -1} q : (fun x => ℚ) { val := (v, w), property := hp } := ↑(circleEquivGen hQ).symm { val := (v, w), property := hp } ht4 : v = 2 * q / (1 + q ^ 2) ∧ w = (1 - q ^ 2) / (1 + q ^ 2) m : ℤ := ↑q.den n : ℤ := q.num hm0 : m ≠ 0 hq2 : q = ↑n / ↑m hm2n2 : 0 < m ^ 2 + n ^ 2 hm2n20 : ↑m ^ 2 + ↑n ^ 2 ≠ 0 hx1 : ∀ {j k : ℚ}, k ≠ 0 → k ^ 2 + j ^ 2 ≠ 0 → (1 - (j / k) ^ 2) / (1 + (j / k) ^ 2) = (k ^ 2 - j ^ 2) / (k ^ 2 + j ^ 2) hw2 : w = (↑m ^ 2 - ↑n ^ 2) / (↑m ^ 2 + ↑n ^ 2) hx2 : ∀ {j k : ℚ}, k ≠ 0 → k ^ 2 + j ^ 2 ≠ 0 → 2 * (j / k) / (1 + (j / k) ^ 2) = 2 * k * j / (k ^ 2 + j ^ 2) hv2 : v = 2 * ↑m * ↑n / (↑m ^ 2 + ↑n ^ 2) hnmcp : Int.gcd n m = 1 ⊢ Int.gcd m n = 1 [PROOFSTEP] rw [Int.gcd_comm] [GOAL] x y z : ℤ h : PythagoreanTriple x y z hc : Int.gcd x y = 1 hyo : y % 2 = 1 hzpos : 0 < z h0 : ¬x = 0 v : ℚ := ↑x / ↑z w : ℚ := ↑y / ↑z hz : z ≠ 0 hq : v ^ 2 + w ^ 2 = 1 hvz : v ≠ 0 hw1 : w ≠ -1 hQ : ∀ (x : ℚ), 1 + x ^ 2 ≠ 0 hp : (v, w) ∈ {p | p.fst ^ 2 + p.snd ^ 2 = 1 ∧ p.snd ≠ -1} q : (fun x => ℚ) { val := (v, w), property := hp } := ↑(circleEquivGen hQ).symm { val := (v, w), property := hp } ht4 : v = 2 * q / (1 + q ^ 2) ∧ w = (1 - q ^ 2) / (1 + q ^ 2) m : ℤ := ↑q.den n : ℤ := q.num hm0 : m ≠ 0 hq2 : q = ↑n / ↑m hm2n2 : 0 < m ^ 2 + n ^ 2 hm2n20 : ↑m ^ 2 + ↑n ^ 2 ≠ 0 hx1 : ∀ {j k : ℚ}, k ≠ 0 → k ^ 2 + j ^ 2 ≠ 0 → (1 - (j / k) ^ 2) / (1 + (j / k) ^ 2) = (k ^ 2 - j ^ 2) / (k ^ 2 + j ^ 2) hw2 : w = (↑m ^ 2 - ↑n ^ 2) / (↑m ^ 2 + ↑n ^ 2) hx2 : ∀ {j k : ℚ}, k ≠ 0 → k ^ 2 + j ^ 2 ≠ 0 → 2 * (j / k) / (1 + (j / k) ^ 2) = 2 * k * j / (k ^ 2 + j ^ 2) hv2 : v = 2 * ↑m * ↑n / (↑m ^ 2 + ↑n ^ 2) hnmcp : Int.gcd n m = 1 ⊢ Int.gcd n m = 1 [PROOFSTEP] exact hnmcp [GOAL] case neg x y z : ℤ h : PythagoreanTriple x y z hc : Int.gcd x y = 1 hyo : y % 2 = 1 hzpos : 0 < z h0 : ¬x = 0 v : ℚ := ↑x / ↑z w : ℚ := ↑y / ↑z hz : z ≠ 0 hq : v ^ 2 + w ^ 2 = 1 hvz : v ≠ 0 hw1 : w ≠ -1 hQ : ∀ (x : ℚ), 1 + x ^ 2 ≠ 0 hp : (v, w) ∈ {p | p.fst ^ 2 + p.snd ^ 2 = 1 ∧ p.snd ≠ -1} q : (fun x => ℚ) { val := (v, w), property := hp } := ↑(circleEquivGen hQ).symm { val := (v, w), property := hp } ht4 : v = 2 * q / (1 + q ^ 2) ∧ w = (1 - q ^ 2) / (1 + q ^ 2) m : ℤ := ↑q.den n : ℤ := q.num hm0 : m ≠ 0 hq2 : q = ↑n / ↑m hm2n2 : 0 < m ^ 2 + n ^ 2 hm2n20 : ↑m ^ 2 + ↑n ^ 2 ≠ 0 hx1 : ∀ {j k : ℚ}, k ≠ 0 → k ^ 2 + j ^ 2 ≠ 0 → (1 - (j / k) ^ 2) / (1 + (j / k) ^ 2) = (k ^ 2 - j ^ 2) / (k ^ 2 + j ^ 2) hw2 : w = (↑m ^ 2 - ↑n ^ 2) / (↑m ^ 2 + ↑n ^ 2) hx2 : ∀ {j k : ℚ}, k ≠ 0 → k ^ 2 + j ^ 2 ≠ 0 → 2 * (j / k) / (1 + (j / k) ^ 2) = 2 * k * j / (k ^ 2 + j ^ 2) hv2 : v = 2 * ↑m * ↑n / (↑m ^ 2 + ↑n ^ 2) hnmcp : Int.gcd n m = 1 hmncp : Int.gcd m n = 1 ⊢ IsPrimitiveClassified h [PROOFSTEP] cases' Int.emod_two_eq_zero_or_one m with hm2 hm2 [GOAL] case neg.inl x y z : ℤ h : PythagoreanTriple x y z hc : Int.gcd x y = 1 hyo : y % 2 = 1 hzpos : 0 < z h0 : ¬x = 0 v : ℚ := ↑x / ↑z w : ℚ := ↑y / ↑z hz : z ≠ 0 hq : v ^ 2 + w ^ 2 = 1 hvz : v ≠ 0 hw1 : w ≠ -1 hQ : ∀ (x : ℚ), 1 + x ^ 2 ≠ 0 hp : (v, w) ∈ {p | p.fst ^ 2 + p.snd ^ 2 = 1 ∧ p.snd ≠ -1} q : (fun x => ℚ) { val := (v, w), property := hp } := ↑(circleEquivGen hQ).symm { val := (v, w), property := hp } ht4 : v = 2 * q / (1 + q ^ 2) ∧ w = (1 - q ^ 2) / (1 + q ^ 2) m : ℤ := ↑q.den n : ℤ := q.num hm0 : m ≠ 0 hq2 : q = ↑n / ↑m hm2n2 : 0 < m ^ 2 + n ^ 2 hm2n20 : ↑m ^ 2 + ↑n ^ 2 ≠ 0 hx1 : ∀ {j k : ℚ}, k ≠ 0 → k ^ 2 + j ^ 2 ≠ 0 → (1 - (j / k) ^ 2) / (1 + (j / k) ^ 2) = (k ^ 2 - j ^ 2) / (k ^ 2 + j ^ 2) hw2 : w = (↑m ^ 2 - ↑n ^ 2) / (↑m ^ 2 + ↑n ^ 2) hx2 : ∀ {j k : ℚ}, k ≠ 0 → k ^ 2 + j ^ 2 ≠ 0 → 2 * (j / k) / (1 + (j / k) ^ 2) = 2 * k * j / (k ^ 2 + j ^ 2) hv2 : v = 2 * ↑m * ↑n / (↑m ^ 2 + ↑n ^ 2) hnmcp : Int.gcd n m = 1 hmncp : Int.gcd m n = 1 hm2 : m % 2 = 0 ⊢ IsPrimitiveClassified h [PROOFSTEP] cases' Int.emod_two_eq_zero_or_one n with hn2 hn2 [GOAL] case neg.inr x y z : ℤ h : PythagoreanTriple x y z hc : Int.gcd x y = 1 hyo : y % 2 = 1 hzpos : 0 < z h0 : ¬x = 0 v : ℚ := ↑x / ↑z w : ℚ := ↑y / ↑z hz : z ≠ 0 hq : v ^ 2 + w ^ 2 = 1 hvz : v ≠ 0 hw1 : w ≠ -1 hQ : ∀ (x : ℚ), 1 + x ^ 2 ≠ 0 hp : (v, w) ∈ {p | p.fst ^ 2 + p.snd ^ 2 = 1 ∧ p.snd ≠ -1} q : (fun x => ℚ) { val := (v, w), property := hp } := ↑(circleEquivGen hQ).symm { val := (v, w), property := hp } ht4 : v = 2 * q / (1 + q ^ 2) ∧ w = (1 - q ^ 2) / (1 + q ^ 2) m : ℤ := ↑q.den n : ℤ := q.num hm0 : m ≠ 0 hq2 : q = ↑n / ↑m hm2n2 : 0 < m ^ 2 + n ^ 2 hm2n20 : ↑m ^ 2 + ↑n ^ 2 ≠ 0 hx1 : ∀ {j k : ℚ}, k ≠ 0 → k ^ 2 + j ^ 2 ≠ 0 → (1 - (j / k) ^ 2) / (1 + (j / k) ^ 2) = (k ^ 2 - j ^ 2) / (k ^ 2 + j ^ 2) hw2 : w = (↑m ^ 2 - ↑n ^ 2) / (↑m ^ 2 + ↑n ^ 2) hx2 : ∀ {j k : ℚ}, k ≠ 0 → k ^ 2 + j ^ 2 ≠ 0 → 2 * (j / k) / (1 + (j / k) ^ 2) = 2 * k * j / (k ^ 2 + j ^ 2) hv2 : v = 2 * ↑m * ↑n / (↑m ^ 2 + ↑n ^ 2) hnmcp : Int.gcd n m = 1 hmncp : Int.gcd m n = 1 hm2 : m % 2 = 1 ⊢ IsPrimitiveClassified h [PROOFSTEP] cases' Int.emod_two_eq_zero_or_one n with hn2 hn2 [GOAL] case neg.inl.inl x y z : ℤ h : PythagoreanTriple x y z hc : Int.gcd x y = 1 hyo : y % 2 = 1 hzpos : 0 < z h0 : ¬x = 0 v : ℚ := ↑x / ↑z w : ℚ := ↑y / ↑z hz : z ≠ 0 hq : v ^ 2 + w ^ 2 = 1 hvz : v ≠ 0 hw1 : w ≠ -1 hQ : ∀ (x : ℚ), 1 + x ^ 2 ≠ 0 hp : (v, w) ∈ {p | p.fst ^ 2 + p.snd ^ 2 = 1 ∧ p.snd ≠ -1} q : (fun x => ℚ) { val := (v, w), property := hp } := ↑(circleEquivGen hQ).symm { val := (v, w), property := hp } ht4 : v = 2 * q / (1 + q ^ 2) ∧ w = (1 - q ^ 2) / (1 + q ^ 2) m : ℤ := ↑q.den n : ℤ := q.num hm0 : m ≠ 0 hq2 : q = ↑n / ↑m hm2n2 : 0 < m ^ 2 + n ^ 2 hm2n20 : ↑m ^ 2 + ↑n ^ 2 ≠ 0 hx1 : ∀ {j k : ℚ}, k ≠ 0 → k ^ 2 + j ^ 2 ≠ 0 → (1 - (j / k) ^ 2) / (1 + (j / k) ^ 2) = (k ^ 2 - j ^ 2) / (k ^ 2 + j ^ 2) hw2 : w = (↑m ^ 2 - ↑n ^ 2) / (↑m ^ 2 + ↑n ^ 2) hx2 : ∀ {j k : ℚ}, k ≠ 0 → k ^ 2 + j ^ 2 ≠ 0 → 2 * (j / k) / (1 + (j / k) ^ 2) = 2 * k * j / (k ^ 2 + j ^ 2) hv2 : v = 2 * ↑m * ↑n / (↑m ^ 2 + ↑n ^ 2) hnmcp : Int.gcd n m = 1 hmncp : Int.gcd m n = 1 hm2 : m % 2 = 0 hn2 : n % 2 = 0 ⊢ IsPrimitiveClassified h [PROOFSTEP] exfalso [GOAL] case neg.inl.inl.h x y z : ℤ h : PythagoreanTriple x y z hc : Int.gcd x y = 1 hyo : y % 2 = 1 hzpos : 0 < z h0 : ¬x = 0 v : ℚ := ↑x / ↑z w : ℚ := ↑y / ↑z hz : z ≠ 0 hq : v ^ 2 + w ^ 2 = 1 hvz : v ≠ 0 hw1 : w ≠ -1 hQ : ∀ (x : ℚ), 1 + x ^ 2 ≠ 0 hp : (v, w) ∈ {p | p.fst ^ 2 + p.snd ^ 2 = 1 ∧ p.snd ≠ -1} q : (fun x => ℚ) { val := (v, w), property := hp } := ↑(circleEquivGen hQ).symm { val := (v, w), property := hp } ht4 : v = 2 * q / (1 + q ^ 2) ∧ w = (1 - q ^ 2) / (1 + q ^ 2) m : ℤ := ↑q.den n : ℤ := q.num hm0 : m ≠ 0 hq2 : q = ↑n / ↑m hm2n2 : 0 < m ^ 2 + n ^ 2 hm2n20 : ↑m ^ 2 + ↑n ^ 2 ≠ 0 hx1 : ∀ {j k : ℚ}, k ≠ 0 → k ^ 2 + j ^ 2 ≠ 0 → (1 - (j / k) ^ 2) / (1 + (j / k) ^ 2) = (k ^ 2 - j ^ 2) / (k ^ 2 + j ^ 2) hw2 : w = (↑m ^ 2 - ↑n ^ 2) / (↑m ^ 2 + ↑n ^ 2) hx2 : ∀ {j k : ℚ}, k ≠ 0 → k ^ 2 + j ^ 2 ≠ 0 → 2 * (j / k) / (1 + (j / k) ^ 2) = 2 * k * j / (k ^ 2 + j ^ 2) hv2 : v = 2 * ↑m * ↑n / (↑m ^ 2 + ↑n ^ 2) hnmcp : Int.gcd n m = 1 hmncp : Int.gcd m n = 1 hm2 : m % 2 = 0 hn2 : n % 2 = 0 ⊢ False [PROOFSTEP] have h1 : 2 ∣ (Int.gcd n m : ℤ) := Int.dvd_gcd (Int.dvd_of_emod_eq_zero hn2) (Int.dvd_of_emod_eq_zero hm2) [GOAL] case neg.inl.inl.h x y z : ℤ h : PythagoreanTriple x y z hc : Int.gcd x y = 1 hyo : y % 2 = 1 hzpos : 0 < z h0 : ¬x = 0 v : ℚ := ↑x / ↑z w : ℚ := ↑y / ↑z hz : z ≠ 0 hq : v ^ 2 + w ^ 2 = 1 hvz : v ≠ 0 hw1 : w ≠ -1 hQ : ∀ (x : ℚ), 1 + x ^ 2 ≠ 0 hp : (v, w) ∈ {p | p.fst ^ 2 + p.snd ^ 2 = 1 ∧ p.snd ≠ -1} q : (fun x => ℚ) { val := (v, w), property := hp } := ↑(circleEquivGen hQ).symm { val := (v, w), property := hp } ht4 : v = 2 * q / (1 + q ^ 2) ∧ w = (1 - q ^ 2) / (1 + q ^ 2) m : ℤ := ↑q.den n : ℤ := q.num hm0 : m ≠ 0 hq2 : q = ↑n / ↑m hm2n2 : 0 < m ^ 2 + n ^ 2 hm2n20 : ↑m ^ 2 + ↑n ^ 2 ≠ 0 hx1 : ∀ {j k : ℚ}, k ≠ 0 → k ^ 2 + j ^ 2 ≠ 0 → (1 - (j / k) ^ 2) / (1 + (j / k) ^ 2) = (k ^ 2 - j ^ 2) / (k ^ 2 + j ^ 2) hw2 : w = (↑m ^ 2 - ↑n ^ 2) / (↑m ^ 2 + ↑n ^ 2) hx2 : ∀ {j k : ℚ}, k ≠ 0 → k ^ 2 + j ^ 2 ≠ 0 → 2 * (j / k) / (1 + (j / k) ^ 2) = 2 * k * j / (k ^ 2 + j ^ 2) hv2 : v = 2 * ↑m * ↑n / (↑m ^ 2 + ↑n ^ 2) hnmcp : Int.gcd n m = 1 hmncp : Int.gcd m n = 1 hm2 : m % 2 = 0 hn2 : n % 2 = 0 h1 : 2 ∣ ↑(Int.gcd n m) ⊢ False [PROOFSTEP] rw [hnmcp] at h1 [GOAL] case neg.inl.inl.h x y z : ℤ h : PythagoreanTriple x y z hc : Int.gcd x y = 1 hyo : y % 2 = 1 hzpos : 0 < z h0 : ¬x = 0 v : ℚ := ↑x / ↑z w : ℚ := ↑y / ↑z hz : z ≠ 0 hq : v ^ 2 + w ^ 2 = 1 hvz : v ≠ 0 hw1 : w ≠ -1 hQ : ∀ (x : ℚ), 1 + x ^ 2 ≠ 0 hp : (v, w) ∈ {p | p.fst ^ 2 + p.snd ^ 2 = 1 ∧ p.snd ≠ -1} q : (fun x => ℚ) { val := (v, w), property := hp } := ↑(circleEquivGen hQ).symm { val := (v, w), property := hp } ht4 : v = 2 * q / (1 + q ^ 2) ∧ w = (1 - q ^ 2) / (1 + q ^ 2) m : ℤ := ↑q.den n : ℤ := q.num hm0 : m ≠ 0 hq2 : q = ↑n / ↑m hm2n2 : 0 < m ^ 2 + n ^ 2 hm2n20 : ↑m ^ 2 + ↑n ^ 2 ≠ 0 hx1 : ∀ {j k : ℚ}, k ≠ 0 → k ^ 2 + j ^ 2 ≠ 0 → (1 - (j / k) ^ 2) / (1 + (j / k) ^ 2) = (k ^ 2 - j ^ 2) / (k ^ 2 + j ^ 2) hw2 : w = (↑m ^ 2 - ↑n ^ 2) / (↑m ^ 2 + ↑n ^ 2) hx2 : ∀ {j k : ℚ}, k ≠ 0 → k ^ 2 + j ^ 2 ≠ 0 → 2 * (j / k) / (1 + (j / k) ^ 2) = 2 * k * j / (k ^ 2 + j ^ 2) hv2 : v = 2 * ↑m * ↑n / (↑m ^ 2 + ↑n ^ 2) hnmcp : Int.gcd n m = 1 hmncp : Int.gcd m n = 1 hm2 : m % 2 = 0 hn2 : n % 2 = 0 h1 : 2 ∣ ↑1 ⊢ False [PROOFSTEP] revert h1 [GOAL] case neg.inl.inl.h x y z : ℤ h : PythagoreanTriple x y z hc : Int.gcd x y = 1 hyo : y % 2 = 1 hzpos : 0 < z h0 : ¬x = 0 v : ℚ := ↑x / ↑z w : ℚ := ↑y / ↑z hz : z ≠ 0 hq : v ^ 2 + w ^ 2 = 1 hvz : v ≠ 0 hw1 : w ≠ -1 hQ : ∀ (x : ℚ), 1 + x ^ 2 ≠ 0 hp : (v, w) ∈ {p | p.fst ^ 2 + p.snd ^ 2 = 1 ∧ p.snd ≠ -1} q : (fun x => ℚ) { val := (v, w), property := hp } := ↑(circleEquivGen hQ).symm { val := (v, w), property := hp } ht4 : v = 2 * q / (1 + q ^ 2) ∧ w = (1 - q ^ 2) / (1 + q ^ 2) m : ℤ := ↑q.den n : ℤ := q.num hm0 : m ≠ 0 hq2 : q = ↑n / ↑m hm2n2 : 0 < m ^ 2 + n ^ 2 hm2n20 : ↑m ^ 2 + ↑n ^ 2 ≠ 0 hx1 : ∀ {j k : ℚ}, k ≠ 0 → k ^ 2 + j ^ 2 ≠ 0 → (1 - (j / k) ^ 2) / (1 + (j / k) ^ 2) = (k ^ 2 - j ^ 2) / (k ^ 2 + j ^ 2) hw2 : w = (↑m ^ 2 - ↑n ^ 2) / (↑m ^ 2 + ↑n ^ 2) hx2 : ∀ {j k : ℚ}, k ≠ 0 → k ^ 2 + j ^ 2 ≠ 0 → 2 * (j / k) / (1 + (j / k) ^ 2) = 2 * k * j / (k ^ 2 + j ^ 2) hv2 : v = 2 * ↑m * ↑n / (↑m ^ 2 + ↑n ^ 2) hnmcp : Int.gcd n m = 1 hmncp : Int.gcd m n = 1 hm2 : m % 2 = 0 hn2 : n % 2 = 0 ⊢ 2 ∣ ↑1 → False [PROOFSTEP] norm_num [GOAL] case neg.inl.inr x y z : ℤ h : PythagoreanTriple x y z hc : Int.gcd x y = 1 hyo : y % 2 = 1 hzpos : 0 < z h0 : ¬x = 0 v : ℚ := ↑x / ↑z w : ℚ := ↑y / ↑z hz : z ≠ 0 hq : v ^ 2 + w ^ 2 = 1 hvz : v ≠ 0 hw1 : w ≠ -1 hQ : ∀ (x : ℚ), 1 + x ^ 2 ≠ 0 hp : (v, w) ∈ {p | p.fst ^ 2 + p.snd ^ 2 = 1 ∧ p.snd ≠ -1} q : (fun x => ℚ) { val := (v, w), property := hp } := ↑(circleEquivGen hQ).symm { val := (v, w), property := hp } ht4 : v = 2 * q / (1 + q ^ 2) ∧ w = (1 - q ^ 2) / (1 + q ^ 2) m : ℤ := ↑q.den n : ℤ := q.num hm0 : m ≠ 0 hq2 : q = ↑n / ↑m hm2n2 : 0 < m ^ 2 + n ^ 2 hm2n20 : ↑m ^ 2 + ↑n ^ 2 ≠ 0 hx1 : ∀ {j k : ℚ}, k ≠ 0 → k ^ 2 + j ^ 2 ≠ 0 → (1 - (j / k) ^ 2) / (1 + (j / k) ^ 2) = (k ^ 2 - j ^ 2) / (k ^ 2 + j ^ 2) hw2 : w = (↑m ^ 2 - ↑n ^ 2) / (↑m ^ 2 + ↑n ^ 2) hx2 : ∀ {j k : ℚ}, k ≠ 0 → k ^ 2 + j ^ 2 ≠ 0 → 2 * (j / k) / (1 + (j / k) ^ 2) = 2 * k * j / (k ^ 2 + j ^ 2) hv2 : v = 2 * ↑m * ↑n / (↑m ^ 2 + ↑n ^ 2) hnmcp : Int.gcd n m = 1 hmncp : Int.gcd m n = 1 hm2 : m % 2 = 0 hn2 : n % 2 = 1 ⊢ IsPrimitiveClassified h [PROOFSTEP] apply h.isPrimitiveClassified_aux hc hzpos hm2n2 hv2 hw2 _ hmncp [GOAL] case neg.inl.inr x y z : ℤ h : PythagoreanTriple x y z hc : Int.gcd x y = 1 hyo : y % 2 = 1 hzpos : 0 < z h0 : ¬x = 0 v : ℚ := ↑x / ↑z w : ℚ := ↑y / ↑z hz : z ≠ 0 hq : v ^ 2 + w ^ 2 = 1 hvz : v ≠ 0 hw1 : w ≠ -1 hQ : ∀ (x : ℚ), 1 + x ^ 2 ≠ 0 hp : (v, w) ∈ {p | p.fst ^ 2 + p.snd ^ 2 = 1 ∧ p.snd ≠ -1} q : (fun x => ℚ) { val := (v, w), property := hp } := ↑(circleEquivGen hQ).symm { val := (v, w), property := hp } ht4 : v = 2 * q / (1 + q ^ 2) ∧ w = (1 - q ^ 2) / (1 + q ^ 2) m : ℤ := ↑q.den n : ℤ := q.num hm0 : m ≠ 0 hq2 : q = ↑n / ↑m hm2n2 : 0 < m ^ 2 + n ^ 2 hm2n20 : ↑m ^ 2 + ↑n ^ 2 ≠ 0 hx1 : ∀ {j k : ℚ}, k ≠ 0 → k ^ 2 + j ^ 2 ≠ 0 → (1 - (j / k) ^ 2) / (1 + (j / k) ^ 2) = (k ^ 2 - j ^ 2) / (k ^ 2 + j ^ 2) hw2 : w = (↑m ^ 2 - ↑n ^ 2) / (↑m ^ 2 + ↑n ^ 2) hx2 : ∀ {j k : ℚ}, k ≠ 0 → k ^ 2 + j ^ 2 ≠ 0 → 2 * (j / k) / (1 + (j / k) ^ 2) = 2 * k * j / (k ^ 2 + j ^ 2) hv2 : v = 2 * ↑m * ↑n / (↑m ^ 2 + ↑n ^ 2) hnmcp : Int.gcd n m = 1 hmncp : Int.gcd m n = 1 hm2 : m % 2 = 0 hn2 : n % 2 = 1 ⊢ m % 2 = 0 ∧ n % 2 = 1 ∨ m % 2 = 1 ∧ n % 2 = 0 [PROOFSTEP] apply Or.intro_left [GOAL] case neg.inl.inr.h x y z : ℤ h : PythagoreanTriple x y z hc : Int.gcd x y = 1 hyo : y % 2 = 1 hzpos : 0 < z h0 : ¬x = 0 v : ℚ := ↑x / ↑z w : ℚ := ↑y / ↑z hz : z ≠ 0 hq : v ^ 2 + w ^ 2 = 1 hvz : v ≠ 0 hw1 : w ≠ -1 hQ : ∀ (x : ℚ), 1 + x ^ 2 ≠ 0 hp : (v, w) ∈ {p | p.fst ^ 2 + p.snd ^ 2 = 1 ∧ p.snd ≠ -1} q : (fun x => ℚ) { val := (v, w), property := hp } := ↑(circleEquivGen hQ).symm { val := (v, w), property := hp } ht4 : v = 2 * q / (1 + q ^ 2) ∧ w = (1 - q ^ 2) / (1 + q ^ 2) m : ℤ := ↑q.den n : ℤ := q.num hm0 : m ≠ 0 hq2 : q = ↑n / ↑m hm2n2 : 0 < m ^ 2 + n ^ 2 hm2n20 : ↑m ^ 2 + ↑n ^ 2 ≠ 0 hx1 : ∀ {j k : ℚ}, k ≠ 0 → k ^ 2 + j ^ 2 ≠ 0 → (1 - (j / k) ^ 2) / (1 + (j / k) ^ 2) = (k ^ 2 - j ^ 2) / (k ^ 2 + j ^ 2) hw2 : w = (↑m ^ 2 - ↑n ^ 2) / (↑m ^ 2 + ↑n ^ 2) hx2 : ∀ {j k : ℚ}, k ≠ 0 → k ^ 2 + j ^ 2 ≠ 0 → 2 * (j / k) / (1 + (j / k) ^ 2) = 2 * k * j / (k ^ 2 + j ^ 2) hv2 : v = 2 * ↑m * ↑n / (↑m ^ 2 + ↑n ^ 2) hnmcp : Int.gcd n m = 1 hmncp : Int.gcd m n = 1 hm2 : m % 2 = 0 hn2 : n % 2 = 1 ⊢ m % 2 = 0 ∧ n % 2 = 1 [PROOFSTEP] exact And.intro hm2 hn2 [GOAL] x y z : ℤ h : PythagoreanTriple x y z hc : Int.gcd x y = 1 hyo : y % 2 = 1 hzpos : 0 < z h0 : ¬x = 0 v : ℚ := ↑x / ↑z w : ℚ := ↑y / ↑z hz : z ≠ 0 hq : v ^ 2 + w ^ 2 = 1 hvz : v ≠ 0 hw1 : w ≠ -1 hQ : ∀ (x : ℚ), 1 + x ^ 2 ≠ 0 hp : (v, w) ∈ {p | p.fst ^ 2 + p.snd ^ 2 = 1 ∧ p.snd ≠ -1} q : (fun x => ℚ) { val := (v, w), property := hp } := ↑(circleEquivGen hQ).symm { val := (v, w), property := hp } ht4 : v = 2 * q / (1 + q ^ 2) ∧ w = (1 - q ^ 2) / (1 + q ^ 2) m : ℤ := ↑q.den n : ℤ := q.num hm0 : m ≠ 0 hq2 : q = ↑n / ↑m hm2n2 : 0 < m ^ 2 + n ^ 2 hm2n20 : ↑m ^ 2 + ↑n ^ 2 ≠ 0 hx1 : ∀ {j k : ℚ}, k ≠ 0 → k ^ 2 + j ^ 2 ≠ 0 → (1 - (j / k) ^ 2) / (1 + (j / k) ^ 2) = (k ^ 2 - j ^ 2) / (k ^ 2 + j ^ 2) hw2 : w = (↑m ^ 2 - ↑n ^ 2) / (↑m ^ 2 + ↑n ^ 2) hx2 : ∀ {j k : ℚ}, k ≠ 0 → k ^ 2 + j ^ 2 ≠ 0 → 2 * (j / k) / (1 + (j / k) ^ 2) = 2 * k * j / (k ^ 2 + j ^ 2) hv2 : v = 2 * ↑m * ↑n / (↑m ^ 2 + ↑n ^ 2) hnmcp : Int.gcd n m = 1 hmncp : Int.gcd m n = 1 hm2 : m % 2 = 0 hn2 : n % 2 = 1 ⊢ Int.gcd (m ^ 2 - n ^ 2) (m ^ 2 + n ^ 2) = 1 [PROOFSTEP] apply coprime_sq_sub_sq_add_of_even_odd hmncp hm2 hn2 [GOAL] case neg.inr.inl x y z : ℤ h : PythagoreanTriple x y z hc : Int.gcd x y = 1 hyo : y % 2 = 1 hzpos : 0 < z h0 : ¬x = 0 v : ℚ := ↑x / ↑z w : ℚ := ↑y / ↑z hz : z ≠ 0 hq : v ^ 2 + w ^ 2 = 1 hvz : v ≠ 0 hw1 : w ≠ -1 hQ : ∀ (x : ℚ), 1 + x ^ 2 ≠ 0 hp : (v, w) ∈ {p | p.fst ^ 2 + p.snd ^ 2 = 1 ∧ p.snd ≠ -1} q : (fun x => ℚ) { val := (v, w), property := hp } := ↑(circleEquivGen hQ).symm { val := (v, w), property := hp } ht4 : v = 2 * q / (1 + q ^ 2) ∧ w = (1 - q ^ 2) / (1 + q ^ 2) m : ℤ := ↑q.den n : ℤ := q.num hm0 : m ≠ 0 hq2 : q = ↑n / ↑m hm2n2 : 0 < m ^ 2 + n ^ 2 hm2n20 : ↑m ^ 2 + ↑n ^ 2 ≠ 0 hx1 : ∀ {j k : ℚ}, k ≠ 0 → k ^ 2 + j ^ 2 ≠ 0 → (1 - (j / k) ^ 2) / (1 + (j / k) ^ 2) = (k ^ 2 - j ^ 2) / (k ^ 2 + j ^ 2) hw2 : w = (↑m ^ 2 - ↑n ^ 2) / (↑m ^ 2 + ↑n ^ 2) hx2 : ∀ {j k : ℚ}, k ≠ 0 → k ^ 2 + j ^ 2 ≠ 0 → 2 * (j / k) / (1 + (j / k) ^ 2) = 2 * k * j / (k ^ 2 + j ^ 2) hv2 : v = 2 * ↑m * ↑n / (↑m ^ 2 + ↑n ^ 2) hnmcp : Int.gcd n m = 1 hmncp : Int.gcd m n = 1 hm2 : m % 2 = 1 hn2 : n % 2 = 0 ⊢ IsPrimitiveClassified h [PROOFSTEP] apply h.isPrimitiveClassified_aux hc hzpos hm2n2 hv2 hw2 _ hmncp [GOAL] case neg.inr.inl x y z : ℤ h : PythagoreanTriple x y z hc : Int.gcd x y = 1 hyo : y % 2 = 1 hzpos : 0 < z h0 : ¬x = 0 v : ℚ := ↑x / ↑z w : ℚ := ↑y / ↑z hz : z ≠ 0 hq : v ^ 2 + w ^ 2 = 1 hvz : v ≠ 0 hw1 : w ≠ -1 hQ : ∀ (x : ℚ), 1 + x ^ 2 ≠ 0 hp : (v, w) ∈ {p | p.fst ^ 2 + p.snd ^ 2 = 1 ∧ p.snd ≠ -1} q : (fun x => ℚ) { val := (v, w), property := hp } := ↑(circleEquivGen hQ).symm { val := (v, w), property := hp } ht4 : v = 2 * q / (1 + q ^ 2) ∧ w = (1 - q ^ 2) / (1 + q ^ 2) m : ℤ := ↑q.den n : ℤ := q.num hm0 : m ≠ 0 hq2 : q = ↑n / ↑m hm2n2 : 0 < m ^ 2 + n ^ 2 hm2n20 : ↑m ^ 2 + ↑n ^ 2 ≠ 0 hx1 : ∀ {j k : ℚ}, k ≠ 0 → k ^ 2 + j ^ 2 ≠ 0 → (1 - (j / k) ^ 2) / (1 + (j / k) ^ 2) = (k ^ 2 - j ^ 2) / (k ^ 2 + j ^ 2) hw2 : w = (↑m ^ 2 - ↑n ^ 2) / (↑m ^ 2 + ↑n ^ 2) hx2 : ∀ {j k : ℚ}, k ≠ 0 → k ^ 2 + j ^ 2 ≠ 0 → 2 * (j / k) / (1 + (j / k) ^ 2) = 2 * k * j / (k ^ 2 + j ^ 2) hv2 : v = 2 * ↑m * ↑n / (↑m ^ 2 + ↑n ^ 2) hnmcp : Int.gcd n m = 1 hmncp : Int.gcd m n = 1 hm2 : m % 2 = 1 hn2 : n % 2 = 0 ⊢ m % 2 = 0 ∧ n % 2 = 1 ∨ m % 2 = 1 ∧ n % 2 = 0 [PROOFSTEP] apply Or.intro_right [GOAL] case neg.inr.inl.h x y z : ℤ h : PythagoreanTriple x y z hc : Int.gcd x y = 1 hyo : y % 2 = 1 hzpos : 0 < z h0 : ¬x = 0 v : ℚ := ↑x / ↑z w : ℚ := ↑y / ↑z hz : z ≠ 0 hq : v ^ 2 + w ^ 2 = 1 hvz : v ≠ 0 hw1 : w ≠ -1 hQ : ∀ (x : ℚ), 1 + x ^ 2 ≠ 0 hp : (v, w) ∈ {p | p.fst ^ 2 + p.snd ^ 2 = 1 ∧ p.snd ≠ -1} q : (fun x => ℚ) { val := (v, w), property := hp } := ↑(circleEquivGen hQ).symm { val := (v, w), property := hp } ht4 : v = 2 * q / (1 + q ^ 2) ∧ w = (1 - q ^ 2) / (1 + q ^ 2) m : ℤ := ↑q.den n : ℤ := q.num hm0 : m ≠ 0 hq2 : q = ↑n / ↑m hm2n2 : 0 < m ^ 2 + n ^ 2 hm2n20 : ↑m ^ 2 + ↑n ^ 2 ≠ 0 hx1 : ∀ {j k : ℚ}, k ≠ 0 → k ^ 2 + j ^ 2 ≠ 0 → (1 - (j / k) ^ 2) / (1 + (j / k) ^ 2) = (k ^ 2 - j ^ 2) / (k ^ 2 + j ^ 2) hw2 : w = (↑m ^ 2 - ↑n ^ 2) / (↑m ^ 2 + ↑n ^ 2) hx2 : ∀ {j k : ℚ}, k ≠ 0 → k ^ 2 + j ^ 2 ≠ 0 → 2 * (j / k) / (1 + (j / k) ^ 2) = 2 * k * j / (k ^ 2 + j ^ 2) hv2 : v = 2 * ↑m * ↑n / (↑m ^ 2 + ↑n ^ 2) hnmcp : Int.gcd n m = 1 hmncp : Int.gcd m n = 1 hm2 : m % 2 = 1 hn2 : n % 2 = 0 ⊢ m % 2 = 1 ∧ n % 2 = 0 [PROOFSTEP] exact And.intro hm2 hn2 [GOAL] x y z : ℤ h : PythagoreanTriple x y z hc : Int.gcd x y = 1 hyo : y % 2 = 1 hzpos : 0 < z h0 : ¬x = 0 v : ℚ := ↑x / ↑z w : ℚ := ↑y / ↑z hz : z ≠ 0 hq : v ^ 2 + w ^ 2 = 1 hvz : v ≠ 0 hw1 : w ≠ -1 hQ : ∀ (x : ℚ), 1 + x ^ 2 ≠ 0 hp : (v, w) ∈ {p | p.fst ^ 2 + p.snd ^ 2 = 1 ∧ p.snd ≠ -1} q : (fun x => ℚ) { val := (v, w), property := hp } := ↑(circleEquivGen hQ).symm { val := (v, w), property := hp } ht4 : v = 2 * q / (1 + q ^ 2) ∧ w = (1 - q ^ 2) / (1 + q ^ 2) m : ℤ := ↑q.den n : ℤ := q.num hm0 : m ≠ 0 hq2 : q = ↑n / ↑m hm2n2 : 0 < m ^ 2 + n ^ 2 hm2n20 : ↑m ^ 2 + ↑n ^ 2 ≠ 0 hx1 : ∀ {j k : ℚ}, k ≠ 0 → k ^ 2 + j ^ 2 ≠ 0 → (1 - (j / k) ^ 2) / (1 + (j / k) ^ 2) = (k ^ 2 - j ^ 2) / (k ^ 2 + j ^ 2) hw2 : w = (↑m ^ 2 - ↑n ^ 2) / (↑m ^ 2 + ↑n ^ 2) hx2 : ∀ {j k : ℚ}, k ≠ 0 → k ^ 2 + j ^ 2 ≠ 0 → 2 * (j / k) / (1 + (j / k) ^ 2) = 2 * k * j / (k ^ 2 + j ^ 2) hv2 : v = 2 * ↑m * ↑n / (↑m ^ 2 + ↑n ^ 2) hnmcp : Int.gcd n m = 1 hmncp : Int.gcd m n = 1 hm2 : m % 2 = 1 hn2 : n % 2 = 0 ⊢ Int.gcd (m ^ 2 - n ^ 2) (m ^ 2 + n ^ 2) = 1 [PROOFSTEP] apply coprime_sq_sub_sq_add_of_odd_even hmncp hm2 hn2 [GOAL] case neg.inr.inr x y z : ℤ h : PythagoreanTriple x y z hc : Int.gcd x y = 1 hyo : y % 2 = 1 hzpos : 0 < z h0 : ¬x = 0 v : ℚ := ↑x / ↑z w : ℚ := ↑y / ↑z hz : z ≠ 0 hq : v ^ 2 + w ^ 2 = 1 hvz : v ≠ 0 hw1 : w ≠ -1 hQ : ∀ (x : ℚ), 1 + x ^ 2 ≠ 0 hp : (v, w) ∈ {p | p.fst ^ 2 + p.snd ^ 2 = 1 ∧ p.snd ≠ -1} q : (fun x => ℚ) { val := (v, w), property := hp } := ↑(circleEquivGen hQ).symm { val := (v, w), property := hp } ht4 : v = 2 * q / (1 + q ^ 2) ∧ w = (1 - q ^ 2) / (1 + q ^ 2) m : ℤ := ↑q.den n : ℤ := q.num hm0 : m ≠ 0 hq2 : q = ↑n / ↑m hm2n2 : 0 < m ^ 2 + n ^ 2 hm2n20 : ↑m ^ 2 + ↑n ^ 2 ≠ 0 hx1 : ∀ {j k : ℚ}, k ≠ 0 → k ^ 2 + j ^ 2 ≠ 0 → (1 - (j / k) ^ 2) / (1 + (j / k) ^ 2) = (k ^ 2 - j ^ 2) / (k ^ 2 + j ^ 2) hw2 : w = (↑m ^ 2 - ↑n ^ 2) / (↑m ^ 2 + ↑n ^ 2) hx2 : ∀ {j k : ℚ}, k ≠ 0 → k ^ 2 + j ^ 2 ≠ 0 → 2 * (j / k) / (1 + (j / k) ^ 2) = 2 * k * j / (k ^ 2 + j ^ 2) hv2 : v = 2 * ↑m * ↑n / (↑m ^ 2 + ↑n ^ 2) hnmcp : Int.gcd n m = 1 hmncp : Int.gcd m n = 1 hm2 : m % 2 = 1 hn2 : n % 2 = 1 ⊢ IsPrimitiveClassified h [PROOFSTEP] exfalso [GOAL] case neg.inr.inr.h x y z : ℤ h : PythagoreanTriple x y z hc : Int.gcd x y = 1 hyo : y % 2 = 1 hzpos : 0 < z h0 : ¬x = 0 v : ℚ := ↑x / ↑z w : ℚ := ↑y / ↑z hz : z ≠ 0 hq : v ^ 2 + w ^ 2 = 1 hvz : v ≠ 0 hw1 : w ≠ -1 hQ : ∀ (x : ℚ), 1 + x ^ 2 ≠ 0 hp : (v, w) ∈ {p | p.fst ^ 2 + p.snd ^ 2 = 1 ∧ p.snd ≠ -1} q : (fun x => ℚ) { val := (v, w), property := hp } := ↑(circleEquivGen hQ).symm { val := (v, w), property := hp } ht4 : v = 2 * q / (1 + q ^ 2) ∧ w = (1 - q ^ 2) / (1 + q ^ 2) m : ℤ := ↑q.den n : ℤ := q.num hm0 : m ≠ 0 hq2 : q = ↑n / ↑m hm2n2 : 0 < m ^ 2 + n ^ 2 hm2n20 : ↑m ^ 2 + ↑n ^ 2 ≠ 0 hx1 : ∀ {j k : ℚ}, k ≠ 0 → k ^ 2 + j ^ 2 ≠ 0 → (1 - (j / k) ^ 2) / (1 + (j / k) ^ 2) = (k ^ 2 - j ^ 2) / (k ^ 2 + j ^ 2) hw2 : w = (↑m ^ 2 - ↑n ^ 2) / (↑m ^ 2 + ↑n ^ 2) hx2 : ∀ {j k : ℚ}, k ≠ 0 → k ^ 2 + j ^ 2 ≠ 0 → 2 * (j / k) / (1 + (j / k) ^ 2) = 2 * k * j / (k ^ 2 + j ^ 2) hv2 : v = 2 * ↑m * ↑n / (↑m ^ 2 + ↑n ^ 2) hnmcp : Int.gcd n m = 1 hmncp : Int.gcd m n = 1 hm2 : m % 2 = 1 hn2 : n % 2 = 1 ⊢ False [PROOFSTEP] have h1 : 2 ∣ m ^ 2 + n ^ 2 ∧ 2 ∣ m ^ 2 - n ^ 2 ∧ (m ^ 2 - n ^ 2) / 2 % 2 = 0 ∧ Int.gcd ((m ^ 2 - n ^ 2) / 2) ((m ^ 2 + n ^ 2) / 2) = 1 := coprime_sq_sub_sq_sum_of_odd_odd hmncp hm2 hn2 [GOAL] case neg.inr.inr.h x y z : ℤ h : PythagoreanTriple x y z hc : Int.gcd x y = 1 hyo : y % 2 = 1 hzpos : 0 < z h0 : ¬x = 0 v : ℚ := ↑x / ↑z w : ℚ := ↑y / ↑z hz : z ≠ 0 hq : v ^ 2 + w ^ 2 = 1 hvz : v ≠ 0 hw1 : w ≠ -1 hQ : ∀ (x : ℚ), 1 + x ^ 2 ≠ 0 hp : (v, w) ∈ {p | p.fst ^ 2 + p.snd ^ 2 = 1 ∧ p.snd ≠ -1} q : (fun x => ℚ) { val := (v, w), property := hp } := ↑(circleEquivGen hQ).symm { val := (v, w), property := hp } ht4 : v = 2 * q / (1 + q ^ 2) ∧ w = (1 - q ^ 2) / (1 + q ^ 2) m : ℤ := ↑q.den n : ℤ := q.num hm0 : m ≠ 0 hq2 : q = ↑n / ↑m hm2n2 : 0 < m ^ 2 + n ^ 2 hm2n20 : ↑m ^ 2 + ↑n ^ 2 ≠ 0 hx1 : ∀ {j k : ℚ}, k ≠ 0 → k ^ 2 + j ^ 2 ≠ 0 → (1 - (j / k) ^ 2) / (1 + (j / k) ^ 2) = (k ^ 2 - j ^ 2) / (k ^ 2 + j ^ 2) hw2 : w = (↑m ^ 2 - ↑n ^ 2) / (↑m ^ 2 + ↑n ^ 2) hx2 : ∀ {j k : ℚ}, k ≠ 0 → k ^ 2 + j ^ 2 ≠ 0 → 2 * (j / k) / (1 + (j / k) ^ 2) = 2 * k * j / (k ^ 2 + j ^ 2) hv2 : v = 2 * ↑m * ↑n / (↑m ^ 2 + ↑n ^ 2) hnmcp : Int.gcd n m = 1 hmncp : Int.gcd m n = 1 hm2 : m % 2 = 1 hn2 : n % 2 = 1 h1 : 2 ∣ m ^ 2 + n ^ 2 ∧ 2 ∣ m ^ 2 - n ^ 2 ∧ (m ^ 2 - n ^ 2) / 2 % 2 = 0 ∧ Int.gcd ((m ^ 2 - n ^ 2) / 2) ((m ^ 2 + n ^ 2) / 2) = 1 ⊢ False [PROOFSTEP] have h2 : y = (m ^ 2 - n ^ 2) / 2 ∧ z = (m ^ 2 + n ^ 2) / 2 := by apply Rat.div_int_inj hzpos _ (h.coprime_of_coprime hc) h1.2.2.2 · show w = _ rw [← Rat.divInt_eq_div, ← Rat.divInt_mul_right (by norm_num : (2 : ℤ) ≠ 0)] rw [Int.ediv_mul_cancel h1.1, Int.ediv_mul_cancel h1.2.1, hw2] norm_cast · apply (mul_lt_mul_right (by norm_num : 0 < (2 : ℤ))).mp rw [Int.ediv_mul_cancel h1.1, zero_mul] exact hm2n2 [GOAL] x y z : ℤ h : PythagoreanTriple x y z hc : Int.gcd x y = 1 hyo : y % 2 = 1 hzpos : 0 < z h0 : ¬x = 0 v : ℚ := ↑x / ↑z w : ℚ := ↑y / ↑z hz : z ≠ 0 hq : v ^ 2 + w ^ 2 = 1 hvz : v ≠ 0 hw1 : w ≠ -1 hQ : ∀ (x : ℚ), 1 + x ^ 2 ≠ 0 hp : (v, w) ∈ {p | p.fst ^ 2 + p.snd ^ 2 = 1 ∧ p.snd ≠ -1} q : (fun x => ℚ) { val := (v, w), property := hp } := ↑(circleEquivGen hQ).symm { val := (v, w), property := hp } ht4 : v = 2 * q / (1 + q ^ 2) ∧ w = (1 - q ^ 2) / (1 + q ^ 2) m : ℤ := ↑q.den n : ℤ := q.num hm0 : m ≠ 0 hq2 : q = ↑n / ↑m hm2n2 : 0 < m ^ 2 + n ^ 2 hm2n20 : ↑m ^ 2 + ↑n ^ 2 ≠ 0 hx1 : ∀ {j k : ℚ}, k ≠ 0 → k ^ 2 + j ^ 2 ≠ 0 → (1 - (j / k) ^ 2) / (1 + (j / k) ^ 2) = (k ^ 2 - j ^ 2) / (k ^ 2 + j ^ 2) hw2 : w = (↑m ^ 2 - ↑n ^ 2) / (↑m ^ 2 + ↑n ^ 2) hx2 : ∀ {j k : ℚ}, k ≠ 0 → k ^ 2 + j ^ 2 ≠ 0 → 2 * (j / k) / (1 + (j / k) ^ 2) = 2 * k * j / (k ^ 2 + j ^ 2) hv2 : v = 2 * ↑m * ↑n / (↑m ^ 2 + ↑n ^ 2) hnmcp : Int.gcd n m = 1 hmncp : Int.gcd m n = 1 hm2 : m % 2 = 1 hn2 : n % 2 = 1 h1 : 2 ∣ m ^ 2 + n ^ 2 ∧ 2 ∣ m ^ 2 - n ^ 2 ∧ (m ^ 2 - n ^ 2) / 2 % 2 = 0 ∧ Int.gcd ((m ^ 2 - n ^ 2) / 2) ((m ^ 2 + n ^ 2) / 2) = 1 ⊢ y = (m ^ 2 - n ^ 2) / 2 ∧ z = (m ^ 2 + n ^ 2) / 2 [PROOFSTEP] apply Rat.div_int_inj hzpos _ (h.coprime_of_coprime hc) h1.2.2.2 [GOAL] x y z : ℤ h : PythagoreanTriple x y z hc : Int.gcd x y = 1 hyo : y % 2 = 1 hzpos : 0 < z h0 : ¬x = 0 v : ℚ := ↑x / ↑z w : ℚ := ↑y / ↑z hz : z ≠ 0 hq : v ^ 2 + w ^ 2 = 1 hvz : v ≠ 0 hw1 : w ≠ -1 hQ : ∀ (x : ℚ), 1 + x ^ 2 ≠ 0 hp : (v, w) ∈ {p | p.fst ^ 2 + p.snd ^ 2 = 1 ∧ p.snd ≠ -1} q : (fun x => ℚ) { val := (v, w), property := hp } := ↑(circleEquivGen hQ).symm { val := (v, w), property := hp } ht4 : v = 2 * q / (1 + q ^ 2) ∧ w = (1 - q ^ 2) / (1 + q ^ 2) m : ℤ := ↑q.den n : ℤ := q.num hm0 : m ≠ 0 hq2 : q = ↑n / ↑m hm2n2 : 0 < m ^ 2 + n ^ 2 hm2n20 : ↑m ^ 2 + ↑n ^ 2 ≠ 0 hx1 : ∀ {j k : ℚ}, k ≠ 0 → k ^ 2 + j ^ 2 ≠ 0 → (1 - (j / k) ^ 2) / (1 + (j / k) ^ 2) = (k ^ 2 - j ^ 2) / (k ^ 2 + j ^ 2) hw2 : w = (↑m ^ 2 - ↑n ^ 2) / (↑m ^ 2 + ↑n ^ 2) hx2 : ∀ {j k : ℚ}, k ≠ 0 → k ^ 2 + j ^ 2 ≠ 0 → 2 * (j / k) / (1 + (j / k) ^ 2) = 2 * k * j / (k ^ 2 + j ^ 2) hv2 : v = 2 * ↑m * ↑n / (↑m ^ 2 + ↑n ^ 2) hnmcp : Int.gcd n m = 1 hmncp : Int.gcd m n = 1 hm2 : m % 2 = 1 hn2 : n % 2 = 1 h1 : 2 ∣ m ^ 2 + n ^ 2 ∧ 2 ∣ m ^ 2 - n ^ 2 ∧ (m ^ 2 - n ^ 2) / 2 % 2 = 0 ∧ Int.gcd ((m ^ 2 - n ^ 2) / 2) ((m ^ 2 + n ^ 2) / 2) = 1 ⊢ ↑y / ↑z = ↑((m ^ 2 - n ^ 2) / 2) / ↑((m ^ 2 + n ^ 2) / 2) [PROOFSTEP] show w = _ [GOAL] x y z : ℤ h : PythagoreanTriple x y z hc : Int.gcd x y = 1 hyo : y % 2 = 1 hzpos : 0 < z h0 : ¬x = 0 v : ℚ := ↑x / ↑z w : ℚ := ↑y / ↑z hz : z ≠ 0 hq : v ^ 2 + w ^ 2 = 1 hvz : v ≠ 0 hw1 : w ≠ -1 hQ : ∀ (x : ℚ), 1 + x ^ 2 ≠ 0 hp : (v, w) ∈ {p | p.fst ^ 2 + p.snd ^ 2 = 1 ∧ p.snd ≠ -1} q : (fun x => ℚ) { val := (v, w), property := hp } := ↑(circleEquivGen hQ).symm { val := (v, w), property := hp } ht4 : v = 2 * q / (1 + q ^ 2) ∧ w = (1 - q ^ 2) / (1 + q ^ 2) m : ℤ := ↑q.den n : ℤ := q.num hm0 : m ≠ 0 hq2 : q = ↑n / ↑m hm2n2 : 0 < m ^ 2 + n ^ 2 hm2n20 : ↑m ^ 2 + ↑n ^ 2 ≠ 0 hx1 : ∀ {j k : ℚ}, k ≠ 0 → k ^ 2 + j ^ 2 ≠ 0 → (1 - (j / k) ^ 2) / (1 + (j / k) ^ 2) = (k ^ 2 - j ^ 2) / (k ^ 2 + j ^ 2) hw2 : w = (↑m ^ 2 - ↑n ^ 2) / (↑m ^ 2 + ↑n ^ 2) hx2 : ∀ {j k : ℚ}, k ≠ 0 → k ^ 2 + j ^ 2 ≠ 0 → 2 * (j / k) / (1 + (j / k) ^ 2) = 2 * k * j / (k ^ 2 + j ^ 2) hv2 : v = 2 * ↑m * ↑n / (↑m ^ 2 + ↑n ^ 2) hnmcp : Int.gcd n m = 1 hmncp : Int.gcd m n = 1 hm2 : m % 2 = 1 hn2 : n % 2 = 1 h1 : 2 ∣ m ^ 2 + n ^ 2 ∧ 2 ∣ m ^ 2 - n ^ 2 ∧ (m ^ 2 - n ^ 2) / 2 % 2 = 0 ∧ Int.gcd ((m ^ 2 - n ^ 2) / 2) ((m ^ 2 + n ^ 2) / 2) = 1 ⊢ w = ↑((m ^ 2 - n ^ 2) / 2) / ↑((m ^ 2 + n ^ 2) / 2) [PROOFSTEP] rw [← Rat.divInt_eq_div, ← Rat.divInt_mul_right (by norm_num : (2 : ℤ) ≠ 0)] [GOAL] x y z : ℤ h : PythagoreanTriple x y z hc : Int.gcd x y = 1 hyo : y % 2 = 1 hzpos : 0 < z h0 : ¬x = 0 v : ℚ := ↑x / ↑z w : ℚ := ↑y / ↑z hz : z ≠ 0 hq : v ^ 2 + w ^ 2 = 1 hvz : v ≠ 0 hw1 : w ≠ -1 hQ : ∀ (x : ℚ), 1 + x ^ 2 ≠ 0 hp : (v, w) ∈ {p | p.fst ^ 2 + p.snd ^ 2 = 1 ∧ p.snd ≠ -1} q : (fun x => ℚ) { val := (v, w), property := hp } := ↑(circleEquivGen hQ).symm { val := (v, w), property := hp } ht4 : v = 2 * q / (1 + q ^ 2) ∧ w = (1 - q ^ 2) / (1 + q ^ 2) m : ℤ := ↑q.den n : ℤ := q.num hm0 : m ≠ 0 hq2 : q = ↑n / ↑m hm2n2 : 0 < m ^ 2 + n ^ 2 hm2n20 : ↑m ^ 2 + ↑n ^ 2 ≠ 0 hx1 : ∀ {j k : ℚ}, k ≠ 0 → k ^ 2 + j ^ 2 ≠ 0 → (1 - (j / k) ^ 2) / (1 + (j / k) ^ 2) = (k ^ 2 - j ^ 2) / (k ^ 2 + j ^ 2) hw2 : w = (↑m ^ 2 - ↑n ^ 2) / (↑m ^ 2 + ↑n ^ 2) hx2 : ∀ {j k : ℚ}, k ≠ 0 → k ^ 2 + j ^ 2 ≠ 0 → 2 * (j / k) / (1 + (j / k) ^ 2) = 2 * k * j / (k ^ 2 + j ^ 2) hv2 : v = 2 * ↑m * ↑n / (↑m ^ 2 + ↑n ^ 2) hnmcp : Int.gcd n m = 1 hmncp : Int.gcd m n = 1 hm2 : m % 2 = 1 hn2 : n % 2 = 1 h1 : 2 ∣ m ^ 2 + n ^ 2 ∧ 2 ∣ m ^ 2 - n ^ 2 ∧ (m ^ 2 - n ^ 2) / 2 % 2 = 0 ∧ Int.gcd ((m ^ 2 - n ^ 2) / 2) ((m ^ 2 + n ^ 2) / 2) = 1 ⊢ 2 ≠ 0 [PROOFSTEP] norm_num [GOAL] x y z : ℤ h : PythagoreanTriple x y z hc : Int.gcd x y = 1 hyo : y % 2 = 1 hzpos : 0 < z h0 : ¬x = 0 v : ℚ := ↑x / ↑z w : ℚ := ↑y / ↑z hz : z ≠ 0 hq : v ^ 2 + w ^ 2 = 1 hvz : v ≠ 0 hw1 : w ≠ -1 hQ : ∀ (x : ℚ), 1 + x ^ 2 ≠ 0 hp : (v, w) ∈ {p | p.fst ^ 2 + p.snd ^ 2 = 1 ∧ p.snd ≠ -1} q : (fun x => ℚ) { val := (v, w), property := hp } := ↑(circleEquivGen hQ).symm { val := (v, w), property := hp } ht4 : v = 2 * q / (1 + q ^ 2) ∧ w = (1 - q ^ 2) / (1 + q ^ 2) m : ℤ := ↑q.den n : ℤ := q.num hm0 : m ≠ 0 hq2 : q = ↑n / ↑m hm2n2 : 0 < m ^ 2 + n ^ 2 hm2n20 : ↑m ^ 2 + ↑n ^ 2 ≠ 0 hx1 : ∀ {j k : ℚ}, k ≠ 0 → k ^ 2 + j ^ 2 ≠ 0 → (1 - (j / k) ^ 2) / (1 + (j / k) ^ 2) = (k ^ 2 - j ^ 2) / (k ^ 2 + j ^ 2) hw2 : w = (↑m ^ 2 - ↑n ^ 2) / (↑m ^ 2 + ↑n ^ 2) hx2 : ∀ {j k : ℚ}, k ≠ 0 → k ^ 2 + j ^ 2 ≠ 0 → 2 * (j / k) / (1 + (j / k) ^ 2) = 2 * k * j / (k ^ 2 + j ^ 2) hv2 : v = 2 * ↑m * ↑n / (↑m ^ 2 + ↑n ^ 2) hnmcp : Int.gcd n m = 1 hmncp : Int.gcd m n = 1 hm2 : m % 2 = 1 hn2 : n % 2 = 1 h1 : 2 ∣ m ^ 2 + n ^ 2 ∧ 2 ∣ m ^ 2 - n ^ 2 ∧ (m ^ 2 - n ^ 2) / 2 % 2 = 0 ∧ Int.gcd ((m ^ 2 - n ^ 2) / 2) ((m ^ 2 + n ^ 2) / 2) = 1 ⊢ w = Rat.divInt ((m ^ 2 - n ^ 2) / 2 * 2) ((m ^ 2 + n ^ 2) / 2 * 2) [PROOFSTEP] rw [Int.ediv_mul_cancel h1.1, Int.ediv_mul_cancel h1.2.1, hw2] [GOAL] x y z : ℤ h : PythagoreanTriple x y z hc : Int.gcd x y = 1 hyo : y % 2 = 1 hzpos : 0 < z h0 : ¬x = 0 v : ℚ := ↑x / ↑z w : ℚ := ↑y / ↑z hz : z ≠ 0 hq : v ^ 2 + w ^ 2 = 1 hvz : v ≠ 0 hw1 : w ≠ -1 hQ : ∀ (x : ℚ), 1 + x ^ 2 ≠ 0 hp : (v, w) ∈ {p | p.fst ^ 2 + p.snd ^ 2 = 1 ∧ p.snd ≠ -1} q : (fun x => ℚ) { val := (v, w), property := hp } := ↑(circleEquivGen hQ).symm { val := (v, w), property := hp } ht4 : v = 2 * q / (1 + q ^ 2) ∧ w = (1 - q ^ 2) / (1 + q ^ 2) m : ℤ := ↑q.den n : ℤ := q.num hm0 : m ≠ 0 hq2 : q = ↑n / ↑m hm2n2 : 0 < m ^ 2 + n ^ 2 hm2n20 : ↑m ^ 2 + ↑n ^ 2 ≠ 0 hx1 : ∀ {j k : ℚ}, k ≠ 0 → k ^ 2 + j ^ 2 ≠ 0 → (1 - (j / k) ^ 2) / (1 + (j / k) ^ 2) = (k ^ 2 - j ^ 2) / (k ^ 2 + j ^ 2) hw2 : w = (↑m ^ 2 - ↑n ^ 2) / (↑m ^ 2 + ↑n ^ 2) hx2 : ∀ {j k : ℚ}, k ≠ 0 → k ^ 2 + j ^ 2 ≠ 0 → 2 * (j / k) / (1 + (j / k) ^ 2) = 2 * k * j / (k ^ 2 + j ^ 2) hv2 : v = 2 * ↑m * ↑n / (↑m ^ 2 + ↑n ^ 2) hnmcp : Int.gcd n m = 1 hmncp : Int.gcd m n = 1 hm2 : m % 2 = 1 hn2 : n % 2 = 1 h1 : 2 ∣ m ^ 2 + n ^ 2 ∧ 2 ∣ m ^ 2 - n ^ 2 ∧ (m ^ 2 - n ^ 2) / 2 % 2 = 0 ∧ Int.gcd ((m ^ 2 - n ^ 2) / 2) ((m ^ 2 + n ^ 2) / 2) = 1 ⊢ (↑m ^ 2 - ↑n ^ 2) / (↑m ^ 2 + ↑n ^ 2) = Rat.divInt (m ^ 2 - n ^ 2) (m ^ 2 + n ^ 2) [PROOFSTEP] norm_cast [GOAL] x y z : ℤ h : PythagoreanTriple x y z hc : Int.gcd x y = 1 hyo : y % 2 = 1 hzpos : 0 < z h0 : ¬x = 0 v : ℚ := ↑x / ↑z w : ℚ := ↑y / ↑z hz : z ≠ 0 hq : v ^ 2 + w ^ 2 = 1 hvz : v ≠ 0 hw1 : w ≠ -1 hQ : ∀ (x : ℚ), 1 + x ^ 2 ≠ 0 hp : (v, w) ∈ {p | p.fst ^ 2 + p.snd ^ 2 = 1 ∧ p.snd ≠ -1} q : (fun x => ℚ) { val := (v, w), property := hp } := ↑(circleEquivGen hQ).symm { val := (v, w), property := hp } ht4 : v = 2 * q / (1 + q ^ 2) ∧ w = (1 - q ^ 2) / (1 + q ^ 2) m : ℤ := ↑q.den n : ℤ := q.num hm0 : m ≠ 0 hq2 : q = ↑n / ↑m hm2n2 : 0 < m ^ 2 + n ^ 2 hm2n20 : ↑m ^ 2 + ↑n ^ 2 ≠ 0 hx1 : ∀ {j k : ℚ}, k ≠ 0 → k ^ 2 + j ^ 2 ≠ 0 → (1 - (j / k) ^ 2) / (1 + (j / k) ^ 2) = (k ^ 2 - j ^ 2) / (k ^ 2 + j ^ 2) hw2 : w = (↑m ^ 2 - ↑n ^ 2) / (↑m ^ 2 + ↑n ^ 2) hx2 : ∀ {j k : ℚ}, k ≠ 0 → k ^ 2 + j ^ 2 ≠ 0 → 2 * (j / k) / (1 + (j / k) ^ 2) = 2 * k * j / (k ^ 2 + j ^ 2) hv2 : v = 2 * ↑m * ↑n / (↑m ^ 2 + ↑n ^ 2) hnmcp : Int.gcd n m = 1 hmncp : Int.gcd m n = 1 hm2 : m % 2 = 1 hn2 : n % 2 = 1 h1 : 2 ∣ m ^ 2 + n ^ 2 ∧ 2 ∣ m ^ 2 - n ^ 2 ∧ (m ^ 2 - n ^ 2) / 2 % 2 = 0 ∧ Int.gcd ((m ^ 2 - n ^ 2) / 2) ((m ^ 2 + n ^ 2) / 2) = 1 ⊢ 0 < (m ^ 2 + n ^ 2) / 2 [PROOFSTEP] apply (mul_lt_mul_right (by norm_num : 0 < (2 : ℤ))).mp [GOAL] x y z : ℤ h : PythagoreanTriple x y z hc : Int.gcd x y = 1 hyo : y % 2 = 1 hzpos : 0 < z h0 : ¬x = 0 v : ℚ := ↑x / ↑z w : ℚ := ↑y / ↑z hz : z ≠ 0 hq : v ^ 2 + w ^ 2 = 1 hvz : v ≠ 0 hw1 : w ≠ -1 hQ : ∀ (x : ℚ), 1 + x ^ 2 ≠ 0 hp : (v, w) ∈ {p | p.fst ^ 2 + p.snd ^ 2 = 1 ∧ p.snd ≠ -1} q : (fun x => ℚ) { val := (v, w), property := hp } := ↑(circleEquivGen hQ).symm { val := (v, w), property := hp } ht4 : v = 2 * q / (1 + q ^ 2) ∧ w = (1 - q ^ 2) / (1 + q ^ 2) m : ℤ := ↑q.den n : ℤ := q.num hm0 : m ≠ 0 hq2 : q = ↑n / ↑m hm2n2 : 0 < m ^ 2 + n ^ 2 hm2n20 : ↑m ^ 2 + ↑n ^ 2 ≠ 0 hx1 : ∀ {j k : ℚ}, k ≠ 0 → k ^ 2 + j ^ 2 ≠ 0 → (1 - (j / k) ^ 2) / (1 + (j / k) ^ 2) = (k ^ 2 - j ^ 2) / (k ^ 2 + j ^ 2) hw2 : w = (↑m ^ 2 - ↑n ^ 2) / (↑m ^ 2 + ↑n ^ 2) hx2 : ∀ {j k : ℚ}, k ≠ 0 → k ^ 2 + j ^ 2 ≠ 0 → 2 * (j / k) / (1 + (j / k) ^ 2) = 2 * k * j / (k ^ 2 + j ^ 2) hv2 : v = 2 * ↑m * ↑n / (↑m ^ 2 + ↑n ^ 2) hnmcp : Int.gcd n m = 1 hmncp : Int.gcd m n = 1 hm2 : m % 2 = 1 hn2 : n % 2 = 1 h1 : 2 ∣ m ^ 2 + n ^ 2 ∧ 2 ∣ m ^ 2 - n ^ 2 ∧ (m ^ 2 - n ^ 2) / 2 % 2 = 0 ∧ Int.gcd ((m ^ 2 - n ^ 2) / 2) ((m ^ 2 + n ^ 2) / 2) = 1 ⊢ 0 < 2 [PROOFSTEP] norm_num [GOAL] x y z : ℤ h : PythagoreanTriple x y z hc : Int.gcd x y = 1 hyo : y % 2 = 1 hzpos : 0 < z h0 : ¬x = 0 v : ℚ := ↑x / ↑z w : ℚ := ↑y / ↑z hz : z ≠ 0 hq : v ^ 2 + w ^ 2 = 1 hvz : v ≠ 0 hw1 : w ≠ -1 hQ : ∀ (x : ℚ), 1 + x ^ 2 ≠ 0 hp : (v, w) ∈ {p | p.fst ^ 2 + p.snd ^ 2 = 1 ∧ p.snd ≠ -1} q : (fun x => ℚ) { val := (v, w), property := hp } := ↑(circleEquivGen hQ).symm { val := (v, w), property := hp } ht4 : v = 2 * q / (1 + q ^ 2) ∧ w = (1 - q ^ 2) / (1 + q ^ 2) m : ℤ := ↑q.den n : ℤ := q.num hm0 : m ≠ 0 hq2 : q = ↑n / ↑m hm2n2 : 0 < m ^ 2 + n ^ 2 hm2n20 : ↑m ^ 2 + ↑n ^ 2 ≠ 0 hx1 : ∀ {j k : ℚ}, k ≠ 0 → k ^ 2 + j ^ 2 ≠ 0 → (1 - (j / k) ^ 2) / (1 + (j / k) ^ 2) = (k ^ 2 - j ^ 2) / (k ^ 2 + j ^ 2) hw2 : w = (↑m ^ 2 - ↑n ^ 2) / (↑m ^ 2 + ↑n ^ 2) hx2 : ∀ {j k : ℚ}, k ≠ 0 → k ^ 2 + j ^ 2 ≠ 0 → 2 * (j / k) / (1 + (j / k) ^ 2) = 2 * k * j / (k ^ 2 + j ^ 2) hv2 : v = 2 * ↑m * ↑n / (↑m ^ 2 + ↑n ^ 2) hnmcp : Int.gcd n m = 1 hmncp : Int.gcd m n = 1 hm2 : m % 2 = 1 hn2 : n % 2 = 1 h1 : 2 ∣ m ^ 2 + n ^ 2 ∧ 2 ∣ m ^ 2 - n ^ 2 ∧ (m ^ 2 - n ^ 2) / 2 % 2 = 0 ∧ Int.gcd ((m ^ 2 - n ^ 2) / 2) ((m ^ 2 + n ^ 2) / 2) = 1 ⊢ 0 * 2 < (m ^ 2 + n ^ 2) / 2 * 2 [PROOFSTEP] rw [Int.ediv_mul_cancel h1.1, zero_mul] [GOAL] x y z : ℤ h : PythagoreanTriple x y z hc : Int.gcd x y = 1 hyo : y % 2 = 1 hzpos : 0 < z h0 : ¬x = 0 v : ℚ := ↑x / ↑z w : ℚ := ↑y / ↑z hz : z ≠ 0 hq : v ^ 2 + w ^ 2 = 1 hvz : v ≠ 0 hw1 : w ≠ -1 hQ : ∀ (x : ℚ), 1 + x ^ 2 ≠ 0 hp : (v, w) ∈ {p | p.fst ^ 2 + p.snd ^ 2 = 1 ∧ p.snd ≠ -1} q : (fun x => ℚ) { val := (v, w), property := hp } := ↑(circleEquivGen hQ).symm { val := (v, w), property := hp } ht4 : v = 2 * q / (1 + q ^ 2) ∧ w = (1 - q ^ 2) / (1 + q ^ 2) m : ℤ := ↑q.den n : ℤ := q.num hm0 : m ≠ 0 hq2 : q = ↑n / ↑m hm2n2 : 0 < m ^ 2 + n ^ 2 hm2n20 : ↑m ^ 2 + ↑n ^ 2 ≠ 0 hx1 : ∀ {j k : ℚ}, k ≠ 0 → k ^ 2 + j ^ 2 ≠ 0 → (1 - (j / k) ^ 2) / (1 + (j / k) ^ 2) = (k ^ 2 - j ^ 2) / (k ^ 2 + j ^ 2) hw2 : w = (↑m ^ 2 - ↑n ^ 2) / (↑m ^ 2 + ↑n ^ 2) hx2 : ∀ {j k : ℚ}, k ≠ 0 → k ^ 2 + j ^ 2 ≠ 0 → 2 * (j / k) / (1 + (j / k) ^ 2) = 2 * k * j / (k ^ 2 + j ^ 2) hv2 : v = 2 * ↑m * ↑n / (↑m ^ 2 + ↑n ^ 2) hnmcp : Int.gcd n m = 1 hmncp : Int.gcd m n = 1 hm2 : m % 2 = 1 hn2 : n % 2 = 1 h1 : 2 ∣ m ^ 2 + n ^ 2 ∧ 2 ∣ m ^ 2 - n ^ 2 ∧ (m ^ 2 - n ^ 2) / 2 % 2 = 0 ∧ Int.gcd ((m ^ 2 - n ^ 2) / 2) ((m ^ 2 + n ^ 2) / 2) = 1 ⊢ 0 < m ^ 2 + n ^ 2 [PROOFSTEP] exact hm2n2 [GOAL] case neg.inr.inr.h x y z : ℤ h : PythagoreanTriple x y z hc : Int.gcd x y = 1 hyo : y % 2 = 1 hzpos : 0 < z h0 : ¬x = 0 v : ℚ := ↑x / ↑z w : ℚ := ↑y / ↑z hz : z ≠ 0 hq : v ^ 2 + w ^ 2 = 1 hvz : v ≠ 0 hw1 : w ≠ -1 hQ : ∀ (x : ℚ), 1 + x ^ 2 ≠ 0 hp : (v, w) ∈ {p | p.fst ^ 2 + p.snd ^ 2 = 1 ∧ p.snd ≠ -1} q : (fun x => ℚ) { val := (v, w), property := hp } := ↑(circleEquivGen hQ).symm { val := (v, w), property := hp } ht4 : v = 2 * q / (1 + q ^ 2) ∧ w = (1 - q ^ 2) / (1 + q ^ 2) m : ℤ := ↑q.den n : ℤ := q.num hm0 : m ≠ 0 hq2 : q = ↑n / ↑m hm2n2 : 0 < m ^ 2 + n ^ 2 hm2n20 : ↑m ^ 2 + ↑n ^ 2 ≠ 0 hx1 : ∀ {j k : ℚ}, k ≠ 0 → k ^ 2 + j ^ 2 ≠ 0 → (1 - (j / k) ^ 2) / (1 + (j / k) ^ 2) = (k ^ 2 - j ^ 2) / (k ^ 2 + j ^ 2) hw2 : w = (↑m ^ 2 - ↑n ^ 2) / (↑m ^ 2 + ↑n ^ 2) hx2 : ∀ {j k : ℚ}, k ≠ 0 → k ^ 2 + j ^ 2 ≠ 0 → 2 * (j / k) / (1 + (j / k) ^ 2) = 2 * k * j / (k ^ 2 + j ^ 2) hv2 : v = 2 * ↑m * ↑n / (↑m ^ 2 + ↑n ^ 2) hnmcp : Int.gcd n m = 1 hmncp : Int.gcd m n = 1 hm2 : m % 2 = 1 hn2 : n % 2 = 1 h1 : 2 ∣ m ^ 2 + n ^ 2 ∧ 2 ∣ m ^ 2 - n ^ 2 ∧ (m ^ 2 - n ^ 2) / 2 % 2 = 0 ∧ Int.gcd ((m ^ 2 - n ^ 2) / 2) ((m ^ 2 + n ^ 2) / 2) = 1 h2 : y = (m ^ 2 - n ^ 2) / 2 ∧ z = (m ^ 2 + n ^ 2) / 2 ⊢ False [PROOFSTEP] rw [h2.1, h1.2.2.1] at hyo [GOAL] case neg.inr.inr.h x y z : ℤ h : PythagoreanTriple x y z hc : Int.gcd x y = 1 hzpos : 0 < z h0 : ¬x = 0 v : ℚ := ↑x / ↑z w : ℚ := ↑y / ↑z hz : z ≠ 0 hq : v ^ 2 + w ^ 2 = 1 hvz : v ≠ 0 hw1 : w ≠ -1 hQ : ∀ (x : ℚ), 1 + x ^ 2 ≠ 0 hp : (v, w) ∈ {p | p.fst ^ 2 + p.snd ^ 2 = 1 ∧ p.snd ≠ -1} q : (fun x => ℚ) { val := (v, w), property := hp } := ↑(circleEquivGen hQ).symm { val := (v, w), property := hp } ht4 : v = 2 * q / (1 + q ^ 2) ∧ w = (1 - q ^ 2) / (1 + q ^ 2) m : ℤ := ↑q.den n : ℤ := q.num hyo : 0 = 1 hm0 : m ≠ 0 hq2 : q = ↑n / ↑m hm2n2 : 0 < m ^ 2 + n ^ 2 hm2n20 : ↑m ^ 2 + ↑n ^ 2 ≠ 0 hx1 : ∀ {j k : ℚ}, k ≠ 0 → k ^ 2 + j ^ 2 ≠ 0 → (1 - (j / k) ^ 2) / (1 + (j / k) ^ 2) = (k ^ 2 - j ^ 2) / (k ^ 2 + j ^ 2) hw2 : w = (↑m ^ 2 - ↑n ^ 2) / (↑m ^ 2 + ↑n ^ 2) hx2 : ∀ {j k : ℚ}, k ≠ 0 → k ^ 2 + j ^ 2 ≠ 0 → 2 * (j / k) / (1 + (j / k) ^ 2) = 2 * k * j / (k ^ 2 + j ^ 2) hv2 : v = 2 * ↑m * ↑n / (↑m ^ 2 + ↑n ^ 2) hnmcp : Int.gcd n m = 1 hmncp : Int.gcd m n = 1 hm2 : m % 2 = 1 hn2 : n % 2 = 1 h1 : 2 ∣ m ^ 2 + n ^ 2 ∧ 2 ∣ m ^ 2 - n ^ 2 ∧ (m ^ 2 - n ^ 2) / 2 % 2 = 0 ∧ Int.gcd ((m ^ 2 - n ^ 2) / 2) ((m ^ 2 + n ^ 2) / 2) = 1 h2 : y = (m ^ 2 - n ^ 2) / 2 ∧ z = (m ^ 2 + n ^ 2) / 2 ⊢ False [PROOFSTEP] revert hyo [GOAL] case neg.inr.inr.h x y z : ℤ h : PythagoreanTriple x y z hc : Int.gcd x y = 1 hzpos : 0 < z h0 : ¬x = 0 v : ℚ := ↑x / ↑z w : ℚ := ↑y / ↑z hz : z ≠ 0 hq : v ^ 2 + w ^ 2 = 1 hvz : v ≠ 0 hw1 : w ≠ -1 hQ : ∀ (x : ℚ), 1 + x ^ 2 ≠ 0 hp : (v, w) ∈ {p | p.fst ^ 2 + p.snd ^ 2 = 1 ∧ p.snd ≠ -1} q : (fun x => ℚ) { val := (v, w), property := hp } := ↑(circleEquivGen hQ).symm { val := (v, w), property := hp } ht4 : v = 2 * q / (1 + q ^ 2) ∧ w = (1 - q ^ 2) / (1 + q ^ 2) m : ℤ := ↑q.den n : ℤ := q.num hm0 : m ≠ 0 hq2 : q = ↑n / ↑m hm2n2 : 0 < m ^ 2 + n ^ 2 hm2n20 : ↑m ^ 2 + ↑n ^ 2 ≠ 0 hx1 : ∀ {j k : ℚ}, k ≠ 0 → k ^ 2 + j ^ 2 ≠ 0 → (1 - (j / k) ^ 2) / (1 + (j / k) ^ 2) = (k ^ 2 - j ^ 2) / (k ^ 2 + j ^ 2) hw2 : w = (↑m ^ 2 - ↑n ^ 2) / (↑m ^ 2 + ↑n ^ 2) hx2 : ∀ {j k : ℚ}, k ≠ 0 → k ^ 2 + j ^ 2 ≠ 0 → 2 * (j / k) / (1 + (j / k) ^ 2) = 2 * k * j / (k ^ 2 + j ^ 2) hv2 : v = 2 * ↑m * ↑n / (↑m ^ 2 + ↑n ^ 2) hnmcp : Int.gcd n m = 1 hmncp : Int.gcd m n = 1 hm2 : m % 2 = 1 hn2 : n % 2 = 1 h1 : 2 ∣ m ^ 2 + n ^ 2 ∧ 2 ∣ m ^ 2 - n ^ 2 ∧ (m ^ 2 - n ^ 2) / 2 % 2 = 0 ∧ Int.gcd ((m ^ 2 - n ^ 2) / 2) ((m ^ 2 + n ^ 2) / 2) = 1 h2 : y = (m ^ 2 - n ^ 2) / 2 ∧ z = (m ^ 2 + n ^ 2) / 2 ⊢ 0 = 1 → False [PROOFSTEP] norm_num [GOAL] x y z : ℤ h : PythagoreanTriple x y z hc : Int.gcd x y = 1 hzpos : 0 < z ⊢ IsPrimitiveClassified h [PROOFSTEP] cases' h.even_odd_of_coprime hc with h1 h2 [GOAL] case inl x y z : ℤ h : PythagoreanTriple x y z hc : Int.gcd x y = 1 hzpos : 0 < z h1 : x % 2 = 0 ∧ y % 2 = 1 ⊢ IsPrimitiveClassified h [PROOFSTEP] exact h.isPrimitiveClassified_of_coprime_of_odd_of_pos hc h1.right hzpos [GOAL] case inr x y z : ℤ h : PythagoreanTriple x y z hc : Int.gcd x y = 1 hzpos : 0 < z h2 : x % 2 = 1 ∧ y % 2 = 0 ⊢ IsPrimitiveClassified h [PROOFSTEP] rw [Int.gcd_comm] at hc [GOAL] case inr x y z : ℤ h : PythagoreanTriple x y z hc : Int.gcd y x = 1 hzpos : 0 < z h2 : x % 2 = 1 ∧ y % 2 = 0 ⊢ IsPrimitiveClassified h [PROOFSTEP] obtain ⟨m, n, H⟩ := h.symm.isPrimitiveClassified_of_coprime_of_odd_of_pos hc h2.left hzpos [GOAL] case inr.intro.intro x y z : ℤ h : PythagoreanTriple x y z hc : Int.gcd y x = 1 hzpos : 0 < z h2 : x % 2 = 1 ∧ y % 2 = 0 m n : ℤ H : (y = m ^ 2 - n ^ 2 ∧ x = 2 * m * n ∨ y = 2 * m * n ∧ x = m ^ 2 - n ^ 2) ∧ Int.gcd m n = 1 ∧ (m % 2 = 0 ∧ n % 2 = 1 ∨ m % 2 = 1 ∧ n % 2 = 0) ⊢ IsPrimitiveClassified h [PROOFSTEP] use m, n [GOAL] case h x y z : ℤ h : PythagoreanTriple x y z hc : Int.gcd y x = 1 hzpos : 0 < z h2 : x % 2 = 1 ∧ y % 2 = 0 m n : ℤ H : (y = m ^ 2 - n ^ 2 ∧ x = 2 * m * n ∨ y = 2 * m * n ∧ x = m ^ 2 - n ^ 2) ∧ Int.gcd m n = 1 ∧ (m % 2 = 0 ∧ n % 2 = 1 ∨ m % 2 = 1 ∧ n % 2 = 0) ⊢ (x = m ^ 2 - n ^ 2 ∧ y = 2 * m * n ∨ x = 2 * m * n ∧ y = m ^ 2 - n ^ 2) ∧ Int.gcd m n = 1 ∧ (m % 2 = 0 ∧ n % 2 = 1 ∨ m % 2 = 1 ∧ n % 2 = 0) [PROOFSTEP] tauto [GOAL] x y z : ℤ h : PythagoreanTriple x y z hc : Int.gcd x y = 1 ⊢ IsPrimitiveClassified h [PROOFSTEP] by_cases hz : 0 < z [GOAL] case pos x y z : ℤ h : PythagoreanTriple x y z hc : Int.gcd x y = 1 hz : 0 < z ⊢ IsPrimitiveClassified h [PROOFSTEP] exact h.isPrimitiveClassified_of_coprime_of_pos hc hz [GOAL] case neg x y z : ℤ h : PythagoreanTriple x y z hc : Int.gcd x y = 1 hz : ¬0 < z ⊢ IsPrimitiveClassified h [PROOFSTEP] have h' : PythagoreanTriple x y (-z) := by simpa [PythagoreanTriple, neg_mul_neg] using h.eq [GOAL] x y z : ℤ h : PythagoreanTriple x y z hc : Int.gcd x y = 1 hz : ¬0 < z ⊢ PythagoreanTriple x y (-z) [PROOFSTEP] simpa [PythagoreanTriple, neg_mul_neg] using h.eq [GOAL] case neg x y z : ℤ h : PythagoreanTriple x y z hc : Int.gcd x y = 1 hz : ¬0 < z h' : PythagoreanTriple x y (-z) ⊢ IsPrimitiveClassified h [PROOFSTEP] apply h'.isPrimitiveClassified_of_coprime_of_pos hc [GOAL] case neg x y z : ℤ h : PythagoreanTriple x y z hc : Int.gcd x y = 1 hz : ¬0 < z h' : PythagoreanTriple x y (-z) ⊢ 0 < -z [PROOFSTEP] apply lt_of_le_of_ne _ (h'.ne_zero_of_coprime hc).symm [GOAL] x y z : ℤ h : PythagoreanTriple x y z hc : Int.gcd x y = 1 hz : ¬0 < z h' : PythagoreanTriple x y (-z) ⊢ 0 ≤ -z [PROOFSTEP] exact le_neg.mp (not_lt.mp hz) [GOAL] x y z : ℤ h : PythagoreanTriple x y z ⊢ IsClassified h [PROOFSTEP] by_cases h0 : Int.gcd x y = 0 [GOAL] case pos x y z : ℤ h : PythagoreanTriple x y z h0 : Int.gcd x y = 0 ⊢ IsClassified h [PROOFSTEP] have hx : x = 0 := by apply Int.natAbs_eq_zero.mp apply Nat.eq_zero_of_gcd_eq_zero_left h0 [GOAL] x y z : ℤ h : PythagoreanTriple x y z h0 : Int.gcd x y = 0 ⊢ x = 0 [PROOFSTEP] apply Int.natAbs_eq_zero.mp [GOAL] x y z : ℤ h : PythagoreanTriple x y z h0 : Int.gcd x y = 0 ⊢ Int.natAbs x = 0 [PROOFSTEP] apply Nat.eq_zero_of_gcd_eq_zero_left h0 [GOAL] case pos x y z : ℤ h : PythagoreanTriple x y z h0 : Int.gcd x y = 0 hx : x = 0 ⊢ IsClassified h [PROOFSTEP] have hy : y = 0 := by apply Int.natAbs_eq_zero.mp apply Nat.eq_zero_of_gcd_eq_zero_right h0 [GOAL] x y z : ℤ h : PythagoreanTriple x y z h0 : Int.gcd x y = 0 hx : x = 0 ⊢ y = 0 [PROOFSTEP] apply Int.natAbs_eq_zero.mp [GOAL] x y z : ℤ h : PythagoreanTriple x y z h0 : Int.gcd x y = 0 hx : x = 0 ⊢ Int.natAbs y = 0 [PROOFSTEP] apply Nat.eq_zero_of_gcd_eq_zero_right h0 [GOAL] case pos x y z : ℤ h : PythagoreanTriple x y z h0 : Int.gcd x y = 0 hx : x = 0 hy : y = 0 ⊢ IsClassified h [PROOFSTEP] use 0, 1, 0 [GOAL] case h x y z : ℤ h : PythagoreanTriple x y z h0 : Int.gcd x y = 0 hx : x = 0 hy : y = 0 ⊢ (x = 0 * (1 ^ 2 - 0 ^ 2) ∧ y = 0 * (2 * 1 * 0) ∨ x = 0 * (2 * 1 * 0) ∧ y = 0 * (1 ^ 2 - 0 ^ 2)) ∧ Int.gcd 1 0 = 1 [PROOFSTEP] field_simp [hx, hy] [GOAL] case neg x y z : ℤ h : PythagoreanTriple x y z h0 : ¬Int.gcd x y = 0 ⊢ IsClassified h [PROOFSTEP] apply h.isClassified_of_normalize_isPrimitiveClassified [GOAL] case neg x y z : ℤ h : PythagoreanTriple x y z h0 : ¬Int.gcd x y = 0 ⊢ IsPrimitiveClassified (_ : PythagoreanTriple (x / ↑(Int.gcd x y)) (y / ↑(Int.gcd x y)) (z / ↑(Int.gcd x y))) [PROOFSTEP] apply h.normalize.isPrimitiveClassified_of_coprime [GOAL] case neg x y z : ℤ h : PythagoreanTriple x y z h0 : ¬Int.gcd x y = 0 ⊢ Int.gcd (x / ↑(Int.gcd x y)) (y / ↑(Int.gcd x y)) = 1 [PROOFSTEP] apply Int.gcd_div_gcd_div_gcd (Nat.pos_of_ne_zero h0) [GOAL] x y z : ℤ h : PythagoreanTriple x y z ⊢ PythagoreanTriple x y z ∧ Int.gcd x y = 1 ↔ ∃ m n, (x = m ^ 2 - n ^ 2 ∧ y = 2 * m * n ∨ x = 2 * m * n ∧ y = m ^ 2 - n ^ 2) ∧ (z = m ^ 2 + n ^ 2 ∨ z = -(m ^ 2 + n ^ 2)) ∧ Int.gcd m n = 1 ∧ (m % 2 = 0 ∧ n % 2 = 1 ∨ m % 2 = 1 ∧ n % 2 = 0) [PROOFSTEP] clear h [GOAL] x y z : ℤ ⊢ PythagoreanTriple x y z ∧ Int.gcd x y = 1 ↔ ∃ m n, (x = m ^ 2 - n ^ 2 ∧ y = 2 * m * n ∨ x = 2 * m * n ∧ y = m ^ 2 - n ^ 2) ∧ (z = m ^ 2 + n ^ 2 ∨ z = -(m ^ 2 + n ^ 2)) ∧ Int.gcd m n = 1 ∧ (m % 2 = 0 ∧ n % 2 = 1 ∨ m % 2 = 1 ∧ n % 2 = 0) [PROOFSTEP] constructor [GOAL] case mp x y z : ℤ ⊢ PythagoreanTriple x y z ∧ Int.gcd x y = 1 → ∃ m n, (x = m ^ 2 - n ^ 2 ∧ y = 2 * m * n ∨ x = 2 * m * n ∧ y = m ^ 2 - n ^ 2) ∧ (z = m ^ 2 + n ^ 2 ∨ z = -(m ^ 2 + n ^ 2)) ∧ Int.gcd m n = 1 ∧ (m % 2 = 0 ∧ n % 2 = 1 ∨ m % 2 = 1 ∧ n % 2 = 0) [PROOFSTEP] intro h [GOAL] case mp x y z : ℤ h : PythagoreanTriple x y z ∧ Int.gcd x y = 1 ⊢ ∃ m n, (x = m ^ 2 - n ^ 2 ∧ y = 2 * m * n ∨ x = 2 * m * n ∧ y = m ^ 2 - n ^ 2) ∧ (z = m ^ 2 + n ^ 2 ∨ z = -(m ^ 2 + n ^ 2)) ∧ Int.gcd m n = 1 ∧ (m % 2 = 0 ∧ n % 2 = 1 ∨ m % 2 = 1 ∧ n % 2 = 0) [PROOFSTEP] obtain ⟨m, n, H⟩ := h.left.isPrimitiveClassified_of_coprime h.right [GOAL] case mp.intro.intro x y z : ℤ h : PythagoreanTriple x y z ∧ Int.gcd x y = 1 m n : ℤ H : (x = m ^ 2 - n ^ 2 ∧ y = 2 * m * n ∨ x = 2 * m * n ∧ y = m ^ 2 - n ^ 2) ∧ Int.gcd m n = 1 ∧ (m % 2 = 0 ∧ n % 2 = 1 ∨ m % 2 = 1 ∧ n % 2 = 0) ⊢ ∃ m n, (x = m ^ 2 - n ^ 2 ∧ y = 2 * m * n ∨ x = 2 * m * n ∧ y = m ^ 2 - n ^ 2) ∧ (z = m ^ 2 + n ^ 2 ∨ z = -(m ^ 2 + n ^ 2)) ∧ Int.gcd m n = 1 ∧ (m % 2 = 0 ∧ n % 2 = 1 ∨ m % 2 = 1 ∧ n % 2 = 0) [PROOFSTEP] use m, n [GOAL] case h x y z : ℤ h : PythagoreanTriple x y z ∧ Int.gcd x y = 1 m n : ℤ H : (x = m ^ 2 - n ^ 2 ∧ y = 2 * m * n ∨ x = 2 * m * n ∧ y = m ^ 2 - n ^ 2) ∧ Int.gcd m n = 1 ∧ (m % 2 = 0 ∧ n % 2 = 1 ∨ m % 2 = 1 ∧ n % 2 = 0) ⊢ (x = m ^ 2 - n ^ 2 ∧ y = 2 * m * n ∨ x = 2 * m * n ∧ y = m ^ 2 - n ^ 2) ∧ (z = m ^ 2 + n ^ 2 ∨ z = -(m ^ 2 + n ^ 2)) ∧ Int.gcd m n = 1 ∧ (m % 2 = 0 ∧ n % 2 = 1 ∨ m % 2 = 1 ∧ n % 2 = 0) [PROOFSTEP] rcases H with ⟨⟨rfl, rfl⟩ | ⟨rfl, rfl⟩, co, pp⟩ [GOAL] case h.intro.inl.intro.intro z m n : ℤ h : PythagoreanTriple (m ^ 2 - n ^ 2) (2 * m * n) z ∧ Int.gcd (m ^ 2 - n ^ 2) (2 * m * n) = 1 co : Int.gcd m n = 1 pp : m % 2 = 0 ∧ n % 2 = 1 ∨ m % 2 = 1 ∧ n % 2 = 0 ⊢ (m ^ 2 - n ^ 2 = m ^ 2 - n ^ 2 ∧ 2 * m * n = 2 * m * n ∨ m ^ 2 - n ^ 2 = 2 * m * n ∧ 2 * m * n = m ^ 2 - n ^ 2) ∧ (z = m ^ 2 + n ^ 2 ∨ z = -(m ^ 2 + n ^ 2)) ∧ Int.gcd m n = 1 ∧ (m % 2 = 0 ∧ n % 2 = 1 ∨ m % 2 = 1 ∧ n % 2 = 0) [PROOFSTEP] refine' ⟨Or.inl ⟨rfl, rfl⟩, _, co, pp⟩ [GOAL] case h.intro.inl.intro.intro z m n : ℤ h : PythagoreanTriple (m ^ 2 - n ^ 2) (2 * m * n) z ∧ Int.gcd (m ^ 2 - n ^ 2) (2 * m * n) = 1 co : Int.gcd m n = 1 pp : m % 2 = 0 ∧ n % 2 = 1 ∨ m % 2 = 1 ∧ n % 2 = 0 ⊢ z = m ^ 2 + n ^ 2 ∨ z = -(m ^ 2 + n ^ 2) [PROOFSTEP] have : z ^ 2 = (m ^ 2 + n ^ 2) ^ 2 := by rw [sq, ← h.left.eq] ring [GOAL] z m n : ℤ h : PythagoreanTriple (m ^ 2 - n ^ 2) (2 * m * n) z ∧ Int.gcd (m ^ 2 - n ^ 2) (2 * m * n) = 1 co : Int.gcd m n = 1 pp : m % 2 = 0 ∧ n % 2 = 1 ∨ m % 2 = 1 ∧ n % 2 = 0 ⊢ z ^ 2 = (m ^ 2 + n ^ 2) ^ 2 [PROOFSTEP] rw [sq, ← h.left.eq] [GOAL] z m n : ℤ h : PythagoreanTriple (m ^ 2 - n ^ 2) (2 * m * n) z ∧ Int.gcd (m ^ 2 - n ^ 2) (2 * m * n) = 1 co : Int.gcd m n = 1 pp : m % 2 = 0 ∧ n % 2 = 1 ∨ m % 2 = 1 ∧ n % 2 = 0 ⊢ (m ^ 2 - n ^ 2) * (m ^ 2 - n ^ 2) + 2 * m * n * (2 * m * n) = (m ^ 2 + n ^ 2) ^ 2 [PROOFSTEP] ring [GOAL] case h.intro.inl.intro.intro z m n : ℤ h : PythagoreanTriple (m ^ 2 - n ^ 2) (2 * m * n) z ∧ Int.gcd (m ^ 2 - n ^ 2) (2 * m * n) = 1 co : Int.gcd m n = 1 pp : m % 2 = 0 ∧ n % 2 = 1 ∨ m % 2 = 1 ∧ n % 2 = 0 this : z ^ 2 = (m ^ 2 + n ^ 2) ^ 2 ⊢ z = m ^ 2 + n ^ 2 ∨ z = -(m ^ 2 + n ^ 2) [PROOFSTEP] simpa using eq_or_eq_neg_of_sq_eq_sq _ _ this [GOAL] case h.intro.inr.intro.intro z m n : ℤ h : PythagoreanTriple (2 * m * n) (m ^ 2 - n ^ 2) z ∧ Int.gcd (2 * m * n) (m ^ 2 - n ^ 2) = 1 co : Int.gcd m n = 1 pp : m % 2 = 0 ∧ n % 2 = 1 ∨ m % 2 = 1 ∧ n % 2 = 0 ⊢ (2 * m * n = m ^ 2 - n ^ 2 ∧ m ^ 2 - n ^ 2 = 2 * m * n ∨ 2 * m * n = 2 * m * n ∧ m ^ 2 - n ^ 2 = m ^ 2 - n ^ 2) ∧ (z = m ^ 2 + n ^ 2 ∨ z = -(m ^ 2 + n ^ 2)) ∧ Int.gcd m n = 1 ∧ (m % 2 = 0 ∧ n % 2 = 1 ∨ m % 2 = 1 ∧ n % 2 = 0) [PROOFSTEP] refine' ⟨Or.inr ⟨rfl, rfl⟩, _, co, pp⟩ [GOAL] case h.intro.inr.intro.intro z m n : ℤ h : PythagoreanTriple (2 * m * n) (m ^ 2 - n ^ 2) z ∧ Int.gcd (2 * m * n) (m ^ 2 - n ^ 2) = 1 co : Int.gcd m n = 1 pp : m % 2 = 0 ∧ n % 2 = 1 ∨ m % 2 = 1 ∧ n % 2 = 0 ⊢ z = m ^ 2 + n ^ 2 ∨ z = -(m ^ 2 + n ^ 2) [PROOFSTEP] have : z ^ 2 = (m ^ 2 + n ^ 2) ^ 2 := by rw [sq, ← h.left.eq] ring [GOAL] z m n : ℤ h : PythagoreanTriple (2 * m * n) (m ^ 2 - n ^ 2) z ∧ Int.gcd (2 * m * n) (m ^ 2 - n ^ 2) = 1 co : Int.gcd m n = 1 pp : m % 2 = 0 ∧ n % 2 = 1 ∨ m % 2 = 1 ∧ n % 2 = 0 ⊢ z ^ 2 = (m ^ 2 + n ^ 2) ^ 2 [PROOFSTEP] rw [sq, ← h.left.eq] [GOAL] z m n : ℤ h : PythagoreanTriple (2 * m * n) (m ^ 2 - n ^ 2) z ∧ Int.gcd (2 * m * n) (m ^ 2 - n ^ 2) = 1 co : Int.gcd m n = 1 pp : m % 2 = 0 ∧ n % 2 = 1 ∨ m % 2 = 1 ∧ n % 2 = 0 ⊢ 2 * m * n * (2 * m * n) + (m ^ 2 - n ^ 2) * (m ^ 2 - n ^ 2) = (m ^ 2 + n ^ 2) ^ 2 [PROOFSTEP] ring [GOAL] case h.intro.inr.intro.intro z m n : ℤ h : PythagoreanTriple (2 * m * n) (m ^ 2 - n ^ 2) z ∧ Int.gcd (2 * m * n) (m ^ 2 - n ^ 2) = 1 co : Int.gcd m n = 1 pp : m % 2 = 0 ∧ n % 2 = 1 ∨ m % 2 = 1 ∧ n % 2 = 0 this : z ^ 2 = (m ^ 2 + n ^ 2) ^ 2 ⊢ z = m ^ 2 + n ^ 2 ∨ z = -(m ^ 2 + n ^ 2) [PROOFSTEP] simpa using eq_or_eq_neg_of_sq_eq_sq _ _ this [GOAL] case mpr x y z : ℤ ⊢ (∃ m n, (x = m ^ 2 - n ^ 2 ∧ y = 2 * m * n ∨ x = 2 * m * n ∧ y = m ^ 2 - n ^ 2) ∧ (z = m ^ 2 + n ^ 2 ∨ z = -(m ^ 2 + n ^ 2)) ∧ Int.gcd m n = 1 ∧ (m % 2 = 0 ∧ n % 2 = 1 ∨ m % 2 = 1 ∧ n % 2 = 0)) → PythagoreanTriple x y z ∧ Int.gcd x y = 1 [PROOFSTEP] delta PythagoreanTriple [GOAL] case mpr x y z : ℤ ⊢ (∃ m n, (x = m ^ 2 - n ^ 2 ∧ y = 2 * m * n ∨ x = 2 * m * n ∧ y = m ^ 2 - n ^ 2) ∧ (z = m ^ 2 + n ^ 2 ∨ z = -(m ^ 2 + n ^ 2)) ∧ Int.gcd m n = 1 ∧ (m % 2 = 0 ∧ n % 2 = 1 ∨ m % 2 = 1 ∧ n % 2 = 0)) → x * x + y * y = z * z ∧ Int.gcd x y = 1 [PROOFSTEP] rintro ⟨m, n, ⟨rfl, rfl⟩ | ⟨rfl, rfl⟩, rfl | rfl, co, pp⟩ [GOAL] case mpr.intro.intro.intro.inl.intro.intro.inl.intro m n : ℤ co : Int.gcd m n = 1 pp : m % 2 = 0 ∧ n % 2 = 1 ∨ m % 2 = 1 ∧ n % 2 = 0 ⊢ (m ^ 2 - n ^ 2) * (m ^ 2 - n ^ 2) + 2 * m * n * (2 * m * n) = (m ^ 2 + n ^ 2) * (m ^ 2 + n ^ 2) ∧ Int.gcd (m ^ 2 - n ^ 2) (2 * m * n) = 1 [PROOFSTEP] first | constructor; ring; exact coprime_sq_sub_mul co pp | constructor; ring; rw [Int.gcd_comm]; exact coprime_sq_sub_mul co pp [GOAL] case mpr.intro.intro.intro.inl.intro.intro.inl.intro m n : ℤ co : Int.gcd m n = 1 pp : m % 2 = 0 ∧ n % 2 = 1 ∨ m % 2 = 1 ∧ n % 2 = 0 ⊢ (m ^ 2 - n ^ 2) * (m ^ 2 - n ^ 2) + 2 * m * n * (2 * m * n) = (m ^ 2 + n ^ 2) * (m ^ 2 + n ^ 2) ∧ Int.gcd (m ^ 2 - n ^ 2) (2 * m * n) = 1 [PROOFSTEP] constructor [GOAL] case mpr.intro.intro.intro.inl.intro.intro.inl.intro.left m n : ℤ co : Int.gcd m n = 1 pp : m % 2 = 0 ∧ n % 2 = 1 ∨ m % 2 = 1 ∧ n % 2 = 0 ⊢ (m ^ 2 - n ^ 2) * (m ^ 2 - n ^ 2) + 2 * m * n * (2 * m * n) = (m ^ 2 + n ^ 2) * (m ^ 2 + n ^ 2) case mpr.intro.intro.intro.inl.intro.intro.inl.intro.right m n : ℤ co : Int.gcd m n = 1 pp : m % 2 = 0 ∧ n % 2 = 1 ∨ m % 2 = 1 ∧ n % 2 = 0 ⊢ Int.gcd (m ^ 2 - n ^ 2) (2 * m * n) = 1 [PROOFSTEP] ring [GOAL] case mpr.intro.intro.intro.inl.intro.intro.inl.intro.right m n : ℤ co : Int.gcd m n = 1 pp : m % 2 = 0 ∧ n % 2 = 1 ∨ m % 2 = 1 ∧ n % 2 = 0 ⊢ Int.gcd (m ^ 2 - n ^ 2) (2 * m * n) = 1 [PROOFSTEP] exact coprime_sq_sub_mul co pp [GOAL] case mpr.intro.intro.intro.inl.intro.intro.inr.intro m n : ℤ co : Int.gcd m n = 1 pp : m % 2 = 0 ∧ n % 2 = 1 ∨ m % 2 = 1 ∧ n % 2 = 0 ⊢ (m ^ 2 - n ^ 2) * (m ^ 2 - n ^ 2) + 2 * m * n * (2 * m * n) = -(m ^ 2 + n ^ 2) * -(m ^ 2 + n ^ 2) ∧ Int.gcd (m ^ 2 - n ^ 2) (2 * m * n) = 1 [PROOFSTEP] first | constructor; ring; exact coprime_sq_sub_mul co pp | constructor; ring; rw [Int.gcd_comm]; exact coprime_sq_sub_mul co pp [GOAL] case mpr.intro.intro.intro.inl.intro.intro.inr.intro m n : ℤ co : Int.gcd m n = 1 pp : m % 2 = 0 ∧ n % 2 = 1 ∨ m % 2 = 1 ∧ n % 2 = 0 ⊢ (m ^ 2 - n ^ 2) * (m ^ 2 - n ^ 2) + 2 * m * n * (2 * m * n) = -(m ^ 2 + n ^ 2) * -(m ^ 2 + n ^ 2) ∧ Int.gcd (m ^ 2 - n ^ 2) (2 * m * n) = 1 [PROOFSTEP] constructor [GOAL] case mpr.intro.intro.intro.inl.intro.intro.inr.intro.left m n : ℤ co : Int.gcd m n = 1 pp : m % 2 = 0 ∧ n % 2 = 1 ∨ m % 2 = 1 ∧ n % 2 = 0 ⊢ (m ^ 2 - n ^ 2) * (m ^ 2 - n ^ 2) + 2 * m * n * (2 * m * n) = -(m ^ 2 + n ^ 2) * -(m ^ 2 + n ^ 2) case mpr.intro.intro.intro.inl.intro.intro.inr.intro.right m n : ℤ co : Int.gcd m n = 1 pp : m % 2 = 0 ∧ n % 2 = 1 ∨ m % 2 = 1 ∧ n % 2 = 0 ⊢ Int.gcd (m ^ 2 - n ^ 2) (2 * m * n) = 1 [PROOFSTEP] ring [GOAL] case mpr.intro.intro.intro.inl.intro.intro.inr.intro.right m n : ℤ co : Int.gcd m n = 1 pp : m % 2 = 0 ∧ n % 2 = 1 ∨ m % 2 = 1 ∧ n % 2 = 0 ⊢ Int.gcd (m ^ 2 - n ^ 2) (2 * m * n) = 1 [PROOFSTEP] exact coprime_sq_sub_mul co pp [GOAL] case mpr.intro.intro.intro.inr.intro.intro.inl.intro m n : ℤ co : Int.gcd m n = 1 pp : m % 2 = 0 ∧ n % 2 = 1 ∨ m % 2 = 1 ∧ n % 2 = 0 ⊢ 2 * m * n * (2 * m * n) + (m ^ 2 - n ^ 2) * (m ^ 2 - n ^ 2) = (m ^ 2 + n ^ 2) * (m ^ 2 + n ^ 2) ∧ Int.gcd (2 * m * n) (m ^ 2 - n ^ 2) = 1 [PROOFSTEP] first | constructor; ring; exact coprime_sq_sub_mul co pp | constructor; ring; rw [Int.gcd_comm]; exact coprime_sq_sub_mul co pp [GOAL] case mpr.intro.intro.intro.inr.intro.intro.inl.intro m n : ℤ co : Int.gcd m n = 1 pp : m % 2 = 0 ∧ n % 2 = 1 ∨ m % 2 = 1 ∧ n % 2 = 0 ⊢ 2 * m * n * (2 * m * n) + (m ^ 2 - n ^ 2) * (m ^ 2 - n ^ 2) = (m ^ 2 + n ^ 2) * (m ^ 2 + n ^ 2) ∧ Int.gcd (2 * m * n) (m ^ 2 - n ^ 2) = 1 [PROOFSTEP] constructor [GOAL] case mpr.intro.intro.intro.inr.intro.intro.inl.intro.left m n : ℤ co : Int.gcd m n = 1 pp : m % 2 = 0 ∧ n % 2 = 1 ∨ m % 2 = 1 ∧ n % 2 = 0 ⊢ 2 * m * n * (2 * m * n) + (m ^ 2 - n ^ 2) * (m ^ 2 - n ^ 2) = (m ^ 2 + n ^ 2) * (m ^ 2 + n ^ 2) case mpr.intro.intro.intro.inr.intro.intro.inl.intro.right m n : ℤ co : Int.gcd m n = 1 pp : m % 2 = 0 ∧ n % 2 = 1 ∨ m % 2 = 1 ∧ n % 2 = 0 ⊢ Int.gcd (2 * m * n) (m ^ 2 - n ^ 2) = 1 [PROOFSTEP] ring [GOAL] case mpr.intro.intro.intro.inr.intro.intro.inl.intro.right m n : ℤ co : Int.gcd m n = 1 pp : m % 2 = 0 ∧ n % 2 = 1 ∨ m % 2 = 1 ∧ n % 2 = 0 ⊢ Int.gcd (2 * m * n) (m ^ 2 - n ^ 2) = 1 [PROOFSTEP] exact coprime_sq_sub_mul co pp [GOAL] case mpr.intro.intro.intro.inr.intro.intro.inl.intro m n : ℤ co : Int.gcd m n = 1 pp : m % 2 = 0 ∧ n % 2 = 1 ∨ m % 2 = 1 ∧ n % 2 = 0 ⊢ 2 * m * n * (2 * m * n) + (m ^ 2 - n ^ 2) * (m ^ 2 - n ^ 2) = (m ^ 2 + n ^ 2) * (m ^ 2 + n ^ 2) ∧ Int.gcd (2 * m * n) (m ^ 2 - n ^ 2) = 1 [PROOFSTEP] constructor [GOAL] case mpr.intro.intro.intro.inr.intro.intro.inl.intro.left m n : ℤ co : Int.gcd m n = 1 pp : m % 2 = 0 ∧ n % 2 = 1 ∨ m % 2 = 1 ∧ n % 2 = 0 ⊢ 2 * m * n * (2 * m * n) + (m ^ 2 - n ^ 2) * (m ^ 2 - n ^ 2) = (m ^ 2 + n ^ 2) * (m ^ 2 + n ^ 2) case mpr.intro.intro.intro.inr.intro.intro.inl.intro.right m n : ℤ co : Int.gcd m n = 1 pp : m % 2 = 0 ∧ n % 2 = 1 ∨ m % 2 = 1 ∧ n % 2 = 0 ⊢ Int.gcd (2 * m * n) (m ^ 2 - n ^ 2) = 1 [PROOFSTEP] ring [GOAL] case mpr.intro.intro.intro.inr.intro.intro.inl.intro.right m n : ℤ co : Int.gcd m n = 1 pp : m % 2 = 0 ∧ n % 2 = 1 ∨ m % 2 = 1 ∧ n % 2 = 0 ⊢ Int.gcd (2 * m * n) (m ^ 2 - n ^ 2) = 1 [PROOFSTEP] rw [Int.gcd_comm] [GOAL] case mpr.intro.intro.intro.inr.intro.intro.inl.intro.right m n : ℤ co : Int.gcd m n = 1 pp : m % 2 = 0 ∧ n % 2 = 1 ∨ m % 2 = 1 ∧ n % 2 = 0 ⊢ Int.gcd (m ^ 2 - n ^ 2) (2 * m * n) = 1 [PROOFSTEP] exact coprime_sq_sub_mul co pp [GOAL] case mpr.intro.intro.intro.inr.intro.intro.inr.intro m n : ℤ co : Int.gcd m n = 1 pp : m % 2 = 0 ∧ n % 2 = 1 ∨ m % 2 = 1 ∧ n % 2 = 0 ⊢ 2 * m * n * (2 * m * n) + (m ^ 2 - n ^ 2) * (m ^ 2 - n ^ 2) = -(m ^ 2 + n ^ 2) * -(m ^ 2 + n ^ 2) ∧ Int.gcd (2 * m * n) (m ^ 2 - n ^ 2) = 1 [PROOFSTEP] first | constructor; ring; exact coprime_sq_sub_mul co pp | constructor; ring; rw [Int.gcd_comm]; exact coprime_sq_sub_mul co pp [GOAL] case mpr.intro.intro.intro.inr.intro.intro.inr.intro m n : ℤ co : Int.gcd m n = 1 pp : m % 2 = 0 ∧ n % 2 = 1 ∨ m % 2 = 1 ∧ n % 2 = 0 ⊢ 2 * m * n * (2 * m * n) + (m ^ 2 - n ^ 2) * (m ^ 2 - n ^ 2) = -(m ^ 2 + n ^ 2) * -(m ^ 2 + n ^ 2) ∧ Int.gcd (2 * m * n) (m ^ 2 - n ^ 2) = 1 [PROOFSTEP] constructor [GOAL] case mpr.intro.intro.intro.inr.intro.intro.inr.intro.left m n : ℤ co : Int.gcd m n = 1 pp : m % 2 = 0 ∧ n % 2 = 1 ∨ m % 2 = 1 ∧ n % 2 = 0 ⊢ 2 * m * n * (2 * m * n) + (m ^ 2 - n ^ 2) * (m ^ 2 - n ^ 2) = -(m ^ 2 + n ^ 2) * -(m ^ 2 + n ^ 2) case mpr.intro.intro.intro.inr.intro.intro.inr.intro.right m n : ℤ co : Int.gcd m n = 1 pp : m % 2 = 0 ∧ n % 2 = 1 ∨ m % 2 = 1 ∧ n % 2 = 0 ⊢ Int.gcd (2 * m * n) (m ^ 2 - n ^ 2) = 1 [PROOFSTEP] ring [GOAL] case mpr.intro.intro.intro.inr.intro.intro.inr.intro.right m n : ℤ co : Int.gcd m n = 1 pp : m % 2 = 0 ∧ n % 2 = 1 ∨ m % 2 = 1 ∧ n % 2 = 0 ⊢ Int.gcd (2 * m * n) (m ^ 2 - n ^ 2) = 1 [PROOFSTEP] exact coprime_sq_sub_mul co pp [GOAL] case mpr.intro.intro.intro.inr.intro.intro.inr.intro m n : ℤ co : Int.gcd m n = 1 pp : m % 2 = 0 ∧ n % 2 = 1 ∨ m % 2 = 1 ∧ n % 2 = 0 ⊢ 2 * m * n * (2 * m * n) + (m ^ 2 - n ^ 2) * (m ^ 2 - n ^ 2) = -(m ^ 2 + n ^ 2) * -(m ^ 2 + n ^ 2) ∧ Int.gcd (2 * m * n) (m ^ 2 - n ^ 2) = 1 [PROOFSTEP] constructor [GOAL] case mpr.intro.intro.intro.inr.intro.intro.inr.intro.left m n : ℤ co : Int.gcd m n = 1 pp : m % 2 = 0 ∧ n % 2 = 1 ∨ m % 2 = 1 ∧ n % 2 = 0 ⊢ 2 * m * n * (2 * m * n) + (m ^ 2 - n ^ 2) * (m ^ 2 - n ^ 2) = -(m ^ 2 + n ^ 2) * -(m ^ 2 + n ^ 2) case mpr.intro.intro.intro.inr.intro.intro.inr.intro.right m n : ℤ co : Int.gcd m n = 1 pp : m % 2 = 0 ∧ n % 2 = 1 ∨ m % 2 = 1 ∧ n % 2 = 0 ⊢ Int.gcd (2 * m * n) (m ^ 2 - n ^ 2) = 1 [PROOFSTEP] ring [GOAL] case mpr.intro.intro.intro.inr.intro.intro.inr.intro.right m n : ℤ co : Int.gcd m n = 1 pp : m % 2 = 0 ∧ n % 2 = 1 ∨ m % 2 = 1 ∧ n % 2 = 0 ⊢ Int.gcd (2 * m * n) (m ^ 2 - n ^ 2) = 1 [PROOFSTEP] rw [Int.gcd_comm] [GOAL] case mpr.intro.intro.intro.inr.intro.intro.inr.intro.right m n : ℤ co : Int.gcd m n = 1 pp : m % 2 = 0 ∧ n % 2 = 1 ∨ m % 2 = 1 ∧ n % 2 = 0 ⊢ Int.gcd (m ^ 2 - n ^ 2) (2 * m * n) = 1 [PROOFSTEP] exact coprime_sq_sub_mul co pp [GOAL] x✝ y✝ z✝ : ℤ h✝ : PythagoreanTriple x✝ y✝ z✝ x y z : ℤ h : PythagoreanTriple x y z h_coprime : Int.gcd x y = 1 h_parity : x % 2 = 1 h_pos : 0 < z ⊢ ∃ m n, x = m ^ 2 - n ^ 2 ∧ y = 2 * m * n ∧ z = m ^ 2 + n ^ 2 ∧ Int.gcd m n = 1 ∧ (m % 2 = 0 ∧ n % 2 = 1 ∨ m % 2 = 1 ∧ n % 2 = 0) ∧ 0 ≤ m [PROOFSTEP] obtain ⟨m, n, ht1, ht2, ht3, ht4⟩ := PythagoreanTriple.coprime_classification.mp (And.intro h h_coprime) [GOAL] case intro.intro.intro.intro.intro x✝ y✝ z✝ : ℤ h✝ : PythagoreanTriple x✝ y✝ z✝ x y z : ℤ h : PythagoreanTriple x y z h_coprime : Int.gcd x y = 1 h_parity : x % 2 = 1 h_pos : 0 < z m n : ℤ ht1 : x = m ^ 2 - n ^ 2 ∧ y = 2 * m * n ∨ x = 2 * m * n ∧ y = m ^ 2 - n ^ 2 ht2 : z = m ^ 2 + n ^ 2 ∨ z = -(m ^ 2 + n ^ 2) ht3 : Int.gcd m n = 1 ht4 : m % 2 = 0 ∧ n % 2 = 1 ∨ m % 2 = 1 ∧ n % 2 = 0 ⊢ ∃ m n, x = m ^ 2 - n ^ 2 ∧ y = 2 * m * n ∧ z = m ^ 2 + n ^ 2 ∧ Int.gcd m n = 1 ∧ (m % 2 = 0 ∧ n % 2 = 1 ∨ m % 2 = 1 ∧ n % 2 = 0) ∧ 0 ≤ m [PROOFSTEP] cases' le_or_lt 0 m with hm hm [GOAL] case intro.intro.intro.intro.intro.inl x✝ y✝ z✝ : ℤ h✝ : PythagoreanTriple x✝ y✝ z✝ x y z : ℤ h : PythagoreanTriple x y z h_coprime : Int.gcd x y = 1 h_parity : x % 2 = 1 h_pos : 0 < z m n : ℤ ht1 : x = m ^ 2 - n ^ 2 ∧ y = 2 * m * n ∨ x = 2 * m * n ∧ y = m ^ 2 - n ^ 2 ht2 : z = m ^ 2 + n ^ 2 ∨ z = -(m ^ 2 + n ^ 2) ht3 : Int.gcd m n = 1 ht4 : m % 2 = 0 ∧ n % 2 = 1 ∨ m % 2 = 1 ∧ n % 2 = 0 hm : 0 ≤ m ⊢ ∃ m n, x = m ^ 2 - n ^ 2 ∧ y = 2 * m * n ∧ z = m ^ 2 + n ^ 2 ∧ Int.gcd m n = 1 ∧ (m % 2 = 0 ∧ n % 2 = 1 ∨ m % 2 = 1 ∧ n % 2 = 0) ∧ 0 ≤ m [PROOFSTEP] use m, n [GOAL] case h x✝ y✝ z✝ : ℤ h✝ : PythagoreanTriple x✝ y✝ z✝ x y z : ℤ h : PythagoreanTriple x y z h_coprime : Int.gcd x y = 1 h_parity : x % 2 = 1 h_pos : 0 < z m n : ℤ ht1 : x = m ^ 2 - n ^ 2 ∧ y = 2 * m * n ∨ x = 2 * m * n ∧ y = m ^ 2 - n ^ 2 ht2 : z = m ^ 2 + n ^ 2 ∨ z = -(m ^ 2 + n ^ 2) ht3 : Int.gcd m n = 1 ht4 : m % 2 = 0 ∧ n % 2 = 1 ∨ m % 2 = 1 ∧ n % 2 = 0 hm : 0 ≤ m ⊢ x = m ^ 2 - n ^ 2 ∧ y = 2 * m * n ∧ z = m ^ 2 + n ^ 2 ∧ Int.gcd m n = 1 ∧ (m % 2 = 0 ∧ n % 2 = 1 ∨ m % 2 = 1 ∧ n % 2 = 0) ∧ 0 ≤ m [PROOFSTEP] cases' ht1 with h_odd h_even [GOAL] case h.inl x✝ y✝ z✝ : ℤ h✝ : PythagoreanTriple x✝ y✝ z✝ x y z : ℤ h : PythagoreanTriple x y z h_coprime : Int.gcd x y = 1 h_parity : x % 2 = 1 h_pos : 0 < z m n : ℤ ht2 : z = m ^ 2 + n ^ 2 ∨ z = -(m ^ 2 + n ^ 2) ht3 : Int.gcd m n = 1 ht4 : m % 2 = 0 ∧ n % 2 = 1 ∨ m % 2 = 1 ∧ n % 2 = 0 hm : 0 ≤ m h_odd : x = m ^ 2 - n ^ 2 ∧ y = 2 * m * n ⊢ x = m ^ 2 - n ^ 2 ∧ y = 2 * m * n ∧ z = m ^ 2 + n ^ 2 ∧ Int.gcd m n = 1 ∧ (m % 2 = 0 ∧ n % 2 = 1 ∨ m % 2 = 1 ∧ n % 2 = 0) ∧ 0 ≤ m [PROOFSTEP] apply And.intro h_odd.1 [GOAL] case h.inl x✝ y✝ z✝ : ℤ h✝ : PythagoreanTriple x✝ y✝ z✝ x y z : ℤ h : PythagoreanTriple x y z h_coprime : Int.gcd x y = 1 h_parity : x % 2 = 1 h_pos : 0 < z m n : ℤ ht2 : z = m ^ 2 + n ^ 2 ∨ z = -(m ^ 2 + n ^ 2) ht3 : Int.gcd m n = 1 ht4 : m % 2 = 0 ∧ n % 2 = 1 ∨ m % 2 = 1 ∧ n % 2 = 0 hm : 0 ≤ m h_odd : x = m ^ 2 - n ^ 2 ∧ y = 2 * m * n ⊢ y = 2 * m * n ∧ z = m ^ 2 + n ^ 2 ∧ Int.gcd m n = 1 ∧ (m % 2 = 0 ∧ n % 2 = 1 ∨ m % 2 = 1 ∧ n % 2 = 0) ∧ 0 ≤ m [PROOFSTEP] apply And.intro h_odd.2 [GOAL] case h.inl x✝ y✝ z✝ : ℤ h✝ : PythagoreanTriple x✝ y✝ z✝ x y z : ℤ h : PythagoreanTriple x y z h_coprime : Int.gcd x y = 1 h_parity : x % 2 = 1 h_pos : 0 < z m n : ℤ ht2 : z = m ^ 2 + n ^ 2 ∨ z = -(m ^ 2 + n ^ 2) ht3 : Int.gcd m n = 1 ht4 : m % 2 = 0 ∧ n % 2 = 1 ∨ m % 2 = 1 ∧ n % 2 = 0 hm : 0 ≤ m h_odd : x = m ^ 2 - n ^ 2 ∧ y = 2 * m * n ⊢ z = m ^ 2 + n ^ 2 ∧ Int.gcd m n = 1 ∧ (m % 2 = 0 ∧ n % 2 = 1 ∨ m % 2 = 1 ∧ n % 2 = 0) ∧ 0 ≤ m [PROOFSTEP] cases' ht2 with h_pos h_neg [GOAL] case h.inl.inl x✝ y✝ z✝ : ℤ h✝ : PythagoreanTriple x✝ y✝ z✝ x y z : ℤ h : PythagoreanTriple x y z h_coprime : Int.gcd x y = 1 h_parity : x % 2 = 1 h_pos✝ : 0 < z m n : ℤ ht3 : Int.gcd m n = 1 ht4 : m % 2 = 0 ∧ n % 2 = 1 ∨ m % 2 = 1 ∧ n % 2 = 0 hm : 0 ≤ m h_odd : x = m ^ 2 - n ^ 2 ∧ y = 2 * m * n h_pos : z = m ^ 2 + n ^ 2 ⊢ z = m ^ 2 + n ^ 2 ∧ Int.gcd m n = 1 ∧ (m % 2 = 0 ∧ n % 2 = 1 ∨ m % 2 = 1 ∧ n % 2 = 0) ∧ 0 ≤ m [PROOFSTEP] apply And.intro h_pos (And.intro ht3 (And.intro ht4 hm)) [GOAL] case h.inl.inr x✝ y✝ z✝ : ℤ h✝ : PythagoreanTriple x✝ y✝ z✝ x y z : ℤ h : PythagoreanTriple x y z h_coprime : Int.gcd x y = 1 h_parity : x % 2 = 1 h_pos : 0 < z m n : ℤ ht3 : Int.gcd m n = 1 ht4 : m % 2 = 0 ∧ n % 2 = 1 ∨ m % 2 = 1 ∧ n % 2 = 0 hm : 0 ≤ m h_odd : x = m ^ 2 - n ^ 2 ∧ y = 2 * m * n h_neg : z = -(m ^ 2 + n ^ 2) ⊢ z = m ^ 2 + n ^ 2 ∧ Int.gcd m n = 1 ∧ (m % 2 = 0 ∧ n % 2 = 1 ∨ m % 2 = 1 ∧ n % 2 = 0) ∧ 0 ≤ m [PROOFSTEP] exfalso [GOAL] case h.inl.inr.h x✝ y✝ z✝ : ℤ h✝ : PythagoreanTriple x✝ y✝ z✝ x y z : ℤ h : PythagoreanTriple x y z h_coprime : Int.gcd x y = 1 h_parity : x % 2 = 1 h_pos : 0 < z m n : ℤ ht3 : Int.gcd m n = 1 ht4 : m % 2 = 0 ∧ n % 2 = 1 ∨ m % 2 = 1 ∧ n % 2 = 0 hm : 0 ≤ m h_odd : x = m ^ 2 - n ^ 2 ∧ y = 2 * m * n h_neg : z = -(m ^ 2 + n ^ 2) ⊢ False [PROOFSTEP] revert h_pos [GOAL] case h.inl.inr.h x✝ y✝ z✝ : ℤ h✝ : PythagoreanTriple x✝ y✝ z✝ x y z : ℤ h : PythagoreanTriple x y z h_coprime : Int.gcd x y = 1 h_parity : x % 2 = 1 m n : ℤ ht3 : Int.gcd m n = 1 ht4 : m % 2 = 0 ∧ n % 2 = 1 ∨ m % 2 = 1 ∧ n % 2 = 0 hm : 0 ≤ m h_odd : x = m ^ 2 - n ^ 2 ∧ y = 2 * m * n h_neg : z = -(m ^ 2 + n ^ 2) ⊢ 0 < z → False [PROOFSTEP] rw [h_neg] [GOAL] case h.inl.inr.h x✝ y✝ z✝ : ℤ h✝ : PythagoreanTriple x✝ y✝ z✝ x y z : ℤ h : PythagoreanTriple x y z h_coprime : Int.gcd x y = 1 h_parity : x % 2 = 1 m n : ℤ ht3 : Int.gcd m n = 1 ht4 : m % 2 = 0 ∧ n % 2 = 1 ∨ m % 2 = 1 ∧ n % 2 = 0 hm : 0 ≤ m h_odd : x = m ^ 2 - n ^ 2 ∧ y = 2 * m * n h_neg : z = -(m ^ 2 + n ^ 2) ⊢ 0 < -(m ^ 2 + n ^ 2) → False [PROOFSTEP] exact imp_false.mpr (not_lt.mpr (neg_nonpos.mpr (add_nonneg (sq_nonneg m) (sq_nonneg n)))) [GOAL] case h.inr x✝ y✝ z✝ : ℤ h✝ : PythagoreanTriple x✝ y✝ z✝ x y z : ℤ h : PythagoreanTriple x y z h_coprime : Int.gcd x y = 1 h_parity : x % 2 = 1 h_pos : 0 < z m n : ℤ ht2 : z = m ^ 2 + n ^ 2 ∨ z = -(m ^ 2 + n ^ 2) ht3 : Int.gcd m n = 1 ht4 : m % 2 = 0 ∧ n % 2 = 1 ∨ m % 2 = 1 ∧ n % 2 = 0 hm : 0 ≤ m h_even : x = 2 * m * n ∧ y = m ^ 2 - n ^ 2 ⊢ x = m ^ 2 - n ^ 2 ∧ y = 2 * m * n ∧ z = m ^ 2 + n ^ 2 ∧ Int.gcd m n = 1 ∧ (m % 2 = 0 ∧ n % 2 = 1 ∨ m % 2 = 1 ∧ n % 2 = 0) ∧ 0 ≤ m [PROOFSTEP] exfalso [GOAL] case h.inr.h x✝ y✝ z✝ : ℤ h✝ : PythagoreanTriple x✝ y✝ z✝ x y z : ℤ h : PythagoreanTriple x y z h_coprime : Int.gcd x y = 1 h_parity : x % 2 = 1 h_pos : 0 < z m n : ℤ ht2 : z = m ^ 2 + n ^ 2 ∨ z = -(m ^ 2 + n ^ 2) ht3 : Int.gcd m n = 1 ht4 : m % 2 = 0 ∧ n % 2 = 1 ∨ m % 2 = 1 ∧ n % 2 = 0 hm : 0 ≤ m h_even : x = 2 * m * n ∧ y = m ^ 2 - n ^ 2 ⊢ False [PROOFSTEP] rcases h_even with ⟨rfl, -⟩ [GOAL] case h.inr.h.intro x y✝ z✝ : ℤ h✝ : PythagoreanTriple x y✝ z✝ y z : ℤ h_pos : 0 < z m n : ℤ ht2 : z = m ^ 2 + n ^ 2 ∨ z = -(m ^ 2 + n ^ 2) ht3 : Int.gcd m n = 1 ht4 : m % 2 = 0 ∧ n % 2 = 1 ∨ m % 2 = 1 ∧ n % 2 = 0 hm : 0 ≤ m h : PythagoreanTriple (2 * m * n) y z h_coprime : Int.gcd (2 * m * n) y = 1 h_parity : 2 * m * n % 2 = 1 ⊢ False [PROOFSTEP] rw [mul_assoc, Int.mul_emod_right] at h_parity [GOAL] case h.inr.h.intro x y✝ z✝ : ℤ h✝ : PythagoreanTriple x y✝ z✝ y z : ℤ h_pos : 0 < z m n : ℤ ht2 : z = m ^ 2 + n ^ 2 ∨ z = -(m ^ 2 + n ^ 2) ht3 : Int.gcd m n = 1 ht4 : m % 2 = 0 ∧ n % 2 = 1 ∨ m % 2 = 1 ∧ n % 2 = 0 hm : 0 ≤ m h : PythagoreanTriple (2 * m * n) y z h_coprime : Int.gcd (2 * m * n) y = 1 h_parity : 0 = 1 ⊢ False [PROOFSTEP] exact zero_ne_one h_parity [GOAL] case intro.intro.intro.intro.intro.inr x✝ y✝ z✝ : ℤ h✝ : PythagoreanTriple x✝ y✝ z✝ x y z : ℤ h : PythagoreanTriple x y z h_coprime : Int.gcd x y = 1 h_parity : x % 2 = 1 h_pos : 0 < z m n : ℤ ht1 : x = m ^ 2 - n ^ 2 ∧ y = 2 * m * n ∨ x = 2 * m * n ∧ y = m ^ 2 - n ^ 2 ht2 : z = m ^ 2 + n ^ 2 ∨ z = -(m ^ 2 + n ^ 2) ht3 : Int.gcd m n = 1 ht4 : m % 2 = 0 ∧ n % 2 = 1 ∨ m % 2 = 1 ∧ n % 2 = 0 hm : m < 0 ⊢ ∃ m n, x = m ^ 2 - n ^ 2 ∧ y = 2 * m * n ∧ z = m ^ 2 + n ^ 2 ∧ Int.gcd m n = 1 ∧ (m % 2 = 0 ∧ n % 2 = 1 ∨ m % 2 = 1 ∧ n % 2 = 0) ∧ 0 ≤ m [PROOFSTEP] use-m, -n [GOAL] case h x✝ y✝ z✝ : ℤ h✝ : PythagoreanTriple x✝ y✝ z✝ x y z : ℤ h : PythagoreanTriple x y z h_coprime : Int.gcd x y = 1 h_parity : x % 2 = 1 h_pos : 0 < z m n : ℤ ht1 : x = m ^ 2 - n ^ 2 ∧ y = 2 * m * n ∨ x = 2 * m * n ∧ y = m ^ 2 - n ^ 2 ht2 : z = m ^ 2 + n ^ 2 ∨ z = -(m ^ 2 + n ^ 2) ht3 : Int.gcd m n = 1 ht4 : m % 2 = 0 ∧ n % 2 = 1 ∨ m % 2 = 1 ∧ n % 2 = 0 hm : m < 0 ⊢ x = (-m) ^ 2 - (-n) ^ 2 ∧ y = 2 * -m * -n ∧ z = (-m) ^ 2 + (-n) ^ 2 ∧ Int.gcd (-m) (-n) = 1 ∧ (-m % 2 = 0 ∧ -n % 2 = 1 ∨ -m % 2 = 1 ∧ -n % 2 = 0) ∧ 0 ≤ -m [PROOFSTEP] cases' ht1 with h_odd h_even [GOAL] case h.inl x✝ y✝ z✝ : ℤ h✝ : PythagoreanTriple x✝ y✝ z✝ x y z : ℤ h : PythagoreanTriple x y z h_coprime : Int.gcd x y = 1 h_parity : x % 2 = 1 h_pos : 0 < z m n : ℤ ht2 : z = m ^ 2 + n ^ 2 ∨ z = -(m ^ 2 + n ^ 2) ht3 : Int.gcd m n = 1 ht4 : m % 2 = 0 ∧ n % 2 = 1 ∨ m % 2 = 1 ∧ n % 2 = 0 hm : m < 0 h_odd : x = m ^ 2 - n ^ 2 ∧ y = 2 * m * n ⊢ x = (-m) ^ 2 - (-n) ^ 2 ∧ y = 2 * -m * -n ∧ z = (-m) ^ 2 + (-n) ^ 2 ∧ Int.gcd (-m) (-n) = 1 ∧ (-m % 2 = 0 ∧ -n % 2 = 1 ∨ -m % 2 = 1 ∧ -n % 2 = 0) ∧ 0 ≤ -m [PROOFSTEP] rw [neg_sq m] [GOAL] case h.inl x✝ y✝ z✝ : ℤ h✝ : PythagoreanTriple x✝ y✝ z✝ x y z : ℤ h : PythagoreanTriple x y z h_coprime : Int.gcd x y = 1 h_parity : x % 2 = 1 h_pos : 0 < z m n : ℤ ht2 : z = m ^ 2 + n ^ 2 ∨ z = -(m ^ 2 + n ^ 2) ht3 : Int.gcd m n = 1 ht4 : m % 2 = 0 ∧ n % 2 = 1 ∨ m % 2 = 1 ∧ n % 2 = 0 hm : m < 0 h_odd : x = m ^ 2 - n ^ 2 ∧ y = 2 * m * n ⊢ x = m ^ 2 - (-n) ^ 2 ∧ y = 2 * -m * -n ∧ z = m ^ 2 + (-n) ^ 2 ∧ Int.gcd (-m) (-n) = 1 ∧ (-m % 2 = 0 ∧ -n % 2 = 1 ∨ -m % 2 = 1 ∧ -n % 2 = 0) ∧ 0 ≤ -m [PROOFSTEP] rw [neg_sq n] [GOAL] case h.inl x✝ y✝ z✝ : ℤ h✝ : PythagoreanTriple x✝ y✝ z✝ x y z : ℤ h : PythagoreanTriple x y z h_coprime : Int.gcd x y = 1 h_parity : x % 2 = 1 h_pos : 0 < z m n : ℤ ht2 : z = m ^ 2 + n ^ 2 ∨ z = -(m ^ 2 + n ^ 2) ht3 : Int.gcd m n = 1 ht4 : m % 2 = 0 ∧ n % 2 = 1 ∨ m % 2 = 1 ∧ n % 2 = 0 hm : m < 0 h_odd : x = m ^ 2 - n ^ 2 ∧ y = 2 * m * n ⊢ x = m ^ 2 - n ^ 2 ∧ y = 2 * -m * -n ∧ z = m ^ 2 + n ^ 2 ∧ Int.gcd (-m) (-n) = 1 ∧ (-m % 2 = 0 ∧ -n % 2 = 1 ∨ -m % 2 = 1 ∧ -n % 2 = 0) ∧ 0 ≤ -m [PROOFSTEP] apply And.intro h_odd.1 [GOAL] case h.inl x✝ y✝ z✝ : ℤ h✝ : PythagoreanTriple x✝ y✝ z✝ x y z : ℤ h : PythagoreanTriple x y z h_coprime : Int.gcd x y = 1 h_parity : x % 2 = 1 h_pos : 0 < z m n : ℤ ht2 : z = m ^ 2 + n ^ 2 ∨ z = -(m ^ 2 + n ^ 2) ht3 : Int.gcd m n = 1 ht4 : m % 2 = 0 ∧ n % 2 = 1 ∨ m % 2 = 1 ∧ n % 2 = 0 hm : m < 0 h_odd : x = m ^ 2 - n ^ 2 ∧ y = 2 * m * n ⊢ y = 2 * -m * -n ∧ z = m ^ 2 + n ^ 2 ∧ Int.gcd (-m) (-n) = 1 ∧ (-m % 2 = 0 ∧ -n % 2 = 1 ∨ -m % 2 = 1 ∧ -n % 2 = 0) ∧ 0 ≤ -m [PROOFSTEP] constructor [GOAL] case h.inl.left x✝ y✝ z✝ : ℤ h✝ : PythagoreanTriple x✝ y✝ z✝ x y z : ℤ h : PythagoreanTriple x y z h_coprime : Int.gcd x y = 1 h_parity : x % 2 = 1 h_pos : 0 < z m n : ℤ ht2 : z = m ^ 2 + n ^ 2 ∨ z = -(m ^ 2 + n ^ 2) ht3 : Int.gcd m n = 1 ht4 : m % 2 = 0 ∧ n % 2 = 1 ∨ m % 2 = 1 ∧ n % 2 = 0 hm : m < 0 h_odd : x = m ^ 2 - n ^ 2 ∧ y = 2 * m * n ⊢ y = 2 * -m * -n [PROOFSTEP] rw [h_odd.2] [GOAL] case h.inl.left x✝ y✝ z✝ : ℤ h✝ : PythagoreanTriple x✝ y✝ z✝ x y z : ℤ h : PythagoreanTriple x y z h_coprime : Int.gcd x y = 1 h_parity : x % 2 = 1 h_pos : 0 < z m n : ℤ ht2 : z = m ^ 2 + n ^ 2 ∨ z = -(m ^ 2 + n ^ 2) ht3 : Int.gcd m n = 1 ht4 : m % 2 = 0 ∧ n % 2 = 1 ∨ m % 2 = 1 ∧ n % 2 = 0 hm : m < 0 h_odd : x = m ^ 2 - n ^ 2 ∧ y = 2 * m * n ⊢ 2 * m * n = 2 * -m * -n [PROOFSTEP] ring [GOAL] case h.inl.right x✝ y✝ z✝ : ℤ h✝ : PythagoreanTriple x✝ y✝ z✝ x y z : ℤ h : PythagoreanTriple x y z h_coprime : Int.gcd x y = 1 h_parity : x % 2 = 1 h_pos : 0 < z m n : ℤ ht2 : z = m ^ 2 + n ^ 2 ∨ z = -(m ^ 2 + n ^ 2) ht3 : Int.gcd m n = 1 ht4 : m % 2 = 0 ∧ n % 2 = 1 ∨ m % 2 = 1 ∧ n % 2 = 0 hm : m < 0 h_odd : x = m ^ 2 - n ^ 2 ∧ y = 2 * m * n ⊢ z = m ^ 2 + n ^ 2 ∧ Int.gcd (-m) (-n) = 1 ∧ (-m % 2 = 0 ∧ -n % 2 = 1 ∨ -m % 2 = 1 ∧ -n % 2 = 0) ∧ 0 ≤ -m [PROOFSTEP] cases' ht2 with h_pos h_neg [GOAL] case h.inl.right.inl x✝ y✝ z✝ : ℤ h✝ : PythagoreanTriple x✝ y✝ z✝ x y z : ℤ h : PythagoreanTriple x y z h_coprime : Int.gcd x y = 1 h_parity : x % 2 = 1 h_pos✝ : 0 < z m n : ℤ ht3 : Int.gcd m n = 1 ht4 : m % 2 = 0 ∧ n % 2 = 1 ∨ m % 2 = 1 ∧ n % 2 = 0 hm : m < 0 h_odd : x = m ^ 2 - n ^ 2 ∧ y = 2 * m * n h_pos : z = m ^ 2 + n ^ 2 ⊢ z = m ^ 2 + n ^ 2 ∧ Int.gcd (-m) (-n) = 1 ∧ (-m % 2 = 0 ∧ -n % 2 = 1 ∨ -m % 2 = 1 ∧ -n % 2 = 0) ∧ 0 ≤ -m [PROOFSTEP] apply And.intro h_pos [GOAL] case h.inl.right.inl x✝ y✝ z✝ : ℤ h✝ : PythagoreanTriple x✝ y✝ z✝ x y z : ℤ h : PythagoreanTriple x y z h_coprime : Int.gcd x y = 1 h_parity : x % 2 = 1 h_pos✝ : 0 < z m n : ℤ ht3 : Int.gcd m n = 1 ht4 : m % 2 = 0 ∧ n % 2 = 1 ∨ m % 2 = 1 ∧ n % 2 = 0 hm : m < 0 h_odd : x = m ^ 2 - n ^ 2 ∧ y = 2 * m * n h_pos : z = m ^ 2 + n ^ 2 ⊢ Int.gcd (-m) (-n) = 1 ∧ (-m % 2 = 0 ∧ -n % 2 = 1 ∨ -m % 2 = 1 ∧ -n % 2 = 0) ∧ 0 ≤ -m [PROOFSTEP] constructor [GOAL] case h.inl.right.inl.left x✝ y✝ z✝ : ℤ h✝ : PythagoreanTriple x✝ y✝ z✝ x y z : ℤ h : PythagoreanTriple x y z h_coprime : Int.gcd x y = 1 h_parity : x % 2 = 1 h_pos✝ : 0 < z m n : ℤ ht3 : Int.gcd m n = 1 ht4 : m % 2 = 0 ∧ n % 2 = 1 ∨ m % 2 = 1 ∧ n % 2 = 0 hm : m < 0 h_odd : x = m ^ 2 - n ^ 2 ∧ y = 2 * m * n h_pos : z = m ^ 2 + n ^ 2 ⊢ Int.gcd (-m) (-n) = 1 [PROOFSTEP] delta Int.gcd [GOAL] case h.inl.right.inl.left x✝ y✝ z✝ : ℤ h✝ : PythagoreanTriple x✝ y✝ z✝ x y z : ℤ h : PythagoreanTriple x y z h_coprime : Int.gcd x y = 1 h_parity : x % 2 = 1 h_pos✝ : 0 < z m n : ℤ ht3 : Int.gcd m n = 1 ht4 : m % 2 = 0 ∧ n % 2 = 1 ∨ m % 2 = 1 ∧ n % 2 = 0 hm : m < 0 h_odd : x = m ^ 2 - n ^ 2 ∧ y = 2 * m * n h_pos : z = m ^ 2 + n ^ 2 ⊢ Nat.gcd (Int.natAbs (-m)) (Int.natAbs (-n)) = 1 [PROOFSTEP] rw [Int.natAbs_neg, Int.natAbs_neg] [GOAL] case h.inl.right.inl.left x✝ y✝ z✝ : ℤ h✝ : PythagoreanTriple x✝ y✝ z✝ x y z : ℤ h : PythagoreanTriple x y z h_coprime : Int.gcd x y = 1 h_parity : x % 2 = 1 h_pos✝ : 0 < z m n : ℤ ht3 : Int.gcd m n = 1 ht4 : m % 2 = 0 ∧ n % 2 = 1 ∨ m % 2 = 1 ∧ n % 2 = 0 hm : m < 0 h_odd : x = m ^ 2 - n ^ 2 ∧ y = 2 * m * n h_pos : z = m ^ 2 + n ^ 2 ⊢ Nat.gcd (Int.natAbs m) (Int.natAbs n) = 1 [PROOFSTEP] exact ht3 [GOAL] case h.inl.right.inl.right x✝ y✝ z✝ : ℤ h✝ : PythagoreanTriple x✝ y✝ z✝ x y z : ℤ h : PythagoreanTriple x y z h_coprime : Int.gcd x y = 1 h_parity : x % 2 = 1 h_pos✝ : 0 < z m n : ℤ ht3 : Int.gcd m n = 1 ht4 : m % 2 = 0 ∧ n % 2 = 1 ∨ m % 2 = 1 ∧ n % 2 = 0 hm : m < 0 h_odd : x = m ^ 2 - n ^ 2 ∧ y = 2 * m * n h_pos : z = m ^ 2 + n ^ 2 ⊢ (-m % 2 = 0 ∧ -n % 2 = 1 ∨ -m % 2 = 1 ∧ -n % 2 = 0) ∧ 0 ≤ -m [PROOFSTEP] rw [Int.neg_emod_two, Int.neg_emod_two] [GOAL] case h.inl.right.inl.right x✝ y✝ z✝ : ℤ h✝ : PythagoreanTriple x✝ y✝ z✝ x y z : ℤ h : PythagoreanTriple x y z h_coprime : Int.gcd x y = 1 h_parity : x % 2 = 1 h_pos✝ : 0 < z m n : ℤ ht3 : Int.gcd m n = 1 ht4 : m % 2 = 0 ∧ n % 2 = 1 ∨ m % 2 = 1 ∧ n % 2 = 0 hm : m < 0 h_odd : x = m ^ 2 - n ^ 2 ∧ y = 2 * m * n h_pos : z = m ^ 2 + n ^ 2 ⊢ (m % 2 = 0 ∧ n % 2 = 1 ∨ m % 2 = 1 ∧ n % 2 = 0) ∧ 0 ≤ -m [PROOFSTEP] apply And.intro ht4 [GOAL] case h.inl.right.inl.right x✝ y✝ z✝ : ℤ h✝ : PythagoreanTriple x✝ y✝ z✝ x y z : ℤ h : PythagoreanTriple x y z h_coprime : Int.gcd x y = 1 h_parity : x % 2 = 1 h_pos✝ : 0 < z m n : ℤ ht3 : Int.gcd m n = 1 ht4 : m % 2 = 0 ∧ n % 2 = 1 ∨ m % 2 = 1 ∧ n % 2 = 0 hm : m < 0 h_odd : x = m ^ 2 - n ^ 2 ∧ y = 2 * m * n h_pos : z = m ^ 2 + n ^ 2 ⊢ 0 ≤ -m [PROOFSTEP] linarith [GOAL] case h.inl.right.inr x✝ y✝ z✝ : ℤ h✝ : PythagoreanTriple x✝ y✝ z✝ x y z : ℤ h : PythagoreanTriple x y z h_coprime : Int.gcd x y = 1 h_parity : x % 2 = 1 h_pos : 0 < z m n : ℤ ht3 : Int.gcd m n = 1 ht4 : m % 2 = 0 ∧ n % 2 = 1 ∨ m % 2 = 1 ∧ n % 2 = 0 hm : m < 0 h_odd : x = m ^ 2 - n ^ 2 ∧ y = 2 * m * n h_neg : z = -(m ^ 2 + n ^ 2) ⊢ z = m ^ 2 + n ^ 2 ∧ Int.gcd (-m) (-n) = 1 ∧ (-m % 2 = 0 ∧ -n % 2 = 1 ∨ -m % 2 = 1 ∧ -n % 2 = 0) ∧ 0 ≤ -m [PROOFSTEP] exfalso [GOAL] case h.inl.right.inr.h x✝ y✝ z✝ : ℤ h✝ : PythagoreanTriple x✝ y✝ z✝ x y z : ℤ h : PythagoreanTriple x y z h_coprime : Int.gcd x y = 1 h_parity : x % 2 = 1 h_pos : 0 < z m n : ℤ ht3 : Int.gcd m n = 1 ht4 : m % 2 = 0 ∧ n % 2 = 1 ∨ m % 2 = 1 ∧ n % 2 = 0 hm : m < 0 h_odd : x = m ^ 2 - n ^ 2 ∧ y = 2 * m * n h_neg : z = -(m ^ 2 + n ^ 2) ⊢ False [PROOFSTEP] revert h_pos [GOAL] case h.inl.right.inr.h x✝ y✝ z✝ : ℤ h✝ : PythagoreanTriple x✝ y✝ z✝ x y z : ℤ h : PythagoreanTriple x y z h_coprime : Int.gcd x y = 1 h_parity : x % 2 = 1 m n : ℤ ht3 : Int.gcd m n = 1 ht4 : m % 2 = 0 ∧ n % 2 = 1 ∨ m % 2 = 1 ∧ n % 2 = 0 hm : m < 0 h_odd : x = m ^ 2 - n ^ 2 ∧ y = 2 * m * n h_neg : z = -(m ^ 2 + n ^ 2) ⊢ 0 < z → False [PROOFSTEP] rw [h_neg] [GOAL] case h.inl.right.inr.h x✝ y✝ z✝ : ℤ h✝ : PythagoreanTriple x✝ y✝ z✝ x y z : ℤ h : PythagoreanTriple x y z h_coprime : Int.gcd x y = 1 h_parity : x % 2 = 1 m n : ℤ ht3 : Int.gcd m n = 1 ht4 : m % 2 = 0 ∧ n % 2 = 1 ∨ m % 2 = 1 ∧ n % 2 = 0 hm : m < 0 h_odd : x = m ^ 2 - n ^ 2 ∧ y = 2 * m * n h_neg : z = -(m ^ 2 + n ^ 2) ⊢ 0 < -(m ^ 2 + n ^ 2) → False [PROOFSTEP] exact imp_false.mpr (not_lt.mpr (neg_nonpos.mpr (add_nonneg (sq_nonneg m) (sq_nonneg n)))) [GOAL] case h.inr x✝ y✝ z✝ : ℤ h✝ : PythagoreanTriple x✝ y✝ z✝ x y z : ℤ h : PythagoreanTriple x y z h_coprime : Int.gcd x y = 1 h_parity : x % 2 = 1 h_pos : 0 < z m n : ℤ ht2 : z = m ^ 2 + n ^ 2 ∨ z = -(m ^ 2 + n ^ 2) ht3 : Int.gcd m n = 1 ht4 : m % 2 = 0 ∧ n % 2 = 1 ∨ m % 2 = 1 ∧ n % 2 = 0 hm : m < 0 h_even : x = 2 * m * n ∧ y = m ^ 2 - n ^ 2 ⊢ x = (-m) ^ 2 - (-n) ^ 2 ∧ y = 2 * -m * -n ∧ z = (-m) ^ 2 + (-n) ^ 2 ∧ Int.gcd (-m) (-n) = 1 ∧ (-m % 2 = 0 ∧ -n % 2 = 1 ∨ -m % 2 = 1 ∧ -n % 2 = 0) ∧ 0 ≤ -m [PROOFSTEP] exfalso [GOAL] case h.inr.h x✝ y✝ z✝ : ℤ h✝ : PythagoreanTriple x✝ y✝ z✝ x y z : ℤ h : PythagoreanTriple x y z h_coprime : Int.gcd x y = 1 h_parity : x % 2 = 1 h_pos : 0 < z m n : ℤ ht2 : z = m ^ 2 + n ^ 2 ∨ z = -(m ^ 2 + n ^ 2) ht3 : Int.gcd m n = 1 ht4 : m % 2 = 0 ∧ n % 2 = 1 ∨ m % 2 = 1 ∧ n % 2 = 0 hm : m < 0 h_even : x = 2 * m * n ∧ y = m ^ 2 - n ^ 2 ⊢ False [PROOFSTEP] rcases h_even with ⟨rfl, -⟩ [GOAL] case h.inr.h.intro x y✝ z✝ : ℤ h✝ : PythagoreanTriple x y✝ z✝ y z : ℤ h_pos : 0 < z m n : ℤ ht2 : z = m ^ 2 + n ^ 2 ∨ z = -(m ^ 2 + n ^ 2) ht3 : Int.gcd m n = 1 ht4 : m % 2 = 0 ∧ n % 2 = 1 ∨ m % 2 = 1 ∧ n % 2 = 0 hm : m < 0 h : PythagoreanTriple (2 * m * n) y z h_coprime : Int.gcd (2 * m * n) y = 1 h_parity : 2 * m * n % 2 = 1 ⊢ False [PROOFSTEP] rw [mul_assoc, Int.mul_emod_right] at h_parity [GOAL] case h.inr.h.intro x y✝ z✝ : ℤ h✝ : PythagoreanTriple x y✝ z✝ y z : ℤ h_pos : 0 < z m n : ℤ ht2 : z = m ^ 2 + n ^ 2 ∨ z = -(m ^ 2 + n ^ 2) ht3 : Int.gcd m n = 1 ht4 : m % 2 = 0 ∧ n % 2 = 1 ∨ m % 2 = 1 ∧ n % 2 = 0 hm : m < 0 h : PythagoreanTriple (2 * m * n) y z h_coprime : Int.gcd (2 * m * n) y = 1 h_parity : 0 = 1 ⊢ False [PROOFSTEP] exact zero_ne_one h_parity [GOAL] x y z : ℤ h : PythagoreanTriple x y z ⊢ PythagoreanTriple x y z ↔ ∃ k m n, (x = k * (m ^ 2 - n ^ 2) ∧ y = k * (2 * m * n) ∨ x = k * (2 * m * n) ∧ y = k * (m ^ 2 - n ^ 2)) ∧ (z = k * (m ^ 2 + n ^ 2) ∨ z = -k * (m ^ 2 + n ^ 2)) [PROOFSTEP] clear h [GOAL] x y z : ℤ ⊢ PythagoreanTriple x y z ↔ ∃ k m n, (x = k * (m ^ 2 - n ^ 2) ∧ y = k * (2 * m * n) ∨ x = k * (2 * m * n) ∧ y = k * (m ^ 2 - n ^ 2)) ∧ (z = k * (m ^ 2 + n ^ 2) ∨ z = -k * (m ^ 2 + n ^ 2)) [PROOFSTEP] constructor [GOAL] case mp x y z : ℤ ⊢ PythagoreanTriple x y z → ∃ k m n, (x = k * (m ^ 2 - n ^ 2) ∧ y = k * (2 * m * n) ∨ x = k * (2 * m * n) ∧ y = k * (m ^ 2 - n ^ 2)) ∧ (z = k * (m ^ 2 + n ^ 2) ∨ z = -k * (m ^ 2 + n ^ 2)) [PROOFSTEP] intro h [GOAL] case mp x y z : ℤ h : PythagoreanTriple x y z ⊢ ∃ k m n, (x = k * (m ^ 2 - n ^ 2) ∧ y = k * (2 * m * n) ∨ x = k * (2 * m * n) ∧ y = k * (m ^ 2 - n ^ 2)) ∧ (z = k * (m ^ 2 + n ^ 2) ∨ z = -k * (m ^ 2 + n ^ 2)) [PROOFSTEP] obtain ⟨k, m, n, H⟩ := h.classified [GOAL] case mp.intro.intro.intro x y z : ℤ h : PythagoreanTriple x y z k m n : ℤ H : (x = k * (m ^ 2 - n ^ 2) ∧ y = k * (2 * m * n) ∨ x = k * (2 * m * n) ∧ y = k * (m ^ 2 - n ^ 2)) ∧ Int.gcd m n = 1 ⊢ ∃ k m n, (x = k * (m ^ 2 - n ^ 2) ∧ y = k * (2 * m * n) ∨ x = k * (2 * m * n) ∧ y = k * (m ^ 2 - n ^ 2)) ∧ (z = k * (m ^ 2 + n ^ 2) ∨ z = -k * (m ^ 2 + n ^ 2)) [PROOFSTEP] use k, m, n [GOAL] case h x y z : ℤ h : PythagoreanTriple x y z k m n : ℤ H : (x = k * (m ^ 2 - n ^ 2) ∧ y = k * (2 * m * n) ∨ x = k * (2 * m * n) ∧ y = k * (m ^ 2 - n ^ 2)) ∧ Int.gcd m n = 1 ⊢ (x = k * (m ^ 2 - n ^ 2) ∧ y = k * (2 * m * n) ∨ x = k * (2 * m * n) ∧ y = k * (m ^ 2 - n ^ 2)) ∧ (z = k * (m ^ 2 + n ^ 2) ∨ z = -k * (m ^ 2 + n ^ 2)) [PROOFSTEP] rcases H with (⟨rfl, rfl⟩ | ⟨rfl, rfl⟩) [GOAL] case h.intro.inl.intro z k m n : ℤ right✝ : Int.gcd m n = 1 h : PythagoreanTriple (k * (m ^ 2 - n ^ 2)) (k * (2 * m * n)) z ⊢ (k * (m ^ 2 - n ^ 2) = k * (m ^ 2 - n ^ 2) ∧ k * (2 * m * n) = k * (2 * m * n) ∨ k * (m ^ 2 - n ^ 2) = k * (2 * m * n) ∧ k * (2 * m * n) = k * (m ^ 2 - n ^ 2)) ∧ (z = k * (m ^ 2 + n ^ 2) ∨ z = -k * (m ^ 2 + n ^ 2)) [PROOFSTEP] refine' ⟨Or.inl ⟨rfl, rfl⟩, _⟩ [GOAL] case h.intro.inl.intro z k m n : ℤ right✝ : Int.gcd m n = 1 h : PythagoreanTriple (k * (m ^ 2 - n ^ 2)) (k * (2 * m * n)) z ⊢ z = k * (m ^ 2 + n ^ 2) ∨ z = -k * (m ^ 2 + n ^ 2) [PROOFSTEP] have : z ^ 2 = (k * (m ^ 2 + n ^ 2)) ^ 2 := by rw [sq, ← h.eq] ring [GOAL] z k m n : ℤ right✝ : Int.gcd m n = 1 h : PythagoreanTriple (k * (m ^ 2 - n ^ 2)) (k * (2 * m * n)) z ⊢ z ^ 2 = (k * (m ^ 2 + n ^ 2)) ^ 2 [PROOFSTEP] rw [sq, ← h.eq] [GOAL] z k m n : ℤ right✝ : Int.gcd m n = 1 h : PythagoreanTriple (k * (m ^ 2 - n ^ 2)) (k * (2 * m * n)) z ⊢ k * (m ^ 2 - n ^ 2) * (k * (m ^ 2 - n ^ 2)) + k * (2 * m * n) * (k * (2 * m * n)) = (k * (m ^ 2 + n ^ 2)) ^ 2 [PROOFSTEP] ring [GOAL] case h.intro.inl.intro z k m n : ℤ right✝ : Int.gcd m n = 1 h : PythagoreanTriple (k * (m ^ 2 - n ^ 2)) (k * (2 * m * n)) z this : z ^ 2 = (k * (m ^ 2 + n ^ 2)) ^ 2 ⊢ z = k * (m ^ 2 + n ^ 2) ∨ z = -k * (m ^ 2 + n ^ 2) [PROOFSTEP] simpa using eq_or_eq_neg_of_sq_eq_sq _ _ this [GOAL] case h.intro.inr.intro z k m n : ℤ right✝ : Int.gcd m n = 1 h : PythagoreanTriple (k * (2 * m * n)) (k * (m ^ 2 - n ^ 2)) z ⊢ (k * (2 * m * n) = k * (m ^ 2 - n ^ 2) ∧ k * (m ^ 2 - n ^ 2) = k * (2 * m * n) ∨ k * (2 * m * n) = k * (2 * m * n) ∧ k * (m ^ 2 - n ^ 2) = k * (m ^ 2 - n ^ 2)) ∧ (z = k * (m ^ 2 + n ^ 2) ∨ z = -k * (m ^ 2 + n ^ 2)) [PROOFSTEP] refine' ⟨Or.inr ⟨rfl, rfl⟩, _⟩ [GOAL] case h.intro.inr.intro z k m n : ℤ right✝ : Int.gcd m n = 1 h : PythagoreanTriple (k * (2 * m * n)) (k * (m ^ 2 - n ^ 2)) z ⊢ z = k * (m ^ 2 + n ^ 2) ∨ z = -k * (m ^ 2 + n ^ 2) [PROOFSTEP] have : z ^ 2 = (k * (m ^ 2 + n ^ 2)) ^ 2 := by rw [sq, ← h.eq] ring [GOAL] z k m n : ℤ right✝ : Int.gcd m n = 1 h : PythagoreanTriple (k * (2 * m * n)) (k * (m ^ 2 - n ^ 2)) z ⊢ z ^ 2 = (k * (m ^ 2 + n ^ 2)) ^ 2 [PROOFSTEP] rw [sq, ← h.eq] [GOAL] z k m n : ℤ right✝ : Int.gcd m n = 1 h : PythagoreanTriple (k * (2 * m * n)) (k * (m ^ 2 - n ^ 2)) z ⊢ k * (2 * m * n) * (k * (2 * m * n)) + k * (m ^ 2 - n ^ 2) * (k * (m ^ 2 - n ^ 2)) = (k * (m ^ 2 + n ^ 2)) ^ 2 [PROOFSTEP] ring [GOAL] case h.intro.inr.intro z k m n : ℤ right✝ : Int.gcd m n = 1 h : PythagoreanTriple (k * (2 * m * n)) (k * (m ^ 2 - n ^ 2)) z this : z ^ 2 = (k * (m ^ 2 + n ^ 2)) ^ 2 ⊢ z = k * (m ^ 2 + n ^ 2) ∨ z = -k * (m ^ 2 + n ^ 2) [PROOFSTEP] simpa using eq_or_eq_neg_of_sq_eq_sq _ _ this [GOAL] case mpr x y z : ℤ ⊢ (∃ k m n, (x = k * (m ^ 2 - n ^ 2) ∧ y = k * (2 * m * n) ∨ x = k * (2 * m * n) ∧ y = k * (m ^ 2 - n ^ 2)) ∧ (z = k * (m ^ 2 + n ^ 2) ∨ z = -k * (m ^ 2 + n ^ 2))) → PythagoreanTriple x y z [PROOFSTEP] rintro ⟨k, m, n, ⟨rfl, rfl⟩ | ⟨rfl, rfl⟩, rfl | rfl⟩ [GOAL] case mpr.intro.intro.intro.intro.inl.intro.inl k m n : ℤ ⊢ PythagoreanTriple (k * (m ^ 2 - n ^ 2)) (k * (2 * m * n)) (k * (m ^ 2 + n ^ 2)) [PROOFSTEP] delta PythagoreanTriple [GOAL] case mpr.intro.intro.intro.intro.inl.intro.inr k m n : ℤ ⊢ PythagoreanTriple (k * (m ^ 2 - n ^ 2)) (k * (2 * m * n)) (-k * (m ^ 2 + n ^ 2)) [PROOFSTEP] delta PythagoreanTriple [GOAL] case mpr.intro.intro.intro.intro.inr.intro.inl k m n : ℤ ⊢ PythagoreanTriple (k * (2 * m * n)) (k * (m ^ 2 - n ^ 2)) (k * (m ^ 2 + n ^ 2)) [PROOFSTEP] delta PythagoreanTriple [GOAL] case mpr.intro.intro.intro.intro.inr.intro.inr k m n : ℤ ⊢ PythagoreanTriple (k * (2 * m * n)) (k * (m ^ 2 - n ^ 2)) (-k * (m ^ 2 + n ^ 2)) [PROOFSTEP] delta PythagoreanTriple [GOAL] case mpr.intro.intro.intro.intro.inl.intro.inl k m n : ℤ ⊢ k * (m ^ 2 - n ^ 2) * (k * (m ^ 2 - n ^ 2)) + k * (2 * m * n) * (k * (2 * m * n)) = k * (m ^ 2 + n ^ 2) * (k * (m ^ 2 + n ^ 2)) [PROOFSTEP] ring [GOAL] case mpr.intro.intro.intro.intro.inl.intro.inr k m n : ℤ ⊢ k * (m ^ 2 - n ^ 2) * (k * (m ^ 2 - n ^ 2)) + k * (2 * m * n) * (k * (2 * m * n)) = -k * (m ^ 2 + n ^ 2) * (-k * (m ^ 2 + n ^ 2)) [PROOFSTEP] ring [GOAL] case mpr.intro.intro.intro.intro.inr.intro.inl k m n : ℤ ⊢ k * (2 * m * n) * (k * (2 * m * n)) + k * (m ^ 2 - n ^ 2) * (k * (m ^ 2 - n ^ 2)) = k * (m ^ 2 + n ^ 2) * (k * (m ^ 2 + n ^ 2)) [PROOFSTEP] ring [GOAL] case mpr.intro.intro.intro.intro.inr.intro.inr k m n : ℤ ⊢ k * (2 * m * n) * (k * (2 * m * n)) + k * (m ^ 2 - n ^ 2) * (k * (m ^ 2 - n ^ 2)) = -k * (m ^ 2 + n ^ 2) * (-k * (m ^ 2 + n ^ 2)) [PROOFSTEP] ring
[STATEMENT] lemma np_None [rule_format (no_asm), simp]: "a' \<noteq> Null --> np a' x' = x'" [PROOF STATE] proof (prove) goal (1 subgoal): 1. a' \<noteq> Null \<longrightarrow> np a' x' = x' [PROOF STEP] apply (unfold np_def raise_if_def) [PROOF STATE] proof (prove) goal (1 subgoal): 1. a' \<noteq> Null \<longrightarrow> (if a' = Null \<and> x' = None then Some (Addr (XcptRef NullPointer)) else x') = x' [PROOF STEP] apply auto [PROOF STATE] proof (prove) goal: No subgoals! [PROOF STEP] done
% Copyright 2019 by Till Tantau % % This file may be distributed and/or modified % % 1. under the LaTeX Project Public License and/or % 2. under the GNU Free Documentation License. % % See the file doc/generic/pgf/licenses/LICENSE for more details. \section{Extended Color Support} This section documents the package \texttt{xxcolor}, which is currently distributed as part of \pgfname. This package extends the \texttt{xcolor} package, written by Uwe Kern, which in turn extends the \texttt{color} package. I hope that the commands in \texttt{xxcolor} will some day migrate to \texttt{xcolor}, such that this package becomes superfluous. The main aim of the \texttt{xxcolor} package is to provide an environment inside which all colors are ``washed out'' or ``dimmed''. This is useful in numerous situations and must typically be achieved in a roundabout manner if such an environment is not available. \begin{environment}{{colormixin}\marg{mix-in specification}} The mix-in specification is applied to all colors inside the environment. At the beginning of the environment, the mix-in is applied to the current color, i.e., the color that was in effect before the environment started. A mix-in specification is a number between 0 and 100 followed by an exclamation mark and a color name. When a |\color| command is encountered inside a mix-in environment, the number states what percentage of the desired color should be used. The rest is ``filled up'' with the color given in the mix-in specification. Thus, a mix-in specification like |90!blue| will mix in 10\% of blue into everything, whereas |25!white| will make everything nearly white. % \begin{codeexample}[width=4cm,preamble={\usepackage{xxcolor}}] \begin{minipage}{3.5cm}\raggedright \color{red}Red text,% \begin{colormixin}{25!white} washed-out red text, \color{blue} washed-out blue text, \begin{colormixin}{25!black} dark washed-out blue text, \color{green} dark washed-out green text,% \end{colormixin} back to washed-out blue text,% \end{colormixin} and back to red. \end{minipage}% \end{codeexample} % \end{environment} Note that the environment only changes colors that have been installed using the standard \LaTeX\ |\color| command. In particular, the colors in images are not changed. There is, however, some support offered by the commands |\pgfuseimage| and |\pgfuseshading|. If the first command is invoked inside a |colormixin| environment with the parameter, say, |50!black| on an image with the name |foo|, the command will first check whether there is also a defined image with the name |foo.!50!black|. If so, this image is used instead. This allows you to provide a different image for this case. If you nest |colormixin| environments, the different mix-ins are all appended. For example, inside the inner environment of the above example, |\pgfuseimage{foo}| would first check whether there exists an image named |foo.!25!white!25!black|. \begin{command}{\colorcurrentmixin} Expands to the current accumulated mix-in. Each nesting of a |colormixin| adds a mix-in to this list. % \begin{codeexample}[preamble={\usepackage{xxcolor} \usepackage{calc}}] \begin{minipage}{\linewidth-6pt}\raggedright \begin{colormixin}{75!white} \colorcurrentmixin\ should be ``!75!white''\par \begin{colormixin}{75!black} \colorcurrentmixin\ should be ``!75!black!75!white''\par \begin{colormixin}{50!white} \colorcurrentmixin\ should be ``!50!white!75!black!75!white''\par \end{colormixin} \end{colormixin} \end{colormixin} \end{minipage} \end{codeexample} % \end{command}
SUBROUTINE INPUTX(BUF1,IBUF1,LBUF1,BUF2,ISTOP) C INPUTX IS THE TAPE INPUT EXECUTE PHASE OF THE SIO SEISMIC PROCESSING SYSTEM. C INPUTX RETURNS A FLOATING POINT TRACE WITH HEADER IN ARRAY BUF1. INPUTX C READS TAPE USING DOUBLE BUFFERING TECHNIQUES, THUS I/O IS BEING PERFORMED C INTO BUF2 AFTER INPUTX RETURNS TO THE CALLING PROGRAM. C INPUTX IS CONTROLLED BOTH BY THE USER'S PARAMETERS AND THE COMPUTER C OPERATOR. THE PARAMETER LISTS MUST BE IN DISC FILE IPARUN. C DATA IS READ FROM TAPE USING THE VARIABLES IN THE FIRST PARAMETER LIST UNTIL C THE LIST IS EXHAUSTED, THEN ANOTHER LIST IS READ FROM DISK AND TAPE READING C IS DONE ACCORDING THE NEW VAIABLES. THIS CONTINUES UNTIL THE LAST PARAMETER C SET IS EXHAUSTED OR THE OPERATOR ANSWERS A REEL CHANGE WITH A -1 AND THEN C INPUTX SETS ARGUMENT ISTOP TO 1 TO INDICATE THAT THERE IS NO MORE DATA TO C BE INPUT. C INPUTX ASSUMES THAT SHOT NUMBERS OR RP NUMBERS INCREASE ON TAPE. NON C ASSENDING TAPES MAY WORK, BUT I DON'T GUARANTEE IT! C C THE PARAMETER LIST MUST BE AS FOLLOWS. C 1) IREELN - 16 BIT INTEGER - INPUT REEL NUMBER. IF IREELN CHANGES BETWEEN C LISTS, A REEL CHANGE IS DONE. C 2) IUNIT - 16 BIT INTEGER - THE INPUT TAPE UNIT NUMBER. (DRIVE NUMBER) C 3) LTYPE - 32 BIT INTEGER - A 4 CHARACTER WORD SPECIFYING THE TYPE OF C DATA BEING INPUT. 'SHOT' OR 'BYRP'. C 4) FIS - 32 BIT INTEGER - THE FIRST SHOT OR RP NUMBER OF THIS LIST. FIS<0 C MEANS THAT FIS IS BEFORE (ON TAPE) THE PRESENT C POSITION ON TAPE. (SEARCH REVERSE FOR FIS) C 5) LIS - 32 BIT INTEGER - THE LAST SHOT OR RP NUMBER OF THIS LIST. C 6) SINC - 32 BIT INTEGER - THE INCREMENT BETWEEN FIS AND LIS. SINC<0 C IMPLIES PROCESSING REVERSE. C 7) FTR - 32 BIT INTEGER - THE FIRST TRACE OF THE SHOT OR RP TO READ. C 8) LTR - 32 BIT INTEGER - THE LAST TRACE OF THE SHOT OR RP TO READ. C 9) TRINC - 32 BIT INTEGER - THE INCREMENT BETWEEN FTR AND LTR. TRINC<0 MEANS THAT FTR>LTR. C 10) ISI - 16 BIT INTEGER - THE SAMPLE INTERVAL IN MICROSECONDS (OVERRIDE) C 11) IDELAY - 16 BIT INTEGER - THE DEEP WATER DELAY IN MILLISECONDS (OVERRIDE) C 12) NTRGAT - 16 BIT INTEGER - THE NUMBER OF TRACES PER GATHER. C 13) TIME1 - REAL - THE PACKED START DAY-GMT C 14) TIME2 - REAL - THE PACKED END DAY-GMT C C ARGUMENTS: C BUF1 - THE REAL ARRAY THAT WILL CONTAIN THE TRACE (HEADER AND DATA) READ C FROM TAPE. C IBUF1 - THE SAME ARRAY BUT THE 16 BIT INTEGER VERSION. PRIME FORTRAN C DOES NOT ALLOW EQUIVALENCING OF ANYTHING TO AN ARGUMENT. C LBUF1 - THE SAME ARRAY BUT THE 32 BIT INTEGER VERSION. C BUF2 - THE NEXT INPUT BUFFER. DATA WILL BE READING INTO BUF2 AFTER C INPUTX RETURNS. C ISTOP - A SIGNAL WHEN SET TO 1 BY INPUTX INDICATES THAT THERE IS NO INPUT C TRACE LEFT ON TAPE. THE OPERATOR OR THE USER'S PARAMETERS INDICATED C A HALT IN PROCESSING. REMEMBER THAT BUF1 DOES NOT CONTAIN DATA! C C COMMON REQUIREMENTS: C COMMON /INPUT/ IPARUN,NLISTS C IPARUN - THE FORTRAN UNIT NUMBER OF THE PARAMETER LIST FILE. (NOT PRIMOS C UNIT NUMBER!) C C COPYWRITED BY: C PAUL HENKART, SCRIPPS INSTITUTION OF OCEANOGRAPHY, JANUARY 1980 C ALL RIGHTS RESERVED BY THE AUTHOR. C c mod 17 May 10 - Comment out creating real mute times in header words 47 & 48 c mod 14 Aug 07 - g95 IAND args must be same sized. c mod 19 Oct 02 - Change the temporary file stuff for file IN/in. c mod 31 Jul 00 - The new delay was wrong when the start time of SET was not c an integer number of seconds (e.g. set 1.5 3.5 had a delay od 1) c mod 22 Dec 97 - Change MIN0 to MIN c mod 24 May 96 - Change trace id from 100 (GPR) to 1 (seismic) c mod 6 Dec 95 - Set ltr if not given and itrindex is given. c mod 15 Nov 95 - add parameter REWIND, set it on every list for c subroutine rdtrc, which sets it to 1 after a tape c change. c mod 20 Jul 95 - tr index stuff was wrong (see 20 mar 95) c mod 23 Mar 95 - Add allno and alltr parameters c mod 20 Mar 95 - Add NO and noindex; Add TR and trindex c mod 18 Nov 93 - Increase nwrds and maxwrd from 30,000 to 32,767 c - Toss out dummy traces (ibuf(15) = trace id = 3) c 6 Oct 93 - Change a check from lbuf(7) to ltype .EQ. 'SHOT' c mod 28 Sep 93 - Increase nwrds and maxwrd from 20,000 to 30,000 c mod 14 Feb 93 - Save LDGO shots with 0 shot number, but set the dead c trace flag (undo it with process header). It looks c like shot 0 uses the shot from 2 shots ago (like in c double buffering. Change the shot number from 0 to c what it should have been. I just saw 2 hours of data c with shot = 0, but the data looked okay, just off by c 2 shots? c mod 11 Feb 93 - LDGO Ewing clock does weird things with the day c occasionally, which screws up reading by GMT. c mod 14 Oct 92 - subtract 1 from the number of traces per shot on LDGO c mod 5 Oct 92 - add parameter set c mod 6 May 92 - secs and stime caused crash on LDGO trace 0 (id=28) c mod 11 Feb 92 to allow fis/lis on rp sorted tapes and clean up c fis/lrp. frp/lrp, fno/lno presets and error messages. c mod 22 July 91 by pch - Add jform = 5; meaning Western/USGS bastardized c SEGY format c mod 27 Apr 91 by pch - nis didn't work (only valid with fis 99999 anyway!) c mod 13 Apr 91 by pch - add jform 4 for LDGO DSS240 id=28, trace 0 c has some goodies in it. c mod 4 Mar 91 by pch - delete file in if IN doesn't exist c - add stime parameter. c mod 23 Mar 90 by pch to add the UTIG 16 bit "floating point" iformat c mod 20 Mar 90 by pch to get rid of the old logic about sample inervals c and depth data. c mod 20 Mar 90 by pch to do the sample interval override between calls c to rdtrc (wait for I/O completion and unpack the data). c mod 19 Mar 90 by pch to correct logic for forgat given and ltr given c mod 10 Jan 90 - ah shit, VMS went bananas in inputx when it saw something bad c in word 50 (water bottom time). Any selfrespecting computer would have c NaN or 0., but no, not VAX, it crapped out! see the setwbt kludge! c mod 15 Dec 89 for forgat 1 and multiple lists c mod 14 Nov 89 for the SSC PHXV format c mod 23 oct89 to toss out non-seismic data (ibuf(15) must=0,1,2,3,6) LOGICAL FIRST COMMON /EDITS/ IERROR,IWARN,IRUN,NOW,ICOMPT COMMON /readt/ ilun, numhdr, numdat, iunhdr, ireeln, intrcs, * ifmt, nskip, secs, idummy, isrcf, idtype, * nfskip, jform, itxsi, itxdel, nfktrc, norigtr, * nrskip, nfiles, rewindi INTEGER rewind, rewindi c jform = 1; c = 2; SSC Phoenix I c = 3; SSC Phoenix II c = 4; LDGO/Digicon DSS-240 c = 5; Western/USGS modified SEGY COMMON /SIOAP/ IASGND,IRELSE,IN,IOUT,NEXTAD COMMON /TAPES/ NMILS,NTRIES,NPAR,NWREAD COMMON /INPUT/ IPARUN,NLISTS COMMON /WRITET/ounit,NSAMPS,OREEL,POSAFT,OFMT,NTRCS,LFOR,ONUMTR, & nfskipo, rewindo, newfile, itrace0, ounit2 COMMON /WRITET/ IWRITE(5),NOTRCS COMMON /inputdev/inputdev CHARACTER*80 inputdev DIMENSION BUF1(1000),IBUF1(1000),LBUF1(1000),BUF2(1000), set(2) INTEGER lsilly, allno, alltr REAL silly EQUIVALENCE (lsilly,silly) INTEGER*2 IBUF1 INTEGER FIS,SINC,FTR,TRINC, forgat, setwbt, rshift CHARACTER*4 LTYPE CHARACTER*10 token INTEGER*2 ldgodss(5), i15 SAVE ! JUST SAVE EVERYTHING!!!! DATA FIRST/.TRUE./, i15/15/ DATA NWRDS/32767/, MAXWDS/32767/ DATA NSHOTS/0/, NTRCN1/0/, istat/0/, lastsh/-1/, iforcnt/0/ DATA setwbt/1/, lastday/0/, ibad/0/, lastshot/0/ C C NOTRCS=INTRCS ! SET THE NUMBER OF OUTPUT TRACES ISTOP=0 ! SET THE STOP SIGNAL TO NO STOP IF(.NOT.FIRST) NUMDAT=0 ! TELL RDTRC TO READ ALL THE DATA IF(.NOT.FIRST) GO TO 100 CALL GETFIL(2,ITEMP,token,ISTAT) ! Just get a unit number IF(ICOMPT.EQ.1) ITEMP=ITEMP+4 ! IS IT A PRIME COMPUTER? OPEN(UNIT=ITEMP,FILE='IN',STATUS='UNKNOWN') ! TRY TO OPEN FILE IN CLOSE(UNIT=ITEMP,STATUS='DELETE') ! DELETE FILE IN OPEN(UNIT=ITEMP,FILE='in',STATUS='UNKNOWN') ! TRY TO OPEN FILE IN CLOSE(UNIT=ITEMP,STATUS='DELETE') ! DELETE FILE IN IF(ICOMPT.EQ.1) ITEMP=ITEMP-4 CALL FREFIL(1,ITEMP,ISTAT) ! FREE THE UNIT NUMBER FOR GETFIL C**** C**** GET THE FIRST PARAMETER LIST, THEN GET THE FIRST TRACE C**** REWIND IPARUN ! START FROM THE BEGINNING OF THE PARAMETER FILE READ(IPARUN,END=10) IREELN,ILUN,LTYPE,FIS,LIS,SINC,FTR,LTR,TRINC, * ISI,IDELAY,NTRGAT,TIME1,TIME2,ISRCF,lprint, forgat, iorder, & stime, inputdev, set, lrenum, notype, noindex, itrtype, & itrindex, allno, alltr, rewind GO TO 30 ! EVERYTHING OK ON THE READ 10 PRINT 20 20 FORMAT(' *** ERROR *** NO INPUT PARAMETERS GIVEN.') STOP 30 continue ireel=ireeln ltrcno=ftr IDIR=1 ! THE DIRECTION OF THE TAPE SEARCH (+1=FORWARD, -1=BACKWARD) IF( fis .LT. 0 ) THEN idir = -1 fis = -fis ENDIF idir = idir * iorder ! the first shot needs to honor the sign of fis LCSHOT=FIS ! THE SHOT TO LOOK FOR IF( ltype .EQ. 'SHOT' .AND. lbuf1(7) .NE. 0 ) PRINT *, & '*** WARNING *** Reading an RP sorted tape as a SHOT tape.' C**** C**** WHEN DOUBLE BUFFERING, WAIT FOR THE I/O COMPLETION, THEN CHECK STATUS C**** AND DO THE DATA CONVERSION IF NECESSARY. C**** 100 CONTINUE IF( .NOT. FIRST ) THEN CALL RDTRC(BUF1,IBUF1,LBUF1,ISTAT,3) ! WAIT ON I/O COMPLETION IF( ILUN .LT. 0 ) THEN ISTOP=-1 ! THE OPERATOR IS STOPPING THE JOB AND NO TRACE IS READY RETURN ENDIF ELSE c**** Check for the Western/USGS format on the first trace only. IF( lbuf1(3) .LT. 0 .AND. lbuf1(4) .GT. 0 .AND. & lbuf1(7) .NE. 0 ) jform = 5 ENDIF IF( ibuf1(15) .EQ. 100 ) ibuf1(15) = 1 ! Change from GPR to seismic data c**** The Lamont DSS240 system stores stuff such as GMT in trace 0 c**** and the shot number comes from trace 0 (what's in (3) is the file c**** number. Trace 0 also counts in the header word for the number of c**** traces per shot (if there are traces 0-184, then there are 185 tr) c*** Argh. I dug my own grave. I decided to save trace 0 when c*** reformating from SEGD to SEGY and didn't create the trace0 c*** exactly as done before. Damn. jform=4 is the pre 1996 SEG-Y c*** Trace 0 stuff. c**** IF( ibuf1(15) .EQ. 28 .AND. ibuf1(79) .LT. 96 ) THEN IF( jform .EQ. 0 ) intrcs = intrcs - 1 jform = 4 110 ldgoshot = 0 iunits = 1 itemp = lbuf1(62) DO 120 i = 1, 8 ldgoshot = ldgoshot + IAND(itemp,15) * iunits itemp = LRSHIFT(itemp,4) iunits = iunits * 10 120 CONTINUE DO 130 i = 1, 4 130 ldgodss(i) = ibuf1(134+i) itemp = RSHIFT(ibuf1(658),8) itemp1 = RSHIFT(ibuf1(659),8) ldgodss(5) = IAND( itemp,15) * 100 & + IAND(ibuf1(658),i15) * 10 & + IAND(itemp1,15) c**** if the shot number and the date are zero, the data is too. IF( ldgoshot .EQ. 0 .AND. ldgodss(1) .EQ. 0 ) THEN c**** shot numbers of 0 are bad, they will also screwup geom type 2 c**** because the next shot's number is big PRINT *,' skipping shot 0 at time ', (ldgodss(i),i=1,4) 125 CALL magtap( ilun, lbuf1, 10000, 21, istat ) IF( istat .EQ. 1024 ) GOTO 110 GOTO 125 ENDIF kill = 1 IF( ldgoshot .EQ. 0 ) THEN IF( ibuf1(15) .EQ. 28 ) THEN lastshot = lastshot + 1 PRINT *,' shot number 0 becoming shot ',lastshot ldgoshot = lastshot kill = 2 ENDIF ENDIF lastshot = ldgoshot c**** 121 is the reel number in BCD c**** 122 is the file number in BCD c**** 123, 124 is the shot number in BCD c**** 161-230 are can depths in feet ENDIF IF( jform .EQ. 4 ) THEN lbuf1(3) = ldgoshot ibuf1(15) = kill ibuf1(79) = 0 ! Lamont doesn't have the year or millisecond ibuf1(80) = ldgodss(1) ibuf1(81) = ldgodss(2) ibuf1(82) = ldgodss(3) ibuf1(83) = ldgodss(4) ibuf1(84) = ldgodss(5) ENDIF c**** geez. If ltr isn't given, setting it is a pain. There was a time c**** when rp trace was set, but itrindex was used. who knows what intrcs was. IF( ltr .EQ. -32767 ) THEN IF( lbuf1(7) .EQ. 0 .AND. itrindex .EQ. 0 .AND. & alltr .EQ. 0 ) ltr = intrcs ENDIF IF( ltr .GE. 0 .AND. ftr .GE. 0 ) THEN IF( alltr .EQ. 0 ) THEN intrcs = (ltr - ftr) / trinc + 1 ELSE intrcs = (ltr - ftr) + 1 ENDIF ENDIF IF(ISTAT.LT.0) GO TO 240 NWRDS=MAXWDS ! ALWAYS READ THE MAXIMUM NUMBER OF WORDS FROM TAPE IF(ISI.NE.0) IBUF1(59)=ISI ! OVERRIDE THE TRACE HEADER IF USER GAVE IT IF( ntrgat .NE. 0 ) lbuf1(51) = 0 ! get rid of EOG IF( ntrgat .LT. 0 ) lbuf1(7) = 0 ! make it a shot IF( TIME1 .EQ. 0. ) THEN c**** The Western/USGS format has the shot number in word 50 etc. IF( jform .EQ. 5 ) THEN IF( icompt .EQ. 2.OR.icompt.EQ.4) CALL swap32(lbuf1(50),1) lbuf1(3) = lbuf1(50) / 10000 lbuf1(7) = 0 lbuf1(50) = 0 ENDIF IF( LBUF1(7) .EQ. 0 .OR. ltype .EQ. 'SHOT' ) THEN ! IS IT A RP SORTED TAPE? LTSHOT=LBUF1(3) ! THE SHOT NUMBER OF THE TRACE JUST READ LTRACE=LBUF1(4) ! THE TRACE NUMBER WITHIN THE SHOT ELSE LTSHOT=LBUF1(6) ! THE RP NUMBER OF THE TRACE JUST READ LTRACE=LBUF1(7) ! THE TRACE NUMBER WITHIN THE RP ENDIF IF( notype .NE. 0 ) THEN IF( notype .EQ. 1 ) ltshot = ibuf1(noindex) IF( notype .EQ. 2 ) ltshot = lbuf1(noindex) IF( notype .EQ. 3 ) ltshot = buf1(noindex) ENDIF IF( itrtype .NE. 0 ) THEN IF( itrtype .EQ. 1 ) ltrace = ibuf1(itrindex) IF( itrtype .EQ. 2 ) ltrace = lbuf1(itrindex) IF( itrtype .EQ. 3 ) ltrace = buf1(itrindex) ENDIF ELSE ! DO IT BY TIME (DAY-GMT) LTRACE=LBUF1(4) IF(LBUF1(7).NE.0) LTRACE=LBUF1(7) dumb = ibuf1(80) ! watch out for 16 bit arithmetic! TIME=dumb*10000.+IBUF1(81)*100.+IBUF1(82) IF( IAND(lprint,2) .NE. 0 ) PRINT 135,time,time1,time2 135 FORMAT(' time=',7(1x,F9.0)) c**** Skip it if LDGO and more than a day away from the last IF( jform .EQ. 4 ) THEN IF( lastday .EQ. ibuf1(80) .AND. ibad .NE. 0 ) GOTO 160 IF( ibuf1(80) .GT. lastday + 1 .AND. lastday .NE. 0 ) THEN lastday = ibuf1(80) ibad = 1 GOTO 160 ENDIF lastday = ibuf1(80) ibad = 0 ENDIF IF(TIME.LT.TIME1) GO TO 160 ! IS THIS SHOT BEFOR THE FIRST TO PROCESS? IF(TIME.LE.TIME2) GO TO 170 ! IS IT BEYOND THE LAST TIME TO PROCESS? 137 READ(IPARUN,END=140) IREELN,JLUN,LTYPE,FIS,LIS,SINC, & FTR,LTR,TRINC,ISI,IDELAY,NTRGAT,TIME1,TIME2,ISRCF, & lprint, forgat, iorder, stime, inputdev, set, lrenum, & notype, noindex, itrtype, itrindex, allno, alltr GO TO 165 140 ISTOP=-1 ! STOP NOW - DO NOT PROCESS THIS TRACE!! RETURN ENDIF IF( IAND(lprint,2) .NE. 0 ) THEN PRINT *,' fis=',fis,' lis=',lis,' sinc=',sinc,' ftr=',ftr, * ' ltr=',ltr PRINT *,' ltshot=',ltshot,' lcshot=',lcshot,' lastsh=', * lastsh,' ltrace=',ltrace,' ltrcno=',ltrcno,' nshots=',nshots PRINT *,' this header is ',lbuf1(3),lbuf1(4),lbuf1(6), * lbuf1(7),ibuf1(15) PRINT *,' notype, noindex, itrtype, itrindex: ', & notype, noindex, itrtype, itrindex PRINT *,' allno, alltr ',allno, alltr,' rewind ',rewind ENDIF c**** toss out non seismic data. ibuf(15) has the trace id code. c**** = 0, if not set, =1 for seismic data, =2 dead, 3= dummy, 6=sweep IF( ibuf1(15) .NE. 0 .AND. ibuf1(15) .NE. 1 .AND. * ibuf1(15) .NE. 2 .AND. c ibuf1(15) .NE. 3 .AND. * ibuf1(15) .NE. 6 ) GOTO 165 IF(FIS.EQ.99999) GO TO 170 ! DOES THE USER CARE WHAT SHOT IT IS? IF(LCSHOT.EQ.LTSHOT) GO TO 170 IF( allno .EQ. 1 ) THEN IF(fis .NE. 99999 .AND. ltshot.GT.lis.AND.lastsh.NE.-1)THEN c & GOTO 137 READ(IPARUN,END=150) IREELN,JLUN,LTYPE,FIS,LIS,SINC, & FTR,LTR,TRINC,ISI,IDELAY,NTRGAT,TIME1,TIME2,ISRCF, & lprint, forgat, iorder, stime, inputdev, set, lrenum, & notype, noindex, itrtype, itrindex, allno, alltr GO TO 165 150 ISTOP=-1 ! STOP NOW - DO NOT PROCESS THIS TRACE!! RETURN ENDIF IF( ltshot .GE. fis .AND. ltshot .LE. lis ) GOTO 170 ENDIF 160 CONTINUE ! GET ANOTHER TRACE INTO MEMORY IF( IDIR*iorder .LT. 0 ) THEN IF( inputdev .NE. ' ' ) THEN PRINT *,' *** ERROR *** Can not go backwards on ', & inputdev STOP ENDIF CALL MAGTAP(ILUN,BUF1,0,25,ISTAT) ! BACK UP A TAPE RECORD (OVER A TRACE) CALL MAGTAP(ILUN,BUF1,0,25,ISTAT) ! BACK UP A TAPE RECORD (OVER A TRACE) ENDIF 165 CALL MAGTAP(ILUN,BUF1,NWRDS,1,ISTAT) ! START READ INTO BUF1 FIRST=.FALSE. GO TO 100 170 CONTINUE IF( alltr .EQ. 0 ) THEN ! GET THE RIGHT TRACE!! IF( LTRCNO .NE. LTRACE ) GO TO 160 ELSE IF( ltrace .LT. ftr .OR. & ( ltr .GT. 0 .AND. ltrace .GT. ltr ) ) GOTO 160 ENDIF IF( LTSHOT .NE. LASTSH ) THEN NSHOTS = NSHOTS+1 ! COUNT THE NEW SHOTS/RPS LASTSH = LTSHOT c nis is only valid when fis = 99999 IF( FIS .EQ. 99999 .AND. NSHOTS .GE. LIS ) GO TO 240 ! HAVE WE DONE ALL THE SHOTS REQUESTED IF( ftr .EQ. 99999 .AND. nshots .NE. 1) THEN IF( allno .EQ. 0 ) THEN lcshot = lcshot + sinc ELSE lcshot = ltshot ENDIF IF( lcshot .GT. lis ) THEN istop = -1 RETURN ENDIF ENDIF ENDIF C**** C**** GOT THE TRACE WE WANT, START THE NEXT ONE IN BEFORE UNPACKING THE PRESENT ONE C**** 171 IF( LRENUM .NE. -32767 ) THEN ! SHOULD WE RENUMBER THE SHOT/RP NUMBER? IF( LBUF1(7) .EQ. 0 ) LBUF1(3)=LRENUM ! CHANGE THE SHOT NUMBER IF( LBUF1(7) .NE. 0 ) LBUF1(6)=LRENUM ! CHANGE THE RP NUMBER ENDIF IF( .NOT. FIRST ) THEN ! THE FIRST TRACE IS ALREADY UNPACKED IN=0 ! SET THE AP ADDRESS NUMDAT=0 CALL RDTRC(BUF1,IBUF1,LBUF1,ISTAT,4) ! UNPACK THE DATA ENDIF C**** C**** SET THE SIO SPECIAL ENTRIES IN THE TRACE HEADER IF NOT THERE YET C**** first = .FALSE. IF(IDELAY.GT.-30000) IBUF1(55)=IDELAY ! THE USER'S DELAY IN MILS SR=REAL(IBUF1(59))/1000000. ! FLOAT SOME VALUES AND PUT BACK IN THE HEADER IF( ibuf1(59) .EQ. 7812 ) sr = 7.8125E-03 ! 1/128 IF( ibuf1(59) .EQ. 488 ) sr = 1. / 2048. IF( ibuf1(59) .EQ. 244 ) sr = 1. / 4096. IF( ibuf1(59) .EQ. 122 ) sr = 1. / 8192. IF( ibuf1(59) .EQ. 67 ) sr = 1. / 15000. IF( ibuf1(59) .EQ. 63 ) sr = 1. / 16000. IF( ibuf1(59) .EQ. 31 ) sr = 3.125E-05 ! 1/32000 BUF1(46)=IBUF1(55)/1000. ! THE DELAY IN SECONDS c BUF1(47)=IBUF1(56)/1000. ! THE START MUTE TIME IN SECONDS c BUF1(48)=IBUF1(57)/1000. ! THE END MUTE TIME IN SECONDS 177 BUF1(49)=SR ! THE SAMPLE INTERVAL IN TIME OF DEPTH IF( forgat .NE. 0 ) lbuf1(50) = 0 IF( setwbt .EQ. 1 ) THEN IF( BUF1(50) .LT. 0. .OR. BUF1(50) .GT. 25. ) THEN BUF1(50) = 0. ! SET WATER BOTTOM TIME setwbt = 0 ENDIF ENDIF C TO ZERO IF NOT ALREADY A REASONABLE NUMBER - SOMEONE MAY HAVE USED C THIS ENTRY FOR SOMETHING ELSE. C IF(LBUF1(51).NE.INTL(-1)) LBUF1(51)=INTL(0) ! SAME FOR THE END OF GATHER FLAG IF( NTRGAT .GT. 0 ) THEN ! SHOULD WE PUT THE END OF GATHER FLAG ON? lbuf1(51) = 0 ! zero the end of gather signal NTRCN1=NTRCN1+1 ! INCREMENT THE COUNT OF TRACES WITHIN THE RP IF( LBUF1(7) .EQ. 0 ) THEN ! DON'T CHANGE THE RP NUMBER IF SORTED BY RPS! LBUF1(6)=LBUF1(3) ! MAKE THE RP NUMBER THE SAME AS THE SHOT NUMBER LBUF1(7)=NTRCN1 ! MAKE THE RECORD INTO A GATHER ENDIF IF( NTRCN1 .GE. NTRGAT ) THEN NTRCN1 = 0 LBUF1(51) = -1 ENDIF ENDIF c**** c**** Does the user want to throw away the front of the data? c**** or the backend? c**** delay = buf1(46) IF( stime .GT. 0. .AND. stime .GT. delay .AND. sr .GT. 0. ) THEN n = NINT( (stime - delay) / sr ) DO 179 i = 1, numdat - n 179 buf1(numhdr+i) = buf1(numhdr+n+i) numdat = numdat - n IF( numdat .LT. 0 ) numdat = 0 ibuf1(58) = numdat delay = stime buf1(46) = delay ibuf1(55) = NINT(delay * 1000.) ENDIF IF( secs .NE. 0. .AND. sr .GT. 0. ) THEN itemp = NINT( secs / sr ) + 1 c numdat = MIN0(numdat,itemp) numdat = MIN(numdat,itemp) ibuf1(58) = numdat ENDIF IF( set(2) .NE. 0 ) THEN istart = (set(1)-delay) / sr + .5 IF( icompt .NE. 5 ) THEN ibuf1(55) = set(1) * 1000. + .5 ! reset the delay in the header ELSE ibuf1(115) = set(1) * 1000. + .5 ENDIF IF( delay .GT. set(1) ) THEN n = NINT( (delay-set(1)) / sr ) DO 1010 i = 1, n 1010 buf2(i) = 0. DO 1020 i = 1, numdat 1020 buf2(n+i) = buf1(numhdr+i) numdat = numdat + n DO 1030 i = 1, numdat 1030 buf1(numhdr+i) = buf2(i) istart = 0 ENDIF buf1(46) = set(1) delay = set(1) ibuf1(55) = NINT(delay*1000.) IF( set(2) .GT. delay + (numdat-1)*sr ) THEN n = NINT( (set(2)-delay)/sr ) + 1 - numdat DO 1040 i = 1, n 1040 buf1(numhdr+numdat+i) = 0. ENDIF numdat = NINT((set(2)-delay)/sr) + 1 IF( icompt .NE. 5 ) THEN ibuf1(58) = numdat ELSE ibuf1(118) = numdat ENDIF IF( istart .GT. 0 ) THEN DO 1100 i = 1, numdat 1100 buf1(numhdr+i) = buf1(numhdr+istart+i) ENDIF ENDIF C**** C**** WHAT SHOT OR RP DO WE WANT NEXT - WHAT TRACE DO WE WANT NEXT C**** 180 IF( ltrcno .NE. 99999 .AND. alltr .EQ. 0 ) LTRCNO=LTRCNO+TRINC idir = 1 IF( lis .LT. fis .AND. fis .NE. 99999 ) idir = -1 IF( TRINC.LT.0) THEN IF(LTRCNO.GE.LTR) GO TO 300 GOTO 200 ENDIF IF(LTRCNO.LE.LTR.AND.LBUF1(7).EQ.0) GO TO 300 IF( ltrcno .EQ. 99999 .AND. ltype .EQ. 'SHOT' ) GOTO 300 C**** THE NEXT STATEMENT BECAUSE I DON'T KNOW HOW MANY TRACES ARE ON A C**** GATHER UNTIL GATHER PUTS A -1 IN WORD 51. THIS WRECKS BEING C**** ABLE TO READ OTHER PEOPLE'S GATHERS!!!! IF(LBUF1(7).EQ.0 .AND. ntrgat .EQ. 0 .AND. forgat .EQ. 0) GOTO 200! IF NOT A GATHER TAPE SKIP AROUND IF(LTR.GT.0.AND.LTRCNO.GT.LTR.AND.ntrgat.LE.0) LBUF1(51)=-1 ! IF LTR IS GIVEN IF( LBUF1(51) .NE. -1 .OR. forgat .NE. 0 ) GOTO 300 200 IF( allno .EQ. 0 ) THEN LCSHOT=LCSHOT+SINC ELSE lcshot = ltshot ENDIF LTRCNO=FTR IF(LRENUM.NE.-32767) LRENUM=LRENUM+1 ! INCREMENT THE RENUMBER NUMBER IF( TIME .NE. 0. .OR. fis .EQ. 99999 ) GO TO 300 ! IS IT BY GMT? IF( LIS .LT. FIS ) THEN IF( LCSHOT .GE. LIS ) GOTO 300 ELSE IF(LCSHOT.LE.LIS) GO TO 300 ENDIF 220 READ(IPARUN,END=240) IREELN,JLUN,LTYPE,FIS,LIS,SINC,FTR,LTR,TRINC, * ISI,IDELAY,NTRGAT,TIME1,TIME2,ISRCF,lprint, forgat, iorder, & stime, inputdev, set, lrenum, notype, noindex, itrtype, & itrindex, allno, alltr, rewind rewindi = rewind IDIR=1 ! THE DIRECTION OF THE TAPE SEARCH (+1=FORWARD, -1=BACKWARD) IF( FIS .LT. 0 ) THEN IDIR = -1 * iorder FIS=-FIS ! MAKE IT POSITIVE ENDIF LCSHOT = FIS ! THE SHOT TO LOOK FOR LTRCNO = FTR ! THE TRACE NUMBER TO LOOK FOR GOTO 250 240 ISTOP=1 ! we hit the end and there are no more parameter lists RETURN 250 IF(IREEL.EQ.IREELN) GO TO 300 ! IS THERE A REEL CHANGE THRU PARAMETERS C**** C**** TAKE CARE OF REEL CHANGES SPECIFIED THRU THE USER'S PARAMETERS C**** IF( inputdev .NE. ' ' ) THEN PRINT *,' *** ERROR *** Can not go backwards on ', inputdev STOP ENDIF CALL MAGTAP(ILUN,BUF1,0,25,ISTAT) ! BACK OVER THE TRACE CALL TPCHNG(ILUN,ILUN,0) ! GET THE TAPE CHANGE DONE IF(ILUN.LT.0) GO TO 240 ! DID THE OPERATOR STOP THE JOB IF(IREELN.NE.0) PRINT 260,IREELN,ILUN 260 FORMAT(' INPUT REEL',i6,' IS NOW ON UNIT',I3) IREEL=IREELN C**** C**** BACK OVER 2 TRACES IF THE NEXT SHOT/RP IS BACKWARDS C**** THEN INITIATE A READ ON THE NEXT TRACE C**** 300 CONTINUE IF( idir*iorder .LT. 0 ) THEN IF( inputdev .NE. ' ' ) THEN PRINT *,' *** ERROR *** Can not go backwards on ', & inputdev STOP ENDIF CALL MAGTAP(ILUN,BUF1,0,25,ISTAT) ! BACK UP A TAPE RECORD (OVER A TRACE) CALL MAGTAP(ILUN,BUF1,0,25,ISTAT) ! BACK UP A TAPE RECORD (OVER A TRACE) nwrds = maxwds ENDIF CALL MAGTAP(ILUN,BUF2,NWRDS,1,ISTAT) ! INITIATE A READ ON THE NEXT TAPE RECORD IF( forgat .NE. 0 ) THEN lbuf1(51) = 0 ! make sure the end of gather is zero CALL magtap( ilun, buf2, 0, 40, istat ) ! wait for the read if forgat was given IF( istat .EQ. -1 ) lbuf1(51) = -1 ! set the end of gather flag if the next trace is an EOF IF( ltr .NE. 0 .AND. ltrcno-1 .EQ. ltr ) lbuf1(51) = -1 ! ltr given and this trace = ltr IF( jform .NE. 2 .AND. jform .NE. 3 ) THEN ! SSC Phoenix I or SEGY format silly = buf2(6) ! SEGY ELSE silly = buf2(1) ! SSC ENDIF IF( icompt .EQ. 2 .OR. icompt .EQ. 4 ) CALL swap32(lsilly,1) !DEC? IF( lsilly .NE. lbuf1(6) ) THEN lbuf1(51) = -1 ENDIF IF( lbuf1(51) .EQ. -1 ) THEN iforcnt = iforcnt + 1 ! count the rps IF( ltshot .GE. lis .AND. fis .NE. 99999 ) THEN READ(IPARUN,END=240) IREELN,JLUN,LTYPE,FIS,LIS,SINC, * FTR,LTR,TRINC,ISI,IDELAY,NTRGAT,TIME1,TIME2,ISRCF, * lprint, forgat, iorder, stime, inputdev, set, & lrenum, notype, noindex, itrtype, itrindex, allno, & alltr, rewind rewindi = rewind lcshot = fis ELSE IF( fis .NE. 99999 ) THEN IF( allno .EQ. 0 ) THEN lcshot = lcshot + sinc ELSE lcshot = ltshot ENDIF ENDIF ENDIF ltrcno = ftr ENDIF IF( iforcnt .NE. forgat ) THEN lbuf1(51) = 0 ELSE iforcnt = 0 ENDIF ENDIF RETURN END
lemma big_prod: assumes "\<And>x. x \<in> A \<Longrightarrow> f x \<in> L F (g x)" shows "(\<lambda>y. \<Prod>x\<in>A. f x y) \<in> L F (\<lambda>y. \<Prod>x\<in>A. g x y)"
import System.Environment import Data.Complex import Paraiso main = do args <- getArgs let arch = if "--cuda" `elem` args then CUDA 128 128 else X86 putStrLn $ compile arch code where code = do parallel 16384 $ do c <- allocate z <- allocate c =$ (Rand (-2.0) 2.0) :+ (Rand (-2.0) 2.0) z =$ (0 :+ 0 :: Complex (Expr Double)) cuda $ do sequential (65536) $ do z =$ z * z + c output [realPart c,imagPart c, realPart z, imagPart z]
#!/usr/bin/env python3 import numpy as np def random_sine_functions( N, M, mu_w=np.pi, sd_w=1.0, mu_A=1.0, sd_A=1.0, mu_phi=0.0, sd_phi=1.0 ): """Generate an N x M matrix of randomly generated sine functions. Random variables will be sampled from Gaussian distributions. The sine function is computed on a grid from -2pi -> 2pi, although this grid is not meaningful in the machine learning context. Parameters ---------- N, M : int Specifies the dimension of the returned matrix, N x M. mu_w, sd_w : float The mean and standard deviation of the frequency. mu_A, sd_A : float The mean and standard deviation of the amplitude. mu_phi, sd_phi : float The mean and stanadrd deviation of the phase. Returns ------- np.ndarray Of shape N x M. """ w = np.random.normal(loc=mu_w, scale=sd_w, size=(N, 1)) A = np.random.normal(loc=mu_A, scale=sd_A, size=(N, 1)) phi = np.random.normal(loc=mu_phi, scale=sd_phi, size=(N, 1)) x = np.linspace(-2.0 * np.pi, 2.0 * np.pi, M).reshape(1, M) return np.sin(w * (x + phi)) * A
module Program import CommonTestingStuff import Data.List export beforeString : String beforeString = "before coop" s55 : PrintString m => CanSleep m => (offset : Time) => m String s55 = do printTime offset " s55 proc, first" for 5 $ do printTime offset " s55 proc, before 350" sleepFor 350.millis printTime offset " s55 proc, before 750" sleepFor 750.millis "short" <$ printTime offset " s55 proc, last" export program : PrintString m => CanSleep m => Zippable m => Alternative m => m Unit program = do offset <- currentTime printTime offset "start" res <- zipWith (++) empty s55 printTime offset "top: \{res}" printTime offset "end"
import Mynat.AddAdv import Mynat.Mul namespace mynat theorem mul_pos (a b : mynat) : a ≠ 0 → b ≠ 0 → a * b ≠ 0 := by intro h1 intro h2 cases a case zero => rw [mynat_zero_eq_zero] rw [zero_mul] exact h1 case succ a' => cases b case zero => rw [mynat_zero_eq_zero] rw [mul_zero] exact h2 case succ b' => rw [mul_succ] rw [succ_mul] rw [add_succ] exact succ_ne_zero _ theorem eq_zero_or_eq_zero_of_mul_eq_zero (a b : mynat) (h : a * b = 0) : a = 0 ∨ b = 0 := by cases a case zero => rw [mynat_zero_eq_zero] apply Or.intro_left rfl case succ a' => cases b case zero => rw [mynat_zero_eq_zero] apply Or.intro_right rfl case succ b' => apply False.elim have samtz := succ_ne_zero a' have sbmtz := succ_ne_zero b' have hfalse := (mul_pos (succ a') (succ b')) samtz sbmtz exact hfalse h theorem mul_eq_zero_iff (a b : mynat): a * b = 0 ↔ a = 0 ∨ b = 0 := by apply Iff.intro . intro H exact eq_zero_or_eq_zero_of_mul_eq_zero a b H . intro h apply Or.elim h . intro hz rw [hz] rw [zero_mul] . intro hz rw [hz] rw [mul_zero] theorem mul_left_cancel (a b c : mynat) (ha : a ≠ 0) : a * b = a * c → b = c := by induction c generalizing b case zero => rw [mynat_zero_eq_zero] rw [mul_zero] intro h have aorb := (mul_eq_zero_iff a b).mp h cases aorb case inl hh => apply False.elim exact ha hh case inr hh => exact hh case succ c' hc => rw [mul_succ] cases b case zero => rw [mynat_zero_eq_zero] rw [mul_zero] intro h' have h'' := (calc a * c' + a = 0 := by rw[h'] ) have haz := add_left_eq_zero h'' apply False.elim exact ha haz case succ b' => rw [mul_succ] intro hhh have bec := (add_right_cancel (a * b') a (a * c')) hhh rw [succ_eq_succ_iff b' c'] exact hc b' bec end mynat
import Hw5 import Lean.Elab.Print import Lean.Elab.Command theorem desiredType (A B : Prop) : (A → B) ↔ ¬ A ∨ B := sorry open Lean open Lean.Meta open Lean.Elab.Command def collectAxiomsOf (constName : Name) : MetaM (List String) := do let env ← getEnv let (_, s) := ((CollectAxioms.collect constName).run env).run {} let a := s.axioms.toList.map toString return a #eval isDefEq (Expr.const ``desiredType []) (Expr.const ``problem4 []) #eval collectAxiomsOf ``problem4
import Data.Nat partial fizzBuzzSimple: (x: Nat) -> String fizzBuzzSimple x with (modNat x (the Nat 3), modNat x (the Nat 5)) fizzBuzzSimple x | (Z, Z) = "fizzbuzz" fizzBuzzSimple x | (Z, _) = "fizz" fizzBuzzSimple x | (_, Z) = "buzz" fizzBuzzSimple x | _ = show x
import luc_double_squares lemma prod_pos (a b n: ℕ ) (h: n=a*b) (h2: 0<n) : 0<b:= begin by_contra, push_neg at a_1, interval_cases b, rw mul_zero at h, rw h at h2, linarith end lemma product_ineq (a b n: ℕ ) (h: 2≤ a) (h3: 0 <n): n=a*b → b <n ∧ 0<b:= begin intro h2, rw nat.succ_le_iff at h, rw h2, nth_rewrite_lhs 0 ← one_mul b, have h1:=prod_pos a b n h2 h3, have h2:= mul_lt_mul h (le_refl b) h1 (zero_le a), split, assumption' end lemma coprime_squares_factors (a b n: ℕ ) (h: a*b=n^2) (h1: nat.coprime a b) (h2: 0 <n): ∃ (r : ℕ), a=r^2:= begin revert b, revert a, revert h2, apply nat.strong_induction_on n, {intros m hd h0 a b h h1, cases lt_or_le a 2, {interval_cases a, {use 0, ring}, {use 1, ring}}, {cases nat.exists_prime_and_dvd h_1 with p h3, cases h3.2 with x h4, have h5: p ∣ a*b, {use x*b, rw h4, rw mul_assoc}, rw h at h5, have h6:= nat.prime.dvd_of_dvd_pow h3.1 h5, have h7:= nat.pow_dvd_pow_of_dvd h6 2, rw ← h at h7, have h9: ¬ p ∣ b, {by_contra, have i1: 2 ≤ nat.gcd a b, {apply le_trans (nat.prime.two_le h3.1), apply nat.le_of_dvd (nat.gcd_pos_of_pos_left b (show 0<a, by linarith)), apply nat.dvd_gcd h3.2 a_1}, have h1': nat.gcd a b=1, {exact h1}, rw h1' at i1, linarith}, have h10: (p^2).coprime b, {apply nat.coprime.symm, exact nat.prime.coprime_pow_of_not_dvd h3.1 h9}, have h11:= nat.coprime.dvd_of_dvd_mul_right h10 h7, cases h11 with y h11, cases h6 with z h6, rw h6 at h, rw h11 at h, rw nat.mul_pow at h, have h12: p^2>0, apply nat.pow_pos, apply gt_of_ge_of_gt (nat.prime.two_le h3.1) (show 2>0, by linarith), rw mul_assoc at h, rw nat.mul_right_inj h12 at h, have h13:= product_ineq p z (m) (nat.prime.two_le h3.1) h0 h6, rw h11 at h1, have h14:= hd z h13.1 h13.2 y b h (nat.coprime.coprime_mul_left h1), cases h14 with r h14, use p*r, rw h11, rw h14, rw nat.mul_pow}} end lemma squares_factors ( a b n:ℕ) (h: a*b=n^2) (h1: 0<n) : ∃ (r s: ℕ ), a=(nat.gcd a b)*r^2 ∧ b = (nat.gcd a b)*s^2:= begin cases nat.eq_zero_or_pos (nat.gcd a b) with g0 g0, {simp [nat.eq_zero_of_gcd_eq_zero_right g0] at *, rw nat.pow_two at h, rw eq_comm at h, rw nat.mul_eq_zero at h, rw (or_self (n=0)) at h, rw h at h1, linarith}, {rcases nat.exists_coprime g0 with ⟨ x, y ,g3, g1, g2 ⟩, rw g1 at h, nth_rewrite 1 g2 at h, have g4: (nat.gcd a b)^2 ∣ n^2, {use x*y, rw ← h, ring}, rw nat.pow_dvd_pow_iff (show 0<2, by linarith) at g4, cases g4 with s g4, rw mul_comm at h, rw ← mul_assoc at h, nth_rewrite 1 mul_assoc at h, nth_rewrite 2 mul_comm at h, repeat {rw mul_assoc at h}, rw ← pow_two at h, rw ← mul_assoc at h, rw g4 at h,rw nat.mul_pow at h, repeat {rw nat.pow_eq_pow at h}, rw mul_comm at h, have g5:= mul_pos g0 g0, rw ← nat.pow_two at g5, rw nat.mul_right_inj g5 at h, have g6:= coprime_squares_factors y x s h g3.symm (prod_pos (nat.gcd a b) s n g4 h1), cases g6 with r g6, rw mul_comm at h, have g7:= coprime_squares_factors x y s h g3 (prod_pos (nat.gcd a b) s n g4 h1), cases g7 with s g7, rw g6 at g2, rw g7 at g1, rw mul_comm at g2, rw mul_comm at g1, use s, use r, cc} end theorem fib_squares (n k: ℕ ) (h: fib n =k^2) : n=0 ∨ n=1 ∨ n=2 ∨ n=12:= begin cases res_mod_4' n with h0 h1', cases div_algo n 2 with w h1, rw h0 at h1, rw add_zero at h1, swap, {cases div_algo n 4 with s h2',cases h1' with h1 h_1, {cases nat_case_bash s 0 with g2 g3, swap, {cases g3 with q g3, rw add_zero q at g3, cases decomp_pow_3 s (show s>0, by linarith) with r g4, rcases g4 with ⟨ u, g4, g5 ⟩, rw add_comm at h2', have g6:=double_not_zero_mod3 u g5, have g7:=fun_gen_add 1 u n s q r (n%4) (luc(2*u)) (fib) h2' g3 g4 (mod_fib (2*1*u) g6), repeat{rw mul_one at g7}, rw h at g7, rw ← zmod.nat_coe_zmod_eq_zero_iff_dvd at g7, apply_fun (λ (a: zmod (luc(2*u))), (a- fib(n%4))) at g7, have H: (k^2 : zmod (luc(2*u))) = -fib(n%4), {simp at g7, exact g7}, rw h1 at H, rw [show fib 1 =1, from rfl] at H, simp at H, have g10:= non_res_3_mod_4 _ _ (luc_pos (2*u)) H, rw luc_mod_4 (2*u) g6 at g10, contradiction}, {simp * at *}}, {have h2: n=4*(s+1)-1, {rw add_comm at h2', rw h2', rw h_1, rw mul_add, rw mul_one, rw nat.add_sub_assoc (show 1 ≤ 4, by linarith), rw add_comm}, cases decomp_pow_3 (s+1) (show s+1>0, by linarith) with r g4, rcases g4 with ⟨ u, g4, g5 ⟩, have g6:=double_not_zero_mod3 u g5, have g7:= fun_gen_add 1 u (4*u-1 + 2*2*(s+1)) (s+1) s r (4*u-1) (luc(2*u)) (fib) (show 4*u-1+2*2*(s+1) = 4*u-1+2*2*(s+1), from rfl) (show s+1=s+1, from rfl) g4 (mod_fib (2*u) g6), have g8:= mod_fib (2*u) g6 (4*(s+1)-1), have i1: 1 ≤ 2*(2*u), {have h2: 1 ≤ u, {by_contra, push_neg at a, interval_cases u, linarith}, ring, apply le_trans (show 1 ≤ 4*1, by linarith), linarith}, have g9:= mod_fib_sub (2*u) (1) (g6.1) (g6.2) (i1), rw (show (-1 :ℤ )^(1+1) = 1, by ring) at g9, rw one_mul at g9, norm_cast at g9, rw (show 2*(2*u)=4*u, by ring) at *, have g10: 4*(s+1)-1+4*u = 4*u -1+2*2*(s+1), {rw (show 2*2 =4, from rfl), rw add_sub_add _ _ _ (i1) (show 1 ≤ 4*(s+1), by linarith)}, rw g10 at g8, have g11:= nat.dvd_add g8 g9, rw add_assoc at g11, nth_rewrite 1 ← add_assoc at g11, nth_rewrite 4 add_comm at g11, repeat {rw ← add_assoc at g11}, rw add_assoc at g11, rw nat.dvd_add_right g7 at g11, rw h2 at h, rw h at g11, rw ← zmod.nat_coe_zmod_eq_zero_iff_dvd at g11, apply_fun (λ (a: zmod (luc(2*u))), (a- fib (1))) at g11, have H: (↑ k^2 : zmod (luc((2*u)))) = -fib(1), {simp at g11, simp, rw ← g11}, rw (show fib 1 =1, from rfl) at H, simp at H, have g12:= non_res_3_mod_4 _ _ (luc_pos(2*u)) H, rw luc_mod_4 (2*u) g6 at g12, contradiction}}, {rw h1 at h, rw fib_2k w at h,cases nat_case_bash k 0, swap, {cases classical.em (w%3=0), {rw ← nat.dvd_iff_mod_eq_zero at h_2, cases h_2 with x h_2, rw h_2 at h, cases h_1 with s h_1, rw add_zero s at h_1, cases squares_factors _ _ _ h (show 0 <k, by linarith) with b h3, rcases h3 with ⟨ a, h3, h4⟩, rw fib_luc_gcd x at *, have h5:= luc_double_square (3*x) _ h4, rw h_2 at h1, cases h5 with h51 h52, {rw h51 at h1, rw mul_zero at h1, left, assumption}, {rw h52 at h1, repeat{right}, rw h1, ring}}, {cases h_1 with s h1', rw add_zero (s) at h1', cases squares_factors _ _ _ h (show 0 <k, by linarith) with b h3, rcases h3 with ⟨ a, h3, h4⟩, rw fib_luc_gcd_2 w h_2 at *, rw one_mul at h4, have h5:= luc_square w _ h4, cases h5 with h51 h52, {rw h51 at h1, rw mul_one at h1, cc }, {rw h52 at h_2, rw (show 3%3 =0, from rfl) at h_2, contradiction}}}, {rw le_zero_iff_eq at h_1, rw h_1 at h, rw (show 0^2=0, from rfl) at h, rw nat.mul_eq_zero at h, cases h with hx hy, {cases nat_case_bash w 0, {rw le_zero_iff_eq at h, rw h at h1, rw h1, simp}, {cases h with k h, rw add_zero k at h, rw h at hx, have i1:= fib_pos k, linarith}}, have i2:= luc_pos w, linarith}} end
''' Evaluate on validation set using the ensemble of 2 or more models ''' import detectron2 from pathlib import Path import random, cv2, os import pandas as pd import matplotlib.pyplot as plt # import some common detectron2 utilities from detectron2 import model_zoo from detectron2.engine import DefaultPredictor, DefaultTrainer from detectron2.config import get_cfg, CfgNode from detectron2.utils.visualizer import Visualizer, ColorMode from detectron2.data import MetadataCatalog, DatasetCatalog from detectron2.data.datasets import register_coco_instances from detectron2.modeling.backbone import fpn_resneSt import numpy as np import torch from utils.metric_by_outputs import calculate_AP from utils.ensemble import ensemble from tqdm import tqdm import argparse parser = argparse.ArgumentParser(description='Some arguments') parser.add_argument('--image_dir', type=str, default=f'data/images', help='Path to image folder') parser.add_argument('--annotation_dir', type=str, default=f'data/annotations_semi_supervised_round2', help='Path to annotation folder') parser.add_argument('--weights', type=str, default='models/pretrained_models/pseudo_round1_model.pth models/pretrained_models/pseudo_round2_model.pth', help='Paths to weight separated by a space') args = parser.parse_args() weight_list = args.weights.split(' ') print(f'Ensemble {len(weight_list)} models:') print(weight_list) ANN_DIR = args.annotation_dir IMAGE_DIR = args.image_dir FOLD = 0 FINAL_THRESH = [0.5, 0.7, 0.8] # =========== Define functions for config ========== def get_config(weight): cfg = get_cfg() cfg.INPUT.MASK_FORMAT='bitmask' cfg.MODEL.RESNETS.RADIX = 1 cfg.MODEL.RESNETS.DEEP_STEM = False cfg.MODEL.RESNETS.AVD = False # Apply avg_down to the downsampling layer for residual path cfg.MODEL.RESNETS.AVG_DOWN = False cfg.MODEL.RESNETS.BOTTLENECK_WIDTH = 64 cfg.merge_from_file(f"configs/mask_rcnn_ResNeSt200.yaml") cfg.MODEL.ROI_HEADS.NUM_CLASSES = 3 cfg.MODEL.WEIGHTS = weight cfg.MODEL.ROI_HEADS.NMS_THRESH_TEST = 0.99 cfg.CUSTOM = CfgNode() cfg.TEST.DETECTIONS_PER_IMAGE = 10000 # img size cfg.INPUT.MIN_SIZE_TEST = 1024 cfg.INPUT.MAX_SIZE_TEST = 2000 cfg.TEST.AUG.MIN_SIZES = (1024, ) cfg.TEST.AUG.FLIP = False return cfg # ======================================================= # ====== Register datasets ======= dataDir=Path(IMAGE_DIR) register_coco_instances('sartorius_val',{}, f'{ANN_DIR}/annotations_valid_{FOLD}.json', dataDir) metadata = MetadataCatalog.get('sartorius_val') valid_ds = DatasetCatalog.get('sartorius_val') # ================================ # ========== Load models =========== list_cfgs = [] list_predictors = [] for weight in args.weights.split(' '): cfg = get_config(weight) predictor = DefaultPredictor(cfg) list_cfgs.append(cfg) list_predictors.append(predictor) # ================================== # ========== Evaluate =========== print('Evaluating on valid data ....') list_APs = [] list_TPs = [] list_FPs = [] list_FNs = [] list_logs = [] list_cell_types = [] list_inst_counts = [] list_im_ids = [] i = 0 for d in tqdm(valid_ds, total=len(valid_ds)): outputs = ensemble(d, list_cfgs, list_predictors, conf_thresh=FINAL_THRESH) calculate_AP(outputs, d['annotations']) AP, TP, FP, FN, log = calculate_AP(outputs, d['annotations']) list_APs.append(AP) list_logs.append(log) list_TPs.append(TP) list_FPs.append(FP) list_FNs.append(FN) list_cell_types.append(d['annotations'][0]['category_id']) list_inst_counts.append(len(d['annotations'])) list_im_ids.append(d['image_id']) i+=1 # if(i > 3): # break import pandas as pd result_df = pd.DataFrame({'image_id':list_im_ids, 'cell_type':list_cell_types, 'inst_count':list_inst_counts, 'AP':list_APs, 'TP':list_TPs, 'FP':list_FPs, 'FN':list_FNs,'log':list_logs}) print('Result by each cell type (average precision [email protected]:0.95):') print(result_df.groupby('cell_type').AP.sum() / len(result_df)) print('\nResult (average precision [email protected]:0.95):') print(result_df.AP.mean()) # =================================
sizeof (bitRecord1): 1 sizeof (bitRecord2): 2 sizeof (bitRecord3): 3 sizeof (bitRecord4): 4 sizeof (bitRecord5): 5 sizeof (bitRecord6): 6 sizeof (bitRecord7): 7 sizeof (bitRecord8): 8 sizeof (bitRecord12): 12
-- --------------------------------- -- this is the agda file implementing my own work on logic, viz. a relational -- framework for logic. -- These codes have been checked by Agda 2.6.0 -- --------------------------------- module RL where -- this file use agda standard library open import Agda.Builtin.Equality open import Relation.Nullary open import Data.Empty open import Data.Product -- --------------------------------- -- Logical Frame -- --------------------------------- record Frame : Set₁ where field Φ : Set -- the set of language bot : Φ -- contradiction top : Φ -- validity _⇌_ : Φ → Φ → Set -- ⇌ is interpreted as consistency relation symm : ∀ (x y : Φ) → x ⇌ y → y ⇌ x -- ⇌ is symmetric alre : ∀ (x : Φ) → ¬ (x ≡ bot) → x ⇌ x -- except for ⊥, ⇌ is reflexive ⊥-contra : ∀ (x : Φ) → ¬ (x ⇌ bot) -- ⊥ is in-⇌ with any x∈Φ ⊤-validi : ∀ (x : Φ) → ¬ (x ≡ bot) → (x ⇌ top) -- ⊤ ⇌ everything e.x. ⊥ substitution : {A : Frame} (x y z : Frame.Φ A) -- ∀x,y,z∈Φ.(x≡y ∧ x⇌z → y⇌z) → x ≡ y → Frame._⇌_ A x z → Frame._⇌_ A y z substitution {A} x y z p q rewrite p = q cons→non-contra : {A : Frame} (x : Frame.Φ A) -- ∀x∈Φ.(∃y∈Φ.(x⇌y) → x≠⊥) → ∃[ y ] Frame._⇌_ A x y → ¬ (x ≡ Frame.bot A) cons→non-contra {A} x (y , f) q = Frame.⊥-contra A y w where s : Frame._⇌_ A (Frame.bot A) y s = substitution {A} x (Frame.bot A) y q f w : Frame._⇌_ A y (Frame.bot A) w = Frame.symm A (Frame.bot A) y s module Example₁ where data tf : Set where 𝟘x 𝟙x : tf data _↔_ : tf → tf → Set where t-t : 𝟙x ↔ 𝟙x symm-tf : ∀ (x y : tf) → x ↔ y → y ↔ x symm-tf 𝟙x 𝟙x t-t = t-t alre-tf : ∀ (x : tf) → ¬ (x ≡ 𝟘x) → x ↔ x alre-tf 𝟙x _ = t-t alre-tf 𝟘x p = ⊥-elim (p refl) 𝟙x-validi : ∀ (x : tf) → ¬ (x ≡ 𝟘x) → (x ↔ 𝟙x) 𝟙x-validi 𝟙x _ = t-t 𝟙x-validi 𝟘x ¬p = ⊥-elim (¬p refl) 𝟘x-contra : ∀ (x : tf) → ¬ (x ↔ 𝟘x) 𝟘x-contra x () tfFrame : Frame -- the smallest possible normal frame tfFrame = record { Φ = tf ; bot = 𝟘x ; top = 𝟙x ; _⇌_ = _↔_ ; symm = symm-tf ; alre = alre-tf ; ⊥-contra = 𝟘x-contra ; ⊤-validi = 𝟙x-validi } -- --------------------------------- -- Logical Consequence -- --------------------------------- record _⊢_ {A : Frame} (a b : Frame.Φ A) : Set where -- logical consequence field -- a⊢b ⇔ ∀x∈Φ.(x⇌a → x⇌b) fromCons : ∀ (x : Frame.Φ A) → Frame._⇌_ A x a → Frame._⇌_ A x b -- --------------------------------- -- properties of ⊢ refl-⊢ : {A : Frame} (a : Frame.Φ A) → _⊢_ {A} a a -- reflexive refl-⊢ {A} a = record { fromCons = p } where p : ∀ (x : Frame.Φ A) → Frame._⇌_ A x a → Frame._⇌_ A x a p x q = q trans-⊢ : {A : Frame} (a b c : Frame.Φ A) -- transitive → _⊢_ {A} a b → _⊢_ {A} b c → _⊢_ {A} a c trans-⊢ {A} a b c p q = record { fromCons = f } where f : ∀ (x : Frame.Φ A) → Frame._⇌_ A x a → Frame._⇌_ A x c f x h = _⊢_.fromCons q x (_⊢_.fromCons p x h) -- --------------------------------- -- --------------------------------- -- ∀x∈Φ.(⊥⊢x) bot-cons : {A : Frame} (x : Frame.Φ A) -- ∀x∈Φ.∀y∈Φ.(y⇌⊥ → y⇌x) → ∀ (y : Frame.Φ A) → Frame._⇌_ A y (Frame.bot A) → Frame._⇌_ A y x bot-cons {A} x y p = ⊥-elim (Frame.⊥-contra A y p) bot-to-every : {A : Frame} (x : Frame.Φ A) → _⊢_ {A} (Frame.bot A) x bot-to-every {A} x = record { fromCons = bot-cons {A} x } -- --------------------------------- -- --------------------------------- -- ∀x∈Φ.(x⊢⊤) top-cons : {A : Frame} (y x : Frame.Φ A) -- ∀y∈Φ.∀x∈Φ.(x⇌y → x⇌⊤) → Frame._⇌_ A x y → Frame._⇌_ A x (Frame.top A) top-cons {A} y x p = Frame.⊤-validi A x (cons→non-contra {A} x (y , p)) top-from-every : {A : Frame} (x : Frame.Φ A) → _⊢_ {A} x (Frame.top A) top-from-every {A} x = record { fromCons = top-cons {A} x } -- --------------------------------- -- --------------------------------- -- the criteria for a Reasoning frame -- --------------------------------- record Reasoning (A : Frame) : Set₁ where field -- basically, reas says every consistent pair is testified reas : ∀ (x y : Frame.Φ A) → Frame._⇌_ A x y → ∃[ z ] ((¬ (z ≡ Frame.bot A)) × ((_⊢_ {A} z x) × (_⊢_ {A} z y))) module Example₂ where open Example₁ 𝟘x⊢𝟘x : _⊢_ {tfFrame} 𝟘x 𝟘x 𝟘x⊢𝟘x = refl-⊢ {tfFrame} 𝟘x 𝟘x⊢𝟙x : _⊢_ {tfFrame} 𝟘x 𝟙x 𝟘x⊢𝟙x = bot-to-every {tfFrame} 𝟙x 𝟙x⊢𝟙x : _⊢_ {tfFrame} 𝟙x 𝟙x 𝟙x⊢𝟙x = refl-⊢ {tfFrame} 𝟙x reas-tf : ∀ (x y : tf) → (x ↔ y) → ∃[ z ] ((¬ (z ≡ 𝟘x)) × ((_⊢_ {tfFrame} z x) × (_⊢_ {tfFrame} z y))) reas-tf 𝟘x _ () reas-tf 𝟙x 𝟙x _ = (𝟙x , (p , (𝟙x⊢𝟙x , 𝟙x⊢𝟙x))) where p : ¬ (𝟙x ≡ 𝟘x) p () Reasoning-tf : Reasoning tfFrame Reasoning-tf = record { reas = reas-tf }
Formal statement is: lemma leibniz_rule_holomorphic: fixes f::"complex \<Rightarrow> 'b::euclidean_space \<Rightarrow> complex" assumes "\<And>x t. x \<in> U \<Longrightarrow> t \<in> cbox a b \<Longrightarrow> ((\<lambda>x. f x t) has_field_derivative fx x t) (at x within U)" assumes "\<And>x. x \<in> U \<Longrightarrow> (f x) integrable_on cbox a b" assumes "continuous_on (U \<times> (cbox a b)) (\<lambda>(x, t). fx x t)" assumes "convex U" shows "(\<lambda>x. integral (cbox a b) (f x)) holomorphic_on U" Informal statement is: If $f$ is a function from a convex set $U$ to the space of functions from $[a, b]$ to $\mathbb{C}$ such that $f$ is differentiable in $x$ and $f(x)$ is integrable for all $x \in U$, then the function $g(x) = \int_a^b f(x)(t) dt$ is holomorphic on $U$.
Arriving in pursuit of her daughter , Lady Bracknell is astonished to be told that Algernon and Cecily are engaged . The revelation of Cecily 's trust fund soon dispels Lady Bracknell 's initial doubts over the young lady 's suitability , but any engagement is forbidden by her guardian Jack : he will consent only if Lady Bracknell agrees to his own union with Gwendolen — something she declines to do .
[STATEMENT] theorem awp_iff_constrains: "(A <= awp F B) = (F \<in> A co B)" [PROOF STATE] proof (prove) goal (1 subgoal): 1. (A \<subseteq> awp F B) = (F \<in> A co B) [PROOF STEP] by (simp add: awp_def constrains_def wp_iff INT_subset_iff)
#include <boost/math/special_functions/owens_t.hpp>
/- Copyright (c) 2021 Gabriel Ebner. All rights reserved. Released under Apache 2.0 license as described in the file LICENSE. Author: Gabriel Ebner -/ import Lean import Mathlib.Tactic.Cache import Mathlib.Tactic.RCases open Tactic namespace Mathlib.Tactic.Ext open Lean Meta def withExtHyps (struct : Name) (k : Array Expr → (x y : Expr) → Array (Name × Expr) → MetaM α) : MetaM α := do unless isStructure (← getEnv) struct do throwError "not a structure: {struct}" let structC ← mkConstWithLevelParams struct forallTelescope (← inferType structC) fun params _ => do withNewBinderInfos (params.map (·.fvarId!, BinderInfo.implicit)) do withLocalDeclD `x (mkAppN structC params) fun x => do withLocalDeclD `y (mkAppN structC params) fun y => do let mut hyps := #[] for field in getStructureFieldsFlattened (← getEnv) struct (includeSubobjectFields := false) do let x_f ← mkProjection x field let y_f ← mkProjection y field if ← isProof x_f then pure () else if ← isDefEq (← inferType x_f) (← inferType y_f) then hyps := hyps.push (field, ← mkEq x_f y_f) else hyps := hyps.push (field, ← mkHEq x_f y_f) k params x y hyps scoped elab "ext_type%" struct:ident : term => do withExtHyps (← resolveGlobalConstNoOverload struct) fun params x y hyps => do let mut ty ← mkEq x y for (f, h) in hyps.reverse do ty := mkForall f BinderInfo.default h ty mkForallFVars (params |>.push x |>.push y) ty def mkIff (p q : Expr) : Expr := mkApp2 (mkConst ``Iff) p q def mkAndN : List Expr → Expr | [] => mkConst ``True | [p] => p | [p, q] => mkAnd p q | p :: ps => mkAnd p (mkAndN ps) scoped elab "ext_iff_type%" struct:ident : term => do withExtHyps (← resolveGlobalConstNoOverload struct) fun params x y hyps => do mkForallFVars (params |>.push x |>.push y) <| mkIff (← mkEq x y) <| mkAndN (hyps.map (·.2)).toList elab "subst_eqs" : tactic => open Elab.Tactic in liftMetaTactic1 fun mvarId => substEqs mvarId scoped macro "ext_proof%" : term => `(fun {..} {..} => by intros; subst_eqs; rfl) syntax "split_ands" : tactic macro_rules | `(tactic| split_ands) => `(tactic| skip) macro_rules | `(tactic| split_ands) => `(tactic| refine And.intro ?_ ?_ <;> split_ands) macro_rules | `(tactic| rfl) => `(tactic| exact HEq.rfl) scoped macro "ext_iff_proof%" : term => `(fun {..} {..} => ⟨fun _ => by subst_eqs; split_ands <;> rfl, fun _ => by (repeat cases ‹_ ∧ _›); subst_eqs; rfl⟩) scoped macro "declareExtTheoremsFor" struct:ident : command => do let extName := mkIdent <| struct.getId.eraseMacroScopes.mkStr "ext" let extIffName := mkIdent <| struct.getId.eraseMacroScopes.mkStr "ext_iff" `(@[ext] protected theorem $extName:ident : ext_type% $struct:ident := ext_proof% protected theorem $extIffName:ident : ext_iff_type% $struct:ident := ext_iff_proof%) open Elab.Command MonadRecDepth in def liftCommandElabM (k : CommandElabM α) : AttrM α := do let (a, commandState) ← k.run { fileName := (← getEnv).mainModule.toString, fileMap := default } |>.run { env := ← getEnv, maxRecDepth := ← getMaxRecDepth, scopes := [{ header := "", opts := ← getOptions }] } modify fun coreState => { coreState with traceState.traces := coreState.traceState.traces ++ commandState.traceState.traces env := commandState.env } if let some err := commandState.messages.msgs.toArray.find? (·.severity matches MessageSeverity.error) then throwError err.data pure a initialize extExtension : SimpleScopedEnvExtension (Name × Array DiscrTree.Key) (DiscrTree Name) ← registerSimpleScopedEnvExtension { name := `ext addEntry := fun dt (n, ks) => dt.insertCore ks n initial := {} } def extAttribute : AttributeImpl where name := `ext descr := "Marks a lemma as extensionality lemma" add decl stx kind := do if isStructure (← getEnv) decl then liftCommandElabM do Elab.Command.elabCommand <|<- `(declareExtTheoremsFor $(mkIdent decl)) else MetaM.run' do let declTy := (← getConstInfo decl).type let (xs, bis, declTy) ← withReducible <| forallMetaTelescopeReducing declTy if declTy.isAppOfArity ``Eq 3 && (declTy.getArg! 1).isMVar && (declTy.getArg! 2).isMVar then let ty := declTy.getArg! 0 let key ← if (← withReducible <| whnf ty).isForall then pure #[DiscrTree.Key.star] -- FIXME: workaround else withReducible <| DiscrTree.mkPath ty extExtension.add (decl, key) kind else throwError "@[ext] attribute only applies to structures or lemmas proving x = y, got {declTy}" initialize registerBuiltinAttribute extAttribute def extLemmas (env : Environment) : DiscrTree Name := extExtension.getState env open Lean.Elab.Tactic in elab "apply_ext_lemma" : tactic => do let tgt ← getMainTarget unless tgt.isAppOfArity ``Eq 3 do throwError "applyExtLemma only applies to equations, not{indentExpr tgt}" let ty := tgt.getArg! 0 let s ← saveState for lem in ← (extLemmas (← getEnv)).getMatch ty do try liftMetaTactic (apply · (← mkConstWithFreshMVarLevels lem)) return catch e => s.restore throwError "no applicable extensionality lemma found for{indentExpr ty}" scoped syntax "ext_or_skip" (ppSpace rintroPat)* : tactic macro_rules | `(tactic| ext_or_skip) => `(tactic| skip) macro_rules | `(tactic| ext_or_skip $xs:rintroPat*) => `(tactic| apply_ext_lemma; ext_or_skip $xs:rintroPat*) macro_rules | `(tactic| ext_or_skip $x:rintroPat $xs:rintroPat*) => `(tactic| rintro $x:rintroPat; ext_or_skip $xs:rintroPat*) -- TODO: support `ext : n` syntax "ext" (colGt ppSpace rintroPat)* (" : " num)? : tactic macro_rules | `(tactic| ext) => do `(tactic| first | intro; ext | apply_ext_lemma; ext | skip) macro_rules | `(tactic| ext $xs:rintroPat*) => `(tactic| apply_ext_lemma; ext_or_skip $xs:rintroPat*) syntax "ext1" (colGt ppSpace rintroPat)* : tactic macro_rules | `(tactic| ext1 $xs:rintroPat*) => `(tactic| apply_ext_lemma; rintro $xs:rintroPat*) -- TODO syntax "ext1?" (colGt ppSpace rintroPat)* : tactic syntax "ext?" (colGt ppSpace rintroPat)* (" : " num)? : tactic
[GOAL] ⊢ riemannZeta 0 = -1 / 2 [PROOFSTEP] rw [riemannZeta_def] [GOAL] ⊢ Function.update (fun s => ↑π ^ (s / 2) * riemannCompletedZeta s / Complex.Gamma (s / 2)) 0 (-1 / 2) 0 = -1 / 2 [PROOFSTEP] exact Function.update_same _ _ _ [GOAL] t : ℝ ht : 0 < t ⊢ Summable fun n => rexp (-π * t * (↑n + 1) ^ 2) [PROOFSTEP] have : 0 < (↑t * I).im := by rwa [ofReal_mul_im, I_im, mul_one] [GOAL] t : ℝ ht : 0 < t ⊢ 0 < (↑t * I).im [PROOFSTEP] rwa [ofReal_mul_im, I_im, mul_one] [GOAL] t : ℝ ht : 0 < t this : 0 < (↑t * I).im ⊢ Summable fun n => rexp (-π * t * (↑n + 1) ^ 2) [PROOFSTEP] convert summable_norm_iff.mpr (hasSum_nat_jacobiTheta this).summable using 1 [GOAL] case h.e'_5 t : ℝ ht : 0 < t this : 0 < (↑t * I).im ⊢ (fun n => rexp (-π * t * (↑n + 1) ^ 2)) = fun x => ‖cexp (↑π * I * (↑x + 1) ^ 2 * (↑t * I))‖ [PROOFSTEP] ext1 n [GOAL] case h.e'_5.h t : ℝ ht : 0 < t this : 0 < (↑t * I).im n : ℕ ⊢ rexp (-π * t * (↑n + 1) ^ 2) = ‖cexp (↑π * I * (↑n + 1) ^ 2 * (↑t * I))‖ [PROOFSTEP] rw [Complex.norm_eq_abs, Complex.abs_exp] [GOAL] case h.e'_5.h t : ℝ ht : 0 < t this : 0 < (↑t * I).im n : ℕ ⊢ rexp (-π * t * (↑n + 1) ^ 2) = rexp (↑π * I * (↑n + 1) ^ 2 * (↑t * I)).re [PROOFSTEP] rw [show ↑π * I * ((n : ℂ) + 1) ^ 2 * (↑t * I) = ((π * t * ((n : ℝ) + 1) ^ 2) : ℝ) * I ^ 2 by push_cast ; ring] [GOAL] t : ℝ ht : 0 < t this : 0 < (↑t * I).im n : ℕ ⊢ ↑π * I * (↑n + 1) ^ 2 * (↑t * I) = ↑(π * t * (↑n + 1) ^ 2) * I ^ 2 [PROOFSTEP] push_cast [GOAL] t : ℝ ht : 0 < t this : 0 < (↑t * I).im n : ℕ ⊢ ↑π * I * (↑n + 1) ^ 2 * (↑t * I) = ↑π * ↑t * (↑n + 1) ^ 2 * I ^ 2 [PROOFSTEP] ring [GOAL] case h.e'_5.h t : ℝ ht : 0 < t this : 0 < (↑t * I).im n : ℕ ⊢ rexp (-π * t * (↑n + 1) ^ 2) = rexp (↑(π * t * (↑n + 1) ^ 2) * I ^ 2).re [PROOFSTEP] rw [I_sq, mul_neg_one, ← ofReal_neg, ofReal_re, neg_mul, neg_mul] [GOAL] t : ℝ ht : 0 < t ⊢ zetaKernel₁ t = (jacobiTheta (↑t * I) - 1) / 2 [PROOFSTEP] rw [jacobiTheta_eq_tsum_nat ((mul_I_im t).symm ▸ ht : 0 < (↑t * I).im), add_comm, add_sub_cancel, mul_div_cancel_left _ (two_ne_zero' ℂ), zetaKernel₁] [GOAL] t : ℝ ht : 0 < t ⊢ ∑' (n : ℕ), ↑(rexp (-π * t * (↑n + 1) ^ 2)) = ∑' (n : ℕ), cexp (↑π * I * (↑n + 1) ^ 2 * (↑t * I)) [PROOFSTEP] congr 1 with n : 1 [GOAL] case e_f.h t : ℝ ht : 0 < t n : ℕ ⊢ ↑(rexp (-π * t * (↑n + 1) ^ 2)) = cexp (↑π * I * (↑n + 1) ^ 2 * (↑t * I)) [PROOFSTEP] push_cast [GOAL] case e_f.h t : ℝ ht : 0 < t n : ℕ ⊢ cexp (-↑π * ↑t * (↑n + 1) ^ 2) = cexp (↑π * I * (↑n + 1) ^ 2 * (↑t * I)) [PROOFSTEP] rw [(by ring : ↑π * I * ((n : ℂ) + 1) ^ 2 * (t * I) = I ^ 2 * π * t * ((n : ℂ) + 1) ^ 2), I_sq, neg_one_mul] [GOAL] t : ℝ ht : 0 < t n : ℕ ⊢ ↑π * I * (↑n + 1) ^ 2 * (↑t * I) = I ^ 2 * ↑π * ↑t * (↑n + 1) ^ 2 [PROOFSTEP] ring [GOAL] t : ℝ ht : 0 < t ⊢ ContinuousAt zetaKernel₁ t [PROOFSTEP] have : ContinuousAt (fun u : ℝ => (jacobiTheta (u * I) - 1) / 2) t := by refine' (ContinuousAt.sub _ continuousAt_const).div_const _ refine' (continuousAt_jacobiTheta _).comp (ContinuousAt.mul _ continuousAt_const) · rwa [mul_I_im, ofReal_re] · exact continuous_ofReal.continuousAt [GOAL] t : ℝ ht : 0 < t ⊢ ContinuousAt (fun u => (jacobiTheta (↑u * I) - 1) / 2) t [PROOFSTEP] refine' (ContinuousAt.sub _ continuousAt_const).div_const _ [GOAL] t : ℝ ht : 0 < t ⊢ ContinuousAt (fun u => jacobiTheta (↑u * I)) t [PROOFSTEP] refine' (continuousAt_jacobiTheta _).comp (ContinuousAt.mul _ continuousAt_const) [GOAL] case refine'_1 t : ℝ ht : 0 < t ⊢ 0 < (↑t * I).im [PROOFSTEP] rwa [mul_I_im, ofReal_re] [GOAL] case refine'_2 t : ℝ ht : 0 < t ⊢ ContinuousAt (fun u => ↑u) t [PROOFSTEP] exact continuous_ofReal.continuousAt [GOAL] t : ℝ ht : 0 < t this : ContinuousAt (fun u => (jacobiTheta (↑u * I) - 1) / 2) t ⊢ ContinuousAt zetaKernel₁ t [PROOFSTEP] refine' this.congr (eventually_of_mem (Ioi_mem_nhds ht) fun u hu => _) [GOAL] t : ℝ ht : 0 < t this : ContinuousAt (fun u => (jacobiTheta (↑u * I) - 1) / 2) t u : ℝ hu : u ∈ Ioi 0 ⊢ (fun u => (jacobiTheta (↑u * I) - 1) / 2) u = zetaKernel₁ u [PROOFSTEP] rw [zetaKernel₁_eq_jacobiTheta hu] [GOAL] ⊢ LocallyIntegrableOn zetaKernel₂ (Ioi 0) [PROOFSTEP] refine (locallyIntegrableOn_iff (Or.inr isOpen_Ioi)).mpr fun k hk hk' => Integrable.add ?_ ?_ [GOAL] case refine_1 k : Set ℝ hk : k ⊆ Ioi 0 hk' : IsCompact k ⊢ Integrable zetaKernel₁ [PROOFSTEP] refine ContinuousOn.integrableOn_compact hk' ?_ [GOAL] case refine_1 k : Set ℝ hk : k ⊆ Ioi 0 hk' : IsCompact k ⊢ ContinuousOn zetaKernel₁ k [PROOFSTEP] exact ContinuousAt.continuousOn fun x hx => continuousAt_zetaKernel₁ (hk hx) [GOAL] case refine_2 k : Set ℝ hk : k ⊆ Ioi 0 hk' : IsCompact k ⊢ Integrable (indicator (Ioc 0 1) fun t => (1 - 1 / ↑(sqrt t)) / 2) [PROOFSTEP] refine (integrable_indicator_iff measurableSet_Ioc).mpr ?_ [GOAL] case refine_2 k : Set ℝ hk : k ⊆ Ioi 0 hk' : IsCompact k ⊢ IntegrableOn (fun t => (1 - 1 / ↑(sqrt t)) / 2) (Ioc 0 1) [PROOFSTEP] rw [IntegrableOn, Measure.restrict_restrict, ← IntegrableOn] [GOAL] case refine_2 k : Set ℝ hk : k ⊆ Ioi 0 hk' : IsCompact k ⊢ IntegrableOn (fun t => (1 - 1 / ↑(sqrt t)) / 2) (Ioc 0 1 ∩ k) case refine_2 k : Set ℝ hk : k ⊆ Ioi 0 hk' : IsCompact k ⊢ MeasurableSet (Ioc 0 1) [PROOFSTEP] swap [GOAL] case refine_2 k : Set ℝ hk : k ⊆ Ioi 0 hk' : IsCompact k ⊢ MeasurableSet (Ioc 0 1) [PROOFSTEP] exact measurableSet_Ioc [GOAL] case refine_2 k : Set ℝ hk : k ⊆ Ioi 0 hk' : IsCompact k ⊢ IntegrableOn (fun t => (1 - 1 / ↑(sqrt t)) / 2) (Ioc 0 1 ∩ k) [PROOFSTEP] apply ContinuousOn.integrableOn_compact [GOAL] case refine_2.hK k : Set ℝ hk : k ⊆ Ioi 0 hk' : IsCompact k ⊢ IsCompact (Ioc 0 1 ∩ k) [PROOFSTEP] convert (isCompact_Icc : IsCompact <| Icc (0 : ℝ) 1).inter hk' using 1 [GOAL] case h.e'_3 k : Set ℝ hk : k ⊆ Ioi 0 hk' : IsCompact k ⊢ Ioc 0 1 ∩ k = Icc 0 1 ∩ k [PROOFSTEP] exact Set.ext fun t => ⟨fun h => ⟨Ioc_subset_Icc_self h.1, h.2⟩, fun h => ⟨⟨hk h.2, h.1.2⟩, h.2⟩⟩ [GOAL] case refine_2.hf k : Set ℝ hk : k ⊆ Ioi 0 hk' : IsCompact k ⊢ ContinuousOn (fun t => (1 - 1 / ↑(sqrt t)) / 2) (Ioc 0 1 ∩ k) [PROOFSTEP] refine ContinuousOn.mono ?_ ((inter_subset_right _ _).trans hk) [GOAL] case refine_2.hf k : Set ℝ hk : k ⊆ Ioi 0 hk' : IsCompact k ⊢ ContinuousOn (fun t => (1 - 1 / ↑(sqrt t)) / 2) (Ioi 0) [PROOFSTEP] refine (continuousOn_const.sub ?_).div_const _ [GOAL] case refine_2.hf k : Set ℝ hk : k ⊆ Ioi 0 hk' : IsCompact k ⊢ ContinuousOn (fun t => 1 / ↑(sqrt t)) (Ioi 0) [PROOFSTEP] refine ContinuousOn.div continuousOn_const ?_ fun x hx => ?_ [GOAL] case refine_2.hf.refine_1 k : Set ℝ hk : k ⊆ Ioi 0 hk' : IsCompact k ⊢ ContinuousOn (fun t => ↑(sqrt t)) (Ioi 0) [PROOFSTEP] exact (continuous_ofReal.comp continuous_sqrt).continuousOn [GOAL] case refine_2.hf.refine_2 k : Set ℝ hk : k ⊆ Ioi 0 hk' : IsCompact k x : ℝ hx : x ∈ Ioi 0 ⊢ ↑(sqrt x) ≠ 0 [PROOFSTEP] exact ofReal_ne_zero.mpr (sqrt_ne_zero'.mpr hx) [GOAL] t : ℝ ht : 0 < t ⊢ zetaKernel₂ (1 / t) = ↑(sqrt t) * zetaKernel₂ t [PROOFSTEP] have aux : ∀ {u : ℝ} (_ : 1 < u), zetaKernel₂ (1 / u) = sqrt u * zetaKernel₂ u := by intro u hu simp_rw [zetaKernel₂, Pi.add_apply] rw [indicator_of_mem, indicator_of_not_mem (not_mem_Ioc_of_gt hu), add_zero] swap; · exact ⟨one_div_pos.mpr (zero_lt_one.trans hu), (one_div u).symm ▸ inv_le_one hu.le⟩ rw [zetaKernel₁_eq_jacobiTheta (one_div_pos.mpr <| zero_lt_one.trans hu), zetaKernel₁_eq_jacobiTheta (zero_lt_one.trans hu), ← add_div, ← mul_div_assoc, add_sub, sub_add_cancel, sqrt_div zero_le_one, sqrt_one, one_div (sqrt _), ofReal_inv, ← one_div, one_div_one_div, mul_sub, mul_one] congr 2 let τ : UpperHalfPlane := .mk (u * I) ((mul_I_im u).symm ▸ zero_lt_one.trans hu) convert jacobiTheta_S_smul τ using 2 · rw [UpperHalfPlane.modular_S_smul, UpperHalfPlane.coe_mk, UpperHalfPlane.coe_mk, ← neg_inv, mul_inv, inv_I, mul_neg, neg_neg, one_div, ofReal_inv] · rw [UpperHalfPlane.coe_mk, mul_comm, mul_assoc, mul_neg, I_mul_I, neg_neg, mul_one, sqrt_eq_rpow, ofReal_cpow (zero_lt_one.trans hu).le] push_cast rfl [GOAL] t : ℝ ht : 0 < t ⊢ ∀ {u : ℝ}, 1 < u → zetaKernel₂ (1 / u) = ↑(sqrt u) * zetaKernel₂ u [PROOFSTEP] intro u hu [GOAL] t : ℝ ht : 0 < t u : ℝ hu : 1 < u ⊢ zetaKernel₂ (1 / u) = ↑(sqrt u) * zetaKernel₂ u [PROOFSTEP] simp_rw [zetaKernel₂, Pi.add_apply] [GOAL] t : ℝ ht : 0 < t u : ℝ hu : 1 < u ⊢ zetaKernel₁ (1 / u) + indicator (Ioc 0 1) (fun t => (1 - 1 / ↑(sqrt t)) / 2) (1 / u) = ↑(sqrt u) * (zetaKernel₁ u + indicator (Ioc 0 1) (fun t => (1 - 1 / ↑(sqrt t)) / 2) u) [PROOFSTEP] rw [indicator_of_mem, indicator_of_not_mem (not_mem_Ioc_of_gt hu), add_zero] [GOAL] t : ℝ ht : 0 < t u : ℝ hu : 1 < u ⊢ zetaKernel₁ (1 / u) + (1 - 1 / ↑(sqrt (1 / u))) / 2 = ↑(sqrt u) * zetaKernel₁ u case h t : ℝ ht : 0 < t u : ℝ hu : 1 < u ⊢ 1 / u ∈ Ioc 0 1 [PROOFSTEP] swap [GOAL] case h t : ℝ ht : 0 < t u : ℝ hu : 1 < u ⊢ 1 / u ∈ Ioc 0 1 [PROOFSTEP] exact ⟨one_div_pos.mpr (zero_lt_one.trans hu), (one_div u).symm ▸ inv_le_one hu.le⟩ [GOAL] t : ℝ ht : 0 < t u : ℝ hu : 1 < u ⊢ zetaKernel₁ (1 / u) + (1 - 1 / ↑(sqrt (1 / u))) / 2 = ↑(sqrt u) * zetaKernel₁ u [PROOFSTEP] rw [zetaKernel₁_eq_jacobiTheta (one_div_pos.mpr <| zero_lt_one.trans hu), zetaKernel₁_eq_jacobiTheta (zero_lt_one.trans hu), ← add_div, ← mul_div_assoc, add_sub, sub_add_cancel, sqrt_div zero_le_one, sqrt_one, one_div (sqrt _), ofReal_inv, ← one_div, one_div_one_div, mul_sub, mul_one] [GOAL] t : ℝ ht : 0 < t u : ℝ hu : 1 < u ⊢ (jacobiTheta (↑(1 / u) * I) - ↑(sqrt u)) / 2 = (↑(sqrt u) * jacobiTheta (↑u * I) - ↑(sqrt u)) / 2 [PROOFSTEP] congr 2 [GOAL] case e_a.e_a t : ℝ ht : 0 < t u : ℝ hu : 1 < u ⊢ jacobiTheta (↑(1 / u) * I) = ↑(sqrt u) * jacobiTheta (↑u * I) [PROOFSTEP] let τ : UpperHalfPlane := .mk (u * I) ((mul_I_im u).symm ▸ zero_lt_one.trans hu) [GOAL] case e_a.e_a t : ℝ ht : 0 < t u : ℝ hu : 1 < u τ : UpperHalfPlane := UpperHalfPlane.mk (↑u * I) (_ : 0 < (↑u * I).im) ⊢ jacobiTheta (↑(1 / u) * I) = ↑(sqrt u) * jacobiTheta (↑u * I) [PROOFSTEP] convert jacobiTheta_S_smul τ using 2 [GOAL] case h.e'_2.h.e'_1 t : ℝ ht : 0 < t u : ℝ hu : 1 < u τ : UpperHalfPlane := UpperHalfPlane.mk (↑u * I) (_ : 0 < (↑u * I).im) ⊢ ↑(1 / u) * I = ↑(ModularGroup.S • τ) [PROOFSTEP] rw [UpperHalfPlane.modular_S_smul, UpperHalfPlane.coe_mk, UpperHalfPlane.coe_mk, ← neg_inv, mul_inv, inv_I, mul_neg, neg_neg, one_div, ofReal_inv] [GOAL] case h.e'_3.h.e'_5 t : ℝ ht : 0 < t u : ℝ hu : 1 < u τ : UpperHalfPlane := UpperHalfPlane.mk (↑u * I) (_ : 0 < (↑u * I).im) ⊢ ↑(sqrt u) = (-I * ↑τ) ^ (1 / 2) [PROOFSTEP] rw [UpperHalfPlane.coe_mk, mul_comm, mul_assoc, mul_neg, I_mul_I, neg_neg, mul_one, sqrt_eq_rpow, ofReal_cpow (zero_lt_one.trans hu).le] [GOAL] case h.e'_3.h.e'_5 t : ℝ ht : 0 < t u : ℝ hu : 1 < u τ : UpperHalfPlane := UpperHalfPlane.mk (↑u * I) (_ : 0 < (↑u * I).im) ⊢ ↑u ^ ↑(1 / 2) = ↑u ^ (1 / 2) [PROOFSTEP] push_cast [GOAL] case h.e'_3.h.e'_5 t : ℝ ht : 0 < t u : ℝ hu : 1 < u τ : UpperHalfPlane := UpperHalfPlane.mk (↑u * I) (_ : 0 < (↑u * I).im) ⊢ ↑u ^ (1 / 2) = ↑u ^ (1 / 2) [PROOFSTEP] rfl [GOAL] t : ℝ ht : 0 < t aux : ∀ {u : ℝ}, 1 < u → zetaKernel₂ (1 / u) = ↑(sqrt u) * zetaKernel₂ u ⊢ zetaKernel₂ (1 / t) = ↑(sqrt t) * zetaKernel₂ t [PROOFSTEP] rcases lt_trichotomy 1 t with (h | h | h) [GOAL] case inl t : ℝ ht : 0 < t aux : ∀ {u : ℝ}, 1 < u → zetaKernel₂ (1 / u) = ↑(sqrt u) * zetaKernel₂ u h : 1 < t ⊢ zetaKernel₂ (1 / t) = ↑(sqrt t) * zetaKernel₂ t [PROOFSTEP] exact aux h [GOAL] case inr.inl t : ℝ ht : 0 < t aux : ∀ {u : ℝ}, 1 < u → zetaKernel₂ (1 / u) = ↑(sqrt u) * zetaKernel₂ u h : 1 = t ⊢ zetaKernel₂ (1 / t) = ↑(sqrt t) * zetaKernel₂ t [PROOFSTEP] simp only [← h, div_self, Ne.def, one_ne_zero, not_false_iff, sqrt_one, ofReal_one, one_mul] [GOAL] case inr.inr t : ℝ ht : 0 < t aux : ∀ {u : ℝ}, 1 < u → zetaKernel₂ (1 / u) = ↑(sqrt u) * zetaKernel₂ u h : t < 1 ⊢ zetaKernel₂ (1 / t) = ↑(sqrt t) * zetaKernel₂ t [PROOFSTEP] have := aux (show 1 < 1 / t by rwa [lt_one_div (zero_lt_one' ℝ) ht, div_one]) [GOAL] t : ℝ ht : 0 < t aux : ∀ {u : ℝ}, 1 < u → zetaKernel₂ (1 / u) = ↑(sqrt u) * zetaKernel₂ u h : t < 1 ⊢ 1 < 1 / t [PROOFSTEP] rwa [lt_one_div (zero_lt_one' ℝ) ht, div_one] [GOAL] case inr.inr t : ℝ ht : 0 < t aux : ∀ {u : ℝ}, 1 < u → zetaKernel₂ (1 / u) = ↑(sqrt u) * zetaKernel₂ u h : t < 1 this : zetaKernel₂ (1 / (1 / t)) = ↑(sqrt (1 / t)) * zetaKernel₂ (1 / t) ⊢ zetaKernel₂ (1 / t) = ↑(sqrt t) * zetaKernel₂ t [PROOFSTEP] rw [one_div_one_div] at this [GOAL] case inr.inr t : ℝ ht : 0 < t aux : ∀ {u : ℝ}, 1 < u → zetaKernel₂ (1 / u) = ↑(sqrt u) * zetaKernel₂ u h : t < 1 this : zetaKernel₂ t = ↑(sqrt (1 / t)) * zetaKernel₂ (1 / t) ⊢ zetaKernel₂ (1 / t) = ↑(sqrt t) * zetaKernel₂ t [PROOFSTEP] rw [this, ← mul_assoc, ← ofReal_mul, ← sqrt_mul ht.le, mul_one_div_cancel ht.ne', sqrt_one, ofReal_one, one_mul] [GOAL] ⊢ zetaKernel₁ =O[atTop] fun t => rexp (-π * t) [PROOFSTEP] have h := isBigO_at_im_infty_jacobiTheta_sub_one.const_mul_left (1 / 2) [GOAL] h : (fun x => 1 / 2 * (jacobiTheta x - 1)) =O[comap im atTop] fun τ => rexp (-π * τ.im) ⊢ zetaKernel₁ =O[atTop] fun t => rexp (-π * t) [PROOFSTEP] simp_rw [mul_comm (1 / 2 : ℂ) _, mul_one_div] at h [GOAL] h : (fun x => (jacobiTheta x - 1) / 2) =O[comap im atTop] fun τ => rexp (-π * τ.im) ⊢ zetaKernel₁ =O[atTop] fun t => rexp (-π * t) [PROOFSTEP] have h' : Tendsto (fun t : ℝ => ↑t * I) atTop (comap im atTop) := by rw [tendsto_comap_iff] convert tendsto_id ext1 t rw [Function.comp_apply, mul_I_im, ofReal_re, id.def] [GOAL] h : (fun x => (jacobiTheta x - 1) / 2) =O[comap im atTop] fun τ => rexp (-π * τ.im) ⊢ Tendsto (fun t => ↑t * I) atTop (comap im atTop) [PROOFSTEP] rw [tendsto_comap_iff] [GOAL] h : (fun x => (jacobiTheta x - 1) / 2) =O[comap im atTop] fun τ => rexp (-π * τ.im) ⊢ Tendsto (im ∘ fun t => ↑t * I) atTop atTop [PROOFSTEP] convert tendsto_id [GOAL] case h.e'_3 h : (fun x => (jacobiTheta x - 1) / 2) =O[comap im atTop] fun τ => rexp (-π * τ.im) ⊢ (im ∘ fun t => ↑t * I) = id [PROOFSTEP] ext1 t [GOAL] case h.e'_3.h h : (fun x => (jacobiTheta x - 1) / 2) =O[comap im atTop] fun τ => rexp (-π * τ.im) t : ℝ ⊢ (im ∘ fun t => ↑t * I) t = id t [PROOFSTEP] rw [Function.comp_apply, mul_I_im, ofReal_re, id.def] [GOAL] h : (fun x => (jacobiTheta x - 1) / 2) =O[comap im atTop] fun τ => rexp (-π * τ.im) h' : Tendsto (fun t => ↑t * I) atTop (comap im atTop) ⊢ zetaKernel₁ =O[atTop] fun t => rexp (-π * t) [PROOFSTEP] convert ((h.norm_left.comp_tendsto h').congr' (eventually_of_mem (Ioi_mem_atTop 0) fun t ht => _) (eventually_of_mem (Ioi_mem_atTop 0) fun t _ => _)).of_norm_left (E' := ℂ) [GOAL] case convert_1 h : (fun x => (jacobiTheta x - 1) / 2) =O[comap im atTop] fun τ => rexp (-π * τ.im) h' : Tendsto (fun t => ↑t * I) atTop (comap im atTop) t : ℝ ht : t ∈ Ioi 0 ⊢ ((fun x => ‖(jacobiTheta x - 1) / 2‖) ∘ fun t => ↑t * I) t = ‖zetaKernel₁ t‖ [PROOFSTEP] rw [Function.comp_apply, ← zetaKernel₁_eq_jacobiTheta ht] [GOAL] case convert_2 h : (fun x => (jacobiTheta x - 1) / 2) =O[comap im atTop] fun τ => rexp (-π * τ.im) h' : Tendsto (fun t => ↑t * I) atTop (comap im atTop) t : ℝ x✝ : t ∈ Ioi 0 ⊢ ((fun τ => rexp (-π * τ.im)) ∘ fun t => ↑t * I) t = rexp (-π * t) [PROOFSTEP] rw [Function.comp_apply, mul_I_im, ofReal_re] [GOAL] ⊢ zetaKernel₂ =O[atTop] fun t => rexp (-π * t) [PROOFSTEP] refine' (eventuallyEq_of_mem (Ioi_mem_atTop (1 : ℝ)) fun t ht => _).trans_isBigO isBigO_atTop_zetaKernel₁ [GOAL] t : ℝ ht : t ∈ Ioi 1 ⊢ zetaKernel₂ t = zetaKernel₁ t [PROOFSTEP] rw [zetaKernel₂, Pi.add_apply, indicator_of_not_mem (not_mem_Ioc_of_gt (Set.mem_Iio.mp ht)), add_zero] [GOAL] ⊢ zetaKernel₂ =O[𝓝[Ioi 0] 0] fun t => rexp (-π / t) / sqrt t [PROOFSTEP] have h1 := isBigO_atTop_zetaKernel₂.comp_tendsto tendsto_inv_zero_atTop [GOAL] h1 : (zetaKernel₂ ∘ fun x => x⁻¹) =O[𝓝[Ioi 0] 0] ((fun t => rexp (-π * t)) ∘ fun x => x⁻¹) ⊢ zetaKernel₂ =O[𝓝[Ioi 0] 0] fun t => rexp (-π / t) / sqrt t [PROOFSTEP] simp_rw [← one_div] at h1 [GOAL] h1 : (zetaKernel₂ ∘ fun x => 1 / x) =O[𝓝[Ioi 0] 0] ((fun t => rexp (-π * t)) ∘ fun x => 1 / x) ⊢ zetaKernel₂ =O[𝓝[Ioi 0] 0] fun t => rexp (-π / t) / sqrt t [PROOFSTEP] have h2 : zetaKernel₂ ∘ Div.div 1 =ᶠ[𝓝[>] 0] fun t => sqrt t * zetaKernel₂ t := eventually_of_mem self_mem_nhdsWithin fun t ht => by dsimp only; rw [← zetaKernel₂_one_div ht]; rfl [GOAL] h1 : (zetaKernel₂ ∘ fun x => 1 / x) =O[𝓝[Ioi 0] 0] ((fun t => rexp (-π * t)) ∘ fun x => 1 / x) t : ℝ ht : t ∈ Ioi 0 ⊢ (zetaKernel₂ ∘ Div.div 1) t = (fun t => ↑(sqrt t) * zetaKernel₂ t) t [PROOFSTEP] dsimp only [GOAL] h1 : (zetaKernel₂ ∘ fun x => 1 / x) =O[𝓝[Ioi 0] 0] ((fun t => rexp (-π * t)) ∘ fun x => 1 / x) t : ℝ ht : t ∈ Ioi 0 ⊢ (zetaKernel₂ ∘ Div.div 1) t = ↑(sqrt t) * zetaKernel₂ t [PROOFSTEP] rw [← zetaKernel₂_one_div ht] [GOAL] h1 : (zetaKernel₂ ∘ fun x => 1 / x) =O[𝓝[Ioi 0] 0] ((fun t => rexp (-π * t)) ∘ fun x => 1 / x) t : ℝ ht : t ∈ Ioi 0 ⊢ (zetaKernel₂ ∘ Div.div 1) t = zetaKernel₂ (1 / t) [PROOFSTEP] rfl [GOAL] h1 : (zetaKernel₂ ∘ fun x => 1 / x) =O[𝓝[Ioi 0] 0] ((fun t => rexp (-π * t)) ∘ fun x => 1 / x) h2 : zetaKernel₂ ∘ Div.div 1 =ᶠ[𝓝[Ioi 0] 0] fun t => ↑(sqrt t) * zetaKernel₂ t ⊢ zetaKernel₂ =O[𝓝[Ioi 0] 0] fun t => rexp (-π / t) / sqrt t [PROOFSTEP] have h3 := h1.congr' h2 (EventuallyEq.refl _ _) [GOAL] h1 : (zetaKernel₂ ∘ fun x => 1 / x) =O[𝓝[Ioi 0] 0] ((fun t => rexp (-π * t)) ∘ fun x => 1 / x) h2 : zetaKernel₂ ∘ Div.div 1 =ᶠ[𝓝[Ioi 0] 0] fun t => ↑(sqrt t) * zetaKernel₂ t h3 : (fun t => ↑(sqrt t) * zetaKernel₂ t) =O[𝓝[Ioi 0] 0] ((fun t => rexp (-π * t)) ∘ fun x => 1 / x) ⊢ zetaKernel₂ =O[𝓝[Ioi 0] 0] fun t => rexp (-π / t) / sqrt t [PROOFSTEP] have h4 := h3.mul (isBigO_refl (fun t : ℝ => 1 / (sqrt t : ℂ)) (𝓝[>] 0)).norm_right [GOAL] h1 : (zetaKernel₂ ∘ fun x => 1 / x) =O[𝓝[Ioi 0] 0] ((fun t => rexp (-π * t)) ∘ fun x => 1 / x) h2 : zetaKernel₂ ∘ Div.div 1 =ᶠ[𝓝[Ioi 0] 0] fun t => ↑(sqrt t) * zetaKernel₂ t h3 : (fun t => ↑(sqrt t) * zetaKernel₂ t) =O[𝓝[Ioi 0] 0] ((fun t => rexp (-π * t)) ∘ fun x => 1 / x) h4 : (fun x => ↑(sqrt x) * zetaKernel₂ x * (1 / ↑(sqrt x))) =O[𝓝[Ioi 0] 0] fun x => ((fun t => rexp (-π * t)) ∘ fun x => 1 / x) x * ‖1 / ↑(sqrt x)‖ ⊢ zetaKernel₂ =O[𝓝[Ioi 0] 0] fun t => rexp (-π / t) / sqrt t [PROOFSTEP] refine h4.congr' ?_ ?_ [GOAL] case refine_1 h1 : (zetaKernel₂ ∘ fun x => 1 / x) =O[𝓝[Ioi 0] 0] ((fun t => rexp (-π * t)) ∘ fun x => 1 / x) h2 : zetaKernel₂ ∘ Div.div 1 =ᶠ[𝓝[Ioi 0] 0] fun t => ↑(sqrt t) * zetaKernel₂ t h3 : (fun t => ↑(sqrt t) * zetaKernel₂ t) =O[𝓝[Ioi 0] 0] ((fun t => rexp (-π * t)) ∘ fun x => 1 / x) h4 : (fun x => ↑(sqrt x) * zetaKernel₂ x * (1 / ↑(sqrt x))) =O[𝓝[Ioi 0] 0] fun x => ((fun t => rexp (-π * t)) ∘ fun x => 1 / x) x * ‖1 / ↑(sqrt x)‖ ⊢ (fun x => ↑(sqrt x) * zetaKernel₂ x * (1 / ↑(sqrt x))) =ᶠ[𝓝[Ioi 0] 0] zetaKernel₂ [PROOFSTEP] refine eventually_of_mem self_mem_nhdsWithin fun x hx => ?_ [GOAL] case refine_1 h1 : (zetaKernel₂ ∘ fun x => 1 / x) =O[𝓝[Ioi 0] 0] ((fun t => rexp (-π * t)) ∘ fun x => 1 / x) h2 : zetaKernel₂ ∘ Div.div 1 =ᶠ[𝓝[Ioi 0] 0] fun t => ↑(sqrt t) * zetaKernel₂ t h3 : (fun t => ↑(sqrt t) * zetaKernel₂ t) =O[𝓝[Ioi 0] 0] ((fun t => rexp (-π * t)) ∘ fun x => 1 / x) h4 : (fun x => ↑(sqrt x) * zetaKernel₂ x * (1 / ↑(sqrt x))) =O[𝓝[Ioi 0] 0] fun x => ((fun t => rexp (-π * t)) ∘ fun x => 1 / x) x * ‖1 / ↑(sqrt x)‖ x : ℝ hx : x ∈ Ioi 0 ⊢ (fun x => ↑(sqrt x) * zetaKernel₂ x * (1 / ↑(sqrt x))) x = zetaKernel₂ x [PROOFSTEP] dsimp [GOAL] case refine_1 h1 : (zetaKernel₂ ∘ fun x => 1 / x) =O[𝓝[Ioi 0] 0] ((fun t => rexp (-π * t)) ∘ fun x => 1 / x) h2 : zetaKernel₂ ∘ Div.div 1 =ᶠ[𝓝[Ioi 0] 0] fun t => ↑(sqrt t) * zetaKernel₂ t h3 : (fun t => ↑(sqrt t) * zetaKernel₂ t) =O[𝓝[Ioi 0] 0] ((fun t => rexp (-π * t)) ∘ fun x => 1 / x) h4 : (fun x => ↑(sqrt x) * zetaKernel₂ x * (1 / ↑(sqrt x))) =O[𝓝[Ioi 0] 0] fun x => ((fun t => rexp (-π * t)) ∘ fun x => 1 / x) x * ‖1 / ↑(sqrt x)‖ x : ℝ hx : x ∈ Ioi 0 ⊢ ↑(sqrt x) * zetaKernel₂ x * (1 / ↑(sqrt x)) = zetaKernel₂ x [PROOFSTEP] rw [mul_comm, ← mul_assoc, one_div_mul_cancel, one_mul] [GOAL] case refine_1 h1 : (zetaKernel₂ ∘ fun x => 1 / x) =O[𝓝[Ioi 0] 0] ((fun t => rexp (-π * t)) ∘ fun x => 1 / x) h2 : zetaKernel₂ ∘ Div.div 1 =ᶠ[𝓝[Ioi 0] 0] fun t => ↑(sqrt t) * zetaKernel₂ t h3 : (fun t => ↑(sqrt t) * zetaKernel₂ t) =O[𝓝[Ioi 0] 0] ((fun t => rexp (-π * t)) ∘ fun x => 1 / x) h4 : (fun x => ↑(sqrt x) * zetaKernel₂ x * (1 / ↑(sqrt x))) =O[𝓝[Ioi 0] 0] fun x => ((fun t => rexp (-π * t)) ∘ fun x => 1 / x) x * ‖1 / ↑(sqrt x)‖ x : ℝ hx : x ∈ Ioi 0 ⊢ ↑(sqrt x) ≠ 0 [PROOFSTEP] exact ofReal_ne_zero.mpr ((sqrt_ne_zero <| le_of_lt hx).mpr (ne_of_gt hx)) [GOAL] case refine_2 h1 : (zetaKernel₂ ∘ fun x => 1 / x) =O[𝓝[Ioi 0] 0] ((fun t => rexp (-π * t)) ∘ fun x => 1 / x) h2 : zetaKernel₂ ∘ Div.div 1 =ᶠ[𝓝[Ioi 0] 0] fun t => ↑(sqrt t) * zetaKernel₂ t h3 : (fun t => ↑(sqrt t) * zetaKernel₂ t) =O[𝓝[Ioi 0] 0] ((fun t => rexp (-π * t)) ∘ fun x => 1 / x) h4 : (fun x => ↑(sqrt x) * zetaKernel₂ x * (1 / ↑(sqrt x))) =O[𝓝[Ioi 0] 0] fun x => ((fun t => rexp (-π * t)) ∘ fun x => 1 / x) x * ‖1 / ↑(sqrt x)‖ ⊢ (fun x => ((fun t => rexp (-π * t)) ∘ fun x => 1 / x) x * ‖1 / ↑(sqrt x)‖) =ᶠ[𝓝[Ioi 0] 0] fun t => rexp (-π / t) / sqrt t [PROOFSTEP] refine eventually_of_mem self_mem_nhdsWithin fun x _ => ?_ [GOAL] case refine_2 h1 : (zetaKernel₂ ∘ fun x => 1 / x) =O[𝓝[Ioi 0] 0] ((fun t => rexp (-π * t)) ∘ fun x => 1 / x) h2 : zetaKernel₂ ∘ Div.div 1 =ᶠ[𝓝[Ioi 0] 0] fun t => ↑(sqrt t) * zetaKernel₂ t h3 : (fun t => ↑(sqrt t) * zetaKernel₂ t) =O[𝓝[Ioi 0] 0] ((fun t => rexp (-π * t)) ∘ fun x => 1 / x) h4 : (fun x => ↑(sqrt x) * zetaKernel₂ x * (1 / ↑(sqrt x))) =O[𝓝[Ioi 0] 0] fun x => ((fun t => rexp (-π * t)) ∘ fun x => 1 / x) x * ‖1 / ↑(sqrt x)‖ x : ℝ x✝ : x ∈ Ioi 0 ⊢ (fun x => ((fun t => rexp (-π * t)) ∘ fun x => 1 / x) x * ‖1 / ↑(sqrt x)‖) x = (fun t => rexp (-π / t) / sqrt t) x [PROOFSTEP] dsimp only [GOAL] case refine_2 h1 : (zetaKernel₂ ∘ fun x => 1 / x) =O[𝓝[Ioi 0] 0] ((fun t => rexp (-π * t)) ∘ fun x => 1 / x) h2 : zetaKernel₂ ∘ Div.div 1 =ᶠ[𝓝[Ioi 0] 0] fun t => ↑(sqrt t) * zetaKernel₂ t h3 : (fun t => ↑(sqrt t) * zetaKernel₂ t) =O[𝓝[Ioi 0] 0] ((fun t => rexp (-π * t)) ∘ fun x => 1 / x) h4 : (fun x => ↑(sqrt x) * zetaKernel₂ x * (1 / ↑(sqrt x))) =O[𝓝[Ioi 0] 0] fun x => ((fun t => rexp (-π * t)) ∘ fun x => 1 / x) x * ‖1 / ↑(sqrt x)‖ x : ℝ x✝ : x ∈ Ioi 0 ⊢ ((fun t => rexp (-π * t)) ∘ fun x => 1 / x) x * ‖1 / ↑(sqrt x)‖ = rexp (-π / x) / sqrt x [PROOFSTEP] rw [Function.comp_apply, mul_one_div, one_div (sqrt x : ℂ), norm_inv, Complex.norm_eq_abs, abs_ofReal, abs_of_nonneg (sqrt_nonneg _), ← div_eq_mul_inv] [GOAL] a : ℝ ⊢ zetaKernel₂ =O[𝓝[Ioi 0] 0] fun t => t ^ a [PROOFSTEP] have aux1 : IsBigO atTop (fun t => exp (-π * t)) fun t => t ^ (-a - 1 / 2) := (isLittleO_exp_neg_mul_rpow_atTop pi_pos _).isBigO [GOAL] a : ℝ aux1 : (fun t => rexp (-π * t)) =O[atTop] fun t => t ^ (-a - 1 / 2) ⊢ zetaKernel₂ =O[𝓝[Ioi 0] 0] fun t => t ^ a [PROOFSTEP] have aux2 : IsBigO atTop (fun t => exp (-π * t) * sqrt t) fun t => t ^ (-a) := by refine (aux1.mul (isBigO_refl sqrt _)).congr' (EventuallyEq.refl _ _) ?_ refine (eventually_gt_atTop 0).mp (eventually_of_forall fun t ht => ?_) simp_rw [sqrt_eq_rpow, ← rpow_add ht, sub_add_cancel] [GOAL] a : ℝ aux1 : (fun t => rexp (-π * t)) =O[atTop] fun t => t ^ (-a - 1 / 2) ⊢ (fun t => rexp (-π * t) * sqrt t) =O[atTop] fun t => t ^ (-a) [PROOFSTEP] refine (aux1.mul (isBigO_refl sqrt _)).congr' (EventuallyEq.refl _ _) ?_ [GOAL] a : ℝ aux1 : (fun t => rexp (-π * t)) =O[atTop] fun t => t ^ (-a - 1 / 2) ⊢ (fun x => x ^ (-a - 1 / 2) * sqrt x) =ᶠ[atTop] fun t => t ^ (-a) [PROOFSTEP] refine (eventually_gt_atTop 0).mp (eventually_of_forall fun t ht => ?_) [GOAL] a : ℝ aux1 : (fun t => rexp (-π * t)) =O[atTop] fun t => t ^ (-a - 1 / 2) t : ℝ ht : 0 < t ⊢ (fun x => x ^ (-a - 1 / 2) * sqrt x) t = (fun t => t ^ (-a)) t [PROOFSTEP] simp_rw [sqrt_eq_rpow, ← rpow_add ht, sub_add_cancel] [GOAL] a : ℝ aux1 : (fun t => rexp (-π * t)) =O[atTop] fun t => t ^ (-a - 1 / 2) aux2 : (fun t => rexp (-π * t) * sqrt t) =O[atTop] fun t => t ^ (-a) ⊢ zetaKernel₂ =O[𝓝[Ioi 0] 0] fun t => t ^ a [PROOFSTEP] refine isBigO_zero_zetaKernel₂.trans ((aux2.comp_tendsto tendsto_inv_zero_atTop).congr' ?_ ?_) [GOAL] case refine_1 a : ℝ aux1 : (fun t => rexp (-π * t)) =O[atTop] fun t => t ^ (-a - 1 / 2) aux2 : (fun t => rexp (-π * t) * sqrt t) =O[atTop] fun t => t ^ (-a) ⊢ ((fun t => rexp (-π * t) * sqrt t) ∘ fun x => x⁻¹) =ᶠ[𝓝[Ioi 0] 0] fun t => rexp (-π / t) / sqrt t [PROOFSTEP] refine eventually_of_mem self_mem_nhdsWithin fun x _ => ?_ [GOAL] case refine_1 a : ℝ aux1 : (fun t => rexp (-π * t)) =O[atTop] fun t => t ^ (-a - 1 / 2) aux2 : (fun t => rexp (-π * t) * sqrt t) =O[atTop] fun t => t ^ (-a) x : ℝ x✝ : x ∈ Ioi 0 ⊢ ((fun t => rexp (-π * t) * sqrt t) ∘ fun x => x⁻¹) x = (fun t => rexp (-π / t) / sqrt t) x [PROOFSTEP] simp_rw [Function.comp_apply, sqrt_inv, ← div_eq_mul_inv] [GOAL] case refine_2 a : ℝ aux1 : (fun t => rexp (-π * t)) =O[atTop] fun t => t ^ (-a - 1 / 2) aux2 : (fun t => rexp (-π * t) * sqrt t) =O[atTop] fun t => t ^ (-a) ⊢ ((fun t => t ^ (-a)) ∘ fun x => x⁻¹) =ᶠ[𝓝[Ioi 0] 0] fun t => t ^ a [PROOFSTEP] refine eventually_of_mem self_mem_nhdsWithin fun x hx => ?_ [GOAL] case refine_2 a : ℝ aux1 : (fun t => rexp (-π * t)) =O[atTop] fun t => t ^ (-a - 1 / 2) aux2 : (fun t => rexp (-π * t) * sqrt t) =O[atTop] fun t => t ^ (-a) x : ℝ hx : x ∈ Ioi 0 ⊢ ((fun t => t ^ (-a)) ∘ fun x => x⁻¹) x = (fun t => t ^ a) x [PROOFSTEP] simp_rw [Function.comp_apply, inv_rpow (le_of_lt hx), rpow_neg (le_of_lt hx), inv_inv] [GOAL] ⊢ zetaKernel₁ =O[𝓝[Ioi 0] 0] fun t => t ^ (-(1 / 2)) [PROOFSTEP] have : zetaKernel₁ =ᶠ[𝓝[>] 0] zetaKernel₂ + fun t => ((1 / sqrt t - 1) / 2 : ℂ) := by refine eventuallyEq_of_mem (Ioc_mem_nhdsWithin_Ioi <| left_mem_Ico.mpr zero_lt_one) fun t h => ?_ rw [Pi.add_apply, zetaKernel₂, Pi.add_apply, indicator_of_mem h] ring [GOAL] ⊢ zetaKernel₁ =ᶠ[𝓝[Ioi 0] 0] zetaKernel₂ + fun t => (1 / ↑(sqrt t) - 1) / 2 [PROOFSTEP] refine eventuallyEq_of_mem (Ioc_mem_nhdsWithin_Ioi <| left_mem_Ico.mpr zero_lt_one) fun t h => ?_ [GOAL] t : ℝ h : t ∈ Ioc 0 1 ⊢ zetaKernel₁ t = (zetaKernel₂ + fun t => (1 / ↑(sqrt t) - 1) / 2) t [PROOFSTEP] rw [Pi.add_apply, zetaKernel₂, Pi.add_apply, indicator_of_mem h] [GOAL] t : ℝ h : t ∈ Ioc 0 1 ⊢ zetaKernel₁ t = zetaKernel₁ t + (1 - 1 / ↑(sqrt t)) / 2 + (1 / ↑(sqrt t) - 1) / 2 [PROOFSTEP] ring [GOAL] this : zetaKernel₁ =ᶠ[𝓝[Ioi 0] 0] zetaKernel₂ + fun t => (1 / ↑(sqrt t) - 1) / 2 ⊢ zetaKernel₁ =O[𝓝[Ioi 0] 0] fun t => t ^ (-(1 / 2)) [PROOFSTEP] refine ((isBigO_zero_zetaKernel₂_rpow _).add ?_).congr' this.symm (EventuallyEq.refl _ _) [GOAL] this : zetaKernel₁ =ᶠ[𝓝[Ioi 0] 0] zetaKernel₂ + fun t => (1 / ↑(sqrt t) - 1) / 2 ⊢ (fun x => (fun t => (1 / ↑(sqrt t) - 1) / 2) x) =O[𝓝[Ioi 0] 0] fun t => t ^ (-(1 / 2)) [PROOFSTEP] simp_rw [sub_div] [GOAL] this : zetaKernel₁ =ᶠ[𝓝[Ioi 0] 0] zetaKernel₂ + fun t => (1 / ↑(sqrt t) - 1) / 2 ⊢ (fun x => 1 / ↑(sqrt x) / 2 - 1 / 2) =O[𝓝[Ioi 0] 0] fun t => t ^ (-(1 / 2)) [PROOFSTEP] apply IsBigO.sub [GOAL] case h₁ this : zetaKernel₁ =ᶠ[𝓝[Ioi 0] 0] zetaKernel₂ + fun t => (1 / ↑(sqrt t) - 1) / 2 ⊢ (fun x => 1 / ↑(sqrt x) / 2) =O[𝓝[Ioi 0] 0] fun t => t ^ (-(1 / 2)) [PROOFSTEP] apply IsBigO.of_norm_left [GOAL] case h₁.a this : zetaKernel₁ =ᶠ[𝓝[Ioi 0] 0] zetaKernel₂ + fun t => (1 / ↑(sqrt t) - 1) / 2 ⊢ (fun x => ‖1 / ↑(sqrt x) / 2‖) =O[𝓝[Ioi 0] 0] fun t => t ^ (-(1 / 2)) [PROOFSTEP] simp_rw [norm_div, norm_one, div_eq_mul_inv, one_mul, mul_comm _ ‖(2 : ℂ)‖⁻¹] [GOAL] case h₁.a this : zetaKernel₁ =ᶠ[𝓝[Ioi 0] 0] zetaKernel₂ + fun t => (1 / ↑(sqrt t) - 1) / 2 ⊢ (fun x => ‖2‖⁻¹ * ‖↑(sqrt x)‖⁻¹) =O[𝓝[Ioi 0] 0] fun t => t ^ (-2⁻¹) [PROOFSTEP] refine ((isBigO_refl _ _).congr' (EventuallyEq.refl _ _) (eventuallyEq_of_mem self_mem_nhdsWithin fun x hx => ?_)).const_mul_left _ [GOAL] case h₁.a this : zetaKernel₁ =ᶠ[𝓝[Ioi 0] 0] zetaKernel₂ + fun t => (1 / ↑(sqrt t) - 1) / 2 x : ℝ hx : x ∈ Ioi 0 ⊢ ‖↑(sqrt x)‖⁻¹ = x ^ (-2⁻¹) [PROOFSTEP] rw [Complex.norm_eq_abs, abs_ofReal, abs_of_nonneg (sqrt_nonneg _), sqrt_eq_rpow, rpow_neg (le_of_lt hx), one_div] [GOAL] case h₂ this : zetaKernel₁ =ᶠ[𝓝[Ioi 0] 0] zetaKernel₂ + fun t => (1 / ↑(sqrt t) - 1) / 2 ⊢ (fun x => 1 / 2) =O[𝓝[Ioi 0] 0] fun t => t ^ (-(1 / 2)) [PROOFSTEP] refine isBigO_iff.mpr ⟨‖(1 / 2 : ℂ)‖, ?_⟩ [GOAL] case h₂ this : zetaKernel₁ =ᶠ[𝓝[Ioi 0] 0] zetaKernel₂ + fun t => (1 / ↑(sqrt t) - 1) / 2 ⊢ ∀ᶠ (x : ℝ) in 𝓝[Ioi 0] 0, ‖1 / 2‖ ≤ ‖1 / 2‖ * ‖x ^ (-(1 / 2))‖ [PROOFSTEP] refine eventually_of_mem (Ioc_mem_nhdsWithin_Ioi <| left_mem_Ico.mpr zero_lt_one) fun t ht => ?_ [GOAL] case h₂ this : zetaKernel₁ =ᶠ[𝓝[Ioi 0] 0] zetaKernel₂ + fun t => (1 / ↑(sqrt t) - 1) / 2 t : ℝ ht : t ∈ Ioc 0 1 ⊢ ‖1 / 2‖ ≤ ‖1 / 2‖ * ‖t ^ (-(1 / 2))‖ [PROOFSTEP] refine le_mul_of_one_le_right (norm_nonneg _) ?_ [GOAL] case h₂ this : zetaKernel₁ =ᶠ[𝓝[Ioi 0] 0] zetaKernel₂ + fun t => (1 / ↑(sqrt t) - 1) / 2 t : ℝ ht : t ∈ Ioc 0 1 ⊢ 1 ≤ ‖t ^ (-(1 / 2))‖ [PROOFSTEP] rw [norm_of_nonneg (rpow_nonneg_of_nonneg ht.1.le _), rpow_neg ht.1.le] [GOAL] case h₂ this : zetaKernel₁ =ᶠ[𝓝[Ioi 0] 0] zetaKernel₂ + fun t => (1 / ↑(sqrt t) - 1) / 2 t : ℝ ht : t ∈ Ioc 0 1 ⊢ 1 ≤ (t ^ (1 / 2))⁻¹ [PROOFSTEP] exact one_le_inv (rpow_pos_of_pos ht.1 _) (rpow_le_one ht.1.le ht.2 one_half_pos.le) [GOAL] s : ℂ hs : s ≠ 0 hs' : s ≠ 1 ⊢ DifferentiableAt ℂ riemannCompletedZeta s [PROOFSTEP] refine (differentiable_completed_zeta₀.differentiableAt.sub ?_).add ?_ [GOAL] case refine_1 s : ℂ hs : s ≠ 0 hs' : s ≠ 1 ⊢ DifferentiableAt ℂ (fun y => 1 / y) s [PROOFSTEP] exact (Differentiable.differentiableAt (differentiable_const _)).div differentiableAt_id hs [GOAL] case refine_2 s : ℂ hs : s ≠ 0 hs' : s ≠ 1 ⊢ DifferentiableAt ℂ (fun y => 1 / (y - 1)) s [PROOFSTEP] refine (differentiable_const _).differentiableAt.div ?_ (sub_ne_zero.mpr hs') [GOAL] case refine_2 s : ℂ hs : s ≠ 0 hs' : s ≠ 1 ⊢ DifferentiableAt ℂ (fun y => y - 1) s [PROOFSTEP] exact differentiableAt_id.sub (differentiableAt_const _) [GOAL] s : ℂ hs' : s ≠ 1 ⊢ DifferentiableAt ℂ riemannZeta s [PROOFSTEP] have c1 : ∀ (t : ℂ) (_ : t ≠ 0) (_ : t ≠ 1), DifferentiableAt ℂ (fun u : ℂ => (π : ℂ) ^ (u / 2) * riemannCompletedZeta u / Gamma (u / 2)) t := by intro t ht ht' apply DifferentiableAt.mul · refine (DifferentiableAt.const_cpow ?_ ?_).mul (differentiableAt_completed_zeta ht ht') · exact DifferentiableAt.div_const differentiableAt_id _ · exact Or.inl (ofReal_ne_zero.mpr pi_pos.ne') · refine differentiable_one_div_Gamma.differentiableAt.comp t ?_ exact DifferentiableAt.div_const differentiableAt_id _ -- Second claim: the limit at `s = 0` exists and is equal to `-1 / 2`. [GOAL] s : ℂ hs' : s ≠ 1 ⊢ ∀ (t : ℂ), t ≠ 0 → t ≠ 1 → DifferentiableAt ℂ (fun u => ↑π ^ (u / 2) * riemannCompletedZeta u / Complex.Gamma (u / 2)) t [PROOFSTEP] intro t ht ht' [GOAL] s : ℂ hs' : s ≠ 1 t : ℂ ht : t ≠ 0 ht' : t ≠ 1 ⊢ DifferentiableAt ℂ (fun u => ↑π ^ (u / 2) * riemannCompletedZeta u / Complex.Gamma (u / 2)) t [PROOFSTEP] apply DifferentiableAt.mul [GOAL] case ha s : ℂ hs' : s ≠ 1 t : ℂ ht : t ≠ 0 ht' : t ≠ 1 ⊢ DifferentiableAt ℂ (fun y => ↑π ^ (y / 2) * riemannCompletedZeta y) t [PROOFSTEP] refine (DifferentiableAt.const_cpow ?_ ?_).mul (differentiableAt_completed_zeta ht ht') [GOAL] case ha.refine_1 s : ℂ hs' : s ≠ 1 t : ℂ ht : t ≠ 0 ht' : t ≠ 1 ⊢ DifferentiableAt ℂ (fun y => y / 2) t [PROOFSTEP] exact DifferentiableAt.div_const differentiableAt_id _ [GOAL] case ha.refine_2 s : ℂ hs' : s ≠ 1 t : ℂ ht : t ≠ 0 ht' : t ≠ 1 ⊢ ↑π ≠ 0 ∨ t / 2 ≠ 0 [PROOFSTEP] exact Or.inl (ofReal_ne_zero.mpr pi_pos.ne') [GOAL] case hb s : ℂ hs' : s ≠ 1 t : ℂ ht : t ≠ 0 ht' : t ≠ 1 ⊢ DifferentiableAt ℂ (fun y => (Complex.Gamma (y / 2))⁻¹) t [PROOFSTEP] refine differentiable_one_div_Gamma.differentiableAt.comp t ?_ [GOAL] case hb s : ℂ hs' : s ≠ 1 t : ℂ ht : t ≠ 0 ht' : t ≠ 1 ⊢ DifferentiableAt ℂ (fun y => y / 2) t [PROOFSTEP] exact DifferentiableAt.div_const differentiableAt_id _ -- Second claim: the limit at `s = 0` exists and is equal to `-1 / 2`. [GOAL] s : ℂ hs' : s ≠ 1 c1 : ∀ (t : ℂ), t ≠ 0 → t ≠ 1 → DifferentiableAt ℂ (fun u => ↑π ^ (u / 2) * riemannCompletedZeta u / Complex.Gamma (u / 2)) t ⊢ DifferentiableAt ℂ riemannZeta s [PROOFSTEP] have c2 : Tendsto (fun s : ℂ => (π : ℂ) ^ (s / 2) * riemannCompletedZeta s / Gamma (s / 2)) (𝓝[≠] 0) (𝓝 <| -1 / 2) := by have h1 : Tendsto (fun z : ℂ => (π : ℂ) ^ (z / 2)) (𝓝 0) (𝓝 1) := by convert (ContinuousAt.comp (f := fun z => z / 2) (continuousAt_const_cpow (ofReal_ne_zero.mpr pi_pos.ne')) ?_).tendsto using 2 · simp_rw [Function.comp_apply, zero_div, cpow_zero] · exact continuousAt_id.div continuousAt_const two_ne_zero suffices h2 : Tendsto (fun z => riemannCompletedZeta z / Gamma (z / 2)) (𝓝[≠] 0) (𝓝 <| -1 / 2) · convert (h1.mono_left nhdsWithin_le_nhds).mul h2 using 1 · ext1 x; rw [mul_div] · simp only [one_mul] suffices h3 : Tendsto (fun z => riemannCompletedZeta z * (z / 2) / (z / 2 * Gamma (z / 2))) (𝓝[≠] 0) (𝓝 <| -1 / 2) · refine Tendsto.congr' (eventuallyEq_of_mem self_mem_nhdsWithin fun z hz => ?_) h3 rw [← div_div, mul_div_cancel _ (div_ne_zero hz two_ne_zero)] have h4 : Tendsto (fun z : ℂ => z / 2 * Gamma (z / 2)) (𝓝[≠] 0) (𝓝 1) := by refine tendsto_self_mul_Gamma_nhds_zero.comp ?_ rw [tendsto_nhdsWithin_iff, (by simp : 𝓝 (0 : ℂ) = 𝓝 (0 / 2))] exact ⟨(tendsto_id.div_const _).mono_left nhdsWithin_le_nhds, eventually_of_mem self_mem_nhdsWithin fun x hx => div_ne_zero hx two_ne_zero⟩ suffices Tendsto (fun z => riemannCompletedZeta z * z / 2) (𝓝[≠] 0) (𝓝 (-1 / 2 : ℂ)) by have := this.div h4 one_ne_zero simp_rw [div_one, mul_div_assoc] at this exact this refine Tendsto.div ?_ tendsto_const_nhds two_ne_zero simp_rw [riemannCompletedZeta, add_mul, sub_mul] rw [show 𝓝 (-1 : ℂ) = 𝓝 (0 - 1 + 0) by rw [zero_sub, add_zero]] refine (Tendsto.sub ?_ ?_).add ?_ · refine Tendsto.mono_left ?_ nhdsWithin_le_nhds have : ContinuousAt riemannCompletedZeta₀ 0 := differentiable_completed_zeta₀.continuous.continuousAt simpa only [id.def, mul_zero] using Tendsto.mul this tendsto_id · refine tendsto_const_nhds.congr' (eventuallyEq_of_mem self_mem_nhdsWithin fun t ht => ?_) simp_rw [one_div_mul_cancel ht] · refine Tendsto.mono_left ?_ nhdsWithin_le_nhds suffices ContinuousAt (fun z : ℂ => 1 / (z - 1)) 0 by simpa only [id.def, mul_zero] using Tendsto.mul this tendsto_id refine continuousAt_const.div (continuousAt_id.sub continuousAt_const) ?_ simpa only [zero_sub] using neg_ne_zero.mpr one_ne_zero [GOAL] s : ℂ hs' : s ≠ 1 c1 : ∀ (t : ℂ), t ≠ 0 → t ≠ 1 → DifferentiableAt ℂ (fun u => ↑π ^ (u / 2) * riemannCompletedZeta u / Complex.Gamma (u / 2)) t ⊢ Tendsto (fun s => ↑π ^ (s / 2) * riemannCompletedZeta s / Complex.Gamma (s / 2)) (𝓝[{0}ᶜ] 0) (𝓝 (-1 / 2)) [PROOFSTEP] have h1 : Tendsto (fun z : ℂ => (π : ℂ) ^ (z / 2)) (𝓝 0) (𝓝 1) := by convert (ContinuousAt.comp (f := fun z => z / 2) (continuousAt_const_cpow (ofReal_ne_zero.mpr pi_pos.ne')) ?_).tendsto using 2 · simp_rw [Function.comp_apply, zero_div, cpow_zero] · exact continuousAt_id.div continuousAt_const two_ne_zero [GOAL] s : ℂ hs' : s ≠ 1 c1 : ∀ (t : ℂ), t ≠ 0 → t ≠ 1 → DifferentiableAt ℂ (fun u => ↑π ^ (u / 2) * riemannCompletedZeta u / Complex.Gamma (u / 2)) t ⊢ Tendsto (fun z => ↑π ^ (z / 2)) (𝓝 0) (𝓝 1) [PROOFSTEP] convert (ContinuousAt.comp (f := fun z => z / 2) (continuousAt_const_cpow (ofReal_ne_zero.mpr pi_pos.ne')) ?_).tendsto using 2 [GOAL] case h.e'_5.h.e'_3 s : ℂ hs' : s ≠ 1 c1 : ∀ (t : ℂ), t ≠ 0 → t ≠ 1 → DifferentiableAt ℂ (fun u => ↑π ^ (u / 2) * riemannCompletedZeta u / Complex.Gamma (u / 2)) t ⊢ 1 = ((fun x => ↑π ^ x) ∘ fun z => z / 2) 0 [PROOFSTEP] simp_rw [Function.comp_apply, zero_div, cpow_zero] [GOAL] case convert_1 s : ℂ hs' : s ≠ 1 c1 : ∀ (t : ℂ), t ≠ 0 → t ≠ 1 → DifferentiableAt ℂ (fun u => ↑π ^ (u / 2) * riemannCompletedZeta u / Complex.Gamma (u / 2)) t ⊢ ContinuousAt (fun z => z / 2) 0 [PROOFSTEP] exact continuousAt_id.div continuousAt_const two_ne_zero [GOAL] s : ℂ hs' : s ≠ 1 c1 : ∀ (t : ℂ), t ≠ 0 → t ≠ 1 → DifferentiableAt ℂ (fun u => ↑π ^ (u / 2) * riemannCompletedZeta u / Complex.Gamma (u / 2)) t h1 : Tendsto (fun z => ↑π ^ (z / 2)) (𝓝 0) (𝓝 1) ⊢ Tendsto (fun s => ↑π ^ (s / 2) * riemannCompletedZeta s / Complex.Gamma (s / 2)) (𝓝[{0}ᶜ] 0) (𝓝 (-1 / 2)) [PROOFSTEP] suffices h2 : Tendsto (fun z => riemannCompletedZeta z / Gamma (z / 2)) (𝓝[≠] 0) (𝓝 <| -1 / 2) [GOAL] s : ℂ hs' : s ≠ 1 c1 : ∀ (t : ℂ), t ≠ 0 → t ≠ 1 → DifferentiableAt ℂ (fun u => ↑π ^ (u / 2) * riemannCompletedZeta u / Complex.Gamma (u / 2)) t h1 : Tendsto (fun z => ↑π ^ (z / 2)) (𝓝 0) (𝓝 1) h2 : Tendsto (fun z => riemannCompletedZeta z / Complex.Gamma (z / 2)) (𝓝[{0}ᶜ] 0) (𝓝 (-1 / 2)) ⊢ Tendsto (fun s => ↑π ^ (s / 2) * riemannCompletedZeta s / Complex.Gamma (s / 2)) (𝓝[{0}ᶜ] 0) (𝓝 (-1 / 2)) [PROOFSTEP] convert (h1.mono_left nhdsWithin_le_nhds).mul h2 using 1 [GOAL] case h.e'_3 s : ℂ hs' : s ≠ 1 c1 : ∀ (t : ℂ), t ≠ 0 → t ≠ 1 → DifferentiableAt ℂ (fun u => ↑π ^ (u / 2) * riemannCompletedZeta u / Complex.Gamma (u / 2)) t h1 : Tendsto (fun z => ↑π ^ (z / 2)) (𝓝 0) (𝓝 1) h2 : Tendsto (fun z => riemannCompletedZeta z / Complex.Gamma (z / 2)) (𝓝[{0}ᶜ] 0) (𝓝 (-1 / 2)) ⊢ (fun s => ↑π ^ (s / 2) * riemannCompletedZeta s / Complex.Gamma (s / 2)) = fun x => ↑π ^ (x / 2) * (riemannCompletedZeta x / Complex.Gamma (x / 2)) [PROOFSTEP] ext1 x [GOAL] case h.e'_3.h s : ℂ hs' : s ≠ 1 c1 : ∀ (t : ℂ), t ≠ 0 → t ≠ 1 → DifferentiableAt ℂ (fun u => ↑π ^ (u / 2) * riemannCompletedZeta u / Complex.Gamma (u / 2)) t h1 : Tendsto (fun z => ↑π ^ (z / 2)) (𝓝 0) (𝓝 1) h2 : Tendsto (fun z => riemannCompletedZeta z / Complex.Gamma (z / 2)) (𝓝[{0}ᶜ] 0) (𝓝 (-1 / 2)) x : ℂ ⊢ ↑π ^ (x / 2) * riemannCompletedZeta x / Complex.Gamma (x / 2) = ↑π ^ (x / 2) * (riemannCompletedZeta x / Complex.Gamma (x / 2)) [PROOFSTEP] rw [mul_div] [GOAL] case h.e'_5 s : ℂ hs' : s ≠ 1 c1 : ∀ (t : ℂ), t ≠ 0 → t ≠ 1 → DifferentiableAt ℂ (fun u => ↑π ^ (u / 2) * riemannCompletedZeta u / Complex.Gamma (u / 2)) t h1 : Tendsto (fun z => ↑π ^ (z / 2)) (𝓝 0) (𝓝 1) h2 : Tendsto (fun z => riemannCompletedZeta z / Complex.Gamma (z / 2)) (𝓝[{0}ᶜ] 0) (𝓝 (-1 / 2)) ⊢ 𝓝 (-1 / 2) = 𝓝 (1 * (-1 / 2)) [PROOFSTEP] simp only [one_mul] [GOAL] case h2 s : ℂ hs' : s ≠ 1 c1 : ∀ (t : ℂ), t ≠ 0 → t ≠ 1 → DifferentiableAt ℂ (fun u => ↑π ^ (u / 2) * riemannCompletedZeta u / Complex.Gamma (u / 2)) t h1 : Tendsto (fun z => ↑π ^ (z / 2)) (𝓝 0) (𝓝 1) ⊢ Tendsto (fun z => riemannCompletedZeta z / Complex.Gamma (z / 2)) (𝓝[{0}ᶜ] 0) (𝓝 (-1 / 2)) [PROOFSTEP] suffices h3 : Tendsto (fun z => riemannCompletedZeta z * (z / 2) / (z / 2 * Gamma (z / 2))) (𝓝[≠] 0) (𝓝 <| -1 / 2) [GOAL] case h2 s : ℂ hs' : s ≠ 1 c1 : ∀ (t : ℂ), t ≠ 0 → t ≠ 1 → DifferentiableAt ℂ (fun u => ↑π ^ (u / 2) * riemannCompletedZeta u / Complex.Gamma (u / 2)) t h1 : Tendsto (fun z => ↑π ^ (z / 2)) (𝓝 0) (𝓝 1) h3 : Tendsto (fun z => riemannCompletedZeta z * (z / 2) / (z / 2 * Complex.Gamma (z / 2))) (𝓝[{0}ᶜ] 0) (𝓝 (-1 / 2)) ⊢ Tendsto (fun z => riemannCompletedZeta z / Complex.Gamma (z / 2)) (𝓝[{0}ᶜ] 0) (𝓝 (-1 / 2)) [PROOFSTEP] refine Tendsto.congr' (eventuallyEq_of_mem self_mem_nhdsWithin fun z hz => ?_) h3 [GOAL] case h2 s : ℂ hs' : s ≠ 1 c1 : ∀ (t : ℂ), t ≠ 0 → t ≠ 1 → DifferentiableAt ℂ (fun u => ↑π ^ (u / 2) * riemannCompletedZeta u / Complex.Gamma (u / 2)) t h1 : Tendsto (fun z => ↑π ^ (z / 2)) (𝓝 0) (𝓝 1) h3 : Tendsto (fun z => riemannCompletedZeta z * (z / 2) / (z / 2 * Complex.Gamma (z / 2))) (𝓝[{0}ᶜ] 0) (𝓝 (-1 / 2)) z : ℂ hz : z ∈ {0}ᶜ ⊢ riemannCompletedZeta z * (z / 2) / (z / 2 * Complex.Gamma (z / 2)) = riemannCompletedZeta z / Complex.Gamma (z / 2) [PROOFSTEP] rw [← div_div, mul_div_cancel _ (div_ne_zero hz two_ne_zero)] [GOAL] case h3 s : ℂ hs' : s ≠ 1 c1 : ∀ (t : ℂ), t ≠ 0 → t ≠ 1 → DifferentiableAt ℂ (fun u => ↑π ^ (u / 2) * riemannCompletedZeta u / Complex.Gamma (u / 2)) t h1 : Tendsto (fun z => ↑π ^ (z / 2)) (𝓝 0) (𝓝 1) ⊢ Tendsto (fun z => riemannCompletedZeta z * (z / 2) / (z / 2 * Complex.Gamma (z / 2))) (𝓝[{0}ᶜ] 0) (𝓝 (-1 / 2)) [PROOFSTEP] have h4 : Tendsto (fun z : ℂ => z / 2 * Gamma (z / 2)) (𝓝[≠] 0) (𝓝 1) := by refine tendsto_self_mul_Gamma_nhds_zero.comp ?_ rw [tendsto_nhdsWithin_iff, (by simp : 𝓝 (0 : ℂ) = 𝓝 (0 / 2))] exact ⟨(tendsto_id.div_const _).mono_left nhdsWithin_le_nhds, eventually_of_mem self_mem_nhdsWithin fun x hx => div_ne_zero hx two_ne_zero⟩ [GOAL] s : ℂ hs' : s ≠ 1 c1 : ∀ (t : ℂ), t ≠ 0 → t ≠ 1 → DifferentiableAt ℂ (fun u => ↑π ^ (u / 2) * riemannCompletedZeta u / Complex.Gamma (u / 2)) t h1 : Tendsto (fun z => ↑π ^ (z / 2)) (𝓝 0) (𝓝 1) ⊢ Tendsto (fun z => z / 2 * Complex.Gamma (z / 2)) (𝓝[{0}ᶜ] 0) (𝓝 1) [PROOFSTEP] refine tendsto_self_mul_Gamma_nhds_zero.comp ?_ [GOAL] s : ℂ hs' : s ≠ 1 c1 : ∀ (t : ℂ), t ≠ 0 → t ≠ 1 → DifferentiableAt ℂ (fun u => ↑π ^ (u / 2) * riemannCompletedZeta u / Complex.Gamma (u / 2)) t h1 : Tendsto (fun z => ↑π ^ (z / 2)) (𝓝 0) (𝓝 1) ⊢ Tendsto (fun z => z / 2) (𝓝[{0}ᶜ] 0) (𝓝[{0}ᶜ] 0) [PROOFSTEP] rw [tendsto_nhdsWithin_iff, (by simp : 𝓝 (0 : ℂ) = 𝓝 (0 / 2))] [GOAL] s : ℂ hs' : s ≠ 1 c1 : ∀ (t : ℂ), t ≠ 0 → t ≠ 1 → DifferentiableAt ℂ (fun u => ↑π ^ (u / 2) * riemannCompletedZeta u / Complex.Gamma (u / 2)) t h1 : Tendsto (fun z => ↑π ^ (z / 2)) (𝓝 0) (𝓝 1) ⊢ 𝓝 0 = 𝓝 (0 / 2) [PROOFSTEP] simp [GOAL] s : ℂ hs' : s ≠ 1 c1 : ∀ (t : ℂ), t ≠ 0 → t ≠ 1 → DifferentiableAt ℂ (fun u => ↑π ^ (u / 2) * riemannCompletedZeta u / Complex.Gamma (u / 2)) t h1 : Tendsto (fun z => ↑π ^ (z / 2)) (𝓝 0) (𝓝 1) ⊢ Tendsto (fun z => z / 2) (𝓝[{0}ᶜ] 0) (𝓝 (0 / 2)) ∧ ∀ᶠ (n : ℂ) in 𝓝[{0}ᶜ] 0, n / 2 ∈ {0}ᶜ [PROOFSTEP] exact ⟨(tendsto_id.div_const _).mono_left nhdsWithin_le_nhds, eventually_of_mem self_mem_nhdsWithin fun x hx => div_ne_zero hx two_ne_zero⟩ [GOAL] case h3 s : ℂ hs' : s ≠ 1 c1 : ∀ (t : ℂ), t ≠ 0 → t ≠ 1 → DifferentiableAt ℂ (fun u => ↑π ^ (u / 2) * riemannCompletedZeta u / Complex.Gamma (u / 2)) t h1 : Tendsto (fun z => ↑π ^ (z / 2)) (𝓝 0) (𝓝 1) h4 : Tendsto (fun z => z / 2 * Complex.Gamma (z / 2)) (𝓝[{0}ᶜ] 0) (𝓝 1) ⊢ Tendsto (fun z => riemannCompletedZeta z * (z / 2) / (z / 2 * Complex.Gamma (z / 2))) (𝓝[{0}ᶜ] 0) (𝓝 (-1 / 2)) [PROOFSTEP] suffices Tendsto (fun z => riemannCompletedZeta z * z / 2) (𝓝[≠] 0) (𝓝 (-1 / 2 : ℂ)) by have := this.div h4 one_ne_zero simp_rw [div_one, mul_div_assoc] at this exact this [GOAL] s : ℂ hs' : s ≠ 1 c1 : ∀ (t : ℂ), t ≠ 0 → t ≠ 1 → DifferentiableAt ℂ (fun u => ↑π ^ (u / 2) * riemannCompletedZeta u / Complex.Gamma (u / 2)) t h1 : Tendsto (fun z => ↑π ^ (z / 2)) (𝓝 0) (𝓝 1) h4 : Tendsto (fun z => z / 2 * Complex.Gamma (z / 2)) (𝓝[{0}ᶜ] 0) (𝓝 1) this : Tendsto (fun z => riemannCompletedZeta z * z / 2) (𝓝[{0}ᶜ] 0) (𝓝 (-1 / 2)) ⊢ Tendsto (fun z => riemannCompletedZeta z * (z / 2) / (z / 2 * Complex.Gamma (z / 2))) (𝓝[{0}ᶜ] 0) (𝓝 (-1 / 2)) [PROOFSTEP] have := this.div h4 one_ne_zero [GOAL] s : ℂ hs' : s ≠ 1 c1 : ∀ (t : ℂ), t ≠ 0 → t ≠ 1 → DifferentiableAt ℂ (fun u => ↑π ^ (u / 2) * riemannCompletedZeta u / Complex.Gamma (u / 2)) t h1 : Tendsto (fun z => ↑π ^ (z / 2)) (𝓝 0) (𝓝 1) h4 : Tendsto (fun z => z / 2 * Complex.Gamma (z / 2)) (𝓝[{0}ᶜ] 0) (𝓝 1) this✝ : Tendsto (fun z => riemannCompletedZeta z * z / 2) (𝓝[{0}ᶜ] 0) (𝓝 (-1 / 2)) this : Tendsto ((fun z => riemannCompletedZeta z * z / 2) / fun z => z / 2 * Complex.Gamma (z / 2)) (𝓝[{0}ᶜ] 0) (𝓝 (-1 / 2 / 1)) ⊢ Tendsto (fun z => riemannCompletedZeta z * (z / 2) / (z / 2 * Complex.Gamma (z / 2))) (𝓝[{0}ᶜ] 0) (𝓝 (-1 / 2)) [PROOFSTEP] simp_rw [div_one, mul_div_assoc] at this [GOAL] s : ℂ hs' : s ≠ 1 c1 : ∀ (t : ℂ), t ≠ 0 → t ≠ 1 → DifferentiableAt ℂ (fun u => ↑π ^ (u / 2) * riemannCompletedZeta u / Complex.Gamma (u / 2)) t h1 : Tendsto (fun z => ↑π ^ (z / 2)) (𝓝 0) (𝓝 1) h4 : Tendsto (fun z => z / 2 * Complex.Gamma (z / 2)) (𝓝[{0}ᶜ] 0) (𝓝 1) this✝ : Tendsto (fun z => riemannCompletedZeta z * z / 2) (𝓝[{0}ᶜ] 0) (𝓝 (-1 / 2)) this : Tendsto ((fun z => riemannCompletedZeta z * (z / 2)) / fun z => z / 2 * Complex.Gamma (z / 2)) (𝓝[{0}ᶜ] 0) (𝓝 (-1 / 2)) ⊢ Tendsto (fun z => riemannCompletedZeta z * (z / 2) / (z / 2 * Complex.Gamma (z / 2))) (𝓝[{0}ᶜ] 0) (𝓝 (-1 / 2)) [PROOFSTEP] exact this [GOAL] case h3 s : ℂ hs' : s ≠ 1 c1 : ∀ (t : ℂ), t ≠ 0 → t ≠ 1 → DifferentiableAt ℂ (fun u => ↑π ^ (u / 2) * riemannCompletedZeta u / Complex.Gamma (u / 2)) t h1 : Tendsto (fun z => ↑π ^ (z / 2)) (𝓝 0) (𝓝 1) h4 : Tendsto (fun z => z / 2 * Complex.Gamma (z / 2)) (𝓝[{0}ᶜ] 0) (𝓝 1) ⊢ Tendsto (fun z => riemannCompletedZeta z * z / 2) (𝓝[{0}ᶜ] 0) (𝓝 (-1 / 2)) [PROOFSTEP] refine Tendsto.div ?_ tendsto_const_nhds two_ne_zero [GOAL] case h3 s : ℂ hs' : s ≠ 1 c1 : ∀ (t : ℂ), t ≠ 0 → t ≠ 1 → DifferentiableAt ℂ (fun u => ↑π ^ (u / 2) * riemannCompletedZeta u / Complex.Gamma (u / 2)) t h1 : Tendsto (fun z => ↑π ^ (z / 2)) (𝓝 0) (𝓝 1) h4 : Tendsto (fun z => z / 2 * Complex.Gamma (z / 2)) (𝓝[{0}ᶜ] 0) (𝓝 1) ⊢ Tendsto (fun z => riemannCompletedZeta z * z) (𝓝[{0}ᶜ] 0) (𝓝 (-1)) [PROOFSTEP] simp_rw [riemannCompletedZeta, add_mul, sub_mul] [GOAL] case h3 s : ℂ hs' : s ≠ 1 c1 : ∀ (t : ℂ), t ≠ 0 → t ≠ 1 → DifferentiableAt ℂ (fun u => ↑π ^ (u / 2) * riemannCompletedZeta u / Complex.Gamma (u / 2)) t h1 : Tendsto (fun z => ↑π ^ (z / 2)) (𝓝 0) (𝓝 1) h4 : Tendsto (fun z => z / 2 * Complex.Gamma (z / 2)) (𝓝[{0}ᶜ] 0) (𝓝 1) ⊢ Tendsto (fun z => riemannCompletedZeta₀ z * z - 1 / z * z + 1 / (z - 1) * z) (𝓝[{0}ᶜ] 0) (𝓝 (-1)) [PROOFSTEP] rw [show 𝓝 (-1 : ℂ) = 𝓝 (0 - 1 + 0) by rw [zero_sub, add_zero]] [GOAL] s : ℂ hs' : s ≠ 1 c1 : ∀ (t : ℂ), t ≠ 0 → t ≠ 1 → DifferentiableAt ℂ (fun u => ↑π ^ (u / 2) * riemannCompletedZeta u / Complex.Gamma (u / 2)) t h1 : Tendsto (fun z => ↑π ^ (z / 2)) (𝓝 0) (𝓝 1) h4 : Tendsto (fun z => z / 2 * Complex.Gamma (z / 2)) (𝓝[{0}ᶜ] 0) (𝓝 1) ⊢ 𝓝 (-1) = 𝓝 (0 - 1 + 0) [PROOFSTEP] rw [zero_sub, add_zero] [GOAL] case h3 s : ℂ hs' : s ≠ 1 c1 : ∀ (t : ℂ), t ≠ 0 → t ≠ 1 → DifferentiableAt ℂ (fun u => ↑π ^ (u / 2) * riemannCompletedZeta u / Complex.Gamma (u / 2)) t h1 : Tendsto (fun z => ↑π ^ (z / 2)) (𝓝 0) (𝓝 1) h4 : Tendsto (fun z => z / 2 * Complex.Gamma (z / 2)) (𝓝[{0}ᶜ] 0) (𝓝 1) ⊢ Tendsto (fun z => riemannCompletedZeta₀ z * z - 1 / z * z + 1 / (z - 1) * z) (𝓝[{0}ᶜ] 0) (𝓝 (0 - 1 + 0)) [PROOFSTEP] refine (Tendsto.sub ?_ ?_).add ?_ [GOAL] case h3.refine_1 s : ℂ hs' : s ≠ 1 c1 : ∀ (t : ℂ), t ≠ 0 → t ≠ 1 → DifferentiableAt ℂ (fun u => ↑π ^ (u / 2) * riemannCompletedZeta u / Complex.Gamma (u / 2)) t h1 : Tendsto (fun z => ↑π ^ (z / 2)) (𝓝 0) (𝓝 1) h4 : Tendsto (fun z => z / 2 * Complex.Gamma (z / 2)) (𝓝[{0}ᶜ] 0) (𝓝 1) ⊢ Tendsto (fun z => riemannCompletedZeta₀ z * z) (𝓝[{0}ᶜ] 0) (𝓝 0) [PROOFSTEP] refine Tendsto.mono_left ?_ nhdsWithin_le_nhds [GOAL] case h3.refine_1 s : ℂ hs' : s ≠ 1 c1 : ∀ (t : ℂ), t ≠ 0 → t ≠ 1 → DifferentiableAt ℂ (fun u => ↑π ^ (u / 2) * riemannCompletedZeta u / Complex.Gamma (u / 2)) t h1 : Tendsto (fun z => ↑π ^ (z / 2)) (𝓝 0) (𝓝 1) h4 : Tendsto (fun z => z / 2 * Complex.Gamma (z / 2)) (𝓝[{0}ᶜ] 0) (𝓝 1) ⊢ Tendsto (fun z => riemannCompletedZeta₀ z * z) (𝓝 0) (𝓝 0) [PROOFSTEP] have : ContinuousAt riemannCompletedZeta₀ 0 := differentiable_completed_zeta₀.continuous.continuousAt [GOAL] case h3.refine_1 s : ℂ hs' : s ≠ 1 c1 : ∀ (t : ℂ), t ≠ 0 → t ≠ 1 → DifferentiableAt ℂ (fun u => ↑π ^ (u / 2) * riemannCompletedZeta u / Complex.Gamma (u / 2)) t h1 : Tendsto (fun z => ↑π ^ (z / 2)) (𝓝 0) (𝓝 1) h4 : Tendsto (fun z => z / 2 * Complex.Gamma (z / 2)) (𝓝[{0}ᶜ] 0) (𝓝 1) this : ContinuousAt riemannCompletedZeta₀ 0 ⊢ Tendsto (fun z => riemannCompletedZeta₀ z * z) (𝓝 0) (𝓝 0) [PROOFSTEP] simpa only [id.def, mul_zero] using Tendsto.mul this tendsto_id [GOAL] case h3.refine_2 s : ℂ hs' : s ≠ 1 c1 : ∀ (t : ℂ), t ≠ 0 → t ≠ 1 → DifferentiableAt ℂ (fun u => ↑π ^ (u / 2) * riemannCompletedZeta u / Complex.Gamma (u / 2)) t h1 : Tendsto (fun z => ↑π ^ (z / 2)) (𝓝 0) (𝓝 1) h4 : Tendsto (fun z => z / 2 * Complex.Gamma (z / 2)) (𝓝[{0}ᶜ] 0) (𝓝 1) ⊢ Tendsto (fun z => 1 / z * z) (𝓝[{0}ᶜ] 0) (𝓝 1) [PROOFSTEP] refine tendsto_const_nhds.congr' (eventuallyEq_of_mem self_mem_nhdsWithin fun t ht => ?_) [GOAL] case h3.refine_2 s : ℂ hs' : s ≠ 1 c1 : ∀ (t : ℂ), t ≠ 0 → t ≠ 1 → DifferentiableAt ℂ (fun u => ↑π ^ (u / 2) * riemannCompletedZeta u / Complex.Gamma (u / 2)) t h1 : Tendsto (fun z => ↑π ^ (z / 2)) (𝓝 0) (𝓝 1) h4 : Tendsto (fun z => z / 2 * Complex.Gamma (z / 2)) (𝓝[{0}ᶜ] 0) (𝓝 1) t : ℂ ht : t ∈ {0}ᶜ ⊢ 1 = 1 / t * t [PROOFSTEP] simp_rw [one_div_mul_cancel ht] [GOAL] case h3.refine_3 s : ℂ hs' : s ≠ 1 c1 : ∀ (t : ℂ), t ≠ 0 → t ≠ 1 → DifferentiableAt ℂ (fun u => ↑π ^ (u / 2) * riemannCompletedZeta u / Complex.Gamma (u / 2)) t h1 : Tendsto (fun z => ↑π ^ (z / 2)) (𝓝 0) (𝓝 1) h4 : Tendsto (fun z => z / 2 * Complex.Gamma (z / 2)) (𝓝[{0}ᶜ] 0) (𝓝 1) ⊢ Tendsto (fun z => 1 / (z - 1) * z) (𝓝[{0}ᶜ] 0) (𝓝 0) [PROOFSTEP] refine Tendsto.mono_left ?_ nhdsWithin_le_nhds [GOAL] case h3.refine_3 s : ℂ hs' : s ≠ 1 c1 : ∀ (t : ℂ), t ≠ 0 → t ≠ 1 → DifferentiableAt ℂ (fun u => ↑π ^ (u / 2) * riemannCompletedZeta u / Complex.Gamma (u / 2)) t h1 : Tendsto (fun z => ↑π ^ (z / 2)) (𝓝 0) (𝓝 1) h4 : Tendsto (fun z => z / 2 * Complex.Gamma (z / 2)) (𝓝[{0}ᶜ] 0) (𝓝 1) ⊢ Tendsto (fun z => 1 / (z - 1) * z) (𝓝 0) (𝓝 0) [PROOFSTEP] suffices ContinuousAt (fun z : ℂ => 1 / (z - 1)) 0 by simpa only [id.def, mul_zero] using Tendsto.mul this tendsto_id [GOAL] s : ℂ hs' : s ≠ 1 c1 : ∀ (t : ℂ), t ≠ 0 → t ≠ 1 → DifferentiableAt ℂ (fun u => ↑π ^ (u / 2) * riemannCompletedZeta u / Complex.Gamma (u / 2)) t h1 : Tendsto (fun z => ↑π ^ (z / 2)) (𝓝 0) (𝓝 1) h4 : Tendsto (fun z => z / 2 * Complex.Gamma (z / 2)) (𝓝[{0}ᶜ] 0) (𝓝 1) this : ContinuousAt (fun z => 1 / (z - 1)) 0 ⊢ Tendsto (fun z => 1 / (z - 1) * z) (𝓝 0) (𝓝 0) [PROOFSTEP] simpa only [id.def, mul_zero] using Tendsto.mul this tendsto_id [GOAL] case h3.refine_3 s : ℂ hs' : s ≠ 1 c1 : ∀ (t : ℂ), t ≠ 0 → t ≠ 1 → DifferentiableAt ℂ (fun u => ↑π ^ (u / 2) * riemannCompletedZeta u / Complex.Gamma (u / 2)) t h1 : Tendsto (fun z => ↑π ^ (z / 2)) (𝓝 0) (𝓝 1) h4 : Tendsto (fun z => z / 2 * Complex.Gamma (z / 2)) (𝓝[{0}ᶜ] 0) (𝓝 1) ⊢ ContinuousAt (fun z => 1 / (z - 1)) 0 [PROOFSTEP] refine continuousAt_const.div (continuousAt_id.sub continuousAt_const) ?_ [GOAL] case h3.refine_3 s : ℂ hs' : s ≠ 1 c1 : ∀ (t : ℂ), t ≠ 0 → t ≠ 1 → DifferentiableAt ℂ (fun u => ↑π ^ (u / 2) * riemannCompletedZeta u / Complex.Gamma (u / 2)) t h1 : Tendsto (fun z => ↑π ^ (z / 2)) (𝓝 0) (𝓝 1) h4 : Tendsto (fun z => z / 2 * Complex.Gamma (z / 2)) (𝓝[{0}ᶜ] 0) (𝓝 1) ⊢ 0 - 1 ≠ 0 [PROOFSTEP] simpa only [zero_sub] using neg_ne_zero.mpr one_ne_zero [GOAL] s : ℂ hs' : s ≠ 1 c1 : ∀ (t : ℂ), t ≠ 0 → t ≠ 1 → DifferentiableAt ℂ (fun u => ↑π ^ (u / 2) * riemannCompletedZeta u / Complex.Gamma (u / 2)) t c2 : Tendsto (fun s => ↑π ^ (s / 2) * riemannCompletedZeta s / Complex.Gamma (s / 2)) (𝓝[{0}ᶜ] 0) (𝓝 (-1 / 2)) ⊢ DifferentiableAt ℂ riemannZeta s [PROOFSTEP] rcases ne_or_eq s 0 with (hs | rfl) [GOAL] case inl s : ℂ hs' : s ≠ 1 c1 : ∀ (t : ℂ), t ≠ 0 → t ≠ 1 → DifferentiableAt ℂ (fun u => ↑π ^ (u / 2) * riemannCompletedZeta u / Complex.Gamma (u / 2)) t c2 : Tendsto (fun s => ↑π ^ (s / 2) * riemannCompletedZeta s / Complex.Gamma (s / 2)) (𝓝[{0}ᶜ] 0) (𝓝 (-1 / 2)) hs : s ≠ 0 ⊢ DifferentiableAt ℂ riemannZeta s [PROOFSTEP] have : {(0 : ℂ)}ᶜ ∈ 𝓝 s := isOpen_compl_singleton.mem_nhds hs [GOAL] case inl s : ℂ hs' : s ≠ 1 c1 : ∀ (t : ℂ), t ≠ 0 → t ≠ 1 → DifferentiableAt ℂ (fun u => ↑π ^ (u / 2) * riemannCompletedZeta u / Complex.Gamma (u / 2)) t c2 : Tendsto (fun s => ↑π ^ (s / 2) * riemannCompletedZeta s / Complex.Gamma (s / 2)) (𝓝[{0}ᶜ] 0) (𝓝 (-1 / 2)) hs : s ≠ 0 this : {0}ᶜ ∈ 𝓝 s ⊢ DifferentiableAt ℂ riemannZeta s [PROOFSTEP] refine (c1 s hs hs').congr_of_eventuallyEq (eventuallyEq_of_mem this fun x hx => ?_) [GOAL] case inl s : ℂ hs' : s ≠ 1 c1 : ∀ (t : ℂ), t ≠ 0 → t ≠ 1 → DifferentiableAt ℂ (fun u => ↑π ^ (u / 2) * riemannCompletedZeta u / Complex.Gamma (u / 2)) t c2 : Tendsto (fun s => ↑π ^ (s / 2) * riemannCompletedZeta s / Complex.Gamma (s / 2)) (𝓝[{0}ᶜ] 0) (𝓝 (-1 / 2)) hs : s ≠ 0 this : {0}ᶜ ∈ 𝓝 s x : ℂ hx : x ∈ {0}ᶜ ⊢ riemannZeta x = ↑π ^ (x / 2) * riemannCompletedZeta x / Complex.Gamma (x / 2) [PROOFSTEP] rw [riemannZeta_def] [GOAL] case inl s : ℂ hs' : s ≠ 1 c1 : ∀ (t : ℂ), t ≠ 0 → t ≠ 1 → DifferentiableAt ℂ (fun u => ↑π ^ (u / 2) * riemannCompletedZeta u / Complex.Gamma (u / 2)) t c2 : Tendsto (fun s => ↑π ^ (s / 2) * riemannCompletedZeta s / Complex.Gamma (s / 2)) (𝓝[{0}ᶜ] 0) (𝓝 (-1 / 2)) hs : s ≠ 0 this : {0}ᶜ ∈ 𝓝 s x : ℂ hx : x ∈ {0}ᶜ ⊢ Function.update (fun s => ↑π ^ (s / 2) * riemannCompletedZeta s / Complex.Gamma (s / 2)) 0 (-1 / 2) x = ↑π ^ (x / 2) * riemannCompletedZeta x / Complex.Gamma (x / 2) [PROOFSTEP] apply Function.update_noteq hx [GOAL] case inr c1 : ∀ (t : ℂ), t ≠ 0 → t ≠ 1 → DifferentiableAt ℂ (fun u => ↑π ^ (u / 2) * riemannCompletedZeta u / Complex.Gamma (u / 2)) t c2 : Tendsto (fun s => ↑π ^ (s / 2) * riemannCompletedZeta s / Complex.Gamma (s / 2)) (𝓝[{0}ᶜ] 0) (𝓝 (-1 / 2)) hs' : 0 ≠ 1 ⊢ DifferentiableAt ℂ riemannZeta 0 [PROOFSTEP] rw [riemannZeta, ← (lim_eq_iff ⟨-1 / 2, c2⟩).mpr c2] [GOAL] case inr c1 : ∀ (t : ℂ), t ≠ 0 → t ≠ 1 → DifferentiableAt ℂ (fun u => ↑π ^ (u / 2) * riemannCompletedZeta u / Complex.Gamma (u / 2)) t c2 : Tendsto (fun s => ↑π ^ (s / 2) * riemannCompletedZeta s / Complex.Gamma (s / 2)) (𝓝[{0}ᶜ] 0) (𝓝 (-1 / 2)) hs' : 0 ≠ 1 ⊢ DifferentiableAt ℂ (Function.update (fun s => ↑π ^ (s / 2) * riemannCompletedZeta s / Complex.Gamma (s / 2)) 0 (lim (map (fun s => ↑π ^ (s / 2) * riemannCompletedZeta s / Complex.Gamma (s / 2)) (𝓝[{0}ᶜ] 0)))) 0 [PROOFSTEP] have S_nhds : {(1 : ℂ)}ᶜ ∈ 𝓝 (0 : ℂ) := isOpen_compl_singleton.mem_nhds hs' [GOAL] case inr c1 : ∀ (t : ℂ), t ≠ 0 → t ≠ 1 → DifferentiableAt ℂ (fun u => ↑π ^ (u / 2) * riemannCompletedZeta u / Complex.Gamma (u / 2)) t c2 : Tendsto (fun s => ↑π ^ (s / 2) * riemannCompletedZeta s / Complex.Gamma (s / 2)) (𝓝[{0}ᶜ] 0) (𝓝 (-1 / 2)) hs' : 0 ≠ 1 S_nhds : {1}ᶜ ∈ 𝓝 0 ⊢ DifferentiableAt ℂ (Function.update (fun s => ↑π ^ (s / 2) * riemannCompletedZeta s / Complex.Gamma (s / 2)) 0 (lim (map (fun s => ↑π ^ (s / 2) * riemannCompletedZeta s / Complex.Gamma (s / 2)) (𝓝[{0}ᶜ] 0)))) 0 [PROOFSTEP] refine ((Complex.differentiableOn_update_limUnder_of_isLittleO S_nhds (fun t ht => (c1 t ht.2 ht.1).differentiableWithinAt) ?_) 0 hs').differentiableAt S_nhds [GOAL] case inr c1 : ∀ (t : ℂ), t ≠ 0 → t ≠ 1 → DifferentiableAt ℂ (fun u => ↑π ^ (u / 2) * riemannCompletedZeta u / Complex.Gamma (u / 2)) t c2 : Tendsto (fun s => ↑π ^ (s / 2) * riemannCompletedZeta s / Complex.Gamma (s / 2)) (𝓝[{0}ᶜ] 0) (𝓝 (-1 / 2)) hs' : 0 ≠ 1 S_nhds : {1}ᶜ ∈ 𝓝 0 ⊢ (fun z => ↑π ^ (z / 2) * riemannCompletedZeta z / Complex.Gamma (z / 2) - ↑π ^ (0 / 2) * riemannCompletedZeta 0 / Complex.Gamma (0 / 2)) =o[𝓝[{0}ᶜ] 0] fun z => (z - 0)⁻¹ [PROOFSTEP] simp only [zero_div, div_zero, Complex.Gamma_zero, mul_zero, cpow_zero, sub_zero] -- Remains to show completed zeta is `o (s ^ (-1))` near 0. [GOAL] case inr c1 : ∀ (t : ℂ), t ≠ 0 → t ≠ 1 → DifferentiableAt ℂ (fun u => ↑π ^ (u / 2) * riemannCompletedZeta u / Complex.Gamma (u / 2)) t c2 : Tendsto (fun s => ↑π ^ (s / 2) * riemannCompletedZeta s / Complex.Gamma (s / 2)) (𝓝[{0}ᶜ] 0) (𝓝 (-1 / 2)) hs' : 0 ≠ 1 S_nhds : {1}ᶜ ∈ 𝓝 0 ⊢ (fun z => ↑π ^ (z / 2) * riemannCompletedZeta z / Complex.Gamma (z / 2)) =o[𝓝[{0}ᶜ] 0] fun z => z⁻¹ [PROOFSTEP] refine (isBigO_const_of_tendsto c2 <| one_ne_zero' ℂ).trans_isLittleO ?_ [GOAL] case inr c1 : ∀ (t : ℂ), t ≠ 0 → t ≠ 1 → DifferentiableAt ℂ (fun u => ↑π ^ (u / 2) * riemannCompletedZeta u / Complex.Gamma (u / 2)) t c2 : Tendsto (fun s => ↑π ^ (s / 2) * riemannCompletedZeta s / Complex.Gamma (s / 2)) (𝓝[{0}ᶜ] 0) (𝓝 (-1 / 2)) hs' : 0 ≠ 1 S_nhds : {1}ᶜ ∈ 𝓝 0 ⊢ (fun _x => 1) =o[𝓝[{0}ᶜ] 0] fun z => z⁻¹ [PROOFSTEP] rw [isLittleO_iff_tendsto'] [GOAL] case inr c1 : ∀ (t : ℂ), t ≠ 0 → t ≠ 1 → DifferentiableAt ℂ (fun u => ↑π ^ (u / 2) * riemannCompletedZeta u / Complex.Gamma (u / 2)) t c2 : Tendsto (fun s => ↑π ^ (s / 2) * riemannCompletedZeta s / Complex.Gamma (s / 2)) (𝓝[{0}ᶜ] 0) (𝓝 (-1 / 2)) hs' : 0 ≠ 1 S_nhds : {1}ᶜ ∈ 𝓝 0 ⊢ Tendsto (fun x => 1 / x⁻¹) (𝓝[{0}ᶜ] 0) (𝓝 0) [PROOFSTEP] exact Tendsto.congr (fun x => by rw [← one_div, one_div_one_div]) nhdsWithin_le_nhds [GOAL] c1 : ∀ (t : ℂ), t ≠ 0 → t ≠ 1 → DifferentiableAt ℂ (fun u => ↑π ^ (u / 2) * riemannCompletedZeta u / Complex.Gamma (u / 2)) t c2 : Tendsto (fun s => ↑π ^ (s / 2) * riemannCompletedZeta s / Complex.Gamma (s / 2)) (𝓝[{0}ᶜ] 0) (𝓝 (-1 / 2)) hs' : 0 ≠ 1 S_nhds : {1}ᶜ ∈ 𝓝 0 x : ℂ ⊢ x = 1 / x⁻¹ [PROOFSTEP] rw [← one_div, one_div_one_div] [GOAL] case inr c1 : ∀ (t : ℂ), t ≠ 0 → t ≠ 1 → DifferentiableAt ℂ (fun u => ↑π ^ (u / 2) * riemannCompletedZeta u / Complex.Gamma (u / 2)) t c2 : Tendsto (fun s => ↑π ^ (s / 2) * riemannCompletedZeta s / Complex.Gamma (s / 2)) (𝓝[{0}ᶜ] 0) (𝓝 (-1 / 2)) hs' : 0 ≠ 1 S_nhds : {1}ᶜ ∈ 𝓝 0 ⊢ ∀ᶠ (x : ℂ) in 𝓝[{0}ᶜ] 0, x⁻¹ = 0 → 1 = 0 [PROOFSTEP] exact eventually_of_mem self_mem_nhdsWithin fun x hx hx' => (hx <| inv_eq_zero.mp hx').elim [GOAL] n : ℕ ⊢ riemannZeta (-2 * (↑n + 1)) = 0 [PROOFSTEP] have : (-2 : ℂ) * (n + 1) ≠ 0 := mul_ne_zero (neg_ne_zero.mpr two_ne_zero) (Nat.cast_add_one_ne_zero n) [GOAL] n : ℕ this : -2 * (↑n + 1) ≠ 0 ⊢ riemannZeta (-2 * (↑n + 1)) = 0 [PROOFSTEP] rw [riemannZeta, Function.update_noteq this, show -2 * ((n : ℂ) + 1) / 2 = -↑(n + 1) by push_cast ; ring, Complex.Gamma_neg_nat_eq_zero, div_zero] [GOAL] n : ℕ this : -2 * (↑n + 1) ≠ 0 ⊢ -2 * (↑n + 1) / 2 = -↑(n + 1) [PROOFSTEP] push_cast [GOAL] n : ℕ this : -2 * (↑n + 1) ≠ 0 ⊢ -2 * (↑n + 1) / 2 = -(↑n + 1) [PROOFSTEP] ring [GOAL] s : ℂ hs : 1 / 2 < s.re ⊢ HasMellin (indicator (Ioc 0 1) fun t => 1 / ↑(sqrt t)) s (1 / (s - 1 / 2)) [PROOFSTEP] have h1 : EqOn (fun t => 1 / ↑(sqrt t) : ℝ → ℂ) (fun t => (t : ℂ) ^ (-1 / 2 : ℂ)) (Ioc 0 1) := by intro t ht simp_rw [neg_div, cpow_neg, ← one_div, sqrt_eq_rpow, ofReal_cpow ht.1.le] norm_num [GOAL] s : ℂ hs : 1 / 2 < s.re ⊢ EqOn (fun t => 1 / ↑(sqrt t)) (fun t => ↑t ^ (-1 / 2)) (Ioc 0 1) [PROOFSTEP] intro t ht [GOAL] s : ℂ hs : 1 / 2 < s.re t : ℝ ht : t ∈ Ioc 0 1 ⊢ (fun t => 1 / ↑(sqrt t)) t = (fun t => ↑t ^ (-1 / 2)) t [PROOFSTEP] simp_rw [neg_div, cpow_neg, ← one_div, sqrt_eq_rpow, ofReal_cpow ht.1.le] [GOAL] s : ℂ hs : 1 / 2 < s.re t : ℝ ht : t ∈ Ioc 0 1 ⊢ 1 / ↑t ^ ↑(1 / 2) = 1 / ↑t ^ (1 / 2) [PROOFSTEP] norm_num [GOAL] s : ℂ hs : 1 / 2 < s.re h1 : EqOn (fun t => 1 / ↑(sqrt t)) (fun t => ↑t ^ (-1 / 2)) (Ioc 0 1) ⊢ HasMellin (indicator (Ioc 0 1) fun t => 1 / ↑(sqrt t)) s (1 / (s - 1 / 2)) [PROOFSTEP] simp_rw [indicator_congr h1, (by ring : s - 1 / 2 = s + -1 / 2)] [GOAL] s : ℂ hs : 1 / 2 < s.re h1 : EqOn (fun t => 1 / ↑(sqrt t)) (fun t => ↑t ^ (-1 / 2)) (Ioc 0 1) ⊢ s - 1 / 2 = s + -1 / 2 [PROOFSTEP] ring [GOAL] s : ℂ hs : 1 / 2 < s.re h1 : EqOn (fun t => 1 / ↑(sqrt t)) (fun t => ↑t ^ (-1 / 2)) (Ioc 0 1) ⊢ HasMellin (indicator (Ioc 0 1) fun t => ↑t ^ (-1 / 2)) s (1 / (s + -1 / 2)) [PROOFSTEP] convert hasMellin_cpow_Ioc (-1 / 2) _ [GOAL] case convert_2 s : ℂ hs : 1 / 2 < s.re h1 : EqOn (fun t => 1 / ↑(sqrt t)) (fun t => ↑t ^ (-1 / 2)) (Ioc 0 1) ⊢ 0 < s.re + (-1 / 2).re [PROOFSTEP] rwa [(by norm_num : (-1 / 2 : ℂ) = (-1 / 2 : ℝ)), ofReal_re, neg_div, ← sub_eq_add_neg, sub_pos] [GOAL] s : ℂ hs : 1 / 2 < s.re h1 : EqOn (fun t => 1 / ↑(sqrt t)) (fun t => ↑t ^ (-1 / 2)) (Ioc 0 1) ⊢ -1 / 2 = ↑(-1 / 2) [PROOFSTEP] norm_num [GOAL] s : ℂ hs : 1 / 2 < s.re ⊢ HasMellin (indicator (Ioc 0 1) fun t => (1 - 1 / ↑(sqrt t)) / 2) s (1 / (2 * s) - 1 / (2 * s - 1)) [PROOFSTEP] have step1 : HasMellin (indicator (Ioc 0 1) (fun t => 1 - 1 / ↑(sqrt t) : ℝ → ℂ)) s (1 / s - 1 / (s - 1 / 2)) := by have a := hasMellin_one_Ioc (one_half_pos.trans hs) have b := hasMellin_one_div_sqrt_Ioc hs simpa only [a.2, b.2, ← indicator_sub] using hasMellin_sub a.1 b.1 -- todo: implement something like "indicator.const_div" (blocked by the port for now) [GOAL] s : ℂ hs : 1 / 2 < s.re ⊢ HasMellin (indicator (Ioc 0 1) fun t => 1 - 1 / ↑(sqrt t)) s (1 / s - 1 / (s - 1 / 2)) [PROOFSTEP] have a := hasMellin_one_Ioc (one_half_pos.trans hs) [GOAL] s : ℂ hs : 1 / 2 < s.re a : HasMellin (indicator (Ioc 0 1) fun x => 1) s (1 / s) ⊢ HasMellin (indicator (Ioc 0 1) fun t => 1 - 1 / ↑(sqrt t)) s (1 / s - 1 / (s - 1 / 2)) [PROOFSTEP] have b := hasMellin_one_div_sqrt_Ioc hs [GOAL] s : ℂ hs : 1 / 2 < s.re a : HasMellin (indicator (Ioc 0 1) fun x => 1) s (1 / s) b : HasMellin (indicator (Ioc 0 1) fun t => 1 / ↑(sqrt t)) s (1 / (s - 1 / 2)) ⊢ HasMellin (indicator (Ioc 0 1) fun t => 1 - 1 / ↑(sqrt t)) s (1 / s - 1 / (s - 1 / 2)) [PROOFSTEP] simpa only [a.2, b.2, ← indicator_sub] using hasMellin_sub a.1 b.1 -- todo: implement something like "indicator.const_div" (blocked by the port for now) [GOAL] s : ℂ hs : 1 / 2 < s.re step1 : HasMellin (indicator (Ioc 0 1) fun t => 1 - 1 / ↑(sqrt t)) s (1 / s - 1 / (s - 1 / 2)) ⊢ HasMellin (indicator (Ioc 0 1) fun t => (1 - 1 / ↑(sqrt t)) / 2) s (1 / (2 * s) - 1 / (2 * s - 1)) [PROOFSTEP] rw [show ((Ioc 0 1).indicator fun t => (1 - 1 / (sqrt t : ℂ)) / 2) = fun t => (Ioc 0 1).indicator (fun t => 1 - 1 / (sqrt t : ℂ)) t / 2 by ext1 t; simp_rw [div_eq_inv_mul, indicator_mul_right]] [GOAL] s : ℂ hs : 1 / 2 < s.re step1 : HasMellin (indicator (Ioc 0 1) fun t => 1 - 1 / ↑(sqrt t)) s (1 / s - 1 / (s - 1 / 2)) ⊢ (indicator (Ioc 0 1) fun t => (1 - 1 / ↑(sqrt t)) / 2) = fun t => indicator (Ioc 0 1) (fun t => 1 - 1 / ↑(sqrt t)) t / 2 [PROOFSTEP] ext1 t [GOAL] case h s : ℂ hs : 1 / 2 < s.re step1 : HasMellin (indicator (Ioc 0 1) fun t => 1 - 1 / ↑(sqrt t)) s (1 / s - 1 / (s - 1 / 2)) t : ℝ ⊢ indicator (Ioc 0 1) (fun t => (1 - 1 / ↑(sqrt t)) / 2) t = indicator (Ioc 0 1) (fun t => 1 - 1 / ↑(sqrt t)) t / 2 [PROOFSTEP] simp_rw [div_eq_inv_mul, indicator_mul_right] [GOAL] s : ℂ hs : 1 / 2 < s.re step1 : HasMellin (indicator (Ioc 0 1) fun t => 1 - 1 / ↑(sqrt t)) s (1 / s - 1 / (s - 1 / 2)) ⊢ HasMellin (fun t => indicator (Ioc 0 1) (fun t => 1 - 1 / ↑(sqrt t)) t / 2) s (1 / (2 * s) - 1 / (2 * s - 1)) [PROOFSTEP] simp_rw [HasMellin, mellin_div_const, step1.2, sub_div, div_div] [GOAL] s : ℂ hs : 1 / 2 < s.re step1 : HasMellin (indicator (Ioc 0 1) fun t => 1 - 1 / ↑(sqrt t)) s (1 / s - 1 / (s - 1 / 2)) ⊢ MellinConvergent (fun t => indicator (Ioc 0 1) (fun t => 1 - 1 / ↑(sqrt t)) t / 2) s ∧ 1 / (s * 2) - 1 / ((s - 1 / 2) * 2) = 1 / (2 * s) - 1 / (2 * s - 1) [PROOFSTEP] refine ⟨step1.1.div_const _, ?_⟩ [GOAL] s : ℂ hs : 1 / 2 < s.re step1 : HasMellin (indicator (Ioc 0 1) fun t => 1 - 1 / ↑(sqrt t)) s (1 / s - 1 / (s - 1 / 2)) ⊢ 1 / (s * 2) - 1 / ((s - 1 / 2) * 2) = 1 / (2 * s) - 1 / (2 * s - 1) [PROOFSTEP] rw [mul_comm, sub_mul, div_mul_cancel _ (two_ne_zero' ℂ), mul_comm s 2] [GOAL] s : ℂ hs : 1 / 2 < s.re ⊢ mellin zetaKernel₂ s = mellin zetaKernel₁ s + 1 / (2 * s) - 1 / (2 * s - 1) [PROOFSTEP] have h := mellinConvergent_of_isBigO_rpow_exp pi_pos locally_integrable_zetaKernel₁ isBigO_atTop_zetaKernel₁ isBigO_zero_zetaKernel₁ hs [GOAL] s : ℂ hs : 1 / 2 < s.re h : MellinConvergent zetaKernel₁ s ⊢ mellin zetaKernel₂ s = mellin zetaKernel₁ s + 1 / (2 * s) - 1 / (2 * s - 1) [PROOFSTEP] have h' := hasMellin_one_div_sqrt_sub_one_div_two_Ioc hs [GOAL] s : ℂ hs : 1 / 2 < s.re h : MellinConvergent zetaKernel₁ s h' : HasMellin (indicator (Ioc 0 1) fun t => (1 - 1 / ↑(sqrt t)) / 2) s (1 / (2 * s) - 1 / (2 * s - 1)) ⊢ mellin zetaKernel₂ s = mellin zetaKernel₁ s + 1 / (2 * s) - 1 / (2 * s - 1) [PROOFSTEP] simp_rw [zetaKernel₂, Pi.add_def, add_sub_assoc, (hasMellin_add h h'.1).2, h'.2] [GOAL] s : ℂ hs : 1 < s.re ⊢ riemannCompletedZeta s = mellin zetaKernel₁ (s / 2) [PROOFSTEP] have : 1 / 2 < (s / 2).re := by rw [show s / 2 = ↑(2⁻¹ : ℝ) * s by push_cast ; rw [mul_comm]; rfl] rwa [ofReal_mul_re, ← div_eq_inv_mul, div_lt_div_right (zero_lt_two' ℝ)] [GOAL] s : ℂ hs : 1 < s.re ⊢ 1 / 2 < (s / 2).re [PROOFSTEP] rw [show s / 2 = ↑(2⁻¹ : ℝ) * s by push_cast ; rw [mul_comm]; rfl] [GOAL] s : ℂ hs : 1 < s.re ⊢ s / 2 = ↑2⁻¹ * s [PROOFSTEP] push_cast [GOAL] s : ℂ hs : 1 < s.re ⊢ s / 2 = 2⁻¹ * s [PROOFSTEP] rw [mul_comm] [GOAL] s : ℂ hs : 1 < s.re ⊢ s / 2 = s * 2⁻¹ [PROOFSTEP] rfl [GOAL] s : ℂ hs : 1 < s.re ⊢ 1 / 2 < (↑2⁻¹ * s).re [PROOFSTEP] rwa [ofReal_mul_re, ← div_eq_inv_mul, div_lt_div_right (zero_lt_two' ℝ)] [GOAL] s : ℂ hs : 1 < s.re this : 1 / 2 < (s / 2).re ⊢ riemannCompletedZeta s = mellin zetaKernel₁ (s / 2) [PROOFSTEP] rw [riemannCompletedZeta, riemannCompletedZeta₀, mellin_zetaKernel₂_eq_of_lt_re this, sub_add, sub_sub, ← add_sub] [GOAL] s : ℂ hs : 1 < s.re this : 1 / 2 < (s / 2).re ⊢ mellin zetaKernel₁ (s / 2) + (1 / (2 * (s / 2)) - (1 / (2 * (s / 2) - 1) + (1 / s - 1 / (s - 1)))) = mellin zetaKernel₁ (s / 2) [PROOFSTEP] conv_rhs => rw [← add_zero (mellin zetaKernel₁ <| s / 2)] [GOAL] s : ℂ hs : 1 < s.re this : 1 / 2 < (s / 2).re | mellin zetaKernel₁ (s / 2) [PROOFSTEP] rw [← add_zero (mellin zetaKernel₁ <| s / 2)] [GOAL] s : ℂ hs : 1 < s.re this : 1 / 2 < (s / 2).re | mellin zetaKernel₁ (s / 2) [PROOFSTEP] rw [← add_zero (mellin zetaKernel₁ <| s / 2)] [GOAL] s : ℂ hs : 1 < s.re this : 1 / 2 < (s / 2).re | mellin zetaKernel₁ (s / 2) [PROOFSTEP] rw [← add_zero (mellin zetaKernel₁ <| s / 2)] [GOAL] s : ℂ hs : 1 < s.re this : 1 / 2 < (s / 2).re ⊢ mellin zetaKernel₁ (s / 2) + (1 / (2 * (s / 2)) - (1 / (2 * (s / 2) - 1) + (1 / s - 1 / (s - 1)))) = mellin zetaKernel₁ (s / 2) + 0 [PROOFSTEP] congr 1 [GOAL] case e_a s : ℂ hs : 1 < s.re this : 1 / 2 < (s / 2).re ⊢ 1 / (2 * (s / 2)) - (1 / (2 * (s / 2) - 1) + (1 / s - 1 / (s - 1))) = 0 [PROOFSTEP] rw [mul_div_cancel' _ (two_ne_zero' ℂ)] [GOAL] case e_a s : ℂ hs : 1 < s.re this : 1 / 2 < (s / 2).re ⊢ 1 / s - (1 / (s - 1) + (1 / s - 1 / (s - 1))) = 0 [PROOFSTEP] abel [GOAL] case e_a s : ℂ hs : 1 < s.re this : 1 / 2 < (s / 2).re ⊢ 1 / s - (1 / (s - 1) + (1 / s - 1 / (s - 1))) = 0 [PROOFSTEP] abel [GOAL] s : ℂ hs : 0 < s.re n : ℕ ⊢ ∫ (t : ℝ) in Ioi 0, ↑t ^ (s - 1) * ↑(rexp (-π * t * (↑n + 1) ^ 2)) = ↑π ^ (-s) * Complex.Gamma s * (1 / (↑n + 1) ^ (2 * s)) [PROOFSTEP] rw [Complex.Gamma_eq_integral hs, GammaIntegral_eq_mellin] [GOAL] s : ℂ hs : 0 < s.re n : ℕ ⊢ ∫ (t : ℝ) in Ioi 0, ↑t ^ (s - 1) * ↑(rexp (-π * t * (↑n + 1) ^ 2)) = ↑π ^ (-s) * mellin (fun x => ↑(rexp (-x))) s * (1 / (↑n + 1) ^ (2 * s)) [PROOFSTEP] conv_rhs => congr rw [← smul_eq_mul, ← mellin_comp_mul_left _ _ pi_pos] [GOAL] s : ℂ hs : 0 < s.re n : ℕ | ↑π ^ (-s) * mellin (fun x => ↑(rexp (-x))) s * (1 / (↑n + 1) ^ (2 * s)) [PROOFSTEP] congr rw [← smul_eq_mul, ← mellin_comp_mul_left _ _ pi_pos] [GOAL] s : ℂ hs : 0 < s.re n : ℕ | ↑π ^ (-s) * mellin (fun x => ↑(rexp (-x))) s * (1 / (↑n + 1) ^ (2 * s)) [PROOFSTEP] congr rw [← smul_eq_mul, ← mellin_comp_mul_left _ _ pi_pos] [GOAL] s : ℂ hs : 0 < s.re n : ℕ | ↑π ^ (-s) * mellin (fun x => ↑(rexp (-x))) s * (1 / (↑n + 1) ^ (2 * s)) [PROOFSTEP] congr [GOAL] case a s : ℂ hs : 0 < s.re n : ℕ | ↑π ^ (-s) * mellin (fun x => ↑(rexp (-x))) s case a s : ℂ hs : 0 < s.re n : ℕ | 1 / (↑n + 1) ^ (2 * s) [PROOFSTEP] rw [← smul_eq_mul, ← mellin_comp_mul_left _ _ pi_pos] [GOAL] s : ℂ hs : 0 < s.re n : ℕ ⊢ ∫ (t : ℝ) in Ioi 0, ↑t ^ (s - 1) * ↑(rexp (-π * t * (↑n + 1) ^ 2)) = mellin (fun t => ↑(rexp (-(π * t)))) s * (1 / (↑n + 1) ^ (2 * s)) [PROOFSTEP] have : 1 / ((n : ℂ) + 1) ^ (2 * s) = (((n : ℝ) + 1) ^ (2 : ℝ) : ℂ) ^ (-s) := by rw [(by norm_num : (n : ℂ) + 1 = ↑((n : ℝ) + 1)), (by norm_num : 2 * s = ↑(2 : ℝ) * s), cpow_mul_ofReal_nonneg, one_div, cpow_neg] rw [← Nat.cast_succ] exact Nat.cast_nonneg _ [GOAL] s : ℂ hs : 0 < s.re n : ℕ ⊢ 1 / (↑n + 1) ^ (2 * s) = ↑((↑n + 1) ^ 2) ^ (-s) [PROOFSTEP] rw [(by norm_num : (n : ℂ) + 1 = ↑((n : ℝ) + 1)), (by norm_num : 2 * s = ↑(2 : ℝ) * s), cpow_mul_ofReal_nonneg, one_div, cpow_neg] [GOAL] s : ℂ hs : 0 < s.re n : ℕ ⊢ ↑n + 1 = ↑(↑n + 1) [PROOFSTEP] norm_num [GOAL] s : ℂ hs : 0 < s.re n : ℕ ⊢ 2 * s = ↑2 * s [PROOFSTEP] norm_num [GOAL] case hx s : ℂ hs : 0 < s.re n : ℕ ⊢ 0 ≤ ↑n + 1 [PROOFSTEP] rw [← Nat.cast_succ] [GOAL] case hx s : ℂ hs : 0 < s.re n : ℕ ⊢ 0 ≤ ↑(Nat.succ n) [PROOFSTEP] exact Nat.cast_nonneg _ [GOAL] s : ℂ hs : 0 < s.re n : ℕ this : 1 / (↑n + 1) ^ (2 * s) = ↑((↑n + 1) ^ 2) ^ (-s) ⊢ ∫ (t : ℝ) in Ioi 0, ↑t ^ (s - 1) * ↑(rexp (-π * t * (↑n + 1) ^ 2)) = mellin (fun t => ↑(rexp (-(π * t)))) s * (1 / (↑n + 1) ^ (2 * s)) [PROOFSTEP] conv_rhs => rw [this, mul_comm, ← smul_eq_mul] [GOAL] s : ℂ hs : 0 < s.re n : ℕ this : 1 / (↑n + 1) ^ (2 * s) = ↑((↑n + 1) ^ 2) ^ (-s) | mellin (fun t => ↑(rexp (-(π * t)))) s * (1 / (↑n + 1) ^ (2 * s)) [PROOFSTEP] rw [this, mul_comm, ← smul_eq_mul] [GOAL] s : ℂ hs : 0 < s.re n : ℕ this : 1 / (↑n + 1) ^ (2 * s) = ↑((↑n + 1) ^ 2) ^ (-s) | mellin (fun t => ↑(rexp (-(π * t)))) s * (1 / (↑n + 1) ^ (2 * s)) [PROOFSTEP] rw [this, mul_comm, ← smul_eq_mul] [GOAL] s : ℂ hs : 0 < s.re n : ℕ this : 1 / (↑n + 1) ^ (2 * s) = ↑((↑n + 1) ^ 2) ^ (-s) | mellin (fun t => ↑(rexp (-(π * t)))) s * (1 / (↑n + 1) ^ (2 * s)) [PROOFSTEP] rw [this, mul_comm, ← smul_eq_mul] [GOAL] s : ℂ hs : 0 < s.re n : ℕ this : 1 / (↑n + 1) ^ (2 * s) = ↑((↑n + 1) ^ 2) ^ (-s) ⊢ ∫ (t : ℝ) in Ioi 0, ↑t ^ (s - 1) * ↑(rexp (-π * t * (↑n + 1) ^ 2)) = ↑((↑n + 1) ^ 2) ^ (-s) • mellin (fun t => ↑(rexp (-(π * t)))) s [PROOFSTEP] rw [← mellin_comp_mul_right _ _ (show 0 < ((n : ℝ) + 1) ^ (2 : ℝ) by positivity)] [GOAL] s : ℂ hs : 0 < s.re n : ℕ this : 1 / (↑n + 1) ^ (2 * s) = ↑((↑n + 1) ^ 2) ^ (-s) ⊢ 0 < (↑n + 1) ^ 2 [PROOFSTEP] positivity [GOAL] s : ℂ hs : 0 < s.re n : ℕ this : 1 / (↑n + 1) ^ (2 * s) = ↑((↑n + 1) ^ 2) ^ (-s) ⊢ ∫ (t : ℝ) in Ioi 0, ↑t ^ (s - 1) * ↑(rexp (-π * t * (↑n + 1) ^ 2)) = mellin (fun t => ↑(rexp (-(π * (t * (↑n + 1) ^ 2))))) s [PROOFSTEP] refine set_integral_congr measurableSet_Ioi fun t _ => ?_ [GOAL] s : ℂ hs : 0 < s.re n : ℕ this : 1 / (↑n + 1) ^ (2 * s) = ↑((↑n + 1) ^ 2) ^ (-s) t : ℝ x✝ : t ∈ Ioi 0 ⊢ ↑t ^ (s - 1) * ↑(rexp (-π * t * (↑n + 1) ^ 2)) = ↑t ^ (s - 1) • (fun t => ↑(rexp (-(π * (t * (↑n + 1) ^ 2))))) t [PROOFSTEP] simp_rw [smul_eq_mul] [GOAL] s : ℂ hs : 0 < s.re n : ℕ this : 1 / (↑n + 1) ^ (2 * s) = ↑((↑n + 1) ^ 2) ^ (-s) t : ℝ x✝ : t ∈ Ioi 0 ⊢ ↑t ^ (s - 1) * ↑(rexp (-π * t * (↑n + 1) ^ 2)) = ↑t ^ (s - 1) * ↑(rexp (-(π * (t * (↑n + 1) ^ 2)))) [PROOFSTEP] congr 3 [GOAL] case e_a.e_r.e_x s : ℂ hs : 0 < s.re n : ℕ this : 1 / (↑n + 1) ^ (2 * s) = ↑((↑n + 1) ^ 2) ^ (-s) t : ℝ x✝ : t ∈ Ioi 0 ⊢ -π * t * (↑n + 1) ^ 2 = -(π * (t * (↑n + 1) ^ 2)) [PROOFSTEP] conv_rhs => rw [← Nat.cast_two, rpow_nat_cast] [GOAL] s : ℂ hs : 0 < s.re n : ℕ this : 1 / (↑n + 1) ^ (2 * s) = ↑((↑n + 1) ^ 2) ^ (-s) t : ℝ x✝ : t ∈ Ioi 0 | -(π * (t * (↑n + 1) ^ 2)) [PROOFSTEP] rw [← Nat.cast_two, rpow_nat_cast] [GOAL] s : ℂ hs : 0 < s.re n : ℕ this : 1 / (↑n + 1) ^ (2 * s) = ↑((↑n + 1) ^ 2) ^ (-s) t : ℝ x✝ : t ∈ Ioi 0 | -(π * (t * (↑n + 1) ^ 2)) [PROOFSTEP] rw [← Nat.cast_two, rpow_nat_cast] [GOAL] s : ℂ hs : 0 < s.re n : ℕ this : 1 / (↑n + 1) ^ (2 * s) = ↑((↑n + 1) ^ 2) ^ (-s) t : ℝ x✝ : t ∈ Ioi 0 | -(π * (t * (↑n + 1) ^ 2)) [PROOFSTEP] rw [← Nat.cast_two, rpow_nat_cast] [GOAL] case e_a.e_r.e_x s : ℂ hs : 0 < s.re n : ℕ this : 1 / (↑n + 1) ^ (2 * s) = ↑((↑n + 1) ^ 2) ^ (-s) t : ℝ x✝ : t ∈ Ioi 0 ⊢ -π * t * (↑n + 1) ^ 2 = -(π * (t * (↑n + 1) ^ 2)) [PROOFSTEP] ring [GOAL] s : ℂ hs : 1 / 2 < s.re ⊢ mellin zetaKernel₁ s = ↑π ^ (-s) * Complex.Gamma s * ∑' (n : ℕ), 1 / (↑n + 1) ^ (2 * s) [PROOFSTEP] let bd : ℕ → ℝ → ℝ := fun n t => t ^ (s.re - 1) * exp (-π * t * ((n : ℝ) + 1) ^ 2) [GOAL] s : ℂ hs : 1 / 2 < s.re bd : ℕ → ℝ → ℝ := fun n t => t ^ (s.re - 1) * rexp (-π * t * (↑n + 1) ^ 2) ⊢ mellin zetaKernel₁ s = ↑π ^ (-s) * Complex.Gamma s * ∑' (n : ℕ), 1 / (↑n + 1) ^ (2 * s) [PROOFSTEP] let f : ℕ → ℝ → ℂ := fun n t => (t : ℂ) ^ (s - 1) * exp (-π * t * ((n : ℝ) + 1) ^ 2) [GOAL] s : ℂ hs : 1 / 2 < s.re bd : ℕ → ℝ → ℝ := fun n t => t ^ (s.re - 1) * rexp (-π * t * (↑n + 1) ^ 2) f : ℕ → ℝ → ℂ := fun n t => ↑t ^ (s - 1) * ↑(rexp (-π * t * (↑n + 1) ^ 2)) ⊢ mellin zetaKernel₁ s = ↑π ^ (-s) * Complex.Gamma s * ∑' (n : ℕ), 1 / (↑n + 1) ^ (2 * s) [PROOFSTEP] have hm : MeasurableSet (Ioi (0 : ℝ)) := measurableSet_Ioi [GOAL] s : ℂ hs : 1 / 2 < s.re bd : ℕ → ℝ → ℝ := fun n t => t ^ (s.re - 1) * rexp (-π * t * (↑n + 1) ^ 2) f : ℕ → ℝ → ℂ := fun n t => ↑t ^ (s - 1) * ↑(rexp (-π * t * (↑n + 1) ^ 2)) hm : MeasurableSet (Ioi 0) ⊢ mellin zetaKernel₁ s = ↑π ^ (-s) * Complex.Gamma s * ∑' (n : ℕ), 1 / (↑n + 1) ^ (2 * s) [PROOFSTEP] have h_norm : ∀ (n : ℕ) {t : ℝ} (_ : 0 < t), ‖f n t‖ = bd n t := by intro n t ht rw [norm_mul, Complex.norm_eq_abs, Complex.norm_eq_abs, Complex.abs_of_nonneg (exp_pos _).le, abs_cpow_eq_rpow_re_of_pos ht, sub_re, one_re] [GOAL] s : ℂ hs : 1 / 2 < s.re bd : ℕ → ℝ → ℝ := fun n t => t ^ (s.re - 1) * rexp (-π * t * (↑n + 1) ^ 2) f : ℕ → ℝ → ℂ := fun n t => ↑t ^ (s - 1) * ↑(rexp (-π * t * (↑n + 1) ^ 2)) hm : MeasurableSet (Ioi 0) ⊢ ∀ (n : ℕ) {t : ℝ}, 0 < t → ‖f n t‖ = bd n t [PROOFSTEP] intro n t ht [GOAL] s : ℂ hs : 1 / 2 < s.re bd : ℕ → ℝ → ℝ := fun n t => t ^ (s.re - 1) * rexp (-π * t * (↑n + 1) ^ 2) f : ℕ → ℝ → ℂ := fun n t => ↑t ^ (s - 1) * ↑(rexp (-π * t * (↑n + 1) ^ 2)) hm : MeasurableSet (Ioi 0) n : ℕ t : ℝ ht : 0 < t ⊢ ‖f n t‖ = bd n t [PROOFSTEP] rw [norm_mul, Complex.norm_eq_abs, Complex.norm_eq_abs, Complex.abs_of_nonneg (exp_pos _).le, abs_cpow_eq_rpow_re_of_pos ht, sub_re, one_re] [GOAL] s : ℂ hs : 1 / 2 < s.re bd : ℕ → ℝ → ℝ := fun n t => t ^ (s.re - 1) * rexp (-π * t * (↑n + 1) ^ 2) f : ℕ → ℝ → ℂ := fun n t => ↑t ^ (s - 1) * ↑(rexp (-π * t * (↑n + 1) ^ 2)) hm : MeasurableSet (Ioi 0) h_norm : ∀ (n : ℕ) {t : ℝ}, 0 < t → ‖f n t‖ = bd n t ⊢ mellin zetaKernel₁ s = ↑π ^ (-s) * Complex.Gamma s * ∑' (n : ℕ), 1 / (↑n + 1) ^ (2 * s) [PROOFSTEP] have hf_meas : ∀ n : ℕ, AEStronglyMeasurable (f n) (volume.restrict <| Ioi 0) := by intro n refine (ContinuousOn.mul ?_ ?_).aestronglyMeasurable hm · exact ContinuousAt.continuousOn fun x hx => continuousAt_ofReal_cpow_const _ _ <| Or.inr <| ne_of_gt hx · apply Continuous.continuousOn exact continuous_ofReal.comp (continuous_exp.comp ((continuous_const.mul continuous_id').mul continuous_const)) [GOAL] s : ℂ hs : 1 / 2 < s.re bd : ℕ → ℝ → ℝ := fun n t => t ^ (s.re - 1) * rexp (-π * t * (↑n + 1) ^ 2) f : ℕ → ℝ → ℂ := fun n t => ↑t ^ (s - 1) * ↑(rexp (-π * t * (↑n + 1) ^ 2)) hm : MeasurableSet (Ioi 0) h_norm : ∀ (n : ℕ) {t : ℝ}, 0 < t → ‖f n t‖ = bd n t ⊢ ∀ (n : ℕ), AEStronglyMeasurable (f n) (Measure.restrict volume (Ioi 0)) [PROOFSTEP] intro n [GOAL] s : ℂ hs : 1 / 2 < s.re bd : ℕ → ℝ → ℝ := fun n t => t ^ (s.re - 1) * rexp (-π * t * (↑n + 1) ^ 2) f : ℕ → ℝ → ℂ := fun n t => ↑t ^ (s - 1) * ↑(rexp (-π * t * (↑n + 1) ^ 2)) hm : MeasurableSet (Ioi 0) h_norm : ∀ (n : ℕ) {t : ℝ}, 0 < t → ‖f n t‖ = bd n t n : ℕ ⊢ AEStronglyMeasurable (f n) (Measure.restrict volume (Ioi 0)) [PROOFSTEP] refine (ContinuousOn.mul ?_ ?_).aestronglyMeasurable hm [GOAL] case refine_1 s : ℂ hs : 1 / 2 < s.re bd : ℕ → ℝ → ℝ := fun n t => t ^ (s.re - 1) * rexp (-π * t * (↑n + 1) ^ 2) f : ℕ → ℝ → ℂ := fun n t => ↑t ^ (s - 1) * ↑(rexp (-π * t * (↑n + 1) ^ 2)) hm : MeasurableSet (Ioi 0) h_norm : ∀ (n : ℕ) {t : ℝ}, 0 < t → ‖f n t‖ = bd n t n : ℕ ⊢ ContinuousOn (fun t => ↑t ^ (s - 1)) (Ioi 0) [PROOFSTEP] exact ContinuousAt.continuousOn fun x hx => continuousAt_ofReal_cpow_const _ _ <| Or.inr <| ne_of_gt hx [GOAL] case refine_2 s : ℂ hs : 1 / 2 < s.re bd : ℕ → ℝ → ℝ := fun n t => t ^ (s.re - 1) * rexp (-π * t * (↑n + 1) ^ 2) f : ℕ → ℝ → ℂ := fun n t => ↑t ^ (s - 1) * ↑(rexp (-π * t * (↑n + 1) ^ 2)) hm : MeasurableSet (Ioi 0) h_norm : ∀ (n : ℕ) {t : ℝ}, 0 < t → ‖f n t‖ = bd n t n : ℕ ⊢ ContinuousOn (fun t => ↑(rexp (-π * t * (↑n + 1) ^ 2))) (Ioi 0) [PROOFSTEP] apply Continuous.continuousOn [GOAL] case refine_2.h s : ℂ hs : 1 / 2 < s.re bd : ℕ → ℝ → ℝ := fun n t => t ^ (s.re - 1) * rexp (-π * t * (↑n + 1) ^ 2) f : ℕ → ℝ → ℂ := fun n t => ↑t ^ (s - 1) * ↑(rexp (-π * t * (↑n + 1) ^ 2)) hm : MeasurableSet (Ioi 0) h_norm : ∀ (n : ℕ) {t : ℝ}, 0 < t → ‖f n t‖ = bd n t n : ℕ ⊢ Continuous fun t => ↑(rexp (-π * t * (↑n + 1) ^ 2)) [PROOFSTEP] exact continuous_ofReal.comp (continuous_exp.comp ((continuous_const.mul continuous_id').mul continuous_const)) [GOAL] s : ℂ hs : 1 / 2 < s.re bd : ℕ → ℝ → ℝ := fun n t => t ^ (s.re - 1) * rexp (-π * t * (↑n + 1) ^ 2) f : ℕ → ℝ → ℂ := fun n t => ↑t ^ (s - 1) * ↑(rexp (-π * t * (↑n + 1) ^ 2)) hm : MeasurableSet (Ioi 0) h_norm : ∀ (n : ℕ) {t : ℝ}, 0 < t → ‖f n t‖ = bd n t hf_meas : ∀ (n : ℕ), AEStronglyMeasurable (f n) (Measure.restrict volume (Ioi 0)) ⊢ mellin zetaKernel₁ s = ↑π ^ (-s) * Complex.Gamma s * ∑' (n : ℕ), 1 / (↑n + 1) ^ (2 * s) [PROOFSTEP] have h_le : ∀ n : ℕ, ∀ᵐ t : ℝ ∂volume.restrict (Ioi 0), ‖f n t‖ ≤ bd n t := fun n => (ae_restrict_iff' hm).mpr (ae_of_all _ fun t ht => le_of_eq (h_norm n ht)) [GOAL] s : ℂ hs : 1 / 2 < s.re bd : ℕ → ℝ → ℝ := fun n t => t ^ (s.re - 1) * rexp (-π * t * (↑n + 1) ^ 2) f : ℕ → ℝ → ℂ := fun n t => ↑t ^ (s - 1) * ↑(rexp (-π * t * (↑n + 1) ^ 2)) hm : MeasurableSet (Ioi 0) h_norm : ∀ (n : ℕ) {t : ℝ}, 0 < t → ‖f n t‖ = bd n t hf_meas : ∀ (n : ℕ), AEStronglyMeasurable (f n) (Measure.restrict volume (Ioi 0)) h_le : ∀ (n : ℕ), ∀ᵐ (t : ℝ) ∂Measure.restrict volume (Ioi 0), ‖f n t‖ ≤ bd n t ⊢ mellin zetaKernel₁ s = ↑π ^ (-s) * Complex.Gamma s * ∑' (n : ℕ), 1 / (↑n + 1) ^ (2 * s) [PROOFSTEP] have h_sum0 : ∀ {t : ℝ} (_ : 0 < t), HasSum (fun n => f n t) ((t : ℂ) ^ (s - 1) * zetaKernel₁ t) := by intro t ht rw [zetaKernel₁] convert (hasSum_ofReal.mpr (summable_exp_neg_pi_mul_nat_sq ht).hasSum).mul_left ((t : ℂ) ^ (s - 1)) simp only [neg_mul, ofReal_exp, ofReal_neg, ofReal_mul, ofReal_pow, ofReal_add, ofReal_nat_cast, ofReal_one, ofReal_tsum] [GOAL] s : ℂ hs : 1 / 2 < s.re bd : ℕ → ℝ → ℝ := fun n t => t ^ (s.re - 1) * rexp (-π * t * (↑n + 1) ^ 2) f : ℕ → ℝ → ℂ := fun n t => ↑t ^ (s - 1) * ↑(rexp (-π * t * (↑n + 1) ^ 2)) hm : MeasurableSet (Ioi 0) h_norm : ∀ (n : ℕ) {t : ℝ}, 0 < t → ‖f n t‖ = bd n t hf_meas : ∀ (n : ℕ), AEStronglyMeasurable (f n) (Measure.restrict volume (Ioi 0)) h_le : ∀ (n : ℕ), ∀ᵐ (t : ℝ) ∂Measure.restrict volume (Ioi 0), ‖f n t‖ ≤ bd n t ⊢ ∀ {t : ℝ}, 0 < t → HasSum (fun n => f n t) (↑t ^ (s - 1) * zetaKernel₁ t) [PROOFSTEP] intro t ht [GOAL] s : ℂ hs : 1 / 2 < s.re bd : ℕ → ℝ → ℝ := fun n t => t ^ (s.re - 1) * rexp (-π * t * (↑n + 1) ^ 2) f : ℕ → ℝ → ℂ := fun n t => ↑t ^ (s - 1) * ↑(rexp (-π * t * (↑n + 1) ^ 2)) hm : MeasurableSet (Ioi 0) h_norm : ∀ (n : ℕ) {t : ℝ}, 0 < t → ‖f n t‖ = bd n t hf_meas : ∀ (n : ℕ), AEStronglyMeasurable (f n) (Measure.restrict volume (Ioi 0)) h_le : ∀ (n : ℕ), ∀ᵐ (t : ℝ) ∂Measure.restrict volume (Ioi 0), ‖f n t‖ ≤ bd n t t : ℝ ht : 0 < t ⊢ HasSum (fun n => f n t) (↑t ^ (s - 1) * zetaKernel₁ t) [PROOFSTEP] rw [zetaKernel₁] [GOAL] s : ℂ hs : 1 / 2 < s.re bd : ℕ → ℝ → ℝ := fun n t => t ^ (s.re - 1) * rexp (-π * t * (↑n + 1) ^ 2) f : ℕ → ℝ → ℂ := fun n t => ↑t ^ (s - 1) * ↑(rexp (-π * t * (↑n + 1) ^ 2)) hm : MeasurableSet (Ioi 0) h_norm : ∀ (n : ℕ) {t : ℝ}, 0 < t → ‖f n t‖ = bd n t hf_meas : ∀ (n : ℕ), AEStronglyMeasurable (f n) (Measure.restrict volume (Ioi 0)) h_le : ∀ (n : ℕ), ∀ᵐ (t : ℝ) ∂Measure.restrict volume (Ioi 0), ‖f n t‖ ≤ bd n t t : ℝ ht : 0 < t ⊢ HasSum (fun n => f n t) (↑t ^ (s - 1) * ∑' (n : ℕ), ↑(rexp (-π * t * (↑n + 1) ^ 2))) [PROOFSTEP] convert (hasSum_ofReal.mpr (summable_exp_neg_pi_mul_nat_sq ht).hasSum).mul_left ((t : ℂ) ^ (s - 1)) [GOAL] case h.e'_6.h.e'_6 s : ℂ hs : 1 / 2 < s.re bd : ℕ → ℝ → ℝ := fun n t => t ^ (s.re - 1) * rexp (-π * t * (↑n + 1) ^ 2) f : ℕ → ℝ → ℂ := fun n t => ↑t ^ (s - 1) * ↑(rexp (-π * t * (↑n + 1) ^ 2)) hm : MeasurableSet (Ioi 0) h_norm : ∀ (n : ℕ) {t : ℝ}, 0 < t → ‖f n t‖ = bd n t hf_meas : ∀ (n : ℕ), AEStronglyMeasurable (f n) (Measure.restrict volume (Ioi 0)) h_le : ∀ (n : ℕ), ∀ᵐ (t : ℝ) ∂Measure.restrict volume (Ioi 0), ‖f n t‖ ≤ bd n t t : ℝ ht : 0 < t ⊢ ∑' (n : ℕ), ↑(rexp (-π * t * (↑n + 1) ^ 2)) = ↑(∑' (b : ℕ), rexp (-π * t * (↑b + 1) ^ 2)) [PROOFSTEP] simp only [neg_mul, ofReal_exp, ofReal_neg, ofReal_mul, ofReal_pow, ofReal_add, ofReal_nat_cast, ofReal_one, ofReal_tsum] [GOAL] s : ℂ hs : 1 / 2 < s.re bd : ℕ → ℝ → ℝ := fun n t => t ^ (s.re - 1) * rexp (-π * t * (↑n + 1) ^ 2) f : ℕ → ℝ → ℂ := fun n t => ↑t ^ (s - 1) * ↑(rexp (-π * t * (↑n + 1) ^ 2)) hm : MeasurableSet (Ioi 0) h_norm : ∀ (n : ℕ) {t : ℝ}, 0 < t → ‖f n t‖ = bd n t hf_meas : ∀ (n : ℕ), AEStronglyMeasurable (f n) (Measure.restrict volume (Ioi 0)) h_le : ∀ (n : ℕ), ∀ᵐ (t : ℝ) ∂Measure.restrict volume (Ioi 0), ‖f n t‖ ≤ bd n t h_sum0 : ∀ {t : ℝ}, 0 < t → HasSum (fun n => f n t) (↑t ^ (s - 1) * zetaKernel₁ t) ⊢ mellin zetaKernel₁ s = ↑π ^ (-s) * Complex.Gamma s * ∑' (n : ℕ), 1 / (↑n + 1) ^ (2 * s) [PROOFSTEP] have h_sum' : ∀ᵐ t : ℝ ∂volume.restrict (Ioi 0), HasSum (fun n : ℕ => f n t) ((t : ℂ) ^ (s - 1) * zetaKernel₁ t) := (ae_restrict_iff' hm).mpr (ae_of_all _ fun t ht => h_sum0 ht) [GOAL] s : ℂ hs : 1 / 2 < s.re bd : ℕ → ℝ → ℝ := fun n t => t ^ (s.re - 1) * rexp (-π * t * (↑n + 1) ^ 2) f : ℕ → ℝ → ℂ := fun n t => ↑t ^ (s - 1) * ↑(rexp (-π * t * (↑n + 1) ^ 2)) hm : MeasurableSet (Ioi 0) h_norm : ∀ (n : ℕ) {t : ℝ}, 0 < t → ‖f n t‖ = bd n t hf_meas : ∀ (n : ℕ), AEStronglyMeasurable (f n) (Measure.restrict volume (Ioi 0)) h_le : ∀ (n : ℕ), ∀ᵐ (t : ℝ) ∂Measure.restrict volume (Ioi 0), ‖f n t‖ ≤ bd n t h_sum0 : ∀ {t : ℝ}, 0 < t → HasSum (fun n => f n t) (↑t ^ (s - 1) * zetaKernel₁ t) h_sum' : ∀ᵐ (t : ℝ) ∂Measure.restrict volume (Ioi 0), HasSum (fun n => f n t) (↑t ^ (s - 1) * zetaKernel₁ t) ⊢ mellin zetaKernel₁ s = ↑π ^ (-s) * Complex.Gamma s * ∑' (n : ℕ), 1 / (↑n + 1) ^ (2 * s) [PROOFSTEP] have h_sum : ∀ᵐ t : ℝ ∂volume.restrict (Ioi 0), Summable fun n : ℕ => bd n t := by refine (ae_restrict_iff' hm).mpr (ae_of_all _ fun t ht => ?_) simpa only [fun n => h_norm n ht] using summable_norm_iff.mpr (h_sum0 ht).summable [GOAL] s : ℂ hs : 1 / 2 < s.re bd : ℕ → ℝ → ℝ := fun n t => t ^ (s.re - 1) * rexp (-π * t * (↑n + 1) ^ 2) f : ℕ → ℝ → ℂ := fun n t => ↑t ^ (s - 1) * ↑(rexp (-π * t * (↑n + 1) ^ 2)) hm : MeasurableSet (Ioi 0) h_norm : ∀ (n : ℕ) {t : ℝ}, 0 < t → ‖f n t‖ = bd n t hf_meas : ∀ (n : ℕ), AEStronglyMeasurable (f n) (Measure.restrict volume (Ioi 0)) h_le : ∀ (n : ℕ), ∀ᵐ (t : ℝ) ∂Measure.restrict volume (Ioi 0), ‖f n t‖ ≤ bd n t h_sum0 : ∀ {t : ℝ}, 0 < t → HasSum (fun n => f n t) (↑t ^ (s - 1) * zetaKernel₁ t) h_sum' : ∀ᵐ (t : ℝ) ∂Measure.restrict volume (Ioi 0), HasSum (fun n => f n t) (↑t ^ (s - 1) * zetaKernel₁ t) ⊢ ∀ᵐ (t : ℝ) ∂Measure.restrict volume (Ioi 0), Summable fun n => bd n t [PROOFSTEP] refine (ae_restrict_iff' hm).mpr (ae_of_all _ fun t ht => ?_) [GOAL] s : ℂ hs : 1 / 2 < s.re bd : ℕ → ℝ → ℝ := fun n t => t ^ (s.re - 1) * rexp (-π * t * (↑n + 1) ^ 2) f : ℕ → ℝ → ℂ := fun n t => ↑t ^ (s - 1) * ↑(rexp (-π * t * (↑n + 1) ^ 2)) hm : MeasurableSet (Ioi 0) h_norm : ∀ (n : ℕ) {t : ℝ}, 0 < t → ‖f n t‖ = bd n t hf_meas : ∀ (n : ℕ), AEStronglyMeasurable (f n) (Measure.restrict volume (Ioi 0)) h_le : ∀ (n : ℕ), ∀ᵐ (t : ℝ) ∂Measure.restrict volume (Ioi 0), ‖f n t‖ ≤ bd n t h_sum0 : ∀ {t : ℝ}, 0 < t → HasSum (fun n => f n t) (↑t ^ (s - 1) * zetaKernel₁ t) h_sum' : ∀ᵐ (t : ℝ) ∂Measure.restrict volume (Ioi 0), HasSum (fun n => f n t) (↑t ^ (s - 1) * zetaKernel₁ t) t : ℝ ht : t ∈ Ioi 0 ⊢ Summable fun n => bd n t [PROOFSTEP] simpa only [fun n => h_norm n ht] using summable_norm_iff.mpr (h_sum0 ht).summable [GOAL] s : ℂ hs : 1 / 2 < s.re bd : ℕ → ℝ → ℝ := fun n t => t ^ (s.re - 1) * rexp (-π * t * (↑n + 1) ^ 2) f : ℕ → ℝ → ℂ := fun n t => ↑t ^ (s - 1) * ↑(rexp (-π * t * (↑n + 1) ^ 2)) hm : MeasurableSet (Ioi 0) h_norm : ∀ (n : ℕ) {t : ℝ}, 0 < t → ‖f n t‖ = bd n t hf_meas : ∀ (n : ℕ), AEStronglyMeasurable (f n) (Measure.restrict volume (Ioi 0)) h_le : ∀ (n : ℕ), ∀ᵐ (t : ℝ) ∂Measure.restrict volume (Ioi 0), ‖f n t‖ ≤ bd n t h_sum0 : ∀ {t : ℝ}, 0 < t → HasSum (fun n => f n t) (↑t ^ (s - 1) * zetaKernel₁ t) h_sum' : ∀ᵐ (t : ℝ) ∂Measure.restrict volume (Ioi 0), HasSum (fun n => f n t) (↑t ^ (s - 1) * zetaKernel₁ t) h_sum : ∀ᵐ (t : ℝ) ∂Measure.restrict volume (Ioi 0), Summable fun n => bd n t ⊢ mellin zetaKernel₁ s = ↑π ^ (-s) * Complex.Gamma s * ∑' (n : ℕ), 1 / (↑n + 1) ^ (2 * s) [PROOFSTEP] have h_int : Integrable (fun t : ℝ => ∑' n : ℕ, bd n t) (volume.restrict (Ioi 0)) := by refine IntegrableOn.congr_fun (mellinConvergent_of_isBigO_rpow_exp pi_pos locally_integrable_zetaKernel₁ isBigO_atTop_zetaKernel₁ isBigO_zero_zetaKernel₁ hs).norm (fun t ht => ?_) hm rw [tsum_mul_left, norm_smul, Complex.norm_eq_abs, abs_cpow_eq_rpow_re_of_pos ht, sub_re, one_re, zetaKernel₁, ← ofReal_tsum, Complex.norm_eq_abs, Complex.abs_of_nonneg] exact tsum_nonneg fun n => (exp_pos _).le [GOAL] s : ℂ hs : 1 / 2 < s.re bd : ℕ → ℝ → ℝ := fun n t => t ^ (s.re - 1) * rexp (-π * t * (↑n + 1) ^ 2) f : ℕ → ℝ → ℂ := fun n t => ↑t ^ (s - 1) * ↑(rexp (-π * t * (↑n + 1) ^ 2)) hm : MeasurableSet (Ioi 0) h_norm : ∀ (n : ℕ) {t : ℝ}, 0 < t → ‖f n t‖ = bd n t hf_meas : ∀ (n : ℕ), AEStronglyMeasurable (f n) (Measure.restrict volume (Ioi 0)) h_le : ∀ (n : ℕ), ∀ᵐ (t : ℝ) ∂Measure.restrict volume (Ioi 0), ‖f n t‖ ≤ bd n t h_sum0 : ∀ {t : ℝ}, 0 < t → HasSum (fun n => f n t) (↑t ^ (s - 1) * zetaKernel₁ t) h_sum' : ∀ᵐ (t : ℝ) ∂Measure.restrict volume (Ioi 0), HasSum (fun n => f n t) (↑t ^ (s - 1) * zetaKernel₁ t) h_sum : ∀ᵐ (t : ℝ) ∂Measure.restrict volume (Ioi 0), Summable fun n => bd n t ⊢ Integrable fun t => ∑' (n : ℕ), bd n t [PROOFSTEP] refine IntegrableOn.congr_fun (mellinConvergent_of_isBigO_rpow_exp pi_pos locally_integrable_zetaKernel₁ isBigO_atTop_zetaKernel₁ isBigO_zero_zetaKernel₁ hs).norm (fun t ht => ?_) hm [GOAL] s : ℂ hs : 1 / 2 < s.re bd : ℕ → ℝ → ℝ := fun n t => t ^ (s.re - 1) * rexp (-π * t * (↑n + 1) ^ 2) f : ℕ → ℝ → ℂ := fun n t => ↑t ^ (s - 1) * ↑(rexp (-π * t * (↑n + 1) ^ 2)) hm : MeasurableSet (Ioi 0) h_norm : ∀ (n : ℕ) {t : ℝ}, 0 < t → ‖f n t‖ = bd n t hf_meas : ∀ (n : ℕ), AEStronglyMeasurable (f n) (Measure.restrict volume (Ioi 0)) h_le : ∀ (n : ℕ), ∀ᵐ (t : ℝ) ∂Measure.restrict volume (Ioi 0), ‖f n t‖ ≤ bd n t h_sum0 : ∀ {t : ℝ}, 0 < t → HasSum (fun n => f n t) (↑t ^ (s - 1) * zetaKernel₁ t) h_sum' : ∀ᵐ (t : ℝ) ∂Measure.restrict volume (Ioi 0), HasSum (fun n => f n t) (↑t ^ (s - 1) * zetaKernel₁ t) h_sum : ∀ᵐ (t : ℝ) ∂Measure.restrict volume (Ioi 0), Summable fun n => bd n t t : ℝ ht : t ∈ Ioi 0 ⊢ ‖↑t ^ (s - 1) • zetaKernel₁ t‖ = ∑' (n : ℕ), bd n t [PROOFSTEP] rw [tsum_mul_left, norm_smul, Complex.norm_eq_abs, abs_cpow_eq_rpow_re_of_pos ht, sub_re, one_re, zetaKernel₁, ← ofReal_tsum, Complex.norm_eq_abs, Complex.abs_of_nonneg] [GOAL] s : ℂ hs : 1 / 2 < s.re bd : ℕ → ℝ → ℝ := fun n t => t ^ (s.re - 1) * rexp (-π * t * (↑n + 1) ^ 2) f : ℕ → ℝ → ℂ := fun n t => ↑t ^ (s - 1) * ↑(rexp (-π * t * (↑n + 1) ^ 2)) hm : MeasurableSet (Ioi 0) h_norm : ∀ (n : ℕ) {t : ℝ}, 0 < t → ‖f n t‖ = bd n t hf_meas : ∀ (n : ℕ), AEStronglyMeasurable (f n) (Measure.restrict volume (Ioi 0)) h_le : ∀ (n : ℕ), ∀ᵐ (t : ℝ) ∂Measure.restrict volume (Ioi 0), ‖f n t‖ ≤ bd n t h_sum0 : ∀ {t : ℝ}, 0 < t → HasSum (fun n => f n t) (↑t ^ (s - 1) * zetaKernel₁ t) h_sum' : ∀ᵐ (t : ℝ) ∂Measure.restrict volume (Ioi 0), HasSum (fun n => f n t) (↑t ^ (s - 1) * zetaKernel₁ t) h_sum : ∀ᵐ (t : ℝ) ∂Measure.restrict volume (Ioi 0), Summable fun n => bd n t t : ℝ ht : t ∈ Ioi 0 ⊢ 0 ≤ ∑' (a : ℕ), rexp (-π * t * (↑a + 1) ^ 2) [PROOFSTEP] exact tsum_nonneg fun n => (exp_pos _).le [GOAL] s : ℂ hs : 1 / 2 < s.re bd : ℕ → ℝ → ℝ := fun n t => t ^ (s.re - 1) * rexp (-π * t * (↑n + 1) ^ 2) f : ℕ → ℝ → ℂ := fun n t => ↑t ^ (s - 1) * ↑(rexp (-π * t * (↑n + 1) ^ 2)) hm : MeasurableSet (Ioi 0) h_norm : ∀ (n : ℕ) {t : ℝ}, 0 < t → ‖f n t‖ = bd n t hf_meas : ∀ (n : ℕ), AEStronglyMeasurable (f n) (Measure.restrict volume (Ioi 0)) h_le : ∀ (n : ℕ), ∀ᵐ (t : ℝ) ∂Measure.restrict volume (Ioi 0), ‖f n t‖ ≤ bd n t h_sum0 : ∀ {t : ℝ}, 0 < t → HasSum (fun n => f n t) (↑t ^ (s - 1) * zetaKernel₁ t) h_sum' : ∀ᵐ (t : ℝ) ∂Measure.restrict volume (Ioi 0), HasSum (fun n => f n t) (↑t ^ (s - 1) * zetaKernel₁ t) h_sum : ∀ᵐ (t : ℝ) ∂Measure.restrict volume (Ioi 0), Summable fun n => bd n t h_int : Integrable fun t => ∑' (n : ℕ), bd n t ⊢ mellin zetaKernel₁ s = ↑π ^ (-s) * Complex.Gamma s * ∑' (n : ℕ), 1 / (↑n + 1) ^ (2 * s) [PROOFSTEP] rw [← tsum_mul_left] [GOAL] s : ℂ hs : 1 / 2 < s.re bd : ℕ → ℝ → ℝ := fun n t => t ^ (s.re - 1) * rexp (-π * t * (↑n + 1) ^ 2) f : ℕ → ℝ → ℂ := fun n t => ↑t ^ (s - 1) * ↑(rexp (-π * t * (↑n + 1) ^ 2)) hm : MeasurableSet (Ioi 0) h_norm : ∀ (n : ℕ) {t : ℝ}, 0 < t → ‖f n t‖ = bd n t hf_meas : ∀ (n : ℕ), AEStronglyMeasurable (f n) (Measure.restrict volume (Ioi 0)) h_le : ∀ (n : ℕ), ∀ᵐ (t : ℝ) ∂Measure.restrict volume (Ioi 0), ‖f n t‖ ≤ bd n t h_sum0 : ∀ {t : ℝ}, 0 < t → HasSum (fun n => f n t) (↑t ^ (s - 1) * zetaKernel₁ t) h_sum' : ∀ᵐ (t : ℝ) ∂Measure.restrict volume (Ioi 0), HasSum (fun n => f n t) (↑t ^ (s - 1) * zetaKernel₁ t) h_sum : ∀ᵐ (t : ℝ) ∂Measure.restrict volume (Ioi 0), Summable fun n => bd n t h_int : Integrable fun t => ∑' (n : ℕ), bd n t ⊢ mellin zetaKernel₁ s = ∑' (x : ℕ), ↑π ^ (-s) * Complex.Gamma s * (1 / (↑x + 1) ^ (2 * s)) [PROOFSTEP] simp_rw [← integral_cpow_mul_exp_neg_pi_mul_sq (one_half_pos.trans hs)] [GOAL] s : ℂ hs : 1 / 2 < s.re bd : ℕ → ℝ → ℝ := fun n t => t ^ (s.re - 1) * rexp (-π * t * (↑n + 1) ^ 2) f : ℕ → ℝ → ℂ := fun n t => ↑t ^ (s - 1) * ↑(rexp (-π * t * (↑n + 1) ^ 2)) hm : MeasurableSet (Ioi 0) h_norm : ∀ (n : ℕ) {t : ℝ}, 0 < t → ‖f n t‖ = bd n t hf_meas : ∀ (n : ℕ), AEStronglyMeasurable (f n) (Measure.restrict volume (Ioi 0)) h_le : ∀ (n : ℕ), ∀ᵐ (t : ℝ) ∂Measure.restrict volume (Ioi 0), ‖f n t‖ ≤ bd n t h_sum0 : ∀ {t : ℝ}, 0 < t → HasSum (fun n => f n t) (↑t ^ (s - 1) * zetaKernel₁ t) h_sum' : ∀ᵐ (t : ℝ) ∂Measure.restrict volume (Ioi 0), HasSum (fun n => f n t) (↑t ^ (s - 1) * zetaKernel₁ t) h_sum : ∀ᵐ (t : ℝ) ∂Measure.restrict volume (Ioi 0), Summable fun n => bd n t h_int : Integrable fun t => ∑' (n : ℕ), bd n t ⊢ mellin zetaKernel₁ s = ∑' (x : ℕ), ∫ (t : ℝ) in Ioi 0, ↑t ^ (s - 1) * ↑(rexp (-π * t * (↑x + 1) ^ 2)) [PROOFSTEP] rw [← (hasSum_integral_of_dominated_convergence bd hf_meas h_le h_sum h_int h_sum').tsum_eq.symm] [GOAL] s : ℂ hs : 1 / 2 < s.re bd : ℕ → ℝ → ℝ := fun n t => t ^ (s.re - 1) * rexp (-π * t * (↑n + 1) ^ 2) f : ℕ → ℝ → ℂ := fun n t => ↑t ^ (s - 1) * ↑(rexp (-π * t * (↑n + 1) ^ 2)) hm : MeasurableSet (Ioi 0) h_norm : ∀ (n : ℕ) {t : ℝ}, 0 < t → ‖f n t‖ = bd n t hf_meas : ∀ (n : ℕ), AEStronglyMeasurable (f n) (Measure.restrict volume (Ioi 0)) h_le : ∀ (n : ℕ), ∀ᵐ (t : ℝ) ∂Measure.restrict volume (Ioi 0), ‖f n t‖ ≤ bd n t h_sum0 : ∀ {t : ℝ}, 0 < t → HasSum (fun n => f n t) (↑t ^ (s - 1) * zetaKernel₁ t) h_sum' : ∀ᵐ (t : ℝ) ∂Measure.restrict volume (Ioi 0), HasSum (fun n => f n t) (↑t ^ (s - 1) * zetaKernel₁ t) h_sum : ∀ᵐ (t : ℝ) ∂Measure.restrict volume (Ioi 0), Summable fun n => bd n t h_int : Integrable fun t => ∑' (n : ℕ), bd n t ⊢ mellin zetaKernel₁ s = ∫ (a : ℝ) in Ioi 0, ↑a ^ (s - 1) * zetaKernel₁ a [PROOFSTEP] rfl [GOAL] s : ℂ hs : 1 < s.re ⊢ riemannCompletedZeta s = ↑π ^ (-s / 2) * Complex.Gamma (s / 2) * ∑' (n : ℕ), 1 / (↑n + 1) ^ s [PROOFSTEP] rw [completed_zeta_eq_mellin_of_one_lt_re hs, mellin_zetaKernel₁_eq_tsum, neg_div, mul_div_cancel' _ (two_ne_zero' ℂ)] [GOAL] s : ℂ hs : 1 < s.re ⊢ 1 / 2 < (s / 2).re [PROOFSTEP] rw [show s / 2 = ↑(2⁻¹ : ℝ) * s by push_cast ; rw [mul_comm]; rfl] [GOAL] s : ℂ hs : 1 < s.re ⊢ s / 2 = ↑2⁻¹ * s [PROOFSTEP] push_cast [GOAL] s : ℂ hs : 1 < s.re ⊢ s / 2 = 2⁻¹ * s [PROOFSTEP] rw [mul_comm] [GOAL] s : ℂ hs : 1 < s.re ⊢ s / 2 = s * 2⁻¹ [PROOFSTEP] rfl [GOAL] s : ℂ hs : 1 < s.re ⊢ 1 / 2 < (↑2⁻¹ * s).re [PROOFSTEP] rwa [ofReal_mul_re, ← div_eq_inv_mul, div_lt_div_right (zero_lt_two' ℝ)] [GOAL] s : ℂ hs : 1 < s.re ⊢ riemannZeta s = ∑' (n : ℕ), 1 / (↑n + 1) ^ s [PROOFSTEP] have : s ≠ 0 := by contrapose! hs; rw [hs, zero_re]; exact zero_le_one [GOAL] s : ℂ hs : 1 < s.re ⊢ s ≠ 0 [PROOFSTEP] contrapose! hs [GOAL] s : ℂ hs : s = 0 ⊢ s.re ≤ 1 [PROOFSTEP] rw [hs, zero_re] [GOAL] s : ℂ hs : s = 0 ⊢ 0 ≤ 1 [PROOFSTEP] exact zero_le_one [GOAL] s : ℂ hs : 1 < s.re this : s ≠ 0 ⊢ riemannZeta s = ∑' (n : ℕ), 1 / (↑n + 1) ^ s [PROOFSTEP] rw [riemannZeta, Function.update_noteq this, completed_zeta_eq_tsum_of_one_lt_re hs, ← mul_assoc, neg_div, cpow_neg, mul_inv_cancel_left₀, mul_div_cancel_left] [GOAL] case ha s : ℂ hs : 1 < s.re this : s ≠ 0 ⊢ Complex.Gamma (s / 2) ≠ 0 [PROOFSTEP] apply Gamma_ne_zero_of_re_pos [GOAL] case ha.hs s : ℂ hs : 1 < s.re this : s ≠ 0 ⊢ 0 < (s / 2).re [PROOFSTEP] rw [div_eq_mul_inv, mul_comm, show (2⁻¹ : ℂ) = (2⁻¹ : ℝ) by norm_num, ofReal_mul_re] [GOAL] s : ℂ hs : 1 < s.re this : s ≠ 0 ⊢ 2⁻¹ = ↑2⁻¹ [PROOFSTEP] norm_num [GOAL] case ha.hs s : ℂ hs : 1 < s.re this : s ≠ 0 ⊢ 0 < 2⁻¹ * s.re [PROOFSTEP] exact mul_pos (inv_pos_of_pos two_pos) (zero_lt_one.trans hs) [GOAL] case h s : ℂ hs : 1 < s.re this : s ≠ 0 ⊢ ↑π ^ (s / 2) ≠ 0 [PROOFSTEP] rw [Ne.def, cpow_eq_zero_iff, not_and_or, ← Ne.def, ofReal_ne_zero] [GOAL] case h s : ℂ hs : 1 < s.re this : s ≠ 0 ⊢ π ≠ 0 ∨ ¬s / 2 ≠ 0 [PROOFSTEP] exact Or.inl pi_pos.ne' [GOAL] s : ℂ hs : 1 < s.re ⊢ riemannZeta s = ∑' (n : ℕ), 1 / ↑n ^ s [PROOFSTEP] have hs' : s ≠ 0 := by contrapose! hs; rw [hs, zero_re]; exact zero_le_one [GOAL] s : ℂ hs : 1 < s.re ⊢ s ≠ 0 [PROOFSTEP] contrapose! hs [GOAL] s : ℂ hs : s = 0 ⊢ s.re ≤ 1 [PROOFSTEP] rw [hs, zero_re] [GOAL] s : ℂ hs : s = 0 ⊢ 0 ≤ 1 [PROOFSTEP] exact zero_le_one [GOAL] s : ℂ hs : 1 < s.re hs' : s ≠ 0 ⊢ riemannZeta s = ∑' (n : ℕ), 1 / ↑n ^ s [PROOFSTEP] rw [tsum_eq_zero_add] [GOAL] s : ℂ hs : 1 < s.re hs' : s ≠ 0 ⊢ riemannZeta s = 1 / ↑0 ^ s + ∑' (b : ℕ), 1 / ↑(b + 1) ^ s [PROOFSTEP] simp_rw [Nat.cast_zero, zero_cpow hs', div_zero, zero_add, zeta_eq_tsum_one_div_nat_add_one_cpow hs, Nat.cast_add, Nat.cast_one] [GOAL] s : ℂ hs : 1 < s.re hs' : s ≠ 0 ⊢ Summable fun n => 1 / ↑n ^ s [PROOFSTEP] rw [← summable_norm_iff] [GOAL] s : ℂ hs : 1 < s.re hs' : s ≠ 0 ⊢ Summable fun x => ‖1 / ↑x ^ s‖ [PROOFSTEP] simp_rw [norm_div, norm_one, Complex.norm_eq_abs, ← ofReal_nat_cast, abs_cpow_eq_rpow_re_of_nonneg (Nat.cast_nonneg _) (zero_lt_one.trans hs).ne', summable_one_div_nat_rpow] [GOAL] s : ℂ hs : 1 < s.re hs' : s ≠ 0 ⊢ 1 < s.re [PROOFSTEP] assumption [GOAL] k : ℕ hk : 1 < k ⊢ riemannZeta ↑k = ∑' (n : ℕ), 1 / ↑n ^ k [PROOFSTEP] simp only [zeta_eq_tsum_one_div_nat_cpow (by rwa [← ofReal_nat_cast, ofReal_re, ← Nat.cast_one, Nat.cast_lt] : 1 < re k), cpow_nat_cast] [GOAL] k : ℕ hk : 1 < k ⊢ 1 < (↑k).re [PROOFSTEP] rwa [← ofReal_nat_cast, ofReal_re, ← Nat.cast_one, Nat.cast_lt] [GOAL] k : ℕ hk : k ≠ 0 ⊢ riemannZeta (2 * ↑k) = (-1) ^ (k + 1) * 2 ^ (2 * k - 1) * ↑π ^ (2 * k) * ↑(bernoulli (2 * k)) / ↑(2 * k)! [PROOFSTEP] convert congr_arg ((↑) : ℝ → ℂ) (hasSum_zeta_nat hk).tsum_eq [GOAL] case h.e'_2 k : ℕ hk : k ≠ 0 ⊢ riemannZeta (2 * ↑k) = ↑(∑' (b : ℕ), 1 / ↑b ^ (2 * k)) [PROOFSTEP] rw [← Nat.cast_two, ← Nat.cast_mul, zeta_nat_eq_tsum_of_gt_one] [GOAL] case h.e'_2 k : ℕ hk : k ≠ 0 ⊢ ∑' (n : ℕ), 1 / ↑n ^ (2 * k) = ↑(∑' (b : ℕ), 1 / ↑b ^ (2 * k)) [PROOFSTEP] rw [ofReal_tsum] [GOAL] case h.e'_2 k : ℕ hk : k ≠ 0 ⊢ ∑' (n : ℕ), 1 / ↑n ^ (2 * k) = ∑' (a : ℕ), ↑(1 / ↑a ^ (2 * k)) [PROOFSTEP] norm_num [GOAL] case h.e'_2 k : ℕ hk : k ≠ 0 ⊢ 1 < 2 * k [PROOFSTEP] refine one_lt_two.trans_le ?_ [GOAL] case h.e'_2 k : ℕ hk : k ≠ 0 ⊢ 2 ≤ 2 * k [PROOFSTEP] conv_lhs => rw [← mul_one 2] [GOAL] k : ℕ hk : k ≠ 0 | 2 [PROOFSTEP] rw [← mul_one 2] [GOAL] k : ℕ hk : k ≠ 0 | 2 [PROOFSTEP] rw [← mul_one 2] [GOAL] k : ℕ hk : k ≠ 0 | 2 [PROOFSTEP] rw [← mul_one 2] [GOAL] case h.e'_2 k : ℕ hk : k ≠ 0 ⊢ 2 * 1 ≤ 2 * k [PROOFSTEP] rwa [mul_le_mul_left (zero_lt_two' ℕ), Nat.one_le_iff_ne_zero] [GOAL] case h.e'_3 k : ℕ hk : k ≠ 0 ⊢ (-1) ^ (k + 1) * 2 ^ (2 * k - 1) * ↑π ^ (2 * k) * ↑(bernoulli (2 * k)) / ↑(2 * k)! = ↑((-1) ^ (k + 1) * 2 ^ (2 * k - 1) * π ^ (2 * k) * ↑(bernoulli (2 * k)) / ↑(2 * k)!) [PROOFSTEP] norm_num [GOAL] ⊢ riemannZeta 2 = ↑π ^ 2 / 6 [PROOFSTEP] convert congr_arg ((↑) : ℝ → ℂ) hasSum_zeta_two.tsum_eq [GOAL] case h.e'_2 ⊢ riemannZeta 2 = ↑(∑' (b : ℕ), 1 / ↑b ^ 2) [PROOFSTEP] rw [← Nat.cast_two, zeta_nat_eq_tsum_of_gt_one one_lt_two, ofReal_tsum] [GOAL] case h.e'_2 ⊢ ∑' (n : ℕ), 1 / ↑n ^ 2 = ∑' (a : ℕ), ↑(1 / ↑a ^ 2) [PROOFSTEP] norm_num [GOAL] case h.e'_3 ⊢ ↑π ^ 2 / 6 = ↑(π ^ 2 / 6) [PROOFSTEP] norm_num [GOAL] ⊢ riemannZeta 4 = ↑(π ^ 4) / 90 [PROOFSTEP] convert congr_arg ((↑) : ℝ → ℂ) hasSum_zeta_four.tsum_eq [GOAL] case h.e'_2 ⊢ riemannZeta 4 = ↑(∑' (b : ℕ), 1 / ↑b ^ 4) [PROOFSTEP] rw [← Nat.cast_one, show (4 : ℂ) = (4 : ℕ) by norm_num, zeta_nat_eq_tsum_of_gt_one (by norm_num : 1 < 4), ofReal_tsum] [GOAL] ⊢ 4 = ↑4 [PROOFSTEP] norm_num [GOAL] ⊢ 1 < 4 [PROOFSTEP] norm_num [GOAL] case h.e'_2 ⊢ ∑' (n : ℕ), 1 / ↑n ^ 4 = ∑' (a : ℕ), ↑(↑1 / ↑a ^ 4) [PROOFSTEP] norm_num [GOAL] case h.e'_3 ⊢ ↑(π ^ 4) / 90 = ↑(π ^ 4 / 90) [PROOFSTEP] norm_num [GOAL] s : ℂ ⊢ riemannCompletedZeta₀ (1 - s) = riemannCompletedZeta₀ s [PROOFSTEP] have := mellin_comp_rpow zetaKernel₂ (s / 2 - 1 / 2) neg_one_lt_zero.ne [GOAL] s : ℂ this : mellin (fun t => zetaKernel₂ (t ^ (-1))) (s / 2 - 1 / 2) = |(-1)|⁻¹ • mellin zetaKernel₂ ((s / 2 - 1 / 2) / ↑(-1)) ⊢ riemannCompletedZeta₀ (1 - s) = riemannCompletedZeta₀ s [PROOFSTEP] simp_rw [rpow_neg_one, ← one_div, abs_neg, abs_one, div_one, one_smul, ofReal_neg, ofReal_one, div_neg, div_one, neg_sub] at this [GOAL] s : ℂ this : mellin (fun t => zetaKernel₂ (1 / t)) (s / 2 - 1 / 2) = mellin zetaKernel₂ (1 / 2 - s / 2) ⊢ riemannCompletedZeta₀ (1 - s) = riemannCompletedZeta₀ s [PROOFSTEP] conv_lhs => rw [riemannCompletedZeta₀, sub_div, ← this] [GOAL] s : ℂ this : mellin (fun t => zetaKernel₂ (1 / t)) (s / 2 - 1 / 2) = mellin zetaKernel₂ (1 / 2 - s / 2) | riemannCompletedZeta₀ (1 - s) [PROOFSTEP] rw [riemannCompletedZeta₀, sub_div, ← this] [GOAL] s : ℂ this : mellin (fun t => zetaKernel₂ (1 / t)) (s / 2 - 1 / 2) = mellin zetaKernel₂ (1 / 2 - s / 2) | riemannCompletedZeta₀ (1 - s) [PROOFSTEP] rw [riemannCompletedZeta₀, sub_div, ← this] [GOAL] s : ℂ this : mellin (fun t => zetaKernel₂ (1 / t)) (s / 2 - 1 / 2) = mellin zetaKernel₂ (1 / 2 - s / 2) | riemannCompletedZeta₀ (1 - s) [PROOFSTEP] rw [riemannCompletedZeta₀, sub_div, ← this] [GOAL] s : ℂ this : mellin (fun t => zetaKernel₂ (1 / t)) (s / 2 - 1 / 2) = mellin zetaKernel₂ (1 / 2 - s / 2) ⊢ mellin (fun t => zetaKernel₂ (1 / t)) (s / 2 - 1 / 2) = riemannCompletedZeta₀ s [PROOFSTEP] refine set_integral_congr measurableSet_Ioi fun t ht => ?_ [GOAL] s : ℂ this : mellin (fun t => zetaKernel₂ (1 / t)) (s / 2 - 1 / 2) = mellin zetaKernel₂ (1 / 2 - s / 2) t : ℝ ht : t ∈ Ioi 0 ⊢ ↑t ^ (s / 2 - 1 / 2 - 1) • (fun t => zetaKernel₂ (1 / t)) t = ↑t ^ (s / 2 - 1) • zetaKernel₂ t [PROOFSTEP] simp_rw [zetaKernel₂_one_div ht, smul_eq_mul, ← mul_assoc, sqrt_eq_rpow, ofReal_cpow (le_of_lt ht), ← cpow_add _ _ (ofReal_ne_zero.mpr <| ne_of_gt ht)] [GOAL] s : ℂ this : mellin (fun t => zetaKernel₂ (1 / t)) (s / 2 - 1 / 2) = mellin zetaKernel₂ (1 / 2 - s / 2) t : ℝ ht : t ∈ Ioi 0 ⊢ ↑t ^ (s / 2 - 1 / 2 - 1 + ↑(1 / 2)) * zetaKernel₂ t = ↑t ^ (s / 2 - 1) * zetaKernel₂ t [PROOFSTEP] congr 2 [GOAL] case e_a.e_a s : ℂ this : mellin (fun t => zetaKernel₂ (1 / t)) (s / 2 - 1 / 2) = mellin zetaKernel₂ (1 / 2 - s / 2) t : ℝ ht : t ∈ Ioi 0 ⊢ s / 2 - 1 / 2 - 1 + ↑(1 / 2) = s / 2 - 1 [PROOFSTEP] push_cast [GOAL] case e_a.e_a s : ℂ this : mellin (fun t => zetaKernel₂ (1 / t)) (s / 2 - 1 / 2) = mellin zetaKernel₂ (1 / 2 - s / 2) t : ℝ ht : t ∈ Ioi 0 ⊢ s / 2 - 1 / 2 - 1 + 1 / 2 = s / 2 - 1 [PROOFSTEP] ring [GOAL] s : ℂ ⊢ riemannCompletedZeta (1 - s) = riemannCompletedZeta s [PROOFSTEP] simp_rw [riemannCompletedZeta, riemannCompletedZeta₀_one_sub, sub_add, (by abel : 1 - s - 1 = -s), (by abel : 1 - s = -(s - 1)), div_neg, neg_sub_neg] [GOAL] s : ℂ ⊢ 1 - s - 1 = -s [PROOFSTEP] abel [GOAL] s : ℂ ⊢ 1 - s - 1 = -s [PROOFSTEP] abel [GOAL] s : ℂ ⊢ 1 - s = -(s - 1) [PROOFSTEP] abel [GOAL] s : ℂ ⊢ 1 - s = -(s - 1) [PROOFSTEP] abel [GOAL] s : ℂ hs : ∀ (n : ℕ), s ≠ -↑n hs' : s ≠ 1 ⊢ riemannZeta (1 - s) = 2 ^ (1 - s) * ↑π ^ (-s) * Complex.Gamma s * Complex.sin (↑π * (1 - s) / 2) * riemannZeta s [PROOFSTEP] have hs_ne : s ≠ 0 := by contrapose! hs; rw [hs]; exact ⟨0, by rw [Nat.cast_zero, neg_zero]⟩ [GOAL] s : ℂ hs : ∀ (n : ℕ), s ≠ -↑n hs' : s ≠ 1 ⊢ s ≠ 0 [PROOFSTEP] contrapose! hs [GOAL] s : ℂ hs' : s ≠ 1 hs : s = 0 ⊢ ∃ n, s = -↑n [PROOFSTEP] rw [hs] [GOAL] s : ℂ hs' : s ≠ 1 hs : s = 0 ⊢ ∃ n, 0 = -↑n [PROOFSTEP] exact ⟨0, by rw [Nat.cast_zero, neg_zero]⟩ [GOAL] s : ℂ hs' : s ≠ 1 hs : s = 0 ⊢ 0 = -↑0 [PROOFSTEP] rw [Nat.cast_zero, neg_zero] [GOAL] s : ℂ hs : ∀ (n : ℕ), s ≠ -↑n hs' : s ≠ 1 hs_ne : s ≠ 0 ⊢ riemannZeta (1 - s) = 2 ^ (1 - s) * ↑π ^ (-s) * Complex.Gamma s * Complex.sin (↑π * (1 - s) / 2) * riemannZeta s [PROOFSTEP] have h_sqrt : (sqrt π : ℂ) ≠ 0 := ofReal_ne_zero.mpr (sqrt_ne_zero'.mpr pi_pos) [GOAL] s : ℂ hs : ∀ (n : ℕ), s ≠ -↑n hs' : s ≠ 1 hs_ne : s ≠ 0 h_sqrt : ↑(sqrt π) ≠ 0 ⊢ riemannZeta (1 - s) = 2 ^ (1 - s) * ↑π ^ (-s) * Complex.Gamma s * Complex.sin (↑π * (1 - s) / 2) * riemannZeta s [PROOFSTEP] have h_pow : (2 : ℂ) ^ (s - 1) ≠ 0 := by rw [Ne.def, cpow_eq_zero_iff, not_and_or] exact Or.inl two_ne_zero [GOAL] s : ℂ hs : ∀ (n : ℕ), s ≠ -↑n hs' : s ≠ 1 hs_ne : s ≠ 0 h_sqrt : ↑(sqrt π) ≠ 0 ⊢ 2 ^ (s - 1) ≠ 0 [PROOFSTEP] rw [Ne.def, cpow_eq_zero_iff, not_and_or] [GOAL] s : ℂ hs : ∀ (n : ℕ), s ≠ -↑n hs' : s ≠ 1 hs_ne : s ≠ 0 h_sqrt : ↑(sqrt π) ≠ 0 ⊢ ¬2 = 0 ∨ ¬s - 1 ≠ 0 [PROOFSTEP] exact Or.inl two_ne_zero [GOAL] s : ℂ hs : ∀ (n : ℕ), s ≠ -↑n hs' : s ≠ 1 hs_ne : s ≠ 0 h_sqrt : ↑(sqrt π) ≠ 0 h_pow : 2 ^ (s - 1) ≠ 0 ⊢ riemannZeta (1 - s) = 2 ^ (1 - s) * ↑π ^ (-s) * Complex.Gamma s * Complex.sin (↑π * (1 - s) / 2) * riemannZeta s [PROOFSTEP] have h_Ga_ne1 : Gamma (s / 2) ≠ 0 := by rw [Ne.def, Complex.Gamma_eq_zero_iff] contrapose! hs obtain ⟨m, hm⟩ := hs rw [div_eq_iff (two_ne_zero' ℂ), ← Nat.cast_two, neg_mul, ← Nat.cast_mul] at hm exact ⟨m * 2, by rw [hm]⟩ [GOAL] s : ℂ hs : ∀ (n : ℕ), s ≠ -↑n hs' : s ≠ 1 hs_ne : s ≠ 0 h_sqrt : ↑(sqrt π) ≠ 0 h_pow : 2 ^ (s - 1) ≠ 0 ⊢ Complex.Gamma (s / 2) ≠ 0 [PROOFSTEP] rw [Ne.def, Complex.Gamma_eq_zero_iff] [GOAL] s : ℂ hs : ∀ (n : ℕ), s ≠ -↑n hs' : s ≠ 1 hs_ne : s ≠ 0 h_sqrt : ↑(sqrt π) ≠ 0 h_pow : 2 ^ (s - 1) ≠ 0 ⊢ ¬∃ m, s / 2 = -↑m [PROOFSTEP] contrapose! hs [GOAL] s : ℂ hs' : s ≠ 1 hs_ne : s ≠ 0 h_sqrt : ↑(sqrt π) ≠ 0 h_pow : 2 ^ (s - 1) ≠ 0 hs : ∃ m, s / 2 = -↑m ⊢ ∃ n, s = -↑n [PROOFSTEP] obtain ⟨m, hm⟩ := hs [GOAL] case intro s : ℂ hs' : s ≠ 1 hs_ne : s ≠ 0 h_sqrt : ↑(sqrt π) ≠ 0 h_pow : 2 ^ (s - 1) ≠ 0 m : ℕ hm : s / 2 = -↑m ⊢ ∃ n, s = -↑n [PROOFSTEP] rw [div_eq_iff (two_ne_zero' ℂ), ← Nat.cast_two, neg_mul, ← Nat.cast_mul] at hm [GOAL] case intro s : ℂ hs' : s ≠ 1 hs_ne : s ≠ 0 h_sqrt : ↑(sqrt π) ≠ 0 h_pow : 2 ^ (s - 1) ≠ 0 m : ℕ hm : s = -↑(m * 2) ⊢ ∃ n, s = -↑n [PROOFSTEP] exact ⟨m * 2, by rw [hm]⟩ [GOAL] s : ℂ hs' : s ≠ 1 hs_ne : s ≠ 0 h_sqrt : ↑(sqrt π) ≠ 0 h_pow : 2 ^ (s - 1) ≠ 0 m : ℕ hm : s = -↑(m * 2) ⊢ s = -↑(m * 2) [PROOFSTEP] rw [hm] [GOAL] s : ℂ hs : ∀ (n : ℕ), s ≠ -↑n hs' : s ≠ 1 hs_ne : s ≠ 0 h_sqrt : ↑(sqrt π) ≠ 0 h_pow : 2 ^ (s - 1) ≠ 0 h_Ga_ne1 : Complex.Gamma (s / 2) ≠ 0 ⊢ riemannZeta (1 - s) = 2 ^ (1 - s) * ↑π ^ (-s) * Complex.Gamma s * Complex.sin (↑π * (1 - s) / 2) * riemannZeta s [PROOFSTEP] have h_Ga_eq : Gamma s = Gamma (s / 2) * Gamma ((s + 1) / 2) * (2 : ℂ) ^ (s - 1) / sqrt π := by rw [add_div, Complex.Gamma_mul_Gamma_add_half, mul_div_cancel' _ (two_ne_zero' ℂ), (by ring : 1 - s = -(s - 1)), cpow_neg, ← div_eq_mul_inv, eq_div_iff h_sqrt, div_mul_eq_mul_div₀, div_mul_cancel _ h_pow] [GOAL] s : ℂ hs : ∀ (n : ℕ), s ≠ -↑n hs' : s ≠ 1 hs_ne : s ≠ 0 h_sqrt : ↑(sqrt π) ≠ 0 h_pow : 2 ^ (s - 1) ≠ 0 h_Ga_ne1 : Complex.Gamma (s / 2) ≠ 0 ⊢ Complex.Gamma s = Complex.Gamma (s / 2) * Complex.Gamma ((s + 1) / 2) * 2 ^ (s - 1) / ↑(sqrt π) [PROOFSTEP] rw [add_div, Complex.Gamma_mul_Gamma_add_half, mul_div_cancel' _ (two_ne_zero' ℂ), (by ring : 1 - s = -(s - 1)), cpow_neg, ← div_eq_mul_inv, eq_div_iff h_sqrt, div_mul_eq_mul_div₀, div_mul_cancel _ h_pow] [GOAL] s : ℂ hs : ∀ (n : ℕ), s ≠ -↑n hs' : s ≠ 1 hs_ne : s ≠ 0 h_sqrt : ↑(sqrt π) ≠ 0 h_pow : 2 ^ (s - 1) ≠ 0 h_Ga_ne1 : Complex.Gamma (s / 2) ≠ 0 ⊢ 1 - s = -(s - 1) [PROOFSTEP] ring [GOAL] s : ℂ hs : ∀ (n : ℕ), s ≠ -↑n hs' : s ≠ 1 hs_ne : s ≠ 0 h_sqrt : ↑(sqrt π) ≠ 0 h_pow : 2 ^ (s - 1) ≠ 0 h_Ga_ne1 : Complex.Gamma (s / 2) ≠ 0 h_Ga_eq : Complex.Gamma s = Complex.Gamma (s / 2) * Complex.Gamma ((s + 1) / 2) * 2 ^ (s - 1) / ↑(sqrt π) ⊢ riemannZeta (1 - s) = 2 ^ (1 - s) * ↑π ^ (-s) * Complex.Gamma s * Complex.sin (↑π * (1 - s) / 2) * riemannZeta s [PROOFSTEP] have h_Ga_ne3 : Gamma ((s + 1) / 2) ≠ 0 := by have h_Ga_aux : Gamma s ≠ 0 := Complex.Gamma_ne_zero hs contrapose! h_Ga_aux rw [h_Ga_eq, h_Ga_aux, mul_zero, zero_mul, zero_div] [GOAL] s : ℂ hs : ∀ (n : ℕ), s ≠ -↑n hs' : s ≠ 1 hs_ne : s ≠ 0 h_sqrt : ↑(sqrt π) ≠ 0 h_pow : 2 ^ (s - 1) ≠ 0 h_Ga_ne1 : Complex.Gamma (s / 2) ≠ 0 h_Ga_eq : Complex.Gamma s = Complex.Gamma (s / 2) * Complex.Gamma ((s + 1) / 2) * 2 ^ (s - 1) / ↑(sqrt π) ⊢ Complex.Gamma ((s + 1) / 2) ≠ 0 [PROOFSTEP] have h_Ga_aux : Gamma s ≠ 0 := Complex.Gamma_ne_zero hs [GOAL] s : ℂ hs : ∀ (n : ℕ), s ≠ -↑n hs' : s ≠ 1 hs_ne : s ≠ 0 h_sqrt : ↑(sqrt π) ≠ 0 h_pow : 2 ^ (s - 1) ≠ 0 h_Ga_ne1 : Complex.Gamma (s / 2) ≠ 0 h_Ga_eq : Complex.Gamma s = Complex.Gamma (s / 2) * Complex.Gamma ((s + 1) / 2) * 2 ^ (s - 1) / ↑(sqrt π) h_Ga_aux : Complex.Gamma s ≠ 0 ⊢ Complex.Gamma ((s + 1) / 2) ≠ 0 [PROOFSTEP] contrapose! h_Ga_aux [GOAL] s : ℂ hs : ∀ (n : ℕ), s ≠ -↑n hs' : s ≠ 1 hs_ne : s ≠ 0 h_sqrt : ↑(sqrt π) ≠ 0 h_pow : 2 ^ (s - 1) ≠ 0 h_Ga_ne1 : Complex.Gamma (s / 2) ≠ 0 h_Ga_eq : Complex.Gamma s = Complex.Gamma (s / 2) * Complex.Gamma ((s + 1) / 2) * 2 ^ (s - 1) / ↑(sqrt π) h_Ga_aux : Complex.Gamma ((s + 1) / 2) = 0 ⊢ Complex.Gamma s = 0 [PROOFSTEP] rw [h_Ga_eq, h_Ga_aux, mul_zero, zero_mul, zero_div] [GOAL] s : ℂ hs : ∀ (n : ℕ), s ≠ -↑n hs' : s ≠ 1 hs_ne : s ≠ 0 h_sqrt : ↑(sqrt π) ≠ 0 h_pow : 2 ^ (s - 1) ≠ 0 h_Ga_ne1 : Complex.Gamma (s / 2) ≠ 0 h_Ga_eq : Complex.Gamma s = Complex.Gamma (s / 2) * Complex.Gamma ((s + 1) / 2) * 2 ^ (s - 1) / ↑(sqrt π) h_Ga_ne3 : Complex.Gamma ((s + 1) / 2) ≠ 0 ⊢ riemannZeta (1 - s) = 2 ^ (1 - s) * ↑π ^ (-s) * Complex.Gamma s * Complex.sin (↑π * (1 - s) / 2) * riemannZeta s [PROOFSTEP] rw [riemannZeta, Function.update_noteq (by rwa [sub_ne_zero, ne_comm] : 1 - s ≠ 0), Function.update_noteq hs_ne, riemannCompletedZeta_one_sub, mul_div, eq_div_iff h_Ga_ne1, mul_comm, ← mul_div_assoc] -- Now rule out case of s = positive odd integer & deduce further non-vanishing statements [GOAL] s : ℂ hs : ∀ (n : ℕ), s ≠ -↑n hs' : s ≠ 1 hs_ne : s ≠ 0 h_sqrt : ↑(sqrt π) ≠ 0 h_pow : 2 ^ (s - 1) ≠ 0 h_Ga_ne1 : Complex.Gamma (s / 2) ≠ 0 h_Ga_eq : Complex.Gamma s = Complex.Gamma (s / 2) * Complex.Gamma ((s + 1) / 2) * 2 ^ (s - 1) / ↑(sqrt π) h_Ga_ne3 : Complex.Gamma ((s + 1) / 2) ≠ 0 ⊢ 1 - s ≠ 0 [PROOFSTEP] rwa [sub_ne_zero, ne_comm] [GOAL] s : ℂ hs : ∀ (n : ℕ), s ≠ -↑n hs' : s ≠ 1 hs_ne : s ≠ 0 h_sqrt : ↑(sqrt π) ≠ 0 h_pow : 2 ^ (s - 1) ≠ 0 h_Ga_ne1 : Complex.Gamma (s / 2) ≠ 0 h_Ga_eq : Complex.Gamma s = Complex.Gamma (s / 2) * Complex.Gamma ((s + 1) / 2) * 2 ^ (s - 1) / ↑(sqrt π) h_Ga_ne3 : Complex.Gamma ((s + 1) / 2) ≠ 0 ⊢ Complex.Gamma (s / 2) * (↑π ^ ((1 - s) / 2) * riemannCompletedZeta s) / Complex.Gamma ((1 - s) / 2) = 2 ^ (1 - s) * ↑π ^ (-s) * Complex.Gamma s * Complex.sin (↑π * (1 - s) / 2) * (↑π ^ (s / 2) * riemannCompletedZeta s) [PROOFSTEP] by_cases hs_pos_odd : ∃ n : ℕ, s = 1 + 2 * n [GOAL] case pos s : ℂ hs : ∀ (n : ℕ), s ≠ -↑n hs' : s ≠ 1 hs_ne : s ≠ 0 h_sqrt : ↑(sqrt π) ≠ 0 h_pow : 2 ^ (s - 1) ≠ 0 h_Ga_ne1 : Complex.Gamma (s / 2) ≠ 0 h_Ga_eq : Complex.Gamma s = Complex.Gamma (s / 2) * Complex.Gamma ((s + 1) / 2) * 2 ^ (s - 1) / ↑(sqrt π) h_Ga_ne3 : Complex.Gamma ((s + 1) / 2) ≠ 0 hs_pos_odd : ∃ n, s = 1 + 2 * ↑n ⊢ Complex.Gamma (s / 2) * (↑π ^ ((1 - s) / 2) * riemannCompletedZeta s) / Complex.Gamma ((1 - s) / 2) = 2 ^ (1 - s) * ↑π ^ (-s) * Complex.Gamma s * Complex.sin (↑π * (1 - s) / 2) * (↑π ^ (s / 2) * riemannCompletedZeta s) [PROOFSTEP] obtain ⟨n, rfl⟩ := hs_pos_odd [GOAL] case pos.intro h_sqrt : ↑(sqrt π) ≠ 0 n : ℕ hs : ∀ (n_1 : ℕ), 1 + 2 * ↑n ≠ -↑n_1 hs' : 1 + 2 * ↑n ≠ 1 hs_ne : 1 + 2 * ↑n ≠ 0 h_pow : 2 ^ (1 + 2 * ↑n - 1) ≠ 0 h_Ga_ne1 : Complex.Gamma ((1 + 2 * ↑n) / 2) ≠ 0 h_Ga_eq : Complex.Gamma (1 + 2 * ↑n) = Complex.Gamma ((1 + 2 * ↑n) / 2) * Complex.Gamma ((1 + 2 * ↑n + 1) / 2) * 2 ^ (1 + 2 * ↑n - 1) / ↑(sqrt π) h_Ga_ne3 : Complex.Gamma ((1 + 2 * ↑n + 1) / 2) ≠ 0 ⊢ Complex.Gamma ((1 + 2 * ↑n) / 2) * (↑π ^ ((1 - (1 + 2 * ↑n)) / 2) * riemannCompletedZeta (1 + 2 * ↑n)) / Complex.Gamma ((1 - (1 + 2 * ↑n)) / 2) = 2 ^ (1 - (1 + 2 * ↑n)) * ↑π ^ (-(1 + 2 * ↑n)) * Complex.Gamma (1 + 2 * ↑n) * Complex.sin (↑π * (1 - (1 + 2 * ↑n)) / 2) * (↑π ^ ((1 + 2 * ↑n) / 2) * riemannCompletedZeta (1 + 2 * ↑n)) [PROOFSTEP] have : (1 - (1 + 2 * (n : ℂ))) / 2 = -↑n := by rw [← sub_sub, sub_self, zero_sub, neg_div, mul_div_cancel_left _ (two_ne_zero' ℂ)] [GOAL] h_sqrt : ↑(sqrt π) ≠ 0 n : ℕ hs : ∀ (n_1 : ℕ), 1 + 2 * ↑n ≠ -↑n_1 hs' : 1 + 2 * ↑n ≠ 1 hs_ne : 1 + 2 * ↑n ≠ 0 h_pow : 2 ^ (1 + 2 * ↑n - 1) ≠ 0 h_Ga_ne1 : Complex.Gamma ((1 + 2 * ↑n) / 2) ≠ 0 h_Ga_eq : Complex.Gamma (1 + 2 * ↑n) = Complex.Gamma ((1 + 2 * ↑n) / 2) * Complex.Gamma ((1 + 2 * ↑n + 1) / 2) * 2 ^ (1 + 2 * ↑n - 1) / ↑(sqrt π) h_Ga_ne3 : Complex.Gamma ((1 + 2 * ↑n + 1) / 2) ≠ 0 ⊢ (1 - (1 + 2 * ↑n)) / 2 = -↑n [PROOFSTEP] rw [← sub_sub, sub_self, zero_sub, neg_div, mul_div_cancel_left _ (two_ne_zero' ℂ)] [GOAL] case pos.intro h_sqrt : ↑(sqrt π) ≠ 0 n : ℕ hs : ∀ (n_1 : ℕ), 1 + 2 * ↑n ≠ -↑n_1 hs' : 1 + 2 * ↑n ≠ 1 hs_ne : 1 + 2 * ↑n ≠ 0 h_pow : 2 ^ (1 + 2 * ↑n - 1) ≠ 0 h_Ga_ne1 : Complex.Gamma ((1 + 2 * ↑n) / 2) ≠ 0 h_Ga_eq : Complex.Gamma (1 + 2 * ↑n) = Complex.Gamma ((1 + 2 * ↑n) / 2) * Complex.Gamma ((1 + 2 * ↑n + 1) / 2) * 2 ^ (1 + 2 * ↑n - 1) / ↑(sqrt π) h_Ga_ne3 : Complex.Gamma ((1 + 2 * ↑n + 1) / 2) ≠ 0 this : (1 - (1 + 2 * ↑n)) / 2 = -↑n ⊢ Complex.Gamma ((1 + 2 * ↑n) / 2) * (↑π ^ ((1 - (1 + 2 * ↑n)) / 2) * riemannCompletedZeta (1 + 2 * ↑n)) / Complex.Gamma ((1 - (1 + 2 * ↑n)) / 2) = 2 ^ (1 - (1 + 2 * ↑n)) * ↑π ^ (-(1 + 2 * ↑n)) * Complex.Gamma (1 + 2 * ↑n) * Complex.sin (↑π * (1 - (1 + 2 * ↑n)) / 2) * (↑π ^ ((1 + 2 * ↑n) / 2) * riemannCompletedZeta (1 + 2 * ↑n)) [PROOFSTEP] rw [this, Complex.Gamma_neg_nat_eq_zero, div_zero] [GOAL] case pos.intro h_sqrt : ↑(sqrt π) ≠ 0 n : ℕ hs : ∀ (n_1 : ℕ), 1 + 2 * ↑n ≠ -↑n_1 hs' : 1 + 2 * ↑n ≠ 1 hs_ne : 1 + 2 * ↑n ≠ 0 h_pow : 2 ^ (1 + 2 * ↑n - 1) ≠ 0 h_Ga_ne1 : Complex.Gamma ((1 + 2 * ↑n) / 2) ≠ 0 h_Ga_eq : Complex.Gamma (1 + 2 * ↑n) = Complex.Gamma ((1 + 2 * ↑n) / 2) * Complex.Gamma ((1 + 2 * ↑n + 1) / 2) * 2 ^ (1 + 2 * ↑n - 1) / ↑(sqrt π) h_Ga_ne3 : Complex.Gamma ((1 + 2 * ↑n + 1) / 2) ≠ 0 this : (1 - (1 + 2 * ↑n)) / 2 = -↑n ⊢ 0 = 2 ^ (1 - (1 + 2 * ↑n)) * ↑π ^ (-(1 + 2 * ↑n)) * Complex.Gamma (1 + 2 * ↑n) * Complex.sin (↑π * (1 - (1 + 2 * ↑n)) / 2) * (↑π ^ ((1 + 2 * ↑n) / 2) * riemannCompletedZeta (1 + 2 * ↑n)) [PROOFSTEP] have : (π : ℂ) * (1 - (1 + 2 * ↑n)) / 2 = ↑(-n : ℤ) * π := by push_cast ; field_simp; ring [GOAL] h_sqrt : ↑(sqrt π) ≠ 0 n : ℕ hs : ∀ (n_1 : ℕ), 1 + 2 * ↑n ≠ -↑n_1 hs' : 1 + 2 * ↑n ≠ 1 hs_ne : 1 + 2 * ↑n ≠ 0 h_pow : 2 ^ (1 + 2 * ↑n - 1) ≠ 0 h_Ga_ne1 : Complex.Gamma ((1 + 2 * ↑n) / 2) ≠ 0 h_Ga_eq : Complex.Gamma (1 + 2 * ↑n) = Complex.Gamma ((1 + 2 * ↑n) / 2) * Complex.Gamma ((1 + 2 * ↑n + 1) / 2) * 2 ^ (1 + 2 * ↑n - 1) / ↑(sqrt π) h_Ga_ne3 : Complex.Gamma ((1 + 2 * ↑n + 1) / 2) ≠ 0 this : (1 - (1 + 2 * ↑n)) / 2 = -↑n ⊢ ↑π * (1 - (1 + 2 * ↑n)) / 2 = ↑(-↑n) * ↑π [PROOFSTEP] push_cast [GOAL] h_sqrt : ↑(sqrt π) ≠ 0 n : ℕ hs : ∀ (n_1 : ℕ), 1 + 2 * ↑n ≠ -↑n_1 hs' : 1 + 2 * ↑n ≠ 1 hs_ne : 1 + 2 * ↑n ≠ 0 h_pow : 2 ^ (1 + 2 * ↑n - 1) ≠ 0 h_Ga_ne1 : Complex.Gamma ((1 + 2 * ↑n) / 2) ≠ 0 h_Ga_eq : Complex.Gamma (1 + 2 * ↑n) = Complex.Gamma ((1 + 2 * ↑n) / 2) * Complex.Gamma ((1 + 2 * ↑n + 1) / 2) * 2 ^ (1 + 2 * ↑n - 1) / ↑(sqrt π) h_Ga_ne3 : Complex.Gamma ((1 + 2 * ↑n + 1) / 2) ≠ 0 this : (1 - (1 + 2 * ↑n)) / 2 = -↑n ⊢ ↑π * (1 - (1 + 2 * ↑n)) / 2 = -↑n * ↑π [PROOFSTEP] field_simp [GOAL] h_sqrt : ↑(sqrt π) ≠ 0 n : ℕ hs : ∀ (n_1 : ℕ), 1 + 2 * ↑n ≠ -↑n_1 hs' : 1 + 2 * ↑n ≠ 1 hs_ne : 1 + 2 * ↑n ≠ 0 h_pow : 2 ^ (1 + 2 * ↑n - 1) ≠ 0 h_Ga_ne1 : Complex.Gamma ((1 + 2 * ↑n) / 2) ≠ 0 h_Ga_eq : Complex.Gamma (1 + 2 * ↑n) = Complex.Gamma ((1 + 2 * ↑n) / 2) * Complex.Gamma ((1 + 2 * ↑n + 1) / 2) * 2 ^ (1 + 2 * ↑n - 1) / ↑(sqrt π) h_Ga_ne3 : Complex.Gamma ((1 + 2 * ↑n + 1) / 2) ≠ 0 this : (1 - (1 + 2 * ↑n)) / 2 = -↑n ⊢ ↑π * (2 * ↑n) = ↑n * ↑π * 2 [PROOFSTEP] ring [GOAL] case pos.intro h_sqrt : ↑(sqrt π) ≠ 0 n : ℕ hs : ∀ (n_1 : ℕ), 1 + 2 * ↑n ≠ -↑n_1 hs' : 1 + 2 * ↑n ≠ 1 hs_ne : 1 + 2 * ↑n ≠ 0 h_pow : 2 ^ (1 + 2 * ↑n - 1) ≠ 0 h_Ga_ne1 : Complex.Gamma ((1 + 2 * ↑n) / 2) ≠ 0 h_Ga_eq : Complex.Gamma (1 + 2 * ↑n) = Complex.Gamma ((1 + 2 * ↑n) / 2) * Complex.Gamma ((1 + 2 * ↑n + 1) / 2) * 2 ^ (1 + 2 * ↑n - 1) / ↑(sqrt π) h_Ga_ne3 : Complex.Gamma ((1 + 2 * ↑n + 1) / 2) ≠ 0 this✝ : (1 - (1 + 2 * ↑n)) / 2 = -↑n this : ↑π * (1 - (1 + 2 * ↑n)) / 2 = ↑(-↑n) * ↑π ⊢ 0 = 2 ^ (1 - (1 + 2 * ↑n)) * ↑π ^ (-(1 + 2 * ↑n)) * Complex.Gamma (1 + 2 * ↑n) * Complex.sin (↑π * (1 - (1 + 2 * ↑n)) / 2) * (↑π ^ ((1 + 2 * ↑n) / 2) * riemannCompletedZeta (1 + 2 * ↑n)) [PROOFSTEP] rw [this, Complex.sin_int_mul_pi, mul_zero, zero_mul] [GOAL] case neg s : ℂ hs : ∀ (n : ℕ), s ≠ -↑n hs' : s ≠ 1 hs_ne : s ≠ 0 h_sqrt : ↑(sqrt π) ≠ 0 h_pow : 2 ^ (s - 1) ≠ 0 h_Ga_ne1 : Complex.Gamma (s / 2) ≠ 0 h_Ga_eq : Complex.Gamma s = Complex.Gamma (s / 2) * Complex.Gamma ((s + 1) / 2) * 2 ^ (s - 1) / ↑(sqrt π) h_Ga_ne3 : Complex.Gamma ((s + 1) / 2) ≠ 0 hs_pos_odd : ¬∃ n, s = 1 + 2 * ↑n ⊢ Complex.Gamma (s / 2) * (↑π ^ ((1 - s) / 2) * riemannCompletedZeta s) / Complex.Gamma ((1 - s) / 2) = 2 ^ (1 - s) * ↑π ^ (-s) * Complex.Gamma s * Complex.sin (↑π * (1 - s) / 2) * (↑π ^ (s / 2) * riemannCompletedZeta s) [PROOFSTEP] have h_Ga_ne4 : Gamma ((1 - s) / 2) ≠ 0 := by rw [Ne.def, Complex.Gamma_eq_zero_iff] contrapose! hs_pos_odd obtain ⟨m, hm⟩ := hs_pos_odd rw [div_eq_iff (two_ne_zero' ℂ), sub_eq_iff_eq_add, neg_mul, ← sub_eq_neg_add, eq_sub_iff_add_eq] at hm exact ⟨m, by rw [← hm, mul_comm]⟩ -- At last the main proof [GOAL] s : ℂ hs : ∀ (n : ℕ), s ≠ -↑n hs' : s ≠ 1 hs_ne : s ≠ 0 h_sqrt : ↑(sqrt π) ≠ 0 h_pow : 2 ^ (s - 1) ≠ 0 h_Ga_ne1 : Complex.Gamma (s / 2) ≠ 0 h_Ga_eq : Complex.Gamma s = Complex.Gamma (s / 2) * Complex.Gamma ((s + 1) / 2) * 2 ^ (s - 1) / ↑(sqrt π) h_Ga_ne3 : Complex.Gamma ((s + 1) / 2) ≠ 0 hs_pos_odd : ¬∃ n, s = 1 + 2 * ↑n ⊢ Complex.Gamma ((1 - s) / 2) ≠ 0 [PROOFSTEP] rw [Ne.def, Complex.Gamma_eq_zero_iff] [GOAL] s : ℂ hs : ∀ (n : ℕ), s ≠ -↑n hs' : s ≠ 1 hs_ne : s ≠ 0 h_sqrt : ↑(sqrt π) ≠ 0 h_pow : 2 ^ (s - 1) ≠ 0 h_Ga_ne1 : Complex.Gamma (s / 2) ≠ 0 h_Ga_eq : Complex.Gamma s = Complex.Gamma (s / 2) * Complex.Gamma ((s + 1) / 2) * 2 ^ (s - 1) / ↑(sqrt π) h_Ga_ne3 : Complex.Gamma ((s + 1) / 2) ≠ 0 hs_pos_odd : ¬∃ n, s = 1 + 2 * ↑n ⊢ ¬∃ m, (1 - s) / 2 = -↑m [PROOFSTEP] contrapose! hs_pos_odd [GOAL] s : ℂ hs : ∀ (n : ℕ), s ≠ -↑n hs' : s ≠ 1 hs_ne : s ≠ 0 h_sqrt : ↑(sqrt π) ≠ 0 h_pow : 2 ^ (s - 1) ≠ 0 h_Ga_ne1 : Complex.Gamma (s / 2) ≠ 0 h_Ga_eq : Complex.Gamma s = Complex.Gamma (s / 2) * Complex.Gamma ((s + 1) / 2) * 2 ^ (s - 1) / ↑(sqrt π) h_Ga_ne3 : Complex.Gamma ((s + 1) / 2) ≠ 0 hs_pos_odd : ∃ m, (1 - s) / 2 = -↑m ⊢ ∃ n, s = 1 + 2 * ↑n [PROOFSTEP] obtain ⟨m, hm⟩ := hs_pos_odd [GOAL] case intro s : ℂ hs : ∀ (n : ℕ), s ≠ -↑n hs' : s ≠ 1 hs_ne : s ≠ 0 h_sqrt : ↑(sqrt π) ≠ 0 h_pow : 2 ^ (s - 1) ≠ 0 h_Ga_ne1 : Complex.Gamma (s / 2) ≠ 0 h_Ga_eq : Complex.Gamma s = Complex.Gamma (s / 2) * Complex.Gamma ((s + 1) / 2) * 2 ^ (s - 1) / ↑(sqrt π) h_Ga_ne3 : Complex.Gamma ((s + 1) / 2) ≠ 0 m : ℕ hm : (1 - s) / 2 = -↑m ⊢ ∃ n, s = 1 + 2 * ↑n [PROOFSTEP] rw [div_eq_iff (two_ne_zero' ℂ), sub_eq_iff_eq_add, neg_mul, ← sub_eq_neg_add, eq_sub_iff_add_eq] at hm [GOAL] case intro s : ℂ hs : ∀ (n : ℕ), s ≠ -↑n hs' : s ≠ 1 hs_ne : s ≠ 0 h_sqrt : ↑(sqrt π) ≠ 0 h_pow : 2 ^ (s - 1) ≠ 0 h_Ga_ne1 : Complex.Gamma (s / 2) ≠ 0 h_Ga_eq : Complex.Gamma s = Complex.Gamma (s / 2) * Complex.Gamma ((s + 1) / 2) * 2 ^ (s - 1) / ↑(sqrt π) h_Ga_ne3 : Complex.Gamma ((s + 1) / 2) ≠ 0 m : ℕ hm : 1 + ↑m * 2 = s ⊢ ∃ n, s = 1 + 2 * ↑n [PROOFSTEP] exact ⟨m, by rw [← hm, mul_comm]⟩ -- At last the main proof [GOAL] s : ℂ hs : ∀ (n : ℕ), s ≠ -↑n hs' : s ≠ 1 hs_ne : s ≠ 0 h_sqrt : ↑(sqrt π) ≠ 0 h_pow : 2 ^ (s - 1) ≠ 0 h_Ga_ne1 : Complex.Gamma (s / 2) ≠ 0 h_Ga_eq : Complex.Gamma s = Complex.Gamma (s / 2) * Complex.Gamma ((s + 1) / 2) * 2 ^ (s - 1) / ↑(sqrt π) h_Ga_ne3 : Complex.Gamma ((s + 1) / 2) ≠ 0 m : ℕ hm : 1 + ↑m * 2 = s ⊢ s = 1 + 2 * ↑m [PROOFSTEP] rw [← hm, mul_comm] [GOAL] case neg s : ℂ hs : ∀ (n : ℕ), s ≠ -↑n hs' : s ≠ 1 hs_ne : s ≠ 0 h_sqrt : ↑(sqrt π) ≠ 0 h_pow : 2 ^ (s - 1) ≠ 0 h_Ga_ne1 : Complex.Gamma (s / 2) ≠ 0 h_Ga_eq : Complex.Gamma s = Complex.Gamma (s / 2) * Complex.Gamma ((s + 1) / 2) * 2 ^ (s - 1) / ↑(sqrt π) h_Ga_ne3 : Complex.Gamma ((s + 1) / 2) ≠ 0 hs_pos_odd : ¬∃ n, s = 1 + 2 * ↑n h_Ga_ne4 : Complex.Gamma ((1 - s) / 2) ≠ 0 ⊢ Complex.Gamma (s / 2) * (↑π ^ ((1 - s) / 2) * riemannCompletedZeta s) / Complex.Gamma ((1 - s) / 2) = 2 ^ (1 - s) * ↑π ^ (-s) * Complex.Gamma s * Complex.sin (↑π * (1 - s) / 2) * (↑π ^ (s / 2) * riemannCompletedZeta s) [PROOFSTEP] rw [show sin (↑π * (1 - s) / 2) = π * (Gamma ((1 - s) / 2) * Gamma (s / 2 + 1 / 2))⁻¹ by have := congr_arg Inv.inv (Complex.Gamma_mul_Gamma_one_sub ((1 - s) / 2)).symm rwa [(by ring : 1 - (1 - s) / 2 = s / 2 + 1 / 2), inv_div, div_eq_iff (ofReal_ne_zero.mpr pi_pos.ne'), mul_comm _ (π : ℂ), mul_div_assoc'] at this ] [GOAL] s : ℂ hs : ∀ (n : ℕ), s ≠ -↑n hs' : s ≠ 1 hs_ne : s ≠ 0 h_sqrt : ↑(sqrt π) ≠ 0 h_pow : 2 ^ (s - 1) ≠ 0 h_Ga_ne1 : Complex.Gamma (s / 2) ≠ 0 h_Ga_eq : Complex.Gamma s = Complex.Gamma (s / 2) * Complex.Gamma ((s + 1) / 2) * 2 ^ (s - 1) / ↑(sqrt π) h_Ga_ne3 : Complex.Gamma ((s + 1) / 2) ≠ 0 hs_pos_odd : ¬∃ n, s = 1 + 2 * ↑n h_Ga_ne4 : Complex.Gamma ((1 - s) / 2) ≠ 0 ⊢ Complex.sin (↑π * (1 - s) / 2) = ↑π * (Complex.Gamma ((1 - s) / 2) * Complex.Gamma (s / 2 + 1 / 2))⁻¹ [PROOFSTEP] have := congr_arg Inv.inv (Complex.Gamma_mul_Gamma_one_sub ((1 - s) / 2)).symm [GOAL] s : ℂ hs : ∀ (n : ℕ), s ≠ -↑n hs' : s ≠ 1 hs_ne : s ≠ 0 h_sqrt : ↑(sqrt π) ≠ 0 h_pow : 2 ^ (s - 1) ≠ 0 h_Ga_ne1 : Complex.Gamma (s / 2) ≠ 0 h_Ga_eq : Complex.Gamma s = Complex.Gamma (s / 2) * Complex.Gamma ((s + 1) / 2) * 2 ^ (s - 1) / ↑(sqrt π) h_Ga_ne3 : Complex.Gamma ((s + 1) / 2) ≠ 0 hs_pos_odd : ¬∃ n, s = 1 + 2 * ↑n h_Ga_ne4 : Complex.Gamma ((1 - s) / 2) ≠ 0 this : (↑π / Complex.sin (↑π * ((1 - s) / 2)))⁻¹ = (Complex.Gamma ((1 - s) / 2) * Complex.Gamma (1 - (1 - s) / 2))⁻¹ ⊢ Complex.sin (↑π * (1 - s) / 2) = ↑π * (Complex.Gamma ((1 - s) / 2) * Complex.Gamma (s / 2 + 1 / 2))⁻¹ [PROOFSTEP] rwa [(by ring : 1 - (1 - s) / 2 = s / 2 + 1 / 2), inv_div, div_eq_iff (ofReal_ne_zero.mpr pi_pos.ne'), mul_comm _ (π : ℂ), mul_div_assoc'] at this [GOAL] s : ℂ hs : ∀ (n : ℕ), s ≠ -↑n hs' : s ≠ 1 hs_ne : s ≠ 0 h_sqrt : ↑(sqrt π) ≠ 0 h_pow : 2 ^ (s - 1) ≠ 0 h_Ga_ne1 : Complex.Gamma (s / 2) ≠ 0 h_Ga_eq : Complex.Gamma s = Complex.Gamma (s / 2) * Complex.Gamma ((s + 1) / 2) * 2 ^ (s - 1) / ↑(sqrt π) h_Ga_ne3 : Complex.Gamma ((s + 1) / 2) ≠ 0 hs_pos_odd : ¬∃ n, s = 1 + 2 * ↑n h_Ga_ne4 : Complex.Gamma ((1 - s) / 2) ≠ 0 this : (↑π / Complex.sin (↑π * ((1 - s) / 2)))⁻¹ = (Complex.Gamma ((1 - s) / 2) * Complex.Gamma (1 - (1 - s) / 2))⁻¹ ⊢ 1 - (1 - s) / 2 = s / 2 + 1 / 2 [PROOFSTEP] ring [GOAL] case neg s : ℂ hs : ∀ (n : ℕ), s ≠ -↑n hs' : s ≠ 1 hs_ne : s ≠ 0 h_sqrt : ↑(sqrt π) ≠ 0 h_pow : 2 ^ (s - 1) ≠ 0 h_Ga_ne1 : Complex.Gamma (s / 2) ≠ 0 h_Ga_eq : Complex.Gamma s = Complex.Gamma (s / 2) * Complex.Gamma ((s + 1) / 2) * 2 ^ (s - 1) / ↑(sqrt π) h_Ga_ne3 : Complex.Gamma ((s + 1) / 2) ≠ 0 hs_pos_odd : ¬∃ n, s = 1 + 2 * ↑n h_Ga_ne4 : Complex.Gamma ((1 - s) / 2) ≠ 0 ⊢ Complex.Gamma (s / 2) * (↑π ^ ((1 - s) / 2) * riemannCompletedZeta s) / Complex.Gamma ((1 - s) / 2) = 2 ^ (1 - s) * ↑π ^ (-s) * Complex.Gamma s * (↑π * (Complex.Gamma ((1 - s) / 2) * Complex.Gamma (s / 2 + 1 / 2))⁻¹) * (↑π ^ (s / 2) * riemannCompletedZeta s) [PROOFSTEP] rw [(by rw [← neg_sub] : (2 : ℂ) ^ (1 - s) = (2 : ℂ) ^ (-(s - 1))), cpow_neg, h_Ga_eq] [GOAL] s : ℂ hs : ∀ (n : ℕ), s ≠ -↑n hs' : s ≠ 1 hs_ne : s ≠ 0 h_sqrt : ↑(sqrt π) ≠ 0 h_pow : 2 ^ (s - 1) ≠ 0 h_Ga_ne1 : Complex.Gamma (s / 2) ≠ 0 h_Ga_eq : Complex.Gamma s = Complex.Gamma (s / 2) * Complex.Gamma ((s + 1) / 2) * 2 ^ (s - 1) / ↑(sqrt π) h_Ga_ne3 : Complex.Gamma ((s + 1) / 2) ≠ 0 hs_pos_odd : ¬∃ n, s = 1 + 2 * ↑n h_Ga_ne4 : Complex.Gamma ((1 - s) / 2) ≠ 0 ⊢ 2 ^ (1 - s) = 2 ^ (-(s - 1)) [PROOFSTEP] rw [← neg_sub] [GOAL] case neg s : ℂ hs : ∀ (n : ℕ), s ≠ -↑n hs' : s ≠ 1 hs_ne : s ≠ 0 h_sqrt : ↑(sqrt π) ≠ 0 h_pow : 2 ^ (s - 1) ≠ 0 h_Ga_ne1 : Complex.Gamma (s / 2) ≠ 0 h_Ga_eq : Complex.Gamma s = Complex.Gamma (s / 2) * Complex.Gamma ((s + 1) / 2) * 2 ^ (s - 1) / ↑(sqrt π) h_Ga_ne3 : Complex.Gamma ((s + 1) / 2) ≠ 0 hs_pos_odd : ¬∃ n, s = 1 + 2 * ↑n h_Ga_ne4 : Complex.Gamma ((1 - s) / 2) ≠ 0 ⊢ Complex.Gamma (s / 2) * (↑π ^ ((1 - s) / 2) * riemannCompletedZeta s) / Complex.Gamma ((1 - s) / 2) = (2 ^ (s - 1))⁻¹ * ↑π ^ (-s) * (Complex.Gamma (s / 2) * Complex.Gamma ((s + 1) / 2) * 2 ^ (s - 1) / ↑(sqrt π)) * (↑π * (Complex.Gamma ((1 - s) / 2) * Complex.Gamma (s / 2 + 1 / 2))⁻¹) * (↑π ^ (s / 2) * riemannCompletedZeta s) [PROOFSTEP] suffices (π : ℂ) ^ ((1 - s) / 2) = (π : ℂ) ^ (-s) * sqrt π * (π : ℂ) ^ (s / 2) by rw [this]; field_simp; ring_nf; rw [← ofReal_pow, sq_sqrt pi_pos.le]; ring [GOAL] s : ℂ hs : ∀ (n : ℕ), s ≠ -↑n hs' : s ≠ 1 hs_ne : s ≠ 0 h_sqrt : ↑(sqrt π) ≠ 0 h_pow : 2 ^ (s - 1) ≠ 0 h_Ga_ne1 : Complex.Gamma (s / 2) ≠ 0 h_Ga_eq : Complex.Gamma s = Complex.Gamma (s / 2) * Complex.Gamma ((s + 1) / 2) * 2 ^ (s - 1) / ↑(sqrt π) h_Ga_ne3 : Complex.Gamma ((s + 1) / 2) ≠ 0 hs_pos_odd : ¬∃ n, s = 1 + 2 * ↑n h_Ga_ne4 : Complex.Gamma ((1 - s) / 2) ≠ 0 this : ↑π ^ ((1 - s) / 2) = ↑π ^ (-s) * ↑(sqrt π) * ↑π ^ (s / 2) ⊢ Complex.Gamma (s / 2) * (↑π ^ ((1 - s) / 2) * riemannCompletedZeta s) / Complex.Gamma ((1 - s) / 2) = (2 ^ (s - 1))⁻¹ * ↑π ^ (-s) * (Complex.Gamma (s / 2) * Complex.Gamma ((s + 1) / 2) * 2 ^ (s - 1) / ↑(sqrt π)) * (↑π * (Complex.Gamma ((1 - s) / 2) * Complex.Gamma (s / 2 + 1 / 2))⁻¹) * (↑π ^ (s / 2) * riemannCompletedZeta s) [PROOFSTEP] rw [this] [GOAL] s : ℂ hs : ∀ (n : ℕ), s ≠ -↑n hs' : s ≠ 1 hs_ne : s ≠ 0 h_sqrt : ↑(sqrt π) ≠ 0 h_pow : 2 ^ (s - 1) ≠ 0 h_Ga_ne1 : Complex.Gamma (s / 2) ≠ 0 h_Ga_eq : Complex.Gamma s = Complex.Gamma (s / 2) * Complex.Gamma ((s + 1) / 2) * 2 ^ (s - 1) / ↑(sqrt π) h_Ga_ne3 : Complex.Gamma ((s + 1) / 2) ≠ 0 hs_pos_odd : ¬∃ n, s = 1 + 2 * ↑n h_Ga_ne4 : Complex.Gamma ((1 - s) / 2) ≠ 0 this : ↑π ^ ((1 - s) / 2) = ↑π ^ (-s) * ↑(sqrt π) * ↑π ^ (s / 2) ⊢ Complex.Gamma (s / 2) * (↑π ^ (-s) * ↑(sqrt π) * ↑π ^ (s / 2) * riemannCompletedZeta s) / Complex.Gamma ((1 - s) / 2) = (2 ^ (s - 1))⁻¹ * ↑π ^ (-s) * (Complex.Gamma (s / 2) * Complex.Gamma ((s + 1) / 2) * 2 ^ (s - 1) / ↑(sqrt π)) * (↑π * (Complex.Gamma ((1 - s) / 2) * Complex.Gamma (s / 2 + 1 / 2))⁻¹) * (↑π ^ (s / 2) * riemannCompletedZeta s) [PROOFSTEP] field_simp [GOAL] s : ℂ hs : ∀ (n : ℕ), s ≠ -↑n hs' : s ≠ 1 hs_ne : s ≠ 0 h_sqrt : ↑(sqrt π) ≠ 0 h_pow : 2 ^ (s - 1) ≠ 0 h_Ga_ne1 : Complex.Gamma (s / 2) ≠ 0 h_Ga_eq : Complex.Gamma s = Complex.Gamma (s / 2) * Complex.Gamma ((s + 1) / 2) * 2 ^ (s - 1) / ↑(sqrt π) h_Ga_ne3 : Complex.Gamma ((s + 1) / 2) ≠ 0 hs_pos_odd : ¬∃ n, s = 1 + 2 * ↑n h_Ga_ne4 : Complex.Gamma ((1 - s) / 2) ≠ 0 this : ↑π ^ ((1 - s) / 2) = ↑π ^ (-s) * ↑(sqrt π) * ↑π ^ (s / 2) ⊢ Complex.Gamma (s / 2) * (↑π ^ (-s) * ↑(sqrt π) * ↑π ^ (s / 2) * riemannCompletedZeta s) * (2 ^ (s - 1) * ↑(sqrt π) * (Complex.Gamma ((1 - s) / 2) * Complex.Gamma ((s + 1) / 2))) = ↑π ^ (-s) * (Complex.Gamma (s / 2) * Complex.Gamma ((s + 1) / 2) * 2 ^ (s - 1)) * ↑π * (↑π ^ (s / 2) * riemannCompletedZeta s) * Complex.Gamma ((1 - s) / 2) [PROOFSTEP] ring_nf [GOAL] s : ℂ hs : ∀ (n : ℕ), s ≠ -↑n hs' : s ≠ 1 hs_ne : s ≠ 0 h_sqrt : ↑(sqrt π) ≠ 0 h_pow : 2 ^ (s - 1) ≠ 0 h_Ga_ne1 : Complex.Gamma (s / 2) ≠ 0 h_Ga_eq : Complex.Gamma s = Complex.Gamma (s / 2) * Complex.Gamma ((s + 1) / 2) * 2 ^ (s - 1) / ↑(sqrt π) h_Ga_ne3 : Complex.Gamma ((s + 1) / 2) ≠ 0 hs_pos_odd : ¬∃ n, s = 1 + 2 * ↑n h_Ga_ne4 : Complex.Gamma ((1 - s) / 2) ≠ 0 this : ↑π ^ ((1 - s) / 2) = ↑π ^ (-s) * ↑(sqrt π) * ↑π ^ (s / 2) ⊢ Complex.Gamma (s * (↑(Int.ofNat 1) / ↑2)) * ↑π ^ (-s) * ↑(sqrt π) ^ 2 * ↑π ^ (s * (↑(Int.ofNat 1) / ↑2)) * riemannCompletedZeta s * 2 ^ (-1 + s) * Complex.Gamma (↑(Int.ofNat 1) / ↑2 + s * ↑(Int.negOfNat 1) * (↑(Int.ofNat 1) / ↑2)) * Complex.Gamma (↑(Int.ofNat 1) / ↑2 + s * (↑(Int.ofNat 1) / ↑2)) = Complex.Gamma (s * (↑(Int.ofNat 1) / ↑2)) * ↑π ^ (-s) * ↑π ^ (s * (↑(Int.ofNat 1) / ↑2)) * riemannCompletedZeta s * 2 ^ (-1 + s) * Complex.Gamma (↑(Int.ofNat 1) / ↑2 + s * ↑(Int.negOfNat 1) * (↑(Int.ofNat 1) / ↑2)) * Complex.Gamma (↑(Int.ofNat 1) / ↑2 + s * (↑(Int.ofNat 1) / ↑2)) * ↑π [PROOFSTEP] rw [← ofReal_pow, sq_sqrt pi_pos.le] [GOAL] s : ℂ hs : ∀ (n : ℕ), s ≠ -↑n hs' : s ≠ 1 hs_ne : s ≠ 0 h_sqrt : ↑(sqrt π) ≠ 0 h_pow : 2 ^ (s - 1) ≠ 0 h_Ga_ne1 : Complex.Gamma (s / 2) ≠ 0 h_Ga_eq : Complex.Gamma s = Complex.Gamma (s / 2) * Complex.Gamma ((s + 1) / 2) * 2 ^ (s - 1) / ↑(sqrt π) h_Ga_ne3 : Complex.Gamma ((s + 1) / 2) ≠ 0 hs_pos_odd : ¬∃ n, s = 1 + 2 * ↑n h_Ga_ne4 : Complex.Gamma ((1 - s) / 2) ≠ 0 this : ↑π ^ ((1 - s) / 2) = ↑π ^ (-s) * ↑(sqrt π) * ↑π ^ (s / 2) ⊢ Complex.Gamma (s * (↑(Int.ofNat 1) / ↑2)) * ↑π ^ (-s) * ↑π * ↑π ^ (s * (↑(Int.ofNat 1) / ↑2)) * riemannCompletedZeta s * 2 ^ (-1 + s) * Complex.Gamma (↑(Int.ofNat 1) / ↑2 + s * ↑(Int.negOfNat 1) * (↑(Int.ofNat 1) / ↑2)) * Complex.Gamma (↑(Int.ofNat 1) / ↑2 + s * (↑(Int.ofNat 1) / ↑2)) = Complex.Gamma (s * (↑(Int.ofNat 1) / ↑2)) * ↑π ^ (-s) * ↑π ^ (s * (↑(Int.ofNat 1) / ↑2)) * riemannCompletedZeta s * 2 ^ (-1 + s) * Complex.Gamma (↑(Int.ofNat 1) / ↑2 + s * ↑(Int.negOfNat 1) * (↑(Int.ofNat 1) / ↑2)) * Complex.Gamma (↑(Int.ofNat 1) / ↑2 + s * (↑(Int.ofNat 1) / ↑2)) * ↑π [PROOFSTEP] ring [GOAL] case neg s : ℂ hs : ∀ (n : ℕ), s ≠ -↑n hs' : s ≠ 1 hs_ne : s ≠ 0 h_sqrt : ↑(sqrt π) ≠ 0 h_pow : 2 ^ (s - 1) ≠ 0 h_Ga_ne1 : Complex.Gamma (s / 2) ≠ 0 h_Ga_eq : Complex.Gamma s = Complex.Gamma (s / 2) * Complex.Gamma ((s + 1) / 2) * 2 ^ (s - 1) / ↑(sqrt π) h_Ga_ne3 : Complex.Gamma ((s + 1) / 2) ≠ 0 hs_pos_odd : ¬∃ n, s = 1 + 2 * ↑n h_Ga_ne4 : Complex.Gamma ((1 - s) / 2) ≠ 0 ⊢ ↑π ^ ((1 - s) / 2) = ↑π ^ (-s) * ↑(sqrt π) * ↑π ^ (s / 2) [PROOFSTEP] simp_rw [sqrt_eq_rpow, ofReal_cpow pi_pos.le, ← cpow_add _ _ (ofReal_ne_zero.mpr pi_pos.ne')] [GOAL] case neg s : ℂ hs : ∀ (n : ℕ), s ≠ -↑n hs' : s ≠ 1 hs_ne : s ≠ 0 h_sqrt : ↑(sqrt π) ≠ 0 h_pow : 2 ^ (s - 1) ≠ 0 h_Ga_ne1 : Complex.Gamma (s / 2) ≠ 0 h_Ga_eq : Complex.Gamma s = Complex.Gamma (s / 2) * Complex.Gamma ((s + 1) / 2) * 2 ^ (s - 1) / ↑(sqrt π) h_Ga_ne3 : Complex.Gamma ((s + 1) / 2) ≠ 0 hs_pos_odd : ¬∃ n, s = 1 + 2 * ↑n h_Ga_ne4 : Complex.Gamma ((1 - s) / 2) ≠ 0 ⊢ ↑π ^ ((1 - s) / 2) = ↑π ^ (-s + ↑(1 / 2) + s / 2) [PROOFSTEP] congr 1 [GOAL] case neg.e_a s : ℂ hs : ∀ (n : ℕ), s ≠ -↑n hs' : s ≠ 1 hs_ne : s ≠ 0 h_sqrt : ↑(sqrt π) ≠ 0 h_pow : 2 ^ (s - 1) ≠ 0 h_Ga_ne1 : Complex.Gamma (s / 2) ≠ 0 h_Ga_eq : Complex.Gamma s = Complex.Gamma (s / 2) * Complex.Gamma ((s + 1) / 2) * 2 ^ (s - 1) / ↑(sqrt π) h_Ga_ne3 : Complex.Gamma ((s + 1) / 2) ≠ 0 hs_pos_odd : ¬∃ n, s = 1 + 2 * ↑n h_Ga_ne4 : Complex.Gamma ((1 - s) / 2) ≠ 0 ⊢ (1 - s) / 2 = -s + ↑(1 / 2) + s / 2 [PROOFSTEP] push_cast [GOAL] case neg.e_a s : ℂ hs : ∀ (n : ℕ), s ≠ -↑n hs' : s ≠ 1 hs_ne : s ≠ 0 h_sqrt : ↑(sqrt π) ≠ 0 h_pow : 2 ^ (s - 1) ≠ 0 h_Ga_ne1 : Complex.Gamma (s / 2) ≠ 0 h_Ga_eq : Complex.Gamma s = Complex.Gamma (s / 2) * Complex.Gamma ((s + 1) / 2) * 2 ^ (s - 1) / ↑(sqrt π) h_Ga_ne3 : Complex.Gamma ((s + 1) / 2) ≠ 0 hs_pos_odd : ¬∃ n, s = 1 + 2 * ↑n h_Ga_ne4 : Complex.Gamma ((1 - s) / 2) ≠ 0 ⊢ (1 - s) / 2 = -s + 1 / 2 + s / 2 [PROOFSTEP] field_simp [GOAL] case neg.e_a s : ℂ hs : ∀ (n : ℕ), s ≠ -↑n hs' : s ≠ 1 hs_ne : s ≠ 0 h_sqrt : ↑(sqrt π) ≠ 0 h_pow : 2 ^ (s - 1) ≠ 0 h_Ga_ne1 : Complex.Gamma (s / 2) ≠ 0 h_Ga_eq : Complex.Gamma s = Complex.Gamma (s / 2) * Complex.Gamma ((s + 1) / 2) * 2 ^ (s - 1) / ↑(sqrt π) h_Ga_ne3 : Complex.Gamma ((s + 1) / 2) ≠ 0 hs_pos_odd : ¬∃ n, s = 1 + 2 * ↑n h_Ga_ne4 : Complex.Gamma ((1 - s) / 2) ≠ 0 ⊢ 1 - s = -(s * 2) + 1 + s [PROOFSTEP] ring [GOAL] k : ℕ ⊢ riemannZeta (-↑k) = (-1) ^ k * ↑(bernoulli (k + 1)) / (↑k + 1) [PROOFSTEP] rcases Nat.even_or_odd' k with ⟨m, rfl | rfl⟩ [GOAL] case intro.inl m : ℕ ⊢ riemannZeta (-↑(2 * m)) = (-1) ^ (2 * m) * ↑(bernoulli (2 * m + 1)) / (↑(2 * m) + 1) [PROOFSTEP] cases' m with m m [GOAL] case intro.inl.zero ⊢ riemannZeta (-↑(2 * Nat.zero)) = (-1) ^ (2 * Nat.zero) * ↑(bernoulli (2 * Nat.zero + 1)) / (↑(2 * Nat.zero) + 1) [PROOFSTEP] rw [Nat.zero_eq, mul_zero, Nat.cast_zero, pow_zero, one_mul, zero_add, neg_zero, zero_add, div_one, bernoulli_one, riemannZeta_zero] [GOAL] case intro.inl.zero ⊢ -1 / 2 = ↑(-1 / 2) [PROOFSTEP] norm_num [GOAL] case intro.inl.succ m : ℕ ⊢ riemannZeta (-↑(2 * Nat.succ m)) = (-1) ^ (2 * Nat.succ m) * ↑(bernoulli (2 * Nat.succ m + 1)) / (↑(2 * Nat.succ m) + 1) [PROOFSTEP] rw [Nat.cast_mul, ← neg_mul, Nat.cast_two, Nat.cast_succ, riemannZeta_neg_two_mul_nat_add_one, bernoulli_eq_bernoulli'_of_ne_one] [GOAL] case intro.inl.succ m : ℕ ⊢ 0 = (-1) ^ (2 * Nat.succ m) * ↑(bernoulli' (2 * Nat.succ m + 1)) / (2 * (↑m + 1) + 1) case intro.inl.succ m : ℕ ⊢ 2 * Nat.succ m + 1 ≠ 1 [PROOFSTEP] swap [GOAL] case intro.inl.succ m : ℕ ⊢ 2 * Nat.succ m + 1 ≠ 1 [PROOFSTEP] apply ne_of_gt [GOAL] case intro.inl.succ.h m : ℕ ⊢ 1 < 2 * Nat.succ m + 1 [PROOFSTEP] norm_num [GOAL] case intro.inl.succ m : ℕ ⊢ 0 = (-1) ^ (2 * Nat.succ m) * ↑(bernoulli' (2 * Nat.succ m + 1)) / (2 * (↑m + 1) + 1) [PROOFSTEP] rw [bernoulli'_odd_eq_zero ⟨m + 1, rfl⟩ (by norm_num), Rat.cast_zero, mul_zero, zero_div] [GOAL] m : ℕ ⊢ 1 < 2 * (m + 1) + 1 [PROOFSTEP] norm_num [GOAL] case intro.inr m : ℕ ⊢ riemannZeta (-↑(2 * m + 1)) = (-1) ^ (2 * m + 1) * ↑(bernoulli (2 * m + 1 + 1)) / (↑(2 * m + 1) + 1) [PROOFSTEP] rw [Odd.neg_one_pow ⟨m, rfl⟩] [GOAL] case intro.inr m : ℕ ⊢ riemannZeta (-↑(2 * m + 1)) = -1 * ↑(bernoulli (2 * m + 1 + 1)) / (↑(2 * m + 1) + 1) [PROOFSTEP] rw [show -(↑(2 * m + 1) : ℂ) = 1 - (2 * m + 2) by push_cast ; ring] [GOAL] m : ℕ ⊢ -↑(2 * m + 1) = 1 - (2 * ↑m + 2) [PROOFSTEP] push_cast [GOAL] m : ℕ ⊢ -(2 * ↑m + 1) = 1 - (2 * ↑m + 2) [PROOFSTEP] ring [GOAL] case intro.inr m : ℕ ⊢ riemannZeta (1 - (2 * ↑m + 2)) = -1 * ↑(bernoulli (2 * m + 1 + 1)) / (↑(2 * m + 1) + 1) [PROOFSTEP] rw [riemannZeta_one_sub] [GOAL] case intro.inr m : ℕ ⊢ 2 ^ (1 - (2 * ↑m + 2)) * ↑π ^ (-(2 * ↑m + 2)) * Complex.Gamma (2 * ↑m + 2) * Complex.sin (↑π * (1 - (2 * ↑m + 2)) / 2) * riemannZeta (2 * ↑m + 2) = -1 * ↑(bernoulli (2 * m + 1 + 1)) / (↑(2 * m + 1) + 1) case intro.inr.hs m : ℕ ⊢ ∀ (n : ℕ), 2 * ↑m + 2 ≠ -↑n case intro.inr.hs' m : ℕ ⊢ 2 * ↑m + 2 ≠ 1 [PROOFSTEP] rotate_left [GOAL] case intro.inr.hs m : ℕ ⊢ ∀ (n : ℕ), 2 * ↑m + 2 ≠ -↑n [PROOFSTEP] intro n [GOAL] case intro.inr.hs m n : ℕ ⊢ 2 * ↑m + 2 ≠ -↑n [PROOFSTEP] rw [(by norm_cast : 2 * (m : ℂ) + 2 = ↑(2 * m + 2)), ← Int.cast_neg_natCast, ← Int.cast_ofNat, Ne.def, Int.cast_inj] [GOAL] m n : ℕ ⊢ 2 * ↑m + 2 = ↑(2 * m + 2) [PROOFSTEP] norm_cast [GOAL] case intro.inr.hs m n : ℕ ⊢ ¬↑(2 * m + 2) = -↑n [PROOFSTEP] apply ne_of_gt [GOAL] case intro.inr.hs.h m n : ℕ ⊢ -↑n < ↑(2 * m + 2) [PROOFSTEP] exact lt_of_le_of_lt (by norm_num : (-n : ℤ) ≤ 0) (by positivity) [GOAL] m n : ℕ ⊢ -↑n ≤ 0 [PROOFSTEP] norm_num [GOAL] m n : ℕ ⊢ 0 < ↑(2 * m + 2) [PROOFSTEP] positivity [GOAL] case intro.inr.hs' m : ℕ ⊢ 2 * ↑m + 2 ≠ 1 [PROOFSTEP] rw [(by norm_cast : 2 * (m : ℂ) + 2 = ↑(2 * m + 2)), Ne.def, Nat.cast_eq_one] [GOAL] m : ℕ ⊢ 2 * ↑m + 2 = ↑(2 * m + 2) [PROOFSTEP] norm_cast [GOAL] case intro.inr.hs' m : ℕ ⊢ ¬2 * m + 2 = 1 [PROOFSTEP] norm_num -- get rid of sine term [GOAL] case intro.inr m : ℕ ⊢ 2 ^ (1 - (2 * ↑m + 2)) * ↑π ^ (-(2 * ↑m + 2)) * Complex.Gamma (2 * ↑m + 2) * Complex.sin (↑π * (1 - (2 * ↑m + 2)) / 2) * riemannZeta (2 * ↑m + 2) = -1 * ↑(bernoulli (2 * m + 1 + 1)) / (↑(2 * m + 1) + 1) [PROOFSTEP] rw [show Complex.sin (↑π * (1 - (2 * ↑m + 2)) / 2) = -(-1 : ℂ) ^ m by rw [(by field_simp; ring : (π : ℂ) * (1 - (2 * ↑m + 2)) / 2 = π / 2 - (π * m + π))] rw [Complex.sin_pi_div_two_sub, Complex.cos_add_pi, neg_inj] rcases Nat.even_or_odd' m with ⟨t, rfl | rfl⟩ · rw [pow_mul, neg_one_sq, one_pow] convert Complex.cos_nat_mul_two_pi t using 2 push_cast ; ring_nf · rw [pow_add, pow_one, pow_mul, neg_one_sq, one_pow, one_mul] convert Complex.cos_nat_mul_two_pi_add_pi t using 2 push_cast ; ring_nf] -- substitute in what we know about zeta values at positive integers [GOAL] m : ℕ ⊢ Complex.sin (↑π * (1 - (2 * ↑m + 2)) / 2) = -(-1) ^ m [PROOFSTEP] rw [(by field_simp; ring : (π : ℂ) * (1 - (2 * ↑m + 2)) / 2 = π / 2 - (π * m + π))] [GOAL] m : ℕ ⊢ ↑π * (1 - (2 * ↑m + 2)) / 2 = ↑π / 2 - (↑π * ↑m + ↑π) [PROOFSTEP] field_simp [GOAL] m : ℕ ⊢ ↑π * (1 - (2 * ↑m + 2)) = ↑π - 2 * (↑π * ↑m + ↑π) [PROOFSTEP] ring [GOAL] m : ℕ ⊢ Complex.sin (↑π / 2 - (↑π * ↑m + ↑π)) = -(-1) ^ m [PROOFSTEP] rw [Complex.sin_pi_div_two_sub, Complex.cos_add_pi, neg_inj] [GOAL] m : ℕ ⊢ Complex.cos (↑π * ↑m) = (-1) ^ m [PROOFSTEP] rcases Nat.even_or_odd' m with ⟨t, rfl | rfl⟩ [GOAL] case intro.inl t : ℕ ⊢ Complex.cos (↑π * ↑(2 * t)) = (-1) ^ (2 * t) [PROOFSTEP] rw [pow_mul, neg_one_sq, one_pow] [GOAL] case intro.inl t : ℕ ⊢ Complex.cos (↑π * ↑(2 * t)) = 1 [PROOFSTEP] convert Complex.cos_nat_mul_two_pi t using 2 [GOAL] case h.e'_2.h.e'_1 t : ℕ ⊢ ↑π * ↑(2 * t) = ↑t * (2 * ↑π) [PROOFSTEP] push_cast [GOAL] case h.e'_2.h.e'_1 t : ℕ ⊢ ↑π * (2 * ↑t) = ↑t * (2 * ↑π) [PROOFSTEP] ring_nf [GOAL] case intro.inr t : ℕ ⊢ Complex.cos (↑π * ↑(2 * t + 1)) = (-1) ^ (2 * t + 1) [PROOFSTEP] rw [pow_add, pow_one, pow_mul, neg_one_sq, one_pow, one_mul] [GOAL] case intro.inr t : ℕ ⊢ Complex.cos (↑π * ↑(2 * t + 1)) = -1 [PROOFSTEP] convert Complex.cos_nat_mul_two_pi_add_pi t using 2 [GOAL] case h.e'_2.h.e'_1 t : ℕ ⊢ ↑π * ↑(2 * t + 1) = ↑t * (2 * ↑π) + ↑π [PROOFSTEP] push_cast [GOAL] case h.e'_2.h.e'_1 t : ℕ ⊢ ↑π * (2 * ↑t + 1) = ↑t * (2 * ↑π) + ↑π [PROOFSTEP] ring_nf [GOAL] case intro.inr m : ℕ ⊢ 2 ^ (1 - (2 * ↑m + 2)) * ↑π ^ (-(2 * ↑m + 2)) * Complex.Gamma (2 * ↑m + 2) * -(-1) ^ m * riemannZeta (2 * ↑m + 2) = -1 * ↑(bernoulli (2 * m + 1 + 1)) / (↑(2 * m + 1) + 1) [PROOFSTEP] have step1 := congr_arg ((↑) : ℝ → ℂ) (hasSum_zeta_nat (by norm_num : m + 1 ≠ 0)).tsum_eq [GOAL] m : ℕ ⊢ m + 1 ≠ 0 [PROOFSTEP] norm_num [GOAL] case intro.inr m : ℕ step1 : ↑(∑' (b : ℕ), 1 / ↑b ^ (2 * (m + 1))) = ↑((-1) ^ (m + 1 + 1) * 2 ^ (2 * (m + 1) - 1) * π ^ (2 * (m + 1)) * ↑(bernoulli (2 * (m + 1))) / ↑(2 * (m + 1))!) ⊢ 2 ^ (1 - (2 * ↑m + 2)) * ↑π ^ (-(2 * ↑m + 2)) * Complex.Gamma (2 * ↑m + 2) * -(-1) ^ m * riemannZeta (2 * ↑m + 2) = -1 * ↑(bernoulli (2 * m + 1 + 1)) / (↑(2 * m + 1) + 1) [PROOFSTEP] have step2 := zeta_nat_eq_tsum_of_gt_one (by rw [mul_add]; norm_num : 1 < 2 * (m + 1)) [GOAL] m : ℕ step1 : ↑(∑' (b : ℕ), 1 / ↑b ^ (2 * (m + 1))) = ↑((-1) ^ (m + 1 + 1) * 2 ^ (2 * (m + 1) - 1) * π ^ (2 * (m + 1)) * ↑(bernoulli (2 * (m + 1))) / ↑(2 * (m + 1))!) ⊢ 1 < 2 * (m + 1) [PROOFSTEP] rw [mul_add] [GOAL] m : ℕ step1 : ↑(∑' (b : ℕ), 1 / ↑b ^ (2 * (m + 1))) = ↑((-1) ^ (m + 1 + 1) * 2 ^ (2 * (m + 1) - 1) * π ^ (2 * (m + 1)) * ↑(bernoulli (2 * (m + 1))) / ↑(2 * (m + 1))!) ⊢ 1 < 2 * m + 2 * 1 [PROOFSTEP] norm_num [GOAL] case intro.inr m : ℕ step1 : ↑(∑' (b : ℕ), 1 / ↑b ^ (2 * (m + 1))) = ↑((-1) ^ (m + 1 + 1) * 2 ^ (2 * (m + 1) - 1) * π ^ (2 * (m + 1)) * ↑(bernoulli (2 * (m + 1))) / ↑(2 * (m + 1))!) step2 : riemannZeta ↑(2 * (m + 1)) = ∑' (n : ℕ), 1 / ↑n ^ (2 * (m + 1)) ⊢ 2 ^ (1 - (2 * ↑m + 2)) * ↑π ^ (-(2 * ↑m + 2)) * Complex.Gamma (2 * ↑m + 2) * -(-1) ^ m * riemannZeta (2 * ↑m + 2) = -1 * ↑(bernoulli (2 * m + 1 + 1)) / (↑(2 * m + 1) + 1) [PROOFSTEP] simp_rw [ofReal_tsum, ofReal_div, ofReal_one, ofReal_pow, ofReal_nat_cast] at step1 [GOAL] case intro.inr m : ℕ step2 : riemannZeta ↑(2 * (m + 1)) = ∑' (n : ℕ), 1 / ↑n ^ (2 * (m + 1)) step1 : ∑' (a : ℕ), 1 / ↑a ^ (2 * (m + 1)) = ↑((-1) ^ (m + 1 + 1) * 2 ^ (2 * (m + 1) - 1) * π ^ (2 * (m + 1)) * ↑(bernoulli (2 * (m + 1)))) / ↑(2 * (m + 1))! ⊢ 2 ^ (1 - (2 * ↑m + 2)) * ↑π ^ (-(2 * ↑m + 2)) * Complex.Gamma (2 * ↑m + 2) * -(-1) ^ m * riemannZeta (2 * ↑m + 2) = -1 * ↑(bernoulli (2 * m + 1 + 1)) / (↑(2 * m + 1) + 1) [PROOFSTEP] rw [step1, (by norm_cast : (↑(2 * (m + 1)) : ℂ) = 2 * ↑m + 2)] at step2 [GOAL] m : ℕ step2 : riemannZeta ↑(2 * (m + 1)) = ↑((-1) ^ (m + 1 + 1) * 2 ^ (2 * (m + 1) - 1) * π ^ (2 * (m + 1)) * ↑(bernoulli (2 * (m + 1)))) / ↑(2 * (m + 1))! step1 : ∑' (a : ℕ), 1 / ↑a ^ (2 * (m + 1)) = ↑((-1) ^ (m + 1 + 1) * 2 ^ (2 * (m + 1) - 1) * π ^ (2 * (m + 1)) * ↑(bernoulli (2 * (m + 1)))) / ↑(2 * (m + 1))! ⊢ ↑(2 * (m + 1)) = 2 * ↑m + 2 [PROOFSTEP] norm_cast [GOAL] case intro.inr m : ℕ step2 : riemannZeta (2 * ↑m + 2) = ↑((-1) ^ (m + 1 + 1) * 2 ^ (2 * (m + 1) - 1) * π ^ (2 * (m + 1)) * ↑(bernoulli (2 * (m + 1)))) / ↑(2 * (m + 1))! step1 : ∑' (a : ℕ), 1 / ↑a ^ (2 * (m + 1)) = ↑((-1) ^ (m + 1 + 1) * 2 ^ (2 * (m + 1) - 1) * π ^ (2 * (m + 1)) * ↑(bernoulli (2 * (m + 1)))) / ↑(2 * (m + 1))! ⊢ 2 ^ (1 - (2 * ↑m + 2)) * ↑π ^ (-(2 * ↑m + 2)) * Complex.Gamma (2 * ↑m + 2) * -(-1) ^ m * riemannZeta (2 * ↑m + 2) = -1 * ↑(bernoulli (2 * m + 1 + 1)) / (↑(2 * m + 1) + 1) [PROOFSTEP] rw [step2, mul_div] -- now the rest is just a lengthy but elementary rearrangement [GOAL] case intro.inr m : ℕ step2 : riemannZeta (2 * ↑m + 2) = ↑((-1) ^ (m + 1 + 1) * 2 ^ (2 * (m + 1) - 1) * π ^ (2 * (m + 1)) * ↑(bernoulli (2 * (m + 1)))) / ↑(2 * (m + 1))! step1 : ∑' (a : ℕ), 1 / ↑a ^ (2 * (m + 1)) = ↑((-1) ^ (m + 1 + 1) * 2 ^ (2 * (m + 1) - 1) * π ^ (2 * (m + 1)) * ↑(bernoulli (2 * (m + 1)))) / ↑(2 * (m + 1))! ⊢ 2 ^ (1 - (2 * ↑m + 2)) * ↑π ^ (-(2 * ↑m + 2)) * Complex.Gamma (2 * ↑m + 2) * -(-1) ^ m * ↑((-1) ^ (m + 1 + 1) * 2 ^ (2 * (m + 1) - 1) * π ^ (2 * (m + 1)) * ↑(bernoulli (2 * (m + 1)))) / ↑(2 * (m + 1))! = -1 * ↑(bernoulli (2 * m + 1 + 1)) / (↑(2 * m + 1) + 1) [PROOFSTEP] rw [show ((2 * (m + 1))! : ℂ) = Complex.Gamma (2 * m + 2) * (↑(2 * m + 1) + 1) by rw [(by push_cast ; ring : (2 * m + 2 : ℂ) = ↑(2 * m + 1) + 1), Complex.Gamma_nat_eq_factorial, (by ring : 2 * (m + 1) = 2 * m + 1 + 1), Nat.factorial_succ, Nat.cast_mul, mul_comm] norm_num] [GOAL] m : ℕ step2 : riemannZeta (2 * ↑m + 2) = ↑((-1) ^ (m + 1 + 1) * 2 ^ (2 * (m + 1) - 1) * π ^ (2 * (m + 1)) * ↑(bernoulli (2 * (m + 1)))) / ↑(2 * (m + 1))! step1 : ∑' (a : ℕ), 1 / ↑a ^ (2 * (m + 1)) = ↑((-1) ^ (m + 1 + 1) * 2 ^ (2 * (m + 1) - 1) * π ^ (2 * (m + 1)) * ↑(bernoulli (2 * (m + 1)))) / ↑(2 * (m + 1))! ⊢ ↑(2 * (m + 1))! = Complex.Gamma (2 * ↑m + 2) * (↑(2 * m + 1) + 1) [PROOFSTEP] rw [(by push_cast ; ring : (2 * m + 2 : ℂ) = ↑(2 * m + 1) + 1), Complex.Gamma_nat_eq_factorial, (by ring : 2 * (m + 1) = 2 * m + 1 + 1), Nat.factorial_succ, Nat.cast_mul, mul_comm] [GOAL] m : ℕ step2 : riemannZeta (2 * ↑m + 2) = ↑((-1) ^ (m + 1 + 1) * 2 ^ (2 * (m + 1) - 1) * π ^ (2 * (m + 1)) * ↑(bernoulli (2 * (m + 1)))) / ↑(2 * (m + 1))! step1 : ∑' (a : ℕ), 1 / ↑a ^ (2 * (m + 1)) = ↑((-1) ^ (m + 1 + 1) * 2 ^ (2 * (m + 1) - 1) * π ^ (2 * (m + 1)) * ↑(bernoulli (2 * (m + 1)))) / ↑(2 * (m + 1))! ⊢ 2 * ↑m + 2 = ↑(2 * m + 1) + 1 [PROOFSTEP] push_cast [GOAL] m : ℕ step2 : riemannZeta (2 * ↑m + 2) = ↑((-1) ^ (m + 1 + 1) * 2 ^ (2 * (m + 1) - 1) * π ^ (2 * (m + 1)) * ↑(bernoulli (2 * (m + 1)))) / ↑(2 * (m + 1))! step1 : ∑' (a : ℕ), 1 / ↑a ^ (2 * (m + 1)) = ↑((-1) ^ (m + 1 + 1) * 2 ^ (2 * (m + 1) - 1) * π ^ (2 * (m + 1)) * ↑(bernoulli (2 * (m + 1)))) / ↑(2 * (m + 1))! ⊢ 2 * ↑m + 2 = 2 * ↑m + 1 + 1 [PROOFSTEP] ring [GOAL] m : ℕ step2 : riemannZeta (2 * ↑m + 2) = ↑((-1) ^ (m + 1 + 1) * 2 ^ (2 * (m + 1) - 1) * π ^ (2 * (m + 1)) * ↑(bernoulli (2 * (m + 1)))) / ↑(2 * (m + 1))! step1 : ∑' (a : ℕ), 1 / ↑a ^ (2 * (m + 1)) = ↑((-1) ^ (m + 1 + 1) * 2 ^ (2 * (m + 1) - 1) * π ^ (2 * (m + 1)) * ↑(bernoulli (2 * (m + 1)))) / ↑(2 * (m + 1))! ⊢ 2 * (m + 1) = 2 * m + 1 + 1 [PROOFSTEP] ring [GOAL] m : ℕ step2 : riemannZeta (2 * ↑m + 2) = ↑((-1) ^ (m + 1 + 1) * 2 ^ (2 * (m + 1) - 1) * π ^ (2 * (m + 1)) * ↑(bernoulli (2 * (m + 1)))) / ↑(2 * (m + 1))! step1 : ∑' (a : ℕ), 1 / ↑a ^ (2 * (m + 1)) = ↑((-1) ^ (m + 1 + 1) * 2 ^ (2 * (m + 1) - 1) * π ^ (2 * (m + 1)) * ↑(bernoulli (2 * (m + 1)))) / ↑(2 * (m + 1))! ⊢ ↑(2 * m + 1)! * ↑(2 * m + 1 + 1) = ↑(2 * m + 1)! * (↑(2 * m + 1) + 1) [PROOFSTEP] norm_num [GOAL] case intro.inr m : ℕ step2 : riemannZeta (2 * ↑m + 2) = ↑((-1) ^ (m + 1 + 1) * 2 ^ (2 * (m + 1) - 1) * π ^ (2 * (m + 1)) * ↑(bernoulli (2 * (m + 1)))) / ↑(2 * (m + 1))! step1 : ∑' (a : ℕ), 1 / ↑a ^ (2 * (m + 1)) = ↑((-1) ^ (m + 1 + 1) * 2 ^ (2 * (m + 1) - 1) * π ^ (2 * (m + 1)) * ↑(bernoulli (2 * (m + 1)))) / ↑(2 * (m + 1))! ⊢ 2 ^ (1 - (2 * ↑m + 2)) * ↑π ^ (-(2 * ↑m + 2)) * Complex.Gamma (2 * ↑m + 2) * -(-1) ^ m * ↑((-1) ^ (m + 1 + 1) * 2 ^ (2 * (m + 1) - 1) * π ^ (2 * (m + 1)) * ↑(bernoulli (2 * (m + 1)))) / (Complex.Gamma (2 * ↑m + 2) * (↑(2 * m + 1) + 1)) = -1 * ↑(bernoulli (2 * m + 1 + 1)) / (↑(2 * m + 1) + 1) [PROOFSTEP] rw [← div_div, neg_one_mul] [GOAL] case intro.inr m : ℕ step2 : riemannZeta (2 * ↑m + 2) = ↑((-1) ^ (m + 1 + 1) * 2 ^ (2 * (m + 1) - 1) * π ^ (2 * (m + 1)) * ↑(bernoulli (2 * (m + 1)))) / ↑(2 * (m + 1))! step1 : ∑' (a : ℕ), 1 / ↑a ^ (2 * (m + 1)) = ↑((-1) ^ (m + 1 + 1) * 2 ^ (2 * (m + 1) - 1) * π ^ (2 * (m + 1)) * ↑(bernoulli (2 * (m + 1)))) / ↑(2 * (m + 1))! ⊢ 2 ^ (1 - (2 * ↑m + 2)) * ↑π ^ (-(2 * ↑m + 2)) * Complex.Gamma (2 * ↑m + 2) * -(-1) ^ m * ↑((-1) ^ (m + 1 + 1) * 2 ^ (2 * (m + 1) - 1) * π ^ (2 * (m + 1)) * ↑(bernoulli (2 * (m + 1)))) / Complex.Gamma (2 * ↑m + 2) / (↑(2 * m + 1) + 1) = -↑(bernoulli (2 * m + 1 + 1)) / (↑(2 * m + 1) + 1) [PROOFSTEP] congr 1 [GOAL] case intro.inr.e_a m : ℕ step2 : riemannZeta (2 * ↑m + 2) = ↑((-1) ^ (m + 1 + 1) * 2 ^ (2 * (m + 1) - 1) * π ^ (2 * (m + 1)) * ↑(bernoulli (2 * (m + 1)))) / ↑(2 * (m + 1))! step1 : ∑' (a : ℕ), 1 / ↑a ^ (2 * (m + 1)) = ↑((-1) ^ (m + 1 + 1) * 2 ^ (2 * (m + 1) - 1) * π ^ (2 * (m + 1)) * ↑(bernoulli (2 * (m + 1)))) / ↑(2 * (m + 1))! ⊢ 2 ^ (1 - (2 * ↑m + 2)) * ↑π ^ (-(2 * ↑m + 2)) * Complex.Gamma (2 * ↑m + 2) * -(-1) ^ m * ↑((-1) ^ (m + 1 + 1) * 2 ^ (2 * (m + 1) - 1) * π ^ (2 * (m + 1)) * ↑(bernoulli (2 * (m + 1)))) / Complex.Gamma (2 * ↑m + 2) = -↑(bernoulli (2 * m + 1 + 1)) [PROOFSTEP] rw [div_eq_iff (Gamma_ne_zero_of_re_pos _)] [GOAL] case intro.inr.e_a m : ℕ step2 : riemannZeta (2 * ↑m + 2) = ↑((-1) ^ (m + 1 + 1) * 2 ^ (2 * (m + 1) - 1) * π ^ (2 * (m + 1)) * ↑(bernoulli (2 * (m + 1)))) / ↑(2 * (m + 1))! step1 : ∑' (a : ℕ), 1 / ↑a ^ (2 * (m + 1)) = ↑((-1) ^ (m + 1 + 1) * 2 ^ (2 * (m + 1) - 1) * π ^ (2 * (m + 1)) * ↑(bernoulli (2 * (m + 1)))) / ↑(2 * (m + 1))! ⊢ 2 ^ (1 - (2 * ↑m + 2)) * ↑π ^ (-(2 * ↑m + 2)) * Complex.Gamma (2 * ↑m + 2) * -(-1) ^ m * ↑((-1) ^ (m + 1 + 1) * 2 ^ (2 * (m + 1) - 1) * π ^ (2 * (m + 1)) * ↑(bernoulli (2 * (m + 1)))) = -↑(bernoulli (2 * m + 1 + 1)) * Complex.Gamma (2 * ↑m + 2) m : ℕ step2 : riemannZeta (2 * ↑m + 2) = ↑((-1) ^ (m + 1 + 1) * 2 ^ (2 * (m + 1) - 1) * π ^ (2 * (m + 1)) * ↑(bernoulli (2 * (m + 1)))) / ↑(2 * (m + 1))! step1 : ∑' (a : ℕ), 1 / ↑a ^ (2 * (m + 1)) = ↑((-1) ^ (m + 1 + 1) * 2 ^ (2 * (m + 1) - 1) * π ^ (2 * (m + 1)) * ↑(bernoulli (2 * (m + 1)))) / ↑(2 * (m + 1))! ⊢ 0 < (2 * ↑m + 2).re [PROOFSTEP] swap [GOAL] m : ℕ step2 : riemannZeta (2 * ↑m + 2) = ↑((-1) ^ (m + 1 + 1) * 2 ^ (2 * (m + 1) - 1) * π ^ (2 * (m + 1)) * ↑(bernoulli (2 * (m + 1)))) / ↑(2 * (m + 1))! step1 : ∑' (a : ℕ), 1 / ↑a ^ (2 * (m + 1)) = ↑((-1) ^ (m + 1 + 1) * 2 ^ (2 * (m + 1) - 1) * π ^ (2 * (m + 1)) * ↑(bernoulli (2 * (m + 1)))) / ↑(2 * (m + 1))! ⊢ 0 < (2 * ↑m + 2).re [PROOFSTEP] rw [(by norm_num : 2 * (m : ℂ) + 2 = ↑(2 * (m : ℝ) + 2)), ofReal_re] [GOAL] m : ℕ step2 : riemannZeta (2 * ↑m + 2) = ↑((-1) ^ (m + 1 + 1) * 2 ^ (2 * (m + 1) - 1) * π ^ (2 * (m + 1)) * ↑(bernoulli (2 * (m + 1)))) / ↑(2 * (m + 1))! step1 : ∑' (a : ℕ), 1 / ↑a ^ (2 * (m + 1)) = ↑((-1) ^ (m + 1 + 1) * 2 ^ (2 * (m + 1) - 1) * π ^ (2 * (m + 1)) * ↑(bernoulli (2 * (m + 1)))) / ↑(2 * (m + 1))! ⊢ 2 * ↑m + 2 = ↑(2 * ↑m + 2) [PROOFSTEP] norm_num [GOAL] m : ℕ step2 : riemannZeta (2 * ↑m + 2) = ↑((-1) ^ (m + 1 + 1) * 2 ^ (2 * (m + 1) - 1) * π ^ (2 * (m + 1)) * ↑(bernoulli (2 * (m + 1)))) / ↑(2 * (m + 1))! step1 : ∑' (a : ℕ), 1 / ↑a ^ (2 * (m + 1)) = ↑((-1) ^ (m + 1 + 1) * 2 ^ (2 * (m + 1) - 1) * π ^ (2 * (m + 1)) * ↑(bernoulli (2 * (m + 1)))) / ↑(2 * (m + 1))! ⊢ 0 < 2 * ↑m + 2 [PROOFSTEP] positivity [GOAL] case intro.inr.e_a m : ℕ step2 : riemannZeta (2 * ↑m + 2) = ↑((-1) ^ (m + 1 + 1) * 2 ^ (2 * (m + 1) - 1) * π ^ (2 * (m + 1)) * ↑(bernoulli (2 * (m + 1)))) / ↑(2 * (m + 1))! step1 : ∑' (a : ℕ), 1 / ↑a ^ (2 * (m + 1)) = ↑((-1) ^ (m + 1 + 1) * 2 ^ (2 * (m + 1) - 1) * π ^ (2 * (m + 1)) * ↑(bernoulli (2 * (m + 1)))) / ↑(2 * (m + 1))! ⊢ 2 ^ (1 - (2 * ↑m + 2)) * ↑π ^ (-(2 * ↑m + 2)) * Complex.Gamma (2 * ↑m + 2) * -(-1) ^ m * ↑((-1) ^ (m + 1 + 1) * 2 ^ (2 * (m + 1) - 1) * π ^ (2 * (m + 1)) * ↑(bernoulli (2 * (m + 1)))) = -↑(bernoulli (2 * m + 1 + 1)) * Complex.Gamma (2 * ↑m + 2) [PROOFSTEP] simp_rw [ofReal_mul, ← mul_assoc, ofReal_rat_cast, mul_add, Nat.add_assoc, mul_one, one_add_one_eq_two, mul_neg, neg_mul, neg_inj] [GOAL] case intro.inr.e_a m : ℕ step2 : riemannZeta (2 * ↑m + 2) = ↑((-1) ^ (m + 1 + 1) * 2 ^ (2 * (m + 1) - 1) * π ^ (2 * (m + 1)) * ↑(bernoulli (2 * (m + 1)))) / ↑(2 * (m + 1))! step1 : ∑' (a : ℕ), 1 / ↑a ^ (2 * (m + 1)) = ↑((-1) ^ (m + 1 + 1) * 2 ^ (2 * (m + 1) - 1) * π ^ (2 * (m + 1)) * ↑(bernoulli (2 * (m + 1)))) / ↑(2 * (m + 1))! ⊢ 2 ^ (1 - (2 * ↑m + 2)) * ↑π ^ (-(2 * ↑m + 2)) * Complex.Gamma (2 * ↑m + 2) * (-1) ^ m * ↑((-1) ^ (m + 2)) * ↑(2 ^ (2 * m + 2 - 1)) * ↑(π ^ (2 * m + 2)) * ↑(bernoulli (2 * m + 2)) = ↑(bernoulli (2 * m + 2)) * Complex.Gamma (2 * ↑m + 2) [PROOFSTEP] conv_rhs => rw [mul_comm] [GOAL] m : ℕ step2 : riemannZeta (2 * ↑m + 2) = ↑((-1) ^ (m + 1 + 1) * 2 ^ (2 * (m + 1) - 1) * π ^ (2 * (m + 1)) * ↑(bernoulli (2 * (m + 1)))) / ↑(2 * (m + 1))! step1 : ∑' (a : ℕ), 1 / ↑a ^ (2 * (m + 1)) = ↑((-1) ^ (m + 1 + 1) * 2 ^ (2 * (m + 1) - 1) * π ^ (2 * (m + 1)) * ↑(bernoulli (2 * (m + 1)))) / ↑(2 * (m + 1))! | ↑(bernoulli (2 * m + 2)) * Complex.Gamma (2 * ↑m + 2) [PROOFSTEP] rw [mul_comm] [GOAL] m : ℕ step2 : riemannZeta (2 * ↑m + 2) = ↑((-1) ^ (m + 1 + 1) * 2 ^ (2 * (m + 1) - 1) * π ^ (2 * (m + 1)) * ↑(bernoulli (2 * (m + 1)))) / ↑(2 * (m + 1))! step1 : ∑' (a : ℕ), 1 / ↑a ^ (2 * (m + 1)) = ↑((-1) ^ (m + 1 + 1) * 2 ^ (2 * (m + 1) - 1) * π ^ (2 * (m + 1)) * ↑(bernoulli (2 * (m + 1)))) / ↑(2 * (m + 1))! | ↑(bernoulli (2 * m + 2)) * Complex.Gamma (2 * ↑m + 2) [PROOFSTEP] rw [mul_comm] [GOAL] m : ℕ step2 : riemannZeta (2 * ↑m + 2) = ↑((-1) ^ (m + 1 + 1) * 2 ^ (2 * (m + 1) - 1) * π ^ (2 * (m + 1)) * ↑(bernoulli (2 * (m + 1)))) / ↑(2 * (m + 1))! step1 : ∑' (a : ℕ), 1 / ↑a ^ (2 * (m + 1)) = ↑((-1) ^ (m + 1 + 1) * 2 ^ (2 * (m + 1) - 1) * π ^ (2 * (m + 1)) * ↑(bernoulli (2 * (m + 1)))) / ↑(2 * (m + 1))! | ↑(bernoulli (2 * m + 2)) * Complex.Gamma (2 * ↑m + 2) [PROOFSTEP] rw [mul_comm] [GOAL] case intro.inr.e_a m : ℕ step2 : riemannZeta (2 * ↑m + 2) = ↑((-1) ^ (m + 1 + 1) * 2 ^ (2 * (m + 1) - 1) * π ^ (2 * (m + 1)) * ↑(bernoulli (2 * (m + 1)))) / ↑(2 * (m + 1))! step1 : ∑' (a : ℕ), 1 / ↑a ^ (2 * (m + 1)) = ↑((-1) ^ (m + 1 + 1) * 2 ^ (2 * (m + 1) - 1) * π ^ (2 * (m + 1)) * ↑(bernoulli (2 * (m + 1)))) / ↑(2 * (m + 1))! ⊢ 2 ^ (1 - (2 * ↑m + 2)) * ↑π ^ (-(2 * ↑m + 2)) * Complex.Gamma (2 * ↑m + 2) * (-1) ^ m * ↑((-1) ^ (m + 2)) * ↑(2 ^ (2 * m + 2 - 1)) * ↑(π ^ (2 * m + 2)) * ↑(bernoulli (2 * m + 2)) = Complex.Gamma (2 * ↑m + 2) * ↑(bernoulli (2 * m + 2)) [PROOFSTEP] congr 1 [GOAL] case intro.inr.e_a.e_a m : ℕ step2 : riemannZeta (2 * ↑m + 2) = ↑((-1) ^ (m + 1 + 1) * 2 ^ (2 * (m + 1) - 1) * π ^ (2 * (m + 1)) * ↑(bernoulli (2 * (m + 1)))) / ↑(2 * (m + 1))! step1 : ∑' (a : ℕ), 1 / ↑a ^ (2 * (m + 1)) = ↑((-1) ^ (m + 1 + 1) * 2 ^ (2 * (m + 1) - 1) * π ^ (2 * (m + 1)) * ↑(bernoulli (2 * (m + 1)))) / ↑(2 * (m + 1))! ⊢ 2 ^ (1 - (2 * ↑m + 2)) * ↑π ^ (-(2 * ↑m + 2)) * Complex.Gamma (2 * ↑m + 2) * (-1) ^ m * ↑((-1) ^ (m + 2)) * ↑(2 ^ (2 * m + 2 - 1)) * ↑(π ^ (2 * m + 2)) = Complex.Gamma (2 * ↑m + 2) [PROOFSTEP] rw [ofReal_pow, ofReal_neg, ofReal_one, pow_add, neg_one_sq, mul_one] [GOAL] case intro.inr.e_a.e_a m : ℕ step2 : riemannZeta (2 * ↑m + 2) = ↑((-1) ^ (m + 1 + 1) * 2 ^ (2 * (m + 1) - 1) * π ^ (2 * (m + 1)) * ↑(bernoulli (2 * (m + 1)))) / ↑(2 * (m + 1))! step1 : ∑' (a : ℕ), 1 / ↑a ^ (2 * (m + 1)) = ↑((-1) ^ (m + 1 + 1) * 2 ^ (2 * (m + 1) - 1) * π ^ (2 * (m + 1)) * ↑(bernoulli (2 * (m + 1)))) / ↑(2 * (m + 1))! ⊢ 2 ^ (1 - (2 * ↑m + 2)) * ↑π ^ (-(2 * ↑m + 2)) * Complex.Gamma (2 * ↑m + 2) * (-1) ^ m * (-1) ^ m * ↑(2 ^ (2 * m + 2 - 1)) * ↑(π ^ (2 * m + 2)) = Complex.Gamma (2 * ↑m + 2) [PROOFSTEP] conv_lhs => congr congr rw [mul_assoc, ← pow_add, ← two_mul, pow_mul, neg_one_sq, one_pow, mul_one] [GOAL] m : ℕ step2 : riemannZeta (2 * ↑m + 2) = ↑((-1) ^ (m + 1 + 1) * 2 ^ (2 * (m + 1) - 1) * π ^ (2 * (m + 1)) * ↑(bernoulli (2 * (m + 1)))) / ↑(2 * (m + 1))! step1 : ∑' (a : ℕ), 1 / ↑a ^ (2 * (m + 1)) = ↑((-1) ^ (m + 1 + 1) * 2 ^ (2 * (m + 1) - 1) * π ^ (2 * (m + 1)) * ↑(bernoulli (2 * (m + 1)))) / ↑(2 * (m + 1))! | 2 ^ (1 - (2 * ↑m + 2)) * ↑π ^ (-(2 * ↑m + 2)) * Complex.Gamma (2 * ↑m + 2) * (-1) ^ m * (-1) ^ m * ↑(2 ^ (2 * m + 2 - 1)) * ↑(π ^ (2 * m + 2)) [PROOFSTEP] congr congr rw [mul_assoc, ← pow_add, ← two_mul, pow_mul, neg_one_sq, one_pow, mul_one] [GOAL] m : ℕ step2 : riemannZeta (2 * ↑m + 2) = ↑((-1) ^ (m + 1 + 1) * 2 ^ (2 * (m + 1) - 1) * π ^ (2 * (m + 1)) * ↑(bernoulli (2 * (m + 1)))) / ↑(2 * (m + 1))! step1 : ∑' (a : ℕ), 1 / ↑a ^ (2 * (m + 1)) = ↑((-1) ^ (m + 1 + 1) * 2 ^ (2 * (m + 1) - 1) * π ^ (2 * (m + 1)) * ↑(bernoulli (2 * (m + 1)))) / ↑(2 * (m + 1))! | 2 ^ (1 - (2 * ↑m + 2)) * ↑π ^ (-(2 * ↑m + 2)) * Complex.Gamma (2 * ↑m + 2) * (-1) ^ m * (-1) ^ m * ↑(2 ^ (2 * m + 2 - 1)) * ↑(π ^ (2 * m + 2)) [PROOFSTEP] congr congr rw [mul_assoc, ← pow_add, ← two_mul, pow_mul, neg_one_sq, one_pow, mul_one] [GOAL] m : ℕ step2 : riemannZeta (2 * ↑m + 2) = ↑((-1) ^ (m + 1 + 1) * 2 ^ (2 * (m + 1) - 1) * π ^ (2 * (m + 1)) * ↑(bernoulli (2 * (m + 1)))) / ↑(2 * (m + 1))! step1 : ∑' (a : ℕ), 1 / ↑a ^ (2 * (m + 1)) = ↑((-1) ^ (m + 1 + 1) * 2 ^ (2 * (m + 1) - 1) * π ^ (2 * (m + 1)) * ↑(bernoulli (2 * (m + 1)))) / ↑(2 * (m + 1))! | 2 ^ (1 - (2 * ↑m + 2)) * ↑π ^ (-(2 * ↑m + 2)) * Complex.Gamma (2 * ↑m + 2) * (-1) ^ m * (-1) ^ m * ↑(2 ^ (2 * m + 2 - 1)) * ↑(π ^ (2 * m + 2)) [PROOFSTEP] congr [GOAL] case a m : ℕ step2 : riemannZeta (2 * ↑m + 2) = ↑((-1) ^ (m + 1 + 1) * 2 ^ (2 * (m + 1) - 1) * π ^ (2 * (m + 1)) * ↑(bernoulli (2 * (m + 1)))) / ↑(2 * (m + 1))! step1 : ∑' (a : ℕ), 1 / ↑a ^ (2 * (m + 1)) = ↑((-1) ^ (m + 1 + 1) * 2 ^ (2 * (m + 1) - 1) * π ^ (2 * (m + 1)) * ↑(bernoulli (2 * (m + 1)))) / ↑(2 * (m + 1))! | 2 ^ (1 - (2 * ↑m + 2)) * ↑π ^ (-(2 * ↑m + 2)) * Complex.Gamma (2 * ↑m + 2) * (-1) ^ m * (-1) ^ m * ↑(2 ^ (2 * m + 2 - 1)) case a m : ℕ step2 : riemannZeta (2 * ↑m + 2) = ↑((-1) ^ (m + 1 + 1) * 2 ^ (2 * (m + 1) - 1) * π ^ (2 * (m + 1)) * ↑(bernoulli (2 * (m + 1)))) / ↑(2 * (m + 1))! step1 : ∑' (a : ℕ), 1 / ↑a ^ (2 * (m + 1)) = ↑((-1) ^ (m + 1 + 1) * 2 ^ (2 * (m + 1) - 1) * π ^ (2 * (m + 1)) * ↑(bernoulli (2 * (m + 1)))) / ↑(2 * (m + 1))! | ↑(π ^ (2 * m + 2)) [PROOFSTEP] congr [GOAL] case a.a m : ℕ step2 : riemannZeta (2 * ↑m + 2) = ↑((-1) ^ (m + 1 + 1) * 2 ^ (2 * (m + 1) - 1) * π ^ (2 * (m + 1)) * ↑(bernoulli (2 * (m + 1)))) / ↑(2 * (m + 1))! step1 : ∑' (a : ℕ), 1 / ↑a ^ (2 * (m + 1)) = ↑((-1) ^ (m + 1 + 1) * 2 ^ (2 * (m + 1) - 1) * π ^ (2 * (m + 1)) * ↑(bernoulli (2 * (m + 1)))) / ↑(2 * (m + 1))! | 2 ^ (1 - (2 * ↑m + 2)) * ↑π ^ (-(2 * ↑m + 2)) * Complex.Gamma (2 * ↑m + 2) * (-1) ^ m * (-1) ^ m case a.a m : ℕ step2 : riemannZeta (2 * ↑m + 2) = ↑((-1) ^ (m + 1 + 1) * 2 ^ (2 * (m + 1) - 1) * π ^ (2 * (m + 1)) * ↑(bernoulli (2 * (m + 1)))) / ↑(2 * (m + 1))! step1 : ∑' (a : ℕ), 1 / ↑a ^ (2 * (m + 1)) = ↑((-1) ^ (m + 1 + 1) * 2 ^ (2 * (m + 1) - 1) * π ^ (2 * (m + 1)) * ↑(bernoulli (2 * (m + 1)))) / ↑(2 * (m + 1))! | ↑(2 ^ (2 * m + 2 - 1)) case a m : ℕ step2 : riemannZeta (2 * ↑m + 2) = ↑((-1) ^ (m + 1 + 1) * 2 ^ (2 * (m + 1) - 1) * π ^ (2 * (m + 1)) * ↑(bernoulli (2 * (m + 1)))) / ↑(2 * (m + 1))! step1 : ∑' (a : ℕ), 1 / ↑a ^ (2 * (m + 1)) = ↑((-1) ^ (m + 1 + 1) * 2 ^ (2 * (m + 1) - 1) * π ^ (2 * (m + 1)) * ↑(bernoulli (2 * (m + 1)))) / ↑(2 * (m + 1))! | ↑(π ^ (2 * m + 2)) [PROOFSTEP] rw [mul_assoc, ← pow_add, ← two_mul, pow_mul, neg_one_sq, one_pow, mul_one] [GOAL] case intro.inr.e_a.e_a m : ℕ step2 : riemannZeta (2 * ↑m + 2) = ↑((-1) ^ (m + 1 + 1) * 2 ^ (2 * (m + 1) - 1) * π ^ (2 * (m + 1)) * ↑(bernoulli (2 * (m + 1)))) / ↑(2 * (m + 1))! step1 : ∑' (a : ℕ), 1 / ↑a ^ (2 * (m + 1)) = ↑((-1) ^ (m + 1 + 1) * 2 ^ (2 * (m + 1) - 1) * π ^ (2 * (m + 1)) * ↑(bernoulli (2 * (m + 1)))) / ↑(2 * (m + 1))! ⊢ 2 ^ (1 - (2 * ↑m + 2)) * ↑π ^ (-(2 * ↑m + 2)) * Complex.Gamma (2 * ↑m + 2) * ↑(2 ^ (2 * m + 2 - 1)) * ↑(π ^ (2 * m + 2)) = Complex.Gamma (2 * ↑m + 2) [PROOFSTEP] rw [show (2 : ℂ) ^ (1 - (2 * (m : ℂ) + 2)) = (↑((2 : ℝ) ^ (2 * m + 2 - 1)))⁻¹ by rw [ofReal_pow, ← cpow_nat_cast, ← cpow_neg, show (2 : ℝ) = (2 : ℂ) by norm_num] congr 1 rw [Nat.add_sub_assoc one_le_two, Nat.cast_add, Nat.cast_mul, Nat.cast_two, (by norm_num : 2 - 1 = 1)] push_cast ; ring] [GOAL] m : ℕ step2 : riemannZeta (2 * ↑m + 2) = ↑((-1) ^ (m + 1 + 1) * 2 ^ (2 * (m + 1) - 1) * π ^ (2 * (m + 1)) * ↑(bernoulli (2 * (m + 1)))) / ↑(2 * (m + 1))! step1 : ∑' (a : ℕ), 1 / ↑a ^ (2 * (m + 1)) = ↑((-1) ^ (m + 1 + 1) * 2 ^ (2 * (m + 1) - 1) * π ^ (2 * (m + 1)) * ↑(bernoulli (2 * (m + 1)))) / ↑(2 * (m + 1))! ⊢ 2 ^ (1 - (2 * ↑m + 2)) = (↑(2 ^ (2 * m + 2 - 1)))⁻¹ [PROOFSTEP] rw [ofReal_pow, ← cpow_nat_cast, ← cpow_neg, show (2 : ℝ) = (2 : ℂ) by norm_num] [GOAL] m : ℕ step2 : riemannZeta (2 * ↑m + 2) = ↑((-1) ^ (m + 1 + 1) * 2 ^ (2 * (m + 1) - 1) * π ^ (2 * (m + 1)) * ↑(bernoulli (2 * (m + 1)))) / ↑(2 * (m + 1))! step1 : ∑' (a : ℕ), 1 / ↑a ^ (2 * (m + 1)) = ↑((-1) ^ (m + 1 + 1) * 2 ^ (2 * (m + 1) - 1) * π ^ (2 * (m + 1)) * ↑(bernoulli (2 * (m + 1)))) / ↑(2 * (m + 1))! ⊢ ↑2 = 2 [PROOFSTEP] norm_num [GOAL] m : ℕ step2 : riemannZeta (2 * ↑m + 2) = ↑((-1) ^ (m + 1 + 1) * 2 ^ (2 * (m + 1) - 1) * π ^ (2 * (m + 1)) * ↑(bernoulli (2 * (m + 1)))) / ↑(2 * (m + 1))! step1 : ∑' (a : ℕ), 1 / ↑a ^ (2 * (m + 1)) = ↑((-1) ^ (m + 1 + 1) * 2 ^ (2 * (m + 1) - 1) * π ^ (2 * (m + 1)) * ↑(bernoulli (2 * (m + 1)))) / ↑(2 * (m + 1))! ⊢ 2 ^ (1 - (2 * ↑m + 2)) = 2 ^ (-↑(2 * m + 2 - 1)) [PROOFSTEP] congr 1 [GOAL] case e_a m : ℕ step2 : riemannZeta (2 * ↑m + 2) = ↑((-1) ^ (m + 1 + 1) * 2 ^ (2 * (m + 1) - 1) * π ^ (2 * (m + 1)) * ↑(bernoulli (2 * (m + 1)))) / ↑(2 * (m + 1))! step1 : ∑' (a : ℕ), 1 / ↑a ^ (2 * (m + 1)) = ↑((-1) ^ (m + 1 + 1) * 2 ^ (2 * (m + 1) - 1) * π ^ (2 * (m + 1)) * ↑(bernoulli (2 * (m + 1)))) / ↑(2 * (m + 1))! ⊢ 1 - (2 * ↑m + 2) = -↑(2 * m + 2 - 1) [PROOFSTEP] rw [Nat.add_sub_assoc one_le_two, Nat.cast_add, Nat.cast_mul, Nat.cast_two, (by norm_num : 2 - 1 = 1)] [GOAL] m : ℕ step2 : riemannZeta (2 * ↑m + 2) = ↑((-1) ^ (m + 1 + 1) * 2 ^ (2 * (m + 1) - 1) * π ^ (2 * (m + 1)) * ↑(bernoulli (2 * (m + 1)))) / ↑(2 * (m + 1))! step1 : ∑' (a : ℕ), 1 / ↑a ^ (2 * (m + 1)) = ↑((-1) ^ (m + 1 + 1) * 2 ^ (2 * (m + 1) - 1) * π ^ (2 * (m + 1)) * ↑(bernoulli (2 * (m + 1)))) / ↑(2 * (m + 1))! ⊢ 2 - 1 = 1 [PROOFSTEP] norm_num [GOAL] case e_a m : ℕ step2 : riemannZeta (2 * ↑m + 2) = ↑((-1) ^ (m + 1 + 1) * 2 ^ (2 * (m + 1) - 1) * π ^ (2 * (m + 1)) * ↑(bernoulli (2 * (m + 1)))) / ↑(2 * (m + 1))! step1 : ∑' (a : ℕ), 1 / ↑a ^ (2 * (m + 1)) = ↑((-1) ^ (m + 1 + 1) * 2 ^ (2 * (m + 1) - 1) * π ^ (2 * (m + 1)) * ↑(bernoulli (2 * (m + 1)))) / ↑(2 * (m + 1))! ⊢ 1 - (2 * ↑m + 2) = -(2 * ↑m + ↑1) [PROOFSTEP] push_cast [GOAL] case e_a m : ℕ step2 : riemannZeta (2 * ↑m + 2) = ↑((-1) ^ (m + 1 + 1) * 2 ^ (2 * (m + 1) - 1) * π ^ (2 * (m + 1)) * ↑(bernoulli (2 * (m + 1)))) / ↑(2 * (m + 1))! step1 : ∑' (a : ℕ), 1 / ↑a ^ (2 * (m + 1)) = ↑((-1) ^ (m + 1 + 1) * 2 ^ (2 * (m + 1) - 1) * π ^ (2 * (m + 1)) * ↑(bernoulli (2 * (m + 1)))) / ↑(2 * (m + 1))! ⊢ 1 - (2 * ↑m + 2) = -(2 * ↑m + 1) [PROOFSTEP] ring [GOAL] case intro.inr.e_a.e_a m : ℕ step2 : riemannZeta (2 * ↑m + 2) = ↑((-1) ^ (m + 1 + 1) * 2 ^ (2 * (m + 1) - 1) * π ^ (2 * (m + 1)) * ↑(bernoulli (2 * (m + 1)))) / ↑(2 * (m + 1))! step1 : ∑' (a : ℕ), 1 / ↑a ^ (2 * (m + 1)) = ↑((-1) ^ (m + 1 + 1) * 2 ^ (2 * (m + 1) - 1) * π ^ (2 * (m + 1)) * ↑(bernoulli (2 * (m + 1)))) / ↑(2 * (m + 1))! ⊢ (↑(2 ^ (2 * m + 2 - 1)))⁻¹ * ↑π ^ (-(2 * ↑m + 2)) * Complex.Gamma (2 * ↑m + 2) * ↑(2 ^ (2 * m + 2 - 1)) * ↑(π ^ (2 * m + 2)) = Complex.Gamma (2 * ↑m + 2) [PROOFSTEP] rw [show (π : ℂ) ^ (-(2 * (m : ℂ) + 2)) = (↑(π ^ (2 * m + 2)))⁻¹ by rw [ofReal_pow, ← cpow_nat_cast, ← cpow_neg, Nat.cast_add, Nat.cast_mul, Nat.cast_two]] [GOAL] m : ℕ step2 : riemannZeta (2 * ↑m + 2) = ↑((-1) ^ (m + 1 + 1) * 2 ^ (2 * (m + 1) - 1) * π ^ (2 * (m + 1)) * ↑(bernoulli (2 * (m + 1)))) / ↑(2 * (m + 1))! step1 : ∑' (a : ℕ), 1 / ↑a ^ (2 * (m + 1)) = ↑((-1) ^ (m + 1 + 1) * 2 ^ (2 * (m + 1) - 1) * π ^ (2 * (m + 1)) * ↑(bernoulli (2 * (m + 1)))) / ↑(2 * (m + 1))! ⊢ ↑π ^ (-(2 * ↑m + 2)) = (↑(π ^ (2 * m + 2)))⁻¹ [PROOFSTEP] rw [ofReal_pow, ← cpow_nat_cast, ← cpow_neg, Nat.cast_add, Nat.cast_mul, Nat.cast_two] [GOAL] case intro.inr.e_a.e_a m : ℕ step2 : riemannZeta (2 * ↑m + 2) = ↑((-1) ^ (m + 1 + 1) * 2 ^ (2 * (m + 1) - 1) * π ^ (2 * (m + 1)) * ↑(bernoulli (2 * (m + 1)))) / ↑(2 * (m + 1))! step1 : ∑' (a : ℕ), 1 / ↑a ^ (2 * (m + 1)) = ↑((-1) ^ (m + 1 + 1) * 2 ^ (2 * (m + 1) - 1) * π ^ (2 * (m + 1)) * ↑(bernoulli (2 * (m + 1)))) / ↑(2 * (m + 1))! ⊢ (↑(2 ^ (2 * m + 2 - 1)))⁻¹ * (↑(π ^ (2 * m + 2)))⁻¹ * Complex.Gamma (2 * ↑m + 2) * ↑(2 ^ (2 * m + 2 - 1)) * ↑(π ^ (2 * m + 2)) = Complex.Gamma (2 * ↑m + 2) [PROOFSTEP] rw [(by intros; ring : ∀ a b c d e : ℂ, a * b * c * d * e = a * d * (b * e) * c)] [GOAL] m : ℕ step2 : riemannZeta (2 * ↑m + 2) = ↑((-1) ^ (m + 1 + 1) * 2 ^ (2 * (m + 1) - 1) * π ^ (2 * (m + 1)) * ↑(bernoulli (2 * (m + 1)))) / ↑(2 * (m + 1))! step1 : ∑' (a : ℕ), 1 / ↑a ^ (2 * (m + 1)) = ↑((-1) ^ (m + 1 + 1) * 2 ^ (2 * (m + 1) - 1) * π ^ (2 * (m + 1)) * ↑(bernoulli (2 * (m + 1)))) / ↑(2 * (m + 1))! ⊢ ∀ (a b c d e : ℂ), a * b * c * d * e = a * d * (b * e) * c [PROOFSTEP] intros [GOAL] m : ℕ step2 : riemannZeta (2 * ↑m + 2) = ↑((-1) ^ (m + 1 + 1) * 2 ^ (2 * (m + 1) - 1) * π ^ (2 * (m + 1)) * ↑(bernoulli (2 * (m + 1)))) / ↑(2 * (m + 1))! step1 : ∑' (a : ℕ), 1 / ↑a ^ (2 * (m + 1)) = ↑((-1) ^ (m + 1 + 1) * 2 ^ (2 * (m + 1) - 1) * π ^ (2 * (m + 1)) * ↑(bernoulli (2 * (m + 1)))) / ↑(2 * (m + 1))! a✝ b✝ c✝ d✝ e✝ : ℂ ⊢ a✝ * b✝ * c✝ * d✝ * e✝ = a✝ * d✝ * (b✝ * e✝) * c✝ [PROOFSTEP] ring [GOAL] case intro.inr.e_a.e_a m : ℕ step2 : riemannZeta (2 * ↑m + 2) = ↑((-1) ^ (m + 1 + 1) * 2 ^ (2 * (m + 1) - 1) * π ^ (2 * (m + 1)) * ↑(bernoulli (2 * (m + 1)))) / ↑(2 * (m + 1))! step1 : ∑' (a : ℕ), 1 / ↑a ^ (2 * (m + 1)) = ↑((-1) ^ (m + 1 + 1) * 2 ^ (2 * (m + 1) - 1) * π ^ (2 * (m + 1)) * ↑(bernoulli (2 * (m + 1)))) / ↑(2 * (m + 1))! ⊢ (↑(2 ^ (2 * m + 2 - 1)))⁻¹ * ↑(2 ^ (2 * m + 2 - 1)) * ((↑(π ^ (2 * m + 2)))⁻¹ * ↑(π ^ (2 * m + 2))) * Complex.Gamma (2 * ↑m + 2) = Complex.Gamma (2 * ↑m + 2) [PROOFSTEP] rw [inv_mul_cancel (ofReal_ne_zero.mpr <| pow_ne_zero _ pi_pos.ne'), inv_mul_cancel (ofReal_ne_zero.mpr <| pow_ne_zero _ two_ne_zero), one_mul, one_mul]
import algebra.char_p.basic import ring_theory.localization import algebra.free_algebra namespace ring_char lemma of_prime_eq_zero {A : Type*} [non_assoc_semiring A] [nontrivial A] {p : ℕ} (hprime : nat.prime p) (hp0 : (p : A) = 0) : ring_char A = p := begin have hchar : ring_char A ∣ p := ring_char.dvd hp0, unfold nat.prime at hprime, have heq := hprime.2 (ring_char A) hchar, cases heq, { exfalso, exact char_p.ring_char_ne_one heq }, { exact heq }, end lemma lt_char {A : Type*} [non_assoc_semiring A] {n : ℕ} : (n : A) = 0 → n < ring_char A → n = 0 := begin rw spec A n, exact nat.eq_zero_of_dvd_of_lt, end lemma lt_char_field {A : Type*} [field A] {n : ℕ} : (n : A) = 0 → n < ring_char A → n = 0 := begin rw spec A n, exact nat.eq_zero_of_dvd_of_lt, end end ring_char /-- If the algebra map `R →+* A` is injective then `A` has the same characteristic as `R`. -/ lemma char_p_of_injective_algebra_map {R A : Type*} [comm_semiring R] [semiring A] [algebra R A] (h : function.injective (algebra_map R A)) (p : ℕ) [char_p R p] : char_p A p := { cast_eq_zero_iff := λx, begin rw ←char_p.cast_eq_zero_iff R p x, change algebra_map ℕ A x = 0 ↔ algebra_map ℕ R x = 0, rw is_scalar_tower.algebra_map_apply ℕ R A x, refine iff.trans _ h.eq_iff, rw ring_hom.map_zero, end }
import category_theory.equivalence open category_theory variables {C : Type*} [category C] variables {D : Type*} [category D] lemma equiv_reflects_mono {X Y : C} (f : X ⟶ Y) (e : C ≌ D) (hef : mono (e.functor.map f)) : mono f := begin split, intros Z g h w, -- Let's think about the maths here. -- We're trying to prove an equation between morphisms in `C`, -- but the only thing we know, namely `hef`, lives over in `D`. -- So lets use the injectivity of an equivalence at the level of morphisms: apply e.functor.map_injective, sorry end
/- Copyright (c) 2020 Joseph Myers. All rights reserved. Released under Apache 2.0 license as described in the file LICENSE. Authors: Joseph Myers ! This file was ported from Lean 3 source module linear_algebra.affine_space.affine_subspace ! leanprover-community/mathlib commit cb3ceec8485239a61ed51d944cb9a95b68c6bafc ! Please do not edit these lines, except to modify the commit id ! if you have ported upstream changes. -/ import Mathbin.LinearAlgebra.AffineSpace.AffineEquiv /-! # Affine spaces > THIS FILE IS SYNCHRONIZED WITH MATHLIB4. > Any changes to this file require a corresponding PR to mathlib4. This file defines affine subspaces (over modules) and the affine span of a set of points. ## Main definitions * `affine_subspace k P` is the type of affine subspaces. Unlike affine spaces, affine subspaces are allowed to be empty, and lemmas that do not apply to empty affine subspaces have `nonempty` hypotheses. There is a `complete_lattice` structure on affine subspaces. * `affine_subspace.direction` gives the `submodule` spanned by the pairwise differences of points in an `affine_subspace`. There are various lemmas relating to the set of vectors in the `direction`, and relating the lattice structure on affine subspaces to that on their directions. * `affine_subspace.parallel`, notation `∥`, gives the property of two affine subspaces being parallel (one being a translate of the other). * `affine_span` gives the affine subspace spanned by a set of points, with `vector_span` giving its direction. `affine_span` is defined in terms of `span_points`, which gives an explicit description of the points contained in the affine span; `span_points` itself should generally only be used when that description is required, with `affine_span` being the main definition for other purposes. Two other descriptions of the affine span are proved equivalent: it is the `Inf` of affine subspaces containing the points, and (if `[nontrivial k]`) it contains exactly those points that are affine combinations of points in the given set. ## Implementation notes `out_param` is used in the definiton of `add_torsor V P` to make `V` an implicit argument (deduced from `P`) in most cases; `include V` is needed in many cases for `V`, and type classes using it, to be added as implicit arguments to individual lemmas. As for modules, `k` is an explicit argument rather than implied by `P` or `V`. This file only provides purely algebraic definitions and results. Those depending on analysis or topology are defined elsewhere; see `analysis.normed_space.add_torsor` and `topology.algebra.affine`. ## References * https://en.wikipedia.org/wiki/Affine_space * https://en.wikipedia.org/wiki/Principal_homogeneous_space -/ noncomputable section open BigOperators Affine open Set section variable (k : Type _) {V : Type _} {P : Type _} [Ring k] [AddCommGroup V] [Module k V] variable [affine_space V P] include V #print vectorSpan /- /-- The submodule spanning the differences of a (possibly empty) set of points. -/ def vectorSpan (s : Set P) : Submodule k V := Submodule.span k (s -ᵥ s) #align vector_span vectorSpan -/ #print vectorSpan_def /- /-- The definition of `vector_span`, for rewriting. -/ theorem vectorSpan_def (s : Set P) : vectorSpan k s = Submodule.span k (s -ᵥ s) := rfl #align vector_span_def vectorSpan_def -/ /- warning: vector_span_mono -> vectorSpan_mono is a dubious translation: lean 3 declaration is forall (k : Type.{u1}) {V : Type.{u2}} {P : Type.{u3}} [_inst_1 : Ring.{u1} k] [_inst_2 : AddCommGroup.{u2} V] [_inst_3 : Module.{u1, u2} k V (Ring.toSemiring.{u1} k _inst_1) (AddCommGroup.toAddCommMonoid.{u2} V _inst_2)] [_inst_4 : AddTorsor.{u2, u3} V P (AddCommGroup.toAddGroup.{u2} V _inst_2)] {s₁ : Set.{u3} P} {s₂ : Set.{u3} P}, (HasSubset.Subset.{u3} (Set.{u3} P) (Set.hasSubset.{u3} P) s₁ s₂) -> (LE.le.{u2} (Submodule.{u1, u2} k V (Ring.toSemiring.{u1} k _inst_1) (AddCommGroup.toAddCommMonoid.{u2} V _inst_2) _inst_3) (Preorder.toLE.{u2} (Submodule.{u1, u2} k V (Ring.toSemiring.{u1} k _inst_1) (AddCommGroup.toAddCommMonoid.{u2} V _inst_2) _inst_3) (PartialOrder.toPreorder.{u2} (Submodule.{u1, u2} k V (Ring.toSemiring.{u1} k _inst_1) (AddCommGroup.toAddCommMonoid.{u2} V _inst_2) _inst_3) (SetLike.partialOrder.{u2, u2} (Submodule.{u1, u2} k V (Ring.toSemiring.{u1} k _inst_1) (AddCommGroup.toAddCommMonoid.{u2} V _inst_2) _inst_3) V (Submodule.setLike.{u1, u2} k V (Ring.toSemiring.{u1} k _inst_1) (AddCommGroup.toAddCommMonoid.{u2} V _inst_2) _inst_3)))) (vectorSpan.{u1, u2, u3} k V P _inst_1 _inst_2 _inst_3 _inst_4 s₁) (vectorSpan.{u1, u2, u3} k V P _inst_1 _inst_2 _inst_3 _inst_4 s₂)) but is expected to have type forall (k : Type.{u1}) {V : Type.{u2}} {P : Type.{u3}} [_inst_1 : Ring.{u1} k] [_inst_2 : AddCommGroup.{u2} V] [_inst_3 : Module.{u1, u2} k V (Ring.toSemiring.{u1} k _inst_1) (AddCommGroup.toAddCommMonoid.{u2} V _inst_2)] [_inst_4 : AddTorsor.{u2, u3} V P (AddCommGroup.toAddGroup.{u2} V _inst_2)] {s₁ : Set.{u3} P} {s₂ : Set.{u3} P}, (HasSubset.Subset.{u3} (Set.{u3} P) (Set.instHasSubsetSet.{u3} P) s₁ s₂) -> (LE.le.{u2} (Submodule.{u1, u2} k V (Ring.toSemiring.{u1} k _inst_1) (AddCommGroup.toAddCommMonoid.{u2} V _inst_2) _inst_3) (Preorder.toLE.{u2} (Submodule.{u1, u2} k V (Ring.toSemiring.{u1} k _inst_1) (AddCommGroup.toAddCommMonoid.{u2} V _inst_2) _inst_3) (PartialOrder.toPreorder.{u2} (Submodule.{u1, u2} k V (Ring.toSemiring.{u1} k _inst_1) (AddCommGroup.toAddCommMonoid.{u2} V _inst_2) _inst_3) (OmegaCompletePartialOrder.toPartialOrder.{u2} (Submodule.{u1, u2} k V (Ring.toSemiring.{u1} k _inst_1) (AddCommGroup.toAddCommMonoid.{u2} V _inst_2) _inst_3) (CompleteLattice.instOmegaCompletePartialOrder.{u2} (Submodule.{u1, u2} k V (Ring.toSemiring.{u1} k _inst_1) (AddCommGroup.toAddCommMonoid.{u2} V _inst_2) _inst_3) (Submodule.completeLattice.{u1, u2} k V (Ring.toSemiring.{u1} k _inst_1) (AddCommGroup.toAddCommMonoid.{u2} V _inst_2) _inst_3))))) (vectorSpan.{u1, u2, u3} k V P _inst_1 _inst_2 _inst_3 _inst_4 s₁) (vectorSpan.{u1, u2, u3} k V P _inst_1 _inst_2 _inst_3 _inst_4 s₂)) Case conversion may be inaccurate. Consider using '#align vector_span_mono vectorSpan_monoₓ'. -/ /-- `vector_span` is monotone. -/ theorem vectorSpan_mono {s₁ s₂ : Set P} (h : s₁ ⊆ s₂) : vectorSpan k s₁ ≤ vectorSpan k s₂ := Submodule.span_mono (vsub_self_mono h) #align vector_span_mono vectorSpan_mono variable (P) /- warning: vector_span_empty -> vectorSpan_empty is a dubious translation: lean 3 declaration is forall (k : Type.{u1}) {V : Type.{u2}} (P : Type.{u3}) [_inst_1 : Ring.{u1} k] [_inst_2 : AddCommGroup.{u2} V] [_inst_3 : Module.{u1, u2} k V (Ring.toSemiring.{u1} k _inst_1) (AddCommGroup.toAddCommMonoid.{u2} V _inst_2)] [_inst_4 : AddTorsor.{u2, u3} V P (AddCommGroup.toAddGroup.{u2} V _inst_2)], Eq.{succ u2} (Submodule.{u1, u2} k V (Ring.toSemiring.{u1} k _inst_1) (AddCommGroup.toAddCommMonoid.{u2} V _inst_2) _inst_3) (vectorSpan.{u1, u2, u3} k V P _inst_1 _inst_2 _inst_3 _inst_4 (EmptyCollection.emptyCollection.{u3} (Set.{u3} P) (Set.hasEmptyc.{u3} P))) (Bot.bot.{u2} (Submodule.{u1, u2} k V (Ring.toSemiring.{u1} k _inst_1) (AddCommGroup.toAddCommMonoid.{u2} V _inst_2) _inst_3) (Submodule.hasBot.{u1, u2} k V (Ring.toSemiring.{u1} k _inst_1) (AddCommGroup.toAddCommMonoid.{u2} V _inst_2) _inst_3)) but is expected to have type forall (k : Type.{u2}) {V : Type.{u3}} (P : Type.{u1}) [_inst_1 : Ring.{u2} k] [_inst_2 : AddCommGroup.{u3} V] [_inst_3 : Module.{u2, u3} k V (Ring.toSemiring.{u2} k _inst_1) (AddCommGroup.toAddCommMonoid.{u3} V _inst_2)] [_inst_4 : AddTorsor.{u3, u1} V P (AddCommGroup.toAddGroup.{u3} V _inst_2)], Eq.{succ u3} (Submodule.{u2, u3} k V (Ring.toSemiring.{u2} k _inst_1) (AddCommGroup.toAddCommMonoid.{u3} V _inst_2) _inst_3) (vectorSpan.{u2, u3, u1} k V P _inst_1 _inst_2 _inst_3 _inst_4 (EmptyCollection.emptyCollection.{u1} (Set.{u1} P) (Set.instEmptyCollectionSet.{u1} P))) (Bot.bot.{u3} (Submodule.{u2, u3} k V (Ring.toSemiring.{u2} k _inst_1) (AddCommGroup.toAddCommMonoid.{u3} V _inst_2) _inst_3) (Submodule.instBotSubmodule.{u2, u3} k V (Ring.toSemiring.{u2} k _inst_1) (AddCommGroup.toAddCommMonoid.{u3} V _inst_2) _inst_3)) Case conversion may be inaccurate. Consider using '#align vector_span_empty vectorSpan_emptyₓ'. -/ /-- The `vector_span` of the empty set is `⊥`. -/ @[simp] theorem vectorSpan_empty : vectorSpan k (∅ : Set P) = (⊥ : Submodule k V) := by rw [vectorSpan_def, vsub_empty, Submodule.span_empty] #align vector_span_empty vectorSpan_empty variable {P} /- warning: vector_span_singleton -> vectorSpan_singleton is a dubious translation: lean 3 declaration is forall (k : Type.{u1}) {V : Type.{u2}} {P : Type.{u3}} [_inst_1 : Ring.{u1} k] [_inst_2 : AddCommGroup.{u2} V] [_inst_3 : Module.{u1, u2} k V (Ring.toSemiring.{u1} k _inst_1) (AddCommGroup.toAddCommMonoid.{u2} V _inst_2)] [_inst_4 : AddTorsor.{u2, u3} V P (AddCommGroup.toAddGroup.{u2} V _inst_2)] (p : P), Eq.{succ u2} (Submodule.{u1, u2} k V (Ring.toSemiring.{u1} k _inst_1) (AddCommGroup.toAddCommMonoid.{u2} V _inst_2) _inst_3) (vectorSpan.{u1, u2, u3} k V P _inst_1 _inst_2 _inst_3 _inst_4 (Singleton.singleton.{u3, u3} P (Set.{u3} P) (Set.hasSingleton.{u3} P) p)) (Bot.bot.{u2} (Submodule.{u1, u2} k V (Ring.toSemiring.{u1} k _inst_1) (AddCommGroup.toAddCommMonoid.{u2} V _inst_2) _inst_3) (Submodule.hasBot.{u1, u2} k V (Ring.toSemiring.{u1} k _inst_1) (AddCommGroup.toAddCommMonoid.{u2} V _inst_2) _inst_3)) but is expected to have type forall (k : Type.{u2}) {V : Type.{u3}} {P : Type.{u1}} [_inst_1 : Ring.{u2} k] [_inst_2 : AddCommGroup.{u3} V] [_inst_3 : Module.{u2, u3} k V (Ring.toSemiring.{u2} k _inst_1) (AddCommGroup.toAddCommMonoid.{u3} V _inst_2)] [_inst_4 : AddTorsor.{u3, u1} V P (AddCommGroup.toAddGroup.{u3} V _inst_2)] (p : P), Eq.{succ u3} (Submodule.{u2, u3} k V (Ring.toSemiring.{u2} k _inst_1) (AddCommGroup.toAddCommMonoid.{u3} V _inst_2) _inst_3) (vectorSpan.{u2, u3, u1} k V P _inst_1 _inst_2 _inst_3 _inst_4 (Singleton.singleton.{u1, u1} P (Set.{u1} P) (Set.instSingletonSet.{u1} P) p)) (Bot.bot.{u3} (Submodule.{u2, u3} k V (Ring.toSemiring.{u2} k _inst_1) (AddCommGroup.toAddCommMonoid.{u3} V _inst_2) _inst_3) (Submodule.instBotSubmodule.{u2, u3} k V (Ring.toSemiring.{u2} k _inst_1) (AddCommGroup.toAddCommMonoid.{u3} V _inst_2) _inst_3)) Case conversion may be inaccurate. Consider using '#align vector_span_singleton vectorSpan_singletonₓ'. -/ /-- The `vector_span` of a single point is `⊥`. -/ @[simp] theorem vectorSpan_singleton (p : P) : vectorSpan k ({p} : Set P) = ⊥ := by simp [vectorSpan_def] #align vector_span_singleton vectorSpan_singleton #print vsub_set_subset_vectorSpan /- /-- The `s -ᵥ s` lies within the `vector_span k s`. -/ theorem vsub_set_subset_vectorSpan (s : Set P) : s -ᵥ s ⊆ ↑(vectorSpan k s) := Submodule.subset_span #align vsub_set_subset_vector_span vsub_set_subset_vectorSpan -/ #print vsub_mem_vectorSpan /- /-- Each pairwise difference is in the `vector_span`. -/ theorem vsub_mem_vectorSpan {s : Set P} {p1 p2 : P} (hp1 : p1 ∈ s) (hp2 : p2 ∈ s) : p1 -ᵥ p2 ∈ vectorSpan k s := vsub_set_subset_vectorSpan k s (vsub_mem_vsub hp1 hp2) #align vsub_mem_vector_span vsub_mem_vectorSpan -/ #print spanPoints /- /-- The points in the affine span of a (possibly empty) set of points. Use `affine_span` instead to get an `affine_subspace k P`. -/ def spanPoints (s : Set P) : Set P := { p | ∃ p1 ∈ s, ∃ v ∈ vectorSpan k s, p = v +ᵥ p1 } #align span_points spanPoints -/ /- warning: mem_span_points -> mem_spanPoints is a dubious translation: lean 3 declaration is forall (k : Type.{u1}) {V : Type.{u2}} {P : Type.{u3}} [_inst_1 : Ring.{u1} k] [_inst_2 : AddCommGroup.{u2} V] [_inst_3 : Module.{u1, u2} k V (Ring.toSemiring.{u1} k _inst_1) (AddCommGroup.toAddCommMonoid.{u2} V _inst_2)] [_inst_4 : AddTorsor.{u2, u3} V P (AddCommGroup.toAddGroup.{u2} V _inst_2)] (p : P) (s : Set.{u3} P), (Membership.Mem.{u3, u3} P (Set.{u3} P) (Set.hasMem.{u3} P) p s) -> (Membership.Mem.{u3, u3} P (Set.{u3} P) (Set.hasMem.{u3} P) p (spanPoints.{u1, u2, u3} k V P _inst_1 _inst_2 _inst_3 _inst_4 s)) but is expected to have type forall (k : Type.{u2}) {V : Type.{u1}} {P : Type.{u3}} [_inst_1 : Ring.{u2} k] [_inst_2 : AddCommGroup.{u1} V] [_inst_3 : Module.{u2, u1} k V (Ring.toSemiring.{u2} k _inst_1) (AddCommGroup.toAddCommMonoid.{u1} V _inst_2)] [_inst_4 : AddTorsor.{u1, u3} V P (AddCommGroup.toAddGroup.{u1} V _inst_2)] (p : P) (s : Set.{u3} P), (Membership.mem.{u3, u3} P (Set.{u3} P) (Set.instMembershipSet.{u3} P) p s) -> (Membership.mem.{u3, u3} P (Set.{u3} P) (Set.instMembershipSet.{u3} P) p (spanPoints.{u2, u1, u3} k V P _inst_1 _inst_2 _inst_3 _inst_4 s)) Case conversion may be inaccurate. Consider using '#align mem_span_points mem_spanPointsₓ'. -/ /-- A point in a set is in its affine span. -/ theorem mem_spanPoints (p : P) (s : Set P) : p ∈ s → p ∈ spanPoints k s | hp => ⟨p, hp, 0, Submodule.zero_mem _, (zero_vadd V p).symm⟩ #align mem_span_points mem_spanPoints /- warning: subset_span_points -> subset_spanPoints is a dubious translation: lean 3 declaration is forall (k : Type.{u1}) {V : Type.{u2}} {P : Type.{u3}} [_inst_1 : Ring.{u1} k] [_inst_2 : AddCommGroup.{u2} V] [_inst_3 : Module.{u1, u2} k V (Ring.toSemiring.{u1} k _inst_1) (AddCommGroup.toAddCommMonoid.{u2} V _inst_2)] [_inst_4 : AddTorsor.{u2, u3} V P (AddCommGroup.toAddGroup.{u2} V _inst_2)] (s : Set.{u3} P), HasSubset.Subset.{u3} (Set.{u3} P) (Set.hasSubset.{u3} P) s (spanPoints.{u1, u2, u3} k V P _inst_1 _inst_2 _inst_3 _inst_4 s) but is expected to have type forall (k : Type.{u2}) {V : Type.{u1}} {P : Type.{u3}} [_inst_1 : Ring.{u2} k] [_inst_2 : AddCommGroup.{u1} V] [_inst_3 : Module.{u2, u1} k V (Ring.toSemiring.{u2} k _inst_1) (AddCommGroup.toAddCommMonoid.{u1} V _inst_2)] [_inst_4 : AddTorsor.{u1, u3} V P (AddCommGroup.toAddGroup.{u1} V _inst_2)] (s : Set.{u3} P), HasSubset.Subset.{u3} (Set.{u3} P) (Set.instHasSubsetSet.{u3} P) s (spanPoints.{u2, u1, u3} k V P _inst_1 _inst_2 _inst_3 _inst_4 s) Case conversion may be inaccurate. Consider using '#align subset_span_points subset_spanPointsₓ'. -/ /-- A set is contained in its `span_points`. -/ theorem subset_spanPoints (s : Set P) : s ⊆ spanPoints k s := fun p => mem_spanPoints k p s #align subset_span_points subset_spanPoints /- warning: span_points_nonempty -> spanPoints_nonempty is a dubious translation: lean 3 declaration is forall (k : Type.{u1}) {V : Type.{u2}} {P : Type.{u3}} [_inst_1 : Ring.{u1} k] [_inst_2 : AddCommGroup.{u2} V] [_inst_3 : Module.{u1, u2} k V (Ring.toSemiring.{u1} k _inst_1) (AddCommGroup.toAddCommMonoid.{u2} V _inst_2)] [_inst_4 : AddTorsor.{u2, u3} V P (AddCommGroup.toAddGroup.{u2} V _inst_2)] (s : Set.{u3} P), Iff (Set.Nonempty.{u3} P (spanPoints.{u1, u2, u3} k V P _inst_1 _inst_2 _inst_3 _inst_4 s)) (Set.Nonempty.{u3} P s) but is expected to have type forall (k : Type.{u2}) {V : Type.{u1}} {P : Type.{u3}} [_inst_1 : Ring.{u2} k] [_inst_2 : AddCommGroup.{u1} V] [_inst_3 : Module.{u2, u1} k V (Ring.toSemiring.{u2} k _inst_1) (AddCommGroup.toAddCommMonoid.{u1} V _inst_2)] [_inst_4 : AddTorsor.{u1, u3} V P (AddCommGroup.toAddGroup.{u1} V _inst_2)] (s : Set.{u3} P), Iff (Set.Nonempty.{u3} P (spanPoints.{u2, u1, u3} k V P _inst_1 _inst_2 _inst_3 _inst_4 s)) (Set.Nonempty.{u3} P s) Case conversion may be inaccurate. Consider using '#align span_points_nonempty spanPoints_nonemptyₓ'. -/ /-- The `span_points` of a set is nonempty if and only if that set is. -/ @[simp] theorem spanPoints_nonempty (s : Set P) : (spanPoints k s).Nonempty ↔ s.Nonempty := by constructor · contrapose rw [Set.not_nonempty_iff_eq_empty, Set.not_nonempty_iff_eq_empty] intro h simp [h, spanPoints] · exact fun h => h.mono (subset_spanPoints _ _) #align span_points_nonempty spanPoints_nonempty /- warning: vadd_mem_span_points_of_mem_span_points_of_mem_vector_span -> vadd_mem_spanPoints_of_mem_spanPoints_of_mem_vectorSpan is a dubious translation: lean 3 declaration is forall (k : Type.{u1}) {V : Type.{u2}} {P : Type.{u3}} [_inst_1 : Ring.{u1} k] [_inst_2 : AddCommGroup.{u2} V] [_inst_3 : Module.{u1, u2} k V (Ring.toSemiring.{u1} k _inst_1) (AddCommGroup.toAddCommMonoid.{u2} V _inst_2)] [_inst_4 : AddTorsor.{u2, u3} V P (AddCommGroup.toAddGroup.{u2} V _inst_2)] {s : Set.{u3} P} {p : P} {v : V}, (Membership.Mem.{u3, u3} P (Set.{u3} P) (Set.hasMem.{u3} P) p (spanPoints.{u1, u2, u3} k V P _inst_1 _inst_2 _inst_3 _inst_4 s)) -> (Membership.Mem.{u2, u2} V (Submodule.{u1, u2} k V (Ring.toSemiring.{u1} k _inst_1) (AddCommGroup.toAddCommMonoid.{u2} V _inst_2) _inst_3) (SetLike.hasMem.{u2, u2} (Submodule.{u1, u2} k V (Ring.toSemiring.{u1} k _inst_1) (AddCommGroup.toAddCommMonoid.{u2} V _inst_2) _inst_3) V (Submodule.setLike.{u1, u2} k V (Ring.toSemiring.{u1} k _inst_1) (AddCommGroup.toAddCommMonoid.{u2} V _inst_2) _inst_3)) v (vectorSpan.{u1, u2, u3} k V P _inst_1 _inst_2 _inst_3 _inst_4 s)) -> (Membership.Mem.{u3, u3} P (Set.{u3} P) (Set.hasMem.{u3} P) (VAdd.vadd.{u2, u3} V P (AddAction.toHasVadd.{u2, u3} V P (SubNegMonoid.toAddMonoid.{u2} V (AddGroup.toSubNegMonoid.{u2} V (AddCommGroup.toAddGroup.{u2} V _inst_2))) (AddTorsor.toAddAction.{u2, u3} V P (AddCommGroup.toAddGroup.{u2} V _inst_2) _inst_4)) v p) (spanPoints.{u1, u2, u3} k V P _inst_1 _inst_2 _inst_3 _inst_4 s)) but is expected to have type forall (k : Type.{u2}) {V : Type.{u1}} {P : Type.{u3}} [_inst_1 : Ring.{u2} k] [_inst_2 : AddCommGroup.{u1} V] [_inst_3 : Module.{u2, u1} k V (Ring.toSemiring.{u2} k _inst_1) (AddCommGroup.toAddCommMonoid.{u1} V _inst_2)] [_inst_4 : AddTorsor.{u1, u3} V P (AddCommGroup.toAddGroup.{u1} V _inst_2)] {s : Set.{u3} P} {p : P} {v : V}, (Membership.mem.{u3, u3} P (Set.{u3} P) (Set.instMembershipSet.{u3} P) p (spanPoints.{u2, u1, u3} k V P _inst_1 _inst_2 _inst_3 _inst_4 s)) -> (Membership.mem.{u1, u1} V (Submodule.{u2, u1} k V (Ring.toSemiring.{u2} k _inst_1) (AddCommGroup.toAddCommMonoid.{u1} V _inst_2) _inst_3) (SetLike.instMembership.{u1, u1} (Submodule.{u2, u1} k V (Ring.toSemiring.{u2} k _inst_1) (AddCommGroup.toAddCommMonoid.{u1} V _inst_2) _inst_3) V (Submodule.setLike.{u2, u1} k V (Ring.toSemiring.{u2} k _inst_1) (AddCommGroup.toAddCommMonoid.{u1} V _inst_2) _inst_3)) v (vectorSpan.{u2, u1, u3} k V P _inst_1 _inst_2 _inst_3 _inst_4 s)) -> (Membership.mem.{u3, u3} P (Set.{u3} P) (Set.instMembershipSet.{u3} P) (HVAdd.hVAdd.{u1, u3, u3} V P P (instHVAdd.{u1, u3} V P (AddAction.toVAdd.{u1, u3} V P (SubNegMonoid.toAddMonoid.{u1} V (AddGroup.toSubNegMonoid.{u1} V (AddCommGroup.toAddGroup.{u1} V _inst_2))) (AddTorsor.toAddAction.{u1, u3} V P (AddCommGroup.toAddGroup.{u1} V _inst_2) _inst_4))) v p) (spanPoints.{u2, u1, u3} k V P _inst_1 _inst_2 _inst_3 _inst_4 s)) Case conversion may be inaccurate. Consider using '#align vadd_mem_span_points_of_mem_span_points_of_mem_vector_span vadd_mem_spanPoints_of_mem_spanPoints_of_mem_vectorSpanₓ'. -/ /-- Adding a point in the affine span and a vector in the spanning submodule produces a point in the affine span. -/ theorem vadd_mem_spanPoints_of_mem_spanPoints_of_mem_vectorSpan {s : Set P} {p : P} {v : V} (hp : p ∈ spanPoints k s) (hv : v ∈ vectorSpan k s) : v +ᵥ p ∈ spanPoints k s := by rcases hp with ⟨p2, ⟨hp2, ⟨v2, ⟨hv2, hv2p⟩⟩⟩⟩ rw [hv2p, vadd_vadd] use p2, hp2, v + v2, (vectorSpan k s).add_mem hv hv2, rfl #align vadd_mem_span_points_of_mem_span_points_of_mem_vector_span vadd_mem_spanPoints_of_mem_spanPoints_of_mem_vectorSpan /- warning: vsub_mem_vector_span_of_mem_span_points_of_mem_span_points -> vsub_mem_vectorSpan_of_mem_spanPoints_of_mem_spanPoints is a dubious translation: lean 3 declaration is forall (k : Type.{u1}) {V : Type.{u2}} {P : Type.{u3}} [_inst_1 : Ring.{u1} k] [_inst_2 : AddCommGroup.{u2} V] [_inst_3 : Module.{u1, u2} k V (Ring.toSemiring.{u1} k _inst_1) (AddCommGroup.toAddCommMonoid.{u2} V _inst_2)] [_inst_4 : AddTorsor.{u2, u3} V P (AddCommGroup.toAddGroup.{u2} V _inst_2)] {s : Set.{u3} P} {p1 : P} {p2 : P}, (Membership.Mem.{u3, u3} P (Set.{u3} P) (Set.hasMem.{u3} P) p1 (spanPoints.{u1, u2, u3} k V P _inst_1 _inst_2 _inst_3 _inst_4 s)) -> (Membership.Mem.{u3, u3} P (Set.{u3} P) (Set.hasMem.{u3} P) p2 (spanPoints.{u1, u2, u3} k V P _inst_1 _inst_2 _inst_3 _inst_4 s)) -> (Membership.Mem.{u2, u2} V (Submodule.{u1, u2} k V (Ring.toSemiring.{u1} k _inst_1) (AddCommGroup.toAddCommMonoid.{u2} V _inst_2) _inst_3) (SetLike.hasMem.{u2, u2} (Submodule.{u1, u2} k V (Ring.toSemiring.{u1} k _inst_1) (AddCommGroup.toAddCommMonoid.{u2} V _inst_2) _inst_3) V (Submodule.setLike.{u1, u2} k V (Ring.toSemiring.{u1} k _inst_1) (AddCommGroup.toAddCommMonoid.{u2} V _inst_2) _inst_3)) (VSub.vsub.{u2, u3} V P (AddTorsor.toHasVsub.{u2, u3} V P (AddCommGroup.toAddGroup.{u2} V _inst_2) _inst_4) p1 p2) (vectorSpan.{u1, u2, u3} k V P _inst_1 _inst_2 _inst_3 _inst_4 s)) but is expected to have type forall (k : Type.{u2}) {V : Type.{u1}} {P : Type.{u3}} [_inst_1 : Ring.{u2} k] [_inst_2 : AddCommGroup.{u1} V] [_inst_3 : Module.{u2, u1} k V (Ring.toSemiring.{u2} k _inst_1) (AddCommGroup.toAddCommMonoid.{u1} V _inst_2)] [_inst_4 : AddTorsor.{u1, u3} V P (AddCommGroup.toAddGroup.{u1} V _inst_2)] {s : Set.{u3} P} {p1 : P} {p2 : P}, (Membership.mem.{u3, u3} P (Set.{u3} P) (Set.instMembershipSet.{u3} P) p1 (spanPoints.{u2, u1, u3} k V P _inst_1 _inst_2 _inst_3 _inst_4 s)) -> (Membership.mem.{u3, u3} P (Set.{u3} P) (Set.instMembershipSet.{u3} P) p2 (spanPoints.{u2, u1, u3} k V P _inst_1 _inst_2 _inst_3 _inst_4 s)) -> (Membership.mem.{u1, u1} V (Submodule.{u2, u1} k V (Ring.toSemiring.{u2} k _inst_1) (AddCommGroup.toAddCommMonoid.{u1} V _inst_2) _inst_3) (SetLike.instMembership.{u1, u1} (Submodule.{u2, u1} k V (Ring.toSemiring.{u2} k _inst_1) (AddCommGroup.toAddCommMonoid.{u1} V _inst_2) _inst_3) V (Submodule.setLike.{u2, u1} k V (Ring.toSemiring.{u2} k _inst_1) (AddCommGroup.toAddCommMonoid.{u1} V _inst_2) _inst_3)) (VSub.vsub.{u1, u3} V P (AddTorsor.toVSub.{u1, u3} V P (AddCommGroup.toAddGroup.{u1} V _inst_2) _inst_4) p1 p2) (vectorSpan.{u2, u1, u3} k V P _inst_1 _inst_2 _inst_3 _inst_4 s)) Case conversion may be inaccurate. Consider using '#align vsub_mem_vector_span_of_mem_span_points_of_mem_span_points vsub_mem_vectorSpan_of_mem_spanPoints_of_mem_spanPointsₓ'. -/ /-- Subtracting two points in the affine span produces a vector in the spanning submodule. -/ theorem vsub_mem_vectorSpan_of_mem_spanPoints_of_mem_spanPoints {s : Set P} {p1 p2 : P} (hp1 : p1 ∈ spanPoints k s) (hp2 : p2 ∈ spanPoints k s) : p1 -ᵥ p2 ∈ vectorSpan k s := by rcases hp1 with ⟨p1a, ⟨hp1a, ⟨v1, ⟨hv1, hv1p⟩⟩⟩⟩ rcases hp2 with ⟨p2a, ⟨hp2a, ⟨v2, ⟨hv2, hv2p⟩⟩⟩⟩ rw [hv1p, hv2p, vsub_vadd_eq_vsub_sub (v1 +ᵥ p1a), vadd_vsub_assoc, add_comm, add_sub_assoc] have hv1v2 : v1 - v2 ∈ vectorSpan k s := by rw [sub_eq_add_neg] apply (vectorSpan k s).add_mem hv1 rw [← neg_one_smul k v2] exact (vectorSpan k s).smul_mem (-1 : k) hv2 refine' (vectorSpan k s).add_mem _ hv1v2 exact vsub_mem_vectorSpan k hp1a hp2a #align vsub_mem_vector_span_of_mem_span_points_of_mem_span_points vsub_mem_vectorSpan_of_mem_spanPoints_of_mem_spanPoints end #print AffineSubspace /- /-- An `affine_subspace k P` is a subset of an `affine_space V P` that, if not empty, has an affine space structure induced by a corresponding subspace of the `module k V`. -/ structure AffineSubspace (k : Type _) {V : Type _} (P : Type _) [Ring k] [AddCommGroup V] [Module k V] [affine_space V P] where carrier : Set P smul_vsub_vadd_mem : ∀ (c : k) {p1 p2 p3 : P}, p1 ∈ carrier → p2 ∈ carrier → p3 ∈ carrier → c • (p1 -ᵥ p2 : V) +ᵥ p3 ∈ carrier #align affine_subspace AffineSubspace -/ namespace Submodule variable {k V : Type _} [Ring k] [AddCommGroup V] [Module k V] #print Submodule.toAffineSubspace /- /-- Reinterpret `p : submodule k V` as an `affine_subspace k V`. -/ def toAffineSubspace (p : Submodule k V) : AffineSubspace k V where carrier := p smul_vsub_vadd_mem c p₁ p₂ p₃ h₁ h₂ h₃ := p.add_mem (p.smul_mem _ (p.sub_mem h₁ h₂)) h₃ #align submodule.to_affine_subspace Submodule.toAffineSubspace -/ end Submodule namespace AffineSubspace variable (k : Type _) {V : Type _} (P : Type _) [Ring k] [AddCommGroup V] [Module k V] [affine_space V P] include V instance : SetLike (AffineSubspace k P) P where coe := carrier coe_injective' p q _ := by cases p <;> cases q <;> congr /- warning: affine_subspace.mem_coe -> AffineSubspace.mem_coe is a dubious translation: lean 3 declaration is forall (k : Type.{u1}) {V : Type.{u2}} (P : Type.{u3}) [_inst_1 : Ring.{u1} k] [_inst_2 : AddCommGroup.{u2} V] [_inst_3 : Module.{u1, u2} k V (Ring.toSemiring.{u1} k _inst_1) (AddCommGroup.toAddCommMonoid.{u2} V _inst_2)] [_inst_4 : AddTorsor.{u2, u3} V P (AddCommGroup.toAddGroup.{u2} V _inst_2)] (p : P) (s : AffineSubspace.{u1, u2, u3} k V P _inst_1 _inst_2 _inst_3 _inst_4), Iff (Membership.Mem.{u3, u3} P (Set.{u3} P) (Set.hasMem.{u3} P) p ((fun (a : Type.{u3}) (b : Type.{u3}) [self : HasLiftT.{succ u3, succ u3} a b] => self.0) (AffineSubspace.{u1, u2, u3} k V P _inst_1 _inst_2 _inst_3 _inst_4) (Set.{u3} P) (HasLiftT.mk.{succ u3, succ u3} (AffineSubspace.{u1, u2, u3} k V P _inst_1 _inst_2 _inst_3 _inst_4) (Set.{u3} P) (CoeTCₓ.coe.{succ u3, succ u3} (AffineSubspace.{u1, u2, u3} k V P _inst_1 _inst_2 _inst_3 _inst_4) (Set.{u3} P) (SetLike.Set.hasCoeT.{u3, u3} (AffineSubspace.{u1, u2, u3} k V P _inst_1 _inst_2 _inst_3 _inst_4) P (AffineSubspace.setLike.{u1, u2, u3} k V P _inst_1 _inst_2 _inst_3 _inst_4)))) s)) (Membership.Mem.{u3, u3} P (AffineSubspace.{u1, u2, u3} k V P _inst_1 _inst_2 _inst_3 _inst_4) (SetLike.hasMem.{u3, u3} (AffineSubspace.{u1, u2, u3} k V P _inst_1 _inst_2 _inst_3 _inst_4) P (AffineSubspace.setLike.{u1, u2, u3} k V P _inst_1 _inst_2 _inst_3 _inst_4)) p s) but is expected to have type forall (k : Type.{u3}) {V : Type.{u2}} (P : Type.{u1}) [_inst_1 : Ring.{u3} k] [_inst_2 : AddCommGroup.{u2} V] [_inst_3 : Module.{u3, u2} k V (Ring.toSemiring.{u3} k _inst_1) (AddCommGroup.toAddCommMonoid.{u2} V _inst_2)] [_inst_4 : AddTorsor.{u2, u1} V P (AddCommGroup.toAddGroup.{u2} V _inst_2)] (p : P) (s : AffineSubspace.{u3, u2, u1} k V P _inst_1 _inst_2 _inst_3 _inst_4), Iff (Membership.mem.{u1, u1} P (Set.{u1} P) (Set.instMembershipSet.{u1} P) p (SetLike.coe.{u1, u1} (AffineSubspace.{u3, u2, u1} k V P _inst_1 _inst_2 _inst_3 _inst_4) P (AffineSubspace.instSetLikeAffineSubspace.{u3, u2, u1} k V P _inst_1 _inst_2 _inst_3 _inst_4) s)) (Membership.mem.{u1, u1} P (AffineSubspace.{u3, u2, u1} k V P _inst_1 _inst_2 _inst_3 _inst_4) (SetLike.instMembership.{u1, u1} (AffineSubspace.{u3, u2, u1} k V P _inst_1 _inst_2 _inst_3 _inst_4) P (AffineSubspace.instSetLikeAffineSubspace.{u3, u2, u1} k V P _inst_1 _inst_2 _inst_3 _inst_4)) p s) Case conversion may be inaccurate. Consider using '#align affine_subspace.mem_coe AffineSubspace.mem_coeₓ'. -/ /-- A point is in an affine subspace coerced to a set if and only if it is in that affine subspace. -/ @[simp] theorem mem_coe (p : P) (s : AffineSubspace k P) : p ∈ (s : Set P) ↔ p ∈ s := Iff.rfl #align affine_subspace.mem_coe AffineSubspace.mem_coe variable {k P} #print AffineSubspace.direction /- /-- The direction of an affine subspace is the submodule spanned by the pairwise differences of points. (Except in the case of an empty affine subspace, where the direction is the zero submodule, every vector in the direction is the difference of two points in the affine subspace.) -/ def direction (s : AffineSubspace k P) : Submodule k V := vectorSpan k (s : Set P) #align affine_subspace.direction AffineSubspace.direction -/ /- warning: affine_subspace.direction_eq_vector_span -> AffineSubspace.direction_eq_vectorSpan is a dubious translation: lean 3 declaration is forall {k : Type.{u1}} {V : Type.{u2}} {P : Type.{u3}} [_inst_1 : Ring.{u1} k] [_inst_2 : AddCommGroup.{u2} V] [_inst_3 : Module.{u1, u2} k V (Ring.toSemiring.{u1} k _inst_1) (AddCommGroup.toAddCommMonoid.{u2} V _inst_2)] [_inst_4 : AddTorsor.{u2, u3} V P (AddCommGroup.toAddGroup.{u2} V _inst_2)] (s : AffineSubspace.{u1, u2, u3} k V P _inst_1 _inst_2 _inst_3 _inst_4), Eq.{succ u2} (Submodule.{u1, u2} k V (Ring.toSemiring.{u1} k _inst_1) (AddCommGroup.toAddCommMonoid.{u2} V _inst_2) _inst_3) (AffineSubspace.direction.{u1, u2, u3} k V P _inst_1 _inst_2 _inst_3 _inst_4 s) (vectorSpan.{u1, u2, u3} k V P _inst_1 _inst_2 _inst_3 _inst_4 ((fun (a : Type.{u3}) (b : Type.{u3}) [self : HasLiftT.{succ u3, succ u3} a b] => self.0) (AffineSubspace.{u1, u2, u3} k V P _inst_1 _inst_2 _inst_3 _inst_4) (Set.{u3} P) (HasLiftT.mk.{succ u3, succ u3} (AffineSubspace.{u1, u2, u3} k V P _inst_1 _inst_2 _inst_3 _inst_4) (Set.{u3} P) (CoeTCₓ.coe.{succ u3, succ u3} (AffineSubspace.{u1, u2, u3} k V P _inst_1 _inst_2 _inst_3 _inst_4) (Set.{u3} P) (SetLike.Set.hasCoeT.{u3, u3} (AffineSubspace.{u1, u2, u3} k V P _inst_1 _inst_2 _inst_3 _inst_4) P (AffineSubspace.setLike.{u1, u2, u3} k V P _inst_1 _inst_2 _inst_3 _inst_4)))) s)) but is expected to have type forall {k : Type.{u3}} {V : Type.{u2}} {P : Type.{u1}} [_inst_1 : Ring.{u3} k] [_inst_2 : AddCommGroup.{u2} V] [_inst_3 : Module.{u3, u2} k V (Ring.toSemiring.{u3} k _inst_1) (AddCommGroup.toAddCommMonoid.{u2} V _inst_2)] [_inst_4 : AddTorsor.{u2, u1} V P (AddCommGroup.toAddGroup.{u2} V _inst_2)] (s : AffineSubspace.{u3, u2, u1} k V P _inst_1 _inst_2 _inst_3 _inst_4), Eq.{succ u2} (Submodule.{u3, u2} k V (Ring.toSemiring.{u3} k _inst_1) (AddCommGroup.toAddCommMonoid.{u2} V _inst_2) _inst_3) (AffineSubspace.direction.{u3, u2, u1} k V P _inst_1 _inst_2 _inst_3 _inst_4 s) (vectorSpan.{u3, u2, u1} k V P _inst_1 _inst_2 _inst_3 _inst_4 (SetLike.coe.{u1, u1} (AffineSubspace.{u3, u2, u1} k V P _inst_1 _inst_2 _inst_3 _inst_4) P (AffineSubspace.instSetLikeAffineSubspace.{u3, u2, u1} k V P _inst_1 _inst_2 _inst_3 _inst_4) s)) Case conversion may be inaccurate. Consider using '#align affine_subspace.direction_eq_vector_span AffineSubspace.direction_eq_vectorSpanₓ'. -/ /-- The direction equals the `vector_span`. -/ theorem direction_eq_vectorSpan (s : AffineSubspace k P) : s.direction = vectorSpan k (s : Set P) := rfl #align affine_subspace.direction_eq_vector_span AffineSubspace.direction_eq_vectorSpan #print AffineSubspace.directionOfNonempty /- /-- Alternative definition of the direction when the affine subspace is nonempty. This is defined so that the order on submodules (as used in the definition of `submodule.span`) can be used in the proof of `coe_direction_eq_vsub_set`, and is not intended to be used beyond that proof. -/ def directionOfNonempty {s : AffineSubspace k P} (h : (s : Set P).Nonempty) : Submodule k V where carrier := (s : Set P) -ᵥ s zero_mem' := by cases' h with p hp exact vsub_self p ▸ vsub_mem_vsub hp hp add_mem' := by intro a b ha hb rcases ha with ⟨p1, p2, hp1, hp2, rfl⟩ rcases hb with ⟨p3, p4, hp3, hp4, rfl⟩ rw [← vadd_vsub_assoc] refine' vsub_mem_vsub _ hp4 convert s.smul_vsub_vadd_mem 1 hp1 hp2 hp3 rw [one_smul] smul_mem' := by intro c v hv rcases hv with ⟨p1, p2, hp1, hp2, rfl⟩ rw [← vadd_vsub (c • (p1 -ᵥ p2)) p2] refine' vsub_mem_vsub _ hp2 exact s.smul_vsub_vadd_mem c hp1 hp2 hp2 #align affine_subspace.direction_of_nonempty AffineSubspace.directionOfNonempty -/ /- warning: affine_subspace.direction_of_nonempty_eq_direction -> AffineSubspace.directionOfNonempty_eq_direction is a dubious translation: lean 3 declaration is forall {k : Type.{u1}} {V : Type.{u2}} {P : Type.{u3}} [_inst_1 : Ring.{u1} k] [_inst_2 : AddCommGroup.{u2} V] [_inst_3 : Module.{u1, u2} k V (Ring.toSemiring.{u1} k _inst_1) (AddCommGroup.toAddCommMonoid.{u2} V _inst_2)] [_inst_4 : AddTorsor.{u2, u3} V P (AddCommGroup.toAddGroup.{u2} V _inst_2)] {s : AffineSubspace.{u1, u2, u3} k V P _inst_1 _inst_2 _inst_3 _inst_4} (h : Set.Nonempty.{u3} P ((fun (a : Type.{u3}) (b : Type.{u3}) [self : HasLiftT.{succ u3, succ u3} a b] => self.0) (AffineSubspace.{u1, u2, u3} k V P _inst_1 _inst_2 _inst_3 _inst_4) (Set.{u3} P) (HasLiftT.mk.{succ u3, succ u3} (AffineSubspace.{u1, u2, u3} k V P _inst_1 _inst_2 _inst_3 _inst_4) (Set.{u3} P) (CoeTCₓ.coe.{succ u3, succ u3} (AffineSubspace.{u1, u2, u3} k V P _inst_1 _inst_2 _inst_3 _inst_4) (Set.{u3} P) (SetLike.Set.hasCoeT.{u3, u3} (AffineSubspace.{u1, u2, u3} k V P _inst_1 _inst_2 _inst_3 _inst_4) P (AffineSubspace.setLike.{u1, u2, u3} k V P _inst_1 _inst_2 _inst_3 _inst_4)))) s)), Eq.{succ u2} (Submodule.{u1, u2} k V (Ring.toSemiring.{u1} k _inst_1) (AddCommGroup.toAddCommMonoid.{u2} V _inst_2) _inst_3) (AffineSubspace.directionOfNonempty.{u1, u2, u3} k V P _inst_1 _inst_2 _inst_3 _inst_4 s h) (AffineSubspace.direction.{u1, u2, u3} k V P _inst_1 _inst_2 _inst_3 _inst_4 s) but is expected to have type forall {k : Type.{u3}} {V : Type.{u2}} {P : Type.{u1}} [_inst_1 : Ring.{u3} k] [_inst_2 : AddCommGroup.{u2} V] [_inst_3 : Module.{u3, u2} k V (Ring.toSemiring.{u3} k _inst_1) (AddCommGroup.toAddCommMonoid.{u2} V _inst_2)] [_inst_4 : AddTorsor.{u2, u1} V P (AddCommGroup.toAddGroup.{u2} V _inst_2)] {s : AffineSubspace.{u3, u2, u1} k V P _inst_1 _inst_2 _inst_3 _inst_4} (h : Set.Nonempty.{u1} P (SetLike.coe.{u1, u1} (AffineSubspace.{u3, u2, u1} k V P _inst_1 _inst_2 _inst_3 _inst_4) P (AffineSubspace.instSetLikeAffineSubspace.{u3, u2, u1} k V P _inst_1 _inst_2 _inst_3 _inst_4) s)), Eq.{succ u2} (Submodule.{u3, u2} k V (Ring.toSemiring.{u3} k _inst_1) (AddCommGroup.toAddCommMonoid.{u2} V _inst_2) _inst_3) (AffineSubspace.directionOfNonempty.{u3, u2, u1} k V P _inst_1 _inst_2 _inst_3 _inst_4 s h) (AffineSubspace.direction.{u3, u2, u1} k V P _inst_1 _inst_2 _inst_3 _inst_4 s) Case conversion may be inaccurate. Consider using '#align affine_subspace.direction_of_nonempty_eq_direction AffineSubspace.directionOfNonempty_eq_directionₓ'. -/ /-- `direction_of_nonempty` gives the same submodule as `direction`. -/ theorem directionOfNonempty_eq_direction {s : AffineSubspace k P} (h : (s : Set P).Nonempty) : directionOfNonempty h = s.direction := le_antisymm (vsub_set_subset_vectorSpan k s) (Submodule.span_le.2 Set.Subset.rfl) #align affine_subspace.direction_of_nonempty_eq_direction AffineSubspace.directionOfNonempty_eq_direction /- warning: affine_subspace.coe_direction_eq_vsub_set -> AffineSubspace.coe_direction_eq_vsub_set is a dubious translation: lean 3 declaration is forall {k : Type.{u1}} {V : Type.{u2}} {P : Type.{u3}} [_inst_1 : Ring.{u1} k] [_inst_2 : AddCommGroup.{u2} V] [_inst_3 : Module.{u1, u2} k V (Ring.toSemiring.{u1} k _inst_1) (AddCommGroup.toAddCommMonoid.{u2} V _inst_2)] [_inst_4 : AddTorsor.{u2, u3} V P (AddCommGroup.toAddGroup.{u2} V _inst_2)] {s : AffineSubspace.{u1, u2, u3} k V P _inst_1 _inst_2 _inst_3 _inst_4}, (Set.Nonempty.{u3} P ((fun (a : Type.{u3}) (b : Type.{u3}) [self : HasLiftT.{succ u3, succ u3} a b] => self.0) (AffineSubspace.{u1, u2, u3} k V P _inst_1 _inst_2 _inst_3 _inst_4) (Set.{u3} P) (HasLiftT.mk.{succ u3, succ u3} (AffineSubspace.{u1, u2, u3} k V P _inst_1 _inst_2 _inst_3 _inst_4) (Set.{u3} P) (CoeTCₓ.coe.{succ u3, succ u3} (AffineSubspace.{u1, u2, u3} k V P _inst_1 _inst_2 _inst_3 _inst_4) (Set.{u3} P) (SetLike.Set.hasCoeT.{u3, u3} (AffineSubspace.{u1, u2, u3} k V P _inst_1 _inst_2 _inst_3 _inst_4) P (AffineSubspace.setLike.{u1, u2, u3} k V P _inst_1 _inst_2 _inst_3 _inst_4)))) s)) -> (Eq.{succ u2} (Set.{u2} V) ((fun (a : Type.{u2}) (b : Type.{u2}) [self : HasLiftT.{succ u2, succ u2} a b] => self.0) (Submodule.{u1, u2} k V (Ring.toSemiring.{u1} k _inst_1) (AddCommGroup.toAddCommMonoid.{u2} V _inst_2) _inst_3) (Set.{u2} V) (HasLiftT.mk.{succ u2, succ u2} (Submodule.{u1, u2} k V (Ring.toSemiring.{u1} k _inst_1) (AddCommGroup.toAddCommMonoid.{u2} V _inst_2) _inst_3) (Set.{u2} V) (CoeTCₓ.coe.{succ u2, succ u2} (Submodule.{u1, u2} k V (Ring.toSemiring.{u1} k _inst_1) (AddCommGroup.toAddCommMonoid.{u2} V _inst_2) _inst_3) (Set.{u2} V) (SetLike.Set.hasCoeT.{u2, u2} (Submodule.{u1, u2} k V (Ring.toSemiring.{u1} k _inst_1) (AddCommGroup.toAddCommMonoid.{u2} V _inst_2) _inst_3) V (Submodule.setLike.{u1, u2} k V (Ring.toSemiring.{u1} k _inst_1) (AddCommGroup.toAddCommMonoid.{u2} V _inst_2) _inst_3)))) (AffineSubspace.direction.{u1, u2, u3} k V P _inst_1 _inst_2 _inst_3 _inst_4 s)) (VSub.vsub.{u2, u3} (Set.{u2} V) (Set.{u3} P) (Set.vsub.{u2, u3} V P (AddTorsor.toHasVsub.{u2, u3} V P (AddCommGroup.toAddGroup.{u2} V _inst_2) _inst_4)) ((fun (a : Type.{u3}) (b : Type.{u3}) [self : HasLiftT.{succ u3, succ u3} a b] => self.0) (AffineSubspace.{u1, u2, u3} k V P _inst_1 _inst_2 _inst_3 _inst_4) (Set.{u3} P) (HasLiftT.mk.{succ u3, succ u3} (AffineSubspace.{u1, u2, u3} k V P _inst_1 _inst_2 _inst_3 _inst_4) (Set.{u3} P) (CoeTCₓ.coe.{succ u3, succ u3} (AffineSubspace.{u1, u2, u3} k V P _inst_1 _inst_2 _inst_3 _inst_4) (Set.{u3} P) (SetLike.Set.hasCoeT.{u3, u3} (AffineSubspace.{u1, u2, u3} k V P _inst_1 _inst_2 _inst_3 _inst_4) P (AffineSubspace.setLike.{u1, u2, u3} k V P _inst_1 _inst_2 _inst_3 _inst_4)))) s) ((fun (a : Type.{u3}) (b : Type.{u3}) [self : HasLiftT.{succ u3, succ u3} a b] => self.0) (AffineSubspace.{u1, u2, u3} k V P _inst_1 _inst_2 _inst_3 _inst_4) (Set.{u3} P) (HasLiftT.mk.{succ u3, succ u3} (AffineSubspace.{u1, u2, u3} k V P _inst_1 _inst_2 _inst_3 _inst_4) (Set.{u3} P) (CoeTCₓ.coe.{succ u3, succ u3} (AffineSubspace.{u1, u2, u3} k V P _inst_1 _inst_2 _inst_3 _inst_4) (Set.{u3} P) (SetLike.Set.hasCoeT.{u3, u3} (AffineSubspace.{u1, u2, u3} k V P _inst_1 _inst_2 _inst_3 _inst_4) P (AffineSubspace.setLike.{u1, u2, u3} k V P _inst_1 _inst_2 _inst_3 _inst_4)))) s))) but is expected to have type forall {k : Type.{u3}} {V : Type.{u2}} {P : Type.{u1}} [_inst_1 : Ring.{u3} k] [_inst_2 : AddCommGroup.{u2} V] [_inst_3 : Module.{u3, u2} k V (Ring.toSemiring.{u3} k _inst_1) (AddCommGroup.toAddCommMonoid.{u2} V _inst_2)] [_inst_4 : AddTorsor.{u2, u1} V P (AddCommGroup.toAddGroup.{u2} V _inst_2)] {s : AffineSubspace.{u3, u2, u1} k V P _inst_1 _inst_2 _inst_3 _inst_4}, (Set.Nonempty.{u1} P (SetLike.coe.{u1, u1} (AffineSubspace.{u3, u2, u1} k V P _inst_1 _inst_2 _inst_3 _inst_4) P (AffineSubspace.instSetLikeAffineSubspace.{u3, u2, u1} k V P _inst_1 _inst_2 _inst_3 _inst_4) s)) -> (Eq.{succ u2} (Set.{u2} V) (SetLike.coe.{u2, u2} (Submodule.{u3, u2} k V (Ring.toSemiring.{u3} k _inst_1) (AddCommGroup.toAddCommMonoid.{u2} V _inst_2) _inst_3) V (Submodule.setLike.{u3, u2} k V (Ring.toSemiring.{u3} k _inst_1) (AddCommGroup.toAddCommMonoid.{u2} V _inst_2) _inst_3) (AffineSubspace.direction.{u3, u2, u1} k V P _inst_1 _inst_2 _inst_3 _inst_4 s)) (VSub.vsub.{u2, u1} (Set.{u2} V) (Set.{u1} P) (Set.vsub.{u2, u1} V P (AddTorsor.toVSub.{u2, u1} V P (AddCommGroup.toAddGroup.{u2} V _inst_2) _inst_4)) (SetLike.coe.{u1, u1} (AffineSubspace.{u3, u2, u1} k V P _inst_1 _inst_2 _inst_3 _inst_4) P (AffineSubspace.instSetLikeAffineSubspace.{u3, u2, u1} k V P _inst_1 _inst_2 _inst_3 _inst_4) s) (SetLike.coe.{u1, u1} (AffineSubspace.{u3, u2, u1} k V P _inst_1 _inst_2 _inst_3 _inst_4) P (AffineSubspace.instSetLikeAffineSubspace.{u3, u2, u1} k V P _inst_1 _inst_2 _inst_3 _inst_4) s))) Case conversion may be inaccurate. Consider using '#align affine_subspace.coe_direction_eq_vsub_set AffineSubspace.coe_direction_eq_vsub_setₓ'. -/ /-- The set of vectors in the direction of a nonempty affine subspace is given by `vsub_set`. -/ theorem coe_direction_eq_vsub_set {s : AffineSubspace k P} (h : (s : Set P).Nonempty) : (s.direction : Set V) = (s : Set P) -ᵥ s := directionOfNonempty_eq_direction h ▸ rfl #align affine_subspace.coe_direction_eq_vsub_set AffineSubspace.coe_direction_eq_vsub_set /- warning: affine_subspace.mem_direction_iff_eq_vsub -> AffineSubspace.mem_direction_iff_eq_vsub is a dubious translation: lean 3 declaration is forall {k : Type.{u1}} {V : Type.{u2}} {P : Type.{u3}} [_inst_1 : Ring.{u1} k] [_inst_2 : AddCommGroup.{u2} V] [_inst_3 : Module.{u1, u2} k V (Ring.toSemiring.{u1} k _inst_1) (AddCommGroup.toAddCommMonoid.{u2} V _inst_2)] [_inst_4 : AddTorsor.{u2, u3} V P (AddCommGroup.toAddGroup.{u2} V _inst_2)] {s : AffineSubspace.{u1, u2, u3} k V P _inst_1 _inst_2 _inst_3 _inst_4}, (Set.Nonempty.{u3} P ((fun (a : Type.{u3}) (b : Type.{u3}) [self : HasLiftT.{succ u3, succ u3} a b] => self.0) (AffineSubspace.{u1, u2, u3} k V P _inst_1 _inst_2 _inst_3 _inst_4) (Set.{u3} P) (HasLiftT.mk.{succ u3, succ u3} (AffineSubspace.{u1, u2, u3} k V P _inst_1 _inst_2 _inst_3 _inst_4) (Set.{u3} P) (CoeTCₓ.coe.{succ u3, succ u3} (AffineSubspace.{u1, u2, u3} k V P _inst_1 _inst_2 _inst_3 _inst_4) (Set.{u3} P) (SetLike.Set.hasCoeT.{u3, u3} (AffineSubspace.{u1, u2, u3} k V P _inst_1 _inst_2 _inst_3 _inst_4) P (AffineSubspace.setLike.{u1, u2, u3} k V P _inst_1 _inst_2 _inst_3 _inst_4)))) s)) -> (forall (v : V), Iff (Membership.Mem.{u2, u2} V (Submodule.{u1, u2} k V (Ring.toSemiring.{u1} k _inst_1) (AddCommGroup.toAddCommMonoid.{u2} V _inst_2) _inst_3) (SetLike.hasMem.{u2, u2} (Submodule.{u1, u2} k V (Ring.toSemiring.{u1} k _inst_1) (AddCommGroup.toAddCommMonoid.{u2} V _inst_2) _inst_3) V (Submodule.setLike.{u1, u2} k V (Ring.toSemiring.{u1} k _inst_1) (AddCommGroup.toAddCommMonoid.{u2} V _inst_2) _inst_3)) v (AffineSubspace.direction.{u1, u2, u3} k V P _inst_1 _inst_2 _inst_3 _inst_4 s)) (Exists.{succ u3} P (fun (p1 : P) => Exists.{0} (Membership.Mem.{u3, u3} P (AffineSubspace.{u1, u2, u3} k V P _inst_1 _inst_2 _inst_3 _inst_4) (SetLike.hasMem.{u3, u3} (AffineSubspace.{u1, u2, u3} k V P _inst_1 _inst_2 _inst_3 _inst_4) P (AffineSubspace.setLike.{u1, u2, u3} k V P _inst_1 _inst_2 _inst_3 _inst_4)) p1 s) (fun (H : Membership.Mem.{u3, u3} P (AffineSubspace.{u1, u2, u3} k V P _inst_1 _inst_2 _inst_3 _inst_4) (SetLike.hasMem.{u3, u3} (AffineSubspace.{u1, u2, u3} k V P _inst_1 _inst_2 _inst_3 _inst_4) P (AffineSubspace.setLike.{u1, u2, u3} k V P _inst_1 _inst_2 _inst_3 _inst_4)) p1 s) => Exists.{succ u3} P (fun (p2 : P) => Exists.{0} (Membership.Mem.{u3, u3} P (AffineSubspace.{u1, u2, u3} k V P _inst_1 _inst_2 _inst_3 _inst_4) (SetLike.hasMem.{u3, u3} (AffineSubspace.{u1, u2, u3} k V P _inst_1 _inst_2 _inst_3 _inst_4) P (AffineSubspace.setLike.{u1, u2, u3} k V P _inst_1 _inst_2 _inst_3 _inst_4)) p2 s) (fun (H : Membership.Mem.{u3, u3} P (AffineSubspace.{u1, u2, u3} k V P _inst_1 _inst_2 _inst_3 _inst_4) (SetLike.hasMem.{u3, u3} (AffineSubspace.{u1, u2, u3} k V P _inst_1 _inst_2 _inst_3 _inst_4) P (AffineSubspace.setLike.{u1, u2, u3} k V P _inst_1 _inst_2 _inst_3 _inst_4)) p2 s) => Eq.{succ u2} V v (VSub.vsub.{u2, u3} V P (AddTorsor.toHasVsub.{u2, u3} V P (AddCommGroup.toAddGroup.{u2} V _inst_2) _inst_4) p1 p2))))))) but is expected to have type forall {k : Type.{u3}} {V : Type.{u2}} {P : Type.{u1}} [_inst_1 : Ring.{u3} k] [_inst_2 : AddCommGroup.{u2} V] [_inst_3 : Module.{u3, u2} k V (Ring.toSemiring.{u3} k _inst_1) (AddCommGroup.toAddCommMonoid.{u2} V _inst_2)] [_inst_4 : AddTorsor.{u2, u1} V P (AddCommGroup.toAddGroup.{u2} V _inst_2)] {s : AffineSubspace.{u3, u2, u1} k V P _inst_1 _inst_2 _inst_3 _inst_4}, (Set.Nonempty.{u1} P (SetLike.coe.{u1, u1} (AffineSubspace.{u3, u2, u1} k V P _inst_1 _inst_2 _inst_3 _inst_4) P (AffineSubspace.instSetLikeAffineSubspace.{u3, u2, u1} k V P _inst_1 _inst_2 _inst_3 _inst_4) s)) -> (forall (v : V), Iff (Membership.mem.{u2, u2} V (Submodule.{u3, u2} k V (Ring.toSemiring.{u3} k _inst_1) (AddCommGroup.toAddCommMonoid.{u2} V _inst_2) _inst_3) (SetLike.instMembership.{u2, u2} (Submodule.{u3, u2} k V (Ring.toSemiring.{u3} k _inst_1) (AddCommGroup.toAddCommMonoid.{u2} V _inst_2) _inst_3) V (Submodule.setLike.{u3, u2} k V (Ring.toSemiring.{u3} k _inst_1) (AddCommGroup.toAddCommMonoid.{u2} V _inst_2) _inst_3)) v (AffineSubspace.direction.{u3, u2, u1} k V P _inst_1 _inst_2 _inst_3 _inst_4 s)) (Exists.{succ u1} P (fun (p1 : P) => And (Membership.mem.{u1, u1} P (AffineSubspace.{u3, u2, u1} k V P _inst_1 _inst_2 _inst_3 _inst_4) (SetLike.instMembership.{u1, u1} (AffineSubspace.{u3, u2, u1} k V P _inst_1 _inst_2 _inst_3 _inst_4) P (AffineSubspace.instSetLikeAffineSubspace.{u3, u2, u1} k V P _inst_1 _inst_2 _inst_3 _inst_4)) p1 s) (Exists.{succ u1} P (fun (p2 : P) => And (Membership.mem.{u1, u1} P (AffineSubspace.{u3, u2, u1} k V P _inst_1 _inst_2 _inst_3 _inst_4) (SetLike.instMembership.{u1, u1} (AffineSubspace.{u3, u2, u1} k V P _inst_1 _inst_2 _inst_3 _inst_4) P (AffineSubspace.instSetLikeAffineSubspace.{u3, u2, u1} k V P _inst_1 _inst_2 _inst_3 _inst_4)) p2 s) (Eq.{succ u2} V v (VSub.vsub.{u2, u1} V P (AddTorsor.toVSub.{u2, u1} V P (AddCommGroup.toAddGroup.{u2} V _inst_2) _inst_4) p1 p2))))))) Case conversion may be inaccurate. Consider using '#align affine_subspace.mem_direction_iff_eq_vsub AffineSubspace.mem_direction_iff_eq_vsubₓ'. -/ /-- A vector is in the direction of a nonempty affine subspace if and only if it is the subtraction of two vectors in the subspace. -/ theorem mem_direction_iff_eq_vsub {s : AffineSubspace k P} (h : (s : Set P).Nonempty) (v : V) : v ∈ s.direction ↔ ∃ p1 ∈ s, ∃ p2 ∈ s, v = p1 -ᵥ p2 := by rw [← SetLike.mem_coe, coe_direction_eq_vsub_set h] exact ⟨fun ⟨p1, p2, hp1, hp2, hv⟩ => ⟨p1, hp1, p2, hp2, hv.symm⟩, fun ⟨p1, hp1, p2, hp2, hv⟩ => ⟨p1, p2, hp1, hp2, hv.symm⟩⟩ #align affine_subspace.mem_direction_iff_eq_vsub AffineSubspace.mem_direction_iff_eq_vsub /- warning: affine_subspace.vadd_mem_of_mem_direction -> AffineSubspace.vadd_mem_of_mem_direction is a dubious translation: lean 3 declaration is forall {k : Type.{u1}} {V : Type.{u2}} {P : Type.{u3}} [_inst_1 : Ring.{u1} k] [_inst_2 : AddCommGroup.{u2} V] [_inst_3 : Module.{u1, u2} k V (Ring.toSemiring.{u1} k _inst_1) (AddCommGroup.toAddCommMonoid.{u2} V _inst_2)] [_inst_4 : AddTorsor.{u2, u3} V P (AddCommGroup.toAddGroup.{u2} V _inst_2)] {s : AffineSubspace.{u1, u2, u3} k V P _inst_1 _inst_2 _inst_3 _inst_4} {v : V}, (Membership.Mem.{u2, u2} V (Submodule.{u1, u2} k V (Ring.toSemiring.{u1} k _inst_1) (AddCommGroup.toAddCommMonoid.{u2} V _inst_2) _inst_3) (SetLike.hasMem.{u2, u2} (Submodule.{u1, u2} k V (Ring.toSemiring.{u1} k _inst_1) (AddCommGroup.toAddCommMonoid.{u2} V _inst_2) _inst_3) V (Submodule.setLike.{u1, u2} k V (Ring.toSemiring.{u1} k _inst_1) (AddCommGroup.toAddCommMonoid.{u2} V _inst_2) _inst_3)) v (AffineSubspace.direction.{u1, u2, u3} k V P _inst_1 _inst_2 _inst_3 _inst_4 s)) -> (forall {p : P}, (Membership.Mem.{u3, u3} P (AffineSubspace.{u1, u2, u3} k V P _inst_1 _inst_2 _inst_3 _inst_4) (SetLike.hasMem.{u3, u3} (AffineSubspace.{u1, u2, u3} k V P _inst_1 _inst_2 _inst_3 _inst_4) P (AffineSubspace.setLike.{u1, u2, u3} k V P _inst_1 _inst_2 _inst_3 _inst_4)) p s) -> (Membership.Mem.{u3, u3} P (AffineSubspace.{u1, u2, u3} k V P _inst_1 _inst_2 _inst_3 _inst_4) (SetLike.hasMem.{u3, u3} (AffineSubspace.{u1, u2, u3} k V P _inst_1 _inst_2 _inst_3 _inst_4) P (AffineSubspace.setLike.{u1, u2, u3} k V P _inst_1 _inst_2 _inst_3 _inst_4)) (VAdd.vadd.{u2, u3} V P (AddAction.toHasVadd.{u2, u3} V P (SubNegMonoid.toAddMonoid.{u2} V (AddGroup.toSubNegMonoid.{u2} V (AddCommGroup.toAddGroup.{u2} V _inst_2))) (AddTorsor.toAddAction.{u2, u3} V P (AddCommGroup.toAddGroup.{u2} V _inst_2) _inst_4)) v p) s)) but is expected to have type forall {k : Type.{u3}} {V : Type.{u2}} {P : Type.{u1}} [_inst_1 : Ring.{u3} k] [_inst_2 : AddCommGroup.{u2} V] [_inst_3 : Module.{u3, u2} k V (Ring.toSemiring.{u3} k _inst_1) (AddCommGroup.toAddCommMonoid.{u2} V _inst_2)] [_inst_4 : AddTorsor.{u2, u1} V P (AddCommGroup.toAddGroup.{u2} V _inst_2)] {s : AffineSubspace.{u3, u2, u1} k V P _inst_1 _inst_2 _inst_3 _inst_4} {v : V}, (Membership.mem.{u2, u2} V (Submodule.{u3, u2} k V (Ring.toSemiring.{u3} k _inst_1) (AddCommGroup.toAddCommMonoid.{u2} V _inst_2) _inst_3) (SetLike.instMembership.{u2, u2} (Submodule.{u3, u2} k V (Ring.toSemiring.{u3} k _inst_1) (AddCommGroup.toAddCommMonoid.{u2} V _inst_2) _inst_3) V (Submodule.setLike.{u3, u2} k V (Ring.toSemiring.{u3} k _inst_1) (AddCommGroup.toAddCommMonoid.{u2} V _inst_2) _inst_3)) v (AffineSubspace.direction.{u3, u2, u1} k V P _inst_1 _inst_2 _inst_3 _inst_4 s)) -> (forall {p : P}, (Membership.mem.{u1, u1} P (AffineSubspace.{u3, u2, u1} k V P _inst_1 _inst_2 _inst_3 _inst_4) (SetLike.instMembership.{u1, u1} (AffineSubspace.{u3, u2, u1} k V P _inst_1 _inst_2 _inst_3 _inst_4) P (AffineSubspace.instSetLikeAffineSubspace.{u3, u2, u1} k V P _inst_1 _inst_2 _inst_3 _inst_4)) p s) -> (Membership.mem.{u1, u1} P (AffineSubspace.{u3, u2, u1} k V P _inst_1 _inst_2 _inst_3 _inst_4) (SetLike.instMembership.{u1, u1} (AffineSubspace.{u3, u2, u1} k V P _inst_1 _inst_2 _inst_3 _inst_4) P (AffineSubspace.instSetLikeAffineSubspace.{u3, u2, u1} k V P _inst_1 _inst_2 _inst_3 _inst_4)) (HVAdd.hVAdd.{u2, u1, u1} V P P (instHVAdd.{u2, u1} V P (AddAction.toVAdd.{u2, u1} V P (SubNegMonoid.toAddMonoid.{u2} V (AddGroup.toSubNegMonoid.{u2} V (AddCommGroup.toAddGroup.{u2} V _inst_2))) (AddTorsor.toAddAction.{u2, u1} V P (AddCommGroup.toAddGroup.{u2} V _inst_2) _inst_4))) v p) s)) Case conversion may be inaccurate. Consider using '#align affine_subspace.vadd_mem_of_mem_direction AffineSubspace.vadd_mem_of_mem_directionₓ'. -/ /-- Adding a vector in the direction to a point in the subspace produces a point in the subspace. -/ theorem vadd_mem_of_mem_direction {s : AffineSubspace k P} {v : V} (hv : v ∈ s.direction) {p : P} (hp : p ∈ s) : v +ᵥ p ∈ s := by rw [mem_direction_iff_eq_vsub ⟨p, hp⟩] at hv rcases hv with ⟨p1, hp1, p2, hp2, hv⟩ rw [hv] convert s.smul_vsub_vadd_mem 1 hp1 hp2 hp rw [one_smul] #align affine_subspace.vadd_mem_of_mem_direction AffineSubspace.vadd_mem_of_mem_direction /- warning: affine_subspace.vsub_mem_direction -> AffineSubspace.vsub_mem_direction is a dubious translation: lean 3 declaration is forall {k : Type.{u1}} {V : Type.{u2}} {P : Type.{u3}} [_inst_1 : Ring.{u1} k] [_inst_2 : AddCommGroup.{u2} V] [_inst_3 : Module.{u1, u2} k V (Ring.toSemiring.{u1} k _inst_1) (AddCommGroup.toAddCommMonoid.{u2} V _inst_2)] [_inst_4 : AddTorsor.{u2, u3} V P (AddCommGroup.toAddGroup.{u2} V _inst_2)] {s : AffineSubspace.{u1, u2, u3} k V P _inst_1 _inst_2 _inst_3 _inst_4} {p1 : P} {p2 : P}, (Membership.Mem.{u3, u3} P (AffineSubspace.{u1, u2, u3} k V P _inst_1 _inst_2 _inst_3 _inst_4) (SetLike.hasMem.{u3, u3} (AffineSubspace.{u1, u2, u3} k V P _inst_1 _inst_2 _inst_3 _inst_4) P (AffineSubspace.setLike.{u1, u2, u3} k V P _inst_1 _inst_2 _inst_3 _inst_4)) p1 s) -> (Membership.Mem.{u3, u3} P (AffineSubspace.{u1, u2, u3} k V P _inst_1 _inst_2 _inst_3 _inst_4) (SetLike.hasMem.{u3, u3} (AffineSubspace.{u1, u2, u3} k V P _inst_1 _inst_2 _inst_3 _inst_4) P (AffineSubspace.setLike.{u1, u2, u3} k V P _inst_1 _inst_2 _inst_3 _inst_4)) p2 s) -> (Membership.Mem.{u2, u2} V (Submodule.{u1, u2} k V (Ring.toSemiring.{u1} k _inst_1) (AddCommGroup.toAddCommMonoid.{u2} V _inst_2) _inst_3) (SetLike.hasMem.{u2, u2} (Submodule.{u1, u2} k V (Ring.toSemiring.{u1} k _inst_1) (AddCommGroup.toAddCommMonoid.{u2} V _inst_2) _inst_3) V (Submodule.setLike.{u1, u2} k V (Ring.toSemiring.{u1} k _inst_1) (AddCommGroup.toAddCommMonoid.{u2} V _inst_2) _inst_3)) (VSub.vsub.{u2, u3} V P (AddTorsor.toHasVsub.{u2, u3} V P (AddCommGroup.toAddGroup.{u2} V _inst_2) _inst_4) p1 p2) (AffineSubspace.direction.{u1, u2, u3} k V P _inst_1 _inst_2 _inst_3 _inst_4 s)) but is expected to have type forall {k : Type.{u3}} {V : Type.{u2}} {P : Type.{u1}} [_inst_1 : Ring.{u3} k] [_inst_2 : AddCommGroup.{u2} V] [_inst_3 : Module.{u3, u2} k V (Ring.toSemiring.{u3} k _inst_1) (AddCommGroup.toAddCommMonoid.{u2} V _inst_2)] [_inst_4 : AddTorsor.{u2, u1} V P (AddCommGroup.toAddGroup.{u2} V _inst_2)] {s : AffineSubspace.{u3, u2, u1} k V P _inst_1 _inst_2 _inst_3 _inst_4} {p1 : P} {p2 : P}, (Membership.mem.{u1, u1} P (AffineSubspace.{u3, u2, u1} k V P _inst_1 _inst_2 _inst_3 _inst_4) (SetLike.instMembership.{u1, u1} (AffineSubspace.{u3, u2, u1} k V P _inst_1 _inst_2 _inst_3 _inst_4) P (AffineSubspace.instSetLikeAffineSubspace.{u3, u2, u1} k V P _inst_1 _inst_2 _inst_3 _inst_4)) p1 s) -> (Membership.mem.{u1, u1} P (AffineSubspace.{u3, u2, u1} k V P _inst_1 _inst_2 _inst_3 _inst_4) (SetLike.instMembership.{u1, u1} (AffineSubspace.{u3, u2, u1} k V P _inst_1 _inst_2 _inst_3 _inst_4) P (AffineSubspace.instSetLikeAffineSubspace.{u3, u2, u1} k V P _inst_1 _inst_2 _inst_3 _inst_4)) p2 s) -> (Membership.mem.{u2, u2} V (Submodule.{u3, u2} k V (Ring.toSemiring.{u3} k _inst_1) (AddCommGroup.toAddCommMonoid.{u2} V _inst_2) _inst_3) (SetLike.instMembership.{u2, u2} (Submodule.{u3, u2} k V (Ring.toSemiring.{u3} k _inst_1) (AddCommGroup.toAddCommMonoid.{u2} V _inst_2) _inst_3) V (Submodule.setLike.{u3, u2} k V (Ring.toSemiring.{u3} k _inst_1) (AddCommGroup.toAddCommMonoid.{u2} V _inst_2) _inst_3)) (VSub.vsub.{u2, u1} V P (AddTorsor.toVSub.{u2, u1} V P (AddCommGroup.toAddGroup.{u2} V _inst_2) _inst_4) p1 p2) (AffineSubspace.direction.{u3, u2, u1} k V P _inst_1 _inst_2 _inst_3 _inst_4 s)) Case conversion may be inaccurate. Consider using '#align affine_subspace.vsub_mem_direction AffineSubspace.vsub_mem_directionₓ'. -/ /-- Subtracting two points in the subspace produces a vector in the direction. -/ theorem vsub_mem_direction {s : AffineSubspace k P} {p1 p2 : P} (hp1 : p1 ∈ s) (hp2 : p2 ∈ s) : p1 -ᵥ p2 ∈ s.direction := vsub_mem_vectorSpan k hp1 hp2 #align affine_subspace.vsub_mem_direction AffineSubspace.vsub_mem_direction /- warning: affine_subspace.vadd_mem_iff_mem_direction -> AffineSubspace.vadd_mem_iff_mem_direction is a dubious translation: lean 3 declaration is forall {k : Type.{u1}} {V : Type.{u2}} {P : Type.{u3}} [_inst_1 : Ring.{u1} k] [_inst_2 : AddCommGroup.{u2} V] [_inst_3 : Module.{u1, u2} k V (Ring.toSemiring.{u1} k _inst_1) (AddCommGroup.toAddCommMonoid.{u2} V _inst_2)] [_inst_4 : AddTorsor.{u2, u3} V P (AddCommGroup.toAddGroup.{u2} V _inst_2)] {s : AffineSubspace.{u1, u2, u3} k V P _inst_1 _inst_2 _inst_3 _inst_4} (v : V) {p : P}, (Membership.Mem.{u3, u3} P (AffineSubspace.{u1, u2, u3} k V P _inst_1 _inst_2 _inst_3 _inst_4) (SetLike.hasMem.{u3, u3} (AffineSubspace.{u1, u2, u3} k V P _inst_1 _inst_2 _inst_3 _inst_4) P (AffineSubspace.setLike.{u1, u2, u3} k V P _inst_1 _inst_2 _inst_3 _inst_4)) p s) -> (Iff (Membership.Mem.{u3, u3} P (AffineSubspace.{u1, u2, u3} k V P _inst_1 _inst_2 _inst_3 _inst_4) (SetLike.hasMem.{u3, u3} (AffineSubspace.{u1, u2, u3} k V P _inst_1 _inst_2 _inst_3 _inst_4) P (AffineSubspace.setLike.{u1, u2, u3} k V P _inst_1 _inst_2 _inst_3 _inst_4)) (VAdd.vadd.{u2, u3} V P (AddAction.toHasVadd.{u2, u3} V P (SubNegMonoid.toAddMonoid.{u2} V (AddGroup.toSubNegMonoid.{u2} V (AddCommGroup.toAddGroup.{u2} V _inst_2))) (AddTorsor.toAddAction.{u2, u3} V P (AddCommGroup.toAddGroup.{u2} V _inst_2) _inst_4)) v p) s) (Membership.Mem.{u2, u2} V (Submodule.{u1, u2} k V (Ring.toSemiring.{u1} k _inst_1) (AddCommGroup.toAddCommMonoid.{u2} V _inst_2) _inst_3) (SetLike.hasMem.{u2, u2} (Submodule.{u1, u2} k V (Ring.toSemiring.{u1} k _inst_1) (AddCommGroup.toAddCommMonoid.{u2} V _inst_2) _inst_3) V (Submodule.setLike.{u1, u2} k V (Ring.toSemiring.{u1} k _inst_1) (AddCommGroup.toAddCommMonoid.{u2} V _inst_2) _inst_3)) v (AffineSubspace.direction.{u1, u2, u3} k V P _inst_1 _inst_2 _inst_3 _inst_4 s))) but is expected to have type forall {k : Type.{u3}} {V : Type.{u2}} {P : Type.{u1}} [_inst_1 : Ring.{u3} k] [_inst_2 : AddCommGroup.{u2} V] [_inst_3 : Module.{u3, u2} k V (Ring.toSemiring.{u3} k _inst_1) (AddCommGroup.toAddCommMonoid.{u2} V _inst_2)] [_inst_4 : AddTorsor.{u2, u1} V P (AddCommGroup.toAddGroup.{u2} V _inst_2)] {s : AffineSubspace.{u3, u2, u1} k V P _inst_1 _inst_2 _inst_3 _inst_4} (v : V) {p : P}, (Membership.mem.{u1, u1} P (AffineSubspace.{u3, u2, u1} k V P _inst_1 _inst_2 _inst_3 _inst_4) (SetLike.instMembership.{u1, u1} (AffineSubspace.{u3, u2, u1} k V P _inst_1 _inst_2 _inst_3 _inst_4) P (AffineSubspace.instSetLikeAffineSubspace.{u3, u2, u1} k V P _inst_1 _inst_2 _inst_3 _inst_4)) p s) -> (Iff (Membership.mem.{u1, u1} P (AffineSubspace.{u3, u2, u1} k V P _inst_1 _inst_2 _inst_3 _inst_4) (SetLike.instMembership.{u1, u1} (AffineSubspace.{u3, u2, u1} k V P _inst_1 _inst_2 _inst_3 _inst_4) P (AffineSubspace.instSetLikeAffineSubspace.{u3, u2, u1} k V P _inst_1 _inst_2 _inst_3 _inst_4)) (HVAdd.hVAdd.{u2, u1, u1} V P P (instHVAdd.{u2, u1} V P (AddAction.toVAdd.{u2, u1} V P (SubNegMonoid.toAddMonoid.{u2} V (AddGroup.toSubNegMonoid.{u2} V (AddCommGroup.toAddGroup.{u2} V _inst_2))) (AddTorsor.toAddAction.{u2, u1} V P (AddCommGroup.toAddGroup.{u2} V _inst_2) _inst_4))) v p) s) (Membership.mem.{u2, u2} V (Submodule.{u3, u2} k V (Ring.toSemiring.{u3} k _inst_1) (AddCommGroup.toAddCommMonoid.{u2} V _inst_2) _inst_3) (SetLike.instMembership.{u2, u2} (Submodule.{u3, u2} k V (Ring.toSemiring.{u3} k _inst_1) (AddCommGroup.toAddCommMonoid.{u2} V _inst_2) _inst_3) V (Submodule.setLike.{u3, u2} k V (Ring.toSemiring.{u3} k _inst_1) (AddCommGroup.toAddCommMonoid.{u2} V _inst_2) _inst_3)) v (AffineSubspace.direction.{u3, u2, u1} k V P _inst_1 _inst_2 _inst_3 _inst_4 s))) Case conversion may be inaccurate. Consider using '#align affine_subspace.vadd_mem_iff_mem_direction AffineSubspace.vadd_mem_iff_mem_directionₓ'. -/ /-- Adding a vector to a point in a subspace produces a point in the subspace if and only if the vector is in the direction. -/ theorem vadd_mem_iff_mem_direction {s : AffineSubspace k P} (v : V) {p : P} (hp : p ∈ s) : v +ᵥ p ∈ s ↔ v ∈ s.direction := ⟨fun h => by simpa using vsub_mem_direction h hp, fun h => vadd_mem_of_mem_direction h hp⟩ #align affine_subspace.vadd_mem_iff_mem_direction AffineSubspace.vadd_mem_iff_mem_direction /- warning: affine_subspace.vadd_mem_iff_mem_of_mem_direction -> AffineSubspace.vadd_mem_iff_mem_of_mem_direction is a dubious translation: lean 3 declaration is forall {k : Type.{u1}} {V : Type.{u2}} {P : Type.{u3}} [_inst_1 : Ring.{u1} k] [_inst_2 : AddCommGroup.{u2} V] [_inst_3 : Module.{u1, u2} k V (Ring.toSemiring.{u1} k _inst_1) (AddCommGroup.toAddCommMonoid.{u2} V _inst_2)] [_inst_4 : AddTorsor.{u2, u3} V P (AddCommGroup.toAddGroup.{u2} V _inst_2)] {s : AffineSubspace.{u1, u2, u3} k V P _inst_1 _inst_2 _inst_3 _inst_4} {v : V}, (Membership.Mem.{u2, u2} V (Submodule.{u1, u2} k V (Ring.toSemiring.{u1} k _inst_1) (AddCommGroup.toAddCommMonoid.{u2} V _inst_2) _inst_3) (SetLike.hasMem.{u2, u2} (Submodule.{u1, u2} k V (Ring.toSemiring.{u1} k _inst_1) (AddCommGroup.toAddCommMonoid.{u2} V _inst_2) _inst_3) V (Submodule.setLike.{u1, u2} k V (Ring.toSemiring.{u1} k _inst_1) (AddCommGroup.toAddCommMonoid.{u2} V _inst_2) _inst_3)) v (AffineSubspace.direction.{u1, u2, u3} k V P _inst_1 _inst_2 _inst_3 _inst_4 s)) -> (forall {p : P}, Iff (Membership.Mem.{u3, u3} P (AffineSubspace.{u1, u2, u3} k V P _inst_1 _inst_2 _inst_3 _inst_4) (SetLike.hasMem.{u3, u3} (AffineSubspace.{u1, u2, u3} k V P _inst_1 _inst_2 _inst_3 _inst_4) P (AffineSubspace.setLike.{u1, u2, u3} k V P _inst_1 _inst_2 _inst_3 _inst_4)) (VAdd.vadd.{u2, u3} V P (AddAction.toHasVadd.{u2, u3} V P (SubNegMonoid.toAddMonoid.{u2} V (AddGroup.toSubNegMonoid.{u2} V (AddCommGroup.toAddGroup.{u2} V _inst_2))) (AddTorsor.toAddAction.{u2, u3} V P (AddCommGroup.toAddGroup.{u2} V _inst_2) _inst_4)) v p) s) (Membership.Mem.{u3, u3} P (AffineSubspace.{u1, u2, u3} k V P _inst_1 _inst_2 _inst_3 _inst_4) (SetLike.hasMem.{u3, u3} (AffineSubspace.{u1, u2, u3} k V P _inst_1 _inst_2 _inst_3 _inst_4) P (AffineSubspace.setLike.{u1, u2, u3} k V P _inst_1 _inst_2 _inst_3 _inst_4)) p s)) but is expected to have type forall {k : Type.{u3}} {V : Type.{u2}} {P : Type.{u1}} [_inst_1 : Ring.{u3} k] [_inst_2 : AddCommGroup.{u2} V] [_inst_3 : Module.{u3, u2} k V (Ring.toSemiring.{u3} k _inst_1) (AddCommGroup.toAddCommMonoid.{u2} V _inst_2)] [_inst_4 : AddTorsor.{u2, u1} V P (AddCommGroup.toAddGroup.{u2} V _inst_2)] {s : AffineSubspace.{u3, u2, u1} k V P _inst_1 _inst_2 _inst_3 _inst_4} {v : V}, (Membership.mem.{u2, u2} V (Submodule.{u3, u2} k V (Ring.toSemiring.{u3} k _inst_1) (AddCommGroup.toAddCommMonoid.{u2} V _inst_2) _inst_3) (SetLike.instMembership.{u2, u2} (Submodule.{u3, u2} k V (Ring.toSemiring.{u3} k _inst_1) (AddCommGroup.toAddCommMonoid.{u2} V _inst_2) _inst_3) V (Submodule.setLike.{u3, u2} k V (Ring.toSemiring.{u3} k _inst_1) (AddCommGroup.toAddCommMonoid.{u2} V _inst_2) _inst_3)) v (AffineSubspace.direction.{u3, u2, u1} k V P _inst_1 _inst_2 _inst_3 _inst_4 s)) -> (forall {p : P}, Iff (Membership.mem.{u1, u1} P (AffineSubspace.{u3, u2, u1} k V P _inst_1 _inst_2 _inst_3 _inst_4) (SetLike.instMembership.{u1, u1} (AffineSubspace.{u3, u2, u1} k V P _inst_1 _inst_2 _inst_3 _inst_4) P (AffineSubspace.instSetLikeAffineSubspace.{u3, u2, u1} k V P _inst_1 _inst_2 _inst_3 _inst_4)) (HVAdd.hVAdd.{u2, u1, u1} V P P (instHVAdd.{u2, u1} V P (AddAction.toVAdd.{u2, u1} V P (SubNegMonoid.toAddMonoid.{u2} V (AddGroup.toSubNegMonoid.{u2} V (AddCommGroup.toAddGroup.{u2} V _inst_2))) (AddTorsor.toAddAction.{u2, u1} V P (AddCommGroup.toAddGroup.{u2} V _inst_2) _inst_4))) v p) s) (Membership.mem.{u1, u1} P (AffineSubspace.{u3, u2, u1} k V P _inst_1 _inst_2 _inst_3 _inst_4) (SetLike.instMembership.{u1, u1} (AffineSubspace.{u3, u2, u1} k V P _inst_1 _inst_2 _inst_3 _inst_4) P (AffineSubspace.instSetLikeAffineSubspace.{u3, u2, u1} k V P _inst_1 _inst_2 _inst_3 _inst_4)) p s)) Case conversion may be inaccurate. Consider using '#align affine_subspace.vadd_mem_iff_mem_of_mem_direction AffineSubspace.vadd_mem_iff_mem_of_mem_directionₓ'. -/ /-- Adding a vector in the direction to a point produces a point in the subspace if and only if the original point is in the subspace. -/ theorem vadd_mem_iff_mem_of_mem_direction {s : AffineSubspace k P} {v : V} (hv : v ∈ s.direction) {p : P} : v +ᵥ p ∈ s ↔ p ∈ s := by refine' ⟨fun h => _, fun h => vadd_mem_of_mem_direction hv h⟩ convert vadd_mem_of_mem_direction (Submodule.neg_mem _ hv) h simp #align affine_subspace.vadd_mem_iff_mem_of_mem_direction AffineSubspace.vadd_mem_iff_mem_of_mem_direction /- warning: affine_subspace.coe_direction_eq_vsub_set_right -> AffineSubspace.coe_direction_eq_vsub_set_right is a dubious translation: lean 3 declaration is forall {k : Type.{u1}} {V : Type.{u2}} {P : Type.{u3}} [_inst_1 : Ring.{u1} k] [_inst_2 : AddCommGroup.{u2} V] [_inst_3 : Module.{u1, u2} k V (Ring.toSemiring.{u1} k _inst_1) (AddCommGroup.toAddCommMonoid.{u2} V _inst_2)] [_inst_4 : AddTorsor.{u2, u3} V P (AddCommGroup.toAddGroup.{u2} V _inst_2)] {s : AffineSubspace.{u1, u2, u3} k V P _inst_1 _inst_2 _inst_3 _inst_4} {p : P}, (Membership.Mem.{u3, u3} P (AffineSubspace.{u1, u2, u3} k V P _inst_1 _inst_2 _inst_3 _inst_4) (SetLike.hasMem.{u3, u3} (AffineSubspace.{u1, u2, u3} k V P _inst_1 _inst_2 _inst_3 _inst_4) P (AffineSubspace.setLike.{u1, u2, u3} k V P _inst_1 _inst_2 _inst_3 _inst_4)) p s) -> (Eq.{succ u2} (Set.{u2} V) ((fun (a : Type.{u2}) (b : Type.{u2}) [self : HasLiftT.{succ u2, succ u2} a b] => self.0) (Submodule.{u1, u2} k V (Ring.toSemiring.{u1} k _inst_1) (AddCommGroup.toAddCommMonoid.{u2} V _inst_2) _inst_3) (Set.{u2} V) (HasLiftT.mk.{succ u2, succ u2} (Submodule.{u1, u2} k V (Ring.toSemiring.{u1} k _inst_1) (AddCommGroup.toAddCommMonoid.{u2} V _inst_2) _inst_3) (Set.{u2} V) (CoeTCₓ.coe.{succ u2, succ u2} (Submodule.{u1, u2} k V (Ring.toSemiring.{u1} k _inst_1) (AddCommGroup.toAddCommMonoid.{u2} V _inst_2) _inst_3) (Set.{u2} V) (SetLike.Set.hasCoeT.{u2, u2} (Submodule.{u1, u2} k V (Ring.toSemiring.{u1} k _inst_1) (AddCommGroup.toAddCommMonoid.{u2} V _inst_2) _inst_3) V (Submodule.setLike.{u1, u2} k V (Ring.toSemiring.{u1} k _inst_1) (AddCommGroup.toAddCommMonoid.{u2} V _inst_2) _inst_3)))) (AffineSubspace.direction.{u1, u2, u3} k V P _inst_1 _inst_2 _inst_3 _inst_4 s)) (Set.image.{u3, u2} P V (fun (_x : P) => VSub.vsub.{u2, u3} V P (AddTorsor.toHasVsub.{u2, u3} V P (AddCommGroup.toAddGroup.{u2} V _inst_2) _inst_4) _x p) ((fun (a : Type.{u3}) (b : Type.{u3}) [self : HasLiftT.{succ u3, succ u3} a b] => self.0) (AffineSubspace.{u1, u2, u3} k V P _inst_1 _inst_2 _inst_3 _inst_4) (Set.{u3} P) (HasLiftT.mk.{succ u3, succ u3} (AffineSubspace.{u1, u2, u3} k V P _inst_1 _inst_2 _inst_3 _inst_4) (Set.{u3} P) (CoeTCₓ.coe.{succ u3, succ u3} (AffineSubspace.{u1, u2, u3} k V P _inst_1 _inst_2 _inst_3 _inst_4) (Set.{u3} P) (SetLike.Set.hasCoeT.{u3, u3} (AffineSubspace.{u1, u2, u3} k V P _inst_1 _inst_2 _inst_3 _inst_4) P (AffineSubspace.setLike.{u1, u2, u3} k V P _inst_1 _inst_2 _inst_3 _inst_4)))) s))) but is expected to have type forall {k : Type.{u3}} {V : Type.{u2}} {P : Type.{u1}} [_inst_1 : Ring.{u3} k] [_inst_2 : AddCommGroup.{u2} V] [_inst_3 : Module.{u3, u2} k V (Ring.toSemiring.{u3} k _inst_1) (AddCommGroup.toAddCommMonoid.{u2} V _inst_2)] [_inst_4 : AddTorsor.{u2, u1} V P (AddCommGroup.toAddGroup.{u2} V _inst_2)] {s : AffineSubspace.{u3, u2, u1} k V P _inst_1 _inst_2 _inst_3 _inst_4} {p : P}, (Membership.mem.{u1, u1} P (AffineSubspace.{u3, u2, u1} k V P _inst_1 _inst_2 _inst_3 _inst_4) (SetLike.instMembership.{u1, u1} (AffineSubspace.{u3, u2, u1} k V P _inst_1 _inst_2 _inst_3 _inst_4) P (AffineSubspace.instSetLikeAffineSubspace.{u3, u2, u1} k V P _inst_1 _inst_2 _inst_3 _inst_4)) p s) -> (Eq.{succ u2} (Set.{u2} V) (SetLike.coe.{u2, u2} (Submodule.{u3, u2} k V (Ring.toSemiring.{u3} k _inst_1) (AddCommGroup.toAddCommMonoid.{u2} V _inst_2) _inst_3) V (Submodule.setLike.{u3, u2} k V (Ring.toSemiring.{u3} k _inst_1) (AddCommGroup.toAddCommMonoid.{u2} V _inst_2) _inst_3) (AffineSubspace.direction.{u3, u2, u1} k V P _inst_1 _inst_2 _inst_3 _inst_4 s)) (Set.image.{u1, u2} P V (fun (_x : P) => VSub.vsub.{u2, u1} V P (AddTorsor.toVSub.{u2, u1} V P (AddCommGroup.toAddGroup.{u2} V _inst_2) _inst_4) _x p) (SetLike.coe.{u1, u1} (AffineSubspace.{u3, u2, u1} k V P _inst_1 _inst_2 _inst_3 _inst_4) P (AffineSubspace.instSetLikeAffineSubspace.{u3, u2, u1} k V P _inst_1 _inst_2 _inst_3 _inst_4) s))) Case conversion may be inaccurate. Consider using '#align affine_subspace.coe_direction_eq_vsub_set_right AffineSubspace.coe_direction_eq_vsub_set_rightₓ'. -/ /-- Given a point in an affine subspace, the set of vectors in its direction equals the set of vectors subtracting that point on the right. -/ theorem coe_direction_eq_vsub_set_right {s : AffineSubspace k P} {p : P} (hp : p ∈ s) : (s.direction : Set V) = (· -ᵥ p) '' s := by rw [coe_direction_eq_vsub_set ⟨p, hp⟩] refine' le_antisymm _ _ · rintro v ⟨p1, p2, hp1, hp2, rfl⟩ exact ⟨p1 -ᵥ p2 +ᵥ p, vadd_mem_of_mem_direction (vsub_mem_direction hp1 hp2) hp, vadd_vsub _ _⟩ · rintro v ⟨p2, hp2, rfl⟩ exact ⟨p2, p, hp2, hp, rfl⟩ #align affine_subspace.coe_direction_eq_vsub_set_right AffineSubspace.coe_direction_eq_vsub_set_right /- warning: affine_subspace.coe_direction_eq_vsub_set_left -> AffineSubspace.coe_direction_eq_vsub_set_left is a dubious translation: lean 3 declaration is forall {k : Type.{u1}} {V : Type.{u2}} {P : Type.{u3}} [_inst_1 : Ring.{u1} k] [_inst_2 : AddCommGroup.{u2} V] [_inst_3 : Module.{u1, u2} k V (Ring.toSemiring.{u1} k _inst_1) (AddCommGroup.toAddCommMonoid.{u2} V _inst_2)] [_inst_4 : AddTorsor.{u2, u3} V P (AddCommGroup.toAddGroup.{u2} V _inst_2)] {s : AffineSubspace.{u1, u2, u3} k V P _inst_1 _inst_2 _inst_3 _inst_4} {p : P}, (Membership.Mem.{u3, u3} P (AffineSubspace.{u1, u2, u3} k V P _inst_1 _inst_2 _inst_3 _inst_4) (SetLike.hasMem.{u3, u3} (AffineSubspace.{u1, u2, u3} k V P _inst_1 _inst_2 _inst_3 _inst_4) P (AffineSubspace.setLike.{u1, u2, u3} k V P _inst_1 _inst_2 _inst_3 _inst_4)) p s) -> (Eq.{succ u2} (Set.{u2} V) ((fun (a : Type.{u2}) (b : Type.{u2}) [self : HasLiftT.{succ u2, succ u2} a b] => self.0) (Submodule.{u1, u2} k V (Ring.toSemiring.{u1} k _inst_1) (AddCommGroup.toAddCommMonoid.{u2} V _inst_2) _inst_3) (Set.{u2} V) (HasLiftT.mk.{succ u2, succ u2} (Submodule.{u1, u2} k V (Ring.toSemiring.{u1} k _inst_1) (AddCommGroup.toAddCommMonoid.{u2} V _inst_2) _inst_3) (Set.{u2} V) (CoeTCₓ.coe.{succ u2, succ u2} (Submodule.{u1, u2} k V (Ring.toSemiring.{u1} k _inst_1) (AddCommGroup.toAddCommMonoid.{u2} V _inst_2) _inst_3) (Set.{u2} V) (SetLike.Set.hasCoeT.{u2, u2} (Submodule.{u1, u2} k V (Ring.toSemiring.{u1} k _inst_1) (AddCommGroup.toAddCommMonoid.{u2} V _inst_2) _inst_3) V (Submodule.setLike.{u1, u2} k V (Ring.toSemiring.{u1} k _inst_1) (AddCommGroup.toAddCommMonoid.{u2} V _inst_2) _inst_3)))) (AffineSubspace.direction.{u1, u2, u3} k V P _inst_1 _inst_2 _inst_3 _inst_4 s)) (Set.image.{u3, u2} P V (VSub.vsub.{u2, u3} V P (AddTorsor.toHasVsub.{u2, u3} V P (AddCommGroup.toAddGroup.{u2} V _inst_2) _inst_4) p) ((fun (a : Type.{u3}) (b : Type.{u3}) [self : HasLiftT.{succ u3, succ u3} a b] => self.0) (AffineSubspace.{u1, u2, u3} k V P _inst_1 _inst_2 _inst_3 _inst_4) (Set.{u3} P) (HasLiftT.mk.{succ u3, succ u3} (AffineSubspace.{u1, u2, u3} k V P _inst_1 _inst_2 _inst_3 _inst_4) (Set.{u3} P) (CoeTCₓ.coe.{succ u3, succ u3} (AffineSubspace.{u1, u2, u3} k V P _inst_1 _inst_2 _inst_3 _inst_4) (Set.{u3} P) (SetLike.Set.hasCoeT.{u3, u3} (AffineSubspace.{u1, u2, u3} k V P _inst_1 _inst_2 _inst_3 _inst_4) P (AffineSubspace.setLike.{u1, u2, u3} k V P _inst_1 _inst_2 _inst_3 _inst_4)))) s))) but is expected to have type forall {k : Type.{u3}} {V : Type.{u2}} {P : Type.{u1}} [_inst_1 : Ring.{u3} k] [_inst_2 : AddCommGroup.{u2} V] [_inst_3 : Module.{u3, u2} k V (Ring.toSemiring.{u3} k _inst_1) (AddCommGroup.toAddCommMonoid.{u2} V _inst_2)] [_inst_4 : AddTorsor.{u2, u1} V P (AddCommGroup.toAddGroup.{u2} V _inst_2)] {s : AffineSubspace.{u3, u2, u1} k V P _inst_1 _inst_2 _inst_3 _inst_4} {p : P}, (Membership.mem.{u1, u1} P (AffineSubspace.{u3, u2, u1} k V P _inst_1 _inst_2 _inst_3 _inst_4) (SetLike.instMembership.{u1, u1} (AffineSubspace.{u3, u2, u1} k V P _inst_1 _inst_2 _inst_3 _inst_4) P (AffineSubspace.instSetLikeAffineSubspace.{u3, u2, u1} k V P _inst_1 _inst_2 _inst_3 _inst_4)) p s) -> (Eq.{succ u2} (Set.{u2} V) (SetLike.coe.{u2, u2} (Submodule.{u3, u2} k V (Ring.toSemiring.{u3} k _inst_1) (AddCommGroup.toAddCommMonoid.{u2} V _inst_2) _inst_3) V (Submodule.setLike.{u3, u2} k V (Ring.toSemiring.{u3} k _inst_1) (AddCommGroup.toAddCommMonoid.{u2} V _inst_2) _inst_3) (AffineSubspace.direction.{u3, u2, u1} k V P _inst_1 _inst_2 _inst_3 _inst_4 s)) (Set.image.{u1, u2} P V ((fun ([email protected]._hyg.2822 : P) ([email protected]._hyg.2824 : P) => VSub.vsub.{u2, u1} V P (AddTorsor.toVSub.{u2, u1} V P (AddCommGroup.toAddGroup.{u2} V _inst_2) _inst_4) [email protected]._hyg.2822 [email protected]._hyg.2824) p) (SetLike.coe.{u1, u1} (AffineSubspace.{u3, u2, u1} k V P _inst_1 _inst_2 _inst_3 _inst_4) P (AffineSubspace.instSetLikeAffineSubspace.{u3, u2, u1} k V P _inst_1 _inst_2 _inst_3 _inst_4) s))) Case conversion may be inaccurate. Consider using '#align affine_subspace.coe_direction_eq_vsub_set_left AffineSubspace.coe_direction_eq_vsub_set_leftₓ'. -/ /-- Given a point in an affine subspace, the set of vectors in its direction equals the set of vectors subtracting that point on the left. -/ theorem coe_direction_eq_vsub_set_left {s : AffineSubspace k P} {p : P} (hp : p ∈ s) : (s.direction : Set V) = (· -ᵥ ·) p '' s := by ext v rw [SetLike.mem_coe, ← Submodule.neg_mem_iff, ← SetLike.mem_coe, coe_direction_eq_vsub_set_right hp, Set.mem_image_iff_bex, Set.mem_image_iff_bex] conv_lhs => congr ext rw [← neg_vsub_eq_vsub_rev, neg_inj] #align affine_subspace.coe_direction_eq_vsub_set_left AffineSubspace.coe_direction_eq_vsub_set_left /- warning: affine_subspace.mem_direction_iff_eq_vsub_right -> AffineSubspace.mem_direction_iff_eq_vsub_right is a dubious translation: lean 3 declaration is forall {k : Type.{u1}} {V : Type.{u2}} {P : Type.{u3}} [_inst_1 : Ring.{u1} k] [_inst_2 : AddCommGroup.{u2} V] [_inst_3 : Module.{u1, u2} k V (Ring.toSemiring.{u1} k _inst_1) (AddCommGroup.toAddCommMonoid.{u2} V _inst_2)] [_inst_4 : AddTorsor.{u2, u3} V P (AddCommGroup.toAddGroup.{u2} V _inst_2)] {s : AffineSubspace.{u1, u2, u3} k V P _inst_1 _inst_2 _inst_3 _inst_4} {p : P}, (Membership.Mem.{u3, u3} P (AffineSubspace.{u1, u2, u3} k V P _inst_1 _inst_2 _inst_3 _inst_4) (SetLike.hasMem.{u3, u3} (AffineSubspace.{u1, u2, u3} k V P _inst_1 _inst_2 _inst_3 _inst_4) P (AffineSubspace.setLike.{u1, u2, u3} k V P _inst_1 _inst_2 _inst_3 _inst_4)) p s) -> (forall (v : V), Iff (Membership.Mem.{u2, u2} V (Submodule.{u1, u2} k V (Ring.toSemiring.{u1} k _inst_1) (AddCommGroup.toAddCommMonoid.{u2} V _inst_2) _inst_3) (SetLike.hasMem.{u2, u2} (Submodule.{u1, u2} k V (Ring.toSemiring.{u1} k _inst_1) (AddCommGroup.toAddCommMonoid.{u2} V _inst_2) _inst_3) V (Submodule.setLike.{u1, u2} k V (Ring.toSemiring.{u1} k _inst_1) (AddCommGroup.toAddCommMonoid.{u2} V _inst_2) _inst_3)) v (AffineSubspace.direction.{u1, u2, u3} k V P _inst_1 _inst_2 _inst_3 _inst_4 s)) (Exists.{succ u3} P (fun (p2 : P) => Exists.{0} (Membership.Mem.{u3, u3} P (AffineSubspace.{u1, u2, u3} k V P _inst_1 _inst_2 _inst_3 _inst_4) (SetLike.hasMem.{u3, u3} (AffineSubspace.{u1, u2, u3} k V P _inst_1 _inst_2 _inst_3 _inst_4) P (AffineSubspace.setLike.{u1, u2, u3} k V P _inst_1 _inst_2 _inst_3 _inst_4)) p2 s) (fun (H : Membership.Mem.{u3, u3} P (AffineSubspace.{u1, u2, u3} k V P _inst_1 _inst_2 _inst_3 _inst_4) (SetLike.hasMem.{u3, u3} (AffineSubspace.{u1, u2, u3} k V P _inst_1 _inst_2 _inst_3 _inst_4) P (AffineSubspace.setLike.{u1, u2, u3} k V P _inst_1 _inst_2 _inst_3 _inst_4)) p2 s) => Eq.{succ u2} V v (VSub.vsub.{u2, u3} V P (AddTorsor.toHasVsub.{u2, u3} V P (AddCommGroup.toAddGroup.{u2} V _inst_2) _inst_4) p2 p))))) but is expected to have type forall {k : Type.{u3}} {V : Type.{u2}} {P : Type.{u1}} [_inst_1 : Ring.{u3} k] [_inst_2 : AddCommGroup.{u2} V] [_inst_3 : Module.{u3, u2} k V (Ring.toSemiring.{u3} k _inst_1) (AddCommGroup.toAddCommMonoid.{u2} V _inst_2)] [_inst_4 : AddTorsor.{u2, u1} V P (AddCommGroup.toAddGroup.{u2} V _inst_2)] {s : AffineSubspace.{u3, u2, u1} k V P _inst_1 _inst_2 _inst_3 _inst_4} {p : P}, (Membership.mem.{u1, u1} P (AffineSubspace.{u3, u2, u1} k V P _inst_1 _inst_2 _inst_3 _inst_4) (SetLike.instMembership.{u1, u1} (AffineSubspace.{u3, u2, u1} k V P _inst_1 _inst_2 _inst_3 _inst_4) P (AffineSubspace.instSetLikeAffineSubspace.{u3, u2, u1} k V P _inst_1 _inst_2 _inst_3 _inst_4)) p s) -> (forall (v : V), Iff (Membership.mem.{u2, u2} V (Submodule.{u3, u2} k V (Ring.toSemiring.{u3} k _inst_1) (AddCommGroup.toAddCommMonoid.{u2} V _inst_2) _inst_3) (SetLike.instMembership.{u2, u2} (Submodule.{u3, u2} k V (Ring.toSemiring.{u3} k _inst_1) (AddCommGroup.toAddCommMonoid.{u2} V _inst_2) _inst_3) V (Submodule.setLike.{u3, u2} k V (Ring.toSemiring.{u3} k _inst_1) (AddCommGroup.toAddCommMonoid.{u2} V _inst_2) _inst_3)) v (AffineSubspace.direction.{u3, u2, u1} k V P _inst_1 _inst_2 _inst_3 _inst_4 s)) (Exists.{succ u1} P (fun (p2 : P) => And (Membership.mem.{u1, u1} P (AffineSubspace.{u3, u2, u1} k V P _inst_1 _inst_2 _inst_3 _inst_4) (SetLike.instMembership.{u1, u1} (AffineSubspace.{u3, u2, u1} k V P _inst_1 _inst_2 _inst_3 _inst_4) P (AffineSubspace.instSetLikeAffineSubspace.{u3, u2, u1} k V P _inst_1 _inst_2 _inst_3 _inst_4)) p2 s) (Eq.{succ u2} V v (VSub.vsub.{u2, u1} V P (AddTorsor.toVSub.{u2, u1} V P (AddCommGroup.toAddGroup.{u2} V _inst_2) _inst_4) p2 p))))) Case conversion may be inaccurate. Consider using '#align affine_subspace.mem_direction_iff_eq_vsub_right AffineSubspace.mem_direction_iff_eq_vsub_rightₓ'. -/ /-- Given a point in an affine subspace, a vector is in its direction if and only if it results from subtracting that point on the right. -/ theorem mem_direction_iff_eq_vsub_right {s : AffineSubspace k P} {p : P} (hp : p ∈ s) (v : V) : v ∈ s.direction ↔ ∃ p2 ∈ s, v = p2 -ᵥ p := by rw [← SetLike.mem_coe, coe_direction_eq_vsub_set_right hp] exact ⟨fun ⟨p2, hp2, hv⟩ => ⟨p2, hp2, hv.symm⟩, fun ⟨p2, hp2, hv⟩ => ⟨p2, hp2, hv.symm⟩⟩ #align affine_subspace.mem_direction_iff_eq_vsub_right AffineSubspace.mem_direction_iff_eq_vsub_right /- warning: affine_subspace.mem_direction_iff_eq_vsub_left -> AffineSubspace.mem_direction_iff_eq_vsub_left is a dubious translation: lean 3 declaration is forall {k : Type.{u1}} {V : Type.{u2}} {P : Type.{u3}} [_inst_1 : Ring.{u1} k] [_inst_2 : AddCommGroup.{u2} V] [_inst_3 : Module.{u1, u2} k V (Ring.toSemiring.{u1} k _inst_1) (AddCommGroup.toAddCommMonoid.{u2} V _inst_2)] [_inst_4 : AddTorsor.{u2, u3} V P (AddCommGroup.toAddGroup.{u2} V _inst_2)] {s : AffineSubspace.{u1, u2, u3} k V P _inst_1 _inst_2 _inst_3 _inst_4} {p : P}, (Membership.Mem.{u3, u3} P (AffineSubspace.{u1, u2, u3} k V P _inst_1 _inst_2 _inst_3 _inst_4) (SetLike.hasMem.{u3, u3} (AffineSubspace.{u1, u2, u3} k V P _inst_1 _inst_2 _inst_3 _inst_4) P (AffineSubspace.setLike.{u1, u2, u3} k V P _inst_1 _inst_2 _inst_3 _inst_4)) p s) -> (forall (v : V), Iff (Membership.Mem.{u2, u2} V (Submodule.{u1, u2} k V (Ring.toSemiring.{u1} k _inst_1) (AddCommGroup.toAddCommMonoid.{u2} V _inst_2) _inst_3) (SetLike.hasMem.{u2, u2} (Submodule.{u1, u2} k V (Ring.toSemiring.{u1} k _inst_1) (AddCommGroup.toAddCommMonoid.{u2} V _inst_2) _inst_3) V (Submodule.setLike.{u1, u2} k V (Ring.toSemiring.{u1} k _inst_1) (AddCommGroup.toAddCommMonoid.{u2} V _inst_2) _inst_3)) v (AffineSubspace.direction.{u1, u2, u3} k V P _inst_1 _inst_2 _inst_3 _inst_4 s)) (Exists.{succ u3} P (fun (p2 : P) => Exists.{0} (Membership.Mem.{u3, u3} P (AffineSubspace.{u1, u2, u3} k V P _inst_1 _inst_2 _inst_3 _inst_4) (SetLike.hasMem.{u3, u3} (AffineSubspace.{u1, u2, u3} k V P _inst_1 _inst_2 _inst_3 _inst_4) P (AffineSubspace.setLike.{u1, u2, u3} k V P _inst_1 _inst_2 _inst_3 _inst_4)) p2 s) (fun (H : Membership.Mem.{u3, u3} P (AffineSubspace.{u1, u2, u3} k V P _inst_1 _inst_2 _inst_3 _inst_4) (SetLike.hasMem.{u3, u3} (AffineSubspace.{u1, u2, u3} k V P _inst_1 _inst_2 _inst_3 _inst_4) P (AffineSubspace.setLike.{u1, u2, u3} k V P _inst_1 _inst_2 _inst_3 _inst_4)) p2 s) => Eq.{succ u2} V v (VSub.vsub.{u2, u3} V P (AddTorsor.toHasVsub.{u2, u3} V P (AddCommGroup.toAddGroup.{u2} V _inst_2) _inst_4) p p2))))) but is expected to have type forall {k : Type.{u3}} {V : Type.{u2}} {P : Type.{u1}} [_inst_1 : Ring.{u3} k] [_inst_2 : AddCommGroup.{u2} V] [_inst_3 : Module.{u3, u2} k V (Ring.toSemiring.{u3} k _inst_1) (AddCommGroup.toAddCommMonoid.{u2} V _inst_2)] [_inst_4 : AddTorsor.{u2, u1} V P (AddCommGroup.toAddGroup.{u2} V _inst_2)] {s : AffineSubspace.{u3, u2, u1} k V P _inst_1 _inst_2 _inst_3 _inst_4} {p : P}, (Membership.mem.{u1, u1} P (AffineSubspace.{u3, u2, u1} k V P _inst_1 _inst_2 _inst_3 _inst_4) (SetLike.instMembership.{u1, u1} (AffineSubspace.{u3, u2, u1} k V P _inst_1 _inst_2 _inst_3 _inst_4) P (AffineSubspace.instSetLikeAffineSubspace.{u3, u2, u1} k V P _inst_1 _inst_2 _inst_3 _inst_4)) p s) -> (forall (v : V), Iff (Membership.mem.{u2, u2} V (Submodule.{u3, u2} k V (Ring.toSemiring.{u3} k _inst_1) (AddCommGroup.toAddCommMonoid.{u2} V _inst_2) _inst_3) (SetLike.instMembership.{u2, u2} (Submodule.{u3, u2} k V (Ring.toSemiring.{u3} k _inst_1) (AddCommGroup.toAddCommMonoid.{u2} V _inst_2) _inst_3) V (Submodule.setLike.{u3, u2} k V (Ring.toSemiring.{u3} k _inst_1) (AddCommGroup.toAddCommMonoid.{u2} V _inst_2) _inst_3)) v (AffineSubspace.direction.{u3, u2, u1} k V P _inst_1 _inst_2 _inst_3 _inst_4 s)) (Exists.{succ u1} P (fun (p2 : P) => And (Membership.mem.{u1, u1} P (AffineSubspace.{u3, u2, u1} k V P _inst_1 _inst_2 _inst_3 _inst_4) (SetLike.instMembership.{u1, u1} (AffineSubspace.{u3, u2, u1} k V P _inst_1 _inst_2 _inst_3 _inst_4) P (AffineSubspace.instSetLikeAffineSubspace.{u3, u2, u1} k V P _inst_1 _inst_2 _inst_3 _inst_4)) p2 s) (Eq.{succ u2} V v (VSub.vsub.{u2, u1} V P (AddTorsor.toVSub.{u2, u1} V P (AddCommGroup.toAddGroup.{u2} V _inst_2) _inst_4) p p2))))) Case conversion may be inaccurate. Consider using '#align affine_subspace.mem_direction_iff_eq_vsub_left AffineSubspace.mem_direction_iff_eq_vsub_leftₓ'. -/ /-- Given a point in an affine subspace, a vector is in its direction if and only if it results from subtracting that point on the left. -/ theorem mem_direction_iff_eq_vsub_left {s : AffineSubspace k P} {p : P} (hp : p ∈ s) (v : V) : v ∈ s.direction ↔ ∃ p2 ∈ s, v = p -ᵥ p2 := by rw [← SetLike.mem_coe, coe_direction_eq_vsub_set_left hp] exact ⟨fun ⟨p2, hp2, hv⟩ => ⟨p2, hp2, hv.symm⟩, fun ⟨p2, hp2, hv⟩ => ⟨p2, hp2, hv.symm⟩⟩ #align affine_subspace.mem_direction_iff_eq_vsub_left AffineSubspace.mem_direction_iff_eq_vsub_left /- warning: affine_subspace.vsub_right_mem_direction_iff_mem -> AffineSubspace.vsub_right_mem_direction_iff_mem is a dubious translation: lean 3 declaration is forall {k : Type.{u1}} {V : Type.{u2}} {P : Type.{u3}} [_inst_1 : Ring.{u1} k] [_inst_2 : AddCommGroup.{u2} V] [_inst_3 : Module.{u1, u2} k V (Ring.toSemiring.{u1} k _inst_1) (AddCommGroup.toAddCommMonoid.{u2} V _inst_2)] [_inst_4 : AddTorsor.{u2, u3} V P (AddCommGroup.toAddGroup.{u2} V _inst_2)] {s : AffineSubspace.{u1, u2, u3} k V P _inst_1 _inst_2 _inst_3 _inst_4} {p : P}, (Membership.Mem.{u3, u3} P (AffineSubspace.{u1, u2, u3} k V P _inst_1 _inst_2 _inst_3 _inst_4) (SetLike.hasMem.{u3, u3} (AffineSubspace.{u1, u2, u3} k V P _inst_1 _inst_2 _inst_3 _inst_4) P (AffineSubspace.setLike.{u1, u2, u3} k V P _inst_1 _inst_2 _inst_3 _inst_4)) p s) -> (forall (p2 : P), Iff (Membership.Mem.{u2, u2} V (Submodule.{u1, u2} k V (Ring.toSemiring.{u1} k _inst_1) (AddCommGroup.toAddCommMonoid.{u2} V _inst_2) _inst_3) (SetLike.hasMem.{u2, u2} (Submodule.{u1, u2} k V (Ring.toSemiring.{u1} k _inst_1) (AddCommGroup.toAddCommMonoid.{u2} V _inst_2) _inst_3) V (Submodule.setLike.{u1, u2} k V (Ring.toSemiring.{u1} k _inst_1) (AddCommGroup.toAddCommMonoid.{u2} V _inst_2) _inst_3)) (VSub.vsub.{u2, u3} V P (AddTorsor.toHasVsub.{u2, u3} V P (AddCommGroup.toAddGroup.{u2} V _inst_2) _inst_4) p2 p) (AffineSubspace.direction.{u1, u2, u3} k V P _inst_1 _inst_2 _inst_3 _inst_4 s)) (Membership.Mem.{u3, u3} P (AffineSubspace.{u1, u2, u3} k V P _inst_1 _inst_2 _inst_3 _inst_4) (SetLike.hasMem.{u3, u3} (AffineSubspace.{u1, u2, u3} k V P _inst_1 _inst_2 _inst_3 _inst_4) P (AffineSubspace.setLike.{u1, u2, u3} k V P _inst_1 _inst_2 _inst_3 _inst_4)) p2 s)) but is expected to have type forall {k : Type.{u3}} {V : Type.{u2}} {P : Type.{u1}} [_inst_1 : Ring.{u3} k] [_inst_2 : AddCommGroup.{u2} V] [_inst_3 : Module.{u3, u2} k V (Ring.toSemiring.{u3} k _inst_1) (AddCommGroup.toAddCommMonoid.{u2} V _inst_2)] [_inst_4 : AddTorsor.{u2, u1} V P (AddCommGroup.toAddGroup.{u2} V _inst_2)] {s : AffineSubspace.{u3, u2, u1} k V P _inst_1 _inst_2 _inst_3 _inst_4} {p : P}, (Membership.mem.{u1, u1} P (AffineSubspace.{u3, u2, u1} k V P _inst_1 _inst_2 _inst_3 _inst_4) (SetLike.instMembership.{u1, u1} (AffineSubspace.{u3, u2, u1} k V P _inst_1 _inst_2 _inst_3 _inst_4) P (AffineSubspace.instSetLikeAffineSubspace.{u3, u2, u1} k V P _inst_1 _inst_2 _inst_3 _inst_4)) p s) -> (forall (p2 : P), Iff (Membership.mem.{u2, u2} V (Submodule.{u3, u2} k V (Ring.toSemiring.{u3} k _inst_1) (AddCommGroup.toAddCommMonoid.{u2} V _inst_2) _inst_3) (SetLike.instMembership.{u2, u2} (Submodule.{u3, u2} k V (Ring.toSemiring.{u3} k _inst_1) (AddCommGroup.toAddCommMonoid.{u2} V _inst_2) _inst_3) V (Submodule.setLike.{u3, u2} k V (Ring.toSemiring.{u3} k _inst_1) (AddCommGroup.toAddCommMonoid.{u2} V _inst_2) _inst_3)) (VSub.vsub.{u2, u1} V P (AddTorsor.toVSub.{u2, u1} V P (AddCommGroup.toAddGroup.{u2} V _inst_2) _inst_4) p2 p) (AffineSubspace.direction.{u3, u2, u1} k V P _inst_1 _inst_2 _inst_3 _inst_4 s)) (Membership.mem.{u1, u1} P (AffineSubspace.{u3, u2, u1} k V P _inst_1 _inst_2 _inst_3 _inst_4) (SetLike.instMembership.{u1, u1} (AffineSubspace.{u3, u2, u1} k V P _inst_1 _inst_2 _inst_3 _inst_4) P (AffineSubspace.instSetLikeAffineSubspace.{u3, u2, u1} k V P _inst_1 _inst_2 _inst_3 _inst_4)) p2 s)) Case conversion may be inaccurate. Consider using '#align affine_subspace.vsub_right_mem_direction_iff_mem AffineSubspace.vsub_right_mem_direction_iff_memₓ'. -/ /-- Given a point in an affine subspace, a result of subtracting that point on the right is in the direction if and only if the other point is in the subspace. -/ theorem vsub_right_mem_direction_iff_mem {s : AffineSubspace k P} {p : P} (hp : p ∈ s) (p2 : P) : p2 -ᵥ p ∈ s.direction ↔ p2 ∈ s := by rw [mem_direction_iff_eq_vsub_right hp] simp #align affine_subspace.vsub_right_mem_direction_iff_mem AffineSubspace.vsub_right_mem_direction_iff_mem /- warning: affine_subspace.vsub_left_mem_direction_iff_mem -> AffineSubspace.vsub_left_mem_direction_iff_mem is a dubious translation: lean 3 declaration is forall {k : Type.{u1}} {V : Type.{u2}} {P : Type.{u3}} [_inst_1 : Ring.{u1} k] [_inst_2 : AddCommGroup.{u2} V] [_inst_3 : Module.{u1, u2} k V (Ring.toSemiring.{u1} k _inst_1) (AddCommGroup.toAddCommMonoid.{u2} V _inst_2)] [_inst_4 : AddTorsor.{u2, u3} V P (AddCommGroup.toAddGroup.{u2} V _inst_2)] {s : AffineSubspace.{u1, u2, u3} k V P _inst_1 _inst_2 _inst_3 _inst_4} {p : P}, (Membership.Mem.{u3, u3} P (AffineSubspace.{u1, u2, u3} k V P _inst_1 _inst_2 _inst_3 _inst_4) (SetLike.hasMem.{u3, u3} (AffineSubspace.{u1, u2, u3} k V P _inst_1 _inst_2 _inst_3 _inst_4) P (AffineSubspace.setLike.{u1, u2, u3} k V P _inst_1 _inst_2 _inst_3 _inst_4)) p s) -> (forall (p2 : P), Iff (Membership.Mem.{u2, u2} V (Submodule.{u1, u2} k V (Ring.toSemiring.{u1} k _inst_1) (AddCommGroup.toAddCommMonoid.{u2} V _inst_2) _inst_3) (SetLike.hasMem.{u2, u2} (Submodule.{u1, u2} k V (Ring.toSemiring.{u1} k _inst_1) (AddCommGroup.toAddCommMonoid.{u2} V _inst_2) _inst_3) V (Submodule.setLike.{u1, u2} k V (Ring.toSemiring.{u1} k _inst_1) (AddCommGroup.toAddCommMonoid.{u2} V _inst_2) _inst_3)) (VSub.vsub.{u2, u3} V P (AddTorsor.toHasVsub.{u2, u3} V P (AddCommGroup.toAddGroup.{u2} V _inst_2) _inst_4) p p2) (AffineSubspace.direction.{u1, u2, u3} k V P _inst_1 _inst_2 _inst_3 _inst_4 s)) (Membership.Mem.{u3, u3} P (AffineSubspace.{u1, u2, u3} k V P _inst_1 _inst_2 _inst_3 _inst_4) (SetLike.hasMem.{u3, u3} (AffineSubspace.{u1, u2, u3} k V P _inst_1 _inst_2 _inst_3 _inst_4) P (AffineSubspace.setLike.{u1, u2, u3} k V P _inst_1 _inst_2 _inst_3 _inst_4)) p2 s)) but is expected to have type forall {k : Type.{u3}} {V : Type.{u2}} {P : Type.{u1}} [_inst_1 : Ring.{u3} k] [_inst_2 : AddCommGroup.{u2} V] [_inst_3 : Module.{u3, u2} k V (Ring.toSemiring.{u3} k _inst_1) (AddCommGroup.toAddCommMonoid.{u2} V _inst_2)] [_inst_4 : AddTorsor.{u2, u1} V P (AddCommGroup.toAddGroup.{u2} V _inst_2)] {s : AffineSubspace.{u3, u2, u1} k V P _inst_1 _inst_2 _inst_3 _inst_4} {p : P}, (Membership.mem.{u1, u1} P (AffineSubspace.{u3, u2, u1} k V P _inst_1 _inst_2 _inst_3 _inst_4) (SetLike.instMembership.{u1, u1} (AffineSubspace.{u3, u2, u1} k V P _inst_1 _inst_2 _inst_3 _inst_4) P (AffineSubspace.instSetLikeAffineSubspace.{u3, u2, u1} k V P _inst_1 _inst_2 _inst_3 _inst_4)) p s) -> (forall (p2 : P), Iff (Membership.mem.{u2, u2} V (Submodule.{u3, u2} k V (Ring.toSemiring.{u3} k _inst_1) (AddCommGroup.toAddCommMonoid.{u2} V _inst_2) _inst_3) (SetLike.instMembership.{u2, u2} (Submodule.{u3, u2} k V (Ring.toSemiring.{u3} k _inst_1) (AddCommGroup.toAddCommMonoid.{u2} V _inst_2) _inst_3) V (Submodule.setLike.{u3, u2} k V (Ring.toSemiring.{u3} k _inst_1) (AddCommGroup.toAddCommMonoid.{u2} V _inst_2) _inst_3)) (VSub.vsub.{u2, u1} V P (AddTorsor.toVSub.{u2, u1} V P (AddCommGroup.toAddGroup.{u2} V _inst_2) _inst_4) p p2) (AffineSubspace.direction.{u3, u2, u1} k V P _inst_1 _inst_2 _inst_3 _inst_4 s)) (Membership.mem.{u1, u1} P (AffineSubspace.{u3, u2, u1} k V P _inst_1 _inst_2 _inst_3 _inst_4) (SetLike.instMembership.{u1, u1} (AffineSubspace.{u3, u2, u1} k V P _inst_1 _inst_2 _inst_3 _inst_4) P (AffineSubspace.instSetLikeAffineSubspace.{u3, u2, u1} k V P _inst_1 _inst_2 _inst_3 _inst_4)) p2 s)) Case conversion may be inaccurate. Consider using '#align affine_subspace.vsub_left_mem_direction_iff_mem AffineSubspace.vsub_left_mem_direction_iff_memₓ'. -/ /-- Given a point in an affine subspace, a result of subtracting that point on the left is in the direction if and only if the other point is in the subspace. -/ theorem vsub_left_mem_direction_iff_mem {s : AffineSubspace k P} {p : P} (hp : p ∈ s) (p2 : P) : p -ᵥ p2 ∈ s.direction ↔ p2 ∈ s := by rw [mem_direction_iff_eq_vsub_left hp] simp #align affine_subspace.vsub_left_mem_direction_iff_mem AffineSubspace.vsub_left_mem_direction_iff_mem /- warning: affine_subspace.coe_injective -> AffineSubspace.coe_injective is a dubious translation: lean 3 declaration is forall {k : Type.{u1}} {V : Type.{u2}} {P : Type.{u3}} [_inst_1 : Ring.{u1} k] [_inst_2 : AddCommGroup.{u2} V] [_inst_3 : Module.{u1, u2} k V (Ring.toSemiring.{u1} k _inst_1) (AddCommGroup.toAddCommMonoid.{u2} V _inst_2)] [_inst_4 : AddTorsor.{u2, u3} V P (AddCommGroup.toAddGroup.{u2} V _inst_2)], Function.Injective.{succ u3, succ u3} (AffineSubspace.{u1, u2, u3} k V P _inst_1 _inst_2 _inst_3 _inst_4) (Set.{u3} P) ((fun (a : Type.{u3}) (b : Type.{u3}) [self : HasLiftT.{succ u3, succ u3} a b] => self.0) (AffineSubspace.{u1, u2, u3} k V P _inst_1 _inst_2 _inst_3 _inst_4) (Set.{u3} P) (HasLiftT.mk.{succ u3, succ u3} (AffineSubspace.{u1, u2, u3} k V P _inst_1 _inst_2 _inst_3 _inst_4) (Set.{u3} P) (CoeTCₓ.coe.{succ u3, succ u3} (AffineSubspace.{u1, u2, u3} k V P _inst_1 _inst_2 _inst_3 _inst_4) (Set.{u3} P) (SetLike.Set.hasCoeT.{u3, u3} (AffineSubspace.{u1, u2, u3} k V P _inst_1 _inst_2 _inst_3 _inst_4) P (AffineSubspace.setLike.{u1, u2, u3} k V P _inst_1 _inst_2 _inst_3 _inst_4))))) but is expected to have type forall {k : Type.{u2}} {V : Type.{u1}} {P : Type.{u3}} [_inst_1 : Ring.{u2} k] [_inst_2 : AddCommGroup.{u1} V] [_inst_3 : Module.{u2, u1} k V (Ring.toSemiring.{u2} k _inst_1) (AddCommGroup.toAddCommMonoid.{u1} V _inst_2)] [_inst_4 : AddTorsor.{u1, u3} V P (AddCommGroup.toAddGroup.{u1} V _inst_2)], Function.Injective.{succ u3, succ u3} (AffineSubspace.{u2, u1, u3} k V P _inst_1 _inst_2 _inst_3 _inst_4) (Set.{u3} P) (SetLike.coe.{u3, u3} (AffineSubspace.{u2, u1, u3} k V P _inst_1 _inst_2 _inst_3 _inst_4) P (AffineSubspace.instSetLikeAffineSubspace.{u2, u1, u3} k V P _inst_1 _inst_2 _inst_3 _inst_4)) Case conversion may be inaccurate. Consider using '#align affine_subspace.coe_injective AffineSubspace.coe_injectiveₓ'. -/ /-- Two affine subspaces are equal if they have the same points. -/ theorem coe_injective : Function.Injective (coe : AffineSubspace k P → Set P) := SetLike.coe_injective #align affine_subspace.coe_injective AffineSubspace.coe_injective /- warning: affine_subspace.ext -> AffineSubspace.ext is a dubious translation: lean 3 declaration is forall {k : Type.{u1}} {V : Type.{u2}} {P : Type.{u3}} [_inst_1 : Ring.{u1} k] [_inst_2 : AddCommGroup.{u2} V] [_inst_3 : Module.{u1, u2} k V (Ring.toSemiring.{u1} k _inst_1) (AddCommGroup.toAddCommMonoid.{u2} V _inst_2)] [_inst_4 : AddTorsor.{u2, u3} V P (AddCommGroup.toAddGroup.{u2} V _inst_2)] {p : AffineSubspace.{u1, u2, u3} k V P _inst_1 _inst_2 _inst_3 _inst_4} {q : AffineSubspace.{u1, u2, u3} k V P _inst_1 _inst_2 _inst_3 _inst_4}, (forall (x : P), Iff (Membership.Mem.{u3, u3} P (AffineSubspace.{u1, u2, u3} k V P _inst_1 _inst_2 _inst_3 _inst_4) (SetLike.hasMem.{u3, u3} (AffineSubspace.{u1, u2, u3} k V P _inst_1 _inst_2 _inst_3 _inst_4) P (AffineSubspace.setLike.{u1, u2, u3} k V P _inst_1 _inst_2 _inst_3 _inst_4)) x p) (Membership.Mem.{u3, u3} P (AffineSubspace.{u1, u2, u3} k V P _inst_1 _inst_2 _inst_3 _inst_4) (SetLike.hasMem.{u3, u3} (AffineSubspace.{u1, u2, u3} k V P _inst_1 _inst_2 _inst_3 _inst_4) P (AffineSubspace.setLike.{u1, u2, u3} k V P _inst_1 _inst_2 _inst_3 _inst_4)) x q)) -> (Eq.{succ u3} (AffineSubspace.{u1, u2, u3} k V P _inst_1 _inst_2 _inst_3 _inst_4) p q) but is expected to have type forall {k : Type.{u3}} {V : Type.{u2}} {P : Type.{u1}} [_inst_1 : Ring.{u3} k] [_inst_2 : AddCommGroup.{u2} V] [_inst_3 : Module.{u3, u2} k V (Ring.toSemiring.{u3} k _inst_1) (AddCommGroup.toAddCommMonoid.{u2} V _inst_2)] [_inst_4 : AddTorsor.{u2, u1} V P (AddCommGroup.toAddGroup.{u2} V _inst_2)] {p : AffineSubspace.{u3, u2, u1} k V P _inst_1 _inst_2 _inst_3 _inst_4} {q : AffineSubspace.{u3, u2, u1} k V P _inst_1 _inst_2 _inst_3 _inst_4}, (forall (x : P), Iff (Membership.mem.{u1, u1} P (AffineSubspace.{u3, u2, u1} k V P _inst_1 _inst_2 _inst_3 _inst_4) (SetLike.instMembership.{u1, u1} (AffineSubspace.{u3, u2, u1} k V P _inst_1 _inst_2 _inst_3 _inst_4) P (AffineSubspace.instSetLikeAffineSubspace.{u3, u2, u1} k V P _inst_1 _inst_2 _inst_3 _inst_4)) x p) (Membership.mem.{u1, u1} P (AffineSubspace.{u3, u2, u1} k V P _inst_1 _inst_2 _inst_3 _inst_4) (SetLike.instMembership.{u1, u1} (AffineSubspace.{u3, u2, u1} k V P _inst_1 _inst_2 _inst_3 _inst_4) P (AffineSubspace.instSetLikeAffineSubspace.{u3, u2, u1} k V P _inst_1 _inst_2 _inst_3 _inst_4)) x q)) -> (Eq.{succ u1} (AffineSubspace.{u3, u2, u1} k V P _inst_1 _inst_2 _inst_3 _inst_4) p q) Case conversion may be inaccurate. Consider using '#align affine_subspace.ext AffineSubspace.extₓ'. -/ @[ext] theorem ext {p q : AffineSubspace k P} (h : ∀ x, x ∈ p ↔ x ∈ q) : p = q := SetLike.ext h #align affine_subspace.ext AffineSubspace.ext /- warning: affine_subspace.ext_iff -> AffineSubspace.ext_iff is a dubious translation: lean 3 declaration is forall {k : Type.{u1}} {V : Type.{u2}} {P : Type.{u3}} [_inst_1 : Ring.{u1} k] [_inst_2 : AddCommGroup.{u2} V] [_inst_3 : Module.{u1, u2} k V (Ring.toSemiring.{u1} k _inst_1) (AddCommGroup.toAddCommMonoid.{u2} V _inst_2)] [_inst_4 : AddTorsor.{u2, u3} V P (AddCommGroup.toAddGroup.{u2} V _inst_2)] (s₁ : AffineSubspace.{u1, u2, u3} k V P _inst_1 _inst_2 _inst_3 _inst_4) (s₂ : AffineSubspace.{u1, u2, u3} k V P _inst_1 _inst_2 _inst_3 _inst_4), Iff (Eq.{succ u3} (Set.{u3} P) ((fun (a : Type.{u3}) (b : Type.{u3}) [self : HasLiftT.{succ u3, succ u3} a b] => self.0) (AffineSubspace.{u1, u2, u3} k V P _inst_1 _inst_2 _inst_3 _inst_4) (Set.{u3} P) (HasLiftT.mk.{succ u3, succ u3} (AffineSubspace.{u1, u2, u3} k V P _inst_1 _inst_2 _inst_3 _inst_4) (Set.{u3} P) (CoeTCₓ.coe.{succ u3, succ u3} (AffineSubspace.{u1, u2, u3} k V P _inst_1 _inst_2 _inst_3 _inst_4) (Set.{u3} P) (SetLike.Set.hasCoeT.{u3, u3} (AffineSubspace.{u1, u2, u3} k V P _inst_1 _inst_2 _inst_3 _inst_4) P (AffineSubspace.setLike.{u1, u2, u3} k V P _inst_1 _inst_2 _inst_3 _inst_4)))) s₁) ((fun (a : Type.{u3}) (b : Type.{u3}) [self : HasLiftT.{succ u3, succ u3} a b] => self.0) (AffineSubspace.{u1, u2, u3} k V P _inst_1 _inst_2 _inst_3 _inst_4) (Set.{u3} P) (HasLiftT.mk.{succ u3, succ u3} (AffineSubspace.{u1, u2, u3} k V P _inst_1 _inst_2 _inst_3 _inst_4) (Set.{u3} P) (CoeTCₓ.coe.{succ u3, succ u3} (AffineSubspace.{u1, u2, u3} k V P _inst_1 _inst_2 _inst_3 _inst_4) (Set.{u3} P) (SetLike.Set.hasCoeT.{u3, u3} (AffineSubspace.{u1, u2, u3} k V P _inst_1 _inst_2 _inst_3 _inst_4) P (AffineSubspace.setLike.{u1, u2, u3} k V P _inst_1 _inst_2 _inst_3 _inst_4)))) s₂)) (Eq.{succ u3} (AffineSubspace.{u1, u2, u3} k V P _inst_1 _inst_2 _inst_3 _inst_4) s₁ s₂) but is expected to have type forall {k : Type.{u3}} {V : Type.{u2}} {P : Type.{u1}} [_inst_1 : Ring.{u3} k] [_inst_2 : AddCommGroup.{u2} V] [_inst_3 : Module.{u3, u2} k V (Ring.toSemiring.{u3} k _inst_1) (AddCommGroup.toAddCommMonoid.{u2} V _inst_2)] [_inst_4 : AddTorsor.{u2, u1} V P (AddCommGroup.toAddGroup.{u2} V _inst_2)] (s₁ : AffineSubspace.{u3, u2, u1} k V P _inst_1 _inst_2 _inst_3 _inst_4) (s₂ : AffineSubspace.{u3, u2, u1} k V P _inst_1 _inst_2 _inst_3 _inst_4), Iff (Eq.{succ u1} (Set.{u1} P) (SetLike.coe.{u1, u1} (AffineSubspace.{u3, u2, u1} k V P _inst_1 _inst_2 _inst_3 _inst_4) P (AffineSubspace.instSetLikeAffineSubspace.{u3, u2, u1} k V P _inst_1 _inst_2 _inst_3 _inst_4) s₁) (SetLike.coe.{u1, u1} (AffineSubspace.{u3, u2, u1} k V P _inst_1 _inst_2 _inst_3 _inst_4) P (AffineSubspace.instSetLikeAffineSubspace.{u3, u2, u1} k V P _inst_1 _inst_2 _inst_3 _inst_4) s₂)) (Eq.{succ u1} (AffineSubspace.{u3, u2, u1} k V P _inst_1 _inst_2 _inst_3 _inst_4) s₁ s₂) Case conversion may be inaccurate. Consider using '#align affine_subspace.ext_iff AffineSubspace.ext_iffₓ'. -/ @[simp] theorem ext_iff (s₁ s₂ : AffineSubspace k P) : (s₁ : Set P) = s₂ ↔ s₁ = s₂ := SetLike.ext'_iff.symm #align affine_subspace.ext_iff AffineSubspace.ext_iff /- warning: affine_subspace.ext_of_direction_eq -> AffineSubspace.ext_of_direction_eq is a dubious translation: lean 3 declaration is forall {k : Type.{u1}} {V : Type.{u2}} {P : Type.{u3}} [_inst_1 : Ring.{u1} k] [_inst_2 : AddCommGroup.{u2} V] [_inst_3 : Module.{u1, u2} k V (Ring.toSemiring.{u1} k _inst_1) (AddCommGroup.toAddCommMonoid.{u2} V _inst_2)] [_inst_4 : AddTorsor.{u2, u3} V P (AddCommGroup.toAddGroup.{u2} V _inst_2)] {s1 : AffineSubspace.{u1, u2, u3} k V P _inst_1 _inst_2 _inst_3 _inst_4} {s2 : AffineSubspace.{u1, u2, u3} k V P _inst_1 _inst_2 _inst_3 _inst_4}, (Eq.{succ u2} (Submodule.{u1, u2} k V (Ring.toSemiring.{u1} k _inst_1) (AddCommGroup.toAddCommMonoid.{u2} V _inst_2) _inst_3) (AffineSubspace.direction.{u1, u2, u3} k V P _inst_1 _inst_2 _inst_3 _inst_4 s1) (AffineSubspace.direction.{u1, u2, u3} k V P _inst_1 _inst_2 _inst_3 _inst_4 s2)) -> (Set.Nonempty.{u3} P (Inter.inter.{u3} (Set.{u3} P) (Set.hasInter.{u3} P) ((fun (a : Type.{u3}) (b : Type.{u3}) [self : HasLiftT.{succ u3, succ u3} a b] => self.0) (AffineSubspace.{u1, u2, u3} k V P _inst_1 _inst_2 _inst_3 _inst_4) (Set.{u3} P) (HasLiftT.mk.{succ u3, succ u3} (AffineSubspace.{u1, u2, u3} k V P _inst_1 _inst_2 _inst_3 _inst_4) (Set.{u3} P) (CoeTCₓ.coe.{succ u3, succ u3} (AffineSubspace.{u1, u2, u3} k V P _inst_1 _inst_2 _inst_3 _inst_4) (Set.{u3} P) (SetLike.Set.hasCoeT.{u3, u3} (AffineSubspace.{u1, u2, u3} k V P _inst_1 _inst_2 _inst_3 _inst_4) P (AffineSubspace.setLike.{u1, u2, u3} k V P _inst_1 _inst_2 _inst_3 _inst_4)))) s1) ((fun (a : Type.{u3}) (b : Type.{u3}) [self : HasLiftT.{succ u3, succ u3} a b] => self.0) (AffineSubspace.{u1, u2, u3} k V P _inst_1 _inst_2 _inst_3 _inst_4) (Set.{u3} P) (HasLiftT.mk.{succ u3, succ u3} (AffineSubspace.{u1, u2, u3} k V P _inst_1 _inst_2 _inst_3 _inst_4) (Set.{u3} P) (CoeTCₓ.coe.{succ u3, succ u3} (AffineSubspace.{u1, u2, u3} k V P _inst_1 _inst_2 _inst_3 _inst_4) (Set.{u3} P) (SetLike.Set.hasCoeT.{u3, u3} (AffineSubspace.{u1, u2, u3} k V P _inst_1 _inst_2 _inst_3 _inst_4) P (AffineSubspace.setLike.{u1, u2, u3} k V P _inst_1 _inst_2 _inst_3 _inst_4)))) s2))) -> (Eq.{succ u3} (AffineSubspace.{u1, u2, u3} k V P _inst_1 _inst_2 _inst_3 _inst_4) s1 s2) but is expected to have type forall {k : Type.{u3}} {V : Type.{u2}} {P : Type.{u1}} [_inst_1 : Ring.{u3} k] [_inst_2 : AddCommGroup.{u2} V] [_inst_3 : Module.{u3, u2} k V (Ring.toSemiring.{u3} k _inst_1) (AddCommGroup.toAddCommMonoid.{u2} V _inst_2)] [_inst_4 : AddTorsor.{u2, u1} V P (AddCommGroup.toAddGroup.{u2} V _inst_2)] {s1 : AffineSubspace.{u3, u2, u1} k V P _inst_1 _inst_2 _inst_3 _inst_4} {s2 : AffineSubspace.{u3, u2, u1} k V P _inst_1 _inst_2 _inst_3 _inst_4}, (Eq.{succ u2} (Submodule.{u3, u2} k V (Ring.toSemiring.{u3} k _inst_1) (AddCommGroup.toAddCommMonoid.{u2} V _inst_2) _inst_3) (AffineSubspace.direction.{u3, u2, u1} k V P _inst_1 _inst_2 _inst_3 _inst_4 s1) (AffineSubspace.direction.{u3, u2, u1} k V P _inst_1 _inst_2 _inst_3 _inst_4 s2)) -> (Set.Nonempty.{u1} P (Inter.inter.{u1} (Set.{u1} P) (Set.instInterSet.{u1} P) (SetLike.coe.{u1, u1} (AffineSubspace.{u3, u2, u1} k V P _inst_1 _inst_2 _inst_3 _inst_4) P (AffineSubspace.instSetLikeAffineSubspace.{u3, u2, u1} k V P _inst_1 _inst_2 _inst_3 _inst_4) s1) (SetLike.coe.{u1, u1} (AffineSubspace.{u3, u2, u1} k V P _inst_1 _inst_2 _inst_3 _inst_4) P (AffineSubspace.instSetLikeAffineSubspace.{u3, u2, u1} k V P _inst_1 _inst_2 _inst_3 _inst_4) s2))) -> (Eq.{succ u1} (AffineSubspace.{u3, u2, u1} k V P _inst_1 _inst_2 _inst_3 _inst_4) s1 s2) Case conversion may be inaccurate. Consider using '#align affine_subspace.ext_of_direction_eq AffineSubspace.ext_of_direction_eqₓ'. -/ /-- Two affine subspaces with the same direction and nonempty intersection are equal. -/ theorem ext_of_direction_eq {s1 s2 : AffineSubspace k P} (hd : s1.direction = s2.direction) (hn : ((s1 : Set P) ∩ s2).Nonempty) : s1 = s2 := by ext p have hq1 := Set.mem_of_mem_inter_left hn.some_mem have hq2 := Set.mem_of_mem_inter_right hn.some_mem constructor · intro hp rw [← vsub_vadd p hn.some] refine' vadd_mem_of_mem_direction _ hq2 rw [← hd] exact vsub_mem_direction hp hq1 · intro hp rw [← vsub_vadd p hn.some] refine' vadd_mem_of_mem_direction _ hq1 rw [hd] exact vsub_mem_direction hp hq2 #align affine_subspace.ext_of_direction_eq AffineSubspace.ext_of_direction_eq #print AffineSubspace.toAddTorsor /- -- See note [reducible non instances] /-- This is not an instance because it loops with `add_torsor.nonempty`. -/ @[reducible] def toAddTorsor (s : AffineSubspace k P) [Nonempty s] : AddTorsor s.direction s where vadd a b := ⟨(a : V) +ᵥ (b : P), vadd_mem_of_mem_direction a.2 b.2⟩ zero_vadd := by simp add_vadd a b c := by ext apply add_vadd vsub a b := ⟨(a : P) -ᵥ (b : P), (vsub_left_mem_direction_iff_mem a.2 _).mpr b.2⟩ Nonempty := by infer_instance vsub_vadd' a b := by ext apply AddTorsor.vsub_vadd' vadd_vsub' a b := by ext apply AddTorsor.vadd_vsub' #align affine_subspace.to_add_torsor AffineSubspace.toAddTorsor -/ attribute [local instance] to_add_torsor /- warning: affine_subspace.coe_vsub -> AffineSubspace.coe_vsub is a dubious translation: lean 3 declaration is forall {k : Type.{u1}} {V : Type.{u2}} {P : Type.{u3}} [_inst_1 : Ring.{u1} k] [_inst_2 : AddCommGroup.{u2} V] [_inst_3 : Module.{u1, u2} k V (Ring.toSemiring.{u1} k _inst_1) (AddCommGroup.toAddCommMonoid.{u2} V _inst_2)] [_inst_4 : AddTorsor.{u2, u3} V P (AddCommGroup.toAddGroup.{u2} V _inst_2)] (s : AffineSubspace.{u1, u2, u3} k V P _inst_1 _inst_2 _inst_3 _inst_4) [_inst_5 : Nonempty.{succ u3} (coeSort.{succ u3, succ (succ u3)} (AffineSubspace.{u1, u2, u3} k V P _inst_1 _inst_2 _inst_3 _inst_4) Type.{u3} (SetLike.hasCoeToSort.{u3, u3} (AffineSubspace.{u1, u2, u3} k V P _inst_1 _inst_2 _inst_3 _inst_4) P (AffineSubspace.setLike.{u1, u2, u3} k V P _inst_1 _inst_2 _inst_3 _inst_4)) s)] (a : coeSort.{succ u3, succ (succ u3)} (AffineSubspace.{u1, u2, u3} k V P _inst_1 _inst_2 _inst_3 _inst_4) Type.{u3} (SetLike.hasCoeToSort.{u3, u3} (AffineSubspace.{u1, u2, u3} k V P _inst_1 _inst_2 _inst_3 _inst_4) P (AffineSubspace.setLike.{u1, u2, u3} k V P _inst_1 _inst_2 _inst_3 _inst_4)) s) (b : coeSort.{succ u3, succ (succ u3)} (AffineSubspace.{u1, u2, u3} k V P _inst_1 _inst_2 _inst_3 _inst_4) Type.{u3} (SetLike.hasCoeToSort.{u3, u3} (AffineSubspace.{u1, u2, u3} k V P _inst_1 _inst_2 _inst_3 _inst_4) P (AffineSubspace.setLike.{u1, u2, u3} k V P _inst_1 _inst_2 _inst_3 _inst_4)) s), Eq.{succ u2} V ((fun (a : Type.{u2}) (b : Type.{u2}) [self : HasLiftT.{succ u2, succ u2} a b] => self.0) (coeSort.{succ u2, succ (succ u2)} (Submodule.{u1, u2} k V (Ring.toSemiring.{u1} k _inst_1) (AddCommGroup.toAddCommMonoid.{u2} V _inst_2) _inst_3) Type.{u2} (SetLike.hasCoeToSort.{u2, u2} (Submodule.{u1, u2} k V (Ring.toSemiring.{u1} k _inst_1) (AddCommGroup.toAddCommMonoid.{u2} V _inst_2) _inst_3) V (Submodule.setLike.{u1, u2} k V (Ring.toSemiring.{u1} k _inst_1) (AddCommGroup.toAddCommMonoid.{u2} V _inst_2) _inst_3)) (AffineSubspace.direction.{u1, u2, u3} k V P _inst_1 _inst_2 _inst_3 _inst_4 s)) V (HasLiftT.mk.{succ u2, succ u2} (coeSort.{succ u2, succ (succ u2)} (Submodule.{u1, u2} k V (Ring.toSemiring.{u1} k _inst_1) (AddCommGroup.toAddCommMonoid.{u2} V _inst_2) _inst_3) Type.{u2} (SetLike.hasCoeToSort.{u2, u2} (Submodule.{u1, u2} k V (Ring.toSemiring.{u1} k _inst_1) (AddCommGroup.toAddCommMonoid.{u2} V _inst_2) _inst_3) V (Submodule.setLike.{u1, u2} k V (Ring.toSemiring.{u1} k _inst_1) (AddCommGroup.toAddCommMonoid.{u2} V _inst_2) _inst_3)) (AffineSubspace.direction.{u1, u2, u3} k V P _inst_1 _inst_2 _inst_3 _inst_4 s)) V (CoeTCₓ.coe.{succ u2, succ u2} (coeSort.{succ u2, succ (succ u2)} (Submodule.{u1, u2} k V (Ring.toSemiring.{u1} k _inst_1) (AddCommGroup.toAddCommMonoid.{u2} V _inst_2) _inst_3) Type.{u2} (SetLike.hasCoeToSort.{u2, u2} (Submodule.{u1, u2} k V (Ring.toSemiring.{u1} k _inst_1) (AddCommGroup.toAddCommMonoid.{u2} V _inst_2) _inst_3) V (Submodule.setLike.{u1, u2} k V (Ring.toSemiring.{u1} k _inst_1) (AddCommGroup.toAddCommMonoid.{u2} V _inst_2) _inst_3)) (AffineSubspace.direction.{u1, u2, u3} k V P _inst_1 _inst_2 _inst_3 _inst_4 s)) V (coeBase.{succ u2, succ u2} (coeSort.{succ u2, succ (succ u2)} (Submodule.{u1, u2} k V (Ring.toSemiring.{u1} k _inst_1) (AddCommGroup.toAddCommMonoid.{u2} V _inst_2) _inst_3) Type.{u2} (SetLike.hasCoeToSort.{u2, u2} (Submodule.{u1, u2} k V (Ring.toSemiring.{u1} k _inst_1) (AddCommGroup.toAddCommMonoid.{u2} V _inst_2) _inst_3) V (Submodule.setLike.{u1, u2} k V (Ring.toSemiring.{u1} k _inst_1) (AddCommGroup.toAddCommMonoid.{u2} V _inst_2) _inst_3)) (AffineSubspace.direction.{u1, u2, u3} k V P _inst_1 _inst_2 _inst_3 _inst_4 s)) V (coeSubtype.{succ u2} V (fun (x : V) => Membership.Mem.{u2, u2} V (Submodule.{u1, u2} k V (Ring.toSemiring.{u1} k _inst_1) (AddCommGroup.toAddCommMonoid.{u2} V _inst_2) _inst_3) (SetLike.hasMem.{u2, u2} (Submodule.{u1, u2} k V (Ring.toSemiring.{u1} k _inst_1) (AddCommGroup.toAddCommMonoid.{u2} V _inst_2) _inst_3) V (Submodule.setLike.{u1, u2} k V (Ring.toSemiring.{u1} k _inst_1) (AddCommGroup.toAddCommMonoid.{u2} V _inst_2) _inst_3)) x (AffineSubspace.direction.{u1, u2, u3} k V P _inst_1 _inst_2 _inst_3 _inst_4 s)))))) (VSub.vsub.{u2, u3} (coeSort.{succ u2, succ (succ u2)} (Submodule.{u1, u2} k V (Ring.toSemiring.{u1} k _inst_1) (AddCommGroup.toAddCommMonoid.{u2} V _inst_2) _inst_3) Type.{u2} (SetLike.hasCoeToSort.{u2, u2} (Submodule.{u1, u2} k V (Ring.toSemiring.{u1} k _inst_1) (AddCommGroup.toAddCommMonoid.{u2} V _inst_2) _inst_3) V (Submodule.setLike.{u1, u2} k V (Ring.toSemiring.{u1} k _inst_1) (AddCommGroup.toAddCommMonoid.{u2} V _inst_2) _inst_3)) (AffineSubspace.direction.{u1, u2, u3} k V P _inst_1 _inst_2 _inst_3 _inst_4 s)) (coeSort.{succ u3, succ (succ u3)} (AffineSubspace.{u1, u2, u3} k V P _inst_1 _inst_2 _inst_3 _inst_4) Type.{u3} (SetLike.hasCoeToSort.{u3, u3} (AffineSubspace.{u1, u2, u3} k V P _inst_1 _inst_2 _inst_3 _inst_4) P (AffineSubspace.setLike.{u1, u2, u3} k V P _inst_1 _inst_2 _inst_3 _inst_4)) s) (AddTorsor.toHasVsub.{u2, u3} (coeSort.{succ u2, succ (succ u2)} (Submodule.{u1, u2} k V (Ring.toSemiring.{u1} k _inst_1) (AddCommGroup.toAddCommMonoid.{u2} V _inst_2) _inst_3) Type.{u2} (SetLike.hasCoeToSort.{u2, u2} (Submodule.{u1, u2} k V (Ring.toSemiring.{u1} k _inst_1) (AddCommGroup.toAddCommMonoid.{u2} V _inst_2) _inst_3) V (Submodule.setLike.{u1, u2} k V (Ring.toSemiring.{u1} k _inst_1) (AddCommGroup.toAddCommMonoid.{u2} V _inst_2) _inst_3)) (AffineSubspace.direction.{u1, u2, u3} k V P _inst_1 _inst_2 _inst_3 _inst_4 s)) (coeSort.{succ u3, succ (succ u3)} (AffineSubspace.{u1, u2, u3} k V P _inst_1 _inst_2 _inst_3 _inst_4) Type.{u3} (SetLike.hasCoeToSort.{u3, u3} (AffineSubspace.{u1, u2, u3} k V P _inst_1 _inst_2 _inst_3 _inst_4) P (AffineSubspace.setLike.{u1, u2, u3} k V P _inst_1 _inst_2 _inst_3 _inst_4)) s) (AddCommGroup.toAddGroup.{u2} (coeSort.{succ u2, succ (succ u2)} (Submodule.{u1, u2} k V (Ring.toSemiring.{u1} k _inst_1) (AddCommGroup.toAddCommMonoid.{u2} V _inst_2) _inst_3) Type.{u2} (SetLike.hasCoeToSort.{u2, u2} (Submodule.{u1, u2} k V (Ring.toSemiring.{u1} k _inst_1) (AddCommGroup.toAddCommMonoid.{u2} V _inst_2) _inst_3) V (Submodule.setLike.{u1, u2} k V (Ring.toSemiring.{u1} k _inst_1) (AddCommGroup.toAddCommMonoid.{u2} V _inst_2) _inst_3)) (AffineSubspace.direction.{u1, u2, u3} k V P _inst_1 _inst_2 _inst_3 _inst_4 s)) (Submodule.addCommGroup.{u1, u2} k V _inst_1 _inst_2 _inst_3 (AffineSubspace.direction.{u1, u2, u3} k V P _inst_1 _inst_2 _inst_3 _inst_4 s))) (AffineSubspace.toAddTorsor.{u1, u2, u3} k V P _inst_1 _inst_2 _inst_3 _inst_4 s _inst_5)) a b)) (VSub.vsub.{u2, u3} V P (AddTorsor.toHasVsub.{u2, u3} V P (AddCommGroup.toAddGroup.{u2} V _inst_2) _inst_4) ((fun (a : Type.{u3}) (b : Type.{u3}) [self : HasLiftT.{succ u3, succ u3} a b] => self.0) (coeSort.{succ u3, succ (succ u3)} (AffineSubspace.{u1, u2, u3} k V P _inst_1 _inst_2 _inst_3 _inst_4) Type.{u3} (SetLike.hasCoeToSort.{u3, u3} (AffineSubspace.{u1, u2, u3} k V P _inst_1 _inst_2 _inst_3 _inst_4) P (AffineSubspace.setLike.{u1, u2, u3} k V P _inst_1 _inst_2 _inst_3 _inst_4)) s) P (HasLiftT.mk.{succ u3, succ u3} (coeSort.{succ u3, succ (succ u3)} (AffineSubspace.{u1, u2, u3} k V P _inst_1 _inst_2 _inst_3 _inst_4) Type.{u3} (SetLike.hasCoeToSort.{u3, u3} (AffineSubspace.{u1, u2, u3} k V P _inst_1 _inst_2 _inst_3 _inst_4) P (AffineSubspace.setLike.{u1, u2, u3} k V P _inst_1 _inst_2 _inst_3 _inst_4)) s) P (CoeTCₓ.coe.{succ u3, succ u3} (coeSort.{succ u3, succ (succ u3)} (AffineSubspace.{u1, u2, u3} k V P _inst_1 _inst_2 _inst_3 _inst_4) Type.{u3} (SetLike.hasCoeToSort.{u3, u3} (AffineSubspace.{u1, u2, u3} k V P _inst_1 _inst_2 _inst_3 _inst_4) P (AffineSubspace.setLike.{u1, u2, u3} k V P _inst_1 _inst_2 _inst_3 _inst_4)) s) P (coeBase.{succ u3, succ u3} (coeSort.{succ u3, succ (succ u3)} (AffineSubspace.{u1, u2, u3} k V P _inst_1 _inst_2 _inst_3 _inst_4) Type.{u3} (SetLike.hasCoeToSort.{u3, u3} (AffineSubspace.{u1, u2, u3} k V P _inst_1 _inst_2 _inst_3 _inst_4) P (AffineSubspace.setLike.{u1, u2, u3} k V P _inst_1 _inst_2 _inst_3 _inst_4)) s) P (coeSubtype.{succ u3} P (fun (x : P) => Membership.Mem.{u3, u3} P (AffineSubspace.{u1, u2, u3} k V P _inst_1 _inst_2 _inst_3 _inst_4) (SetLike.hasMem.{u3, u3} (AffineSubspace.{u1, u2, u3} k V P _inst_1 _inst_2 _inst_3 _inst_4) P (AffineSubspace.setLike.{u1, u2, u3} k V P _inst_1 _inst_2 _inst_3 _inst_4)) x s))))) a) ((fun (a : Type.{u3}) (b : Type.{u3}) [self : HasLiftT.{succ u3, succ u3} a b] => self.0) (coeSort.{succ u3, succ (succ u3)} (AffineSubspace.{u1, u2, u3} k V P _inst_1 _inst_2 _inst_3 _inst_4) Type.{u3} (SetLike.hasCoeToSort.{u3, u3} (AffineSubspace.{u1, u2, u3} k V P _inst_1 _inst_2 _inst_3 _inst_4) P (AffineSubspace.setLike.{u1, u2, u3} k V P _inst_1 _inst_2 _inst_3 _inst_4)) s) P (HasLiftT.mk.{succ u3, succ u3} (coeSort.{succ u3, succ (succ u3)} (AffineSubspace.{u1, u2, u3} k V P _inst_1 _inst_2 _inst_3 _inst_4) Type.{u3} (SetLike.hasCoeToSort.{u3, u3} (AffineSubspace.{u1, u2, u3} k V P _inst_1 _inst_2 _inst_3 _inst_4) P (AffineSubspace.setLike.{u1, u2, u3} k V P _inst_1 _inst_2 _inst_3 _inst_4)) s) P (CoeTCₓ.coe.{succ u3, succ u3} (coeSort.{succ u3, succ (succ u3)} (AffineSubspace.{u1, u2, u3} k V P _inst_1 _inst_2 _inst_3 _inst_4) Type.{u3} (SetLike.hasCoeToSort.{u3, u3} (AffineSubspace.{u1, u2, u3} k V P _inst_1 _inst_2 _inst_3 _inst_4) P (AffineSubspace.setLike.{u1, u2, u3} k V P _inst_1 _inst_2 _inst_3 _inst_4)) s) P (coeBase.{succ u3, succ u3} (coeSort.{succ u3, succ (succ u3)} (AffineSubspace.{u1, u2, u3} k V P _inst_1 _inst_2 _inst_3 _inst_4) Type.{u3} (SetLike.hasCoeToSort.{u3, u3} (AffineSubspace.{u1, u2, u3} k V P _inst_1 _inst_2 _inst_3 _inst_4) P (AffineSubspace.setLike.{u1, u2, u3} k V P _inst_1 _inst_2 _inst_3 _inst_4)) s) P (coeSubtype.{succ u3} P (fun (x : P) => Membership.Mem.{u3, u3} P (AffineSubspace.{u1, u2, u3} k V P _inst_1 _inst_2 _inst_3 _inst_4) (SetLike.hasMem.{u3, u3} (AffineSubspace.{u1, u2, u3} k V P _inst_1 _inst_2 _inst_3 _inst_4) P (AffineSubspace.setLike.{u1, u2, u3} k V P _inst_1 _inst_2 _inst_3 _inst_4)) x s))))) b)) but is expected to have type forall {k : Type.{u3}} {V : Type.{u2}} {P : Type.{u1}} [_inst_1 : Ring.{u3} k] [_inst_2 : AddCommGroup.{u2} V] [_inst_3 : Module.{u3, u2} k V (Ring.toSemiring.{u3} k _inst_1) (AddCommGroup.toAddCommMonoid.{u2} V _inst_2)] [_inst_4 : AddTorsor.{u2, u1} V P (AddCommGroup.toAddGroup.{u2} V _inst_2)] (s : AffineSubspace.{u3, u2, u1} k V P _inst_1 _inst_2 _inst_3 _inst_4) [_inst_5 : Nonempty.{succ u1} (Subtype.{succ u1} P (fun (x : P) => Membership.mem.{u1, u1} P (AffineSubspace.{u3, u2, u1} k V P _inst_1 _inst_2 _inst_3 _inst_4) (SetLike.instMembership.{u1, u1} (AffineSubspace.{u3, u2, u1} k V P _inst_1 _inst_2 _inst_3 _inst_4) P (AffineSubspace.instSetLikeAffineSubspace.{u3, u2, u1} k V P _inst_1 _inst_2 _inst_3 _inst_4)) x s))] (a : Subtype.{succ u1} P (fun (x : P) => Membership.mem.{u1, u1} P (AffineSubspace.{u3, u2, u1} k V P _inst_1 _inst_2 _inst_3 _inst_4) (SetLike.instMembership.{u1, u1} (AffineSubspace.{u3, u2, u1} k V P _inst_1 _inst_2 _inst_3 _inst_4) P (AffineSubspace.instSetLikeAffineSubspace.{u3, u2, u1} k V P _inst_1 _inst_2 _inst_3 _inst_4)) x s)) (b : Subtype.{succ u1} P (fun (x : P) => Membership.mem.{u1, u1} P (AffineSubspace.{u3, u2, u1} k V P _inst_1 _inst_2 _inst_3 _inst_4) (SetLike.instMembership.{u1, u1} (AffineSubspace.{u3, u2, u1} k V P _inst_1 _inst_2 _inst_3 _inst_4) P (AffineSubspace.instSetLikeAffineSubspace.{u3, u2, u1} k V P _inst_1 _inst_2 _inst_3 _inst_4)) x s)), Eq.{succ u2} V (Subtype.val.{succ u2} V (fun (x : V) => Membership.mem.{u2, u2} V (Set.{u2} V) (Set.instMembershipSet.{u2} V) x (SetLike.coe.{u2, u2} (Submodule.{u3, u2} k V (Ring.toSemiring.{u3} k _inst_1) (AddCommGroup.toAddCommMonoid.{u2} V _inst_2) _inst_3) V (Submodule.setLike.{u3, u2} k V (Ring.toSemiring.{u3} k _inst_1) (AddCommGroup.toAddCommMonoid.{u2} V _inst_2) _inst_3) (AffineSubspace.direction.{u3, u2, u1} k V P _inst_1 _inst_2 _inst_3 _inst_4 s))) (VSub.vsub.{u2, u1} (Subtype.{succ u2} V (fun (x : V) => Membership.mem.{u2, u2} V (Submodule.{u3, u2} k V (Ring.toSemiring.{u3} k _inst_1) (AddCommGroup.toAddCommMonoid.{u2} V _inst_2) _inst_3) (SetLike.instMembership.{u2, u2} (Submodule.{u3, u2} k V (Ring.toSemiring.{u3} k _inst_1) (AddCommGroup.toAddCommMonoid.{u2} V _inst_2) _inst_3) V (Submodule.setLike.{u3, u2} k V (Ring.toSemiring.{u3} k _inst_1) (AddCommGroup.toAddCommMonoid.{u2} V _inst_2) _inst_3)) x (AffineSubspace.direction.{u3, u2, u1} k V P _inst_1 _inst_2 _inst_3 _inst_4 s))) (Subtype.{succ u1} P (fun (x : P) => Membership.mem.{u1, u1} P (AffineSubspace.{u3, u2, u1} k V P _inst_1 _inst_2 _inst_3 _inst_4) (SetLike.instMembership.{u1, u1} (AffineSubspace.{u3, u2, u1} k V P _inst_1 _inst_2 _inst_3 _inst_4) P (AffineSubspace.instSetLikeAffineSubspace.{u3, u2, u1} k V P _inst_1 _inst_2 _inst_3 _inst_4)) x s)) (AddTorsor.toVSub.{u2, u1} (Subtype.{succ u2} V (fun (x : V) => Membership.mem.{u2, u2} V (Submodule.{u3, u2} k V (Ring.toSemiring.{u3} k _inst_1) (AddCommGroup.toAddCommMonoid.{u2} V _inst_2) _inst_3) (SetLike.instMembership.{u2, u2} (Submodule.{u3, u2} k V (Ring.toSemiring.{u3} k _inst_1) (AddCommGroup.toAddCommMonoid.{u2} V _inst_2) _inst_3) V (Submodule.setLike.{u3, u2} k V (Ring.toSemiring.{u3} k _inst_1) (AddCommGroup.toAddCommMonoid.{u2} V _inst_2) _inst_3)) x (AffineSubspace.direction.{u3, u2, u1} k V P _inst_1 _inst_2 _inst_3 _inst_4 s))) (Subtype.{succ u1} P (fun (x : P) => Membership.mem.{u1, u1} P (AffineSubspace.{u3, u2, u1} k V P _inst_1 _inst_2 _inst_3 _inst_4) (SetLike.instMembership.{u1, u1} (AffineSubspace.{u3, u2, u1} k V P _inst_1 _inst_2 _inst_3 _inst_4) P (AffineSubspace.instSetLikeAffineSubspace.{u3, u2, u1} k V P _inst_1 _inst_2 _inst_3 _inst_4)) x s)) (AddCommGroup.toAddGroup.{u2} (Subtype.{succ u2} V (fun (x : V) => Membership.mem.{u2, u2} V (Submodule.{u3, u2} k V (Ring.toSemiring.{u3} k _inst_1) (AddCommGroup.toAddCommMonoid.{u2} V _inst_2) _inst_3) (SetLike.instMembership.{u2, u2} (Submodule.{u3, u2} k V (Ring.toSemiring.{u3} k _inst_1) (AddCommGroup.toAddCommMonoid.{u2} V _inst_2) _inst_3) V (Submodule.setLike.{u3, u2} k V (Ring.toSemiring.{u3} k _inst_1) (AddCommGroup.toAddCommMonoid.{u2} V _inst_2) _inst_3)) x (AffineSubspace.direction.{u3, u2, u1} k V P _inst_1 _inst_2 _inst_3 _inst_4 s))) (Submodule.addCommGroup.{u3, u2} k V _inst_1 _inst_2 _inst_3 (AffineSubspace.direction.{u3, u2, u1} k V P _inst_1 _inst_2 _inst_3 _inst_4 s))) (AffineSubspace.toAddTorsor.{u3, u2, u1} k V P _inst_1 _inst_2 _inst_3 _inst_4 s _inst_5)) a b)) (VSub.vsub.{u2, u1} V P (AddTorsor.toVSub.{u2, u1} V P (AddCommGroup.toAddGroup.{u2} V _inst_2) _inst_4) (Subtype.val.{succ u1} P (fun (x : P) => Membership.mem.{u1, u1} P (Set.{u1} P) (Set.instMembershipSet.{u1} P) x (SetLike.coe.{u1, u1} (AffineSubspace.{u3, u2, u1} k V P _inst_1 _inst_2 _inst_3 _inst_4) P (AffineSubspace.instSetLikeAffineSubspace.{u3, u2, u1} k V P _inst_1 _inst_2 _inst_3 _inst_4) s)) a) (Subtype.val.{succ u1} P (fun (x : P) => Membership.mem.{u1, u1} P (Set.{u1} P) (Set.instMembershipSet.{u1} P) x (SetLike.coe.{u1, u1} (AffineSubspace.{u3, u2, u1} k V P _inst_1 _inst_2 _inst_3 _inst_4) P (AffineSubspace.instSetLikeAffineSubspace.{u3, u2, u1} k V P _inst_1 _inst_2 _inst_3 _inst_4) s)) b)) Case conversion may be inaccurate. Consider using '#align affine_subspace.coe_vsub AffineSubspace.coe_vsubₓ'. -/ @[simp, norm_cast] theorem coe_vsub (s : AffineSubspace k P) [Nonempty s] (a b : s) : ↑(a -ᵥ b) = (a : P) -ᵥ (b : P) := rfl #align affine_subspace.coe_vsub AffineSubspace.coe_vsub /- warning: affine_subspace.coe_vadd -> AffineSubspace.coe_vadd is a dubious translation: lean 3 declaration is forall {k : Type.{u1}} {V : Type.{u2}} {P : Type.{u3}} [_inst_1 : Ring.{u1} k] [_inst_2 : AddCommGroup.{u2} V] [_inst_3 : Module.{u1, u2} k V (Ring.toSemiring.{u1} k _inst_1) (AddCommGroup.toAddCommMonoid.{u2} V _inst_2)] [_inst_4 : AddTorsor.{u2, u3} V P (AddCommGroup.toAddGroup.{u2} V _inst_2)] (s : AffineSubspace.{u1, u2, u3} k V P _inst_1 _inst_2 _inst_3 _inst_4) [_inst_5 : Nonempty.{succ u3} (coeSort.{succ u3, succ (succ u3)} (AffineSubspace.{u1, u2, u3} k V P _inst_1 _inst_2 _inst_3 _inst_4) Type.{u3} (SetLike.hasCoeToSort.{u3, u3} (AffineSubspace.{u1, u2, u3} k V P _inst_1 _inst_2 _inst_3 _inst_4) P (AffineSubspace.setLike.{u1, u2, u3} k V P _inst_1 _inst_2 _inst_3 _inst_4)) s)] (a : coeSort.{succ u2, succ (succ u2)} (Submodule.{u1, u2} k V (Ring.toSemiring.{u1} k _inst_1) (AddCommGroup.toAddCommMonoid.{u2} V _inst_2) _inst_3) Type.{u2} (SetLike.hasCoeToSort.{u2, u2} (Submodule.{u1, u2} k V (Ring.toSemiring.{u1} k _inst_1) (AddCommGroup.toAddCommMonoid.{u2} V _inst_2) _inst_3) V (Submodule.setLike.{u1, u2} k V (Ring.toSemiring.{u1} k _inst_1) (AddCommGroup.toAddCommMonoid.{u2} V _inst_2) _inst_3)) (AffineSubspace.direction.{u1, u2, u3} k V P _inst_1 _inst_2 _inst_3 _inst_4 s)) (b : coeSort.{succ u3, succ (succ u3)} (AffineSubspace.{u1, u2, u3} k V P _inst_1 _inst_2 _inst_3 _inst_4) Type.{u3} (SetLike.hasCoeToSort.{u3, u3} (AffineSubspace.{u1, u2, u3} k V P _inst_1 _inst_2 _inst_3 _inst_4) P (AffineSubspace.setLike.{u1, u2, u3} k V P _inst_1 _inst_2 _inst_3 _inst_4)) s), Eq.{succ u3} P ((fun (a : Type.{u3}) (b : Type.{u3}) [self : HasLiftT.{succ u3, succ u3} a b] => self.0) (coeSort.{succ u3, succ (succ u3)} (AffineSubspace.{u1, u2, u3} k V P _inst_1 _inst_2 _inst_3 _inst_4) Type.{u3} (SetLike.hasCoeToSort.{u3, u3} (AffineSubspace.{u1, u2, u3} k V P _inst_1 _inst_2 _inst_3 _inst_4) P (AffineSubspace.setLike.{u1, u2, u3} k V P _inst_1 _inst_2 _inst_3 _inst_4)) s) P (HasLiftT.mk.{succ u3, succ u3} (coeSort.{succ u3, succ (succ u3)} (AffineSubspace.{u1, u2, u3} k V P _inst_1 _inst_2 _inst_3 _inst_4) Type.{u3} (SetLike.hasCoeToSort.{u3, u3} (AffineSubspace.{u1, u2, u3} k V P _inst_1 _inst_2 _inst_3 _inst_4) P (AffineSubspace.setLike.{u1, u2, u3} k V P _inst_1 _inst_2 _inst_3 _inst_4)) s) P (CoeTCₓ.coe.{succ u3, succ u3} (coeSort.{succ u3, succ (succ u3)} (AffineSubspace.{u1, u2, u3} k V P _inst_1 _inst_2 _inst_3 _inst_4) Type.{u3} (SetLike.hasCoeToSort.{u3, u3} (AffineSubspace.{u1, u2, u3} k V P _inst_1 _inst_2 _inst_3 _inst_4) P (AffineSubspace.setLike.{u1, u2, u3} k V P _inst_1 _inst_2 _inst_3 _inst_4)) s) P (coeBase.{succ u3, succ u3} (coeSort.{succ u3, succ (succ u3)} (AffineSubspace.{u1, u2, u3} k V P _inst_1 _inst_2 _inst_3 _inst_4) Type.{u3} (SetLike.hasCoeToSort.{u3, u3} (AffineSubspace.{u1, u2, u3} k V P _inst_1 _inst_2 _inst_3 _inst_4) P (AffineSubspace.setLike.{u1, u2, u3} k V P _inst_1 _inst_2 _inst_3 _inst_4)) s) P (coeSubtype.{succ u3} P (fun (x : P) => Membership.Mem.{u3, u3} P (AffineSubspace.{u1, u2, u3} k V P _inst_1 _inst_2 _inst_3 _inst_4) (SetLike.hasMem.{u3, u3} (AffineSubspace.{u1, u2, u3} k V P _inst_1 _inst_2 _inst_3 _inst_4) P (AffineSubspace.setLike.{u1, u2, u3} k V P _inst_1 _inst_2 _inst_3 _inst_4)) x s))))) (VAdd.vadd.{u2, u3} (coeSort.{succ u2, succ (succ u2)} (Submodule.{u1, u2} k V (Ring.toSemiring.{u1} k _inst_1) (AddCommGroup.toAddCommMonoid.{u2} V _inst_2) _inst_3) Type.{u2} (SetLike.hasCoeToSort.{u2, u2} (Submodule.{u1, u2} k V (Ring.toSemiring.{u1} k _inst_1) (AddCommGroup.toAddCommMonoid.{u2} V _inst_2) _inst_3) V (Submodule.setLike.{u1, u2} k V (Ring.toSemiring.{u1} k _inst_1) (AddCommGroup.toAddCommMonoid.{u2} V _inst_2) _inst_3)) (AffineSubspace.direction.{u1, u2, u3} k V P _inst_1 _inst_2 _inst_3 _inst_4 s)) (coeSort.{succ u3, succ (succ u3)} (AffineSubspace.{u1, u2, u3} k V P _inst_1 _inst_2 _inst_3 _inst_4) Type.{u3} (SetLike.hasCoeToSort.{u3, u3} (AffineSubspace.{u1, u2, u3} k V P _inst_1 _inst_2 _inst_3 _inst_4) P (AffineSubspace.setLike.{u1, u2, u3} k V P _inst_1 _inst_2 _inst_3 _inst_4)) s) (AddAction.toHasVadd.{u2, u3} (coeSort.{succ u2, succ (succ u2)} (Submodule.{u1, u2} k V (Ring.toSemiring.{u1} k _inst_1) (AddCommGroup.toAddCommMonoid.{u2} V _inst_2) _inst_3) Type.{u2} (SetLike.hasCoeToSort.{u2, u2} (Submodule.{u1, u2} k V (Ring.toSemiring.{u1} k _inst_1) (AddCommGroup.toAddCommMonoid.{u2} V _inst_2) _inst_3) V (Submodule.setLike.{u1, u2} k V (Ring.toSemiring.{u1} k _inst_1) (AddCommGroup.toAddCommMonoid.{u2} V _inst_2) _inst_3)) (AffineSubspace.direction.{u1, u2, u3} k V P _inst_1 _inst_2 _inst_3 _inst_4 s)) (coeSort.{succ u3, succ (succ u3)} (AffineSubspace.{u1, u2, u3} k V P _inst_1 _inst_2 _inst_3 _inst_4) Type.{u3} (SetLike.hasCoeToSort.{u3, u3} (AffineSubspace.{u1, u2, u3} k V P _inst_1 _inst_2 _inst_3 _inst_4) P (AffineSubspace.setLike.{u1, u2, u3} k V P _inst_1 _inst_2 _inst_3 _inst_4)) s) (SubNegMonoid.toAddMonoid.{u2} (coeSort.{succ u2, succ (succ u2)} (Submodule.{u1, u2} k V (Ring.toSemiring.{u1} k _inst_1) (AddCommGroup.toAddCommMonoid.{u2} V _inst_2) _inst_3) Type.{u2} (SetLike.hasCoeToSort.{u2, u2} (Submodule.{u1, u2} k V (Ring.toSemiring.{u1} k _inst_1) (AddCommGroup.toAddCommMonoid.{u2} V _inst_2) _inst_3) V (Submodule.setLike.{u1, u2} k V (Ring.toSemiring.{u1} k _inst_1) (AddCommGroup.toAddCommMonoid.{u2} V _inst_2) _inst_3)) (AffineSubspace.direction.{u1, u2, u3} k V P _inst_1 _inst_2 _inst_3 _inst_4 s)) (AddGroup.toSubNegMonoid.{u2} (coeSort.{succ u2, succ (succ u2)} (Submodule.{u1, u2} k V (Ring.toSemiring.{u1} k _inst_1) (AddCommGroup.toAddCommMonoid.{u2} V _inst_2) _inst_3) Type.{u2} (SetLike.hasCoeToSort.{u2, u2} (Submodule.{u1, u2} k V (Ring.toSemiring.{u1} k _inst_1) (AddCommGroup.toAddCommMonoid.{u2} V _inst_2) _inst_3) V (Submodule.setLike.{u1, u2} k V (Ring.toSemiring.{u1} k _inst_1) (AddCommGroup.toAddCommMonoid.{u2} V _inst_2) _inst_3)) (AffineSubspace.direction.{u1, u2, u3} k V P _inst_1 _inst_2 _inst_3 _inst_4 s)) (AddCommGroup.toAddGroup.{u2} (coeSort.{succ u2, succ (succ u2)} (Submodule.{u1, u2} k V (Ring.toSemiring.{u1} k _inst_1) (AddCommGroup.toAddCommMonoid.{u2} V _inst_2) _inst_3) Type.{u2} (SetLike.hasCoeToSort.{u2, u2} (Submodule.{u1, u2} k V (Ring.toSemiring.{u1} k _inst_1) (AddCommGroup.toAddCommMonoid.{u2} V _inst_2) _inst_3) V (Submodule.setLike.{u1, u2} k V (Ring.toSemiring.{u1} k _inst_1) (AddCommGroup.toAddCommMonoid.{u2} V _inst_2) _inst_3)) (AffineSubspace.direction.{u1, u2, u3} k V P _inst_1 _inst_2 _inst_3 _inst_4 s)) (Submodule.addCommGroup.{u1, u2} k V _inst_1 _inst_2 _inst_3 (AffineSubspace.direction.{u1, u2, u3} k V P _inst_1 _inst_2 _inst_3 _inst_4 s))))) (AddTorsor.toAddAction.{u2, u3} (coeSort.{succ u2, succ (succ u2)} (Submodule.{u1, u2} k V (Ring.toSemiring.{u1} k _inst_1) (AddCommGroup.toAddCommMonoid.{u2} V _inst_2) _inst_3) Type.{u2} (SetLike.hasCoeToSort.{u2, u2} (Submodule.{u1, u2} k V (Ring.toSemiring.{u1} k _inst_1) (AddCommGroup.toAddCommMonoid.{u2} V _inst_2) _inst_3) V (Submodule.setLike.{u1, u2} k V (Ring.toSemiring.{u1} k _inst_1) (AddCommGroup.toAddCommMonoid.{u2} V _inst_2) _inst_3)) (AffineSubspace.direction.{u1, u2, u3} k V P _inst_1 _inst_2 _inst_3 _inst_4 s)) (coeSort.{succ u3, succ (succ u3)} (AffineSubspace.{u1, u2, u3} k V P _inst_1 _inst_2 _inst_3 _inst_4) Type.{u3} (SetLike.hasCoeToSort.{u3, u3} (AffineSubspace.{u1, u2, u3} k V P _inst_1 _inst_2 _inst_3 _inst_4) P (AffineSubspace.setLike.{u1, u2, u3} k V P _inst_1 _inst_2 _inst_3 _inst_4)) s) (AddCommGroup.toAddGroup.{u2} (coeSort.{succ u2, succ (succ u2)} (Submodule.{u1, u2} k V (Ring.toSemiring.{u1} k _inst_1) (AddCommGroup.toAddCommMonoid.{u2} V _inst_2) _inst_3) Type.{u2} (SetLike.hasCoeToSort.{u2, u2} (Submodule.{u1, u2} k V (Ring.toSemiring.{u1} k _inst_1) (AddCommGroup.toAddCommMonoid.{u2} V _inst_2) _inst_3) V (Submodule.setLike.{u1, u2} k V (Ring.toSemiring.{u1} k _inst_1) (AddCommGroup.toAddCommMonoid.{u2} V _inst_2) _inst_3)) (AffineSubspace.direction.{u1, u2, u3} k V P _inst_1 _inst_2 _inst_3 _inst_4 s)) (Submodule.addCommGroup.{u1, u2} k V _inst_1 _inst_2 _inst_3 (AffineSubspace.direction.{u1, u2, u3} k V P _inst_1 _inst_2 _inst_3 _inst_4 s))) (AffineSubspace.toAddTorsor.{u1, u2, u3} k V P _inst_1 _inst_2 _inst_3 _inst_4 s _inst_5))) a b)) (VAdd.vadd.{u2, u3} V P (AddAction.toHasVadd.{u2, u3} V P (SubNegMonoid.toAddMonoid.{u2} V (AddGroup.toSubNegMonoid.{u2} V (AddCommGroup.toAddGroup.{u2} V _inst_2))) (AddTorsor.toAddAction.{u2, u3} V P (AddCommGroup.toAddGroup.{u2} V _inst_2) _inst_4)) ((fun (a : Type.{u2}) (b : Type.{u2}) [self : HasLiftT.{succ u2, succ u2} a b] => self.0) (coeSort.{succ u2, succ (succ u2)} (Submodule.{u1, u2} k V (Ring.toSemiring.{u1} k _inst_1) (AddCommGroup.toAddCommMonoid.{u2} V _inst_2) _inst_3) Type.{u2} (SetLike.hasCoeToSort.{u2, u2} (Submodule.{u1, u2} k V (Ring.toSemiring.{u1} k _inst_1) (AddCommGroup.toAddCommMonoid.{u2} V _inst_2) _inst_3) V (Submodule.setLike.{u1, u2} k V (Ring.toSemiring.{u1} k _inst_1) (AddCommGroup.toAddCommMonoid.{u2} V _inst_2) _inst_3)) (AffineSubspace.direction.{u1, u2, u3} k V P _inst_1 _inst_2 _inst_3 _inst_4 s)) V (HasLiftT.mk.{succ u2, succ u2} (coeSort.{succ u2, succ (succ u2)} (Submodule.{u1, u2} k V (Ring.toSemiring.{u1} k _inst_1) (AddCommGroup.toAddCommMonoid.{u2} V _inst_2) _inst_3) Type.{u2} (SetLike.hasCoeToSort.{u2, u2} (Submodule.{u1, u2} k V (Ring.toSemiring.{u1} k _inst_1) (AddCommGroup.toAddCommMonoid.{u2} V _inst_2) _inst_3) V (Submodule.setLike.{u1, u2} k V (Ring.toSemiring.{u1} k _inst_1) (AddCommGroup.toAddCommMonoid.{u2} V _inst_2) _inst_3)) (AffineSubspace.direction.{u1, u2, u3} k V P _inst_1 _inst_2 _inst_3 _inst_4 s)) V (CoeTCₓ.coe.{succ u2, succ u2} (coeSort.{succ u2, succ (succ u2)} (Submodule.{u1, u2} k V (Ring.toSemiring.{u1} k _inst_1) (AddCommGroup.toAddCommMonoid.{u2} V _inst_2) _inst_3) Type.{u2} (SetLike.hasCoeToSort.{u2, u2} (Submodule.{u1, u2} k V (Ring.toSemiring.{u1} k _inst_1) (AddCommGroup.toAddCommMonoid.{u2} V _inst_2) _inst_3) V (Submodule.setLike.{u1, u2} k V (Ring.toSemiring.{u1} k _inst_1) (AddCommGroup.toAddCommMonoid.{u2} V _inst_2) _inst_3)) (AffineSubspace.direction.{u1, u2, u3} k V P _inst_1 _inst_2 _inst_3 _inst_4 s)) V (coeBase.{succ u2, succ u2} (coeSort.{succ u2, succ (succ u2)} (Submodule.{u1, u2} k V (Ring.toSemiring.{u1} k _inst_1) (AddCommGroup.toAddCommMonoid.{u2} V _inst_2) _inst_3) Type.{u2} (SetLike.hasCoeToSort.{u2, u2} (Submodule.{u1, u2} k V (Ring.toSemiring.{u1} k _inst_1) (AddCommGroup.toAddCommMonoid.{u2} V _inst_2) _inst_3) V (Submodule.setLike.{u1, u2} k V (Ring.toSemiring.{u1} k _inst_1) (AddCommGroup.toAddCommMonoid.{u2} V _inst_2) _inst_3)) (AffineSubspace.direction.{u1, u2, u3} k V P _inst_1 _inst_2 _inst_3 _inst_4 s)) V (coeSubtype.{succ u2} V (fun (x : V) => Membership.Mem.{u2, u2} V (Submodule.{u1, u2} k V (Ring.toSemiring.{u1} k _inst_1) (AddCommGroup.toAddCommMonoid.{u2} V _inst_2) _inst_3) (SetLike.hasMem.{u2, u2} (Submodule.{u1, u2} k V (Ring.toSemiring.{u1} k _inst_1) (AddCommGroup.toAddCommMonoid.{u2} V _inst_2) _inst_3) V (Submodule.setLike.{u1, u2} k V (Ring.toSemiring.{u1} k _inst_1) (AddCommGroup.toAddCommMonoid.{u2} V _inst_2) _inst_3)) x (AffineSubspace.direction.{u1, u2, u3} k V P _inst_1 _inst_2 _inst_3 _inst_4 s)))))) a) ((fun (a : Type.{u3}) (b : Type.{u3}) [self : HasLiftT.{succ u3, succ u3} a b] => self.0) (coeSort.{succ u3, succ (succ u3)} (AffineSubspace.{u1, u2, u3} k V P _inst_1 _inst_2 _inst_3 _inst_4) Type.{u3} (SetLike.hasCoeToSort.{u3, u3} (AffineSubspace.{u1, u2, u3} k V P _inst_1 _inst_2 _inst_3 _inst_4) P (AffineSubspace.setLike.{u1, u2, u3} k V P _inst_1 _inst_2 _inst_3 _inst_4)) s) P (HasLiftT.mk.{succ u3, succ u3} (coeSort.{succ u3, succ (succ u3)} (AffineSubspace.{u1, u2, u3} k V P _inst_1 _inst_2 _inst_3 _inst_4) Type.{u3} (SetLike.hasCoeToSort.{u3, u3} (AffineSubspace.{u1, u2, u3} k V P _inst_1 _inst_2 _inst_3 _inst_4) P (AffineSubspace.setLike.{u1, u2, u3} k V P _inst_1 _inst_2 _inst_3 _inst_4)) s) P (CoeTCₓ.coe.{succ u3, succ u3} (coeSort.{succ u3, succ (succ u3)} (AffineSubspace.{u1, u2, u3} k V P _inst_1 _inst_2 _inst_3 _inst_4) Type.{u3} (SetLike.hasCoeToSort.{u3, u3} (AffineSubspace.{u1, u2, u3} k V P _inst_1 _inst_2 _inst_3 _inst_4) P (AffineSubspace.setLike.{u1, u2, u3} k V P _inst_1 _inst_2 _inst_3 _inst_4)) s) P (coeBase.{succ u3, succ u3} (coeSort.{succ u3, succ (succ u3)} (AffineSubspace.{u1, u2, u3} k V P _inst_1 _inst_2 _inst_3 _inst_4) Type.{u3} (SetLike.hasCoeToSort.{u3, u3} (AffineSubspace.{u1, u2, u3} k V P _inst_1 _inst_2 _inst_3 _inst_4) P (AffineSubspace.setLike.{u1, u2, u3} k V P _inst_1 _inst_2 _inst_3 _inst_4)) s) P (coeSubtype.{succ u3} P (fun (x : P) => Membership.Mem.{u3, u3} P (AffineSubspace.{u1, u2, u3} k V P _inst_1 _inst_2 _inst_3 _inst_4) (SetLike.hasMem.{u3, u3} (AffineSubspace.{u1, u2, u3} k V P _inst_1 _inst_2 _inst_3 _inst_4) P (AffineSubspace.setLike.{u1, u2, u3} k V P _inst_1 _inst_2 _inst_3 _inst_4)) x s))))) b)) but is expected to have type forall {k : Type.{u3}} {V : Type.{u2}} {P : Type.{u1}} [_inst_1 : Ring.{u3} k] [_inst_2 : AddCommGroup.{u2} V] [_inst_3 : Module.{u3, u2} k V (Ring.toSemiring.{u3} k _inst_1) (AddCommGroup.toAddCommMonoid.{u2} V _inst_2)] [_inst_4 : AddTorsor.{u2, u1} V P (AddCommGroup.toAddGroup.{u2} V _inst_2)] (s : AffineSubspace.{u3, u2, u1} k V P _inst_1 _inst_2 _inst_3 _inst_4) [_inst_5 : Nonempty.{succ u1} (Subtype.{succ u1} P (fun (x : P) => Membership.mem.{u1, u1} P (AffineSubspace.{u3, u2, u1} k V P _inst_1 _inst_2 _inst_3 _inst_4) (SetLike.instMembership.{u1, u1} (AffineSubspace.{u3, u2, u1} k V P _inst_1 _inst_2 _inst_3 _inst_4) P (AffineSubspace.instSetLikeAffineSubspace.{u3, u2, u1} k V P _inst_1 _inst_2 _inst_3 _inst_4)) x s))] (a : Subtype.{succ u2} V (fun (x : V) => Membership.mem.{u2, u2} V (Submodule.{u3, u2} k V (Ring.toSemiring.{u3} k _inst_1) (AddCommGroup.toAddCommMonoid.{u2} V _inst_2) _inst_3) (SetLike.instMembership.{u2, u2} (Submodule.{u3, u2} k V (Ring.toSemiring.{u3} k _inst_1) (AddCommGroup.toAddCommMonoid.{u2} V _inst_2) _inst_3) V (Submodule.setLike.{u3, u2} k V (Ring.toSemiring.{u3} k _inst_1) (AddCommGroup.toAddCommMonoid.{u2} V _inst_2) _inst_3)) x (AffineSubspace.direction.{u3, u2, u1} k V P _inst_1 _inst_2 _inst_3 _inst_4 s))) (b : Subtype.{succ u1} P (fun (x : P) => Membership.mem.{u1, u1} P (AffineSubspace.{u3, u2, u1} k V P _inst_1 _inst_2 _inst_3 _inst_4) (SetLike.instMembership.{u1, u1} (AffineSubspace.{u3, u2, u1} k V P _inst_1 _inst_2 _inst_3 _inst_4) P (AffineSubspace.instSetLikeAffineSubspace.{u3, u2, u1} k V P _inst_1 _inst_2 _inst_3 _inst_4)) x s)), Eq.{succ u1} P (Subtype.val.{succ u1} P (fun (x : P) => Membership.mem.{u1, u1} P (Set.{u1} P) (Set.instMembershipSet.{u1} P) x (SetLike.coe.{u1, u1} (AffineSubspace.{u3, u2, u1} k V P _inst_1 _inst_2 _inst_3 _inst_4) P (AffineSubspace.instSetLikeAffineSubspace.{u3, u2, u1} k V P _inst_1 _inst_2 _inst_3 _inst_4) s)) (HVAdd.hVAdd.{u2, u1, u1} (Subtype.{succ u2} V (fun (x : V) => Membership.mem.{u2, u2} V (Submodule.{u3, u2} k V (Ring.toSemiring.{u3} k _inst_1) (AddCommGroup.toAddCommMonoid.{u2} V _inst_2) _inst_3) (SetLike.instMembership.{u2, u2} (Submodule.{u3, u2} k V (Ring.toSemiring.{u3} k _inst_1) (AddCommGroup.toAddCommMonoid.{u2} V _inst_2) _inst_3) V (Submodule.setLike.{u3, u2} k V (Ring.toSemiring.{u3} k _inst_1) (AddCommGroup.toAddCommMonoid.{u2} V _inst_2) _inst_3)) x (AffineSubspace.direction.{u3, u2, u1} k V P _inst_1 _inst_2 _inst_3 _inst_4 s))) (Subtype.{succ u1} P (fun (x : P) => Membership.mem.{u1, u1} P (AffineSubspace.{u3, u2, u1} k V P _inst_1 _inst_2 _inst_3 _inst_4) (SetLike.instMembership.{u1, u1} (AffineSubspace.{u3, u2, u1} k V P _inst_1 _inst_2 _inst_3 _inst_4) P (AffineSubspace.instSetLikeAffineSubspace.{u3, u2, u1} k V P _inst_1 _inst_2 _inst_3 _inst_4)) x s)) (Subtype.{succ u1} P (fun (x : P) => Membership.mem.{u1, u1} P (AffineSubspace.{u3, u2, u1} k V P _inst_1 _inst_2 _inst_3 _inst_4) (SetLike.instMembership.{u1, u1} (AffineSubspace.{u3, u2, u1} k V P _inst_1 _inst_2 _inst_3 _inst_4) P (AffineSubspace.instSetLikeAffineSubspace.{u3, u2, u1} k V P _inst_1 _inst_2 _inst_3 _inst_4)) x s)) (instHVAdd.{u2, u1} (Subtype.{succ u2} V (fun (x : V) => Membership.mem.{u2, u2} V (Submodule.{u3, u2} k V (Ring.toSemiring.{u3} k _inst_1) (AddCommGroup.toAddCommMonoid.{u2} V _inst_2) _inst_3) (SetLike.instMembership.{u2, u2} (Submodule.{u3, u2} k V (Ring.toSemiring.{u3} k _inst_1) (AddCommGroup.toAddCommMonoid.{u2} V _inst_2) _inst_3) V (Submodule.setLike.{u3, u2} k V (Ring.toSemiring.{u3} k _inst_1) (AddCommGroup.toAddCommMonoid.{u2} V _inst_2) _inst_3)) x (AffineSubspace.direction.{u3, u2, u1} k V P _inst_1 _inst_2 _inst_3 _inst_4 s))) (Subtype.{succ u1} P (fun (x : P) => Membership.mem.{u1, u1} P (AffineSubspace.{u3, u2, u1} k V P _inst_1 _inst_2 _inst_3 _inst_4) (SetLike.instMembership.{u1, u1} (AffineSubspace.{u3, u2, u1} k V P _inst_1 _inst_2 _inst_3 _inst_4) P (AffineSubspace.instSetLikeAffineSubspace.{u3, u2, u1} k V P _inst_1 _inst_2 _inst_3 _inst_4)) x s)) (AddAction.toVAdd.{u2, u1} (Subtype.{succ u2} V (fun (x : V) => Membership.mem.{u2, u2} V (Submodule.{u3, u2} k V (Ring.toSemiring.{u3} k _inst_1) (AddCommGroup.toAddCommMonoid.{u2} V _inst_2) _inst_3) (SetLike.instMembership.{u2, u2} (Submodule.{u3, u2} k V (Ring.toSemiring.{u3} k _inst_1) (AddCommGroup.toAddCommMonoid.{u2} V _inst_2) _inst_3) V (Submodule.setLike.{u3, u2} k V (Ring.toSemiring.{u3} k _inst_1) (AddCommGroup.toAddCommMonoid.{u2} V _inst_2) _inst_3)) x (AffineSubspace.direction.{u3, u2, u1} k V P _inst_1 _inst_2 _inst_3 _inst_4 s))) (Subtype.{succ u1} P (fun (x : P) => Membership.mem.{u1, u1} P (AffineSubspace.{u3, u2, u1} k V P _inst_1 _inst_2 _inst_3 _inst_4) (SetLike.instMembership.{u1, u1} (AffineSubspace.{u3, u2, u1} k V P _inst_1 _inst_2 _inst_3 _inst_4) P (AffineSubspace.instSetLikeAffineSubspace.{u3, u2, u1} k V P _inst_1 _inst_2 _inst_3 _inst_4)) x s)) (AddSubmonoid.toAddMonoid.{u2} V (AddCommMonoid.toAddMonoid.{u2} V (AddCommGroup.toAddCommMonoid.{u2} V _inst_2)) (Submodule.toAddSubmonoid.{u3, u2} k V (Ring.toSemiring.{u3} k _inst_1) (AddCommGroup.toAddCommMonoid.{u2} V _inst_2) _inst_3 (AffineSubspace.direction.{u3, u2, u1} k V P _inst_1 _inst_2 _inst_3 _inst_4 s))) (AddTorsor.toAddAction.{u2, u1} (Subtype.{succ u2} V (fun (x : V) => Membership.mem.{u2, u2} V (Submodule.{u3, u2} k V (Ring.toSemiring.{u3} k _inst_1) (AddCommGroup.toAddCommMonoid.{u2} V _inst_2) _inst_3) (SetLike.instMembership.{u2, u2} (Submodule.{u3, u2} k V (Ring.toSemiring.{u3} k _inst_1) (AddCommGroup.toAddCommMonoid.{u2} V _inst_2) _inst_3) V (Submodule.setLike.{u3, u2} k V (Ring.toSemiring.{u3} k _inst_1) (AddCommGroup.toAddCommMonoid.{u2} V _inst_2) _inst_3)) x (AffineSubspace.direction.{u3, u2, u1} k V P _inst_1 _inst_2 _inst_3 _inst_4 s))) (Subtype.{succ u1} P (fun (x : P) => Membership.mem.{u1, u1} P (AffineSubspace.{u3, u2, u1} k V P _inst_1 _inst_2 _inst_3 _inst_4) (SetLike.instMembership.{u1, u1} (AffineSubspace.{u3, u2, u1} k V P _inst_1 _inst_2 _inst_3 _inst_4) P (AffineSubspace.instSetLikeAffineSubspace.{u3, u2, u1} k V P _inst_1 _inst_2 _inst_3 _inst_4)) x s)) (AddCommGroup.toAddGroup.{u2} (Subtype.{succ u2} V (fun (x : V) => Membership.mem.{u2, u2} V (Submodule.{u3, u2} k V (Ring.toSemiring.{u3} k _inst_1) (AddCommGroup.toAddCommMonoid.{u2} V _inst_2) _inst_3) (SetLike.instMembership.{u2, u2} (Submodule.{u3, u2} k V (Ring.toSemiring.{u3} k _inst_1) (AddCommGroup.toAddCommMonoid.{u2} V _inst_2) _inst_3) V (Submodule.setLike.{u3, u2} k V (Ring.toSemiring.{u3} k _inst_1) (AddCommGroup.toAddCommMonoid.{u2} V _inst_2) _inst_3)) x (AffineSubspace.direction.{u3, u2, u1} k V P _inst_1 _inst_2 _inst_3 _inst_4 s))) (Submodule.addCommGroup.{u3, u2} k V _inst_1 _inst_2 _inst_3 (AffineSubspace.direction.{u3, u2, u1} k V P _inst_1 _inst_2 _inst_3 _inst_4 s))) (AffineSubspace.toAddTorsor.{u3, u2, u1} k V P _inst_1 _inst_2 _inst_3 _inst_4 s _inst_5)))) a b)) (HVAdd.hVAdd.{u2, u1, u1} V P P (instHVAdd.{u2, u1} V P (AddAction.toVAdd.{u2, u1} V P (SubNegMonoid.toAddMonoid.{u2} V (AddGroup.toSubNegMonoid.{u2} V (AddCommGroup.toAddGroup.{u2} V _inst_2))) (AddTorsor.toAddAction.{u2, u1} V P (AddCommGroup.toAddGroup.{u2} V _inst_2) _inst_4))) (Subtype.val.{succ u2} V (fun (x : V) => Membership.mem.{u2, u2} V (Set.{u2} V) (Set.instMembershipSet.{u2} V) x (SetLike.coe.{u2, u2} (Submodule.{u3, u2} k V (Ring.toSemiring.{u3} k _inst_1) (AddCommGroup.toAddCommMonoid.{u2} V _inst_2) _inst_3) V (Submodule.setLike.{u3, u2} k V (Ring.toSemiring.{u3} k _inst_1) (AddCommGroup.toAddCommMonoid.{u2} V _inst_2) _inst_3) (AffineSubspace.direction.{u3, u2, u1} k V P _inst_1 _inst_2 _inst_3 _inst_4 s))) a) (Subtype.val.{succ u1} P (fun (x : P) => Membership.mem.{u1, u1} P (Set.{u1} P) (Set.instMembershipSet.{u1} P) x (SetLike.coe.{u1, u1} (AffineSubspace.{u3, u2, u1} k V P _inst_1 _inst_2 _inst_3 _inst_4) P (AffineSubspace.instSetLikeAffineSubspace.{u3, u2, u1} k V P _inst_1 _inst_2 _inst_3 _inst_4) s)) b)) Case conversion may be inaccurate. Consider using '#align affine_subspace.coe_vadd AffineSubspace.coe_vaddₓ'. -/ @[simp, norm_cast] theorem coe_vadd (s : AffineSubspace k P) [Nonempty s] (a : s.direction) (b : s) : ↑(a +ᵥ b) = (a : V) +ᵥ (b : P) := rfl #align affine_subspace.coe_vadd AffineSubspace.coe_vadd #print AffineSubspace.subtype /- /-- Embedding of an affine subspace to the ambient space, as an affine map. -/ protected def subtype (s : AffineSubspace k P) [Nonempty s] : s →ᵃ[k] P where toFun := coe linear := s.direction.Subtype map_vadd' p v := rfl #align affine_subspace.subtype AffineSubspace.subtype -/ /- warning: affine_subspace.subtype_linear -> AffineSubspace.subtype_linear is a dubious translation: lean 3 declaration is forall {k : Type.{u1}} {V : Type.{u2}} {P : Type.{u3}} [_inst_1 : Ring.{u1} k] [_inst_2 : AddCommGroup.{u2} V] [_inst_3 : Module.{u1, u2} k V (Ring.toSemiring.{u1} k _inst_1) (AddCommGroup.toAddCommMonoid.{u2} V _inst_2)] [_inst_4 : AddTorsor.{u2, u3} V P (AddCommGroup.toAddGroup.{u2} V _inst_2)] (s : AffineSubspace.{u1, u2, u3} k V P _inst_1 _inst_2 _inst_3 _inst_4) [_inst_5 : Nonempty.{succ u3} (coeSort.{succ u3, succ (succ u3)} (AffineSubspace.{u1, u2, u3} k V P _inst_1 _inst_2 _inst_3 _inst_4) Type.{u3} (SetLike.hasCoeToSort.{u3, u3} (AffineSubspace.{u1, u2, u3} k V P _inst_1 _inst_2 _inst_3 _inst_4) P (AffineSubspace.setLike.{u1, u2, u3} k V P _inst_1 _inst_2 _inst_3 _inst_4)) s)], Eq.{succ u2} (LinearMap.{u1, u1, u2, u2} k k (Ring.toSemiring.{u1} k _inst_1) (Ring.toSemiring.{u1} k _inst_1) (RingHom.id.{u1} k (Semiring.toNonAssocSemiring.{u1} k (Ring.toSemiring.{u1} k _inst_1))) (coeSort.{succ u2, succ (succ u2)} (Submodule.{u1, u2} k V (Ring.toSemiring.{u1} k _inst_1) (AddCommGroup.toAddCommMonoid.{u2} V _inst_2) _inst_3) Type.{u2} (SetLike.hasCoeToSort.{u2, u2} (Submodule.{u1, u2} k V (Ring.toSemiring.{u1} k _inst_1) (AddCommGroup.toAddCommMonoid.{u2} V _inst_2) _inst_3) V (Submodule.setLike.{u1, u2} k V (Ring.toSemiring.{u1} k _inst_1) (AddCommGroup.toAddCommMonoid.{u2} V _inst_2) _inst_3)) (AffineSubspace.direction.{u1, u2, u3} k V P _inst_1 _inst_2 _inst_3 _inst_4 s)) V (AddCommGroup.toAddCommMonoid.{u2} (coeSort.{succ u2, succ (succ u2)} (Submodule.{u1, u2} k V (Ring.toSemiring.{u1} k _inst_1) (AddCommGroup.toAddCommMonoid.{u2} V _inst_2) _inst_3) Type.{u2} (SetLike.hasCoeToSort.{u2, u2} (Submodule.{u1, u2} k V (Ring.toSemiring.{u1} k _inst_1) (AddCommGroup.toAddCommMonoid.{u2} V _inst_2) _inst_3) V (Submodule.setLike.{u1, u2} k V (Ring.toSemiring.{u1} k _inst_1) (AddCommGroup.toAddCommMonoid.{u2} V _inst_2) _inst_3)) (AffineSubspace.direction.{u1, u2, u3} k V P _inst_1 _inst_2 _inst_3 _inst_4 s)) (Submodule.addCommGroup.{u1, u2} k V _inst_1 _inst_2 _inst_3 (AffineSubspace.direction.{u1, u2, u3} k V P _inst_1 _inst_2 _inst_3 _inst_4 s))) (AddCommGroup.toAddCommMonoid.{u2} V _inst_2) (Submodule.module.{u1, u2} k V (Ring.toSemiring.{u1} k _inst_1) (AddCommGroup.toAddCommMonoid.{u2} V _inst_2) _inst_3 (AffineSubspace.direction.{u1, u2, u3} k V P _inst_1 _inst_2 _inst_3 _inst_4 s)) _inst_3) (AffineMap.linear.{u1, u2, u3, u2, u3} k (coeSort.{succ u2, succ (succ u2)} (Submodule.{u1, u2} k V (Ring.toSemiring.{u1} k _inst_1) (AddCommGroup.toAddCommMonoid.{u2} V _inst_2) _inst_3) Type.{u2} (SetLike.hasCoeToSort.{u2, u2} (Submodule.{u1, u2} k V (Ring.toSemiring.{u1} k _inst_1) (AddCommGroup.toAddCommMonoid.{u2} V _inst_2) _inst_3) V (Submodule.setLike.{u1, u2} k V (Ring.toSemiring.{u1} k _inst_1) (AddCommGroup.toAddCommMonoid.{u2} V _inst_2) _inst_3)) (AffineSubspace.direction.{u1, u2, u3} k V P _inst_1 _inst_2 _inst_3 _inst_4 s)) (coeSort.{succ u3, succ (succ u3)} (AffineSubspace.{u1, u2, u3} k V P _inst_1 _inst_2 _inst_3 _inst_4) Type.{u3} (SetLike.hasCoeToSort.{u3, u3} (AffineSubspace.{u1, u2, u3} k V P _inst_1 _inst_2 _inst_3 _inst_4) P (AffineSubspace.setLike.{u1, u2, u3} k V P _inst_1 _inst_2 _inst_3 _inst_4)) s) V P _inst_1 (Submodule.addCommGroup.{u1, u2} k V _inst_1 _inst_2 _inst_3 (AffineSubspace.direction.{u1, u2, u3} k V P _inst_1 _inst_2 _inst_3 _inst_4 s)) (Submodule.module.{u1, u2} k V (Ring.toSemiring.{u1} k _inst_1) (AddCommGroup.toAddCommMonoid.{u2} V _inst_2) _inst_3 (AffineSubspace.direction.{u1, u2, u3} k V P _inst_1 _inst_2 _inst_3 _inst_4 s)) (AffineSubspace.toAddTorsor.{u1, u2, u3} k V P _inst_1 _inst_2 _inst_3 _inst_4 s _inst_5) _inst_2 _inst_3 _inst_4 (AffineSubspace.subtype.{u1, u2, u3} k V P _inst_1 _inst_2 _inst_3 _inst_4 s _inst_5)) (Submodule.subtype.{u1, u2} k V (Ring.toSemiring.{u1} k _inst_1) (AddCommGroup.toAddCommMonoid.{u2} V _inst_2) _inst_3 (AffineSubspace.direction.{u1, u2, u3} k V P _inst_1 _inst_2 _inst_3 _inst_4 s)) but is expected to have type forall {k : Type.{u3}} {V : Type.{u2}} {P : Type.{u1}} [_inst_1 : Ring.{u3} k] [_inst_2 : AddCommGroup.{u2} V] [_inst_3 : Module.{u3, u2} k V (Ring.toSemiring.{u3} k _inst_1) (AddCommGroup.toAddCommMonoid.{u2} V _inst_2)] [_inst_4 : AddTorsor.{u2, u1} V P (AddCommGroup.toAddGroup.{u2} V _inst_2)] (s : AffineSubspace.{u3, u2, u1} k V P _inst_1 _inst_2 _inst_3 _inst_4) [_inst_5 : Nonempty.{succ u1} (Subtype.{succ u1} P (fun (x : P) => Membership.mem.{u1, u1} P (AffineSubspace.{u3, u2, u1} k V P _inst_1 _inst_2 _inst_3 _inst_4) (SetLike.instMembership.{u1, u1} (AffineSubspace.{u3, u2, u1} k V P _inst_1 _inst_2 _inst_3 _inst_4) P (AffineSubspace.instSetLikeAffineSubspace.{u3, u2, u1} k V P _inst_1 _inst_2 _inst_3 _inst_4)) x s))], Eq.{succ u2} (LinearMap.{u3, u3, u2, u2} k k (Ring.toSemiring.{u3} k _inst_1) (Ring.toSemiring.{u3} k _inst_1) (RingHom.id.{u3} k (Semiring.toNonAssocSemiring.{u3} k (Ring.toSemiring.{u3} k _inst_1))) (Subtype.{succ u2} V (fun (x : V) => Membership.mem.{u2, u2} V (Submodule.{u3, u2} k V (Ring.toSemiring.{u3} k _inst_1) (AddCommGroup.toAddCommMonoid.{u2} V _inst_2) _inst_3) (SetLike.instMembership.{u2, u2} (Submodule.{u3, u2} k V (Ring.toSemiring.{u3} k _inst_1) (AddCommGroup.toAddCommMonoid.{u2} V _inst_2) _inst_3) V (Submodule.setLike.{u3, u2} k V (Ring.toSemiring.{u3} k _inst_1) (AddCommGroup.toAddCommMonoid.{u2} V _inst_2) _inst_3)) x (AffineSubspace.direction.{u3, u2, u1} k V P _inst_1 _inst_2 _inst_3 _inst_4 s))) V (AddCommGroup.toAddCommMonoid.{u2} (Subtype.{succ u2} V (fun (x : V) => Membership.mem.{u2, u2} V (Submodule.{u3, u2} k V (Ring.toSemiring.{u3} k _inst_1) (AddCommGroup.toAddCommMonoid.{u2} V _inst_2) _inst_3) (SetLike.instMembership.{u2, u2} (Submodule.{u3, u2} k V (Ring.toSemiring.{u3} k _inst_1) (AddCommGroup.toAddCommMonoid.{u2} V _inst_2) _inst_3) V (Submodule.setLike.{u3, u2} k V (Ring.toSemiring.{u3} k _inst_1) (AddCommGroup.toAddCommMonoid.{u2} V _inst_2) _inst_3)) x (AffineSubspace.direction.{u3, u2, u1} k V P _inst_1 _inst_2 _inst_3 _inst_4 s))) (Submodule.addCommGroup.{u3, u2} k V _inst_1 _inst_2 _inst_3 (AffineSubspace.direction.{u3, u2, u1} k V P _inst_1 _inst_2 _inst_3 _inst_4 s))) (AddCommGroup.toAddCommMonoid.{u2} V _inst_2) (Submodule.module.{u3, u2} k V (Ring.toSemiring.{u3} k _inst_1) (AddCommGroup.toAddCommMonoid.{u2} V _inst_2) _inst_3 (AffineSubspace.direction.{u3, u2, u1} k V P _inst_1 _inst_2 _inst_3 _inst_4 s)) _inst_3) (AffineMap.linear.{u3, u2, u1, u2, u1} k (Subtype.{succ u2} V (fun (x : V) => Membership.mem.{u2, u2} V (Submodule.{u3, u2} k V (Ring.toSemiring.{u3} k _inst_1) (AddCommGroup.toAddCommMonoid.{u2} V _inst_2) _inst_3) (SetLike.instMembership.{u2, u2} (Submodule.{u3, u2} k V (Ring.toSemiring.{u3} k _inst_1) (AddCommGroup.toAddCommMonoid.{u2} V _inst_2) _inst_3) V (Submodule.setLike.{u3, u2} k V (Ring.toSemiring.{u3} k _inst_1) (AddCommGroup.toAddCommMonoid.{u2} V _inst_2) _inst_3)) x (AffineSubspace.direction.{u3, u2, u1} k V P _inst_1 _inst_2 _inst_3 _inst_4 s))) (Subtype.{succ u1} P (fun (x : P) => Membership.mem.{u1, u1} P (AffineSubspace.{u3, u2, u1} k V P _inst_1 _inst_2 _inst_3 _inst_4) (SetLike.instMembership.{u1, u1} (AffineSubspace.{u3, u2, u1} k V P _inst_1 _inst_2 _inst_3 _inst_4) P (AffineSubspace.instSetLikeAffineSubspace.{u3, u2, u1} k V P _inst_1 _inst_2 _inst_3 _inst_4)) x s)) V P _inst_1 (Submodule.addCommGroup.{u3, u2} k V _inst_1 _inst_2 _inst_3 (AffineSubspace.direction.{u3, u2, u1} k V P _inst_1 _inst_2 _inst_3 _inst_4 s)) (Submodule.module.{u3, u2} k V (Ring.toSemiring.{u3} k _inst_1) (AddCommGroup.toAddCommMonoid.{u2} V _inst_2) _inst_3 (AffineSubspace.direction.{u3, u2, u1} k V P _inst_1 _inst_2 _inst_3 _inst_4 s)) (AffineSubspace.toAddTorsor.{u3, u2, u1} k V P _inst_1 _inst_2 _inst_3 _inst_4 s _inst_5) _inst_2 _inst_3 _inst_4 (AffineSubspace.subtype.{u3, u2, u1} k V P _inst_1 _inst_2 _inst_3 _inst_4 s _inst_5)) (Submodule.subtype.{u3, u2} k V (Ring.toSemiring.{u3} k _inst_1) (AddCommGroup.toAddCommMonoid.{u2} V _inst_2) _inst_3 (AffineSubspace.direction.{u3, u2, u1} k V P _inst_1 _inst_2 _inst_3 _inst_4 s)) Case conversion may be inaccurate. Consider using '#align affine_subspace.subtype_linear AffineSubspace.subtype_linearₓ'. -/ @[simp] theorem subtype_linear (s : AffineSubspace k P) [Nonempty s] : s.Subtype.linear = s.direction.Subtype := rfl #align affine_subspace.subtype_linear AffineSubspace.subtype_linear /- warning: affine_subspace.subtype_apply -> AffineSubspace.subtype_apply is a dubious translation: lean 3 declaration is forall {k : Type.{u1}} {V : Type.{u2}} {P : Type.{u3}} [_inst_1 : Ring.{u1} k] [_inst_2 : AddCommGroup.{u2} V] [_inst_3 : Module.{u1, u2} k V (Ring.toSemiring.{u1} k _inst_1) (AddCommGroup.toAddCommMonoid.{u2} V _inst_2)] [_inst_4 : AddTorsor.{u2, u3} V P (AddCommGroup.toAddGroup.{u2} V _inst_2)] (s : AffineSubspace.{u1, u2, u3} k V P _inst_1 _inst_2 _inst_3 _inst_4) [_inst_5 : Nonempty.{succ u3} (coeSort.{succ u3, succ (succ u3)} (AffineSubspace.{u1, u2, u3} k V P _inst_1 _inst_2 _inst_3 _inst_4) Type.{u3} (SetLike.hasCoeToSort.{u3, u3} (AffineSubspace.{u1, u2, u3} k V P _inst_1 _inst_2 _inst_3 _inst_4) P (AffineSubspace.setLike.{u1, u2, u3} k V P _inst_1 _inst_2 _inst_3 _inst_4)) s)] (p : coeSort.{succ u3, succ (succ u3)} (AffineSubspace.{u1, u2, u3} k V P _inst_1 _inst_2 _inst_3 _inst_4) Type.{u3} (SetLike.hasCoeToSort.{u3, u3} (AffineSubspace.{u1, u2, u3} k V P _inst_1 _inst_2 _inst_3 _inst_4) P (AffineSubspace.setLike.{u1, u2, u3} k V P _inst_1 _inst_2 _inst_3 _inst_4)) s), Eq.{succ u3} P (coeFn.{max (succ u2) (succ u3), succ u3} (AffineMap.{u1, u2, u3, u2, u3} k (coeSort.{succ u2, succ (succ u2)} (Submodule.{u1, u2} k V (Ring.toSemiring.{u1} k _inst_1) (AddCommGroup.toAddCommMonoid.{u2} V _inst_2) _inst_3) Type.{u2} (SetLike.hasCoeToSort.{u2, u2} (Submodule.{u1, u2} k V (Ring.toSemiring.{u1} k _inst_1) (AddCommGroup.toAddCommMonoid.{u2} V _inst_2) _inst_3) V (Submodule.setLike.{u1, u2} k V (Ring.toSemiring.{u1} k _inst_1) (AddCommGroup.toAddCommMonoid.{u2} V _inst_2) _inst_3)) (AffineSubspace.direction.{u1, u2, u3} k V P _inst_1 _inst_2 _inst_3 _inst_4 s)) (coeSort.{succ u3, succ (succ u3)} (AffineSubspace.{u1, u2, u3} k V P _inst_1 _inst_2 _inst_3 _inst_4) Type.{u3} (SetLike.hasCoeToSort.{u3, u3} (AffineSubspace.{u1, u2, u3} k V P _inst_1 _inst_2 _inst_3 _inst_4) P (AffineSubspace.setLike.{u1, u2, u3} k V P _inst_1 _inst_2 _inst_3 _inst_4)) s) V P _inst_1 (Submodule.addCommGroup.{u1, u2} k V _inst_1 _inst_2 _inst_3 (AffineSubspace.direction.{u1, u2, u3} k V P _inst_1 _inst_2 _inst_3 _inst_4 s)) (Submodule.module.{u1, u2} k V (Ring.toSemiring.{u1} k _inst_1) (AddCommGroup.toAddCommMonoid.{u2} V _inst_2) _inst_3 (AffineSubspace.direction.{u1, u2, u3} k V P _inst_1 _inst_2 _inst_3 _inst_4 s)) (AffineSubspace.toAddTorsor.{u1, u2, u3} k V P _inst_1 _inst_2 _inst_3 _inst_4 s _inst_5) _inst_2 _inst_3 _inst_4) (fun (_x : AffineMap.{u1, u2, u3, u2, u3} k (coeSort.{succ u2, succ (succ u2)} (Submodule.{u1, u2} k V (Ring.toSemiring.{u1} k _inst_1) (AddCommGroup.toAddCommMonoid.{u2} V _inst_2) _inst_3) Type.{u2} (SetLike.hasCoeToSort.{u2, u2} (Submodule.{u1, u2} k V (Ring.toSemiring.{u1} k _inst_1) (AddCommGroup.toAddCommMonoid.{u2} V _inst_2) _inst_3) V (Submodule.setLike.{u1, u2} k V (Ring.toSemiring.{u1} k _inst_1) (AddCommGroup.toAddCommMonoid.{u2} V _inst_2) _inst_3)) (AffineSubspace.direction.{u1, u2, u3} k V P _inst_1 _inst_2 _inst_3 _inst_4 s)) (coeSort.{succ u3, succ (succ u3)} (AffineSubspace.{u1, u2, u3} k V P _inst_1 _inst_2 _inst_3 _inst_4) Type.{u3} (SetLike.hasCoeToSort.{u3, u3} (AffineSubspace.{u1, u2, u3} k V P _inst_1 _inst_2 _inst_3 _inst_4) P (AffineSubspace.setLike.{u1, u2, u3} k V P _inst_1 _inst_2 _inst_3 _inst_4)) s) V P _inst_1 (Submodule.addCommGroup.{u1, u2} k V _inst_1 _inst_2 _inst_3 (AffineSubspace.direction.{u1, u2, u3} k V P _inst_1 _inst_2 _inst_3 _inst_4 s)) (Submodule.module.{u1, u2} k V (Ring.toSemiring.{u1} k _inst_1) (AddCommGroup.toAddCommMonoid.{u2} V _inst_2) _inst_3 (AffineSubspace.direction.{u1, u2, u3} k V P _inst_1 _inst_2 _inst_3 _inst_4 s)) (AffineSubspace.toAddTorsor.{u1, u2, u3} k V P _inst_1 _inst_2 _inst_3 _inst_4 s _inst_5) _inst_2 _inst_3 _inst_4) => (coeSort.{succ u3, succ (succ u3)} (AffineSubspace.{u1, u2, u3} k V P _inst_1 _inst_2 _inst_3 _inst_4) Type.{u3} (SetLike.hasCoeToSort.{u3, u3} (AffineSubspace.{u1, u2, u3} k V P _inst_1 _inst_2 _inst_3 _inst_4) P (AffineSubspace.setLike.{u1, u2, u3} k V P _inst_1 _inst_2 _inst_3 _inst_4)) s) -> P) (AffineMap.hasCoeToFun.{u1, u2, u3, u2, u3} k (coeSort.{succ u2, succ (succ u2)} (Submodule.{u1, u2} k V (Ring.toSemiring.{u1} k _inst_1) (AddCommGroup.toAddCommMonoid.{u2} V _inst_2) _inst_3) Type.{u2} (SetLike.hasCoeToSort.{u2, u2} (Submodule.{u1, u2} k V (Ring.toSemiring.{u1} k _inst_1) (AddCommGroup.toAddCommMonoid.{u2} V _inst_2) _inst_3) V (Submodule.setLike.{u1, u2} k V (Ring.toSemiring.{u1} k _inst_1) (AddCommGroup.toAddCommMonoid.{u2} V _inst_2) _inst_3)) (AffineSubspace.direction.{u1, u2, u3} k V P _inst_1 _inst_2 _inst_3 _inst_4 s)) (coeSort.{succ u3, succ (succ u3)} (AffineSubspace.{u1, u2, u3} k V P _inst_1 _inst_2 _inst_3 _inst_4) Type.{u3} (SetLike.hasCoeToSort.{u3, u3} (AffineSubspace.{u1, u2, u3} k V P _inst_1 _inst_2 _inst_3 _inst_4) P (AffineSubspace.setLike.{u1, u2, u3} k V P _inst_1 _inst_2 _inst_3 _inst_4)) s) V P _inst_1 (Submodule.addCommGroup.{u1, u2} k V _inst_1 _inst_2 _inst_3 (AffineSubspace.direction.{u1, u2, u3} k V P _inst_1 _inst_2 _inst_3 _inst_4 s)) (Submodule.module.{u1, u2} k V (Ring.toSemiring.{u1} k _inst_1) (AddCommGroup.toAddCommMonoid.{u2} V _inst_2) _inst_3 (AffineSubspace.direction.{u1, u2, u3} k V P _inst_1 _inst_2 _inst_3 _inst_4 s)) (AffineSubspace.toAddTorsor.{u1, u2, u3} k V P _inst_1 _inst_2 _inst_3 _inst_4 s _inst_5) _inst_2 _inst_3 _inst_4) (AffineSubspace.subtype.{u1, u2, u3} k V P _inst_1 _inst_2 _inst_3 _inst_4 s _inst_5) p) ((fun (a : Type.{u3}) (b : Type.{u3}) [self : HasLiftT.{succ u3, succ u3} a b] => self.0) (coeSort.{succ u3, succ (succ u3)} (AffineSubspace.{u1, u2, u3} k V P _inst_1 _inst_2 _inst_3 _inst_4) Type.{u3} (SetLike.hasCoeToSort.{u3, u3} (AffineSubspace.{u1, u2, u3} k V P _inst_1 _inst_2 _inst_3 _inst_4) P (AffineSubspace.setLike.{u1, u2, u3} k V P _inst_1 _inst_2 _inst_3 _inst_4)) s) P (HasLiftT.mk.{succ u3, succ u3} (coeSort.{succ u3, succ (succ u3)} (AffineSubspace.{u1, u2, u3} k V P _inst_1 _inst_2 _inst_3 _inst_4) Type.{u3} (SetLike.hasCoeToSort.{u3, u3} (AffineSubspace.{u1, u2, u3} k V P _inst_1 _inst_2 _inst_3 _inst_4) P (AffineSubspace.setLike.{u1, u2, u3} k V P _inst_1 _inst_2 _inst_3 _inst_4)) s) P (CoeTCₓ.coe.{succ u3, succ u3} (coeSort.{succ u3, succ (succ u3)} (AffineSubspace.{u1, u2, u3} k V P _inst_1 _inst_2 _inst_3 _inst_4) Type.{u3} (SetLike.hasCoeToSort.{u3, u3} (AffineSubspace.{u1, u2, u3} k V P _inst_1 _inst_2 _inst_3 _inst_4) P (AffineSubspace.setLike.{u1, u2, u3} k V P _inst_1 _inst_2 _inst_3 _inst_4)) s) P (coeBase.{succ u3, succ u3} (coeSort.{succ u3, succ (succ u3)} (AffineSubspace.{u1, u2, u3} k V P _inst_1 _inst_2 _inst_3 _inst_4) Type.{u3} (SetLike.hasCoeToSort.{u3, u3} (AffineSubspace.{u1, u2, u3} k V P _inst_1 _inst_2 _inst_3 _inst_4) P (AffineSubspace.setLike.{u1, u2, u3} k V P _inst_1 _inst_2 _inst_3 _inst_4)) s) P (coeSubtype.{succ u3} P (fun (x : P) => Membership.Mem.{u3, u3} P (AffineSubspace.{u1, u2, u3} k V P _inst_1 _inst_2 _inst_3 _inst_4) (SetLike.hasMem.{u3, u3} (AffineSubspace.{u1, u2, u3} k V P _inst_1 _inst_2 _inst_3 _inst_4) P (AffineSubspace.setLike.{u1, u2, u3} k V P _inst_1 _inst_2 _inst_3 _inst_4)) x s))))) p) but is expected to have type forall {k : Type.{u3}} {V : Type.{u2}} {P : Type.{u1}} [_inst_1 : Ring.{u3} k] [_inst_2 : AddCommGroup.{u2} V] [_inst_3 : Module.{u3, u2} k V (Ring.toSemiring.{u3} k _inst_1) (AddCommGroup.toAddCommMonoid.{u2} V _inst_2)] [_inst_4 : AddTorsor.{u2, u1} V P (AddCommGroup.toAddGroup.{u2} V _inst_2)] (s : AffineSubspace.{u3, u2, u1} k V P _inst_1 _inst_2 _inst_3 _inst_4) [_inst_5 : Nonempty.{succ u1} (Subtype.{succ u1} P (fun (x : P) => Membership.mem.{u1, u1} P (AffineSubspace.{u3, u2, u1} k V P _inst_1 _inst_2 _inst_3 _inst_4) (SetLike.instMembership.{u1, u1} (AffineSubspace.{u3, u2, u1} k V P _inst_1 _inst_2 _inst_3 _inst_4) P (AffineSubspace.instSetLikeAffineSubspace.{u3, u2, u1} k V P _inst_1 _inst_2 _inst_3 _inst_4)) x s))] (p : Subtype.{succ u1} P (fun (x : P) => Membership.mem.{u1, u1} P (AffineSubspace.{u3, u2, u1} k V P _inst_1 _inst_2 _inst_3 _inst_4) (SetLike.instMembership.{u1, u1} (AffineSubspace.{u3, u2, u1} k V P _inst_1 _inst_2 _inst_3 _inst_4) P (AffineSubspace.instSetLikeAffineSubspace.{u3, u2, u1} k V P _inst_1 _inst_2 _inst_3 _inst_4)) x s)), Eq.{succ u1} ((fun ([email protected]._hyg.1004 : Subtype.{succ u1} P (fun (x : P) => Membership.mem.{u1, u1} P (AffineSubspace.{u3, u2, u1} k V P _inst_1 _inst_2 _inst_3 _inst_4) (SetLike.instMembership.{u1, u1} (AffineSubspace.{u3, u2, u1} k V P _inst_1 _inst_2 _inst_3 _inst_4) P (AffineSubspace.instSetLikeAffineSubspace.{u3, u2, u1} k V P _inst_1 _inst_2 _inst_3 _inst_4)) x s)) => P) p) (FunLike.coe.{max (succ u2) (succ u1), succ u1, succ u1} (AffineMap.{u3, u2, u1, u2, u1} k (Subtype.{succ u2} V (fun (x : V) => Membership.mem.{u2, u2} V (Submodule.{u3, u2} k V (Ring.toSemiring.{u3} k _inst_1) (AddCommGroup.toAddCommMonoid.{u2} V _inst_2) _inst_3) (SetLike.instMembership.{u2, u2} (Submodule.{u3, u2} k V (Ring.toSemiring.{u3} k _inst_1) (AddCommGroup.toAddCommMonoid.{u2} V _inst_2) _inst_3) V (Submodule.setLike.{u3, u2} k V (Ring.toSemiring.{u3} k _inst_1) (AddCommGroup.toAddCommMonoid.{u2} V _inst_2) _inst_3)) x (AffineSubspace.direction.{u3, u2, u1} k V P _inst_1 _inst_2 _inst_3 _inst_4 s))) (Subtype.{succ u1} P (fun (x : P) => Membership.mem.{u1, u1} P (AffineSubspace.{u3, u2, u1} k V P _inst_1 _inst_2 _inst_3 _inst_4) (SetLike.instMembership.{u1, u1} (AffineSubspace.{u3, u2, u1} k V P _inst_1 _inst_2 _inst_3 _inst_4) P (AffineSubspace.instSetLikeAffineSubspace.{u3, u2, u1} k V P _inst_1 _inst_2 _inst_3 _inst_4)) x s)) V P _inst_1 (Submodule.addCommGroup.{u3, u2} k V _inst_1 _inst_2 _inst_3 (AffineSubspace.direction.{u3, u2, u1} k V P _inst_1 _inst_2 _inst_3 _inst_4 s)) (Submodule.module.{u3, u2} k V (Ring.toSemiring.{u3} k _inst_1) (AddCommGroup.toAddCommMonoid.{u2} V _inst_2) _inst_3 (AffineSubspace.direction.{u3, u2, u1} k V P _inst_1 _inst_2 _inst_3 _inst_4 s)) (AffineSubspace.toAddTorsor.{u3, u2, u1} k V P _inst_1 _inst_2 _inst_3 _inst_4 s _inst_5) _inst_2 _inst_3 _inst_4) (Subtype.{succ u1} P (fun (x : P) => Membership.mem.{u1, u1} P (AffineSubspace.{u3, u2, u1} k V P _inst_1 _inst_2 _inst_3 _inst_4) (SetLike.instMembership.{u1, u1} (AffineSubspace.{u3, u2, u1} k V P _inst_1 _inst_2 _inst_3 _inst_4) P (AffineSubspace.instSetLikeAffineSubspace.{u3, u2, u1} k V P _inst_1 _inst_2 _inst_3 _inst_4)) x s)) (fun (_x : Subtype.{succ u1} P (fun (x : P) => Membership.mem.{u1, u1} P (AffineSubspace.{u3, u2, u1} k V P _inst_1 _inst_2 _inst_3 _inst_4) (SetLike.instMembership.{u1, u1} (AffineSubspace.{u3, u2, u1} k V P _inst_1 _inst_2 _inst_3 _inst_4) P (AffineSubspace.instSetLikeAffineSubspace.{u3, u2, u1} k V P _inst_1 _inst_2 _inst_3 _inst_4)) x s)) => (fun ([email protected]._hyg.1004 : Subtype.{succ u1} P (fun (x : P) => Membership.mem.{u1, u1} P (AffineSubspace.{u3, u2, u1} k V P _inst_1 _inst_2 _inst_3 _inst_4) (SetLike.instMembership.{u1, u1} (AffineSubspace.{u3, u2, u1} k V P _inst_1 _inst_2 _inst_3 _inst_4) P (AffineSubspace.instSetLikeAffineSubspace.{u3, u2, u1} k V P _inst_1 _inst_2 _inst_3 _inst_4)) x s)) => P) _x) (AffineMap.funLike.{u3, u2, u1, u2, u1} k (Subtype.{succ u2} V (fun (x : V) => Membership.mem.{u2, u2} V (Submodule.{u3, u2} k V (Ring.toSemiring.{u3} k _inst_1) (AddCommGroup.toAddCommMonoid.{u2} V _inst_2) _inst_3) (SetLike.instMembership.{u2, u2} (Submodule.{u3, u2} k V (Ring.toSemiring.{u3} k _inst_1) (AddCommGroup.toAddCommMonoid.{u2} V _inst_2) _inst_3) V (Submodule.setLike.{u3, u2} k V (Ring.toSemiring.{u3} k _inst_1) (AddCommGroup.toAddCommMonoid.{u2} V _inst_2) _inst_3)) x (AffineSubspace.direction.{u3, u2, u1} k V P _inst_1 _inst_2 _inst_3 _inst_4 s))) (Subtype.{succ u1} P (fun (x : P) => Membership.mem.{u1, u1} P (AffineSubspace.{u3, u2, u1} k V P _inst_1 _inst_2 _inst_3 _inst_4) (SetLike.instMembership.{u1, u1} (AffineSubspace.{u3, u2, u1} k V P _inst_1 _inst_2 _inst_3 _inst_4) P (AffineSubspace.instSetLikeAffineSubspace.{u3, u2, u1} k V P _inst_1 _inst_2 _inst_3 _inst_4)) x s)) V P _inst_1 (Submodule.addCommGroup.{u3, u2} k V _inst_1 _inst_2 _inst_3 (AffineSubspace.direction.{u3, u2, u1} k V P _inst_1 _inst_2 _inst_3 _inst_4 s)) (Submodule.module.{u3, u2} k V (Ring.toSemiring.{u3} k _inst_1) (AddCommGroup.toAddCommMonoid.{u2} V _inst_2) _inst_3 (AffineSubspace.direction.{u3, u2, u1} k V P _inst_1 _inst_2 _inst_3 _inst_4 s)) (AffineSubspace.toAddTorsor.{u3, u2, u1} k V P _inst_1 _inst_2 _inst_3 _inst_4 s _inst_5) _inst_2 _inst_3 _inst_4) (AffineSubspace.subtype.{u3, u2, u1} k V P _inst_1 _inst_2 _inst_3 _inst_4 s _inst_5) p) (Subtype.val.{succ u1} P (fun (x : P) => Membership.mem.{u1, u1} P (Set.{u1} P) (Set.instMembershipSet.{u1} P) x (SetLike.coe.{u1, u1} (AffineSubspace.{u3, u2, u1} k V P _inst_1 _inst_2 _inst_3 _inst_4) P (AffineSubspace.instSetLikeAffineSubspace.{u3, u2, u1} k V P _inst_1 _inst_2 _inst_3 _inst_4) s)) p) Case conversion may be inaccurate. Consider using '#align affine_subspace.subtype_apply AffineSubspace.subtype_applyₓ'. -/ theorem subtype_apply (s : AffineSubspace k P) [Nonempty s] (p : s) : s.Subtype p = p := rfl #align affine_subspace.subtype_apply AffineSubspace.subtype_apply /- warning: affine_subspace.coe_subtype -> AffineSubspace.coeSubtype is a dubious translation: lean 3 declaration is forall {k : Type.{u1}} {V : Type.{u2}} {P : Type.{u3}} [_inst_1 : Ring.{u1} k] [_inst_2 : AddCommGroup.{u2} V] [_inst_3 : Module.{u1, u2} k V (Ring.toSemiring.{u1} k _inst_1) (AddCommGroup.toAddCommMonoid.{u2} V _inst_2)] [_inst_4 : AddTorsor.{u2, u3} V P (AddCommGroup.toAddGroup.{u2} V _inst_2)] (s : AffineSubspace.{u1, u2, u3} k V P _inst_1 _inst_2 _inst_3 _inst_4) [_inst_5 : Nonempty.{succ u3} (coeSort.{succ u3, succ (succ u3)} (AffineSubspace.{u1, u2, u3} k V P _inst_1 _inst_2 _inst_3 _inst_4) Type.{u3} (SetLike.hasCoeToSort.{u3, u3} (AffineSubspace.{u1, u2, u3} k V P _inst_1 _inst_2 _inst_3 _inst_4) P (AffineSubspace.setLike.{u1, u2, u3} k V P _inst_1 _inst_2 _inst_3 _inst_4)) s)], Eq.{succ u3} ((fun (_x : AffineMap.{u1, u2, u3, u2, u3} k (coeSort.{succ u2, succ (succ u2)} (Submodule.{u1, u2} k V (Ring.toSemiring.{u1} k _inst_1) (AddCommGroup.toAddCommMonoid.{u2} V _inst_2) _inst_3) Type.{u2} (SetLike.hasCoeToSort.{u2, u2} (Submodule.{u1, u2} k V (Ring.toSemiring.{u1} k _inst_1) (AddCommGroup.toAddCommMonoid.{u2} V _inst_2) _inst_3) V (Submodule.setLike.{u1, u2} k V (Ring.toSemiring.{u1} k _inst_1) (AddCommGroup.toAddCommMonoid.{u2} V _inst_2) _inst_3)) (AffineSubspace.direction.{u1, u2, u3} k V P _inst_1 _inst_2 _inst_3 _inst_4 s)) (coeSort.{succ u3, succ (succ u3)} (AffineSubspace.{u1, u2, u3} k V P _inst_1 _inst_2 _inst_3 _inst_4) Type.{u3} (SetLike.hasCoeToSort.{u3, u3} (AffineSubspace.{u1, u2, u3} k V P _inst_1 _inst_2 _inst_3 _inst_4) P (AffineSubspace.setLike.{u1, u2, u3} k V P _inst_1 _inst_2 _inst_3 _inst_4)) s) V P _inst_1 (Submodule.addCommGroup.{u1, u2} k V _inst_1 _inst_2 _inst_3 (AffineSubspace.direction.{u1, u2, u3} k V P _inst_1 _inst_2 _inst_3 _inst_4 s)) (Submodule.module.{u1, u2} k V (Ring.toSemiring.{u1} k _inst_1) (AddCommGroup.toAddCommMonoid.{u2} V _inst_2) _inst_3 (AffineSubspace.direction.{u1, u2, u3} k V P _inst_1 _inst_2 _inst_3 _inst_4 s)) (AffineSubspace.toAddTorsor.{u1, u2, u3} k V P _inst_1 _inst_2 _inst_3 _inst_4 s _inst_5) _inst_2 _inst_3 _inst_4) => (coeSort.{succ u3, succ (succ u3)} (AffineSubspace.{u1, u2, u3} k V P _inst_1 _inst_2 _inst_3 _inst_4) Type.{u3} (SetLike.hasCoeToSort.{u3, u3} (AffineSubspace.{u1, u2, u3} k V P _inst_1 _inst_2 _inst_3 _inst_4) P (AffineSubspace.setLike.{u1, u2, u3} k V P _inst_1 _inst_2 _inst_3 _inst_4)) s) -> P) (AffineSubspace.subtype.{u1, u2, u3} k V P _inst_1 _inst_2 _inst_3 _inst_4 s _inst_5)) (coeFn.{max (succ u2) (succ u3), succ u3} (AffineMap.{u1, u2, u3, u2, u3} k (coeSort.{succ u2, succ (succ u2)} (Submodule.{u1, u2} k V (Ring.toSemiring.{u1} k _inst_1) (AddCommGroup.toAddCommMonoid.{u2} V _inst_2) _inst_3) Type.{u2} (SetLike.hasCoeToSort.{u2, u2} (Submodule.{u1, u2} k V (Ring.toSemiring.{u1} k _inst_1) (AddCommGroup.toAddCommMonoid.{u2} V _inst_2) _inst_3) V (Submodule.setLike.{u1, u2} k V (Ring.toSemiring.{u1} k _inst_1) (AddCommGroup.toAddCommMonoid.{u2} V _inst_2) _inst_3)) (AffineSubspace.direction.{u1, u2, u3} k V P _inst_1 _inst_2 _inst_3 _inst_4 s)) (coeSort.{succ u3, succ (succ u3)} (AffineSubspace.{u1, u2, u3} k V P _inst_1 _inst_2 _inst_3 _inst_4) Type.{u3} (SetLike.hasCoeToSort.{u3, u3} (AffineSubspace.{u1, u2, u3} k V P _inst_1 _inst_2 _inst_3 _inst_4) P (AffineSubspace.setLike.{u1, u2, u3} k V P _inst_1 _inst_2 _inst_3 _inst_4)) s) V P _inst_1 (Submodule.addCommGroup.{u1, u2} k V _inst_1 _inst_2 _inst_3 (AffineSubspace.direction.{u1, u2, u3} k V P _inst_1 _inst_2 _inst_3 _inst_4 s)) (Submodule.module.{u1, u2} k V (Ring.toSemiring.{u1} k _inst_1) (AddCommGroup.toAddCommMonoid.{u2} V _inst_2) _inst_3 (AffineSubspace.direction.{u1, u2, u3} k V P _inst_1 _inst_2 _inst_3 _inst_4 s)) (AffineSubspace.toAddTorsor.{u1, u2, u3} k V P _inst_1 _inst_2 _inst_3 _inst_4 s _inst_5) _inst_2 _inst_3 _inst_4) (fun (_x : AffineMap.{u1, u2, u3, u2, u3} k (coeSort.{succ u2, succ (succ u2)} (Submodule.{u1, u2} k V (Ring.toSemiring.{u1} k _inst_1) (AddCommGroup.toAddCommMonoid.{u2} V _inst_2) _inst_3) Type.{u2} (SetLike.hasCoeToSort.{u2, u2} (Submodule.{u1, u2} k V (Ring.toSemiring.{u1} k _inst_1) (AddCommGroup.toAddCommMonoid.{u2} V _inst_2) _inst_3) V (Submodule.setLike.{u1, u2} k V (Ring.toSemiring.{u1} k _inst_1) (AddCommGroup.toAddCommMonoid.{u2} V _inst_2) _inst_3)) (AffineSubspace.direction.{u1, u2, u3} k V P _inst_1 _inst_2 _inst_3 _inst_4 s)) (coeSort.{succ u3, succ (succ u3)} (AffineSubspace.{u1, u2, u3} k V P _inst_1 _inst_2 _inst_3 _inst_4) Type.{u3} (SetLike.hasCoeToSort.{u3, u3} (AffineSubspace.{u1, u2, u3} k V P _inst_1 _inst_2 _inst_3 _inst_4) P (AffineSubspace.setLike.{u1, u2, u3} k V P _inst_1 _inst_2 _inst_3 _inst_4)) s) V P _inst_1 (Submodule.addCommGroup.{u1, u2} k V _inst_1 _inst_2 _inst_3 (AffineSubspace.direction.{u1, u2, u3} k V P _inst_1 _inst_2 _inst_3 _inst_4 s)) (Submodule.module.{u1, u2} k V (Ring.toSemiring.{u1} k _inst_1) (AddCommGroup.toAddCommMonoid.{u2} V _inst_2) _inst_3 (AffineSubspace.direction.{u1, u2, u3} k V P _inst_1 _inst_2 _inst_3 _inst_4 s)) (AffineSubspace.toAddTorsor.{u1, u2, u3} k V P _inst_1 _inst_2 _inst_3 _inst_4 s _inst_5) _inst_2 _inst_3 _inst_4) => (coeSort.{succ u3, succ (succ u3)} (AffineSubspace.{u1, u2, u3} k V P _inst_1 _inst_2 _inst_3 _inst_4) Type.{u3} (SetLike.hasCoeToSort.{u3, u3} (AffineSubspace.{u1, u2, u3} k V P _inst_1 _inst_2 _inst_3 _inst_4) P (AffineSubspace.setLike.{u1, u2, u3} k V P _inst_1 _inst_2 _inst_3 _inst_4)) s) -> P) (AffineMap.hasCoeToFun.{u1, u2, u3, u2, u3} k (coeSort.{succ u2, succ (succ u2)} (Submodule.{u1, u2} k V (Ring.toSemiring.{u1} k _inst_1) (AddCommGroup.toAddCommMonoid.{u2} V _inst_2) _inst_3) Type.{u2} (SetLike.hasCoeToSort.{u2, u2} (Submodule.{u1, u2} k V (Ring.toSemiring.{u1} k _inst_1) (AddCommGroup.toAddCommMonoid.{u2} V _inst_2) _inst_3) V (Submodule.setLike.{u1, u2} k V (Ring.toSemiring.{u1} k _inst_1) (AddCommGroup.toAddCommMonoid.{u2} V _inst_2) _inst_3)) (AffineSubspace.direction.{u1, u2, u3} k V P _inst_1 _inst_2 _inst_3 _inst_4 s)) (coeSort.{succ u3, succ (succ u3)} (AffineSubspace.{u1, u2, u3} k V P _inst_1 _inst_2 _inst_3 _inst_4) Type.{u3} (SetLike.hasCoeToSort.{u3, u3} (AffineSubspace.{u1, u2, u3} k V P _inst_1 _inst_2 _inst_3 _inst_4) P (AffineSubspace.setLike.{u1, u2, u3} k V P _inst_1 _inst_2 _inst_3 _inst_4)) s) V P _inst_1 (Submodule.addCommGroup.{u1, u2} k V _inst_1 _inst_2 _inst_3 (AffineSubspace.direction.{u1, u2, u3} k V P _inst_1 _inst_2 _inst_3 _inst_4 s)) (Submodule.module.{u1, u2} k V (Ring.toSemiring.{u1} k _inst_1) (AddCommGroup.toAddCommMonoid.{u2} V _inst_2) _inst_3 (AffineSubspace.direction.{u1, u2, u3} k V P _inst_1 _inst_2 _inst_3 _inst_4 s)) (AffineSubspace.toAddTorsor.{u1, u2, u3} k V P _inst_1 _inst_2 _inst_3 _inst_4 s _inst_5) _inst_2 _inst_3 _inst_4) (AffineSubspace.subtype.{u1, u2, u3} k V P _inst_1 _inst_2 _inst_3 _inst_4 s _inst_5)) ((fun (a : Type.{u3}) (b : Type.{u3}) [self : HasLiftT.{succ u3, succ u3} a b] => self.0) (coeSort.{succ u3, succ (succ u3)} (AffineSubspace.{u1, u2, u3} k V P _inst_1 _inst_2 _inst_3 _inst_4) Type.{u3} (SetLike.hasCoeToSort.{u3, u3} (AffineSubspace.{u1, u2, u3} k V P _inst_1 _inst_2 _inst_3 _inst_4) P (AffineSubspace.setLike.{u1, u2, u3} k V P _inst_1 _inst_2 _inst_3 _inst_4)) s) P (HasLiftT.mk.{succ u3, succ u3} (coeSort.{succ u3, succ (succ u3)} (AffineSubspace.{u1, u2, u3} k V P _inst_1 _inst_2 _inst_3 _inst_4) Type.{u3} (SetLike.hasCoeToSort.{u3, u3} (AffineSubspace.{u1, u2, u3} k V P _inst_1 _inst_2 _inst_3 _inst_4) P (AffineSubspace.setLike.{u1, u2, u3} k V P _inst_1 _inst_2 _inst_3 _inst_4)) s) P (CoeTCₓ.coe.{succ u3, succ u3} (coeSort.{succ u3, succ (succ u3)} (AffineSubspace.{u1, u2, u3} k V P _inst_1 _inst_2 _inst_3 _inst_4) Type.{u3} (SetLike.hasCoeToSort.{u3, u3} (AffineSubspace.{u1, u2, u3} k V P _inst_1 _inst_2 _inst_3 _inst_4) P (AffineSubspace.setLike.{u1, u2, u3} k V P _inst_1 _inst_2 _inst_3 _inst_4)) s) P (coeBase.{succ u3, succ u3} (coeSort.{succ u3, succ (succ u3)} (AffineSubspace.{u1, u2, u3} k V P _inst_1 _inst_2 _inst_3 _inst_4) Type.{u3} (SetLike.hasCoeToSort.{u3, u3} (AffineSubspace.{u1, u2, u3} k V P _inst_1 _inst_2 _inst_3 _inst_4) P (AffineSubspace.setLike.{u1, u2, u3} k V P _inst_1 _inst_2 _inst_3 _inst_4)) s) P (coeSubtype.{succ u3} P (fun (x : P) => Membership.Mem.{u3, u3} P (AffineSubspace.{u1, u2, u3} k V P _inst_1 _inst_2 _inst_3 _inst_4) (SetLike.hasMem.{u3, u3} (AffineSubspace.{u1, u2, u3} k V P _inst_1 _inst_2 _inst_3 _inst_4) P (AffineSubspace.setLike.{u1, u2, u3} k V P _inst_1 _inst_2 _inst_3 _inst_4)) x s)))))) but is expected to have type forall {k : Type.{u3}} {V : Type.{u2}} {P : Type.{u1}} [_inst_1 : Ring.{u3} k] [_inst_2 : AddCommGroup.{u2} V] [_inst_3 : Module.{u3, u2} k V (Ring.toSemiring.{u3} k _inst_1) (AddCommGroup.toAddCommMonoid.{u2} V _inst_2)] [_inst_4 : AddTorsor.{u2, u1} V P (AddCommGroup.toAddGroup.{u2} V _inst_2)] (s : AffineSubspace.{u3, u2, u1} k V P _inst_1 _inst_2 _inst_3 _inst_4) [_inst_5 : Nonempty.{succ u1} (Subtype.{succ u1} P (fun (x : P) => Membership.mem.{u1, u1} P (AffineSubspace.{u3, u2, u1} k V P _inst_1 _inst_2 _inst_3 _inst_4) (SetLike.instMembership.{u1, u1} (AffineSubspace.{u3, u2, u1} k V P _inst_1 _inst_2 _inst_3 _inst_4) P (AffineSubspace.instSetLikeAffineSubspace.{u3, u2, u1} k V P _inst_1 _inst_2 _inst_3 _inst_4)) x s))], Eq.{succ u1} (forall (a : Subtype.{succ u1} P (fun (x : P) => Membership.mem.{u1, u1} P (AffineSubspace.{u3, u2, u1} k V P _inst_1 _inst_2 _inst_3 _inst_4) (SetLike.instMembership.{u1, u1} (AffineSubspace.{u3, u2, u1} k V P _inst_1 _inst_2 _inst_3 _inst_4) P (AffineSubspace.instSetLikeAffineSubspace.{u3, u2, u1} k V P _inst_1 _inst_2 _inst_3 _inst_4)) x s)), (fun ([email protected]._hyg.1004 : Subtype.{succ u1} P (fun (x : P) => Membership.mem.{u1, u1} P (AffineSubspace.{u3, u2, u1} k V P _inst_1 _inst_2 _inst_3 _inst_4) (SetLike.instMembership.{u1, u1} (AffineSubspace.{u3, u2, u1} k V P _inst_1 _inst_2 _inst_3 _inst_4) P (AffineSubspace.instSetLikeAffineSubspace.{u3, u2, u1} k V P _inst_1 _inst_2 _inst_3 _inst_4)) x s)) => P) a) (FunLike.coe.{max (succ u2) (succ u1), succ u1, succ u1} (AffineMap.{u3, u2, u1, u2, u1} k (Subtype.{succ u2} V (fun (x : V) => Membership.mem.{u2, u2} V (Submodule.{u3, u2} k V (Ring.toSemiring.{u3} k _inst_1) (AddCommGroup.toAddCommMonoid.{u2} V _inst_2) _inst_3) (SetLike.instMembership.{u2, u2} (Submodule.{u3, u2} k V (Ring.toSemiring.{u3} k _inst_1) (AddCommGroup.toAddCommMonoid.{u2} V _inst_2) _inst_3) V (Submodule.setLike.{u3, u2} k V (Ring.toSemiring.{u3} k _inst_1) (AddCommGroup.toAddCommMonoid.{u2} V _inst_2) _inst_3)) x (AffineSubspace.direction.{u3, u2, u1} k V P _inst_1 _inst_2 _inst_3 _inst_4 s))) (Subtype.{succ u1} P (fun (x : P) => Membership.mem.{u1, u1} P (AffineSubspace.{u3, u2, u1} k V P _inst_1 _inst_2 _inst_3 _inst_4) (SetLike.instMembership.{u1, u1} (AffineSubspace.{u3, u2, u1} k V P _inst_1 _inst_2 _inst_3 _inst_4) P (AffineSubspace.instSetLikeAffineSubspace.{u3, u2, u1} k V P _inst_1 _inst_2 _inst_3 _inst_4)) x s)) V P _inst_1 (Submodule.addCommGroup.{u3, u2} k V _inst_1 _inst_2 _inst_3 (AffineSubspace.direction.{u3, u2, u1} k V P _inst_1 _inst_2 _inst_3 _inst_4 s)) (Submodule.module.{u3, u2} k V (Ring.toSemiring.{u3} k _inst_1) (AddCommGroup.toAddCommMonoid.{u2} V _inst_2) _inst_3 (AffineSubspace.direction.{u3, u2, u1} k V P _inst_1 _inst_2 _inst_3 _inst_4 s)) (AffineSubspace.toAddTorsor.{u3, u2, u1} k V P _inst_1 _inst_2 _inst_3 _inst_4 s _inst_5) _inst_2 _inst_3 _inst_4) (Subtype.{succ u1} P (fun (x : P) => Membership.mem.{u1, u1} P (AffineSubspace.{u3, u2, u1} k V P _inst_1 _inst_2 _inst_3 _inst_4) (SetLike.instMembership.{u1, u1} (AffineSubspace.{u3, u2, u1} k V P _inst_1 _inst_2 _inst_3 _inst_4) P (AffineSubspace.instSetLikeAffineSubspace.{u3, u2, u1} k V P _inst_1 _inst_2 _inst_3 _inst_4)) x s)) (fun (_x : Subtype.{succ u1} P (fun (x : P) => Membership.mem.{u1, u1} P (AffineSubspace.{u3, u2, u1} k V P _inst_1 _inst_2 _inst_3 _inst_4) (SetLike.instMembership.{u1, u1} (AffineSubspace.{u3, u2, u1} k V P _inst_1 _inst_2 _inst_3 _inst_4) P (AffineSubspace.instSetLikeAffineSubspace.{u3, u2, u1} k V P _inst_1 _inst_2 _inst_3 _inst_4)) x s)) => (fun ([email protected]._hyg.1004 : Subtype.{succ u1} P (fun (x : P) => Membership.mem.{u1, u1} P (AffineSubspace.{u3, u2, u1} k V P _inst_1 _inst_2 _inst_3 _inst_4) (SetLike.instMembership.{u1, u1} (AffineSubspace.{u3, u2, u1} k V P _inst_1 _inst_2 _inst_3 _inst_4) P (AffineSubspace.instSetLikeAffineSubspace.{u3, u2, u1} k V P _inst_1 _inst_2 _inst_3 _inst_4)) x s)) => P) _x) (AffineMap.funLike.{u3, u2, u1, u2, u1} k (Subtype.{succ u2} V (fun (x : V) => Membership.mem.{u2, u2} V (Submodule.{u3, u2} k V (Ring.toSemiring.{u3} k _inst_1) (AddCommGroup.toAddCommMonoid.{u2} V _inst_2) _inst_3) (SetLike.instMembership.{u2, u2} (Submodule.{u3, u2} k V (Ring.toSemiring.{u3} k _inst_1) (AddCommGroup.toAddCommMonoid.{u2} V _inst_2) _inst_3) V (Submodule.setLike.{u3, u2} k V (Ring.toSemiring.{u3} k _inst_1) (AddCommGroup.toAddCommMonoid.{u2} V _inst_2) _inst_3)) x (AffineSubspace.direction.{u3, u2, u1} k V P _inst_1 _inst_2 _inst_3 _inst_4 s))) (Subtype.{succ u1} P (fun (x : P) => Membership.mem.{u1, u1} P (AffineSubspace.{u3, u2, u1} k V P _inst_1 _inst_2 _inst_3 _inst_4) (SetLike.instMembership.{u1, u1} (AffineSubspace.{u3, u2, u1} k V P _inst_1 _inst_2 _inst_3 _inst_4) P (AffineSubspace.instSetLikeAffineSubspace.{u3, u2, u1} k V P _inst_1 _inst_2 _inst_3 _inst_4)) x s)) V P _inst_1 (Submodule.addCommGroup.{u3, u2} k V _inst_1 _inst_2 _inst_3 (AffineSubspace.direction.{u3, u2, u1} k V P _inst_1 _inst_2 _inst_3 _inst_4 s)) (Submodule.module.{u3, u2} k V (Ring.toSemiring.{u3} k _inst_1) (AddCommGroup.toAddCommMonoid.{u2} V _inst_2) _inst_3 (AffineSubspace.direction.{u3, u2, u1} k V P _inst_1 _inst_2 _inst_3 _inst_4 s)) (AffineSubspace.toAddTorsor.{u3, u2, u1} k V P _inst_1 _inst_2 _inst_3 _inst_4 s _inst_5) _inst_2 _inst_3 _inst_4) (AffineSubspace.subtype.{u3, u2, u1} k V P _inst_1 _inst_2 _inst_3 _inst_4 s _inst_5)) (Subtype.val.{succ u1} P (fun (x : P) => Membership.mem.{u1, u1} P (Set.{u1} P) (Set.instMembershipSet.{u1} P) x (SetLike.coe.{u1, u1} (AffineSubspace.{u3, u2, u1} k V P _inst_1 _inst_2 _inst_3 _inst_4) P (AffineSubspace.instSetLikeAffineSubspace.{u3, u2, u1} k V P _inst_1 _inst_2 _inst_3 _inst_4) s))) Case conversion may be inaccurate. Consider using '#align affine_subspace.coe_subtype AffineSubspace.coeSubtypeₓ'. -/ @[simp] theorem coeSubtype (s : AffineSubspace k P) [Nonempty s] : (s.Subtype : s → P) = coe := rfl #align affine_subspace.coe_subtype AffineSubspace.coeSubtype /- warning: affine_subspace.injective_subtype -> AffineSubspace.injective_subtype is a dubious translation: lean 3 declaration is forall {k : Type.{u1}} {V : Type.{u2}} {P : Type.{u3}} [_inst_1 : Ring.{u1} k] [_inst_2 : AddCommGroup.{u2} V] [_inst_3 : Module.{u1, u2} k V (Ring.toSemiring.{u1} k _inst_1) (AddCommGroup.toAddCommMonoid.{u2} V _inst_2)] [_inst_4 : AddTorsor.{u2, u3} V P (AddCommGroup.toAddGroup.{u2} V _inst_2)] (s : AffineSubspace.{u1, u2, u3} k V P _inst_1 _inst_2 _inst_3 _inst_4) [_inst_5 : Nonempty.{succ u3} (coeSort.{succ u3, succ (succ u3)} (AffineSubspace.{u1, u2, u3} k V P _inst_1 _inst_2 _inst_3 _inst_4) Type.{u3} (SetLike.hasCoeToSort.{u3, u3} (AffineSubspace.{u1, u2, u3} k V P _inst_1 _inst_2 _inst_3 _inst_4) P (AffineSubspace.setLike.{u1, u2, u3} k V P _inst_1 _inst_2 _inst_3 _inst_4)) s)], Function.Injective.{succ u3, succ u3} (coeSort.{succ u3, succ (succ u3)} (AffineSubspace.{u1, u2, u3} k V P _inst_1 _inst_2 _inst_3 _inst_4) Type.{u3} (SetLike.hasCoeToSort.{u3, u3} (AffineSubspace.{u1, u2, u3} k V P _inst_1 _inst_2 _inst_3 _inst_4) P (AffineSubspace.setLike.{u1, u2, u3} k V P _inst_1 _inst_2 _inst_3 _inst_4)) s) P (coeFn.{max (succ u2) (succ u3), succ u3} (AffineMap.{u1, u2, u3, u2, u3} k (coeSort.{succ u2, succ (succ u2)} (Submodule.{u1, u2} k V (Ring.toSemiring.{u1} k _inst_1) (AddCommGroup.toAddCommMonoid.{u2} V _inst_2) _inst_3) Type.{u2} (SetLike.hasCoeToSort.{u2, u2} (Submodule.{u1, u2} k V (Ring.toSemiring.{u1} k _inst_1) (AddCommGroup.toAddCommMonoid.{u2} V _inst_2) _inst_3) V (Submodule.setLike.{u1, u2} k V (Ring.toSemiring.{u1} k _inst_1) (AddCommGroup.toAddCommMonoid.{u2} V _inst_2) _inst_3)) (AffineSubspace.direction.{u1, u2, u3} k V P _inst_1 _inst_2 _inst_3 _inst_4 s)) (coeSort.{succ u3, succ (succ u3)} (AffineSubspace.{u1, u2, u3} k V P _inst_1 _inst_2 _inst_3 _inst_4) Type.{u3} (SetLike.hasCoeToSort.{u3, u3} (AffineSubspace.{u1, u2, u3} k V P _inst_1 _inst_2 _inst_3 _inst_4) P (AffineSubspace.setLike.{u1, u2, u3} k V P _inst_1 _inst_2 _inst_3 _inst_4)) s) V P _inst_1 (Submodule.addCommGroup.{u1, u2} k V _inst_1 _inst_2 _inst_3 (AffineSubspace.direction.{u1, u2, u3} k V P _inst_1 _inst_2 _inst_3 _inst_4 s)) (Submodule.module.{u1, u2} k V (Ring.toSemiring.{u1} k _inst_1) (AddCommGroup.toAddCommMonoid.{u2} V _inst_2) _inst_3 (AffineSubspace.direction.{u1, u2, u3} k V P _inst_1 _inst_2 _inst_3 _inst_4 s)) (AffineSubspace.toAddTorsor.{u1, u2, u3} k V P _inst_1 _inst_2 _inst_3 _inst_4 s _inst_5) _inst_2 _inst_3 _inst_4) (fun (_x : AffineMap.{u1, u2, u3, u2, u3} k (coeSort.{succ u2, succ (succ u2)} (Submodule.{u1, u2} k V (Ring.toSemiring.{u1} k _inst_1) (AddCommGroup.toAddCommMonoid.{u2} V _inst_2) _inst_3) Type.{u2} (SetLike.hasCoeToSort.{u2, u2} (Submodule.{u1, u2} k V (Ring.toSemiring.{u1} k _inst_1) (AddCommGroup.toAddCommMonoid.{u2} V _inst_2) _inst_3) V (Submodule.setLike.{u1, u2} k V (Ring.toSemiring.{u1} k _inst_1) (AddCommGroup.toAddCommMonoid.{u2} V _inst_2) _inst_3)) (AffineSubspace.direction.{u1, u2, u3} k V P _inst_1 _inst_2 _inst_3 _inst_4 s)) (coeSort.{succ u3, succ (succ u3)} (AffineSubspace.{u1, u2, u3} k V P _inst_1 _inst_2 _inst_3 _inst_4) Type.{u3} (SetLike.hasCoeToSort.{u3, u3} (AffineSubspace.{u1, u2, u3} k V P _inst_1 _inst_2 _inst_3 _inst_4) P (AffineSubspace.setLike.{u1, u2, u3} k V P _inst_1 _inst_2 _inst_3 _inst_4)) s) V P _inst_1 (Submodule.addCommGroup.{u1, u2} k V _inst_1 _inst_2 _inst_3 (AffineSubspace.direction.{u1, u2, u3} k V P _inst_1 _inst_2 _inst_3 _inst_4 s)) (Submodule.module.{u1, u2} k V (Ring.toSemiring.{u1} k _inst_1) (AddCommGroup.toAddCommMonoid.{u2} V _inst_2) _inst_3 (AffineSubspace.direction.{u1, u2, u3} k V P _inst_1 _inst_2 _inst_3 _inst_4 s)) (AffineSubspace.toAddTorsor.{u1, u2, u3} k V P _inst_1 _inst_2 _inst_3 _inst_4 s _inst_5) _inst_2 _inst_3 _inst_4) => (coeSort.{succ u3, succ (succ u3)} (AffineSubspace.{u1, u2, u3} k V P _inst_1 _inst_2 _inst_3 _inst_4) Type.{u3} (SetLike.hasCoeToSort.{u3, u3} (AffineSubspace.{u1, u2, u3} k V P _inst_1 _inst_2 _inst_3 _inst_4) P (AffineSubspace.setLike.{u1, u2, u3} k V P _inst_1 _inst_2 _inst_3 _inst_4)) s) -> P) (AffineMap.hasCoeToFun.{u1, u2, u3, u2, u3} k (coeSort.{succ u2, succ (succ u2)} (Submodule.{u1, u2} k V (Ring.toSemiring.{u1} k _inst_1) (AddCommGroup.toAddCommMonoid.{u2} V _inst_2) _inst_3) Type.{u2} (SetLike.hasCoeToSort.{u2, u2} (Submodule.{u1, u2} k V (Ring.toSemiring.{u1} k _inst_1) (AddCommGroup.toAddCommMonoid.{u2} V _inst_2) _inst_3) V (Submodule.setLike.{u1, u2} k V (Ring.toSemiring.{u1} k _inst_1) (AddCommGroup.toAddCommMonoid.{u2} V _inst_2) _inst_3)) (AffineSubspace.direction.{u1, u2, u3} k V P _inst_1 _inst_2 _inst_3 _inst_4 s)) (coeSort.{succ u3, succ (succ u3)} (AffineSubspace.{u1, u2, u3} k V P _inst_1 _inst_2 _inst_3 _inst_4) Type.{u3} (SetLike.hasCoeToSort.{u3, u3} (AffineSubspace.{u1, u2, u3} k V P _inst_1 _inst_2 _inst_3 _inst_4) P (AffineSubspace.setLike.{u1, u2, u3} k V P _inst_1 _inst_2 _inst_3 _inst_4)) s) V P _inst_1 (Submodule.addCommGroup.{u1, u2} k V _inst_1 _inst_2 _inst_3 (AffineSubspace.direction.{u1, u2, u3} k V P _inst_1 _inst_2 _inst_3 _inst_4 s)) (Submodule.module.{u1, u2} k V (Ring.toSemiring.{u1} k _inst_1) (AddCommGroup.toAddCommMonoid.{u2} V _inst_2) _inst_3 (AffineSubspace.direction.{u1, u2, u3} k V P _inst_1 _inst_2 _inst_3 _inst_4 s)) (AffineSubspace.toAddTorsor.{u1, u2, u3} k V P _inst_1 _inst_2 _inst_3 _inst_4 s _inst_5) _inst_2 _inst_3 _inst_4) (AffineSubspace.subtype.{u1, u2, u3} k V P _inst_1 _inst_2 _inst_3 _inst_4 s _inst_5)) but is expected to have type forall {k : Type.{u3}} {V : Type.{u2}} {P : Type.{u1}} [_inst_1 : Ring.{u3} k] [_inst_2 : AddCommGroup.{u2} V] [_inst_3 : Module.{u3, u2} k V (Ring.toSemiring.{u3} k _inst_1) (AddCommGroup.toAddCommMonoid.{u2} V _inst_2)] [_inst_4 : AddTorsor.{u2, u1} V P (AddCommGroup.toAddGroup.{u2} V _inst_2)] (s : AffineSubspace.{u3, u2, u1} k V P _inst_1 _inst_2 _inst_3 _inst_4) [_inst_5 : Nonempty.{succ u1} (Subtype.{succ u1} P (fun (x : P) => Membership.mem.{u1, u1} P (AffineSubspace.{u3, u2, u1} k V P _inst_1 _inst_2 _inst_3 _inst_4) (SetLike.instMembership.{u1, u1} (AffineSubspace.{u3, u2, u1} k V P _inst_1 _inst_2 _inst_3 _inst_4) P (AffineSubspace.instSetLikeAffineSubspace.{u3, u2, u1} k V P _inst_1 _inst_2 _inst_3 _inst_4)) x s))], Function.Injective.{succ u1, succ u1} (Subtype.{succ u1} P (fun (x : P) => Membership.mem.{u1, u1} P (AffineSubspace.{u3, u2, u1} k V P _inst_1 _inst_2 _inst_3 _inst_4) (SetLike.instMembership.{u1, u1} (AffineSubspace.{u3, u2, u1} k V P _inst_1 _inst_2 _inst_3 _inst_4) P (AffineSubspace.instSetLikeAffineSubspace.{u3, u2, u1} k V P _inst_1 _inst_2 _inst_3 _inst_4)) x s)) P (FunLike.coe.{max (succ u2) (succ u1), succ u1, succ u1} (AffineMap.{u3, u2, u1, u2, u1} k (Subtype.{succ u2} V (fun (x : V) => Membership.mem.{u2, u2} V (Submodule.{u3, u2} k V (Ring.toSemiring.{u3} k _inst_1) (AddCommGroup.toAddCommMonoid.{u2} V _inst_2) _inst_3) (SetLike.instMembership.{u2, u2} (Submodule.{u3, u2} k V (Ring.toSemiring.{u3} k _inst_1) (AddCommGroup.toAddCommMonoid.{u2} V _inst_2) _inst_3) V (Submodule.setLike.{u3, u2} k V (Ring.toSemiring.{u3} k _inst_1) (AddCommGroup.toAddCommMonoid.{u2} V _inst_2) _inst_3)) x (AffineSubspace.direction.{u3, u2, u1} k V P _inst_1 _inst_2 _inst_3 _inst_4 s))) (Subtype.{succ u1} P (fun (x : P) => Membership.mem.{u1, u1} P (AffineSubspace.{u3, u2, u1} k V P _inst_1 _inst_2 _inst_3 _inst_4) (SetLike.instMembership.{u1, u1} (AffineSubspace.{u3, u2, u1} k V P _inst_1 _inst_2 _inst_3 _inst_4) P (AffineSubspace.instSetLikeAffineSubspace.{u3, u2, u1} k V P _inst_1 _inst_2 _inst_3 _inst_4)) x s)) V P _inst_1 (Submodule.addCommGroup.{u3, u2} k V _inst_1 _inst_2 _inst_3 (AffineSubspace.direction.{u3, u2, u1} k V P _inst_1 _inst_2 _inst_3 _inst_4 s)) (Submodule.module.{u3, u2} k V (Ring.toSemiring.{u3} k _inst_1) (AddCommGroup.toAddCommMonoid.{u2} V _inst_2) _inst_3 (AffineSubspace.direction.{u3, u2, u1} k V P _inst_1 _inst_2 _inst_3 _inst_4 s)) (AffineSubspace.toAddTorsor.{u3, u2, u1} k V P _inst_1 _inst_2 _inst_3 _inst_4 s _inst_5) _inst_2 _inst_3 _inst_4) (Subtype.{succ u1} P (fun (x : P) => Membership.mem.{u1, u1} P (AffineSubspace.{u3, u2, u1} k V P _inst_1 _inst_2 _inst_3 _inst_4) (SetLike.instMembership.{u1, u1} (AffineSubspace.{u3, u2, u1} k V P _inst_1 _inst_2 _inst_3 _inst_4) P (AffineSubspace.instSetLikeAffineSubspace.{u3, u2, u1} k V P _inst_1 _inst_2 _inst_3 _inst_4)) x s)) (fun (_x : Subtype.{succ u1} P (fun (x : P) => Membership.mem.{u1, u1} P (AffineSubspace.{u3, u2, u1} k V P _inst_1 _inst_2 _inst_3 _inst_4) (SetLike.instMembership.{u1, u1} (AffineSubspace.{u3, u2, u1} k V P _inst_1 _inst_2 _inst_3 _inst_4) P (AffineSubspace.instSetLikeAffineSubspace.{u3, u2, u1} k V P _inst_1 _inst_2 _inst_3 _inst_4)) x s)) => (fun ([email protected]._hyg.1004 : Subtype.{succ u1} P (fun (x : P) => Membership.mem.{u1, u1} P (AffineSubspace.{u3, u2, u1} k V P _inst_1 _inst_2 _inst_3 _inst_4) (SetLike.instMembership.{u1, u1} (AffineSubspace.{u3, u2, u1} k V P _inst_1 _inst_2 _inst_3 _inst_4) P (AffineSubspace.instSetLikeAffineSubspace.{u3, u2, u1} k V P _inst_1 _inst_2 _inst_3 _inst_4)) x s)) => P) _x) (AffineMap.funLike.{u3, u2, u1, u2, u1} k (Subtype.{succ u2} V (fun (x : V) => Membership.mem.{u2, u2} V (Submodule.{u3, u2} k V (Ring.toSemiring.{u3} k _inst_1) (AddCommGroup.toAddCommMonoid.{u2} V _inst_2) _inst_3) (SetLike.instMembership.{u2, u2} (Submodule.{u3, u2} k V (Ring.toSemiring.{u3} k _inst_1) (AddCommGroup.toAddCommMonoid.{u2} V _inst_2) _inst_3) V (Submodule.setLike.{u3, u2} k V (Ring.toSemiring.{u3} k _inst_1) (AddCommGroup.toAddCommMonoid.{u2} V _inst_2) _inst_3)) x (AffineSubspace.direction.{u3, u2, u1} k V P _inst_1 _inst_2 _inst_3 _inst_4 s))) (Subtype.{succ u1} P (fun (x : P) => Membership.mem.{u1, u1} P (AffineSubspace.{u3, u2, u1} k V P _inst_1 _inst_2 _inst_3 _inst_4) (SetLike.instMembership.{u1, u1} (AffineSubspace.{u3, u2, u1} k V P _inst_1 _inst_2 _inst_3 _inst_4) P (AffineSubspace.instSetLikeAffineSubspace.{u3, u2, u1} k V P _inst_1 _inst_2 _inst_3 _inst_4)) x s)) V P _inst_1 (Submodule.addCommGroup.{u3, u2} k V _inst_1 _inst_2 _inst_3 (AffineSubspace.direction.{u3, u2, u1} k V P _inst_1 _inst_2 _inst_3 _inst_4 s)) (Submodule.module.{u3, u2} k V (Ring.toSemiring.{u3} k _inst_1) (AddCommGroup.toAddCommMonoid.{u2} V _inst_2) _inst_3 (AffineSubspace.direction.{u3, u2, u1} k V P _inst_1 _inst_2 _inst_3 _inst_4 s)) (AffineSubspace.toAddTorsor.{u3, u2, u1} k V P _inst_1 _inst_2 _inst_3 _inst_4 s _inst_5) _inst_2 _inst_3 _inst_4) (AffineSubspace.subtype.{u3, u2, u1} k V P _inst_1 _inst_2 _inst_3 _inst_4 s _inst_5)) Case conversion may be inaccurate. Consider using '#align affine_subspace.injective_subtype AffineSubspace.injective_subtypeₓ'. -/ theorem injective_subtype (s : AffineSubspace k P) [Nonempty s] : Function.Injective s.Subtype := Subtype.coe_injective #align affine_subspace.injective_subtype AffineSubspace.injective_subtype /- warning: affine_subspace.eq_iff_direction_eq_of_mem -> AffineSubspace.eq_iff_direction_eq_of_mem is a dubious translation: lean 3 declaration is forall {k : Type.{u1}} {V : Type.{u2}} {P : Type.{u3}} [_inst_1 : Ring.{u1} k] [_inst_2 : AddCommGroup.{u2} V] [_inst_3 : Module.{u1, u2} k V (Ring.toSemiring.{u1} k _inst_1) (AddCommGroup.toAddCommMonoid.{u2} V _inst_2)] [_inst_4 : AddTorsor.{u2, u3} V P (AddCommGroup.toAddGroup.{u2} V _inst_2)] {s₁ : AffineSubspace.{u1, u2, u3} k V P _inst_1 _inst_2 _inst_3 _inst_4} {s₂ : AffineSubspace.{u1, u2, u3} k V P _inst_1 _inst_2 _inst_3 _inst_4} {p : P}, (Membership.Mem.{u3, u3} P (AffineSubspace.{u1, u2, u3} k V P _inst_1 _inst_2 _inst_3 _inst_4) (SetLike.hasMem.{u3, u3} (AffineSubspace.{u1, u2, u3} k V P _inst_1 _inst_2 _inst_3 _inst_4) P (AffineSubspace.setLike.{u1, u2, u3} k V P _inst_1 _inst_2 _inst_3 _inst_4)) p s₁) -> (Membership.Mem.{u3, u3} P (AffineSubspace.{u1, u2, u3} k V P _inst_1 _inst_2 _inst_3 _inst_4) (SetLike.hasMem.{u3, u3} (AffineSubspace.{u1, u2, u3} k V P _inst_1 _inst_2 _inst_3 _inst_4) P (AffineSubspace.setLike.{u1, u2, u3} k V P _inst_1 _inst_2 _inst_3 _inst_4)) p s₂) -> (Iff (Eq.{succ u3} (AffineSubspace.{u1, u2, u3} k V P _inst_1 _inst_2 _inst_3 _inst_4) s₁ s₂) (Eq.{succ u2} (Submodule.{u1, u2} k V (Ring.toSemiring.{u1} k _inst_1) (AddCommGroup.toAddCommMonoid.{u2} V _inst_2) _inst_3) (AffineSubspace.direction.{u1, u2, u3} k V P _inst_1 _inst_2 _inst_3 _inst_4 s₁) (AffineSubspace.direction.{u1, u2, u3} k V P _inst_1 _inst_2 _inst_3 _inst_4 s₂))) but is expected to have type forall {k : Type.{u3}} {V : Type.{u2}} {P : Type.{u1}} [_inst_1 : Ring.{u3} k] [_inst_2 : AddCommGroup.{u2} V] [_inst_3 : Module.{u3, u2} k V (Ring.toSemiring.{u3} k _inst_1) (AddCommGroup.toAddCommMonoid.{u2} V _inst_2)] [_inst_4 : AddTorsor.{u2, u1} V P (AddCommGroup.toAddGroup.{u2} V _inst_2)] {s₁ : AffineSubspace.{u3, u2, u1} k V P _inst_1 _inst_2 _inst_3 _inst_4} {s₂ : AffineSubspace.{u3, u2, u1} k V P _inst_1 _inst_2 _inst_3 _inst_4} {p : P}, (Membership.mem.{u1, u1} P (AffineSubspace.{u3, u2, u1} k V P _inst_1 _inst_2 _inst_3 _inst_4) (SetLike.instMembership.{u1, u1} (AffineSubspace.{u3, u2, u1} k V P _inst_1 _inst_2 _inst_3 _inst_4) P (AffineSubspace.instSetLikeAffineSubspace.{u3, u2, u1} k V P _inst_1 _inst_2 _inst_3 _inst_4)) p s₁) -> (Membership.mem.{u1, u1} P (AffineSubspace.{u3, u2, u1} k V P _inst_1 _inst_2 _inst_3 _inst_4) (SetLike.instMembership.{u1, u1} (AffineSubspace.{u3, u2, u1} k V P _inst_1 _inst_2 _inst_3 _inst_4) P (AffineSubspace.instSetLikeAffineSubspace.{u3, u2, u1} k V P _inst_1 _inst_2 _inst_3 _inst_4)) p s₂) -> (Iff (Eq.{succ u1} (AffineSubspace.{u3, u2, u1} k V P _inst_1 _inst_2 _inst_3 _inst_4) s₁ s₂) (Eq.{succ u2} (Submodule.{u3, u2} k V (Ring.toSemiring.{u3} k _inst_1) (AddCommGroup.toAddCommMonoid.{u2} V _inst_2) _inst_3) (AffineSubspace.direction.{u3, u2, u1} k V P _inst_1 _inst_2 _inst_3 _inst_4 s₁) (AffineSubspace.direction.{u3, u2, u1} k V P _inst_1 _inst_2 _inst_3 _inst_4 s₂))) Case conversion may be inaccurate. Consider using '#align affine_subspace.eq_iff_direction_eq_of_mem AffineSubspace.eq_iff_direction_eq_of_memₓ'. -/ /-- Two affine subspaces with nonempty intersection are equal if and only if their directions are equal. -/ theorem eq_iff_direction_eq_of_mem {s₁ s₂ : AffineSubspace k P} {p : P} (h₁ : p ∈ s₁) (h₂ : p ∈ s₂) : s₁ = s₂ ↔ s₁.direction = s₂.direction := ⟨fun h => h ▸ rfl, fun h => ext_of_direction_eq h ⟨p, h₁, h₂⟩⟩ #align affine_subspace.eq_iff_direction_eq_of_mem AffineSubspace.eq_iff_direction_eq_of_mem #print AffineSubspace.mk' /- /-- Construct an affine subspace from a point and a direction. -/ def mk' (p : P) (direction : Submodule k V) : AffineSubspace k P where carrier := { q | ∃ v ∈ direction, q = v +ᵥ p } smul_vsub_vadd_mem c p1 p2 p3 hp1 hp2 hp3 := by rcases hp1 with ⟨v1, hv1, hp1⟩ rcases hp2 with ⟨v2, hv2, hp2⟩ rcases hp3 with ⟨v3, hv3, hp3⟩ use c • (v1 - v2) + v3, direction.add_mem (direction.smul_mem c (direction.sub_mem hv1 hv2)) hv3 simp [hp1, hp2, hp3, vadd_vadd] #align affine_subspace.mk' AffineSubspace.mk' -/ /- warning: affine_subspace.self_mem_mk' -> AffineSubspace.self_mem_mk' is a dubious translation: lean 3 declaration is forall {k : Type.{u1}} {V : Type.{u2}} {P : Type.{u3}} [_inst_1 : Ring.{u1} k] [_inst_2 : AddCommGroup.{u2} V] [_inst_3 : Module.{u1, u2} k V (Ring.toSemiring.{u1} k _inst_1) (AddCommGroup.toAddCommMonoid.{u2} V _inst_2)] [_inst_4 : AddTorsor.{u2, u3} V P (AddCommGroup.toAddGroup.{u2} V _inst_2)] (p : P) (direction : Submodule.{u1, u2} k V (Ring.toSemiring.{u1} k _inst_1) (AddCommGroup.toAddCommMonoid.{u2} V _inst_2) _inst_3), Membership.Mem.{u3, u3} P (AffineSubspace.{u1, u2, u3} k V P _inst_1 _inst_2 _inst_3 _inst_4) (SetLike.hasMem.{u3, u3} (AffineSubspace.{u1, u2, u3} k V P _inst_1 _inst_2 _inst_3 _inst_4) P (AffineSubspace.setLike.{u1, u2, u3} k V P _inst_1 _inst_2 _inst_3 _inst_4)) p (AffineSubspace.mk'.{u1, u2, u3} k V P _inst_1 _inst_2 _inst_3 _inst_4 p direction) but is expected to have type forall {k : Type.{u3}} {V : Type.{u2}} {P : Type.{u1}} [_inst_1 : Ring.{u3} k] [_inst_2 : AddCommGroup.{u2} V] [_inst_3 : Module.{u3, u2} k V (Ring.toSemiring.{u3} k _inst_1) (AddCommGroup.toAddCommMonoid.{u2} V _inst_2)] [_inst_4 : AddTorsor.{u2, u1} V P (AddCommGroup.toAddGroup.{u2} V _inst_2)] (p : P) (direction : Submodule.{u3, u2} k V (Ring.toSemiring.{u3} k _inst_1) (AddCommGroup.toAddCommMonoid.{u2} V _inst_2) _inst_3), Membership.mem.{u1, u1} P (AffineSubspace.{u3, u2, u1} k V P _inst_1 _inst_2 _inst_3 _inst_4) (SetLike.instMembership.{u1, u1} (AffineSubspace.{u3, u2, u1} k V P _inst_1 _inst_2 _inst_3 _inst_4) P (AffineSubspace.instSetLikeAffineSubspace.{u3, u2, u1} k V P _inst_1 _inst_2 _inst_3 _inst_4)) p (AffineSubspace.mk'.{u3, u2, u1} k V P _inst_1 _inst_2 _inst_3 _inst_4 p direction) Case conversion may be inaccurate. Consider using '#align affine_subspace.self_mem_mk' AffineSubspace.self_mem_mk'ₓ'. -/ /-- An affine subspace constructed from a point and a direction contains that point. -/ theorem self_mem_mk' (p : P) (direction : Submodule k V) : p ∈ mk' p direction := ⟨0, ⟨direction.zero_mem, (zero_vadd _ _).symm⟩⟩ #align affine_subspace.self_mem_mk' AffineSubspace.self_mem_mk' /- warning: affine_subspace.vadd_mem_mk' -> AffineSubspace.vadd_mem_mk' is a dubious translation: lean 3 declaration is forall {k : Type.{u1}} {V : Type.{u2}} {P : Type.{u3}} [_inst_1 : Ring.{u1} k] [_inst_2 : AddCommGroup.{u2} V] [_inst_3 : Module.{u1, u2} k V (Ring.toSemiring.{u1} k _inst_1) (AddCommGroup.toAddCommMonoid.{u2} V _inst_2)] [_inst_4 : AddTorsor.{u2, u3} V P (AddCommGroup.toAddGroup.{u2} V _inst_2)] {v : V} (p : P) {direction : Submodule.{u1, u2} k V (Ring.toSemiring.{u1} k _inst_1) (AddCommGroup.toAddCommMonoid.{u2} V _inst_2) _inst_3}, (Membership.Mem.{u2, u2} V (Submodule.{u1, u2} k V (Ring.toSemiring.{u1} k _inst_1) (AddCommGroup.toAddCommMonoid.{u2} V _inst_2) _inst_3) (SetLike.hasMem.{u2, u2} (Submodule.{u1, u2} k V (Ring.toSemiring.{u1} k _inst_1) (AddCommGroup.toAddCommMonoid.{u2} V _inst_2) _inst_3) V (Submodule.setLike.{u1, u2} k V (Ring.toSemiring.{u1} k _inst_1) (AddCommGroup.toAddCommMonoid.{u2} V _inst_2) _inst_3)) v direction) -> (Membership.Mem.{u3, u3} P (AffineSubspace.{u1, u2, u3} k V P _inst_1 _inst_2 _inst_3 _inst_4) (SetLike.hasMem.{u3, u3} (AffineSubspace.{u1, u2, u3} k V P _inst_1 _inst_2 _inst_3 _inst_4) P (AffineSubspace.setLike.{u1, u2, u3} k V P _inst_1 _inst_2 _inst_3 _inst_4)) (VAdd.vadd.{u2, u3} V P (AddAction.toHasVadd.{u2, u3} V P (SubNegMonoid.toAddMonoid.{u2} V (AddGroup.toSubNegMonoid.{u2} V (AddCommGroup.toAddGroup.{u2} V _inst_2))) (AddTorsor.toAddAction.{u2, u3} V P (AddCommGroup.toAddGroup.{u2} V _inst_2) _inst_4)) v p) (AffineSubspace.mk'.{u1, u2, u3} k V P _inst_1 _inst_2 _inst_3 _inst_4 p direction)) but is expected to have type forall {k : Type.{u3}} {V : Type.{u2}} {P : Type.{u1}} [_inst_1 : Ring.{u3} k] [_inst_2 : AddCommGroup.{u2} V] [_inst_3 : Module.{u3, u2} k V (Ring.toSemiring.{u3} k _inst_1) (AddCommGroup.toAddCommMonoid.{u2} V _inst_2)] [_inst_4 : AddTorsor.{u2, u1} V P (AddCommGroup.toAddGroup.{u2} V _inst_2)] {v : V} (p : P) {direction : Submodule.{u3, u2} k V (Ring.toSemiring.{u3} k _inst_1) (AddCommGroup.toAddCommMonoid.{u2} V _inst_2) _inst_3}, (Membership.mem.{u2, u2} V (Submodule.{u3, u2} k V (Ring.toSemiring.{u3} k _inst_1) (AddCommGroup.toAddCommMonoid.{u2} V _inst_2) _inst_3) (SetLike.instMembership.{u2, u2} (Submodule.{u3, u2} k V (Ring.toSemiring.{u3} k _inst_1) (AddCommGroup.toAddCommMonoid.{u2} V _inst_2) _inst_3) V (Submodule.setLike.{u3, u2} k V (Ring.toSemiring.{u3} k _inst_1) (AddCommGroup.toAddCommMonoid.{u2} V _inst_2) _inst_3)) v direction) -> (Membership.mem.{u1, u1} P (AffineSubspace.{u3, u2, u1} k V P _inst_1 _inst_2 _inst_3 _inst_4) (SetLike.instMembership.{u1, u1} (AffineSubspace.{u3, u2, u1} k V P _inst_1 _inst_2 _inst_3 _inst_4) P (AffineSubspace.instSetLikeAffineSubspace.{u3, u2, u1} k V P _inst_1 _inst_2 _inst_3 _inst_4)) (HVAdd.hVAdd.{u2, u1, u1} V P P (instHVAdd.{u2, u1} V P (AddAction.toVAdd.{u2, u1} V P (SubNegMonoid.toAddMonoid.{u2} V (AddGroup.toSubNegMonoid.{u2} V (AddCommGroup.toAddGroup.{u2} V _inst_2))) (AddTorsor.toAddAction.{u2, u1} V P (AddCommGroup.toAddGroup.{u2} V _inst_2) _inst_4))) v p) (AffineSubspace.mk'.{u3, u2, u1} k V P _inst_1 _inst_2 _inst_3 _inst_4 p direction)) Case conversion may be inaccurate. Consider using '#align affine_subspace.vadd_mem_mk' AffineSubspace.vadd_mem_mk'ₓ'. -/ /-- An affine subspace constructed from a point and a direction contains the result of adding a vector in that direction to that point. -/ theorem vadd_mem_mk' {v : V} (p : P) {direction : Submodule k V} (hv : v ∈ direction) : v +ᵥ p ∈ mk' p direction := ⟨v, hv, rfl⟩ #align affine_subspace.vadd_mem_mk' AffineSubspace.vadd_mem_mk' /- warning: affine_subspace.mk'_nonempty -> AffineSubspace.mk'_nonempty is a dubious translation: lean 3 declaration is forall {k : Type.{u1}} {V : Type.{u2}} {P : Type.{u3}} [_inst_1 : Ring.{u1} k] [_inst_2 : AddCommGroup.{u2} V] [_inst_3 : Module.{u1, u2} k V (Ring.toSemiring.{u1} k _inst_1) (AddCommGroup.toAddCommMonoid.{u2} V _inst_2)] [_inst_4 : AddTorsor.{u2, u3} V P (AddCommGroup.toAddGroup.{u2} V _inst_2)] (p : P) (direction : Submodule.{u1, u2} k V (Ring.toSemiring.{u1} k _inst_1) (AddCommGroup.toAddCommMonoid.{u2} V _inst_2) _inst_3), Set.Nonempty.{u3} P ((fun (a : Type.{u3}) (b : Type.{u3}) [self : HasLiftT.{succ u3, succ u3} a b] => self.0) (AffineSubspace.{u1, u2, u3} k V P _inst_1 _inst_2 _inst_3 _inst_4) (Set.{u3} P) (HasLiftT.mk.{succ u3, succ u3} (AffineSubspace.{u1, u2, u3} k V P _inst_1 _inst_2 _inst_3 _inst_4) (Set.{u3} P) (CoeTCₓ.coe.{succ u3, succ u3} (AffineSubspace.{u1, u2, u3} k V P _inst_1 _inst_2 _inst_3 _inst_4) (Set.{u3} P) (SetLike.Set.hasCoeT.{u3, u3} (AffineSubspace.{u1, u2, u3} k V P _inst_1 _inst_2 _inst_3 _inst_4) P (AffineSubspace.setLike.{u1, u2, u3} k V P _inst_1 _inst_2 _inst_3 _inst_4)))) (AffineSubspace.mk'.{u1, u2, u3} k V P _inst_1 _inst_2 _inst_3 _inst_4 p direction)) but is expected to have type forall {k : Type.{u3}} {V : Type.{u2}} {P : Type.{u1}} [_inst_1 : Ring.{u3} k] [_inst_2 : AddCommGroup.{u2} V] [_inst_3 : Module.{u3, u2} k V (Ring.toSemiring.{u3} k _inst_1) (AddCommGroup.toAddCommMonoid.{u2} V _inst_2)] [_inst_4 : AddTorsor.{u2, u1} V P (AddCommGroup.toAddGroup.{u2} V _inst_2)] (p : P) (direction : Submodule.{u3, u2} k V (Ring.toSemiring.{u3} k _inst_1) (AddCommGroup.toAddCommMonoid.{u2} V _inst_2) _inst_3), Set.Nonempty.{u1} P (SetLike.coe.{u1, u1} (AffineSubspace.{u3, u2, u1} k V P _inst_1 _inst_2 _inst_3 _inst_4) P (AffineSubspace.instSetLikeAffineSubspace.{u3, u2, u1} k V P _inst_1 _inst_2 _inst_3 _inst_4) (AffineSubspace.mk'.{u3, u2, u1} k V P _inst_1 _inst_2 _inst_3 _inst_4 p direction)) Case conversion may be inaccurate. Consider using '#align affine_subspace.mk'_nonempty AffineSubspace.mk'_nonemptyₓ'. -/ /-- An affine subspace constructed from a point and a direction is nonempty. -/ theorem mk'_nonempty (p : P) (direction : Submodule k V) : (mk' p direction : Set P).Nonempty := ⟨p, self_mem_mk' p direction⟩ #align affine_subspace.mk'_nonempty AffineSubspace.mk'_nonempty /- warning: affine_subspace.direction_mk' -> AffineSubspace.direction_mk' is a dubious translation: lean 3 declaration is forall {k : Type.{u1}} {V : Type.{u2}} {P : Type.{u3}} [_inst_1 : Ring.{u1} k] [_inst_2 : AddCommGroup.{u2} V] [_inst_3 : Module.{u1, u2} k V (Ring.toSemiring.{u1} k _inst_1) (AddCommGroup.toAddCommMonoid.{u2} V _inst_2)] [_inst_4 : AddTorsor.{u2, u3} V P (AddCommGroup.toAddGroup.{u2} V _inst_2)] (p : P) (direction : Submodule.{u1, u2} k V (Ring.toSemiring.{u1} k _inst_1) (AddCommGroup.toAddCommMonoid.{u2} V _inst_2) _inst_3), Eq.{succ u2} (Submodule.{u1, u2} k V (Ring.toSemiring.{u1} k _inst_1) (AddCommGroup.toAddCommMonoid.{u2} V _inst_2) _inst_3) (AffineSubspace.direction.{u1, u2, u3} k V P _inst_1 _inst_2 _inst_3 _inst_4 (AffineSubspace.mk'.{u1, u2, u3} k V P _inst_1 _inst_2 _inst_3 _inst_4 p direction)) direction but is expected to have type forall {k : Type.{u3}} {V : Type.{u2}} {P : Type.{u1}} [_inst_1 : Ring.{u3} k] [_inst_2 : AddCommGroup.{u2} V] [_inst_3 : Module.{u3, u2} k V (Ring.toSemiring.{u3} k _inst_1) (AddCommGroup.toAddCommMonoid.{u2} V _inst_2)] [_inst_4 : AddTorsor.{u2, u1} V P (AddCommGroup.toAddGroup.{u2} V _inst_2)] (p : P) (direction : Submodule.{u3, u2} k V (Ring.toSemiring.{u3} k _inst_1) (AddCommGroup.toAddCommMonoid.{u2} V _inst_2) _inst_3), Eq.{succ u2} (Submodule.{u3, u2} k V (Ring.toSemiring.{u3} k _inst_1) (AddCommGroup.toAddCommMonoid.{u2} V _inst_2) _inst_3) (AffineSubspace.direction.{u3, u2, u1} k V P _inst_1 _inst_2 _inst_3 _inst_4 (AffineSubspace.mk'.{u3, u2, u1} k V P _inst_1 _inst_2 _inst_3 _inst_4 p direction)) direction Case conversion may be inaccurate. Consider using '#align affine_subspace.direction_mk' AffineSubspace.direction_mk'ₓ'. -/ /-- The direction of an affine subspace constructed from a point and a direction. -/ @[simp] theorem direction_mk' (p : P) (direction : Submodule k V) : (mk' p direction).direction = direction := by ext v rw [mem_direction_iff_eq_vsub (mk'_nonempty _ _)] constructor · rintro ⟨p1, ⟨v1, hv1, hp1⟩, p2, ⟨v2, hv2, hp2⟩, hv⟩ rw [hv, hp1, hp2, vadd_vsub_vadd_cancel_right] exact direction.sub_mem hv1 hv2 · exact fun hv => ⟨v +ᵥ p, vadd_mem_mk' _ hv, p, self_mem_mk' _ _, (vadd_vsub _ _).symm⟩ #align affine_subspace.direction_mk' AffineSubspace.direction_mk' /- warning: affine_subspace.mem_mk'_iff_vsub_mem -> AffineSubspace.mem_mk'_iff_vsub_mem is a dubious translation: lean 3 declaration is forall {k : Type.{u1}} {V : Type.{u2}} {P : Type.{u3}} [_inst_1 : Ring.{u1} k] [_inst_2 : AddCommGroup.{u2} V] [_inst_3 : Module.{u1, u2} k V (Ring.toSemiring.{u1} k _inst_1) (AddCommGroup.toAddCommMonoid.{u2} V _inst_2)] [_inst_4 : AddTorsor.{u2, u3} V P (AddCommGroup.toAddGroup.{u2} V _inst_2)] {p₁ : P} {p₂ : P} {direction : Submodule.{u1, u2} k V (Ring.toSemiring.{u1} k _inst_1) (AddCommGroup.toAddCommMonoid.{u2} V _inst_2) _inst_3}, Iff (Membership.Mem.{u3, u3} P (AffineSubspace.{u1, u2, u3} k V P _inst_1 _inst_2 _inst_3 _inst_4) (SetLike.hasMem.{u3, u3} (AffineSubspace.{u1, u2, u3} k V P _inst_1 _inst_2 _inst_3 _inst_4) P (AffineSubspace.setLike.{u1, u2, u3} k V P _inst_1 _inst_2 _inst_3 _inst_4)) p₂ (AffineSubspace.mk'.{u1, u2, u3} k V P _inst_1 _inst_2 _inst_3 _inst_4 p₁ direction)) (Membership.Mem.{u2, u2} V (Submodule.{u1, u2} k V (Ring.toSemiring.{u1} k _inst_1) (AddCommGroup.toAddCommMonoid.{u2} V _inst_2) _inst_3) (SetLike.hasMem.{u2, u2} (Submodule.{u1, u2} k V (Ring.toSemiring.{u1} k _inst_1) (AddCommGroup.toAddCommMonoid.{u2} V _inst_2) _inst_3) V (Submodule.setLike.{u1, u2} k V (Ring.toSemiring.{u1} k _inst_1) (AddCommGroup.toAddCommMonoid.{u2} V _inst_2) _inst_3)) (VSub.vsub.{u2, u3} V P (AddTorsor.toHasVsub.{u2, u3} V P (AddCommGroup.toAddGroup.{u2} V _inst_2) _inst_4) p₂ p₁) direction) but is expected to have type forall {k : Type.{u3}} {V : Type.{u2}} {P : Type.{u1}} [_inst_1 : Ring.{u3} k] [_inst_2 : AddCommGroup.{u2} V] [_inst_3 : Module.{u3, u2} k V (Ring.toSemiring.{u3} k _inst_1) (AddCommGroup.toAddCommMonoid.{u2} V _inst_2)] [_inst_4 : AddTorsor.{u2, u1} V P (AddCommGroup.toAddGroup.{u2} V _inst_2)] {p₁ : P} {p₂ : P} {direction : Submodule.{u3, u2} k V (Ring.toSemiring.{u3} k _inst_1) (AddCommGroup.toAddCommMonoid.{u2} V _inst_2) _inst_3}, Iff (Membership.mem.{u1, u1} P (AffineSubspace.{u3, u2, u1} k V P _inst_1 _inst_2 _inst_3 _inst_4) (SetLike.instMembership.{u1, u1} (AffineSubspace.{u3, u2, u1} k V P _inst_1 _inst_2 _inst_3 _inst_4) P (AffineSubspace.instSetLikeAffineSubspace.{u3, u2, u1} k V P _inst_1 _inst_2 _inst_3 _inst_4)) p₂ (AffineSubspace.mk'.{u3, u2, u1} k V P _inst_1 _inst_2 _inst_3 _inst_4 p₁ direction)) (Membership.mem.{u2, u2} V (Submodule.{u3, u2} k V (Ring.toSemiring.{u3} k _inst_1) (AddCommGroup.toAddCommMonoid.{u2} V _inst_2) _inst_3) (SetLike.instMembership.{u2, u2} (Submodule.{u3, u2} k V (Ring.toSemiring.{u3} k _inst_1) (AddCommGroup.toAddCommMonoid.{u2} V _inst_2) _inst_3) V (Submodule.setLike.{u3, u2} k V (Ring.toSemiring.{u3} k _inst_1) (AddCommGroup.toAddCommMonoid.{u2} V _inst_2) _inst_3)) (VSub.vsub.{u2, u1} V P (AddTorsor.toVSub.{u2, u1} V P (AddCommGroup.toAddGroup.{u2} V _inst_2) _inst_4) p₂ p₁) direction) Case conversion may be inaccurate. Consider using '#align affine_subspace.mem_mk'_iff_vsub_mem AffineSubspace.mem_mk'_iff_vsub_memₓ'. -/ /-- A point lies in an affine subspace constructed from another point and a direction if and only if their difference is in that direction. -/ theorem mem_mk'_iff_vsub_mem {p₁ p₂ : P} {direction : Submodule k V} : p₂ ∈ mk' p₁ direction ↔ p₂ -ᵥ p₁ ∈ direction := by refine' ⟨fun h => _, fun h => _⟩ · rw [← direction_mk' p₁ direction] exact vsub_mem_direction h (self_mem_mk' _ _) · rw [← vsub_vadd p₂ p₁] exact vadd_mem_mk' p₁ h #align affine_subspace.mem_mk'_iff_vsub_mem AffineSubspace.mem_mk'_iff_vsub_mem /- warning: affine_subspace.mk'_eq -> AffineSubspace.mk'_eq is a dubious translation: lean 3 declaration is forall {k : Type.{u1}} {V : Type.{u2}} {P : Type.{u3}} [_inst_1 : Ring.{u1} k] [_inst_2 : AddCommGroup.{u2} V] [_inst_3 : Module.{u1, u2} k V (Ring.toSemiring.{u1} k _inst_1) (AddCommGroup.toAddCommMonoid.{u2} V _inst_2)] [_inst_4 : AddTorsor.{u2, u3} V P (AddCommGroup.toAddGroup.{u2} V _inst_2)] {s : AffineSubspace.{u1, u2, u3} k V P _inst_1 _inst_2 _inst_3 _inst_4} {p : P}, (Membership.Mem.{u3, u3} P (AffineSubspace.{u1, u2, u3} k V P _inst_1 _inst_2 _inst_3 _inst_4) (SetLike.hasMem.{u3, u3} (AffineSubspace.{u1, u2, u3} k V P _inst_1 _inst_2 _inst_3 _inst_4) P (AffineSubspace.setLike.{u1, u2, u3} k V P _inst_1 _inst_2 _inst_3 _inst_4)) p s) -> (Eq.{succ u3} (AffineSubspace.{u1, u2, u3} k V P _inst_1 _inst_2 _inst_3 _inst_4) (AffineSubspace.mk'.{u1, u2, u3} k V P _inst_1 _inst_2 _inst_3 _inst_4 p (AffineSubspace.direction.{u1, u2, u3} k V P _inst_1 _inst_2 _inst_3 _inst_4 s)) s) but is expected to have type forall {k : Type.{u3}} {V : Type.{u2}} {P : Type.{u1}} [_inst_1 : Ring.{u3} k] [_inst_2 : AddCommGroup.{u2} V] [_inst_3 : Module.{u3, u2} k V (Ring.toSemiring.{u3} k _inst_1) (AddCommGroup.toAddCommMonoid.{u2} V _inst_2)] [_inst_4 : AddTorsor.{u2, u1} V P (AddCommGroup.toAddGroup.{u2} V _inst_2)] {s : AffineSubspace.{u3, u2, u1} k V P _inst_1 _inst_2 _inst_3 _inst_4} {p : P}, (Membership.mem.{u1, u1} P (AffineSubspace.{u3, u2, u1} k V P _inst_1 _inst_2 _inst_3 _inst_4) (SetLike.instMembership.{u1, u1} (AffineSubspace.{u3, u2, u1} k V P _inst_1 _inst_2 _inst_3 _inst_4) P (AffineSubspace.instSetLikeAffineSubspace.{u3, u2, u1} k V P _inst_1 _inst_2 _inst_3 _inst_4)) p s) -> (Eq.{succ u1} (AffineSubspace.{u3, u2, u1} k V P _inst_1 _inst_2 _inst_3 _inst_4) (AffineSubspace.mk'.{u3, u2, u1} k V P _inst_1 _inst_2 _inst_3 _inst_4 p (AffineSubspace.direction.{u3, u2, u1} k V P _inst_1 _inst_2 _inst_3 _inst_4 s)) s) Case conversion may be inaccurate. Consider using '#align affine_subspace.mk'_eq AffineSubspace.mk'_eqₓ'. -/ /-- Constructing an affine subspace from a point in a subspace and that subspace's direction yields the original subspace. -/ @[simp] theorem mk'_eq {s : AffineSubspace k P} {p : P} (hp : p ∈ s) : mk' p s.direction = s := ext_of_direction_eq (direction_mk' p s.direction) ⟨p, Set.mem_inter (self_mem_mk' _ _) hp⟩ #align affine_subspace.mk'_eq AffineSubspace.mk'_eq /- warning: affine_subspace.span_points_subset_coe_of_subset_coe -> AffineSubspace.spanPoints_subset_coe_of_subset_coe is a dubious translation: lean 3 declaration is forall {k : Type.{u1}} {V : Type.{u2}} {P : Type.{u3}} [_inst_1 : Ring.{u1} k] [_inst_2 : AddCommGroup.{u2} V] [_inst_3 : Module.{u1, u2} k V (Ring.toSemiring.{u1} k _inst_1) (AddCommGroup.toAddCommMonoid.{u2} V _inst_2)] [_inst_4 : AddTorsor.{u2, u3} V P (AddCommGroup.toAddGroup.{u2} V _inst_2)] {s : Set.{u3} P} {s1 : AffineSubspace.{u1, u2, u3} k V P _inst_1 _inst_2 _inst_3 _inst_4}, (HasSubset.Subset.{u3} (Set.{u3} P) (Set.hasSubset.{u3} P) s ((fun (a : Type.{u3}) (b : Type.{u3}) [self : HasLiftT.{succ u3, succ u3} a b] => self.0) (AffineSubspace.{u1, u2, u3} k V P _inst_1 _inst_2 _inst_3 _inst_4) (Set.{u3} P) (HasLiftT.mk.{succ u3, succ u3} (AffineSubspace.{u1, u2, u3} k V P _inst_1 _inst_2 _inst_3 _inst_4) (Set.{u3} P) (CoeTCₓ.coe.{succ u3, succ u3} (AffineSubspace.{u1, u2, u3} k V P _inst_1 _inst_2 _inst_3 _inst_4) (Set.{u3} P) (SetLike.Set.hasCoeT.{u3, u3} (AffineSubspace.{u1, u2, u3} k V P _inst_1 _inst_2 _inst_3 _inst_4) P (AffineSubspace.setLike.{u1, u2, u3} k V P _inst_1 _inst_2 _inst_3 _inst_4)))) s1)) -> (HasSubset.Subset.{u3} (Set.{u3} P) (Set.hasSubset.{u3} P) (spanPoints.{u1, u2, u3} k V P _inst_1 _inst_2 _inst_3 _inst_4 s) ((fun (a : Type.{u3}) (b : Type.{u3}) [self : HasLiftT.{succ u3, succ u3} a b] => self.0) (AffineSubspace.{u1, u2, u3} k V P _inst_1 _inst_2 _inst_3 _inst_4) (Set.{u3} P) (HasLiftT.mk.{succ u3, succ u3} (AffineSubspace.{u1, u2, u3} k V P _inst_1 _inst_2 _inst_3 _inst_4) (Set.{u3} P) (CoeTCₓ.coe.{succ u3, succ u3} (AffineSubspace.{u1, u2, u3} k V P _inst_1 _inst_2 _inst_3 _inst_4) (Set.{u3} P) (SetLike.Set.hasCoeT.{u3, u3} (AffineSubspace.{u1, u2, u3} k V P _inst_1 _inst_2 _inst_3 _inst_4) P (AffineSubspace.setLike.{u1, u2, u3} k V P _inst_1 _inst_2 _inst_3 _inst_4)))) s1)) but is expected to have type forall {k : Type.{u2}} {V : Type.{u1}} {P : Type.{u3}} [_inst_1 : Ring.{u2} k] [_inst_2 : AddCommGroup.{u1} V] [_inst_3 : Module.{u2, u1} k V (Ring.toSemiring.{u2} k _inst_1) (AddCommGroup.toAddCommMonoid.{u1} V _inst_2)] [_inst_4 : AddTorsor.{u1, u3} V P (AddCommGroup.toAddGroup.{u1} V _inst_2)] {s : Set.{u3} P} {s1 : AffineSubspace.{u2, u1, u3} k V P _inst_1 _inst_2 _inst_3 _inst_4}, (HasSubset.Subset.{u3} (Set.{u3} P) (Set.instHasSubsetSet.{u3} P) s (SetLike.coe.{u3, u3} (AffineSubspace.{u2, u1, u3} k V P _inst_1 _inst_2 _inst_3 _inst_4) P (AffineSubspace.instSetLikeAffineSubspace.{u2, u1, u3} k V P _inst_1 _inst_2 _inst_3 _inst_4) s1)) -> (HasSubset.Subset.{u3} (Set.{u3} P) (Set.instHasSubsetSet.{u3} P) (spanPoints.{u2, u1, u3} k V P _inst_1 _inst_2 _inst_3 _inst_4 s) (SetLike.coe.{u3, u3} (AffineSubspace.{u2, u1, u3} k V P _inst_1 _inst_2 _inst_3 _inst_4) P (AffineSubspace.instSetLikeAffineSubspace.{u2, u1, u3} k V P _inst_1 _inst_2 _inst_3 _inst_4) s1)) Case conversion may be inaccurate. Consider using '#align affine_subspace.span_points_subset_coe_of_subset_coe AffineSubspace.spanPoints_subset_coe_of_subset_coeₓ'. -/ /-- If an affine subspace contains a set of points, it contains the `span_points` of that set. -/ theorem spanPoints_subset_coe_of_subset_coe {s : Set P} {s1 : AffineSubspace k P} (h : s ⊆ s1) : spanPoints k s ⊆ s1 := by rintro p ⟨p1, hp1, v, hv, hp⟩ rw [hp] have hp1s1 : p1 ∈ (s1 : Set P) := Set.mem_of_mem_of_subset hp1 h refine' vadd_mem_of_mem_direction _ hp1s1 have hs : vectorSpan k s ≤ s1.direction := vectorSpan_mono k h rw [SetLike.le_def] at hs rw [← SetLike.mem_coe] exact Set.mem_of_mem_of_subset hv hs #align affine_subspace.span_points_subset_coe_of_subset_coe AffineSubspace.spanPoints_subset_coe_of_subset_coe end AffineSubspace /- warning: affine_map.line_map_mem -> AffineMap.lineMap_mem is a dubious translation: lean 3 declaration is forall {k : Type.{u1}} {V : Type.{u2}} {P : Type.{u3}} [_inst_1 : Ring.{u1} k] [_inst_2 : AddCommGroup.{u2} V] [_inst_3 : Module.{u1, u2} k V (Ring.toSemiring.{u1} k _inst_1) (AddCommGroup.toAddCommMonoid.{u2} V _inst_2)] [_inst_4 : AddTorsor.{u2, u3} V P (AddCommGroup.toAddGroup.{u2} V _inst_2)] {Q : AffineSubspace.{u1, u2, u3} k V P _inst_1 _inst_2 _inst_3 _inst_4} {p₀ : P} {p₁ : P} (c : k), (Membership.Mem.{u3, u3} P (AffineSubspace.{u1, u2, u3} k V P _inst_1 _inst_2 _inst_3 _inst_4) (SetLike.hasMem.{u3, u3} (AffineSubspace.{u1, u2, u3} k V P _inst_1 _inst_2 _inst_3 _inst_4) P (AffineSubspace.setLike.{u1, u2, u3} k V P _inst_1 _inst_2 _inst_3 _inst_4)) p₀ Q) -> (Membership.Mem.{u3, u3} P (AffineSubspace.{u1, u2, u3} k V P _inst_1 _inst_2 _inst_3 _inst_4) (SetLike.hasMem.{u3, u3} (AffineSubspace.{u1, u2, u3} k V P _inst_1 _inst_2 _inst_3 _inst_4) P (AffineSubspace.setLike.{u1, u2, u3} k V P _inst_1 _inst_2 _inst_3 _inst_4)) p₁ Q) -> (Membership.Mem.{u3, u3} P (AffineSubspace.{u1, u2, u3} k V P _inst_1 _inst_2 _inst_3 _inst_4) (SetLike.hasMem.{u3, u3} (AffineSubspace.{u1, u2, u3} k V P _inst_1 _inst_2 _inst_3 _inst_4) P (AffineSubspace.setLike.{u1, u2, u3} k V P _inst_1 _inst_2 _inst_3 _inst_4)) (coeFn.{max (succ u1) (succ u2) (succ u3), max (succ u1) (succ u3)} (AffineMap.{u1, u1, u1, u2, u3} k k k V P _inst_1 (NonUnitalNonAssocRing.toAddCommGroup.{u1} k (NonAssocRing.toNonUnitalNonAssocRing.{u1} k (Ring.toNonAssocRing.{u1} k _inst_1))) (Semiring.toModule.{u1} k (Ring.toSemiring.{u1} k _inst_1)) (addGroupIsAddTorsor.{u1} k (AddGroupWithOne.toAddGroup.{u1} k (AddCommGroupWithOne.toAddGroupWithOne.{u1} k (Ring.toAddCommGroupWithOne.{u1} k _inst_1)))) _inst_2 _inst_3 _inst_4) (fun (_x : AffineMap.{u1, u1, u1, u2, u3} k k k V P _inst_1 (NonUnitalNonAssocRing.toAddCommGroup.{u1} k (NonAssocRing.toNonUnitalNonAssocRing.{u1} k (Ring.toNonAssocRing.{u1} k _inst_1))) (Semiring.toModule.{u1} k (Ring.toSemiring.{u1} k _inst_1)) (addGroupIsAddTorsor.{u1} k (AddGroupWithOne.toAddGroup.{u1} k (AddCommGroupWithOne.toAddGroupWithOne.{u1} k (Ring.toAddCommGroupWithOne.{u1} k _inst_1)))) _inst_2 _inst_3 _inst_4) => k -> P) (AffineMap.hasCoeToFun.{u1, u1, u1, u2, u3} k k k V P _inst_1 (NonUnitalNonAssocRing.toAddCommGroup.{u1} k (NonAssocRing.toNonUnitalNonAssocRing.{u1} k (Ring.toNonAssocRing.{u1} k _inst_1))) (Semiring.toModule.{u1} k (Ring.toSemiring.{u1} k _inst_1)) (addGroupIsAddTorsor.{u1} k (AddGroupWithOne.toAddGroup.{u1} k (AddCommGroupWithOne.toAddGroupWithOne.{u1} k (Ring.toAddCommGroupWithOne.{u1} k _inst_1)))) _inst_2 _inst_3 _inst_4) (AffineMap.lineMap.{u1, u2, u3} k V P _inst_1 _inst_2 _inst_3 _inst_4 p₀ p₁) c) Q) but is expected to have type forall {k : Type.{u3}} {V : Type.{u2}} {P : Type.{u1}} [_inst_1 : Ring.{u3} k] [_inst_2 : AddCommGroup.{u2} V] [_inst_3 : Module.{u3, u2} k V (Ring.toSemiring.{u3} k _inst_1) (AddCommGroup.toAddCommMonoid.{u2} V _inst_2)] [_inst_4 : AddTorsor.{u2, u1} V P (AddCommGroup.toAddGroup.{u2} V _inst_2)] {Q : AffineSubspace.{u3, u2, u1} k V P _inst_1 _inst_2 _inst_3 _inst_4} {p₀ : P} {p₁ : P} (c : k), (Membership.mem.{u1, u1} P (AffineSubspace.{u3, u2, u1} k V P _inst_1 _inst_2 _inst_3 _inst_4) (SetLike.instMembership.{u1, u1} (AffineSubspace.{u3, u2, u1} k V P _inst_1 _inst_2 _inst_3 _inst_4) P (AffineSubspace.instSetLikeAffineSubspace.{u3, u2, u1} k V P _inst_1 _inst_2 _inst_3 _inst_4)) p₀ Q) -> (Membership.mem.{u1, u1} P (AffineSubspace.{u3, u2, u1} k V P _inst_1 _inst_2 _inst_3 _inst_4) (SetLike.instMembership.{u1, u1} (AffineSubspace.{u3, u2, u1} k V P _inst_1 _inst_2 _inst_3 _inst_4) P (AffineSubspace.instSetLikeAffineSubspace.{u3, u2, u1} k V P _inst_1 _inst_2 _inst_3 _inst_4)) p₁ Q) -> (Membership.mem.{u1, u1} ((fun ([email protected]._hyg.1004 : k) => P) c) (AffineSubspace.{u3, u2, u1} k V P _inst_1 _inst_2 _inst_3 _inst_4) (SetLike.instMembership.{u1, u1} (AffineSubspace.{u3, u2, u1} k V P _inst_1 _inst_2 _inst_3 _inst_4) P (AffineSubspace.instSetLikeAffineSubspace.{u3, u2, u1} k V P _inst_1 _inst_2 _inst_3 _inst_4)) (FunLike.coe.{max (max (succ u3) (succ u2)) (succ u1), succ u3, succ u1} (AffineMap.{u3, u3, u3, u2, u1} k k k V P _inst_1 (Ring.toAddCommGroup.{u3} k _inst_1) (AffineMap.instModuleToSemiringToAddCommMonoidToNonUnitalNonAssocSemiringToNonUnitalNonAssocRingToNonUnitalRing.{u3} k _inst_1) (addGroupIsAddTorsor.{u3} k (AddGroupWithOne.toAddGroup.{u3} k (Ring.toAddGroupWithOne.{u3} k _inst_1))) _inst_2 _inst_3 _inst_4) k (fun (_x : k) => (fun ([email protected]._hyg.1004 : k) => P) _x) (AffineMap.funLike.{u3, u3, u3, u2, u1} k k k V P _inst_1 (Ring.toAddCommGroup.{u3} k _inst_1) (AffineMap.instModuleToSemiringToAddCommMonoidToNonUnitalNonAssocSemiringToNonUnitalNonAssocRingToNonUnitalRing.{u3} k _inst_1) (addGroupIsAddTorsor.{u3} k (AddGroupWithOne.toAddGroup.{u3} k (Ring.toAddGroupWithOne.{u3} k _inst_1))) _inst_2 _inst_3 _inst_4) (AffineMap.lineMap.{u3, u2, u1} k V P _inst_1 _inst_2 _inst_3 _inst_4 p₀ p₁) c) Q) Case conversion may be inaccurate. Consider using '#align affine_map.line_map_mem AffineMap.lineMap_memₓ'. -/ theorem AffineMap.lineMap_mem {k V P : Type _} [Ring k] [AddCommGroup V] [Module k V] [AddTorsor V P] {Q : AffineSubspace k P} {p₀ p₁ : P} (c : k) (h₀ : p₀ ∈ Q) (h₁ : p₁ ∈ Q) : AffineMap.lineMap p₀ p₁ c ∈ Q := by rw [AffineMap.lineMap_apply] exact Q.smul_vsub_vadd_mem c h₁ h₀ h₀ #align affine_map.line_map_mem AffineMap.lineMap_mem section affineSpan variable (k : Type _) {V : Type _} {P : Type _} [Ring k] [AddCommGroup V] [Module k V] [affine_space V P] include V #print affineSpan /- /-- The affine span of a set of points is the smallest affine subspace containing those points. (Actually defined here in terms of spans in modules.) -/ def affineSpan (s : Set P) : AffineSubspace k P where carrier := spanPoints k s smul_vsub_vadd_mem c p1 p2 p3 hp1 hp2 hp3 := vadd_mem_spanPoints_of_mem_spanPoints_of_mem_vectorSpan k hp3 ((vectorSpan k s).smul_mem c (vsub_mem_vectorSpan_of_mem_spanPoints_of_mem_spanPoints k hp1 hp2)) #align affine_span affineSpan -/ /- warning: coe_affine_span -> coe_affineSpan is a dubious translation: lean 3 declaration is forall (k : Type.{u1}) {V : Type.{u2}} {P : Type.{u3}} [_inst_1 : Ring.{u1} k] [_inst_2 : AddCommGroup.{u2} V] [_inst_3 : Module.{u1, u2} k V (Ring.toSemiring.{u1} k _inst_1) (AddCommGroup.toAddCommMonoid.{u2} V _inst_2)] [_inst_4 : AddTorsor.{u2, u3} V P (AddCommGroup.toAddGroup.{u2} V _inst_2)] (s : Set.{u3} P), Eq.{succ u3} (Set.{u3} P) ((fun (a : Type.{u3}) (b : Type.{u3}) [self : HasLiftT.{succ u3, succ u3} a b] => self.0) (AffineSubspace.{u1, u2, u3} k V P _inst_1 _inst_2 _inst_3 _inst_4) (Set.{u3} P) (HasLiftT.mk.{succ u3, succ u3} (AffineSubspace.{u1, u2, u3} k V P _inst_1 _inst_2 _inst_3 _inst_4) (Set.{u3} P) (CoeTCₓ.coe.{succ u3, succ u3} (AffineSubspace.{u1, u2, u3} k V P _inst_1 _inst_2 _inst_3 _inst_4) (Set.{u3} P) (SetLike.Set.hasCoeT.{u3, u3} (AffineSubspace.{u1, u2, u3} k V P _inst_1 _inst_2 _inst_3 _inst_4) P (AffineSubspace.setLike.{u1, u2, u3} k V P _inst_1 _inst_2 _inst_3 _inst_4)))) (affineSpan.{u1, u2, u3} k V P _inst_1 _inst_2 _inst_3 _inst_4 s)) (spanPoints.{u1, u2, u3} k V P _inst_1 _inst_2 _inst_3 _inst_4 s) but is expected to have type forall (k : Type.{u2}) {V : Type.{u1}} {P : Type.{u3}} [_inst_1 : Ring.{u2} k] [_inst_2 : AddCommGroup.{u1} V] [_inst_3 : Module.{u2, u1} k V (Ring.toSemiring.{u2} k _inst_1) (AddCommGroup.toAddCommMonoid.{u1} V _inst_2)] [_inst_4 : AddTorsor.{u1, u3} V P (AddCommGroup.toAddGroup.{u1} V _inst_2)] (s : Set.{u3} P), Eq.{succ u3} (Set.{u3} P) (SetLike.coe.{u3, u3} (AffineSubspace.{u2, u1, u3} k V P _inst_1 _inst_2 _inst_3 _inst_4) P (AffineSubspace.instSetLikeAffineSubspace.{u2, u1, u3} k V P _inst_1 _inst_2 _inst_3 _inst_4) (affineSpan.{u2, u1, u3} k V P _inst_1 _inst_2 _inst_3 _inst_4 s)) (spanPoints.{u2, u1, u3} k V P _inst_1 _inst_2 _inst_3 _inst_4 s) Case conversion may be inaccurate. Consider using '#align coe_affine_span coe_affineSpanₓ'. -/ /-- The affine span, converted to a set, is `span_points`. -/ @[simp] theorem coe_affineSpan (s : Set P) : (affineSpan k s : Set P) = spanPoints k s := rfl #align coe_affine_span coe_affineSpan /- warning: subset_affine_span -> subset_affineSpan is a dubious translation: lean 3 declaration is forall (k : Type.{u1}) {V : Type.{u2}} {P : Type.{u3}} [_inst_1 : Ring.{u1} k] [_inst_2 : AddCommGroup.{u2} V] [_inst_3 : Module.{u1, u2} k V (Ring.toSemiring.{u1} k _inst_1) (AddCommGroup.toAddCommMonoid.{u2} V _inst_2)] [_inst_4 : AddTorsor.{u2, u3} V P (AddCommGroup.toAddGroup.{u2} V _inst_2)] (s : Set.{u3} P), HasSubset.Subset.{u3} (Set.{u3} P) (Set.hasSubset.{u3} P) s ((fun (a : Type.{u3}) (b : Type.{u3}) [self : HasLiftT.{succ u3, succ u3} a b] => self.0) (AffineSubspace.{u1, u2, u3} k V P _inst_1 _inst_2 _inst_3 _inst_4) (Set.{u3} P) (HasLiftT.mk.{succ u3, succ u3} (AffineSubspace.{u1, u2, u3} k V P _inst_1 _inst_2 _inst_3 _inst_4) (Set.{u3} P) (CoeTCₓ.coe.{succ u3, succ u3} (AffineSubspace.{u1, u2, u3} k V P _inst_1 _inst_2 _inst_3 _inst_4) (Set.{u3} P) (SetLike.Set.hasCoeT.{u3, u3} (AffineSubspace.{u1, u2, u3} k V P _inst_1 _inst_2 _inst_3 _inst_4) P (AffineSubspace.setLike.{u1, u2, u3} k V P _inst_1 _inst_2 _inst_3 _inst_4)))) (affineSpan.{u1, u2, u3} k V P _inst_1 _inst_2 _inst_3 _inst_4 s)) but is expected to have type forall (k : Type.{u2}) {V : Type.{u1}} {P : Type.{u3}} [_inst_1 : Ring.{u2} k] [_inst_2 : AddCommGroup.{u1} V] [_inst_3 : Module.{u2, u1} k V (Ring.toSemiring.{u2} k _inst_1) (AddCommGroup.toAddCommMonoid.{u1} V _inst_2)] [_inst_4 : AddTorsor.{u1, u3} V P (AddCommGroup.toAddGroup.{u1} V _inst_2)] (s : Set.{u3} P), HasSubset.Subset.{u3} (Set.{u3} P) (Set.instHasSubsetSet.{u3} P) s (SetLike.coe.{u3, u3} (AffineSubspace.{u2, u1, u3} k V P _inst_1 _inst_2 _inst_3 _inst_4) P (AffineSubspace.instSetLikeAffineSubspace.{u2, u1, u3} k V P _inst_1 _inst_2 _inst_3 _inst_4) (affineSpan.{u2, u1, u3} k V P _inst_1 _inst_2 _inst_3 _inst_4 s)) Case conversion may be inaccurate. Consider using '#align subset_affine_span subset_affineSpanₓ'. -/ /-- A set is contained in its affine span. -/ theorem subset_affineSpan (s : Set P) : s ⊆ affineSpan k s := subset_spanPoints k s #align subset_affine_span subset_affineSpan #print direction_affineSpan /- /-- The direction of the affine span is the `vector_span`. -/ theorem direction_affineSpan (s : Set P) : (affineSpan k s).direction = vectorSpan k s := by apply le_antisymm · refine' Submodule.span_le.2 _ rintro v ⟨p1, p3, ⟨p2, hp2, v1, hv1, hp1⟩, ⟨p4, hp4, v2, hv2, hp3⟩, rfl⟩ rw [hp1, hp3, vsub_vadd_eq_vsub_sub, vadd_vsub_assoc, SetLike.mem_coe] exact (vectorSpan k s).sub_mem ((vectorSpan k s).add_mem hv1 (vsub_mem_vectorSpan k hp2 hp4)) hv2 · exact vectorSpan_mono k (subset_spanPoints k s) #align direction_affine_span direction_affineSpan -/ /- warning: mem_affine_span -> mem_affineSpan is a dubious translation: lean 3 declaration is forall (k : Type.{u1}) {V : Type.{u2}} {P : Type.{u3}} [_inst_1 : Ring.{u1} k] [_inst_2 : AddCommGroup.{u2} V] [_inst_3 : Module.{u1, u2} k V (Ring.toSemiring.{u1} k _inst_1) (AddCommGroup.toAddCommMonoid.{u2} V _inst_2)] [_inst_4 : AddTorsor.{u2, u3} V P (AddCommGroup.toAddGroup.{u2} V _inst_2)] {p : P} {s : Set.{u3} P}, (Membership.Mem.{u3, u3} P (Set.{u3} P) (Set.hasMem.{u3} P) p s) -> (Membership.Mem.{u3, u3} P (AffineSubspace.{u1, u2, u3} k V P _inst_1 _inst_2 _inst_3 _inst_4) (SetLike.hasMem.{u3, u3} (AffineSubspace.{u1, u2, u3} k V P _inst_1 _inst_2 _inst_3 _inst_4) P (AffineSubspace.setLike.{u1, u2, u3} k V P _inst_1 _inst_2 _inst_3 _inst_4)) p (affineSpan.{u1, u2, u3} k V P _inst_1 _inst_2 _inst_3 _inst_4 s)) but is expected to have type forall (k : Type.{u2}) {V : Type.{u1}} {P : Type.{u3}} [_inst_1 : Ring.{u2} k] [_inst_2 : AddCommGroup.{u1} V] [_inst_3 : Module.{u2, u1} k V (Ring.toSemiring.{u2} k _inst_1) (AddCommGroup.toAddCommMonoid.{u1} V _inst_2)] [_inst_4 : AddTorsor.{u1, u3} V P (AddCommGroup.toAddGroup.{u1} V _inst_2)] {p : P} {s : Set.{u3} P}, (Membership.mem.{u3, u3} P (Set.{u3} P) (Set.instMembershipSet.{u3} P) p s) -> (Membership.mem.{u3, u3} P (AffineSubspace.{u2, u1, u3} k V P _inst_1 _inst_2 _inst_3 _inst_4) (SetLike.instMembership.{u3, u3} (AffineSubspace.{u2, u1, u3} k V P _inst_1 _inst_2 _inst_3 _inst_4) P (AffineSubspace.instSetLikeAffineSubspace.{u2, u1, u3} k V P _inst_1 _inst_2 _inst_3 _inst_4)) p (affineSpan.{u2, u1, u3} k V P _inst_1 _inst_2 _inst_3 _inst_4 s)) Case conversion may be inaccurate. Consider using '#align mem_affine_span mem_affineSpanₓ'. -/ /-- A point in a set is in its affine span. -/ theorem mem_affineSpan {p : P} {s : Set P} (hp : p ∈ s) : p ∈ affineSpan k s := mem_spanPoints k p s hp #align mem_affine_span mem_affineSpan end affineSpan namespace AffineSubspace variable {k : Type _} {V : Type _} {P : Type _} [Ring k] [AddCommGroup V] [Module k V] [S : affine_space V P] include S instance : CompleteLattice (AffineSubspace k P) := { PartialOrder.lift (coe : AffineSubspace k P → Set P) coe_injective with sup := fun s1 s2 => affineSpan k (s1 ∪ s2) le_sup_left := fun s1 s2 => Set.Subset.trans (Set.subset_union_left s1 s2) (subset_spanPoints k _) le_sup_right := fun s1 s2 => Set.Subset.trans (Set.subset_union_right s1 s2) (subset_spanPoints k _) sup_le := fun s1 s2 s3 hs1 hs2 => spanPoints_subset_coe_of_subset_coe (Set.union_subset hs1 hs2) inf := fun s1 s2 => mk (s1 ∩ s2) fun c p1 p2 p3 hp1 hp2 hp3 => ⟨s1.smul_vsub_vadd_mem c hp1.1 hp2.1 hp3.1, s2.smul_vsub_vadd_mem c hp1.2 hp2.2 hp3.2⟩ inf_le_left := fun _ _ => Set.inter_subset_left _ _ inf_le_right := fun _ _ => Set.inter_subset_right _ _ le_inf := fun _ _ _ => Set.subset_inter top := { carrier := Set.univ smul_vsub_vadd_mem := fun _ _ _ _ _ _ _ => Set.mem_univ _ } le_top := fun _ _ _ => Set.mem_univ _ bot := { carrier := ∅ smul_vsub_vadd_mem := fun _ _ _ _ => False.elim } bot_le := fun _ _ => False.elim supₛ := fun s => affineSpan k (⋃ s' ∈ s, (s' : Set P)) infₛ := fun s => mk (⋂ s' ∈ s, (s' : Set P)) fun c p1 p2 p3 hp1 hp2 hp3 => Set.mem_interᵢ₂.2 fun s2 hs2 => by rw [Set.mem_interᵢ₂] at * exact s2.smul_vsub_vadd_mem c (hp1 s2 hs2) (hp2 s2 hs2) (hp3 s2 hs2) le_sup := fun _ _ h => Set.Subset.trans (Set.subset_bunionᵢ_of_mem h) (subset_spanPoints k _) sup_le := fun _ _ h => spanPoints_subset_coe_of_subset_coe (Set.unionᵢ₂_subset h) inf_le := fun _ _ => Set.binterᵢ_subset_of_mem le_inf := fun _ _ => Set.subset_interᵢ₂ } instance : Inhabited (AffineSubspace k P) := ⟨⊤⟩ /- warning: affine_subspace.le_def -> AffineSubspace.le_def is a dubious translation: lean 3 declaration is forall {k : Type.{u1}} {V : Type.{u2}} {P : Type.{u3}} [_inst_1 : Ring.{u1} k] [_inst_2 : AddCommGroup.{u2} V] [_inst_3 : Module.{u1, u2} k V (Ring.toSemiring.{u1} k _inst_1) (AddCommGroup.toAddCommMonoid.{u2} V _inst_2)] [S : AddTorsor.{u2, u3} V P (AddCommGroup.toAddGroup.{u2} V _inst_2)] (s1 : AffineSubspace.{u1, u2, u3} k V P _inst_1 _inst_2 _inst_3 S) (s2 : AffineSubspace.{u1, u2, u3} k V P _inst_1 _inst_2 _inst_3 S), Iff (LE.le.{u3} (AffineSubspace.{u1, u2, u3} k V P _inst_1 _inst_2 _inst_3 S) (Preorder.toLE.{u3} (AffineSubspace.{u1, u2, u3} k V P _inst_1 _inst_2 _inst_3 S) (PartialOrder.toPreorder.{u3} (AffineSubspace.{u1, u2, u3} k V P _inst_1 _inst_2 _inst_3 S) (SetLike.partialOrder.{u3, u3} (AffineSubspace.{u1, u2, u3} k V P _inst_1 _inst_2 _inst_3 S) P (AffineSubspace.setLike.{u1, u2, u3} k V P _inst_1 _inst_2 _inst_3 S)))) s1 s2) (HasSubset.Subset.{u3} (Set.{u3} P) (Set.hasSubset.{u3} P) ((fun (a : Type.{u3}) (b : Type.{u3}) [self : HasLiftT.{succ u3, succ u3} a b] => self.0) (AffineSubspace.{u1, u2, u3} k V P _inst_1 _inst_2 _inst_3 S) (Set.{u3} P) (HasLiftT.mk.{succ u3, succ u3} (AffineSubspace.{u1, u2, u3} k V P _inst_1 _inst_2 _inst_3 S) (Set.{u3} P) (CoeTCₓ.coe.{succ u3, succ u3} (AffineSubspace.{u1, u2, u3} k V P _inst_1 _inst_2 _inst_3 S) (Set.{u3} P) (SetLike.Set.hasCoeT.{u3, u3} (AffineSubspace.{u1, u2, u3} k V P _inst_1 _inst_2 _inst_3 S) P (AffineSubspace.setLike.{u1, u2, u3} k V P _inst_1 _inst_2 _inst_3 S)))) s1) ((fun (a : Type.{u3}) (b : Type.{u3}) [self : HasLiftT.{succ u3, succ u3} a b] => self.0) (AffineSubspace.{u1, u2, u3} k V P _inst_1 _inst_2 _inst_3 S) (Set.{u3} P) (HasLiftT.mk.{succ u3, succ u3} (AffineSubspace.{u1, u2, u3} k V P _inst_1 _inst_2 _inst_3 S) (Set.{u3} P) (CoeTCₓ.coe.{succ u3, succ u3} (AffineSubspace.{u1, u2, u3} k V P _inst_1 _inst_2 _inst_3 S) (Set.{u3} P) (SetLike.Set.hasCoeT.{u3, u3} (AffineSubspace.{u1, u2, u3} k V P _inst_1 _inst_2 _inst_3 S) P (AffineSubspace.setLike.{u1, u2, u3} k V P _inst_1 _inst_2 _inst_3 S)))) s2)) but is expected to have type forall {k : Type.{u3}} {V : Type.{u2}} {P : Type.{u1}} [_inst_1 : Ring.{u3} k] [_inst_2 : AddCommGroup.{u2} V] [_inst_3 : Module.{u3, u2} k V (Ring.toSemiring.{u3} k _inst_1) (AddCommGroup.toAddCommMonoid.{u2} V _inst_2)] [S : AddTorsor.{u2, u1} V P (AddCommGroup.toAddGroup.{u2} V _inst_2)] (s1 : AffineSubspace.{u3, u2, u1} k V P _inst_1 _inst_2 _inst_3 S) (s2 : AffineSubspace.{u3, u2, u1} k V P _inst_1 _inst_2 _inst_3 S), Iff (LE.le.{u1} (AffineSubspace.{u3, u2, u1} k V P _inst_1 _inst_2 _inst_3 S) (Preorder.toLE.{u1} (AffineSubspace.{u3, u2, u1} k V P _inst_1 _inst_2 _inst_3 S) (PartialOrder.toPreorder.{u1} (AffineSubspace.{u3, u2, u1} k V P _inst_1 _inst_2 _inst_3 S) (OmegaCompletePartialOrder.toPartialOrder.{u1} (AffineSubspace.{u3, u2, u1} k V P _inst_1 _inst_2 _inst_3 S) (CompleteLattice.instOmegaCompletePartialOrder.{u1} (AffineSubspace.{u3, u2, u1} k V P _inst_1 _inst_2 _inst_3 S) (AffineSubspace.instCompleteLatticeAffineSubspace.{u3, u2, u1} k V P _inst_1 _inst_2 _inst_3 S))))) s1 s2) (HasSubset.Subset.{u1} (Set.{u1} P) (Set.instHasSubsetSet.{u1} P) (SetLike.coe.{u1, u1} (AffineSubspace.{u3, u2, u1} k V P _inst_1 _inst_2 _inst_3 S) P (AffineSubspace.instSetLikeAffineSubspace.{u3, u2, u1} k V P _inst_1 _inst_2 _inst_3 S) s1) (SetLike.coe.{u1, u1} (AffineSubspace.{u3, u2, u1} k V P _inst_1 _inst_2 _inst_3 S) P (AffineSubspace.instSetLikeAffineSubspace.{u3, u2, u1} k V P _inst_1 _inst_2 _inst_3 S) s2)) Case conversion may be inaccurate. Consider using '#align affine_subspace.le_def AffineSubspace.le_defₓ'. -/ /-- The `≤` order on subspaces is the same as that on the corresponding sets. -/ theorem le_def (s1 s2 : AffineSubspace k P) : s1 ≤ s2 ↔ (s1 : Set P) ⊆ s2 := Iff.rfl #align affine_subspace.le_def AffineSubspace.le_def /- warning: affine_subspace.le_def' -> AffineSubspace.le_def' is a dubious translation: lean 3 declaration is forall {k : Type.{u1}} {V : Type.{u2}} {P : Type.{u3}} [_inst_1 : Ring.{u1} k] [_inst_2 : AddCommGroup.{u2} V] [_inst_3 : Module.{u1, u2} k V (Ring.toSemiring.{u1} k _inst_1) (AddCommGroup.toAddCommMonoid.{u2} V _inst_2)] [S : AddTorsor.{u2, u3} V P (AddCommGroup.toAddGroup.{u2} V _inst_2)] (s1 : AffineSubspace.{u1, u2, u3} k V P _inst_1 _inst_2 _inst_3 S) (s2 : AffineSubspace.{u1, u2, u3} k V P _inst_1 _inst_2 _inst_3 S), Iff (LE.le.{u3} (AffineSubspace.{u1, u2, u3} k V P _inst_1 _inst_2 _inst_3 S) (Preorder.toLE.{u3} (AffineSubspace.{u1, u2, u3} k V P _inst_1 _inst_2 _inst_3 S) (PartialOrder.toPreorder.{u3} (AffineSubspace.{u1, u2, u3} k V P _inst_1 _inst_2 _inst_3 S) (SetLike.partialOrder.{u3, u3} (AffineSubspace.{u1, u2, u3} k V P _inst_1 _inst_2 _inst_3 S) P (AffineSubspace.setLike.{u1, u2, u3} k V P _inst_1 _inst_2 _inst_3 S)))) s1 s2) (forall (p : P), (Membership.Mem.{u3, u3} P (AffineSubspace.{u1, u2, u3} k V P _inst_1 _inst_2 _inst_3 S) (SetLike.hasMem.{u3, u3} (AffineSubspace.{u1, u2, u3} k V P _inst_1 _inst_2 _inst_3 S) P (AffineSubspace.setLike.{u1, u2, u3} k V P _inst_1 _inst_2 _inst_3 S)) p s1) -> (Membership.Mem.{u3, u3} P (AffineSubspace.{u1, u2, u3} k V P _inst_1 _inst_2 _inst_3 S) (SetLike.hasMem.{u3, u3} (AffineSubspace.{u1, u2, u3} k V P _inst_1 _inst_2 _inst_3 S) P (AffineSubspace.setLike.{u1, u2, u3} k V P _inst_1 _inst_2 _inst_3 S)) p s2)) but is expected to have type forall {k : Type.{u3}} {V : Type.{u2}} {P : Type.{u1}} [_inst_1 : Ring.{u3} k] [_inst_2 : AddCommGroup.{u2} V] [_inst_3 : Module.{u3, u2} k V (Ring.toSemiring.{u3} k _inst_1) (AddCommGroup.toAddCommMonoid.{u2} V _inst_2)] [S : AddTorsor.{u2, u1} V P (AddCommGroup.toAddGroup.{u2} V _inst_2)] (s1 : AffineSubspace.{u3, u2, u1} k V P _inst_1 _inst_2 _inst_3 S) (s2 : AffineSubspace.{u3, u2, u1} k V P _inst_1 _inst_2 _inst_3 S), Iff (LE.le.{u1} (AffineSubspace.{u3, u2, u1} k V P _inst_1 _inst_2 _inst_3 S) (Preorder.toLE.{u1} (AffineSubspace.{u3, u2, u1} k V P _inst_1 _inst_2 _inst_3 S) (PartialOrder.toPreorder.{u1} (AffineSubspace.{u3, u2, u1} k V P _inst_1 _inst_2 _inst_3 S) (OmegaCompletePartialOrder.toPartialOrder.{u1} (AffineSubspace.{u3, u2, u1} k V P _inst_1 _inst_2 _inst_3 S) (CompleteLattice.instOmegaCompletePartialOrder.{u1} (AffineSubspace.{u3, u2, u1} k V P _inst_1 _inst_2 _inst_3 S) (AffineSubspace.instCompleteLatticeAffineSubspace.{u3, u2, u1} k V P _inst_1 _inst_2 _inst_3 S))))) s1 s2) (forall (p : P), (Membership.mem.{u1, u1} P (AffineSubspace.{u3, u2, u1} k V P _inst_1 _inst_2 _inst_3 S) (SetLike.instMembership.{u1, u1} (AffineSubspace.{u3, u2, u1} k V P _inst_1 _inst_2 _inst_3 S) P (AffineSubspace.instSetLikeAffineSubspace.{u3, u2, u1} k V P _inst_1 _inst_2 _inst_3 S)) p s1) -> (Membership.mem.{u1, u1} P (AffineSubspace.{u3, u2, u1} k V P _inst_1 _inst_2 _inst_3 S) (SetLike.instMembership.{u1, u1} (AffineSubspace.{u3, u2, u1} k V P _inst_1 _inst_2 _inst_3 S) P (AffineSubspace.instSetLikeAffineSubspace.{u3, u2, u1} k V P _inst_1 _inst_2 _inst_3 S)) p s2)) Case conversion may be inaccurate. Consider using '#align affine_subspace.le_def' AffineSubspace.le_def'ₓ'. -/ /-- One subspace is less than or equal to another if and only if all its points are in the second subspace. -/ theorem le_def' (s1 s2 : AffineSubspace k P) : s1 ≤ s2 ↔ ∀ p ∈ s1, p ∈ s2 := Iff.rfl #align affine_subspace.le_def' AffineSubspace.le_def' /- warning: affine_subspace.lt_def -> AffineSubspace.lt_def is a dubious translation: lean 3 declaration is forall {k : Type.{u1}} {V : Type.{u2}} {P : Type.{u3}} [_inst_1 : Ring.{u1} k] [_inst_2 : AddCommGroup.{u2} V] [_inst_3 : Module.{u1, u2} k V (Ring.toSemiring.{u1} k _inst_1) (AddCommGroup.toAddCommMonoid.{u2} V _inst_2)] [S : AddTorsor.{u2, u3} V P (AddCommGroup.toAddGroup.{u2} V _inst_2)] (s1 : AffineSubspace.{u1, u2, u3} k V P _inst_1 _inst_2 _inst_3 S) (s2 : AffineSubspace.{u1, u2, u3} k V P _inst_1 _inst_2 _inst_3 S), Iff (LT.lt.{u3} (AffineSubspace.{u1, u2, u3} k V P _inst_1 _inst_2 _inst_3 S) (Preorder.toLT.{u3} (AffineSubspace.{u1, u2, u3} k V P _inst_1 _inst_2 _inst_3 S) (PartialOrder.toPreorder.{u3} (AffineSubspace.{u1, u2, u3} k V P _inst_1 _inst_2 _inst_3 S) (SetLike.partialOrder.{u3, u3} (AffineSubspace.{u1, u2, u3} k V P _inst_1 _inst_2 _inst_3 S) P (AffineSubspace.setLike.{u1, u2, u3} k V P _inst_1 _inst_2 _inst_3 S)))) s1 s2) (HasSSubset.SSubset.{u3} (Set.{u3} P) (Set.hasSsubset.{u3} P) ((fun (a : Type.{u3}) (b : Type.{u3}) [self : HasLiftT.{succ u3, succ u3} a b] => self.0) (AffineSubspace.{u1, u2, u3} k V P _inst_1 _inst_2 _inst_3 S) (Set.{u3} P) (HasLiftT.mk.{succ u3, succ u3} (AffineSubspace.{u1, u2, u3} k V P _inst_1 _inst_2 _inst_3 S) (Set.{u3} P) (CoeTCₓ.coe.{succ u3, succ u3} (AffineSubspace.{u1, u2, u3} k V P _inst_1 _inst_2 _inst_3 S) (Set.{u3} P) (SetLike.Set.hasCoeT.{u3, u3} (AffineSubspace.{u1, u2, u3} k V P _inst_1 _inst_2 _inst_3 S) P (AffineSubspace.setLike.{u1, u2, u3} k V P _inst_1 _inst_2 _inst_3 S)))) s1) ((fun (a : Type.{u3}) (b : Type.{u3}) [self : HasLiftT.{succ u3, succ u3} a b] => self.0) (AffineSubspace.{u1, u2, u3} k V P _inst_1 _inst_2 _inst_3 S) (Set.{u3} P) (HasLiftT.mk.{succ u3, succ u3} (AffineSubspace.{u1, u2, u3} k V P _inst_1 _inst_2 _inst_3 S) (Set.{u3} P) (CoeTCₓ.coe.{succ u3, succ u3} (AffineSubspace.{u1, u2, u3} k V P _inst_1 _inst_2 _inst_3 S) (Set.{u3} P) (SetLike.Set.hasCoeT.{u3, u3} (AffineSubspace.{u1, u2, u3} k V P _inst_1 _inst_2 _inst_3 S) P (AffineSubspace.setLike.{u1, u2, u3} k V P _inst_1 _inst_2 _inst_3 S)))) s2)) but is expected to have type forall {k : Type.{u3}} {V : Type.{u2}} {P : Type.{u1}} [_inst_1 : Ring.{u3} k] [_inst_2 : AddCommGroup.{u2} V] [_inst_3 : Module.{u3, u2} k V (Ring.toSemiring.{u3} k _inst_1) (AddCommGroup.toAddCommMonoid.{u2} V _inst_2)] [S : AddTorsor.{u2, u1} V P (AddCommGroup.toAddGroup.{u2} V _inst_2)] (s1 : AffineSubspace.{u3, u2, u1} k V P _inst_1 _inst_2 _inst_3 S) (s2 : AffineSubspace.{u3, u2, u1} k V P _inst_1 _inst_2 _inst_3 S), Iff (LT.lt.{u1} (AffineSubspace.{u3, u2, u1} k V P _inst_1 _inst_2 _inst_3 S) (Preorder.toLT.{u1} (AffineSubspace.{u3, u2, u1} k V P _inst_1 _inst_2 _inst_3 S) (PartialOrder.toPreorder.{u1} (AffineSubspace.{u3, u2, u1} k V P _inst_1 _inst_2 _inst_3 S) (OmegaCompletePartialOrder.toPartialOrder.{u1} (AffineSubspace.{u3, u2, u1} k V P _inst_1 _inst_2 _inst_3 S) (CompleteLattice.instOmegaCompletePartialOrder.{u1} (AffineSubspace.{u3, u2, u1} k V P _inst_1 _inst_2 _inst_3 S) (AffineSubspace.instCompleteLatticeAffineSubspace.{u3, u2, u1} k V P _inst_1 _inst_2 _inst_3 S))))) s1 s2) (HasSSubset.SSubset.{u1} (Set.{u1} P) (Set.instHasSSubsetSet.{u1} P) (SetLike.coe.{u1, u1} (AffineSubspace.{u3, u2, u1} k V P _inst_1 _inst_2 _inst_3 S) P (AffineSubspace.instSetLikeAffineSubspace.{u3, u2, u1} k V P _inst_1 _inst_2 _inst_3 S) s1) (SetLike.coe.{u1, u1} (AffineSubspace.{u3, u2, u1} k V P _inst_1 _inst_2 _inst_3 S) P (AffineSubspace.instSetLikeAffineSubspace.{u3, u2, u1} k V P _inst_1 _inst_2 _inst_3 S) s2)) Case conversion may be inaccurate. Consider using '#align affine_subspace.lt_def AffineSubspace.lt_defₓ'. -/ /-- The `<` order on subspaces is the same as that on the corresponding sets. -/ theorem lt_def (s1 s2 : AffineSubspace k P) : s1 < s2 ↔ (s1 : Set P) ⊂ s2 := Iff.rfl #align affine_subspace.lt_def AffineSubspace.lt_def /- warning: affine_subspace.not_le_iff_exists -> AffineSubspace.not_le_iff_exists is a dubious translation: lean 3 declaration is forall {k : Type.{u1}} {V : Type.{u2}} {P : Type.{u3}} [_inst_1 : Ring.{u1} k] [_inst_2 : AddCommGroup.{u2} V] [_inst_3 : Module.{u1, u2} k V (Ring.toSemiring.{u1} k _inst_1) (AddCommGroup.toAddCommMonoid.{u2} V _inst_2)] [S : AddTorsor.{u2, u3} V P (AddCommGroup.toAddGroup.{u2} V _inst_2)] (s1 : AffineSubspace.{u1, u2, u3} k V P _inst_1 _inst_2 _inst_3 S) (s2 : AffineSubspace.{u1, u2, u3} k V P _inst_1 _inst_2 _inst_3 S), Iff (Not (LE.le.{u3} (AffineSubspace.{u1, u2, u3} k V P _inst_1 _inst_2 _inst_3 S) (Preorder.toLE.{u3} (AffineSubspace.{u1, u2, u3} k V P _inst_1 _inst_2 _inst_3 S) (PartialOrder.toPreorder.{u3} (AffineSubspace.{u1, u2, u3} k V P _inst_1 _inst_2 _inst_3 S) (SetLike.partialOrder.{u3, u3} (AffineSubspace.{u1, u2, u3} k V P _inst_1 _inst_2 _inst_3 S) P (AffineSubspace.setLike.{u1, u2, u3} k V P _inst_1 _inst_2 _inst_3 S)))) s1 s2)) (Exists.{succ u3} P (fun (p : P) => Exists.{0} (Membership.Mem.{u3, u3} P (AffineSubspace.{u1, u2, u3} k V P _inst_1 _inst_2 _inst_3 S) (SetLike.hasMem.{u3, u3} (AffineSubspace.{u1, u2, u3} k V P _inst_1 _inst_2 _inst_3 S) P (AffineSubspace.setLike.{u1, u2, u3} k V P _inst_1 _inst_2 _inst_3 S)) p s1) (fun (H : Membership.Mem.{u3, u3} P (AffineSubspace.{u1, u2, u3} k V P _inst_1 _inst_2 _inst_3 S) (SetLike.hasMem.{u3, u3} (AffineSubspace.{u1, u2, u3} k V P _inst_1 _inst_2 _inst_3 S) P (AffineSubspace.setLike.{u1, u2, u3} k V P _inst_1 _inst_2 _inst_3 S)) p s1) => Not (Membership.Mem.{u3, u3} P (AffineSubspace.{u1, u2, u3} k V P _inst_1 _inst_2 _inst_3 S) (SetLike.hasMem.{u3, u3} (AffineSubspace.{u1, u2, u3} k V P _inst_1 _inst_2 _inst_3 S) P (AffineSubspace.setLike.{u1, u2, u3} k V P _inst_1 _inst_2 _inst_3 S)) p s2)))) but is expected to have type forall {k : Type.{u3}} {V : Type.{u2}} {P : Type.{u1}} [_inst_1 : Ring.{u3} k] [_inst_2 : AddCommGroup.{u2} V] [_inst_3 : Module.{u3, u2} k V (Ring.toSemiring.{u3} k _inst_1) (AddCommGroup.toAddCommMonoid.{u2} V _inst_2)] [S : AddTorsor.{u2, u1} V P (AddCommGroup.toAddGroup.{u2} V _inst_2)] (s1 : AffineSubspace.{u3, u2, u1} k V P _inst_1 _inst_2 _inst_3 S) (s2 : AffineSubspace.{u3, u2, u1} k V P _inst_1 _inst_2 _inst_3 S), Iff (Not (LE.le.{u1} (AffineSubspace.{u3, u2, u1} k V P _inst_1 _inst_2 _inst_3 S) (Preorder.toLE.{u1} (AffineSubspace.{u3, u2, u1} k V P _inst_1 _inst_2 _inst_3 S) (PartialOrder.toPreorder.{u1} (AffineSubspace.{u3, u2, u1} k V P _inst_1 _inst_2 _inst_3 S) (OmegaCompletePartialOrder.toPartialOrder.{u1} (AffineSubspace.{u3, u2, u1} k V P _inst_1 _inst_2 _inst_3 S) (CompleteLattice.instOmegaCompletePartialOrder.{u1} (AffineSubspace.{u3, u2, u1} k V P _inst_1 _inst_2 _inst_3 S) (AffineSubspace.instCompleteLatticeAffineSubspace.{u3, u2, u1} k V P _inst_1 _inst_2 _inst_3 S))))) s1 s2)) (Exists.{succ u1} P (fun (p : P) => And (Membership.mem.{u1, u1} P (AffineSubspace.{u3, u2, u1} k V P _inst_1 _inst_2 _inst_3 S) (SetLike.instMembership.{u1, u1} (AffineSubspace.{u3, u2, u1} k V P _inst_1 _inst_2 _inst_3 S) P (AffineSubspace.instSetLikeAffineSubspace.{u3, u2, u1} k V P _inst_1 _inst_2 _inst_3 S)) p s1) (Not (Membership.mem.{u1, u1} P (AffineSubspace.{u3, u2, u1} k V P _inst_1 _inst_2 _inst_3 S) (SetLike.instMembership.{u1, u1} (AffineSubspace.{u3, u2, u1} k V P _inst_1 _inst_2 _inst_3 S) P (AffineSubspace.instSetLikeAffineSubspace.{u3, u2, u1} k V P _inst_1 _inst_2 _inst_3 S)) p s2)))) Case conversion may be inaccurate. Consider using '#align affine_subspace.not_le_iff_exists AffineSubspace.not_le_iff_existsₓ'. -/ /-- One subspace is not less than or equal to another if and only if it has a point not in the second subspace. -/ theorem not_le_iff_exists (s1 s2 : AffineSubspace k P) : ¬s1 ≤ s2 ↔ ∃ p ∈ s1, p ∉ s2 := Set.not_subset #align affine_subspace.not_le_iff_exists AffineSubspace.not_le_iff_exists /- warning: affine_subspace.exists_of_lt -> AffineSubspace.exists_of_lt is a dubious translation: lean 3 declaration is forall {k : Type.{u1}} {V : Type.{u2}} {P : Type.{u3}} [_inst_1 : Ring.{u1} k] [_inst_2 : AddCommGroup.{u2} V] [_inst_3 : Module.{u1, u2} k V (Ring.toSemiring.{u1} k _inst_1) (AddCommGroup.toAddCommMonoid.{u2} V _inst_2)] [S : AddTorsor.{u2, u3} V P (AddCommGroup.toAddGroup.{u2} V _inst_2)] {s1 : AffineSubspace.{u1, u2, u3} k V P _inst_1 _inst_2 _inst_3 S} {s2 : AffineSubspace.{u1, u2, u3} k V P _inst_1 _inst_2 _inst_3 S}, (LT.lt.{u3} (AffineSubspace.{u1, u2, u3} k V P _inst_1 _inst_2 _inst_3 S) (Preorder.toLT.{u3} (AffineSubspace.{u1, u2, u3} k V P _inst_1 _inst_2 _inst_3 S) (PartialOrder.toPreorder.{u3} (AffineSubspace.{u1, u2, u3} k V P _inst_1 _inst_2 _inst_3 S) (SetLike.partialOrder.{u3, u3} (AffineSubspace.{u1, u2, u3} k V P _inst_1 _inst_2 _inst_3 S) P (AffineSubspace.setLike.{u1, u2, u3} k V P _inst_1 _inst_2 _inst_3 S)))) s1 s2) -> (Exists.{succ u3} P (fun (p : P) => Exists.{0} (Membership.Mem.{u3, u3} P (AffineSubspace.{u1, u2, u3} k V P _inst_1 _inst_2 _inst_3 S) (SetLike.hasMem.{u3, u3} (AffineSubspace.{u1, u2, u3} k V P _inst_1 _inst_2 _inst_3 S) P (AffineSubspace.setLike.{u1, u2, u3} k V P _inst_1 _inst_2 _inst_3 S)) p s2) (fun (H : Membership.Mem.{u3, u3} P (AffineSubspace.{u1, u2, u3} k V P _inst_1 _inst_2 _inst_3 S) (SetLike.hasMem.{u3, u3} (AffineSubspace.{u1, u2, u3} k V P _inst_1 _inst_2 _inst_3 S) P (AffineSubspace.setLike.{u1, u2, u3} k V P _inst_1 _inst_2 _inst_3 S)) p s2) => Not (Membership.Mem.{u3, u3} P (AffineSubspace.{u1, u2, u3} k V P _inst_1 _inst_2 _inst_3 S) (SetLike.hasMem.{u3, u3} (AffineSubspace.{u1, u2, u3} k V P _inst_1 _inst_2 _inst_3 S) P (AffineSubspace.setLike.{u1, u2, u3} k V P _inst_1 _inst_2 _inst_3 S)) p s1)))) but is expected to have type forall {k : Type.{u3}} {V : Type.{u2}} {P : Type.{u1}} [_inst_1 : Ring.{u3} k] [_inst_2 : AddCommGroup.{u2} V] [_inst_3 : Module.{u3, u2} k V (Ring.toSemiring.{u3} k _inst_1) (AddCommGroup.toAddCommMonoid.{u2} V _inst_2)] [S : AddTorsor.{u2, u1} V P (AddCommGroup.toAddGroup.{u2} V _inst_2)] {s1 : AffineSubspace.{u3, u2, u1} k V P _inst_1 _inst_2 _inst_3 S} {s2 : AffineSubspace.{u3, u2, u1} k V P _inst_1 _inst_2 _inst_3 S}, (LT.lt.{u1} (AffineSubspace.{u3, u2, u1} k V P _inst_1 _inst_2 _inst_3 S) (Preorder.toLT.{u1} (AffineSubspace.{u3, u2, u1} k V P _inst_1 _inst_2 _inst_3 S) (PartialOrder.toPreorder.{u1} (AffineSubspace.{u3, u2, u1} k V P _inst_1 _inst_2 _inst_3 S) (OmegaCompletePartialOrder.toPartialOrder.{u1} (AffineSubspace.{u3, u2, u1} k V P _inst_1 _inst_2 _inst_3 S) (CompleteLattice.instOmegaCompletePartialOrder.{u1} (AffineSubspace.{u3, u2, u1} k V P _inst_1 _inst_2 _inst_3 S) (AffineSubspace.instCompleteLatticeAffineSubspace.{u3, u2, u1} k V P _inst_1 _inst_2 _inst_3 S))))) s1 s2) -> (Exists.{succ u1} P (fun (p : P) => And (Membership.mem.{u1, u1} P (AffineSubspace.{u3, u2, u1} k V P _inst_1 _inst_2 _inst_3 S) (SetLike.instMembership.{u1, u1} (AffineSubspace.{u3, u2, u1} k V P _inst_1 _inst_2 _inst_3 S) P (AffineSubspace.instSetLikeAffineSubspace.{u3, u2, u1} k V P _inst_1 _inst_2 _inst_3 S)) p s2) (Not (Membership.mem.{u1, u1} P (AffineSubspace.{u3, u2, u1} k V P _inst_1 _inst_2 _inst_3 S) (SetLike.instMembership.{u1, u1} (AffineSubspace.{u3, u2, u1} k V P _inst_1 _inst_2 _inst_3 S) P (AffineSubspace.instSetLikeAffineSubspace.{u3, u2, u1} k V P _inst_1 _inst_2 _inst_3 S)) p s1)))) Case conversion may be inaccurate. Consider using '#align affine_subspace.exists_of_lt AffineSubspace.exists_of_ltₓ'. -/ /-- If a subspace is less than another, there is a point only in the second. -/ theorem exists_of_lt {s1 s2 : AffineSubspace k P} (h : s1 < s2) : ∃ p ∈ s2, p ∉ s1 := Set.exists_of_ssubset h #align affine_subspace.exists_of_lt AffineSubspace.exists_of_lt /- warning: affine_subspace.lt_iff_le_and_exists -> AffineSubspace.lt_iff_le_and_exists is a dubious translation: lean 3 declaration is forall {k : Type.{u1}} {V : Type.{u2}} {P : Type.{u3}} [_inst_1 : Ring.{u1} k] [_inst_2 : AddCommGroup.{u2} V] [_inst_3 : Module.{u1, u2} k V (Ring.toSemiring.{u1} k _inst_1) (AddCommGroup.toAddCommMonoid.{u2} V _inst_2)] [S : AddTorsor.{u2, u3} V P (AddCommGroup.toAddGroup.{u2} V _inst_2)] (s1 : AffineSubspace.{u1, u2, u3} k V P _inst_1 _inst_2 _inst_3 S) (s2 : AffineSubspace.{u1, u2, u3} k V P _inst_1 _inst_2 _inst_3 S), Iff (LT.lt.{u3} (AffineSubspace.{u1, u2, u3} k V P _inst_1 _inst_2 _inst_3 S) (Preorder.toLT.{u3} (AffineSubspace.{u1, u2, u3} k V P _inst_1 _inst_2 _inst_3 S) (PartialOrder.toPreorder.{u3} (AffineSubspace.{u1, u2, u3} k V P _inst_1 _inst_2 _inst_3 S) (SetLike.partialOrder.{u3, u3} (AffineSubspace.{u1, u2, u3} k V P _inst_1 _inst_2 _inst_3 S) P (AffineSubspace.setLike.{u1, u2, u3} k V P _inst_1 _inst_2 _inst_3 S)))) s1 s2) (And (LE.le.{u3} (AffineSubspace.{u1, u2, u3} k V P _inst_1 _inst_2 _inst_3 S) (Preorder.toLE.{u3} (AffineSubspace.{u1, u2, u3} k V P _inst_1 _inst_2 _inst_3 S) (PartialOrder.toPreorder.{u3} (AffineSubspace.{u1, u2, u3} k V P _inst_1 _inst_2 _inst_3 S) (SetLike.partialOrder.{u3, u3} (AffineSubspace.{u1, u2, u3} k V P _inst_1 _inst_2 _inst_3 S) P (AffineSubspace.setLike.{u1, u2, u3} k V P _inst_1 _inst_2 _inst_3 S)))) s1 s2) (Exists.{succ u3} P (fun (p : P) => Exists.{0} (Membership.Mem.{u3, u3} P (AffineSubspace.{u1, u2, u3} k V P _inst_1 _inst_2 _inst_3 S) (SetLike.hasMem.{u3, u3} (AffineSubspace.{u1, u2, u3} k V P _inst_1 _inst_2 _inst_3 S) P (AffineSubspace.setLike.{u1, u2, u3} k V P _inst_1 _inst_2 _inst_3 S)) p s2) (fun (H : Membership.Mem.{u3, u3} P (AffineSubspace.{u1, u2, u3} k V P _inst_1 _inst_2 _inst_3 S) (SetLike.hasMem.{u3, u3} (AffineSubspace.{u1, u2, u3} k V P _inst_1 _inst_2 _inst_3 S) P (AffineSubspace.setLike.{u1, u2, u3} k V P _inst_1 _inst_2 _inst_3 S)) p s2) => Not (Membership.Mem.{u3, u3} P (AffineSubspace.{u1, u2, u3} k V P _inst_1 _inst_2 _inst_3 S) (SetLike.hasMem.{u3, u3} (AffineSubspace.{u1, u2, u3} k V P _inst_1 _inst_2 _inst_3 S) P (AffineSubspace.setLike.{u1, u2, u3} k V P _inst_1 _inst_2 _inst_3 S)) p s1))))) but is expected to have type forall {k : Type.{u3}} {V : Type.{u2}} {P : Type.{u1}} [_inst_1 : Ring.{u3} k] [_inst_2 : AddCommGroup.{u2} V] [_inst_3 : Module.{u3, u2} k V (Ring.toSemiring.{u3} k _inst_1) (AddCommGroup.toAddCommMonoid.{u2} V _inst_2)] [S : AddTorsor.{u2, u1} V P (AddCommGroup.toAddGroup.{u2} V _inst_2)] (s1 : AffineSubspace.{u3, u2, u1} k V P _inst_1 _inst_2 _inst_3 S) (s2 : AffineSubspace.{u3, u2, u1} k V P _inst_1 _inst_2 _inst_3 S), Iff (LT.lt.{u1} (AffineSubspace.{u3, u2, u1} k V P _inst_1 _inst_2 _inst_3 S) (Preorder.toLT.{u1} (AffineSubspace.{u3, u2, u1} k V P _inst_1 _inst_2 _inst_3 S) (PartialOrder.toPreorder.{u1} (AffineSubspace.{u3, u2, u1} k V P _inst_1 _inst_2 _inst_3 S) (OmegaCompletePartialOrder.toPartialOrder.{u1} (AffineSubspace.{u3, u2, u1} k V P _inst_1 _inst_2 _inst_3 S) (CompleteLattice.instOmegaCompletePartialOrder.{u1} (AffineSubspace.{u3, u2, u1} k V P _inst_1 _inst_2 _inst_3 S) (AffineSubspace.instCompleteLatticeAffineSubspace.{u3, u2, u1} k V P _inst_1 _inst_2 _inst_3 S))))) s1 s2) (And (LE.le.{u1} (AffineSubspace.{u3, u2, u1} k V P _inst_1 _inst_2 _inst_3 S) (Preorder.toLE.{u1} (AffineSubspace.{u3, u2, u1} k V P _inst_1 _inst_2 _inst_3 S) (PartialOrder.toPreorder.{u1} (AffineSubspace.{u3, u2, u1} k V P _inst_1 _inst_2 _inst_3 S) (OmegaCompletePartialOrder.toPartialOrder.{u1} (AffineSubspace.{u3, u2, u1} k V P _inst_1 _inst_2 _inst_3 S) (CompleteLattice.instOmegaCompletePartialOrder.{u1} (AffineSubspace.{u3, u2, u1} k V P _inst_1 _inst_2 _inst_3 S) (AffineSubspace.instCompleteLatticeAffineSubspace.{u3, u2, u1} k V P _inst_1 _inst_2 _inst_3 S))))) s1 s2) (Exists.{succ u1} P (fun (p : P) => And (Membership.mem.{u1, u1} P (AffineSubspace.{u3, u2, u1} k V P _inst_1 _inst_2 _inst_3 S) (SetLike.instMembership.{u1, u1} (AffineSubspace.{u3, u2, u1} k V P _inst_1 _inst_2 _inst_3 S) P (AffineSubspace.instSetLikeAffineSubspace.{u3, u2, u1} k V P _inst_1 _inst_2 _inst_3 S)) p s2) (Not (Membership.mem.{u1, u1} P (AffineSubspace.{u3, u2, u1} k V P _inst_1 _inst_2 _inst_3 S) (SetLike.instMembership.{u1, u1} (AffineSubspace.{u3, u2, u1} k V P _inst_1 _inst_2 _inst_3 S) P (AffineSubspace.instSetLikeAffineSubspace.{u3, u2, u1} k V P _inst_1 _inst_2 _inst_3 S)) p s1))))) Case conversion may be inaccurate. Consider using '#align affine_subspace.lt_iff_le_and_exists AffineSubspace.lt_iff_le_and_existsₓ'. -/ /-- A subspace is less than another if and only if it is less than or equal to the second subspace and there is a point only in the second. -/ theorem lt_iff_le_and_exists (s1 s2 : AffineSubspace k P) : s1 < s2 ↔ s1 ≤ s2 ∧ ∃ p ∈ s2, p ∉ s1 := by rw [lt_iff_le_not_le, not_le_iff_exists] #align affine_subspace.lt_iff_le_and_exists AffineSubspace.lt_iff_le_and_exists /- warning: affine_subspace.eq_of_direction_eq_of_nonempty_of_le -> AffineSubspace.eq_of_direction_eq_of_nonempty_of_le is a dubious translation: lean 3 declaration is forall {k : Type.{u1}} {V : Type.{u2}} {P : Type.{u3}} [_inst_1 : Ring.{u1} k] [_inst_2 : AddCommGroup.{u2} V] [_inst_3 : Module.{u1, u2} k V (Ring.toSemiring.{u1} k _inst_1) (AddCommGroup.toAddCommMonoid.{u2} V _inst_2)] [S : AddTorsor.{u2, u3} V P (AddCommGroup.toAddGroup.{u2} V _inst_2)] {s₁ : AffineSubspace.{u1, u2, u3} k V P _inst_1 _inst_2 _inst_3 S} {s₂ : AffineSubspace.{u1, u2, u3} k V P _inst_1 _inst_2 _inst_3 S}, (Eq.{succ u2} (Submodule.{u1, u2} k V (Ring.toSemiring.{u1} k _inst_1) (AddCommGroup.toAddCommMonoid.{u2} V _inst_2) _inst_3) (AffineSubspace.direction.{u1, u2, u3} k V P _inst_1 _inst_2 _inst_3 S s₁) (AffineSubspace.direction.{u1, u2, u3} k V P _inst_1 _inst_2 _inst_3 S s₂)) -> (Set.Nonempty.{u3} P ((fun (a : Type.{u3}) (b : Type.{u3}) [self : HasLiftT.{succ u3, succ u3} a b] => self.0) (AffineSubspace.{u1, u2, u3} k V P _inst_1 _inst_2 _inst_3 S) (Set.{u3} P) (HasLiftT.mk.{succ u3, succ u3} (AffineSubspace.{u1, u2, u3} k V P _inst_1 _inst_2 _inst_3 S) (Set.{u3} P) (CoeTCₓ.coe.{succ u3, succ u3} (AffineSubspace.{u1, u2, u3} k V P _inst_1 _inst_2 _inst_3 S) (Set.{u3} P) (SetLike.Set.hasCoeT.{u3, u3} (AffineSubspace.{u1, u2, u3} k V P _inst_1 _inst_2 _inst_3 S) P (AffineSubspace.setLike.{u1, u2, u3} k V P _inst_1 _inst_2 _inst_3 S)))) s₁)) -> (LE.le.{u3} (AffineSubspace.{u1, u2, u3} k V P _inst_1 _inst_2 _inst_3 S) (Preorder.toLE.{u3} (AffineSubspace.{u1, u2, u3} k V P _inst_1 _inst_2 _inst_3 S) (PartialOrder.toPreorder.{u3} (AffineSubspace.{u1, u2, u3} k V P _inst_1 _inst_2 _inst_3 S) (SetLike.partialOrder.{u3, u3} (AffineSubspace.{u1, u2, u3} k V P _inst_1 _inst_2 _inst_3 S) P (AffineSubspace.setLike.{u1, u2, u3} k V P _inst_1 _inst_2 _inst_3 S)))) s₁ s₂) -> (Eq.{succ u3} (AffineSubspace.{u1, u2, u3} k V P _inst_1 _inst_2 _inst_3 S) s₁ s₂) but is expected to have type forall {k : Type.{u3}} {V : Type.{u2}} {P : Type.{u1}} [_inst_1 : Ring.{u3} k] [_inst_2 : AddCommGroup.{u2} V] [_inst_3 : Module.{u3, u2} k V (Ring.toSemiring.{u3} k _inst_1) (AddCommGroup.toAddCommMonoid.{u2} V _inst_2)] [S : AddTorsor.{u2, u1} V P (AddCommGroup.toAddGroup.{u2} V _inst_2)] {s₁ : AffineSubspace.{u3, u2, u1} k V P _inst_1 _inst_2 _inst_3 S} {s₂ : AffineSubspace.{u3, u2, u1} k V P _inst_1 _inst_2 _inst_3 S}, (Eq.{succ u2} (Submodule.{u3, u2} k V (Ring.toSemiring.{u3} k _inst_1) (AddCommGroup.toAddCommMonoid.{u2} V _inst_2) _inst_3) (AffineSubspace.direction.{u3, u2, u1} k V P _inst_1 _inst_2 _inst_3 S s₁) (AffineSubspace.direction.{u3, u2, u1} k V P _inst_1 _inst_2 _inst_3 S s₂)) -> (Set.Nonempty.{u1} P (SetLike.coe.{u1, u1} (AffineSubspace.{u3, u2, u1} k V P _inst_1 _inst_2 _inst_3 S) P (AffineSubspace.instSetLikeAffineSubspace.{u3, u2, u1} k V P _inst_1 _inst_2 _inst_3 S) s₁)) -> (LE.le.{u1} (AffineSubspace.{u3, u2, u1} k V P _inst_1 _inst_2 _inst_3 S) (Preorder.toLE.{u1} (AffineSubspace.{u3, u2, u1} k V P _inst_1 _inst_2 _inst_3 S) (PartialOrder.toPreorder.{u1} (AffineSubspace.{u3, u2, u1} k V P _inst_1 _inst_2 _inst_3 S) (OmegaCompletePartialOrder.toPartialOrder.{u1} (AffineSubspace.{u3, u2, u1} k V P _inst_1 _inst_2 _inst_3 S) (CompleteLattice.instOmegaCompletePartialOrder.{u1} (AffineSubspace.{u3, u2, u1} k V P _inst_1 _inst_2 _inst_3 S) (AffineSubspace.instCompleteLatticeAffineSubspace.{u3, u2, u1} k V P _inst_1 _inst_2 _inst_3 S))))) s₁ s₂) -> (Eq.{succ u1} (AffineSubspace.{u3, u2, u1} k V P _inst_1 _inst_2 _inst_3 S) s₁ s₂) Case conversion may be inaccurate. Consider using '#align affine_subspace.eq_of_direction_eq_of_nonempty_of_le AffineSubspace.eq_of_direction_eq_of_nonempty_of_leₓ'. -/ /-- If an affine subspace is nonempty and contained in another with the same direction, they are equal. -/ theorem eq_of_direction_eq_of_nonempty_of_le {s₁ s₂ : AffineSubspace k P} (hd : s₁.direction = s₂.direction) (hn : (s₁ : Set P).Nonempty) (hle : s₁ ≤ s₂) : s₁ = s₂ := let ⟨p, hp⟩ := hn ext_of_direction_eq hd ⟨p, hp, hle hp⟩ #align affine_subspace.eq_of_direction_eq_of_nonempty_of_le AffineSubspace.eq_of_direction_eq_of_nonempty_of_le variable (k V) /- warning: affine_subspace.affine_span_eq_Inf -> AffineSubspace.affineSpan_eq_infₛ is a dubious translation: lean 3 declaration is forall (k : Type.{u1}) (V : Type.{u2}) {P : Type.{u3}} [_inst_1 : Ring.{u1} k] [_inst_2 : AddCommGroup.{u2} V] [_inst_3 : Module.{u1, u2} k V (Ring.toSemiring.{u1} k _inst_1) (AddCommGroup.toAddCommMonoid.{u2} V _inst_2)] [S : AddTorsor.{u2, u3} V P (AddCommGroup.toAddGroup.{u2} V _inst_2)] (s : Set.{u3} P), Eq.{succ u3} (AffineSubspace.{u1, u2, u3} k V P _inst_1 _inst_2 _inst_3 S) (affineSpan.{u1, u2, u3} k V P _inst_1 _inst_2 _inst_3 S s) (InfSet.infₛ.{u3} (AffineSubspace.{u1, u2, u3} k V P _inst_1 _inst_2 _inst_3 S) (ConditionallyCompleteLattice.toHasInf.{u3} (AffineSubspace.{u1, u2, u3} k V P _inst_1 _inst_2 _inst_3 S) (CompleteLattice.toConditionallyCompleteLattice.{u3} (AffineSubspace.{u1, u2, u3} k V P _inst_1 _inst_2 _inst_3 S) (AffineSubspace.completeLattice.{u1, u2, u3} k V P _inst_1 _inst_2 _inst_3 S))) (setOf.{u3} (AffineSubspace.{u1, u2, u3} k V P _inst_1 _inst_2 _inst_3 S) (fun (s' : AffineSubspace.{u1, u2, u3} k V P _inst_1 _inst_2 _inst_3 S) => HasSubset.Subset.{u3} (Set.{u3} P) (Set.hasSubset.{u3} P) s ((fun (a : Type.{u3}) (b : Type.{u3}) [self : HasLiftT.{succ u3, succ u3} a b] => self.0) (AffineSubspace.{u1, u2, u3} k V P _inst_1 _inst_2 _inst_3 S) (Set.{u3} P) (HasLiftT.mk.{succ u3, succ u3} (AffineSubspace.{u1, u2, u3} k V P _inst_1 _inst_2 _inst_3 S) (Set.{u3} P) (CoeTCₓ.coe.{succ u3, succ u3} (AffineSubspace.{u1, u2, u3} k V P _inst_1 _inst_2 _inst_3 S) (Set.{u3} P) (SetLike.Set.hasCoeT.{u3, u3} (AffineSubspace.{u1, u2, u3} k V P _inst_1 _inst_2 _inst_3 S) P (AffineSubspace.setLike.{u1, u2, u3} k V P _inst_1 _inst_2 _inst_3 S)))) s')))) but is expected to have type forall (k : Type.{u2}) (V : Type.{u1}) {P : Type.{u3}} [_inst_1 : Ring.{u2} k] [_inst_2 : AddCommGroup.{u1} V] [_inst_3 : Module.{u2, u1} k V (Ring.toSemiring.{u2} k _inst_1) (AddCommGroup.toAddCommMonoid.{u1} V _inst_2)] [S : AddTorsor.{u1, u3} V P (AddCommGroup.toAddGroup.{u1} V _inst_2)] (s : Set.{u3} P), Eq.{succ u3} (AffineSubspace.{u2, u1, u3} k V P _inst_1 _inst_2 _inst_3 S) (affineSpan.{u2, u1, u3} k V P _inst_1 _inst_2 _inst_3 S s) (InfSet.infₛ.{u3} (AffineSubspace.{u2, u1, u3} k V P _inst_1 _inst_2 _inst_3 S) (ConditionallyCompleteLattice.toInfSet.{u3} (AffineSubspace.{u2, u1, u3} k V P _inst_1 _inst_2 _inst_3 S) (CompleteLattice.toConditionallyCompleteLattice.{u3} (AffineSubspace.{u2, u1, u3} k V P _inst_1 _inst_2 _inst_3 S) (AffineSubspace.instCompleteLatticeAffineSubspace.{u2, u1, u3} k V P _inst_1 _inst_2 _inst_3 S))) (setOf.{u3} (AffineSubspace.{u2, u1, u3} k V P _inst_1 _inst_2 _inst_3 S) (fun (s' : AffineSubspace.{u2, u1, u3} k V P _inst_1 _inst_2 _inst_3 S) => HasSubset.Subset.{u3} (Set.{u3} P) (Set.instHasSubsetSet.{u3} P) s (SetLike.coe.{u3, u3} (AffineSubspace.{u2, u1, u3} k V P _inst_1 _inst_2 _inst_3 S) P (AffineSubspace.instSetLikeAffineSubspace.{u2, u1, u3} k V P _inst_1 _inst_2 _inst_3 S) s')))) Case conversion may be inaccurate. Consider using '#align affine_subspace.affine_span_eq_Inf AffineSubspace.affineSpan_eq_infₛₓ'. -/ /-- The affine span is the `Inf` of subspaces containing the given points. -/ theorem affineSpan_eq_infₛ (s : Set P) : affineSpan k s = infₛ { s' | s ⊆ s' } := le_antisymm (spanPoints_subset_coe_of_subset_coe <| Set.subset_interᵢ₂ fun _ => id) (infₛ_le (subset_spanPoints k _)) #align affine_subspace.affine_span_eq_Inf AffineSubspace.affineSpan_eq_infₛ variable (P) /- warning: affine_subspace.gi -> AffineSubspace.gi is a dubious translation: lean 3 declaration is forall (k : Type.{u1}) (V : Type.{u2}) (P : Type.{u3}) [_inst_1 : Ring.{u1} k] [_inst_2 : AddCommGroup.{u2} V] [_inst_3 : Module.{u1, u2} k V (Ring.toSemiring.{u1} k _inst_1) (AddCommGroup.toAddCommMonoid.{u2} V _inst_2)] [S : AddTorsor.{u2, u3} V P (AddCommGroup.toAddGroup.{u2} V _inst_2)], GaloisInsertion.{u3, u3} (Set.{u3} P) (AffineSubspace.{u1, u2, u3} k V P _inst_1 _inst_2 _inst_3 S) (PartialOrder.toPreorder.{u3} (Set.{u3} P) (CompleteSemilatticeInf.toPartialOrder.{u3} (Set.{u3} P) (CompleteLattice.toCompleteSemilatticeInf.{u3} (Set.{u3} P) (Order.Coframe.toCompleteLattice.{u3} (Set.{u3} P) (CompleteDistribLattice.toCoframe.{u3} (Set.{u3} P) (CompleteBooleanAlgebra.toCompleteDistribLattice.{u3} (Set.{u3} P) (Set.completeBooleanAlgebra.{u3} P))))))) (PartialOrder.toPreorder.{u3} (AffineSubspace.{u1, u2, u3} k V P _inst_1 _inst_2 _inst_3 S) (SetLike.partialOrder.{u3, u3} (AffineSubspace.{u1, u2, u3} k V P _inst_1 _inst_2 _inst_3 S) P (AffineSubspace.setLike.{u1, u2, u3} k V P _inst_1 _inst_2 _inst_3 S))) (affineSpan.{u1, u2, u3} k V P _inst_1 _inst_2 _inst_3 S) ((fun (a : Type.{u3}) (b : Type.{u3}) [self : HasLiftT.{succ u3, succ u3} a b] => self.0) (AffineSubspace.{u1, u2, u3} k V P _inst_1 _inst_2 _inst_3 S) (Set.{u3} P) (HasLiftT.mk.{succ u3, succ u3} (AffineSubspace.{u1, u2, u3} k V P _inst_1 _inst_2 _inst_3 S) (Set.{u3} P) (CoeTCₓ.coe.{succ u3, succ u3} (AffineSubspace.{u1, u2, u3} k V P _inst_1 _inst_2 _inst_3 S) (Set.{u3} P) (SetLike.Set.hasCoeT.{u3, u3} (AffineSubspace.{u1, u2, u3} k V P _inst_1 _inst_2 _inst_3 S) P (AffineSubspace.setLike.{u1, u2, u3} k V P _inst_1 _inst_2 _inst_3 S))))) but is expected to have type forall (k : Type.{u1}) (V : Type.{u2}) (P : Type.{u3}) [_inst_1 : Ring.{u1} k] [_inst_2 : AddCommGroup.{u2} V] [_inst_3 : Module.{u1, u2} k V (Ring.toSemiring.{u1} k _inst_1) (AddCommGroup.toAddCommMonoid.{u2} V _inst_2)] [S : AddTorsor.{u2, u3} V P (AddCommGroup.toAddGroup.{u2} V _inst_2)], GaloisInsertion.{u3, u3} (Set.{u3} P) (AffineSubspace.{u1, u2, u3} k V P _inst_1 _inst_2 _inst_3 S) (PartialOrder.toPreorder.{u3} (Set.{u3} P) (OmegaCompletePartialOrder.toPartialOrder.{u3} (Set.{u3} P) (CompleteLattice.instOmegaCompletePartialOrder.{u3} (Set.{u3} P) (Order.Coframe.toCompleteLattice.{u3} (Set.{u3} P) (CompleteDistribLattice.toCoframe.{u3} (Set.{u3} P) (CompleteBooleanAlgebra.toCompleteDistribLattice.{u3} (Set.{u3} P) (Set.instCompleteBooleanAlgebraSet.{u3} P))))))) (PartialOrder.toPreorder.{u3} (AffineSubspace.{u1, u2, u3} k V P _inst_1 _inst_2 _inst_3 S) (OmegaCompletePartialOrder.toPartialOrder.{u3} (AffineSubspace.{u1, u2, u3} k V P _inst_1 _inst_2 _inst_3 S) (CompleteLattice.instOmegaCompletePartialOrder.{u3} (AffineSubspace.{u1, u2, u3} k V P _inst_1 _inst_2 _inst_3 S) (AffineSubspace.instCompleteLatticeAffineSubspace.{u1, u2, u3} k V P _inst_1 _inst_2 _inst_3 S)))) (affineSpan.{u1, u2, u3} k V P _inst_1 _inst_2 _inst_3 S) (SetLike.coe.{u3, u3} (AffineSubspace.{u1, u2, u3} k V P _inst_1 _inst_2 _inst_3 S) P (AffineSubspace.instSetLikeAffineSubspace.{u1, u2, u3} k V P _inst_1 _inst_2 _inst_3 S)) Case conversion may be inaccurate. Consider using '#align affine_subspace.gi AffineSubspace.giₓ'. -/ /-- The Galois insertion formed by `affine_span` and coercion back to a set. -/ protected def gi : GaloisInsertion (affineSpan k) (coe : AffineSubspace k P → Set P) where choice s _ := affineSpan k s gc s1 s2 := ⟨fun h => Set.Subset.trans (subset_spanPoints k s1) h, spanPoints_subset_coe_of_subset_coe⟩ le_l_u _ := subset_spanPoints k _ choice_eq _ _ := rfl #align affine_subspace.gi AffineSubspace.gi /- warning: affine_subspace.span_empty -> AffineSubspace.span_empty is a dubious translation: lean 3 declaration is forall (k : Type.{u1}) (V : Type.{u2}) (P : Type.{u3}) [_inst_1 : Ring.{u1} k] [_inst_2 : AddCommGroup.{u2} V] [_inst_3 : Module.{u1, u2} k V (Ring.toSemiring.{u1} k _inst_1) (AddCommGroup.toAddCommMonoid.{u2} V _inst_2)] [S : AddTorsor.{u2, u3} V P (AddCommGroup.toAddGroup.{u2} V _inst_2)], Eq.{succ u3} (AffineSubspace.{u1, u2, u3} k V P _inst_1 _inst_2 _inst_3 S) (affineSpan.{u1, u2, u3} k V P _inst_1 _inst_2 _inst_3 S (EmptyCollection.emptyCollection.{u3} (Set.{u3} P) (Set.hasEmptyc.{u3} P))) (Bot.bot.{u3} (AffineSubspace.{u1, u2, u3} k V P _inst_1 _inst_2 _inst_3 S) (CompleteLattice.toHasBot.{u3} (AffineSubspace.{u1, u2, u3} k V P _inst_1 _inst_2 _inst_3 S) (AffineSubspace.completeLattice.{u1, u2, u3} k V P _inst_1 _inst_2 _inst_3 S))) but is expected to have type forall (k : Type.{u2}) (V : Type.{u1}) (P : Type.{u3}) [_inst_1 : Ring.{u2} k] [_inst_2 : AddCommGroup.{u1} V] [_inst_3 : Module.{u2, u1} k V (Ring.toSemiring.{u2} k _inst_1) (AddCommGroup.toAddCommMonoid.{u1} V _inst_2)] [S : AddTorsor.{u1, u3} V P (AddCommGroup.toAddGroup.{u1} V _inst_2)], Eq.{succ u3} (AffineSubspace.{u2, u1, u3} k V P _inst_1 _inst_2 _inst_3 S) (affineSpan.{u2, u1, u3} k V P _inst_1 _inst_2 _inst_3 S (EmptyCollection.emptyCollection.{u3} (Set.{u3} P) (Set.instEmptyCollectionSet.{u3} P))) (Bot.bot.{u3} (AffineSubspace.{u2, u1, u3} k V P _inst_1 _inst_2 _inst_3 S) (CompleteLattice.toBot.{u3} (AffineSubspace.{u2, u1, u3} k V P _inst_1 _inst_2 _inst_3 S) (AffineSubspace.instCompleteLatticeAffineSubspace.{u2, u1, u3} k V P _inst_1 _inst_2 _inst_3 S))) Case conversion may be inaccurate. Consider using '#align affine_subspace.span_empty AffineSubspace.span_emptyₓ'. -/ /-- The span of the empty set is `⊥`. -/ @[simp] theorem span_empty : affineSpan k (∅ : Set P) = ⊥ := (AffineSubspace.gi k V P).gc.l_bot #align affine_subspace.span_empty AffineSubspace.span_empty /- warning: affine_subspace.span_univ -> AffineSubspace.span_univ is a dubious translation: lean 3 declaration is forall (k : Type.{u1}) (V : Type.{u2}) (P : Type.{u3}) [_inst_1 : Ring.{u1} k] [_inst_2 : AddCommGroup.{u2} V] [_inst_3 : Module.{u1, u2} k V (Ring.toSemiring.{u1} k _inst_1) (AddCommGroup.toAddCommMonoid.{u2} V _inst_2)] [S : AddTorsor.{u2, u3} V P (AddCommGroup.toAddGroup.{u2} V _inst_2)], Eq.{succ u3} (AffineSubspace.{u1, u2, u3} k V P _inst_1 _inst_2 _inst_3 S) (affineSpan.{u1, u2, u3} k V P _inst_1 _inst_2 _inst_3 S (Set.univ.{u3} P)) (Top.top.{u3} (AffineSubspace.{u1, u2, u3} k V P _inst_1 _inst_2 _inst_3 S) (CompleteLattice.toHasTop.{u3} (AffineSubspace.{u1, u2, u3} k V P _inst_1 _inst_2 _inst_3 S) (AffineSubspace.completeLattice.{u1, u2, u3} k V P _inst_1 _inst_2 _inst_3 S))) but is expected to have type forall (k : Type.{u2}) (V : Type.{u1}) (P : Type.{u3}) [_inst_1 : Ring.{u2} k] [_inst_2 : AddCommGroup.{u1} V] [_inst_3 : Module.{u2, u1} k V (Ring.toSemiring.{u2} k _inst_1) (AddCommGroup.toAddCommMonoid.{u1} V _inst_2)] [S : AddTorsor.{u1, u3} V P (AddCommGroup.toAddGroup.{u1} V _inst_2)], Eq.{succ u3} (AffineSubspace.{u2, u1, u3} k V P _inst_1 _inst_2 _inst_3 S) (affineSpan.{u2, u1, u3} k V P _inst_1 _inst_2 _inst_3 S (Set.univ.{u3} P)) (Top.top.{u3} (AffineSubspace.{u2, u1, u3} k V P _inst_1 _inst_2 _inst_3 S) (CompleteLattice.toTop.{u3} (AffineSubspace.{u2, u1, u3} k V P _inst_1 _inst_2 _inst_3 S) (AffineSubspace.instCompleteLatticeAffineSubspace.{u2, u1, u3} k V P _inst_1 _inst_2 _inst_3 S))) Case conversion may be inaccurate. Consider using '#align affine_subspace.span_univ AffineSubspace.span_univₓ'. -/ /-- The span of `univ` is `⊤`. -/ @[simp] theorem span_univ : affineSpan k (Set.univ : Set P) = ⊤ := eq_top_iff.2 <| subset_spanPoints k _ #align affine_subspace.span_univ AffineSubspace.span_univ variable {k V P} /- warning: affine_span_le -> affineSpan_le is a dubious translation: lean 3 declaration is forall {k : Type.{u1}} {V : Type.{u2}} {P : Type.{u3}} [_inst_1 : Ring.{u1} k] [_inst_2 : AddCommGroup.{u2} V] [_inst_3 : Module.{u1, u2} k V (Ring.toSemiring.{u1} k _inst_1) (AddCommGroup.toAddCommMonoid.{u2} V _inst_2)] [S : AddTorsor.{u2, u3} V P (AddCommGroup.toAddGroup.{u2} V _inst_2)] {s : Set.{u3} P} {Q : AffineSubspace.{u1, u2, u3} k V P _inst_1 _inst_2 _inst_3 S}, Iff (LE.le.{u3} (AffineSubspace.{u1, u2, u3} k V P _inst_1 _inst_2 _inst_3 S) (Preorder.toLE.{u3} (AffineSubspace.{u1, u2, u3} k V P _inst_1 _inst_2 _inst_3 S) (PartialOrder.toPreorder.{u3} (AffineSubspace.{u1, u2, u3} k V P _inst_1 _inst_2 _inst_3 S) (SetLike.partialOrder.{u3, u3} (AffineSubspace.{u1, u2, u3} k V P _inst_1 _inst_2 _inst_3 S) P (AffineSubspace.setLike.{u1, u2, u3} k V P _inst_1 _inst_2 _inst_3 S)))) (affineSpan.{u1, u2, u3} k V P _inst_1 _inst_2 _inst_3 S s) Q) (HasSubset.Subset.{u3} (Set.{u3} P) (Set.hasSubset.{u3} P) s ((fun (a : Type.{u3}) (b : Type.{u3}) [self : HasLiftT.{succ u3, succ u3} a b] => self.0) (AffineSubspace.{u1, u2, u3} k V P _inst_1 _inst_2 _inst_3 S) (Set.{u3} P) (HasLiftT.mk.{succ u3, succ u3} (AffineSubspace.{u1, u2, u3} k V P _inst_1 _inst_2 _inst_3 S) (Set.{u3} P) (CoeTCₓ.coe.{succ u3, succ u3} (AffineSubspace.{u1, u2, u3} k V P _inst_1 _inst_2 _inst_3 S) (Set.{u3} P) (SetLike.Set.hasCoeT.{u3, u3} (AffineSubspace.{u1, u2, u3} k V P _inst_1 _inst_2 _inst_3 S) P (AffineSubspace.setLike.{u1, u2, u3} k V P _inst_1 _inst_2 _inst_3 S)))) Q)) but is expected to have type forall {k : Type.{u2}} {V : Type.{u1}} {P : Type.{u3}} [_inst_1 : Ring.{u2} k] [_inst_2 : AddCommGroup.{u1} V] [_inst_3 : Module.{u2, u1} k V (Ring.toSemiring.{u2} k _inst_1) (AddCommGroup.toAddCommMonoid.{u1} V _inst_2)] [S : AddTorsor.{u1, u3} V P (AddCommGroup.toAddGroup.{u1} V _inst_2)] {s : Set.{u3} P} {Q : AffineSubspace.{u2, u1, u3} k V P _inst_1 _inst_2 _inst_3 S}, Iff (LE.le.{u3} (AffineSubspace.{u2, u1, u3} k V P _inst_1 _inst_2 _inst_3 S) (Preorder.toLE.{u3} (AffineSubspace.{u2, u1, u3} k V P _inst_1 _inst_2 _inst_3 S) (PartialOrder.toPreorder.{u3} (AffineSubspace.{u2, u1, u3} k V P _inst_1 _inst_2 _inst_3 S) (OmegaCompletePartialOrder.toPartialOrder.{u3} (AffineSubspace.{u2, u1, u3} k V P _inst_1 _inst_2 _inst_3 S) (CompleteLattice.instOmegaCompletePartialOrder.{u3} (AffineSubspace.{u2, u1, u3} k V P _inst_1 _inst_2 _inst_3 S) (AffineSubspace.instCompleteLatticeAffineSubspace.{u2, u1, u3} k V P _inst_1 _inst_2 _inst_3 S))))) (affineSpan.{u2, u1, u3} k V P _inst_1 _inst_2 _inst_3 S s) Q) (HasSubset.Subset.{u3} (Set.{u3} P) (Set.instHasSubsetSet.{u3} P) s (SetLike.coe.{u3, u3} (AffineSubspace.{u2, u1, u3} k V P _inst_1 _inst_2 _inst_3 S) P (AffineSubspace.instSetLikeAffineSubspace.{u2, u1, u3} k V P _inst_1 _inst_2 _inst_3 S) Q)) Case conversion may be inaccurate. Consider using '#align affine_span_le affineSpan_leₓ'. -/ theorem affineSpan_le {s : Set P} {Q : AffineSubspace k P} : affineSpan k s ≤ Q ↔ s ⊆ (Q : Set P) := (AffineSubspace.gi k V P).gc _ _ #align affine_span_le affineSpan_le variable (k V) {P} {p₁ p₂ : P} /- warning: affine_subspace.coe_affine_span_singleton -> AffineSubspace.coe_affineSpan_singleton is a dubious translation: lean 3 declaration is forall (k : Type.{u1}) (V : Type.{u2}) {P : Type.{u3}} [_inst_1 : Ring.{u1} k] [_inst_2 : AddCommGroup.{u2} V] [_inst_3 : Module.{u1, u2} k V (Ring.toSemiring.{u1} k _inst_1) (AddCommGroup.toAddCommMonoid.{u2} V _inst_2)] [S : AddTorsor.{u2, u3} V P (AddCommGroup.toAddGroup.{u2} V _inst_2)] (p : P), Eq.{succ u3} (Set.{u3} P) ((fun (a : Type.{u3}) (b : Type.{u3}) [self : HasLiftT.{succ u3, succ u3} a b] => self.0) (AffineSubspace.{u1, u2, u3} k V P _inst_1 _inst_2 _inst_3 S) (Set.{u3} P) (HasLiftT.mk.{succ u3, succ u3} (AffineSubspace.{u1, u2, u3} k V P _inst_1 _inst_2 _inst_3 S) (Set.{u3} P) (CoeTCₓ.coe.{succ u3, succ u3} (AffineSubspace.{u1, u2, u3} k V P _inst_1 _inst_2 _inst_3 S) (Set.{u3} P) (SetLike.Set.hasCoeT.{u3, u3} (AffineSubspace.{u1, u2, u3} k V P _inst_1 _inst_2 _inst_3 S) P (AffineSubspace.setLike.{u1, u2, u3} k V P _inst_1 _inst_2 _inst_3 S)))) (affineSpan.{u1, u2, u3} k V P _inst_1 _inst_2 _inst_3 S (Singleton.singleton.{u3, u3} P (Set.{u3} P) (Set.hasSingleton.{u3} P) p))) (Singleton.singleton.{u3, u3} P (Set.{u3} P) (Set.hasSingleton.{u3} P) p) but is expected to have type forall (k : Type.{u2}) (V : Type.{u1}) {P : Type.{u3}} [_inst_1 : Ring.{u2} k] [_inst_2 : AddCommGroup.{u1} V] [_inst_3 : Module.{u2, u1} k V (Ring.toSemiring.{u2} k _inst_1) (AddCommGroup.toAddCommMonoid.{u1} V _inst_2)] [S : AddTorsor.{u1, u3} V P (AddCommGroup.toAddGroup.{u1} V _inst_2)] (p : P), Eq.{succ u3} (Set.{u3} P) (SetLike.coe.{u3, u3} (AffineSubspace.{u2, u1, u3} k V P _inst_1 _inst_2 _inst_3 S) P (AffineSubspace.instSetLikeAffineSubspace.{u2, u1, u3} k V P _inst_1 _inst_2 _inst_3 S) (affineSpan.{u2, u1, u3} k V P _inst_1 _inst_2 _inst_3 S (Singleton.singleton.{u3, u3} P (Set.{u3} P) (Set.instSingletonSet.{u3} P) p))) (Singleton.singleton.{u3, u3} P (Set.{u3} P) (Set.instSingletonSet.{u3} P) p) Case conversion may be inaccurate. Consider using '#align affine_subspace.coe_affine_span_singleton AffineSubspace.coe_affineSpan_singletonₓ'. -/ /-- The affine span of a single point, coerced to a set, contains just that point. -/ @[simp] theorem coe_affineSpan_singleton (p : P) : (affineSpan k ({p} : Set P) : Set P) = {p} := by ext x rw [mem_coe, ← vsub_right_mem_direction_iff_mem (mem_affineSpan k (Set.mem_singleton p)) _, direction_affineSpan] simp #align affine_subspace.coe_affine_span_singleton AffineSubspace.coe_affineSpan_singleton /- warning: affine_subspace.mem_affine_span_singleton -> AffineSubspace.mem_affineSpan_singleton is a dubious translation: lean 3 declaration is forall (k : Type.{u1}) (V : Type.{u2}) {P : Type.{u3}} [_inst_1 : Ring.{u1} k] [_inst_2 : AddCommGroup.{u2} V] [_inst_3 : Module.{u1, u2} k V (Ring.toSemiring.{u1} k _inst_1) (AddCommGroup.toAddCommMonoid.{u2} V _inst_2)] [S : AddTorsor.{u2, u3} V P (AddCommGroup.toAddGroup.{u2} V _inst_2)] {p₁ : P} {p₂ : P}, Iff (Membership.Mem.{u3, u3} P (AffineSubspace.{u1, u2, u3} k V P _inst_1 _inst_2 _inst_3 S) (SetLike.hasMem.{u3, u3} (AffineSubspace.{u1, u2, u3} k V P _inst_1 _inst_2 _inst_3 S) P (AffineSubspace.setLike.{u1, u2, u3} k V P _inst_1 _inst_2 _inst_3 S)) p₁ (affineSpan.{u1, u2, u3} k V P _inst_1 _inst_2 _inst_3 S (Singleton.singleton.{u3, u3} P (Set.{u3} P) (Set.hasSingleton.{u3} P) p₂))) (Eq.{succ u3} P p₁ p₂) but is expected to have type forall (k : Type.{u2}) (V : Type.{u1}) {P : Type.{u3}} [_inst_1 : Ring.{u2} k] [_inst_2 : AddCommGroup.{u1} V] [_inst_3 : Module.{u2, u1} k V (Ring.toSemiring.{u2} k _inst_1) (AddCommGroup.toAddCommMonoid.{u1} V _inst_2)] [S : AddTorsor.{u1, u3} V P (AddCommGroup.toAddGroup.{u1} V _inst_2)] {p₁ : P} {p₂ : P}, Iff (Membership.mem.{u3, u3} P (AffineSubspace.{u2, u1, u3} k V P _inst_1 _inst_2 _inst_3 S) (SetLike.instMembership.{u3, u3} (AffineSubspace.{u2, u1, u3} k V P _inst_1 _inst_2 _inst_3 S) P (AffineSubspace.instSetLikeAffineSubspace.{u2, u1, u3} k V P _inst_1 _inst_2 _inst_3 S)) p₁ (affineSpan.{u2, u1, u3} k V P _inst_1 _inst_2 _inst_3 S (Singleton.singleton.{u3, u3} P (Set.{u3} P) (Set.instSingletonSet.{u3} P) p₂))) (Eq.{succ u3} P p₁ p₂) Case conversion may be inaccurate. Consider using '#align affine_subspace.mem_affine_span_singleton AffineSubspace.mem_affineSpan_singletonₓ'. -/ /-- A point is in the affine span of a single point if and only if they are equal. -/ @[simp] theorem mem_affineSpan_singleton : p₁ ∈ affineSpan k ({p₂} : Set P) ↔ p₁ = p₂ := by simp [← mem_coe] #align affine_subspace.mem_affine_span_singleton AffineSubspace.mem_affineSpan_singleton /- warning: affine_subspace.preimage_coe_affine_span_singleton -> AffineSubspace.preimage_coe_affineSpan_singleton is a dubious translation: lean 3 declaration is forall (k : Type.{u1}) (V : Type.{u2}) {P : Type.{u3}} [_inst_1 : Ring.{u1} k] [_inst_2 : AddCommGroup.{u2} V] [_inst_3 : Module.{u1, u2} k V (Ring.toSemiring.{u1} k _inst_1) (AddCommGroup.toAddCommMonoid.{u2} V _inst_2)] [S : AddTorsor.{u2, u3} V P (AddCommGroup.toAddGroup.{u2} V _inst_2)] (x : P), Eq.{succ u3} (Set.{u3} (coeSort.{succ u3, succ (succ u3)} (AffineSubspace.{u1, u2, u3} k V P _inst_1 _inst_2 _inst_3 S) Type.{u3} (SetLike.hasCoeToSort.{u3, u3} (AffineSubspace.{u1, u2, u3} k V P _inst_1 _inst_2 _inst_3 S) P (AffineSubspace.setLike.{u1, u2, u3} k V P _inst_1 _inst_2 _inst_3 S)) (affineSpan.{u1, u2, u3} k V P _inst_1 _inst_2 _inst_3 S (Singleton.singleton.{u3, u3} P (Set.{u3} P) (Set.hasSingleton.{u3} P) x)))) (Set.preimage.{u3, u3} (coeSort.{succ u3, succ (succ u3)} (AffineSubspace.{u1, u2, u3} k V P _inst_1 _inst_2 _inst_3 S) Type.{u3} (SetLike.hasCoeToSort.{u3, u3} (AffineSubspace.{u1, u2, u3} k V P _inst_1 _inst_2 _inst_3 S) P (AffineSubspace.setLike.{u1, u2, u3} k V P _inst_1 _inst_2 _inst_3 S)) (affineSpan.{u1, u2, u3} k V P _inst_1 _inst_2 _inst_3 S (Singleton.singleton.{u3, u3} P (Set.{u3} P) (Set.hasSingleton.{u3} P) x))) P ((fun (a : Type.{u3}) (b : Type.{u3}) [self : HasLiftT.{succ u3, succ u3} a b] => self.0) (coeSort.{succ u3, succ (succ u3)} (AffineSubspace.{u1, u2, u3} k V P _inst_1 _inst_2 _inst_3 S) Type.{u3} (SetLike.hasCoeToSort.{u3, u3} (AffineSubspace.{u1, u2, u3} k V P _inst_1 _inst_2 _inst_3 S) P (AffineSubspace.setLike.{u1, u2, u3} k V P _inst_1 _inst_2 _inst_3 S)) (affineSpan.{u1, u2, u3} k V P _inst_1 _inst_2 _inst_3 S (Singleton.singleton.{u3, u3} P (Set.{u3} P) (Set.hasSingleton.{u3} P) x))) P (HasLiftT.mk.{succ u3, succ u3} (coeSort.{succ u3, succ (succ u3)} (AffineSubspace.{u1, u2, u3} k V P _inst_1 _inst_2 _inst_3 S) Type.{u3} (SetLike.hasCoeToSort.{u3, u3} (AffineSubspace.{u1, u2, u3} k V P _inst_1 _inst_2 _inst_3 S) P (AffineSubspace.setLike.{u1, u2, u3} k V P _inst_1 _inst_2 _inst_3 S)) (affineSpan.{u1, u2, u3} k V P _inst_1 _inst_2 _inst_3 S (Singleton.singleton.{u3, u3} P (Set.{u3} P) (Set.hasSingleton.{u3} P) x))) P (CoeTCₓ.coe.{succ u3, succ u3} (coeSort.{succ u3, succ (succ u3)} (AffineSubspace.{u1, u2, u3} k V P _inst_1 _inst_2 _inst_3 S) Type.{u3} (SetLike.hasCoeToSort.{u3, u3} (AffineSubspace.{u1, u2, u3} k V P _inst_1 _inst_2 _inst_3 S) P (AffineSubspace.setLike.{u1, u2, u3} k V P _inst_1 _inst_2 _inst_3 S)) (affineSpan.{u1, u2, u3} k V P _inst_1 _inst_2 _inst_3 S (Singleton.singleton.{u3, u3} P (Set.{u3} P) (Set.hasSingleton.{u3} P) x))) P (coeBase.{succ u3, succ u3} (coeSort.{succ u3, succ (succ u3)} (AffineSubspace.{u1, u2, u3} k V P _inst_1 _inst_2 _inst_3 S) Type.{u3} (SetLike.hasCoeToSort.{u3, u3} (AffineSubspace.{u1, u2, u3} k V P _inst_1 _inst_2 _inst_3 S) P (AffineSubspace.setLike.{u1, u2, u3} k V P _inst_1 _inst_2 _inst_3 S)) (affineSpan.{u1, u2, u3} k V P _inst_1 _inst_2 _inst_3 S (Singleton.singleton.{u3, u3} P (Set.{u3} P) (Set.hasSingleton.{u3} P) x))) P (coeSubtype.{succ u3} P (fun (x_1 : P) => Membership.Mem.{u3, u3} P (AffineSubspace.{u1, u2, u3} k V P _inst_1 _inst_2 _inst_3 S) (SetLike.hasMem.{u3, u3} (AffineSubspace.{u1, u2, u3} k V P _inst_1 _inst_2 _inst_3 S) P (AffineSubspace.setLike.{u1, u2, u3} k V P _inst_1 _inst_2 _inst_3 S)) x_1 (affineSpan.{u1, u2, u3} k V P _inst_1 _inst_2 _inst_3 S (Singleton.singleton.{u3, u3} P (Set.{u3} P) (Set.hasSingleton.{u3} P) x)))))))) (Singleton.singleton.{u3, u3} P (Set.{u3} P) (Set.hasSingleton.{u3} P) x)) (Set.univ.{u3} (coeSort.{succ u3, succ (succ u3)} (AffineSubspace.{u1, u2, u3} k V P _inst_1 _inst_2 _inst_3 S) Type.{u3} (SetLike.hasCoeToSort.{u3, u3} (AffineSubspace.{u1, u2, u3} k V P _inst_1 _inst_2 _inst_3 S) P (AffineSubspace.setLike.{u1, u2, u3} k V P _inst_1 _inst_2 _inst_3 S)) (affineSpan.{u1, u2, u3} k V P _inst_1 _inst_2 _inst_3 S (Singleton.singleton.{u3, u3} P (Set.{u3} P) (Set.hasSingleton.{u3} P) x)))) but is expected to have type forall (k : Type.{u2}) (V : Type.{u1}) {P : Type.{u3}} [_inst_1 : Ring.{u2} k] [_inst_2 : AddCommGroup.{u1} V] [_inst_3 : Module.{u2, u1} k V (Ring.toSemiring.{u2} k _inst_1) (AddCommGroup.toAddCommMonoid.{u1} V _inst_2)] [S : AddTorsor.{u1, u3} V P (AddCommGroup.toAddGroup.{u1} V _inst_2)] (x : P), Eq.{succ u3} (Set.{u3} (Subtype.{succ u3} P (fun (x_1 : P) => Membership.mem.{u3, u3} P (Set.{u3} P) (Set.instMembershipSet.{u3} P) x_1 (SetLike.coe.{u3, u3} (AffineSubspace.{u2, u1, u3} k V P _inst_1 _inst_2 _inst_3 S) P (AffineSubspace.instSetLikeAffineSubspace.{u2, u1, u3} k V P _inst_1 _inst_2 _inst_3 S) (affineSpan.{u2, u1, u3} k V P _inst_1 _inst_2 _inst_3 S (Singleton.singleton.{u3, u3} P (Set.{u3} P) (Set.instSingletonSet.{u3} P) x)))))) (Set.preimage.{u3, u3} (Subtype.{succ u3} P (fun (x_1 : P) => Membership.mem.{u3, u3} P (Set.{u3} P) (Set.instMembershipSet.{u3} P) x_1 (SetLike.coe.{u3, u3} (AffineSubspace.{u2, u1, u3} k V P _inst_1 _inst_2 _inst_3 S) P (AffineSubspace.instSetLikeAffineSubspace.{u2, u1, u3} k V P _inst_1 _inst_2 _inst_3 S) (affineSpan.{u2, u1, u3} k V P _inst_1 _inst_2 _inst_3 S (Singleton.singleton.{u3, u3} P (Set.{u3} P) (Set.instSingletonSet.{u3} P) x))))) P (Subtype.val.{succ u3} P (fun (x_1 : P) => Membership.mem.{u3, u3} P (Set.{u3} P) (Set.instMembershipSet.{u3} P) x_1 (SetLike.coe.{u3, u3} (AffineSubspace.{u2, u1, u3} k V P _inst_1 _inst_2 _inst_3 S) P (AffineSubspace.instSetLikeAffineSubspace.{u2, u1, u3} k V P _inst_1 _inst_2 _inst_3 S) (affineSpan.{u2, u1, u3} k V P _inst_1 _inst_2 _inst_3 S (Singleton.singleton.{u3, u3} P (Set.{u3} P) (Set.instSingletonSet.{u3} P) x))))) (Singleton.singleton.{u3, u3} P (Set.{u3} P) (Set.instSingletonSet.{u3} P) x)) (Set.univ.{u3} (Subtype.{succ u3} P (fun (x_1 : P) => Membership.mem.{u3, u3} P (Set.{u3} P) (Set.instMembershipSet.{u3} P) x_1 (SetLike.coe.{u3, u3} (AffineSubspace.{u2, u1, u3} k V P _inst_1 _inst_2 _inst_3 S) P (AffineSubspace.instSetLikeAffineSubspace.{u2, u1, u3} k V P _inst_1 _inst_2 _inst_3 S) (affineSpan.{u2, u1, u3} k V P _inst_1 _inst_2 _inst_3 S (Singleton.singleton.{u3, u3} P (Set.{u3} P) (Set.instSingletonSet.{u3} P) x)))))) Case conversion may be inaccurate. Consider using '#align affine_subspace.preimage_coe_affine_span_singleton AffineSubspace.preimage_coe_affineSpan_singletonₓ'. -/ @[simp] theorem preimage_coe_affineSpan_singleton (x : P) : (coe : affineSpan k ({x} : Set P) → P) ⁻¹' {x} = univ := eq_univ_of_forall fun y => (AffineSubspace.mem_affineSpan_singleton _ _).1 y.2 #align affine_subspace.preimage_coe_affine_span_singleton AffineSubspace.preimage_coe_affineSpan_singleton /- warning: affine_subspace.span_union -> AffineSubspace.span_union is a dubious translation: lean 3 declaration is forall (k : Type.{u1}) (V : Type.{u2}) {P : Type.{u3}} [_inst_1 : Ring.{u1} k] [_inst_2 : AddCommGroup.{u2} V] [_inst_3 : Module.{u1, u2} k V (Ring.toSemiring.{u1} k _inst_1) (AddCommGroup.toAddCommMonoid.{u2} V _inst_2)] [S : AddTorsor.{u2, u3} V P (AddCommGroup.toAddGroup.{u2} V _inst_2)] (s : Set.{u3} P) (t : Set.{u3} P), Eq.{succ u3} (AffineSubspace.{u1, u2, u3} k V P _inst_1 _inst_2 _inst_3 S) (affineSpan.{u1, u2, u3} k V P _inst_1 _inst_2 _inst_3 S (Union.union.{u3} (Set.{u3} P) (Set.hasUnion.{u3} P) s t)) (Sup.sup.{u3} (AffineSubspace.{u1, u2, u3} k V P _inst_1 _inst_2 _inst_3 S) (SemilatticeSup.toHasSup.{u3} (AffineSubspace.{u1, u2, u3} k V P _inst_1 _inst_2 _inst_3 S) (Lattice.toSemilatticeSup.{u3} (AffineSubspace.{u1, u2, u3} k V P _inst_1 _inst_2 _inst_3 S) (ConditionallyCompleteLattice.toLattice.{u3} (AffineSubspace.{u1, u2, u3} k V P _inst_1 _inst_2 _inst_3 S) (CompleteLattice.toConditionallyCompleteLattice.{u3} (AffineSubspace.{u1, u2, u3} k V P _inst_1 _inst_2 _inst_3 S) (AffineSubspace.completeLattice.{u1, u2, u3} k V P _inst_1 _inst_2 _inst_3 S))))) (affineSpan.{u1, u2, u3} k V P _inst_1 _inst_2 _inst_3 S s) (affineSpan.{u1, u2, u3} k V P _inst_1 _inst_2 _inst_3 S t)) but is expected to have type forall (k : Type.{u2}) (V : Type.{u1}) {P : Type.{u3}} [_inst_1 : Ring.{u2} k] [_inst_2 : AddCommGroup.{u1} V] [_inst_3 : Module.{u2, u1} k V (Ring.toSemiring.{u2} k _inst_1) (AddCommGroup.toAddCommMonoid.{u1} V _inst_2)] [S : AddTorsor.{u1, u3} V P (AddCommGroup.toAddGroup.{u1} V _inst_2)] (s : Set.{u3} P) (t : Set.{u3} P), Eq.{succ u3} (AffineSubspace.{u2, u1, u3} k V P _inst_1 _inst_2 _inst_3 S) (affineSpan.{u2, u1, u3} k V P _inst_1 _inst_2 _inst_3 S (Union.union.{u3} (Set.{u3} P) (Set.instUnionSet.{u3} P) s t)) (Sup.sup.{u3} (AffineSubspace.{u2, u1, u3} k V P _inst_1 _inst_2 _inst_3 S) (SemilatticeSup.toSup.{u3} (AffineSubspace.{u2, u1, u3} k V P _inst_1 _inst_2 _inst_3 S) (Lattice.toSemilatticeSup.{u3} (AffineSubspace.{u2, u1, u3} k V P _inst_1 _inst_2 _inst_3 S) (ConditionallyCompleteLattice.toLattice.{u3} (AffineSubspace.{u2, u1, u3} k V P _inst_1 _inst_2 _inst_3 S) (CompleteLattice.toConditionallyCompleteLattice.{u3} (AffineSubspace.{u2, u1, u3} k V P _inst_1 _inst_2 _inst_3 S) (AffineSubspace.instCompleteLatticeAffineSubspace.{u2, u1, u3} k V P _inst_1 _inst_2 _inst_3 S))))) (affineSpan.{u2, u1, u3} k V P _inst_1 _inst_2 _inst_3 S s) (affineSpan.{u2, u1, u3} k V P _inst_1 _inst_2 _inst_3 S t)) Case conversion may be inaccurate. Consider using '#align affine_subspace.span_union AffineSubspace.span_unionₓ'. -/ /-- The span of a union of sets is the sup of their spans. -/ theorem span_union (s t : Set P) : affineSpan k (s ∪ t) = affineSpan k s ⊔ affineSpan k t := (AffineSubspace.gi k V P).gc.l_sup #align affine_subspace.span_union AffineSubspace.span_union /- warning: affine_subspace.span_Union -> AffineSubspace.span_unionᵢ is a dubious translation: lean 3 declaration is forall (k : Type.{u1}) (V : Type.{u2}) {P : Type.{u3}} [_inst_1 : Ring.{u1} k] [_inst_2 : AddCommGroup.{u2} V] [_inst_3 : Module.{u1, u2} k V (Ring.toSemiring.{u1} k _inst_1) (AddCommGroup.toAddCommMonoid.{u2} V _inst_2)] [S : AddTorsor.{u2, u3} V P (AddCommGroup.toAddGroup.{u2} V _inst_2)] {ι : Type.{u4}} (s : ι -> (Set.{u3} P)), Eq.{succ u3} (AffineSubspace.{u1, u2, u3} k V P _inst_1 _inst_2 _inst_3 S) (affineSpan.{u1, u2, u3} k V P _inst_1 _inst_2 _inst_3 S (Set.unionᵢ.{u3, succ u4} P ι (fun (i : ι) => s i))) (supᵢ.{u3, succ u4} (AffineSubspace.{u1, u2, u3} k V P _inst_1 _inst_2 _inst_3 S) (ConditionallyCompleteLattice.toHasSup.{u3} (AffineSubspace.{u1, u2, u3} k V P _inst_1 _inst_2 _inst_3 S) (CompleteLattice.toConditionallyCompleteLattice.{u3} (AffineSubspace.{u1, u2, u3} k V P _inst_1 _inst_2 _inst_3 S) (AffineSubspace.completeLattice.{u1, u2, u3} k V P _inst_1 _inst_2 _inst_3 S))) ι (fun (i : ι) => affineSpan.{u1, u2, u3} k V P _inst_1 _inst_2 _inst_3 S (s i))) but is expected to have type forall (k : Type.{u2}) (V : Type.{u1}) {P : Type.{u3}} [_inst_1 : Ring.{u2} k] [_inst_2 : AddCommGroup.{u1} V] [_inst_3 : Module.{u2, u1} k V (Ring.toSemiring.{u2} k _inst_1) (AddCommGroup.toAddCommMonoid.{u1} V _inst_2)] [S : AddTorsor.{u1, u3} V P (AddCommGroup.toAddGroup.{u1} V _inst_2)] {ι : Type.{u4}} (s : ι -> (Set.{u3} P)), Eq.{succ u3} (AffineSubspace.{u2, u1, u3} k V P _inst_1 _inst_2 _inst_3 S) (affineSpan.{u2, u1, u3} k V P _inst_1 _inst_2 _inst_3 S (Set.unionᵢ.{u3, succ u4} P ι (fun (i : ι) => s i))) (supᵢ.{u3, succ u4} (AffineSubspace.{u2, u1, u3} k V P _inst_1 _inst_2 _inst_3 S) (ConditionallyCompleteLattice.toSupSet.{u3} (AffineSubspace.{u2, u1, u3} k V P _inst_1 _inst_2 _inst_3 S) (CompleteLattice.toConditionallyCompleteLattice.{u3} (AffineSubspace.{u2, u1, u3} k V P _inst_1 _inst_2 _inst_3 S) (AffineSubspace.instCompleteLatticeAffineSubspace.{u2, u1, u3} k V P _inst_1 _inst_2 _inst_3 S))) ι (fun (i : ι) => affineSpan.{u2, u1, u3} k V P _inst_1 _inst_2 _inst_3 S (s i))) Case conversion may be inaccurate. Consider using '#align affine_subspace.span_Union AffineSubspace.span_unionᵢₓ'. -/ /-- The span of a union of an indexed family of sets is the sup of their spans. -/ theorem span_unionᵢ {ι : Type _} (s : ι → Set P) : affineSpan k (⋃ i, s i) = ⨆ i, affineSpan k (s i) := (AffineSubspace.gi k V P).gc.l_supᵢ #align affine_subspace.span_Union AffineSubspace.span_unionᵢ variable (P) /- warning: affine_subspace.top_coe -> AffineSubspace.top_coe is a dubious translation: lean 3 declaration is forall (k : Type.{u1}) (V : Type.{u2}) (P : Type.{u3}) [_inst_1 : Ring.{u1} k] [_inst_2 : AddCommGroup.{u2} V] [_inst_3 : Module.{u1, u2} k V (Ring.toSemiring.{u1} k _inst_1) (AddCommGroup.toAddCommMonoid.{u2} V _inst_2)] [S : AddTorsor.{u2, u3} V P (AddCommGroup.toAddGroup.{u2} V _inst_2)], Eq.{succ u3} (Set.{u3} P) ((fun (a : Type.{u3}) (b : Type.{u3}) [self : HasLiftT.{succ u3, succ u3} a b] => self.0) (AffineSubspace.{u1, u2, u3} k V P _inst_1 _inst_2 _inst_3 S) (Set.{u3} P) (HasLiftT.mk.{succ u3, succ u3} (AffineSubspace.{u1, u2, u3} k V P _inst_1 _inst_2 _inst_3 S) (Set.{u3} P) (CoeTCₓ.coe.{succ u3, succ u3} (AffineSubspace.{u1, u2, u3} k V P _inst_1 _inst_2 _inst_3 S) (Set.{u3} P) (SetLike.Set.hasCoeT.{u3, u3} (AffineSubspace.{u1, u2, u3} k V P _inst_1 _inst_2 _inst_3 S) P (AffineSubspace.setLike.{u1, u2, u3} k V P _inst_1 _inst_2 _inst_3 S)))) (Top.top.{u3} (AffineSubspace.{u1, u2, u3} k V P _inst_1 _inst_2 _inst_3 S) (CompleteLattice.toHasTop.{u3} (AffineSubspace.{u1, u2, u3} k V P _inst_1 _inst_2 _inst_3 S) (AffineSubspace.completeLattice.{u1, u2, u3} k V P _inst_1 _inst_2 _inst_3 S)))) (Set.univ.{u3} P) but is expected to have type forall (k : Type.{u2}) (V : Type.{u1}) (P : Type.{u3}) [_inst_1 : Ring.{u2} k] [_inst_2 : AddCommGroup.{u1} V] [_inst_3 : Module.{u2, u1} k V (Ring.toSemiring.{u2} k _inst_1) (AddCommGroup.toAddCommMonoid.{u1} V _inst_2)] [S : AddTorsor.{u1, u3} V P (AddCommGroup.toAddGroup.{u1} V _inst_2)], Eq.{succ u3} (Set.{u3} P) (SetLike.coe.{u3, u3} (AffineSubspace.{u2, u1, u3} k V P _inst_1 _inst_2 _inst_3 S) P (AffineSubspace.instSetLikeAffineSubspace.{u2, u1, u3} k V P _inst_1 _inst_2 _inst_3 S) (Top.top.{u3} (AffineSubspace.{u2, u1, u3} k V P _inst_1 _inst_2 _inst_3 S) (CompleteLattice.toTop.{u3} (AffineSubspace.{u2, u1, u3} k V P _inst_1 _inst_2 _inst_3 S) (AffineSubspace.instCompleteLatticeAffineSubspace.{u2, u1, u3} k V P _inst_1 _inst_2 _inst_3 S)))) (Set.univ.{u3} P) Case conversion may be inaccurate. Consider using '#align affine_subspace.top_coe AffineSubspace.top_coeₓ'. -/ /-- `⊤`, coerced to a set, is the whole set of points. -/ @[simp] theorem top_coe : ((⊤ : AffineSubspace k P) : Set P) = Set.univ := rfl #align affine_subspace.top_coe AffineSubspace.top_coe variable {P} /- warning: affine_subspace.mem_top -> AffineSubspace.mem_top is a dubious translation: lean 3 declaration is forall (k : Type.{u1}) (V : Type.{u2}) {P : Type.{u3}} [_inst_1 : Ring.{u1} k] [_inst_2 : AddCommGroup.{u2} V] [_inst_3 : Module.{u1, u2} k V (Ring.toSemiring.{u1} k _inst_1) (AddCommGroup.toAddCommMonoid.{u2} V _inst_2)] [S : AddTorsor.{u2, u3} V P (AddCommGroup.toAddGroup.{u2} V _inst_2)] (p : P), Membership.Mem.{u3, u3} P (AffineSubspace.{u1, u2, u3} k V P _inst_1 _inst_2 _inst_3 S) (SetLike.hasMem.{u3, u3} (AffineSubspace.{u1, u2, u3} k V P _inst_1 _inst_2 _inst_3 S) P (AffineSubspace.setLike.{u1, u2, u3} k V P _inst_1 _inst_2 _inst_3 S)) p (Top.top.{u3} (AffineSubspace.{u1, u2, u3} k V P _inst_1 _inst_2 _inst_3 S) (CompleteLattice.toHasTop.{u3} (AffineSubspace.{u1, u2, u3} k V P _inst_1 _inst_2 _inst_3 S) (AffineSubspace.completeLattice.{u1, u2, u3} k V P _inst_1 _inst_2 _inst_3 S))) but is expected to have type forall (k : Type.{u2}) (V : Type.{u1}) {P : Type.{u3}} [_inst_1 : Ring.{u2} k] [_inst_2 : AddCommGroup.{u1} V] [_inst_3 : Module.{u2, u1} k V (Ring.toSemiring.{u2} k _inst_1) (AddCommGroup.toAddCommMonoid.{u1} V _inst_2)] [S : AddTorsor.{u1, u3} V P (AddCommGroup.toAddGroup.{u1} V _inst_2)] (p : P), Membership.mem.{u3, u3} P (AffineSubspace.{u2, u1, u3} k V P _inst_1 _inst_2 _inst_3 S) (SetLike.instMembership.{u3, u3} (AffineSubspace.{u2, u1, u3} k V P _inst_1 _inst_2 _inst_3 S) P (AffineSubspace.instSetLikeAffineSubspace.{u2, u1, u3} k V P _inst_1 _inst_2 _inst_3 S)) p (Top.top.{u3} (AffineSubspace.{u2, u1, u3} k V P _inst_1 _inst_2 _inst_3 S) (CompleteLattice.toTop.{u3} (AffineSubspace.{u2, u1, u3} k V P _inst_1 _inst_2 _inst_3 S) (AffineSubspace.instCompleteLatticeAffineSubspace.{u2, u1, u3} k V P _inst_1 _inst_2 _inst_3 S))) Case conversion may be inaccurate. Consider using '#align affine_subspace.mem_top AffineSubspace.mem_topₓ'. -/ /-- All points are in `⊤`. -/ theorem mem_top (p : P) : p ∈ (⊤ : AffineSubspace k P) := Set.mem_univ p #align affine_subspace.mem_top AffineSubspace.mem_top variable (P) /- warning: affine_subspace.direction_top -> AffineSubspace.direction_top is a dubious translation: lean 3 declaration is forall (k : Type.{u1}) (V : Type.{u2}) (P : Type.{u3}) [_inst_1 : Ring.{u1} k] [_inst_2 : AddCommGroup.{u2} V] [_inst_3 : Module.{u1, u2} k V (Ring.toSemiring.{u1} k _inst_1) (AddCommGroup.toAddCommMonoid.{u2} V _inst_2)] [S : AddTorsor.{u2, u3} V P (AddCommGroup.toAddGroup.{u2} V _inst_2)], Eq.{succ u2} (Submodule.{u1, u2} k V (Ring.toSemiring.{u1} k _inst_1) (AddCommGroup.toAddCommMonoid.{u2} V _inst_2) _inst_3) (AffineSubspace.direction.{u1, u2, u3} k V P _inst_1 _inst_2 _inst_3 S (Top.top.{u3} (AffineSubspace.{u1, u2, u3} k V P _inst_1 _inst_2 _inst_3 S) (CompleteLattice.toHasTop.{u3} (AffineSubspace.{u1, u2, u3} k V P _inst_1 _inst_2 _inst_3 S) (AffineSubspace.completeLattice.{u1, u2, u3} k V P _inst_1 _inst_2 _inst_3 S)))) (Top.top.{u2} (Submodule.{u1, u2} k V (Ring.toSemiring.{u1} k _inst_1) (AddCommGroup.toAddCommMonoid.{u2} V _inst_2) _inst_3) (Submodule.hasTop.{u1, u2} k V (Ring.toSemiring.{u1} k _inst_1) (AddCommGroup.toAddCommMonoid.{u2} V _inst_2) _inst_3)) but is expected to have type forall (k : Type.{u2}) (V : Type.{u3}) (P : Type.{u1}) [_inst_1 : Ring.{u2} k] [_inst_2 : AddCommGroup.{u3} V] [_inst_3 : Module.{u2, u3} k V (Ring.toSemiring.{u2} k _inst_1) (AddCommGroup.toAddCommMonoid.{u3} V _inst_2)] [S : AddTorsor.{u3, u1} V P (AddCommGroup.toAddGroup.{u3} V _inst_2)], Eq.{succ u3} (Submodule.{u2, u3} k V (Ring.toSemiring.{u2} k _inst_1) (AddCommGroup.toAddCommMonoid.{u3} V _inst_2) _inst_3) (AffineSubspace.direction.{u2, u3, u1} k V P _inst_1 _inst_2 _inst_3 S (Top.top.{u1} (AffineSubspace.{u2, u3, u1} k V P _inst_1 _inst_2 _inst_3 S) (CompleteLattice.toTop.{u1} (AffineSubspace.{u2, u3, u1} k V P _inst_1 _inst_2 _inst_3 S) (AffineSubspace.instCompleteLatticeAffineSubspace.{u2, u3, u1} k V P _inst_1 _inst_2 _inst_3 S)))) (Top.top.{u3} (Submodule.{u2, u3} k V (Ring.toSemiring.{u2} k _inst_1) (AddCommGroup.toAddCommMonoid.{u3} V _inst_2) _inst_3) (Submodule.instTopSubmodule.{u2, u3} k V (Ring.toSemiring.{u2} k _inst_1) (AddCommGroup.toAddCommMonoid.{u3} V _inst_2) _inst_3)) Case conversion may be inaccurate. Consider using '#align affine_subspace.direction_top AffineSubspace.direction_topₓ'. -/ /-- The direction of `⊤` is the whole module as a submodule. -/ @[simp] theorem direction_top : (⊤ : AffineSubspace k P).direction = ⊤ := by cases' S.nonempty with p ext v refine' ⟨imp_intro Submodule.mem_top, fun hv => _⟩ have hpv : (v +ᵥ p -ᵥ p : V) ∈ (⊤ : AffineSubspace k P).direction := vsub_mem_direction (mem_top k V _) (mem_top k V _) rwa [vadd_vsub] at hpv #align affine_subspace.direction_top AffineSubspace.direction_top /- warning: affine_subspace.bot_coe -> AffineSubspace.bot_coe is a dubious translation: lean 3 declaration is forall (k : Type.{u1}) (V : Type.{u2}) (P : Type.{u3}) [_inst_1 : Ring.{u1} k] [_inst_2 : AddCommGroup.{u2} V] [_inst_3 : Module.{u1, u2} k V (Ring.toSemiring.{u1} k _inst_1) (AddCommGroup.toAddCommMonoid.{u2} V _inst_2)] [S : AddTorsor.{u2, u3} V P (AddCommGroup.toAddGroup.{u2} V _inst_2)], Eq.{succ u3} (Set.{u3} P) ((fun (a : Type.{u3}) (b : Type.{u3}) [self : HasLiftT.{succ u3, succ u3} a b] => self.0) (AffineSubspace.{u1, u2, u3} k V P _inst_1 _inst_2 _inst_3 S) (Set.{u3} P) (HasLiftT.mk.{succ u3, succ u3} (AffineSubspace.{u1, u2, u3} k V P _inst_1 _inst_2 _inst_3 S) (Set.{u3} P) (CoeTCₓ.coe.{succ u3, succ u3} (AffineSubspace.{u1, u2, u3} k V P _inst_1 _inst_2 _inst_3 S) (Set.{u3} P) (SetLike.Set.hasCoeT.{u3, u3} (AffineSubspace.{u1, u2, u3} k V P _inst_1 _inst_2 _inst_3 S) P (AffineSubspace.setLike.{u1, u2, u3} k V P _inst_1 _inst_2 _inst_3 S)))) (Bot.bot.{u3} (AffineSubspace.{u1, u2, u3} k V P _inst_1 _inst_2 _inst_3 S) (CompleteLattice.toHasBot.{u3} (AffineSubspace.{u1, u2, u3} k V P _inst_1 _inst_2 _inst_3 S) (AffineSubspace.completeLattice.{u1, u2, u3} k V P _inst_1 _inst_2 _inst_3 S)))) (EmptyCollection.emptyCollection.{u3} (Set.{u3} P) (Set.hasEmptyc.{u3} P)) but is expected to have type forall (k : Type.{u2}) (V : Type.{u1}) (P : Type.{u3}) [_inst_1 : Ring.{u2} k] [_inst_2 : AddCommGroup.{u1} V] [_inst_3 : Module.{u2, u1} k V (Ring.toSemiring.{u2} k _inst_1) (AddCommGroup.toAddCommMonoid.{u1} V _inst_2)] [S : AddTorsor.{u1, u3} V P (AddCommGroup.toAddGroup.{u1} V _inst_2)], Eq.{succ u3} (Set.{u3} P) (SetLike.coe.{u3, u3} (AffineSubspace.{u2, u1, u3} k V P _inst_1 _inst_2 _inst_3 S) P (AffineSubspace.instSetLikeAffineSubspace.{u2, u1, u3} k V P _inst_1 _inst_2 _inst_3 S) (Bot.bot.{u3} (AffineSubspace.{u2, u1, u3} k V P _inst_1 _inst_2 _inst_3 S) (CompleteLattice.toBot.{u3} (AffineSubspace.{u2, u1, u3} k V P _inst_1 _inst_2 _inst_3 S) (AffineSubspace.instCompleteLatticeAffineSubspace.{u2, u1, u3} k V P _inst_1 _inst_2 _inst_3 S)))) (EmptyCollection.emptyCollection.{u3} (Set.{u3} P) (Set.instEmptyCollectionSet.{u3} P)) Case conversion may be inaccurate. Consider using '#align affine_subspace.bot_coe AffineSubspace.bot_coeₓ'. -/ /-- `⊥`, coerced to a set, is the empty set. -/ @[simp] theorem bot_coe : ((⊥ : AffineSubspace k P) : Set P) = ∅ := rfl #align affine_subspace.bot_coe AffineSubspace.bot_coe /- warning: affine_subspace.bot_ne_top -> AffineSubspace.bot_ne_top is a dubious translation: lean 3 declaration is forall (k : Type.{u1}) (V : Type.{u2}) (P : Type.{u3}) [_inst_1 : Ring.{u1} k] [_inst_2 : AddCommGroup.{u2} V] [_inst_3 : Module.{u1, u2} k V (Ring.toSemiring.{u1} k _inst_1) (AddCommGroup.toAddCommMonoid.{u2} V _inst_2)] [S : AddTorsor.{u2, u3} V P (AddCommGroup.toAddGroup.{u2} V _inst_2)], Ne.{succ u3} (AffineSubspace.{u1, u2, u3} k V P _inst_1 _inst_2 _inst_3 S) (Bot.bot.{u3} (AffineSubspace.{u1, u2, u3} k V P _inst_1 _inst_2 _inst_3 S) (CompleteLattice.toHasBot.{u3} (AffineSubspace.{u1, u2, u3} k V P _inst_1 _inst_2 _inst_3 S) (AffineSubspace.completeLattice.{u1, u2, u3} k V P _inst_1 _inst_2 _inst_3 S))) (Top.top.{u3} (AffineSubspace.{u1, u2, u3} k V P _inst_1 _inst_2 _inst_3 S) (CompleteLattice.toHasTop.{u3} (AffineSubspace.{u1, u2, u3} k V P _inst_1 _inst_2 _inst_3 S) (AffineSubspace.completeLattice.{u1, u2, u3} k V P _inst_1 _inst_2 _inst_3 S))) but is expected to have type forall (k : Type.{u2}) (V : Type.{u1}) (P : Type.{u3}) [_inst_1 : Ring.{u2} k] [_inst_2 : AddCommGroup.{u1} V] [_inst_3 : Module.{u2, u1} k V (Ring.toSemiring.{u2} k _inst_1) (AddCommGroup.toAddCommMonoid.{u1} V _inst_2)] [S : AddTorsor.{u1, u3} V P (AddCommGroup.toAddGroup.{u1} V _inst_2)], Ne.{succ u3} (AffineSubspace.{u2, u1, u3} k V P _inst_1 _inst_2 _inst_3 S) (Bot.bot.{u3} (AffineSubspace.{u2, u1, u3} k V P _inst_1 _inst_2 _inst_3 S) (CompleteLattice.toBot.{u3} (AffineSubspace.{u2, u1, u3} k V P _inst_1 _inst_2 _inst_3 S) (AffineSubspace.instCompleteLatticeAffineSubspace.{u2, u1, u3} k V P _inst_1 _inst_2 _inst_3 S))) (Top.top.{u3} (AffineSubspace.{u2, u1, u3} k V P _inst_1 _inst_2 _inst_3 S) (CompleteLattice.toTop.{u3} (AffineSubspace.{u2, u1, u3} k V P _inst_1 _inst_2 _inst_3 S) (AffineSubspace.instCompleteLatticeAffineSubspace.{u2, u1, u3} k V P _inst_1 _inst_2 _inst_3 S))) Case conversion may be inaccurate. Consider using '#align affine_subspace.bot_ne_top AffineSubspace.bot_ne_topₓ'. -/ theorem bot_ne_top : (⊥ : AffineSubspace k P) ≠ ⊤ := by intro contra rw [← ext_iff, bot_coe, top_coe] at contra exact Set.empty_ne_univ contra #align affine_subspace.bot_ne_top AffineSubspace.bot_ne_top instance : Nontrivial (AffineSubspace k P) := ⟨⟨⊥, ⊤, bot_ne_top k V P⟩⟩ /- warning: affine_subspace.nonempty_of_affine_span_eq_top -> AffineSubspace.nonempty_of_affineSpan_eq_top is a dubious translation: lean 3 declaration is forall (k : Type.{u1}) (V : Type.{u2}) (P : Type.{u3}) [_inst_1 : Ring.{u1} k] [_inst_2 : AddCommGroup.{u2} V] [_inst_3 : Module.{u1, u2} k V (Ring.toSemiring.{u1} k _inst_1) (AddCommGroup.toAddCommMonoid.{u2} V _inst_2)] [S : AddTorsor.{u2, u3} V P (AddCommGroup.toAddGroup.{u2} V _inst_2)] {s : Set.{u3} P}, (Eq.{succ u3} (AffineSubspace.{u1, u2, u3} k V P _inst_1 _inst_2 _inst_3 S) (affineSpan.{u1, u2, u3} k V P _inst_1 _inst_2 _inst_3 S s) (Top.top.{u3} (AffineSubspace.{u1, u2, u3} k V P _inst_1 _inst_2 _inst_3 S) (CompleteLattice.toHasTop.{u3} (AffineSubspace.{u1, u2, u3} k V P _inst_1 _inst_2 _inst_3 S) (AffineSubspace.completeLattice.{u1, u2, u3} k V P _inst_1 _inst_2 _inst_3 S)))) -> (Set.Nonempty.{u3} P s) but is expected to have type forall (k : Type.{u2}) (V : Type.{u1}) (P : Type.{u3}) [_inst_1 : Ring.{u2} k] [_inst_2 : AddCommGroup.{u1} V] [_inst_3 : Module.{u2, u1} k V (Ring.toSemiring.{u2} k _inst_1) (AddCommGroup.toAddCommMonoid.{u1} V _inst_2)] [S : AddTorsor.{u1, u3} V P (AddCommGroup.toAddGroup.{u1} V _inst_2)] {s : Set.{u3} P}, (Eq.{succ u3} (AffineSubspace.{u2, u1, u3} k V P _inst_1 _inst_2 _inst_3 S) (affineSpan.{u2, u1, u3} k V P _inst_1 _inst_2 _inst_3 S s) (Top.top.{u3} (AffineSubspace.{u2, u1, u3} k V P _inst_1 _inst_2 _inst_3 S) (CompleteLattice.toTop.{u3} (AffineSubspace.{u2, u1, u3} k V P _inst_1 _inst_2 _inst_3 S) (AffineSubspace.instCompleteLatticeAffineSubspace.{u2, u1, u3} k V P _inst_1 _inst_2 _inst_3 S)))) -> (Set.Nonempty.{u3} P s) Case conversion may be inaccurate. Consider using '#align affine_subspace.nonempty_of_affine_span_eq_top AffineSubspace.nonempty_of_affineSpan_eq_topₓ'. -/ theorem nonempty_of_affineSpan_eq_top {s : Set P} (h : affineSpan k s = ⊤) : s.Nonempty := by rw [Set.nonempty_iff_ne_empty] rintro rfl rw [AffineSubspace.span_empty] at h exact bot_ne_top k V P h #align affine_subspace.nonempty_of_affine_span_eq_top AffineSubspace.nonempty_of_affineSpan_eq_top /- warning: affine_subspace.vector_span_eq_top_of_affine_span_eq_top -> AffineSubspace.vectorSpan_eq_top_of_affineSpan_eq_top is a dubious translation: lean 3 declaration is forall (k : Type.{u1}) (V : Type.{u2}) (P : Type.{u3}) [_inst_1 : Ring.{u1} k] [_inst_2 : AddCommGroup.{u2} V] [_inst_3 : Module.{u1, u2} k V (Ring.toSemiring.{u1} k _inst_1) (AddCommGroup.toAddCommMonoid.{u2} V _inst_2)] [S : AddTorsor.{u2, u3} V P (AddCommGroup.toAddGroup.{u2} V _inst_2)] {s : Set.{u3} P}, (Eq.{succ u3} (AffineSubspace.{u1, u2, u3} k V P _inst_1 _inst_2 _inst_3 S) (affineSpan.{u1, u2, u3} k V P _inst_1 _inst_2 _inst_3 S s) (Top.top.{u3} (AffineSubspace.{u1, u2, u3} k V P _inst_1 _inst_2 _inst_3 S) (CompleteLattice.toHasTop.{u3} (AffineSubspace.{u1, u2, u3} k V P _inst_1 _inst_2 _inst_3 S) (AffineSubspace.completeLattice.{u1, u2, u3} k V P _inst_1 _inst_2 _inst_3 S)))) -> (Eq.{succ u2} (Submodule.{u1, u2} k V (Ring.toSemiring.{u1} k _inst_1) (AddCommGroup.toAddCommMonoid.{u2} V _inst_2) _inst_3) (vectorSpan.{u1, u2, u3} k V P _inst_1 _inst_2 _inst_3 S s) (Top.top.{u2} (Submodule.{u1, u2} k V (Ring.toSemiring.{u1} k _inst_1) (AddCommGroup.toAddCommMonoid.{u2} V _inst_2) _inst_3) (Submodule.hasTop.{u1, u2} k V (Ring.toSemiring.{u1} k _inst_1) (AddCommGroup.toAddCommMonoid.{u2} V _inst_2) _inst_3))) but is expected to have type forall (k : Type.{u2}) (V : Type.{u1}) (P : Type.{u3}) [_inst_1 : Ring.{u2} k] [_inst_2 : AddCommGroup.{u1} V] [_inst_3 : Module.{u2, u1} k V (Ring.toSemiring.{u2} k _inst_1) (AddCommGroup.toAddCommMonoid.{u1} V _inst_2)] [S : AddTorsor.{u1, u3} V P (AddCommGroup.toAddGroup.{u1} V _inst_2)] {s : Set.{u3} P}, (Eq.{succ u3} (AffineSubspace.{u2, u1, u3} k V P _inst_1 _inst_2 _inst_3 S) (affineSpan.{u2, u1, u3} k V P _inst_1 _inst_2 _inst_3 S s) (Top.top.{u3} (AffineSubspace.{u2, u1, u3} k V P _inst_1 _inst_2 _inst_3 S) (CompleteLattice.toTop.{u3} (AffineSubspace.{u2, u1, u3} k V P _inst_1 _inst_2 _inst_3 S) (AffineSubspace.instCompleteLatticeAffineSubspace.{u2, u1, u3} k V P _inst_1 _inst_2 _inst_3 S)))) -> (Eq.{succ u1} (Submodule.{u2, u1} k V (Ring.toSemiring.{u2} k _inst_1) (AddCommGroup.toAddCommMonoid.{u1} V _inst_2) _inst_3) (vectorSpan.{u2, u1, u3} k V P _inst_1 _inst_2 _inst_3 S s) (Top.top.{u1} (Submodule.{u2, u1} k V (Ring.toSemiring.{u2} k _inst_1) (AddCommGroup.toAddCommMonoid.{u1} V _inst_2) _inst_3) (Submodule.instTopSubmodule.{u2, u1} k V (Ring.toSemiring.{u2} k _inst_1) (AddCommGroup.toAddCommMonoid.{u1} V _inst_2) _inst_3))) Case conversion may be inaccurate. Consider using '#align affine_subspace.vector_span_eq_top_of_affine_span_eq_top AffineSubspace.vectorSpan_eq_top_of_affineSpan_eq_topₓ'. -/ /-- If the affine span of a set is `⊤`, then the vector span of the same set is the `⊤`. -/ theorem vectorSpan_eq_top_of_affineSpan_eq_top {s : Set P} (h : affineSpan k s = ⊤) : vectorSpan k s = ⊤ := by rw [← direction_affineSpan, h, direction_top] #align affine_subspace.vector_span_eq_top_of_affine_span_eq_top AffineSubspace.vectorSpan_eq_top_of_affineSpan_eq_top /- warning: affine_subspace.affine_span_eq_top_iff_vector_span_eq_top_of_nonempty -> AffineSubspace.affineSpan_eq_top_iff_vectorSpan_eq_top_of_nonempty is a dubious translation: lean 3 declaration is forall (k : Type.{u1}) (V : Type.{u2}) (P : Type.{u3}) [_inst_1 : Ring.{u1} k] [_inst_2 : AddCommGroup.{u2} V] [_inst_3 : Module.{u1, u2} k V (Ring.toSemiring.{u1} k _inst_1) (AddCommGroup.toAddCommMonoid.{u2} V _inst_2)] [S : AddTorsor.{u2, u3} V P (AddCommGroup.toAddGroup.{u2} V _inst_2)] {s : Set.{u3} P}, (Set.Nonempty.{u3} P s) -> (Iff (Eq.{succ u3} (AffineSubspace.{u1, u2, u3} k V P _inst_1 _inst_2 _inst_3 S) (affineSpan.{u1, u2, u3} k V P _inst_1 _inst_2 _inst_3 S s) (Top.top.{u3} (AffineSubspace.{u1, u2, u3} k V P _inst_1 _inst_2 _inst_3 S) (CompleteLattice.toHasTop.{u3} (AffineSubspace.{u1, u2, u3} k V P _inst_1 _inst_2 _inst_3 S) (AffineSubspace.completeLattice.{u1, u2, u3} k V P _inst_1 _inst_2 _inst_3 S)))) (Eq.{succ u2} (Submodule.{u1, u2} k V (Ring.toSemiring.{u1} k _inst_1) (AddCommGroup.toAddCommMonoid.{u2} V _inst_2) _inst_3) (vectorSpan.{u1, u2, u3} k V P _inst_1 _inst_2 _inst_3 S s) (Top.top.{u2} (Submodule.{u1, u2} k V (Ring.toSemiring.{u1} k _inst_1) (AddCommGroup.toAddCommMonoid.{u2} V _inst_2) _inst_3) (Submodule.hasTop.{u1, u2} k V (Ring.toSemiring.{u1} k _inst_1) (AddCommGroup.toAddCommMonoid.{u2} V _inst_2) _inst_3)))) but is expected to have type forall (k : Type.{u2}) (V : Type.{u1}) (P : Type.{u3}) [_inst_1 : Ring.{u2} k] [_inst_2 : AddCommGroup.{u1} V] [_inst_3 : Module.{u2, u1} k V (Ring.toSemiring.{u2} k _inst_1) (AddCommGroup.toAddCommMonoid.{u1} V _inst_2)] [S : AddTorsor.{u1, u3} V P (AddCommGroup.toAddGroup.{u1} V _inst_2)] {s : Set.{u3} P}, (Set.Nonempty.{u3} P s) -> (Iff (Eq.{succ u3} (AffineSubspace.{u2, u1, u3} k V P _inst_1 _inst_2 _inst_3 S) (affineSpan.{u2, u1, u3} k V P _inst_1 _inst_2 _inst_3 S s) (Top.top.{u3} (AffineSubspace.{u2, u1, u3} k V P _inst_1 _inst_2 _inst_3 S) (CompleteLattice.toTop.{u3} (AffineSubspace.{u2, u1, u3} k V P _inst_1 _inst_2 _inst_3 S) (AffineSubspace.instCompleteLatticeAffineSubspace.{u2, u1, u3} k V P _inst_1 _inst_2 _inst_3 S)))) (Eq.{succ u1} (Submodule.{u2, u1} k V (Ring.toSemiring.{u2} k _inst_1) (AddCommGroup.toAddCommMonoid.{u1} V _inst_2) _inst_3) (vectorSpan.{u2, u1, u3} k V P _inst_1 _inst_2 _inst_3 S s) (Top.top.{u1} (Submodule.{u2, u1} k V (Ring.toSemiring.{u2} k _inst_1) (AddCommGroup.toAddCommMonoid.{u1} V _inst_2) _inst_3) (Submodule.instTopSubmodule.{u2, u1} k V (Ring.toSemiring.{u2} k _inst_1) (AddCommGroup.toAddCommMonoid.{u1} V _inst_2) _inst_3)))) Case conversion may be inaccurate. Consider using '#align affine_subspace.affine_span_eq_top_iff_vector_span_eq_top_of_nonempty AffineSubspace.affineSpan_eq_top_iff_vectorSpan_eq_top_of_nonemptyₓ'. -/ /-- For a nonempty set, the affine span is `⊤` iff its vector span is `⊤`. -/ theorem affineSpan_eq_top_iff_vectorSpan_eq_top_of_nonempty {s : Set P} (hs : s.Nonempty) : affineSpan k s = ⊤ ↔ vectorSpan k s = ⊤ := by refine' ⟨vector_span_eq_top_of_affine_span_eq_top k V P, _⟩ intro h suffices Nonempty (affineSpan k s) by obtain ⟨p, hp : p ∈ affineSpan k s⟩ := this rw [eq_iff_direction_eq_of_mem hp (mem_top k V p), direction_affineSpan, h, direction_top] obtain ⟨x, hx⟩ := hs exact ⟨⟨x, mem_affineSpan k hx⟩⟩ #align affine_subspace.affine_span_eq_top_iff_vector_span_eq_top_of_nonempty AffineSubspace.affineSpan_eq_top_iff_vectorSpan_eq_top_of_nonempty /- warning: affine_subspace.affine_span_eq_top_iff_vector_span_eq_top_of_nontrivial -> AffineSubspace.affineSpan_eq_top_iff_vectorSpan_eq_top_of_nontrivial is a dubious translation: lean 3 declaration is forall (k : Type.{u1}) (V : Type.{u2}) (P : Type.{u3}) [_inst_1 : Ring.{u1} k] [_inst_2 : AddCommGroup.{u2} V] [_inst_3 : Module.{u1, u2} k V (Ring.toSemiring.{u1} k _inst_1) (AddCommGroup.toAddCommMonoid.{u2} V _inst_2)] [S : AddTorsor.{u2, u3} V P (AddCommGroup.toAddGroup.{u2} V _inst_2)] {s : Set.{u3} P} [_inst_4 : Nontrivial.{u3} P], Iff (Eq.{succ u3} (AffineSubspace.{u1, u2, u3} k V P _inst_1 _inst_2 _inst_3 S) (affineSpan.{u1, u2, u3} k V P _inst_1 _inst_2 _inst_3 S s) (Top.top.{u3} (AffineSubspace.{u1, u2, u3} k V P _inst_1 _inst_2 _inst_3 S) (CompleteLattice.toHasTop.{u3} (AffineSubspace.{u1, u2, u3} k V P _inst_1 _inst_2 _inst_3 S) (AffineSubspace.completeLattice.{u1, u2, u3} k V P _inst_1 _inst_2 _inst_3 S)))) (Eq.{succ u2} (Submodule.{u1, u2} k V (Ring.toSemiring.{u1} k _inst_1) (AddCommGroup.toAddCommMonoid.{u2} V _inst_2) _inst_3) (vectorSpan.{u1, u2, u3} k V P _inst_1 _inst_2 _inst_3 S s) (Top.top.{u2} (Submodule.{u1, u2} k V (Ring.toSemiring.{u1} k _inst_1) (AddCommGroup.toAddCommMonoid.{u2} V _inst_2) _inst_3) (Submodule.hasTop.{u1, u2} k V (Ring.toSemiring.{u1} k _inst_1) (AddCommGroup.toAddCommMonoid.{u2} V _inst_2) _inst_3))) but is expected to have type forall (k : Type.{u2}) (V : Type.{u1}) (P : Type.{u3}) [_inst_1 : Ring.{u2} k] [_inst_2 : AddCommGroup.{u1} V] [_inst_3 : Module.{u2, u1} k V (Ring.toSemiring.{u2} k _inst_1) (AddCommGroup.toAddCommMonoid.{u1} V _inst_2)] [S : AddTorsor.{u1, u3} V P (AddCommGroup.toAddGroup.{u1} V _inst_2)] {s : Set.{u3} P} [_inst_4 : Nontrivial.{u3} P], Iff (Eq.{succ u3} (AffineSubspace.{u2, u1, u3} k V P _inst_1 _inst_2 _inst_3 S) (affineSpan.{u2, u1, u3} k V P _inst_1 _inst_2 _inst_3 S s) (Top.top.{u3} (AffineSubspace.{u2, u1, u3} k V P _inst_1 _inst_2 _inst_3 S) (CompleteLattice.toTop.{u3} (AffineSubspace.{u2, u1, u3} k V P _inst_1 _inst_2 _inst_3 S) (AffineSubspace.instCompleteLatticeAffineSubspace.{u2, u1, u3} k V P _inst_1 _inst_2 _inst_3 S)))) (Eq.{succ u1} (Submodule.{u2, u1} k V (Ring.toSemiring.{u2} k _inst_1) (AddCommGroup.toAddCommMonoid.{u1} V _inst_2) _inst_3) (vectorSpan.{u2, u1, u3} k V P _inst_1 _inst_2 _inst_3 S s) (Top.top.{u1} (Submodule.{u2, u1} k V (Ring.toSemiring.{u2} k _inst_1) (AddCommGroup.toAddCommMonoid.{u1} V _inst_2) _inst_3) (Submodule.instTopSubmodule.{u2, u1} k V (Ring.toSemiring.{u2} k _inst_1) (AddCommGroup.toAddCommMonoid.{u1} V _inst_2) _inst_3))) Case conversion may be inaccurate. Consider using '#align affine_subspace.affine_span_eq_top_iff_vector_span_eq_top_of_nontrivial AffineSubspace.affineSpan_eq_top_iff_vectorSpan_eq_top_of_nontrivialₓ'. -/ /-- For a non-trivial space, the affine span of a set is `⊤` iff its vector span is `⊤`. -/ theorem affineSpan_eq_top_iff_vectorSpan_eq_top_of_nontrivial {s : Set P} [Nontrivial P] : affineSpan k s = ⊤ ↔ vectorSpan k s = ⊤ := by cases' s.eq_empty_or_nonempty with hs hs · simp [hs, subsingleton_iff_bot_eq_top, AddTorsor.subsingleton_iff V P, not_subsingleton] · rw [affine_span_eq_top_iff_vector_span_eq_top_of_nonempty k V P hs] #align affine_subspace.affine_span_eq_top_iff_vector_span_eq_top_of_nontrivial AffineSubspace.affineSpan_eq_top_iff_vectorSpan_eq_top_of_nontrivial /- warning: affine_subspace.card_pos_of_affine_span_eq_top -> AffineSubspace.card_pos_of_affineSpan_eq_top is a dubious translation: lean 3 declaration is forall (k : Type.{u1}) (V : Type.{u2}) (P : Type.{u3}) [_inst_1 : Ring.{u1} k] [_inst_2 : AddCommGroup.{u2} V] [_inst_3 : Module.{u1, u2} k V (Ring.toSemiring.{u1} k _inst_1) (AddCommGroup.toAddCommMonoid.{u2} V _inst_2)] [S : AddTorsor.{u2, u3} V P (AddCommGroup.toAddGroup.{u2} V _inst_2)] {ι : Type.{u4}} [_inst_4 : Fintype.{u4} ι] {p : ι -> P}, (Eq.{succ u3} (AffineSubspace.{u1, u2, u3} k V P _inst_1 _inst_2 _inst_3 S) (affineSpan.{u1, u2, u3} k V P _inst_1 _inst_2 _inst_3 S (Set.range.{u3, succ u4} P ι p)) (Top.top.{u3} (AffineSubspace.{u1, u2, u3} k V P _inst_1 _inst_2 _inst_3 S) (CompleteLattice.toHasTop.{u3} (AffineSubspace.{u1, u2, u3} k V P _inst_1 _inst_2 _inst_3 S) (AffineSubspace.completeLattice.{u1, u2, u3} k V P _inst_1 _inst_2 _inst_3 S)))) -> (LT.lt.{0} Nat Nat.hasLt (OfNat.ofNat.{0} Nat 0 (OfNat.mk.{0} Nat 0 (Zero.zero.{0} Nat Nat.hasZero))) (Fintype.card.{u4} ι _inst_4)) but is expected to have type forall (k : Type.{u2}) (V : Type.{u1}) (P : Type.{u3}) [_inst_1 : Ring.{u2} k] [_inst_2 : AddCommGroup.{u1} V] [_inst_3 : Module.{u2, u1} k V (Ring.toSemiring.{u2} k _inst_1) (AddCommGroup.toAddCommMonoid.{u1} V _inst_2)] [S : AddTorsor.{u1, u3} V P (AddCommGroup.toAddGroup.{u1} V _inst_2)] {ι : Type.{u4}} [_inst_4 : Fintype.{u4} ι] {p : ι -> P}, (Eq.{succ u3} (AffineSubspace.{u2, u1, u3} k V P _inst_1 _inst_2 _inst_3 S) (affineSpan.{u2, u1, u3} k V P _inst_1 _inst_2 _inst_3 S (Set.range.{u3, succ u4} P ι p)) (Top.top.{u3} (AffineSubspace.{u2, u1, u3} k V P _inst_1 _inst_2 _inst_3 S) (CompleteLattice.toTop.{u3} (AffineSubspace.{u2, u1, u3} k V P _inst_1 _inst_2 _inst_3 S) (AffineSubspace.instCompleteLatticeAffineSubspace.{u2, u1, u3} k V P _inst_1 _inst_2 _inst_3 S)))) -> (LT.lt.{0} Nat instLTNat (OfNat.ofNat.{0} Nat 0 (instOfNatNat 0)) (Fintype.card.{u4} ι _inst_4)) Case conversion may be inaccurate. Consider using '#align affine_subspace.card_pos_of_affine_span_eq_top AffineSubspace.card_pos_of_affineSpan_eq_topₓ'. -/ theorem card_pos_of_affineSpan_eq_top {ι : Type _} [Fintype ι] {p : ι → P} (h : affineSpan k (range p) = ⊤) : 0 < Fintype.card ι := by obtain ⟨-, ⟨i, -⟩⟩ := nonempty_of_affine_span_eq_top k V P h exact fintype.card_pos_iff.mpr ⟨i⟩ #align affine_subspace.card_pos_of_affine_span_eq_top AffineSubspace.card_pos_of_affineSpan_eq_top variable {P} /- warning: affine_subspace.not_mem_bot -> AffineSubspace.not_mem_bot is a dubious translation: lean 3 declaration is forall (k : Type.{u1}) (V : Type.{u2}) {P : Type.{u3}} [_inst_1 : Ring.{u1} k] [_inst_2 : AddCommGroup.{u2} V] [_inst_3 : Module.{u1, u2} k V (Ring.toSemiring.{u1} k _inst_1) (AddCommGroup.toAddCommMonoid.{u2} V _inst_2)] [S : AddTorsor.{u2, u3} V P (AddCommGroup.toAddGroup.{u2} V _inst_2)] (p : P), Not (Membership.Mem.{u3, u3} P (AffineSubspace.{u1, u2, u3} k V P _inst_1 _inst_2 _inst_3 S) (SetLike.hasMem.{u3, u3} (AffineSubspace.{u1, u2, u3} k V P _inst_1 _inst_2 _inst_3 S) P (AffineSubspace.setLike.{u1, u2, u3} k V P _inst_1 _inst_2 _inst_3 S)) p (Bot.bot.{u3} (AffineSubspace.{u1, u2, u3} k V P _inst_1 _inst_2 _inst_3 S) (CompleteLattice.toHasBot.{u3} (AffineSubspace.{u1, u2, u3} k V P _inst_1 _inst_2 _inst_3 S) (AffineSubspace.completeLattice.{u1, u2, u3} k V P _inst_1 _inst_2 _inst_3 S)))) but is expected to have type forall (k : Type.{u2}) (V : Type.{u1}) {P : Type.{u3}} [_inst_1 : Ring.{u2} k] [_inst_2 : AddCommGroup.{u1} V] [_inst_3 : Module.{u2, u1} k V (Ring.toSemiring.{u2} k _inst_1) (AddCommGroup.toAddCommMonoid.{u1} V _inst_2)] [S : AddTorsor.{u1, u3} V P (AddCommGroup.toAddGroup.{u1} V _inst_2)] (p : P), Not (Membership.mem.{u3, u3} P (AffineSubspace.{u2, u1, u3} k V P _inst_1 _inst_2 _inst_3 S) (SetLike.instMembership.{u3, u3} (AffineSubspace.{u2, u1, u3} k V P _inst_1 _inst_2 _inst_3 S) P (AffineSubspace.instSetLikeAffineSubspace.{u2, u1, u3} k V P _inst_1 _inst_2 _inst_3 S)) p (Bot.bot.{u3} (AffineSubspace.{u2, u1, u3} k V P _inst_1 _inst_2 _inst_3 S) (CompleteLattice.toBot.{u3} (AffineSubspace.{u2, u1, u3} k V P _inst_1 _inst_2 _inst_3 S) (AffineSubspace.instCompleteLatticeAffineSubspace.{u2, u1, u3} k V P _inst_1 _inst_2 _inst_3 S)))) Case conversion may be inaccurate. Consider using '#align affine_subspace.not_mem_bot AffineSubspace.not_mem_botₓ'. -/ /-- No points are in `⊥`. -/ theorem not_mem_bot (p : P) : p ∉ (⊥ : AffineSubspace k P) := Set.not_mem_empty p #align affine_subspace.not_mem_bot AffineSubspace.not_mem_bot variable (P) /- warning: affine_subspace.direction_bot -> AffineSubspace.direction_bot is a dubious translation: lean 3 declaration is forall (k : Type.{u1}) (V : Type.{u2}) (P : Type.{u3}) [_inst_1 : Ring.{u1} k] [_inst_2 : AddCommGroup.{u2} V] [_inst_3 : Module.{u1, u2} k V (Ring.toSemiring.{u1} k _inst_1) (AddCommGroup.toAddCommMonoid.{u2} V _inst_2)] [S : AddTorsor.{u2, u3} V P (AddCommGroup.toAddGroup.{u2} V _inst_2)], Eq.{succ u2} (Submodule.{u1, u2} k V (Ring.toSemiring.{u1} k _inst_1) (AddCommGroup.toAddCommMonoid.{u2} V _inst_2) _inst_3) (AffineSubspace.direction.{u1, u2, u3} k V P _inst_1 _inst_2 _inst_3 S (Bot.bot.{u3} (AffineSubspace.{u1, u2, u3} k V P _inst_1 _inst_2 _inst_3 S) (CompleteLattice.toHasBot.{u3} (AffineSubspace.{u1, u2, u3} k V P _inst_1 _inst_2 _inst_3 S) (AffineSubspace.completeLattice.{u1, u2, u3} k V P _inst_1 _inst_2 _inst_3 S)))) (Bot.bot.{u2} (Submodule.{u1, u2} k V (Ring.toSemiring.{u1} k _inst_1) (AddCommGroup.toAddCommMonoid.{u2} V _inst_2) _inst_3) (Submodule.hasBot.{u1, u2} k V (Ring.toSemiring.{u1} k _inst_1) (AddCommGroup.toAddCommMonoid.{u2} V _inst_2) _inst_3)) but is expected to have type forall (k : Type.{u2}) (V : Type.{u3}) (P : Type.{u1}) [_inst_1 : Ring.{u2} k] [_inst_2 : AddCommGroup.{u3} V] [_inst_3 : Module.{u2, u3} k V (Ring.toSemiring.{u2} k _inst_1) (AddCommGroup.toAddCommMonoid.{u3} V _inst_2)] [S : AddTorsor.{u3, u1} V P (AddCommGroup.toAddGroup.{u3} V _inst_2)], Eq.{succ u3} (Submodule.{u2, u3} k V (Ring.toSemiring.{u2} k _inst_1) (AddCommGroup.toAddCommMonoid.{u3} V _inst_2) _inst_3) (AffineSubspace.direction.{u2, u3, u1} k V P _inst_1 _inst_2 _inst_3 S (Bot.bot.{u1} (AffineSubspace.{u2, u3, u1} k V P _inst_1 _inst_2 _inst_3 S) (CompleteLattice.toBot.{u1} (AffineSubspace.{u2, u3, u1} k V P _inst_1 _inst_2 _inst_3 S) (AffineSubspace.instCompleteLatticeAffineSubspace.{u2, u3, u1} k V P _inst_1 _inst_2 _inst_3 S)))) (Bot.bot.{u3} (Submodule.{u2, u3} k V (Ring.toSemiring.{u2} k _inst_1) (AddCommGroup.toAddCommMonoid.{u3} V _inst_2) _inst_3) (Submodule.instBotSubmodule.{u2, u3} k V (Ring.toSemiring.{u2} k _inst_1) (AddCommGroup.toAddCommMonoid.{u3} V _inst_2) _inst_3)) Case conversion may be inaccurate. Consider using '#align affine_subspace.direction_bot AffineSubspace.direction_botₓ'. -/ /-- The direction of `⊥` is the submodule `⊥`. -/ @[simp] theorem direction_bot : (⊥ : AffineSubspace k P).direction = ⊥ := by rw [direction_eq_vector_span, bot_coe, vectorSpan_def, vsub_empty, Submodule.span_empty] #align affine_subspace.direction_bot AffineSubspace.direction_bot variable {k V P} /- warning: affine_subspace.coe_eq_bot_iff -> AffineSubspace.coe_eq_bot_iff is a dubious translation: lean 3 declaration is forall {k : Type.{u1}} {V : Type.{u2}} {P : Type.{u3}} [_inst_1 : Ring.{u1} k] [_inst_2 : AddCommGroup.{u2} V] [_inst_3 : Module.{u1, u2} k V (Ring.toSemiring.{u1} k _inst_1) (AddCommGroup.toAddCommMonoid.{u2} V _inst_2)] [S : AddTorsor.{u2, u3} V P (AddCommGroup.toAddGroup.{u2} V _inst_2)] (Q : AffineSubspace.{u1, u2, u3} k V P _inst_1 _inst_2 _inst_3 S), Iff (Eq.{succ u3} (Set.{u3} P) ((fun (a : Type.{u3}) (b : Type.{u3}) [self : HasLiftT.{succ u3, succ u3} a b] => self.0) (AffineSubspace.{u1, u2, u3} k V P _inst_1 _inst_2 _inst_3 S) (Set.{u3} P) (HasLiftT.mk.{succ u3, succ u3} (AffineSubspace.{u1, u2, u3} k V P _inst_1 _inst_2 _inst_3 S) (Set.{u3} P) (CoeTCₓ.coe.{succ u3, succ u3} (AffineSubspace.{u1, u2, u3} k V P _inst_1 _inst_2 _inst_3 S) (Set.{u3} P) (SetLike.Set.hasCoeT.{u3, u3} (AffineSubspace.{u1, u2, u3} k V P _inst_1 _inst_2 _inst_3 S) P (AffineSubspace.setLike.{u1, u2, u3} k V P _inst_1 _inst_2 _inst_3 S)))) Q) (EmptyCollection.emptyCollection.{u3} (Set.{u3} P) (Set.hasEmptyc.{u3} P))) (Eq.{succ u3} (AffineSubspace.{u1, u2, u3} k V P _inst_1 _inst_2 _inst_3 S) Q (Bot.bot.{u3} (AffineSubspace.{u1, u2, u3} k V P _inst_1 _inst_2 _inst_3 S) (CompleteLattice.toHasBot.{u3} (AffineSubspace.{u1, u2, u3} k V P _inst_1 _inst_2 _inst_3 S) (AffineSubspace.completeLattice.{u1, u2, u3} k V P _inst_1 _inst_2 _inst_3 S)))) but is expected to have type forall {k : Type.{u3}} {V : Type.{u2}} {P : Type.{u1}} [_inst_1 : Ring.{u3} k] [_inst_2 : AddCommGroup.{u2} V] [_inst_3 : Module.{u3, u2} k V (Ring.toSemiring.{u3} k _inst_1) (AddCommGroup.toAddCommMonoid.{u2} V _inst_2)] [S : AddTorsor.{u2, u1} V P (AddCommGroup.toAddGroup.{u2} V _inst_2)] (Q : AffineSubspace.{u3, u2, u1} k V P _inst_1 _inst_2 _inst_3 S), Iff (Eq.{succ u1} (Set.{u1} P) (SetLike.coe.{u1, u1} (AffineSubspace.{u3, u2, u1} k V P _inst_1 _inst_2 _inst_3 S) P (AffineSubspace.instSetLikeAffineSubspace.{u3, u2, u1} k V P _inst_1 _inst_2 _inst_3 S) Q) (EmptyCollection.emptyCollection.{u1} (Set.{u1} P) (Set.instEmptyCollectionSet.{u1} P))) (Eq.{succ u1} (AffineSubspace.{u3, u2, u1} k V P _inst_1 _inst_2 _inst_3 S) Q (Bot.bot.{u1} (AffineSubspace.{u3, u2, u1} k V P _inst_1 _inst_2 _inst_3 S) (CompleteLattice.toBot.{u1} (AffineSubspace.{u3, u2, u1} k V P _inst_1 _inst_2 _inst_3 S) (AffineSubspace.instCompleteLatticeAffineSubspace.{u3, u2, u1} k V P _inst_1 _inst_2 _inst_3 S)))) Case conversion may be inaccurate. Consider using '#align affine_subspace.coe_eq_bot_iff AffineSubspace.coe_eq_bot_iffₓ'. -/ @[simp] theorem coe_eq_bot_iff (Q : AffineSubspace k P) : (Q : Set P) = ∅ ↔ Q = ⊥ := coe_injective.eq_iff' (bot_coe _ _ _) #align affine_subspace.coe_eq_bot_iff AffineSubspace.coe_eq_bot_iff /- warning: affine_subspace.coe_eq_univ_iff -> AffineSubspace.coe_eq_univ_iff is a dubious translation: lean 3 declaration is forall {k : Type.{u1}} {V : Type.{u2}} {P : Type.{u3}} [_inst_1 : Ring.{u1} k] [_inst_2 : AddCommGroup.{u2} V] [_inst_3 : Module.{u1, u2} k V (Ring.toSemiring.{u1} k _inst_1) (AddCommGroup.toAddCommMonoid.{u2} V _inst_2)] [S : AddTorsor.{u2, u3} V P (AddCommGroup.toAddGroup.{u2} V _inst_2)] (Q : AffineSubspace.{u1, u2, u3} k V P _inst_1 _inst_2 _inst_3 S), Iff (Eq.{succ u3} (Set.{u3} P) ((fun (a : Type.{u3}) (b : Type.{u3}) [self : HasLiftT.{succ u3, succ u3} a b] => self.0) (AffineSubspace.{u1, u2, u3} k V P _inst_1 _inst_2 _inst_3 S) (Set.{u3} P) (HasLiftT.mk.{succ u3, succ u3} (AffineSubspace.{u1, u2, u3} k V P _inst_1 _inst_2 _inst_3 S) (Set.{u3} P) (CoeTCₓ.coe.{succ u3, succ u3} (AffineSubspace.{u1, u2, u3} k V P _inst_1 _inst_2 _inst_3 S) (Set.{u3} P) (SetLike.Set.hasCoeT.{u3, u3} (AffineSubspace.{u1, u2, u3} k V P _inst_1 _inst_2 _inst_3 S) P (AffineSubspace.setLike.{u1, u2, u3} k V P _inst_1 _inst_2 _inst_3 S)))) Q) (Set.univ.{u3} P)) (Eq.{succ u3} (AffineSubspace.{u1, u2, u3} k V P _inst_1 _inst_2 _inst_3 S) Q (Top.top.{u3} (AffineSubspace.{u1, u2, u3} k V P _inst_1 _inst_2 _inst_3 S) (CompleteLattice.toHasTop.{u3} (AffineSubspace.{u1, u2, u3} k V P _inst_1 _inst_2 _inst_3 S) (AffineSubspace.completeLattice.{u1, u2, u3} k V P _inst_1 _inst_2 _inst_3 S)))) but is expected to have type forall {k : Type.{u3}} {V : Type.{u2}} {P : Type.{u1}} [_inst_1 : Ring.{u3} k] [_inst_2 : AddCommGroup.{u2} V] [_inst_3 : Module.{u3, u2} k V (Ring.toSemiring.{u3} k _inst_1) (AddCommGroup.toAddCommMonoid.{u2} V _inst_2)] [S : AddTorsor.{u2, u1} V P (AddCommGroup.toAddGroup.{u2} V _inst_2)] (Q : AffineSubspace.{u3, u2, u1} k V P _inst_1 _inst_2 _inst_3 S), Iff (Eq.{succ u1} (Set.{u1} P) (SetLike.coe.{u1, u1} (AffineSubspace.{u3, u2, u1} k V P _inst_1 _inst_2 _inst_3 S) P (AffineSubspace.instSetLikeAffineSubspace.{u3, u2, u1} k V P _inst_1 _inst_2 _inst_3 S) Q) (Set.univ.{u1} P)) (Eq.{succ u1} (AffineSubspace.{u3, u2, u1} k V P _inst_1 _inst_2 _inst_3 S) Q (Top.top.{u1} (AffineSubspace.{u3, u2, u1} k V P _inst_1 _inst_2 _inst_3 S) (CompleteLattice.toTop.{u1} (AffineSubspace.{u3, u2, u1} k V P _inst_1 _inst_2 _inst_3 S) (AffineSubspace.instCompleteLatticeAffineSubspace.{u3, u2, u1} k V P _inst_1 _inst_2 _inst_3 S)))) Case conversion may be inaccurate. Consider using '#align affine_subspace.coe_eq_univ_iff AffineSubspace.coe_eq_univ_iffₓ'. -/ @[simp] theorem coe_eq_univ_iff (Q : AffineSubspace k P) : (Q : Set P) = univ ↔ Q = ⊤ := coe_injective.eq_iff' (top_coe _ _ _) #align affine_subspace.coe_eq_univ_iff AffineSubspace.coe_eq_univ_iff /- warning: affine_subspace.nonempty_iff_ne_bot -> AffineSubspace.nonempty_iff_ne_bot is a dubious translation: lean 3 declaration is forall {k : Type.{u1}} {V : Type.{u2}} {P : Type.{u3}} [_inst_1 : Ring.{u1} k] [_inst_2 : AddCommGroup.{u2} V] [_inst_3 : Module.{u1, u2} k V (Ring.toSemiring.{u1} k _inst_1) (AddCommGroup.toAddCommMonoid.{u2} V _inst_2)] [S : AddTorsor.{u2, u3} V P (AddCommGroup.toAddGroup.{u2} V _inst_2)] (Q : AffineSubspace.{u1, u2, u3} k V P _inst_1 _inst_2 _inst_3 S), Iff (Set.Nonempty.{u3} P ((fun (a : Type.{u3}) (b : Type.{u3}) [self : HasLiftT.{succ u3, succ u3} a b] => self.0) (AffineSubspace.{u1, u2, u3} k V P _inst_1 _inst_2 _inst_3 S) (Set.{u3} P) (HasLiftT.mk.{succ u3, succ u3} (AffineSubspace.{u1, u2, u3} k V P _inst_1 _inst_2 _inst_3 S) (Set.{u3} P) (CoeTCₓ.coe.{succ u3, succ u3} (AffineSubspace.{u1, u2, u3} k V P _inst_1 _inst_2 _inst_3 S) (Set.{u3} P) (SetLike.Set.hasCoeT.{u3, u3} (AffineSubspace.{u1, u2, u3} k V P _inst_1 _inst_2 _inst_3 S) P (AffineSubspace.setLike.{u1, u2, u3} k V P _inst_1 _inst_2 _inst_3 S)))) Q)) (Ne.{succ u3} (AffineSubspace.{u1, u2, u3} k V P _inst_1 _inst_2 _inst_3 S) Q (Bot.bot.{u3} (AffineSubspace.{u1, u2, u3} k V P _inst_1 _inst_2 _inst_3 S) (CompleteLattice.toHasBot.{u3} (AffineSubspace.{u1, u2, u3} k V P _inst_1 _inst_2 _inst_3 S) (AffineSubspace.completeLattice.{u1, u2, u3} k V P _inst_1 _inst_2 _inst_3 S)))) but is expected to have type forall {k : Type.{u3}} {V : Type.{u2}} {P : Type.{u1}} [_inst_1 : Ring.{u3} k] [_inst_2 : AddCommGroup.{u2} V] [_inst_3 : Module.{u3, u2} k V (Ring.toSemiring.{u3} k _inst_1) (AddCommGroup.toAddCommMonoid.{u2} V _inst_2)] [S : AddTorsor.{u2, u1} V P (AddCommGroup.toAddGroup.{u2} V _inst_2)] (Q : AffineSubspace.{u3, u2, u1} k V P _inst_1 _inst_2 _inst_3 S), Iff (Set.Nonempty.{u1} P (SetLike.coe.{u1, u1} (AffineSubspace.{u3, u2, u1} k V P _inst_1 _inst_2 _inst_3 S) P (AffineSubspace.instSetLikeAffineSubspace.{u3, u2, u1} k V P _inst_1 _inst_2 _inst_3 S) Q)) (Ne.{succ u1} (AffineSubspace.{u3, u2, u1} k V P _inst_1 _inst_2 _inst_3 S) Q (Bot.bot.{u1} (AffineSubspace.{u3, u2, u1} k V P _inst_1 _inst_2 _inst_3 S) (CompleteLattice.toBot.{u1} (AffineSubspace.{u3, u2, u1} k V P _inst_1 _inst_2 _inst_3 S) (AffineSubspace.instCompleteLatticeAffineSubspace.{u3, u2, u1} k V P _inst_1 _inst_2 _inst_3 S)))) Case conversion may be inaccurate. Consider using '#align affine_subspace.nonempty_iff_ne_bot AffineSubspace.nonempty_iff_ne_botₓ'. -/ theorem nonempty_iff_ne_bot (Q : AffineSubspace k P) : (Q : Set P).Nonempty ↔ Q ≠ ⊥ := by rw [nonempty_iff_ne_empty] exact not_congr Q.coe_eq_bot_iff #align affine_subspace.nonempty_iff_ne_bot AffineSubspace.nonempty_iff_ne_bot /- warning: affine_subspace.eq_bot_or_nonempty -> AffineSubspace.eq_bot_or_nonempty is a dubious translation: lean 3 declaration is forall {k : Type.{u1}} {V : Type.{u2}} {P : Type.{u3}} [_inst_1 : Ring.{u1} k] [_inst_2 : AddCommGroup.{u2} V] [_inst_3 : Module.{u1, u2} k V (Ring.toSemiring.{u1} k _inst_1) (AddCommGroup.toAddCommMonoid.{u2} V _inst_2)] [S : AddTorsor.{u2, u3} V P (AddCommGroup.toAddGroup.{u2} V _inst_2)] (Q : AffineSubspace.{u1, u2, u3} k V P _inst_1 _inst_2 _inst_3 S), Or (Eq.{succ u3} (AffineSubspace.{u1, u2, u3} k V P _inst_1 _inst_2 _inst_3 S) Q (Bot.bot.{u3} (AffineSubspace.{u1, u2, u3} k V P _inst_1 _inst_2 _inst_3 S) (CompleteLattice.toHasBot.{u3} (AffineSubspace.{u1, u2, u3} k V P _inst_1 _inst_2 _inst_3 S) (AffineSubspace.completeLattice.{u1, u2, u3} k V P _inst_1 _inst_2 _inst_3 S)))) (Set.Nonempty.{u3} P ((fun (a : Type.{u3}) (b : Type.{u3}) [self : HasLiftT.{succ u3, succ u3} a b] => self.0) (AffineSubspace.{u1, u2, u3} k V P _inst_1 _inst_2 _inst_3 S) (Set.{u3} P) (HasLiftT.mk.{succ u3, succ u3} (AffineSubspace.{u1, u2, u3} k V P _inst_1 _inst_2 _inst_3 S) (Set.{u3} P) (CoeTCₓ.coe.{succ u3, succ u3} (AffineSubspace.{u1, u2, u3} k V P _inst_1 _inst_2 _inst_3 S) (Set.{u3} P) (SetLike.Set.hasCoeT.{u3, u3} (AffineSubspace.{u1, u2, u3} k V P _inst_1 _inst_2 _inst_3 S) P (AffineSubspace.setLike.{u1, u2, u3} k V P _inst_1 _inst_2 _inst_3 S)))) Q)) but is expected to have type forall {k : Type.{u3}} {V : Type.{u2}} {P : Type.{u1}} [_inst_1 : Ring.{u3} k] [_inst_2 : AddCommGroup.{u2} V] [_inst_3 : Module.{u3, u2} k V (Ring.toSemiring.{u3} k _inst_1) (AddCommGroup.toAddCommMonoid.{u2} V _inst_2)] [S : AddTorsor.{u2, u1} V P (AddCommGroup.toAddGroup.{u2} V _inst_2)] (Q : AffineSubspace.{u3, u2, u1} k V P _inst_1 _inst_2 _inst_3 S), Or (Eq.{succ u1} (AffineSubspace.{u3, u2, u1} k V P _inst_1 _inst_2 _inst_3 S) Q (Bot.bot.{u1} (AffineSubspace.{u3, u2, u1} k V P _inst_1 _inst_2 _inst_3 S) (CompleteLattice.toBot.{u1} (AffineSubspace.{u3, u2, u1} k V P _inst_1 _inst_2 _inst_3 S) (AffineSubspace.instCompleteLatticeAffineSubspace.{u3, u2, u1} k V P _inst_1 _inst_2 _inst_3 S)))) (Set.Nonempty.{u1} P (SetLike.coe.{u1, u1} (AffineSubspace.{u3, u2, u1} k V P _inst_1 _inst_2 _inst_3 S) P (AffineSubspace.instSetLikeAffineSubspace.{u3, u2, u1} k V P _inst_1 _inst_2 _inst_3 S) Q)) Case conversion may be inaccurate. Consider using '#align affine_subspace.eq_bot_or_nonempty AffineSubspace.eq_bot_or_nonemptyₓ'. -/ theorem eq_bot_or_nonempty (Q : AffineSubspace k P) : Q = ⊥ ∨ (Q : Set P).Nonempty := by rw [nonempty_iff_ne_bot] apply eq_or_ne #align affine_subspace.eq_bot_or_nonempty AffineSubspace.eq_bot_or_nonempty /- warning: affine_subspace.subsingleton_of_subsingleton_span_eq_top -> AffineSubspace.subsingleton_of_subsingleton_span_eq_top is a dubious translation: lean 3 declaration is forall {k : Type.{u1}} {V : Type.{u2}} {P : Type.{u3}} [_inst_1 : Ring.{u1} k] [_inst_2 : AddCommGroup.{u2} V] [_inst_3 : Module.{u1, u2} k V (Ring.toSemiring.{u1} k _inst_1) (AddCommGroup.toAddCommMonoid.{u2} V _inst_2)] [S : AddTorsor.{u2, u3} V P (AddCommGroup.toAddGroup.{u2} V _inst_2)] {s : Set.{u3} P}, (Set.Subsingleton.{u3} P s) -> (Eq.{succ u3} (AffineSubspace.{u1, u2, u3} k V P _inst_1 _inst_2 _inst_3 S) (affineSpan.{u1, u2, u3} k V P _inst_1 _inst_2 _inst_3 S s) (Top.top.{u3} (AffineSubspace.{u1, u2, u3} k V P _inst_1 _inst_2 _inst_3 S) (CompleteLattice.toHasTop.{u3} (AffineSubspace.{u1, u2, u3} k V P _inst_1 _inst_2 _inst_3 S) (AffineSubspace.completeLattice.{u1, u2, u3} k V P _inst_1 _inst_2 _inst_3 S)))) -> (Subsingleton.{succ u3} P) but is expected to have type forall {k : Type.{u2}} {V : Type.{u1}} {P : Type.{u3}} [_inst_1 : Ring.{u2} k] [_inst_2 : AddCommGroup.{u1} V] [_inst_3 : Module.{u2, u1} k V (Ring.toSemiring.{u2} k _inst_1) (AddCommGroup.toAddCommMonoid.{u1} V _inst_2)] [S : AddTorsor.{u1, u3} V P (AddCommGroup.toAddGroup.{u1} V _inst_2)] {s : Set.{u3} P}, (Set.Subsingleton.{u3} P s) -> (Eq.{succ u3} (AffineSubspace.{u2, u1, u3} k V P _inst_1 _inst_2 _inst_3 S) (affineSpan.{u2, u1, u3} k V P _inst_1 _inst_2 _inst_3 S s) (Top.top.{u3} (AffineSubspace.{u2, u1, u3} k V P _inst_1 _inst_2 _inst_3 S) (CompleteLattice.toTop.{u3} (AffineSubspace.{u2, u1, u3} k V P _inst_1 _inst_2 _inst_3 S) (AffineSubspace.instCompleteLatticeAffineSubspace.{u2, u1, u3} k V P _inst_1 _inst_2 _inst_3 S)))) -> (Subsingleton.{succ u3} P) Case conversion may be inaccurate. Consider using '#align affine_subspace.subsingleton_of_subsingleton_span_eq_top AffineSubspace.subsingleton_of_subsingleton_span_eq_topₓ'. -/ theorem subsingleton_of_subsingleton_span_eq_top {s : Set P} (h₁ : s.Subsingleton) (h₂ : affineSpan k s = ⊤) : Subsingleton P := by obtain ⟨p, hp⟩ := AffineSubspace.nonempty_of_affineSpan_eq_top k V P h₂ have : s = {p} := subset.antisymm (fun q hq => h₁ hq hp) (by simp [hp]) rw [this, ← AffineSubspace.ext_iff, AffineSubspace.coe_affineSpan_singleton, AffineSubspace.top_coe, eq_comm, ← subsingleton_iff_singleton (mem_univ _)] at h₂ exact subsingleton_of_univ_subsingleton h₂ #align affine_subspace.subsingleton_of_subsingleton_span_eq_top AffineSubspace.subsingleton_of_subsingleton_span_eq_top /- warning: affine_subspace.eq_univ_of_subsingleton_span_eq_top -> AffineSubspace.eq_univ_of_subsingleton_span_eq_top is a dubious translation: lean 3 declaration is forall {k : Type.{u1}} {V : Type.{u2}} {P : Type.{u3}} [_inst_1 : Ring.{u1} k] [_inst_2 : AddCommGroup.{u2} V] [_inst_3 : Module.{u1, u2} k V (Ring.toSemiring.{u1} k _inst_1) (AddCommGroup.toAddCommMonoid.{u2} V _inst_2)] [S : AddTorsor.{u2, u3} V P (AddCommGroup.toAddGroup.{u2} V _inst_2)] {s : Set.{u3} P}, (Set.Subsingleton.{u3} P s) -> (Eq.{succ u3} (AffineSubspace.{u1, u2, u3} k V P _inst_1 _inst_2 _inst_3 S) (affineSpan.{u1, u2, u3} k V P _inst_1 _inst_2 _inst_3 S s) (Top.top.{u3} (AffineSubspace.{u1, u2, u3} k V P _inst_1 _inst_2 _inst_3 S) (CompleteLattice.toHasTop.{u3} (AffineSubspace.{u1, u2, u3} k V P _inst_1 _inst_2 _inst_3 S) (AffineSubspace.completeLattice.{u1, u2, u3} k V P _inst_1 _inst_2 _inst_3 S)))) -> (Eq.{succ u3} (Set.{u3} P) s (Set.univ.{u3} P)) but is expected to have type forall {k : Type.{u2}} {V : Type.{u1}} {P : Type.{u3}} [_inst_1 : Ring.{u2} k] [_inst_2 : AddCommGroup.{u1} V] [_inst_3 : Module.{u2, u1} k V (Ring.toSemiring.{u2} k _inst_1) (AddCommGroup.toAddCommMonoid.{u1} V _inst_2)] [S : AddTorsor.{u1, u3} V P (AddCommGroup.toAddGroup.{u1} V _inst_2)] {s : Set.{u3} P}, (Set.Subsingleton.{u3} P s) -> (Eq.{succ u3} (AffineSubspace.{u2, u1, u3} k V P _inst_1 _inst_2 _inst_3 S) (affineSpan.{u2, u1, u3} k V P _inst_1 _inst_2 _inst_3 S s) (Top.top.{u3} (AffineSubspace.{u2, u1, u3} k V P _inst_1 _inst_2 _inst_3 S) (CompleteLattice.toTop.{u3} (AffineSubspace.{u2, u1, u3} k V P _inst_1 _inst_2 _inst_3 S) (AffineSubspace.instCompleteLatticeAffineSubspace.{u2, u1, u3} k V P _inst_1 _inst_2 _inst_3 S)))) -> (Eq.{succ u3} (Set.{u3} P) s (Set.univ.{u3} P)) Case conversion may be inaccurate. Consider using '#align affine_subspace.eq_univ_of_subsingleton_span_eq_top AffineSubspace.eq_univ_of_subsingleton_span_eq_topₓ'. -/ theorem eq_univ_of_subsingleton_span_eq_top {s : Set P} (h₁ : s.Subsingleton) (h₂ : affineSpan k s = ⊤) : s = (univ : Set P) := by obtain ⟨p, hp⟩ := AffineSubspace.nonempty_of_affineSpan_eq_top k V P h₂ have : s = {p} := subset.antisymm (fun q hq => h₁ hq hp) (by simp [hp]) rw [this, eq_comm, ← subsingleton_iff_singleton (mem_univ p), subsingleton_univ_iff] exact subsingleton_of_subsingleton_span_eq_top h₁ h₂ #align affine_subspace.eq_univ_of_subsingleton_span_eq_top AffineSubspace.eq_univ_of_subsingleton_span_eq_top /- warning: affine_subspace.direction_eq_top_iff_of_nonempty -> AffineSubspace.direction_eq_top_iff_of_nonempty is a dubious translation: lean 3 declaration is forall {k : Type.{u1}} {V : Type.{u2}} {P : Type.{u3}} [_inst_1 : Ring.{u1} k] [_inst_2 : AddCommGroup.{u2} V] [_inst_3 : Module.{u1, u2} k V (Ring.toSemiring.{u1} k _inst_1) (AddCommGroup.toAddCommMonoid.{u2} V _inst_2)] [S : AddTorsor.{u2, u3} V P (AddCommGroup.toAddGroup.{u2} V _inst_2)] {s : AffineSubspace.{u1, u2, u3} k V P _inst_1 _inst_2 _inst_3 S}, (Set.Nonempty.{u3} P ((fun (a : Type.{u3}) (b : Type.{u3}) [self : HasLiftT.{succ u3, succ u3} a b] => self.0) (AffineSubspace.{u1, u2, u3} k V P _inst_1 _inst_2 _inst_3 S) (Set.{u3} P) (HasLiftT.mk.{succ u3, succ u3} (AffineSubspace.{u1, u2, u3} k V P _inst_1 _inst_2 _inst_3 S) (Set.{u3} P) (CoeTCₓ.coe.{succ u3, succ u3} (AffineSubspace.{u1, u2, u3} k V P _inst_1 _inst_2 _inst_3 S) (Set.{u3} P) (SetLike.Set.hasCoeT.{u3, u3} (AffineSubspace.{u1, u2, u3} k V P _inst_1 _inst_2 _inst_3 S) P (AffineSubspace.setLike.{u1, u2, u3} k V P _inst_1 _inst_2 _inst_3 S)))) s)) -> (Iff (Eq.{succ u2} (Submodule.{u1, u2} k V (Ring.toSemiring.{u1} k _inst_1) (AddCommGroup.toAddCommMonoid.{u2} V _inst_2) _inst_3) (AffineSubspace.direction.{u1, u2, u3} k V P _inst_1 _inst_2 _inst_3 S s) (Top.top.{u2} (Submodule.{u1, u2} k V (Ring.toSemiring.{u1} k _inst_1) (AddCommGroup.toAddCommMonoid.{u2} V _inst_2) _inst_3) (Submodule.hasTop.{u1, u2} k V (Ring.toSemiring.{u1} k _inst_1) (AddCommGroup.toAddCommMonoid.{u2} V _inst_2) _inst_3))) (Eq.{succ u3} (AffineSubspace.{u1, u2, u3} k V P _inst_1 _inst_2 _inst_3 S) s (Top.top.{u3} (AffineSubspace.{u1, u2, u3} k V P _inst_1 _inst_2 _inst_3 S) (CompleteLattice.toHasTop.{u3} (AffineSubspace.{u1, u2, u3} k V P _inst_1 _inst_2 _inst_3 S) (AffineSubspace.completeLattice.{u1, u2, u3} k V P _inst_1 _inst_2 _inst_3 S))))) but is expected to have type forall {k : Type.{u3}} {V : Type.{u2}} {P : Type.{u1}} [_inst_1 : Ring.{u3} k] [_inst_2 : AddCommGroup.{u2} V] [_inst_3 : Module.{u3, u2} k V (Ring.toSemiring.{u3} k _inst_1) (AddCommGroup.toAddCommMonoid.{u2} V _inst_2)] [S : AddTorsor.{u2, u1} V P (AddCommGroup.toAddGroup.{u2} V _inst_2)] {s : AffineSubspace.{u3, u2, u1} k V P _inst_1 _inst_2 _inst_3 S}, (Set.Nonempty.{u1} P (SetLike.coe.{u1, u1} (AffineSubspace.{u3, u2, u1} k V P _inst_1 _inst_2 _inst_3 S) P (AffineSubspace.instSetLikeAffineSubspace.{u3, u2, u1} k V P _inst_1 _inst_2 _inst_3 S) s)) -> (Iff (Eq.{succ u2} (Submodule.{u3, u2} k V (Ring.toSemiring.{u3} k _inst_1) (AddCommGroup.toAddCommMonoid.{u2} V _inst_2) _inst_3) (AffineSubspace.direction.{u3, u2, u1} k V P _inst_1 _inst_2 _inst_3 S s) (Top.top.{u2} (Submodule.{u3, u2} k V (Ring.toSemiring.{u3} k _inst_1) (AddCommGroup.toAddCommMonoid.{u2} V _inst_2) _inst_3) (Submodule.instTopSubmodule.{u3, u2} k V (Ring.toSemiring.{u3} k _inst_1) (AddCommGroup.toAddCommMonoid.{u2} V _inst_2) _inst_3))) (Eq.{succ u1} (AffineSubspace.{u3, u2, u1} k V P _inst_1 _inst_2 _inst_3 S) s (Top.top.{u1} (AffineSubspace.{u3, u2, u1} k V P _inst_1 _inst_2 _inst_3 S) (CompleteLattice.toTop.{u1} (AffineSubspace.{u3, u2, u1} k V P _inst_1 _inst_2 _inst_3 S) (AffineSubspace.instCompleteLatticeAffineSubspace.{u3, u2, u1} k V P _inst_1 _inst_2 _inst_3 S))))) Case conversion may be inaccurate. Consider using '#align affine_subspace.direction_eq_top_iff_of_nonempty AffineSubspace.direction_eq_top_iff_of_nonemptyₓ'. -/ /-- A nonempty affine subspace is `⊤` if and only if its direction is `⊤`. -/ @[simp] theorem direction_eq_top_iff_of_nonempty {s : AffineSubspace k P} (h : (s : Set P).Nonempty) : s.direction = ⊤ ↔ s = ⊤ := by constructor · intro hd rw [← direction_top k V P] at hd refine' ext_of_direction_eq hd _ simp [h] · rintro rfl simp #align affine_subspace.direction_eq_top_iff_of_nonempty AffineSubspace.direction_eq_top_iff_of_nonempty /- warning: affine_subspace.inf_coe -> AffineSubspace.inf_coe is a dubious translation: lean 3 declaration is forall {k : Type.{u1}} {V : Type.{u2}} {P : Type.{u3}} [_inst_1 : Ring.{u1} k] [_inst_2 : AddCommGroup.{u2} V] [_inst_3 : Module.{u1, u2} k V (Ring.toSemiring.{u1} k _inst_1) (AddCommGroup.toAddCommMonoid.{u2} V _inst_2)] [S : AddTorsor.{u2, u3} V P (AddCommGroup.toAddGroup.{u2} V _inst_2)] (s1 : AffineSubspace.{u1, u2, u3} k V P _inst_1 _inst_2 _inst_3 S) (s2 : AffineSubspace.{u1, u2, u3} k V P _inst_1 _inst_2 _inst_3 S), Eq.{succ u3} (Set.{u3} P) (Inf.inf.{u3} (Set.{u3} P) (SemilatticeInf.toHasInf.{u3} (Set.{u3} P) (Lattice.toSemilatticeInf.{u3} (Set.{u3} P) (ConditionallyCompleteLattice.toLattice.{u3} (Set.{u3} P) (CompleteLattice.toConditionallyCompleteLattice.{u3} (Set.{u3} P) (Order.Coframe.toCompleteLattice.{u3} (Set.{u3} P) (CompleteDistribLattice.toCoframe.{u3} (Set.{u3} P) (CompleteBooleanAlgebra.toCompleteDistribLattice.{u3} (Set.{u3} P) (Set.completeBooleanAlgebra.{u3} P)))))))) ((fun (a : Type.{u3}) (b : Type.{u3}) [self : HasLiftT.{succ u3, succ u3} a b] => self.0) (AffineSubspace.{u1, u2, u3} k V P _inst_1 _inst_2 _inst_3 S) (Set.{u3} P) (HasLiftT.mk.{succ u3, succ u3} (AffineSubspace.{u1, u2, u3} k V P _inst_1 _inst_2 _inst_3 S) (Set.{u3} P) (CoeTCₓ.coe.{succ u3, succ u3} (AffineSubspace.{u1, u2, u3} k V P _inst_1 _inst_2 _inst_3 S) (Set.{u3} P) (SetLike.Set.hasCoeT.{u3, u3} (AffineSubspace.{u1, u2, u3} k V P _inst_1 _inst_2 _inst_3 S) P (AffineSubspace.setLike.{u1, u2, u3} k V P _inst_1 _inst_2 _inst_3 S)))) s1) ((fun (a : Type.{u3}) (b : Type.{u3}) [self : HasLiftT.{succ u3, succ u3} a b] => self.0) (AffineSubspace.{u1, u2, u3} k V P _inst_1 _inst_2 _inst_3 S) (Set.{u3} P) (HasLiftT.mk.{succ u3, succ u3} (AffineSubspace.{u1, u2, u3} k V P _inst_1 _inst_2 _inst_3 S) (Set.{u3} P) (CoeTCₓ.coe.{succ u3, succ u3} (AffineSubspace.{u1, u2, u3} k V P _inst_1 _inst_2 _inst_3 S) (Set.{u3} P) (SetLike.Set.hasCoeT.{u3, u3} (AffineSubspace.{u1, u2, u3} k V P _inst_1 _inst_2 _inst_3 S) P (AffineSubspace.setLike.{u1, u2, u3} k V P _inst_1 _inst_2 _inst_3 S)))) s2)) (Inter.inter.{u3} (Set.{u3} P) (Set.hasInter.{u3} P) ((fun (a : Type.{u3}) (b : Type.{u3}) [self : HasLiftT.{succ u3, succ u3} a b] => self.0) (AffineSubspace.{u1, u2, u3} k V P _inst_1 _inst_2 _inst_3 S) (Set.{u3} P) (HasLiftT.mk.{succ u3, succ u3} (AffineSubspace.{u1, u2, u3} k V P _inst_1 _inst_2 _inst_3 S) (Set.{u3} P) (CoeTCₓ.coe.{succ u3, succ u3} (AffineSubspace.{u1, u2, u3} k V P _inst_1 _inst_2 _inst_3 S) (Set.{u3} P) (SetLike.Set.hasCoeT.{u3, u3} (AffineSubspace.{u1, u2, u3} k V P _inst_1 _inst_2 _inst_3 S) P (AffineSubspace.setLike.{u1, u2, u3} k V P _inst_1 _inst_2 _inst_3 S)))) s1) ((fun (a : Type.{u3}) (b : Type.{u3}) [self : HasLiftT.{succ u3, succ u3} a b] => self.0) (AffineSubspace.{u1, u2, u3} k V P _inst_1 _inst_2 _inst_3 S) (Set.{u3} P) (HasLiftT.mk.{succ u3, succ u3} (AffineSubspace.{u1, u2, u3} k V P _inst_1 _inst_2 _inst_3 S) (Set.{u3} P) (CoeTCₓ.coe.{succ u3, succ u3} (AffineSubspace.{u1, u2, u3} k V P _inst_1 _inst_2 _inst_3 S) (Set.{u3} P) (SetLike.Set.hasCoeT.{u3, u3} (AffineSubspace.{u1, u2, u3} k V P _inst_1 _inst_2 _inst_3 S) P (AffineSubspace.setLike.{u1, u2, u3} k V P _inst_1 _inst_2 _inst_3 S)))) s2)) but is expected to have type forall {k : Type.{u3}} {V : Type.{u2}} {P : Type.{u1}} [_inst_1 : Ring.{u3} k] [_inst_2 : AddCommGroup.{u2} V] [_inst_3 : Module.{u3, u2} k V (Ring.toSemiring.{u3} k _inst_1) (AddCommGroup.toAddCommMonoid.{u2} V _inst_2)] [S : AddTorsor.{u2, u1} V P (AddCommGroup.toAddGroup.{u2} V _inst_2)] (s1 : AffineSubspace.{u3, u2, u1} k V P _inst_1 _inst_2 _inst_3 S) (s2 : AffineSubspace.{u3, u2, u1} k V P _inst_1 _inst_2 _inst_3 S), Eq.{succ u1} (Set.{u1} P) (Inf.inf.{u1} (Set.{u1} P) (Lattice.toInf.{u1} (Set.{u1} P) (ConditionallyCompleteLattice.toLattice.{u1} (Set.{u1} P) (CompleteLattice.toConditionallyCompleteLattice.{u1} (Set.{u1} P) (Order.Coframe.toCompleteLattice.{u1} (Set.{u1} P) (CompleteDistribLattice.toCoframe.{u1} (Set.{u1} P) (CompleteBooleanAlgebra.toCompleteDistribLattice.{u1} (Set.{u1} P) (Set.instCompleteBooleanAlgebraSet.{u1} P))))))) (SetLike.coe.{u1, u1} (AffineSubspace.{u3, u2, u1} k V P _inst_1 _inst_2 _inst_3 S) P (AffineSubspace.instSetLikeAffineSubspace.{u3, u2, u1} k V P _inst_1 _inst_2 _inst_3 S) s1) (SetLike.coe.{u1, u1} (AffineSubspace.{u3, u2, u1} k V P _inst_1 _inst_2 _inst_3 S) P (AffineSubspace.instSetLikeAffineSubspace.{u3, u2, u1} k V P _inst_1 _inst_2 _inst_3 S) s2)) (Inter.inter.{u1} (Set.{u1} P) (Set.instInterSet.{u1} P) (SetLike.coe.{u1, u1} (AffineSubspace.{u3, u2, u1} k V P _inst_1 _inst_2 _inst_3 S) P (AffineSubspace.instSetLikeAffineSubspace.{u3, u2, u1} k V P _inst_1 _inst_2 _inst_3 S) s1) (SetLike.coe.{u1, u1} (AffineSubspace.{u3, u2, u1} k V P _inst_1 _inst_2 _inst_3 S) P (AffineSubspace.instSetLikeAffineSubspace.{u3, u2, u1} k V P _inst_1 _inst_2 _inst_3 S) s2)) Case conversion may be inaccurate. Consider using '#align affine_subspace.inf_coe AffineSubspace.inf_coeₓ'. -/ /-- The inf of two affine subspaces, coerced to a set, is the intersection of the two sets of points. -/ @[simp] theorem inf_coe (s1 s2 : AffineSubspace k P) : (s1 ⊓ s2 : Set P) = s1 ∩ s2 := rfl #align affine_subspace.inf_coe AffineSubspace.inf_coe /- warning: affine_subspace.mem_inf_iff -> AffineSubspace.mem_inf_iff is a dubious translation: lean 3 declaration is forall {k : Type.{u1}} {V : Type.{u2}} {P : Type.{u3}} [_inst_1 : Ring.{u1} k] [_inst_2 : AddCommGroup.{u2} V] [_inst_3 : Module.{u1, u2} k V (Ring.toSemiring.{u1} k _inst_1) (AddCommGroup.toAddCommMonoid.{u2} V _inst_2)] [S : AddTorsor.{u2, u3} V P (AddCommGroup.toAddGroup.{u2} V _inst_2)] (p : P) (s1 : AffineSubspace.{u1, u2, u3} k V P _inst_1 _inst_2 _inst_3 S) (s2 : AffineSubspace.{u1, u2, u3} k V P _inst_1 _inst_2 _inst_3 S), Iff (Membership.Mem.{u3, u3} P (AffineSubspace.{u1, u2, u3} k V P _inst_1 _inst_2 _inst_3 S) (SetLike.hasMem.{u3, u3} (AffineSubspace.{u1, u2, u3} k V P _inst_1 _inst_2 _inst_3 S) P (AffineSubspace.setLike.{u1, u2, u3} k V P _inst_1 _inst_2 _inst_3 S)) p (Inf.inf.{u3} (AffineSubspace.{u1, u2, u3} k V P _inst_1 _inst_2 _inst_3 S) (SemilatticeInf.toHasInf.{u3} (AffineSubspace.{u1, u2, u3} k V P _inst_1 _inst_2 _inst_3 S) (Lattice.toSemilatticeInf.{u3} (AffineSubspace.{u1, u2, u3} k V P _inst_1 _inst_2 _inst_3 S) (ConditionallyCompleteLattice.toLattice.{u3} (AffineSubspace.{u1, u2, u3} k V P _inst_1 _inst_2 _inst_3 S) (CompleteLattice.toConditionallyCompleteLattice.{u3} (AffineSubspace.{u1, u2, u3} k V P _inst_1 _inst_2 _inst_3 S) (AffineSubspace.completeLattice.{u1, u2, u3} k V P _inst_1 _inst_2 _inst_3 S))))) s1 s2)) (And (Membership.Mem.{u3, u3} P (AffineSubspace.{u1, u2, u3} k V P _inst_1 _inst_2 _inst_3 S) (SetLike.hasMem.{u3, u3} (AffineSubspace.{u1, u2, u3} k V P _inst_1 _inst_2 _inst_3 S) P (AffineSubspace.setLike.{u1, u2, u3} k V P _inst_1 _inst_2 _inst_3 S)) p s1) (Membership.Mem.{u3, u3} P (AffineSubspace.{u1, u2, u3} k V P _inst_1 _inst_2 _inst_3 S) (SetLike.hasMem.{u3, u3} (AffineSubspace.{u1, u2, u3} k V P _inst_1 _inst_2 _inst_3 S) P (AffineSubspace.setLike.{u1, u2, u3} k V P _inst_1 _inst_2 _inst_3 S)) p s2)) but is expected to have type forall {k : Type.{u3}} {V : Type.{u2}} {P : Type.{u1}} [_inst_1 : Ring.{u3} k] [_inst_2 : AddCommGroup.{u2} V] [_inst_3 : Module.{u3, u2} k V (Ring.toSemiring.{u3} k _inst_1) (AddCommGroup.toAddCommMonoid.{u2} V _inst_2)] [S : AddTorsor.{u2, u1} V P (AddCommGroup.toAddGroup.{u2} V _inst_2)] (p : P) (s1 : AffineSubspace.{u3, u2, u1} k V P _inst_1 _inst_2 _inst_3 S) (s2 : AffineSubspace.{u3, u2, u1} k V P _inst_1 _inst_2 _inst_3 S), Iff (Membership.mem.{u1, u1} P (AffineSubspace.{u3, u2, u1} k V P _inst_1 _inst_2 _inst_3 S) (SetLike.instMembership.{u1, u1} (AffineSubspace.{u3, u2, u1} k V P _inst_1 _inst_2 _inst_3 S) P (AffineSubspace.instSetLikeAffineSubspace.{u3, u2, u1} k V P _inst_1 _inst_2 _inst_3 S)) p (Inf.inf.{u1} (AffineSubspace.{u3, u2, u1} k V P _inst_1 _inst_2 _inst_3 S) (Lattice.toInf.{u1} (AffineSubspace.{u3, u2, u1} k V P _inst_1 _inst_2 _inst_3 S) (ConditionallyCompleteLattice.toLattice.{u1} (AffineSubspace.{u3, u2, u1} k V P _inst_1 _inst_2 _inst_3 S) (CompleteLattice.toConditionallyCompleteLattice.{u1} (AffineSubspace.{u3, u2, u1} k V P _inst_1 _inst_2 _inst_3 S) (AffineSubspace.instCompleteLatticeAffineSubspace.{u3, u2, u1} k V P _inst_1 _inst_2 _inst_3 S)))) s1 s2)) (And (Membership.mem.{u1, u1} P (AffineSubspace.{u3, u2, u1} k V P _inst_1 _inst_2 _inst_3 S) (SetLike.instMembership.{u1, u1} (AffineSubspace.{u3, u2, u1} k V P _inst_1 _inst_2 _inst_3 S) P (AffineSubspace.instSetLikeAffineSubspace.{u3, u2, u1} k V P _inst_1 _inst_2 _inst_3 S)) p s1) (Membership.mem.{u1, u1} P (AffineSubspace.{u3, u2, u1} k V P _inst_1 _inst_2 _inst_3 S) (SetLike.instMembership.{u1, u1} (AffineSubspace.{u3, u2, u1} k V P _inst_1 _inst_2 _inst_3 S) P (AffineSubspace.instSetLikeAffineSubspace.{u3, u2, u1} k V P _inst_1 _inst_2 _inst_3 S)) p s2)) Case conversion may be inaccurate. Consider using '#align affine_subspace.mem_inf_iff AffineSubspace.mem_inf_iffₓ'. -/ /-- A point is in the inf of two affine subspaces if and only if it is in both of them. -/ theorem mem_inf_iff (p : P) (s1 s2 : AffineSubspace k P) : p ∈ s1 ⊓ s2 ↔ p ∈ s1 ∧ p ∈ s2 := Iff.rfl #align affine_subspace.mem_inf_iff AffineSubspace.mem_inf_iff /- warning: affine_subspace.direction_inf -> AffineSubspace.direction_inf is a dubious translation: lean 3 declaration is forall {k : Type.{u1}} {V : Type.{u2}} {P : Type.{u3}} [_inst_1 : Ring.{u1} k] [_inst_2 : AddCommGroup.{u2} V] [_inst_3 : Module.{u1, u2} k V (Ring.toSemiring.{u1} k _inst_1) (AddCommGroup.toAddCommMonoid.{u2} V _inst_2)] [S : AddTorsor.{u2, u3} V P (AddCommGroup.toAddGroup.{u2} V _inst_2)] (s1 : AffineSubspace.{u1, u2, u3} k V P _inst_1 _inst_2 _inst_3 S) (s2 : AffineSubspace.{u1, u2, u3} k V P _inst_1 _inst_2 _inst_3 S), LE.le.{u2} (Submodule.{u1, u2} k V (Ring.toSemiring.{u1} k _inst_1) (AddCommGroup.toAddCommMonoid.{u2} V _inst_2) _inst_3) (Preorder.toLE.{u2} (Submodule.{u1, u2} k V (Ring.toSemiring.{u1} k _inst_1) (AddCommGroup.toAddCommMonoid.{u2} V _inst_2) _inst_3) (PartialOrder.toPreorder.{u2} (Submodule.{u1, u2} k V (Ring.toSemiring.{u1} k _inst_1) (AddCommGroup.toAddCommMonoid.{u2} V _inst_2) _inst_3) (SetLike.partialOrder.{u2, u2} (Submodule.{u1, u2} k V (Ring.toSemiring.{u1} k _inst_1) (AddCommGroup.toAddCommMonoid.{u2} V _inst_2) _inst_3) V (Submodule.setLike.{u1, u2} k V (Ring.toSemiring.{u1} k _inst_1) (AddCommGroup.toAddCommMonoid.{u2} V _inst_2) _inst_3)))) (AffineSubspace.direction.{u1, u2, u3} k V P _inst_1 _inst_2 _inst_3 S (Inf.inf.{u3} (AffineSubspace.{u1, u2, u3} k V P _inst_1 _inst_2 _inst_3 S) (SemilatticeInf.toHasInf.{u3} (AffineSubspace.{u1, u2, u3} k V P _inst_1 _inst_2 _inst_3 S) (Lattice.toSemilatticeInf.{u3} (AffineSubspace.{u1, u2, u3} k V P _inst_1 _inst_2 _inst_3 S) (ConditionallyCompleteLattice.toLattice.{u3} (AffineSubspace.{u1, u2, u3} k V P _inst_1 _inst_2 _inst_3 S) (CompleteLattice.toConditionallyCompleteLattice.{u3} (AffineSubspace.{u1, u2, u3} k V P _inst_1 _inst_2 _inst_3 S) (AffineSubspace.completeLattice.{u1, u2, u3} k V P _inst_1 _inst_2 _inst_3 S))))) s1 s2)) (Inf.inf.{u2} (Submodule.{u1, u2} k V (Ring.toSemiring.{u1} k _inst_1) (AddCommGroup.toAddCommMonoid.{u2} V _inst_2) _inst_3) (Submodule.hasInf.{u1, u2} k V (Ring.toSemiring.{u1} k _inst_1) (AddCommGroup.toAddCommMonoid.{u2} V _inst_2) _inst_3) (AffineSubspace.direction.{u1, u2, u3} k V P _inst_1 _inst_2 _inst_3 S s1) (AffineSubspace.direction.{u1, u2, u3} k V P _inst_1 _inst_2 _inst_3 S s2)) but is expected to have type forall {k : Type.{u3}} {V : Type.{u2}} {P : Type.{u1}} [_inst_1 : Ring.{u3} k] [_inst_2 : AddCommGroup.{u2} V] [_inst_3 : Module.{u3, u2} k V (Ring.toSemiring.{u3} k _inst_1) (AddCommGroup.toAddCommMonoid.{u2} V _inst_2)] [S : AddTorsor.{u2, u1} V P (AddCommGroup.toAddGroup.{u2} V _inst_2)] (s1 : AffineSubspace.{u3, u2, u1} k V P _inst_1 _inst_2 _inst_3 S) (s2 : AffineSubspace.{u3, u2, u1} k V P _inst_1 _inst_2 _inst_3 S), LE.le.{u2} (Submodule.{u3, u2} k V (Ring.toSemiring.{u3} k _inst_1) (AddCommGroup.toAddCommMonoid.{u2} V _inst_2) _inst_3) (Preorder.toLE.{u2} (Submodule.{u3, u2} k V (Ring.toSemiring.{u3} k _inst_1) (AddCommGroup.toAddCommMonoid.{u2} V _inst_2) _inst_3) (PartialOrder.toPreorder.{u2} (Submodule.{u3, u2} k V (Ring.toSemiring.{u3} k _inst_1) (AddCommGroup.toAddCommMonoid.{u2} V _inst_2) _inst_3) (OmegaCompletePartialOrder.toPartialOrder.{u2} (Submodule.{u3, u2} k V (Ring.toSemiring.{u3} k _inst_1) (AddCommGroup.toAddCommMonoid.{u2} V _inst_2) _inst_3) (CompleteLattice.instOmegaCompletePartialOrder.{u2} (Submodule.{u3, u2} k V (Ring.toSemiring.{u3} k _inst_1) (AddCommGroup.toAddCommMonoid.{u2} V _inst_2) _inst_3) (Submodule.completeLattice.{u3, u2} k V (Ring.toSemiring.{u3} k _inst_1) (AddCommGroup.toAddCommMonoid.{u2} V _inst_2) _inst_3))))) (AffineSubspace.direction.{u3, u2, u1} k V P _inst_1 _inst_2 _inst_3 S (Inf.inf.{u1} (AffineSubspace.{u3, u2, u1} k V P _inst_1 _inst_2 _inst_3 S) (Lattice.toInf.{u1} (AffineSubspace.{u3, u2, u1} k V P _inst_1 _inst_2 _inst_3 S) (ConditionallyCompleteLattice.toLattice.{u1} (AffineSubspace.{u3, u2, u1} k V P _inst_1 _inst_2 _inst_3 S) (CompleteLattice.toConditionallyCompleteLattice.{u1} (AffineSubspace.{u3, u2, u1} k V P _inst_1 _inst_2 _inst_3 S) (AffineSubspace.instCompleteLatticeAffineSubspace.{u3, u2, u1} k V P _inst_1 _inst_2 _inst_3 S)))) s1 s2)) (Inf.inf.{u2} (Submodule.{u3, u2} k V (Ring.toSemiring.{u3} k _inst_1) (AddCommGroup.toAddCommMonoid.{u2} V _inst_2) _inst_3) (Submodule.instInfSubmodule.{u3, u2} k V (Ring.toSemiring.{u3} k _inst_1) (AddCommGroup.toAddCommMonoid.{u2} V _inst_2) _inst_3) (AffineSubspace.direction.{u3, u2, u1} k V P _inst_1 _inst_2 _inst_3 S s1) (AffineSubspace.direction.{u3, u2, u1} k V P _inst_1 _inst_2 _inst_3 S s2)) Case conversion may be inaccurate. Consider using '#align affine_subspace.direction_inf AffineSubspace.direction_infₓ'. -/ /-- The direction of the inf of two affine subspaces is less than or equal to the inf of their directions. -/ theorem direction_inf (s1 s2 : AffineSubspace k P) : (s1 ⊓ s2).direction ≤ s1.direction ⊓ s2.direction := by repeat' rw [direction_eq_vector_span, vectorSpan_def] exact le_inf (infₛ_le_infₛ fun p hp => trans (vsub_self_mono (inter_subset_left _ _)) hp) (infₛ_le_infₛ fun p hp => trans (vsub_self_mono (inter_subset_right _ _)) hp) #align affine_subspace.direction_inf AffineSubspace.direction_inf /- warning: affine_subspace.direction_inf_of_mem -> AffineSubspace.direction_inf_of_mem is a dubious translation: lean 3 declaration is forall {k : Type.{u1}} {V : Type.{u2}} {P : Type.{u3}} [_inst_1 : Ring.{u1} k] [_inst_2 : AddCommGroup.{u2} V] [_inst_3 : Module.{u1, u2} k V (Ring.toSemiring.{u1} k _inst_1) (AddCommGroup.toAddCommMonoid.{u2} V _inst_2)] [S : AddTorsor.{u2, u3} V P (AddCommGroup.toAddGroup.{u2} V _inst_2)] {s₁ : AffineSubspace.{u1, u2, u3} k V P _inst_1 _inst_2 _inst_3 S} {s₂ : AffineSubspace.{u1, u2, u3} k V P _inst_1 _inst_2 _inst_3 S} {p : P}, (Membership.Mem.{u3, u3} P (AffineSubspace.{u1, u2, u3} k V P _inst_1 _inst_2 _inst_3 S) (SetLike.hasMem.{u3, u3} (AffineSubspace.{u1, u2, u3} k V P _inst_1 _inst_2 _inst_3 S) P (AffineSubspace.setLike.{u1, u2, u3} k V P _inst_1 _inst_2 _inst_3 S)) p s₁) -> (Membership.Mem.{u3, u3} P (AffineSubspace.{u1, u2, u3} k V P _inst_1 _inst_2 _inst_3 S) (SetLike.hasMem.{u3, u3} (AffineSubspace.{u1, u2, u3} k V P _inst_1 _inst_2 _inst_3 S) P (AffineSubspace.setLike.{u1, u2, u3} k V P _inst_1 _inst_2 _inst_3 S)) p s₂) -> (Eq.{succ u2} (Submodule.{u1, u2} k V (Ring.toSemiring.{u1} k _inst_1) (AddCommGroup.toAddCommMonoid.{u2} V _inst_2) _inst_3) (AffineSubspace.direction.{u1, u2, u3} k V P _inst_1 _inst_2 _inst_3 S (Inf.inf.{u3} (AffineSubspace.{u1, u2, u3} k V P _inst_1 _inst_2 _inst_3 S) (SemilatticeInf.toHasInf.{u3} (AffineSubspace.{u1, u2, u3} k V P _inst_1 _inst_2 _inst_3 S) (Lattice.toSemilatticeInf.{u3} (AffineSubspace.{u1, u2, u3} k V P _inst_1 _inst_2 _inst_3 S) (ConditionallyCompleteLattice.toLattice.{u3} (AffineSubspace.{u1, u2, u3} k V P _inst_1 _inst_2 _inst_3 S) (CompleteLattice.toConditionallyCompleteLattice.{u3} (AffineSubspace.{u1, u2, u3} k V P _inst_1 _inst_2 _inst_3 S) (AffineSubspace.completeLattice.{u1, u2, u3} k V P _inst_1 _inst_2 _inst_3 S))))) s₁ s₂)) (Inf.inf.{u2} (Submodule.{u1, u2} k V (Ring.toSemiring.{u1} k _inst_1) (AddCommGroup.toAddCommMonoid.{u2} V _inst_2) _inst_3) (Submodule.hasInf.{u1, u2} k V (Ring.toSemiring.{u1} k _inst_1) (AddCommGroup.toAddCommMonoid.{u2} V _inst_2) _inst_3) (AffineSubspace.direction.{u1, u2, u3} k V P _inst_1 _inst_2 _inst_3 S s₁) (AffineSubspace.direction.{u1, u2, u3} k V P _inst_1 _inst_2 _inst_3 S s₂))) but is expected to have type forall {k : Type.{u3}} {V : Type.{u2}} {P : Type.{u1}} [_inst_1 : Ring.{u3} k] [_inst_2 : AddCommGroup.{u2} V] [_inst_3 : Module.{u3, u2} k V (Ring.toSemiring.{u3} k _inst_1) (AddCommGroup.toAddCommMonoid.{u2} V _inst_2)] [S : AddTorsor.{u2, u1} V P (AddCommGroup.toAddGroup.{u2} V _inst_2)] {s₁ : AffineSubspace.{u3, u2, u1} k V P _inst_1 _inst_2 _inst_3 S} {s₂ : AffineSubspace.{u3, u2, u1} k V P _inst_1 _inst_2 _inst_3 S} {p : P}, (Membership.mem.{u1, u1} P (AffineSubspace.{u3, u2, u1} k V P _inst_1 _inst_2 _inst_3 S) (SetLike.instMembership.{u1, u1} (AffineSubspace.{u3, u2, u1} k V P _inst_1 _inst_2 _inst_3 S) P (AffineSubspace.instSetLikeAffineSubspace.{u3, u2, u1} k V P _inst_1 _inst_2 _inst_3 S)) p s₁) -> (Membership.mem.{u1, u1} P (AffineSubspace.{u3, u2, u1} k V P _inst_1 _inst_2 _inst_3 S) (SetLike.instMembership.{u1, u1} (AffineSubspace.{u3, u2, u1} k V P _inst_1 _inst_2 _inst_3 S) P (AffineSubspace.instSetLikeAffineSubspace.{u3, u2, u1} k V P _inst_1 _inst_2 _inst_3 S)) p s₂) -> (Eq.{succ u2} (Submodule.{u3, u2} k V (Ring.toSemiring.{u3} k _inst_1) (AddCommGroup.toAddCommMonoid.{u2} V _inst_2) _inst_3) (AffineSubspace.direction.{u3, u2, u1} k V P _inst_1 _inst_2 _inst_3 S (Inf.inf.{u1} (AffineSubspace.{u3, u2, u1} k V P _inst_1 _inst_2 _inst_3 S) (Lattice.toInf.{u1} (AffineSubspace.{u3, u2, u1} k V P _inst_1 _inst_2 _inst_3 S) (ConditionallyCompleteLattice.toLattice.{u1} (AffineSubspace.{u3, u2, u1} k V P _inst_1 _inst_2 _inst_3 S) (CompleteLattice.toConditionallyCompleteLattice.{u1} (AffineSubspace.{u3, u2, u1} k V P _inst_1 _inst_2 _inst_3 S) (AffineSubspace.instCompleteLatticeAffineSubspace.{u3, u2, u1} k V P _inst_1 _inst_2 _inst_3 S)))) s₁ s₂)) (Inf.inf.{u2} (Submodule.{u3, u2} k V (Ring.toSemiring.{u3} k _inst_1) (AddCommGroup.toAddCommMonoid.{u2} V _inst_2) _inst_3) (Submodule.instInfSubmodule.{u3, u2} k V (Ring.toSemiring.{u3} k _inst_1) (AddCommGroup.toAddCommMonoid.{u2} V _inst_2) _inst_3) (AffineSubspace.direction.{u3, u2, u1} k V P _inst_1 _inst_2 _inst_3 S s₁) (AffineSubspace.direction.{u3, u2, u1} k V P _inst_1 _inst_2 _inst_3 S s₂))) Case conversion may be inaccurate. Consider using '#align affine_subspace.direction_inf_of_mem AffineSubspace.direction_inf_of_memₓ'. -/ /-- If two affine subspaces have a point in common, the direction of their inf equals the inf of their directions. -/ theorem direction_inf_of_mem {s₁ s₂ : AffineSubspace k P} {p : P} (h₁ : p ∈ s₁) (h₂ : p ∈ s₂) : (s₁ ⊓ s₂).direction = s₁.direction ⊓ s₂.direction := by ext v rw [Submodule.mem_inf, ← vadd_mem_iff_mem_direction v h₁, ← vadd_mem_iff_mem_direction v h₂, ← vadd_mem_iff_mem_direction v ((mem_inf_iff p s₁ s₂).2 ⟨h₁, h₂⟩), mem_inf_iff] #align affine_subspace.direction_inf_of_mem AffineSubspace.direction_inf_of_mem /- warning: affine_subspace.direction_inf_of_mem_inf -> AffineSubspace.direction_inf_of_mem_inf is a dubious translation: lean 3 declaration is forall {k : Type.{u1}} {V : Type.{u2}} {P : Type.{u3}} [_inst_1 : Ring.{u1} k] [_inst_2 : AddCommGroup.{u2} V] [_inst_3 : Module.{u1, u2} k V (Ring.toSemiring.{u1} k _inst_1) (AddCommGroup.toAddCommMonoid.{u2} V _inst_2)] [S : AddTorsor.{u2, u3} V P (AddCommGroup.toAddGroup.{u2} V _inst_2)] {s₁ : AffineSubspace.{u1, u2, u3} k V P _inst_1 _inst_2 _inst_3 S} {s₂ : AffineSubspace.{u1, u2, u3} k V P _inst_1 _inst_2 _inst_3 S} {p : P}, (Membership.Mem.{u3, u3} P (AffineSubspace.{u1, u2, u3} k V P _inst_1 _inst_2 _inst_3 S) (SetLike.hasMem.{u3, u3} (AffineSubspace.{u1, u2, u3} k V P _inst_1 _inst_2 _inst_3 S) P (AffineSubspace.setLike.{u1, u2, u3} k V P _inst_1 _inst_2 _inst_3 S)) p (Inf.inf.{u3} (AffineSubspace.{u1, u2, u3} k V P _inst_1 _inst_2 _inst_3 S) (SemilatticeInf.toHasInf.{u3} (AffineSubspace.{u1, u2, u3} k V P _inst_1 _inst_2 _inst_3 S) (Lattice.toSemilatticeInf.{u3} (AffineSubspace.{u1, u2, u3} k V P _inst_1 _inst_2 _inst_3 S) (ConditionallyCompleteLattice.toLattice.{u3} (AffineSubspace.{u1, u2, u3} k V P _inst_1 _inst_2 _inst_3 S) (CompleteLattice.toConditionallyCompleteLattice.{u3} (AffineSubspace.{u1, u2, u3} k V P _inst_1 _inst_2 _inst_3 S) (AffineSubspace.completeLattice.{u1, u2, u3} k V P _inst_1 _inst_2 _inst_3 S))))) s₁ s₂)) -> (Eq.{succ u2} (Submodule.{u1, u2} k V (Ring.toSemiring.{u1} k _inst_1) (AddCommGroup.toAddCommMonoid.{u2} V _inst_2) _inst_3) (AffineSubspace.direction.{u1, u2, u3} k V P _inst_1 _inst_2 _inst_3 S (Inf.inf.{u3} (AffineSubspace.{u1, u2, u3} k V P _inst_1 _inst_2 _inst_3 S) (SemilatticeInf.toHasInf.{u3} (AffineSubspace.{u1, u2, u3} k V P _inst_1 _inst_2 _inst_3 S) (Lattice.toSemilatticeInf.{u3} (AffineSubspace.{u1, u2, u3} k V P _inst_1 _inst_2 _inst_3 S) (ConditionallyCompleteLattice.toLattice.{u3} (AffineSubspace.{u1, u2, u3} k V P _inst_1 _inst_2 _inst_3 S) (CompleteLattice.toConditionallyCompleteLattice.{u3} (AffineSubspace.{u1, u2, u3} k V P _inst_1 _inst_2 _inst_3 S) (AffineSubspace.completeLattice.{u1, u2, u3} k V P _inst_1 _inst_2 _inst_3 S))))) s₁ s₂)) (Inf.inf.{u2} (Submodule.{u1, u2} k V (Ring.toSemiring.{u1} k _inst_1) (AddCommGroup.toAddCommMonoid.{u2} V _inst_2) _inst_3) (Submodule.hasInf.{u1, u2} k V (Ring.toSemiring.{u1} k _inst_1) (AddCommGroup.toAddCommMonoid.{u2} V _inst_2) _inst_3) (AffineSubspace.direction.{u1, u2, u3} k V P _inst_1 _inst_2 _inst_3 S s₁) (AffineSubspace.direction.{u1, u2, u3} k V P _inst_1 _inst_2 _inst_3 S s₂))) but is expected to have type forall {k : Type.{u3}} {V : Type.{u2}} {P : Type.{u1}} [_inst_1 : Ring.{u3} k] [_inst_2 : AddCommGroup.{u2} V] [_inst_3 : Module.{u3, u2} k V (Ring.toSemiring.{u3} k _inst_1) (AddCommGroup.toAddCommMonoid.{u2} V _inst_2)] [S : AddTorsor.{u2, u1} V P (AddCommGroup.toAddGroup.{u2} V _inst_2)] {s₁ : AffineSubspace.{u3, u2, u1} k V P _inst_1 _inst_2 _inst_3 S} {s₂ : AffineSubspace.{u3, u2, u1} k V P _inst_1 _inst_2 _inst_3 S} {p : P}, (Membership.mem.{u1, u1} P (AffineSubspace.{u3, u2, u1} k V P _inst_1 _inst_2 _inst_3 S) (SetLike.instMembership.{u1, u1} (AffineSubspace.{u3, u2, u1} k V P _inst_1 _inst_2 _inst_3 S) P (AffineSubspace.instSetLikeAffineSubspace.{u3, u2, u1} k V P _inst_1 _inst_2 _inst_3 S)) p (Inf.inf.{u1} (AffineSubspace.{u3, u2, u1} k V P _inst_1 _inst_2 _inst_3 S) (Lattice.toInf.{u1} (AffineSubspace.{u3, u2, u1} k V P _inst_1 _inst_2 _inst_3 S) (ConditionallyCompleteLattice.toLattice.{u1} (AffineSubspace.{u3, u2, u1} k V P _inst_1 _inst_2 _inst_3 S) (CompleteLattice.toConditionallyCompleteLattice.{u1} (AffineSubspace.{u3, u2, u1} k V P _inst_1 _inst_2 _inst_3 S) (AffineSubspace.instCompleteLatticeAffineSubspace.{u3, u2, u1} k V P _inst_1 _inst_2 _inst_3 S)))) s₁ s₂)) -> (Eq.{succ u2} (Submodule.{u3, u2} k V (Ring.toSemiring.{u3} k _inst_1) (AddCommGroup.toAddCommMonoid.{u2} V _inst_2) _inst_3) (AffineSubspace.direction.{u3, u2, u1} k V P _inst_1 _inst_2 _inst_3 S (Inf.inf.{u1} (AffineSubspace.{u3, u2, u1} k V P _inst_1 _inst_2 _inst_3 S) (Lattice.toInf.{u1} (AffineSubspace.{u3, u2, u1} k V P _inst_1 _inst_2 _inst_3 S) (ConditionallyCompleteLattice.toLattice.{u1} (AffineSubspace.{u3, u2, u1} k V P _inst_1 _inst_2 _inst_3 S) (CompleteLattice.toConditionallyCompleteLattice.{u1} (AffineSubspace.{u3, u2, u1} k V P _inst_1 _inst_2 _inst_3 S) (AffineSubspace.instCompleteLatticeAffineSubspace.{u3, u2, u1} k V P _inst_1 _inst_2 _inst_3 S)))) s₁ s₂)) (Inf.inf.{u2} (Submodule.{u3, u2} k V (Ring.toSemiring.{u3} k _inst_1) (AddCommGroup.toAddCommMonoid.{u2} V _inst_2) _inst_3) (Submodule.instInfSubmodule.{u3, u2} k V (Ring.toSemiring.{u3} k _inst_1) (AddCommGroup.toAddCommMonoid.{u2} V _inst_2) _inst_3) (AffineSubspace.direction.{u3, u2, u1} k V P _inst_1 _inst_2 _inst_3 S s₁) (AffineSubspace.direction.{u3, u2, u1} k V P _inst_1 _inst_2 _inst_3 S s₂))) Case conversion may be inaccurate. Consider using '#align affine_subspace.direction_inf_of_mem_inf AffineSubspace.direction_inf_of_mem_infₓ'. -/ /-- If two affine subspaces have a point in their inf, the direction of their inf equals the inf of their directions. -/ theorem direction_inf_of_mem_inf {s₁ s₂ : AffineSubspace k P} {p : P} (h : p ∈ s₁ ⊓ s₂) : (s₁ ⊓ s₂).direction = s₁.direction ⊓ s₂.direction := direction_inf_of_mem ((mem_inf_iff p s₁ s₂).1 h).1 ((mem_inf_iff p s₁ s₂).1 h).2 #align affine_subspace.direction_inf_of_mem_inf AffineSubspace.direction_inf_of_mem_inf /- warning: affine_subspace.direction_le -> AffineSubspace.direction_le is a dubious translation: lean 3 declaration is forall {k : Type.{u1}} {V : Type.{u2}} {P : Type.{u3}} [_inst_1 : Ring.{u1} k] [_inst_2 : AddCommGroup.{u2} V] [_inst_3 : Module.{u1, u2} k V (Ring.toSemiring.{u1} k _inst_1) (AddCommGroup.toAddCommMonoid.{u2} V _inst_2)] [S : AddTorsor.{u2, u3} V P (AddCommGroup.toAddGroup.{u2} V _inst_2)] {s1 : AffineSubspace.{u1, u2, u3} k V P _inst_1 _inst_2 _inst_3 S} {s2 : AffineSubspace.{u1, u2, u3} k V P _inst_1 _inst_2 _inst_3 S}, (LE.le.{u3} (AffineSubspace.{u1, u2, u3} k V P _inst_1 _inst_2 _inst_3 S) (Preorder.toLE.{u3} (AffineSubspace.{u1, u2, u3} k V P _inst_1 _inst_2 _inst_3 S) (PartialOrder.toPreorder.{u3} (AffineSubspace.{u1, u2, u3} k V P _inst_1 _inst_2 _inst_3 S) (SetLike.partialOrder.{u3, u3} (AffineSubspace.{u1, u2, u3} k V P _inst_1 _inst_2 _inst_3 S) P (AffineSubspace.setLike.{u1, u2, u3} k V P _inst_1 _inst_2 _inst_3 S)))) s1 s2) -> (LE.le.{u2} (Submodule.{u1, u2} k V (Ring.toSemiring.{u1} k _inst_1) (AddCommGroup.toAddCommMonoid.{u2} V _inst_2) _inst_3) (Preorder.toLE.{u2} (Submodule.{u1, u2} k V (Ring.toSemiring.{u1} k _inst_1) (AddCommGroup.toAddCommMonoid.{u2} V _inst_2) _inst_3) (PartialOrder.toPreorder.{u2} (Submodule.{u1, u2} k V (Ring.toSemiring.{u1} k _inst_1) (AddCommGroup.toAddCommMonoid.{u2} V _inst_2) _inst_3) (SetLike.partialOrder.{u2, u2} (Submodule.{u1, u2} k V (Ring.toSemiring.{u1} k _inst_1) (AddCommGroup.toAddCommMonoid.{u2} V _inst_2) _inst_3) V (Submodule.setLike.{u1, u2} k V (Ring.toSemiring.{u1} k _inst_1) (AddCommGroup.toAddCommMonoid.{u2} V _inst_2) _inst_3)))) (AffineSubspace.direction.{u1, u2, u3} k V P _inst_1 _inst_2 _inst_3 S s1) (AffineSubspace.direction.{u1, u2, u3} k V P _inst_1 _inst_2 _inst_3 S s2)) but is expected to have type forall {k : Type.{u3}} {V : Type.{u2}} {P : Type.{u1}} [_inst_1 : Ring.{u3} k] [_inst_2 : AddCommGroup.{u2} V] [_inst_3 : Module.{u3, u2} k V (Ring.toSemiring.{u3} k _inst_1) (AddCommGroup.toAddCommMonoid.{u2} V _inst_2)] [S : AddTorsor.{u2, u1} V P (AddCommGroup.toAddGroup.{u2} V _inst_2)] {s1 : AffineSubspace.{u3, u2, u1} k V P _inst_1 _inst_2 _inst_3 S} {s2 : AffineSubspace.{u3, u2, u1} k V P _inst_1 _inst_2 _inst_3 S}, (LE.le.{u1} (AffineSubspace.{u3, u2, u1} k V P _inst_1 _inst_2 _inst_3 S) (Preorder.toLE.{u1} (AffineSubspace.{u3, u2, u1} k V P _inst_1 _inst_2 _inst_3 S) (PartialOrder.toPreorder.{u1} (AffineSubspace.{u3, u2, u1} k V P _inst_1 _inst_2 _inst_3 S) (OmegaCompletePartialOrder.toPartialOrder.{u1} (AffineSubspace.{u3, u2, u1} k V P _inst_1 _inst_2 _inst_3 S) (CompleteLattice.instOmegaCompletePartialOrder.{u1} (AffineSubspace.{u3, u2, u1} k V P _inst_1 _inst_2 _inst_3 S) (AffineSubspace.instCompleteLatticeAffineSubspace.{u3, u2, u1} k V P _inst_1 _inst_2 _inst_3 S))))) s1 s2) -> (LE.le.{u2} (Submodule.{u3, u2} k V (Ring.toSemiring.{u3} k _inst_1) (AddCommGroup.toAddCommMonoid.{u2} V _inst_2) _inst_3) (Preorder.toLE.{u2} (Submodule.{u3, u2} k V (Ring.toSemiring.{u3} k _inst_1) (AddCommGroup.toAddCommMonoid.{u2} V _inst_2) _inst_3) (PartialOrder.toPreorder.{u2} (Submodule.{u3, u2} k V (Ring.toSemiring.{u3} k _inst_1) (AddCommGroup.toAddCommMonoid.{u2} V _inst_2) _inst_3) (OmegaCompletePartialOrder.toPartialOrder.{u2} (Submodule.{u3, u2} k V (Ring.toSemiring.{u3} k _inst_1) (AddCommGroup.toAddCommMonoid.{u2} V _inst_2) _inst_3) (CompleteLattice.instOmegaCompletePartialOrder.{u2} (Submodule.{u3, u2} k V (Ring.toSemiring.{u3} k _inst_1) (AddCommGroup.toAddCommMonoid.{u2} V _inst_2) _inst_3) (Submodule.completeLattice.{u3, u2} k V (Ring.toSemiring.{u3} k _inst_1) (AddCommGroup.toAddCommMonoid.{u2} V _inst_2) _inst_3))))) (AffineSubspace.direction.{u3, u2, u1} k V P _inst_1 _inst_2 _inst_3 S s1) (AffineSubspace.direction.{u3, u2, u1} k V P _inst_1 _inst_2 _inst_3 S s2)) Case conversion may be inaccurate. Consider using '#align affine_subspace.direction_le AffineSubspace.direction_leₓ'. -/ /-- If one affine subspace is less than or equal to another, the same applies to their directions. -/ theorem direction_le {s1 s2 : AffineSubspace k P} (h : s1 ≤ s2) : s1.direction ≤ s2.direction := by repeat' rw [direction_eq_vector_span, vectorSpan_def] exact vectorSpan_mono k h #align affine_subspace.direction_le AffineSubspace.direction_le /- warning: affine_subspace.direction_lt_of_nonempty -> AffineSubspace.direction_lt_of_nonempty is a dubious translation: lean 3 declaration is forall {k : Type.{u1}} {V : Type.{u2}} {P : Type.{u3}} [_inst_1 : Ring.{u1} k] [_inst_2 : AddCommGroup.{u2} V] [_inst_3 : Module.{u1, u2} k V (Ring.toSemiring.{u1} k _inst_1) (AddCommGroup.toAddCommMonoid.{u2} V _inst_2)] [S : AddTorsor.{u2, u3} V P (AddCommGroup.toAddGroup.{u2} V _inst_2)] {s1 : AffineSubspace.{u1, u2, u3} k V P _inst_1 _inst_2 _inst_3 S} {s2 : AffineSubspace.{u1, u2, u3} k V P _inst_1 _inst_2 _inst_3 S}, (LT.lt.{u3} (AffineSubspace.{u1, u2, u3} k V P _inst_1 _inst_2 _inst_3 S) (Preorder.toLT.{u3} (AffineSubspace.{u1, u2, u3} k V P _inst_1 _inst_2 _inst_3 S) (PartialOrder.toPreorder.{u3} (AffineSubspace.{u1, u2, u3} k V P _inst_1 _inst_2 _inst_3 S) (SetLike.partialOrder.{u3, u3} (AffineSubspace.{u1, u2, u3} k V P _inst_1 _inst_2 _inst_3 S) P (AffineSubspace.setLike.{u1, u2, u3} k V P _inst_1 _inst_2 _inst_3 S)))) s1 s2) -> (Set.Nonempty.{u3} P ((fun (a : Type.{u3}) (b : Type.{u3}) [self : HasLiftT.{succ u3, succ u3} a b] => self.0) (AffineSubspace.{u1, u2, u3} k V P _inst_1 _inst_2 _inst_3 S) (Set.{u3} P) (HasLiftT.mk.{succ u3, succ u3} (AffineSubspace.{u1, u2, u3} k V P _inst_1 _inst_2 _inst_3 S) (Set.{u3} P) (CoeTCₓ.coe.{succ u3, succ u3} (AffineSubspace.{u1, u2, u3} k V P _inst_1 _inst_2 _inst_3 S) (Set.{u3} P) (SetLike.Set.hasCoeT.{u3, u3} (AffineSubspace.{u1, u2, u3} k V P _inst_1 _inst_2 _inst_3 S) P (AffineSubspace.setLike.{u1, u2, u3} k V P _inst_1 _inst_2 _inst_3 S)))) s1)) -> (LT.lt.{u2} (Submodule.{u1, u2} k V (Ring.toSemiring.{u1} k _inst_1) (AddCommGroup.toAddCommMonoid.{u2} V _inst_2) _inst_3) (Preorder.toLT.{u2} (Submodule.{u1, u2} k V (Ring.toSemiring.{u1} k _inst_1) (AddCommGroup.toAddCommMonoid.{u2} V _inst_2) _inst_3) (PartialOrder.toPreorder.{u2} (Submodule.{u1, u2} k V (Ring.toSemiring.{u1} k _inst_1) (AddCommGroup.toAddCommMonoid.{u2} V _inst_2) _inst_3) (SetLike.partialOrder.{u2, u2} (Submodule.{u1, u2} k V (Ring.toSemiring.{u1} k _inst_1) (AddCommGroup.toAddCommMonoid.{u2} V _inst_2) _inst_3) V (Submodule.setLike.{u1, u2} k V (Ring.toSemiring.{u1} k _inst_1) (AddCommGroup.toAddCommMonoid.{u2} V _inst_2) _inst_3)))) (AffineSubspace.direction.{u1, u2, u3} k V P _inst_1 _inst_2 _inst_3 S s1) (AffineSubspace.direction.{u1, u2, u3} k V P _inst_1 _inst_2 _inst_3 S s2)) but is expected to have type forall {k : Type.{u3}} {V : Type.{u2}} {P : Type.{u1}} [_inst_1 : Ring.{u3} k] [_inst_2 : AddCommGroup.{u2} V] [_inst_3 : Module.{u3, u2} k V (Ring.toSemiring.{u3} k _inst_1) (AddCommGroup.toAddCommMonoid.{u2} V _inst_2)] [S : AddTorsor.{u2, u1} V P (AddCommGroup.toAddGroup.{u2} V _inst_2)] {s1 : AffineSubspace.{u3, u2, u1} k V P _inst_1 _inst_2 _inst_3 S} {s2 : AffineSubspace.{u3, u2, u1} k V P _inst_1 _inst_2 _inst_3 S}, (LT.lt.{u1} (AffineSubspace.{u3, u2, u1} k V P _inst_1 _inst_2 _inst_3 S) (Preorder.toLT.{u1} (AffineSubspace.{u3, u2, u1} k V P _inst_1 _inst_2 _inst_3 S) (PartialOrder.toPreorder.{u1} (AffineSubspace.{u3, u2, u1} k V P _inst_1 _inst_2 _inst_3 S) (OmegaCompletePartialOrder.toPartialOrder.{u1} (AffineSubspace.{u3, u2, u1} k V P _inst_1 _inst_2 _inst_3 S) (CompleteLattice.instOmegaCompletePartialOrder.{u1} (AffineSubspace.{u3, u2, u1} k V P _inst_1 _inst_2 _inst_3 S) (AffineSubspace.instCompleteLatticeAffineSubspace.{u3, u2, u1} k V P _inst_1 _inst_2 _inst_3 S))))) s1 s2) -> (Set.Nonempty.{u1} P (SetLike.coe.{u1, u1} (AffineSubspace.{u3, u2, u1} k V P _inst_1 _inst_2 _inst_3 S) P (AffineSubspace.instSetLikeAffineSubspace.{u3, u2, u1} k V P _inst_1 _inst_2 _inst_3 S) s1)) -> (LT.lt.{u2} (Submodule.{u3, u2} k V (Ring.toSemiring.{u3} k _inst_1) (AddCommGroup.toAddCommMonoid.{u2} V _inst_2) _inst_3) (Preorder.toLT.{u2} (Submodule.{u3, u2} k V (Ring.toSemiring.{u3} k _inst_1) (AddCommGroup.toAddCommMonoid.{u2} V _inst_2) _inst_3) (PartialOrder.toPreorder.{u2} (Submodule.{u3, u2} k V (Ring.toSemiring.{u3} k _inst_1) (AddCommGroup.toAddCommMonoid.{u2} V _inst_2) _inst_3) (OmegaCompletePartialOrder.toPartialOrder.{u2} (Submodule.{u3, u2} k V (Ring.toSemiring.{u3} k _inst_1) (AddCommGroup.toAddCommMonoid.{u2} V _inst_2) _inst_3) (CompleteLattice.instOmegaCompletePartialOrder.{u2} (Submodule.{u3, u2} k V (Ring.toSemiring.{u3} k _inst_1) (AddCommGroup.toAddCommMonoid.{u2} V _inst_2) _inst_3) (Submodule.completeLattice.{u3, u2} k V (Ring.toSemiring.{u3} k _inst_1) (AddCommGroup.toAddCommMonoid.{u2} V _inst_2) _inst_3))))) (AffineSubspace.direction.{u3, u2, u1} k V P _inst_1 _inst_2 _inst_3 S s1) (AffineSubspace.direction.{u3, u2, u1} k V P _inst_1 _inst_2 _inst_3 S s2)) Case conversion may be inaccurate. Consider using '#align affine_subspace.direction_lt_of_nonempty AffineSubspace.direction_lt_of_nonemptyₓ'. -/ /-- If one nonempty affine subspace is less than another, the same applies to their directions -/ theorem direction_lt_of_nonempty {s1 s2 : AffineSubspace k P} (h : s1 < s2) (hn : (s1 : Set P).Nonempty) : s1.direction < s2.direction := by cases' hn with p hp rw [lt_iff_le_and_exists] at h rcases h with ⟨hle, p2, hp2, hp2s1⟩ rw [SetLike.lt_iff_le_and_exists] use direction_le hle, p2 -ᵥ p, vsub_mem_direction hp2 (hle hp) intro hm rw [vsub_right_mem_direction_iff_mem hp p2] at hm exact hp2s1 hm #align affine_subspace.direction_lt_of_nonempty AffineSubspace.direction_lt_of_nonempty /- warning: affine_subspace.sup_direction_le -> AffineSubspace.sup_direction_le is a dubious translation: lean 3 declaration is forall {k : Type.{u1}} {V : Type.{u2}} {P : Type.{u3}} [_inst_1 : Ring.{u1} k] [_inst_2 : AddCommGroup.{u2} V] [_inst_3 : Module.{u1, u2} k V (Ring.toSemiring.{u1} k _inst_1) (AddCommGroup.toAddCommMonoid.{u2} V _inst_2)] [S : AddTorsor.{u2, u3} V P (AddCommGroup.toAddGroup.{u2} V _inst_2)] (s1 : AffineSubspace.{u1, u2, u3} k V P _inst_1 _inst_2 _inst_3 S) (s2 : AffineSubspace.{u1, u2, u3} k V P _inst_1 _inst_2 _inst_3 S), LE.le.{u2} (Submodule.{u1, u2} k V (Ring.toSemiring.{u1} k _inst_1) (AddCommGroup.toAddCommMonoid.{u2} V _inst_2) _inst_3) (Preorder.toLE.{u2} (Submodule.{u1, u2} k V (Ring.toSemiring.{u1} k _inst_1) (AddCommGroup.toAddCommMonoid.{u2} V _inst_2) _inst_3) (PartialOrder.toPreorder.{u2} (Submodule.{u1, u2} k V (Ring.toSemiring.{u1} k _inst_1) (AddCommGroup.toAddCommMonoid.{u2} V _inst_2) _inst_3) (SetLike.partialOrder.{u2, u2} (Submodule.{u1, u2} k V (Ring.toSemiring.{u1} k _inst_1) (AddCommGroup.toAddCommMonoid.{u2} V _inst_2) _inst_3) V (Submodule.setLike.{u1, u2} k V (Ring.toSemiring.{u1} k _inst_1) (AddCommGroup.toAddCommMonoid.{u2} V _inst_2) _inst_3)))) (Sup.sup.{u2} (Submodule.{u1, u2} k V (Ring.toSemiring.{u1} k _inst_1) (AddCommGroup.toAddCommMonoid.{u2} V _inst_2) _inst_3) (SemilatticeSup.toHasSup.{u2} (Submodule.{u1, u2} k V (Ring.toSemiring.{u1} k _inst_1) (AddCommGroup.toAddCommMonoid.{u2} V _inst_2) _inst_3) (Lattice.toSemilatticeSup.{u2} (Submodule.{u1, u2} k V (Ring.toSemiring.{u1} k _inst_1) (AddCommGroup.toAddCommMonoid.{u2} V _inst_2) _inst_3) (ConditionallyCompleteLattice.toLattice.{u2} (Submodule.{u1, u2} k V (Ring.toSemiring.{u1} k _inst_1) (AddCommGroup.toAddCommMonoid.{u2} V _inst_2) _inst_3) (CompleteLattice.toConditionallyCompleteLattice.{u2} (Submodule.{u1, u2} k V (Ring.toSemiring.{u1} k _inst_1) (AddCommGroup.toAddCommMonoid.{u2} V _inst_2) _inst_3) (Submodule.completeLattice.{u1, u2} k V (Ring.toSemiring.{u1} k _inst_1) (AddCommGroup.toAddCommMonoid.{u2} V _inst_2) _inst_3))))) (AffineSubspace.direction.{u1, u2, u3} k V P _inst_1 _inst_2 _inst_3 S s1) (AffineSubspace.direction.{u1, u2, u3} k V P _inst_1 _inst_2 _inst_3 S s2)) (AffineSubspace.direction.{u1, u2, u3} k V P _inst_1 _inst_2 _inst_3 S (Sup.sup.{u3} (AffineSubspace.{u1, u2, u3} k V P _inst_1 _inst_2 _inst_3 S) (SemilatticeSup.toHasSup.{u3} (AffineSubspace.{u1, u2, u3} k V P _inst_1 _inst_2 _inst_3 S) (Lattice.toSemilatticeSup.{u3} (AffineSubspace.{u1, u2, u3} k V P _inst_1 _inst_2 _inst_3 S) (ConditionallyCompleteLattice.toLattice.{u3} (AffineSubspace.{u1, u2, u3} k V P _inst_1 _inst_2 _inst_3 S) (CompleteLattice.toConditionallyCompleteLattice.{u3} (AffineSubspace.{u1, u2, u3} k V P _inst_1 _inst_2 _inst_3 S) (AffineSubspace.completeLattice.{u1, u2, u3} k V P _inst_1 _inst_2 _inst_3 S))))) s1 s2)) but is expected to have type forall {k : Type.{u3}} {V : Type.{u2}} {P : Type.{u1}} [_inst_1 : Ring.{u3} k] [_inst_2 : AddCommGroup.{u2} V] [_inst_3 : Module.{u3, u2} k V (Ring.toSemiring.{u3} k _inst_1) (AddCommGroup.toAddCommMonoid.{u2} V _inst_2)] [S : AddTorsor.{u2, u1} V P (AddCommGroup.toAddGroup.{u2} V _inst_2)] (s1 : AffineSubspace.{u3, u2, u1} k V P _inst_1 _inst_2 _inst_3 S) (s2 : AffineSubspace.{u3, u2, u1} k V P _inst_1 _inst_2 _inst_3 S), LE.le.{u2} (Submodule.{u3, u2} k V (Ring.toSemiring.{u3} k _inst_1) (AddCommGroup.toAddCommMonoid.{u2} V _inst_2) _inst_3) (Preorder.toLE.{u2} (Submodule.{u3, u2} k V (Ring.toSemiring.{u3} k _inst_1) (AddCommGroup.toAddCommMonoid.{u2} V _inst_2) _inst_3) (PartialOrder.toPreorder.{u2} (Submodule.{u3, u2} k V (Ring.toSemiring.{u3} k _inst_1) (AddCommGroup.toAddCommMonoid.{u2} V _inst_2) _inst_3) (OmegaCompletePartialOrder.toPartialOrder.{u2} (Submodule.{u3, u2} k V (Ring.toSemiring.{u3} k _inst_1) (AddCommGroup.toAddCommMonoid.{u2} V _inst_2) _inst_3) (CompleteLattice.instOmegaCompletePartialOrder.{u2} (Submodule.{u3, u2} k V (Ring.toSemiring.{u3} k _inst_1) (AddCommGroup.toAddCommMonoid.{u2} V _inst_2) _inst_3) (Submodule.completeLattice.{u3, u2} k V (Ring.toSemiring.{u3} k _inst_1) (AddCommGroup.toAddCommMonoid.{u2} V _inst_2) _inst_3))))) (Sup.sup.{u2} (Submodule.{u3, u2} k V (Ring.toSemiring.{u3} k _inst_1) (AddCommGroup.toAddCommMonoid.{u2} V _inst_2) _inst_3) (SemilatticeSup.toSup.{u2} (Submodule.{u3, u2} k V (Ring.toSemiring.{u3} k _inst_1) (AddCommGroup.toAddCommMonoid.{u2} V _inst_2) _inst_3) (Lattice.toSemilatticeSup.{u2} (Submodule.{u3, u2} k V (Ring.toSemiring.{u3} k _inst_1) (AddCommGroup.toAddCommMonoid.{u2} V _inst_2) _inst_3) (ConditionallyCompleteLattice.toLattice.{u2} (Submodule.{u3, u2} k V (Ring.toSemiring.{u3} k _inst_1) (AddCommGroup.toAddCommMonoid.{u2} V _inst_2) _inst_3) (CompleteLattice.toConditionallyCompleteLattice.{u2} (Submodule.{u3, u2} k V (Ring.toSemiring.{u3} k _inst_1) (AddCommGroup.toAddCommMonoid.{u2} V _inst_2) _inst_3) (Submodule.completeLattice.{u3, u2} k V (Ring.toSemiring.{u3} k _inst_1) (AddCommGroup.toAddCommMonoid.{u2} V _inst_2) _inst_3))))) (AffineSubspace.direction.{u3, u2, u1} k V P _inst_1 _inst_2 _inst_3 S s1) (AffineSubspace.direction.{u3, u2, u1} k V P _inst_1 _inst_2 _inst_3 S s2)) (AffineSubspace.direction.{u3, u2, u1} k V P _inst_1 _inst_2 _inst_3 S (Sup.sup.{u1} (AffineSubspace.{u3, u2, u1} k V P _inst_1 _inst_2 _inst_3 S) (SemilatticeSup.toSup.{u1} (AffineSubspace.{u3, u2, u1} k V P _inst_1 _inst_2 _inst_3 S) (Lattice.toSemilatticeSup.{u1} (AffineSubspace.{u3, u2, u1} k V P _inst_1 _inst_2 _inst_3 S) (ConditionallyCompleteLattice.toLattice.{u1} (AffineSubspace.{u3, u2, u1} k V P _inst_1 _inst_2 _inst_3 S) (CompleteLattice.toConditionallyCompleteLattice.{u1} (AffineSubspace.{u3, u2, u1} k V P _inst_1 _inst_2 _inst_3 S) (AffineSubspace.instCompleteLatticeAffineSubspace.{u3, u2, u1} k V P _inst_1 _inst_2 _inst_3 S))))) s1 s2)) Case conversion may be inaccurate. Consider using '#align affine_subspace.sup_direction_le AffineSubspace.sup_direction_leₓ'. -/ /-- The sup of the directions of two affine subspaces is less than or equal to the direction of their sup. -/ theorem sup_direction_le (s1 s2 : AffineSubspace k P) : s1.direction ⊔ s2.direction ≤ (s1 ⊔ s2).direction := by repeat' rw [direction_eq_vector_span, vectorSpan_def] exact sup_le (infₛ_le_infₛ fun p hp => Set.Subset.trans (vsub_self_mono (le_sup_left : s1 ≤ s1 ⊔ s2)) hp) (infₛ_le_infₛ fun p hp => Set.Subset.trans (vsub_self_mono (le_sup_right : s2 ≤ s1 ⊔ s2)) hp) #align affine_subspace.sup_direction_le AffineSubspace.sup_direction_le /- warning: affine_subspace.sup_direction_lt_of_nonempty_of_inter_empty -> AffineSubspace.sup_direction_lt_of_nonempty_of_inter_empty is a dubious translation: lean 3 declaration is forall {k : Type.{u1}} {V : Type.{u2}} {P : Type.{u3}} [_inst_1 : Ring.{u1} k] [_inst_2 : AddCommGroup.{u2} V] [_inst_3 : Module.{u1, u2} k V (Ring.toSemiring.{u1} k _inst_1) (AddCommGroup.toAddCommMonoid.{u2} V _inst_2)] [S : AddTorsor.{u2, u3} V P (AddCommGroup.toAddGroup.{u2} V _inst_2)] {s1 : AffineSubspace.{u1, u2, u3} k V P _inst_1 _inst_2 _inst_3 S} {s2 : AffineSubspace.{u1, u2, u3} k V P _inst_1 _inst_2 _inst_3 S}, (Set.Nonempty.{u3} P ((fun (a : Type.{u3}) (b : Type.{u3}) [self : HasLiftT.{succ u3, succ u3} a b] => self.0) (AffineSubspace.{u1, u2, u3} k V P _inst_1 _inst_2 _inst_3 S) (Set.{u3} P) (HasLiftT.mk.{succ u3, succ u3} (AffineSubspace.{u1, u2, u3} k V P _inst_1 _inst_2 _inst_3 S) (Set.{u3} P) (CoeTCₓ.coe.{succ u3, succ u3} (AffineSubspace.{u1, u2, u3} k V P _inst_1 _inst_2 _inst_3 S) (Set.{u3} P) (SetLike.Set.hasCoeT.{u3, u3} (AffineSubspace.{u1, u2, u3} k V P _inst_1 _inst_2 _inst_3 S) P (AffineSubspace.setLike.{u1, u2, u3} k V P _inst_1 _inst_2 _inst_3 S)))) s1)) -> (Set.Nonempty.{u3} P ((fun (a : Type.{u3}) (b : Type.{u3}) [self : HasLiftT.{succ u3, succ u3} a b] => self.0) (AffineSubspace.{u1, u2, u3} k V P _inst_1 _inst_2 _inst_3 S) (Set.{u3} P) (HasLiftT.mk.{succ u3, succ u3} (AffineSubspace.{u1, u2, u3} k V P _inst_1 _inst_2 _inst_3 S) (Set.{u3} P) (CoeTCₓ.coe.{succ u3, succ u3} (AffineSubspace.{u1, u2, u3} k V P _inst_1 _inst_2 _inst_3 S) (Set.{u3} P) (SetLike.Set.hasCoeT.{u3, u3} (AffineSubspace.{u1, u2, u3} k V P _inst_1 _inst_2 _inst_3 S) P (AffineSubspace.setLike.{u1, u2, u3} k V P _inst_1 _inst_2 _inst_3 S)))) s2)) -> (Eq.{succ u3} (Set.{u3} P) (Inter.inter.{u3} (Set.{u3} P) (Set.hasInter.{u3} P) ((fun (a : Type.{u3}) (b : Type.{u3}) [self : HasLiftT.{succ u3, succ u3} a b] => self.0) (AffineSubspace.{u1, u2, u3} k V P _inst_1 _inst_2 _inst_3 S) (Set.{u3} P) (HasLiftT.mk.{succ u3, succ u3} (AffineSubspace.{u1, u2, u3} k V P _inst_1 _inst_2 _inst_3 S) (Set.{u3} P) (CoeTCₓ.coe.{succ u3, succ u3} (AffineSubspace.{u1, u2, u3} k V P _inst_1 _inst_2 _inst_3 S) (Set.{u3} P) (SetLike.Set.hasCoeT.{u3, u3} (AffineSubspace.{u1, u2, u3} k V P _inst_1 _inst_2 _inst_3 S) P (AffineSubspace.setLike.{u1, u2, u3} k V P _inst_1 _inst_2 _inst_3 S)))) s1) ((fun (a : Type.{u3}) (b : Type.{u3}) [self : HasLiftT.{succ u3, succ u3} a b] => self.0) (AffineSubspace.{u1, u2, u3} k V P _inst_1 _inst_2 _inst_3 S) (Set.{u3} P) (HasLiftT.mk.{succ u3, succ u3} (AffineSubspace.{u1, u2, u3} k V P _inst_1 _inst_2 _inst_3 S) (Set.{u3} P) (CoeTCₓ.coe.{succ u3, succ u3} (AffineSubspace.{u1, u2, u3} k V P _inst_1 _inst_2 _inst_3 S) (Set.{u3} P) (SetLike.Set.hasCoeT.{u3, u3} (AffineSubspace.{u1, u2, u3} k V P _inst_1 _inst_2 _inst_3 S) P (AffineSubspace.setLike.{u1, u2, u3} k V P _inst_1 _inst_2 _inst_3 S)))) s2)) (EmptyCollection.emptyCollection.{u3} (Set.{u3} P) (Set.hasEmptyc.{u3} P))) -> (LT.lt.{u2} (Submodule.{u1, u2} k V (Ring.toSemiring.{u1} k _inst_1) (AddCommGroup.toAddCommMonoid.{u2} V _inst_2) _inst_3) (Preorder.toLT.{u2} (Submodule.{u1, u2} k V (Ring.toSemiring.{u1} k _inst_1) (AddCommGroup.toAddCommMonoid.{u2} V _inst_2) _inst_3) (PartialOrder.toPreorder.{u2} (Submodule.{u1, u2} k V (Ring.toSemiring.{u1} k _inst_1) (AddCommGroup.toAddCommMonoid.{u2} V _inst_2) _inst_3) (SetLike.partialOrder.{u2, u2} (Submodule.{u1, u2} k V (Ring.toSemiring.{u1} k _inst_1) (AddCommGroup.toAddCommMonoid.{u2} V _inst_2) _inst_3) V (Submodule.setLike.{u1, u2} k V (Ring.toSemiring.{u1} k _inst_1) (AddCommGroup.toAddCommMonoid.{u2} V _inst_2) _inst_3)))) (Sup.sup.{u2} (Submodule.{u1, u2} k V (Ring.toSemiring.{u1} k _inst_1) (AddCommGroup.toAddCommMonoid.{u2} V _inst_2) _inst_3) (SemilatticeSup.toHasSup.{u2} (Submodule.{u1, u2} k V (Ring.toSemiring.{u1} k _inst_1) (AddCommGroup.toAddCommMonoid.{u2} V _inst_2) _inst_3) (Lattice.toSemilatticeSup.{u2} (Submodule.{u1, u2} k V (Ring.toSemiring.{u1} k _inst_1) (AddCommGroup.toAddCommMonoid.{u2} V _inst_2) _inst_3) (ConditionallyCompleteLattice.toLattice.{u2} (Submodule.{u1, u2} k V (Ring.toSemiring.{u1} k _inst_1) (AddCommGroup.toAddCommMonoid.{u2} V _inst_2) _inst_3) (CompleteLattice.toConditionallyCompleteLattice.{u2} (Submodule.{u1, u2} k V (Ring.toSemiring.{u1} k _inst_1) (AddCommGroup.toAddCommMonoid.{u2} V _inst_2) _inst_3) (Submodule.completeLattice.{u1, u2} k V (Ring.toSemiring.{u1} k _inst_1) (AddCommGroup.toAddCommMonoid.{u2} V _inst_2) _inst_3))))) (AffineSubspace.direction.{u1, u2, u3} k V P _inst_1 _inst_2 _inst_3 S s1) (AffineSubspace.direction.{u1, u2, u3} k V P _inst_1 _inst_2 _inst_3 S s2)) (AffineSubspace.direction.{u1, u2, u3} k V P _inst_1 _inst_2 _inst_3 S (Sup.sup.{u3} (AffineSubspace.{u1, u2, u3} k V P _inst_1 _inst_2 _inst_3 S) (SemilatticeSup.toHasSup.{u3} (AffineSubspace.{u1, u2, u3} k V P _inst_1 _inst_2 _inst_3 S) (Lattice.toSemilatticeSup.{u3} (AffineSubspace.{u1, u2, u3} k V P _inst_1 _inst_2 _inst_3 S) (ConditionallyCompleteLattice.toLattice.{u3} (AffineSubspace.{u1, u2, u3} k V P _inst_1 _inst_2 _inst_3 S) (CompleteLattice.toConditionallyCompleteLattice.{u3} (AffineSubspace.{u1, u2, u3} k V P _inst_1 _inst_2 _inst_3 S) (AffineSubspace.completeLattice.{u1, u2, u3} k V P _inst_1 _inst_2 _inst_3 S))))) s1 s2))) but is expected to have type forall {k : Type.{u3}} {V : Type.{u2}} {P : Type.{u1}} [_inst_1 : Ring.{u3} k] [_inst_2 : AddCommGroup.{u2} V] [_inst_3 : Module.{u3, u2} k V (Ring.toSemiring.{u3} k _inst_1) (AddCommGroup.toAddCommMonoid.{u2} V _inst_2)] [S : AddTorsor.{u2, u1} V P (AddCommGroup.toAddGroup.{u2} V _inst_2)] {s1 : AffineSubspace.{u3, u2, u1} k V P _inst_1 _inst_2 _inst_3 S} {s2 : AffineSubspace.{u3, u2, u1} k V P _inst_1 _inst_2 _inst_3 S}, (Set.Nonempty.{u1} P (SetLike.coe.{u1, u1} (AffineSubspace.{u3, u2, u1} k V P _inst_1 _inst_2 _inst_3 S) P (AffineSubspace.instSetLikeAffineSubspace.{u3, u2, u1} k V P _inst_1 _inst_2 _inst_3 S) s1)) -> (Set.Nonempty.{u1} P (SetLike.coe.{u1, u1} (AffineSubspace.{u3, u2, u1} k V P _inst_1 _inst_2 _inst_3 S) P (AffineSubspace.instSetLikeAffineSubspace.{u3, u2, u1} k V P _inst_1 _inst_2 _inst_3 S) s2)) -> (Eq.{succ u1} (Set.{u1} P) (Inter.inter.{u1} (Set.{u1} P) (Set.instInterSet.{u1} P) (SetLike.coe.{u1, u1} (AffineSubspace.{u3, u2, u1} k V P _inst_1 _inst_2 _inst_3 S) P (AffineSubspace.instSetLikeAffineSubspace.{u3, u2, u1} k V P _inst_1 _inst_2 _inst_3 S) s1) (SetLike.coe.{u1, u1} (AffineSubspace.{u3, u2, u1} k V P _inst_1 _inst_2 _inst_3 S) P (AffineSubspace.instSetLikeAffineSubspace.{u3, u2, u1} k V P _inst_1 _inst_2 _inst_3 S) s2)) (EmptyCollection.emptyCollection.{u1} (Set.{u1} P) (Set.instEmptyCollectionSet.{u1} P))) -> (LT.lt.{u2} (Submodule.{u3, u2} k V (Ring.toSemiring.{u3} k _inst_1) (AddCommGroup.toAddCommMonoid.{u2} V _inst_2) _inst_3) (Preorder.toLT.{u2} (Submodule.{u3, u2} k V (Ring.toSemiring.{u3} k _inst_1) (AddCommGroup.toAddCommMonoid.{u2} V _inst_2) _inst_3) (PartialOrder.toPreorder.{u2} (Submodule.{u3, u2} k V (Ring.toSemiring.{u3} k _inst_1) (AddCommGroup.toAddCommMonoid.{u2} V _inst_2) _inst_3) (OmegaCompletePartialOrder.toPartialOrder.{u2} (Submodule.{u3, u2} k V (Ring.toSemiring.{u3} k _inst_1) (AddCommGroup.toAddCommMonoid.{u2} V _inst_2) _inst_3) (CompleteLattice.instOmegaCompletePartialOrder.{u2} (Submodule.{u3, u2} k V (Ring.toSemiring.{u3} k _inst_1) (AddCommGroup.toAddCommMonoid.{u2} V _inst_2) _inst_3) (Submodule.completeLattice.{u3, u2} k V (Ring.toSemiring.{u3} k _inst_1) (AddCommGroup.toAddCommMonoid.{u2} V _inst_2) _inst_3))))) (Sup.sup.{u2} (Submodule.{u3, u2} k V (Ring.toSemiring.{u3} k _inst_1) (AddCommGroup.toAddCommMonoid.{u2} V _inst_2) _inst_3) (SemilatticeSup.toSup.{u2} (Submodule.{u3, u2} k V (Ring.toSemiring.{u3} k _inst_1) (AddCommGroup.toAddCommMonoid.{u2} V _inst_2) _inst_3) (Lattice.toSemilatticeSup.{u2} (Submodule.{u3, u2} k V (Ring.toSemiring.{u3} k _inst_1) (AddCommGroup.toAddCommMonoid.{u2} V _inst_2) _inst_3) (ConditionallyCompleteLattice.toLattice.{u2} (Submodule.{u3, u2} k V (Ring.toSemiring.{u3} k _inst_1) (AddCommGroup.toAddCommMonoid.{u2} V _inst_2) _inst_3) (CompleteLattice.toConditionallyCompleteLattice.{u2} (Submodule.{u3, u2} k V (Ring.toSemiring.{u3} k _inst_1) (AddCommGroup.toAddCommMonoid.{u2} V _inst_2) _inst_3) (Submodule.completeLattice.{u3, u2} k V (Ring.toSemiring.{u3} k _inst_1) (AddCommGroup.toAddCommMonoid.{u2} V _inst_2) _inst_3))))) (AffineSubspace.direction.{u3, u2, u1} k V P _inst_1 _inst_2 _inst_3 S s1) (AffineSubspace.direction.{u3, u2, u1} k V P _inst_1 _inst_2 _inst_3 S s2)) (AffineSubspace.direction.{u3, u2, u1} k V P _inst_1 _inst_2 _inst_3 S (Sup.sup.{u1} (AffineSubspace.{u3, u2, u1} k V P _inst_1 _inst_2 _inst_3 S) (SemilatticeSup.toSup.{u1} (AffineSubspace.{u3, u2, u1} k V P _inst_1 _inst_2 _inst_3 S) (Lattice.toSemilatticeSup.{u1} (AffineSubspace.{u3, u2, u1} k V P _inst_1 _inst_2 _inst_3 S) (ConditionallyCompleteLattice.toLattice.{u1} (AffineSubspace.{u3, u2, u1} k V P _inst_1 _inst_2 _inst_3 S) (CompleteLattice.toConditionallyCompleteLattice.{u1} (AffineSubspace.{u3, u2, u1} k V P _inst_1 _inst_2 _inst_3 S) (AffineSubspace.instCompleteLatticeAffineSubspace.{u3, u2, u1} k V P _inst_1 _inst_2 _inst_3 S))))) s1 s2))) Case conversion may be inaccurate. Consider using '#align affine_subspace.sup_direction_lt_of_nonempty_of_inter_empty AffineSubspace.sup_direction_lt_of_nonempty_of_inter_emptyₓ'. -/ /-- The sup of the directions of two nonempty affine subspaces with empty intersection is less than the direction of their sup. -/ theorem sup_direction_lt_of_nonempty_of_inter_empty {s1 s2 : AffineSubspace k P} (h1 : (s1 : Set P).Nonempty) (h2 : (s2 : Set P).Nonempty) (he : (s1 ∩ s2 : Set P) = ∅) : s1.direction ⊔ s2.direction < (s1 ⊔ s2).direction := by cases' h1 with p1 hp1 cases' h2 with p2 hp2 rw [SetLike.lt_iff_le_and_exists] use sup_direction_le s1 s2, p2 -ᵥ p1, vsub_mem_direction ((le_sup_right : s2 ≤ s1 ⊔ s2) hp2) ((le_sup_left : s1 ≤ s1 ⊔ s2) hp1) intro h rw [Submodule.mem_sup] at h rcases h with ⟨v1, hv1, v2, hv2, hv1v2⟩ rw [← sub_eq_zero, sub_eq_add_neg, neg_vsub_eq_vsub_rev, add_comm v1, add_assoc, ← vadd_vsub_assoc, ← neg_neg v2, add_comm, ← sub_eq_add_neg, ← vsub_vadd_eq_vsub_sub, vsub_eq_zero_iff_eq] at hv1v2 refine' Set.Nonempty.ne_empty _ he use v1 +ᵥ p1, vadd_mem_of_mem_direction hv1 hp1 rw [hv1v2] exact vadd_mem_of_mem_direction (Submodule.neg_mem _ hv2) hp2 #align affine_subspace.sup_direction_lt_of_nonempty_of_inter_empty AffineSubspace.sup_direction_lt_of_nonempty_of_inter_empty /- warning: affine_subspace.inter_nonempty_of_nonempty_of_sup_direction_eq_top -> AffineSubspace.inter_nonempty_of_nonempty_of_sup_direction_eq_top is a dubious translation: lean 3 declaration is forall {k : Type.{u1}} {V : Type.{u2}} {P : Type.{u3}} [_inst_1 : Ring.{u1} k] [_inst_2 : AddCommGroup.{u2} V] [_inst_3 : Module.{u1, u2} k V (Ring.toSemiring.{u1} k _inst_1) (AddCommGroup.toAddCommMonoid.{u2} V _inst_2)] [S : AddTorsor.{u2, u3} V P (AddCommGroup.toAddGroup.{u2} V _inst_2)] {s1 : AffineSubspace.{u1, u2, u3} k V P _inst_1 _inst_2 _inst_3 S} {s2 : AffineSubspace.{u1, u2, u3} k V P _inst_1 _inst_2 _inst_3 S}, (Set.Nonempty.{u3} P ((fun (a : Type.{u3}) (b : Type.{u3}) [self : HasLiftT.{succ u3, succ u3} a b] => self.0) (AffineSubspace.{u1, u2, u3} k V P _inst_1 _inst_2 _inst_3 S) (Set.{u3} P) (HasLiftT.mk.{succ u3, succ u3} (AffineSubspace.{u1, u2, u3} k V P _inst_1 _inst_2 _inst_3 S) (Set.{u3} P) (CoeTCₓ.coe.{succ u3, succ u3} (AffineSubspace.{u1, u2, u3} k V P _inst_1 _inst_2 _inst_3 S) (Set.{u3} P) (SetLike.Set.hasCoeT.{u3, u3} (AffineSubspace.{u1, u2, u3} k V P _inst_1 _inst_2 _inst_3 S) P (AffineSubspace.setLike.{u1, u2, u3} k V P _inst_1 _inst_2 _inst_3 S)))) s1)) -> (Set.Nonempty.{u3} P ((fun (a : Type.{u3}) (b : Type.{u3}) [self : HasLiftT.{succ u3, succ u3} a b] => self.0) (AffineSubspace.{u1, u2, u3} k V P _inst_1 _inst_2 _inst_3 S) (Set.{u3} P) (HasLiftT.mk.{succ u3, succ u3} (AffineSubspace.{u1, u2, u3} k V P _inst_1 _inst_2 _inst_3 S) (Set.{u3} P) (CoeTCₓ.coe.{succ u3, succ u3} (AffineSubspace.{u1, u2, u3} k V P _inst_1 _inst_2 _inst_3 S) (Set.{u3} P) (SetLike.Set.hasCoeT.{u3, u3} (AffineSubspace.{u1, u2, u3} k V P _inst_1 _inst_2 _inst_3 S) P (AffineSubspace.setLike.{u1, u2, u3} k V P _inst_1 _inst_2 _inst_3 S)))) s2)) -> (Eq.{succ u2} (Submodule.{u1, u2} k V (Ring.toSemiring.{u1} k _inst_1) (AddCommGroup.toAddCommMonoid.{u2} V _inst_2) _inst_3) (Sup.sup.{u2} (Submodule.{u1, u2} k V (Ring.toSemiring.{u1} k _inst_1) (AddCommGroup.toAddCommMonoid.{u2} V _inst_2) _inst_3) (SemilatticeSup.toHasSup.{u2} (Submodule.{u1, u2} k V (Ring.toSemiring.{u1} k _inst_1) (AddCommGroup.toAddCommMonoid.{u2} V _inst_2) _inst_3) (Lattice.toSemilatticeSup.{u2} (Submodule.{u1, u2} k V (Ring.toSemiring.{u1} k _inst_1) (AddCommGroup.toAddCommMonoid.{u2} V _inst_2) _inst_3) (ConditionallyCompleteLattice.toLattice.{u2} (Submodule.{u1, u2} k V (Ring.toSemiring.{u1} k _inst_1) (AddCommGroup.toAddCommMonoid.{u2} V _inst_2) _inst_3) (CompleteLattice.toConditionallyCompleteLattice.{u2} (Submodule.{u1, u2} k V (Ring.toSemiring.{u1} k _inst_1) (AddCommGroup.toAddCommMonoid.{u2} V _inst_2) _inst_3) (Submodule.completeLattice.{u1, u2} k V (Ring.toSemiring.{u1} k _inst_1) (AddCommGroup.toAddCommMonoid.{u2} V _inst_2) _inst_3))))) (AffineSubspace.direction.{u1, u2, u3} k V P _inst_1 _inst_2 _inst_3 S s1) (AffineSubspace.direction.{u1, u2, u3} k V P _inst_1 _inst_2 _inst_3 S s2)) (Top.top.{u2} (Submodule.{u1, u2} k V (Ring.toSemiring.{u1} k _inst_1) (AddCommGroup.toAddCommMonoid.{u2} V _inst_2) _inst_3) (Submodule.hasTop.{u1, u2} k V (Ring.toSemiring.{u1} k _inst_1) (AddCommGroup.toAddCommMonoid.{u2} V _inst_2) _inst_3))) -> (Set.Nonempty.{u3} P (Inter.inter.{u3} (Set.{u3} P) (Set.hasInter.{u3} P) ((fun (a : Type.{u3}) (b : Type.{u3}) [self : HasLiftT.{succ u3, succ u3} a b] => self.0) (AffineSubspace.{u1, u2, u3} k V P _inst_1 _inst_2 _inst_3 S) (Set.{u3} P) (HasLiftT.mk.{succ u3, succ u3} (AffineSubspace.{u1, u2, u3} k V P _inst_1 _inst_2 _inst_3 S) (Set.{u3} P) (CoeTCₓ.coe.{succ u3, succ u3} (AffineSubspace.{u1, u2, u3} k V P _inst_1 _inst_2 _inst_3 S) (Set.{u3} P) (SetLike.Set.hasCoeT.{u3, u3} (AffineSubspace.{u1, u2, u3} k V P _inst_1 _inst_2 _inst_3 S) P (AffineSubspace.setLike.{u1, u2, u3} k V P _inst_1 _inst_2 _inst_3 S)))) s1) ((fun (a : Type.{u3}) (b : Type.{u3}) [self : HasLiftT.{succ u3, succ u3} a b] => self.0) (AffineSubspace.{u1, u2, u3} k V P _inst_1 _inst_2 _inst_3 S) (Set.{u3} P) (HasLiftT.mk.{succ u3, succ u3} (AffineSubspace.{u1, u2, u3} k V P _inst_1 _inst_2 _inst_3 S) (Set.{u3} P) (CoeTCₓ.coe.{succ u3, succ u3} (AffineSubspace.{u1, u2, u3} k V P _inst_1 _inst_2 _inst_3 S) (Set.{u3} P) (SetLike.Set.hasCoeT.{u3, u3} (AffineSubspace.{u1, u2, u3} k V P _inst_1 _inst_2 _inst_3 S) P (AffineSubspace.setLike.{u1, u2, u3} k V P _inst_1 _inst_2 _inst_3 S)))) s2))) but is expected to have type forall {k : Type.{u3}} {V : Type.{u2}} {P : Type.{u1}} [_inst_1 : Ring.{u3} k] [_inst_2 : AddCommGroup.{u2} V] [_inst_3 : Module.{u3, u2} k V (Ring.toSemiring.{u3} k _inst_1) (AddCommGroup.toAddCommMonoid.{u2} V _inst_2)] [S : AddTorsor.{u2, u1} V P (AddCommGroup.toAddGroup.{u2} V _inst_2)] {s1 : AffineSubspace.{u3, u2, u1} k V P _inst_1 _inst_2 _inst_3 S} {s2 : AffineSubspace.{u3, u2, u1} k V P _inst_1 _inst_2 _inst_3 S}, (Set.Nonempty.{u1} P (SetLike.coe.{u1, u1} (AffineSubspace.{u3, u2, u1} k V P _inst_1 _inst_2 _inst_3 S) P (AffineSubspace.instSetLikeAffineSubspace.{u3, u2, u1} k V P _inst_1 _inst_2 _inst_3 S) s1)) -> (Set.Nonempty.{u1} P (SetLike.coe.{u1, u1} (AffineSubspace.{u3, u2, u1} k V P _inst_1 _inst_2 _inst_3 S) P (AffineSubspace.instSetLikeAffineSubspace.{u3, u2, u1} k V P _inst_1 _inst_2 _inst_3 S) s2)) -> (Eq.{succ u2} (Submodule.{u3, u2} k V (Ring.toSemiring.{u3} k _inst_1) (AddCommGroup.toAddCommMonoid.{u2} V _inst_2) _inst_3) (Sup.sup.{u2} (Submodule.{u3, u2} k V (Ring.toSemiring.{u3} k _inst_1) (AddCommGroup.toAddCommMonoid.{u2} V _inst_2) _inst_3) (SemilatticeSup.toSup.{u2} (Submodule.{u3, u2} k V (Ring.toSemiring.{u3} k _inst_1) (AddCommGroup.toAddCommMonoid.{u2} V _inst_2) _inst_3) (Lattice.toSemilatticeSup.{u2} (Submodule.{u3, u2} k V (Ring.toSemiring.{u3} k _inst_1) (AddCommGroup.toAddCommMonoid.{u2} V _inst_2) _inst_3) (ConditionallyCompleteLattice.toLattice.{u2} (Submodule.{u3, u2} k V (Ring.toSemiring.{u3} k _inst_1) (AddCommGroup.toAddCommMonoid.{u2} V _inst_2) _inst_3) (CompleteLattice.toConditionallyCompleteLattice.{u2} (Submodule.{u3, u2} k V (Ring.toSemiring.{u3} k _inst_1) (AddCommGroup.toAddCommMonoid.{u2} V _inst_2) _inst_3) (Submodule.completeLattice.{u3, u2} k V (Ring.toSemiring.{u3} k _inst_1) (AddCommGroup.toAddCommMonoid.{u2} V _inst_2) _inst_3))))) (AffineSubspace.direction.{u3, u2, u1} k V P _inst_1 _inst_2 _inst_3 S s1) (AffineSubspace.direction.{u3, u2, u1} k V P _inst_1 _inst_2 _inst_3 S s2)) (Top.top.{u2} (Submodule.{u3, u2} k V (Ring.toSemiring.{u3} k _inst_1) (AddCommGroup.toAddCommMonoid.{u2} V _inst_2) _inst_3) (Submodule.instTopSubmodule.{u3, u2} k V (Ring.toSemiring.{u3} k _inst_1) (AddCommGroup.toAddCommMonoid.{u2} V _inst_2) _inst_3))) -> (Set.Nonempty.{u1} P (Inter.inter.{u1} (Set.{u1} P) (Set.instInterSet.{u1} P) (SetLike.coe.{u1, u1} (AffineSubspace.{u3, u2, u1} k V P _inst_1 _inst_2 _inst_3 S) P (AffineSubspace.instSetLikeAffineSubspace.{u3, u2, u1} k V P _inst_1 _inst_2 _inst_3 S) s1) (SetLike.coe.{u1, u1} (AffineSubspace.{u3, u2, u1} k V P _inst_1 _inst_2 _inst_3 S) P (AffineSubspace.instSetLikeAffineSubspace.{u3, u2, u1} k V P _inst_1 _inst_2 _inst_3 S) s2))) Case conversion may be inaccurate. Consider using '#align affine_subspace.inter_nonempty_of_nonempty_of_sup_direction_eq_top AffineSubspace.inter_nonempty_of_nonempty_of_sup_direction_eq_topₓ'. -/ /-- If the directions of two nonempty affine subspaces span the whole module, they have nonempty intersection. -/ theorem inter_nonempty_of_nonempty_of_sup_direction_eq_top {s1 s2 : AffineSubspace k P} (h1 : (s1 : Set P).Nonempty) (h2 : (s2 : Set P).Nonempty) (hd : s1.direction ⊔ s2.direction = ⊤) : ((s1 : Set P) ∩ s2).Nonempty := by by_contra h rw [Set.not_nonempty_iff_eq_empty] at h have hlt := sup_direction_lt_of_nonempty_of_inter_empty h1 h2 h rw [hd] at hlt exact not_top_lt hlt #align affine_subspace.inter_nonempty_of_nonempty_of_sup_direction_eq_top AffineSubspace.inter_nonempty_of_nonempty_of_sup_direction_eq_top /- warning: affine_subspace.inter_eq_singleton_of_nonempty_of_is_compl -> AffineSubspace.inter_eq_singleton_of_nonempty_of_isCompl is a dubious translation: lean 3 declaration is forall {k : Type.{u1}} {V : Type.{u2}} {P : Type.{u3}} [_inst_1 : Ring.{u1} k] [_inst_2 : AddCommGroup.{u2} V] [_inst_3 : Module.{u1, u2} k V (Ring.toSemiring.{u1} k _inst_1) (AddCommGroup.toAddCommMonoid.{u2} V _inst_2)] [S : AddTorsor.{u2, u3} V P (AddCommGroup.toAddGroup.{u2} V _inst_2)] {s1 : AffineSubspace.{u1, u2, u3} k V P _inst_1 _inst_2 _inst_3 S} {s2 : AffineSubspace.{u1, u2, u3} k V P _inst_1 _inst_2 _inst_3 S}, (Set.Nonempty.{u3} P ((fun (a : Type.{u3}) (b : Type.{u3}) [self : HasLiftT.{succ u3, succ u3} a b] => self.0) (AffineSubspace.{u1, u2, u3} k V P _inst_1 _inst_2 _inst_3 S) (Set.{u3} P) (HasLiftT.mk.{succ u3, succ u3} (AffineSubspace.{u1, u2, u3} k V P _inst_1 _inst_2 _inst_3 S) (Set.{u3} P) (CoeTCₓ.coe.{succ u3, succ u3} (AffineSubspace.{u1, u2, u3} k V P _inst_1 _inst_2 _inst_3 S) (Set.{u3} P) (SetLike.Set.hasCoeT.{u3, u3} (AffineSubspace.{u1, u2, u3} k V P _inst_1 _inst_2 _inst_3 S) P (AffineSubspace.setLike.{u1, u2, u3} k V P _inst_1 _inst_2 _inst_3 S)))) s1)) -> (Set.Nonempty.{u3} P ((fun (a : Type.{u3}) (b : Type.{u3}) [self : HasLiftT.{succ u3, succ u3} a b] => self.0) (AffineSubspace.{u1, u2, u3} k V P _inst_1 _inst_2 _inst_3 S) (Set.{u3} P) (HasLiftT.mk.{succ u3, succ u3} (AffineSubspace.{u1, u2, u3} k V P _inst_1 _inst_2 _inst_3 S) (Set.{u3} P) (CoeTCₓ.coe.{succ u3, succ u3} (AffineSubspace.{u1, u2, u3} k V P _inst_1 _inst_2 _inst_3 S) (Set.{u3} P) (SetLike.Set.hasCoeT.{u3, u3} (AffineSubspace.{u1, u2, u3} k V P _inst_1 _inst_2 _inst_3 S) P (AffineSubspace.setLike.{u1, u2, u3} k V P _inst_1 _inst_2 _inst_3 S)))) s2)) -> (IsCompl.{u2} (Submodule.{u1, u2} k V (Ring.toSemiring.{u1} k _inst_1) (AddCommGroup.toAddCommMonoid.{u2} V _inst_2) _inst_3) (SetLike.partialOrder.{u2, u2} (Submodule.{u1, u2} k V (Ring.toSemiring.{u1} k _inst_1) (AddCommGroup.toAddCommMonoid.{u2} V _inst_2) _inst_3) V (Submodule.setLike.{u1, u2} k V (Ring.toSemiring.{u1} k _inst_1) (AddCommGroup.toAddCommMonoid.{u2} V _inst_2) _inst_3)) (CompleteLattice.toBoundedOrder.{u2} (Submodule.{u1, u2} k V (Ring.toSemiring.{u1} k _inst_1) (AddCommGroup.toAddCommMonoid.{u2} V _inst_2) _inst_3) (Submodule.completeLattice.{u1, u2} k V (Ring.toSemiring.{u1} k _inst_1) (AddCommGroup.toAddCommMonoid.{u2} V _inst_2) _inst_3)) (AffineSubspace.direction.{u1, u2, u3} k V P _inst_1 _inst_2 _inst_3 S s1) (AffineSubspace.direction.{u1, u2, u3} k V P _inst_1 _inst_2 _inst_3 S s2)) -> (Exists.{succ u3} P (fun (p : P) => Eq.{succ u3} (Set.{u3} P) (Inter.inter.{u3} (Set.{u3} P) (Set.hasInter.{u3} P) ((fun (a : Type.{u3}) (b : Type.{u3}) [self : HasLiftT.{succ u3, succ u3} a b] => self.0) (AffineSubspace.{u1, u2, u3} k V P _inst_1 _inst_2 _inst_3 S) (Set.{u3} P) (HasLiftT.mk.{succ u3, succ u3} (AffineSubspace.{u1, u2, u3} k V P _inst_1 _inst_2 _inst_3 S) (Set.{u3} P) (CoeTCₓ.coe.{succ u3, succ u3} (AffineSubspace.{u1, u2, u3} k V P _inst_1 _inst_2 _inst_3 S) (Set.{u3} P) (SetLike.Set.hasCoeT.{u3, u3} (AffineSubspace.{u1, u2, u3} k V P _inst_1 _inst_2 _inst_3 S) P (AffineSubspace.setLike.{u1, u2, u3} k V P _inst_1 _inst_2 _inst_3 S)))) s1) ((fun (a : Type.{u3}) (b : Type.{u3}) [self : HasLiftT.{succ u3, succ u3} a b] => self.0) (AffineSubspace.{u1, u2, u3} k V P _inst_1 _inst_2 _inst_3 S) (Set.{u3} P) (HasLiftT.mk.{succ u3, succ u3} (AffineSubspace.{u1, u2, u3} k V P _inst_1 _inst_2 _inst_3 S) (Set.{u3} P) (CoeTCₓ.coe.{succ u3, succ u3} (AffineSubspace.{u1, u2, u3} k V P _inst_1 _inst_2 _inst_3 S) (Set.{u3} P) (SetLike.Set.hasCoeT.{u3, u3} (AffineSubspace.{u1, u2, u3} k V P _inst_1 _inst_2 _inst_3 S) P (AffineSubspace.setLike.{u1, u2, u3} k V P _inst_1 _inst_2 _inst_3 S)))) s2)) (Singleton.singleton.{u3, u3} P (Set.{u3} P) (Set.hasSingleton.{u3} P) p))) but is expected to have type forall {k : Type.{u3}} {V : Type.{u2}} {P : Type.{u1}} [_inst_1 : Ring.{u3} k] [_inst_2 : AddCommGroup.{u2} V] [_inst_3 : Module.{u3, u2} k V (Ring.toSemiring.{u3} k _inst_1) (AddCommGroup.toAddCommMonoid.{u2} V _inst_2)] [S : AddTorsor.{u2, u1} V P (AddCommGroup.toAddGroup.{u2} V _inst_2)] {s1 : AffineSubspace.{u3, u2, u1} k V P _inst_1 _inst_2 _inst_3 S} {s2 : AffineSubspace.{u3, u2, u1} k V P _inst_1 _inst_2 _inst_3 S}, (Set.Nonempty.{u1} P (SetLike.coe.{u1, u1} (AffineSubspace.{u3, u2, u1} k V P _inst_1 _inst_2 _inst_3 S) P (AffineSubspace.instSetLikeAffineSubspace.{u3, u2, u1} k V P _inst_1 _inst_2 _inst_3 S) s1)) -> (Set.Nonempty.{u1} P (SetLike.coe.{u1, u1} (AffineSubspace.{u3, u2, u1} k V P _inst_1 _inst_2 _inst_3 S) P (AffineSubspace.instSetLikeAffineSubspace.{u3, u2, u1} k V P _inst_1 _inst_2 _inst_3 S) s2)) -> (IsCompl.{u2} (Submodule.{u3, u2} k V (Ring.toSemiring.{u3} k _inst_1) (AddCommGroup.toAddCommMonoid.{u2} V _inst_2) _inst_3) (OmegaCompletePartialOrder.toPartialOrder.{u2} (Submodule.{u3, u2} k V (Ring.toSemiring.{u3} k _inst_1) (AddCommGroup.toAddCommMonoid.{u2} V _inst_2) _inst_3) (CompleteLattice.instOmegaCompletePartialOrder.{u2} (Submodule.{u3, u2} k V (Ring.toSemiring.{u3} k _inst_1) (AddCommGroup.toAddCommMonoid.{u2} V _inst_2) _inst_3) (Submodule.completeLattice.{u3, u2} k V (Ring.toSemiring.{u3} k _inst_1) (AddCommGroup.toAddCommMonoid.{u2} V _inst_2) _inst_3))) (CompleteLattice.toBoundedOrder.{u2} (Submodule.{u3, u2} k V (Ring.toSemiring.{u3} k _inst_1) (AddCommGroup.toAddCommMonoid.{u2} V _inst_2) _inst_3) (Submodule.completeLattice.{u3, u2} k V (Ring.toSemiring.{u3} k _inst_1) (AddCommGroup.toAddCommMonoid.{u2} V _inst_2) _inst_3)) (AffineSubspace.direction.{u3, u2, u1} k V P _inst_1 _inst_2 _inst_3 S s1) (AffineSubspace.direction.{u3, u2, u1} k V P _inst_1 _inst_2 _inst_3 S s2)) -> (Exists.{succ u1} P (fun (p : P) => Eq.{succ u1} (Set.{u1} P) (Inter.inter.{u1} (Set.{u1} P) (Set.instInterSet.{u1} P) (SetLike.coe.{u1, u1} (AffineSubspace.{u3, u2, u1} k V P _inst_1 _inst_2 _inst_3 S) P (AffineSubspace.instSetLikeAffineSubspace.{u3, u2, u1} k V P _inst_1 _inst_2 _inst_3 S) s1) (SetLike.coe.{u1, u1} (AffineSubspace.{u3, u2, u1} k V P _inst_1 _inst_2 _inst_3 S) P (AffineSubspace.instSetLikeAffineSubspace.{u3, u2, u1} k V P _inst_1 _inst_2 _inst_3 S) s2)) (Singleton.singleton.{u1, u1} P (Set.{u1} P) (Set.instSingletonSet.{u1} P) p))) Case conversion may be inaccurate. Consider using '#align affine_subspace.inter_eq_singleton_of_nonempty_of_is_compl AffineSubspace.inter_eq_singleton_of_nonempty_of_isComplₓ'. -/ /-- If the directions of two nonempty affine subspaces are complements of each other, they intersect in exactly one point. -/ theorem inter_eq_singleton_of_nonempty_of_isCompl {s1 s2 : AffineSubspace k P} (h1 : (s1 : Set P).Nonempty) (h2 : (s2 : Set P).Nonempty) (hd : IsCompl s1.direction s2.direction) : ∃ p, (s1 : Set P) ∩ s2 = {p} := by cases' inter_nonempty_of_nonempty_of_sup_direction_eq_top h1 h2 hd.sup_eq_top with p hp use p ext q rw [Set.mem_singleton_iff] constructor · rintro ⟨hq1, hq2⟩ have hqp : q -ᵥ p ∈ s1.direction ⊓ s2.direction := ⟨vsub_mem_direction hq1 hp.1, vsub_mem_direction hq2 hp.2⟩ rwa [hd.inf_eq_bot, Submodule.mem_bot, vsub_eq_zero_iff_eq] at hqp · exact fun h => h.symm ▸ hp #align affine_subspace.inter_eq_singleton_of_nonempty_of_is_compl AffineSubspace.inter_eq_singleton_of_nonempty_of_isCompl /- warning: affine_subspace.affine_span_coe -> AffineSubspace.affineSpan_coe is a dubious translation: lean 3 declaration is forall {k : Type.{u1}} {V : Type.{u2}} {P : Type.{u3}} [_inst_1 : Ring.{u1} k] [_inst_2 : AddCommGroup.{u2} V] [_inst_3 : Module.{u1, u2} k V (Ring.toSemiring.{u1} k _inst_1) (AddCommGroup.toAddCommMonoid.{u2} V _inst_2)] [S : AddTorsor.{u2, u3} V P (AddCommGroup.toAddGroup.{u2} V _inst_2)] (s : AffineSubspace.{u1, u2, u3} k V P _inst_1 _inst_2 _inst_3 S), Eq.{succ u3} (AffineSubspace.{u1, u2, u3} k V P _inst_1 _inst_2 _inst_3 S) (affineSpan.{u1, u2, u3} k V P _inst_1 _inst_2 _inst_3 S ((fun (a : Type.{u3}) (b : Type.{u3}) [self : HasLiftT.{succ u3, succ u3} a b] => self.0) (AffineSubspace.{u1, u2, u3} k V P _inst_1 _inst_2 _inst_3 S) (Set.{u3} P) (HasLiftT.mk.{succ u3, succ u3} (AffineSubspace.{u1, u2, u3} k V P _inst_1 _inst_2 _inst_3 S) (Set.{u3} P) (CoeTCₓ.coe.{succ u3, succ u3} (AffineSubspace.{u1, u2, u3} k V P _inst_1 _inst_2 _inst_3 S) (Set.{u3} P) (SetLike.Set.hasCoeT.{u3, u3} (AffineSubspace.{u1, u2, u3} k V P _inst_1 _inst_2 _inst_3 S) P (AffineSubspace.setLike.{u1, u2, u3} k V P _inst_1 _inst_2 _inst_3 S)))) s)) s but is expected to have type forall {k : Type.{u3}} {V : Type.{u2}} {P : Type.{u1}} [_inst_1 : Ring.{u3} k] [_inst_2 : AddCommGroup.{u2} V] [_inst_3 : Module.{u3, u2} k V (Ring.toSemiring.{u3} k _inst_1) (AddCommGroup.toAddCommMonoid.{u2} V _inst_2)] [S : AddTorsor.{u2, u1} V P (AddCommGroup.toAddGroup.{u2} V _inst_2)] (s : AffineSubspace.{u3, u2, u1} k V P _inst_1 _inst_2 _inst_3 S), Eq.{succ u1} (AffineSubspace.{u3, u2, u1} k V P _inst_1 _inst_2 _inst_3 S) (affineSpan.{u3, u2, u1} k V P _inst_1 _inst_2 _inst_3 S (SetLike.coe.{u1, u1} (AffineSubspace.{u3, u2, u1} k V P _inst_1 _inst_2 _inst_3 S) P (AffineSubspace.instSetLikeAffineSubspace.{u3, u2, u1} k V P _inst_1 _inst_2 _inst_3 S) s)) s Case conversion may be inaccurate. Consider using '#align affine_subspace.affine_span_coe AffineSubspace.affineSpan_coeₓ'. -/ /-- Coercing a subspace to a set then taking the affine span produces the original subspace. -/ @[simp] theorem affineSpan_coe (s : AffineSubspace k P) : affineSpan k (s : Set P) = s := by refine' le_antisymm _ (subset_spanPoints _ _) rintro p ⟨p1, hp1, v, hv, rfl⟩ exact vadd_mem_of_mem_direction hv hp1 #align affine_subspace.affine_span_coe AffineSubspace.affineSpan_coe end AffineSubspace section AffineSpace' variable (k : Type _) {V : Type _} {P : Type _} [Ring k] [AddCommGroup V] [Module k V] [affine_space V P] variable {ι : Type _} include V open AffineSubspace Set #print vectorSpan_eq_span_vsub_set_left /- /-- The `vector_span` is the span of the pairwise subtractions with a given point on the left. -/ theorem vectorSpan_eq_span_vsub_set_left {s : Set P} {p : P} (hp : p ∈ s) : vectorSpan k s = Submodule.span k ((· -ᵥ ·) p '' s) := by rw [vectorSpan_def] refine' le_antisymm _ (Submodule.span_mono _) · rw [Submodule.span_le] rintro v ⟨p1, p2, hp1, hp2, hv⟩ rw [← vsub_sub_vsub_cancel_left p1 p2 p] at hv rw [← hv, SetLike.mem_coe, Submodule.mem_span] exact fun m hm => Submodule.sub_mem _ (hm ⟨p2, hp2, rfl⟩) (hm ⟨p1, hp1, rfl⟩) · rintro v ⟨p2, hp2, hv⟩ exact ⟨p, p2, hp, hp2, hv⟩ #align vector_span_eq_span_vsub_set_left vectorSpan_eq_span_vsub_set_left -/ #print vectorSpan_eq_span_vsub_set_right /- /-- The `vector_span` is the span of the pairwise subtractions with a given point on the right. -/ theorem vectorSpan_eq_span_vsub_set_right {s : Set P} {p : P} (hp : p ∈ s) : vectorSpan k s = Submodule.span k ((· -ᵥ p) '' s) := by rw [vectorSpan_def] refine' le_antisymm _ (Submodule.span_mono _) · rw [Submodule.span_le] rintro v ⟨p1, p2, hp1, hp2, hv⟩ rw [← vsub_sub_vsub_cancel_right p1 p2 p] at hv rw [← hv, SetLike.mem_coe, Submodule.mem_span] exact fun m hm => Submodule.sub_mem _ (hm ⟨p1, hp1, rfl⟩) (hm ⟨p2, hp2, rfl⟩) · rintro v ⟨p2, hp2, hv⟩ exact ⟨p2, p, hp2, hp, hv⟩ #align vector_span_eq_span_vsub_set_right vectorSpan_eq_span_vsub_set_right -/ /- warning: vector_span_eq_span_vsub_set_left_ne -> vectorSpan_eq_span_vsub_set_left_ne is a dubious translation: lean 3 declaration is forall (k : Type.{u1}) {V : Type.{u2}} {P : Type.{u3}} [_inst_1 : Ring.{u1} k] [_inst_2 : AddCommGroup.{u2} V] [_inst_3 : Module.{u1, u2} k V (Ring.toSemiring.{u1} k _inst_1) (AddCommGroup.toAddCommMonoid.{u2} V _inst_2)] [_inst_4 : AddTorsor.{u2, u3} V P (AddCommGroup.toAddGroup.{u2} V _inst_2)] {s : Set.{u3} P} {p : P}, (Membership.Mem.{u3, u3} P (Set.{u3} P) (Set.hasMem.{u3} P) p s) -> (Eq.{succ u2} (Submodule.{u1, u2} k V (Ring.toSemiring.{u1} k _inst_1) (AddCommGroup.toAddCommMonoid.{u2} V _inst_2) _inst_3) (vectorSpan.{u1, u2, u3} k V P _inst_1 _inst_2 _inst_3 _inst_4 s) (Submodule.span.{u1, u2} k V (Ring.toSemiring.{u1} k _inst_1) (AddCommGroup.toAddCommMonoid.{u2} V _inst_2) _inst_3 (Set.image.{u3, u2} P V (VSub.vsub.{u2, u3} V P (AddTorsor.toHasVsub.{u2, u3} V P (AddCommGroup.toAddGroup.{u2} V _inst_2) _inst_4) p) (SDiff.sdiff.{u3} (Set.{u3} P) (BooleanAlgebra.toHasSdiff.{u3} (Set.{u3} P) (Set.booleanAlgebra.{u3} P)) s (Singleton.singleton.{u3, u3} P (Set.{u3} P) (Set.hasSingleton.{u3} P) p))))) but is expected to have type forall (k : Type.{u1}) {V : Type.{u2}} {P : Type.{u3}} [_inst_1 : Ring.{u1} k] [_inst_2 : AddCommGroup.{u2} V] [_inst_3 : Module.{u1, u2} k V (Ring.toSemiring.{u1} k _inst_1) (AddCommGroup.toAddCommMonoid.{u2} V _inst_2)] [_inst_4 : AddTorsor.{u2, u3} V P (AddCommGroup.toAddGroup.{u2} V _inst_2)] {s : Set.{u3} P} {p : P}, (Membership.mem.{u3, u3} P (Set.{u3} P) (Set.instMembershipSet.{u3} P) p s) -> (Eq.{succ u2} (Submodule.{u1, u2} k V (Ring.toSemiring.{u1} k _inst_1) (AddCommGroup.toAddCommMonoid.{u2} V _inst_2) _inst_3) (vectorSpan.{u1, u2, u3} k V P _inst_1 _inst_2 _inst_3 _inst_4 s) (Submodule.span.{u1, u2} k V (Ring.toSemiring.{u1} k _inst_1) (AddCommGroup.toAddCommMonoid.{u2} V _inst_2) _inst_3 (Set.image.{u3, u2} P V ((fun ([email protected]._hyg.11114 : P) ([email protected]._hyg.11116 : P) => VSub.vsub.{u2, u3} V P (AddTorsor.toVSub.{u2, u3} V P (AddCommGroup.toAddGroup.{u2} V _inst_2) _inst_4) [email protected]._hyg.11114 [email protected]._hyg.11116) p) (SDiff.sdiff.{u3} (Set.{u3} P) (Set.instSDiffSet.{u3} P) s (Singleton.singleton.{u3, u3} P (Set.{u3} P) (Set.instSingletonSet.{u3} P) p))))) Case conversion may be inaccurate. Consider using '#align vector_span_eq_span_vsub_set_left_ne vectorSpan_eq_span_vsub_set_left_neₓ'. -/ /-- The `vector_span` is the span of the pairwise subtractions with a given point on the left, excluding the subtraction of that point from itself. -/ theorem vectorSpan_eq_span_vsub_set_left_ne {s : Set P} {p : P} (hp : p ∈ s) : vectorSpan k s = Submodule.span k ((· -ᵥ ·) p '' (s \ {p})) := by conv_lhs => rw [vectorSpan_eq_span_vsub_set_left k hp, ← Set.insert_eq_of_mem hp, ← Set.insert_diff_singleton, Set.image_insert_eq] simp [Submodule.span_insert_eq_span] #align vector_span_eq_span_vsub_set_left_ne vectorSpan_eq_span_vsub_set_left_ne /- warning: vector_span_eq_span_vsub_set_right_ne -> vectorSpan_eq_span_vsub_set_right_ne is a dubious translation: lean 3 declaration is forall (k : Type.{u1}) {V : Type.{u2}} {P : Type.{u3}} [_inst_1 : Ring.{u1} k] [_inst_2 : AddCommGroup.{u2} V] [_inst_3 : Module.{u1, u2} k V (Ring.toSemiring.{u1} k _inst_1) (AddCommGroup.toAddCommMonoid.{u2} V _inst_2)] [_inst_4 : AddTorsor.{u2, u3} V P (AddCommGroup.toAddGroup.{u2} V _inst_2)] {s : Set.{u3} P} {p : P}, (Membership.Mem.{u3, u3} P (Set.{u3} P) (Set.hasMem.{u3} P) p s) -> (Eq.{succ u2} (Submodule.{u1, u2} k V (Ring.toSemiring.{u1} k _inst_1) (AddCommGroup.toAddCommMonoid.{u2} V _inst_2) _inst_3) (vectorSpan.{u1, u2, u3} k V P _inst_1 _inst_2 _inst_3 _inst_4 s) (Submodule.span.{u1, u2} k V (Ring.toSemiring.{u1} k _inst_1) (AddCommGroup.toAddCommMonoid.{u2} V _inst_2) _inst_3 (Set.image.{u3, u2} P V (fun (_x : P) => VSub.vsub.{u2, u3} V P (AddTorsor.toHasVsub.{u2, u3} V P (AddCommGroup.toAddGroup.{u2} V _inst_2) _inst_4) _x p) (SDiff.sdiff.{u3} (Set.{u3} P) (BooleanAlgebra.toHasSdiff.{u3} (Set.{u3} P) (Set.booleanAlgebra.{u3} P)) s (Singleton.singleton.{u3, u3} P (Set.{u3} P) (Set.hasSingleton.{u3} P) p))))) but is expected to have type forall (k : Type.{u1}) {V : Type.{u2}} {P : Type.{u3}} [_inst_1 : Ring.{u1} k] [_inst_2 : AddCommGroup.{u2} V] [_inst_3 : Module.{u1, u2} k V (Ring.toSemiring.{u1} k _inst_1) (AddCommGroup.toAddCommMonoid.{u2} V _inst_2)] [_inst_4 : AddTorsor.{u2, u3} V P (AddCommGroup.toAddGroup.{u2} V _inst_2)] {s : Set.{u3} P} {p : P}, (Membership.mem.{u3, u3} P (Set.{u3} P) (Set.instMembershipSet.{u3} P) p s) -> (Eq.{succ u2} (Submodule.{u1, u2} k V (Ring.toSemiring.{u1} k _inst_1) (AddCommGroup.toAddCommMonoid.{u2} V _inst_2) _inst_3) (vectorSpan.{u1, u2, u3} k V P _inst_1 _inst_2 _inst_3 _inst_4 s) (Submodule.span.{u1, u2} k V (Ring.toSemiring.{u1} k _inst_1) (AddCommGroup.toAddCommMonoid.{u2} V _inst_2) _inst_3 (Set.image.{u3, u2} P V (fun (_x : P) => VSub.vsub.{u2, u3} V P (AddTorsor.toVSub.{u2, u3} V P (AddCommGroup.toAddGroup.{u2} V _inst_2) _inst_4) _x p) (SDiff.sdiff.{u3} (Set.{u3} P) (Set.instSDiffSet.{u3} P) s (Singleton.singleton.{u3, u3} P (Set.{u3} P) (Set.instSingletonSet.{u3} P) p))))) Case conversion may be inaccurate. Consider using '#align vector_span_eq_span_vsub_set_right_ne vectorSpan_eq_span_vsub_set_right_neₓ'. -/ /-- The `vector_span` is the span of the pairwise subtractions with a given point on the right, excluding the subtraction of that point from itself. -/ theorem vectorSpan_eq_span_vsub_set_right_ne {s : Set P} {p : P} (hp : p ∈ s) : vectorSpan k s = Submodule.span k ((· -ᵥ p) '' (s \ {p})) := by conv_lhs => rw [vectorSpan_eq_span_vsub_set_right k hp, ← Set.insert_eq_of_mem hp, ← Set.insert_diff_singleton, Set.image_insert_eq] simp [Submodule.span_insert_eq_span] #align vector_span_eq_span_vsub_set_right_ne vectorSpan_eq_span_vsub_set_right_ne #print vectorSpan_eq_span_vsub_finset_right_ne /- /-- The `vector_span` is the span of the pairwise subtractions with a given point on the right, excluding the subtraction of that point from itself. -/ theorem vectorSpan_eq_span_vsub_finset_right_ne [DecidableEq P] [DecidableEq V] {s : Finset P} {p : P} (hp : p ∈ s) : vectorSpan k (s : Set P) = Submodule.span k ((s.eraseₓ p).image (· -ᵥ p)) := by simp [vectorSpan_eq_span_vsub_set_right_ne _ (finset.mem_coe.mpr hp)] #align vector_span_eq_span_vsub_finset_right_ne vectorSpan_eq_span_vsub_finset_right_ne -/ /- warning: vector_span_image_eq_span_vsub_set_left_ne -> vectorSpan_image_eq_span_vsub_set_left_ne is a dubious translation: lean 3 declaration is forall (k : Type.{u1}) {V : Type.{u2}} {P : Type.{u3}} [_inst_1 : Ring.{u1} k] [_inst_2 : AddCommGroup.{u2} V] [_inst_3 : Module.{u1, u2} k V (Ring.toSemiring.{u1} k _inst_1) (AddCommGroup.toAddCommMonoid.{u2} V _inst_2)] [_inst_4 : AddTorsor.{u2, u3} V P (AddCommGroup.toAddGroup.{u2} V _inst_2)] {ι : Type.{u4}} (p : ι -> P) {s : Set.{u4} ι} {i : ι}, (Membership.Mem.{u4, u4} ι (Set.{u4} ι) (Set.hasMem.{u4} ι) i s) -> (Eq.{succ u2} (Submodule.{u1, u2} k V (Ring.toSemiring.{u1} k _inst_1) (AddCommGroup.toAddCommMonoid.{u2} V _inst_2) _inst_3) (vectorSpan.{u1, u2, u3} k V P _inst_1 _inst_2 _inst_3 _inst_4 (Set.image.{u4, u3} ι P p s)) (Submodule.span.{u1, u2} k V (Ring.toSemiring.{u1} k _inst_1) (AddCommGroup.toAddCommMonoid.{u2} V _inst_2) _inst_3 (Set.image.{u3, u2} P V (VSub.vsub.{u2, u3} V P (AddTorsor.toHasVsub.{u2, u3} V P (AddCommGroup.toAddGroup.{u2} V _inst_2) _inst_4) (p i)) (Set.image.{u4, u3} ι P p (SDiff.sdiff.{u4} (Set.{u4} ι) (BooleanAlgebra.toHasSdiff.{u4} (Set.{u4} ι) (Set.booleanAlgebra.{u4} ι)) s (Singleton.singleton.{u4, u4} ι (Set.{u4} ι) (Set.hasSingleton.{u4} ι) i)))))) but is expected to have type forall (k : Type.{u2}) {V : Type.{u3}} {P : Type.{u1}} [_inst_1 : Ring.{u2} k] [_inst_2 : AddCommGroup.{u3} V] [_inst_3 : Module.{u2, u3} k V (Ring.toSemiring.{u2} k _inst_1) (AddCommGroup.toAddCommMonoid.{u3} V _inst_2)] [_inst_4 : AddTorsor.{u3, u1} V P (AddCommGroup.toAddGroup.{u3} V _inst_2)] {ι : Type.{u4}} (p : ι -> P) {s : Set.{u4} ι} {i : ι}, (Membership.mem.{u4, u4} ι (Set.{u4} ι) (Set.instMembershipSet.{u4} ι) i s) -> (Eq.{succ u3} (Submodule.{u2, u3} k V (Ring.toSemiring.{u2} k _inst_1) (AddCommGroup.toAddCommMonoid.{u3} V _inst_2) _inst_3) (vectorSpan.{u2, u3, u1} k V P _inst_1 _inst_2 _inst_3 _inst_4 (Set.image.{u4, u1} ι P p s)) (Submodule.span.{u2, u3} k V (Ring.toSemiring.{u2} k _inst_1) (AddCommGroup.toAddCommMonoid.{u3} V _inst_2) _inst_3 (Set.image.{u1, u3} P V ((fun ([email protected]._hyg.11422 : P) ([email protected]._hyg.11424 : P) => VSub.vsub.{u3, u1} V P (AddTorsor.toVSub.{u3, u1} V P (AddCommGroup.toAddGroup.{u3} V _inst_2) _inst_4) [email protected]._hyg.11422 [email protected]._hyg.11424) (p i)) (Set.image.{u4, u1} ι P p (SDiff.sdiff.{u4} (Set.{u4} ι) (Set.instSDiffSet.{u4} ι) s (Singleton.singleton.{u4, u4} ι (Set.{u4} ι) (Set.instSingletonSet.{u4} ι) i)))))) Case conversion may be inaccurate. Consider using '#align vector_span_image_eq_span_vsub_set_left_ne vectorSpan_image_eq_span_vsub_set_left_neₓ'. -/ /-- The `vector_span` of the image of a function is the span of the pairwise subtractions with a given point on the left, excluding the subtraction of that point from itself. -/ theorem vectorSpan_image_eq_span_vsub_set_left_ne (p : ι → P) {s : Set ι} {i : ι} (hi : i ∈ s) : vectorSpan k (p '' s) = Submodule.span k ((· -ᵥ ·) (p i) '' (p '' (s \ {i}))) := by conv_lhs => rw [vectorSpan_eq_span_vsub_set_left k (Set.mem_image_of_mem p hi), ← Set.insert_eq_of_mem hi, ← Set.insert_diff_singleton, Set.image_insert_eq, Set.image_insert_eq] simp [Submodule.span_insert_eq_span] #align vector_span_image_eq_span_vsub_set_left_ne vectorSpan_image_eq_span_vsub_set_left_ne /- warning: vector_span_image_eq_span_vsub_set_right_ne -> vectorSpan_image_eq_span_vsub_set_right_ne is a dubious translation: lean 3 declaration is forall (k : Type.{u1}) {V : Type.{u2}} {P : Type.{u3}} [_inst_1 : Ring.{u1} k] [_inst_2 : AddCommGroup.{u2} V] [_inst_3 : Module.{u1, u2} k V (Ring.toSemiring.{u1} k _inst_1) (AddCommGroup.toAddCommMonoid.{u2} V _inst_2)] [_inst_4 : AddTorsor.{u2, u3} V P (AddCommGroup.toAddGroup.{u2} V _inst_2)] {ι : Type.{u4}} (p : ι -> P) {s : Set.{u4} ι} {i : ι}, (Membership.Mem.{u4, u4} ι (Set.{u4} ι) (Set.hasMem.{u4} ι) i s) -> (Eq.{succ u2} (Submodule.{u1, u2} k V (Ring.toSemiring.{u1} k _inst_1) (AddCommGroup.toAddCommMonoid.{u2} V _inst_2) _inst_3) (vectorSpan.{u1, u2, u3} k V P _inst_1 _inst_2 _inst_3 _inst_4 (Set.image.{u4, u3} ι P p s)) (Submodule.span.{u1, u2} k V (Ring.toSemiring.{u1} k _inst_1) (AddCommGroup.toAddCommMonoid.{u2} V _inst_2) _inst_3 (Set.image.{u3, u2} P V (fun (_x : P) => VSub.vsub.{u2, u3} V P (AddTorsor.toHasVsub.{u2, u3} V P (AddCommGroup.toAddGroup.{u2} V _inst_2) _inst_4) _x (p i)) (Set.image.{u4, u3} ι P p (SDiff.sdiff.{u4} (Set.{u4} ι) (BooleanAlgebra.toHasSdiff.{u4} (Set.{u4} ι) (Set.booleanAlgebra.{u4} ι)) s (Singleton.singleton.{u4, u4} ι (Set.{u4} ι) (Set.hasSingleton.{u4} ι) i)))))) but is expected to have type forall (k : Type.{u2}) {V : Type.{u3}} {P : Type.{u1}} [_inst_1 : Ring.{u2} k] [_inst_2 : AddCommGroup.{u3} V] [_inst_3 : Module.{u2, u3} k V (Ring.toSemiring.{u2} k _inst_1) (AddCommGroup.toAddCommMonoid.{u3} V _inst_2)] [_inst_4 : AddTorsor.{u3, u1} V P (AddCommGroup.toAddGroup.{u3} V _inst_2)] {ι : Type.{u4}} (p : ι -> P) {s : Set.{u4} ι} {i : ι}, (Membership.mem.{u4, u4} ι (Set.{u4} ι) (Set.instMembershipSet.{u4} ι) i s) -> (Eq.{succ u3} (Submodule.{u2, u3} k V (Ring.toSemiring.{u2} k _inst_1) (AddCommGroup.toAddCommMonoid.{u3} V _inst_2) _inst_3) (vectorSpan.{u2, u3, u1} k V P _inst_1 _inst_2 _inst_3 _inst_4 (Set.image.{u4, u1} ι P p s)) (Submodule.span.{u2, u3} k V (Ring.toSemiring.{u2} k _inst_1) (AddCommGroup.toAddCommMonoid.{u3} V _inst_2) _inst_3 (Set.image.{u1, u3} P V (fun (_x : P) => VSub.vsub.{u3, u1} V P (AddTorsor.toVSub.{u3, u1} V P (AddCommGroup.toAddGroup.{u3} V _inst_2) _inst_4) _x (p i)) (Set.image.{u4, u1} ι P p (SDiff.sdiff.{u4} (Set.{u4} ι) (Set.instSDiffSet.{u4} ι) s (Singleton.singleton.{u4, u4} ι (Set.{u4} ι) (Set.instSingletonSet.{u4} ι) i)))))) Case conversion may be inaccurate. Consider using '#align vector_span_image_eq_span_vsub_set_right_ne vectorSpan_image_eq_span_vsub_set_right_neₓ'. -/ /-- The `vector_span` of the image of a function is the span of the pairwise subtractions with a given point on the right, excluding the subtraction of that point from itself. -/ theorem vectorSpan_image_eq_span_vsub_set_right_ne (p : ι → P) {s : Set ι} {i : ι} (hi : i ∈ s) : vectorSpan k (p '' s) = Submodule.span k ((· -ᵥ p i) '' (p '' (s \ {i}))) := by conv_lhs => rw [vectorSpan_eq_span_vsub_set_right k (Set.mem_image_of_mem p hi), ← Set.insert_eq_of_mem hi, ← Set.insert_diff_singleton, Set.image_insert_eq, Set.image_insert_eq] simp [Submodule.span_insert_eq_span] #align vector_span_image_eq_span_vsub_set_right_ne vectorSpan_image_eq_span_vsub_set_right_ne /- warning: vector_span_range_eq_span_range_vsub_left -> vectorSpan_range_eq_span_range_vsub_left is a dubious translation: lean 3 declaration is forall (k : Type.{u1}) {V : Type.{u2}} {P : Type.{u3}} [_inst_1 : Ring.{u1} k] [_inst_2 : AddCommGroup.{u2} V] [_inst_3 : Module.{u1, u2} k V (Ring.toSemiring.{u1} k _inst_1) (AddCommGroup.toAddCommMonoid.{u2} V _inst_2)] [_inst_4 : AddTorsor.{u2, u3} V P (AddCommGroup.toAddGroup.{u2} V _inst_2)] {ι : Type.{u4}} (p : ι -> P) (i0 : ι), Eq.{succ u2} (Submodule.{u1, u2} k V (Ring.toSemiring.{u1} k _inst_1) (AddCommGroup.toAddCommMonoid.{u2} V _inst_2) _inst_3) (vectorSpan.{u1, u2, u3} k V P _inst_1 _inst_2 _inst_3 _inst_4 (Set.range.{u3, succ u4} P ι p)) (Submodule.span.{u1, u2} k V (Ring.toSemiring.{u1} k _inst_1) (AddCommGroup.toAddCommMonoid.{u2} V _inst_2) _inst_3 (Set.range.{u2, succ u4} V ι (fun (i : ι) => VSub.vsub.{u2, u3} V P (AddTorsor.toHasVsub.{u2, u3} V P (AddCommGroup.toAddGroup.{u2} V _inst_2) _inst_4) (p i0) (p i)))) but is expected to have type forall (k : Type.{u3}) {V : Type.{u4}} {P : Type.{u2}} [_inst_1 : Ring.{u3} k] [_inst_2 : AddCommGroup.{u4} V] [_inst_3 : Module.{u3, u4} k V (Ring.toSemiring.{u3} k _inst_1) (AddCommGroup.toAddCommMonoid.{u4} V _inst_2)] [_inst_4 : AddTorsor.{u4, u2} V P (AddCommGroup.toAddGroup.{u4} V _inst_2)] {ι : Type.{u1}} (p : ι -> P) (i0 : ι), Eq.{succ u4} (Submodule.{u3, u4} k V (Ring.toSemiring.{u3} k _inst_1) (AddCommGroup.toAddCommMonoid.{u4} V _inst_2) _inst_3) (vectorSpan.{u3, u4, u2} k V P _inst_1 _inst_2 _inst_3 _inst_4 (Set.range.{u2, succ u1} P ι p)) (Submodule.span.{u3, u4} k V (Ring.toSemiring.{u3} k _inst_1) (AddCommGroup.toAddCommMonoid.{u4} V _inst_2) _inst_3 (Set.range.{u4, succ u1} V ι (fun (i : ι) => VSub.vsub.{u4, u2} V P (AddTorsor.toVSub.{u4, u2} V P (AddCommGroup.toAddGroup.{u4} V _inst_2) _inst_4) (p i0) (p i)))) Case conversion may be inaccurate. Consider using '#align vector_span_range_eq_span_range_vsub_left vectorSpan_range_eq_span_range_vsub_leftₓ'. -/ /-- The `vector_span` of an indexed family is the span of the pairwise subtractions with a given point on the left. -/ theorem vectorSpan_range_eq_span_range_vsub_left (p : ι → P) (i0 : ι) : vectorSpan k (Set.range p) = Submodule.span k (Set.range fun i : ι => p i0 -ᵥ p i) := by rw [vectorSpan_eq_span_vsub_set_left k (Set.mem_range_self i0), ← Set.range_comp] #align vector_span_range_eq_span_range_vsub_left vectorSpan_range_eq_span_range_vsub_left /- warning: vector_span_range_eq_span_range_vsub_right -> vectorSpan_range_eq_span_range_vsub_right is a dubious translation: lean 3 declaration is forall (k : Type.{u1}) {V : Type.{u2}} {P : Type.{u3}} [_inst_1 : Ring.{u1} k] [_inst_2 : AddCommGroup.{u2} V] [_inst_3 : Module.{u1, u2} k V (Ring.toSemiring.{u1} k _inst_1) (AddCommGroup.toAddCommMonoid.{u2} V _inst_2)] [_inst_4 : AddTorsor.{u2, u3} V P (AddCommGroup.toAddGroup.{u2} V _inst_2)] {ι : Type.{u4}} (p : ι -> P) (i0 : ι), Eq.{succ u2} (Submodule.{u1, u2} k V (Ring.toSemiring.{u1} k _inst_1) (AddCommGroup.toAddCommMonoid.{u2} V _inst_2) _inst_3) (vectorSpan.{u1, u2, u3} k V P _inst_1 _inst_2 _inst_3 _inst_4 (Set.range.{u3, succ u4} P ι p)) (Submodule.span.{u1, u2} k V (Ring.toSemiring.{u1} k _inst_1) (AddCommGroup.toAddCommMonoid.{u2} V _inst_2) _inst_3 (Set.range.{u2, succ u4} V ι (fun (i : ι) => VSub.vsub.{u2, u3} V P (AddTorsor.toHasVsub.{u2, u3} V P (AddCommGroup.toAddGroup.{u2} V _inst_2) _inst_4) (p i) (p i0)))) but is expected to have type forall (k : Type.{u3}) {V : Type.{u4}} {P : Type.{u2}} [_inst_1 : Ring.{u3} k] [_inst_2 : AddCommGroup.{u4} V] [_inst_3 : Module.{u3, u4} k V (Ring.toSemiring.{u3} k _inst_1) (AddCommGroup.toAddCommMonoid.{u4} V _inst_2)] [_inst_4 : AddTorsor.{u4, u2} V P (AddCommGroup.toAddGroup.{u4} V _inst_2)] {ι : Type.{u1}} (p : ι -> P) (i0 : ι), Eq.{succ u4} (Submodule.{u3, u4} k V (Ring.toSemiring.{u3} k _inst_1) (AddCommGroup.toAddCommMonoid.{u4} V _inst_2) _inst_3) (vectorSpan.{u3, u4, u2} k V P _inst_1 _inst_2 _inst_3 _inst_4 (Set.range.{u2, succ u1} P ι p)) (Submodule.span.{u3, u4} k V (Ring.toSemiring.{u3} k _inst_1) (AddCommGroup.toAddCommMonoid.{u4} V _inst_2) _inst_3 (Set.range.{u4, succ u1} V ι (fun (i : ι) => VSub.vsub.{u4, u2} V P (AddTorsor.toVSub.{u4, u2} V P (AddCommGroup.toAddGroup.{u4} V _inst_2) _inst_4) (p i) (p i0)))) Case conversion may be inaccurate. Consider using '#align vector_span_range_eq_span_range_vsub_right vectorSpan_range_eq_span_range_vsub_rightₓ'. -/ /-- The `vector_span` of an indexed family is the span of the pairwise subtractions with a given point on the right. -/ theorem vectorSpan_range_eq_span_range_vsub_right (p : ι → P) (i0 : ι) : vectorSpan k (Set.range p) = Submodule.span k (Set.range fun i : ι => p i -ᵥ p i0) := by rw [vectorSpan_eq_span_vsub_set_right k (Set.mem_range_self i0), ← Set.range_comp] #align vector_span_range_eq_span_range_vsub_right vectorSpan_range_eq_span_range_vsub_right /- warning: vector_span_range_eq_span_range_vsub_left_ne -> vectorSpan_range_eq_span_range_vsub_left_ne is a dubious translation: lean 3 declaration is forall (k : Type.{u1}) {V : Type.{u2}} {P : Type.{u3}} [_inst_1 : Ring.{u1} k] [_inst_2 : AddCommGroup.{u2} V] [_inst_3 : Module.{u1, u2} k V (Ring.toSemiring.{u1} k _inst_1) (AddCommGroup.toAddCommMonoid.{u2} V _inst_2)] [_inst_4 : AddTorsor.{u2, u3} V P (AddCommGroup.toAddGroup.{u2} V _inst_2)] {ι : Type.{u4}} (p : ι -> P) (i₀ : ι), Eq.{succ u2} (Submodule.{u1, u2} k V (Ring.toSemiring.{u1} k _inst_1) (AddCommGroup.toAddCommMonoid.{u2} V _inst_2) _inst_3) (vectorSpan.{u1, u2, u3} k V P _inst_1 _inst_2 _inst_3 _inst_4 (Set.range.{u3, succ u4} P ι p)) (Submodule.span.{u1, u2} k V (Ring.toSemiring.{u1} k _inst_1) (AddCommGroup.toAddCommMonoid.{u2} V _inst_2) _inst_3 (Set.range.{u2, succ u4} V (Subtype.{succ u4} ι (fun (x : ι) => Ne.{succ u4} ι x i₀)) (fun (i : Subtype.{succ u4} ι (fun (x : ι) => Ne.{succ u4} ι x i₀)) => VSub.vsub.{u2, u3} V P (AddTorsor.toHasVsub.{u2, u3} V P (AddCommGroup.toAddGroup.{u2} V _inst_2) _inst_4) (p i₀) (p ((fun (a : Type.{u4}) (b : Type.{u4}) [self : HasLiftT.{succ u4, succ u4} a b] => self.0) (Subtype.{succ u4} ι (fun (x : ι) => Ne.{succ u4} ι x i₀)) ι (HasLiftT.mk.{succ u4, succ u4} (Subtype.{succ u4} ι (fun (x : ι) => Ne.{succ u4} ι x i₀)) ι (CoeTCₓ.coe.{succ u4, succ u4} (Subtype.{succ u4} ι (fun (x : ι) => Ne.{succ u4} ι x i₀)) ι (coeBase.{succ u4, succ u4} (Subtype.{succ u4} ι (fun (x : ι) => Ne.{succ u4} ι x i₀)) ι (coeSubtype.{succ u4} ι (fun (x : ι) => Ne.{succ u4} ι x i₀))))) i))))) but is expected to have type forall (k : Type.{u3}) {V : Type.{u4}} {P : Type.{u2}} [_inst_1 : Ring.{u3} k] [_inst_2 : AddCommGroup.{u4} V] [_inst_3 : Module.{u3, u4} k V (Ring.toSemiring.{u3} k _inst_1) (AddCommGroup.toAddCommMonoid.{u4} V _inst_2)] [_inst_4 : AddTorsor.{u4, u2} V P (AddCommGroup.toAddGroup.{u4} V _inst_2)] {ι : Type.{u1}} (p : ι -> P) (i₀ : ι), Eq.{succ u4} (Submodule.{u3, u4} k V (Ring.toSemiring.{u3} k _inst_1) (AddCommGroup.toAddCommMonoid.{u4} V _inst_2) _inst_3) (vectorSpan.{u3, u4, u2} k V P _inst_1 _inst_2 _inst_3 _inst_4 (Set.range.{u2, succ u1} P ι p)) (Submodule.span.{u3, u4} k V (Ring.toSemiring.{u3} k _inst_1) (AddCommGroup.toAddCommMonoid.{u4} V _inst_2) _inst_3 (Set.range.{u4, succ u1} V (Subtype.{succ u1} ι (fun (x : ι) => Ne.{succ u1} ι x i₀)) (fun (i : Subtype.{succ u1} ι (fun (x : ι) => Ne.{succ u1} ι x i₀)) => VSub.vsub.{u4, u2} V P (AddTorsor.toVSub.{u4, u2} V P (AddCommGroup.toAddGroup.{u4} V _inst_2) _inst_4) (p i₀) (p (Subtype.val.{succ u1} ι (fun (x : ι) => Ne.{succ u1} ι x i₀) i))))) Case conversion may be inaccurate. Consider using '#align vector_span_range_eq_span_range_vsub_left_ne vectorSpan_range_eq_span_range_vsub_left_neₓ'. -/ /-- The `vector_span` of an indexed family is the span of the pairwise subtractions with a given point on the left, excluding the subtraction of that point from itself. -/ theorem vectorSpan_range_eq_span_range_vsub_left_ne (p : ι → P) (i₀ : ι) : vectorSpan k (Set.range p) = Submodule.span k (Set.range fun i : { x // x ≠ i₀ } => p i₀ -ᵥ p i) := by rw [← Set.image_univ, vectorSpan_image_eq_span_vsub_set_left_ne k _ (Set.mem_univ i₀)] congr with v simp only [Set.mem_range, Set.mem_image, Set.mem_diff, Set.mem_singleton_iff, Subtype.exists, Subtype.coe_mk] constructor · rintro ⟨x, ⟨i₁, ⟨⟨hi₁u, hi₁⟩, rfl⟩⟩, hv⟩ exact ⟨i₁, hi₁, hv⟩ · exact fun ⟨i₁, hi₁, hv⟩ => ⟨p i₁, ⟨i₁, ⟨Set.mem_univ _, hi₁⟩, rfl⟩, hv⟩ #align vector_span_range_eq_span_range_vsub_left_ne vectorSpan_range_eq_span_range_vsub_left_ne /- warning: vector_span_range_eq_span_range_vsub_right_ne -> vectorSpan_range_eq_span_range_vsub_right_ne is a dubious translation: lean 3 declaration is forall (k : Type.{u1}) {V : Type.{u2}} {P : Type.{u3}} [_inst_1 : Ring.{u1} k] [_inst_2 : AddCommGroup.{u2} V] [_inst_3 : Module.{u1, u2} k V (Ring.toSemiring.{u1} k _inst_1) (AddCommGroup.toAddCommMonoid.{u2} V _inst_2)] [_inst_4 : AddTorsor.{u2, u3} V P (AddCommGroup.toAddGroup.{u2} V _inst_2)] {ι : Type.{u4}} (p : ι -> P) (i₀ : ι), Eq.{succ u2} (Submodule.{u1, u2} k V (Ring.toSemiring.{u1} k _inst_1) (AddCommGroup.toAddCommMonoid.{u2} V _inst_2) _inst_3) (vectorSpan.{u1, u2, u3} k V P _inst_1 _inst_2 _inst_3 _inst_4 (Set.range.{u3, succ u4} P ι p)) (Submodule.span.{u1, u2} k V (Ring.toSemiring.{u1} k _inst_1) (AddCommGroup.toAddCommMonoid.{u2} V _inst_2) _inst_3 (Set.range.{u2, succ u4} V (Subtype.{succ u4} ι (fun (x : ι) => Ne.{succ u4} ι x i₀)) (fun (i : Subtype.{succ u4} ι (fun (x : ι) => Ne.{succ u4} ι x i₀)) => VSub.vsub.{u2, u3} V P (AddTorsor.toHasVsub.{u2, u3} V P (AddCommGroup.toAddGroup.{u2} V _inst_2) _inst_4) (p ((fun (a : Type.{u4}) (b : Type.{u4}) [self : HasLiftT.{succ u4, succ u4} a b] => self.0) (Subtype.{succ u4} ι (fun (x : ι) => Ne.{succ u4} ι x i₀)) ι (HasLiftT.mk.{succ u4, succ u4} (Subtype.{succ u4} ι (fun (x : ι) => Ne.{succ u4} ι x i₀)) ι (CoeTCₓ.coe.{succ u4, succ u4} (Subtype.{succ u4} ι (fun (x : ι) => Ne.{succ u4} ι x i₀)) ι (coeBase.{succ u4, succ u4} (Subtype.{succ u4} ι (fun (x : ι) => Ne.{succ u4} ι x i₀)) ι (coeSubtype.{succ u4} ι (fun (x : ι) => Ne.{succ u4} ι x i₀))))) i)) (p i₀)))) but is expected to have type forall (k : Type.{u3}) {V : Type.{u4}} {P : Type.{u2}} [_inst_1 : Ring.{u3} k] [_inst_2 : AddCommGroup.{u4} V] [_inst_3 : Module.{u3, u4} k V (Ring.toSemiring.{u3} k _inst_1) (AddCommGroup.toAddCommMonoid.{u4} V _inst_2)] [_inst_4 : AddTorsor.{u4, u2} V P (AddCommGroup.toAddGroup.{u4} V _inst_2)] {ι : Type.{u1}} (p : ι -> P) (i₀ : ι), Eq.{succ u4} (Submodule.{u3, u4} k V (Ring.toSemiring.{u3} k _inst_1) (AddCommGroup.toAddCommMonoid.{u4} V _inst_2) _inst_3) (vectorSpan.{u3, u4, u2} k V P _inst_1 _inst_2 _inst_3 _inst_4 (Set.range.{u2, succ u1} P ι p)) (Submodule.span.{u3, u4} k V (Ring.toSemiring.{u3} k _inst_1) (AddCommGroup.toAddCommMonoid.{u4} V _inst_2) _inst_3 (Set.range.{u4, succ u1} V (Subtype.{succ u1} ι (fun (x : ι) => Ne.{succ u1} ι x i₀)) (fun (i : Subtype.{succ u1} ι (fun (x : ι) => Ne.{succ u1} ι x i₀)) => VSub.vsub.{u4, u2} V P (AddTorsor.toVSub.{u4, u2} V P (AddCommGroup.toAddGroup.{u4} V _inst_2) _inst_4) (p (Subtype.val.{succ u1} ι (fun (x : ι) => Ne.{succ u1} ι x i₀) i)) (p i₀)))) Case conversion may be inaccurate. Consider using '#align vector_span_range_eq_span_range_vsub_right_ne vectorSpan_range_eq_span_range_vsub_right_neₓ'. -/ /-- The `vector_span` of an indexed family is the span of the pairwise subtractions with a given point on the right, excluding the subtraction of that point from itself. -/ theorem vectorSpan_range_eq_span_range_vsub_right_ne (p : ι → P) (i₀ : ι) : vectorSpan k (Set.range p) = Submodule.span k (Set.range fun i : { x // x ≠ i₀ } => p i -ᵥ p i₀) := by rw [← Set.image_univ, vectorSpan_image_eq_span_vsub_set_right_ne k _ (Set.mem_univ i₀)] congr with v simp only [Set.mem_range, Set.mem_image, Set.mem_diff, Set.mem_singleton_iff, Subtype.exists, Subtype.coe_mk] constructor · rintro ⟨x, ⟨i₁, ⟨⟨hi₁u, hi₁⟩, rfl⟩⟩, hv⟩ exact ⟨i₁, hi₁, hv⟩ · exact fun ⟨i₁, hi₁, hv⟩ => ⟨p i₁, ⟨i₁, ⟨Set.mem_univ _, hi₁⟩, rfl⟩, hv⟩ #align vector_span_range_eq_span_range_vsub_right_ne vectorSpan_range_eq_span_range_vsub_right_ne section variable {s : Set P} /- warning: affine_span_nonempty -> affineSpan_nonempty is a dubious translation: lean 3 declaration is forall (k : Type.{u1}) {V : Type.{u2}} {P : Type.{u3}} [_inst_1 : Ring.{u1} k] [_inst_2 : AddCommGroup.{u2} V] [_inst_3 : Module.{u1, u2} k V (Ring.toSemiring.{u1} k _inst_1) (AddCommGroup.toAddCommMonoid.{u2} V _inst_2)] [_inst_4 : AddTorsor.{u2, u3} V P (AddCommGroup.toAddGroup.{u2} V _inst_2)] {s : Set.{u3} P}, Iff (Set.Nonempty.{u3} P ((fun (a : Type.{u3}) (b : Type.{u3}) [self : HasLiftT.{succ u3, succ u3} a b] => self.0) (AffineSubspace.{u1, u2, u3} k V P _inst_1 _inst_2 _inst_3 _inst_4) (Set.{u3} P) (HasLiftT.mk.{succ u3, succ u3} (AffineSubspace.{u1, u2, u3} k V P _inst_1 _inst_2 _inst_3 _inst_4) (Set.{u3} P) (CoeTCₓ.coe.{succ u3, succ u3} (AffineSubspace.{u1, u2, u3} k V P _inst_1 _inst_2 _inst_3 _inst_4) (Set.{u3} P) (SetLike.Set.hasCoeT.{u3, u3} (AffineSubspace.{u1, u2, u3} k V P _inst_1 _inst_2 _inst_3 _inst_4) P (AffineSubspace.setLike.{u1, u2, u3} k V P _inst_1 _inst_2 _inst_3 _inst_4)))) (affineSpan.{u1, u2, u3} k V P _inst_1 _inst_2 _inst_3 _inst_4 s))) (Set.Nonempty.{u3} P s) but is expected to have type forall (k : Type.{u2}) {V : Type.{u1}} {P : Type.{u3}} [_inst_1 : Ring.{u2} k] [_inst_2 : AddCommGroup.{u1} V] [_inst_3 : Module.{u2, u1} k V (Ring.toSemiring.{u2} k _inst_1) (AddCommGroup.toAddCommMonoid.{u1} V _inst_2)] [_inst_4 : AddTorsor.{u1, u3} V P (AddCommGroup.toAddGroup.{u1} V _inst_2)] {s : Set.{u3} P}, Iff (Set.Nonempty.{u3} P (SetLike.coe.{u3, u3} (AffineSubspace.{u2, u1, u3} k V P _inst_1 _inst_2 _inst_3 _inst_4) P (AffineSubspace.instSetLikeAffineSubspace.{u2, u1, u3} k V P _inst_1 _inst_2 _inst_3 _inst_4) (affineSpan.{u2, u1, u3} k V P _inst_1 _inst_2 _inst_3 _inst_4 s))) (Set.Nonempty.{u3} P s) Case conversion may be inaccurate. Consider using '#align affine_span_nonempty affineSpan_nonemptyₓ'. -/ /-- The affine span of a set is nonempty if and only if that set is. -/ theorem affineSpan_nonempty : (affineSpan k s : Set P).Nonempty ↔ s.Nonempty := spanPoints_nonempty k s #align affine_span_nonempty affineSpan_nonempty /- warning: set.nonempty.affine_span -> Set.Nonempty.affineSpan is a dubious translation: lean 3 declaration is forall (k : Type.{u1}) {V : Type.{u2}} {P : Type.{u3}} [_inst_1 : Ring.{u1} k] [_inst_2 : AddCommGroup.{u2} V] [_inst_3 : Module.{u1, u2} k V (Ring.toSemiring.{u1} k _inst_1) (AddCommGroup.toAddCommMonoid.{u2} V _inst_2)] [_inst_4 : AddTorsor.{u2, u3} V P (AddCommGroup.toAddGroup.{u2} V _inst_2)] {s : Set.{u3} P}, (Set.Nonempty.{u3} P s) -> (Set.Nonempty.{u3} P ((fun (a : Type.{u3}) (b : Type.{u3}) [self : HasLiftT.{succ u3, succ u3} a b] => self.0) (AffineSubspace.{u1, u2, u3} k V P _inst_1 _inst_2 _inst_3 _inst_4) (Set.{u3} P) (HasLiftT.mk.{succ u3, succ u3} (AffineSubspace.{u1, u2, u3} k V P _inst_1 _inst_2 _inst_3 _inst_4) (Set.{u3} P) (CoeTCₓ.coe.{succ u3, succ u3} (AffineSubspace.{u1, u2, u3} k V P _inst_1 _inst_2 _inst_3 _inst_4) (Set.{u3} P) (SetLike.Set.hasCoeT.{u3, u3} (AffineSubspace.{u1, u2, u3} k V P _inst_1 _inst_2 _inst_3 _inst_4) P (AffineSubspace.setLike.{u1, u2, u3} k V P _inst_1 _inst_2 _inst_3 _inst_4)))) (affineSpan.{u1, u2, u3} k V P _inst_1 _inst_2 _inst_3 _inst_4 s))) but is expected to have type forall (k : Type.{u2}) {V : Type.{u1}} {P : Type.{u3}} [_inst_1 : Ring.{u2} k] [_inst_2 : AddCommGroup.{u1} V] [_inst_3 : Module.{u2, u1} k V (Ring.toSemiring.{u2} k _inst_1) (AddCommGroup.toAddCommMonoid.{u1} V _inst_2)] [_inst_4 : AddTorsor.{u1, u3} V P (AddCommGroup.toAddGroup.{u1} V _inst_2)] {s : Set.{u3} P}, (Set.Nonempty.{u3} P s) -> (Set.Nonempty.{u3} P (SetLike.coe.{u3, u3} (AffineSubspace.{u2, u1, u3} k V P _inst_1 _inst_2 _inst_3 _inst_4) P (AffineSubspace.instSetLikeAffineSubspace.{u2, u1, u3} k V P _inst_1 _inst_2 _inst_3 _inst_4) (affineSpan.{u2, u1, u3} k V P _inst_1 _inst_2 _inst_3 _inst_4 s))) Case conversion may be inaccurate. Consider using '#align set.nonempty.affine_span Set.Nonempty.affineSpanₓ'. -/ alias affineSpan_nonempty ↔ _ _root_.set.nonempty.affine_span #align set.nonempty.affine_span Set.Nonempty.affineSpan /-- The affine span of a nonempty set is nonempty. -/ instance [Nonempty s] : Nonempty (affineSpan k s) := ((nonempty_coe_sort.1 ‹_›).affineSpan _).to_subtype /- warning: affine_span_eq_bot -> affineSpan_eq_bot is a dubious translation: lean 3 declaration is forall (k : Type.{u1}) {V : Type.{u2}} {P : Type.{u3}} [_inst_1 : Ring.{u1} k] [_inst_2 : AddCommGroup.{u2} V] [_inst_3 : Module.{u1, u2} k V (Ring.toSemiring.{u1} k _inst_1) (AddCommGroup.toAddCommMonoid.{u2} V _inst_2)] [_inst_4 : AddTorsor.{u2, u3} V P (AddCommGroup.toAddGroup.{u2} V _inst_2)] {s : Set.{u3} P}, Iff (Eq.{succ u3} (AffineSubspace.{u1, u2, u3} k V P _inst_1 _inst_2 _inst_3 _inst_4) (affineSpan.{u1, u2, u3} k V P _inst_1 _inst_2 _inst_3 _inst_4 s) (Bot.bot.{u3} (AffineSubspace.{u1, u2, u3} k V P _inst_1 _inst_2 _inst_3 _inst_4) (CompleteLattice.toHasBot.{u3} (AffineSubspace.{u1, u2, u3} k V P _inst_1 _inst_2 _inst_3 _inst_4) (AffineSubspace.completeLattice.{u1, u2, u3} k V P _inst_1 _inst_2 _inst_3 _inst_4)))) (Eq.{succ u3} (Set.{u3} P) s (EmptyCollection.emptyCollection.{u3} (Set.{u3} P) (Set.hasEmptyc.{u3} P))) but is expected to have type forall (k : Type.{u2}) {V : Type.{u1}} {P : Type.{u3}} [_inst_1 : Ring.{u2} k] [_inst_2 : AddCommGroup.{u1} V] [_inst_3 : Module.{u2, u1} k V (Ring.toSemiring.{u2} k _inst_1) (AddCommGroup.toAddCommMonoid.{u1} V _inst_2)] [_inst_4 : AddTorsor.{u1, u3} V P (AddCommGroup.toAddGroup.{u1} V _inst_2)] {s : Set.{u3} P}, Iff (Eq.{succ u3} (AffineSubspace.{u2, u1, u3} k V P _inst_1 _inst_2 _inst_3 _inst_4) (affineSpan.{u2, u1, u3} k V P _inst_1 _inst_2 _inst_3 _inst_4 s) (Bot.bot.{u3} (AffineSubspace.{u2, u1, u3} k V P _inst_1 _inst_2 _inst_3 _inst_4) (CompleteLattice.toBot.{u3} (AffineSubspace.{u2, u1, u3} k V P _inst_1 _inst_2 _inst_3 _inst_4) (AffineSubspace.instCompleteLatticeAffineSubspace.{u2, u1, u3} k V P _inst_1 _inst_2 _inst_3 _inst_4)))) (Eq.{succ u3} (Set.{u3} P) s (EmptyCollection.emptyCollection.{u3} (Set.{u3} P) (Set.instEmptyCollectionSet.{u3} P))) Case conversion may be inaccurate. Consider using '#align affine_span_eq_bot affineSpan_eq_botₓ'. -/ /-- The affine span of a set is `⊥` if and only if that set is empty. -/ @[simp] theorem affineSpan_eq_bot : affineSpan k s = ⊥ ↔ s = ∅ := by rw [← not_iff_not, ← Ne.def, ← Ne.def, ← nonempty_iff_ne_bot, affineSpan_nonempty, nonempty_iff_ne_empty] #align affine_span_eq_bot affineSpan_eq_bot /- warning: bot_lt_affine_span -> bot_lt_affineSpan is a dubious translation: lean 3 declaration is forall (k : Type.{u1}) {V : Type.{u2}} {P : Type.{u3}} [_inst_1 : Ring.{u1} k] [_inst_2 : AddCommGroup.{u2} V] [_inst_3 : Module.{u1, u2} k V (Ring.toSemiring.{u1} k _inst_1) (AddCommGroup.toAddCommMonoid.{u2} V _inst_2)] [_inst_4 : AddTorsor.{u2, u3} V P (AddCommGroup.toAddGroup.{u2} V _inst_2)] {s : Set.{u3} P}, Iff (LT.lt.{u3} (AffineSubspace.{u1, u2, u3} k V P _inst_1 _inst_2 _inst_3 _inst_4) (Preorder.toLT.{u3} (AffineSubspace.{u1, u2, u3} k V P _inst_1 _inst_2 _inst_3 _inst_4) (PartialOrder.toPreorder.{u3} (AffineSubspace.{u1, u2, u3} k V P _inst_1 _inst_2 _inst_3 _inst_4) (SetLike.partialOrder.{u3, u3} (AffineSubspace.{u1, u2, u3} k V P _inst_1 _inst_2 _inst_3 _inst_4) P (AffineSubspace.setLike.{u1, u2, u3} k V P _inst_1 _inst_2 _inst_3 _inst_4)))) (Bot.bot.{u3} (AffineSubspace.{u1, u2, u3} k V P _inst_1 _inst_2 _inst_3 _inst_4) (CompleteLattice.toHasBot.{u3} (AffineSubspace.{u1, u2, u3} k V P _inst_1 _inst_2 _inst_3 _inst_4) (AffineSubspace.completeLattice.{u1, u2, u3} k V P _inst_1 _inst_2 _inst_3 _inst_4))) (affineSpan.{u1, u2, u3} k V P _inst_1 _inst_2 _inst_3 _inst_4 s)) (Set.Nonempty.{u3} P s) but is expected to have type forall (k : Type.{u2}) {V : Type.{u1}} {P : Type.{u3}} [_inst_1 : Ring.{u2} k] [_inst_2 : AddCommGroup.{u1} V] [_inst_3 : Module.{u2, u1} k V (Ring.toSemiring.{u2} k _inst_1) (AddCommGroup.toAddCommMonoid.{u1} V _inst_2)] [_inst_4 : AddTorsor.{u1, u3} V P (AddCommGroup.toAddGroup.{u1} V _inst_2)] {s : Set.{u3} P}, Iff (LT.lt.{u3} (AffineSubspace.{u2, u1, u3} k V P _inst_1 _inst_2 _inst_3 _inst_4) (Preorder.toLT.{u3} (AffineSubspace.{u2, u1, u3} k V P _inst_1 _inst_2 _inst_3 _inst_4) (PartialOrder.toPreorder.{u3} (AffineSubspace.{u2, u1, u3} k V P _inst_1 _inst_2 _inst_3 _inst_4) (OmegaCompletePartialOrder.toPartialOrder.{u3} (AffineSubspace.{u2, u1, u3} k V P _inst_1 _inst_2 _inst_3 _inst_4) (CompleteLattice.instOmegaCompletePartialOrder.{u3} (AffineSubspace.{u2, u1, u3} k V P _inst_1 _inst_2 _inst_3 _inst_4) (AffineSubspace.instCompleteLatticeAffineSubspace.{u2, u1, u3} k V P _inst_1 _inst_2 _inst_3 _inst_4))))) (Bot.bot.{u3} (AffineSubspace.{u2, u1, u3} k V P _inst_1 _inst_2 _inst_3 _inst_4) (CompleteLattice.toBot.{u3} (AffineSubspace.{u2, u1, u3} k V P _inst_1 _inst_2 _inst_3 _inst_4) (AffineSubspace.instCompleteLatticeAffineSubspace.{u2, u1, u3} k V P _inst_1 _inst_2 _inst_3 _inst_4))) (affineSpan.{u2, u1, u3} k V P _inst_1 _inst_2 _inst_3 _inst_4 s)) (Set.Nonempty.{u3} P s) Case conversion may be inaccurate. Consider using '#align bot_lt_affine_span bot_lt_affineSpanₓ'. -/ @[simp] theorem bot_lt_affineSpan : ⊥ < affineSpan k s ↔ s.Nonempty := by rw [bot_lt_iff_ne_bot, nonempty_iff_ne_empty] exact (affineSpan_eq_bot _).Not #align bot_lt_affine_span bot_lt_affineSpan end variable {k} /- warning: affine_span_induction -> affineSpan_induction is a dubious translation: lean 3 declaration is forall {k : Type.{u1}} {V : Type.{u2}} {P : Type.{u3}} [_inst_1 : Ring.{u1} k] [_inst_2 : AddCommGroup.{u2} V] [_inst_3 : Module.{u1, u2} k V (Ring.toSemiring.{u1} k _inst_1) (AddCommGroup.toAddCommMonoid.{u2} V _inst_2)] [_inst_4 : AddTorsor.{u2, u3} V P (AddCommGroup.toAddGroup.{u2} V _inst_2)] {x : P} {s : Set.{u3} P} {p : P -> Prop}, (Membership.Mem.{u3, u3} P (AffineSubspace.{u1, u2, u3} k V P _inst_1 _inst_2 _inst_3 _inst_4) (SetLike.hasMem.{u3, u3} (AffineSubspace.{u1, u2, u3} k V P _inst_1 _inst_2 _inst_3 _inst_4) P (AffineSubspace.setLike.{u1, u2, u3} k V P _inst_1 _inst_2 _inst_3 _inst_4)) x (affineSpan.{u1, u2, u3} k V P _inst_1 _inst_2 _inst_3 _inst_4 s)) -> (forall (x : P), (Membership.Mem.{u3, u3} P (Set.{u3} P) (Set.hasMem.{u3} P) x s) -> (p x)) -> (forall (c : k) (u : P) (v : P) (w : P), (p u) -> (p v) -> (p w) -> (p (VAdd.vadd.{u2, u3} V P (AddAction.toHasVadd.{u2, u3} V P (SubNegMonoid.toAddMonoid.{u2} V (AddGroup.toSubNegMonoid.{u2} V (AddCommGroup.toAddGroup.{u2} V _inst_2))) (AddTorsor.toAddAction.{u2, u3} V P (AddCommGroup.toAddGroup.{u2} V _inst_2) _inst_4)) (SMul.smul.{u1, u2} k V (SMulZeroClass.toHasSmul.{u1, u2} k V (AddZeroClass.toHasZero.{u2} V (AddMonoid.toAddZeroClass.{u2} V (AddCommMonoid.toAddMonoid.{u2} V (AddCommGroup.toAddCommMonoid.{u2} V _inst_2)))) (SMulWithZero.toSmulZeroClass.{u1, u2} k V (MulZeroClass.toHasZero.{u1} k (MulZeroOneClass.toMulZeroClass.{u1} k (MonoidWithZero.toMulZeroOneClass.{u1} k (Semiring.toMonoidWithZero.{u1} k (Ring.toSemiring.{u1} k _inst_1))))) (AddZeroClass.toHasZero.{u2} V (AddMonoid.toAddZeroClass.{u2} V (AddCommMonoid.toAddMonoid.{u2} V (AddCommGroup.toAddCommMonoid.{u2} V _inst_2)))) (MulActionWithZero.toSMulWithZero.{u1, u2} k V (Semiring.toMonoidWithZero.{u1} k (Ring.toSemiring.{u1} k _inst_1)) (AddZeroClass.toHasZero.{u2} V (AddMonoid.toAddZeroClass.{u2} V (AddCommMonoid.toAddMonoid.{u2} V (AddCommGroup.toAddCommMonoid.{u2} V _inst_2)))) (Module.toMulActionWithZero.{u1, u2} k V (Ring.toSemiring.{u1} k _inst_1) (AddCommGroup.toAddCommMonoid.{u2} V _inst_2) _inst_3)))) c (VSub.vsub.{u2, u3} V P (AddTorsor.toHasVsub.{u2, u3} V P (AddCommGroup.toAddGroup.{u2} V _inst_2) _inst_4) u v)) w))) -> (p x) but is expected to have type forall {k : Type.{u2}} {V : Type.{u1}} {P : Type.{u3}} [_inst_1 : Ring.{u2} k] [_inst_2 : AddCommGroup.{u1} V] [_inst_3 : Module.{u2, u1} k V (Ring.toSemiring.{u2} k _inst_1) (AddCommGroup.toAddCommMonoid.{u1} V _inst_2)] [_inst_4 : AddTorsor.{u1, u3} V P (AddCommGroup.toAddGroup.{u1} V _inst_2)] {x : P} {s : Set.{u3} P} {p : P -> Prop}, (Membership.mem.{u3, u3} P (AffineSubspace.{u2, u1, u3} k V P _inst_1 _inst_2 _inst_3 _inst_4) (SetLike.instMembership.{u3, u3} (AffineSubspace.{u2, u1, u3} k V P _inst_1 _inst_2 _inst_3 _inst_4) P (AffineSubspace.instSetLikeAffineSubspace.{u2, u1, u3} k V P _inst_1 _inst_2 _inst_3 _inst_4)) x (affineSpan.{u2, u1, u3} k V P _inst_1 _inst_2 _inst_3 _inst_4 s)) -> (forall (x : P), (Membership.mem.{u3, u3} P (Set.{u3} P) (Set.instMembershipSet.{u3} P) x s) -> (p x)) -> (forall (c : k) (u : P) (v : P) (w : P), (p u) -> (p v) -> (p w) -> (p (HVAdd.hVAdd.{u1, u3, u3} V P P (instHVAdd.{u1, u3} V P (AddAction.toVAdd.{u1, u3} V P (SubNegMonoid.toAddMonoid.{u1} V (AddGroup.toSubNegMonoid.{u1} V (AddCommGroup.toAddGroup.{u1} V _inst_2))) (AddTorsor.toAddAction.{u1, u3} V P (AddCommGroup.toAddGroup.{u1} V _inst_2) _inst_4))) (HSMul.hSMul.{u2, u1, u1} k V V (instHSMul.{u2, u1} k V (SMulZeroClass.toSMul.{u2, u1} k V (NegZeroClass.toZero.{u1} V (SubNegZeroMonoid.toNegZeroClass.{u1} V (SubtractionMonoid.toSubNegZeroMonoid.{u1} V (SubtractionCommMonoid.toSubtractionMonoid.{u1} V (AddCommGroup.toDivisionAddCommMonoid.{u1} V _inst_2))))) (SMulWithZero.toSMulZeroClass.{u2, u1} k V (MonoidWithZero.toZero.{u2} k (Semiring.toMonoidWithZero.{u2} k (Ring.toSemiring.{u2} k _inst_1))) (NegZeroClass.toZero.{u1} V (SubNegZeroMonoid.toNegZeroClass.{u1} V (SubtractionMonoid.toSubNegZeroMonoid.{u1} V (SubtractionCommMonoid.toSubtractionMonoid.{u1} V (AddCommGroup.toDivisionAddCommMonoid.{u1} V _inst_2))))) (MulActionWithZero.toSMulWithZero.{u2, u1} k V (Semiring.toMonoidWithZero.{u2} k (Ring.toSemiring.{u2} k _inst_1)) (NegZeroClass.toZero.{u1} V (SubNegZeroMonoid.toNegZeroClass.{u1} V (SubtractionMonoid.toSubNegZeroMonoid.{u1} V (SubtractionCommMonoid.toSubtractionMonoid.{u1} V (AddCommGroup.toDivisionAddCommMonoid.{u1} V _inst_2))))) (Module.toMulActionWithZero.{u2, u1} k V (Ring.toSemiring.{u2} k _inst_1) (AddCommGroup.toAddCommMonoid.{u1} V _inst_2) _inst_3))))) c (VSub.vsub.{u1, u3} V P (AddTorsor.toVSub.{u1, u3} V P (AddCommGroup.toAddGroup.{u1} V _inst_2) _inst_4) u v)) w))) -> (p x) Case conversion may be inaccurate. Consider using '#align affine_span_induction affineSpan_inductionₓ'. -/ /-- An induction principle for span membership. If `p` holds for all elements of `s` and is preserved under certain affine combinations, then `p` holds for all elements of the span of `s`. -/ theorem affineSpan_induction {x : P} {s : Set P} {p : P → Prop} (h : x ∈ affineSpan k s) (Hs : ∀ x : P, x ∈ s → p x) (Hc : ∀ (c : k) (u v w : P), p u → p v → p w → p (c • (u -ᵥ v) +ᵥ w)) : p x := (@affineSpan_le _ _ _ _ _ _ _ _ ⟨p, Hc⟩).mpr Hs h #align affine_span_induction affineSpan_induction /- warning: affine_span_induction' -> affineSpan_induction' is a dubious translation: lean 3 declaration is forall {k : Type.{u1}} {V : Type.{u2}} {P : Type.{u3}} [_inst_1 : Ring.{u1} k] [_inst_2 : AddCommGroup.{u2} V] [_inst_3 : Module.{u1, u2} k V (Ring.toSemiring.{u1} k _inst_1) (AddCommGroup.toAddCommMonoid.{u2} V _inst_2)] [_inst_4 : AddTorsor.{u2, u3} V P (AddCommGroup.toAddGroup.{u2} V _inst_2)] {s : Set.{u3} P} {p : forall (x : P), (Membership.Mem.{u3, u3} P (AffineSubspace.{u1, u2, u3} k V P _inst_1 _inst_2 _inst_3 _inst_4) (SetLike.hasMem.{u3, u3} (AffineSubspace.{u1, u2, u3} k V P _inst_1 _inst_2 _inst_3 _inst_4) P (AffineSubspace.setLike.{u1, u2, u3} k V P _inst_1 _inst_2 _inst_3 _inst_4)) x (affineSpan.{u1, u2, u3} k V P _inst_1 _inst_2 _inst_3 _inst_4 s)) -> Prop}, (forall (y : P) (hys : Membership.Mem.{u3, u3} P (Set.{u3} P) (Set.hasMem.{u3} P) y s), p y (subset_affineSpan.{u1, u2, u3} k V P _inst_1 _inst_2 _inst_3 _inst_4 s y hys)) -> (forall (c : k) (u : P) (hu : Membership.Mem.{u3, u3} P (AffineSubspace.{u1, u2, u3} k V P _inst_1 _inst_2 _inst_3 _inst_4) (SetLike.hasMem.{u3, u3} (AffineSubspace.{u1, u2, u3} k V P _inst_1 _inst_2 _inst_3 _inst_4) P (AffineSubspace.setLike.{u1, u2, u3} k V P _inst_1 _inst_2 _inst_3 _inst_4)) u (affineSpan.{u1, u2, u3} k V P _inst_1 _inst_2 _inst_3 _inst_4 s)) (v : P) (hv : Membership.Mem.{u3, u3} P (AffineSubspace.{u1, u2, u3} k V P _inst_1 _inst_2 _inst_3 _inst_4) (SetLike.hasMem.{u3, u3} (AffineSubspace.{u1, u2, u3} k V P _inst_1 _inst_2 _inst_3 _inst_4) P (AffineSubspace.setLike.{u1, u2, u3} k V P _inst_1 _inst_2 _inst_3 _inst_4)) v (affineSpan.{u1, u2, u3} k V P _inst_1 _inst_2 _inst_3 _inst_4 s)) (w : P) (hw : Membership.Mem.{u3, u3} P (AffineSubspace.{u1, u2, u3} k V P _inst_1 _inst_2 _inst_3 _inst_4) (SetLike.hasMem.{u3, u3} (AffineSubspace.{u1, u2, u3} k V P _inst_1 _inst_2 _inst_3 _inst_4) P (AffineSubspace.setLike.{u1, u2, u3} k V P _inst_1 _inst_2 _inst_3 _inst_4)) w (affineSpan.{u1, u2, u3} k V P _inst_1 _inst_2 _inst_3 _inst_4 s)), (p u hu) -> (p v hv) -> (p w hw) -> (p (VAdd.vadd.{u2, u3} V P (AddAction.toHasVadd.{u2, u3} V P (SubNegMonoid.toAddMonoid.{u2} V (AddGroup.toSubNegMonoid.{u2} V (AddCommGroup.toAddGroup.{u2} V _inst_2))) (AddTorsor.toAddAction.{u2, u3} V P (AddCommGroup.toAddGroup.{u2} V _inst_2) _inst_4)) (SMul.smul.{u1, u2} k V (SMulZeroClass.toHasSmul.{u1, u2} k V (AddZeroClass.toHasZero.{u2} V (AddMonoid.toAddZeroClass.{u2} V (AddCommMonoid.toAddMonoid.{u2} V (AddCommGroup.toAddCommMonoid.{u2} V _inst_2)))) (SMulWithZero.toSmulZeroClass.{u1, u2} k V (MulZeroClass.toHasZero.{u1} k (MulZeroOneClass.toMulZeroClass.{u1} k (MonoidWithZero.toMulZeroOneClass.{u1} k (Semiring.toMonoidWithZero.{u1} k (Ring.toSemiring.{u1} k _inst_1))))) (AddZeroClass.toHasZero.{u2} V (AddMonoid.toAddZeroClass.{u2} V (AddCommMonoid.toAddMonoid.{u2} V (AddCommGroup.toAddCommMonoid.{u2} V _inst_2)))) (MulActionWithZero.toSMulWithZero.{u1, u2} k V (Semiring.toMonoidWithZero.{u1} k (Ring.toSemiring.{u1} k _inst_1)) (AddZeroClass.toHasZero.{u2} V (AddMonoid.toAddZeroClass.{u2} V (AddCommMonoid.toAddMonoid.{u2} V (AddCommGroup.toAddCommMonoid.{u2} V _inst_2)))) (Module.toMulActionWithZero.{u1, u2} k V (Ring.toSemiring.{u1} k _inst_1) (AddCommGroup.toAddCommMonoid.{u2} V _inst_2) _inst_3)))) c (VSub.vsub.{u2, u3} V P (AddTorsor.toHasVsub.{u2, u3} V P (AddCommGroup.toAddGroup.{u2} V _inst_2) _inst_4) u v)) w) (AffineSubspace.smul_vsub_vadd_mem.{u1, u2, u3} k V P _inst_1 _inst_2 _inst_3 _inst_4 (affineSpan.{u1, u2, u3} k V P _inst_1 _inst_2 _inst_3 _inst_4 s) c u v w hu hv hw))) -> (forall {x : P} (h : Membership.Mem.{u3, u3} P (AffineSubspace.{u1, u2, u3} k V P _inst_1 _inst_2 _inst_3 _inst_4) (SetLike.hasMem.{u3, u3} (AffineSubspace.{u1, u2, u3} k V P _inst_1 _inst_2 _inst_3 _inst_4) P (AffineSubspace.setLike.{u1, u2, u3} k V P _inst_1 _inst_2 _inst_3 _inst_4)) x (affineSpan.{u1, u2, u3} k V P _inst_1 _inst_2 _inst_3 _inst_4 s)), p x h) but is expected to have type forall {k : Type.{u2}} {V : Type.{u1}} {P : Type.{u3}} [_inst_1 : Ring.{u2} k] [_inst_2 : AddCommGroup.{u1} V] [_inst_3 : Module.{u2, u1} k V (Ring.toSemiring.{u2} k _inst_1) (AddCommGroup.toAddCommMonoid.{u1} V _inst_2)] [_inst_4 : AddTorsor.{u1, u3} V P (AddCommGroup.toAddGroup.{u1} V _inst_2)] {s : Set.{u3} P} {p : forall (x : P), (Membership.mem.{u3, u3} P (AffineSubspace.{u2, u1, u3} k V P _inst_1 _inst_2 _inst_3 _inst_4) (SetLike.instMembership.{u3, u3} (AffineSubspace.{u2, u1, u3} k V P _inst_1 _inst_2 _inst_3 _inst_4) P (AffineSubspace.instSetLikeAffineSubspace.{u2, u1, u3} k V P _inst_1 _inst_2 _inst_3 _inst_4)) x (affineSpan.{u2, u1, u3} k V P _inst_1 _inst_2 _inst_3 _inst_4 s)) -> Prop}, (forall (y : P) (hys : Membership.mem.{u3, u3} P (Set.{u3} P) (Set.instMembershipSet.{u3} P) y s), p y (subset_affineSpan.{u1, u2, u3} k V P _inst_1 _inst_2 _inst_3 _inst_4 s y hys)) -> (forall (c : k) (u : P) (hu : Membership.mem.{u3, u3} P (AffineSubspace.{u2, u1, u3} k V P _inst_1 _inst_2 _inst_3 _inst_4) (SetLike.instMembership.{u3, u3} (AffineSubspace.{u2, u1, u3} k V P _inst_1 _inst_2 _inst_3 _inst_4) P (AffineSubspace.instSetLikeAffineSubspace.{u2, u1, u3} k V P _inst_1 _inst_2 _inst_3 _inst_4)) u (affineSpan.{u2, u1, u3} k V P _inst_1 _inst_2 _inst_3 _inst_4 s)) (v : P) (hv : Membership.mem.{u3, u3} P (AffineSubspace.{u2, u1, u3} k V P _inst_1 _inst_2 _inst_3 _inst_4) (SetLike.instMembership.{u3, u3} (AffineSubspace.{u2, u1, u3} k V P _inst_1 _inst_2 _inst_3 _inst_4) P (AffineSubspace.instSetLikeAffineSubspace.{u2, u1, u3} k V P _inst_1 _inst_2 _inst_3 _inst_4)) v (affineSpan.{u2, u1, u3} k V P _inst_1 _inst_2 _inst_3 _inst_4 s)) (w : P) (hw : Membership.mem.{u3, u3} P (AffineSubspace.{u2, u1, u3} k V P _inst_1 _inst_2 _inst_3 _inst_4) (SetLike.instMembership.{u3, u3} (AffineSubspace.{u2, u1, u3} k V P _inst_1 _inst_2 _inst_3 _inst_4) P (AffineSubspace.instSetLikeAffineSubspace.{u2, u1, u3} k V P _inst_1 _inst_2 _inst_3 _inst_4)) w (affineSpan.{u2, u1, u3} k V P _inst_1 _inst_2 _inst_3 _inst_4 s)), (p u hu) -> (p v hv) -> (p w hw) -> (p (HVAdd.hVAdd.{u1, u3, u3} V P P (instHVAdd.{u1, u3} V P (AddAction.toVAdd.{u1, u3} V P (SubNegMonoid.toAddMonoid.{u1} V (AddGroup.toSubNegMonoid.{u1} V (AddCommGroup.toAddGroup.{u1} V _inst_2))) (AddTorsor.toAddAction.{u1, u3} V P (AddCommGroup.toAddGroup.{u1} V _inst_2) _inst_4))) (HSMul.hSMul.{u2, u1, u1} k V V (instHSMul.{u2, u1} k V (SMulZeroClass.toSMul.{u2, u1} k V (NegZeroClass.toZero.{u1} V (SubNegZeroMonoid.toNegZeroClass.{u1} V (SubtractionMonoid.toSubNegZeroMonoid.{u1} V (SubtractionCommMonoid.toSubtractionMonoid.{u1} V (AddCommGroup.toDivisionAddCommMonoid.{u1} V _inst_2))))) (SMulWithZero.toSMulZeroClass.{u2, u1} k V (MonoidWithZero.toZero.{u2} k (Semiring.toMonoidWithZero.{u2} k (Ring.toSemiring.{u2} k _inst_1))) (NegZeroClass.toZero.{u1} V (SubNegZeroMonoid.toNegZeroClass.{u1} V (SubtractionMonoid.toSubNegZeroMonoid.{u1} V (SubtractionCommMonoid.toSubtractionMonoid.{u1} V (AddCommGroup.toDivisionAddCommMonoid.{u1} V _inst_2))))) (MulActionWithZero.toSMulWithZero.{u2, u1} k V (Semiring.toMonoidWithZero.{u2} k (Ring.toSemiring.{u2} k _inst_1)) (NegZeroClass.toZero.{u1} V (SubNegZeroMonoid.toNegZeroClass.{u1} V (SubtractionMonoid.toSubNegZeroMonoid.{u1} V (SubtractionCommMonoid.toSubtractionMonoid.{u1} V (AddCommGroup.toDivisionAddCommMonoid.{u1} V _inst_2))))) (Module.toMulActionWithZero.{u2, u1} k V (Ring.toSemiring.{u2} k _inst_1) (AddCommGroup.toAddCommMonoid.{u1} V _inst_2) _inst_3))))) c (VSub.vsub.{u1, u3} V P (AddTorsor.toVSub.{u1, u3} V P (AddCommGroup.toAddGroup.{u1} V _inst_2) _inst_4) u v)) w) (AffineSubspace.smul_vsub_vadd_mem.{u2, u1, u3} k V P _inst_1 _inst_2 _inst_3 _inst_4 (affineSpan.{u2, u1, u3} k V P _inst_1 _inst_2 _inst_3 _inst_4 s) c u v w hu hv hw))) -> (forall {x : P} (h : Membership.mem.{u3, u3} P (AffineSubspace.{u2, u1, u3} k V P _inst_1 _inst_2 _inst_3 _inst_4) (SetLike.instMembership.{u3, u3} (AffineSubspace.{u2, u1, u3} k V P _inst_1 _inst_2 _inst_3 _inst_4) P (AffineSubspace.instSetLikeAffineSubspace.{u2, u1, u3} k V P _inst_1 _inst_2 _inst_3 _inst_4)) x (affineSpan.{u2, u1, u3} k V P _inst_1 _inst_2 _inst_3 _inst_4 s)), p x h) Case conversion may be inaccurate. Consider using '#align affine_span_induction' affineSpan_induction'ₓ'. -/ /-- A dependent version of `affine_span_induction`. -/ theorem affineSpan_induction' {s : Set P} {p : ∀ x, x ∈ affineSpan k s → Prop} (Hs : ∀ (y) (hys : y ∈ s), p y (subset_affineSpan k _ hys)) (Hc : ∀ (c : k) (u hu v hv w hw), p u hu → p v hv → p w hw → p (c • (u -ᵥ v) +ᵥ w) (AffineSubspace.smul_vsub_vadd_mem _ _ hu hv hw)) {x : P} (h : x ∈ affineSpan k s) : p x h := by refine' Exists.elim _ fun (hx : x ∈ affineSpan k s) (hc : p x hx) => hc refine' @affineSpan_induction k V P _ _ _ _ _ _ _ h _ _ · exact fun y hy => ⟨subset_affineSpan _ _ hy, Hs y hy⟩ · exact fun c u v w hu hv hw => Exists.elim hu fun hu' hu => Exists.elim hv fun hv' hv => Exists.elim hw fun hw' hw => ⟨AffineSubspace.smul_vsub_vadd_mem _ _ hu' hv' hw', Hc _ _ _ _ _ _ _ hu hv hw⟩ #align affine_span_induction' affineSpan_induction' section WithLocalInstance attribute [local instance] AffineSubspace.toAddTorsor /- warning: affine_span_coe_preimage_eq_top -> affineSpan_coe_preimage_eq_top is a dubious translation: lean 3 declaration is forall {k : Type.{u1}} {V : Type.{u2}} {P : Type.{u3}} [_inst_1 : Ring.{u1} k] [_inst_2 : AddCommGroup.{u2} V] [_inst_3 : Module.{u1, u2} k V (Ring.toSemiring.{u1} k _inst_1) (AddCommGroup.toAddCommMonoid.{u2} V _inst_2)] [_inst_4 : AddTorsor.{u2, u3} V P (AddCommGroup.toAddGroup.{u2} V _inst_2)] (A : Set.{u3} P) [_inst_5 : Nonempty.{succ u3} (coeSort.{succ u3, succ (succ u3)} (Set.{u3} P) Type.{u3} (Set.hasCoeToSort.{u3} P) A)], Eq.{succ u3} (AffineSubspace.{u1, u2, u3} k (coeSort.{succ u2, succ (succ u2)} (Submodule.{u1, u2} k V (Ring.toSemiring.{u1} k _inst_1) (AddCommGroup.toAddCommMonoid.{u2} V _inst_2) _inst_3) Type.{u2} (SetLike.hasCoeToSort.{u2, u2} (Submodule.{u1, u2} k V (Ring.toSemiring.{u1} k _inst_1) (AddCommGroup.toAddCommMonoid.{u2} V _inst_2) _inst_3) V (Submodule.setLike.{u1, u2} k V (Ring.toSemiring.{u1} k _inst_1) (AddCommGroup.toAddCommMonoid.{u2} V _inst_2) _inst_3)) (AffineSubspace.direction.{u1, u2, u3} k V P _inst_1 _inst_2 _inst_3 _inst_4 (affineSpan.{u1, u2, u3} k V P _inst_1 _inst_2 _inst_3 _inst_4 A))) (coeSort.{succ u3, succ (succ u3)} (AffineSubspace.{u1, u2, u3} k V P _inst_1 _inst_2 _inst_3 _inst_4) Type.{u3} (SetLike.hasCoeToSort.{u3, u3} (AffineSubspace.{u1, u2, u3} k V P _inst_1 _inst_2 _inst_3 _inst_4) P (AffineSubspace.setLike.{u1, u2, u3} k V P _inst_1 _inst_2 _inst_3 _inst_4)) (affineSpan.{u1, u2, u3} k V P _inst_1 _inst_2 _inst_3 _inst_4 A)) _inst_1 (Submodule.addCommGroup.{u1, u2} k V _inst_1 _inst_2 _inst_3 (AffineSubspace.direction.{u1, u2, u3} k V P _inst_1 _inst_2 _inst_3 _inst_4 (affineSpan.{u1, u2, u3} k V P _inst_1 _inst_2 _inst_3 _inst_4 A))) (Submodule.module.{u1, u2} k V (Ring.toSemiring.{u1} k _inst_1) (AddCommGroup.toAddCommMonoid.{u2} V _inst_2) _inst_3 (AffineSubspace.direction.{u1, u2, u3} k V P _inst_1 _inst_2 _inst_3 _inst_4 (affineSpan.{u1, u2, u3} k V P _inst_1 _inst_2 _inst_3 _inst_4 A))) (AffineSubspace.toAddTorsor.{u1, u2, u3} k V P _inst_1 _inst_2 _inst_3 _inst_4 (affineSpan.{u1, u2, u3} k V P _inst_1 _inst_2 _inst_3 _inst_4 A) (affineSpan.nonempty.{u1, u2, u3} k V P _inst_1 _inst_2 _inst_3 _inst_4 A _inst_5))) (affineSpan.{u1, u2, u3} k (coeSort.{succ u2, succ (succ u2)} (Submodule.{u1, u2} k V (Ring.toSemiring.{u1} k _inst_1) (AddCommGroup.toAddCommMonoid.{u2} V _inst_2) _inst_3) Type.{u2} (SetLike.hasCoeToSort.{u2, u2} (Submodule.{u1, u2} k V (Ring.toSemiring.{u1} k _inst_1) (AddCommGroup.toAddCommMonoid.{u2} V _inst_2) _inst_3) V (Submodule.setLike.{u1, u2} k V (Ring.toSemiring.{u1} k _inst_1) (AddCommGroup.toAddCommMonoid.{u2} V _inst_2) _inst_3)) (AffineSubspace.direction.{u1, u2, u3} k V P _inst_1 _inst_2 _inst_3 _inst_4 (affineSpan.{u1, u2, u3} k V P _inst_1 _inst_2 _inst_3 _inst_4 A))) (coeSort.{succ u3, succ (succ u3)} (AffineSubspace.{u1, u2, u3} k V P _inst_1 _inst_2 _inst_3 _inst_4) Type.{u3} (SetLike.hasCoeToSort.{u3, u3} (AffineSubspace.{u1, u2, u3} k V P _inst_1 _inst_2 _inst_3 _inst_4) P (AffineSubspace.setLike.{u1, u2, u3} k V P _inst_1 _inst_2 _inst_3 _inst_4)) (affineSpan.{u1, u2, u3} k V P _inst_1 _inst_2 _inst_3 _inst_4 A)) _inst_1 (Submodule.addCommGroup.{u1, u2} k V _inst_1 _inst_2 _inst_3 (AffineSubspace.direction.{u1, u2, u3} k V P _inst_1 _inst_2 _inst_3 _inst_4 (affineSpan.{u1, u2, u3} k V P _inst_1 _inst_2 _inst_3 _inst_4 A))) (Submodule.module.{u1, u2} k V (Ring.toSemiring.{u1} k _inst_1) (AddCommGroup.toAddCommMonoid.{u2} V _inst_2) _inst_3 (AffineSubspace.direction.{u1, u2, u3} k V P _inst_1 _inst_2 _inst_3 _inst_4 (affineSpan.{u1, u2, u3} k V P _inst_1 _inst_2 _inst_3 _inst_4 A))) (AffineSubspace.toAddTorsor.{u1, u2, u3} k V P _inst_1 _inst_2 _inst_3 _inst_4 (affineSpan.{u1, u2, u3} k V P _inst_1 _inst_2 _inst_3 _inst_4 A) (affineSpan.nonempty.{u1, u2, u3} k V P _inst_1 _inst_2 _inst_3 _inst_4 A _inst_5)) (Set.preimage.{u3, u3} (coeSort.{succ u3, succ (succ u3)} (AffineSubspace.{u1, u2, u3} k V P _inst_1 _inst_2 _inst_3 _inst_4) Type.{u3} (SetLike.hasCoeToSort.{u3, u3} (AffineSubspace.{u1, u2, u3} k V P _inst_1 _inst_2 _inst_3 _inst_4) P (AffineSubspace.setLike.{u1, u2, u3} k V P _inst_1 _inst_2 _inst_3 _inst_4)) (affineSpan.{u1, u2, u3} k V P _inst_1 _inst_2 _inst_3 _inst_4 A)) P ((fun (a : Type.{u3}) (b : Type.{u3}) [self : HasLiftT.{succ u3, succ u3} a b] => self.0) (coeSort.{succ u3, succ (succ u3)} (AffineSubspace.{u1, u2, u3} k V P _inst_1 _inst_2 _inst_3 _inst_4) Type.{u3} (SetLike.hasCoeToSort.{u3, u3} (AffineSubspace.{u1, u2, u3} k V P _inst_1 _inst_2 _inst_3 _inst_4) P (AffineSubspace.setLike.{u1, u2, u3} k V P _inst_1 _inst_2 _inst_3 _inst_4)) (affineSpan.{u1, u2, u3} k V P _inst_1 _inst_2 _inst_3 _inst_4 A)) P (HasLiftT.mk.{succ u3, succ u3} (coeSort.{succ u3, succ (succ u3)} (AffineSubspace.{u1, u2, u3} k V P _inst_1 _inst_2 _inst_3 _inst_4) Type.{u3} (SetLike.hasCoeToSort.{u3, u3} (AffineSubspace.{u1, u2, u3} k V P _inst_1 _inst_2 _inst_3 _inst_4) P (AffineSubspace.setLike.{u1, u2, u3} k V P _inst_1 _inst_2 _inst_3 _inst_4)) (affineSpan.{u1, u2, u3} k V P _inst_1 _inst_2 _inst_3 _inst_4 A)) P (CoeTCₓ.coe.{succ u3, succ u3} (coeSort.{succ u3, succ (succ u3)} (AffineSubspace.{u1, u2, u3} k V P _inst_1 _inst_2 _inst_3 _inst_4) Type.{u3} (SetLike.hasCoeToSort.{u3, u3} (AffineSubspace.{u1, u2, u3} k V P _inst_1 _inst_2 _inst_3 _inst_4) P (AffineSubspace.setLike.{u1, u2, u3} k V P _inst_1 _inst_2 _inst_3 _inst_4)) (affineSpan.{u1, u2, u3} k V P _inst_1 _inst_2 _inst_3 _inst_4 A)) P (coeBase.{succ u3, succ u3} (coeSort.{succ u3, succ (succ u3)} (AffineSubspace.{u1, u2, u3} k V P _inst_1 _inst_2 _inst_3 _inst_4) Type.{u3} (SetLike.hasCoeToSort.{u3, u3} (AffineSubspace.{u1, u2, u3} k V P _inst_1 _inst_2 _inst_3 _inst_4) P (AffineSubspace.setLike.{u1, u2, u3} k V P _inst_1 _inst_2 _inst_3 _inst_4)) (affineSpan.{u1, u2, u3} k V P _inst_1 _inst_2 _inst_3 _inst_4 A)) P (coeSubtype.{succ u3} P (fun (x : P) => Membership.Mem.{u3, u3} P (AffineSubspace.{u1, u2, u3} k V P _inst_1 _inst_2 _inst_3 _inst_4) (SetLike.hasMem.{u3, u3} (AffineSubspace.{u1, u2, u3} k V P _inst_1 _inst_2 _inst_3 _inst_4) P (AffineSubspace.setLike.{u1, u2, u3} k V P _inst_1 _inst_2 _inst_3 _inst_4)) x (affineSpan.{u1, u2, u3} k V P _inst_1 _inst_2 _inst_3 _inst_4 A))))))) A)) (Top.top.{u3} (AffineSubspace.{u1, u2, u3} k (coeSort.{succ u2, succ (succ u2)} (Submodule.{u1, u2} k V (Ring.toSemiring.{u1} k _inst_1) (AddCommGroup.toAddCommMonoid.{u2} V _inst_2) _inst_3) Type.{u2} (SetLike.hasCoeToSort.{u2, u2} (Submodule.{u1, u2} k V (Ring.toSemiring.{u1} k _inst_1) (AddCommGroup.toAddCommMonoid.{u2} V _inst_2) _inst_3) V (Submodule.setLike.{u1, u2} k V (Ring.toSemiring.{u1} k _inst_1) (AddCommGroup.toAddCommMonoid.{u2} V _inst_2) _inst_3)) (AffineSubspace.direction.{u1, u2, u3} k V P _inst_1 _inst_2 _inst_3 _inst_4 (affineSpan.{u1, u2, u3} k V P _inst_1 _inst_2 _inst_3 _inst_4 A))) (coeSort.{succ u3, succ (succ u3)} (AffineSubspace.{u1, u2, u3} k V P _inst_1 _inst_2 _inst_3 _inst_4) Type.{u3} (SetLike.hasCoeToSort.{u3, u3} (AffineSubspace.{u1, u2, u3} k V P _inst_1 _inst_2 _inst_3 _inst_4) P (AffineSubspace.setLike.{u1, u2, u3} k V P _inst_1 _inst_2 _inst_3 _inst_4)) (affineSpan.{u1, u2, u3} k V P _inst_1 _inst_2 _inst_3 _inst_4 A)) _inst_1 (Submodule.addCommGroup.{u1, u2} k V _inst_1 _inst_2 _inst_3 (AffineSubspace.direction.{u1, u2, u3} k V P _inst_1 _inst_2 _inst_3 _inst_4 (affineSpan.{u1, u2, u3} k V P _inst_1 _inst_2 _inst_3 _inst_4 A))) (Submodule.module.{u1, u2} k V (Ring.toSemiring.{u1} k _inst_1) (AddCommGroup.toAddCommMonoid.{u2} V _inst_2) _inst_3 (AffineSubspace.direction.{u1, u2, u3} k V P _inst_1 _inst_2 _inst_3 _inst_4 (affineSpan.{u1, u2, u3} k V P _inst_1 _inst_2 _inst_3 _inst_4 A))) (AffineSubspace.toAddTorsor.{u1, u2, u3} k V P _inst_1 _inst_2 _inst_3 _inst_4 (affineSpan.{u1, u2, u3} k V P _inst_1 _inst_2 _inst_3 _inst_4 A) (affineSpan.nonempty.{u1, u2, u3} k V P _inst_1 _inst_2 _inst_3 _inst_4 A _inst_5))) (CompleteLattice.toHasTop.{u3} (AffineSubspace.{u1, u2, u3} k (coeSort.{succ u2, succ (succ u2)} (Submodule.{u1, u2} k V (Ring.toSemiring.{u1} k _inst_1) (AddCommGroup.toAddCommMonoid.{u2} V _inst_2) _inst_3) Type.{u2} (SetLike.hasCoeToSort.{u2, u2} (Submodule.{u1, u2} k V (Ring.toSemiring.{u1} k _inst_1) (AddCommGroup.toAddCommMonoid.{u2} V _inst_2) _inst_3) V (Submodule.setLike.{u1, u2} k V (Ring.toSemiring.{u1} k _inst_1) (AddCommGroup.toAddCommMonoid.{u2} V _inst_2) _inst_3)) (AffineSubspace.direction.{u1, u2, u3} k V P _inst_1 _inst_2 _inst_3 _inst_4 (affineSpan.{u1, u2, u3} k V P _inst_1 _inst_2 _inst_3 _inst_4 A))) (coeSort.{succ u3, succ (succ u3)} (AffineSubspace.{u1, u2, u3} k V P _inst_1 _inst_2 _inst_3 _inst_4) Type.{u3} (SetLike.hasCoeToSort.{u3, u3} (AffineSubspace.{u1, u2, u3} k V P _inst_1 _inst_2 _inst_3 _inst_4) P (AffineSubspace.setLike.{u1, u2, u3} k V P _inst_1 _inst_2 _inst_3 _inst_4)) (affineSpan.{u1, u2, u3} k V P _inst_1 _inst_2 _inst_3 _inst_4 A)) _inst_1 (Submodule.addCommGroup.{u1, u2} k V _inst_1 _inst_2 _inst_3 (AffineSubspace.direction.{u1, u2, u3} k V P _inst_1 _inst_2 _inst_3 _inst_4 (affineSpan.{u1, u2, u3} k V P _inst_1 _inst_2 _inst_3 _inst_4 A))) (Submodule.module.{u1, u2} k V (Ring.toSemiring.{u1} k _inst_1) (AddCommGroup.toAddCommMonoid.{u2} V _inst_2) _inst_3 (AffineSubspace.direction.{u1, u2, u3} k V P _inst_1 _inst_2 _inst_3 _inst_4 (affineSpan.{u1, u2, u3} k V P _inst_1 _inst_2 _inst_3 _inst_4 A))) (AffineSubspace.toAddTorsor.{u1, u2, u3} k V P _inst_1 _inst_2 _inst_3 _inst_4 (affineSpan.{u1, u2, u3} k V P _inst_1 _inst_2 _inst_3 _inst_4 A) (affineSpan.nonempty.{u1, u2, u3} k V P _inst_1 _inst_2 _inst_3 _inst_4 A _inst_5))) (AffineSubspace.completeLattice.{u1, u2, u3} k (coeSort.{succ u2, succ (succ u2)} (Submodule.{u1, u2} k V (Ring.toSemiring.{u1} k _inst_1) (AddCommGroup.toAddCommMonoid.{u2} V _inst_2) _inst_3) Type.{u2} (SetLike.hasCoeToSort.{u2, u2} (Submodule.{u1, u2} k V (Ring.toSemiring.{u1} k _inst_1) (AddCommGroup.toAddCommMonoid.{u2} V _inst_2) _inst_3) V (Submodule.setLike.{u1, u2} k V (Ring.toSemiring.{u1} k _inst_1) (AddCommGroup.toAddCommMonoid.{u2} V _inst_2) _inst_3)) (AffineSubspace.direction.{u1, u2, u3} k V P _inst_1 _inst_2 _inst_3 _inst_4 (affineSpan.{u1, u2, u3} k V P _inst_1 _inst_2 _inst_3 _inst_4 A))) (coeSort.{succ u3, succ (succ u3)} (AffineSubspace.{u1, u2, u3} k V P _inst_1 _inst_2 _inst_3 _inst_4) Type.{u3} (SetLike.hasCoeToSort.{u3, u3} (AffineSubspace.{u1, u2, u3} k V P _inst_1 _inst_2 _inst_3 _inst_4) P (AffineSubspace.setLike.{u1, u2, u3} k V P _inst_1 _inst_2 _inst_3 _inst_4)) (affineSpan.{u1, u2, u3} k V P _inst_1 _inst_2 _inst_3 _inst_4 A)) _inst_1 (Submodule.addCommGroup.{u1, u2} k V _inst_1 _inst_2 _inst_3 (AffineSubspace.direction.{u1, u2, u3} k V P _inst_1 _inst_2 _inst_3 _inst_4 (affineSpan.{u1, u2, u3} k V P _inst_1 _inst_2 _inst_3 _inst_4 A))) (Submodule.module.{u1, u2} k V (Ring.toSemiring.{u1} k _inst_1) (AddCommGroup.toAddCommMonoid.{u2} V _inst_2) _inst_3 (AffineSubspace.direction.{u1, u2, u3} k V P _inst_1 _inst_2 _inst_3 _inst_4 (affineSpan.{u1, u2, u3} k V P _inst_1 _inst_2 _inst_3 _inst_4 A))) (AffineSubspace.toAddTorsor.{u1, u2, u3} k V P _inst_1 _inst_2 _inst_3 _inst_4 (affineSpan.{u1, u2, u3} k V P _inst_1 _inst_2 _inst_3 _inst_4 A) (affineSpan.nonempty.{u1, u2, u3} k V P _inst_1 _inst_2 _inst_3 _inst_4 A _inst_5))))) but is expected to have type forall {k : Type.{u2}} {V : Type.{u1}} {P : Type.{u3}} [_inst_1 : Ring.{u2} k] [_inst_2 : AddCommGroup.{u1} V] [_inst_3 : Module.{u2, u1} k V (Ring.toSemiring.{u2} k _inst_1) (AddCommGroup.toAddCommMonoid.{u1} V _inst_2)] [_inst_4 : AddTorsor.{u1, u3} V P (AddCommGroup.toAddGroup.{u1} V _inst_2)] (A : Set.{u3} P) [_inst_5 : Nonempty.{succ u3} (Set.Elem.{u3} P A)], Eq.{succ u3} (AffineSubspace.{u2, u1, u3} k (Subtype.{succ u1} V (fun (x : V) => Membership.mem.{u1, u1} V (Submodule.{u2, u1} k V (Ring.toSemiring.{u2} k _inst_1) (AddCommGroup.toAddCommMonoid.{u1} V _inst_2) _inst_3) (SetLike.instMembership.{u1, u1} (Submodule.{u2, u1} k V (Ring.toSemiring.{u2} k _inst_1) (AddCommGroup.toAddCommMonoid.{u1} V _inst_2) _inst_3) V (Submodule.setLike.{u2, u1} k V (Ring.toSemiring.{u2} k _inst_1) (AddCommGroup.toAddCommMonoid.{u1} V _inst_2) _inst_3)) x (AffineSubspace.direction.{u2, u1, u3} k V P _inst_1 _inst_2 _inst_3 _inst_4 (affineSpan.{u2, u1, u3} k V P _inst_1 _inst_2 _inst_3 _inst_4 A)))) (Subtype.{succ u3} P (fun (x : P) => Membership.mem.{u3, u3} P (Set.{u3} P) (Set.instMembershipSet.{u3} P) x (SetLike.coe.{u3, u3} (AffineSubspace.{u2, u1, u3} k V P _inst_1 _inst_2 _inst_3 _inst_4) P (AffineSubspace.instSetLikeAffineSubspace.{u2, u1, u3} k V P _inst_1 _inst_2 _inst_3 _inst_4) (affineSpan.{u2, u1, u3} k V P _inst_1 _inst_2 _inst_3 _inst_4 A)))) _inst_1 (Submodule.addCommGroup.{u2, u1} k V _inst_1 _inst_2 _inst_3 (AffineSubspace.direction.{u2, u1, u3} k V P _inst_1 _inst_2 _inst_3 _inst_4 (affineSpan.{u2, u1, u3} k V P _inst_1 _inst_2 _inst_3 _inst_4 A))) (Submodule.module.{u2, u1} k V (Ring.toSemiring.{u2} k _inst_1) (AddCommGroup.toAddCommMonoid.{u1} V _inst_2) _inst_3 (AffineSubspace.direction.{u2, u1, u3} k V P _inst_1 _inst_2 _inst_3 _inst_4 (affineSpan.{u2, u1, u3} k V P _inst_1 _inst_2 _inst_3 _inst_4 A))) (AffineSubspace.toAddTorsor.{u2, u1, u3} k V P _inst_1 _inst_2 _inst_3 _inst_4 (affineSpan.{u2, u1, u3} k V P _inst_1 _inst_2 _inst_3 _inst_4 A) (instNonemptySubtypeMemAffineSubspaceInstMembershipInstSetLikeAffineSubspaceAffineSpan.{u2, u1, u3} k V P _inst_1 _inst_2 _inst_3 _inst_4 A _inst_5))) (affineSpan.{u2, u1, u3} k (Subtype.{succ u1} V (fun (x : V) => Membership.mem.{u1, u1} V (Submodule.{u2, u1} k V (Ring.toSemiring.{u2} k _inst_1) (AddCommGroup.toAddCommMonoid.{u1} V _inst_2) _inst_3) (SetLike.instMembership.{u1, u1} (Submodule.{u2, u1} k V (Ring.toSemiring.{u2} k _inst_1) (AddCommGroup.toAddCommMonoid.{u1} V _inst_2) _inst_3) V (Submodule.setLike.{u2, u1} k V (Ring.toSemiring.{u2} k _inst_1) (AddCommGroup.toAddCommMonoid.{u1} V _inst_2) _inst_3)) x (AffineSubspace.direction.{u2, u1, u3} k V P _inst_1 _inst_2 _inst_3 _inst_4 (affineSpan.{u2, u1, u3} k V P _inst_1 _inst_2 _inst_3 _inst_4 A)))) (Subtype.{succ u3} P (fun (x : P) => Membership.mem.{u3, u3} P (Set.{u3} P) (Set.instMembershipSet.{u3} P) x (SetLike.coe.{u3, u3} (AffineSubspace.{u2, u1, u3} k V P _inst_1 _inst_2 _inst_3 _inst_4) P (AffineSubspace.instSetLikeAffineSubspace.{u2, u1, u3} k V P _inst_1 _inst_2 _inst_3 _inst_4) (affineSpan.{u2, u1, u3} k V P _inst_1 _inst_2 _inst_3 _inst_4 A)))) _inst_1 (Submodule.addCommGroup.{u2, u1} k V _inst_1 _inst_2 _inst_3 (AffineSubspace.direction.{u2, u1, u3} k V P _inst_1 _inst_2 _inst_3 _inst_4 (affineSpan.{u2, u1, u3} k V P _inst_1 _inst_2 _inst_3 _inst_4 A))) (Submodule.module.{u2, u1} k V (Ring.toSemiring.{u2} k _inst_1) (AddCommGroup.toAddCommMonoid.{u1} V _inst_2) _inst_3 (AffineSubspace.direction.{u2, u1, u3} k V P _inst_1 _inst_2 _inst_3 _inst_4 (affineSpan.{u2, u1, u3} k V P _inst_1 _inst_2 _inst_3 _inst_4 A))) (AffineSubspace.toAddTorsor.{u2, u1, u3} k V P _inst_1 _inst_2 _inst_3 _inst_4 (affineSpan.{u2, u1, u3} k V P _inst_1 _inst_2 _inst_3 _inst_4 A) (instNonemptySubtypeMemAffineSubspaceInstMembershipInstSetLikeAffineSubspaceAffineSpan.{u2, u1, u3} k V P _inst_1 _inst_2 _inst_3 _inst_4 A _inst_5)) (Set.preimage.{u3, u3} (Subtype.{succ u3} P (fun (x : P) => Membership.mem.{u3, u3} P (Set.{u3} P) (Set.instMembershipSet.{u3} P) x (SetLike.coe.{u3, u3} (AffineSubspace.{u2, u1, u3} k V P _inst_1 _inst_2 _inst_3 _inst_4) P (AffineSubspace.instSetLikeAffineSubspace.{u2, u1, u3} k V P _inst_1 _inst_2 _inst_3 _inst_4) (affineSpan.{u2, u1, u3} k V P _inst_1 _inst_2 _inst_3 _inst_4 A)))) P (Subtype.val.{succ u3} P (fun (x : P) => Membership.mem.{u3, u3} P (Set.{u3} P) (Set.instMembershipSet.{u3} P) x (SetLike.coe.{u3, u3} (AffineSubspace.{u2, u1, u3} k V P _inst_1 _inst_2 _inst_3 _inst_4) P (AffineSubspace.instSetLikeAffineSubspace.{u2, u1, u3} k V P _inst_1 _inst_2 _inst_3 _inst_4) (affineSpan.{u2, u1, u3} k V P _inst_1 _inst_2 _inst_3 _inst_4 A)))) A)) (Top.top.{u3} (AffineSubspace.{u2, u1, u3} k (Subtype.{succ u1} V (fun (x : V) => Membership.mem.{u1, u1} V (Submodule.{u2, u1} k V (Ring.toSemiring.{u2} k _inst_1) (AddCommGroup.toAddCommMonoid.{u1} V _inst_2) _inst_3) (SetLike.instMembership.{u1, u1} (Submodule.{u2, u1} k V (Ring.toSemiring.{u2} k _inst_1) (AddCommGroup.toAddCommMonoid.{u1} V _inst_2) _inst_3) V (Submodule.setLike.{u2, u1} k V (Ring.toSemiring.{u2} k _inst_1) (AddCommGroup.toAddCommMonoid.{u1} V _inst_2) _inst_3)) x (AffineSubspace.direction.{u2, u1, u3} k V P _inst_1 _inst_2 _inst_3 _inst_4 (affineSpan.{u2, u1, u3} k V P _inst_1 _inst_2 _inst_3 _inst_4 A)))) (Subtype.{succ u3} P (fun (x : P) => Membership.mem.{u3, u3} P (Set.{u3} P) (Set.instMembershipSet.{u3} P) x (SetLike.coe.{u3, u3} (AffineSubspace.{u2, u1, u3} k V P _inst_1 _inst_2 _inst_3 _inst_4) P (AffineSubspace.instSetLikeAffineSubspace.{u2, u1, u3} k V P _inst_1 _inst_2 _inst_3 _inst_4) (affineSpan.{u2, u1, u3} k V P _inst_1 _inst_2 _inst_3 _inst_4 A)))) _inst_1 (Submodule.addCommGroup.{u2, u1} k V _inst_1 _inst_2 _inst_3 (AffineSubspace.direction.{u2, u1, u3} k V P _inst_1 _inst_2 _inst_3 _inst_4 (affineSpan.{u2, u1, u3} k V P _inst_1 _inst_2 _inst_3 _inst_4 A))) (Submodule.module.{u2, u1} k V (Ring.toSemiring.{u2} k _inst_1) (AddCommGroup.toAddCommMonoid.{u1} V _inst_2) _inst_3 (AffineSubspace.direction.{u2, u1, u3} k V P _inst_1 _inst_2 _inst_3 _inst_4 (affineSpan.{u2, u1, u3} k V P _inst_1 _inst_2 _inst_3 _inst_4 A))) (AffineSubspace.toAddTorsor.{u2, u1, u3} k V P _inst_1 _inst_2 _inst_3 _inst_4 (affineSpan.{u2, u1, u3} k V P _inst_1 _inst_2 _inst_3 _inst_4 A) (instNonemptySubtypeMemAffineSubspaceInstMembershipInstSetLikeAffineSubspaceAffineSpan.{u2, u1, u3} k V P _inst_1 _inst_2 _inst_3 _inst_4 A _inst_5))) (CompleteLattice.toTop.{u3} (AffineSubspace.{u2, u1, u3} k (Subtype.{succ u1} V (fun (x : V) => Membership.mem.{u1, u1} V (Submodule.{u2, u1} k V (Ring.toSemiring.{u2} k _inst_1) (AddCommGroup.toAddCommMonoid.{u1} V _inst_2) _inst_3) (SetLike.instMembership.{u1, u1} (Submodule.{u2, u1} k V (Ring.toSemiring.{u2} k _inst_1) (AddCommGroup.toAddCommMonoid.{u1} V _inst_2) _inst_3) V (Submodule.setLike.{u2, u1} k V (Ring.toSemiring.{u2} k _inst_1) (AddCommGroup.toAddCommMonoid.{u1} V _inst_2) _inst_3)) x (AffineSubspace.direction.{u2, u1, u3} k V P _inst_1 _inst_2 _inst_3 _inst_4 (affineSpan.{u2, u1, u3} k V P _inst_1 _inst_2 _inst_3 _inst_4 A)))) (Subtype.{succ u3} P (fun (x : P) => Membership.mem.{u3, u3} P (Set.{u3} P) (Set.instMembershipSet.{u3} P) x (SetLike.coe.{u3, u3} (AffineSubspace.{u2, u1, u3} k V P _inst_1 _inst_2 _inst_3 _inst_4) P (AffineSubspace.instSetLikeAffineSubspace.{u2, u1, u3} k V P _inst_1 _inst_2 _inst_3 _inst_4) (affineSpan.{u2, u1, u3} k V P _inst_1 _inst_2 _inst_3 _inst_4 A)))) _inst_1 (Submodule.addCommGroup.{u2, u1} k V _inst_1 _inst_2 _inst_3 (AffineSubspace.direction.{u2, u1, u3} k V P _inst_1 _inst_2 _inst_3 _inst_4 (affineSpan.{u2, u1, u3} k V P _inst_1 _inst_2 _inst_3 _inst_4 A))) (Submodule.module.{u2, u1} k V (Ring.toSemiring.{u2} k _inst_1) (AddCommGroup.toAddCommMonoid.{u1} V _inst_2) _inst_3 (AffineSubspace.direction.{u2, u1, u3} k V P _inst_1 _inst_2 _inst_3 _inst_4 (affineSpan.{u2, u1, u3} k V P _inst_1 _inst_2 _inst_3 _inst_4 A))) (AffineSubspace.toAddTorsor.{u2, u1, u3} k V P _inst_1 _inst_2 _inst_3 _inst_4 (affineSpan.{u2, u1, u3} k V P _inst_1 _inst_2 _inst_3 _inst_4 A) (instNonemptySubtypeMemAffineSubspaceInstMembershipInstSetLikeAffineSubspaceAffineSpan.{u2, u1, u3} k V P _inst_1 _inst_2 _inst_3 _inst_4 A _inst_5))) (AffineSubspace.instCompleteLatticeAffineSubspace.{u2, u1, u3} k (Subtype.{succ u1} V (fun (x : V) => Membership.mem.{u1, u1} V (Submodule.{u2, u1} k V (Ring.toSemiring.{u2} k _inst_1) (AddCommGroup.toAddCommMonoid.{u1} V _inst_2) _inst_3) (SetLike.instMembership.{u1, u1} (Submodule.{u2, u1} k V (Ring.toSemiring.{u2} k _inst_1) (AddCommGroup.toAddCommMonoid.{u1} V _inst_2) _inst_3) V (Submodule.setLike.{u2, u1} k V (Ring.toSemiring.{u2} k _inst_1) (AddCommGroup.toAddCommMonoid.{u1} V _inst_2) _inst_3)) x (AffineSubspace.direction.{u2, u1, u3} k V P _inst_1 _inst_2 _inst_3 _inst_4 (affineSpan.{u2, u1, u3} k V P _inst_1 _inst_2 _inst_3 _inst_4 A)))) (Subtype.{succ u3} P (fun (x : P) => Membership.mem.{u3, u3} P (Set.{u3} P) (Set.instMembershipSet.{u3} P) x (SetLike.coe.{u3, u3} (AffineSubspace.{u2, u1, u3} k V P _inst_1 _inst_2 _inst_3 _inst_4) P (AffineSubspace.instSetLikeAffineSubspace.{u2, u1, u3} k V P _inst_1 _inst_2 _inst_3 _inst_4) (affineSpan.{u2, u1, u3} k V P _inst_1 _inst_2 _inst_3 _inst_4 A)))) _inst_1 (Submodule.addCommGroup.{u2, u1} k V _inst_1 _inst_2 _inst_3 (AffineSubspace.direction.{u2, u1, u3} k V P _inst_1 _inst_2 _inst_3 _inst_4 (affineSpan.{u2, u1, u3} k V P _inst_1 _inst_2 _inst_3 _inst_4 A))) (Submodule.module.{u2, u1} k V (Ring.toSemiring.{u2} k _inst_1) (AddCommGroup.toAddCommMonoid.{u1} V _inst_2) _inst_3 (AffineSubspace.direction.{u2, u1, u3} k V P _inst_1 _inst_2 _inst_3 _inst_4 (affineSpan.{u2, u1, u3} k V P _inst_1 _inst_2 _inst_3 _inst_4 A))) (AffineSubspace.toAddTorsor.{u2, u1, u3} k V P _inst_1 _inst_2 _inst_3 _inst_4 (affineSpan.{u2, u1, u3} k V P _inst_1 _inst_2 _inst_3 _inst_4 A) (instNonemptySubtypeMemAffineSubspaceInstMembershipInstSetLikeAffineSubspaceAffineSpan.{u2, u1, u3} k V P _inst_1 _inst_2 _inst_3 _inst_4 A _inst_5))))) Case conversion may be inaccurate. Consider using '#align affine_span_coe_preimage_eq_top affineSpan_coe_preimage_eq_topₓ'. -/ /-- A set, considered as a subset of its spanned affine subspace, spans the whole subspace. -/ @[simp] theorem affineSpan_coe_preimage_eq_top (A : Set P) [Nonempty A] : affineSpan k ((coe : affineSpan k A → P) ⁻¹' A) = ⊤ := by rw [eq_top_iff] rintro ⟨x, hx⟩ - refine' affineSpan_induction' (fun y hy => _) (fun c u hu v hv w hw => _) hx · exact subset_affineSpan _ _ hy · exact AffineSubspace.smul_vsub_vadd_mem _ _ #align affine_span_coe_preimage_eq_top affineSpan_coe_preimage_eq_top end WithLocalInstance /- warning: affine_span_singleton_union_vadd_eq_top_of_span_eq_top -> affineSpan_singleton_union_vadd_eq_top_of_span_eq_top is a dubious translation: lean 3 declaration is forall {k : Type.{u1}} {V : Type.{u2}} {P : Type.{u3}} [_inst_1 : Ring.{u1} k] [_inst_2 : AddCommGroup.{u2} V] [_inst_3 : Module.{u1, u2} k V (Ring.toSemiring.{u1} k _inst_1) (AddCommGroup.toAddCommMonoid.{u2} V _inst_2)] [_inst_4 : AddTorsor.{u2, u3} V P (AddCommGroup.toAddGroup.{u2} V _inst_2)] {s : Set.{u2} V} (p : P), (Eq.{succ u2} (Submodule.{u1, u2} k V (Ring.toSemiring.{u1} k _inst_1) (AddCommGroup.toAddCommMonoid.{u2} V _inst_2) _inst_3) (Submodule.span.{u1, u2} k V (Ring.toSemiring.{u1} k _inst_1) (AddCommGroup.toAddCommMonoid.{u2} V _inst_2) _inst_3 (Set.range.{u2, succ u2} V (coeSort.{succ u2, succ (succ u2)} (Set.{u2} V) Type.{u2} (Set.hasCoeToSort.{u2} V) s) ((fun (a : Type.{u2}) (b : Type.{u2}) [self : HasLiftT.{succ u2, succ u2} a b] => self.0) (coeSort.{succ u2, succ (succ u2)} (Set.{u2} V) Type.{u2} (Set.hasCoeToSort.{u2} V) s) V (HasLiftT.mk.{succ u2, succ u2} (coeSort.{succ u2, succ (succ u2)} (Set.{u2} V) Type.{u2} (Set.hasCoeToSort.{u2} V) s) V (CoeTCₓ.coe.{succ u2, succ u2} (coeSort.{succ u2, succ (succ u2)} (Set.{u2} V) Type.{u2} (Set.hasCoeToSort.{u2} V) s) V (coeBase.{succ u2, succ u2} (coeSort.{succ u2, succ (succ u2)} (Set.{u2} V) Type.{u2} (Set.hasCoeToSort.{u2} V) s) V (coeSubtype.{succ u2} V (fun (x : V) => Membership.Mem.{u2, u2} V (Set.{u2} V) (Set.hasMem.{u2} V) x s)))))))) (Top.top.{u2} (Submodule.{u1, u2} k V (Ring.toSemiring.{u1} k _inst_1) (AddCommGroup.toAddCommMonoid.{u2} V _inst_2) _inst_3) (Submodule.hasTop.{u1, u2} k V (Ring.toSemiring.{u1} k _inst_1) (AddCommGroup.toAddCommMonoid.{u2} V _inst_2) _inst_3))) -> (Eq.{succ u3} (AffineSubspace.{u1, u2, u3} k V P _inst_1 _inst_2 _inst_3 _inst_4) (affineSpan.{u1, u2, u3} k V P _inst_1 _inst_2 _inst_3 _inst_4 (Union.union.{u3} (Set.{u3} P) (Set.hasUnion.{u3} P) (Singleton.singleton.{u3, u3} P (Set.{u3} P) (Set.hasSingleton.{u3} P) p) (Set.image.{u2, u3} V P (fun (v : V) => VAdd.vadd.{u2, u3} V P (AddAction.toHasVadd.{u2, u3} V P (SubNegMonoid.toAddMonoid.{u2} V (AddGroup.toSubNegMonoid.{u2} V (AddCommGroup.toAddGroup.{u2} V _inst_2))) (AddTorsor.toAddAction.{u2, u3} V P (AddCommGroup.toAddGroup.{u2} V _inst_2) _inst_4)) v p) s))) (Top.top.{u3} (AffineSubspace.{u1, u2, u3} k V P _inst_1 _inst_2 _inst_3 _inst_4) (CompleteLattice.toHasTop.{u3} (AffineSubspace.{u1, u2, u3} k V P _inst_1 _inst_2 _inst_3 _inst_4) (AffineSubspace.completeLattice.{u1, u2, u3} k V P _inst_1 _inst_2 _inst_3 _inst_4)))) but is expected to have type forall {k : Type.{u2}} {V : Type.{u3}} {P : Type.{u1}} [_inst_1 : Ring.{u2} k] [_inst_2 : AddCommGroup.{u3} V] [_inst_3 : Module.{u2, u3} k V (Ring.toSemiring.{u2} k _inst_1) (AddCommGroup.toAddCommMonoid.{u3} V _inst_2)] [_inst_4 : AddTorsor.{u3, u1} V P (AddCommGroup.toAddGroup.{u3} V _inst_2)] {s : Set.{u3} V} (p : P), (Eq.{succ u3} (Submodule.{u2, u3} k V (Ring.toSemiring.{u2} k _inst_1) (AddCommGroup.toAddCommMonoid.{u3} V _inst_2) _inst_3) (Submodule.span.{u2, u3} k V (Ring.toSemiring.{u2} k _inst_1) (AddCommGroup.toAddCommMonoid.{u3} V _inst_2) _inst_3 (Set.range.{u3, succ u3} V (Subtype.{succ u3} V (fun (x : V) => Membership.mem.{u3, u3} V (Set.{u3} V) (Set.instMembershipSet.{u3} V) x s)) (Subtype.val.{succ u3} V (fun (x : V) => Membership.mem.{u3, u3} V (Set.{u3} V) (Set.instMembershipSet.{u3} V) x s)))) (Top.top.{u3} (Submodule.{u2, u3} k V (Ring.toSemiring.{u2} k _inst_1) (AddCommGroup.toAddCommMonoid.{u3} V _inst_2) _inst_3) (Submodule.instTopSubmodule.{u2, u3} k V (Ring.toSemiring.{u2} k _inst_1) (AddCommGroup.toAddCommMonoid.{u3} V _inst_2) _inst_3))) -> (Eq.{succ u1} (AffineSubspace.{u2, u3, u1} k V P _inst_1 _inst_2 _inst_3 _inst_4) (affineSpan.{u2, u3, u1} k V P _inst_1 _inst_2 _inst_3 _inst_4 (Union.union.{u1} (Set.{u1} P) (Set.instUnionSet.{u1} P) (Singleton.singleton.{u1, u1} P (Set.{u1} P) (Set.instSingletonSet.{u1} P) p) (Set.image.{u3, u1} V P (fun (v : V) => HVAdd.hVAdd.{u3, u1, u1} V P P (instHVAdd.{u3, u1} V P (AddAction.toVAdd.{u3, u1} V P (SubNegMonoid.toAddMonoid.{u3} V (AddGroup.toSubNegMonoid.{u3} V (AddCommGroup.toAddGroup.{u3} V _inst_2))) (AddTorsor.toAddAction.{u3, u1} V P (AddCommGroup.toAddGroup.{u3} V _inst_2) _inst_4))) v p) s))) (Top.top.{u1} (AffineSubspace.{u2, u3, u1} k V P _inst_1 _inst_2 _inst_3 _inst_4) (CompleteLattice.toTop.{u1} (AffineSubspace.{u2, u3, u1} k V P _inst_1 _inst_2 _inst_3 _inst_4) (AffineSubspace.instCompleteLatticeAffineSubspace.{u2, u3, u1} k V P _inst_1 _inst_2 _inst_3 _inst_4)))) Case conversion may be inaccurate. Consider using '#align affine_span_singleton_union_vadd_eq_top_of_span_eq_top affineSpan_singleton_union_vadd_eq_top_of_span_eq_topₓ'. -/ /-- Suppose a set of vectors spans `V`. Then a point `p`, together with those vectors added to `p`, spans `P`. -/ theorem affineSpan_singleton_union_vadd_eq_top_of_span_eq_top {s : Set V} (p : P) (h : Submodule.span k (Set.range (coe : s → V)) = ⊤) : affineSpan k ({p} ∪ (fun v => v +ᵥ p) '' s) = ⊤ := by convert ext_of_direction_eq _ ⟨p, mem_affineSpan k (Set.mem_union_left _ (Set.mem_singleton _)), mem_top k V p⟩ rw [direction_affineSpan, direction_top, vectorSpan_eq_span_vsub_set_right k (Set.mem_union_left _ (Set.mem_singleton _) : p ∈ _), eq_top_iff, ← h] apply Submodule.span_mono rintro v ⟨v', rfl⟩ use (v' : V) +ᵥ p simp #align affine_span_singleton_union_vadd_eq_top_of_span_eq_top affineSpan_singleton_union_vadd_eq_top_of_span_eq_top variable (k) /- warning: vector_span_pair -> vectorSpan_pair is a dubious translation: lean 3 declaration is forall (k : Type.{u1}) {V : Type.{u2}} {P : Type.{u3}} [_inst_1 : Ring.{u1} k] [_inst_2 : AddCommGroup.{u2} V] [_inst_3 : Module.{u1, u2} k V (Ring.toSemiring.{u1} k _inst_1) (AddCommGroup.toAddCommMonoid.{u2} V _inst_2)] [_inst_4 : AddTorsor.{u2, u3} V P (AddCommGroup.toAddGroup.{u2} V _inst_2)] (p₁ : P) (p₂ : P), Eq.{succ u2} (Submodule.{u1, u2} k V (Ring.toSemiring.{u1} k _inst_1) (AddCommGroup.toAddCommMonoid.{u2} V _inst_2) _inst_3) (vectorSpan.{u1, u2, u3} k V P _inst_1 _inst_2 _inst_3 _inst_4 (Insert.insert.{u3, u3} P (Set.{u3} P) (Set.hasInsert.{u3} P) p₁ (Singleton.singleton.{u3, u3} P (Set.{u3} P) (Set.hasSingleton.{u3} P) p₂))) (Submodule.span.{u1, u2} k V (Ring.toSemiring.{u1} k _inst_1) (AddCommGroup.toAddCommMonoid.{u2} V _inst_2) _inst_3 (Singleton.singleton.{u2, u2} V (Set.{u2} V) (Set.hasSingleton.{u2} V) (VSub.vsub.{u2, u3} V P (AddTorsor.toHasVsub.{u2, u3} V P (AddCommGroup.toAddGroup.{u2} V _inst_2) _inst_4) p₁ p₂))) but is expected to have type forall (k : Type.{u2}) {V : Type.{u3}} {P : Type.{u1}} [_inst_1 : Ring.{u2} k] [_inst_2 : AddCommGroup.{u3} V] [_inst_3 : Module.{u2, u3} k V (Ring.toSemiring.{u2} k _inst_1) (AddCommGroup.toAddCommMonoid.{u3} V _inst_2)] [_inst_4 : AddTorsor.{u3, u1} V P (AddCommGroup.toAddGroup.{u3} V _inst_2)] (p₁ : P) (p₂ : P), Eq.{succ u3} (Submodule.{u2, u3} k V (Ring.toSemiring.{u2} k _inst_1) (AddCommGroup.toAddCommMonoid.{u3} V _inst_2) _inst_3) (vectorSpan.{u2, u3, u1} k V P _inst_1 _inst_2 _inst_3 _inst_4 (Insert.insert.{u1, u1} P (Set.{u1} P) (Set.instInsertSet.{u1} P) p₁ (Singleton.singleton.{u1, u1} P (Set.{u1} P) (Set.instSingletonSet.{u1} P) p₂))) (Submodule.span.{u2, u3} k V (Ring.toSemiring.{u2} k _inst_1) (AddCommGroup.toAddCommMonoid.{u3} V _inst_2) _inst_3 (Singleton.singleton.{u3, u3} V (Set.{u3} V) (Set.instSingletonSet.{u3} V) (VSub.vsub.{u3, u1} V P (AddTorsor.toVSub.{u3, u1} V P (AddCommGroup.toAddGroup.{u3} V _inst_2) _inst_4) p₁ p₂))) Case conversion may be inaccurate. Consider using '#align vector_span_pair vectorSpan_pairₓ'. -/ /-- The `vector_span` of two points is the span of their difference. -/ theorem vectorSpan_pair (p₁ p₂ : P) : vectorSpan k ({p₁, p₂} : Set P) = k ∙ p₁ -ᵥ p₂ := by rw [vectorSpan_eq_span_vsub_set_left k (mem_insert p₁ _), image_pair, vsub_self, Submodule.span_insert_zero] #align vector_span_pair vectorSpan_pair /- warning: vector_span_pair_rev -> vectorSpan_pair_rev is a dubious translation: lean 3 declaration is forall (k : Type.{u1}) {V : Type.{u2}} {P : Type.{u3}} [_inst_1 : Ring.{u1} k] [_inst_2 : AddCommGroup.{u2} V] [_inst_3 : Module.{u1, u2} k V (Ring.toSemiring.{u1} k _inst_1) (AddCommGroup.toAddCommMonoid.{u2} V _inst_2)] [_inst_4 : AddTorsor.{u2, u3} V P (AddCommGroup.toAddGroup.{u2} V _inst_2)] (p₁ : P) (p₂ : P), Eq.{succ u2} (Submodule.{u1, u2} k V (Ring.toSemiring.{u1} k _inst_1) (AddCommGroup.toAddCommMonoid.{u2} V _inst_2) _inst_3) (vectorSpan.{u1, u2, u3} k V P _inst_1 _inst_2 _inst_3 _inst_4 (Insert.insert.{u3, u3} P (Set.{u3} P) (Set.hasInsert.{u3} P) p₁ (Singleton.singleton.{u3, u3} P (Set.{u3} P) (Set.hasSingleton.{u3} P) p₂))) (Submodule.span.{u1, u2} k V (Ring.toSemiring.{u1} k _inst_1) (AddCommGroup.toAddCommMonoid.{u2} V _inst_2) _inst_3 (Singleton.singleton.{u2, u2} V (Set.{u2} V) (Set.hasSingleton.{u2} V) (VSub.vsub.{u2, u3} V P (AddTorsor.toHasVsub.{u2, u3} V P (AddCommGroup.toAddGroup.{u2} V _inst_2) _inst_4) p₂ p₁))) but is expected to have type forall (k : Type.{u2}) {V : Type.{u3}} {P : Type.{u1}} [_inst_1 : Ring.{u2} k] [_inst_2 : AddCommGroup.{u3} V] [_inst_3 : Module.{u2, u3} k V (Ring.toSemiring.{u2} k _inst_1) (AddCommGroup.toAddCommMonoid.{u3} V _inst_2)] [_inst_4 : AddTorsor.{u3, u1} V P (AddCommGroup.toAddGroup.{u3} V _inst_2)] (p₁ : P) (p₂ : P), Eq.{succ u3} (Submodule.{u2, u3} k V (Ring.toSemiring.{u2} k _inst_1) (AddCommGroup.toAddCommMonoid.{u3} V _inst_2) _inst_3) (vectorSpan.{u2, u3, u1} k V P _inst_1 _inst_2 _inst_3 _inst_4 (Insert.insert.{u1, u1} P (Set.{u1} P) (Set.instInsertSet.{u1} P) p₁ (Singleton.singleton.{u1, u1} P (Set.{u1} P) (Set.instSingletonSet.{u1} P) p₂))) (Submodule.span.{u2, u3} k V (Ring.toSemiring.{u2} k _inst_1) (AddCommGroup.toAddCommMonoid.{u3} V _inst_2) _inst_3 (Singleton.singleton.{u3, u3} V (Set.{u3} V) (Set.instSingletonSet.{u3} V) (VSub.vsub.{u3, u1} V P (AddTorsor.toVSub.{u3, u1} V P (AddCommGroup.toAddGroup.{u3} V _inst_2) _inst_4) p₂ p₁))) Case conversion may be inaccurate. Consider using '#align vector_span_pair_rev vectorSpan_pair_revₓ'. -/ /-- The `vector_span` of two points is the span of their difference (reversed). -/ theorem vectorSpan_pair_rev (p₁ p₂ : P) : vectorSpan k ({p₁, p₂} : Set P) = k ∙ p₂ -ᵥ p₁ := by rw [pair_comm, vectorSpan_pair] #align vector_span_pair_rev vectorSpan_pair_rev /- warning: vsub_mem_vector_span_pair -> vsub_mem_vectorSpan_pair is a dubious translation: lean 3 declaration is forall (k : Type.{u1}) {V : Type.{u2}} {P : Type.{u3}} [_inst_1 : Ring.{u1} k] [_inst_2 : AddCommGroup.{u2} V] [_inst_3 : Module.{u1, u2} k V (Ring.toSemiring.{u1} k _inst_1) (AddCommGroup.toAddCommMonoid.{u2} V _inst_2)] [_inst_4 : AddTorsor.{u2, u3} V P (AddCommGroup.toAddGroup.{u2} V _inst_2)] (p₁ : P) (p₂ : P), Membership.Mem.{u2, u2} V (Submodule.{u1, u2} k V (Ring.toSemiring.{u1} k _inst_1) (AddCommGroup.toAddCommMonoid.{u2} V _inst_2) _inst_3) (SetLike.hasMem.{u2, u2} (Submodule.{u1, u2} k V (Ring.toSemiring.{u1} k _inst_1) (AddCommGroup.toAddCommMonoid.{u2} V _inst_2) _inst_3) V (Submodule.setLike.{u1, u2} k V (Ring.toSemiring.{u1} k _inst_1) (AddCommGroup.toAddCommMonoid.{u2} V _inst_2) _inst_3)) (VSub.vsub.{u2, u3} V P (AddTorsor.toHasVsub.{u2, u3} V P (AddCommGroup.toAddGroup.{u2} V _inst_2) _inst_4) p₁ p₂) (vectorSpan.{u1, u2, u3} k V P _inst_1 _inst_2 _inst_3 _inst_4 (Insert.insert.{u3, u3} P (Set.{u3} P) (Set.hasInsert.{u3} P) p₁ (Singleton.singleton.{u3, u3} P (Set.{u3} P) (Set.hasSingleton.{u3} P) p₂))) but is expected to have type forall (k : Type.{u2}) {V : Type.{u3}} {P : Type.{u1}} [_inst_1 : Ring.{u2} k] [_inst_2 : AddCommGroup.{u3} V] [_inst_3 : Module.{u2, u3} k V (Ring.toSemiring.{u2} k _inst_1) (AddCommGroup.toAddCommMonoid.{u3} V _inst_2)] [_inst_4 : AddTorsor.{u3, u1} V P (AddCommGroup.toAddGroup.{u3} V _inst_2)] (p₁ : P) (p₂ : P), Membership.mem.{u3, u3} V (Submodule.{u2, u3} k V (Ring.toSemiring.{u2} k _inst_1) (AddCommGroup.toAddCommMonoid.{u3} V _inst_2) _inst_3) (SetLike.instMembership.{u3, u3} (Submodule.{u2, u3} k V (Ring.toSemiring.{u2} k _inst_1) (AddCommGroup.toAddCommMonoid.{u3} V _inst_2) _inst_3) V (Submodule.setLike.{u2, u3} k V (Ring.toSemiring.{u2} k _inst_1) (AddCommGroup.toAddCommMonoid.{u3} V _inst_2) _inst_3)) (VSub.vsub.{u3, u1} V P (AddTorsor.toVSub.{u3, u1} V P (AddCommGroup.toAddGroup.{u3} V _inst_2) _inst_4) p₁ p₂) (vectorSpan.{u2, u3, u1} k V P _inst_1 _inst_2 _inst_3 _inst_4 (Insert.insert.{u1, u1} P (Set.{u1} P) (Set.instInsertSet.{u1} P) p₁ (Singleton.singleton.{u1, u1} P (Set.{u1} P) (Set.instSingletonSet.{u1} P) p₂))) Case conversion may be inaccurate. Consider using '#align vsub_mem_vector_span_pair vsub_mem_vectorSpan_pairₓ'. -/ /-- The difference between two points lies in their `vector_span`. -/ theorem vsub_mem_vectorSpan_pair (p₁ p₂ : P) : p₁ -ᵥ p₂ ∈ vectorSpan k ({p₁, p₂} : Set P) := vsub_mem_vectorSpan _ (Set.mem_insert _ _) (Set.mem_insert_of_mem _ (Set.mem_singleton _)) #align vsub_mem_vector_span_pair vsub_mem_vectorSpan_pair /- warning: vsub_rev_mem_vector_span_pair -> vsub_rev_mem_vectorSpan_pair is a dubious translation: lean 3 declaration is forall (k : Type.{u1}) {V : Type.{u2}} {P : Type.{u3}} [_inst_1 : Ring.{u1} k] [_inst_2 : AddCommGroup.{u2} V] [_inst_3 : Module.{u1, u2} k V (Ring.toSemiring.{u1} k _inst_1) (AddCommGroup.toAddCommMonoid.{u2} V _inst_2)] [_inst_4 : AddTorsor.{u2, u3} V P (AddCommGroup.toAddGroup.{u2} V _inst_2)] (p₁ : P) (p₂ : P), Membership.Mem.{u2, u2} V (Submodule.{u1, u2} k V (Ring.toSemiring.{u1} k _inst_1) (AddCommGroup.toAddCommMonoid.{u2} V _inst_2) _inst_3) (SetLike.hasMem.{u2, u2} (Submodule.{u1, u2} k V (Ring.toSemiring.{u1} k _inst_1) (AddCommGroup.toAddCommMonoid.{u2} V _inst_2) _inst_3) V (Submodule.setLike.{u1, u2} k V (Ring.toSemiring.{u1} k _inst_1) (AddCommGroup.toAddCommMonoid.{u2} V _inst_2) _inst_3)) (VSub.vsub.{u2, u3} V P (AddTorsor.toHasVsub.{u2, u3} V P (AddCommGroup.toAddGroup.{u2} V _inst_2) _inst_4) p₂ p₁) (vectorSpan.{u1, u2, u3} k V P _inst_1 _inst_2 _inst_3 _inst_4 (Insert.insert.{u3, u3} P (Set.{u3} P) (Set.hasInsert.{u3} P) p₁ (Singleton.singleton.{u3, u3} P (Set.{u3} P) (Set.hasSingleton.{u3} P) p₂))) but is expected to have type forall (k : Type.{u2}) {V : Type.{u3}} {P : Type.{u1}} [_inst_1 : Ring.{u2} k] [_inst_2 : AddCommGroup.{u3} V] [_inst_3 : Module.{u2, u3} k V (Ring.toSemiring.{u2} k _inst_1) (AddCommGroup.toAddCommMonoid.{u3} V _inst_2)] [_inst_4 : AddTorsor.{u3, u1} V P (AddCommGroup.toAddGroup.{u3} V _inst_2)] (p₁ : P) (p₂ : P), Membership.mem.{u3, u3} V (Submodule.{u2, u3} k V (Ring.toSemiring.{u2} k _inst_1) (AddCommGroup.toAddCommMonoid.{u3} V _inst_2) _inst_3) (SetLike.instMembership.{u3, u3} (Submodule.{u2, u3} k V (Ring.toSemiring.{u2} k _inst_1) (AddCommGroup.toAddCommMonoid.{u3} V _inst_2) _inst_3) V (Submodule.setLike.{u2, u3} k V (Ring.toSemiring.{u2} k _inst_1) (AddCommGroup.toAddCommMonoid.{u3} V _inst_2) _inst_3)) (VSub.vsub.{u3, u1} V P (AddTorsor.toVSub.{u3, u1} V P (AddCommGroup.toAddGroup.{u3} V _inst_2) _inst_4) p₂ p₁) (vectorSpan.{u2, u3, u1} k V P _inst_1 _inst_2 _inst_3 _inst_4 (Insert.insert.{u1, u1} P (Set.{u1} P) (Set.instInsertSet.{u1} P) p₁ (Singleton.singleton.{u1, u1} P (Set.{u1} P) (Set.instSingletonSet.{u1} P) p₂))) Case conversion may be inaccurate. Consider using '#align vsub_rev_mem_vector_span_pair vsub_rev_mem_vectorSpan_pairₓ'. -/ /-- The difference between two points (reversed) lies in their `vector_span`. -/ theorem vsub_rev_mem_vectorSpan_pair (p₁ p₂ : P) : p₂ -ᵥ p₁ ∈ vectorSpan k ({p₁, p₂} : Set P) := vsub_mem_vectorSpan _ (Set.mem_insert_of_mem _ (Set.mem_singleton _)) (Set.mem_insert _ _) #align vsub_rev_mem_vector_span_pair vsub_rev_mem_vectorSpan_pair variable {k} /- warning: smul_vsub_mem_vector_span_pair -> smul_vsub_mem_vectorSpan_pair is a dubious translation: lean 3 declaration is forall {k : Type.{u1}} {V : Type.{u2}} {P : Type.{u3}} [_inst_1 : Ring.{u1} k] [_inst_2 : AddCommGroup.{u2} V] [_inst_3 : Module.{u1, u2} k V (Ring.toSemiring.{u1} k _inst_1) (AddCommGroup.toAddCommMonoid.{u2} V _inst_2)] [_inst_4 : AddTorsor.{u2, u3} V P (AddCommGroup.toAddGroup.{u2} V _inst_2)] (r : k) (p₁ : P) (p₂ : P), Membership.Mem.{u2, u2} V (Submodule.{u1, u2} k V (Ring.toSemiring.{u1} k _inst_1) (AddCommGroup.toAddCommMonoid.{u2} V _inst_2) _inst_3) (SetLike.hasMem.{u2, u2} (Submodule.{u1, u2} k V (Ring.toSemiring.{u1} k _inst_1) (AddCommGroup.toAddCommMonoid.{u2} V _inst_2) _inst_3) V (Submodule.setLike.{u1, u2} k V (Ring.toSemiring.{u1} k _inst_1) (AddCommGroup.toAddCommMonoid.{u2} V _inst_2) _inst_3)) (SMul.smul.{u1, u2} k V (SMulZeroClass.toHasSmul.{u1, u2} k V (AddZeroClass.toHasZero.{u2} V (AddMonoid.toAddZeroClass.{u2} V (AddCommMonoid.toAddMonoid.{u2} V (AddCommGroup.toAddCommMonoid.{u2} V _inst_2)))) (SMulWithZero.toSmulZeroClass.{u1, u2} k V (MulZeroClass.toHasZero.{u1} k (MulZeroOneClass.toMulZeroClass.{u1} k (MonoidWithZero.toMulZeroOneClass.{u1} k (Semiring.toMonoidWithZero.{u1} k (Ring.toSemiring.{u1} k _inst_1))))) (AddZeroClass.toHasZero.{u2} V (AddMonoid.toAddZeroClass.{u2} V (AddCommMonoid.toAddMonoid.{u2} V (AddCommGroup.toAddCommMonoid.{u2} V _inst_2)))) (MulActionWithZero.toSMulWithZero.{u1, u2} k V (Semiring.toMonoidWithZero.{u1} k (Ring.toSemiring.{u1} k _inst_1)) (AddZeroClass.toHasZero.{u2} V (AddMonoid.toAddZeroClass.{u2} V (AddCommMonoid.toAddMonoid.{u2} V (AddCommGroup.toAddCommMonoid.{u2} V _inst_2)))) (Module.toMulActionWithZero.{u1, u2} k V (Ring.toSemiring.{u1} k _inst_1) (AddCommGroup.toAddCommMonoid.{u2} V _inst_2) _inst_3)))) r (VSub.vsub.{u2, u3} V P (AddTorsor.toHasVsub.{u2, u3} V P (AddCommGroup.toAddGroup.{u2} V _inst_2) _inst_4) p₁ p₂)) (vectorSpan.{u1, u2, u3} k V P _inst_1 _inst_2 _inst_3 _inst_4 (Insert.insert.{u3, u3} P (Set.{u3} P) (Set.hasInsert.{u3} P) p₁ (Singleton.singleton.{u3, u3} P (Set.{u3} P) (Set.hasSingleton.{u3} P) p₂))) but is expected to have type forall {k : Type.{u2}} {V : Type.{u3}} {P : Type.{u1}} [_inst_1 : Ring.{u2} k] [_inst_2 : AddCommGroup.{u3} V] [_inst_3 : Module.{u2, u3} k V (Ring.toSemiring.{u2} k _inst_1) (AddCommGroup.toAddCommMonoid.{u3} V _inst_2)] [_inst_4 : AddTorsor.{u3, u1} V P (AddCommGroup.toAddGroup.{u3} V _inst_2)] (r : k) (p₁ : P) (p₂ : P), Membership.mem.{u3, u3} V (Submodule.{u2, u3} k V (Ring.toSemiring.{u2} k _inst_1) (AddCommGroup.toAddCommMonoid.{u3} V _inst_2) _inst_3) (SetLike.instMembership.{u3, u3} (Submodule.{u2, u3} k V (Ring.toSemiring.{u2} k _inst_1) (AddCommGroup.toAddCommMonoid.{u3} V _inst_2) _inst_3) V (Submodule.setLike.{u2, u3} k V (Ring.toSemiring.{u2} k _inst_1) (AddCommGroup.toAddCommMonoid.{u3} V _inst_2) _inst_3)) (HSMul.hSMul.{u2, u3, u3} k V V (instHSMul.{u2, u3} k V (SMulZeroClass.toSMul.{u2, u3} k V (NegZeroClass.toZero.{u3} V (SubNegZeroMonoid.toNegZeroClass.{u3} V (SubtractionMonoid.toSubNegZeroMonoid.{u3} V (SubtractionCommMonoid.toSubtractionMonoid.{u3} V (AddCommGroup.toDivisionAddCommMonoid.{u3} V _inst_2))))) (SMulWithZero.toSMulZeroClass.{u2, u3} k V (MonoidWithZero.toZero.{u2} k (Semiring.toMonoidWithZero.{u2} k (Ring.toSemiring.{u2} k _inst_1))) (NegZeroClass.toZero.{u3} V (SubNegZeroMonoid.toNegZeroClass.{u3} V (SubtractionMonoid.toSubNegZeroMonoid.{u3} V (SubtractionCommMonoid.toSubtractionMonoid.{u3} V (AddCommGroup.toDivisionAddCommMonoid.{u3} V _inst_2))))) (MulActionWithZero.toSMulWithZero.{u2, u3} k V (Semiring.toMonoidWithZero.{u2} k (Ring.toSemiring.{u2} k _inst_1)) (NegZeroClass.toZero.{u3} V (SubNegZeroMonoid.toNegZeroClass.{u3} V (SubtractionMonoid.toSubNegZeroMonoid.{u3} V (SubtractionCommMonoid.toSubtractionMonoid.{u3} V (AddCommGroup.toDivisionAddCommMonoid.{u3} V _inst_2))))) (Module.toMulActionWithZero.{u2, u3} k V (Ring.toSemiring.{u2} k _inst_1) (AddCommGroup.toAddCommMonoid.{u3} V _inst_2) _inst_3))))) r (VSub.vsub.{u3, u1} V P (AddTorsor.toVSub.{u3, u1} V P (AddCommGroup.toAddGroup.{u3} V _inst_2) _inst_4) p₁ p₂)) (vectorSpan.{u2, u3, u1} k V P _inst_1 _inst_2 _inst_3 _inst_4 (Insert.insert.{u1, u1} P (Set.{u1} P) (Set.instInsertSet.{u1} P) p₁ (Singleton.singleton.{u1, u1} P (Set.{u1} P) (Set.instSingletonSet.{u1} P) p₂))) Case conversion may be inaccurate. Consider using '#align smul_vsub_mem_vector_span_pair smul_vsub_mem_vectorSpan_pairₓ'. -/ /-- A multiple of the difference between two points lies in their `vector_span`. -/ theorem smul_vsub_mem_vectorSpan_pair (r : k) (p₁ p₂ : P) : r • (p₁ -ᵥ p₂) ∈ vectorSpan k ({p₁, p₂} : Set P) := Submodule.smul_mem _ _ (vsub_mem_vectorSpan_pair k p₁ p₂) #align smul_vsub_mem_vector_span_pair smul_vsub_mem_vectorSpan_pair /- warning: smul_vsub_rev_mem_vector_span_pair -> smul_vsub_rev_mem_vectorSpan_pair is a dubious translation: lean 3 declaration is forall {k : Type.{u1}} {V : Type.{u2}} {P : Type.{u3}} [_inst_1 : Ring.{u1} k] [_inst_2 : AddCommGroup.{u2} V] [_inst_3 : Module.{u1, u2} k V (Ring.toSemiring.{u1} k _inst_1) (AddCommGroup.toAddCommMonoid.{u2} V _inst_2)] [_inst_4 : AddTorsor.{u2, u3} V P (AddCommGroup.toAddGroup.{u2} V _inst_2)] (r : k) (p₁ : P) (p₂ : P), Membership.Mem.{u2, u2} V (Submodule.{u1, u2} k V (Ring.toSemiring.{u1} k _inst_1) (AddCommGroup.toAddCommMonoid.{u2} V _inst_2) _inst_3) (SetLike.hasMem.{u2, u2} (Submodule.{u1, u2} k V (Ring.toSemiring.{u1} k _inst_1) (AddCommGroup.toAddCommMonoid.{u2} V _inst_2) _inst_3) V (Submodule.setLike.{u1, u2} k V (Ring.toSemiring.{u1} k _inst_1) (AddCommGroup.toAddCommMonoid.{u2} V _inst_2) _inst_3)) (SMul.smul.{u1, u2} k V (SMulZeroClass.toHasSmul.{u1, u2} k V (AddZeroClass.toHasZero.{u2} V (AddMonoid.toAddZeroClass.{u2} V (AddCommMonoid.toAddMonoid.{u2} V (AddCommGroup.toAddCommMonoid.{u2} V _inst_2)))) (SMulWithZero.toSmulZeroClass.{u1, u2} k V (MulZeroClass.toHasZero.{u1} k (MulZeroOneClass.toMulZeroClass.{u1} k (MonoidWithZero.toMulZeroOneClass.{u1} k (Semiring.toMonoidWithZero.{u1} k (Ring.toSemiring.{u1} k _inst_1))))) (AddZeroClass.toHasZero.{u2} V (AddMonoid.toAddZeroClass.{u2} V (AddCommMonoid.toAddMonoid.{u2} V (AddCommGroup.toAddCommMonoid.{u2} V _inst_2)))) (MulActionWithZero.toSMulWithZero.{u1, u2} k V (Semiring.toMonoidWithZero.{u1} k (Ring.toSemiring.{u1} k _inst_1)) (AddZeroClass.toHasZero.{u2} V (AddMonoid.toAddZeroClass.{u2} V (AddCommMonoid.toAddMonoid.{u2} V (AddCommGroup.toAddCommMonoid.{u2} V _inst_2)))) (Module.toMulActionWithZero.{u1, u2} k V (Ring.toSemiring.{u1} k _inst_1) (AddCommGroup.toAddCommMonoid.{u2} V _inst_2) _inst_3)))) r (VSub.vsub.{u2, u3} V P (AddTorsor.toHasVsub.{u2, u3} V P (AddCommGroup.toAddGroup.{u2} V _inst_2) _inst_4) p₂ p₁)) (vectorSpan.{u1, u2, u3} k V P _inst_1 _inst_2 _inst_3 _inst_4 (Insert.insert.{u3, u3} P (Set.{u3} P) (Set.hasInsert.{u3} P) p₁ (Singleton.singleton.{u3, u3} P (Set.{u3} P) (Set.hasSingleton.{u3} P) p₂))) but is expected to have type forall {k : Type.{u2}} {V : Type.{u3}} {P : Type.{u1}} [_inst_1 : Ring.{u2} k] [_inst_2 : AddCommGroup.{u3} V] [_inst_3 : Module.{u2, u3} k V (Ring.toSemiring.{u2} k _inst_1) (AddCommGroup.toAddCommMonoid.{u3} V _inst_2)] [_inst_4 : AddTorsor.{u3, u1} V P (AddCommGroup.toAddGroup.{u3} V _inst_2)] (r : k) (p₁ : P) (p₂ : P), Membership.mem.{u3, u3} V (Submodule.{u2, u3} k V (Ring.toSemiring.{u2} k _inst_1) (AddCommGroup.toAddCommMonoid.{u3} V _inst_2) _inst_3) (SetLike.instMembership.{u3, u3} (Submodule.{u2, u3} k V (Ring.toSemiring.{u2} k _inst_1) (AddCommGroup.toAddCommMonoid.{u3} V _inst_2) _inst_3) V (Submodule.setLike.{u2, u3} k V (Ring.toSemiring.{u2} k _inst_1) (AddCommGroup.toAddCommMonoid.{u3} V _inst_2) _inst_3)) (HSMul.hSMul.{u2, u3, u3} k V V (instHSMul.{u2, u3} k V (SMulZeroClass.toSMul.{u2, u3} k V (NegZeroClass.toZero.{u3} V (SubNegZeroMonoid.toNegZeroClass.{u3} V (SubtractionMonoid.toSubNegZeroMonoid.{u3} V (SubtractionCommMonoid.toSubtractionMonoid.{u3} V (AddCommGroup.toDivisionAddCommMonoid.{u3} V _inst_2))))) (SMulWithZero.toSMulZeroClass.{u2, u3} k V (MonoidWithZero.toZero.{u2} k (Semiring.toMonoidWithZero.{u2} k (Ring.toSemiring.{u2} k _inst_1))) (NegZeroClass.toZero.{u3} V (SubNegZeroMonoid.toNegZeroClass.{u3} V (SubtractionMonoid.toSubNegZeroMonoid.{u3} V (SubtractionCommMonoid.toSubtractionMonoid.{u3} V (AddCommGroup.toDivisionAddCommMonoid.{u3} V _inst_2))))) (MulActionWithZero.toSMulWithZero.{u2, u3} k V (Semiring.toMonoidWithZero.{u2} k (Ring.toSemiring.{u2} k _inst_1)) (NegZeroClass.toZero.{u3} V (SubNegZeroMonoid.toNegZeroClass.{u3} V (SubtractionMonoid.toSubNegZeroMonoid.{u3} V (SubtractionCommMonoid.toSubtractionMonoid.{u3} V (AddCommGroup.toDivisionAddCommMonoid.{u3} V _inst_2))))) (Module.toMulActionWithZero.{u2, u3} k V (Ring.toSemiring.{u2} k _inst_1) (AddCommGroup.toAddCommMonoid.{u3} V _inst_2) _inst_3))))) r (VSub.vsub.{u3, u1} V P (AddTorsor.toVSub.{u3, u1} V P (AddCommGroup.toAddGroup.{u3} V _inst_2) _inst_4) p₂ p₁)) (vectorSpan.{u2, u3, u1} k V P _inst_1 _inst_2 _inst_3 _inst_4 (Insert.insert.{u1, u1} P (Set.{u1} P) (Set.instInsertSet.{u1} P) p₁ (Singleton.singleton.{u1, u1} P (Set.{u1} P) (Set.instSingletonSet.{u1} P) p₂))) Case conversion may be inaccurate. Consider using '#align smul_vsub_rev_mem_vector_span_pair smul_vsub_rev_mem_vectorSpan_pairₓ'. -/ /-- A multiple of the difference between two points (reversed) lies in their `vector_span`. -/ theorem smul_vsub_rev_mem_vectorSpan_pair (r : k) (p₁ p₂ : P) : r • (p₂ -ᵥ p₁) ∈ vectorSpan k ({p₁, p₂} : Set P) := Submodule.smul_mem _ _ (vsub_rev_mem_vectorSpan_pair k p₁ p₂) #align smul_vsub_rev_mem_vector_span_pair smul_vsub_rev_mem_vectorSpan_pair /- warning: mem_vector_span_pair -> mem_vectorSpan_pair is a dubious translation: lean 3 declaration is forall {k : Type.{u1}} {V : Type.{u2}} {P : Type.{u3}} [_inst_1 : Ring.{u1} k] [_inst_2 : AddCommGroup.{u2} V] [_inst_3 : Module.{u1, u2} k V (Ring.toSemiring.{u1} k _inst_1) (AddCommGroup.toAddCommMonoid.{u2} V _inst_2)] [_inst_4 : AddTorsor.{u2, u3} V P (AddCommGroup.toAddGroup.{u2} V _inst_2)] {p₁ : P} {p₂ : P} {v : V}, Iff (Membership.Mem.{u2, u2} V (Submodule.{u1, u2} k V (Ring.toSemiring.{u1} k _inst_1) (AddCommGroup.toAddCommMonoid.{u2} V _inst_2) _inst_3) (SetLike.hasMem.{u2, u2} (Submodule.{u1, u2} k V (Ring.toSemiring.{u1} k _inst_1) (AddCommGroup.toAddCommMonoid.{u2} V _inst_2) _inst_3) V (Submodule.setLike.{u1, u2} k V (Ring.toSemiring.{u1} k _inst_1) (AddCommGroup.toAddCommMonoid.{u2} V _inst_2) _inst_3)) v (vectorSpan.{u1, u2, u3} k V P _inst_1 _inst_2 _inst_3 _inst_4 (Insert.insert.{u3, u3} P (Set.{u3} P) (Set.hasInsert.{u3} P) p₁ (Singleton.singleton.{u3, u3} P (Set.{u3} P) (Set.hasSingleton.{u3} P) p₂)))) (Exists.{succ u1} k (fun (r : k) => Eq.{succ u2} V (SMul.smul.{u1, u2} k V (SMulZeroClass.toHasSmul.{u1, u2} k V (AddZeroClass.toHasZero.{u2} V (AddMonoid.toAddZeroClass.{u2} V (AddCommMonoid.toAddMonoid.{u2} V (AddCommGroup.toAddCommMonoid.{u2} V _inst_2)))) (SMulWithZero.toSmulZeroClass.{u1, u2} k V (MulZeroClass.toHasZero.{u1} k (MulZeroOneClass.toMulZeroClass.{u1} k (MonoidWithZero.toMulZeroOneClass.{u1} k (Semiring.toMonoidWithZero.{u1} k (Ring.toSemiring.{u1} k _inst_1))))) (AddZeroClass.toHasZero.{u2} V (AddMonoid.toAddZeroClass.{u2} V (AddCommMonoid.toAddMonoid.{u2} V (AddCommGroup.toAddCommMonoid.{u2} V _inst_2)))) (MulActionWithZero.toSMulWithZero.{u1, u2} k V (Semiring.toMonoidWithZero.{u1} k (Ring.toSemiring.{u1} k _inst_1)) (AddZeroClass.toHasZero.{u2} V (AddMonoid.toAddZeroClass.{u2} V (AddCommMonoid.toAddMonoid.{u2} V (AddCommGroup.toAddCommMonoid.{u2} V _inst_2)))) (Module.toMulActionWithZero.{u1, u2} k V (Ring.toSemiring.{u1} k _inst_1) (AddCommGroup.toAddCommMonoid.{u2} V _inst_2) _inst_3)))) r (VSub.vsub.{u2, u3} V P (AddTorsor.toHasVsub.{u2, u3} V P (AddCommGroup.toAddGroup.{u2} V _inst_2) _inst_4) p₁ p₂)) v)) but is expected to have type forall {k : Type.{u2}} {V : Type.{u3}} {P : Type.{u1}} [_inst_1 : Ring.{u2} k] [_inst_2 : AddCommGroup.{u3} V] [_inst_3 : Module.{u2, u3} k V (Ring.toSemiring.{u2} k _inst_1) (AddCommGroup.toAddCommMonoid.{u3} V _inst_2)] [_inst_4 : AddTorsor.{u3, u1} V P (AddCommGroup.toAddGroup.{u3} V _inst_2)] {p₁ : P} {p₂ : P} {v : V}, Iff (Membership.mem.{u3, u3} V (Submodule.{u2, u3} k V (Ring.toSemiring.{u2} k _inst_1) (AddCommGroup.toAddCommMonoid.{u3} V _inst_2) _inst_3) (SetLike.instMembership.{u3, u3} (Submodule.{u2, u3} k V (Ring.toSemiring.{u2} k _inst_1) (AddCommGroup.toAddCommMonoid.{u3} V _inst_2) _inst_3) V (Submodule.setLike.{u2, u3} k V (Ring.toSemiring.{u2} k _inst_1) (AddCommGroup.toAddCommMonoid.{u3} V _inst_2) _inst_3)) v (vectorSpan.{u2, u3, u1} k V P _inst_1 _inst_2 _inst_3 _inst_4 (Insert.insert.{u1, u1} P (Set.{u1} P) (Set.instInsertSet.{u1} P) p₁ (Singleton.singleton.{u1, u1} P (Set.{u1} P) (Set.instSingletonSet.{u1} P) p₂)))) (Exists.{succ u2} k (fun (r : k) => Eq.{succ u3} V (HSMul.hSMul.{u2, u3, u3} k V V (instHSMul.{u2, u3} k V (SMulZeroClass.toSMul.{u2, u3} k V (NegZeroClass.toZero.{u3} V (SubNegZeroMonoid.toNegZeroClass.{u3} V (SubtractionMonoid.toSubNegZeroMonoid.{u3} V (SubtractionCommMonoid.toSubtractionMonoid.{u3} V (AddCommGroup.toDivisionAddCommMonoid.{u3} V _inst_2))))) (SMulWithZero.toSMulZeroClass.{u2, u3} k V (MonoidWithZero.toZero.{u2} k (Semiring.toMonoidWithZero.{u2} k (Ring.toSemiring.{u2} k _inst_1))) (NegZeroClass.toZero.{u3} V (SubNegZeroMonoid.toNegZeroClass.{u3} V (SubtractionMonoid.toSubNegZeroMonoid.{u3} V (SubtractionCommMonoid.toSubtractionMonoid.{u3} V (AddCommGroup.toDivisionAddCommMonoid.{u3} V _inst_2))))) (MulActionWithZero.toSMulWithZero.{u2, u3} k V (Semiring.toMonoidWithZero.{u2} k (Ring.toSemiring.{u2} k _inst_1)) (NegZeroClass.toZero.{u3} V (SubNegZeroMonoid.toNegZeroClass.{u3} V (SubtractionMonoid.toSubNegZeroMonoid.{u3} V (SubtractionCommMonoid.toSubtractionMonoid.{u3} V (AddCommGroup.toDivisionAddCommMonoid.{u3} V _inst_2))))) (Module.toMulActionWithZero.{u2, u3} k V (Ring.toSemiring.{u2} k _inst_1) (AddCommGroup.toAddCommMonoid.{u3} V _inst_2) _inst_3))))) r (VSub.vsub.{u3, u1} V P (AddTorsor.toVSub.{u3, u1} V P (AddCommGroup.toAddGroup.{u3} V _inst_2) _inst_4) p₁ p₂)) v)) Case conversion may be inaccurate. Consider using '#align mem_vector_span_pair mem_vectorSpan_pairₓ'. -/ /-- A vector lies in the `vector_span` of two points if and only if it is a multiple of their difference. -/ theorem mem_vectorSpan_pair {p₁ p₂ : P} {v : V} : v ∈ vectorSpan k ({p₁, p₂} : Set P) ↔ ∃ r : k, r • (p₁ -ᵥ p₂) = v := by rw [vectorSpan_pair, Submodule.mem_span_singleton] #align mem_vector_span_pair mem_vectorSpan_pair /- warning: mem_vector_span_pair_rev -> mem_vectorSpan_pair_rev is a dubious translation: lean 3 declaration is forall {k : Type.{u1}} {V : Type.{u2}} {P : Type.{u3}} [_inst_1 : Ring.{u1} k] [_inst_2 : AddCommGroup.{u2} V] [_inst_3 : Module.{u1, u2} k V (Ring.toSemiring.{u1} k _inst_1) (AddCommGroup.toAddCommMonoid.{u2} V _inst_2)] [_inst_4 : AddTorsor.{u2, u3} V P (AddCommGroup.toAddGroup.{u2} V _inst_2)] {p₁ : P} {p₂ : P} {v : V}, Iff (Membership.Mem.{u2, u2} V (Submodule.{u1, u2} k V (Ring.toSemiring.{u1} k _inst_1) (AddCommGroup.toAddCommMonoid.{u2} V _inst_2) _inst_3) (SetLike.hasMem.{u2, u2} (Submodule.{u1, u2} k V (Ring.toSemiring.{u1} k _inst_1) (AddCommGroup.toAddCommMonoid.{u2} V _inst_2) _inst_3) V (Submodule.setLike.{u1, u2} k V (Ring.toSemiring.{u1} k _inst_1) (AddCommGroup.toAddCommMonoid.{u2} V _inst_2) _inst_3)) v (vectorSpan.{u1, u2, u3} k V P _inst_1 _inst_2 _inst_3 _inst_4 (Insert.insert.{u3, u3} P (Set.{u3} P) (Set.hasInsert.{u3} P) p₁ (Singleton.singleton.{u3, u3} P (Set.{u3} P) (Set.hasSingleton.{u3} P) p₂)))) (Exists.{succ u1} k (fun (r : k) => Eq.{succ u2} V (SMul.smul.{u1, u2} k V (SMulZeroClass.toHasSmul.{u1, u2} k V (AddZeroClass.toHasZero.{u2} V (AddMonoid.toAddZeroClass.{u2} V (AddCommMonoid.toAddMonoid.{u2} V (AddCommGroup.toAddCommMonoid.{u2} V _inst_2)))) (SMulWithZero.toSmulZeroClass.{u1, u2} k V (MulZeroClass.toHasZero.{u1} k (MulZeroOneClass.toMulZeroClass.{u1} k (MonoidWithZero.toMulZeroOneClass.{u1} k (Semiring.toMonoidWithZero.{u1} k (Ring.toSemiring.{u1} k _inst_1))))) (AddZeroClass.toHasZero.{u2} V (AddMonoid.toAddZeroClass.{u2} V (AddCommMonoid.toAddMonoid.{u2} V (AddCommGroup.toAddCommMonoid.{u2} V _inst_2)))) (MulActionWithZero.toSMulWithZero.{u1, u2} k V (Semiring.toMonoidWithZero.{u1} k (Ring.toSemiring.{u1} k _inst_1)) (AddZeroClass.toHasZero.{u2} V (AddMonoid.toAddZeroClass.{u2} V (AddCommMonoid.toAddMonoid.{u2} V (AddCommGroup.toAddCommMonoid.{u2} V _inst_2)))) (Module.toMulActionWithZero.{u1, u2} k V (Ring.toSemiring.{u1} k _inst_1) (AddCommGroup.toAddCommMonoid.{u2} V _inst_2) _inst_3)))) r (VSub.vsub.{u2, u3} V P (AddTorsor.toHasVsub.{u2, u3} V P (AddCommGroup.toAddGroup.{u2} V _inst_2) _inst_4) p₂ p₁)) v)) but is expected to have type forall {k : Type.{u2}} {V : Type.{u3}} {P : Type.{u1}} [_inst_1 : Ring.{u2} k] [_inst_2 : AddCommGroup.{u3} V] [_inst_3 : Module.{u2, u3} k V (Ring.toSemiring.{u2} k _inst_1) (AddCommGroup.toAddCommMonoid.{u3} V _inst_2)] [_inst_4 : AddTorsor.{u3, u1} V P (AddCommGroup.toAddGroup.{u3} V _inst_2)] {p₁ : P} {p₂ : P} {v : V}, Iff (Membership.mem.{u3, u3} V (Submodule.{u2, u3} k V (Ring.toSemiring.{u2} k _inst_1) (AddCommGroup.toAddCommMonoid.{u3} V _inst_2) _inst_3) (SetLike.instMembership.{u3, u3} (Submodule.{u2, u3} k V (Ring.toSemiring.{u2} k _inst_1) (AddCommGroup.toAddCommMonoid.{u3} V _inst_2) _inst_3) V (Submodule.setLike.{u2, u3} k V (Ring.toSemiring.{u2} k _inst_1) (AddCommGroup.toAddCommMonoid.{u3} V _inst_2) _inst_3)) v (vectorSpan.{u2, u3, u1} k V P _inst_1 _inst_2 _inst_3 _inst_4 (Insert.insert.{u1, u1} P (Set.{u1} P) (Set.instInsertSet.{u1} P) p₁ (Singleton.singleton.{u1, u1} P (Set.{u1} P) (Set.instSingletonSet.{u1} P) p₂)))) (Exists.{succ u2} k (fun (r : k) => Eq.{succ u3} V (HSMul.hSMul.{u2, u3, u3} k V V (instHSMul.{u2, u3} k V (SMulZeroClass.toSMul.{u2, u3} k V (NegZeroClass.toZero.{u3} V (SubNegZeroMonoid.toNegZeroClass.{u3} V (SubtractionMonoid.toSubNegZeroMonoid.{u3} V (SubtractionCommMonoid.toSubtractionMonoid.{u3} V (AddCommGroup.toDivisionAddCommMonoid.{u3} V _inst_2))))) (SMulWithZero.toSMulZeroClass.{u2, u3} k V (MonoidWithZero.toZero.{u2} k (Semiring.toMonoidWithZero.{u2} k (Ring.toSemiring.{u2} k _inst_1))) (NegZeroClass.toZero.{u3} V (SubNegZeroMonoid.toNegZeroClass.{u3} V (SubtractionMonoid.toSubNegZeroMonoid.{u3} V (SubtractionCommMonoid.toSubtractionMonoid.{u3} V (AddCommGroup.toDivisionAddCommMonoid.{u3} V _inst_2))))) (MulActionWithZero.toSMulWithZero.{u2, u3} k V (Semiring.toMonoidWithZero.{u2} k (Ring.toSemiring.{u2} k _inst_1)) (NegZeroClass.toZero.{u3} V (SubNegZeroMonoid.toNegZeroClass.{u3} V (SubtractionMonoid.toSubNegZeroMonoid.{u3} V (SubtractionCommMonoid.toSubtractionMonoid.{u3} V (AddCommGroup.toDivisionAddCommMonoid.{u3} V _inst_2))))) (Module.toMulActionWithZero.{u2, u3} k V (Ring.toSemiring.{u2} k _inst_1) (AddCommGroup.toAddCommMonoid.{u3} V _inst_2) _inst_3))))) r (VSub.vsub.{u3, u1} V P (AddTorsor.toVSub.{u3, u1} V P (AddCommGroup.toAddGroup.{u3} V _inst_2) _inst_4) p₂ p₁)) v)) Case conversion may be inaccurate. Consider using '#align mem_vector_span_pair_rev mem_vectorSpan_pair_revₓ'. -/ /-- A vector lies in the `vector_span` of two points if and only if it is a multiple of their difference (reversed). -/ theorem mem_vectorSpan_pair_rev {p₁ p₂ : P} {v : V} : v ∈ vectorSpan k ({p₁, p₂} : Set P) ↔ ∃ r : k, r • (p₂ -ᵥ p₁) = v := by rw [vectorSpan_pair_rev, Submodule.mem_span_singleton] #align mem_vector_span_pair_rev mem_vectorSpan_pair_rev variable (k) -- mathport name: «exprline[ , , ]» notation "line[" k ", " p₁ ", " p₂ "]" => affineSpan k (insert p₁ (@singleton _ _ Set.hasSingleton p₂)) /- warning: left_mem_affine_span_pair -> left_mem_affineSpan_pair is a dubious translation: lean 3 declaration is forall (k : Type.{u1}) {V : Type.{u2}} {P : Type.{u3}} [_inst_1 : Ring.{u1} k] [_inst_2 : AddCommGroup.{u2} V] [_inst_3 : Module.{u1, u2} k V (Ring.toSemiring.{u1} k _inst_1) (AddCommGroup.toAddCommMonoid.{u2} V _inst_2)] [_inst_4 : AddTorsor.{u2, u3} V P (AddCommGroup.toAddGroup.{u2} V _inst_2)] (p₁ : P) (p₂ : P), Membership.Mem.{u3, u3} P (AffineSubspace.{u1, u2, u3} k V P _inst_1 _inst_2 _inst_3 _inst_4) (SetLike.hasMem.{u3, u3} (AffineSubspace.{u1, u2, u3} k V P _inst_1 _inst_2 _inst_3 _inst_4) P (AffineSubspace.setLike.{u1, u2, u3} k V P _inst_1 _inst_2 _inst_3 _inst_4)) p₁ (affineSpan.{u1, u2, u3} k V P _inst_1 _inst_2 _inst_3 _inst_4 (Insert.insert.{u3, u3} P (Set.{u3} P) (Set.hasInsert.{u3} P) p₁ (Singleton.singleton.{u3, u3} P (Set.{u3} P) (Set.hasSingleton.{u3} P) p₂))) but is expected to have type forall (k : Type.{u2}) {V : Type.{u1}} {P : Type.{u3}} [_inst_1 : Ring.{u2} k] [_inst_2 : AddCommGroup.{u1} V] [_inst_3 : Module.{u2, u1} k V (Ring.toSemiring.{u2} k _inst_1) (AddCommGroup.toAddCommMonoid.{u1} V _inst_2)] [_inst_4 : AddTorsor.{u1, u3} V P (AddCommGroup.toAddGroup.{u1} V _inst_2)] (p₁ : P) (p₂ : P), Membership.mem.{u3, u3} P (AffineSubspace.{u2, u1, u3} k V P _inst_1 _inst_2 _inst_3 _inst_4) (SetLike.instMembership.{u3, u3} (AffineSubspace.{u2, u1, u3} k V P _inst_1 _inst_2 _inst_3 _inst_4) P (AffineSubspace.instSetLikeAffineSubspace.{u2, u1, u3} k V P _inst_1 _inst_2 _inst_3 _inst_4)) p₁ (affineSpan.{u2, u1, u3} k V P _inst_1 _inst_2 _inst_3 _inst_4 (Insert.insert.{u3, u3} P (Set.{u3} P) (Set.instInsertSet.{u3} P) p₁ (Singleton.singleton.{u3, u3} P (Set.{u3} P) (Set.instSingletonSet.{u3} P) p₂))) Case conversion may be inaccurate. Consider using '#align left_mem_affine_span_pair left_mem_affineSpan_pairₓ'. -/ /-- The first of two points lies in their affine span. -/ theorem left_mem_affineSpan_pair (p₁ p₂ : P) : p₁ ∈ line[k, p₁, p₂] := mem_affineSpan _ (Set.mem_insert _ _) #align left_mem_affine_span_pair left_mem_affineSpan_pair /- warning: right_mem_affine_span_pair -> right_mem_affineSpan_pair is a dubious translation: lean 3 declaration is forall (k : Type.{u1}) {V : Type.{u2}} {P : Type.{u3}} [_inst_1 : Ring.{u1} k] [_inst_2 : AddCommGroup.{u2} V] [_inst_3 : Module.{u1, u2} k V (Ring.toSemiring.{u1} k _inst_1) (AddCommGroup.toAddCommMonoid.{u2} V _inst_2)] [_inst_4 : AddTorsor.{u2, u3} V P (AddCommGroup.toAddGroup.{u2} V _inst_2)] (p₁ : P) (p₂ : P), Membership.Mem.{u3, u3} P (AffineSubspace.{u1, u2, u3} k V P _inst_1 _inst_2 _inst_3 _inst_4) (SetLike.hasMem.{u3, u3} (AffineSubspace.{u1, u2, u3} k V P _inst_1 _inst_2 _inst_3 _inst_4) P (AffineSubspace.setLike.{u1, u2, u3} k V P _inst_1 _inst_2 _inst_3 _inst_4)) p₂ (affineSpan.{u1, u2, u3} k V P _inst_1 _inst_2 _inst_3 _inst_4 (Insert.insert.{u3, u3} P (Set.{u3} P) (Set.hasInsert.{u3} P) p₁ (Singleton.singleton.{u3, u3} P (Set.{u3} P) (Set.hasSingleton.{u3} P) p₂))) but is expected to have type forall (k : Type.{u2}) {V : Type.{u1}} {P : Type.{u3}} [_inst_1 : Ring.{u2} k] [_inst_2 : AddCommGroup.{u1} V] [_inst_3 : Module.{u2, u1} k V (Ring.toSemiring.{u2} k _inst_1) (AddCommGroup.toAddCommMonoid.{u1} V _inst_2)] [_inst_4 : AddTorsor.{u1, u3} V P (AddCommGroup.toAddGroup.{u1} V _inst_2)] (p₁ : P) (p₂ : P), Membership.mem.{u3, u3} P (AffineSubspace.{u2, u1, u3} k V P _inst_1 _inst_2 _inst_3 _inst_4) (SetLike.instMembership.{u3, u3} (AffineSubspace.{u2, u1, u3} k V P _inst_1 _inst_2 _inst_3 _inst_4) P (AffineSubspace.instSetLikeAffineSubspace.{u2, u1, u3} k V P _inst_1 _inst_2 _inst_3 _inst_4)) p₂ (affineSpan.{u2, u1, u3} k V P _inst_1 _inst_2 _inst_3 _inst_4 (Insert.insert.{u3, u3} P (Set.{u3} P) (Set.instInsertSet.{u3} P) p₁ (Singleton.singleton.{u3, u3} P (Set.{u3} P) (Set.instSingletonSet.{u3} P) p₂))) Case conversion may be inaccurate. Consider using '#align right_mem_affine_span_pair right_mem_affineSpan_pairₓ'. -/ /-- The second of two points lies in their affine span. -/ theorem right_mem_affineSpan_pair (p₁ p₂ : P) : p₂ ∈ line[k, p₁, p₂] := mem_affineSpan _ (Set.mem_insert_of_mem _ (Set.mem_singleton _)) #align right_mem_affine_span_pair right_mem_affineSpan_pair variable {k} /- warning: affine_map.line_map_mem_affine_span_pair -> AffineMap.lineMap_mem_affineSpan_pair is a dubious translation: lean 3 declaration is forall {k : Type.{u1}} {V : Type.{u2}} {P : Type.{u3}} [_inst_1 : Ring.{u1} k] [_inst_2 : AddCommGroup.{u2} V] [_inst_3 : Module.{u1, u2} k V (Ring.toSemiring.{u1} k _inst_1) (AddCommGroup.toAddCommMonoid.{u2} V _inst_2)] [_inst_4 : AddTorsor.{u2, u3} V P (AddCommGroup.toAddGroup.{u2} V _inst_2)] (r : k) (p₁ : P) (p₂ : P), Membership.Mem.{u3, u3} P (AffineSubspace.{u1, u2, u3} k V P _inst_1 _inst_2 _inst_3 _inst_4) (SetLike.hasMem.{u3, u3} (AffineSubspace.{u1, u2, u3} k V P _inst_1 _inst_2 _inst_3 _inst_4) P (AffineSubspace.setLike.{u1, u2, u3} k V P _inst_1 _inst_2 _inst_3 _inst_4)) (coeFn.{max (succ u1) (succ u2) (succ u3), max (succ u1) (succ u3)} (AffineMap.{u1, u1, u1, u2, u3} k k k V P _inst_1 (NonUnitalNonAssocRing.toAddCommGroup.{u1} k (NonAssocRing.toNonUnitalNonAssocRing.{u1} k (Ring.toNonAssocRing.{u1} k _inst_1))) (Semiring.toModule.{u1} k (Ring.toSemiring.{u1} k _inst_1)) (addGroupIsAddTorsor.{u1} k (AddGroupWithOne.toAddGroup.{u1} k (AddCommGroupWithOne.toAddGroupWithOne.{u1} k (Ring.toAddCommGroupWithOne.{u1} k _inst_1)))) _inst_2 _inst_3 _inst_4) (fun (_x : AffineMap.{u1, u1, u1, u2, u3} k k k V P _inst_1 (NonUnitalNonAssocRing.toAddCommGroup.{u1} k (NonAssocRing.toNonUnitalNonAssocRing.{u1} k (Ring.toNonAssocRing.{u1} k _inst_1))) (Semiring.toModule.{u1} k (Ring.toSemiring.{u1} k _inst_1)) (addGroupIsAddTorsor.{u1} k (AddGroupWithOne.toAddGroup.{u1} k (AddCommGroupWithOne.toAddGroupWithOne.{u1} k (Ring.toAddCommGroupWithOne.{u1} k _inst_1)))) _inst_2 _inst_3 _inst_4) => k -> P) (AffineMap.hasCoeToFun.{u1, u1, u1, u2, u3} k k k V P _inst_1 (NonUnitalNonAssocRing.toAddCommGroup.{u1} k (NonAssocRing.toNonUnitalNonAssocRing.{u1} k (Ring.toNonAssocRing.{u1} k _inst_1))) (Semiring.toModule.{u1} k (Ring.toSemiring.{u1} k _inst_1)) (addGroupIsAddTorsor.{u1} k (AddGroupWithOne.toAddGroup.{u1} k (AddCommGroupWithOne.toAddGroupWithOne.{u1} k (Ring.toAddCommGroupWithOne.{u1} k _inst_1)))) _inst_2 _inst_3 _inst_4) (AffineMap.lineMap.{u1, u2, u3} k V P _inst_1 _inst_2 _inst_3 _inst_4 p₁ p₂) r) (affineSpan.{u1, u2, u3} k V P _inst_1 _inst_2 _inst_3 _inst_4 (Insert.insert.{u3, u3} P (Set.{u3} P) (Set.hasInsert.{u3} P) p₁ (Singleton.singleton.{u3, u3} P (Set.{u3} P) (Set.hasSingleton.{u3} P) p₂))) but is expected to have type forall {k : Type.{u2}} {V : Type.{u1}} {P : Type.{u3}} [_inst_1 : Ring.{u2} k] [_inst_2 : AddCommGroup.{u1} V] [_inst_3 : Module.{u2, u1} k V (Ring.toSemiring.{u2} k _inst_1) (AddCommGroup.toAddCommMonoid.{u1} V _inst_2)] [_inst_4 : AddTorsor.{u1, u3} V P (AddCommGroup.toAddGroup.{u1} V _inst_2)] (r : k) (p₁ : P) (p₂ : P), Membership.mem.{u3, u3} ((fun ([email protected]._hyg.1004 : k) => P) r) (AffineSubspace.{u2, u1, u3} k V P _inst_1 _inst_2 _inst_3 _inst_4) (SetLike.instMembership.{u3, u3} (AffineSubspace.{u2, u1, u3} k V P _inst_1 _inst_2 _inst_3 _inst_4) P (AffineSubspace.instSetLikeAffineSubspace.{u2, u1, u3} k V P _inst_1 _inst_2 _inst_3 _inst_4)) (FunLike.coe.{max (max (succ u2) (succ u1)) (succ u3), succ u2, succ u3} (AffineMap.{u2, u2, u2, u1, u3} k k k V P _inst_1 (Ring.toAddCommGroup.{u2} k _inst_1) (AffineMap.instModuleToSemiringToAddCommMonoidToNonUnitalNonAssocSemiringToNonUnitalNonAssocRingToNonUnitalRing.{u2} k _inst_1) (addGroupIsAddTorsor.{u2} k (AddGroupWithOne.toAddGroup.{u2} k (Ring.toAddGroupWithOne.{u2} k _inst_1))) _inst_2 _inst_3 _inst_4) k (fun (_x : k) => (fun ([email protected]._hyg.1004 : k) => P) _x) (AffineMap.funLike.{u2, u2, u2, u1, u3} k k k V P _inst_1 (Ring.toAddCommGroup.{u2} k _inst_1) (AffineMap.instModuleToSemiringToAddCommMonoidToNonUnitalNonAssocSemiringToNonUnitalNonAssocRingToNonUnitalRing.{u2} k _inst_1) (addGroupIsAddTorsor.{u2} k (AddGroupWithOne.toAddGroup.{u2} k (Ring.toAddGroupWithOne.{u2} k _inst_1))) _inst_2 _inst_3 _inst_4) (AffineMap.lineMap.{u2, u1, u3} k V P _inst_1 _inst_2 _inst_3 _inst_4 p₁ p₂) r) (affineSpan.{u2, u1, u3} k V P _inst_1 _inst_2 _inst_3 _inst_4 (Insert.insert.{u3, u3} P (Set.{u3} P) (Set.instInsertSet.{u3} P) p₁ (Singleton.singleton.{u3, u3} P (Set.{u3} P) (Set.instSingletonSet.{u3} P) p₂))) Case conversion may be inaccurate. Consider using '#align affine_map.line_map_mem_affine_span_pair AffineMap.lineMap_mem_affineSpan_pairₓ'. -/ /-- A combination of two points expressed with `line_map` lies in their affine span. -/ theorem AffineMap.lineMap_mem_affineSpan_pair (r : k) (p₁ p₂ : P) : AffineMap.lineMap p₁ p₂ r ∈ line[k, p₁, p₂] := AffineMap.lineMap_mem _ (left_mem_affineSpan_pair _ _ _) (right_mem_affineSpan_pair _ _ _) #align affine_map.line_map_mem_affine_span_pair AffineMap.lineMap_mem_affineSpan_pair /- warning: affine_map.line_map_rev_mem_affine_span_pair -> AffineMap.lineMap_rev_mem_affineSpan_pair is a dubious translation: lean 3 declaration is forall {k : Type.{u1}} {V : Type.{u2}} {P : Type.{u3}} [_inst_1 : Ring.{u1} k] [_inst_2 : AddCommGroup.{u2} V] [_inst_3 : Module.{u1, u2} k V (Ring.toSemiring.{u1} k _inst_1) (AddCommGroup.toAddCommMonoid.{u2} V _inst_2)] [_inst_4 : AddTorsor.{u2, u3} V P (AddCommGroup.toAddGroup.{u2} V _inst_2)] (r : k) (p₁ : P) (p₂ : P), Membership.Mem.{u3, u3} P (AffineSubspace.{u1, u2, u3} k V P _inst_1 _inst_2 _inst_3 _inst_4) (SetLike.hasMem.{u3, u3} (AffineSubspace.{u1, u2, u3} k V P _inst_1 _inst_2 _inst_3 _inst_4) P (AffineSubspace.setLike.{u1, u2, u3} k V P _inst_1 _inst_2 _inst_3 _inst_4)) (coeFn.{max (succ u1) (succ u2) (succ u3), max (succ u1) (succ u3)} (AffineMap.{u1, u1, u1, u2, u3} k k k V P _inst_1 (NonUnitalNonAssocRing.toAddCommGroup.{u1} k (NonAssocRing.toNonUnitalNonAssocRing.{u1} k (Ring.toNonAssocRing.{u1} k _inst_1))) (Semiring.toModule.{u1} k (Ring.toSemiring.{u1} k _inst_1)) (addGroupIsAddTorsor.{u1} k (AddGroupWithOne.toAddGroup.{u1} k (AddCommGroupWithOne.toAddGroupWithOne.{u1} k (Ring.toAddCommGroupWithOne.{u1} k _inst_1)))) _inst_2 _inst_3 _inst_4) (fun (_x : AffineMap.{u1, u1, u1, u2, u3} k k k V P _inst_1 (NonUnitalNonAssocRing.toAddCommGroup.{u1} k (NonAssocRing.toNonUnitalNonAssocRing.{u1} k (Ring.toNonAssocRing.{u1} k _inst_1))) (Semiring.toModule.{u1} k (Ring.toSemiring.{u1} k _inst_1)) (addGroupIsAddTorsor.{u1} k (AddGroupWithOne.toAddGroup.{u1} k (AddCommGroupWithOne.toAddGroupWithOne.{u1} k (Ring.toAddCommGroupWithOne.{u1} k _inst_1)))) _inst_2 _inst_3 _inst_4) => k -> P) (AffineMap.hasCoeToFun.{u1, u1, u1, u2, u3} k k k V P _inst_1 (NonUnitalNonAssocRing.toAddCommGroup.{u1} k (NonAssocRing.toNonUnitalNonAssocRing.{u1} k (Ring.toNonAssocRing.{u1} k _inst_1))) (Semiring.toModule.{u1} k (Ring.toSemiring.{u1} k _inst_1)) (addGroupIsAddTorsor.{u1} k (AddGroupWithOne.toAddGroup.{u1} k (AddCommGroupWithOne.toAddGroupWithOne.{u1} k (Ring.toAddCommGroupWithOne.{u1} k _inst_1)))) _inst_2 _inst_3 _inst_4) (AffineMap.lineMap.{u1, u2, u3} k V P _inst_1 _inst_2 _inst_3 _inst_4 p₂ p₁) r) (affineSpan.{u1, u2, u3} k V P _inst_1 _inst_2 _inst_3 _inst_4 (Insert.insert.{u3, u3} P (Set.{u3} P) (Set.hasInsert.{u3} P) p₁ (Singleton.singleton.{u3, u3} P (Set.{u3} P) (Set.hasSingleton.{u3} P) p₂))) but is expected to have type forall {k : Type.{u2}} {V : Type.{u1}} {P : Type.{u3}} [_inst_1 : Ring.{u2} k] [_inst_2 : AddCommGroup.{u1} V] [_inst_3 : Module.{u2, u1} k V (Ring.toSemiring.{u2} k _inst_1) (AddCommGroup.toAddCommMonoid.{u1} V _inst_2)] [_inst_4 : AddTorsor.{u1, u3} V P (AddCommGroup.toAddGroup.{u1} V _inst_2)] (r : k) (p₁ : P) (p₂ : P), Membership.mem.{u3, u3} ((fun ([email protected]._hyg.1004 : k) => P) r) (AffineSubspace.{u2, u1, u3} k V P _inst_1 _inst_2 _inst_3 _inst_4) (SetLike.instMembership.{u3, u3} (AffineSubspace.{u2, u1, u3} k V P _inst_1 _inst_2 _inst_3 _inst_4) P (AffineSubspace.instSetLikeAffineSubspace.{u2, u1, u3} k V P _inst_1 _inst_2 _inst_3 _inst_4)) (FunLike.coe.{max (max (succ u2) (succ u1)) (succ u3), succ u2, succ u3} (AffineMap.{u2, u2, u2, u1, u3} k k k V P _inst_1 (Ring.toAddCommGroup.{u2} k _inst_1) (AffineMap.instModuleToSemiringToAddCommMonoidToNonUnitalNonAssocSemiringToNonUnitalNonAssocRingToNonUnitalRing.{u2} k _inst_1) (addGroupIsAddTorsor.{u2} k (AddGroupWithOne.toAddGroup.{u2} k (Ring.toAddGroupWithOne.{u2} k _inst_1))) _inst_2 _inst_3 _inst_4) k (fun (_x : k) => (fun ([email protected]._hyg.1004 : k) => P) _x) (AffineMap.funLike.{u2, u2, u2, u1, u3} k k k V P _inst_1 (Ring.toAddCommGroup.{u2} k _inst_1) (AffineMap.instModuleToSemiringToAddCommMonoidToNonUnitalNonAssocSemiringToNonUnitalNonAssocRingToNonUnitalRing.{u2} k _inst_1) (addGroupIsAddTorsor.{u2} k (AddGroupWithOne.toAddGroup.{u2} k (Ring.toAddGroupWithOne.{u2} k _inst_1))) _inst_2 _inst_3 _inst_4) (AffineMap.lineMap.{u2, u1, u3} k V P _inst_1 _inst_2 _inst_3 _inst_4 p₂ p₁) r) (affineSpan.{u2, u1, u3} k V P _inst_1 _inst_2 _inst_3 _inst_4 (Insert.insert.{u3, u3} P (Set.{u3} P) (Set.instInsertSet.{u3} P) p₁ (Singleton.singleton.{u3, u3} P (Set.{u3} P) (Set.instSingletonSet.{u3} P) p₂))) Case conversion may be inaccurate. Consider using '#align affine_map.line_map_rev_mem_affine_span_pair AffineMap.lineMap_rev_mem_affineSpan_pairₓ'. -/ /-- A combination of two points expressed with `line_map` (with the two points reversed) lies in their affine span. -/ theorem AffineMap.lineMap_rev_mem_affineSpan_pair (r : k) (p₁ p₂ : P) : AffineMap.lineMap p₂ p₁ r ∈ line[k, p₁, p₂] := AffineMap.lineMap_mem _ (right_mem_affineSpan_pair _ _ _) (left_mem_affineSpan_pair _ _ _) #align affine_map.line_map_rev_mem_affine_span_pair AffineMap.lineMap_rev_mem_affineSpan_pair /- warning: smul_vsub_vadd_mem_affine_span_pair -> smul_vsub_vadd_mem_affineSpan_pair is a dubious translation: lean 3 declaration is forall {k : Type.{u1}} {V : Type.{u2}} {P : Type.{u3}} [_inst_1 : Ring.{u1} k] [_inst_2 : AddCommGroup.{u2} V] [_inst_3 : Module.{u1, u2} k V (Ring.toSemiring.{u1} k _inst_1) (AddCommGroup.toAddCommMonoid.{u2} V _inst_2)] [_inst_4 : AddTorsor.{u2, u3} V P (AddCommGroup.toAddGroup.{u2} V _inst_2)] (r : k) (p₁ : P) (p₂ : P), Membership.Mem.{u3, u3} P (AffineSubspace.{u1, u2, u3} k V P _inst_1 _inst_2 _inst_3 _inst_4) (SetLike.hasMem.{u3, u3} (AffineSubspace.{u1, u2, u3} k V P _inst_1 _inst_2 _inst_3 _inst_4) P (AffineSubspace.setLike.{u1, u2, u3} k V P _inst_1 _inst_2 _inst_3 _inst_4)) (VAdd.vadd.{u2, u3} V P (AddAction.toHasVadd.{u2, u3} V P (SubNegMonoid.toAddMonoid.{u2} V (AddGroup.toSubNegMonoid.{u2} V (AddCommGroup.toAddGroup.{u2} V _inst_2))) (AddTorsor.toAddAction.{u2, u3} V P (AddCommGroup.toAddGroup.{u2} V _inst_2) _inst_4)) (SMul.smul.{u1, u2} k V (SMulZeroClass.toHasSmul.{u1, u2} k V (AddZeroClass.toHasZero.{u2} V (AddMonoid.toAddZeroClass.{u2} V (AddCommMonoid.toAddMonoid.{u2} V (AddCommGroup.toAddCommMonoid.{u2} V _inst_2)))) (SMulWithZero.toSmulZeroClass.{u1, u2} k V (MulZeroClass.toHasZero.{u1} k (MulZeroOneClass.toMulZeroClass.{u1} k (MonoidWithZero.toMulZeroOneClass.{u1} k (Semiring.toMonoidWithZero.{u1} k (Ring.toSemiring.{u1} k _inst_1))))) (AddZeroClass.toHasZero.{u2} V (AddMonoid.toAddZeroClass.{u2} V (AddCommMonoid.toAddMonoid.{u2} V (AddCommGroup.toAddCommMonoid.{u2} V _inst_2)))) (MulActionWithZero.toSMulWithZero.{u1, u2} k V (Semiring.toMonoidWithZero.{u1} k (Ring.toSemiring.{u1} k _inst_1)) (AddZeroClass.toHasZero.{u2} V (AddMonoid.toAddZeroClass.{u2} V (AddCommMonoid.toAddMonoid.{u2} V (AddCommGroup.toAddCommMonoid.{u2} V _inst_2)))) (Module.toMulActionWithZero.{u1, u2} k V (Ring.toSemiring.{u1} k _inst_1) (AddCommGroup.toAddCommMonoid.{u2} V _inst_2) _inst_3)))) r (VSub.vsub.{u2, u3} V P (AddTorsor.toHasVsub.{u2, u3} V P (AddCommGroup.toAddGroup.{u2} V _inst_2) _inst_4) p₂ p₁)) p₁) (affineSpan.{u1, u2, u3} k V P _inst_1 _inst_2 _inst_3 _inst_4 (Insert.insert.{u3, u3} P (Set.{u3} P) (Set.hasInsert.{u3} P) p₁ (Singleton.singleton.{u3, u3} P (Set.{u3} P) (Set.hasSingleton.{u3} P) p₂))) but is expected to have type forall {k : Type.{u2}} {V : Type.{u1}} {P : Type.{u3}} [_inst_1 : Ring.{u2} k] [_inst_2 : AddCommGroup.{u1} V] [_inst_3 : Module.{u2, u1} k V (Ring.toSemiring.{u2} k _inst_1) (AddCommGroup.toAddCommMonoid.{u1} V _inst_2)] [_inst_4 : AddTorsor.{u1, u3} V P (AddCommGroup.toAddGroup.{u1} V _inst_2)] (r : k) (p₁ : P) (p₂ : P), Membership.mem.{u3, u3} P (AffineSubspace.{u2, u1, u3} k V P _inst_1 _inst_2 _inst_3 _inst_4) (SetLike.instMembership.{u3, u3} (AffineSubspace.{u2, u1, u3} k V P _inst_1 _inst_2 _inst_3 _inst_4) P (AffineSubspace.instSetLikeAffineSubspace.{u2, u1, u3} k V P _inst_1 _inst_2 _inst_3 _inst_4)) (HVAdd.hVAdd.{u1, u3, u3} V P P (instHVAdd.{u1, u3} V P (AddAction.toVAdd.{u1, u3} V P (SubNegMonoid.toAddMonoid.{u1} V (AddGroup.toSubNegMonoid.{u1} V (AddCommGroup.toAddGroup.{u1} V _inst_2))) (AddTorsor.toAddAction.{u1, u3} V P (AddCommGroup.toAddGroup.{u1} V _inst_2) _inst_4))) (HSMul.hSMul.{u2, u1, u1} k V V (instHSMul.{u2, u1} k V (SMulZeroClass.toSMul.{u2, u1} k V (NegZeroClass.toZero.{u1} V (SubNegZeroMonoid.toNegZeroClass.{u1} V (SubtractionMonoid.toSubNegZeroMonoid.{u1} V (SubtractionCommMonoid.toSubtractionMonoid.{u1} V (AddCommGroup.toDivisionAddCommMonoid.{u1} V _inst_2))))) (SMulWithZero.toSMulZeroClass.{u2, u1} k V (MonoidWithZero.toZero.{u2} k (Semiring.toMonoidWithZero.{u2} k (Ring.toSemiring.{u2} k _inst_1))) (NegZeroClass.toZero.{u1} V (SubNegZeroMonoid.toNegZeroClass.{u1} V (SubtractionMonoid.toSubNegZeroMonoid.{u1} V (SubtractionCommMonoid.toSubtractionMonoid.{u1} V (AddCommGroup.toDivisionAddCommMonoid.{u1} V _inst_2))))) (MulActionWithZero.toSMulWithZero.{u2, u1} k V (Semiring.toMonoidWithZero.{u2} k (Ring.toSemiring.{u2} k _inst_1)) (NegZeroClass.toZero.{u1} V (SubNegZeroMonoid.toNegZeroClass.{u1} V (SubtractionMonoid.toSubNegZeroMonoid.{u1} V (SubtractionCommMonoid.toSubtractionMonoid.{u1} V (AddCommGroup.toDivisionAddCommMonoid.{u1} V _inst_2))))) (Module.toMulActionWithZero.{u2, u1} k V (Ring.toSemiring.{u2} k _inst_1) (AddCommGroup.toAddCommMonoid.{u1} V _inst_2) _inst_3))))) r (VSub.vsub.{u1, u3} V P (AddTorsor.toVSub.{u1, u3} V P (AddCommGroup.toAddGroup.{u1} V _inst_2) _inst_4) p₂ p₁)) p₁) (affineSpan.{u2, u1, u3} k V P _inst_1 _inst_2 _inst_3 _inst_4 (Insert.insert.{u3, u3} P (Set.{u3} P) (Set.instInsertSet.{u3} P) p₁ (Singleton.singleton.{u3, u3} P (Set.{u3} P) (Set.instSingletonSet.{u3} P) p₂))) Case conversion may be inaccurate. Consider using '#align smul_vsub_vadd_mem_affine_span_pair smul_vsub_vadd_mem_affineSpan_pairₓ'. -/ /-- A multiple of the difference of two points added to the first point lies in their affine span. -/ theorem smul_vsub_vadd_mem_affineSpan_pair (r : k) (p₁ p₂ : P) : r • (p₂ -ᵥ p₁) +ᵥ p₁ ∈ line[k, p₁, p₂] := AffineMap.lineMap_mem_affineSpan_pair _ _ _ #align smul_vsub_vadd_mem_affine_span_pair smul_vsub_vadd_mem_affineSpan_pair /- warning: smul_vsub_rev_vadd_mem_affine_span_pair -> smul_vsub_rev_vadd_mem_affineSpan_pair is a dubious translation: lean 3 declaration is forall {k : Type.{u1}} {V : Type.{u2}} {P : Type.{u3}} [_inst_1 : Ring.{u1} k] [_inst_2 : AddCommGroup.{u2} V] [_inst_3 : Module.{u1, u2} k V (Ring.toSemiring.{u1} k _inst_1) (AddCommGroup.toAddCommMonoid.{u2} V _inst_2)] [_inst_4 : AddTorsor.{u2, u3} V P (AddCommGroup.toAddGroup.{u2} V _inst_2)] (r : k) (p₁ : P) (p₂ : P), Membership.Mem.{u3, u3} P (AffineSubspace.{u1, u2, u3} k V P _inst_1 _inst_2 _inst_3 _inst_4) (SetLike.hasMem.{u3, u3} (AffineSubspace.{u1, u2, u3} k V P _inst_1 _inst_2 _inst_3 _inst_4) P (AffineSubspace.setLike.{u1, u2, u3} k V P _inst_1 _inst_2 _inst_3 _inst_4)) (VAdd.vadd.{u2, u3} V P (AddAction.toHasVadd.{u2, u3} V P (SubNegMonoid.toAddMonoid.{u2} V (AddGroup.toSubNegMonoid.{u2} V (AddCommGroup.toAddGroup.{u2} V _inst_2))) (AddTorsor.toAddAction.{u2, u3} V P (AddCommGroup.toAddGroup.{u2} V _inst_2) _inst_4)) (SMul.smul.{u1, u2} k V (SMulZeroClass.toHasSmul.{u1, u2} k V (AddZeroClass.toHasZero.{u2} V (AddMonoid.toAddZeroClass.{u2} V (AddCommMonoid.toAddMonoid.{u2} V (AddCommGroup.toAddCommMonoid.{u2} V _inst_2)))) (SMulWithZero.toSmulZeroClass.{u1, u2} k V (MulZeroClass.toHasZero.{u1} k (MulZeroOneClass.toMulZeroClass.{u1} k (MonoidWithZero.toMulZeroOneClass.{u1} k (Semiring.toMonoidWithZero.{u1} k (Ring.toSemiring.{u1} k _inst_1))))) (AddZeroClass.toHasZero.{u2} V (AddMonoid.toAddZeroClass.{u2} V (AddCommMonoid.toAddMonoid.{u2} V (AddCommGroup.toAddCommMonoid.{u2} V _inst_2)))) (MulActionWithZero.toSMulWithZero.{u1, u2} k V (Semiring.toMonoidWithZero.{u1} k (Ring.toSemiring.{u1} k _inst_1)) (AddZeroClass.toHasZero.{u2} V (AddMonoid.toAddZeroClass.{u2} V (AddCommMonoid.toAddMonoid.{u2} V (AddCommGroup.toAddCommMonoid.{u2} V _inst_2)))) (Module.toMulActionWithZero.{u1, u2} k V (Ring.toSemiring.{u1} k _inst_1) (AddCommGroup.toAddCommMonoid.{u2} V _inst_2) _inst_3)))) r (VSub.vsub.{u2, u3} V P (AddTorsor.toHasVsub.{u2, u3} V P (AddCommGroup.toAddGroup.{u2} V _inst_2) _inst_4) p₁ p₂)) p₂) (affineSpan.{u1, u2, u3} k V P _inst_1 _inst_2 _inst_3 _inst_4 (Insert.insert.{u3, u3} P (Set.{u3} P) (Set.hasInsert.{u3} P) p₁ (Singleton.singleton.{u3, u3} P (Set.{u3} P) (Set.hasSingleton.{u3} P) p₂))) but is expected to have type forall {k : Type.{u2}} {V : Type.{u1}} {P : Type.{u3}} [_inst_1 : Ring.{u2} k] [_inst_2 : AddCommGroup.{u1} V] [_inst_3 : Module.{u2, u1} k V (Ring.toSemiring.{u2} k _inst_1) (AddCommGroup.toAddCommMonoid.{u1} V _inst_2)] [_inst_4 : AddTorsor.{u1, u3} V P (AddCommGroup.toAddGroup.{u1} V _inst_2)] (r : k) (p₁ : P) (p₂ : P), Membership.mem.{u3, u3} P (AffineSubspace.{u2, u1, u3} k V P _inst_1 _inst_2 _inst_3 _inst_4) (SetLike.instMembership.{u3, u3} (AffineSubspace.{u2, u1, u3} k V P _inst_1 _inst_2 _inst_3 _inst_4) P (AffineSubspace.instSetLikeAffineSubspace.{u2, u1, u3} k V P _inst_1 _inst_2 _inst_3 _inst_4)) (HVAdd.hVAdd.{u1, u3, u3} V P P (instHVAdd.{u1, u3} V P (AddAction.toVAdd.{u1, u3} V P (SubNegMonoid.toAddMonoid.{u1} V (AddGroup.toSubNegMonoid.{u1} V (AddCommGroup.toAddGroup.{u1} V _inst_2))) (AddTorsor.toAddAction.{u1, u3} V P (AddCommGroup.toAddGroup.{u1} V _inst_2) _inst_4))) (HSMul.hSMul.{u2, u1, u1} k V V (instHSMul.{u2, u1} k V (SMulZeroClass.toSMul.{u2, u1} k V (NegZeroClass.toZero.{u1} V (SubNegZeroMonoid.toNegZeroClass.{u1} V (SubtractionMonoid.toSubNegZeroMonoid.{u1} V (SubtractionCommMonoid.toSubtractionMonoid.{u1} V (AddCommGroup.toDivisionAddCommMonoid.{u1} V _inst_2))))) (SMulWithZero.toSMulZeroClass.{u2, u1} k V (MonoidWithZero.toZero.{u2} k (Semiring.toMonoidWithZero.{u2} k (Ring.toSemiring.{u2} k _inst_1))) (NegZeroClass.toZero.{u1} V (SubNegZeroMonoid.toNegZeroClass.{u1} V (SubtractionMonoid.toSubNegZeroMonoid.{u1} V (SubtractionCommMonoid.toSubtractionMonoid.{u1} V (AddCommGroup.toDivisionAddCommMonoid.{u1} V _inst_2))))) (MulActionWithZero.toSMulWithZero.{u2, u1} k V (Semiring.toMonoidWithZero.{u2} k (Ring.toSemiring.{u2} k _inst_1)) (NegZeroClass.toZero.{u1} V (SubNegZeroMonoid.toNegZeroClass.{u1} V (SubtractionMonoid.toSubNegZeroMonoid.{u1} V (SubtractionCommMonoid.toSubtractionMonoid.{u1} V (AddCommGroup.toDivisionAddCommMonoid.{u1} V _inst_2))))) (Module.toMulActionWithZero.{u2, u1} k V (Ring.toSemiring.{u2} k _inst_1) (AddCommGroup.toAddCommMonoid.{u1} V _inst_2) _inst_3))))) r (VSub.vsub.{u1, u3} V P (AddTorsor.toVSub.{u1, u3} V P (AddCommGroup.toAddGroup.{u1} V _inst_2) _inst_4) p₁ p₂)) p₂) (affineSpan.{u2, u1, u3} k V P _inst_1 _inst_2 _inst_3 _inst_4 (Insert.insert.{u3, u3} P (Set.{u3} P) (Set.instInsertSet.{u3} P) p₁ (Singleton.singleton.{u3, u3} P (Set.{u3} P) (Set.instSingletonSet.{u3} P) p₂))) Case conversion may be inaccurate. Consider using '#align smul_vsub_rev_vadd_mem_affine_span_pair smul_vsub_rev_vadd_mem_affineSpan_pairₓ'. -/ /-- A multiple of the difference of two points added to the second point lies in their affine span. -/ theorem smul_vsub_rev_vadd_mem_affineSpan_pair (r : k) (p₁ p₂ : P) : r • (p₁ -ᵥ p₂) +ᵥ p₂ ∈ line[k, p₁, p₂] := AffineMap.lineMap_rev_mem_affineSpan_pair _ _ _ #align smul_vsub_rev_vadd_mem_affine_span_pair smul_vsub_rev_vadd_mem_affineSpan_pair /- warning: vadd_left_mem_affine_span_pair -> vadd_left_mem_affineSpan_pair is a dubious translation: lean 3 declaration is forall {k : Type.{u1}} {V : Type.{u2}} {P : Type.{u3}} [_inst_1 : Ring.{u1} k] [_inst_2 : AddCommGroup.{u2} V] [_inst_3 : Module.{u1, u2} k V (Ring.toSemiring.{u1} k _inst_1) (AddCommGroup.toAddCommMonoid.{u2} V _inst_2)] [_inst_4 : AddTorsor.{u2, u3} V P (AddCommGroup.toAddGroup.{u2} V _inst_2)] {p₁ : P} {p₂ : P} {v : V}, Iff (Membership.Mem.{u3, u3} P (AffineSubspace.{u1, u2, u3} k V P _inst_1 _inst_2 _inst_3 _inst_4) (SetLike.hasMem.{u3, u3} (AffineSubspace.{u1, u2, u3} k V P _inst_1 _inst_2 _inst_3 _inst_4) P (AffineSubspace.setLike.{u1, u2, u3} k V P _inst_1 _inst_2 _inst_3 _inst_4)) (VAdd.vadd.{u2, u3} V P (AddAction.toHasVadd.{u2, u3} V P (SubNegMonoid.toAddMonoid.{u2} V (AddGroup.toSubNegMonoid.{u2} V (AddCommGroup.toAddGroup.{u2} V _inst_2))) (AddTorsor.toAddAction.{u2, u3} V P (AddCommGroup.toAddGroup.{u2} V _inst_2) _inst_4)) v p₁) (affineSpan.{u1, u2, u3} k V P _inst_1 _inst_2 _inst_3 _inst_4 (Insert.insert.{u3, u3} P (Set.{u3} P) (Set.hasInsert.{u3} P) p₁ (Singleton.singleton.{u3, u3} P (Set.{u3} P) (Set.hasSingleton.{u3} P) p₂)))) (Exists.{succ u1} k (fun (r : k) => Eq.{succ u2} V (SMul.smul.{u1, u2} k V (SMulZeroClass.toHasSmul.{u1, u2} k V (AddZeroClass.toHasZero.{u2} V (AddMonoid.toAddZeroClass.{u2} V (AddCommMonoid.toAddMonoid.{u2} V (AddCommGroup.toAddCommMonoid.{u2} V _inst_2)))) (SMulWithZero.toSmulZeroClass.{u1, u2} k V (MulZeroClass.toHasZero.{u1} k (MulZeroOneClass.toMulZeroClass.{u1} k (MonoidWithZero.toMulZeroOneClass.{u1} k (Semiring.toMonoidWithZero.{u1} k (Ring.toSemiring.{u1} k _inst_1))))) (AddZeroClass.toHasZero.{u2} V (AddMonoid.toAddZeroClass.{u2} V (AddCommMonoid.toAddMonoid.{u2} V (AddCommGroup.toAddCommMonoid.{u2} V _inst_2)))) (MulActionWithZero.toSMulWithZero.{u1, u2} k V (Semiring.toMonoidWithZero.{u1} k (Ring.toSemiring.{u1} k _inst_1)) (AddZeroClass.toHasZero.{u2} V (AddMonoid.toAddZeroClass.{u2} V (AddCommMonoid.toAddMonoid.{u2} V (AddCommGroup.toAddCommMonoid.{u2} V _inst_2)))) (Module.toMulActionWithZero.{u1, u2} k V (Ring.toSemiring.{u1} k _inst_1) (AddCommGroup.toAddCommMonoid.{u2} V _inst_2) _inst_3)))) r (VSub.vsub.{u2, u3} V P (AddTorsor.toHasVsub.{u2, u3} V P (AddCommGroup.toAddGroup.{u2} V _inst_2) _inst_4) p₂ p₁)) v)) but is expected to have type forall {k : Type.{u2}} {V : Type.{u1}} {P : Type.{u3}} [_inst_1 : Ring.{u2} k] [_inst_2 : AddCommGroup.{u1} V] [_inst_3 : Module.{u2, u1} k V (Ring.toSemiring.{u2} k _inst_1) (AddCommGroup.toAddCommMonoid.{u1} V _inst_2)] [_inst_4 : AddTorsor.{u1, u3} V P (AddCommGroup.toAddGroup.{u1} V _inst_2)] {p₁ : P} {p₂ : P} {v : V}, Iff (Membership.mem.{u3, u3} P (AffineSubspace.{u2, u1, u3} k V P _inst_1 _inst_2 _inst_3 _inst_4) (SetLike.instMembership.{u3, u3} (AffineSubspace.{u2, u1, u3} k V P _inst_1 _inst_2 _inst_3 _inst_4) P (AffineSubspace.instSetLikeAffineSubspace.{u2, u1, u3} k V P _inst_1 _inst_2 _inst_3 _inst_4)) (HVAdd.hVAdd.{u1, u3, u3} V P P (instHVAdd.{u1, u3} V P (AddAction.toVAdd.{u1, u3} V P (SubNegMonoid.toAddMonoid.{u1} V (AddGroup.toSubNegMonoid.{u1} V (AddCommGroup.toAddGroup.{u1} V _inst_2))) (AddTorsor.toAddAction.{u1, u3} V P (AddCommGroup.toAddGroup.{u1} V _inst_2) _inst_4))) v p₁) (affineSpan.{u2, u1, u3} k V P _inst_1 _inst_2 _inst_3 _inst_4 (Insert.insert.{u3, u3} P (Set.{u3} P) (Set.instInsertSet.{u3} P) p₁ (Singleton.singleton.{u3, u3} P (Set.{u3} P) (Set.instSingletonSet.{u3} P) p₂)))) (Exists.{succ u2} k (fun (r : k) => Eq.{succ u1} V (HSMul.hSMul.{u2, u1, u1} k V V (instHSMul.{u2, u1} k V (SMulZeroClass.toSMul.{u2, u1} k V (NegZeroClass.toZero.{u1} V (SubNegZeroMonoid.toNegZeroClass.{u1} V (SubtractionMonoid.toSubNegZeroMonoid.{u1} V (SubtractionCommMonoid.toSubtractionMonoid.{u1} V (AddCommGroup.toDivisionAddCommMonoid.{u1} V _inst_2))))) (SMulWithZero.toSMulZeroClass.{u2, u1} k V (MonoidWithZero.toZero.{u2} k (Semiring.toMonoidWithZero.{u2} k (Ring.toSemiring.{u2} k _inst_1))) (NegZeroClass.toZero.{u1} V (SubNegZeroMonoid.toNegZeroClass.{u1} V (SubtractionMonoid.toSubNegZeroMonoid.{u1} V (SubtractionCommMonoid.toSubtractionMonoid.{u1} V (AddCommGroup.toDivisionAddCommMonoid.{u1} V _inst_2))))) (MulActionWithZero.toSMulWithZero.{u2, u1} k V (Semiring.toMonoidWithZero.{u2} k (Ring.toSemiring.{u2} k _inst_1)) (NegZeroClass.toZero.{u1} V (SubNegZeroMonoid.toNegZeroClass.{u1} V (SubtractionMonoid.toSubNegZeroMonoid.{u1} V (SubtractionCommMonoid.toSubtractionMonoid.{u1} V (AddCommGroup.toDivisionAddCommMonoid.{u1} V _inst_2))))) (Module.toMulActionWithZero.{u2, u1} k V (Ring.toSemiring.{u2} k _inst_1) (AddCommGroup.toAddCommMonoid.{u1} V _inst_2) _inst_3))))) r (VSub.vsub.{u1, u3} V P (AddTorsor.toVSub.{u1, u3} V P (AddCommGroup.toAddGroup.{u1} V _inst_2) _inst_4) p₂ p₁)) v)) Case conversion may be inaccurate. Consider using '#align vadd_left_mem_affine_span_pair vadd_left_mem_affineSpan_pairₓ'. -/ /-- A vector added to the first point lies in the affine span of two points if and only if it is a multiple of their difference. -/ theorem vadd_left_mem_affineSpan_pair {p₁ p₂ : P} {v : V} : v +ᵥ p₁ ∈ line[k, p₁, p₂] ↔ ∃ r : k, r • (p₂ -ᵥ p₁) = v := by rw [vadd_mem_iff_mem_direction _ (left_mem_affineSpan_pair _ _ _), direction_affineSpan, mem_vectorSpan_pair_rev] #align vadd_left_mem_affine_span_pair vadd_left_mem_affineSpan_pair /- warning: vadd_right_mem_affine_span_pair -> vadd_right_mem_affineSpan_pair is a dubious translation: lean 3 declaration is forall {k : Type.{u1}} {V : Type.{u2}} {P : Type.{u3}} [_inst_1 : Ring.{u1} k] [_inst_2 : AddCommGroup.{u2} V] [_inst_3 : Module.{u1, u2} k V (Ring.toSemiring.{u1} k _inst_1) (AddCommGroup.toAddCommMonoid.{u2} V _inst_2)] [_inst_4 : AddTorsor.{u2, u3} V P (AddCommGroup.toAddGroup.{u2} V _inst_2)] {p₁ : P} {p₂ : P} {v : V}, Iff (Membership.Mem.{u3, u3} P (AffineSubspace.{u1, u2, u3} k V P _inst_1 _inst_2 _inst_3 _inst_4) (SetLike.hasMem.{u3, u3} (AffineSubspace.{u1, u2, u3} k V P _inst_1 _inst_2 _inst_3 _inst_4) P (AffineSubspace.setLike.{u1, u2, u3} k V P _inst_1 _inst_2 _inst_3 _inst_4)) (VAdd.vadd.{u2, u3} V P (AddAction.toHasVadd.{u2, u3} V P (SubNegMonoid.toAddMonoid.{u2} V (AddGroup.toSubNegMonoid.{u2} V (AddCommGroup.toAddGroup.{u2} V _inst_2))) (AddTorsor.toAddAction.{u2, u3} V P (AddCommGroup.toAddGroup.{u2} V _inst_2) _inst_4)) v p₂) (affineSpan.{u1, u2, u3} k V P _inst_1 _inst_2 _inst_3 _inst_4 (Insert.insert.{u3, u3} P (Set.{u3} P) (Set.hasInsert.{u3} P) p₁ (Singleton.singleton.{u3, u3} P (Set.{u3} P) (Set.hasSingleton.{u3} P) p₂)))) (Exists.{succ u1} k (fun (r : k) => Eq.{succ u2} V (SMul.smul.{u1, u2} k V (SMulZeroClass.toHasSmul.{u1, u2} k V (AddZeroClass.toHasZero.{u2} V (AddMonoid.toAddZeroClass.{u2} V (AddCommMonoid.toAddMonoid.{u2} V (AddCommGroup.toAddCommMonoid.{u2} V _inst_2)))) (SMulWithZero.toSmulZeroClass.{u1, u2} k V (MulZeroClass.toHasZero.{u1} k (MulZeroOneClass.toMulZeroClass.{u1} k (MonoidWithZero.toMulZeroOneClass.{u1} k (Semiring.toMonoidWithZero.{u1} k (Ring.toSemiring.{u1} k _inst_1))))) (AddZeroClass.toHasZero.{u2} V (AddMonoid.toAddZeroClass.{u2} V (AddCommMonoid.toAddMonoid.{u2} V (AddCommGroup.toAddCommMonoid.{u2} V _inst_2)))) (MulActionWithZero.toSMulWithZero.{u1, u2} k V (Semiring.toMonoidWithZero.{u1} k (Ring.toSemiring.{u1} k _inst_1)) (AddZeroClass.toHasZero.{u2} V (AddMonoid.toAddZeroClass.{u2} V (AddCommMonoid.toAddMonoid.{u2} V (AddCommGroup.toAddCommMonoid.{u2} V _inst_2)))) (Module.toMulActionWithZero.{u1, u2} k V (Ring.toSemiring.{u1} k _inst_1) (AddCommGroup.toAddCommMonoid.{u2} V _inst_2) _inst_3)))) r (VSub.vsub.{u2, u3} V P (AddTorsor.toHasVsub.{u2, u3} V P (AddCommGroup.toAddGroup.{u2} V _inst_2) _inst_4) p₁ p₂)) v)) but is expected to have type forall {k : Type.{u2}} {V : Type.{u1}} {P : Type.{u3}} [_inst_1 : Ring.{u2} k] [_inst_2 : AddCommGroup.{u1} V] [_inst_3 : Module.{u2, u1} k V (Ring.toSemiring.{u2} k _inst_1) (AddCommGroup.toAddCommMonoid.{u1} V _inst_2)] [_inst_4 : AddTorsor.{u1, u3} V P (AddCommGroup.toAddGroup.{u1} V _inst_2)] {p₁ : P} {p₂ : P} {v : V}, Iff (Membership.mem.{u3, u3} P (AffineSubspace.{u2, u1, u3} k V P _inst_1 _inst_2 _inst_3 _inst_4) (SetLike.instMembership.{u3, u3} (AffineSubspace.{u2, u1, u3} k V P _inst_1 _inst_2 _inst_3 _inst_4) P (AffineSubspace.instSetLikeAffineSubspace.{u2, u1, u3} k V P _inst_1 _inst_2 _inst_3 _inst_4)) (HVAdd.hVAdd.{u1, u3, u3} V P P (instHVAdd.{u1, u3} V P (AddAction.toVAdd.{u1, u3} V P (SubNegMonoid.toAddMonoid.{u1} V (AddGroup.toSubNegMonoid.{u1} V (AddCommGroup.toAddGroup.{u1} V _inst_2))) (AddTorsor.toAddAction.{u1, u3} V P (AddCommGroup.toAddGroup.{u1} V _inst_2) _inst_4))) v p₂) (affineSpan.{u2, u1, u3} k V P _inst_1 _inst_2 _inst_3 _inst_4 (Insert.insert.{u3, u3} P (Set.{u3} P) (Set.instInsertSet.{u3} P) p₁ (Singleton.singleton.{u3, u3} P (Set.{u3} P) (Set.instSingletonSet.{u3} P) p₂)))) (Exists.{succ u2} k (fun (r : k) => Eq.{succ u1} V (HSMul.hSMul.{u2, u1, u1} k V V (instHSMul.{u2, u1} k V (SMulZeroClass.toSMul.{u2, u1} k V (NegZeroClass.toZero.{u1} V (SubNegZeroMonoid.toNegZeroClass.{u1} V (SubtractionMonoid.toSubNegZeroMonoid.{u1} V (SubtractionCommMonoid.toSubtractionMonoid.{u1} V (AddCommGroup.toDivisionAddCommMonoid.{u1} V _inst_2))))) (SMulWithZero.toSMulZeroClass.{u2, u1} k V (MonoidWithZero.toZero.{u2} k (Semiring.toMonoidWithZero.{u2} k (Ring.toSemiring.{u2} k _inst_1))) (NegZeroClass.toZero.{u1} V (SubNegZeroMonoid.toNegZeroClass.{u1} V (SubtractionMonoid.toSubNegZeroMonoid.{u1} V (SubtractionCommMonoid.toSubtractionMonoid.{u1} V (AddCommGroup.toDivisionAddCommMonoid.{u1} V _inst_2))))) (MulActionWithZero.toSMulWithZero.{u2, u1} k V (Semiring.toMonoidWithZero.{u2} k (Ring.toSemiring.{u2} k _inst_1)) (NegZeroClass.toZero.{u1} V (SubNegZeroMonoid.toNegZeroClass.{u1} V (SubtractionMonoid.toSubNegZeroMonoid.{u1} V (SubtractionCommMonoid.toSubtractionMonoid.{u1} V (AddCommGroup.toDivisionAddCommMonoid.{u1} V _inst_2))))) (Module.toMulActionWithZero.{u2, u1} k V (Ring.toSemiring.{u2} k _inst_1) (AddCommGroup.toAddCommMonoid.{u1} V _inst_2) _inst_3))))) r (VSub.vsub.{u1, u3} V P (AddTorsor.toVSub.{u1, u3} V P (AddCommGroup.toAddGroup.{u1} V _inst_2) _inst_4) p₁ p₂)) v)) Case conversion may be inaccurate. Consider using '#align vadd_right_mem_affine_span_pair vadd_right_mem_affineSpan_pairₓ'. -/ /-- A vector added to the second point lies in the affine span of two points if and only if it is a multiple of their difference. -/ theorem vadd_right_mem_affineSpan_pair {p₁ p₂ : P} {v : V} : v +ᵥ p₂ ∈ line[k, p₁, p₂] ↔ ∃ r : k, r • (p₁ -ᵥ p₂) = v := by rw [vadd_mem_iff_mem_direction _ (right_mem_affineSpan_pair _ _ _), direction_affineSpan, mem_vectorSpan_pair] #align vadd_right_mem_affine_span_pair vadd_right_mem_affineSpan_pair /- warning: affine_span_pair_le_of_mem_of_mem -> affineSpan_pair_le_of_mem_of_mem is a dubious translation: lean 3 declaration is forall {k : Type.{u1}} {V : Type.{u2}} {P : Type.{u3}} [_inst_1 : Ring.{u1} k] [_inst_2 : AddCommGroup.{u2} V] [_inst_3 : Module.{u1, u2} k V (Ring.toSemiring.{u1} k _inst_1) (AddCommGroup.toAddCommMonoid.{u2} V _inst_2)] [_inst_4 : AddTorsor.{u2, u3} V P (AddCommGroup.toAddGroup.{u2} V _inst_2)] {p₁ : P} {p₂ : P} {s : AffineSubspace.{u1, u2, u3} k V P _inst_1 _inst_2 _inst_3 _inst_4}, (Membership.Mem.{u3, u3} P (AffineSubspace.{u1, u2, u3} k V P _inst_1 _inst_2 _inst_3 _inst_4) (SetLike.hasMem.{u3, u3} (AffineSubspace.{u1, u2, u3} k V P _inst_1 _inst_2 _inst_3 _inst_4) P (AffineSubspace.setLike.{u1, u2, u3} k V P _inst_1 _inst_2 _inst_3 _inst_4)) p₁ s) -> (Membership.Mem.{u3, u3} P (AffineSubspace.{u1, u2, u3} k V P _inst_1 _inst_2 _inst_3 _inst_4) (SetLike.hasMem.{u3, u3} (AffineSubspace.{u1, u2, u3} k V P _inst_1 _inst_2 _inst_3 _inst_4) P (AffineSubspace.setLike.{u1, u2, u3} k V P _inst_1 _inst_2 _inst_3 _inst_4)) p₂ s) -> (LE.le.{u3} (AffineSubspace.{u1, u2, u3} k V P _inst_1 _inst_2 _inst_3 _inst_4) (Preorder.toLE.{u3} (AffineSubspace.{u1, u2, u3} k V P _inst_1 _inst_2 _inst_3 _inst_4) (PartialOrder.toPreorder.{u3} (AffineSubspace.{u1, u2, u3} k V P _inst_1 _inst_2 _inst_3 _inst_4) (SetLike.partialOrder.{u3, u3} (AffineSubspace.{u1, u2, u3} k V P _inst_1 _inst_2 _inst_3 _inst_4) P (AffineSubspace.setLike.{u1, u2, u3} k V P _inst_1 _inst_2 _inst_3 _inst_4)))) (affineSpan.{u1, u2, u3} k V P _inst_1 _inst_2 _inst_3 _inst_4 (Insert.insert.{u3, u3} P (Set.{u3} P) (Set.hasInsert.{u3} P) p₁ (Singleton.singleton.{u3, u3} P (Set.{u3} P) (Set.hasSingleton.{u3} P) p₂))) s) but is expected to have type forall {k : Type.{u3}} {V : Type.{u2}} {P : Type.{u1}} [_inst_1 : Ring.{u3} k] [_inst_2 : AddCommGroup.{u2} V] [_inst_3 : Module.{u3, u2} k V (Ring.toSemiring.{u3} k _inst_1) (AddCommGroup.toAddCommMonoid.{u2} V _inst_2)] [_inst_4 : AddTorsor.{u2, u1} V P (AddCommGroup.toAddGroup.{u2} V _inst_2)] {p₁ : P} {p₂ : P} {s : AffineSubspace.{u3, u2, u1} k V P _inst_1 _inst_2 _inst_3 _inst_4}, (Membership.mem.{u1, u1} P (AffineSubspace.{u3, u2, u1} k V P _inst_1 _inst_2 _inst_3 _inst_4) (SetLike.instMembership.{u1, u1} (AffineSubspace.{u3, u2, u1} k V P _inst_1 _inst_2 _inst_3 _inst_4) P (AffineSubspace.instSetLikeAffineSubspace.{u3, u2, u1} k V P _inst_1 _inst_2 _inst_3 _inst_4)) p₁ s) -> (Membership.mem.{u1, u1} P (AffineSubspace.{u3, u2, u1} k V P _inst_1 _inst_2 _inst_3 _inst_4) (SetLike.instMembership.{u1, u1} (AffineSubspace.{u3, u2, u1} k V P _inst_1 _inst_2 _inst_3 _inst_4) P (AffineSubspace.instSetLikeAffineSubspace.{u3, u2, u1} k V P _inst_1 _inst_2 _inst_3 _inst_4)) p₂ s) -> (LE.le.{u1} (AffineSubspace.{u3, u2, u1} k V P _inst_1 _inst_2 _inst_3 _inst_4) (Preorder.toLE.{u1} (AffineSubspace.{u3, u2, u1} k V P _inst_1 _inst_2 _inst_3 _inst_4) (PartialOrder.toPreorder.{u1} (AffineSubspace.{u3, u2, u1} k V P _inst_1 _inst_2 _inst_3 _inst_4) (OmegaCompletePartialOrder.toPartialOrder.{u1} (AffineSubspace.{u3, u2, u1} k V P _inst_1 _inst_2 _inst_3 _inst_4) (CompleteLattice.instOmegaCompletePartialOrder.{u1} (AffineSubspace.{u3, u2, u1} k V P _inst_1 _inst_2 _inst_3 _inst_4) (AffineSubspace.instCompleteLatticeAffineSubspace.{u3, u2, u1} k V P _inst_1 _inst_2 _inst_3 _inst_4))))) (affineSpan.{u3, u2, u1} k V P _inst_1 _inst_2 _inst_3 _inst_4 (Insert.insert.{u1, u1} P (Set.{u1} P) (Set.instInsertSet.{u1} P) p₁ (Singleton.singleton.{u1, u1} P (Set.{u1} P) (Set.instSingletonSet.{u1} P) p₂))) s) Case conversion may be inaccurate. Consider using '#align affine_span_pair_le_of_mem_of_mem affineSpan_pair_le_of_mem_of_memₓ'. -/ /-- The span of two points that lie in an affine subspace is contained in that subspace. -/ theorem affineSpan_pair_le_of_mem_of_mem {p₁ p₂ : P} {s : AffineSubspace k P} (hp₁ : p₁ ∈ s) (hp₂ : p₂ ∈ s) : line[k, p₁, p₂] ≤ s := by rw [affineSpan_le, Set.insert_subset, Set.singleton_subset_iff] exact ⟨hp₁, hp₂⟩ #align affine_span_pair_le_of_mem_of_mem affineSpan_pair_le_of_mem_of_mem /- warning: affine_span_pair_le_of_left_mem -> affineSpan_pair_le_of_left_mem is a dubious translation: lean 3 declaration is forall {k : Type.{u1}} {V : Type.{u2}} {P : Type.{u3}} [_inst_1 : Ring.{u1} k] [_inst_2 : AddCommGroup.{u2} V] [_inst_3 : Module.{u1, u2} k V (Ring.toSemiring.{u1} k _inst_1) (AddCommGroup.toAddCommMonoid.{u2} V _inst_2)] [_inst_4 : AddTorsor.{u2, u3} V P (AddCommGroup.toAddGroup.{u2} V _inst_2)] {p₁ : P} {p₂ : P} {p₃ : P}, (Membership.Mem.{u3, u3} P (AffineSubspace.{u1, u2, u3} k V P _inst_1 _inst_2 _inst_3 _inst_4) (SetLike.hasMem.{u3, u3} (AffineSubspace.{u1, u2, u3} k V P _inst_1 _inst_2 _inst_3 _inst_4) P (AffineSubspace.setLike.{u1, u2, u3} k V P _inst_1 _inst_2 _inst_3 _inst_4)) p₁ (affineSpan.{u1, u2, u3} k V P _inst_1 _inst_2 _inst_3 _inst_4 (Insert.insert.{u3, u3} P (Set.{u3} P) (Set.hasInsert.{u3} P) p₂ (Singleton.singleton.{u3, u3} P (Set.{u3} P) (Set.hasSingleton.{u3} P) p₃)))) -> (LE.le.{u3} (AffineSubspace.{u1, u2, u3} k V P _inst_1 _inst_2 _inst_3 _inst_4) (Preorder.toLE.{u3} (AffineSubspace.{u1, u2, u3} k V P _inst_1 _inst_2 _inst_3 _inst_4) (PartialOrder.toPreorder.{u3} (AffineSubspace.{u1, u2, u3} k V P _inst_1 _inst_2 _inst_3 _inst_4) (SetLike.partialOrder.{u3, u3} (AffineSubspace.{u1, u2, u3} k V P _inst_1 _inst_2 _inst_3 _inst_4) P (AffineSubspace.setLike.{u1, u2, u3} k V P _inst_1 _inst_2 _inst_3 _inst_4)))) (affineSpan.{u1, u2, u3} k V P _inst_1 _inst_2 _inst_3 _inst_4 (Insert.insert.{u3, u3} P (Set.{u3} P) (Set.hasInsert.{u3} P) p₁ (Singleton.singleton.{u3, u3} P (Set.{u3} P) (Set.hasSingleton.{u3} P) p₃))) (affineSpan.{u1, u2, u3} k V P _inst_1 _inst_2 _inst_3 _inst_4 (Insert.insert.{u3, u3} P (Set.{u3} P) (Set.hasInsert.{u3} P) p₂ (Singleton.singleton.{u3, u3} P (Set.{u3} P) (Set.hasSingleton.{u3} P) p₃)))) but is expected to have type forall {k : Type.{u2}} {V : Type.{u1}} {P : Type.{u3}} [_inst_1 : Ring.{u2} k] [_inst_2 : AddCommGroup.{u1} V] [_inst_3 : Module.{u2, u1} k V (Ring.toSemiring.{u2} k _inst_1) (AddCommGroup.toAddCommMonoid.{u1} V _inst_2)] [_inst_4 : AddTorsor.{u1, u3} V P (AddCommGroup.toAddGroup.{u1} V _inst_2)] {p₁ : P} {p₂ : P} {p₃ : P}, (Membership.mem.{u3, u3} P (AffineSubspace.{u2, u1, u3} k V P _inst_1 _inst_2 _inst_3 _inst_4) (SetLike.instMembership.{u3, u3} (AffineSubspace.{u2, u1, u3} k V P _inst_1 _inst_2 _inst_3 _inst_4) P (AffineSubspace.instSetLikeAffineSubspace.{u2, u1, u3} k V P _inst_1 _inst_2 _inst_3 _inst_4)) p₁ (affineSpan.{u2, u1, u3} k V P _inst_1 _inst_2 _inst_3 _inst_4 (Insert.insert.{u3, u3} P (Set.{u3} P) (Set.instInsertSet.{u3} P) p₂ (Singleton.singleton.{u3, u3} P (Set.{u3} P) (Set.instSingletonSet.{u3} P) p₃)))) -> (LE.le.{u3} (AffineSubspace.{u2, u1, u3} k V P _inst_1 _inst_2 _inst_3 _inst_4) (Preorder.toLE.{u3} (AffineSubspace.{u2, u1, u3} k V P _inst_1 _inst_2 _inst_3 _inst_4) (PartialOrder.toPreorder.{u3} (AffineSubspace.{u2, u1, u3} k V P _inst_1 _inst_2 _inst_3 _inst_4) (OmegaCompletePartialOrder.toPartialOrder.{u3} (AffineSubspace.{u2, u1, u3} k V P _inst_1 _inst_2 _inst_3 _inst_4) (CompleteLattice.instOmegaCompletePartialOrder.{u3} (AffineSubspace.{u2, u1, u3} k V P _inst_1 _inst_2 _inst_3 _inst_4) (AffineSubspace.instCompleteLatticeAffineSubspace.{u2, u1, u3} k V P _inst_1 _inst_2 _inst_3 _inst_4))))) (affineSpan.{u2, u1, u3} k V P _inst_1 _inst_2 _inst_3 _inst_4 (Insert.insert.{u3, u3} P (Set.{u3} P) (Set.instInsertSet.{u3} P) p₁ (Singleton.singleton.{u3, u3} P (Set.{u3} P) (Set.instSingletonSet.{u3} P) p₃))) (affineSpan.{u2, u1, u3} k V P _inst_1 _inst_2 _inst_3 _inst_4 (Insert.insert.{u3, u3} P (Set.{u3} P) (Set.instInsertSet.{u3} P) p₂ (Singleton.singleton.{u3, u3} P (Set.{u3} P) (Set.instSingletonSet.{u3} P) p₃)))) Case conversion may be inaccurate. Consider using '#align affine_span_pair_le_of_left_mem affineSpan_pair_le_of_left_memₓ'. -/ /-- One line is contained in another differing in the first point if the first point of the first line is contained in the second line. -/ theorem affineSpan_pair_le_of_left_mem {p₁ p₂ p₃ : P} (h : p₁ ∈ line[k, p₂, p₃]) : line[k, p₁, p₃] ≤ line[k, p₂, p₃] := affineSpan_pair_le_of_mem_of_mem h (right_mem_affineSpan_pair _ _ _) #align affine_span_pair_le_of_left_mem affineSpan_pair_le_of_left_mem /- warning: affine_span_pair_le_of_right_mem -> affineSpan_pair_le_of_right_mem is a dubious translation: lean 3 declaration is forall {k : Type.{u1}} {V : Type.{u2}} {P : Type.{u3}} [_inst_1 : Ring.{u1} k] [_inst_2 : AddCommGroup.{u2} V] [_inst_3 : Module.{u1, u2} k V (Ring.toSemiring.{u1} k _inst_1) (AddCommGroup.toAddCommMonoid.{u2} V _inst_2)] [_inst_4 : AddTorsor.{u2, u3} V P (AddCommGroup.toAddGroup.{u2} V _inst_2)] {p₁ : P} {p₂ : P} {p₃ : P}, (Membership.Mem.{u3, u3} P (AffineSubspace.{u1, u2, u3} k V P _inst_1 _inst_2 _inst_3 _inst_4) (SetLike.hasMem.{u3, u3} (AffineSubspace.{u1, u2, u3} k V P _inst_1 _inst_2 _inst_3 _inst_4) P (AffineSubspace.setLike.{u1, u2, u3} k V P _inst_1 _inst_2 _inst_3 _inst_4)) p₁ (affineSpan.{u1, u2, u3} k V P _inst_1 _inst_2 _inst_3 _inst_4 (Insert.insert.{u3, u3} P (Set.{u3} P) (Set.hasInsert.{u3} P) p₂ (Singleton.singleton.{u3, u3} P (Set.{u3} P) (Set.hasSingleton.{u3} P) p₃)))) -> (LE.le.{u3} (AffineSubspace.{u1, u2, u3} k V P _inst_1 _inst_2 _inst_3 _inst_4) (Preorder.toLE.{u3} (AffineSubspace.{u1, u2, u3} k V P _inst_1 _inst_2 _inst_3 _inst_4) (PartialOrder.toPreorder.{u3} (AffineSubspace.{u1, u2, u3} k V P _inst_1 _inst_2 _inst_3 _inst_4) (SetLike.partialOrder.{u3, u3} (AffineSubspace.{u1, u2, u3} k V P _inst_1 _inst_2 _inst_3 _inst_4) P (AffineSubspace.setLike.{u1, u2, u3} k V P _inst_1 _inst_2 _inst_3 _inst_4)))) (affineSpan.{u1, u2, u3} k V P _inst_1 _inst_2 _inst_3 _inst_4 (Insert.insert.{u3, u3} P (Set.{u3} P) (Set.hasInsert.{u3} P) p₂ (Singleton.singleton.{u3, u3} P (Set.{u3} P) (Set.hasSingleton.{u3} P) p₁))) (affineSpan.{u1, u2, u3} k V P _inst_1 _inst_2 _inst_3 _inst_4 (Insert.insert.{u3, u3} P (Set.{u3} P) (Set.hasInsert.{u3} P) p₂ (Singleton.singleton.{u3, u3} P (Set.{u3} P) (Set.hasSingleton.{u3} P) p₃)))) but is expected to have type forall {k : Type.{u2}} {V : Type.{u1}} {P : Type.{u3}} [_inst_1 : Ring.{u2} k] [_inst_2 : AddCommGroup.{u1} V] [_inst_3 : Module.{u2, u1} k V (Ring.toSemiring.{u2} k _inst_1) (AddCommGroup.toAddCommMonoid.{u1} V _inst_2)] [_inst_4 : AddTorsor.{u1, u3} V P (AddCommGroup.toAddGroup.{u1} V _inst_2)] {p₁ : P} {p₂ : P} {p₃ : P}, (Membership.mem.{u3, u3} P (AffineSubspace.{u2, u1, u3} k V P _inst_1 _inst_2 _inst_3 _inst_4) (SetLike.instMembership.{u3, u3} (AffineSubspace.{u2, u1, u3} k V P _inst_1 _inst_2 _inst_3 _inst_4) P (AffineSubspace.instSetLikeAffineSubspace.{u2, u1, u3} k V P _inst_1 _inst_2 _inst_3 _inst_4)) p₁ (affineSpan.{u2, u1, u3} k V P _inst_1 _inst_2 _inst_3 _inst_4 (Insert.insert.{u3, u3} P (Set.{u3} P) (Set.instInsertSet.{u3} P) p₂ (Singleton.singleton.{u3, u3} P (Set.{u3} P) (Set.instSingletonSet.{u3} P) p₃)))) -> (LE.le.{u3} (AffineSubspace.{u2, u1, u3} k V P _inst_1 _inst_2 _inst_3 _inst_4) (Preorder.toLE.{u3} (AffineSubspace.{u2, u1, u3} k V P _inst_1 _inst_2 _inst_3 _inst_4) (PartialOrder.toPreorder.{u3} (AffineSubspace.{u2, u1, u3} k V P _inst_1 _inst_2 _inst_3 _inst_4) (OmegaCompletePartialOrder.toPartialOrder.{u3} (AffineSubspace.{u2, u1, u3} k V P _inst_1 _inst_2 _inst_3 _inst_4) (CompleteLattice.instOmegaCompletePartialOrder.{u3} (AffineSubspace.{u2, u1, u3} k V P _inst_1 _inst_2 _inst_3 _inst_4) (AffineSubspace.instCompleteLatticeAffineSubspace.{u2, u1, u3} k V P _inst_1 _inst_2 _inst_3 _inst_4))))) (affineSpan.{u2, u1, u3} k V P _inst_1 _inst_2 _inst_3 _inst_4 (Insert.insert.{u3, u3} P (Set.{u3} P) (Set.instInsertSet.{u3} P) p₂ (Singleton.singleton.{u3, u3} P (Set.{u3} P) (Set.instSingletonSet.{u3} P) p₁))) (affineSpan.{u2, u1, u3} k V P _inst_1 _inst_2 _inst_3 _inst_4 (Insert.insert.{u3, u3} P (Set.{u3} P) (Set.instInsertSet.{u3} P) p₂ (Singleton.singleton.{u3, u3} P (Set.{u3} P) (Set.instSingletonSet.{u3} P) p₃)))) Case conversion may be inaccurate. Consider using '#align affine_span_pair_le_of_right_mem affineSpan_pair_le_of_right_memₓ'. -/ /-- One line is contained in another differing in the second point if the second point of the first line is contained in the second line. -/ theorem affineSpan_pair_le_of_right_mem {p₁ p₂ p₃ : P} (h : p₁ ∈ line[k, p₂, p₃]) : line[k, p₂, p₁] ≤ line[k, p₂, p₃] := affineSpan_pair_le_of_mem_of_mem (left_mem_affineSpan_pair _ _ _) h #align affine_span_pair_le_of_right_mem affineSpan_pair_le_of_right_mem variable (k) /- warning: affine_span_mono -> affineSpan_mono is a dubious translation: lean 3 declaration is forall (k : Type.{u1}) {V : Type.{u2}} {P : Type.{u3}} [_inst_1 : Ring.{u1} k] [_inst_2 : AddCommGroup.{u2} V] [_inst_3 : Module.{u1, u2} k V (Ring.toSemiring.{u1} k _inst_1) (AddCommGroup.toAddCommMonoid.{u2} V _inst_2)] [_inst_4 : AddTorsor.{u2, u3} V P (AddCommGroup.toAddGroup.{u2} V _inst_2)] {s₁ : Set.{u3} P} {s₂ : Set.{u3} P}, (HasSubset.Subset.{u3} (Set.{u3} P) (Set.hasSubset.{u3} P) s₁ s₂) -> (LE.le.{u3} (AffineSubspace.{u1, u2, u3} k V P _inst_1 _inst_2 _inst_3 _inst_4) (Preorder.toLE.{u3} (AffineSubspace.{u1, u2, u3} k V P _inst_1 _inst_2 _inst_3 _inst_4) (PartialOrder.toPreorder.{u3} (AffineSubspace.{u1, u2, u3} k V P _inst_1 _inst_2 _inst_3 _inst_4) (SetLike.partialOrder.{u3, u3} (AffineSubspace.{u1, u2, u3} k V P _inst_1 _inst_2 _inst_3 _inst_4) P (AffineSubspace.setLike.{u1, u2, u3} k V P _inst_1 _inst_2 _inst_3 _inst_4)))) (affineSpan.{u1, u2, u3} k V P _inst_1 _inst_2 _inst_3 _inst_4 s₁) (affineSpan.{u1, u2, u3} k V P _inst_1 _inst_2 _inst_3 _inst_4 s₂)) but is expected to have type forall (k : Type.{u2}) {V : Type.{u1}} {P : Type.{u3}} [_inst_1 : Ring.{u2} k] [_inst_2 : AddCommGroup.{u1} V] [_inst_3 : Module.{u2, u1} k V (Ring.toSemiring.{u2} k _inst_1) (AddCommGroup.toAddCommMonoid.{u1} V _inst_2)] [_inst_4 : AddTorsor.{u1, u3} V P (AddCommGroup.toAddGroup.{u1} V _inst_2)] {s₁ : Set.{u3} P} {s₂ : Set.{u3} P}, (HasSubset.Subset.{u3} (Set.{u3} P) (Set.instHasSubsetSet.{u3} P) s₁ s₂) -> (LE.le.{u3} (AffineSubspace.{u2, u1, u3} k V P _inst_1 _inst_2 _inst_3 _inst_4) (Preorder.toLE.{u3} (AffineSubspace.{u2, u1, u3} k V P _inst_1 _inst_2 _inst_3 _inst_4) (PartialOrder.toPreorder.{u3} (AffineSubspace.{u2, u1, u3} k V P _inst_1 _inst_2 _inst_3 _inst_4) (OmegaCompletePartialOrder.toPartialOrder.{u3} (AffineSubspace.{u2, u1, u3} k V P _inst_1 _inst_2 _inst_3 _inst_4) (CompleteLattice.instOmegaCompletePartialOrder.{u3} (AffineSubspace.{u2, u1, u3} k V P _inst_1 _inst_2 _inst_3 _inst_4) (AffineSubspace.instCompleteLatticeAffineSubspace.{u2, u1, u3} k V P _inst_1 _inst_2 _inst_3 _inst_4))))) (affineSpan.{u2, u1, u3} k V P _inst_1 _inst_2 _inst_3 _inst_4 s₁) (affineSpan.{u2, u1, u3} k V P _inst_1 _inst_2 _inst_3 _inst_4 s₂)) Case conversion may be inaccurate. Consider using '#align affine_span_mono affineSpan_monoₓ'. -/ /-- `affine_span` is monotone. -/ @[mono] theorem affineSpan_mono {s₁ s₂ : Set P} (h : s₁ ⊆ s₂) : affineSpan k s₁ ≤ affineSpan k s₂ := spanPoints_subset_coe_of_subset_coe (Set.Subset.trans h (subset_affineSpan k _)) #align affine_span_mono affineSpan_mono /- warning: affine_span_insert_affine_span -> affineSpan_insert_affineSpan is a dubious translation: lean 3 declaration is forall (k : Type.{u1}) {V : Type.{u2}} {P : Type.{u3}} [_inst_1 : Ring.{u1} k] [_inst_2 : AddCommGroup.{u2} V] [_inst_3 : Module.{u1, u2} k V (Ring.toSemiring.{u1} k _inst_1) (AddCommGroup.toAddCommMonoid.{u2} V _inst_2)] [_inst_4 : AddTorsor.{u2, u3} V P (AddCommGroup.toAddGroup.{u2} V _inst_2)] (p : P) (ps : Set.{u3} P), Eq.{succ u3} (AffineSubspace.{u1, u2, u3} k V P _inst_1 _inst_2 _inst_3 _inst_4) (affineSpan.{u1, u2, u3} k V P _inst_1 _inst_2 _inst_3 _inst_4 (Insert.insert.{u3, u3} P (Set.{u3} P) (Set.hasInsert.{u3} P) p ((fun (a : Type.{u3}) (b : Type.{u3}) [self : HasLiftT.{succ u3, succ u3} a b] => self.0) (AffineSubspace.{u1, u2, u3} k V P _inst_1 _inst_2 _inst_3 _inst_4) (Set.{u3} P) (HasLiftT.mk.{succ u3, succ u3} (AffineSubspace.{u1, u2, u3} k V P _inst_1 _inst_2 _inst_3 _inst_4) (Set.{u3} P) (CoeTCₓ.coe.{succ u3, succ u3} (AffineSubspace.{u1, u2, u3} k V P _inst_1 _inst_2 _inst_3 _inst_4) (Set.{u3} P) (SetLike.Set.hasCoeT.{u3, u3} (AffineSubspace.{u1, u2, u3} k V P _inst_1 _inst_2 _inst_3 _inst_4) P (AffineSubspace.setLike.{u1, u2, u3} k V P _inst_1 _inst_2 _inst_3 _inst_4)))) (affineSpan.{u1, u2, u3} k V P _inst_1 _inst_2 _inst_3 _inst_4 ps)))) (affineSpan.{u1, u2, u3} k V P _inst_1 _inst_2 _inst_3 _inst_4 (Insert.insert.{u3, u3} P (Set.{u3} P) (Set.hasInsert.{u3} P) p ps)) but is expected to have type forall (k : Type.{u2}) {V : Type.{u1}} {P : Type.{u3}} [_inst_1 : Ring.{u2} k] [_inst_2 : AddCommGroup.{u1} V] [_inst_3 : Module.{u2, u1} k V (Ring.toSemiring.{u2} k _inst_1) (AddCommGroup.toAddCommMonoid.{u1} V _inst_2)] [_inst_4 : AddTorsor.{u1, u3} V P (AddCommGroup.toAddGroup.{u1} V _inst_2)] (p : P) (ps : Set.{u3} P), Eq.{succ u3} (AffineSubspace.{u2, u1, u3} k V P _inst_1 _inst_2 _inst_3 _inst_4) (affineSpan.{u2, u1, u3} k V P _inst_1 _inst_2 _inst_3 _inst_4 (Insert.insert.{u3, u3} P (Set.{u3} P) (Set.instInsertSet.{u3} P) p (SetLike.coe.{u3, u3} (AffineSubspace.{u2, u1, u3} k V P _inst_1 _inst_2 _inst_3 _inst_4) P (AffineSubspace.instSetLikeAffineSubspace.{u2, u1, u3} k V P _inst_1 _inst_2 _inst_3 _inst_4) (affineSpan.{u2, u1, u3} k V P _inst_1 _inst_2 _inst_3 _inst_4 ps)))) (affineSpan.{u2, u1, u3} k V P _inst_1 _inst_2 _inst_3 _inst_4 (Insert.insert.{u3, u3} P (Set.{u3} P) (Set.instInsertSet.{u3} P) p ps)) Case conversion may be inaccurate. Consider using '#align affine_span_insert_affine_span affineSpan_insert_affineSpanₓ'. -/ /-- Taking the affine span of a set, adding a point and taking the span again produces the same results as adding the point to the set and taking the span. -/ theorem affineSpan_insert_affineSpan (p : P) (ps : Set P) : affineSpan k (insert p (affineSpan k ps : Set P)) = affineSpan k (insert p ps) := by rw [Set.insert_eq, Set.insert_eq, span_union, span_union, affine_span_coe] #align affine_span_insert_affine_span affineSpan_insert_affineSpan /- warning: affine_span_insert_eq_affine_span -> affineSpan_insert_eq_affineSpan is a dubious translation: lean 3 declaration is forall (k : Type.{u1}) {V : Type.{u2}} {P : Type.{u3}} [_inst_1 : Ring.{u1} k] [_inst_2 : AddCommGroup.{u2} V] [_inst_3 : Module.{u1, u2} k V (Ring.toSemiring.{u1} k _inst_1) (AddCommGroup.toAddCommMonoid.{u2} V _inst_2)] [_inst_4 : AddTorsor.{u2, u3} V P (AddCommGroup.toAddGroup.{u2} V _inst_2)] {p : P} {ps : Set.{u3} P}, (Membership.Mem.{u3, u3} P (AffineSubspace.{u1, u2, u3} k V P _inst_1 _inst_2 _inst_3 _inst_4) (SetLike.hasMem.{u3, u3} (AffineSubspace.{u1, u2, u3} k V P _inst_1 _inst_2 _inst_3 _inst_4) P (AffineSubspace.setLike.{u1, u2, u3} k V P _inst_1 _inst_2 _inst_3 _inst_4)) p (affineSpan.{u1, u2, u3} k V P _inst_1 _inst_2 _inst_3 _inst_4 ps)) -> (Eq.{succ u3} (AffineSubspace.{u1, u2, u3} k V P _inst_1 _inst_2 _inst_3 _inst_4) (affineSpan.{u1, u2, u3} k V P _inst_1 _inst_2 _inst_3 _inst_4 (Insert.insert.{u3, u3} P (Set.{u3} P) (Set.hasInsert.{u3} P) p ps)) (affineSpan.{u1, u2, u3} k V P _inst_1 _inst_2 _inst_3 _inst_4 ps)) but is expected to have type forall (k : Type.{u2}) {V : Type.{u1}} {P : Type.{u3}} [_inst_1 : Ring.{u2} k] [_inst_2 : AddCommGroup.{u1} V] [_inst_3 : Module.{u2, u1} k V (Ring.toSemiring.{u2} k _inst_1) (AddCommGroup.toAddCommMonoid.{u1} V _inst_2)] [_inst_4 : AddTorsor.{u1, u3} V P (AddCommGroup.toAddGroup.{u1} V _inst_2)] {p : P} {ps : Set.{u3} P}, (Membership.mem.{u3, u3} P (AffineSubspace.{u2, u1, u3} k V P _inst_1 _inst_2 _inst_3 _inst_4) (SetLike.instMembership.{u3, u3} (AffineSubspace.{u2, u1, u3} k V P _inst_1 _inst_2 _inst_3 _inst_4) P (AffineSubspace.instSetLikeAffineSubspace.{u2, u1, u3} k V P _inst_1 _inst_2 _inst_3 _inst_4)) p (affineSpan.{u2, u1, u3} k V P _inst_1 _inst_2 _inst_3 _inst_4 ps)) -> (Eq.{succ u3} (AffineSubspace.{u2, u1, u3} k V P _inst_1 _inst_2 _inst_3 _inst_4) (affineSpan.{u2, u1, u3} k V P _inst_1 _inst_2 _inst_3 _inst_4 (Insert.insert.{u3, u3} P (Set.{u3} P) (Set.instInsertSet.{u3} P) p ps)) (affineSpan.{u2, u1, u3} k V P _inst_1 _inst_2 _inst_3 _inst_4 ps)) Case conversion may be inaccurate. Consider using '#align affine_span_insert_eq_affine_span affineSpan_insert_eq_affineSpanₓ'. -/ /-- If a point is in the affine span of a set, adding it to that set does not change the affine span. -/ theorem affineSpan_insert_eq_affineSpan {p : P} {ps : Set P} (h : p ∈ affineSpan k ps) : affineSpan k (insert p ps) = affineSpan k ps := by rw [← mem_coe] at h rw [← affineSpan_insert_affineSpan, Set.insert_eq_of_mem h, affine_span_coe] #align affine_span_insert_eq_affine_span affineSpan_insert_eq_affineSpan variable {k} /- warning: vector_span_insert_eq_vector_span -> vectorSpan_insert_eq_vectorSpan is a dubious translation: lean 3 declaration is forall {k : Type.{u1}} {V : Type.{u2}} {P : Type.{u3}} [_inst_1 : Ring.{u1} k] [_inst_2 : AddCommGroup.{u2} V] [_inst_3 : Module.{u1, u2} k V (Ring.toSemiring.{u1} k _inst_1) (AddCommGroup.toAddCommMonoid.{u2} V _inst_2)] [_inst_4 : AddTorsor.{u2, u3} V P (AddCommGroup.toAddGroup.{u2} V _inst_2)] {p : P} {ps : Set.{u3} P}, (Membership.Mem.{u3, u3} P (AffineSubspace.{u1, u2, u3} k V P _inst_1 _inst_2 _inst_3 _inst_4) (SetLike.hasMem.{u3, u3} (AffineSubspace.{u1, u2, u3} k V P _inst_1 _inst_2 _inst_3 _inst_4) P (AffineSubspace.setLike.{u1, u2, u3} k V P _inst_1 _inst_2 _inst_3 _inst_4)) p (affineSpan.{u1, u2, u3} k V P _inst_1 _inst_2 _inst_3 _inst_4 ps)) -> (Eq.{succ u2} (Submodule.{u1, u2} k V (Ring.toSemiring.{u1} k _inst_1) (AddCommGroup.toAddCommMonoid.{u2} V _inst_2) _inst_3) (vectorSpan.{u1, u2, u3} k V P _inst_1 _inst_2 _inst_3 _inst_4 (Insert.insert.{u3, u3} P (Set.{u3} P) (Set.hasInsert.{u3} P) p ps)) (vectorSpan.{u1, u2, u3} k V P _inst_1 _inst_2 _inst_3 _inst_4 ps)) but is expected to have type forall {k : Type.{u2}} {V : Type.{u1}} {P : Type.{u3}} [_inst_1 : Ring.{u2} k] [_inst_2 : AddCommGroup.{u1} V] [_inst_3 : Module.{u2, u1} k V (Ring.toSemiring.{u2} k _inst_1) (AddCommGroup.toAddCommMonoid.{u1} V _inst_2)] [_inst_4 : AddTorsor.{u1, u3} V P (AddCommGroup.toAddGroup.{u1} V _inst_2)] {p : P} {ps : Set.{u3} P}, (Membership.mem.{u3, u3} P (AffineSubspace.{u2, u1, u3} k V P _inst_1 _inst_2 _inst_3 _inst_4) (SetLike.instMembership.{u3, u3} (AffineSubspace.{u2, u1, u3} k V P _inst_1 _inst_2 _inst_3 _inst_4) P (AffineSubspace.instSetLikeAffineSubspace.{u2, u1, u3} k V P _inst_1 _inst_2 _inst_3 _inst_4)) p (affineSpan.{u2, u1, u3} k V P _inst_1 _inst_2 _inst_3 _inst_4 ps)) -> (Eq.{succ u1} (Submodule.{u2, u1} k V (Ring.toSemiring.{u2} k _inst_1) (AddCommGroup.toAddCommMonoid.{u1} V _inst_2) _inst_3) (vectorSpan.{u2, u1, u3} k V P _inst_1 _inst_2 _inst_3 _inst_4 (Insert.insert.{u3, u3} P (Set.{u3} P) (Set.instInsertSet.{u3} P) p ps)) (vectorSpan.{u2, u1, u3} k V P _inst_1 _inst_2 _inst_3 _inst_4 ps)) Case conversion may be inaccurate. Consider using '#align vector_span_insert_eq_vector_span vectorSpan_insert_eq_vectorSpanₓ'. -/ /-- If a point is in the affine span of a set, adding it to that set does not change the vector span. -/ theorem vectorSpan_insert_eq_vectorSpan {p : P} {ps : Set P} (h : p ∈ affineSpan k ps) : vectorSpan k (insert p ps) = vectorSpan k ps := by simp_rw [← direction_affineSpan, affineSpan_insert_eq_affineSpan _ h] #align vector_span_insert_eq_vector_span vectorSpan_insert_eq_vectorSpan end AffineSpace' namespace AffineSubspace variable {k : Type _} {V : Type _} {P : Type _} [Ring k] [AddCommGroup V] [Module k V] [affine_space V P] include V /- warning: affine_subspace.direction_sup -> AffineSubspace.direction_sup is a dubious translation: lean 3 declaration is forall {k : Type.{u1}} {V : Type.{u2}} {P : Type.{u3}} [_inst_1 : Ring.{u1} k] [_inst_2 : AddCommGroup.{u2} V] [_inst_3 : Module.{u1, u2} k V (Ring.toSemiring.{u1} k _inst_1) (AddCommGroup.toAddCommMonoid.{u2} V _inst_2)] [_inst_4 : AddTorsor.{u2, u3} V P (AddCommGroup.toAddGroup.{u2} V _inst_2)] {s1 : AffineSubspace.{u1, u2, u3} k V P _inst_1 _inst_2 _inst_3 _inst_4} {s2 : AffineSubspace.{u1, u2, u3} k V P _inst_1 _inst_2 _inst_3 _inst_4} {p1 : P} {p2 : P}, (Membership.Mem.{u3, u3} P (AffineSubspace.{u1, u2, u3} k V P _inst_1 _inst_2 _inst_3 _inst_4) (SetLike.hasMem.{u3, u3} (AffineSubspace.{u1, u2, u3} k V P _inst_1 _inst_2 _inst_3 _inst_4) P (AffineSubspace.setLike.{u1, u2, u3} k V P _inst_1 _inst_2 _inst_3 _inst_4)) p1 s1) -> (Membership.Mem.{u3, u3} P (AffineSubspace.{u1, u2, u3} k V P _inst_1 _inst_2 _inst_3 _inst_4) (SetLike.hasMem.{u3, u3} (AffineSubspace.{u1, u2, u3} k V P _inst_1 _inst_2 _inst_3 _inst_4) P (AffineSubspace.setLike.{u1, u2, u3} k V P _inst_1 _inst_2 _inst_3 _inst_4)) p2 s2) -> (Eq.{succ u2} (Submodule.{u1, u2} k V (Ring.toSemiring.{u1} k _inst_1) (AddCommGroup.toAddCommMonoid.{u2} V _inst_2) _inst_3) (AffineSubspace.direction.{u1, u2, u3} k V P _inst_1 _inst_2 _inst_3 _inst_4 (Sup.sup.{u3} (AffineSubspace.{u1, u2, u3} k V P _inst_1 _inst_2 _inst_3 _inst_4) (SemilatticeSup.toHasSup.{u3} (AffineSubspace.{u1, u2, u3} k V P _inst_1 _inst_2 _inst_3 _inst_4) (Lattice.toSemilatticeSup.{u3} (AffineSubspace.{u1, u2, u3} k V P _inst_1 _inst_2 _inst_3 _inst_4) (ConditionallyCompleteLattice.toLattice.{u3} (AffineSubspace.{u1, u2, u3} k V P _inst_1 _inst_2 _inst_3 _inst_4) (CompleteLattice.toConditionallyCompleteLattice.{u3} (AffineSubspace.{u1, u2, u3} k V P _inst_1 _inst_2 _inst_3 _inst_4) (AffineSubspace.completeLattice.{u1, u2, u3} k V P _inst_1 _inst_2 _inst_3 _inst_4))))) s1 s2)) (Sup.sup.{u2} (Submodule.{u1, u2} k V (Ring.toSemiring.{u1} k _inst_1) (AddCommGroup.toAddCommMonoid.{u2} V _inst_2) _inst_3) (SemilatticeSup.toHasSup.{u2} (Submodule.{u1, u2} k V (Ring.toSemiring.{u1} k _inst_1) (AddCommGroup.toAddCommMonoid.{u2} V _inst_2) _inst_3) (Lattice.toSemilatticeSup.{u2} (Submodule.{u1, u2} k V (Ring.toSemiring.{u1} k _inst_1) (AddCommGroup.toAddCommMonoid.{u2} V _inst_2) _inst_3) (ConditionallyCompleteLattice.toLattice.{u2} (Submodule.{u1, u2} k V (Ring.toSemiring.{u1} k _inst_1) (AddCommGroup.toAddCommMonoid.{u2} V _inst_2) _inst_3) (CompleteLattice.toConditionallyCompleteLattice.{u2} (Submodule.{u1, u2} k V (Ring.toSemiring.{u1} k _inst_1) (AddCommGroup.toAddCommMonoid.{u2} V _inst_2) _inst_3) (Submodule.completeLattice.{u1, u2} k V (Ring.toSemiring.{u1} k _inst_1) (AddCommGroup.toAddCommMonoid.{u2} V _inst_2) _inst_3))))) (Sup.sup.{u2} (Submodule.{u1, u2} k V (Ring.toSemiring.{u1} k _inst_1) (AddCommGroup.toAddCommMonoid.{u2} V _inst_2) _inst_3) (SemilatticeSup.toHasSup.{u2} (Submodule.{u1, u2} k V (Ring.toSemiring.{u1} k _inst_1) (AddCommGroup.toAddCommMonoid.{u2} V _inst_2) _inst_3) (Lattice.toSemilatticeSup.{u2} (Submodule.{u1, u2} k V (Ring.toSemiring.{u1} k _inst_1) (AddCommGroup.toAddCommMonoid.{u2} V _inst_2) _inst_3) (ConditionallyCompleteLattice.toLattice.{u2} (Submodule.{u1, u2} k V (Ring.toSemiring.{u1} k _inst_1) (AddCommGroup.toAddCommMonoid.{u2} V _inst_2) _inst_3) (CompleteLattice.toConditionallyCompleteLattice.{u2} (Submodule.{u1, u2} k V (Ring.toSemiring.{u1} k _inst_1) (AddCommGroup.toAddCommMonoid.{u2} V _inst_2) _inst_3) (Submodule.completeLattice.{u1, u2} k V (Ring.toSemiring.{u1} k _inst_1) (AddCommGroup.toAddCommMonoid.{u2} V _inst_2) _inst_3))))) (AffineSubspace.direction.{u1, u2, u3} k V P _inst_1 _inst_2 _inst_3 _inst_4 s1) (AffineSubspace.direction.{u1, u2, u3} k V P _inst_1 _inst_2 _inst_3 _inst_4 s2)) (Submodule.span.{u1, u2} k V (Ring.toSemiring.{u1} k _inst_1) (AddCommGroup.toAddCommMonoid.{u2} V _inst_2) _inst_3 (Singleton.singleton.{u2, u2} V (Set.{u2} V) (Set.hasSingleton.{u2} V) (VSub.vsub.{u2, u3} V P (AddTorsor.toHasVsub.{u2, u3} V P (AddCommGroup.toAddGroup.{u2} V _inst_2) _inst_4) p2 p1))))) but is expected to have type forall {k : Type.{u3}} {V : Type.{u2}} {P : Type.{u1}} [_inst_1 : Ring.{u3} k] [_inst_2 : AddCommGroup.{u2} V] [_inst_3 : Module.{u3, u2} k V (Ring.toSemiring.{u3} k _inst_1) (AddCommGroup.toAddCommMonoid.{u2} V _inst_2)] [_inst_4 : AddTorsor.{u2, u1} V P (AddCommGroup.toAddGroup.{u2} V _inst_2)] {s1 : AffineSubspace.{u3, u2, u1} k V P _inst_1 _inst_2 _inst_3 _inst_4} {s2 : AffineSubspace.{u3, u2, u1} k V P _inst_1 _inst_2 _inst_3 _inst_4} {p1 : P} {p2 : P}, (Membership.mem.{u1, u1} P (AffineSubspace.{u3, u2, u1} k V P _inst_1 _inst_2 _inst_3 _inst_4) (SetLike.instMembership.{u1, u1} (AffineSubspace.{u3, u2, u1} k V P _inst_1 _inst_2 _inst_3 _inst_4) P (AffineSubspace.instSetLikeAffineSubspace.{u3, u2, u1} k V P _inst_1 _inst_2 _inst_3 _inst_4)) p1 s1) -> (Membership.mem.{u1, u1} P (AffineSubspace.{u3, u2, u1} k V P _inst_1 _inst_2 _inst_3 _inst_4) (SetLike.instMembership.{u1, u1} (AffineSubspace.{u3, u2, u1} k V P _inst_1 _inst_2 _inst_3 _inst_4) P (AffineSubspace.instSetLikeAffineSubspace.{u3, u2, u1} k V P _inst_1 _inst_2 _inst_3 _inst_4)) p2 s2) -> (Eq.{succ u2} (Submodule.{u3, u2} k V (Ring.toSemiring.{u3} k _inst_1) (AddCommGroup.toAddCommMonoid.{u2} V _inst_2) _inst_3) (AffineSubspace.direction.{u3, u2, u1} k V P _inst_1 _inst_2 _inst_3 _inst_4 (Sup.sup.{u1} (AffineSubspace.{u3, u2, u1} k V P _inst_1 _inst_2 _inst_3 _inst_4) (SemilatticeSup.toSup.{u1} (AffineSubspace.{u3, u2, u1} k V P _inst_1 _inst_2 _inst_3 _inst_4) (Lattice.toSemilatticeSup.{u1} (AffineSubspace.{u3, u2, u1} k V P _inst_1 _inst_2 _inst_3 _inst_4) (ConditionallyCompleteLattice.toLattice.{u1} (AffineSubspace.{u3, u2, u1} k V P _inst_1 _inst_2 _inst_3 _inst_4) (CompleteLattice.toConditionallyCompleteLattice.{u1} (AffineSubspace.{u3, u2, u1} k V P _inst_1 _inst_2 _inst_3 _inst_4) (AffineSubspace.instCompleteLatticeAffineSubspace.{u3, u2, u1} k V P _inst_1 _inst_2 _inst_3 _inst_4))))) s1 s2)) (Sup.sup.{u2} (Submodule.{u3, u2} k V (Ring.toSemiring.{u3} k _inst_1) (AddCommGroup.toAddCommMonoid.{u2} V _inst_2) _inst_3) (SemilatticeSup.toSup.{u2} (Submodule.{u3, u2} k V (Ring.toSemiring.{u3} k _inst_1) (AddCommGroup.toAddCommMonoid.{u2} V _inst_2) _inst_3) (Lattice.toSemilatticeSup.{u2} (Submodule.{u3, u2} k V (Ring.toSemiring.{u3} k _inst_1) (AddCommGroup.toAddCommMonoid.{u2} V _inst_2) _inst_3) (ConditionallyCompleteLattice.toLattice.{u2} (Submodule.{u3, u2} k V (Ring.toSemiring.{u3} k _inst_1) (AddCommGroup.toAddCommMonoid.{u2} V _inst_2) _inst_3) (CompleteLattice.toConditionallyCompleteLattice.{u2} (Submodule.{u3, u2} k V (Ring.toSemiring.{u3} k _inst_1) (AddCommGroup.toAddCommMonoid.{u2} V _inst_2) _inst_3) (Submodule.completeLattice.{u3, u2} k V (Ring.toSemiring.{u3} k _inst_1) (AddCommGroup.toAddCommMonoid.{u2} V _inst_2) _inst_3))))) (Sup.sup.{u2} (Submodule.{u3, u2} k V (Ring.toSemiring.{u3} k _inst_1) (AddCommGroup.toAddCommMonoid.{u2} V _inst_2) _inst_3) (SemilatticeSup.toSup.{u2} (Submodule.{u3, u2} k V (Ring.toSemiring.{u3} k _inst_1) (AddCommGroup.toAddCommMonoid.{u2} V _inst_2) _inst_3) (Lattice.toSemilatticeSup.{u2} (Submodule.{u3, u2} k V (Ring.toSemiring.{u3} k _inst_1) (AddCommGroup.toAddCommMonoid.{u2} V _inst_2) _inst_3) (ConditionallyCompleteLattice.toLattice.{u2} (Submodule.{u3, u2} k V (Ring.toSemiring.{u3} k _inst_1) (AddCommGroup.toAddCommMonoid.{u2} V _inst_2) _inst_3) (CompleteLattice.toConditionallyCompleteLattice.{u2} (Submodule.{u3, u2} k V (Ring.toSemiring.{u3} k _inst_1) (AddCommGroup.toAddCommMonoid.{u2} V _inst_2) _inst_3) (Submodule.completeLattice.{u3, u2} k V (Ring.toSemiring.{u3} k _inst_1) (AddCommGroup.toAddCommMonoid.{u2} V _inst_2) _inst_3))))) (AffineSubspace.direction.{u3, u2, u1} k V P _inst_1 _inst_2 _inst_3 _inst_4 s1) (AffineSubspace.direction.{u3, u2, u1} k V P _inst_1 _inst_2 _inst_3 _inst_4 s2)) (Submodule.span.{u3, u2} k V (Ring.toSemiring.{u3} k _inst_1) (AddCommGroup.toAddCommMonoid.{u2} V _inst_2) _inst_3 (Singleton.singleton.{u2, u2} V (Set.{u2} V) (Set.instSingletonSet.{u2} V) (VSub.vsub.{u2, u1} V P (AddTorsor.toVSub.{u2, u1} V P (AddCommGroup.toAddGroup.{u2} V _inst_2) _inst_4) p2 p1))))) Case conversion may be inaccurate. Consider using '#align affine_subspace.direction_sup AffineSubspace.direction_supₓ'. -/ /-- The direction of the sup of two nonempty affine subspaces is the sup of the two directions and of any one difference between points in the two subspaces. -/ theorem direction_sup {s1 s2 : AffineSubspace k P} {p1 p2 : P} (hp1 : p1 ∈ s1) (hp2 : p2 ∈ s2) : (s1 ⊔ s2).direction = s1.direction ⊔ s2.direction ⊔ k ∙ p2 -ᵥ p1 := by refine' le_antisymm _ _ · change (affineSpan k ((s1 : Set P) ∪ s2)).direction ≤ _ rw [← mem_coe] at hp1 rw [direction_affineSpan, vectorSpan_eq_span_vsub_set_right k (Set.mem_union_left _ hp1), Submodule.span_le] rintro v ⟨p3, hp3, rfl⟩ cases hp3 · rw [sup_assoc, sup_comm, SetLike.mem_coe, Submodule.mem_sup] use 0, Submodule.zero_mem _, p3 -ᵥ p1, vsub_mem_direction hp3 hp1 rw [zero_add] · rw [sup_assoc, SetLike.mem_coe, Submodule.mem_sup] use 0, Submodule.zero_mem _, p3 -ᵥ p1 rw [and_comm', zero_add] use rfl rw [← vsub_add_vsub_cancel p3 p2 p1, Submodule.mem_sup] use p3 -ᵥ p2, vsub_mem_direction hp3 hp2, p2 -ᵥ p1, Submodule.mem_span_singleton_self _ · refine' sup_le (sup_direction_le _ _) _ rw [direction_eq_vector_span, vectorSpan_def] exact infₛ_le_infₛ fun p hp => Set.Subset.trans (Set.singleton_subset_iff.2 (vsub_mem_vsub (mem_spanPoints k p2 _ (Set.mem_union_right _ hp2)) (mem_spanPoints k p1 _ (Set.mem_union_left _ hp1)))) hp #align affine_subspace.direction_sup AffineSubspace.direction_sup /- warning: affine_subspace.direction_affine_span_insert -> AffineSubspace.direction_affineSpan_insert is a dubious translation: lean 3 declaration is forall {k : Type.{u1}} {V : Type.{u2}} {P : Type.{u3}} [_inst_1 : Ring.{u1} k] [_inst_2 : AddCommGroup.{u2} V] [_inst_3 : Module.{u1, u2} k V (Ring.toSemiring.{u1} k _inst_1) (AddCommGroup.toAddCommMonoid.{u2} V _inst_2)] [_inst_4 : AddTorsor.{u2, u3} V P (AddCommGroup.toAddGroup.{u2} V _inst_2)] {s : AffineSubspace.{u1, u2, u3} k V P _inst_1 _inst_2 _inst_3 _inst_4} {p1 : P} {p2 : P}, (Membership.Mem.{u3, u3} P (AffineSubspace.{u1, u2, u3} k V P _inst_1 _inst_2 _inst_3 _inst_4) (SetLike.hasMem.{u3, u3} (AffineSubspace.{u1, u2, u3} k V P _inst_1 _inst_2 _inst_3 _inst_4) P (AffineSubspace.setLike.{u1, u2, u3} k V P _inst_1 _inst_2 _inst_3 _inst_4)) p1 s) -> (Eq.{succ u2} (Submodule.{u1, u2} k V (Ring.toSemiring.{u1} k _inst_1) (AddCommGroup.toAddCommMonoid.{u2} V _inst_2) _inst_3) (AffineSubspace.direction.{u1, u2, u3} k V P _inst_1 _inst_2 _inst_3 _inst_4 (affineSpan.{u1, u2, u3} k V P _inst_1 _inst_2 _inst_3 _inst_4 (Insert.insert.{u3, u3} P (Set.{u3} P) (Set.hasInsert.{u3} P) p2 ((fun (a : Type.{u3}) (b : Type.{u3}) [self : HasLiftT.{succ u3, succ u3} a b] => self.0) (AffineSubspace.{u1, u2, u3} k V P _inst_1 _inst_2 _inst_3 _inst_4) (Set.{u3} P) (HasLiftT.mk.{succ u3, succ u3} (AffineSubspace.{u1, u2, u3} k V P _inst_1 _inst_2 _inst_3 _inst_4) (Set.{u3} P) (CoeTCₓ.coe.{succ u3, succ u3} (AffineSubspace.{u1, u2, u3} k V P _inst_1 _inst_2 _inst_3 _inst_4) (Set.{u3} P) (SetLike.Set.hasCoeT.{u3, u3} (AffineSubspace.{u1, u2, u3} k V P _inst_1 _inst_2 _inst_3 _inst_4) P (AffineSubspace.setLike.{u1, u2, u3} k V P _inst_1 _inst_2 _inst_3 _inst_4)))) s)))) (Sup.sup.{u2} (Submodule.{u1, u2} k V (Ring.toSemiring.{u1} k _inst_1) (AddCommGroup.toAddCommMonoid.{u2} V _inst_2) _inst_3) (SemilatticeSup.toHasSup.{u2} (Submodule.{u1, u2} k V (Ring.toSemiring.{u1} k _inst_1) (AddCommGroup.toAddCommMonoid.{u2} V _inst_2) _inst_3) (Lattice.toSemilatticeSup.{u2} (Submodule.{u1, u2} k V (Ring.toSemiring.{u1} k _inst_1) (AddCommGroup.toAddCommMonoid.{u2} V _inst_2) _inst_3) (ConditionallyCompleteLattice.toLattice.{u2} (Submodule.{u1, u2} k V (Ring.toSemiring.{u1} k _inst_1) (AddCommGroup.toAddCommMonoid.{u2} V _inst_2) _inst_3) (CompleteLattice.toConditionallyCompleteLattice.{u2} (Submodule.{u1, u2} k V (Ring.toSemiring.{u1} k _inst_1) (AddCommGroup.toAddCommMonoid.{u2} V _inst_2) _inst_3) (Submodule.completeLattice.{u1, u2} k V (Ring.toSemiring.{u1} k _inst_1) (AddCommGroup.toAddCommMonoid.{u2} V _inst_2) _inst_3))))) (Submodule.span.{u1, u2} k V (Ring.toSemiring.{u1} k _inst_1) (AddCommGroup.toAddCommMonoid.{u2} V _inst_2) _inst_3 (Singleton.singleton.{u2, u2} V (Set.{u2} V) (Set.hasSingleton.{u2} V) (VSub.vsub.{u2, u3} V P (AddTorsor.toHasVsub.{u2, u3} V P (AddCommGroup.toAddGroup.{u2} V _inst_2) _inst_4) p2 p1))) (AffineSubspace.direction.{u1, u2, u3} k V P _inst_1 _inst_2 _inst_3 _inst_4 s))) but is expected to have type forall {k : Type.{u3}} {V : Type.{u2}} {P : Type.{u1}} [_inst_1 : Ring.{u3} k] [_inst_2 : AddCommGroup.{u2} V] [_inst_3 : Module.{u3, u2} k V (Ring.toSemiring.{u3} k _inst_1) (AddCommGroup.toAddCommMonoid.{u2} V _inst_2)] [_inst_4 : AddTorsor.{u2, u1} V P (AddCommGroup.toAddGroup.{u2} V _inst_2)] {s : AffineSubspace.{u3, u2, u1} k V P _inst_1 _inst_2 _inst_3 _inst_4} {p1 : P} {p2 : P}, (Membership.mem.{u1, u1} P (AffineSubspace.{u3, u2, u1} k V P _inst_1 _inst_2 _inst_3 _inst_4) (SetLike.instMembership.{u1, u1} (AffineSubspace.{u3, u2, u1} k V P _inst_1 _inst_2 _inst_3 _inst_4) P (AffineSubspace.instSetLikeAffineSubspace.{u3, u2, u1} k V P _inst_1 _inst_2 _inst_3 _inst_4)) p1 s) -> (Eq.{succ u2} (Submodule.{u3, u2} k V (Ring.toSemiring.{u3} k _inst_1) (AddCommGroup.toAddCommMonoid.{u2} V _inst_2) _inst_3) (AffineSubspace.direction.{u3, u2, u1} k V P _inst_1 _inst_2 _inst_3 _inst_4 (affineSpan.{u3, u2, u1} k V P _inst_1 _inst_2 _inst_3 _inst_4 (Insert.insert.{u1, u1} P (Set.{u1} P) (Set.instInsertSet.{u1} P) p2 (SetLike.coe.{u1, u1} (AffineSubspace.{u3, u2, u1} k V P _inst_1 _inst_2 _inst_3 _inst_4) P (AffineSubspace.instSetLikeAffineSubspace.{u3, u2, u1} k V P _inst_1 _inst_2 _inst_3 _inst_4) s)))) (Sup.sup.{u2} (Submodule.{u3, u2} k V (Ring.toSemiring.{u3} k _inst_1) (AddCommGroup.toAddCommMonoid.{u2} V _inst_2) _inst_3) (SemilatticeSup.toSup.{u2} (Submodule.{u3, u2} k V (Ring.toSemiring.{u3} k _inst_1) (AddCommGroup.toAddCommMonoid.{u2} V _inst_2) _inst_3) (Lattice.toSemilatticeSup.{u2} (Submodule.{u3, u2} k V (Ring.toSemiring.{u3} k _inst_1) (AddCommGroup.toAddCommMonoid.{u2} V _inst_2) _inst_3) (ConditionallyCompleteLattice.toLattice.{u2} (Submodule.{u3, u2} k V (Ring.toSemiring.{u3} k _inst_1) (AddCommGroup.toAddCommMonoid.{u2} V _inst_2) _inst_3) (CompleteLattice.toConditionallyCompleteLattice.{u2} (Submodule.{u3, u2} k V (Ring.toSemiring.{u3} k _inst_1) (AddCommGroup.toAddCommMonoid.{u2} V _inst_2) _inst_3) (Submodule.completeLattice.{u3, u2} k V (Ring.toSemiring.{u3} k _inst_1) (AddCommGroup.toAddCommMonoid.{u2} V _inst_2) _inst_3))))) (Submodule.span.{u3, u2} k V (Ring.toSemiring.{u3} k _inst_1) (AddCommGroup.toAddCommMonoid.{u2} V _inst_2) _inst_3 (Singleton.singleton.{u2, u2} V (Set.{u2} V) (Set.instSingletonSet.{u2} V) (VSub.vsub.{u2, u1} V P (AddTorsor.toVSub.{u2, u1} V P (AddCommGroup.toAddGroup.{u2} V _inst_2) _inst_4) p2 p1))) (AffineSubspace.direction.{u3, u2, u1} k V P _inst_1 _inst_2 _inst_3 _inst_4 s))) Case conversion may be inaccurate. Consider using '#align affine_subspace.direction_affine_span_insert AffineSubspace.direction_affineSpan_insertₓ'. -/ /-- The direction of the span of the result of adding a point to a nonempty affine subspace is the sup of the direction of that subspace and of any one difference between that point and a point in the subspace. -/ theorem direction_affineSpan_insert {s : AffineSubspace k P} {p1 p2 : P} (hp1 : p1 ∈ s) : (affineSpan k (insert p2 (s : Set P))).direction = Submodule.span k {p2 -ᵥ p1} ⊔ s.direction := by rw [sup_comm, ← Set.union_singleton, ← coe_affine_span_singleton k V p2] change (s ⊔ affineSpan k {p2}).direction = _ rw [direction_sup hp1 (mem_affineSpan k (Set.mem_singleton _)), direction_affineSpan] simp #align affine_subspace.direction_affine_span_insert AffineSubspace.direction_affineSpan_insert /- warning: affine_subspace.mem_affine_span_insert_iff -> AffineSubspace.mem_affineSpan_insert_iff is a dubious translation: lean 3 declaration is forall {k : Type.{u1}} {V : Type.{u2}} {P : Type.{u3}} [_inst_1 : Ring.{u1} k] [_inst_2 : AddCommGroup.{u2} V] [_inst_3 : Module.{u1, u2} k V (Ring.toSemiring.{u1} k _inst_1) (AddCommGroup.toAddCommMonoid.{u2} V _inst_2)] [_inst_4 : AddTorsor.{u2, u3} V P (AddCommGroup.toAddGroup.{u2} V _inst_2)] {s : AffineSubspace.{u1, u2, u3} k V P _inst_1 _inst_2 _inst_3 _inst_4} {p1 : P}, (Membership.Mem.{u3, u3} P (AffineSubspace.{u1, u2, u3} k V P _inst_1 _inst_2 _inst_3 _inst_4) (SetLike.hasMem.{u3, u3} (AffineSubspace.{u1, u2, u3} k V P _inst_1 _inst_2 _inst_3 _inst_4) P (AffineSubspace.setLike.{u1, u2, u3} k V P _inst_1 _inst_2 _inst_3 _inst_4)) p1 s) -> (forall (p2 : P) (p : P), Iff (Membership.Mem.{u3, u3} P (AffineSubspace.{u1, u2, u3} k V P _inst_1 _inst_2 _inst_3 _inst_4) (SetLike.hasMem.{u3, u3} (AffineSubspace.{u1, u2, u3} k V P _inst_1 _inst_2 _inst_3 _inst_4) P (AffineSubspace.setLike.{u1, u2, u3} k V P _inst_1 _inst_2 _inst_3 _inst_4)) p (affineSpan.{u1, u2, u3} k V P _inst_1 _inst_2 _inst_3 _inst_4 (Insert.insert.{u3, u3} P (Set.{u3} P) (Set.hasInsert.{u3} P) p2 ((fun (a : Type.{u3}) (b : Type.{u3}) [self : HasLiftT.{succ u3, succ u3} a b] => self.0) (AffineSubspace.{u1, u2, u3} k V P _inst_1 _inst_2 _inst_3 _inst_4) (Set.{u3} P) (HasLiftT.mk.{succ u3, succ u3} (AffineSubspace.{u1, u2, u3} k V P _inst_1 _inst_2 _inst_3 _inst_4) (Set.{u3} P) (CoeTCₓ.coe.{succ u3, succ u3} (AffineSubspace.{u1, u2, u3} k V P _inst_1 _inst_2 _inst_3 _inst_4) (Set.{u3} P) (SetLike.Set.hasCoeT.{u3, u3} (AffineSubspace.{u1, u2, u3} k V P _inst_1 _inst_2 _inst_3 _inst_4) P (AffineSubspace.setLike.{u1, u2, u3} k V P _inst_1 _inst_2 _inst_3 _inst_4)))) s)))) (Exists.{succ u1} k (fun (r : k) => Exists.{succ u3} P (fun (p0 : P) => Exists.{0} (Membership.Mem.{u3, u3} P (AffineSubspace.{u1, u2, u3} k V P _inst_1 _inst_2 _inst_3 _inst_4) (SetLike.hasMem.{u3, u3} (AffineSubspace.{u1, u2, u3} k V P _inst_1 _inst_2 _inst_3 _inst_4) P (AffineSubspace.setLike.{u1, u2, u3} k V P _inst_1 _inst_2 _inst_3 _inst_4)) p0 s) (fun (hp0 : Membership.Mem.{u3, u3} P (AffineSubspace.{u1, u2, u3} k V P _inst_1 _inst_2 _inst_3 _inst_4) (SetLike.hasMem.{u3, u3} (AffineSubspace.{u1, u2, u3} k V P _inst_1 _inst_2 _inst_3 _inst_4) P (AffineSubspace.setLike.{u1, u2, u3} k V P _inst_1 _inst_2 _inst_3 _inst_4)) p0 s) => Eq.{succ u3} P p (VAdd.vadd.{u2, u3} V P (AddAction.toHasVadd.{u2, u3} V P (SubNegMonoid.toAddMonoid.{u2} V (AddGroup.toSubNegMonoid.{u2} V (AddCommGroup.toAddGroup.{u2} V _inst_2))) (AddTorsor.toAddAction.{u2, u3} V P (AddCommGroup.toAddGroup.{u2} V _inst_2) _inst_4)) (SMul.smul.{u1, u2} k V (SMulZeroClass.toHasSmul.{u1, u2} k V (AddZeroClass.toHasZero.{u2} V (AddMonoid.toAddZeroClass.{u2} V (AddCommMonoid.toAddMonoid.{u2} V (AddCommGroup.toAddCommMonoid.{u2} V _inst_2)))) (SMulWithZero.toSmulZeroClass.{u1, u2} k V (MulZeroClass.toHasZero.{u1} k (MulZeroOneClass.toMulZeroClass.{u1} k (MonoidWithZero.toMulZeroOneClass.{u1} k (Semiring.toMonoidWithZero.{u1} k (Ring.toSemiring.{u1} k _inst_1))))) (AddZeroClass.toHasZero.{u2} V (AddMonoid.toAddZeroClass.{u2} V (AddCommMonoid.toAddMonoid.{u2} V (AddCommGroup.toAddCommMonoid.{u2} V _inst_2)))) (MulActionWithZero.toSMulWithZero.{u1, u2} k V (Semiring.toMonoidWithZero.{u1} k (Ring.toSemiring.{u1} k _inst_1)) (AddZeroClass.toHasZero.{u2} V (AddMonoid.toAddZeroClass.{u2} V (AddCommMonoid.toAddMonoid.{u2} V (AddCommGroup.toAddCommMonoid.{u2} V _inst_2)))) (Module.toMulActionWithZero.{u1, u2} k V (Ring.toSemiring.{u1} k _inst_1) (AddCommGroup.toAddCommMonoid.{u2} V _inst_2) _inst_3)))) r (VSub.vsub.{u2, u3} V P (AddTorsor.toHasVsub.{u2, u3} V P (AddCommGroup.toAddGroup.{u2} V _inst_2) _inst_4) p2 p1)) p0)))))) but is expected to have type forall {k : Type.{u3}} {V : Type.{u2}} {P : Type.{u1}} [_inst_1 : Ring.{u3} k] [_inst_2 : AddCommGroup.{u2} V] [_inst_3 : Module.{u3, u2} k V (Ring.toSemiring.{u3} k _inst_1) (AddCommGroup.toAddCommMonoid.{u2} V _inst_2)] [_inst_4 : AddTorsor.{u2, u1} V P (AddCommGroup.toAddGroup.{u2} V _inst_2)] {s : AffineSubspace.{u3, u2, u1} k V P _inst_1 _inst_2 _inst_3 _inst_4} {p1 : P}, (Membership.mem.{u1, u1} P (AffineSubspace.{u3, u2, u1} k V P _inst_1 _inst_2 _inst_3 _inst_4) (SetLike.instMembership.{u1, u1} (AffineSubspace.{u3, u2, u1} k V P _inst_1 _inst_2 _inst_3 _inst_4) P (AffineSubspace.instSetLikeAffineSubspace.{u3, u2, u1} k V P _inst_1 _inst_2 _inst_3 _inst_4)) p1 s) -> (forall (p2 : P) (p : P), Iff (Membership.mem.{u1, u1} P (AffineSubspace.{u3, u2, u1} k V P _inst_1 _inst_2 _inst_3 _inst_4) (SetLike.instMembership.{u1, u1} (AffineSubspace.{u3, u2, u1} k V P _inst_1 _inst_2 _inst_3 _inst_4) P (AffineSubspace.instSetLikeAffineSubspace.{u3, u2, u1} k V P _inst_1 _inst_2 _inst_3 _inst_4)) p (affineSpan.{u3, u2, u1} k V P _inst_1 _inst_2 _inst_3 _inst_4 (Insert.insert.{u1, u1} P (Set.{u1} P) (Set.instInsertSet.{u1} P) p2 (SetLike.coe.{u1, u1} (AffineSubspace.{u3, u2, u1} k V P _inst_1 _inst_2 _inst_3 _inst_4) P (AffineSubspace.instSetLikeAffineSubspace.{u3, u2, u1} k V P _inst_1 _inst_2 _inst_3 _inst_4) s)))) (Exists.{succ u3} k (fun (r : k) => Exists.{succ u1} P (fun (p0 : P) => Exists.{0} (Membership.mem.{u1, u1} P (AffineSubspace.{u3, u2, u1} k V P _inst_1 _inst_2 _inst_3 _inst_4) (SetLike.instMembership.{u1, u1} (AffineSubspace.{u3, u2, u1} k V P _inst_1 _inst_2 _inst_3 _inst_4) P (AffineSubspace.instSetLikeAffineSubspace.{u3, u2, u1} k V P _inst_1 _inst_2 _inst_3 _inst_4)) p0 s) (fun (hp0 : Membership.mem.{u1, u1} P (AffineSubspace.{u3, u2, u1} k V P _inst_1 _inst_2 _inst_3 _inst_4) (SetLike.instMembership.{u1, u1} (AffineSubspace.{u3, u2, u1} k V P _inst_1 _inst_2 _inst_3 _inst_4) P (AffineSubspace.instSetLikeAffineSubspace.{u3, u2, u1} k V P _inst_1 _inst_2 _inst_3 _inst_4)) p0 s) => Eq.{succ u1} P p (HVAdd.hVAdd.{u2, u1, u1} V P P (instHVAdd.{u2, u1} V P (AddAction.toVAdd.{u2, u1} V P (SubNegMonoid.toAddMonoid.{u2} V (AddGroup.toSubNegMonoid.{u2} V (AddCommGroup.toAddGroup.{u2} V _inst_2))) (AddTorsor.toAddAction.{u2, u1} V P (AddCommGroup.toAddGroup.{u2} V _inst_2) _inst_4))) (HSMul.hSMul.{u3, u2, u2} k V V (instHSMul.{u3, u2} k V (SMulZeroClass.toSMul.{u3, u2} k V (NegZeroClass.toZero.{u2} V (SubNegZeroMonoid.toNegZeroClass.{u2} V (SubtractionMonoid.toSubNegZeroMonoid.{u2} V (SubtractionCommMonoid.toSubtractionMonoid.{u2} V (AddCommGroup.toDivisionAddCommMonoid.{u2} V _inst_2))))) (SMulWithZero.toSMulZeroClass.{u3, u2} k V (MonoidWithZero.toZero.{u3} k (Semiring.toMonoidWithZero.{u3} k (Ring.toSemiring.{u3} k _inst_1))) (NegZeroClass.toZero.{u2} V (SubNegZeroMonoid.toNegZeroClass.{u2} V (SubtractionMonoid.toSubNegZeroMonoid.{u2} V (SubtractionCommMonoid.toSubtractionMonoid.{u2} V (AddCommGroup.toDivisionAddCommMonoid.{u2} V _inst_2))))) (MulActionWithZero.toSMulWithZero.{u3, u2} k V (Semiring.toMonoidWithZero.{u3} k (Ring.toSemiring.{u3} k _inst_1)) (NegZeroClass.toZero.{u2} V (SubNegZeroMonoid.toNegZeroClass.{u2} V (SubtractionMonoid.toSubNegZeroMonoid.{u2} V (SubtractionCommMonoid.toSubtractionMonoid.{u2} V (AddCommGroup.toDivisionAddCommMonoid.{u2} V _inst_2))))) (Module.toMulActionWithZero.{u3, u2} k V (Ring.toSemiring.{u3} k _inst_1) (AddCommGroup.toAddCommMonoid.{u2} V _inst_2) _inst_3))))) r (VSub.vsub.{u2, u1} V P (AddTorsor.toVSub.{u2, u1} V P (AddCommGroup.toAddGroup.{u2} V _inst_2) _inst_4) p2 p1)) p0)))))) Case conversion may be inaccurate. Consider using '#align affine_subspace.mem_affine_span_insert_iff AffineSubspace.mem_affineSpan_insert_iffₓ'. -/ /-- Given a point `p1` in an affine subspace `s`, and a point `p2`, a point `p` is in the span of `s` with `p2` added if and only if it is a multiple of `p2 -ᵥ p1` added to a point in `s`. -/ theorem mem_affineSpan_insert_iff {s : AffineSubspace k P} {p1 : P} (hp1 : p1 ∈ s) (p2 p : P) : p ∈ affineSpan k (insert p2 (s : Set P)) ↔ ∃ (r : k)(p0 : P)(hp0 : p0 ∈ s), p = r • (p2 -ᵥ p1 : V) +ᵥ p0 := by rw [← mem_coe] at hp1 rw [← vsub_right_mem_direction_iff_mem (mem_affineSpan k (Set.mem_insert_of_mem _ hp1)), direction_affine_span_insert hp1, Submodule.mem_sup] constructor · rintro ⟨v1, hv1, v2, hv2, hp⟩ rw [Submodule.mem_span_singleton] at hv1 rcases hv1 with ⟨r, rfl⟩ use r, v2 +ᵥ p1, vadd_mem_of_mem_direction hv2 hp1 symm at hp rw [← sub_eq_zero, ← vsub_vadd_eq_vsub_sub, vsub_eq_zero_iff_eq] at hp rw [hp, vadd_vadd] · rintro ⟨r, p3, hp3, rfl⟩ use r • (p2 -ᵥ p1), Submodule.mem_span_singleton.2 ⟨r, rfl⟩, p3 -ᵥ p1, vsub_mem_direction hp3 hp1 rw [vadd_vsub_assoc, add_comm] #align affine_subspace.mem_affine_span_insert_iff AffineSubspace.mem_affineSpan_insert_iff end AffineSubspace section MapComap variable {k V₁ P₁ V₂ P₂ V₃ P₃ : Type _} [Ring k] variable [AddCommGroup V₁] [Module k V₁] [AddTorsor V₁ P₁] variable [AddCommGroup V₂] [Module k V₂] [AddTorsor V₂ P₂] variable [AddCommGroup V₃] [Module k V₃] [AddTorsor V₃ P₃] include V₁ V₂ section variable (f : P₁ →ᵃ[k] P₂) /- warning: affine_map.vector_span_image_eq_submodule_map -> AffineMap.vectorSpan_image_eq_submodule_map is a dubious translation: lean 3 declaration is forall {k : Type.{u1}} {V₁ : Type.{u2}} {P₁ : Type.{u3}} {V₂ : Type.{u4}} {P₂ : Type.{u5}} [_inst_1 : Ring.{u1} k] [_inst_2 : AddCommGroup.{u2} V₁] [_inst_3 : Module.{u1, u2} k V₁ (Ring.toSemiring.{u1} k _inst_1) (AddCommGroup.toAddCommMonoid.{u2} V₁ _inst_2)] [_inst_4 : AddTorsor.{u2, u3} V₁ P₁ (AddCommGroup.toAddGroup.{u2} V₁ _inst_2)] [_inst_5 : AddCommGroup.{u4} V₂] [_inst_6 : Module.{u1, u4} k V₂ (Ring.toSemiring.{u1} k _inst_1) (AddCommGroup.toAddCommMonoid.{u4} V₂ _inst_5)] [_inst_7 : AddTorsor.{u4, u5} V₂ P₂ (AddCommGroup.toAddGroup.{u4} V₂ _inst_5)] (f : AffineMap.{u1, u2, u3, u4, u5} k V₁ P₁ V₂ P₂ _inst_1 _inst_2 _inst_3 _inst_4 _inst_5 _inst_6 _inst_7) {s : Set.{u3} P₁}, Eq.{succ u4} (Submodule.{u1, u4} k V₂ (Ring.toSemiring.{u1} k _inst_1) (AddCommGroup.toAddCommMonoid.{u4} V₂ _inst_5) _inst_6) (Submodule.map.{u1, u1, u2, u4, max u2 u4} k k V₁ V₂ (Ring.toSemiring.{u1} k _inst_1) (Ring.toSemiring.{u1} k _inst_1) (AddCommGroup.toAddCommMonoid.{u2} V₁ _inst_2) (AddCommGroup.toAddCommMonoid.{u4} V₂ _inst_5) _inst_3 _inst_6 (RingHom.id.{u1} k (Semiring.toNonAssocSemiring.{u1} k (Ring.toSemiring.{u1} k _inst_1))) (RingHomSurjective.ids.{u1} k (Ring.toSemiring.{u1} k _inst_1)) (LinearMap.{u1, u1, u2, u4} k k (Ring.toSemiring.{u1} k _inst_1) (Ring.toSemiring.{u1} k _inst_1) (RingHom.id.{u1} k (Semiring.toNonAssocSemiring.{u1} k (Ring.toSemiring.{u1} k _inst_1))) V₁ V₂ (AddCommGroup.toAddCommMonoid.{u2} V₁ _inst_2) (AddCommGroup.toAddCommMonoid.{u4} V₂ _inst_5) _inst_3 _inst_6) (LinearMap.semilinearMapClass.{u1, u1, u2, u4} k k V₁ V₂ (Ring.toSemiring.{u1} k _inst_1) (Ring.toSemiring.{u1} k _inst_1) (AddCommGroup.toAddCommMonoid.{u2} V₁ _inst_2) (AddCommGroup.toAddCommMonoid.{u4} V₂ _inst_5) _inst_3 _inst_6 (RingHom.id.{u1} k (Semiring.toNonAssocSemiring.{u1} k (Ring.toSemiring.{u1} k _inst_1)))) (AffineMap.linear.{u1, u2, u3, u4, u5} k V₁ P₁ V₂ P₂ _inst_1 _inst_2 _inst_3 _inst_4 _inst_5 _inst_6 _inst_7 f) (vectorSpan.{u1, u2, u3} k V₁ P₁ _inst_1 _inst_2 _inst_3 _inst_4 s)) (vectorSpan.{u1, u4, u5} k V₂ P₂ _inst_1 _inst_5 _inst_6 _inst_7 (Set.image.{u3, u5} P₁ P₂ (coeFn.{max (succ u2) (succ u3) (succ u4) (succ u5), max (succ u3) (succ u5)} (AffineMap.{u1, u2, u3, u4, u5} k V₁ P₁ V₂ P₂ _inst_1 _inst_2 _inst_3 _inst_4 _inst_5 _inst_6 _inst_7) (fun (_x : AffineMap.{u1, u2, u3, u4, u5} k V₁ P₁ V₂ P₂ _inst_1 _inst_2 _inst_3 _inst_4 _inst_5 _inst_6 _inst_7) => P₁ -> P₂) (AffineMap.hasCoeToFun.{u1, u2, u3, u4, u5} k V₁ P₁ V₂ P₂ _inst_1 _inst_2 _inst_3 _inst_4 _inst_5 _inst_6 _inst_7) f) s)) but is expected to have type forall {k : Type.{u3}} {V₁ : Type.{u2}} {P₁ : Type.{u5}} {V₂ : Type.{u4}} {P₂ : Type.{u1}} [_inst_1 : Ring.{u3} k] [_inst_2 : AddCommGroup.{u2} V₁] [_inst_3 : Module.{u3, u2} k V₁ (Ring.toSemiring.{u3} k _inst_1) (AddCommGroup.toAddCommMonoid.{u2} V₁ _inst_2)] [_inst_4 : AddTorsor.{u2, u5} V₁ P₁ (AddCommGroup.toAddGroup.{u2} V₁ _inst_2)] [_inst_5 : AddCommGroup.{u4} V₂] [_inst_6 : Module.{u3, u4} k V₂ (Ring.toSemiring.{u3} k _inst_1) (AddCommGroup.toAddCommMonoid.{u4} V₂ _inst_5)] [_inst_7 : AddTorsor.{u4, u1} V₂ P₂ (AddCommGroup.toAddGroup.{u4} V₂ _inst_5)] (f : AffineMap.{u3, u2, u5, u4, u1} k V₁ P₁ V₂ P₂ _inst_1 _inst_2 _inst_3 _inst_4 _inst_5 _inst_6 _inst_7) {s : Set.{u5} P₁}, Eq.{succ u4} (Submodule.{u3, u4} k V₂ (Ring.toSemiring.{u3} k _inst_1) (AddCommGroup.toAddCommMonoid.{u4} V₂ _inst_5) _inst_6) (Submodule.map.{u3, u3, u2, u4, max u2 u4} k k V₁ V₂ (Ring.toSemiring.{u3} k _inst_1) (Ring.toSemiring.{u3} k _inst_1) (AddCommGroup.toAddCommMonoid.{u2} V₁ _inst_2) (AddCommGroup.toAddCommMonoid.{u4} V₂ _inst_5) _inst_3 _inst_6 (RingHom.id.{u3} k (Semiring.toNonAssocSemiring.{u3} k (Ring.toSemiring.{u3} k _inst_1))) (RingHomSurjective.ids.{u3} k (Ring.toSemiring.{u3} k _inst_1)) (LinearMap.{u3, u3, u2, u4} k k (Ring.toSemiring.{u3} k _inst_1) (Ring.toSemiring.{u3} k _inst_1) (RingHom.id.{u3} k (Semiring.toNonAssocSemiring.{u3} k (Ring.toSemiring.{u3} k _inst_1))) V₁ V₂ (AddCommGroup.toAddCommMonoid.{u2} V₁ _inst_2) (AddCommGroup.toAddCommMonoid.{u4} V₂ _inst_5) _inst_3 _inst_6) (LinearMap.instSemilinearMapClassLinearMap.{u3, u3, u2, u4} k k V₁ V₂ (Ring.toSemiring.{u3} k _inst_1) (Ring.toSemiring.{u3} k _inst_1) (AddCommGroup.toAddCommMonoid.{u2} V₁ _inst_2) (AddCommGroup.toAddCommMonoid.{u4} V₂ _inst_5) _inst_3 _inst_6 (RingHom.id.{u3} k (Semiring.toNonAssocSemiring.{u3} k (Ring.toSemiring.{u3} k _inst_1)))) (AffineMap.linear.{u3, u2, u5, u4, u1} k V₁ P₁ V₂ P₂ _inst_1 _inst_2 _inst_3 _inst_4 _inst_5 _inst_6 _inst_7 f) (vectorSpan.{u3, u2, u5} k V₁ P₁ _inst_1 _inst_2 _inst_3 _inst_4 s)) (vectorSpan.{u3, u4, u1} k V₂ P₂ _inst_1 _inst_5 _inst_6 _inst_7 (Set.image.{u5, u1} P₁ P₂ (FunLike.coe.{max (max (max (succ u2) (succ u5)) (succ u4)) (succ u1), succ u5, succ u1} (AffineMap.{u3, u2, u5, u4, u1} k V₁ P₁ V₂ P₂ _inst_1 _inst_2 _inst_3 _inst_4 _inst_5 _inst_6 _inst_7) P₁ (fun (_x : P₁) => (fun ([email protected]._hyg.1004 : P₁) => P₂) _x) (AffineMap.funLike.{u3, u2, u5, u4, u1} k V₁ P₁ V₂ P₂ _inst_1 _inst_2 _inst_3 _inst_4 _inst_5 _inst_6 _inst_7) f) s)) Case conversion may be inaccurate. Consider using '#align affine_map.vector_span_image_eq_submodule_map AffineMap.vectorSpan_image_eq_submodule_mapₓ'. -/ @[simp] theorem AffineMap.vectorSpan_image_eq_submodule_map {s : Set P₁} : Submodule.map f.linear (vectorSpan k s) = vectorSpan k (f '' s) := by simp [f.image_vsub_image, vectorSpan_def] #align affine_map.vector_span_image_eq_submodule_map AffineMap.vectorSpan_image_eq_submodule_map namespace AffineSubspace #print AffineSubspace.map /- /-- The image of an affine subspace under an affine map as an affine subspace. -/ def map (s : AffineSubspace k P₁) : AffineSubspace k P₂ where carrier := f '' s smul_vsub_vadd_mem := by rintro t - - - ⟨p₁, h₁, rfl⟩ ⟨p₂, h₂, rfl⟩ ⟨p₃, h₃, rfl⟩ use t • (p₁ -ᵥ p₂) +ᵥ p₃ suffices t • (p₁ -ᵥ p₂) +ᵥ p₃ ∈ s by simp [this] exact s.smul_vsub_vadd_mem t h₁ h₂ h₃ #align affine_subspace.map AffineSubspace.map -/ /- warning: affine_subspace.coe_map -> AffineSubspace.coe_map is a dubious translation: lean 3 declaration is forall {k : Type.{u1}} {V₁ : Type.{u2}} {P₁ : Type.{u3}} {V₂ : Type.{u4}} {P₂ : Type.{u5}} [_inst_1 : Ring.{u1} k] [_inst_2 : AddCommGroup.{u2} V₁] [_inst_3 : Module.{u1, u2} k V₁ (Ring.toSemiring.{u1} k _inst_1) (AddCommGroup.toAddCommMonoid.{u2} V₁ _inst_2)] [_inst_4 : AddTorsor.{u2, u3} V₁ P₁ (AddCommGroup.toAddGroup.{u2} V₁ _inst_2)] [_inst_5 : AddCommGroup.{u4} V₂] [_inst_6 : Module.{u1, u4} k V₂ (Ring.toSemiring.{u1} k _inst_1) (AddCommGroup.toAddCommMonoid.{u4} V₂ _inst_5)] [_inst_7 : AddTorsor.{u4, u5} V₂ P₂ (AddCommGroup.toAddGroup.{u4} V₂ _inst_5)] (f : AffineMap.{u1, u2, u3, u4, u5} k V₁ P₁ V₂ P₂ _inst_1 _inst_2 _inst_3 _inst_4 _inst_5 _inst_6 _inst_7) (s : AffineSubspace.{u1, u2, u3} k V₁ P₁ _inst_1 _inst_2 _inst_3 _inst_4), Eq.{succ u5} (Set.{u5} P₂) ((fun (a : Type.{u5}) (b : Type.{u5}) [self : HasLiftT.{succ u5, succ u5} a b] => self.0) (AffineSubspace.{u1, u4, u5} k V₂ P₂ _inst_1 _inst_5 _inst_6 _inst_7) (Set.{u5} P₂) (HasLiftT.mk.{succ u5, succ u5} (AffineSubspace.{u1, u4, u5} k V₂ P₂ _inst_1 _inst_5 _inst_6 _inst_7) (Set.{u5} P₂) (CoeTCₓ.coe.{succ u5, succ u5} (AffineSubspace.{u1, u4, u5} k V₂ P₂ _inst_1 _inst_5 _inst_6 _inst_7) (Set.{u5} P₂) (SetLike.Set.hasCoeT.{u5, u5} (AffineSubspace.{u1, u4, u5} k V₂ P₂ _inst_1 _inst_5 _inst_6 _inst_7) P₂ (AffineSubspace.setLike.{u1, u4, u5} k V₂ P₂ _inst_1 _inst_5 _inst_6 _inst_7)))) (AffineSubspace.map.{u1, u2, u3, u4, u5} k V₁ P₁ V₂ P₂ _inst_1 _inst_2 _inst_3 _inst_4 _inst_5 _inst_6 _inst_7 f s)) (Set.image.{u3, u5} P₁ P₂ (coeFn.{max (succ u2) (succ u3) (succ u4) (succ u5), max (succ u3) (succ u5)} (AffineMap.{u1, u2, u3, u4, u5} k V₁ P₁ V₂ P₂ _inst_1 _inst_2 _inst_3 _inst_4 _inst_5 _inst_6 _inst_7) (fun (_x : AffineMap.{u1, u2, u3, u4, u5} k V₁ P₁ V₂ P₂ _inst_1 _inst_2 _inst_3 _inst_4 _inst_5 _inst_6 _inst_7) => P₁ -> P₂) (AffineMap.hasCoeToFun.{u1, u2, u3, u4, u5} k V₁ P₁ V₂ P₂ _inst_1 _inst_2 _inst_3 _inst_4 _inst_5 _inst_6 _inst_7) f) ((fun (a : Type.{u3}) (b : Type.{u3}) [self : HasLiftT.{succ u3, succ u3} a b] => self.0) (AffineSubspace.{u1, u2, u3} k V₁ P₁ _inst_1 _inst_2 _inst_3 _inst_4) (Set.{u3} P₁) (HasLiftT.mk.{succ u3, succ u3} (AffineSubspace.{u1, u2, u3} k V₁ P₁ _inst_1 _inst_2 _inst_3 _inst_4) (Set.{u3} P₁) (CoeTCₓ.coe.{succ u3, succ u3} (AffineSubspace.{u1, u2, u3} k V₁ P₁ _inst_1 _inst_2 _inst_3 _inst_4) (Set.{u3} P₁) (SetLike.Set.hasCoeT.{u3, u3} (AffineSubspace.{u1, u2, u3} k V₁ P₁ _inst_1 _inst_2 _inst_3 _inst_4) P₁ (AffineSubspace.setLike.{u1, u2, u3} k V₁ P₁ _inst_1 _inst_2 _inst_3 _inst_4)))) s)) but is expected to have type forall {k : Type.{u5}} {V₁ : Type.{u4}} {P₁ : Type.{u3}} {V₂ : Type.{u1}} {P₂ : Type.{u2}} [_inst_1 : Ring.{u5} k] [_inst_2 : AddCommGroup.{u4} V₁] [_inst_3 : Module.{u5, u4} k V₁ (Ring.toSemiring.{u5} k _inst_1) (AddCommGroup.toAddCommMonoid.{u4} V₁ _inst_2)] [_inst_4 : AddTorsor.{u4, u3} V₁ P₁ (AddCommGroup.toAddGroup.{u4} V₁ _inst_2)] [_inst_5 : AddCommGroup.{u1} V₂] [_inst_6 : Module.{u5, u1} k V₂ (Ring.toSemiring.{u5} k _inst_1) (AddCommGroup.toAddCommMonoid.{u1} V₂ _inst_5)] [_inst_7 : AddTorsor.{u1, u2} V₂ P₂ (AddCommGroup.toAddGroup.{u1} V₂ _inst_5)] (f : AffineMap.{u5, u4, u3, u1, u2} k V₁ P₁ V₂ P₂ _inst_1 _inst_2 _inst_3 _inst_4 _inst_5 _inst_6 _inst_7) (s : AffineSubspace.{u5, u4, u3} k V₁ P₁ _inst_1 _inst_2 _inst_3 _inst_4), Eq.{succ u2} (Set.{u2} P₂) (SetLike.coe.{u2, u2} (AffineSubspace.{u5, u1, u2} k V₂ P₂ _inst_1 _inst_5 _inst_6 _inst_7) P₂ (AffineSubspace.instSetLikeAffineSubspace.{u5, u1, u2} k V₂ P₂ _inst_1 _inst_5 _inst_6 _inst_7) (AffineSubspace.map.{u5, u4, u3, u1, u2} k V₁ P₁ V₂ P₂ _inst_1 _inst_2 _inst_3 _inst_4 _inst_5 _inst_6 _inst_7 f s)) (Set.image.{u3, u2} P₁ P₂ (FunLike.coe.{max (max (max (succ u4) (succ u3)) (succ u1)) (succ u2), succ u3, succ u2} (AffineMap.{u5, u4, u3, u1, u2} k V₁ P₁ V₂ P₂ _inst_1 _inst_2 _inst_3 _inst_4 _inst_5 _inst_6 _inst_7) P₁ (fun (_x : P₁) => (fun ([email protected]._hyg.1004 : P₁) => P₂) _x) (AffineMap.funLike.{u5, u4, u3, u1, u2} k V₁ P₁ V₂ P₂ _inst_1 _inst_2 _inst_3 _inst_4 _inst_5 _inst_6 _inst_7) f) (SetLike.coe.{u3, u3} (AffineSubspace.{u5, u4, u3} k V₁ P₁ _inst_1 _inst_2 _inst_3 _inst_4) P₁ (AffineSubspace.instSetLikeAffineSubspace.{u5, u4, u3} k V₁ P₁ _inst_1 _inst_2 _inst_3 _inst_4) s)) Case conversion may be inaccurate. Consider using '#align affine_subspace.coe_map AffineSubspace.coe_mapₓ'. -/ @[simp] theorem coe_map (s : AffineSubspace k P₁) : (s.map f : Set P₂) = f '' s := rfl #align affine_subspace.coe_map AffineSubspace.coe_map /- warning: affine_subspace.mem_map -> AffineSubspace.mem_map is a dubious translation: lean 3 declaration is forall {k : Type.{u1}} {V₁ : Type.{u2}} {P₁ : Type.{u3}} {V₂ : Type.{u4}} {P₂ : Type.{u5}} [_inst_1 : Ring.{u1} k] [_inst_2 : AddCommGroup.{u2} V₁] [_inst_3 : Module.{u1, u2} k V₁ (Ring.toSemiring.{u1} k _inst_1) (AddCommGroup.toAddCommMonoid.{u2} V₁ _inst_2)] [_inst_4 : AddTorsor.{u2, u3} V₁ P₁ (AddCommGroup.toAddGroup.{u2} V₁ _inst_2)] [_inst_5 : AddCommGroup.{u4} V₂] [_inst_6 : Module.{u1, u4} k V₂ (Ring.toSemiring.{u1} k _inst_1) (AddCommGroup.toAddCommMonoid.{u4} V₂ _inst_5)] [_inst_7 : AddTorsor.{u4, u5} V₂ P₂ (AddCommGroup.toAddGroup.{u4} V₂ _inst_5)] {f : AffineMap.{u1, u2, u3, u4, u5} k V₁ P₁ V₂ P₂ _inst_1 _inst_2 _inst_3 _inst_4 _inst_5 _inst_6 _inst_7} {x : P₂} {s : AffineSubspace.{u1, u2, u3} k V₁ P₁ _inst_1 _inst_2 _inst_3 _inst_4}, Iff (Membership.Mem.{u5, u5} P₂ (AffineSubspace.{u1, u4, u5} k V₂ P₂ _inst_1 _inst_5 _inst_6 _inst_7) (SetLike.hasMem.{u5, u5} (AffineSubspace.{u1, u4, u5} k V₂ P₂ _inst_1 _inst_5 _inst_6 _inst_7) P₂ (AffineSubspace.setLike.{u1, u4, u5} k V₂ P₂ _inst_1 _inst_5 _inst_6 _inst_7)) x (AffineSubspace.map.{u1, u2, u3, u4, u5} k V₁ P₁ V₂ P₂ _inst_1 _inst_2 _inst_3 _inst_4 _inst_5 _inst_6 _inst_7 f s)) (Exists.{succ u3} P₁ (fun (y : P₁) => Exists.{0} (Membership.Mem.{u3, u3} P₁ (AffineSubspace.{u1, u2, u3} k V₁ P₁ _inst_1 _inst_2 _inst_3 _inst_4) (SetLike.hasMem.{u3, u3} (AffineSubspace.{u1, u2, u3} k V₁ P₁ _inst_1 _inst_2 _inst_3 _inst_4) P₁ (AffineSubspace.setLike.{u1, u2, u3} k V₁ P₁ _inst_1 _inst_2 _inst_3 _inst_4)) y s) (fun (H : Membership.Mem.{u3, u3} P₁ (AffineSubspace.{u1, u2, u3} k V₁ P₁ _inst_1 _inst_2 _inst_3 _inst_4) (SetLike.hasMem.{u3, u3} (AffineSubspace.{u1, u2, u3} k V₁ P₁ _inst_1 _inst_2 _inst_3 _inst_4) P₁ (AffineSubspace.setLike.{u1, u2, u3} k V₁ P₁ _inst_1 _inst_2 _inst_3 _inst_4)) y s) => Eq.{succ u5} P₂ (coeFn.{max (succ u2) (succ u3) (succ u4) (succ u5), max (succ u3) (succ u5)} (AffineMap.{u1, u2, u3, u4, u5} k V₁ P₁ V₂ P₂ _inst_1 _inst_2 _inst_3 _inst_4 _inst_5 _inst_6 _inst_7) (fun (_x : AffineMap.{u1, u2, u3, u4, u5} k V₁ P₁ V₂ P₂ _inst_1 _inst_2 _inst_3 _inst_4 _inst_5 _inst_6 _inst_7) => P₁ -> P₂) (AffineMap.hasCoeToFun.{u1, u2, u3, u4, u5} k V₁ P₁ V₂ P₂ _inst_1 _inst_2 _inst_3 _inst_4 _inst_5 _inst_6 _inst_7) f y) x))) but is expected to have type forall {k : Type.{u5}} {V₁ : Type.{u4}} {P₁ : Type.{u3}} {V₂ : Type.{u2}} {P₂ : Type.{u1}} [_inst_1 : Ring.{u5} k] [_inst_2 : AddCommGroup.{u4} V₁] [_inst_3 : Module.{u5, u4} k V₁ (Ring.toSemiring.{u5} k _inst_1) (AddCommGroup.toAddCommMonoid.{u4} V₁ _inst_2)] [_inst_4 : AddTorsor.{u4, u3} V₁ P₁ (AddCommGroup.toAddGroup.{u4} V₁ _inst_2)] [_inst_5 : AddCommGroup.{u2} V₂] [_inst_6 : Module.{u5, u2} k V₂ (Ring.toSemiring.{u5} k _inst_1) (AddCommGroup.toAddCommMonoid.{u2} V₂ _inst_5)] [_inst_7 : AddTorsor.{u2, u1} V₂ P₂ (AddCommGroup.toAddGroup.{u2} V₂ _inst_5)] {f : AffineMap.{u5, u4, u3, u2, u1} k V₁ P₁ V₂ P₂ _inst_1 _inst_2 _inst_3 _inst_4 _inst_5 _inst_6 _inst_7} {x : P₂} {s : AffineSubspace.{u5, u4, u3} k V₁ P₁ _inst_1 _inst_2 _inst_3 _inst_4}, Iff (Membership.mem.{u1, u1} P₂ (AffineSubspace.{u5, u2, u1} k V₂ P₂ _inst_1 _inst_5 _inst_6 _inst_7) (SetLike.instMembership.{u1, u1} (AffineSubspace.{u5, u2, u1} k V₂ P₂ _inst_1 _inst_5 _inst_6 _inst_7) P₂ (AffineSubspace.instSetLikeAffineSubspace.{u5, u2, u1} k V₂ P₂ _inst_1 _inst_5 _inst_6 _inst_7)) x (AffineSubspace.map.{u5, u4, u3, u2, u1} k V₁ P₁ V₂ P₂ _inst_1 _inst_2 _inst_3 _inst_4 _inst_5 _inst_6 _inst_7 f s)) (Exists.{succ u3} P₁ (fun (y : P₁) => And (Membership.mem.{u3, u3} P₁ (AffineSubspace.{u5, u4, u3} k V₁ P₁ _inst_1 _inst_2 _inst_3 _inst_4) (SetLike.instMembership.{u3, u3} (AffineSubspace.{u5, u4, u3} k V₁ P₁ _inst_1 _inst_2 _inst_3 _inst_4) P₁ (AffineSubspace.instSetLikeAffineSubspace.{u5, u4, u3} k V₁ P₁ _inst_1 _inst_2 _inst_3 _inst_4)) y s) (Eq.{succ u1} ((fun ([email protected]._hyg.1004 : P₁) => P₂) y) (FunLike.coe.{max (max (max (succ u4) (succ u3)) (succ u2)) (succ u1), succ u3, succ u1} (AffineMap.{u5, u4, u3, u2, u1} k V₁ P₁ V₂ P₂ _inst_1 _inst_2 _inst_3 _inst_4 _inst_5 _inst_6 _inst_7) P₁ (fun (a : P₁) => (fun ([email protected]._hyg.1004 : P₁) => P₂) a) (AffineMap.funLike.{u5, u4, u3, u2, u1} k V₁ P₁ V₂ P₂ _inst_1 _inst_2 _inst_3 _inst_4 _inst_5 _inst_6 _inst_7) f y) x))) Case conversion may be inaccurate. Consider using '#align affine_subspace.mem_map AffineSubspace.mem_mapₓ'. -/ @[simp] theorem mem_map {f : P₁ →ᵃ[k] P₂} {x : P₂} {s : AffineSubspace k P₁} : x ∈ s.map f ↔ ∃ y ∈ s, f y = x := mem_image_iff_bex #align affine_subspace.mem_map AffineSubspace.mem_map /- warning: affine_subspace.mem_map_of_mem -> AffineSubspace.mem_map_of_mem is a dubious translation: lean 3 declaration is forall {k : Type.{u1}} {V₁ : Type.{u2}} {P₁ : Type.{u3}} {V₂ : Type.{u4}} {P₂ : Type.{u5}} [_inst_1 : Ring.{u1} k] [_inst_2 : AddCommGroup.{u2} V₁] [_inst_3 : Module.{u1, u2} k V₁ (Ring.toSemiring.{u1} k _inst_1) (AddCommGroup.toAddCommMonoid.{u2} V₁ _inst_2)] [_inst_4 : AddTorsor.{u2, u3} V₁ P₁ (AddCommGroup.toAddGroup.{u2} V₁ _inst_2)] [_inst_5 : AddCommGroup.{u4} V₂] [_inst_6 : Module.{u1, u4} k V₂ (Ring.toSemiring.{u1} k _inst_1) (AddCommGroup.toAddCommMonoid.{u4} V₂ _inst_5)] [_inst_7 : AddTorsor.{u4, u5} V₂ P₂ (AddCommGroup.toAddGroup.{u4} V₂ _inst_5)] (f : AffineMap.{u1, u2, u3, u4, u5} k V₁ P₁ V₂ P₂ _inst_1 _inst_2 _inst_3 _inst_4 _inst_5 _inst_6 _inst_7) {x : P₁} {s : AffineSubspace.{u1, u2, u3} k V₁ P₁ _inst_1 _inst_2 _inst_3 _inst_4}, (Membership.Mem.{u3, u3} P₁ (AffineSubspace.{u1, u2, u3} k V₁ P₁ _inst_1 _inst_2 _inst_3 _inst_4) (SetLike.hasMem.{u3, u3} (AffineSubspace.{u1, u2, u3} k V₁ P₁ _inst_1 _inst_2 _inst_3 _inst_4) P₁ (AffineSubspace.setLike.{u1, u2, u3} k V₁ P₁ _inst_1 _inst_2 _inst_3 _inst_4)) x s) -> (Membership.Mem.{u5, u5} P₂ (AffineSubspace.{u1, u4, u5} k V₂ P₂ _inst_1 _inst_5 _inst_6 _inst_7) (SetLike.hasMem.{u5, u5} (AffineSubspace.{u1, u4, u5} k V₂ P₂ _inst_1 _inst_5 _inst_6 _inst_7) P₂ (AffineSubspace.setLike.{u1, u4, u5} k V₂ P₂ _inst_1 _inst_5 _inst_6 _inst_7)) (coeFn.{max (succ u2) (succ u3) (succ u4) (succ u5), max (succ u3) (succ u5)} (AffineMap.{u1, u2, u3, u4, u5} k V₁ P₁ V₂ P₂ _inst_1 _inst_2 _inst_3 _inst_4 _inst_5 _inst_6 _inst_7) (fun (_x : AffineMap.{u1, u2, u3, u4, u5} k V₁ P₁ V₂ P₂ _inst_1 _inst_2 _inst_3 _inst_4 _inst_5 _inst_6 _inst_7) => P₁ -> P₂) (AffineMap.hasCoeToFun.{u1, u2, u3, u4, u5} k V₁ P₁ V₂ P₂ _inst_1 _inst_2 _inst_3 _inst_4 _inst_5 _inst_6 _inst_7) f x) (AffineSubspace.map.{u1, u2, u3, u4, u5} k V₁ P₁ V₂ P₂ _inst_1 _inst_2 _inst_3 _inst_4 _inst_5 _inst_6 _inst_7 f s)) but is expected to have type forall {k : Type.{u5}} {V₁ : Type.{u4}} {P₁ : Type.{u3}} {V₂ : Type.{u1}} {P₂ : Type.{u2}} [_inst_1 : Ring.{u5} k] [_inst_2 : AddCommGroup.{u4} V₁] [_inst_3 : Module.{u5, u4} k V₁ (Ring.toSemiring.{u5} k _inst_1) (AddCommGroup.toAddCommMonoid.{u4} V₁ _inst_2)] [_inst_4 : AddTorsor.{u4, u3} V₁ P₁ (AddCommGroup.toAddGroup.{u4} V₁ _inst_2)] [_inst_5 : AddCommGroup.{u1} V₂] [_inst_6 : Module.{u5, u1} k V₂ (Ring.toSemiring.{u5} k _inst_1) (AddCommGroup.toAddCommMonoid.{u1} V₂ _inst_5)] [_inst_7 : AddTorsor.{u1, u2} V₂ P₂ (AddCommGroup.toAddGroup.{u1} V₂ _inst_5)] (f : AffineMap.{u5, u4, u3, u1, u2} k V₁ P₁ V₂ P₂ _inst_1 _inst_2 _inst_3 _inst_4 _inst_5 _inst_6 _inst_7) {x : P₁} {s : AffineSubspace.{u5, u4, u3} k V₁ P₁ _inst_1 _inst_2 _inst_3 _inst_4}, (Membership.mem.{u3, u3} P₁ (AffineSubspace.{u5, u4, u3} k V₁ P₁ _inst_1 _inst_2 _inst_3 _inst_4) (SetLike.instMembership.{u3, u3} (AffineSubspace.{u5, u4, u3} k V₁ P₁ _inst_1 _inst_2 _inst_3 _inst_4) P₁ (AffineSubspace.instSetLikeAffineSubspace.{u5, u4, u3} k V₁ P₁ _inst_1 _inst_2 _inst_3 _inst_4)) x s) -> (Membership.mem.{u2, u2} ((fun ([email protected]._hyg.1004 : P₁) => P₂) x) (AffineSubspace.{u5, u1, u2} k V₂ P₂ _inst_1 _inst_5 _inst_6 _inst_7) (SetLike.instMembership.{u2, u2} (AffineSubspace.{u5, u1, u2} k V₂ P₂ _inst_1 _inst_5 _inst_6 _inst_7) P₂ (AffineSubspace.instSetLikeAffineSubspace.{u5, u1, u2} k V₂ P₂ _inst_1 _inst_5 _inst_6 _inst_7)) (FunLike.coe.{max (max (max (succ u4) (succ u3)) (succ u1)) (succ u2), succ u3, succ u2} (AffineMap.{u5, u4, u3, u1, u2} k V₁ P₁ V₂ P₂ _inst_1 _inst_2 _inst_3 _inst_4 _inst_5 _inst_6 _inst_7) P₁ (fun (_x : P₁) => (fun ([email protected]._hyg.1004 : P₁) => P₂) _x) (AffineMap.funLike.{u5, u4, u3, u1, u2} k V₁ P₁ V₂ P₂ _inst_1 _inst_2 _inst_3 _inst_4 _inst_5 _inst_6 _inst_7) f x) (AffineSubspace.map.{u5, u4, u3, u1, u2} k V₁ P₁ V₂ P₂ _inst_1 _inst_2 _inst_3 _inst_4 _inst_5 _inst_6 _inst_7 f s)) Case conversion may be inaccurate. Consider using '#align affine_subspace.mem_map_of_mem AffineSubspace.mem_map_of_memₓ'. -/ theorem mem_map_of_mem {x : P₁} {s : AffineSubspace k P₁} (h : x ∈ s) : f x ∈ s.map f := Set.mem_image_of_mem _ h #align affine_subspace.mem_map_of_mem AffineSubspace.mem_map_of_mem /- warning: affine_subspace.mem_map_iff_mem_of_injective -> AffineSubspace.mem_map_iff_mem_of_injective is a dubious translation: lean 3 declaration is forall {k : Type.{u1}} {V₁ : Type.{u2}} {P₁ : Type.{u3}} {V₂ : Type.{u4}} {P₂ : Type.{u5}} [_inst_1 : Ring.{u1} k] [_inst_2 : AddCommGroup.{u2} V₁] [_inst_3 : Module.{u1, u2} k V₁ (Ring.toSemiring.{u1} k _inst_1) (AddCommGroup.toAddCommMonoid.{u2} V₁ _inst_2)] [_inst_4 : AddTorsor.{u2, u3} V₁ P₁ (AddCommGroup.toAddGroup.{u2} V₁ _inst_2)] [_inst_5 : AddCommGroup.{u4} V₂] [_inst_6 : Module.{u1, u4} k V₂ (Ring.toSemiring.{u1} k _inst_1) (AddCommGroup.toAddCommMonoid.{u4} V₂ _inst_5)] [_inst_7 : AddTorsor.{u4, u5} V₂ P₂ (AddCommGroup.toAddGroup.{u4} V₂ _inst_5)] {f : AffineMap.{u1, u2, u3, u4, u5} k V₁ P₁ V₂ P₂ _inst_1 _inst_2 _inst_3 _inst_4 _inst_5 _inst_6 _inst_7} {x : P₁} {s : AffineSubspace.{u1, u2, u3} k V₁ P₁ _inst_1 _inst_2 _inst_3 _inst_4}, (Function.Injective.{succ u3, succ u5} P₁ P₂ (coeFn.{max (succ u2) (succ u3) (succ u4) (succ u5), max (succ u3) (succ u5)} (AffineMap.{u1, u2, u3, u4, u5} k V₁ P₁ V₂ P₂ _inst_1 _inst_2 _inst_3 _inst_4 _inst_5 _inst_6 _inst_7) (fun (_x : AffineMap.{u1, u2, u3, u4, u5} k V₁ P₁ V₂ P₂ _inst_1 _inst_2 _inst_3 _inst_4 _inst_5 _inst_6 _inst_7) => P₁ -> P₂) (AffineMap.hasCoeToFun.{u1, u2, u3, u4, u5} k V₁ P₁ V₂ P₂ _inst_1 _inst_2 _inst_3 _inst_4 _inst_5 _inst_6 _inst_7) f)) -> (Iff (Membership.Mem.{u5, u5} P₂ (AffineSubspace.{u1, u4, u5} k V₂ P₂ _inst_1 _inst_5 _inst_6 _inst_7) (SetLike.hasMem.{u5, u5} (AffineSubspace.{u1, u4, u5} k V₂ P₂ _inst_1 _inst_5 _inst_6 _inst_7) P₂ (AffineSubspace.setLike.{u1, u4, u5} k V₂ P₂ _inst_1 _inst_5 _inst_6 _inst_7)) (coeFn.{max (succ u2) (succ u3) (succ u4) (succ u5), max (succ u3) (succ u5)} (AffineMap.{u1, u2, u3, u4, u5} k V₁ P₁ V₂ P₂ _inst_1 _inst_2 _inst_3 _inst_4 _inst_5 _inst_6 _inst_7) (fun (_x : AffineMap.{u1, u2, u3, u4, u5} k V₁ P₁ V₂ P₂ _inst_1 _inst_2 _inst_3 _inst_4 _inst_5 _inst_6 _inst_7) => P₁ -> P₂) (AffineMap.hasCoeToFun.{u1, u2, u3, u4, u5} k V₁ P₁ V₂ P₂ _inst_1 _inst_2 _inst_3 _inst_4 _inst_5 _inst_6 _inst_7) f x) (AffineSubspace.map.{u1, u2, u3, u4, u5} k V₁ P₁ V₂ P₂ _inst_1 _inst_2 _inst_3 _inst_4 _inst_5 _inst_6 _inst_7 f s)) (Membership.Mem.{u3, u3} P₁ (AffineSubspace.{u1, u2, u3} k V₁ P₁ _inst_1 _inst_2 _inst_3 _inst_4) (SetLike.hasMem.{u3, u3} (AffineSubspace.{u1, u2, u3} k V₁ P₁ _inst_1 _inst_2 _inst_3 _inst_4) P₁ (AffineSubspace.setLike.{u1, u2, u3} k V₁ P₁ _inst_1 _inst_2 _inst_3 _inst_4)) x s)) but is expected to have type forall {k : Type.{u5}} {V₁ : Type.{u4}} {P₁ : Type.{u3}} {V₂ : Type.{u2}} {P₂ : Type.{u1}} [_inst_1 : Ring.{u5} k] [_inst_2 : AddCommGroup.{u4} V₁] [_inst_3 : Module.{u5, u4} k V₁ (Ring.toSemiring.{u5} k _inst_1) (AddCommGroup.toAddCommMonoid.{u4} V₁ _inst_2)] [_inst_4 : AddTorsor.{u4, u3} V₁ P₁ (AddCommGroup.toAddGroup.{u4} V₁ _inst_2)] [_inst_5 : AddCommGroup.{u2} V₂] [_inst_6 : Module.{u5, u2} k V₂ (Ring.toSemiring.{u5} k _inst_1) (AddCommGroup.toAddCommMonoid.{u2} V₂ _inst_5)] [_inst_7 : AddTorsor.{u2, u1} V₂ P₂ (AddCommGroup.toAddGroup.{u2} V₂ _inst_5)] {f : AffineMap.{u5, u4, u3, u2, u1} k V₁ P₁ V₂ P₂ _inst_1 _inst_2 _inst_3 _inst_4 _inst_5 _inst_6 _inst_7} {x : P₁} {s : AffineSubspace.{u5, u4, u3} k V₁ P₁ _inst_1 _inst_2 _inst_3 _inst_4}, (Function.Injective.{succ u3, succ u1} P₁ P₂ (FunLike.coe.{max (max (max (succ u4) (succ u3)) (succ u2)) (succ u1), succ u3, succ u1} (AffineMap.{u5, u4, u3, u2, u1} k V₁ P₁ V₂ P₂ _inst_1 _inst_2 _inst_3 _inst_4 _inst_5 _inst_6 _inst_7) P₁ (fun (_x : P₁) => (fun ([email protected]._hyg.1004 : P₁) => P₂) _x) (AffineMap.funLike.{u5, u4, u3, u2, u1} k V₁ P₁ V₂ P₂ _inst_1 _inst_2 _inst_3 _inst_4 _inst_5 _inst_6 _inst_7) f)) -> (Iff (Membership.mem.{u1, u1} ((fun ([email protected]._hyg.1004 : P₁) => P₂) x) (AffineSubspace.{u5, u2, u1} k V₂ P₂ _inst_1 _inst_5 _inst_6 _inst_7) (SetLike.instMembership.{u1, u1} (AffineSubspace.{u5, u2, u1} k V₂ P₂ _inst_1 _inst_5 _inst_6 _inst_7) P₂ (AffineSubspace.instSetLikeAffineSubspace.{u5, u2, u1} k V₂ P₂ _inst_1 _inst_5 _inst_6 _inst_7)) (FunLike.coe.{max (max (max (succ u4) (succ u3)) (succ u2)) (succ u1), succ u3, succ u1} (AffineMap.{u5, u4, u3, u2, u1} k V₁ P₁ V₂ P₂ _inst_1 _inst_2 _inst_3 _inst_4 _inst_5 _inst_6 _inst_7) P₁ (fun (_x : P₁) => (fun ([email protected]._hyg.1004 : P₁) => P₂) _x) (AffineMap.funLike.{u5, u4, u3, u2, u1} k V₁ P₁ V₂ P₂ _inst_1 _inst_2 _inst_3 _inst_4 _inst_5 _inst_6 _inst_7) f x) (AffineSubspace.map.{u5, u4, u3, u2, u1} k V₁ P₁ V₂ P₂ _inst_1 _inst_2 _inst_3 _inst_4 _inst_5 _inst_6 _inst_7 f s)) (Membership.mem.{u3, u3} P₁ (AffineSubspace.{u5, u4, u3} k V₁ P₁ _inst_1 _inst_2 _inst_3 _inst_4) (SetLike.instMembership.{u3, u3} (AffineSubspace.{u5, u4, u3} k V₁ P₁ _inst_1 _inst_2 _inst_3 _inst_4) P₁ (AffineSubspace.instSetLikeAffineSubspace.{u5, u4, u3} k V₁ P₁ _inst_1 _inst_2 _inst_3 _inst_4)) x s)) Case conversion may be inaccurate. Consider using '#align affine_subspace.mem_map_iff_mem_of_injective AffineSubspace.mem_map_iff_mem_of_injectiveₓ'. -/ theorem mem_map_iff_mem_of_injective {f : P₁ →ᵃ[k] P₂} {x : P₁} {s : AffineSubspace k P₁} (hf : Function.Injective f) : f x ∈ s.map f ↔ x ∈ s := hf.mem_set_image #align affine_subspace.mem_map_iff_mem_of_injective AffineSubspace.mem_map_iff_mem_of_injective /- warning: affine_subspace.map_bot -> AffineSubspace.map_bot is a dubious translation: lean 3 declaration is forall {k : Type.{u1}} {V₁ : Type.{u2}} {P₁ : Type.{u3}} {V₂ : Type.{u4}} {P₂ : Type.{u5}} [_inst_1 : Ring.{u1} k] [_inst_2 : AddCommGroup.{u2} V₁] [_inst_3 : Module.{u1, u2} k V₁ (Ring.toSemiring.{u1} k _inst_1) (AddCommGroup.toAddCommMonoid.{u2} V₁ _inst_2)] [_inst_4 : AddTorsor.{u2, u3} V₁ P₁ (AddCommGroup.toAddGroup.{u2} V₁ _inst_2)] [_inst_5 : AddCommGroup.{u4} V₂] [_inst_6 : Module.{u1, u4} k V₂ (Ring.toSemiring.{u1} k _inst_1) (AddCommGroup.toAddCommMonoid.{u4} V₂ _inst_5)] [_inst_7 : AddTorsor.{u4, u5} V₂ P₂ (AddCommGroup.toAddGroup.{u4} V₂ _inst_5)] (f : AffineMap.{u1, u2, u3, u4, u5} k V₁ P₁ V₂ P₂ _inst_1 _inst_2 _inst_3 _inst_4 _inst_5 _inst_6 _inst_7), Eq.{succ u5} (AffineSubspace.{u1, u4, u5} k V₂ P₂ _inst_1 _inst_5 _inst_6 _inst_7) (AffineSubspace.map.{u1, u2, u3, u4, u5} k V₁ P₁ V₂ P₂ _inst_1 _inst_2 _inst_3 _inst_4 _inst_5 _inst_6 _inst_7 f (Bot.bot.{u3} (AffineSubspace.{u1, u2, u3} k V₁ P₁ _inst_1 _inst_2 _inst_3 _inst_4) (CompleteLattice.toHasBot.{u3} (AffineSubspace.{u1, u2, u3} k V₁ P₁ _inst_1 _inst_2 _inst_3 _inst_4) (AffineSubspace.completeLattice.{u1, u2, u3} k V₁ P₁ _inst_1 _inst_2 _inst_3 _inst_4)))) (Bot.bot.{u5} (AffineSubspace.{u1, u4, u5} k V₂ P₂ _inst_1 _inst_5 _inst_6 _inst_7) (CompleteLattice.toHasBot.{u5} (AffineSubspace.{u1, u4, u5} k V₂ P₂ _inst_1 _inst_5 _inst_6 _inst_7) (AffineSubspace.completeLattice.{u1, u4, u5} k V₂ P₂ _inst_1 _inst_5 _inst_6 _inst_7))) but is expected to have type forall {k : Type.{u4}} {V₁ : Type.{u2}} {P₁ : Type.{u1}} {V₂ : Type.{u3}} {P₂ : Type.{u5}} [_inst_1 : Ring.{u4} k] [_inst_2 : AddCommGroup.{u2} V₁] [_inst_3 : Module.{u4, u2} k V₁ (Ring.toSemiring.{u4} k _inst_1) (AddCommGroup.toAddCommMonoid.{u2} V₁ _inst_2)] [_inst_4 : AddTorsor.{u2, u1} V₁ P₁ (AddCommGroup.toAddGroup.{u2} V₁ _inst_2)] [_inst_5 : AddCommGroup.{u3} V₂] [_inst_6 : Module.{u4, u3} k V₂ (Ring.toSemiring.{u4} k _inst_1) (AddCommGroup.toAddCommMonoid.{u3} V₂ _inst_5)] [_inst_7 : AddTorsor.{u3, u5} V₂ P₂ (AddCommGroup.toAddGroup.{u3} V₂ _inst_5)] (f : AffineMap.{u4, u2, u1, u3, u5} k V₁ P₁ V₂ P₂ _inst_1 _inst_2 _inst_3 _inst_4 _inst_5 _inst_6 _inst_7), Eq.{succ u5} (AffineSubspace.{u4, u3, u5} k V₂ P₂ _inst_1 _inst_5 _inst_6 _inst_7) (AffineSubspace.map.{u4, u2, u1, u3, u5} k V₁ P₁ V₂ P₂ _inst_1 _inst_2 _inst_3 _inst_4 _inst_5 _inst_6 _inst_7 f (Bot.bot.{u1} (AffineSubspace.{u4, u2, u1} k V₁ P₁ _inst_1 _inst_2 _inst_3 _inst_4) (CompleteLattice.toBot.{u1} (AffineSubspace.{u4, u2, u1} k V₁ P₁ _inst_1 _inst_2 _inst_3 _inst_4) (AffineSubspace.instCompleteLatticeAffineSubspace.{u4, u2, u1} k V₁ P₁ _inst_1 _inst_2 _inst_3 _inst_4)))) (Bot.bot.{u5} (AffineSubspace.{u4, u3, u5} k V₂ P₂ _inst_1 _inst_5 _inst_6 _inst_7) (CompleteLattice.toBot.{u5} (AffineSubspace.{u4, u3, u5} k V₂ P₂ _inst_1 _inst_5 _inst_6 _inst_7) (AffineSubspace.instCompleteLatticeAffineSubspace.{u4, u3, u5} k V₂ P₂ _inst_1 _inst_5 _inst_6 _inst_7))) Case conversion may be inaccurate. Consider using '#align affine_subspace.map_bot AffineSubspace.map_botₓ'. -/ @[simp] theorem map_bot : (⊥ : AffineSubspace k P₁).map f = ⊥ := coe_injective <| image_empty f #align affine_subspace.map_bot AffineSubspace.map_bot /- warning: affine_subspace.map_eq_bot_iff -> AffineSubspace.map_eq_bot_iff is a dubious translation: lean 3 declaration is forall {k : Type.{u1}} {V₁ : Type.{u2}} {P₁ : Type.{u3}} {V₂ : Type.{u4}} {P₂ : Type.{u5}} [_inst_1 : Ring.{u1} k] [_inst_2 : AddCommGroup.{u2} V₁] [_inst_3 : Module.{u1, u2} k V₁ (Ring.toSemiring.{u1} k _inst_1) (AddCommGroup.toAddCommMonoid.{u2} V₁ _inst_2)] [_inst_4 : AddTorsor.{u2, u3} V₁ P₁ (AddCommGroup.toAddGroup.{u2} V₁ _inst_2)] [_inst_5 : AddCommGroup.{u4} V₂] [_inst_6 : Module.{u1, u4} k V₂ (Ring.toSemiring.{u1} k _inst_1) (AddCommGroup.toAddCommMonoid.{u4} V₂ _inst_5)] [_inst_7 : AddTorsor.{u4, u5} V₂ P₂ (AddCommGroup.toAddGroup.{u4} V₂ _inst_5)] (f : AffineMap.{u1, u2, u3, u4, u5} k V₁ P₁ V₂ P₂ _inst_1 _inst_2 _inst_3 _inst_4 _inst_5 _inst_6 _inst_7) {s : AffineSubspace.{u1, u2, u3} k V₁ P₁ _inst_1 _inst_2 _inst_3 _inst_4}, Iff (Eq.{succ u5} (AffineSubspace.{u1, u4, u5} k V₂ P₂ _inst_1 _inst_5 _inst_6 _inst_7) (AffineSubspace.map.{u1, u2, u3, u4, u5} k V₁ P₁ V₂ P₂ _inst_1 _inst_2 _inst_3 _inst_4 _inst_5 _inst_6 _inst_7 f s) (Bot.bot.{u5} (AffineSubspace.{u1, u4, u5} k V₂ P₂ _inst_1 _inst_5 _inst_6 _inst_7) (CompleteLattice.toHasBot.{u5} (AffineSubspace.{u1, u4, u5} k V₂ P₂ _inst_1 _inst_5 _inst_6 _inst_7) (AffineSubspace.completeLattice.{u1, u4, u5} k V₂ P₂ _inst_1 _inst_5 _inst_6 _inst_7)))) (Eq.{succ u3} (AffineSubspace.{u1, u2, u3} k V₁ P₁ _inst_1 _inst_2 _inst_3 _inst_4) s (Bot.bot.{u3} (AffineSubspace.{u1, u2, u3} k V₁ P₁ _inst_1 _inst_2 _inst_3 _inst_4) (CompleteLattice.toHasBot.{u3} (AffineSubspace.{u1, u2, u3} k V₁ P₁ _inst_1 _inst_2 _inst_3 _inst_4) (AffineSubspace.completeLattice.{u1, u2, u3} k V₁ P₁ _inst_1 _inst_2 _inst_3 _inst_4)))) but is expected to have type forall {k : Type.{u5}} {V₁ : Type.{u4}} {P₁ : Type.{u3}} {V₂ : Type.{u1}} {P₂ : Type.{u2}} [_inst_1 : Ring.{u5} k] [_inst_2 : AddCommGroup.{u4} V₁] [_inst_3 : Module.{u5, u4} k V₁ (Ring.toSemiring.{u5} k _inst_1) (AddCommGroup.toAddCommMonoid.{u4} V₁ _inst_2)] [_inst_4 : AddTorsor.{u4, u3} V₁ P₁ (AddCommGroup.toAddGroup.{u4} V₁ _inst_2)] [_inst_5 : AddCommGroup.{u1} V₂] [_inst_6 : Module.{u5, u1} k V₂ (Ring.toSemiring.{u5} k _inst_1) (AddCommGroup.toAddCommMonoid.{u1} V₂ _inst_5)] [_inst_7 : AddTorsor.{u1, u2} V₂ P₂ (AddCommGroup.toAddGroup.{u1} V₂ _inst_5)] (f : AffineMap.{u5, u4, u3, u1, u2} k V₁ P₁ V₂ P₂ _inst_1 _inst_2 _inst_3 _inst_4 _inst_5 _inst_6 _inst_7) {s : AffineSubspace.{u5, u4, u3} k V₁ P₁ _inst_1 _inst_2 _inst_3 _inst_4}, Iff (Eq.{succ u2} (AffineSubspace.{u5, u1, u2} k V₂ P₂ _inst_1 _inst_5 _inst_6 _inst_7) (AffineSubspace.map.{u5, u4, u3, u1, u2} k V₁ P₁ V₂ P₂ _inst_1 _inst_2 _inst_3 _inst_4 _inst_5 _inst_6 _inst_7 f s) (Bot.bot.{u2} (AffineSubspace.{u5, u1, u2} k V₂ P₂ _inst_1 _inst_5 _inst_6 _inst_7) (CompleteLattice.toBot.{u2} (AffineSubspace.{u5, u1, u2} k V₂ P₂ _inst_1 _inst_5 _inst_6 _inst_7) (AffineSubspace.instCompleteLatticeAffineSubspace.{u5, u1, u2} k V₂ P₂ _inst_1 _inst_5 _inst_6 _inst_7)))) (Eq.{succ u3} (AffineSubspace.{u5, u4, u3} k V₁ P₁ _inst_1 _inst_2 _inst_3 _inst_4) s (Bot.bot.{u3} (AffineSubspace.{u5, u4, u3} k V₁ P₁ _inst_1 _inst_2 _inst_3 _inst_4) (CompleteLattice.toBot.{u3} (AffineSubspace.{u5, u4, u3} k V₁ P₁ _inst_1 _inst_2 _inst_3 _inst_4) (AffineSubspace.instCompleteLatticeAffineSubspace.{u5, u4, u3} k V₁ P₁ _inst_1 _inst_2 _inst_3 _inst_4)))) Case conversion may be inaccurate. Consider using '#align affine_subspace.map_eq_bot_iff AffineSubspace.map_eq_bot_iffₓ'. -/ @[simp] theorem map_eq_bot_iff {s : AffineSubspace k P₁} : s.map f = ⊥ ↔ s = ⊥ := by refine' ⟨fun h => _, fun h => _⟩ · rwa [← coe_eq_bot_iff, coe_map, image_eq_empty, coe_eq_bot_iff] at h · rw [h, map_bot] #align affine_subspace.map_eq_bot_iff AffineSubspace.map_eq_bot_iff omit V₂ /- warning: affine_subspace.map_id -> AffineSubspace.map_id is a dubious translation: lean 3 declaration is forall {k : Type.{u1}} {V₁ : Type.{u2}} {P₁ : Type.{u3}} [_inst_1 : Ring.{u1} k] [_inst_2 : AddCommGroup.{u2} V₁] [_inst_3 : Module.{u1, u2} k V₁ (Ring.toSemiring.{u1} k _inst_1) (AddCommGroup.toAddCommMonoid.{u2} V₁ _inst_2)] [_inst_4 : AddTorsor.{u2, u3} V₁ P₁ (AddCommGroup.toAddGroup.{u2} V₁ _inst_2)] (s : AffineSubspace.{u1, u2, u3} k V₁ P₁ _inst_1 _inst_2 _inst_3 _inst_4), Eq.{succ u3} (AffineSubspace.{u1, u2, u3} k V₁ P₁ _inst_1 _inst_2 _inst_3 _inst_4) (AffineSubspace.map.{u1, u2, u3, u2, u3} k V₁ P₁ V₁ P₁ _inst_1 _inst_2 _inst_3 _inst_4 _inst_2 _inst_3 _inst_4 (AffineMap.id.{u1, u2, u3} k V₁ P₁ _inst_1 _inst_2 _inst_3 _inst_4) s) s but is expected to have type forall {k : Type.{u3}} {V₁ : Type.{u2}} {P₁ : Type.{u1}} [_inst_1 : Ring.{u3} k] [_inst_2 : AddCommGroup.{u2} V₁] [_inst_3 : Module.{u3, u2} k V₁ (Ring.toSemiring.{u3} k _inst_1) (AddCommGroup.toAddCommMonoid.{u2} V₁ _inst_2)] [_inst_4 : AddTorsor.{u2, u1} V₁ P₁ (AddCommGroup.toAddGroup.{u2} V₁ _inst_2)] (s : AffineSubspace.{u3, u2, u1} k V₁ P₁ _inst_1 _inst_2 _inst_3 _inst_4), Eq.{succ u1} (AffineSubspace.{u3, u2, u1} k V₁ P₁ _inst_1 _inst_2 _inst_3 _inst_4) (AffineSubspace.map.{u3, u2, u1, u2, u1} k V₁ P₁ V₁ P₁ _inst_1 _inst_2 _inst_3 _inst_4 _inst_2 _inst_3 _inst_4 (AffineMap.id.{u3, u2, u1} k V₁ P₁ _inst_1 _inst_2 _inst_3 _inst_4) s) s Case conversion may be inaccurate. Consider using '#align affine_subspace.map_id AffineSubspace.map_idₓ'. -/ @[simp] theorem map_id (s : AffineSubspace k P₁) : s.map (AffineMap.id k P₁) = s := coe_injective <| image_id _ #align affine_subspace.map_id AffineSubspace.map_id include V₂ V₃ /- warning: affine_subspace.map_map -> AffineSubspace.map_map is a dubious translation: lean 3 declaration is forall {k : Type.{u1}} {V₁ : Type.{u2}} {P₁ : Type.{u3}} {V₂ : Type.{u4}} {P₂ : Type.{u5}} {V₃ : Type.{u6}} {P₃ : Type.{u7}} [_inst_1 : Ring.{u1} k] [_inst_2 : AddCommGroup.{u2} V₁] [_inst_3 : Module.{u1, u2} k V₁ (Ring.toSemiring.{u1} k _inst_1) (AddCommGroup.toAddCommMonoid.{u2} V₁ _inst_2)] [_inst_4 : AddTorsor.{u2, u3} V₁ P₁ (AddCommGroup.toAddGroup.{u2} V₁ _inst_2)] [_inst_5 : AddCommGroup.{u4} V₂] [_inst_6 : Module.{u1, u4} k V₂ (Ring.toSemiring.{u1} k _inst_1) (AddCommGroup.toAddCommMonoid.{u4} V₂ _inst_5)] [_inst_7 : AddTorsor.{u4, u5} V₂ P₂ (AddCommGroup.toAddGroup.{u4} V₂ _inst_5)] [_inst_8 : AddCommGroup.{u6} V₃] [_inst_9 : Module.{u1, u6} k V₃ (Ring.toSemiring.{u1} k _inst_1) (AddCommGroup.toAddCommMonoid.{u6} V₃ _inst_8)] [_inst_10 : AddTorsor.{u6, u7} V₃ P₃ (AddCommGroup.toAddGroup.{u6} V₃ _inst_8)] (s : AffineSubspace.{u1, u2, u3} k V₁ P₁ _inst_1 _inst_2 _inst_3 _inst_4) (f : AffineMap.{u1, u2, u3, u4, u5} k V₁ P₁ V₂ P₂ _inst_1 _inst_2 _inst_3 _inst_4 _inst_5 _inst_6 _inst_7) (g : AffineMap.{u1, u4, u5, u6, u7} k V₂ P₂ V₃ P₃ _inst_1 _inst_5 _inst_6 _inst_7 _inst_8 _inst_9 _inst_10), Eq.{succ u7} (AffineSubspace.{u1, u6, u7} k V₃ P₃ _inst_1 _inst_8 _inst_9 _inst_10) (AffineSubspace.map.{u1, u4, u5, u6, u7} k V₂ P₂ V₃ P₃ _inst_1 _inst_5 _inst_6 _inst_7 _inst_8 _inst_9 _inst_10 g (AffineSubspace.map.{u1, u2, u3, u4, u5} k V₁ P₁ V₂ P₂ _inst_1 _inst_2 _inst_3 _inst_4 _inst_5 _inst_6 _inst_7 f s)) (AffineSubspace.map.{u1, u2, u3, u6, u7} k V₁ P₁ V₃ P₃ _inst_1 _inst_2 _inst_3 _inst_4 _inst_8 _inst_9 _inst_10 (AffineMap.comp.{u1, u2, u3, u4, u5, u6, u7} k V₁ P₁ V₂ P₂ V₃ P₃ _inst_1 _inst_2 _inst_3 _inst_4 _inst_5 _inst_6 _inst_7 _inst_8 _inst_9 _inst_10 g f) s) but is expected to have type forall {k : Type.{u7}} {V₁ : Type.{u6}} {P₁ : Type.{u5}} {V₂ : Type.{u4}} {P₂ : Type.{u3}} {V₃ : Type.{u2}} {P₃ : Type.{u1}} [_inst_1 : Ring.{u7} k] [_inst_2 : AddCommGroup.{u6} V₁] [_inst_3 : Module.{u7, u6} k V₁ (Ring.toSemiring.{u7} k _inst_1) (AddCommGroup.toAddCommMonoid.{u6} V₁ _inst_2)] [_inst_4 : AddTorsor.{u6, u5} V₁ P₁ (AddCommGroup.toAddGroup.{u6} V₁ _inst_2)] [_inst_5 : AddCommGroup.{u4} V₂] [_inst_6 : Module.{u7, u4} k V₂ (Ring.toSemiring.{u7} k _inst_1) (AddCommGroup.toAddCommMonoid.{u4} V₂ _inst_5)] [_inst_7 : AddTorsor.{u4, u3} V₂ P₂ (AddCommGroup.toAddGroup.{u4} V₂ _inst_5)] [_inst_8 : AddCommGroup.{u2} V₃] [_inst_9 : Module.{u7, u2} k V₃ (Ring.toSemiring.{u7} k _inst_1) (AddCommGroup.toAddCommMonoid.{u2} V₃ _inst_8)] [_inst_10 : AddTorsor.{u2, u1} V₃ P₃ (AddCommGroup.toAddGroup.{u2} V₃ _inst_8)] (s : AffineSubspace.{u7, u6, u5} k V₁ P₁ _inst_1 _inst_2 _inst_3 _inst_4) (f : AffineMap.{u7, u6, u5, u4, u3} k V₁ P₁ V₂ P₂ _inst_1 _inst_2 _inst_3 _inst_4 _inst_5 _inst_6 _inst_7) (g : AffineMap.{u7, u4, u3, u2, u1} k V₂ P₂ V₃ P₃ _inst_1 _inst_5 _inst_6 _inst_7 _inst_8 _inst_9 _inst_10), Eq.{succ u1} (AffineSubspace.{u7, u2, u1} k V₃ P₃ _inst_1 _inst_8 _inst_9 _inst_10) (AffineSubspace.map.{u7, u4, u3, u2, u1} k V₂ P₂ V₃ P₃ _inst_1 _inst_5 _inst_6 _inst_7 _inst_8 _inst_9 _inst_10 g (AffineSubspace.map.{u7, u6, u5, u4, u3} k V₁ P₁ V₂ P₂ _inst_1 _inst_2 _inst_3 _inst_4 _inst_5 _inst_6 _inst_7 f s)) (AffineSubspace.map.{u7, u6, u5, u2, u1} k V₁ P₁ V₃ P₃ _inst_1 _inst_2 _inst_3 _inst_4 _inst_8 _inst_9 _inst_10 (AffineMap.comp.{u7, u6, u5, u4, u3, u2, u1} k V₁ P₁ V₂ P₂ V₃ P₃ _inst_1 _inst_2 _inst_3 _inst_4 _inst_5 _inst_6 _inst_7 _inst_8 _inst_9 _inst_10 g f) s) Case conversion may be inaccurate. Consider using '#align affine_subspace.map_map AffineSubspace.map_mapₓ'. -/ theorem map_map (s : AffineSubspace k P₁) (f : P₁ →ᵃ[k] P₂) (g : P₂ →ᵃ[k] P₃) : (s.map f).map g = s.map (g.comp f) := coe_injective <| image_image _ _ _ #align affine_subspace.map_map AffineSubspace.map_map omit V₃ /- warning: affine_subspace.map_direction -> AffineSubspace.map_direction is a dubious translation: lean 3 declaration is forall {k : Type.{u1}} {V₁ : Type.{u2}} {P₁ : Type.{u3}} {V₂ : Type.{u4}} {P₂ : Type.{u5}} [_inst_1 : Ring.{u1} k] [_inst_2 : AddCommGroup.{u2} V₁] [_inst_3 : Module.{u1, u2} k V₁ (Ring.toSemiring.{u1} k _inst_1) (AddCommGroup.toAddCommMonoid.{u2} V₁ _inst_2)] [_inst_4 : AddTorsor.{u2, u3} V₁ P₁ (AddCommGroup.toAddGroup.{u2} V₁ _inst_2)] [_inst_5 : AddCommGroup.{u4} V₂] [_inst_6 : Module.{u1, u4} k V₂ (Ring.toSemiring.{u1} k _inst_1) (AddCommGroup.toAddCommMonoid.{u4} V₂ _inst_5)] [_inst_7 : AddTorsor.{u4, u5} V₂ P₂ (AddCommGroup.toAddGroup.{u4} V₂ _inst_5)] (f : AffineMap.{u1, u2, u3, u4, u5} k V₁ P₁ V₂ P₂ _inst_1 _inst_2 _inst_3 _inst_4 _inst_5 _inst_6 _inst_7) (s : AffineSubspace.{u1, u2, u3} k V₁ P₁ _inst_1 _inst_2 _inst_3 _inst_4), Eq.{succ u4} (Submodule.{u1, u4} k V₂ (Ring.toSemiring.{u1} k _inst_1) (AddCommGroup.toAddCommMonoid.{u4} V₂ _inst_5) _inst_6) (AffineSubspace.direction.{u1, u4, u5} k V₂ P₂ _inst_1 _inst_5 _inst_6 _inst_7 (AffineSubspace.map.{u1, u2, u3, u4, u5} k V₁ P₁ V₂ P₂ _inst_1 _inst_2 _inst_3 _inst_4 _inst_5 _inst_6 _inst_7 f s)) (Submodule.map.{u1, u1, u2, u4, max u2 u4} k k V₁ V₂ (Ring.toSemiring.{u1} k _inst_1) (Ring.toSemiring.{u1} k _inst_1) (AddCommGroup.toAddCommMonoid.{u2} V₁ _inst_2) (AddCommGroup.toAddCommMonoid.{u4} V₂ _inst_5) _inst_3 _inst_6 (RingHom.id.{u1} k (Semiring.toNonAssocSemiring.{u1} k (Ring.toSemiring.{u1} k _inst_1))) (RingHomSurjective.ids.{u1} k (Ring.toSemiring.{u1} k _inst_1)) (LinearMap.{u1, u1, u2, u4} k k (Ring.toSemiring.{u1} k _inst_1) (Ring.toSemiring.{u1} k _inst_1) (RingHom.id.{u1} k (Semiring.toNonAssocSemiring.{u1} k (Ring.toSemiring.{u1} k _inst_1))) V₁ V₂ (AddCommGroup.toAddCommMonoid.{u2} V₁ _inst_2) (AddCommGroup.toAddCommMonoid.{u4} V₂ _inst_5) _inst_3 _inst_6) (LinearMap.semilinearMapClass.{u1, u1, u2, u4} k k V₁ V₂ (Ring.toSemiring.{u1} k _inst_1) (Ring.toSemiring.{u1} k _inst_1) (AddCommGroup.toAddCommMonoid.{u2} V₁ _inst_2) (AddCommGroup.toAddCommMonoid.{u4} V₂ _inst_5) _inst_3 _inst_6 (RingHom.id.{u1} k (Semiring.toNonAssocSemiring.{u1} k (Ring.toSemiring.{u1} k _inst_1)))) (AffineMap.linear.{u1, u2, u3, u4, u5} k V₁ P₁ V₂ P₂ _inst_1 _inst_2 _inst_3 _inst_4 _inst_5 _inst_6 _inst_7 f) (AffineSubspace.direction.{u1, u2, u3} k V₁ P₁ _inst_1 _inst_2 _inst_3 _inst_4 s)) but is expected to have type forall {k : Type.{u5}} {V₁ : Type.{u4}} {P₁ : Type.{u3}} {V₂ : Type.{u2}} {P₂ : Type.{u1}} [_inst_1 : Ring.{u5} k] [_inst_2 : AddCommGroup.{u4} V₁] [_inst_3 : Module.{u5, u4} k V₁ (Ring.toSemiring.{u5} k _inst_1) (AddCommGroup.toAddCommMonoid.{u4} V₁ _inst_2)] [_inst_4 : AddTorsor.{u4, u3} V₁ P₁ (AddCommGroup.toAddGroup.{u4} V₁ _inst_2)] [_inst_5 : AddCommGroup.{u2} V₂] [_inst_6 : Module.{u5, u2} k V₂ (Ring.toSemiring.{u5} k _inst_1) (AddCommGroup.toAddCommMonoid.{u2} V₂ _inst_5)] [_inst_7 : AddTorsor.{u2, u1} V₂ P₂ (AddCommGroup.toAddGroup.{u2} V₂ _inst_5)] (f : AffineMap.{u5, u4, u3, u2, u1} k V₁ P₁ V₂ P₂ _inst_1 _inst_2 _inst_3 _inst_4 _inst_5 _inst_6 _inst_7) (s : AffineSubspace.{u5, u4, u3} k V₁ P₁ _inst_1 _inst_2 _inst_3 _inst_4), Eq.{succ u2} (Submodule.{u5, u2} k V₂ (Ring.toSemiring.{u5} k _inst_1) (AddCommGroup.toAddCommMonoid.{u2} V₂ _inst_5) _inst_6) (AffineSubspace.direction.{u5, u2, u1} k V₂ P₂ _inst_1 _inst_5 _inst_6 _inst_7 (AffineSubspace.map.{u5, u4, u3, u2, u1} k V₁ P₁ V₂ P₂ _inst_1 _inst_2 _inst_3 _inst_4 _inst_5 _inst_6 _inst_7 f s)) (Submodule.map.{u5, u5, u4, u2, max u4 u2} k k V₁ V₂ (Ring.toSemiring.{u5} k _inst_1) (Ring.toSemiring.{u5} k _inst_1) (AddCommGroup.toAddCommMonoid.{u4} V₁ _inst_2) (AddCommGroup.toAddCommMonoid.{u2} V₂ _inst_5) _inst_3 _inst_6 (RingHom.id.{u5} k (Semiring.toNonAssocSemiring.{u5} k (Ring.toSemiring.{u5} k _inst_1))) (RingHomSurjective.ids.{u5} k (Ring.toSemiring.{u5} k _inst_1)) (LinearMap.{u5, u5, u4, u2} k k (Ring.toSemiring.{u5} k _inst_1) (Ring.toSemiring.{u5} k _inst_1) (RingHom.id.{u5} k (Semiring.toNonAssocSemiring.{u5} k (Ring.toSemiring.{u5} k _inst_1))) V₁ V₂ (AddCommGroup.toAddCommMonoid.{u4} V₁ _inst_2) (AddCommGroup.toAddCommMonoid.{u2} V₂ _inst_5) _inst_3 _inst_6) (LinearMap.instSemilinearMapClassLinearMap.{u5, u5, u4, u2} k k V₁ V₂ (Ring.toSemiring.{u5} k _inst_1) (Ring.toSemiring.{u5} k _inst_1) (AddCommGroup.toAddCommMonoid.{u4} V₁ _inst_2) (AddCommGroup.toAddCommMonoid.{u2} V₂ _inst_5) _inst_3 _inst_6 (RingHom.id.{u5} k (Semiring.toNonAssocSemiring.{u5} k (Ring.toSemiring.{u5} k _inst_1)))) (AffineMap.linear.{u5, u4, u3, u2, u1} k V₁ P₁ V₂ P₂ _inst_1 _inst_2 _inst_3 _inst_4 _inst_5 _inst_6 _inst_7 f) (AffineSubspace.direction.{u5, u4, u3} k V₁ P₁ _inst_1 _inst_2 _inst_3 _inst_4 s)) Case conversion may be inaccurate. Consider using '#align affine_subspace.map_direction AffineSubspace.map_directionₓ'. -/ @[simp] theorem map_direction (s : AffineSubspace k P₁) : (s.map f).direction = s.direction.map f.linear := by simp [direction_eq_vector_span] #align affine_subspace.map_direction AffineSubspace.map_direction /- warning: affine_subspace.map_span -> AffineSubspace.map_span is a dubious translation: lean 3 declaration is forall {k : Type.{u1}} {V₁ : Type.{u2}} {P₁ : Type.{u3}} {V₂ : Type.{u4}} {P₂ : Type.{u5}} [_inst_1 : Ring.{u1} k] [_inst_2 : AddCommGroup.{u2} V₁] [_inst_3 : Module.{u1, u2} k V₁ (Ring.toSemiring.{u1} k _inst_1) (AddCommGroup.toAddCommMonoid.{u2} V₁ _inst_2)] [_inst_4 : AddTorsor.{u2, u3} V₁ P₁ (AddCommGroup.toAddGroup.{u2} V₁ _inst_2)] [_inst_5 : AddCommGroup.{u4} V₂] [_inst_6 : Module.{u1, u4} k V₂ (Ring.toSemiring.{u1} k _inst_1) (AddCommGroup.toAddCommMonoid.{u4} V₂ _inst_5)] [_inst_7 : AddTorsor.{u4, u5} V₂ P₂ (AddCommGroup.toAddGroup.{u4} V₂ _inst_5)] (f : AffineMap.{u1, u2, u3, u4, u5} k V₁ P₁ V₂ P₂ _inst_1 _inst_2 _inst_3 _inst_4 _inst_5 _inst_6 _inst_7) (s : Set.{u3} P₁), Eq.{succ u5} (AffineSubspace.{u1, u4, u5} k V₂ P₂ _inst_1 _inst_5 _inst_6 _inst_7) (AffineSubspace.map.{u1, u2, u3, u4, u5} k V₁ P₁ V₂ P₂ _inst_1 _inst_2 _inst_3 _inst_4 _inst_5 _inst_6 _inst_7 f (affineSpan.{u1, u2, u3} k V₁ P₁ _inst_1 _inst_2 _inst_3 _inst_4 s)) (affineSpan.{u1, u4, u5} k V₂ P₂ _inst_1 _inst_5 _inst_6 _inst_7 (Set.image.{u3, u5} P₁ P₂ (coeFn.{max (succ u2) (succ u3) (succ u4) (succ u5), max (succ u3) (succ u5)} (AffineMap.{u1, u2, u3, u4, u5} k V₁ P₁ V₂ P₂ _inst_1 _inst_2 _inst_3 _inst_4 _inst_5 _inst_6 _inst_7) (fun (_x : AffineMap.{u1, u2, u3, u4, u5} k V₁ P₁ V₂ P₂ _inst_1 _inst_2 _inst_3 _inst_4 _inst_5 _inst_6 _inst_7) => P₁ -> P₂) (AffineMap.hasCoeToFun.{u1, u2, u3, u4, u5} k V₁ P₁ V₂ P₂ _inst_1 _inst_2 _inst_3 _inst_4 _inst_5 _inst_6 _inst_7) f) s)) but is expected to have type forall {k : Type.{u3}} {V₁ : Type.{u1}} {P₁ : Type.{u5}} {V₂ : Type.{u2}} {P₂ : Type.{u4}} [_inst_1 : Ring.{u3} k] [_inst_2 : AddCommGroup.{u1} V₁] [_inst_3 : Module.{u3, u1} k V₁ (Ring.toSemiring.{u3} k _inst_1) (AddCommGroup.toAddCommMonoid.{u1} V₁ _inst_2)] [_inst_4 : AddTorsor.{u1, u5} V₁ P₁ (AddCommGroup.toAddGroup.{u1} V₁ _inst_2)] [_inst_5 : AddCommGroup.{u2} V₂] [_inst_6 : Module.{u3, u2} k V₂ (Ring.toSemiring.{u3} k _inst_1) (AddCommGroup.toAddCommMonoid.{u2} V₂ _inst_5)] [_inst_7 : AddTorsor.{u2, u4} V₂ P₂ (AddCommGroup.toAddGroup.{u2} V₂ _inst_5)] (f : AffineMap.{u3, u1, u5, u2, u4} k V₁ P₁ V₂ P₂ _inst_1 _inst_2 _inst_3 _inst_4 _inst_5 _inst_6 _inst_7) (s : Set.{u5} P₁), Eq.{succ u4} (AffineSubspace.{u3, u2, u4} k V₂ P₂ _inst_1 _inst_5 _inst_6 _inst_7) (AffineSubspace.map.{u3, u1, u5, u2, u4} k V₁ P₁ V₂ P₂ _inst_1 _inst_2 _inst_3 _inst_4 _inst_5 _inst_6 _inst_7 f (affineSpan.{u3, u1, u5} k V₁ P₁ _inst_1 _inst_2 _inst_3 _inst_4 s)) (affineSpan.{u3, u2, u4} k V₂ P₂ _inst_1 _inst_5 _inst_6 _inst_7 (Set.image.{u5, u4} P₁ P₂ (FunLike.coe.{max (max (max (succ u1) (succ u5)) (succ u2)) (succ u4), succ u5, succ u4} (AffineMap.{u3, u1, u5, u2, u4} k V₁ P₁ V₂ P₂ _inst_1 _inst_2 _inst_3 _inst_4 _inst_5 _inst_6 _inst_7) P₁ (fun (_x : P₁) => (fun ([email protected]._hyg.1004 : P₁) => P₂) _x) (AffineMap.funLike.{u3, u1, u5, u2, u4} k V₁ P₁ V₂ P₂ _inst_1 _inst_2 _inst_3 _inst_4 _inst_5 _inst_6 _inst_7) f) s)) Case conversion may be inaccurate. Consider using '#align affine_subspace.map_span AffineSubspace.map_spanₓ'. -/ theorem map_span (s : Set P₁) : (affineSpan k s).map f = affineSpan k (f '' s) := by rcases s.eq_empty_or_nonempty with (rfl | ⟨p, hp⟩); · simp apply ext_of_direction_eq · simp [direction_affineSpan] · exact ⟨f p, mem_image_of_mem f (subset_affineSpan k _ hp), subset_affineSpan k _ (mem_image_of_mem f hp)⟩ #align affine_subspace.map_span AffineSubspace.map_span end AffineSubspace namespace AffineMap /- warning: affine_map.map_top_of_surjective -> AffineMap.map_top_of_surjective is a dubious translation: lean 3 declaration is forall {k : Type.{u1}} {V₁ : Type.{u2}} {P₁ : Type.{u3}} {V₂ : Type.{u4}} {P₂ : Type.{u5}} [_inst_1 : Ring.{u1} k] [_inst_2 : AddCommGroup.{u2} V₁] [_inst_3 : Module.{u1, u2} k V₁ (Ring.toSemiring.{u1} k _inst_1) (AddCommGroup.toAddCommMonoid.{u2} V₁ _inst_2)] [_inst_4 : AddTorsor.{u2, u3} V₁ P₁ (AddCommGroup.toAddGroup.{u2} V₁ _inst_2)] [_inst_5 : AddCommGroup.{u4} V₂] [_inst_6 : Module.{u1, u4} k V₂ (Ring.toSemiring.{u1} k _inst_1) (AddCommGroup.toAddCommMonoid.{u4} V₂ _inst_5)] [_inst_7 : AddTorsor.{u4, u5} V₂ P₂ (AddCommGroup.toAddGroup.{u4} V₂ _inst_5)] (f : AffineMap.{u1, u2, u3, u4, u5} k V₁ P₁ V₂ P₂ _inst_1 _inst_2 _inst_3 _inst_4 _inst_5 _inst_6 _inst_7), (Function.Surjective.{succ u3, succ u5} P₁ P₂ (coeFn.{max (succ u2) (succ u3) (succ u4) (succ u5), max (succ u3) (succ u5)} (AffineMap.{u1, u2, u3, u4, u5} k V₁ P₁ V₂ P₂ _inst_1 _inst_2 _inst_3 _inst_4 _inst_5 _inst_6 _inst_7) (fun (_x : AffineMap.{u1, u2, u3, u4, u5} k V₁ P₁ V₂ P₂ _inst_1 _inst_2 _inst_3 _inst_4 _inst_5 _inst_6 _inst_7) => P₁ -> P₂) (AffineMap.hasCoeToFun.{u1, u2, u3, u4, u5} k V₁ P₁ V₂ P₂ _inst_1 _inst_2 _inst_3 _inst_4 _inst_5 _inst_6 _inst_7) f)) -> (Eq.{succ u5} (AffineSubspace.{u1, u4, u5} k V₂ P₂ _inst_1 _inst_5 _inst_6 _inst_7) (AffineSubspace.map.{u1, u2, u3, u4, u5} k V₁ P₁ V₂ P₂ _inst_1 _inst_2 _inst_3 _inst_4 _inst_5 _inst_6 _inst_7 f (Top.top.{u3} (AffineSubspace.{u1, u2, u3} k V₁ P₁ _inst_1 _inst_2 _inst_3 _inst_4) (CompleteLattice.toHasTop.{u3} (AffineSubspace.{u1, u2, u3} k V₁ P₁ _inst_1 _inst_2 _inst_3 _inst_4) (AffineSubspace.completeLattice.{u1, u2, u3} k V₁ P₁ _inst_1 _inst_2 _inst_3 _inst_4)))) (Top.top.{u5} (AffineSubspace.{u1, u4, u5} k V₂ P₂ _inst_1 _inst_5 _inst_6 _inst_7) (CompleteLattice.toHasTop.{u5} (AffineSubspace.{u1, u4, u5} k V₂ P₂ _inst_1 _inst_5 _inst_6 _inst_7) (AffineSubspace.completeLattice.{u1, u4, u5} k V₂ P₂ _inst_1 _inst_5 _inst_6 _inst_7)))) but is expected to have type forall {k : Type.{u1}} {V₁ : Type.{u3}} {P₁ : Type.{u5}} {V₂ : Type.{u2}} {P₂ : Type.{u4}} [_inst_1 : Ring.{u1} k] [_inst_2 : AddCommGroup.{u3} V₁] [_inst_3 : Module.{u1, u3} k V₁ (Ring.toSemiring.{u1} k _inst_1) (AddCommGroup.toAddCommMonoid.{u3} V₁ _inst_2)] [_inst_4 : AddTorsor.{u3, u5} V₁ P₁ (AddCommGroup.toAddGroup.{u3} V₁ _inst_2)] [_inst_5 : AddCommGroup.{u2} V₂] [_inst_6 : Module.{u1, u2} k V₂ (Ring.toSemiring.{u1} k _inst_1) (AddCommGroup.toAddCommMonoid.{u2} V₂ _inst_5)] [_inst_7 : AddTorsor.{u2, u4} V₂ P₂ (AddCommGroup.toAddGroup.{u2} V₂ _inst_5)] (f : AffineMap.{u1, u3, u5, u2, u4} k V₁ P₁ V₂ P₂ _inst_1 _inst_2 _inst_3 _inst_4 _inst_5 _inst_6 _inst_7), (Function.Surjective.{succ u5, succ u4} P₁ P₂ (FunLike.coe.{max (max (max (succ u3) (succ u5)) (succ u2)) (succ u4), succ u5, succ u4} (AffineMap.{u1, u3, u5, u2, u4} k V₁ P₁ V₂ P₂ _inst_1 _inst_2 _inst_3 _inst_4 _inst_5 _inst_6 _inst_7) P₁ (fun (_x : P₁) => (fun ([email protected]._hyg.1004 : P₁) => P₂) _x) (AffineMap.funLike.{u1, u3, u5, u2, u4} k V₁ P₁ V₂ P₂ _inst_1 _inst_2 _inst_3 _inst_4 _inst_5 _inst_6 _inst_7) f)) -> (Eq.{succ u4} (AffineSubspace.{u1, u2, u4} k V₂ P₂ _inst_1 _inst_5 _inst_6 _inst_7) (AffineSubspace.map.{u1, u3, u5, u2, u4} k V₁ P₁ V₂ P₂ _inst_1 _inst_2 _inst_3 _inst_4 _inst_5 _inst_6 _inst_7 f (Top.top.{u5} (AffineSubspace.{u1, u3, u5} k V₁ P₁ _inst_1 _inst_2 _inst_3 _inst_4) (CompleteLattice.toTop.{u5} (AffineSubspace.{u1, u3, u5} k V₁ P₁ _inst_1 _inst_2 _inst_3 _inst_4) (AffineSubspace.instCompleteLatticeAffineSubspace.{u1, u3, u5} k V₁ P₁ _inst_1 _inst_2 _inst_3 _inst_4)))) (Top.top.{u4} (AffineSubspace.{u1, u2, u4} k V₂ P₂ _inst_1 _inst_5 _inst_6 _inst_7) (CompleteLattice.toTop.{u4} (AffineSubspace.{u1, u2, u4} k V₂ P₂ _inst_1 _inst_5 _inst_6 _inst_7) (AffineSubspace.instCompleteLatticeAffineSubspace.{u1, u2, u4} k V₂ P₂ _inst_1 _inst_5 _inst_6 _inst_7)))) Case conversion may be inaccurate. Consider using '#align affine_map.map_top_of_surjective AffineMap.map_top_of_surjectiveₓ'. -/ @[simp] theorem map_top_of_surjective (hf : Function.Surjective f) : AffineSubspace.map f ⊤ = ⊤ := by rw [← AffineSubspace.ext_iff] exact image_univ_of_surjective hf #align affine_map.map_top_of_surjective AffineMap.map_top_of_surjective /- warning: affine_map.span_eq_top_of_surjective -> AffineMap.span_eq_top_of_surjective is a dubious translation: lean 3 declaration is forall {k : Type.{u1}} {V₁ : Type.{u2}} {P₁ : Type.{u3}} {V₂ : Type.{u4}} {P₂ : Type.{u5}} [_inst_1 : Ring.{u1} k] [_inst_2 : AddCommGroup.{u2} V₁] [_inst_3 : Module.{u1, u2} k V₁ (Ring.toSemiring.{u1} k _inst_1) (AddCommGroup.toAddCommMonoid.{u2} V₁ _inst_2)] [_inst_4 : AddTorsor.{u2, u3} V₁ P₁ (AddCommGroup.toAddGroup.{u2} V₁ _inst_2)] [_inst_5 : AddCommGroup.{u4} V₂] [_inst_6 : Module.{u1, u4} k V₂ (Ring.toSemiring.{u1} k _inst_1) (AddCommGroup.toAddCommMonoid.{u4} V₂ _inst_5)] [_inst_7 : AddTorsor.{u4, u5} V₂ P₂ (AddCommGroup.toAddGroup.{u4} V₂ _inst_5)] (f : AffineMap.{u1, u2, u3, u4, u5} k V₁ P₁ V₂ P₂ _inst_1 _inst_2 _inst_3 _inst_4 _inst_5 _inst_6 _inst_7) {s : Set.{u3} P₁}, (Function.Surjective.{succ u3, succ u5} P₁ P₂ (coeFn.{max (succ u2) (succ u3) (succ u4) (succ u5), max (succ u3) (succ u5)} (AffineMap.{u1, u2, u3, u4, u5} k V₁ P₁ V₂ P₂ _inst_1 _inst_2 _inst_3 _inst_4 _inst_5 _inst_6 _inst_7) (fun (_x : AffineMap.{u1, u2, u3, u4, u5} k V₁ P₁ V₂ P₂ _inst_1 _inst_2 _inst_3 _inst_4 _inst_5 _inst_6 _inst_7) => P₁ -> P₂) (AffineMap.hasCoeToFun.{u1, u2, u3, u4, u5} k V₁ P₁ V₂ P₂ _inst_1 _inst_2 _inst_3 _inst_4 _inst_5 _inst_6 _inst_7) f)) -> (Eq.{succ u3} (AffineSubspace.{u1, u2, u3} k V₁ P₁ _inst_1 _inst_2 _inst_3 _inst_4) (affineSpan.{u1, u2, u3} k V₁ P₁ _inst_1 _inst_2 _inst_3 _inst_4 s) (Top.top.{u3} (AffineSubspace.{u1, u2, u3} k V₁ P₁ _inst_1 _inst_2 _inst_3 _inst_4) (CompleteLattice.toHasTop.{u3} (AffineSubspace.{u1, u2, u3} k V₁ P₁ _inst_1 _inst_2 _inst_3 _inst_4) (AffineSubspace.completeLattice.{u1, u2, u3} k V₁ P₁ _inst_1 _inst_2 _inst_3 _inst_4)))) -> (Eq.{succ u5} (AffineSubspace.{u1, u4, u5} k V₂ P₂ _inst_1 _inst_5 _inst_6 _inst_7) (affineSpan.{u1, u4, u5} k V₂ P₂ _inst_1 _inst_5 _inst_6 _inst_7 (Set.image.{u3, u5} P₁ P₂ (coeFn.{max (succ u2) (succ u3) (succ u4) (succ u5), max (succ u3) (succ u5)} (AffineMap.{u1, u2, u3, u4, u5} k V₁ P₁ V₂ P₂ _inst_1 _inst_2 _inst_3 _inst_4 _inst_5 _inst_6 _inst_7) (fun (_x : AffineMap.{u1, u2, u3, u4, u5} k V₁ P₁ V₂ P₂ _inst_1 _inst_2 _inst_3 _inst_4 _inst_5 _inst_6 _inst_7) => P₁ -> P₂) (AffineMap.hasCoeToFun.{u1, u2, u3, u4, u5} k V₁ P₁ V₂ P₂ _inst_1 _inst_2 _inst_3 _inst_4 _inst_5 _inst_6 _inst_7) f) s)) (Top.top.{u5} (AffineSubspace.{u1, u4, u5} k V₂ P₂ _inst_1 _inst_5 _inst_6 _inst_7) (CompleteLattice.toHasTop.{u5} (AffineSubspace.{u1, u4, u5} k V₂ P₂ _inst_1 _inst_5 _inst_6 _inst_7) (AffineSubspace.completeLattice.{u1, u4, u5} k V₂ P₂ _inst_1 _inst_5 _inst_6 _inst_7)))) but is expected to have type forall {k : Type.{u1}} {V₁ : Type.{u3}} {P₁ : Type.{u5}} {V₂ : Type.{u2}} {P₂ : Type.{u4}} [_inst_1 : Ring.{u1} k] [_inst_2 : AddCommGroup.{u3} V₁] [_inst_3 : Module.{u1, u3} k V₁ (Ring.toSemiring.{u1} k _inst_1) (AddCommGroup.toAddCommMonoid.{u3} V₁ _inst_2)] [_inst_4 : AddTorsor.{u3, u5} V₁ P₁ (AddCommGroup.toAddGroup.{u3} V₁ _inst_2)] [_inst_5 : AddCommGroup.{u2} V₂] [_inst_6 : Module.{u1, u2} k V₂ (Ring.toSemiring.{u1} k _inst_1) (AddCommGroup.toAddCommMonoid.{u2} V₂ _inst_5)] [_inst_7 : AddTorsor.{u2, u4} V₂ P₂ (AddCommGroup.toAddGroup.{u2} V₂ _inst_5)] (f : AffineMap.{u1, u3, u5, u2, u4} k V₁ P₁ V₂ P₂ _inst_1 _inst_2 _inst_3 _inst_4 _inst_5 _inst_6 _inst_7) {s : Set.{u5} P₁}, (Function.Surjective.{succ u5, succ u4} P₁ P₂ (FunLike.coe.{max (max (max (succ u3) (succ u5)) (succ u2)) (succ u4), succ u5, succ u4} (AffineMap.{u1, u3, u5, u2, u4} k V₁ P₁ V₂ P₂ _inst_1 _inst_2 _inst_3 _inst_4 _inst_5 _inst_6 _inst_7) P₁ (fun (_x : P₁) => (fun ([email protected]._hyg.1004 : P₁) => P₂) _x) (AffineMap.funLike.{u1, u3, u5, u2, u4} k V₁ P₁ V₂ P₂ _inst_1 _inst_2 _inst_3 _inst_4 _inst_5 _inst_6 _inst_7) f)) -> (Eq.{succ u5} (AffineSubspace.{u1, u3, u5} k V₁ P₁ _inst_1 _inst_2 _inst_3 _inst_4) (affineSpan.{u1, u3, u5} k V₁ P₁ _inst_1 _inst_2 _inst_3 _inst_4 s) (Top.top.{u5} (AffineSubspace.{u1, u3, u5} k V₁ P₁ _inst_1 _inst_2 _inst_3 _inst_4) (CompleteLattice.toTop.{u5} (AffineSubspace.{u1, u3, u5} k V₁ P₁ _inst_1 _inst_2 _inst_3 _inst_4) (AffineSubspace.instCompleteLatticeAffineSubspace.{u1, u3, u5} k V₁ P₁ _inst_1 _inst_2 _inst_3 _inst_4)))) -> (Eq.{succ u4} (AffineSubspace.{u1, u2, u4} k V₂ P₂ _inst_1 _inst_5 _inst_6 _inst_7) (affineSpan.{u1, u2, u4} k V₂ P₂ _inst_1 _inst_5 _inst_6 _inst_7 (Set.image.{u5, u4} P₁ P₂ (FunLike.coe.{max (max (max (succ u3) (succ u5)) (succ u2)) (succ u4), succ u5, succ u4} (AffineMap.{u1, u3, u5, u2, u4} k V₁ P₁ V₂ P₂ _inst_1 _inst_2 _inst_3 _inst_4 _inst_5 _inst_6 _inst_7) P₁ (fun (_x : P₁) => (fun ([email protected]._hyg.1004 : P₁) => P₂) _x) (AffineMap.funLike.{u1, u3, u5, u2, u4} k V₁ P₁ V₂ P₂ _inst_1 _inst_2 _inst_3 _inst_4 _inst_5 _inst_6 _inst_7) f) s)) (Top.top.{u4} (AffineSubspace.{u1, u2, u4} k V₂ P₂ _inst_1 _inst_5 _inst_6 _inst_7) (CompleteLattice.toTop.{u4} (AffineSubspace.{u1, u2, u4} k V₂ P₂ _inst_1 _inst_5 _inst_6 _inst_7) (AffineSubspace.instCompleteLatticeAffineSubspace.{u1, u2, u4} k V₂ P₂ _inst_1 _inst_5 _inst_6 _inst_7)))) Case conversion may be inaccurate. Consider using '#align affine_map.span_eq_top_of_surjective AffineMap.span_eq_top_of_surjectiveₓ'. -/ theorem span_eq_top_of_surjective {s : Set P₁} (hf : Function.Surjective f) (h : affineSpan k s = ⊤) : affineSpan k (f '' s) = ⊤ := by rw [← AffineSubspace.map_span, h, map_top_of_surjective f hf] #align affine_map.span_eq_top_of_surjective AffineMap.span_eq_top_of_surjective end AffineMap namespace AffineEquiv /- warning: affine_equiv.span_eq_top_iff -> AffineEquiv.span_eq_top_iff is a dubious translation: lean 3 declaration is forall {k : Type.{u1}} {V₁ : Type.{u2}} {P₁ : Type.{u3}} {V₂ : Type.{u4}} {P₂ : Type.{u5}} [_inst_1 : Ring.{u1} k] [_inst_2 : AddCommGroup.{u2} V₁] [_inst_3 : Module.{u1, u2} k V₁ (Ring.toSemiring.{u1} k _inst_1) (AddCommGroup.toAddCommMonoid.{u2} V₁ _inst_2)] [_inst_4 : AddTorsor.{u2, u3} V₁ P₁ (AddCommGroup.toAddGroup.{u2} V₁ _inst_2)] [_inst_5 : AddCommGroup.{u4} V₂] [_inst_6 : Module.{u1, u4} k V₂ (Ring.toSemiring.{u1} k _inst_1) (AddCommGroup.toAddCommMonoid.{u4} V₂ _inst_5)] [_inst_7 : AddTorsor.{u4, u5} V₂ P₂ (AddCommGroup.toAddGroup.{u4} V₂ _inst_5)] {s : Set.{u3} P₁} (e : AffineEquiv.{u1, u3, u5, u2, u4} k P₁ P₂ V₁ V₂ _inst_1 _inst_2 _inst_3 _inst_4 _inst_5 _inst_6 _inst_7), Iff (Eq.{succ u3} (AffineSubspace.{u1, u2, u3} k V₁ P₁ _inst_1 _inst_2 _inst_3 _inst_4) (affineSpan.{u1, u2, u3} k V₁ P₁ _inst_1 _inst_2 _inst_3 _inst_4 s) (Top.top.{u3} (AffineSubspace.{u1, u2, u3} k V₁ P₁ _inst_1 _inst_2 _inst_3 _inst_4) (CompleteLattice.toHasTop.{u3} (AffineSubspace.{u1, u2, u3} k V₁ P₁ _inst_1 _inst_2 _inst_3 _inst_4) (AffineSubspace.completeLattice.{u1, u2, u3} k V₁ P₁ _inst_1 _inst_2 _inst_3 _inst_4)))) (Eq.{succ u5} (AffineSubspace.{u1, u4, u5} k V₂ P₂ _inst_1 _inst_5 _inst_6 _inst_7) (affineSpan.{u1, u4, u5} k V₂ P₂ _inst_1 _inst_5 _inst_6 _inst_7 (Set.image.{u3, u5} P₁ P₂ (coeFn.{max (succ u3) (succ u5) (succ u2) (succ u4), max (succ u3) (succ u5)} (AffineEquiv.{u1, u3, u5, u2, u4} k P₁ P₂ V₁ V₂ _inst_1 _inst_2 _inst_3 _inst_4 _inst_5 _inst_6 _inst_7) (fun (_x : AffineEquiv.{u1, u3, u5, u2, u4} k P₁ P₂ V₁ V₂ _inst_1 _inst_2 _inst_3 _inst_4 _inst_5 _inst_6 _inst_7) => P₁ -> P₂) (AffineEquiv.hasCoeToFun.{u1, u3, u5, u2, u4} k P₁ P₂ V₁ V₂ _inst_1 _inst_2 _inst_3 _inst_4 _inst_5 _inst_6 _inst_7) e) s)) (Top.top.{u5} (AffineSubspace.{u1, u4, u5} k V₂ P₂ _inst_1 _inst_5 _inst_6 _inst_7) (CompleteLattice.toHasTop.{u5} (AffineSubspace.{u1, u4, u5} k V₂ P₂ _inst_1 _inst_5 _inst_6 _inst_7) (AffineSubspace.completeLattice.{u1, u4, u5} k V₂ P₂ _inst_1 _inst_5 _inst_6 _inst_7)))) but is expected to have type forall {k : Type.{u4}} {V₁ : Type.{u2}} {P₁ : Type.{u5}} {V₂ : Type.{u1}} {P₂ : Type.{u3}} [_inst_1 : Ring.{u4} k] [_inst_2 : AddCommGroup.{u2} V₁] [_inst_3 : Module.{u4, u2} k V₁ (Ring.toSemiring.{u4} k _inst_1) (AddCommGroup.toAddCommMonoid.{u2} V₁ _inst_2)] [_inst_4 : AddTorsor.{u2, u5} V₁ P₁ (AddCommGroup.toAddGroup.{u2} V₁ _inst_2)] [_inst_5 : AddCommGroup.{u1} V₂] [_inst_6 : Module.{u4, u1} k V₂ (Ring.toSemiring.{u4} k _inst_1) (AddCommGroup.toAddCommMonoid.{u1} V₂ _inst_5)] [_inst_7 : AddTorsor.{u1, u3} V₂ P₂ (AddCommGroup.toAddGroup.{u1} V₂ _inst_5)] {s : Set.{u5} P₁} (e : AffineEquiv.{u4, u5, u3, u2, u1} k P₁ P₂ V₁ V₂ _inst_1 _inst_2 _inst_3 _inst_4 _inst_5 _inst_6 _inst_7), Iff (Eq.{succ u5} (AffineSubspace.{u4, u2, u5} k V₁ P₁ _inst_1 _inst_2 _inst_3 _inst_4) (affineSpan.{u4, u2, u5} k V₁ P₁ _inst_1 _inst_2 _inst_3 _inst_4 s) (Top.top.{u5} (AffineSubspace.{u4, u2, u5} k V₁ P₁ _inst_1 _inst_2 _inst_3 _inst_4) (CompleteLattice.toTop.{u5} (AffineSubspace.{u4, u2, u5} k V₁ P₁ _inst_1 _inst_2 _inst_3 _inst_4) (AffineSubspace.instCompleteLatticeAffineSubspace.{u4, u2, u5} k V₁ P₁ _inst_1 _inst_2 _inst_3 _inst_4)))) (Eq.{succ u3} (AffineSubspace.{u4, u1, u3} k V₂ P₂ _inst_1 _inst_5 _inst_6 _inst_7) (affineSpan.{u4, u1, u3} k V₂ P₂ _inst_1 _inst_5 _inst_6 _inst_7 (Set.image.{u5, u3} P₁ P₂ (FunLike.coe.{max (max (max (succ u5) (succ u3)) (succ u2)) (succ u1), succ u5, succ u3} (AffineEquiv.{u4, u5, u3, u2, u1} k P₁ P₂ V₁ V₂ _inst_1 _inst_2 _inst_3 _inst_4 _inst_5 _inst_6 _inst_7) P₁ (fun (_x : P₁) => (fun ([email protected]._hyg.1471 : P₁) => P₂) _x) (EmbeddingLike.toFunLike.{max (max (max (succ u5) (succ u3)) (succ u2)) (succ u1), succ u5, succ u3} (AffineEquiv.{u4, u5, u3, u2, u1} k P₁ P₂ V₁ V₂ _inst_1 _inst_2 _inst_3 _inst_4 _inst_5 _inst_6 _inst_7) P₁ P₂ (EquivLike.toEmbeddingLike.{max (max (max (succ u5) (succ u3)) (succ u2)) (succ u1), succ u5, succ u3} (AffineEquiv.{u4, u5, u3, u2, u1} k P₁ P₂ V₁ V₂ _inst_1 _inst_2 _inst_3 _inst_4 _inst_5 _inst_6 _inst_7) P₁ P₂ (AffineEquiv.equivLike.{u4, u5, u3, u2, u1} k P₁ P₂ V₁ V₂ _inst_1 _inst_2 _inst_3 _inst_4 _inst_5 _inst_6 _inst_7))) e) s)) (Top.top.{u3} (AffineSubspace.{u4, u1, u3} k V₂ P₂ _inst_1 _inst_5 _inst_6 _inst_7) (CompleteLattice.toTop.{u3} (AffineSubspace.{u4, u1, u3} k V₂ P₂ _inst_1 _inst_5 _inst_6 _inst_7) (AffineSubspace.instCompleteLatticeAffineSubspace.{u4, u1, u3} k V₂ P₂ _inst_1 _inst_5 _inst_6 _inst_7)))) Case conversion may be inaccurate. Consider using '#align affine_equiv.span_eq_top_iff AffineEquiv.span_eq_top_iffₓ'. -/ theorem span_eq_top_iff {s : Set P₁} (e : P₁ ≃ᵃ[k] P₂) : affineSpan k s = ⊤ ↔ affineSpan k (e '' s) = ⊤ := by refine' ⟨(e : P₁ →ᵃ[k] P₂).span_eq_top_of_surjective e.surjective, _⟩ intro h have : s = e.symm '' (e '' s) := by simp [← image_comp] rw [this] exact (e.symm : P₂ →ᵃ[k] P₁).span_eq_top_of_surjective e.symm.surjective h #align affine_equiv.span_eq_top_iff AffineEquiv.span_eq_top_iff end AffineEquiv end namespace AffineSubspace #print AffineSubspace.comap /- /-- The preimage of an affine subspace under an affine map as an affine subspace. -/ def comap (f : P₁ →ᵃ[k] P₂) (s : AffineSubspace k P₂) : AffineSubspace k P₁ where carrier := f ⁻¹' s smul_vsub_vadd_mem t p₁ p₂ p₃ (hp₁ : f p₁ ∈ s) (hp₂ : f p₂ ∈ s) (hp₃ : f p₃ ∈ s) := show f _ ∈ s by rw [AffineMap.map_vadd, LinearMap.map_smul, AffineMap.linearMap_vsub] apply s.smul_vsub_vadd_mem _ hp₁ hp₂ hp₃ #align affine_subspace.comap AffineSubspace.comap -/ /- warning: affine_subspace.coe_comap -> AffineSubspace.coe_comap is a dubious translation: lean 3 declaration is forall {k : Type.{u1}} {V₁ : Type.{u2}} {P₁ : Type.{u3}} {V₂ : Type.{u4}} {P₂ : Type.{u5}} [_inst_1 : Ring.{u1} k] [_inst_2 : AddCommGroup.{u2} V₁] [_inst_3 : Module.{u1, u2} k V₁ (Ring.toSemiring.{u1} k _inst_1) (AddCommGroup.toAddCommMonoid.{u2} V₁ _inst_2)] [_inst_4 : AddTorsor.{u2, u3} V₁ P₁ (AddCommGroup.toAddGroup.{u2} V₁ _inst_2)] [_inst_5 : AddCommGroup.{u4} V₂] [_inst_6 : Module.{u1, u4} k V₂ (Ring.toSemiring.{u1} k _inst_1) (AddCommGroup.toAddCommMonoid.{u4} V₂ _inst_5)] [_inst_7 : AddTorsor.{u4, u5} V₂ P₂ (AddCommGroup.toAddGroup.{u4} V₂ _inst_5)] (f : AffineMap.{u1, u2, u3, u4, u5} k V₁ P₁ V₂ P₂ _inst_1 _inst_2 _inst_3 _inst_4 _inst_5 _inst_6 _inst_7) (s : AffineSubspace.{u1, u4, u5} k V₂ P₂ _inst_1 _inst_5 _inst_6 _inst_7), Eq.{succ u3} (Set.{u3} P₁) ((fun (a : Type.{u3}) (b : Type.{u3}) [self : HasLiftT.{succ u3, succ u3} a b] => self.0) (AffineSubspace.{u1, u2, u3} k V₁ P₁ _inst_1 _inst_2 _inst_3 _inst_4) (Set.{u3} P₁) (HasLiftT.mk.{succ u3, succ u3} (AffineSubspace.{u1, u2, u3} k V₁ P₁ _inst_1 _inst_2 _inst_3 _inst_4) (Set.{u3} P₁) (CoeTCₓ.coe.{succ u3, succ u3} (AffineSubspace.{u1, u2, u3} k V₁ P₁ _inst_1 _inst_2 _inst_3 _inst_4) (Set.{u3} P₁) (SetLike.Set.hasCoeT.{u3, u3} (AffineSubspace.{u1, u2, u3} k V₁ P₁ _inst_1 _inst_2 _inst_3 _inst_4) P₁ (AffineSubspace.setLike.{u1, u2, u3} k V₁ P₁ _inst_1 _inst_2 _inst_3 _inst_4)))) (AffineSubspace.comap.{u1, u2, u3, u4, u5} k V₁ P₁ V₂ P₂ _inst_1 _inst_2 _inst_3 _inst_4 _inst_5 _inst_6 _inst_7 f s)) (Set.preimage.{u3, u5} P₁ P₂ (coeFn.{max (succ u2) (succ u3) (succ u4) (succ u5), max (succ u3) (succ u5)} (AffineMap.{u1, u2, u3, u4, u5} k V₁ P₁ V₂ P₂ _inst_1 _inst_2 _inst_3 _inst_4 _inst_5 _inst_6 _inst_7) (fun (_x : AffineMap.{u1, u2, u3, u4, u5} k V₁ P₁ V₂ P₂ _inst_1 _inst_2 _inst_3 _inst_4 _inst_5 _inst_6 _inst_7) => P₁ -> P₂) (AffineMap.hasCoeToFun.{u1, u2, u3, u4, u5} k V₁ P₁ V₂ P₂ _inst_1 _inst_2 _inst_3 _inst_4 _inst_5 _inst_6 _inst_7) f) ((fun (a : Type.{u5}) (b : Type.{u5}) [self : HasLiftT.{succ u5, succ u5} a b] => self.0) (AffineSubspace.{u1, u4, u5} k V₂ P₂ _inst_1 _inst_5 _inst_6 _inst_7) (Set.{u5} P₂) (HasLiftT.mk.{succ u5, succ u5} (AffineSubspace.{u1, u4, u5} k V₂ P₂ _inst_1 _inst_5 _inst_6 _inst_7) (Set.{u5} P₂) (CoeTCₓ.coe.{succ u5, succ u5} (AffineSubspace.{u1, u4, u5} k V₂ P₂ _inst_1 _inst_5 _inst_6 _inst_7) (Set.{u5} P₂) (SetLike.Set.hasCoeT.{u5, u5} (AffineSubspace.{u1, u4, u5} k V₂ P₂ _inst_1 _inst_5 _inst_6 _inst_7) P₂ (AffineSubspace.setLike.{u1, u4, u5} k V₂ P₂ _inst_1 _inst_5 _inst_6 _inst_7)))) s)) but is expected to have type forall {k : Type.{u5}} {V₁ : Type.{u4}} {P₁ : Type.{u3}} {V₂ : Type.{u2}} {P₂ : Type.{u1}} [_inst_1 : Ring.{u5} k] [_inst_2 : AddCommGroup.{u4} V₁] [_inst_3 : Module.{u5, u4} k V₁ (Ring.toSemiring.{u5} k _inst_1) (AddCommGroup.toAddCommMonoid.{u4} V₁ _inst_2)] [_inst_4 : AddTorsor.{u4, u3} V₁ P₁ (AddCommGroup.toAddGroup.{u4} V₁ _inst_2)] [_inst_5 : AddCommGroup.{u2} V₂] [_inst_6 : Module.{u5, u2} k V₂ (Ring.toSemiring.{u5} k _inst_1) (AddCommGroup.toAddCommMonoid.{u2} V₂ _inst_5)] [_inst_7 : AddTorsor.{u2, u1} V₂ P₂ (AddCommGroup.toAddGroup.{u2} V₂ _inst_5)] (f : AffineMap.{u5, u4, u3, u2, u1} k V₁ P₁ V₂ P₂ _inst_1 _inst_2 _inst_3 _inst_4 _inst_5 _inst_6 _inst_7) (s : AffineSubspace.{u5, u2, u1} k V₂ P₂ _inst_1 _inst_5 _inst_6 _inst_7), Eq.{succ u3} (Set.{u3} P₁) (SetLike.coe.{u3, u3} (AffineSubspace.{u5, u4, u3} k V₁ P₁ _inst_1 _inst_2 _inst_3 _inst_4) P₁ (AffineSubspace.instSetLikeAffineSubspace.{u5, u4, u3} k V₁ P₁ _inst_1 _inst_2 _inst_3 _inst_4) (AffineSubspace.comap.{u5, u4, u3, u2, u1} k V₁ P₁ V₂ P₂ _inst_1 _inst_2 _inst_3 _inst_4 _inst_5 _inst_6 _inst_7 f s)) (Set.preimage.{u3, u1} P₁ P₂ (FunLike.coe.{max (max (max (succ u4) (succ u3)) (succ u2)) (succ u1), succ u3, succ u1} (AffineMap.{u5, u4, u3, u2, u1} k V₁ P₁ V₂ P₂ _inst_1 _inst_2 _inst_3 _inst_4 _inst_5 _inst_6 _inst_7) P₁ (fun (_x : P₁) => (fun ([email protected]._hyg.1004 : P₁) => P₂) _x) (AffineMap.funLike.{u5, u4, u3, u2, u1} k V₁ P₁ V₂ P₂ _inst_1 _inst_2 _inst_3 _inst_4 _inst_5 _inst_6 _inst_7) f) (SetLike.coe.{u1, u1} (AffineSubspace.{u5, u2, u1} k V₂ P₂ _inst_1 _inst_5 _inst_6 _inst_7) P₂ (AffineSubspace.instSetLikeAffineSubspace.{u5, u2, u1} k V₂ P₂ _inst_1 _inst_5 _inst_6 _inst_7) s)) Case conversion may be inaccurate. Consider using '#align affine_subspace.coe_comap AffineSubspace.coe_comapₓ'. -/ @[simp] theorem coe_comap (f : P₁ →ᵃ[k] P₂) (s : AffineSubspace k P₂) : (s.comap f : Set P₁) = f ⁻¹' ↑s := rfl #align affine_subspace.coe_comap AffineSubspace.coe_comap /- warning: affine_subspace.mem_comap -> AffineSubspace.mem_comap is a dubious translation: lean 3 declaration is forall {k : Type.{u1}} {V₁ : Type.{u2}} {P₁ : Type.{u3}} {V₂ : Type.{u4}} {P₂ : Type.{u5}} [_inst_1 : Ring.{u1} k] [_inst_2 : AddCommGroup.{u2} V₁] [_inst_3 : Module.{u1, u2} k V₁ (Ring.toSemiring.{u1} k _inst_1) (AddCommGroup.toAddCommMonoid.{u2} V₁ _inst_2)] [_inst_4 : AddTorsor.{u2, u3} V₁ P₁ (AddCommGroup.toAddGroup.{u2} V₁ _inst_2)] [_inst_5 : AddCommGroup.{u4} V₂] [_inst_6 : Module.{u1, u4} k V₂ (Ring.toSemiring.{u1} k _inst_1) (AddCommGroup.toAddCommMonoid.{u4} V₂ _inst_5)] [_inst_7 : AddTorsor.{u4, u5} V₂ P₂ (AddCommGroup.toAddGroup.{u4} V₂ _inst_5)] {f : AffineMap.{u1, u2, u3, u4, u5} k V₁ P₁ V₂ P₂ _inst_1 _inst_2 _inst_3 _inst_4 _inst_5 _inst_6 _inst_7} {x : P₁} {s : AffineSubspace.{u1, u4, u5} k V₂ P₂ _inst_1 _inst_5 _inst_6 _inst_7}, Iff (Membership.Mem.{u3, u3} P₁ (AffineSubspace.{u1, u2, u3} k V₁ P₁ _inst_1 _inst_2 _inst_3 _inst_4) (SetLike.hasMem.{u3, u3} (AffineSubspace.{u1, u2, u3} k V₁ P₁ _inst_1 _inst_2 _inst_3 _inst_4) P₁ (AffineSubspace.setLike.{u1, u2, u3} k V₁ P₁ _inst_1 _inst_2 _inst_3 _inst_4)) x (AffineSubspace.comap.{u1, u2, u3, u4, u5} k V₁ P₁ V₂ P₂ _inst_1 _inst_2 _inst_3 _inst_4 _inst_5 _inst_6 _inst_7 f s)) (Membership.Mem.{u5, u5} P₂ (AffineSubspace.{u1, u4, u5} k V₂ P₂ _inst_1 _inst_5 _inst_6 _inst_7) (SetLike.hasMem.{u5, u5} (AffineSubspace.{u1, u4, u5} k V₂ P₂ _inst_1 _inst_5 _inst_6 _inst_7) P₂ (AffineSubspace.setLike.{u1, u4, u5} k V₂ P₂ _inst_1 _inst_5 _inst_6 _inst_7)) (coeFn.{max (succ u2) (succ u3) (succ u4) (succ u5), max (succ u3) (succ u5)} (AffineMap.{u1, u2, u3, u4, u5} k V₁ P₁ V₂ P₂ _inst_1 _inst_2 _inst_3 _inst_4 _inst_5 _inst_6 _inst_7) (fun (_x : AffineMap.{u1, u2, u3, u4, u5} k V₁ P₁ V₂ P₂ _inst_1 _inst_2 _inst_3 _inst_4 _inst_5 _inst_6 _inst_7) => P₁ -> P₂) (AffineMap.hasCoeToFun.{u1, u2, u3, u4, u5} k V₁ P₁ V₂ P₂ _inst_1 _inst_2 _inst_3 _inst_4 _inst_5 _inst_6 _inst_7) f x) s) but is expected to have type forall {k : Type.{u5}} {V₁ : Type.{u4}} {P₁ : Type.{u3}} {V₂ : Type.{u2}} {P₂ : Type.{u1}} [_inst_1 : Ring.{u5} k] [_inst_2 : AddCommGroup.{u4} V₁] [_inst_3 : Module.{u5, u4} k V₁ (Ring.toSemiring.{u5} k _inst_1) (AddCommGroup.toAddCommMonoid.{u4} V₁ _inst_2)] [_inst_4 : AddTorsor.{u4, u3} V₁ P₁ (AddCommGroup.toAddGroup.{u4} V₁ _inst_2)] [_inst_5 : AddCommGroup.{u2} V₂] [_inst_6 : Module.{u5, u2} k V₂ (Ring.toSemiring.{u5} k _inst_1) (AddCommGroup.toAddCommMonoid.{u2} V₂ _inst_5)] [_inst_7 : AddTorsor.{u2, u1} V₂ P₂ (AddCommGroup.toAddGroup.{u2} V₂ _inst_5)] {f : AffineMap.{u5, u4, u3, u2, u1} k V₁ P₁ V₂ P₂ _inst_1 _inst_2 _inst_3 _inst_4 _inst_5 _inst_6 _inst_7} {x : P₁} {s : AffineSubspace.{u5, u2, u1} k V₂ P₂ _inst_1 _inst_5 _inst_6 _inst_7}, Iff (Membership.mem.{u3, u3} P₁ (AffineSubspace.{u5, u4, u3} k V₁ P₁ _inst_1 _inst_2 _inst_3 _inst_4) (SetLike.instMembership.{u3, u3} (AffineSubspace.{u5, u4, u3} k V₁ P₁ _inst_1 _inst_2 _inst_3 _inst_4) P₁ (AffineSubspace.instSetLikeAffineSubspace.{u5, u4, u3} k V₁ P₁ _inst_1 _inst_2 _inst_3 _inst_4)) x (AffineSubspace.comap.{u5, u4, u3, u2, u1} k V₁ P₁ V₂ P₂ _inst_1 _inst_2 _inst_3 _inst_4 _inst_5 _inst_6 _inst_7 f s)) (Membership.mem.{u1, u1} ((fun ([email protected]._hyg.1004 : P₁) => P₂) x) (AffineSubspace.{u5, u2, u1} k V₂ P₂ _inst_1 _inst_5 _inst_6 _inst_7) (SetLike.instMembership.{u1, u1} (AffineSubspace.{u5, u2, u1} k V₂ P₂ _inst_1 _inst_5 _inst_6 _inst_7) P₂ (AffineSubspace.instSetLikeAffineSubspace.{u5, u2, u1} k V₂ P₂ _inst_1 _inst_5 _inst_6 _inst_7)) (FunLike.coe.{max (max (max (succ u4) (succ u3)) (succ u2)) (succ u1), succ u3, succ u1} (AffineMap.{u5, u4, u3, u2, u1} k V₁ P₁ V₂ P₂ _inst_1 _inst_2 _inst_3 _inst_4 _inst_5 _inst_6 _inst_7) P₁ (fun (_x : P₁) => (fun ([email protected]._hyg.1004 : P₁) => P₂) _x) (AffineMap.funLike.{u5, u4, u3, u2, u1} k V₁ P₁ V₂ P₂ _inst_1 _inst_2 _inst_3 _inst_4 _inst_5 _inst_6 _inst_7) f x) s) Case conversion may be inaccurate. Consider using '#align affine_subspace.mem_comap AffineSubspace.mem_comapₓ'. -/ @[simp] theorem mem_comap {f : P₁ →ᵃ[k] P₂} {x : P₁} {s : AffineSubspace k P₂} : x ∈ s.comap f ↔ f x ∈ s := Iff.rfl #align affine_subspace.mem_comap AffineSubspace.mem_comap /- warning: affine_subspace.comap_mono -> AffineSubspace.comap_mono is a dubious translation: lean 3 declaration is forall {k : Type.{u1}} {V₁ : Type.{u2}} {P₁ : Type.{u3}} {V₂ : Type.{u4}} {P₂ : Type.{u5}} [_inst_1 : Ring.{u1} k] [_inst_2 : AddCommGroup.{u2} V₁] [_inst_3 : Module.{u1, u2} k V₁ (Ring.toSemiring.{u1} k _inst_1) (AddCommGroup.toAddCommMonoid.{u2} V₁ _inst_2)] [_inst_4 : AddTorsor.{u2, u3} V₁ P₁ (AddCommGroup.toAddGroup.{u2} V₁ _inst_2)] [_inst_5 : AddCommGroup.{u4} V₂] [_inst_6 : Module.{u1, u4} k V₂ (Ring.toSemiring.{u1} k _inst_1) (AddCommGroup.toAddCommMonoid.{u4} V₂ _inst_5)] [_inst_7 : AddTorsor.{u4, u5} V₂ P₂ (AddCommGroup.toAddGroup.{u4} V₂ _inst_5)] {f : AffineMap.{u1, u2, u3, u4, u5} k V₁ P₁ V₂ P₂ _inst_1 _inst_2 _inst_3 _inst_4 _inst_5 _inst_6 _inst_7} {s : AffineSubspace.{u1, u4, u5} k V₂ P₂ _inst_1 _inst_5 _inst_6 _inst_7} {t : AffineSubspace.{u1, u4, u5} k V₂ P₂ _inst_1 _inst_5 _inst_6 _inst_7}, (LE.le.{u5} (AffineSubspace.{u1, u4, u5} k V₂ P₂ _inst_1 _inst_5 _inst_6 _inst_7) (Preorder.toLE.{u5} (AffineSubspace.{u1, u4, u5} k V₂ P₂ _inst_1 _inst_5 _inst_6 _inst_7) (PartialOrder.toPreorder.{u5} (AffineSubspace.{u1, u4, u5} k V₂ P₂ _inst_1 _inst_5 _inst_6 _inst_7) (SetLike.partialOrder.{u5, u5} (AffineSubspace.{u1, u4, u5} k V₂ P₂ _inst_1 _inst_5 _inst_6 _inst_7) P₂ (AffineSubspace.setLike.{u1, u4, u5} k V₂ P₂ _inst_1 _inst_5 _inst_6 _inst_7)))) s t) -> (LE.le.{u3} (AffineSubspace.{u1, u2, u3} k V₁ P₁ _inst_1 _inst_2 _inst_3 _inst_4) (Preorder.toLE.{u3} (AffineSubspace.{u1, u2, u3} k V₁ P₁ _inst_1 _inst_2 _inst_3 _inst_4) (PartialOrder.toPreorder.{u3} (AffineSubspace.{u1, u2, u3} k V₁ P₁ _inst_1 _inst_2 _inst_3 _inst_4) (SetLike.partialOrder.{u3, u3} (AffineSubspace.{u1, u2, u3} k V₁ P₁ _inst_1 _inst_2 _inst_3 _inst_4) P₁ (AffineSubspace.setLike.{u1, u2, u3} k V₁ P₁ _inst_1 _inst_2 _inst_3 _inst_4)))) (AffineSubspace.comap.{u1, u2, u3, u4, u5} k V₁ P₁ V₂ P₂ _inst_1 _inst_2 _inst_3 _inst_4 _inst_5 _inst_6 _inst_7 f s) (AffineSubspace.comap.{u1, u2, u3, u4, u5} k V₁ P₁ V₂ P₂ _inst_1 _inst_2 _inst_3 _inst_4 _inst_5 _inst_6 _inst_7 f t)) but is expected to have type forall {k : Type.{u5}} {V₁ : Type.{u4}} {P₁ : Type.{u3}} {V₂ : Type.{u2}} {P₂ : Type.{u1}} [_inst_1 : Ring.{u5} k] [_inst_2 : AddCommGroup.{u4} V₁] [_inst_3 : Module.{u5, u4} k V₁ (Ring.toSemiring.{u5} k _inst_1) (AddCommGroup.toAddCommMonoid.{u4} V₁ _inst_2)] [_inst_4 : AddTorsor.{u4, u3} V₁ P₁ (AddCommGroup.toAddGroup.{u4} V₁ _inst_2)] [_inst_5 : AddCommGroup.{u2} V₂] [_inst_6 : Module.{u5, u2} k V₂ (Ring.toSemiring.{u5} k _inst_1) (AddCommGroup.toAddCommMonoid.{u2} V₂ _inst_5)] [_inst_7 : AddTorsor.{u2, u1} V₂ P₂ (AddCommGroup.toAddGroup.{u2} V₂ _inst_5)] {f : AffineMap.{u5, u4, u3, u2, u1} k V₁ P₁ V₂ P₂ _inst_1 _inst_2 _inst_3 _inst_4 _inst_5 _inst_6 _inst_7} {s : AffineSubspace.{u5, u2, u1} k V₂ P₂ _inst_1 _inst_5 _inst_6 _inst_7} {t : AffineSubspace.{u5, u2, u1} k V₂ P₂ _inst_1 _inst_5 _inst_6 _inst_7}, (LE.le.{u1} (AffineSubspace.{u5, u2, u1} k V₂ P₂ _inst_1 _inst_5 _inst_6 _inst_7) (Preorder.toLE.{u1} (AffineSubspace.{u5, u2, u1} k V₂ P₂ _inst_1 _inst_5 _inst_6 _inst_7) (PartialOrder.toPreorder.{u1} (AffineSubspace.{u5, u2, u1} k V₂ P₂ _inst_1 _inst_5 _inst_6 _inst_7) (OmegaCompletePartialOrder.toPartialOrder.{u1} (AffineSubspace.{u5, u2, u1} k V₂ P₂ _inst_1 _inst_5 _inst_6 _inst_7) (CompleteLattice.instOmegaCompletePartialOrder.{u1} (AffineSubspace.{u5, u2, u1} k V₂ P₂ _inst_1 _inst_5 _inst_6 _inst_7) (AffineSubspace.instCompleteLatticeAffineSubspace.{u5, u2, u1} k V₂ P₂ _inst_1 _inst_5 _inst_6 _inst_7))))) s t) -> (LE.le.{u3} (AffineSubspace.{u5, u4, u3} k V₁ P₁ _inst_1 _inst_2 _inst_3 _inst_4) (Preorder.toLE.{u3} (AffineSubspace.{u5, u4, u3} k V₁ P₁ _inst_1 _inst_2 _inst_3 _inst_4) (PartialOrder.toPreorder.{u3} (AffineSubspace.{u5, u4, u3} k V₁ P₁ _inst_1 _inst_2 _inst_3 _inst_4) (OmegaCompletePartialOrder.toPartialOrder.{u3} (AffineSubspace.{u5, u4, u3} k V₁ P₁ _inst_1 _inst_2 _inst_3 _inst_4) (CompleteLattice.instOmegaCompletePartialOrder.{u3} (AffineSubspace.{u5, u4, u3} k V₁ P₁ _inst_1 _inst_2 _inst_3 _inst_4) (AffineSubspace.instCompleteLatticeAffineSubspace.{u5, u4, u3} k V₁ P₁ _inst_1 _inst_2 _inst_3 _inst_4))))) (AffineSubspace.comap.{u5, u4, u3, u2, u1} k V₁ P₁ V₂ P₂ _inst_1 _inst_2 _inst_3 _inst_4 _inst_5 _inst_6 _inst_7 f s) (AffineSubspace.comap.{u5, u4, u3, u2, u1} k V₁ P₁ V₂ P₂ _inst_1 _inst_2 _inst_3 _inst_4 _inst_5 _inst_6 _inst_7 f t)) Case conversion may be inaccurate. Consider using '#align affine_subspace.comap_mono AffineSubspace.comap_monoₓ'. -/ theorem comap_mono {f : P₁ →ᵃ[k] P₂} {s t : AffineSubspace k P₂} : s ≤ t → s.comap f ≤ t.comap f := preimage_mono #align affine_subspace.comap_mono AffineSubspace.comap_mono /- warning: affine_subspace.comap_top -> AffineSubspace.comap_top is a dubious translation: lean 3 declaration is forall {k : Type.{u1}} {V₁ : Type.{u2}} {P₁ : Type.{u3}} {V₂ : Type.{u4}} {P₂ : Type.{u5}} [_inst_1 : Ring.{u1} k] [_inst_2 : AddCommGroup.{u2} V₁] [_inst_3 : Module.{u1, u2} k V₁ (Ring.toSemiring.{u1} k _inst_1) (AddCommGroup.toAddCommMonoid.{u2} V₁ _inst_2)] [_inst_4 : AddTorsor.{u2, u3} V₁ P₁ (AddCommGroup.toAddGroup.{u2} V₁ _inst_2)] [_inst_5 : AddCommGroup.{u4} V₂] [_inst_6 : Module.{u1, u4} k V₂ (Ring.toSemiring.{u1} k _inst_1) (AddCommGroup.toAddCommMonoid.{u4} V₂ _inst_5)] [_inst_7 : AddTorsor.{u4, u5} V₂ P₂ (AddCommGroup.toAddGroup.{u4} V₂ _inst_5)] {f : AffineMap.{u1, u2, u3, u4, u5} k V₁ P₁ V₂ P₂ _inst_1 _inst_2 _inst_3 _inst_4 _inst_5 _inst_6 _inst_7}, Eq.{succ u3} (AffineSubspace.{u1, u2, u3} k V₁ P₁ _inst_1 _inst_2 _inst_3 _inst_4) (AffineSubspace.comap.{u1, u2, u3, u4, u5} k V₁ P₁ V₂ P₂ _inst_1 _inst_2 _inst_3 _inst_4 _inst_5 _inst_6 _inst_7 f (Top.top.{u5} (AffineSubspace.{u1, u4, u5} k V₂ P₂ _inst_1 _inst_5 _inst_6 _inst_7) (CompleteLattice.toHasTop.{u5} (AffineSubspace.{u1, u4, u5} k V₂ P₂ _inst_1 _inst_5 _inst_6 _inst_7) (AffineSubspace.completeLattice.{u1, u4, u5} k V₂ P₂ _inst_1 _inst_5 _inst_6 _inst_7)))) (Top.top.{u3} (AffineSubspace.{u1, u2, u3} k V₁ P₁ _inst_1 _inst_2 _inst_3 _inst_4) (CompleteLattice.toHasTop.{u3} (AffineSubspace.{u1, u2, u3} k V₁ P₁ _inst_1 _inst_2 _inst_3 _inst_4) (AffineSubspace.completeLattice.{u1, u2, u3} k V₁ P₁ _inst_1 _inst_2 _inst_3 _inst_4))) but is expected to have type forall {k : Type.{u5}} {V₁ : Type.{u4}} {P₁ : Type.{u3}} {V₂ : Type.{u2}} {P₂ : Type.{u1}} [_inst_1 : Ring.{u5} k] [_inst_2 : AddCommGroup.{u4} V₁] [_inst_3 : Module.{u5, u4} k V₁ (Ring.toSemiring.{u5} k _inst_1) (AddCommGroup.toAddCommMonoid.{u4} V₁ _inst_2)] [_inst_4 : AddTorsor.{u4, u3} V₁ P₁ (AddCommGroup.toAddGroup.{u4} V₁ _inst_2)] [_inst_5 : AddCommGroup.{u2} V₂] [_inst_6 : Module.{u5, u2} k V₂ (Ring.toSemiring.{u5} k _inst_1) (AddCommGroup.toAddCommMonoid.{u2} V₂ _inst_5)] [_inst_7 : AddTorsor.{u2, u1} V₂ P₂ (AddCommGroup.toAddGroup.{u2} V₂ _inst_5)] {f : AffineMap.{u5, u4, u3, u2, u1} k V₁ P₁ V₂ P₂ _inst_1 _inst_2 _inst_3 _inst_4 _inst_5 _inst_6 _inst_7}, Eq.{succ u3} (AffineSubspace.{u5, u4, u3} k V₁ P₁ _inst_1 _inst_2 _inst_3 _inst_4) (AffineSubspace.comap.{u5, u4, u3, u2, u1} k V₁ P₁ V₂ P₂ _inst_1 _inst_2 _inst_3 _inst_4 _inst_5 _inst_6 _inst_7 f (Top.top.{u1} (AffineSubspace.{u5, u2, u1} k V₂ P₂ _inst_1 _inst_5 _inst_6 _inst_7) (CompleteLattice.toTop.{u1} (AffineSubspace.{u5, u2, u1} k V₂ P₂ _inst_1 _inst_5 _inst_6 _inst_7) (AffineSubspace.instCompleteLatticeAffineSubspace.{u5, u2, u1} k V₂ P₂ _inst_1 _inst_5 _inst_6 _inst_7)))) (Top.top.{u3} (AffineSubspace.{u5, u4, u3} k V₁ P₁ _inst_1 _inst_2 _inst_3 _inst_4) (CompleteLattice.toTop.{u3} (AffineSubspace.{u5, u4, u3} k V₁ P₁ _inst_1 _inst_2 _inst_3 _inst_4) (AffineSubspace.instCompleteLatticeAffineSubspace.{u5, u4, u3} k V₁ P₁ _inst_1 _inst_2 _inst_3 _inst_4))) Case conversion may be inaccurate. Consider using '#align affine_subspace.comap_top AffineSubspace.comap_topₓ'. -/ @[simp] theorem comap_top {f : P₁ →ᵃ[k] P₂} : (⊤ : AffineSubspace k P₂).comap f = ⊤ := by rw [← ext_iff] exact preimage_univ #align affine_subspace.comap_top AffineSubspace.comap_top omit V₂ /- warning: affine_subspace.comap_id -> AffineSubspace.comap_id is a dubious translation: lean 3 declaration is forall {k : Type.{u1}} {V₁ : Type.{u2}} {P₁ : Type.{u3}} [_inst_1 : Ring.{u1} k] [_inst_2 : AddCommGroup.{u2} V₁] [_inst_3 : Module.{u1, u2} k V₁ (Ring.toSemiring.{u1} k _inst_1) (AddCommGroup.toAddCommMonoid.{u2} V₁ _inst_2)] [_inst_4 : AddTorsor.{u2, u3} V₁ P₁ (AddCommGroup.toAddGroup.{u2} V₁ _inst_2)] (s : AffineSubspace.{u1, u2, u3} k V₁ P₁ _inst_1 _inst_2 _inst_3 _inst_4), Eq.{succ u3} (AffineSubspace.{u1, u2, u3} k V₁ P₁ _inst_1 _inst_2 _inst_3 _inst_4) (AffineSubspace.comap.{u1, u2, u3, u2, u3} k V₁ P₁ V₁ P₁ _inst_1 _inst_2 _inst_3 _inst_4 _inst_2 _inst_3 _inst_4 (AffineMap.id.{u1, u2, u3} k V₁ P₁ _inst_1 _inst_2 _inst_3 _inst_4) s) s but is expected to have type forall {k : Type.{u3}} {V₁ : Type.{u2}} {P₁ : Type.{u1}} [_inst_1 : Ring.{u3} k] [_inst_2 : AddCommGroup.{u2} V₁] [_inst_3 : Module.{u3, u2} k V₁ (Ring.toSemiring.{u3} k _inst_1) (AddCommGroup.toAddCommMonoid.{u2} V₁ _inst_2)] [_inst_4 : AddTorsor.{u2, u1} V₁ P₁ (AddCommGroup.toAddGroup.{u2} V₁ _inst_2)] (s : AffineSubspace.{u3, u2, u1} k V₁ P₁ _inst_1 _inst_2 _inst_3 _inst_4), Eq.{succ u1} (AffineSubspace.{u3, u2, u1} k V₁ P₁ _inst_1 _inst_2 _inst_3 _inst_4) (AffineSubspace.comap.{u3, u2, u1, u2, u1} k V₁ P₁ V₁ P₁ _inst_1 _inst_2 _inst_3 _inst_4 _inst_2 _inst_3 _inst_4 (AffineMap.id.{u3, u2, u1} k V₁ P₁ _inst_1 _inst_2 _inst_3 _inst_4) s) s Case conversion may be inaccurate. Consider using '#align affine_subspace.comap_id AffineSubspace.comap_idₓ'. -/ @[simp] theorem comap_id (s : AffineSubspace k P₁) : s.comap (AffineMap.id k P₁) = s := coe_injective rfl #align affine_subspace.comap_id AffineSubspace.comap_id include V₂ V₃ /- warning: affine_subspace.comap_comap -> AffineSubspace.comap_comap is a dubious translation: lean 3 declaration is forall {k : Type.{u1}} {V₁ : Type.{u2}} {P₁ : Type.{u3}} {V₂ : Type.{u4}} {P₂ : Type.{u5}} {V₃ : Type.{u6}} {P₃ : Type.{u7}} [_inst_1 : Ring.{u1} k] [_inst_2 : AddCommGroup.{u2} V₁] [_inst_3 : Module.{u1, u2} k V₁ (Ring.toSemiring.{u1} k _inst_1) (AddCommGroup.toAddCommMonoid.{u2} V₁ _inst_2)] [_inst_4 : AddTorsor.{u2, u3} V₁ P₁ (AddCommGroup.toAddGroup.{u2} V₁ _inst_2)] [_inst_5 : AddCommGroup.{u4} V₂] [_inst_6 : Module.{u1, u4} k V₂ (Ring.toSemiring.{u1} k _inst_1) (AddCommGroup.toAddCommMonoid.{u4} V₂ _inst_5)] [_inst_7 : AddTorsor.{u4, u5} V₂ P₂ (AddCommGroup.toAddGroup.{u4} V₂ _inst_5)] [_inst_8 : AddCommGroup.{u6} V₃] [_inst_9 : Module.{u1, u6} k V₃ (Ring.toSemiring.{u1} k _inst_1) (AddCommGroup.toAddCommMonoid.{u6} V₃ _inst_8)] [_inst_10 : AddTorsor.{u6, u7} V₃ P₃ (AddCommGroup.toAddGroup.{u6} V₃ _inst_8)] (s : AffineSubspace.{u1, u6, u7} k V₃ P₃ _inst_1 _inst_8 _inst_9 _inst_10) (f : AffineMap.{u1, u2, u3, u4, u5} k V₁ P₁ V₂ P₂ _inst_1 _inst_2 _inst_3 _inst_4 _inst_5 _inst_6 _inst_7) (g : AffineMap.{u1, u4, u5, u6, u7} k V₂ P₂ V₃ P₃ _inst_1 _inst_5 _inst_6 _inst_7 _inst_8 _inst_9 _inst_10), Eq.{succ u3} (AffineSubspace.{u1, u2, u3} k V₁ P₁ _inst_1 _inst_2 _inst_3 _inst_4) (AffineSubspace.comap.{u1, u2, u3, u4, u5} k V₁ P₁ V₂ P₂ _inst_1 _inst_2 _inst_3 _inst_4 _inst_5 _inst_6 _inst_7 f (AffineSubspace.comap.{u1, u4, u5, u6, u7} k V₂ P₂ V₃ P₃ _inst_1 _inst_5 _inst_6 _inst_7 _inst_8 _inst_9 _inst_10 g s)) (AffineSubspace.comap.{u1, u2, u3, u6, u7} k V₁ P₁ V₃ P₃ _inst_1 _inst_2 _inst_3 _inst_4 _inst_8 _inst_9 _inst_10 (AffineMap.comp.{u1, u2, u3, u4, u5, u6, u7} k V₁ P₁ V₂ P₂ V₃ P₃ _inst_1 _inst_2 _inst_3 _inst_4 _inst_5 _inst_6 _inst_7 _inst_8 _inst_9 _inst_10 g f) s) but is expected to have type forall {k : Type.{u7}} {V₁ : Type.{u4}} {P₁ : Type.{u3}} {V₂ : Type.{u2}} {P₂ : Type.{u1}} {V₃ : Type.{u6}} {P₃ : Type.{u5}} [_inst_1 : Ring.{u7} k] [_inst_2 : AddCommGroup.{u4} V₁] [_inst_3 : Module.{u7, u4} k V₁ (Ring.toSemiring.{u7} k _inst_1) (AddCommGroup.toAddCommMonoid.{u4} V₁ _inst_2)] [_inst_4 : AddTorsor.{u4, u3} V₁ P₁ (AddCommGroup.toAddGroup.{u4} V₁ _inst_2)] [_inst_5 : AddCommGroup.{u2} V₂] [_inst_6 : Module.{u7, u2} k V₂ (Ring.toSemiring.{u7} k _inst_1) (AddCommGroup.toAddCommMonoid.{u2} V₂ _inst_5)] [_inst_7 : AddTorsor.{u2, u1} V₂ P₂ (AddCommGroup.toAddGroup.{u2} V₂ _inst_5)] [_inst_8 : AddCommGroup.{u6} V₃] [_inst_9 : Module.{u7, u6} k V₃ (Ring.toSemiring.{u7} k _inst_1) (AddCommGroup.toAddCommMonoid.{u6} V₃ _inst_8)] [_inst_10 : AddTorsor.{u6, u5} V₃ P₃ (AddCommGroup.toAddGroup.{u6} V₃ _inst_8)] (s : AffineSubspace.{u7, u6, u5} k V₃ P₃ _inst_1 _inst_8 _inst_9 _inst_10) (f : AffineMap.{u7, u4, u3, u2, u1} k V₁ P₁ V₂ P₂ _inst_1 _inst_2 _inst_3 _inst_4 _inst_5 _inst_6 _inst_7) (g : AffineMap.{u7, u2, u1, u6, u5} k V₂ P₂ V₃ P₃ _inst_1 _inst_5 _inst_6 _inst_7 _inst_8 _inst_9 _inst_10), Eq.{succ u3} (AffineSubspace.{u7, u4, u3} k V₁ P₁ _inst_1 _inst_2 _inst_3 _inst_4) (AffineSubspace.comap.{u7, u4, u3, u2, u1} k V₁ P₁ V₂ P₂ _inst_1 _inst_2 _inst_3 _inst_4 _inst_5 _inst_6 _inst_7 f (AffineSubspace.comap.{u7, u2, u1, u6, u5} k V₂ P₂ V₃ P₃ _inst_1 _inst_5 _inst_6 _inst_7 _inst_8 _inst_9 _inst_10 g s)) (AffineSubspace.comap.{u7, u4, u3, u6, u5} k V₁ P₁ V₃ P₃ _inst_1 _inst_2 _inst_3 _inst_4 _inst_8 _inst_9 _inst_10 (AffineMap.comp.{u7, u4, u3, u2, u1, u6, u5} k V₁ P₁ V₂ P₂ V₃ P₃ _inst_1 _inst_2 _inst_3 _inst_4 _inst_5 _inst_6 _inst_7 _inst_8 _inst_9 _inst_10 g f) s) Case conversion may be inaccurate. Consider using '#align affine_subspace.comap_comap AffineSubspace.comap_comapₓ'. -/ theorem comap_comap (s : AffineSubspace k P₃) (f : P₁ →ᵃ[k] P₂) (g : P₂ →ᵃ[k] P₃) : (s.comap g).comap f = s.comap (g.comp f) := coe_injective rfl #align affine_subspace.comap_comap AffineSubspace.comap_comap omit V₃ /- warning: affine_subspace.map_le_iff_le_comap -> AffineSubspace.map_le_iff_le_comap is a dubious translation: lean 3 declaration is forall {k : Type.{u1}} {V₁ : Type.{u2}} {P₁ : Type.{u3}} {V₂ : Type.{u4}} {P₂ : Type.{u5}} [_inst_1 : Ring.{u1} k] [_inst_2 : AddCommGroup.{u2} V₁] [_inst_3 : Module.{u1, u2} k V₁ (Ring.toSemiring.{u1} k _inst_1) (AddCommGroup.toAddCommMonoid.{u2} V₁ _inst_2)] [_inst_4 : AddTorsor.{u2, u3} V₁ P₁ (AddCommGroup.toAddGroup.{u2} V₁ _inst_2)] [_inst_5 : AddCommGroup.{u4} V₂] [_inst_6 : Module.{u1, u4} k V₂ (Ring.toSemiring.{u1} k _inst_1) (AddCommGroup.toAddCommMonoid.{u4} V₂ _inst_5)] [_inst_7 : AddTorsor.{u4, u5} V₂ P₂ (AddCommGroup.toAddGroup.{u4} V₂ _inst_5)] {f : AffineMap.{u1, u2, u3, u4, u5} k V₁ P₁ V₂ P₂ _inst_1 _inst_2 _inst_3 _inst_4 _inst_5 _inst_6 _inst_7} {s : AffineSubspace.{u1, u2, u3} k V₁ P₁ _inst_1 _inst_2 _inst_3 _inst_4} {t : AffineSubspace.{u1, u4, u5} k V₂ P₂ _inst_1 _inst_5 _inst_6 _inst_7}, Iff (LE.le.{u5} (AffineSubspace.{u1, u4, u5} k V₂ P₂ _inst_1 _inst_5 _inst_6 _inst_7) (Preorder.toLE.{u5} (AffineSubspace.{u1, u4, u5} k V₂ P₂ _inst_1 _inst_5 _inst_6 _inst_7) (PartialOrder.toPreorder.{u5} (AffineSubspace.{u1, u4, u5} k V₂ P₂ _inst_1 _inst_5 _inst_6 _inst_7) (SetLike.partialOrder.{u5, u5} (AffineSubspace.{u1, u4, u5} k V₂ P₂ _inst_1 _inst_5 _inst_6 _inst_7) P₂ (AffineSubspace.setLike.{u1, u4, u5} k V₂ P₂ _inst_1 _inst_5 _inst_6 _inst_7)))) (AffineSubspace.map.{u1, u2, u3, u4, u5} k V₁ P₁ V₂ P₂ _inst_1 _inst_2 _inst_3 _inst_4 _inst_5 _inst_6 _inst_7 f s) t) (LE.le.{u3} (AffineSubspace.{u1, u2, u3} k V₁ P₁ _inst_1 _inst_2 _inst_3 _inst_4) (Preorder.toLE.{u3} (AffineSubspace.{u1, u2, u3} k V₁ P₁ _inst_1 _inst_2 _inst_3 _inst_4) (PartialOrder.toPreorder.{u3} (AffineSubspace.{u1, u2, u3} k V₁ P₁ _inst_1 _inst_2 _inst_3 _inst_4) (SetLike.partialOrder.{u3, u3} (AffineSubspace.{u1, u2, u3} k V₁ P₁ _inst_1 _inst_2 _inst_3 _inst_4) P₁ (AffineSubspace.setLike.{u1, u2, u3} k V₁ P₁ _inst_1 _inst_2 _inst_3 _inst_4)))) s (AffineSubspace.comap.{u1, u2, u3, u4, u5} k V₁ P₁ V₂ P₂ _inst_1 _inst_2 _inst_3 _inst_4 _inst_5 _inst_6 _inst_7 f t)) but is expected to have type forall {k : Type.{u5}} {V₁ : Type.{u4}} {P₁ : Type.{u3}} {V₂ : Type.{u2}} {P₂ : Type.{u1}} [_inst_1 : Ring.{u5} k] [_inst_2 : AddCommGroup.{u4} V₁] [_inst_3 : Module.{u5, u4} k V₁ (Ring.toSemiring.{u5} k _inst_1) (AddCommGroup.toAddCommMonoid.{u4} V₁ _inst_2)] [_inst_4 : AddTorsor.{u4, u3} V₁ P₁ (AddCommGroup.toAddGroup.{u4} V₁ _inst_2)] [_inst_5 : AddCommGroup.{u2} V₂] [_inst_6 : Module.{u5, u2} k V₂ (Ring.toSemiring.{u5} k _inst_1) (AddCommGroup.toAddCommMonoid.{u2} V₂ _inst_5)] [_inst_7 : AddTorsor.{u2, u1} V₂ P₂ (AddCommGroup.toAddGroup.{u2} V₂ _inst_5)] {f : AffineMap.{u5, u4, u3, u2, u1} k V₁ P₁ V₂ P₂ _inst_1 _inst_2 _inst_3 _inst_4 _inst_5 _inst_6 _inst_7} {s : AffineSubspace.{u5, u4, u3} k V₁ P₁ _inst_1 _inst_2 _inst_3 _inst_4} {t : AffineSubspace.{u5, u2, u1} k V₂ P₂ _inst_1 _inst_5 _inst_6 _inst_7}, Iff (LE.le.{u1} (AffineSubspace.{u5, u2, u1} k V₂ P₂ _inst_1 _inst_5 _inst_6 _inst_7) (Preorder.toLE.{u1} (AffineSubspace.{u5, u2, u1} k V₂ P₂ _inst_1 _inst_5 _inst_6 _inst_7) (PartialOrder.toPreorder.{u1} (AffineSubspace.{u5, u2, u1} k V₂ P₂ _inst_1 _inst_5 _inst_6 _inst_7) (OmegaCompletePartialOrder.toPartialOrder.{u1} (AffineSubspace.{u5, u2, u1} k V₂ P₂ _inst_1 _inst_5 _inst_6 _inst_7) (CompleteLattice.instOmegaCompletePartialOrder.{u1} (AffineSubspace.{u5, u2, u1} k V₂ P₂ _inst_1 _inst_5 _inst_6 _inst_7) (AffineSubspace.instCompleteLatticeAffineSubspace.{u5, u2, u1} k V₂ P₂ _inst_1 _inst_5 _inst_6 _inst_7))))) (AffineSubspace.map.{u5, u4, u3, u2, u1} k V₁ P₁ V₂ P₂ _inst_1 _inst_2 _inst_3 _inst_4 _inst_5 _inst_6 _inst_7 f s) t) (LE.le.{u3} (AffineSubspace.{u5, u4, u3} k V₁ P₁ _inst_1 _inst_2 _inst_3 _inst_4) (Preorder.toLE.{u3} (AffineSubspace.{u5, u4, u3} k V₁ P₁ _inst_1 _inst_2 _inst_3 _inst_4) (PartialOrder.toPreorder.{u3} (AffineSubspace.{u5, u4, u3} k V₁ P₁ _inst_1 _inst_2 _inst_3 _inst_4) (OmegaCompletePartialOrder.toPartialOrder.{u3} (AffineSubspace.{u5, u4, u3} k V₁ P₁ _inst_1 _inst_2 _inst_3 _inst_4) (CompleteLattice.instOmegaCompletePartialOrder.{u3} (AffineSubspace.{u5, u4, u3} k V₁ P₁ _inst_1 _inst_2 _inst_3 _inst_4) (AffineSubspace.instCompleteLatticeAffineSubspace.{u5, u4, u3} k V₁ P₁ _inst_1 _inst_2 _inst_3 _inst_4))))) s (AffineSubspace.comap.{u5, u4, u3, u2, u1} k V₁ P₁ V₂ P₂ _inst_1 _inst_2 _inst_3 _inst_4 _inst_5 _inst_6 _inst_7 f t)) Case conversion may be inaccurate. Consider using '#align affine_subspace.map_le_iff_le_comap AffineSubspace.map_le_iff_le_comapₓ'. -/ -- lemmas about map and comap derived from the galois connection theorem map_le_iff_le_comap {f : P₁ →ᵃ[k] P₂} {s : AffineSubspace k P₁} {t : AffineSubspace k P₂} : s.map f ≤ t ↔ s ≤ t.comap f := image_subset_iff #align affine_subspace.map_le_iff_le_comap AffineSubspace.map_le_iff_le_comap /- warning: affine_subspace.gc_map_comap -> AffineSubspace.gc_map_comap is a dubious translation: lean 3 declaration is forall {k : Type.{u1}} {V₁ : Type.{u2}} {P₁ : Type.{u3}} {V₂ : Type.{u4}} {P₂ : Type.{u5}} [_inst_1 : Ring.{u1} k] [_inst_2 : AddCommGroup.{u2} V₁] [_inst_3 : Module.{u1, u2} k V₁ (Ring.toSemiring.{u1} k _inst_1) (AddCommGroup.toAddCommMonoid.{u2} V₁ _inst_2)] [_inst_4 : AddTorsor.{u2, u3} V₁ P₁ (AddCommGroup.toAddGroup.{u2} V₁ _inst_2)] [_inst_5 : AddCommGroup.{u4} V₂] [_inst_6 : Module.{u1, u4} k V₂ (Ring.toSemiring.{u1} k _inst_1) (AddCommGroup.toAddCommMonoid.{u4} V₂ _inst_5)] [_inst_7 : AddTorsor.{u4, u5} V₂ P₂ (AddCommGroup.toAddGroup.{u4} V₂ _inst_5)] (f : AffineMap.{u1, u2, u3, u4, u5} k V₁ P₁ V₂ P₂ _inst_1 _inst_2 _inst_3 _inst_4 _inst_5 _inst_6 _inst_7), GaloisConnection.{u3, u5} (AffineSubspace.{u1, u2, u3} k V₁ P₁ _inst_1 _inst_2 _inst_3 _inst_4) (AffineSubspace.{u1, u4, u5} k V₂ P₂ _inst_1 _inst_5 _inst_6 _inst_7) (PartialOrder.toPreorder.{u3} (AffineSubspace.{u1, u2, u3} k V₁ P₁ _inst_1 _inst_2 _inst_3 _inst_4) (SetLike.partialOrder.{u3, u3} (AffineSubspace.{u1, u2, u3} k V₁ P₁ _inst_1 _inst_2 _inst_3 _inst_4) P₁ (AffineSubspace.setLike.{u1, u2, u3} k V₁ P₁ _inst_1 _inst_2 _inst_3 _inst_4))) (PartialOrder.toPreorder.{u5} (AffineSubspace.{u1, u4, u5} k V₂ P₂ _inst_1 _inst_5 _inst_6 _inst_7) (SetLike.partialOrder.{u5, u5} (AffineSubspace.{u1, u4, u5} k V₂ P₂ _inst_1 _inst_5 _inst_6 _inst_7) P₂ (AffineSubspace.setLike.{u1, u4, u5} k V₂ P₂ _inst_1 _inst_5 _inst_6 _inst_7))) (AffineSubspace.map.{u1, u2, u3, u4, u5} k V₁ P₁ V₂ P₂ _inst_1 _inst_2 _inst_3 _inst_4 _inst_5 _inst_6 _inst_7 f) (AffineSubspace.comap.{u1, u2, u3, u4, u5} k V₁ P₁ V₂ P₂ _inst_1 _inst_2 _inst_3 _inst_4 _inst_5 _inst_6 _inst_7 f) but is expected to have type forall {k : Type.{u5}} {V₁ : Type.{u4}} {P₁ : Type.{u3}} {V₂ : Type.{u2}} {P₂ : Type.{u1}} [_inst_1 : Ring.{u5} k] [_inst_2 : AddCommGroup.{u4} V₁] [_inst_3 : Module.{u5, u4} k V₁ (Ring.toSemiring.{u5} k _inst_1) (AddCommGroup.toAddCommMonoid.{u4} V₁ _inst_2)] [_inst_4 : AddTorsor.{u4, u3} V₁ P₁ (AddCommGroup.toAddGroup.{u4} V₁ _inst_2)] [_inst_5 : AddCommGroup.{u2} V₂] [_inst_6 : Module.{u5, u2} k V₂ (Ring.toSemiring.{u5} k _inst_1) (AddCommGroup.toAddCommMonoid.{u2} V₂ _inst_5)] [_inst_7 : AddTorsor.{u2, u1} V₂ P₂ (AddCommGroup.toAddGroup.{u2} V₂ _inst_5)] (f : AffineMap.{u5, u4, u3, u2, u1} k V₁ P₁ V₂ P₂ _inst_1 _inst_2 _inst_3 _inst_4 _inst_5 _inst_6 _inst_7), GaloisConnection.{u3, u1} (AffineSubspace.{u5, u4, u3} k V₁ P₁ _inst_1 _inst_2 _inst_3 _inst_4) (AffineSubspace.{u5, u2, u1} k V₂ P₂ _inst_1 _inst_5 _inst_6 _inst_7) (PartialOrder.toPreorder.{u3} (AffineSubspace.{u5, u4, u3} k V₁ P₁ _inst_1 _inst_2 _inst_3 _inst_4) (OmegaCompletePartialOrder.toPartialOrder.{u3} (AffineSubspace.{u5, u4, u3} k V₁ P₁ _inst_1 _inst_2 _inst_3 _inst_4) (CompleteLattice.instOmegaCompletePartialOrder.{u3} (AffineSubspace.{u5, u4, u3} k V₁ P₁ _inst_1 _inst_2 _inst_3 _inst_4) (AffineSubspace.instCompleteLatticeAffineSubspace.{u5, u4, u3} k V₁ P₁ _inst_1 _inst_2 _inst_3 _inst_4)))) (PartialOrder.toPreorder.{u1} (AffineSubspace.{u5, u2, u1} k V₂ P₂ _inst_1 _inst_5 _inst_6 _inst_7) (OmegaCompletePartialOrder.toPartialOrder.{u1} (AffineSubspace.{u5, u2, u1} k V₂ P₂ _inst_1 _inst_5 _inst_6 _inst_7) (CompleteLattice.instOmegaCompletePartialOrder.{u1} (AffineSubspace.{u5, u2, u1} k V₂ P₂ _inst_1 _inst_5 _inst_6 _inst_7) (AffineSubspace.instCompleteLatticeAffineSubspace.{u5, u2, u1} k V₂ P₂ _inst_1 _inst_5 _inst_6 _inst_7)))) (AffineSubspace.map.{u5, u4, u3, u2, u1} k V₁ P₁ V₂ P₂ _inst_1 _inst_2 _inst_3 _inst_4 _inst_5 _inst_6 _inst_7 f) (AffineSubspace.comap.{u5, u4, u3, u2, u1} k V₁ P₁ V₂ P₂ _inst_1 _inst_2 _inst_3 _inst_4 _inst_5 _inst_6 _inst_7 f) Case conversion may be inaccurate. Consider using '#align affine_subspace.gc_map_comap AffineSubspace.gc_map_comapₓ'. -/ theorem gc_map_comap (f : P₁ →ᵃ[k] P₂) : GaloisConnection (map f) (comap f) := fun _ _ => map_le_iff_le_comap #align affine_subspace.gc_map_comap AffineSubspace.gc_map_comap /- warning: affine_subspace.map_comap_le -> AffineSubspace.map_comap_le is a dubious translation: lean 3 declaration is forall {k : Type.{u1}} {V₁ : Type.{u2}} {P₁ : Type.{u3}} {V₂ : Type.{u4}} {P₂ : Type.{u5}} [_inst_1 : Ring.{u1} k] [_inst_2 : AddCommGroup.{u2} V₁] [_inst_3 : Module.{u1, u2} k V₁ (Ring.toSemiring.{u1} k _inst_1) (AddCommGroup.toAddCommMonoid.{u2} V₁ _inst_2)] [_inst_4 : AddTorsor.{u2, u3} V₁ P₁ (AddCommGroup.toAddGroup.{u2} V₁ _inst_2)] [_inst_5 : AddCommGroup.{u4} V₂] [_inst_6 : Module.{u1, u4} k V₂ (Ring.toSemiring.{u1} k _inst_1) (AddCommGroup.toAddCommMonoid.{u4} V₂ _inst_5)] [_inst_7 : AddTorsor.{u4, u5} V₂ P₂ (AddCommGroup.toAddGroup.{u4} V₂ _inst_5)] (f : AffineMap.{u1, u2, u3, u4, u5} k V₁ P₁ V₂ P₂ _inst_1 _inst_2 _inst_3 _inst_4 _inst_5 _inst_6 _inst_7) (s : AffineSubspace.{u1, u4, u5} k V₂ P₂ _inst_1 _inst_5 _inst_6 _inst_7), LE.le.{u5} (AffineSubspace.{u1, u4, u5} k V₂ P₂ _inst_1 _inst_5 _inst_6 _inst_7) (Preorder.toLE.{u5} (AffineSubspace.{u1, u4, u5} k V₂ P₂ _inst_1 _inst_5 _inst_6 _inst_7) (PartialOrder.toPreorder.{u5} (AffineSubspace.{u1, u4, u5} k V₂ P₂ _inst_1 _inst_5 _inst_6 _inst_7) (SetLike.partialOrder.{u5, u5} (AffineSubspace.{u1, u4, u5} k V₂ P₂ _inst_1 _inst_5 _inst_6 _inst_7) P₂ (AffineSubspace.setLike.{u1, u4, u5} k V₂ P₂ _inst_1 _inst_5 _inst_6 _inst_7)))) (AffineSubspace.map.{u1, u2, u3, u4, u5} k V₁ P₁ V₂ P₂ _inst_1 _inst_2 _inst_3 _inst_4 _inst_5 _inst_6 _inst_7 f (AffineSubspace.comap.{u1, u2, u3, u4, u5} k V₁ P₁ V₂ P₂ _inst_1 _inst_2 _inst_3 _inst_4 _inst_5 _inst_6 _inst_7 f s)) s but is expected to have type forall {k : Type.{u5}} {V₁ : Type.{u4}} {P₁ : Type.{u3}} {V₂ : Type.{u2}} {P₂ : Type.{u1}} [_inst_1 : Ring.{u5} k] [_inst_2 : AddCommGroup.{u4} V₁] [_inst_3 : Module.{u5, u4} k V₁ (Ring.toSemiring.{u5} k _inst_1) (AddCommGroup.toAddCommMonoid.{u4} V₁ _inst_2)] [_inst_4 : AddTorsor.{u4, u3} V₁ P₁ (AddCommGroup.toAddGroup.{u4} V₁ _inst_2)] [_inst_5 : AddCommGroup.{u2} V₂] [_inst_6 : Module.{u5, u2} k V₂ (Ring.toSemiring.{u5} k _inst_1) (AddCommGroup.toAddCommMonoid.{u2} V₂ _inst_5)] [_inst_7 : AddTorsor.{u2, u1} V₂ P₂ (AddCommGroup.toAddGroup.{u2} V₂ _inst_5)] (f : AffineMap.{u5, u4, u3, u2, u1} k V₁ P₁ V₂ P₂ _inst_1 _inst_2 _inst_3 _inst_4 _inst_5 _inst_6 _inst_7) (s : AffineSubspace.{u5, u2, u1} k V₂ P₂ _inst_1 _inst_5 _inst_6 _inst_7), LE.le.{u1} (AffineSubspace.{u5, u2, u1} k V₂ P₂ _inst_1 _inst_5 _inst_6 _inst_7) (Preorder.toLE.{u1} (AffineSubspace.{u5, u2, u1} k V₂ P₂ _inst_1 _inst_5 _inst_6 _inst_7) (PartialOrder.toPreorder.{u1} (AffineSubspace.{u5, u2, u1} k V₂ P₂ _inst_1 _inst_5 _inst_6 _inst_7) (OmegaCompletePartialOrder.toPartialOrder.{u1} (AffineSubspace.{u5, u2, u1} k V₂ P₂ _inst_1 _inst_5 _inst_6 _inst_7) (CompleteLattice.instOmegaCompletePartialOrder.{u1} (AffineSubspace.{u5, u2, u1} k V₂ P₂ _inst_1 _inst_5 _inst_6 _inst_7) (AffineSubspace.instCompleteLatticeAffineSubspace.{u5, u2, u1} k V₂ P₂ _inst_1 _inst_5 _inst_6 _inst_7))))) (AffineSubspace.map.{u5, u4, u3, u2, u1} k V₁ P₁ V₂ P₂ _inst_1 _inst_2 _inst_3 _inst_4 _inst_5 _inst_6 _inst_7 f (AffineSubspace.comap.{u5, u4, u3, u2, u1} k V₁ P₁ V₂ P₂ _inst_1 _inst_2 _inst_3 _inst_4 _inst_5 _inst_6 _inst_7 f s)) s Case conversion may be inaccurate. Consider using '#align affine_subspace.map_comap_le AffineSubspace.map_comap_leₓ'. -/ theorem map_comap_le (f : P₁ →ᵃ[k] P₂) (s : AffineSubspace k P₂) : (s.comap f).map f ≤ s := (gc_map_comap f).l_u_le _ #align affine_subspace.map_comap_le AffineSubspace.map_comap_le /- warning: affine_subspace.le_comap_map -> AffineSubspace.le_comap_map is a dubious translation: lean 3 declaration is forall {k : Type.{u1}} {V₁ : Type.{u2}} {P₁ : Type.{u3}} {V₂ : Type.{u4}} {P₂ : Type.{u5}} [_inst_1 : Ring.{u1} k] [_inst_2 : AddCommGroup.{u2} V₁] [_inst_3 : Module.{u1, u2} k V₁ (Ring.toSemiring.{u1} k _inst_1) (AddCommGroup.toAddCommMonoid.{u2} V₁ _inst_2)] [_inst_4 : AddTorsor.{u2, u3} V₁ P₁ (AddCommGroup.toAddGroup.{u2} V₁ _inst_2)] [_inst_5 : AddCommGroup.{u4} V₂] [_inst_6 : Module.{u1, u4} k V₂ (Ring.toSemiring.{u1} k _inst_1) (AddCommGroup.toAddCommMonoid.{u4} V₂ _inst_5)] [_inst_7 : AddTorsor.{u4, u5} V₂ P₂ (AddCommGroup.toAddGroup.{u4} V₂ _inst_5)] (f : AffineMap.{u1, u2, u3, u4, u5} k V₁ P₁ V₂ P₂ _inst_1 _inst_2 _inst_3 _inst_4 _inst_5 _inst_6 _inst_7) (s : AffineSubspace.{u1, u2, u3} k V₁ P₁ _inst_1 _inst_2 _inst_3 _inst_4), LE.le.{u3} (AffineSubspace.{u1, u2, u3} k V₁ P₁ _inst_1 _inst_2 _inst_3 _inst_4) (Preorder.toLE.{u3} (AffineSubspace.{u1, u2, u3} k V₁ P₁ _inst_1 _inst_2 _inst_3 _inst_4) (PartialOrder.toPreorder.{u3} (AffineSubspace.{u1, u2, u3} k V₁ P₁ _inst_1 _inst_2 _inst_3 _inst_4) (SetLike.partialOrder.{u3, u3} (AffineSubspace.{u1, u2, u3} k V₁ P₁ _inst_1 _inst_2 _inst_3 _inst_4) P₁ (AffineSubspace.setLike.{u1, u2, u3} k V₁ P₁ _inst_1 _inst_2 _inst_3 _inst_4)))) s (AffineSubspace.comap.{u1, u2, u3, u4, u5} k V₁ P₁ V₂ P₂ _inst_1 _inst_2 _inst_3 _inst_4 _inst_5 _inst_6 _inst_7 f (AffineSubspace.map.{u1, u2, u3, u4, u5} k V₁ P₁ V₂ P₂ _inst_1 _inst_2 _inst_3 _inst_4 _inst_5 _inst_6 _inst_7 f s)) but is expected to have type forall {k : Type.{u5}} {V₁ : Type.{u4}} {P₁ : Type.{u3}} {V₂ : Type.{u2}} {P₂ : Type.{u1}} [_inst_1 : Ring.{u5} k] [_inst_2 : AddCommGroup.{u4} V₁] [_inst_3 : Module.{u5, u4} k V₁ (Ring.toSemiring.{u5} k _inst_1) (AddCommGroup.toAddCommMonoid.{u4} V₁ _inst_2)] [_inst_4 : AddTorsor.{u4, u3} V₁ P₁ (AddCommGroup.toAddGroup.{u4} V₁ _inst_2)] [_inst_5 : AddCommGroup.{u2} V₂] [_inst_6 : Module.{u5, u2} k V₂ (Ring.toSemiring.{u5} k _inst_1) (AddCommGroup.toAddCommMonoid.{u2} V₂ _inst_5)] [_inst_7 : AddTorsor.{u2, u1} V₂ P₂ (AddCommGroup.toAddGroup.{u2} V₂ _inst_5)] (f : AffineMap.{u5, u4, u3, u2, u1} k V₁ P₁ V₂ P₂ _inst_1 _inst_2 _inst_3 _inst_4 _inst_5 _inst_6 _inst_7) (s : AffineSubspace.{u5, u4, u3} k V₁ P₁ _inst_1 _inst_2 _inst_3 _inst_4), LE.le.{u3} (AffineSubspace.{u5, u4, u3} k V₁ P₁ _inst_1 _inst_2 _inst_3 _inst_4) (Preorder.toLE.{u3} (AffineSubspace.{u5, u4, u3} k V₁ P₁ _inst_1 _inst_2 _inst_3 _inst_4) (PartialOrder.toPreorder.{u3} (AffineSubspace.{u5, u4, u3} k V₁ P₁ _inst_1 _inst_2 _inst_3 _inst_4) (OmegaCompletePartialOrder.toPartialOrder.{u3} (AffineSubspace.{u5, u4, u3} k V₁ P₁ _inst_1 _inst_2 _inst_3 _inst_4) (CompleteLattice.instOmegaCompletePartialOrder.{u3} (AffineSubspace.{u5, u4, u3} k V₁ P₁ _inst_1 _inst_2 _inst_3 _inst_4) (AffineSubspace.instCompleteLatticeAffineSubspace.{u5, u4, u3} k V₁ P₁ _inst_1 _inst_2 _inst_3 _inst_4))))) s (AffineSubspace.comap.{u5, u4, u3, u2, u1} k V₁ P₁ V₂ P₂ _inst_1 _inst_2 _inst_3 _inst_4 _inst_5 _inst_6 _inst_7 f (AffineSubspace.map.{u5, u4, u3, u2, u1} k V₁ P₁ V₂ P₂ _inst_1 _inst_2 _inst_3 _inst_4 _inst_5 _inst_6 _inst_7 f s)) Case conversion may be inaccurate. Consider using '#align affine_subspace.le_comap_map AffineSubspace.le_comap_mapₓ'. -/ theorem le_comap_map (f : P₁ →ᵃ[k] P₂) (s : AffineSubspace k P₁) : s ≤ (s.map f).comap f := (gc_map_comap f).le_u_l _ #align affine_subspace.le_comap_map AffineSubspace.le_comap_map /- warning: affine_subspace.map_sup -> AffineSubspace.map_sup is a dubious translation: lean 3 declaration is forall {k : Type.{u1}} {V₁ : Type.{u2}} {P₁ : Type.{u3}} {V₂ : Type.{u4}} {P₂ : Type.{u5}} [_inst_1 : Ring.{u1} k] [_inst_2 : AddCommGroup.{u2} V₁] [_inst_3 : Module.{u1, u2} k V₁ (Ring.toSemiring.{u1} k _inst_1) (AddCommGroup.toAddCommMonoid.{u2} V₁ _inst_2)] [_inst_4 : AddTorsor.{u2, u3} V₁ P₁ (AddCommGroup.toAddGroup.{u2} V₁ _inst_2)] [_inst_5 : AddCommGroup.{u4} V₂] [_inst_6 : Module.{u1, u4} k V₂ (Ring.toSemiring.{u1} k _inst_1) (AddCommGroup.toAddCommMonoid.{u4} V₂ _inst_5)] [_inst_7 : AddTorsor.{u4, u5} V₂ P₂ (AddCommGroup.toAddGroup.{u4} V₂ _inst_5)] (s : AffineSubspace.{u1, u2, u3} k V₁ P₁ _inst_1 _inst_2 _inst_3 _inst_4) (t : AffineSubspace.{u1, u2, u3} k V₁ P₁ _inst_1 _inst_2 _inst_3 _inst_4) (f : AffineMap.{u1, u2, u3, u4, u5} k V₁ P₁ V₂ P₂ _inst_1 _inst_2 _inst_3 _inst_4 _inst_5 _inst_6 _inst_7), Eq.{succ u5} (AffineSubspace.{u1, u4, u5} k V₂ P₂ _inst_1 _inst_5 _inst_6 _inst_7) (AffineSubspace.map.{u1, u2, u3, u4, u5} k V₁ P₁ V₂ P₂ _inst_1 _inst_2 _inst_3 _inst_4 _inst_5 _inst_6 _inst_7 f (Sup.sup.{u3} (AffineSubspace.{u1, u2, u3} k V₁ P₁ _inst_1 _inst_2 _inst_3 _inst_4) (SemilatticeSup.toHasSup.{u3} (AffineSubspace.{u1, u2, u3} k V₁ P₁ _inst_1 _inst_2 _inst_3 _inst_4) (Lattice.toSemilatticeSup.{u3} (AffineSubspace.{u1, u2, u3} k V₁ P₁ _inst_1 _inst_2 _inst_3 _inst_4) (ConditionallyCompleteLattice.toLattice.{u3} (AffineSubspace.{u1, u2, u3} k V₁ P₁ _inst_1 _inst_2 _inst_3 _inst_4) (CompleteLattice.toConditionallyCompleteLattice.{u3} (AffineSubspace.{u1, u2, u3} k V₁ P₁ _inst_1 _inst_2 _inst_3 _inst_4) (AffineSubspace.completeLattice.{u1, u2, u3} k V₁ P₁ _inst_1 _inst_2 _inst_3 _inst_4))))) s t)) (Sup.sup.{u5} (AffineSubspace.{u1, u4, u5} k V₂ P₂ _inst_1 _inst_5 _inst_6 _inst_7) (SemilatticeSup.toHasSup.{u5} (AffineSubspace.{u1, u4, u5} k V₂ P₂ _inst_1 _inst_5 _inst_6 _inst_7) (Lattice.toSemilatticeSup.{u5} (AffineSubspace.{u1, u4, u5} k V₂ P₂ _inst_1 _inst_5 _inst_6 _inst_7) (ConditionallyCompleteLattice.toLattice.{u5} (AffineSubspace.{u1, u4, u5} k V₂ P₂ _inst_1 _inst_5 _inst_6 _inst_7) (CompleteLattice.toConditionallyCompleteLattice.{u5} (AffineSubspace.{u1, u4, u5} k V₂ P₂ _inst_1 _inst_5 _inst_6 _inst_7) (AffineSubspace.completeLattice.{u1, u4, u5} k V₂ P₂ _inst_1 _inst_5 _inst_6 _inst_7))))) (AffineSubspace.map.{u1, u2, u3, u4, u5} k V₁ P₁ V₂ P₂ _inst_1 _inst_2 _inst_3 _inst_4 _inst_5 _inst_6 _inst_7 f s) (AffineSubspace.map.{u1, u2, u3, u4, u5} k V₁ P₁ V₂ P₂ _inst_1 _inst_2 _inst_3 _inst_4 _inst_5 _inst_6 _inst_7 f t)) but is expected to have type forall {k : Type.{u5}} {V₁ : Type.{u4}} {P₁ : Type.{u3}} {V₂ : Type.{u2}} {P₂ : Type.{u1}} [_inst_1 : Ring.{u5} k] [_inst_2 : AddCommGroup.{u4} V₁] [_inst_3 : Module.{u5, u4} k V₁ (Ring.toSemiring.{u5} k _inst_1) (AddCommGroup.toAddCommMonoid.{u4} V₁ _inst_2)] [_inst_4 : AddTorsor.{u4, u3} V₁ P₁ (AddCommGroup.toAddGroup.{u4} V₁ _inst_2)] [_inst_5 : AddCommGroup.{u2} V₂] [_inst_6 : Module.{u5, u2} k V₂ (Ring.toSemiring.{u5} k _inst_1) (AddCommGroup.toAddCommMonoid.{u2} V₂ _inst_5)] [_inst_7 : AddTorsor.{u2, u1} V₂ P₂ (AddCommGroup.toAddGroup.{u2} V₂ _inst_5)] (s : AffineSubspace.{u5, u4, u3} k V₁ P₁ _inst_1 _inst_2 _inst_3 _inst_4) (t : AffineSubspace.{u5, u4, u3} k V₁ P₁ _inst_1 _inst_2 _inst_3 _inst_4) (f : AffineMap.{u5, u4, u3, u2, u1} k V₁ P₁ V₂ P₂ _inst_1 _inst_2 _inst_3 _inst_4 _inst_5 _inst_6 _inst_7), Eq.{succ u1} (AffineSubspace.{u5, u2, u1} k V₂ P₂ _inst_1 _inst_5 _inst_6 _inst_7) (AffineSubspace.map.{u5, u4, u3, u2, u1} k V₁ P₁ V₂ P₂ _inst_1 _inst_2 _inst_3 _inst_4 _inst_5 _inst_6 _inst_7 f (Sup.sup.{u3} (AffineSubspace.{u5, u4, u3} k V₁ P₁ _inst_1 _inst_2 _inst_3 _inst_4) (SemilatticeSup.toSup.{u3} (AffineSubspace.{u5, u4, u3} k V₁ P₁ _inst_1 _inst_2 _inst_3 _inst_4) (Lattice.toSemilatticeSup.{u3} (AffineSubspace.{u5, u4, u3} k V₁ P₁ _inst_1 _inst_2 _inst_3 _inst_4) (ConditionallyCompleteLattice.toLattice.{u3} (AffineSubspace.{u5, u4, u3} k V₁ P₁ _inst_1 _inst_2 _inst_3 _inst_4) (CompleteLattice.toConditionallyCompleteLattice.{u3} (AffineSubspace.{u5, u4, u3} k V₁ P₁ _inst_1 _inst_2 _inst_3 _inst_4) (AffineSubspace.instCompleteLatticeAffineSubspace.{u5, u4, u3} k V₁ P₁ _inst_1 _inst_2 _inst_3 _inst_4))))) s t)) (Sup.sup.{u1} (AffineSubspace.{u5, u2, u1} k V₂ P₂ _inst_1 _inst_5 _inst_6 _inst_7) (SemilatticeSup.toSup.{u1} (AffineSubspace.{u5, u2, u1} k V₂ P₂ _inst_1 _inst_5 _inst_6 _inst_7) (Lattice.toSemilatticeSup.{u1} (AffineSubspace.{u5, u2, u1} k V₂ P₂ _inst_1 _inst_5 _inst_6 _inst_7) (ConditionallyCompleteLattice.toLattice.{u1} (AffineSubspace.{u5, u2, u1} k V₂ P₂ _inst_1 _inst_5 _inst_6 _inst_7) (CompleteLattice.toConditionallyCompleteLattice.{u1} (AffineSubspace.{u5, u2, u1} k V₂ P₂ _inst_1 _inst_5 _inst_6 _inst_7) (AffineSubspace.instCompleteLatticeAffineSubspace.{u5, u2, u1} k V₂ P₂ _inst_1 _inst_5 _inst_6 _inst_7))))) (AffineSubspace.map.{u5, u4, u3, u2, u1} k V₁ P₁ V₂ P₂ _inst_1 _inst_2 _inst_3 _inst_4 _inst_5 _inst_6 _inst_7 f s) (AffineSubspace.map.{u5, u4, u3, u2, u1} k V₁ P₁ V₂ P₂ _inst_1 _inst_2 _inst_3 _inst_4 _inst_5 _inst_6 _inst_7 f t)) Case conversion may be inaccurate. Consider using '#align affine_subspace.map_sup AffineSubspace.map_supₓ'. -/ theorem map_sup (s t : AffineSubspace k P₁) (f : P₁ →ᵃ[k] P₂) : (s ⊔ t).map f = s.map f ⊔ t.map f := (gc_map_comap f).l_sup #align affine_subspace.map_sup AffineSubspace.map_sup /- warning: affine_subspace.map_supr -> AffineSubspace.map_supᵢ is a dubious translation: lean 3 declaration is forall {k : Type.{u1}} {V₁ : Type.{u2}} {P₁ : Type.{u3}} {V₂ : Type.{u4}} {P₂ : Type.{u5}} [_inst_1 : Ring.{u1} k] [_inst_2 : AddCommGroup.{u2} V₁] [_inst_3 : Module.{u1, u2} k V₁ (Ring.toSemiring.{u1} k _inst_1) (AddCommGroup.toAddCommMonoid.{u2} V₁ _inst_2)] [_inst_4 : AddTorsor.{u2, u3} V₁ P₁ (AddCommGroup.toAddGroup.{u2} V₁ _inst_2)] [_inst_5 : AddCommGroup.{u4} V₂] [_inst_6 : Module.{u1, u4} k V₂ (Ring.toSemiring.{u1} k _inst_1) (AddCommGroup.toAddCommMonoid.{u4} V₂ _inst_5)] [_inst_7 : AddTorsor.{u4, u5} V₂ P₂ (AddCommGroup.toAddGroup.{u4} V₂ _inst_5)] {ι : Sort.{u6}} (f : AffineMap.{u1, u2, u3, u4, u5} k V₁ P₁ V₂ P₂ _inst_1 _inst_2 _inst_3 _inst_4 _inst_5 _inst_6 _inst_7) (s : ι -> (AffineSubspace.{u1, u2, u3} k V₁ P₁ _inst_1 _inst_2 _inst_3 _inst_4)), Eq.{succ u5} (AffineSubspace.{u1, u4, u5} k V₂ P₂ _inst_1 _inst_5 _inst_6 _inst_7) (AffineSubspace.map.{u1, u2, u3, u4, u5} k V₁ P₁ V₂ P₂ _inst_1 _inst_2 _inst_3 _inst_4 _inst_5 _inst_6 _inst_7 f (supᵢ.{u3, u6} (AffineSubspace.{u1, u2, u3} k V₁ P₁ _inst_1 _inst_2 _inst_3 _inst_4) (ConditionallyCompleteLattice.toHasSup.{u3} (AffineSubspace.{u1, u2, u3} k V₁ P₁ _inst_1 _inst_2 _inst_3 _inst_4) (CompleteLattice.toConditionallyCompleteLattice.{u3} (AffineSubspace.{u1, u2, u3} k V₁ P₁ _inst_1 _inst_2 _inst_3 _inst_4) (AffineSubspace.completeLattice.{u1, u2, u3} k V₁ P₁ _inst_1 _inst_2 _inst_3 _inst_4))) ι s)) (supᵢ.{u5, u6} (AffineSubspace.{u1, u4, u5} k V₂ P₂ _inst_1 _inst_5 _inst_6 _inst_7) (ConditionallyCompleteLattice.toHasSup.{u5} (AffineSubspace.{u1, u4, u5} k V₂ P₂ _inst_1 _inst_5 _inst_6 _inst_7) (CompleteLattice.toConditionallyCompleteLattice.{u5} (AffineSubspace.{u1, u4, u5} k V₂ P₂ _inst_1 _inst_5 _inst_6 _inst_7) (AffineSubspace.completeLattice.{u1, u4, u5} k V₂ P₂ _inst_1 _inst_5 _inst_6 _inst_7))) ι (fun (i : ι) => AffineSubspace.map.{u1, u2, u3, u4, u5} k V₁ P₁ V₂ P₂ _inst_1 _inst_2 _inst_3 _inst_4 _inst_5 _inst_6 _inst_7 f (s i))) but is expected to have type forall {k : Type.{u5}} {V₁ : Type.{u4}} {P₁ : Type.{u3}} {V₂ : Type.{u2}} {P₂ : Type.{u1}} [_inst_1 : Ring.{u5} k] [_inst_2 : AddCommGroup.{u4} V₁] [_inst_3 : Module.{u5, u4} k V₁ (Ring.toSemiring.{u5} k _inst_1) (AddCommGroup.toAddCommMonoid.{u4} V₁ _inst_2)] [_inst_4 : AddTorsor.{u4, u3} V₁ P₁ (AddCommGroup.toAddGroup.{u4} V₁ _inst_2)] [_inst_5 : AddCommGroup.{u2} V₂] [_inst_6 : Module.{u5, u2} k V₂ (Ring.toSemiring.{u5} k _inst_1) (AddCommGroup.toAddCommMonoid.{u2} V₂ _inst_5)] [_inst_7 : AddTorsor.{u2, u1} V₂ P₂ (AddCommGroup.toAddGroup.{u2} V₂ _inst_5)] {ι : Sort.{u6}} (f : AffineMap.{u5, u4, u3, u2, u1} k V₁ P₁ V₂ P₂ _inst_1 _inst_2 _inst_3 _inst_4 _inst_5 _inst_6 _inst_7) (s : ι -> (AffineSubspace.{u5, u4, u3} k V₁ P₁ _inst_1 _inst_2 _inst_3 _inst_4)), Eq.{succ u1} (AffineSubspace.{u5, u2, u1} k V₂ P₂ _inst_1 _inst_5 _inst_6 _inst_7) (AffineSubspace.map.{u5, u4, u3, u2, u1} k V₁ P₁ V₂ P₂ _inst_1 _inst_2 _inst_3 _inst_4 _inst_5 _inst_6 _inst_7 f (supᵢ.{u3, u6} (AffineSubspace.{u5, u4, u3} k V₁ P₁ _inst_1 _inst_2 _inst_3 _inst_4) (ConditionallyCompleteLattice.toSupSet.{u3} (AffineSubspace.{u5, u4, u3} k V₁ P₁ _inst_1 _inst_2 _inst_3 _inst_4) (CompleteLattice.toConditionallyCompleteLattice.{u3} (AffineSubspace.{u5, u4, u3} k V₁ P₁ _inst_1 _inst_2 _inst_3 _inst_4) (AffineSubspace.instCompleteLatticeAffineSubspace.{u5, u4, u3} k V₁ P₁ _inst_1 _inst_2 _inst_3 _inst_4))) ι s)) (supᵢ.{u1, u6} (AffineSubspace.{u5, u2, u1} k V₂ P₂ _inst_1 _inst_5 _inst_6 _inst_7) (ConditionallyCompleteLattice.toSupSet.{u1} (AffineSubspace.{u5, u2, u1} k V₂ P₂ _inst_1 _inst_5 _inst_6 _inst_7) (CompleteLattice.toConditionallyCompleteLattice.{u1} (AffineSubspace.{u5, u2, u1} k V₂ P₂ _inst_1 _inst_5 _inst_6 _inst_7) (AffineSubspace.instCompleteLatticeAffineSubspace.{u5, u2, u1} k V₂ P₂ _inst_1 _inst_5 _inst_6 _inst_7))) ι (fun (i : ι) => AffineSubspace.map.{u5, u4, u3, u2, u1} k V₁ P₁ V₂ P₂ _inst_1 _inst_2 _inst_3 _inst_4 _inst_5 _inst_6 _inst_7 f (s i))) Case conversion may be inaccurate. Consider using '#align affine_subspace.map_supr AffineSubspace.map_supᵢₓ'. -/ theorem map_supᵢ {ι : Sort _} (f : P₁ →ᵃ[k] P₂) (s : ι → AffineSubspace k P₁) : (supᵢ s).map f = ⨆ i, (s i).map f := (gc_map_comap f).l_supᵢ #align affine_subspace.map_supr AffineSubspace.map_supᵢ /- warning: affine_subspace.comap_inf -> AffineSubspace.comap_inf is a dubious translation: lean 3 declaration is forall {k : Type.{u1}} {V₁ : Type.{u2}} {P₁ : Type.{u3}} {V₂ : Type.{u4}} {P₂ : Type.{u5}} [_inst_1 : Ring.{u1} k] [_inst_2 : AddCommGroup.{u2} V₁] [_inst_3 : Module.{u1, u2} k V₁ (Ring.toSemiring.{u1} k _inst_1) (AddCommGroup.toAddCommMonoid.{u2} V₁ _inst_2)] [_inst_4 : AddTorsor.{u2, u3} V₁ P₁ (AddCommGroup.toAddGroup.{u2} V₁ _inst_2)] [_inst_5 : AddCommGroup.{u4} V₂] [_inst_6 : Module.{u1, u4} k V₂ (Ring.toSemiring.{u1} k _inst_1) (AddCommGroup.toAddCommMonoid.{u4} V₂ _inst_5)] [_inst_7 : AddTorsor.{u4, u5} V₂ P₂ (AddCommGroup.toAddGroup.{u4} V₂ _inst_5)] (s : AffineSubspace.{u1, u4, u5} k V₂ P₂ _inst_1 _inst_5 _inst_6 _inst_7) (t : AffineSubspace.{u1, u4, u5} k V₂ P₂ _inst_1 _inst_5 _inst_6 _inst_7) (f : AffineMap.{u1, u2, u3, u4, u5} k V₁ P₁ V₂ P₂ _inst_1 _inst_2 _inst_3 _inst_4 _inst_5 _inst_6 _inst_7), Eq.{succ u3} (AffineSubspace.{u1, u2, u3} k V₁ P₁ _inst_1 _inst_2 _inst_3 _inst_4) (AffineSubspace.comap.{u1, u2, u3, u4, u5} k V₁ P₁ V₂ P₂ _inst_1 _inst_2 _inst_3 _inst_4 _inst_5 _inst_6 _inst_7 f (Inf.inf.{u5} (AffineSubspace.{u1, u4, u5} k V₂ P₂ _inst_1 _inst_5 _inst_6 _inst_7) (SemilatticeInf.toHasInf.{u5} (AffineSubspace.{u1, u4, u5} k V₂ P₂ _inst_1 _inst_5 _inst_6 _inst_7) (Lattice.toSemilatticeInf.{u5} (AffineSubspace.{u1, u4, u5} k V₂ P₂ _inst_1 _inst_5 _inst_6 _inst_7) (ConditionallyCompleteLattice.toLattice.{u5} (AffineSubspace.{u1, u4, u5} k V₂ P₂ _inst_1 _inst_5 _inst_6 _inst_7) (CompleteLattice.toConditionallyCompleteLattice.{u5} (AffineSubspace.{u1, u4, u5} k V₂ P₂ _inst_1 _inst_5 _inst_6 _inst_7) (AffineSubspace.completeLattice.{u1, u4, u5} k V₂ P₂ _inst_1 _inst_5 _inst_6 _inst_7))))) s t)) (Inf.inf.{u3} (AffineSubspace.{u1, u2, u3} k V₁ P₁ _inst_1 _inst_2 _inst_3 _inst_4) (SemilatticeInf.toHasInf.{u3} (AffineSubspace.{u1, u2, u3} k V₁ P₁ _inst_1 _inst_2 _inst_3 _inst_4) (Lattice.toSemilatticeInf.{u3} (AffineSubspace.{u1, u2, u3} k V₁ P₁ _inst_1 _inst_2 _inst_3 _inst_4) (ConditionallyCompleteLattice.toLattice.{u3} (AffineSubspace.{u1, u2, u3} k V₁ P₁ _inst_1 _inst_2 _inst_3 _inst_4) (CompleteLattice.toConditionallyCompleteLattice.{u3} (AffineSubspace.{u1, u2, u3} k V₁ P₁ _inst_1 _inst_2 _inst_3 _inst_4) (AffineSubspace.completeLattice.{u1, u2, u3} k V₁ P₁ _inst_1 _inst_2 _inst_3 _inst_4))))) (AffineSubspace.comap.{u1, u2, u3, u4, u5} k V₁ P₁ V₂ P₂ _inst_1 _inst_2 _inst_3 _inst_4 _inst_5 _inst_6 _inst_7 f s) (AffineSubspace.comap.{u1, u2, u3, u4, u5} k V₁ P₁ V₂ P₂ _inst_1 _inst_2 _inst_3 _inst_4 _inst_5 _inst_6 _inst_7 f t)) but is expected to have type forall {k : Type.{u5}} {V₁ : Type.{u2}} {P₁ : Type.{u1}} {V₂ : Type.{u4}} {P₂ : Type.{u3}} [_inst_1 : Ring.{u5} k] [_inst_2 : AddCommGroup.{u2} V₁] [_inst_3 : Module.{u5, u2} k V₁ (Ring.toSemiring.{u5} k _inst_1) (AddCommGroup.toAddCommMonoid.{u2} V₁ _inst_2)] [_inst_4 : AddTorsor.{u2, u1} V₁ P₁ (AddCommGroup.toAddGroup.{u2} V₁ _inst_2)] [_inst_5 : AddCommGroup.{u4} V₂] [_inst_6 : Module.{u5, u4} k V₂ (Ring.toSemiring.{u5} k _inst_1) (AddCommGroup.toAddCommMonoid.{u4} V₂ _inst_5)] [_inst_7 : AddTorsor.{u4, u3} V₂ P₂ (AddCommGroup.toAddGroup.{u4} V₂ _inst_5)] (s : AffineSubspace.{u5, u4, u3} k V₂ P₂ _inst_1 _inst_5 _inst_6 _inst_7) (t : AffineSubspace.{u5, u4, u3} k V₂ P₂ _inst_1 _inst_5 _inst_6 _inst_7) (f : AffineMap.{u5, u2, u1, u4, u3} k V₁ P₁ V₂ P₂ _inst_1 _inst_2 _inst_3 _inst_4 _inst_5 _inst_6 _inst_7), Eq.{succ u1} (AffineSubspace.{u5, u2, u1} k V₁ P₁ _inst_1 _inst_2 _inst_3 _inst_4) (AffineSubspace.comap.{u5, u2, u1, u4, u3} k V₁ P₁ V₂ P₂ _inst_1 _inst_2 _inst_3 _inst_4 _inst_5 _inst_6 _inst_7 f (Inf.inf.{u3} (AffineSubspace.{u5, u4, u3} k V₂ P₂ _inst_1 _inst_5 _inst_6 _inst_7) (Lattice.toInf.{u3} (AffineSubspace.{u5, u4, u3} k V₂ P₂ _inst_1 _inst_5 _inst_6 _inst_7) (ConditionallyCompleteLattice.toLattice.{u3} (AffineSubspace.{u5, u4, u3} k V₂ P₂ _inst_1 _inst_5 _inst_6 _inst_7) (CompleteLattice.toConditionallyCompleteLattice.{u3} (AffineSubspace.{u5, u4, u3} k V₂ P₂ _inst_1 _inst_5 _inst_6 _inst_7) (AffineSubspace.instCompleteLatticeAffineSubspace.{u5, u4, u3} k V₂ P₂ _inst_1 _inst_5 _inst_6 _inst_7)))) s t)) (Inf.inf.{u1} (AffineSubspace.{u5, u2, u1} k V₁ P₁ _inst_1 _inst_2 _inst_3 _inst_4) (Lattice.toInf.{u1} (AffineSubspace.{u5, u2, u1} k V₁ P₁ _inst_1 _inst_2 _inst_3 _inst_4) (ConditionallyCompleteLattice.toLattice.{u1} (AffineSubspace.{u5, u2, u1} k V₁ P₁ _inst_1 _inst_2 _inst_3 _inst_4) (CompleteLattice.toConditionallyCompleteLattice.{u1} (AffineSubspace.{u5, u2, u1} k V₁ P₁ _inst_1 _inst_2 _inst_3 _inst_4) (AffineSubspace.instCompleteLatticeAffineSubspace.{u5, u2, u1} k V₁ P₁ _inst_1 _inst_2 _inst_3 _inst_4)))) (AffineSubspace.comap.{u5, u2, u1, u4, u3} k V₁ P₁ V₂ P₂ _inst_1 _inst_2 _inst_3 _inst_4 _inst_5 _inst_6 _inst_7 f s) (AffineSubspace.comap.{u5, u2, u1, u4, u3} k V₁ P₁ V₂ P₂ _inst_1 _inst_2 _inst_3 _inst_4 _inst_5 _inst_6 _inst_7 f t)) Case conversion may be inaccurate. Consider using '#align affine_subspace.comap_inf AffineSubspace.comap_infₓ'. -/ theorem comap_inf (s t : AffineSubspace k P₂) (f : P₁ →ᵃ[k] P₂) : (s ⊓ t).comap f = s.comap f ⊓ t.comap f := (gc_map_comap f).u_inf #align affine_subspace.comap_inf AffineSubspace.comap_inf /- warning: affine_subspace.comap_supr -> AffineSubspace.comap_supr is a dubious translation: lean 3 declaration is forall {k : Type.{u1}} {V₁ : Type.{u2}} {P₁ : Type.{u3}} {V₂ : Type.{u4}} {P₂ : Type.{u5}} [_inst_1 : Ring.{u1} k] [_inst_2 : AddCommGroup.{u2} V₁] [_inst_3 : Module.{u1, u2} k V₁ (Ring.toSemiring.{u1} k _inst_1) (AddCommGroup.toAddCommMonoid.{u2} V₁ _inst_2)] [_inst_4 : AddTorsor.{u2, u3} V₁ P₁ (AddCommGroup.toAddGroup.{u2} V₁ _inst_2)] [_inst_5 : AddCommGroup.{u4} V₂] [_inst_6 : Module.{u1, u4} k V₂ (Ring.toSemiring.{u1} k _inst_1) (AddCommGroup.toAddCommMonoid.{u4} V₂ _inst_5)] [_inst_7 : AddTorsor.{u4, u5} V₂ P₂ (AddCommGroup.toAddGroup.{u4} V₂ _inst_5)] {ι : Sort.{u6}} (f : AffineMap.{u1, u2, u3, u4, u5} k V₁ P₁ V₂ P₂ _inst_1 _inst_2 _inst_3 _inst_4 _inst_5 _inst_6 _inst_7) (s : ι -> (AffineSubspace.{u1, u4, u5} k V₂ P₂ _inst_1 _inst_5 _inst_6 _inst_7)), Eq.{succ u3} (AffineSubspace.{u1, u2, u3} k V₁ P₁ _inst_1 _inst_2 _inst_3 _inst_4) (AffineSubspace.comap.{u1, u2, u3, u4, u5} k V₁ P₁ V₂ P₂ _inst_1 _inst_2 _inst_3 _inst_4 _inst_5 _inst_6 _inst_7 f (infᵢ.{u5, u6} (AffineSubspace.{u1, u4, u5} k V₂ P₂ _inst_1 _inst_5 _inst_6 _inst_7) (ConditionallyCompleteLattice.toHasInf.{u5} (AffineSubspace.{u1, u4, u5} k V₂ P₂ _inst_1 _inst_5 _inst_6 _inst_7) (CompleteLattice.toConditionallyCompleteLattice.{u5} (AffineSubspace.{u1, u4, u5} k V₂ P₂ _inst_1 _inst_5 _inst_6 _inst_7) (AffineSubspace.completeLattice.{u1, u4, u5} k V₂ P₂ _inst_1 _inst_5 _inst_6 _inst_7))) ι s)) (infᵢ.{u3, u6} (AffineSubspace.{u1, u2, u3} k V₁ P₁ _inst_1 _inst_2 _inst_3 _inst_4) (ConditionallyCompleteLattice.toHasInf.{u3} (AffineSubspace.{u1, u2, u3} k V₁ P₁ _inst_1 _inst_2 _inst_3 _inst_4) (CompleteLattice.toConditionallyCompleteLattice.{u3} (AffineSubspace.{u1, u2, u3} k V₁ P₁ _inst_1 _inst_2 _inst_3 _inst_4) (AffineSubspace.completeLattice.{u1, u2, u3} k V₁ P₁ _inst_1 _inst_2 _inst_3 _inst_4))) ι (fun (i : ι) => AffineSubspace.comap.{u1, u2, u3, u4, u5} k V₁ P₁ V₂ P₂ _inst_1 _inst_2 _inst_3 _inst_4 _inst_5 _inst_6 _inst_7 f (s i))) but is expected to have type forall {k : Type.{u5}} {V₁ : Type.{u4}} {P₁ : Type.{u3}} {V₂ : Type.{u2}} {P₂ : Type.{u1}} [_inst_1 : Ring.{u5} k] [_inst_2 : AddCommGroup.{u4} V₁] [_inst_3 : Module.{u5, u4} k V₁ (Ring.toSemiring.{u5} k _inst_1) (AddCommGroup.toAddCommMonoid.{u4} V₁ _inst_2)] [_inst_4 : AddTorsor.{u4, u3} V₁ P₁ (AddCommGroup.toAddGroup.{u4} V₁ _inst_2)] [_inst_5 : AddCommGroup.{u2} V₂] [_inst_6 : Module.{u5, u2} k V₂ (Ring.toSemiring.{u5} k _inst_1) (AddCommGroup.toAddCommMonoid.{u2} V₂ _inst_5)] [_inst_7 : AddTorsor.{u2, u1} V₂ P₂ (AddCommGroup.toAddGroup.{u2} V₂ _inst_5)] {ι : Sort.{u6}} (f : AffineMap.{u5, u4, u3, u2, u1} k V₁ P₁ V₂ P₂ _inst_1 _inst_2 _inst_3 _inst_4 _inst_5 _inst_6 _inst_7) (s : ι -> (AffineSubspace.{u5, u2, u1} k V₂ P₂ _inst_1 _inst_5 _inst_6 _inst_7)), Eq.{succ u3} (AffineSubspace.{u5, u4, u3} k V₁ P₁ _inst_1 _inst_2 _inst_3 _inst_4) (AffineSubspace.comap.{u5, u4, u3, u2, u1} k V₁ P₁ V₂ P₂ _inst_1 _inst_2 _inst_3 _inst_4 _inst_5 _inst_6 _inst_7 f (infᵢ.{u1, u6} (AffineSubspace.{u5, u2, u1} k V₂ P₂ _inst_1 _inst_5 _inst_6 _inst_7) (ConditionallyCompleteLattice.toInfSet.{u1} (AffineSubspace.{u5, u2, u1} k V₂ P₂ _inst_1 _inst_5 _inst_6 _inst_7) (CompleteLattice.toConditionallyCompleteLattice.{u1} (AffineSubspace.{u5, u2, u1} k V₂ P₂ _inst_1 _inst_5 _inst_6 _inst_7) (AffineSubspace.instCompleteLatticeAffineSubspace.{u5, u2, u1} k V₂ P₂ _inst_1 _inst_5 _inst_6 _inst_7))) ι s)) (infᵢ.{u3, u6} (AffineSubspace.{u5, u4, u3} k V₁ P₁ _inst_1 _inst_2 _inst_3 _inst_4) (ConditionallyCompleteLattice.toInfSet.{u3} (AffineSubspace.{u5, u4, u3} k V₁ P₁ _inst_1 _inst_2 _inst_3 _inst_4) (CompleteLattice.toConditionallyCompleteLattice.{u3} (AffineSubspace.{u5, u4, u3} k V₁ P₁ _inst_1 _inst_2 _inst_3 _inst_4) (AffineSubspace.instCompleteLatticeAffineSubspace.{u5, u4, u3} k V₁ P₁ _inst_1 _inst_2 _inst_3 _inst_4))) ι (fun (i : ι) => AffineSubspace.comap.{u5, u4, u3, u2, u1} k V₁ P₁ V₂ P₂ _inst_1 _inst_2 _inst_3 _inst_4 _inst_5 _inst_6 _inst_7 f (s i))) Case conversion may be inaccurate. Consider using '#align affine_subspace.comap_supr AffineSubspace.comap_suprₓ'. -/ theorem comap_supr {ι : Sort _} (f : P₁ →ᵃ[k] P₂) (s : ι → AffineSubspace k P₂) : (infᵢ s).comap f = ⨅ i, (s i).comap f := (gc_map_comap f).u_infᵢ #align affine_subspace.comap_supr AffineSubspace.comap_supr /- warning: affine_subspace.comap_symm -> AffineSubspace.comap_symm is a dubious translation: lean 3 declaration is forall {k : Type.{u1}} {V₁ : Type.{u2}} {P₁ : Type.{u3}} {V₂ : Type.{u4}} {P₂ : Type.{u5}} [_inst_1 : Ring.{u1} k] [_inst_2 : AddCommGroup.{u2} V₁] [_inst_3 : Module.{u1, u2} k V₁ (Ring.toSemiring.{u1} k _inst_1) (AddCommGroup.toAddCommMonoid.{u2} V₁ _inst_2)] [_inst_4 : AddTorsor.{u2, u3} V₁ P₁ (AddCommGroup.toAddGroup.{u2} V₁ _inst_2)] [_inst_5 : AddCommGroup.{u4} V₂] [_inst_6 : Module.{u1, u4} k V₂ (Ring.toSemiring.{u1} k _inst_1) (AddCommGroup.toAddCommMonoid.{u4} V₂ _inst_5)] [_inst_7 : AddTorsor.{u4, u5} V₂ P₂ (AddCommGroup.toAddGroup.{u4} V₂ _inst_5)] (e : AffineEquiv.{u1, u3, u5, u2, u4} k P₁ P₂ V₁ V₂ _inst_1 _inst_2 _inst_3 _inst_4 _inst_5 _inst_6 _inst_7) (s : AffineSubspace.{u1, u2, u3} k V₁ P₁ _inst_1 _inst_2 _inst_3 _inst_4), Eq.{succ u5} (AffineSubspace.{u1, u4, u5} k V₂ P₂ _inst_1 _inst_5 _inst_6 _inst_7) (AffineSubspace.comap.{u1, u4, u5, u2, u3} k V₂ P₂ V₁ P₁ _inst_1 _inst_5 _inst_6 _inst_7 _inst_2 _inst_3 _inst_4 ((fun (a : Sort.{max (succ u5) (succ u3) (succ u4) (succ u2)}) (b : Sort.{max (succ u4) (succ u5) (succ u2) (succ u3)}) [self : HasLiftT.{max (succ u5) (succ u3) (succ u4) (succ u2), max (succ u4) (succ u5) (succ u2) (succ u3)} a b] => self.0) (AffineEquiv.{u1, u5, u3, u4, u2} k P₂ P₁ V₂ V₁ _inst_1 _inst_5 _inst_6 _inst_7 _inst_2 _inst_3 _inst_4) (AffineMap.{u1, u4, u5, u2, u3} k V₂ P₂ V₁ P₁ _inst_1 _inst_5 _inst_6 _inst_7 _inst_2 _inst_3 _inst_4) (HasLiftT.mk.{max (succ u5) (succ u3) (succ u4) (succ u2), max (succ u4) (succ u5) (succ u2) (succ u3)} (AffineEquiv.{u1, u5, u3, u4, u2} k P₂ P₁ V₂ V₁ _inst_1 _inst_5 _inst_6 _inst_7 _inst_2 _inst_3 _inst_4) (AffineMap.{u1, u4, u5, u2, u3} k V₂ P₂ V₁ P₁ _inst_1 _inst_5 _inst_6 _inst_7 _inst_2 _inst_3 _inst_4) (CoeTCₓ.coe.{max (succ u5) (succ u3) (succ u4) (succ u2), max (succ u4) (succ u5) (succ u2) (succ u3)} (AffineEquiv.{u1, u5, u3, u4, u2} k P₂ P₁ V₂ V₁ _inst_1 _inst_5 _inst_6 _inst_7 _inst_2 _inst_3 _inst_4) (AffineMap.{u1, u4, u5, u2, u3} k V₂ P₂ V₁ P₁ _inst_1 _inst_5 _inst_6 _inst_7 _inst_2 _inst_3 _inst_4) (coeBase.{max (succ u5) (succ u3) (succ u4) (succ u2), max (succ u4) (succ u5) (succ u2) (succ u3)} (AffineEquiv.{u1, u5, u3, u4, u2} k P₂ P₁ V₂ V₁ _inst_1 _inst_5 _inst_6 _inst_7 _inst_2 _inst_3 _inst_4) (AffineMap.{u1, u4, u5, u2, u3} k V₂ P₂ V₁ P₁ _inst_1 _inst_5 _inst_6 _inst_7 _inst_2 _inst_3 _inst_4) (AffineEquiv.AffineMap.hasCoe.{u1, u5, u3, u4, u2} k P₂ P₁ V₂ V₁ _inst_1 _inst_5 _inst_6 _inst_7 _inst_2 _inst_3 _inst_4)))) (AffineEquiv.symm.{u1, u3, u5, u2, u4} k P₁ P₂ V₁ V₂ _inst_1 _inst_2 _inst_3 _inst_4 _inst_5 _inst_6 _inst_7 e)) s) (AffineSubspace.map.{u1, u2, u3, u4, u5} k V₁ P₁ V₂ P₂ _inst_1 _inst_2 _inst_3 _inst_4 _inst_5 _inst_6 _inst_7 ((fun (a : Sort.{max (succ u3) (succ u5) (succ u2) (succ u4)}) (b : Sort.{max (succ u2) (succ u3) (succ u4) (succ u5)}) [self : HasLiftT.{max (succ u3) (succ u5) (succ u2) (succ u4), max (succ u2) (succ u3) (succ u4) (succ u5)} a b] => self.0) (AffineEquiv.{u1, u3, u5, u2, u4} k P₁ P₂ V₁ V₂ _inst_1 _inst_2 _inst_3 _inst_4 _inst_5 _inst_6 _inst_7) (AffineMap.{u1, u2, u3, u4, u5} k V₁ P₁ V₂ P₂ _inst_1 _inst_2 _inst_3 _inst_4 _inst_5 _inst_6 _inst_7) (HasLiftT.mk.{max (succ u3) (succ u5) (succ u2) (succ u4), max (succ u2) (succ u3) (succ u4) (succ u5)} (AffineEquiv.{u1, u3, u5, u2, u4} k P₁ P₂ V₁ V₂ _inst_1 _inst_2 _inst_3 _inst_4 _inst_5 _inst_6 _inst_7) (AffineMap.{u1, u2, u3, u4, u5} k V₁ P₁ V₂ P₂ _inst_1 _inst_2 _inst_3 _inst_4 _inst_5 _inst_6 _inst_7) (CoeTCₓ.coe.{max (succ u3) (succ u5) (succ u2) (succ u4), max (succ u2) (succ u3) (succ u4) (succ u5)} (AffineEquiv.{u1, u3, u5, u2, u4} k P₁ P₂ V₁ V₂ _inst_1 _inst_2 _inst_3 _inst_4 _inst_5 _inst_6 _inst_7) (AffineMap.{u1, u2, u3, u4, u5} k V₁ P₁ V₂ P₂ _inst_1 _inst_2 _inst_3 _inst_4 _inst_5 _inst_6 _inst_7) (coeBase.{max (succ u3) (succ u5) (succ u2) (succ u4), max (succ u2) (succ u3) (succ u4) (succ u5)} (AffineEquiv.{u1, u3, u5, u2, u4} k P₁ P₂ V₁ V₂ _inst_1 _inst_2 _inst_3 _inst_4 _inst_5 _inst_6 _inst_7) (AffineMap.{u1, u2, u3, u4, u5} k V₁ P₁ V₂ P₂ _inst_1 _inst_2 _inst_3 _inst_4 _inst_5 _inst_6 _inst_7) (AffineEquiv.AffineMap.hasCoe.{u1, u3, u5, u2, u4} k P₁ P₂ V₁ V₂ _inst_1 _inst_2 _inst_3 _inst_4 _inst_5 _inst_6 _inst_7)))) e) s) but is expected to have type forall {k : Type.{u5}} {V₁ : Type.{u2}} {P₁ : Type.{u4}} {V₂ : Type.{u1}} {P₂ : Type.{u3}} [_inst_1 : Ring.{u5} k] [_inst_2 : AddCommGroup.{u2} V₁] [_inst_3 : Module.{u5, u2} k V₁ (Ring.toSemiring.{u5} k _inst_1) (AddCommGroup.toAddCommMonoid.{u2} V₁ _inst_2)] [_inst_4 : AddTorsor.{u2, u4} V₁ P₁ (AddCommGroup.toAddGroup.{u2} V₁ _inst_2)] [_inst_5 : AddCommGroup.{u1} V₂] [_inst_6 : Module.{u5, u1} k V₂ (Ring.toSemiring.{u5} k _inst_1) (AddCommGroup.toAddCommMonoid.{u1} V₂ _inst_5)] [_inst_7 : AddTorsor.{u1, u3} V₂ P₂ (AddCommGroup.toAddGroup.{u1} V₂ _inst_5)] (e : AffineEquiv.{u5, u4, u3, u2, u1} k P₁ P₂ V₁ V₂ _inst_1 _inst_2 _inst_3 _inst_4 _inst_5 _inst_6 _inst_7) (s : AffineSubspace.{u5, u2, u4} k V₁ P₁ _inst_1 _inst_2 _inst_3 _inst_4), Eq.{succ u3} (AffineSubspace.{u5, u1, u3} k V₂ P₂ _inst_1 _inst_5 _inst_6 _inst_7) (AffineSubspace.comap.{u5, u1, u3, u2, u4} k V₂ P₂ V₁ P₁ _inst_1 _inst_5 _inst_6 _inst_7 _inst_2 _inst_3 _inst_4 (AffineEquiv.toAffineMap.{u5, u3, u4, u1, u2} k P₂ P₁ V₂ V₁ _inst_1 _inst_5 _inst_6 _inst_7 _inst_2 _inst_3 _inst_4 (AffineEquiv.symm.{u5, u4, u3, u2, u1} k P₁ P₂ V₁ V₂ _inst_1 _inst_2 _inst_3 _inst_4 _inst_5 _inst_6 _inst_7 e)) s) (AffineSubspace.map.{u5, u2, u4, u1, u3} k V₁ P₁ V₂ P₂ _inst_1 _inst_2 _inst_3 _inst_4 _inst_5 _inst_6 _inst_7 (AffineEquiv.toAffineMap.{u5, u4, u3, u2, u1} k P₁ P₂ V₁ V₂ _inst_1 _inst_2 _inst_3 _inst_4 _inst_5 _inst_6 _inst_7 e) s) Case conversion may be inaccurate. Consider using '#align affine_subspace.comap_symm AffineSubspace.comap_symmₓ'. -/ @[simp] theorem comap_symm (e : P₁ ≃ᵃ[k] P₂) (s : AffineSubspace k P₁) : s.comap (e.symm : P₂ →ᵃ[k] P₁) = s.map e := coe_injective <| e.preimage_symm _ #align affine_subspace.comap_symm AffineSubspace.comap_symm /- warning: affine_subspace.map_symm -> AffineSubspace.map_symm is a dubious translation: lean 3 declaration is forall {k : Type.{u1}} {V₁ : Type.{u2}} {P₁ : Type.{u3}} {V₂ : Type.{u4}} {P₂ : Type.{u5}} [_inst_1 : Ring.{u1} k] [_inst_2 : AddCommGroup.{u2} V₁] [_inst_3 : Module.{u1, u2} k V₁ (Ring.toSemiring.{u1} k _inst_1) (AddCommGroup.toAddCommMonoid.{u2} V₁ _inst_2)] [_inst_4 : AddTorsor.{u2, u3} V₁ P₁ (AddCommGroup.toAddGroup.{u2} V₁ _inst_2)] [_inst_5 : AddCommGroup.{u4} V₂] [_inst_6 : Module.{u1, u4} k V₂ (Ring.toSemiring.{u1} k _inst_1) (AddCommGroup.toAddCommMonoid.{u4} V₂ _inst_5)] [_inst_7 : AddTorsor.{u4, u5} V₂ P₂ (AddCommGroup.toAddGroup.{u4} V₂ _inst_5)] (e : AffineEquiv.{u1, u3, u5, u2, u4} k P₁ P₂ V₁ V₂ _inst_1 _inst_2 _inst_3 _inst_4 _inst_5 _inst_6 _inst_7) (s : AffineSubspace.{u1, u4, u5} k V₂ P₂ _inst_1 _inst_5 _inst_6 _inst_7), Eq.{succ u3} (AffineSubspace.{u1, u2, u3} k V₁ P₁ _inst_1 _inst_2 _inst_3 _inst_4) (AffineSubspace.map.{u1, u4, u5, u2, u3} k V₂ P₂ V₁ P₁ _inst_1 _inst_5 _inst_6 _inst_7 _inst_2 _inst_3 _inst_4 ((fun (a : Sort.{max (succ u5) (succ u3) (succ u4) (succ u2)}) (b : Sort.{max (succ u4) (succ u5) (succ u2) (succ u3)}) [self : HasLiftT.{max (succ u5) (succ u3) (succ u4) (succ u2), max (succ u4) (succ u5) (succ u2) (succ u3)} a b] => self.0) (AffineEquiv.{u1, u5, u3, u4, u2} k P₂ P₁ V₂ V₁ _inst_1 _inst_5 _inst_6 _inst_7 _inst_2 _inst_3 _inst_4) (AffineMap.{u1, u4, u5, u2, u3} k V₂ P₂ V₁ P₁ _inst_1 _inst_5 _inst_6 _inst_7 _inst_2 _inst_3 _inst_4) (HasLiftT.mk.{max (succ u5) (succ u3) (succ u4) (succ u2), max (succ u4) (succ u5) (succ u2) (succ u3)} (AffineEquiv.{u1, u5, u3, u4, u2} k P₂ P₁ V₂ V₁ _inst_1 _inst_5 _inst_6 _inst_7 _inst_2 _inst_3 _inst_4) (AffineMap.{u1, u4, u5, u2, u3} k V₂ P₂ V₁ P₁ _inst_1 _inst_5 _inst_6 _inst_7 _inst_2 _inst_3 _inst_4) (CoeTCₓ.coe.{max (succ u5) (succ u3) (succ u4) (succ u2), max (succ u4) (succ u5) (succ u2) (succ u3)} (AffineEquiv.{u1, u5, u3, u4, u2} k P₂ P₁ V₂ V₁ _inst_1 _inst_5 _inst_6 _inst_7 _inst_2 _inst_3 _inst_4) (AffineMap.{u1, u4, u5, u2, u3} k V₂ P₂ V₁ P₁ _inst_1 _inst_5 _inst_6 _inst_7 _inst_2 _inst_3 _inst_4) (coeBase.{max (succ u5) (succ u3) (succ u4) (succ u2), max (succ u4) (succ u5) (succ u2) (succ u3)} (AffineEquiv.{u1, u5, u3, u4, u2} k P₂ P₁ V₂ V₁ _inst_1 _inst_5 _inst_6 _inst_7 _inst_2 _inst_3 _inst_4) (AffineMap.{u1, u4, u5, u2, u3} k V₂ P₂ V₁ P₁ _inst_1 _inst_5 _inst_6 _inst_7 _inst_2 _inst_3 _inst_4) (AffineEquiv.AffineMap.hasCoe.{u1, u5, u3, u4, u2} k P₂ P₁ V₂ V₁ _inst_1 _inst_5 _inst_6 _inst_7 _inst_2 _inst_3 _inst_4)))) (AffineEquiv.symm.{u1, u3, u5, u2, u4} k P₁ P₂ V₁ V₂ _inst_1 _inst_2 _inst_3 _inst_4 _inst_5 _inst_6 _inst_7 e)) s) (AffineSubspace.comap.{u1, u2, u3, u4, u5} k V₁ P₁ V₂ P₂ _inst_1 _inst_2 _inst_3 _inst_4 _inst_5 _inst_6 _inst_7 ((fun (a : Sort.{max (succ u3) (succ u5) (succ u2) (succ u4)}) (b : Sort.{max (succ u2) (succ u3) (succ u4) (succ u5)}) [self : HasLiftT.{max (succ u3) (succ u5) (succ u2) (succ u4), max (succ u2) (succ u3) (succ u4) (succ u5)} a b] => self.0) (AffineEquiv.{u1, u3, u5, u2, u4} k P₁ P₂ V₁ V₂ _inst_1 _inst_2 _inst_3 _inst_4 _inst_5 _inst_6 _inst_7) (AffineMap.{u1, u2, u3, u4, u5} k V₁ P₁ V₂ P₂ _inst_1 _inst_2 _inst_3 _inst_4 _inst_5 _inst_6 _inst_7) (HasLiftT.mk.{max (succ u3) (succ u5) (succ u2) (succ u4), max (succ u2) (succ u3) (succ u4) (succ u5)} (AffineEquiv.{u1, u3, u5, u2, u4} k P₁ P₂ V₁ V₂ _inst_1 _inst_2 _inst_3 _inst_4 _inst_5 _inst_6 _inst_7) (AffineMap.{u1, u2, u3, u4, u5} k V₁ P₁ V₂ P₂ _inst_1 _inst_2 _inst_3 _inst_4 _inst_5 _inst_6 _inst_7) (CoeTCₓ.coe.{max (succ u3) (succ u5) (succ u2) (succ u4), max (succ u2) (succ u3) (succ u4) (succ u5)} (AffineEquiv.{u1, u3, u5, u2, u4} k P₁ P₂ V₁ V₂ _inst_1 _inst_2 _inst_3 _inst_4 _inst_5 _inst_6 _inst_7) (AffineMap.{u1, u2, u3, u4, u5} k V₁ P₁ V₂ P₂ _inst_1 _inst_2 _inst_3 _inst_4 _inst_5 _inst_6 _inst_7) (coeBase.{max (succ u3) (succ u5) (succ u2) (succ u4), max (succ u2) (succ u3) (succ u4) (succ u5)} (AffineEquiv.{u1, u3, u5, u2, u4} k P₁ P₂ V₁ V₂ _inst_1 _inst_2 _inst_3 _inst_4 _inst_5 _inst_6 _inst_7) (AffineMap.{u1, u2, u3, u4, u5} k V₁ P₁ V₂ P₂ _inst_1 _inst_2 _inst_3 _inst_4 _inst_5 _inst_6 _inst_7) (AffineEquiv.AffineMap.hasCoe.{u1, u3, u5, u2, u4} k P₁ P₂ V₁ V₂ _inst_1 _inst_2 _inst_3 _inst_4 _inst_5 _inst_6 _inst_7)))) e) s) but is expected to have type forall {k : Type.{u5}} {V₁ : Type.{u2}} {P₁ : Type.{u4}} {V₂ : Type.{u1}} {P₂ : Type.{u3}} [_inst_1 : Ring.{u5} k] [_inst_2 : AddCommGroup.{u2} V₁] [_inst_3 : Module.{u5, u2} k V₁ (Ring.toSemiring.{u5} k _inst_1) (AddCommGroup.toAddCommMonoid.{u2} V₁ _inst_2)] [_inst_4 : AddTorsor.{u2, u4} V₁ P₁ (AddCommGroup.toAddGroup.{u2} V₁ _inst_2)] [_inst_5 : AddCommGroup.{u1} V₂] [_inst_6 : Module.{u5, u1} k V₂ (Ring.toSemiring.{u5} k _inst_1) (AddCommGroup.toAddCommMonoid.{u1} V₂ _inst_5)] [_inst_7 : AddTorsor.{u1, u3} V₂ P₂ (AddCommGroup.toAddGroup.{u1} V₂ _inst_5)] (e : AffineEquiv.{u5, u4, u3, u2, u1} k P₁ P₂ V₁ V₂ _inst_1 _inst_2 _inst_3 _inst_4 _inst_5 _inst_6 _inst_7) (s : AffineSubspace.{u5, u1, u3} k V₂ P₂ _inst_1 _inst_5 _inst_6 _inst_7), Eq.{succ u4} (AffineSubspace.{u5, u2, u4} k V₁ P₁ _inst_1 _inst_2 _inst_3 _inst_4) (AffineSubspace.map.{u5, u1, u3, u2, u4} k V₂ P₂ V₁ P₁ _inst_1 _inst_5 _inst_6 _inst_7 _inst_2 _inst_3 _inst_4 (AffineEquiv.toAffineMap.{u5, u3, u4, u1, u2} k P₂ P₁ V₂ V₁ _inst_1 _inst_5 _inst_6 _inst_7 _inst_2 _inst_3 _inst_4 (AffineEquiv.symm.{u5, u4, u3, u2, u1} k P₁ P₂ V₁ V₂ _inst_1 _inst_2 _inst_3 _inst_4 _inst_5 _inst_6 _inst_7 e)) s) (AffineSubspace.comap.{u5, u2, u4, u1, u3} k V₁ P₁ V₂ P₂ _inst_1 _inst_2 _inst_3 _inst_4 _inst_5 _inst_6 _inst_7 (AffineEquiv.toAffineMap.{u5, u4, u3, u2, u1} k P₁ P₂ V₁ V₂ _inst_1 _inst_2 _inst_3 _inst_4 _inst_5 _inst_6 _inst_7 e) s) Case conversion may be inaccurate. Consider using '#align affine_subspace.map_symm AffineSubspace.map_symmₓ'. -/ @[simp] theorem map_symm (e : P₁ ≃ᵃ[k] P₂) (s : AffineSubspace k P₂) : s.map (e.symm : P₂ →ᵃ[k] P₁) = s.comap e := coe_injective <| e.image_symm _ #align affine_subspace.map_symm AffineSubspace.map_symm /- warning: affine_subspace.comap_span -> AffineSubspace.comap_span is a dubious translation: lean 3 declaration is forall {k : Type.{u1}} {V₁ : Type.{u2}} {P₁ : Type.{u3}} {V₂ : Type.{u4}} {P₂ : Type.{u5}} [_inst_1 : Ring.{u1} k] [_inst_2 : AddCommGroup.{u2} V₁] [_inst_3 : Module.{u1, u2} k V₁ (Ring.toSemiring.{u1} k _inst_1) (AddCommGroup.toAddCommMonoid.{u2} V₁ _inst_2)] [_inst_4 : AddTorsor.{u2, u3} V₁ P₁ (AddCommGroup.toAddGroup.{u2} V₁ _inst_2)] [_inst_5 : AddCommGroup.{u4} V₂] [_inst_6 : Module.{u1, u4} k V₂ (Ring.toSemiring.{u1} k _inst_1) (AddCommGroup.toAddCommMonoid.{u4} V₂ _inst_5)] [_inst_7 : AddTorsor.{u4, u5} V₂ P₂ (AddCommGroup.toAddGroup.{u4} V₂ _inst_5)] (f : AffineEquiv.{u1, u3, u5, u2, u4} k P₁ P₂ V₁ V₂ _inst_1 _inst_2 _inst_3 _inst_4 _inst_5 _inst_6 _inst_7) (s : Set.{u5} P₂), Eq.{succ u3} (AffineSubspace.{u1, u2, u3} k V₁ P₁ _inst_1 _inst_2 _inst_3 _inst_4) (AffineSubspace.comap.{u1, u2, u3, u4, u5} k V₁ P₁ V₂ P₂ _inst_1 _inst_2 _inst_3 _inst_4 _inst_5 _inst_6 _inst_7 ((fun (a : Sort.{max (succ u3) (succ u5) (succ u2) (succ u4)}) (b : Sort.{max (succ u2) (succ u3) (succ u4) (succ u5)}) [self : HasLiftT.{max (succ u3) (succ u5) (succ u2) (succ u4), max (succ u2) (succ u3) (succ u4) (succ u5)} a b] => self.0) (AffineEquiv.{u1, u3, u5, u2, u4} k P₁ P₂ V₁ V₂ _inst_1 _inst_2 _inst_3 _inst_4 _inst_5 _inst_6 _inst_7) (AffineMap.{u1, u2, u3, u4, u5} k V₁ P₁ V₂ P₂ _inst_1 _inst_2 _inst_3 _inst_4 _inst_5 _inst_6 _inst_7) (HasLiftT.mk.{max (succ u3) (succ u5) (succ u2) (succ u4), max (succ u2) (succ u3) (succ u4) (succ u5)} (AffineEquiv.{u1, u3, u5, u2, u4} k P₁ P₂ V₁ V₂ _inst_1 _inst_2 _inst_3 _inst_4 _inst_5 _inst_6 _inst_7) (AffineMap.{u1, u2, u3, u4, u5} k V₁ P₁ V₂ P₂ _inst_1 _inst_2 _inst_3 _inst_4 _inst_5 _inst_6 _inst_7) (CoeTCₓ.coe.{max (succ u3) (succ u5) (succ u2) (succ u4), max (succ u2) (succ u3) (succ u4) (succ u5)} (AffineEquiv.{u1, u3, u5, u2, u4} k P₁ P₂ V₁ V₂ _inst_1 _inst_2 _inst_3 _inst_4 _inst_5 _inst_6 _inst_7) (AffineMap.{u1, u2, u3, u4, u5} k V₁ P₁ V₂ P₂ _inst_1 _inst_2 _inst_3 _inst_4 _inst_5 _inst_6 _inst_7) (coeBase.{max (succ u3) (succ u5) (succ u2) (succ u4), max (succ u2) (succ u3) (succ u4) (succ u5)} (AffineEquiv.{u1, u3, u5, u2, u4} k P₁ P₂ V₁ V₂ _inst_1 _inst_2 _inst_3 _inst_4 _inst_5 _inst_6 _inst_7) (AffineMap.{u1, u2, u3, u4, u5} k V₁ P₁ V₂ P₂ _inst_1 _inst_2 _inst_3 _inst_4 _inst_5 _inst_6 _inst_7) (AffineEquiv.AffineMap.hasCoe.{u1, u3, u5, u2, u4} k P₁ P₂ V₁ V₂ _inst_1 _inst_2 _inst_3 _inst_4 _inst_5 _inst_6 _inst_7)))) f) (affineSpan.{u1, u4, u5} k V₂ P₂ _inst_1 _inst_5 _inst_6 _inst_7 s)) (affineSpan.{u1, u2, u3} k V₁ P₁ _inst_1 _inst_2 _inst_3 _inst_4 (Set.preimage.{u3, u5} P₁ P₂ (coeFn.{max (succ u3) (succ u5) (succ u2) (succ u4), max (succ u3) (succ u5)} (AffineEquiv.{u1, u3, u5, u2, u4} k P₁ P₂ V₁ V₂ _inst_1 _inst_2 _inst_3 _inst_4 _inst_5 _inst_6 _inst_7) (fun (_x : AffineEquiv.{u1, u3, u5, u2, u4} k P₁ P₂ V₁ V₂ _inst_1 _inst_2 _inst_3 _inst_4 _inst_5 _inst_6 _inst_7) => P₁ -> P₂) (AffineEquiv.hasCoeToFun.{u1, u3, u5, u2, u4} k P₁ P₂ V₁ V₂ _inst_1 _inst_2 _inst_3 _inst_4 _inst_5 _inst_6 _inst_7) f) s)) but is expected to have type forall {k : Type.{u5}} {V₁ : Type.{u2}} {P₁ : Type.{u4}} {V₂ : Type.{u1}} {P₂ : Type.{u3}} [_inst_1 : Ring.{u5} k] [_inst_2 : AddCommGroup.{u2} V₁] [_inst_3 : Module.{u5, u2} k V₁ (Ring.toSemiring.{u5} k _inst_1) (AddCommGroup.toAddCommMonoid.{u2} V₁ _inst_2)] [_inst_4 : AddTorsor.{u2, u4} V₁ P₁ (AddCommGroup.toAddGroup.{u2} V₁ _inst_2)] [_inst_5 : AddCommGroup.{u1} V₂] [_inst_6 : Module.{u5, u1} k V₂ (Ring.toSemiring.{u5} k _inst_1) (AddCommGroup.toAddCommMonoid.{u1} V₂ _inst_5)] [_inst_7 : AddTorsor.{u1, u3} V₂ P₂ (AddCommGroup.toAddGroup.{u1} V₂ _inst_5)] (f : AffineEquiv.{u5, u4, u3, u2, u1} k P₁ P₂ V₁ V₂ _inst_1 _inst_2 _inst_3 _inst_4 _inst_5 _inst_6 _inst_7) (s : Set.{u3} P₂), Eq.{succ u4} (AffineSubspace.{u5, u2, u4} k V₁ P₁ _inst_1 _inst_2 _inst_3 _inst_4) (AffineSubspace.comap.{u5, u2, u4, u1, u3} k V₁ P₁ V₂ P₂ _inst_1 _inst_2 _inst_3 _inst_4 _inst_5 _inst_6 _inst_7 (AffineEquiv.toAffineMap.{u5, u4, u3, u2, u1} k P₁ P₂ V₁ V₂ _inst_1 _inst_2 _inst_3 _inst_4 _inst_5 _inst_6 _inst_7 f) (affineSpan.{u5, u1, u3} k V₂ P₂ _inst_1 _inst_5 _inst_6 _inst_7 s)) (affineSpan.{u5, u2, u4} k V₁ P₁ _inst_1 _inst_2 _inst_3 _inst_4 (Set.preimage.{u4, u3} P₁ P₂ (FunLike.coe.{max (max (max (succ u4) (succ u3)) (succ u2)) (succ u1), succ u4, succ u3} (AffineEquiv.{u5, u4, u3, u2, u1} k P₁ P₂ V₁ V₂ _inst_1 _inst_2 _inst_3 _inst_4 _inst_5 _inst_6 _inst_7) P₁ (fun (_x : P₁) => (fun ([email protected]._hyg.1471 : P₁) => P₂) _x) (EmbeddingLike.toFunLike.{max (max (max (succ u4) (succ u3)) (succ u2)) (succ u1), succ u4, succ u3} (AffineEquiv.{u5, u4, u3, u2, u1} k P₁ P₂ V₁ V₂ _inst_1 _inst_2 _inst_3 _inst_4 _inst_5 _inst_6 _inst_7) P₁ P₂ (EquivLike.toEmbeddingLike.{max (max (max (succ u4) (succ u3)) (succ u2)) (succ u1), succ u4, succ u3} (AffineEquiv.{u5, u4, u3, u2, u1} k P₁ P₂ V₁ V₂ _inst_1 _inst_2 _inst_3 _inst_4 _inst_5 _inst_6 _inst_7) P₁ P₂ (AffineEquiv.equivLike.{u5, u4, u3, u2, u1} k P₁ P₂ V₁ V₂ _inst_1 _inst_2 _inst_3 _inst_4 _inst_5 _inst_6 _inst_7))) f) s)) Case conversion may be inaccurate. Consider using '#align affine_subspace.comap_span AffineSubspace.comap_spanₓ'. -/ theorem comap_span (f : P₁ ≃ᵃ[k] P₂) (s : Set P₂) : (affineSpan k s).comap (f : P₁ →ᵃ[k] P₂) = affineSpan k (f ⁻¹' s) := by rw [← map_symm, map_span, AffineEquiv.coe_coe, f.image_symm] #align affine_subspace.comap_span AffineSubspace.comap_span end AffineSubspace end MapComap namespace AffineSubspace open AffineEquiv variable {k : Type _} {V : Type _} {P : Type _} [Ring k] [AddCommGroup V] [Module k V] variable [affine_space V P] include V #print AffineSubspace.Parallel /- /-- Two affine subspaces are parallel if one is related to the other by adding the same vector to all points. -/ def Parallel (s₁ s₂ : AffineSubspace k P) : Prop := ∃ v : V, s₂ = s₁.map (constVAdd k P v) #align affine_subspace.parallel AffineSubspace.Parallel -/ -- mathport name: affine_subspace.parallel scoped[Affine] infixl:50 " ∥ " => AffineSubspace.Parallel /- warning: affine_subspace.parallel.symm -> AffineSubspace.Parallel.symm is a dubious translation: lean 3 declaration is forall {k : Type.{u1}} {V : Type.{u2}} {P : Type.{u3}} [_inst_1 : Ring.{u1} k] [_inst_2 : AddCommGroup.{u2} V] [_inst_3 : Module.{u1, u2} k V (Ring.toSemiring.{u1} k _inst_1) (AddCommGroup.toAddCommMonoid.{u2} V _inst_2)] [_inst_4 : AddTorsor.{u2, u3} V P (AddCommGroup.toAddGroup.{u2} V _inst_2)] {s₁ : AffineSubspace.{u1, u2, u3} k V P _inst_1 _inst_2 _inst_3 _inst_4} {s₂ : AffineSubspace.{u1, u2, u3} k V P _inst_1 _inst_2 _inst_3 _inst_4}, (AffineSubspace.Parallel.{u1, u2, u3} k V P _inst_1 _inst_2 _inst_3 _inst_4 s₁ s₂) -> (AffineSubspace.Parallel.{u1, u2, u3} k V P _inst_1 _inst_2 _inst_3 _inst_4 s₂ s₁) but is expected to have type forall {k : Type.{u3}} {V : Type.{u2}} {P : Type.{u1}} [_inst_1 : Ring.{u3} k] [_inst_2 : AddCommGroup.{u2} V] [_inst_3 : Module.{u3, u2} k V (Ring.toSemiring.{u3} k _inst_1) (AddCommGroup.toAddCommMonoid.{u2} V _inst_2)] [_inst_4 : AddTorsor.{u2, u1} V P (AddCommGroup.toAddGroup.{u2} V _inst_2)] {s₁ : AffineSubspace.{u3, u2, u1} k V P _inst_1 _inst_2 _inst_3 _inst_4} {s₂ : AffineSubspace.{u3, u2, u1} k V P _inst_1 _inst_2 _inst_3 _inst_4}, (AffineSubspace.Parallel.{u3, u2, u1} k V P _inst_1 _inst_2 _inst_3 _inst_4 s₁ s₂) -> (AffineSubspace.Parallel.{u3, u2, u1} k V P _inst_1 _inst_2 _inst_3 _inst_4 s₂ s₁) Case conversion may be inaccurate. Consider using '#align affine_subspace.parallel.symm AffineSubspace.Parallel.symmₓ'. -/ @[symm] theorem Parallel.symm {s₁ s₂ : AffineSubspace k P} (h : s₁ ∥ s₂) : s₂ ∥ s₁ := by rcases h with ⟨v, rfl⟩ refine' ⟨-v, _⟩ rw [map_map, ← coe_trans_to_affine_map, ← const_vadd_add, neg_add_self, const_vadd_zero, coe_refl_to_affine_map, map_id] #align affine_subspace.parallel.symm AffineSubspace.Parallel.symm /- warning: affine_subspace.parallel_comm -> AffineSubspace.parallel_comm is a dubious translation: lean 3 declaration is forall {k : Type.{u1}} {V : Type.{u2}} {P : Type.{u3}} [_inst_1 : Ring.{u1} k] [_inst_2 : AddCommGroup.{u2} V] [_inst_3 : Module.{u1, u2} k V (Ring.toSemiring.{u1} k _inst_1) (AddCommGroup.toAddCommMonoid.{u2} V _inst_2)] [_inst_4 : AddTorsor.{u2, u3} V P (AddCommGroup.toAddGroup.{u2} V _inst_2)] {s₁ : AffineSubspace.{u1, u2, u3} k V P _inst_1 _inst_2 _inst_3 _inst_4} {s₂ : AffineSubspace.{u1, u2, u3} k V P _inst_1 _inst_2 _inst_3 _inst_4}, Iff (AffineSubspace.Parallel.{u1, u2, u3} k V P _inst_1 _inst_2 _inst_3 _inst_4 s₁ s₂) (AffineSubspace.Parallel.{u1, u2, u3} k V P _inst_1 _inst_2 _inst_3 _inst_4 s₂ s₁) but is expected to have type forall {k : Type.{u3}} {V : Type.{u2}} {P : Type.{u1}} [_inst_1 : Ring.{u3} k] [_inst_2 : AddCommGroup.{u2} V] [_inst_3 : Module.{u3, u2} k V (Ring.toSemiring.{u3} k _inst_1) (AddCommGroup.toAddCommMonoid.{u2} V _inst_2)] [_inst_4 : AddTorsor.{u2, u1} V P (AddCommGroup.toAddGroup.{u2} V _inst_2)] {s₁ : AffineSubspace.{u3, u2, u1} k V P _inst_1 _inst_2 _inst_3 _inst_4} {s₂ : AffineSubspace.{u3, u2, u1} k V P _inst_1 _inst_2 _inst_3 _inst_4}, Iff (AffineSubspace.Parallel.{u3, u2, u1} k V P _inst_1 _inst_2 _inst_3 _inst_4 s₁ s₂) (AffineSubspace.Parallel.{u3, u2, u1} k V P _inst_1 _inst_2 _inst_3 _inst_4 s₂ s₁) Case conversion may be inaccurate. Consider using '#align affine_subspace.parallel_comm AffineSubspace.parallel_commₓ'. -/ theorem parallel_comm {s₁ s₂ : AffineSubspace k P} : s₁ ∥ s₂ ↔ s₂ ∥ s₁ := ⟨Parallel.symm, Parallel.symm⟩ #align affine_subspace.parallel_comm AffineSubspace.parallel_comm /- warning: affine_subspace.parallel.refl -> AffineSubspace.Parallel.refl is a dubious translation: lean 3 declaration is forall {k : Type.{u1}} {V : Type.{u2}} {P : Type.{u3}} [_inst_1 : Ring.{u1} k] [_inst_2 : AddCommGroup.{u2} V] [_inst_3 : Module.{u1, u2} k V (Ring.toSemiring.{u1} k _inst_1) (AddCommGroup.toAddCommMonoid.{u2} V _inst_2)] [_inst_4 : AddTorsor.{u2, u3} V P (AddCommGroup.toAddGroup.{u2} V _inst_2)] (s : AffineSubspace.{u1, u2, u3} k V P _inst_1 _inst_2 _inst_3 _inst_4), AffineSubspace.Parallel.{u1, u2, u3} k V P _inst_1 _inst_2 _inst_3 _inst_4 s s but is expected to have type forall {k : Type.{u3}} {V : Type.{u2}} {P : Type.{u1}} [_inst_1 : Ring.{u3} k] [_inst_2 : AddCommGroup.{u2} V] [_inst_3 : Module.{u3, u2} k V (Ring.toSemiring.{u3} k _inst_1) (AddCommGroup.toAddCommMonoid.{u2} V _inst_2)] [_inst_4 : AddTorsor.{u2, u1} V P (AddCommGroup.toAddGroup.{u2} V _inst_2)] (s : AffineSubspace.{u3, u2, u1} k V P _inst_1 _inst_2 _inst_3 _inst_4), AffineSubspace.Parallel.{u3, u2, u1} k V P _inst_1 _inst_2 _inst_3 _inst_4 s s Case conversion may be inaccurate. Consider using '#align affine_subspace.parallel.refl AffineSubspace.Parallel.reflₓ'. -/ @[refl] theorem Parallel.refl (s : AffineSubspace k P) : s ∥ s := ⟨0, by simp⟩ #align affine_subspace.parallel.refl AffineSubspace.Parallel.refl /- warning: affine_subspace.parallel.trans -> AffineSubspace.Parallel.trans is a dubious translation: lean 3 declaration is forall {k : Type.{u1}} {V : Type.{u2}} {P : Type.{u3}} [_inst_1 : Ring.{u1} k] [_inst_2 : AddCommGroup.{u2} V] [_inst_3 : Module.{u1, u2} k V (Ring.toSemiring.{u1} k _inst_1) (AddCommGroup.toAddCommMonoid.{u2} V _inst_2)] [_inst_4 : AddTorsor.{u2, u3} V P (AddCommGroup.toAddGroup.{u2} V _inst_2)] {s₁ : AffineSubspace.{u1, u2, u3} k V P _inst_1 _inst_2 _inst_3 _inst_4} {s₂ : AffineSubspace.{u1, u2, u3} k V P _inst_1 _inst_2 _inst_3 _inst_4} {s₃ : AffineSubspace.{u1, u2, u3} k V P _inst_1 _inst_2 _inst_3 _inst_4}, (AffineSubspace.Parallel.{u1, u2, u3} k V P _inst_1 _inst_2 _inst_3 _inst_4 s₁ s₂) -> (AffineSubspace.Parallel.{u1, u2, u3} k V P _inst_1 _inst_2 _inst_3 _inst_4 s₂ s₃) -> (AffineSubspace.Parallel.{u1, u2, u3} k V P _inst_1 _inst_2 _inst_3 _inst_4 s₁ s₃) but is expected to have type forall {k : Type.{u3}} {V : Type.{u2}} {P : Type.{u1}} [_inst_1 : Ring.{u3} k] [_inst_2 : AddCommGroup.{u2} V] [_inst_3 : Module.{u3, u2} k V (Ring.toSemiring.{u3} k _inst_1) (AddCommGroup.toAddCommMonoid.{u2} V _inst_2)] [_inst_4 : AddTorsor.{u2, u1} V P (AddCommGroup.toAddGroup.{u2} V _inst_2)] {s₁ : AffineSubspace.{u3, u2, u1} k V P _inst_1 _inst_2 _inst_3 _inst_4} {s₂ : AffineSubspace.{u3, u2, u1} k V P _inst_1 _inst_2 _inst_3 _inst_4} {s₃ : AffineSubspace.{u3, u2, u1} k V P _inst_1 _inst_2 _inst_3 _inst_4}, (AffineSubspace.Parallel.{u3, u2, u1} k V P _inst_1 _inst_2 _inst_3 _inst_4 s₁ s₂) -> (AffineSubspace.Parallel.{u3, u2, u1} k V P _inst_1 _inst_2 _inst_3 _inst_4 s₂ s₃) -> (AffineSubspace.Parallel.{u3, u2, u1} k V P _inst_1 _inst_2 _inst_3 _inst_4 s₁ s₃) Case conversion may be inaccurate. Consider using '#align affine_subspace.parallel.trans AffineSubspace.Parallel.transₓ'. -/ @[trans] theorem Parallel.trans {s₁ s₂ s₃ : AffineSubspace k P} (h₁₂ : s₁ ∥ s₂) (h₂₃ : s₂ ∥ s₃) : s₁ ∥ s₃ := by rcases h₁₂ with ⟨v₁₂, rfl⟩ rcases h₂₃ with ⟨v₂₃, rfl⟩ refine' ⟨v₂₃ + v₁₂, _⟩ rw [map_map, ← coe_trans_to_affine_map, ← const_vadd_add] #align affine_subspace.parallel.trans AffineSubspace.Parallel.trans /- warning: affine_subspace.parallel.direction_eq -> AffineSubspace.Parallel.direction_eq is a dubious translation: lean 3 declaration is forall {k : Type.{u1}} {V : Type.{u2}} {P : Type.{u3}} [_inst_1 : Ring.{u1} k] [_inst_2 : AddCommGroup.{u2} V] [_inst_3 : Module.{u1, u2} k V (Ring.toSemiring.{u1} k _inst_1) (AddCommGroup.toAddCommMonoid.{u2} V _inst_2)] [_inst_4 : AddTorsor.{u2, u3} V P (AddCommGroup.toAddGroup.{u2} V _inst_2)] {s₁ : AffineSubspace.{u1, u2, u3} k V P _inst_1 _inst_2 _inst_3 _inst_4} {s₂ : AffineSubspace.{u1, u2, u3} k V P _inst_1 _inst_2 _inst_3 _inst_4}, (AffineSubspace.Parallel.{u1, u2, u3} k V P _inst_1 _inst_2 _inst_3 _inst_4 s₁ s₂) -> (Eq.{succ u2} (Submodule.{u1, u2} k V (Ring.toSemiring.{u1} k _inst_1) (AddCommGroup.toAddCommMonoid.{u2} V _inst_2) _inst_3) (AffineSubspace.direction.{u1, u2, u3} k V P _inst_1 _inst_2 _inst_3 _inst_4 s₁) (AffineSubspace.direction.{u1, u2, u3} k V P _inst_1 _inst_2 _inst_3 _inst_4 s₂)) but is expected to have type forall {k : Type.{u3}} {V : Type.{u2}} {P : Type.{u1}} [_inst_1 : Ring.{u3} k] [_inst_2 : AddCommGroup.{u2} V] [_inst_3 : Module.{u3, u2} k V (Ring.toSemiring.{u3} k _inst_1) (AddCommGroup.toAddCommMonoid.{u2} V _inst_2)] [_inst_4 : AddTorsor.{u2, u1} V P (AddCommGroup.toAddGroup.{u2} V _inst_2)] {s₁ : AffineSubspace.{u3, u2, u1} k V P _inst_1 _inst_2 _inst_3 _inst_4} {s₂ : AffineSubspace.{u3, u2, u1} k V P _inst_1 _inst_2 _inst_3 _inst_4}, (AffineSubspace.Parallel.{u3, u2, u1} k V P _inst_1 _inst_2 _inst_3 _inst_4 s₁ s₂) -> (Eq.{succ u2} (Submodule.{u3, u2} k V (Ring.toSemiring.{u3} k _inst_1) (AddCommGroup.toAddCommMonoid.{u2} V _inst_2) _inst_3) (AffineSubspace.direction.{u3, u2, u1} k V P _inst_1 _inst_2 _inst_3 _inst_4 s₁) (AffineSubspace.direction.{u3, u2, u1} k V P _inst_1 _inst_2 _inst_3 _inst_4 s₂)) Case conversion may be inaccurate. Consider using '#align affine_subspace.parallel.direction_eq AffineSubspace.Parallel.direction_eqₓ'. -/ theorem Parallel.direction_eq {s₁ s₂ : AffineSubspace k P} (h : s₁ ∥ s₂) : s₁.direction = s₂.direction := by rcases h with ⟨v, rfl⟩ simp #align affine_subspace.parallel.direction_eq AffineSubspace.Parallel.direction_eq /- warning: affine_subspace.parallel_bot_iff_eq_bot -> AffineSubspace.parallel_bot_iff_eq_bot is a dubious translation: lean 3 declaration is forall {k : Type.{u1}} {V : Type.{u2}} {P : Type.{u3}} [_inst_1 : Ring.{u1} k] [_inst_2 : AddCommGroup.{u2} V] [_inst_3 : Module.{u1, u2} k V (Ring.toSemiring.{u1} k _inst_1) (AddCommGroup.toAddCommMonoid.{u2} V _inst_2)] [_inst_4 : AddTorsor.{u2, u3} V P (AddCommGroup.toAddGroup.{u2} V _inst_2)] {s : AffineSubspace.{u1, u2, u3} k V P _inst_1 _inst_2 _inst_3 _inst_4}, Iff (AffineSubspace.Parallel.{u1, u2, u3} k V P _inst_1 _inst_2 _inst_3 _inst_4 s (Bot.bot.{u3} (AffineSubspace.{u1, u2, u3} k V P _inst_1 _inst_2 _inst_3 _inst_4) (CompleteLattice.toHasBot.{u3} (AffineSubspace.{u1, u2, u3} k V P _inst_1 _inst_2 _inst_3 _inst_4) (AffineSubspace.completeLattice.{u1, u2, u3} k V P _inst_1 _inst_2 _inst_3 _inst_4)))) (Eq.{succ u3} (AffineSubspace.{u1, u2, u3} k V P _inst_1 _inst_2 _inst_3 _inst_4) s (Bot.bot.{u3} (AffineSubspace.{u1, u2, u3} k V P _inst_1 _inst_2 _inst_3 _inst_4) (CompleteLattice.toHasBot.{u3} (AffineSubspace.{u1, u2, u3} k V P _inst_1 _inst_2 _inst_3 _inst_4) (AffineSubspace.completeLattice.{u1, u2, u3} k V P _inst_1 _inst_2 _inst_3 _inst_4)))) but is expected to have type forall {k : Type.{u3}} {V : Type.{u2}} {P : Type.{u1}} [_inst_1 : Ring.{u3} k] [_inst_2 : AddCommGroup.{u2} V] [_inst_3 : Module.{u3, u2} k V (Ring.toSemiring.{u3} k _inst_1) (AddCommGroup.toAddCommMonoid.{u2} V _inst_2)] [_inst_4 : AddTorsor.{u2, u1} V P (AddCommGroup.toAddGroup.{u2} V _inst_2)] {s : AffineSubspace.{u3, u2, u1} k V P _inst_1 _inst_2 _inst_3 _inst_4}, Iff (AffineSubspace.Parallel.{u3, u2, u1} k V P _inst_1 _inst_2 _inst_3 _inst_4 s (Bot.bot.{u1} (AffineSubspace.{u3, u2, u1} k V P _inst_1 _inst_2 _inst_3 _inst_4) (CompleteLattice.toBot.{u1} (AffineSubspace.{u3, u2, u1} k V P _inst_1 _inst_2 _inst_3 _inst_4) (AffineSubspace.instCompleteLatticeAffineSubspace.{u3, u2, u1} k V P _inst_1 _inst_2 _inst_3 _inst_4)))) (Eq.{succ u1} (AffineSubspace.{u3, u2, u1} k V P _inst_1 _inst_2 _inst_3 _inst_4) s (Bot.bot.{u1} (AffineSubspace.{u3, u2, u1} k V P _inst_1 _inst_2 _inst_3 _inst_4) (CompleteLattice.toBot.{u1} (AffineSubspace.{u3, u2, u1} k V P _inst_1 _inst_2 _inst_3 _inst_4) (AffineSubspace.instCompleteLatticeAffineSubspace.{u3, u2, u1} k V P _inst_1 _inst_2 _inst_3 _inst_4)))) Case conversion may be inaccurate. Consider using '#align affine_subspace.parallel_bot_iff_eq_bot AffineSubspace.parallel_bot_iff_eq_botₓ'. -/ @[simp] theorem parallel_bot_iff_eq_bot {s : AffineSubspace k P} : s ∥ ⊥ ↔ s = ⊥ := by refine' ⟨fun h => _, fun h => h ▸ parallel.refl _⟩ rcases h with ⟨v, h⟩ rwa [eq_comm, map_eq_bot_iff] at h #align affine_subspace.parallel_bot_iff_eq_bot AffineSubspace.parallel_bot_iff_eq_bot /- warning: affine_subspace.bot_parallel_iff_eq_bot -> AffineSubspace.bot_parallel_iff_eq_bot is a dubious translation: lean 3 declaration is forall {k : Type.{u1}} {V : Type.{u2}} {P : Type.{u3}} [_inst_1 : Ring.{u1} k] [_inst_2 : AddCommGroup.{u2} V] [_inst_3 : Module.{u1, u2} k V (Ring.toSemiring.{u1} k _inst_1) (AddCommGroup.toAddCommMonoid.{u2} V _inst_2)] [_inst_4 : AddTorsor.{u2, u3} V P (AddCommGroup.toAddGroup.{u2} V _inst_2)] {s : AffineSubspace.{u1, u2, u3} k V P _inst_1 _inst_2 _inst_3 _inst_4}, Iff (AffineSubspace.Parallel.{u1, u2, u3} k V P _inst_1 _inst_2 _inst_3 _inst_4 (Bot.bot.{u3} (AffineSubspace.{u1, u2, u3} k V P _inst_1 _inst_2 _inst_3 _inst_4) (CompleteLattice.toHasBot.{u3} (AffineSubspace.{u1, u2, u3} k V P _inst_1 _inst_2 _inst_3 _inst_4) (AffineSubspace.completeLattice.{u1, u2, u3} k V P _inst_1 _inst_2 _inst_3 _inst_4))) s) (Eq.{succ u3} (AffineSubspace.{u1, u2, u3} k V P _inst_1 _inst_2 _inst_3 _inst_4) s (Bot.bot.{u3} (AffineSubspace.{u1, u2, u3} k V P _inst_1 _inst_2 _inst_3 _inst_4) (CompleteLattice.toHasBot.{u3} (AffineSubspace.{u1, u2, u3} k V P _inst_1 _inst_2 _inst_3 _inst_4) (AffineSubspace.completeLattice.{u1, u2, u3} k V P _inst_1 _inst_2 _inst_3 _inst_4)))) but is expected to have type forall {k : Type.{u3}} {V : Type.{u2}} {P : Type.{u1}} [_inst_1 : Ring.{u3} k] [_inst_2 : AddCommGroup.{u2} V] [_inst_3 : Module.{u3, u2} k V (Ring.toSemiring.{u3} k _inst_1) (AddCommGroup.toAddCommMonoid.{u2} V _inst_2)] [_inst_4 : AddTorsor.{u2, u1} V P (AddCommGroup.toAddGroup.{u2} V _inst_2)] {s : AffineSubspace.{u3, u2, u1} k V P _inst_1 _inst_2 _inst_3 _inst_4}, Iff (AffineSubspace.Parallel.{u3, u2, u1} k V P _inst_1 _inst_2 _inst_3 _inst_4 (Bot.bot.{u1} (AffineSubspace.{u3, u2, u1} k V P _inst_1 _inst_2 _inst_3 _inst_4) (CompleteLattice.toBot.{u1} (AffineSubspace.{u3, u2, u1} k V P _inst_1 _inst_2 _inst_3 _inst_4) (AffineSubspace.instCompleteLatticeAffineSubspace.{u3, u2, u1} k V P _inst_1 _inst_2 _inst_3 _inst_4))) s) (Eq.{succ u1} (AffineSubspace.{u3, u2, u1} k V P _inst_1 _inst_2 _inst_3 _inst_4) s (Bot.bot.{u1} (AffineSubspace.{u3, u2, u1} k V P _inst_1 _inst_2 _inst_3 _inst_4) (CompleteLattice.toBot.{u1} (AffineSubspace.{u3, u2, u1} k V P _inst_1 _inst_2 _inst_3 _inst_4) (AffineSubspace.instCompleteLatticeAffineSubspace.{u3, u2, u1} k V P _inst_1 _inst_2 _inst_3 _inst_4)))) Case conversion may be inaccurate. Consider using '#align affine_subspace.bot_parallel_iff_eq_bot AffineSubspace.bot_parallel_iff_eq_botₓ'. -/ @[simp] theorem bot_parallel_iff_eq_bot {s : AffineSubspace k P} : ⊥ ∥ s ↔ s = ⊥ := by rw [parallel_comm, parallel_bot_iff_eq_bot] #align affine_subspace.bot_parallel_iff_eq_bot AffineSubspace.bot_parallel_iff_eq_bot /- warning: affine_subspace.parallel_iff_direction_eq_and_eq_bot_iff_eq_bot -> AffineSubspace.parallel_iff_direction_eq_and_eq_bot_iff_eq_bot is a dubious translation: lean 3 declaration is forall {k : Type.{u1}} {V : Type.{u2}} {P : Type.{u3}} [_inst_1 : Ring.{u1} k] [_inst_2 : AddCommGroup.{u2} V] [_inst_3 : Module.{u1, u2} k V (Ring.toSemiring.{u1} k _inst_1) (AddCommGroup.toAddCommMonoid.{u2} V _inst_2)] [_inst_4 : AddTorsor.{u2, u3} V P (AddCommGroup.toAddGroup.{u2} V _inst_2)] {s₁ : AffineSubspace.{u1, u2, u3} k V P _inst_1 _inst_2 _inst_3 _inst_4} {s₂ : AffineSubspace.{u1, u2, u3} k V P _inst_1 _inst_2 _inst_3 _inst_4}, Iff (AffineSubspace.Parallel.{u1, u2, u3} k V P _inst_1 _inst_2 _inst_3 _inst_4 s₁ s₂) (And (Eq.{succ u2} (Submodule.{u1, u2} k V (Ring.toSemiring.{u1} k _inst_1) (AddCommGroup.toAddCommMonoid.{u2} V _inst_2) _inst_3) (AffineSubspace.direction.{u1, u2, u3} k V P _inst_1 _inst_2 _inst_3 _inst_4 s₁) (AffineSubspace.direction.{u1, u2, u3} k V P _inst_1 _inst_2 _inst_3 _inst_4 s₂)) (Iff (Eq.{succ u3} (AffineSubspace.{u1, u2, u3} k V P _inst_1 _inst_2 _inst_3 _inst_4) s₁ (Bot.bot.{u3} (AffineSubspace.{u1, u2, u3} k V P _inst_1 _inst_2 _inst_3 _inst_4) (CompleteLattice.toHasBot.{u3} (AffineSubspace.{u1, u2, u3} k V P _inst_1 _inst_2 _inst_3 _inst_4) (AffineSubspace.completeLattice.{u1, u2, u3} k V P _inst_1 _inst_2 _inst_3 _inst_4)))) (Eq.{succ u3} (AffineSubspace.{u1, u2, u3} k V P _inst_1 _inst_2 _inst_3 _inst_4) s₂ (Bot.bot.{u3} (AffineSubspace.{u1, u2, u3} k V P _inst_1 _inst_2 _inst_3 _inst_4) (CompleteLattice.toHasBot.{u3} (AffineSubspace.{u1, u2, u3} k V P _inst_1 _inst_2 _inst_3 _inst_4) (AffineSubspace.completeLattice.{u1, u2, u3} k V P _inst_1 _inst_2 _inst_3 _inst_4)))))) but is expected to have type forall {k : Type.{u3}} {V : Type.{u2}} {P : Type.{u1}} [_inst_1 : Ring.{u3} k] [_inst_2 : AddCommGroup.{u2} V] [_inst_3 : Module.{u3, u2} k V (Ring.toSemiring.{u3} k _inst_1) (AddCommGroup.toAddCommMonoid.{u2} V _inst_2)] [_inst_4 : AddTorsor.{u2, u1} V P (AddCommGroup.toAddGroup.{u2} V _inst_2)] {s₁ : AffineSubspace.{u3, u2, u1} k V P _inst_1 _inst_2 _inst_3 _inst_4} {s₂ : AffineSubspace.{u3, u2, u1} k V P _inst_1 _inst_2 _inst_3 _inst_4}, Iff (AffineSubspace.Parallel.{u3, u2, u1} k V P _inst_1 _inst_2 _inst_3 _inst_4 s₁ s₂) (And (Eq.{succ u2} (Submodule.{u3, u2} k V (Ring.toSemiring.{u3} k _inst_1) (AddCommGroup.toAddCommMonoid.{u2} V _inst_2) _inst_3) (AffineSubspace.direction.{u3, u2, u1} k V P _inst_1 _inst_2 _inst_3 _inst_4 s₁) (AffineSubspace.direction.{u3, u2, u1} k V P _inst_1 _inst_2 _inst_3 _inst_4 s₂)) (Iff (Eq.{succ u1} (AffineSubspace.{u3, u2, u1} k V P _inst_1 _inst_2 _inst_3 _inst_4) s₁ (Bot.bot.{u1} (AffineSubspace.{u3, u2, u1} k V P _inst_1 _inst_2 _inst_3 _inst_4) (CompleteLattice.toBot.{u1} (AffineSubspace.{u3, u2, u1} k V P _inst_1 _inst_2 _inst_3 _inst_4) (AffineSubspace.instCompleteLatticeAffineSubspace.{u3, u2, u1} k V P _inst_1 _inst_2 _inst_3 _inst_4)))) (Eq.{succ u1} (AffineSubspace.{u3, u2, u1} k V P _inst_1 _inst_2 _inst_3 _inst_4) s₂ (Bot.bot.{u1} (AffineSubspace.{u3, u2, u1} k V P _inst_1 _inst_2 _inst_3 _inst_4) (CompleteLattice.toBot.{u1} (AffineSubspace.{u3, u2, u1} k V P _inst_1 _inst_2 _inst_3 _inst_4) (AffineSubspace.instCompleteLatticeAffineSubspace.{u3, u2, u1} k V P _inst_1 _inst_2 _inst_3 _inst_4)))))) Case conversion may be inaccurate. Consider using '#align affine_subspace.parallel_iff_direction_eq_and_eq_bot_iff_eq_bot AffineSubspace.parallel_iff_direction_eq_and_eq_bot_iff_eq_botₓ'. -/ theorem parallel_iff_direction_eq_and_eq_bot_iff_eq_bot {s₁ s₂ : AffineSubspace k P} : s₁ ∥ s₂ ↔ s₁.direction = s₂.direction ∧ (s₁ = ⊥ ↔ s₂ = ⊥) := by refine' ⟨fun h => ⟨h.direction_eq, _, _⟩, fun h => _⟩ · rintro rfl exact bot_parallel_iff_eq_bot.1 h · rintro rfl exact parallel_bot_iff_eq_bot.1 h · rcases h with ⟨hd, hb⟩ by_cases hs₁ : s₁ = ⊥ · rw [hs₁, bot_parallel_iff_eq_bot] exact hb.1 hs₁ · have hs₂ : s₂ ≠ ⊥ := hb.not.1 hs₁ rcases(nonempty_iff_ne_bot s₁).2 hs₁ with ⟨p₁, hp₁⟩ rcases(nonempty_iff_ne_bot s₂).2 hs₂ with ⟨p₂, hp₂⟩ refine' ⟨p₂ -ᵥ p₁, (eq_iff_direction_eq_of_mem hp₂ _).2 _⟩ · rw [mem_map] refine' ⟨p₁, hp₁, _⟩ simp · simpa using hd.symm #align affine_subspace.parallel_iff_direction_eq_and_eq_bot_iff_eq_bot AffineSubspace.parallel_iff_direction_eq_and_eq_bot_iff_eq_bot /- warning: affine_subspace.parallel.vector_span_eq -> AffineSubspace.Parallel.vectorSpan_eq is a dubious translation: lean 3 declaration is forall {k : Type.{u1}} {V : Type.{u2}} {P : Type.{u3}} [_inst_1 : Ring.{u1} k] [_inst_2 : AddCommGroup.{u2} V] [_inst_3 : Module.{u1, u2} k V (Ring.toSemiring.{u1} k _inst_1) (AddCommGroup.toAddCommMonoid.{u2} V _inst_2)] [_inst_4 : AddTorsor.{u2, u3} V P (AddCommGroup.toAddGroup.{u2} V _inst_2)] {s₁ : Set.{u3} P} {s₂ : Set.{u3} P}, (AffineSubspace.Parallel.{u1, u2, u3} k V P _inst_1 _inst_2 _inst_3 _inst_4 (affineSpan.{u1, u2, u3} k V P _inst_1 _inst_2 _inst_3 _inst_4 s₁) (affineSpan.{u1, u2, u3} k V P _inst_1 _inst_2 _inst_3 _inst_4 s₂)) -> (Eq.{succ u2} (Submodule.{u1, u2} k V (Ring.toSemiring.{u1} k _inst_1) (AddCommGroup.toAddCommMonoid.{u2} V _inst_2) _inst_3) (vectorSpan.{u1, u2, u3} k V P _inst_1 _inst_2 _inst_3 _inst_4 s₁) (vectorSpan.{u1, u2, u3} k V P _inst_1 _inst_2 _inst_3 _inst_4 s₂)) but is expected to have type forall {k : Type.{u2}} {V : Type.{u1}} {P : Type.{u3}} [_inst_1 : Ring.{u2} k] [_inst_2 : AddCommGroup.{u1} V] [_inst_3 : Module.{u2, u1} k V (Ring.toSemiring.{u2} k _inst_1) (AddCommGroup.toAddCommMonoid.{u1} V _inst_2)] [_inst_4 : AddTorsor.{u1, u3} V P (AddCommGroup.toAddGroup.{u1} V _inst_2)] {s₁ : Set.{u3} P} {s₂ : Set.{u3} P}, (AffineSubspace.Parallel.{u2, u1, u3} k V P _inst_1 _inst_2 _inst_3 _inst_4 (affineSpan.{u2, u1, u3} k V P _inst_1 _inst_2 _inst_3 _inst_4 s₁) (affineSpan.{u2, u1, u3} k V P _inst_1 _inst_2 _inst_3 _inst_4 s₂)) -> (Eq.{succ u1} (Submodule.{u2, u1} k V (Ring.toSemiring.{u2} k _inst_1) (AddCommGroup.toAddCommMonoid.{u1} V _inst_2) _inst_3) (vectorSpan.{u2, u1, u3} k V P _inst_1 _inst_2 _inst_3 _inst_4 s₁) (vectorSpan.{u2, u1, u3} k V P _inst_1 _inst_2 _inst_3 _inst_4 s₂)) Case conversion may be inaccurate. Consider using '#align affine_subspace.parallel.vector_span_eq AffineSubspace.Parallel.vectorSpan_eqₓ'. -/ theorem Parallel.vectorSpan_eq {s₁ s₂ : Set P} (h : affineSpan k s₁ ∥ affineSpan k s₂) : vectorSpan k s₁ = vectorSpan k s₂ := by simp_rw [← direction_affineSpan] exact h.direction_eq #align affine_subspace.parallel.vector_span_eq AffineSubspace.Parallel.vectorSpan_eq /- warning: affine_subspace.affine_span_parallel_iff_vector_span_eq_and_eq_empty_iff_eq_empty -> AffineSubspace.affineSpan_parallel_iff_vectorSpan_eq_and_eq_empty_iff_eq_empty is a dubious translation: lean 3 declaration is forall {k : Type.{u1}} {V : Type.{u2}} {P : Type.{u3}} [_inst_1 : Ring.{u1} k] [_inst_2 : AddCommGroup.{u2} V] [_inst_3 : Module.{u1, u2} k V (Ring.toSemiring.{u1} k _inst_1) (AddCommGroup.toAddCommMonoid.{u2} V _inst_2)] [_inst_4 : AddTorsor.{u2, u3} V P (AddCommGroup.toAddGroup.{u2} V _inst_2)] {s₁ : Set.{u3} P} {s₂ : Set.{u3} P}, Iff (AffineSubspace.Parallel.{u1, u2, u3} k V P _inst_1 _inst_2 _inst_3 _inst_4 (affineSpan.{u1, u2, u3} k V P _inst_1 _inst_2 _inst_3 _inst_4 s₁) (affineSpan.{u1, u2, u3} k V P _inst_1 _inst_2 _inst_3 _inst_4 s₂)) (And (Eq.{succ u2} (Submodule.{u1, u2} k V (Ring.toSemiring.{u1} k _inst_1) (AddCommGroup.toAddCommMonoid.{u2} V _inst_2) _inst_3) (vectorSpan.{u1, u2, u3} k V P _inst_1 _inst_2 _inst_3 _inst_4 s₁) (vectorSpan.{u1, u2, u3} k V P _inst_1 _inst_2 _inst_3 _inst_4 s₂)) (Iff (Eq.{succ u3} (Set.{u3} P) s₁ (EmptyCollection.emptyCollection.{u3} (Set.{u3} P) (Set.hasEmptyc.{u3} P))) (Eq.{succ u3} (Set.{u3} P) s₂ (EmptyCollection.emptyCollection.{u3} (Set.{u3} P) (Set.hasEmptyc.{u3} P))))) but is expected to have type forall {k : Type.{u2}} {V : Type.{u1}} {P : Type.{u3}} [_inst_1 : Ring.{u2} k] [_inst_2 : AddCommGroup.{u1} V] [_inst_3 : Module.{u2, u1} k V (Ring.toSemiring.{u2} k _inst_1) (AddCommGroup.toAddCommMonoid.{u1} V _inst_2)] [_inst_4 : AddTorsor.{u1, u3} V P (AddCommGroup.toAddGroup.{u1} V _inst_2)] {s₁ : Set.{u3} P} {s₂ : Set.{u3} P}, Iff (AffineSubspace.Parallel.{u2, u1, u3} k V P _inst_1 _inst_2 _inst_3 _inst_4 (affineSpan.{u2, u1, u3} k V P _inst_1 _inst_2 _inst_3 _inst_4 s₁) (affineSpan.{u2, u1, u3} k V P _inst_1 _inst_2 _inst_3 _inst_4 s₂)) (And (Eq.{succ u1} (Submodule.{u2, u1} k V (Ring.toSemiring.{u2} k _inst_1) (AddCommGroup.toAddCommMonoid.{u1} V _inst_2) _inst_3) (vectorSpan.{u2, u1, u3} k V P _inst_1 _inst_2 _inst_3 _inst_4 s₁) (vectorSpan.{u2, u1, u3} k V P _inst_1 _inst_2 _inst_3 _inst_4 s₂)) (Iff (Eq.{succ u3} (Set.{u3} P) s₁ (EmptyCollection.emptyCollection.{u3} (Set.{u3} P) (Set.instEmptyCollectionSet.{u3} P))) (Eq.{succ u3} (Set.{u3} P) s₂ (EmptyCollection.emptyCollection.{u3} (Set.{u3} P) (Set.instEmptyCollectionSet.{u3} P))))) Case conversion may be inaccurate. Consider using '#align affine_subspace.affine_span_parallel_iff_vector_span_eq_and_eq_empty_iff_eq_empty AffineSubspace.affineSpan_parallel_iff_vectorSpan_eq_and_eq_empty_iff_eq_emptyₓ'. -/ theorem affineSpan_parallel_iff_vectorSpan_eq_and_eq_empty_iff_eq_empty {s₁ s₂ : Set P} : affineSpan k s₁ ∥ affineSpan k s₂ ↔ vectorSpan k s₁ = vectorSpan k s₂ ∧ (s₁ = ∅ ↔ s₂ = ∅) := by simp_rw [← direction_affineSpan, ← affineSpan_eq_bot k] exact parallel_iff_direction_eq_and_eq_bot_iff_eq_bot #align affine_subspace.affine_span_parallel_iff_vector_span_eq_and_eq_empty_iff_eq_empty AffineSubspace.affineSpan_parallel_iff_vectorSpan_eq_and_eq_empty_iff_eq_empty /- warning: affine_subspace.affine_span_pair_parallel_iff_vector_span_eq -> AffineSubspace.affineSpan_pair_parallel_iff_vectorSpan_eq is a dubious translation: lean 3 declaration is forall {k : Type.{u1}} {V : Type.{u2}} {P : Type.{u3}} [_inst_1 : Ring.{u1} k] [_inst_2 : AddCommGroup.{u2} V] [_inst_3 : Module.{u1, u2} k V (Ring.toSemiring.{u1} k _inst_1) (AddCommGroup.toAddCommMonoid.{u2} V _inst_2)] [_inst_4 : AddTorsor.{u2, u3} V P (AddCommGroup.toAddGroup.{u2} V _inst_2)] {p₁ : P} {p₂ : P} {p₃ : P} {p₄ : P}, Iff (AffineSubspace.Parallel.{u1, u2, u3} k V P _inst_1 _inst_2 _inst_3 _inst_4 (affineSpan.{u1, u2, u3} k V P _inst_1 _inst_2 _inst_3 _inst_4 (Insert.insert.{u3, u3} P (Set.{u3} P) (Set.hasInsert.{u3} P) p₁ (Singleton.singleton.{u3, u3} P (Set.{u3} P) (Set.hasSingleton.{u3} P) p₂))) (affineSpan.{u1, u2, u3} k V P _inst_1 _inst_2 _inst_3 _inst_4 (Insert.insert.{u3, u3} P (Set.{u3} P) (Set.hasInsert.{u3} P) p₃ (Singleton.singleton.{u3, u3} P (Set.{u3} P) (Set.hasSingleton.{u3} P) p₄)))) (Eq.{succ u2} (Submodule.{u1, u2} k V (Ring.toSemiring.{u1} k _inst_1) (AddCommGroup.toAddCommMonoid.{u2} V _inst_2) _inst_3) (vectorSpan.{u1, u2, u3} k V P _inst_1 _inst_2 _inst_3 _inst_4 (Insert.insert.{u3, u3} P (Set.{u3} P) (Set.hasInsert.{u3} P) p₁ (Singleton.singleton.{u3, u3} P (Set.{u3} P) (Set.hasSingleton.{u3} P) p₂))) (vectorSpan.{u1, u2, u3} k V P _inst_1 _inst_2 _inst_3 _inst_4 (Insert.insert.{u3, u3} P (Set.{u3} P) (Set.hasInsert.{u3} P) p₃ (Singleton.singleton.{u3, u3} P (Set.{u3} P) (Set.hasSingleton.{u3} P) p₄)))) but is expected to have type forall {k : Type.{u3}} {V : Type.{u2}} {P : Type.{u1}} [_inst_1 : Ring.{u3} k] [_inst_2 : AddCommGroup.{u2} V] [_inst_3 : Module.{u3, u2} k V (Ring.toSemiring.{u3} k _inst_1) (AddCommGroup.toAddCommMonoid.{u2} V _inst_2)] [_inst_4 : AddTorsor.{u2, u1} V P (AddCommGroup.toAddGroup.{u2} V _inst_2)] {p₁ : P} {p₂ : P} {p₃ : P} {p₄ : P}, Iff (AffineSubspace.Parallel.{u3, u2, u1} k V P _inst_1 _inst_2 _inst_3 _inst_4 (affineSpan.{u3, u2, u1} k V P _inst_1 _inst_2 _inst_3 _inst_4 (Insert.insert.{u1, u1} P (Set.{u1} P) (Set.instInsertSet.{u1} P) p₁ (Singleton.singleton.{u1, u1} P (Set.{u1} P) (Set.instSingletonSet.{u1} P) p₂))) (affineSpan.{u3, u2, u1} k V P _inst_1 _inst_2 _inst_3 _inst_4 (Insert.insert.{u1, u1} P (Set.{u1} P) (Set.instInsertSet.{u1} P) p₃ (Singleton.singleton.{u1, u1} P (Set.{u1} P) (Set.instSingletonSet.{u1} P) p₄)))) (Eq.{succ u2} (Submodule.{u3, u2} k V (Ring.toSemiring.{u3} k _inst_1) (AddCommGroup.toAddCommMonoid.{u2} V _inst_2) _inst_3) (vectorSpan.{u3, u2, u1} k V P _inst_1 _inst_2 _inst_3 _inst_4 (Insert.insert.{u1, u1} P (Set.{u1} P) (Set.instInsertSet.{u1} P) p₁ (Singleton.singleton.{u1, u1} P (Set.{u1} P) (Set.instSingletonSet.{u1} P) p₂))) (vectorSpan.{u3, u2, u1} k V P _inst_1 _inst_2 _inst_3 _inst_4 (Insert.insert.{u1, u1} P (Set.{u1} P) (Set.instInsertSet.{u1} P) p₃ (Singleton.singleton.{u1, u1} P (Set.{u1} P) (Set.instSingletonSet.{u1} P) p₄)))) Case conversion may be inaccurate. Consider using '#align affine_subspace.affine_span_pair_parallel_iff_vector_span_eq AffineSubspace.affineSpan_pair_parallel_iff_vectorSpan_eqₓ'. -/ theorem affineSpan_pair_parallel_iff_vectorSpan_eq {p₁ p₂ p₃ p₄ : P} : line[k, p₁, p₂] ∥ line[k, p₃, p₄] ↔ vectorSpan k ({p₁, p₂} : Set P) = vectorSpan k ({p₃, p₄} : Set P) := by simp [affine_span_parallel_iff_vector_span_eq_and_eq_empty_iff_eq_empty, ← not_nonempty_iff_eq_empty] #align affine_subspace.affine_span_pair_parallel_iff_vector_span_eq AffineSubspace.affineSpan_pair_parallel_iff_vectorSpan_eq end AffineSubspace
{-# OPTIONS --without-K #-} open import HoTT open import cohomology.CofiberSequence open import cohomology.FunctionOver module cohomology.MayerVietoris {i} where {- Mayer-Vietoris Sequence: Given a span X ←f– Z –g→ Y, the cofiber space of the natural map [reglue : X ∨ Y → X ⊔_Z Y] (defined below) is equivalent to the suspension of Z. -} {- Relevant functions -} module MayerVietorisFunctions (ps : ⊙Span {i} {i} {i}) where open ⊙Span ps module Reglue = WedgeRec {X = ⊙Span.X ps} {Y = ⊙Span.Y ps} {C = fst (⊙Pushout ps)} left right (! (ap left (snd f)) ∙ glue (snd Z) ∙' ap right (snd g)) reglue : X ∨ Y → fst (⊙Pushout ps) reglue = Reglue.f ⊙reglue : fst (X ⊙∨ Y ⊙→ ⊙Pushout ps) ⊙reglue = (reglue , idp) module MVDiff = SuspensionRec (fst Z) {C = Suspension (X ∨ Y)} (north _) (north _) (λ z → merid _ (winl (fst f z)) ∙ ! (merid _ (winr (fst g z)))) mv-diff : Suspension (fst Z) → Suspension (X ∨ Y) mv-diff = MVDiff.f ⊙mv-diff : fst (⊙Susp Z ⊙→ ⊙Susp (X ⊙∨ Y)) ⊙mv-diff = (mv-diff , idp) {- We use path induction (via [⊙pushout-J]) to assume that the basepoint preservation paths of the span maps are [idp]. The module [Base] contains the proof of the theorem for this case. -} module MayerVietorisBase {A B : Type i} (Z : Ptd i) (f : fst Z → A) (g : fst Z → B) where X = ⊙[ A , f (snd Z) ] Y = ⊙[ B , g (snd Z) ] ps = ⊙span X Y Z (f , idp) (g , idp) F : fst (Z ⊙→ X) F = (f , idp) G : fst (Z ⊙→ Y) G = (g , idp) open MayerVietorisFunctions ps {- Definition of the maps into : Cofiber reglue → ΣZ out : ΣZ → Cofiber reglue -} private into-glue-square : Square idp idp (ap (ext-glue ∘ reglue) wglue) (merid _ (snd Z)) into-glue-square = connection ⊡v∙ ! (ap-∘ ext-glue reglue wglue ∙ ap (ap ext-glue) Reglue.glue-β ∙ ExtGlue.glue-β (snd Z)) module IntoGlue = WedgeElim {P = λ xy → north _ == ext-glue (reglue xy)} (λ _ → idp) (λ _ → merid _ (snd Z)) (↓-cst=app-from-square into-glue-square) into-glue = IntoGlue.f module Into = CofiberRec reglue (north _) ext-glue into-glue private out-glue-and-square : (z : fst Z) → Σ (cfbase reglue == cfbase reglue) (λ p → Square (cfglue _ (winl (f z))) p (ap (cfcod _) (glue z)) (cfglue _ (winr (g z)))) out-glue-and-square z = fill-square-top _ _ _ out-glue = fst ∘ out-glue-and-square out-square = snd ∘ out-glue-and-square module Out = SuspensionRec (fst Z) {C = Cofiber reglue} (cfbase _) (cfbase _) out-glue into = Into.f out = Out.f {- [out] is a right inverse for [into] -} private into-out-sq : (z : fst Z) → Square idp (ap into (ap out (merid _ z))) (merid _ z) (merid _ (snd Z)) into-out-sq z = (ap (ap into) (Out.glue-β z) ∙v⊡ (! (Into.glue-β (winl (f z)))) ∙h⊡ ap-square into (out-square z) ⊡h∙ (Into.glue-β (winr (g z)))) ⊡v∙ (∘-ap into (cfcod _) (glue z) ∙ ExtGlue.glue-β z) into-out : ∀ σ → into (out σ) == σ into-out = Suspension-elim (fst Z) idp (merid _ (snd Z)) (λ z → ↓-∘=idf-from-square into out (into-out-sq z)) {- [out] is a left inverse for [into] -} {- [out] is left inverse on codomain part of cofiber space, - i.e. [out (into (cfcod _ γ)) == cfcod _ γ] -} private out-into-cod-square : (z : fst Z) → Square (cfglue reglue (winl (f z))) (ap (out ∘ ext-glue {s = ⊙span-out ps}) (glue z)) (ap (cfcod _) (glue z)) (cfglue _ (winr (g z))) out-into-cod-square z = (ap-∘ out ext-glue (glue z) ∙ ap (ap out) (ExtGlue.glue-β z) ∙ Out.glue-β z) ∙v⊡ out-square z module OutIntoCod = PushoutElim {d = ⊙span-out ps} {P = λ γ → out (into (cfcod _ γ)) == cfcod _ γ} (λ x → cfglue _ (winl x)) (λ y → cfglue _ (winr y)) (λ z → ↓-='-from-square (out-into-cod-square z)) out-into-cod = OutIntoCod.f {- Cube move lemma for the left inverse coherence. This is used to build up a right square (in this case starting from a cube filler) -} private square-push-rb : ∀ {i} {A : Type i} {a₀₀ a₀₁ a₁₀ a₁₁ : A} {b : A} {p₀₋ : a₀₀ == a₀₁} {p₋₀ : a₀₀ == a₁₀} {p₋₁ : a₀₁ == a₁₁} {p₁₋ : a₁₀ == b} (q : b == a₁₁) (sq : Square p₀₋ p₋₀ p₋₁ (p₁₋ ∙ q)) → Square p₀₋ p₋₀ (p₋₁ ∙' ! q) p₁₋ square-push-rb {p₁₋ = idp} idp sq = sq right-from-bot-lemma : ∀ {i} {A : Type i} {a₀₀₀ a₀₁₀ a₁₀₀ a₁₁₀ a₀₀₁ a₀₁₁ a₁₀₁ a₁₁₁ b₀ b₁ : A} {p₀₋₀ : a₀₀₀ == a₀₁₀} {p₋₀₀ : a₀₀₀ == a₁₀₀} {p₋₁₀ : a₀₁₀ == a₁₁₀} {p₁₋₀ : a₁₀₀ == a₁₁₀} {sq₋₋₀ : Square p₀₋₀ p₋₀₀ p₋₁₀ p₁₋₀} -- left {p₀₋₁ : a₀₀₁ == a₀₁₁} {p₋₀₁ : a₀₀₁ == a₁₀₁} {p₋₁₁ : a₀₁₁ == a₁₁₁} {p₁₋₁ : a₁₀₁ == a₁₁₁} (sq₋₋₁ : Square p₀₋₁ p₋₀₁ p₋₁₁ p₁₋₁) -- right {p₀₀₋ : a₀₀₀ == a₀₀₁} {p₀₁₋ : a₀₁₀ == b₀} {p₁₀₋ : a₁₀₀ == a₁₀₁} {p₁₁₋ : a₁₁₀ == b₁} {q₀₋ : a₀₁₁ == b₀} {q₋₁ : b₀ == b₁} {q₁₋ : a₁₁₁ == b₁} {sq₀₋₋ : Square p₀₋₀ p₀₀₋ p₀₁₋ (p₀₋₁ ∙ q₀₋)} -- back {sq₋₀₋ : Square p₋₀₀ p₀₀₋ p₁₀₋ p₋₀₁} -- top {sq₋₁₋ : Square p₋₁₀ p₀₁₋ p₁₁₋ q₋₁} -- bottom {sq₁₋₋ : Square p₁₋₀ p₁₀₋ p₁₁₋ (p₁₋₁ ∙ q₁₋)} -- front (sq' : Square q₀₋ p₋₁₁ q₋₁ q₁₋) (cu : Cube sq₋₋₀ sq₋₋₁ (square-push-rb q₀₋ sq₀₋₋) sq₋₀₋ (sq₋₁₋ ⊡h' !□h (square-symmetry sq')) (square-push-rb q₁₋ sq₁₋₋)) → Cube sq₋₋₀ (sq₋₋₁ ⊡v sq') sq₀₋₋ sq₋₀₋ sq₋₁₋ sq₁₋₋ right-from-bot-lemma sq₋₋₁ ids cu = right-from-bot-lemma' sq₋₋₁ cu where right-from-bot-lemma' : ∀ {i} {A : Type i} {a₀₀₀ a₀₁₀ a₁₀₀ a₁₁₀ a₀₀₁ a₀₁₁ a₁₀₁ a₁₁₁ : A} {p₀₋₀ : a₀₀₀ == a₀₁₀} {p₋₀₀ : a₀₀₀ == a₁₀₀} {p₋₁₀ : a₀₁₀ == a₁₁₀} {p₁₋₀ : a₁₀₀ == a₁₁₀} {sq₋₋₀ : Square p₀₋₀ p₋₀₀ p₋₁₀ p₁₋₀} -- left {p₀₋₁ : a₀₀₁ == a₀₁₁} {p₋₀₁ : a₀₀₁ == a₁₀₁} {p₋₁₁ : a₀₁₁ == a₁₁₁} {p₁₋₁ : a₁₀₁ == a₁₁₁} (sq₋₋₁ : Square p₀₋₁ p₋₀₁ p₋₁₁ p₁₋₁) -- right {p₀₀₋ : a₀₀₀ == a₀₀₁} {p₀₁₋ : a₀₁₀ == a₀₁₁} {p₁₀₋ : a₁₀₀ == a₁₀₁} {p₁₁₋ : a₁₁₀ == a₁₁₁} {sq₀₋₋ : Square p₀₋₀ p₀₀₋ p₀₁₋ (p₀₋₁ ∙ idp)} -- back {sq₋₀₋ : Square p₋₀₀ p₀₀₋ p₁₀₋ p₋₀₁} -- top {sq₋₁₋ : Square p₋₁₀ p₀₁₋ p₁₁₋ p₋₁₁} -- bottom {sq₁₋₋ : Square p₁₋₀ p₁₀₋ p₁₁₋ (p₁₋₁ ∙ idp)} -- front (cu : Cube sq₋₋₀ sq₋₋₁ (square-push-rb idp sq₀₋₋) sq₋₀₋ (sq₋₁₋ ⊡h' !□h (square-symmetry vid-square)) (square-push-rb idp sq₁₋₋)) → Cube sq₋₋₀ (sq₋₋₁ ⊡v vid-square) sq₀₋₋ sq₋₀₋ sq₋₁₋ sq₁₋₋ right-from-bot-lemma' ids cu = cu {- Proving the coherence term for the left inverse. This means proving [(w : X ∨ Y) → Square idp (ap out (ap into (glue w))) (cfglue _ w) (out-into-cod (reglue w))] -} private out-into-sql : (x : fst X) → Square idp (ap out (into-glue (winl x))) (cfglue _ (winl x)) (cfglue _ (winl x)) out-into-sql x = connection out-into-fill : Σ (Square idp (ap out (glue (snd Z))) idp idp) (λ sq → Cube (out-into-sql (snd X)) sq (natural-square (λ _ → idp) wglue) (natural-square (ap out ∘ into-glue) wglue) (natural-square (cfglue _) wglue ⊡h' !□h (square-symmetry connection)) (square-push-rb (cfglue _ (winr (snd Y))) (natural-square (out-into-cod ∘ reglue) wglue))) out-into-fill = fill-cube-right _ _ _ _ _ {- [fst out-into-fill] is chosen so that we can prove [out-into-sql == out-into-sqr [ ⋯ ↓ ⋯ ]]; this is proven by massaging [out-into-fill-cube] into the right shape. The trick is that the type of [out-into-fill-square] is independent of [y], so we can pick it to give the right result at the basepoint. -} out-into-sqr : (y : fst Y) → Square idp (ap out (into-glue (winr y))) (cfglue _ (winr y)) (cfglue _ (winr y)) out-into-sqr y = fst out-into-fill ⊡v connection out-into : ∀ κ → out (into κ) == κ out-into = Cofiber-elim reglue idp out-into-cod (λ w → ↓-∘=idf-from-square out into $ ap (ap out) (Into.glue-β w) ∙v⊡ Wedge-elim {P = λ w → Square idp (ap out (into-glue w)) (cfglue _ w) (out-into-cod (reglue w))} out-into-sql out-into-sqr (cube-to-↓-square $ right-from-bot-lemma (fst out-into-fill) connection $ (snd out-into-fill)) w) {- equivalence and paths -} eq : Cofiber reglue ≃ Suspension (fst Z) eq = equiv into out into-out out-into path : Cofiber reglue == Suspension (fst Z) path = ua eq ⊙path : ⊙Cof ⊙reglue == ⊙Susp Z ⊙path = ⊙ua eq idp {- Transporting [cfcod reglue] over the equivalence -} cfcod-over : ⊙cfcod ⊙reglue == ⊙ext-glue [ (λ W → fst (⊙Pushout ps ⊙→ W)) ↓ ⊙path ] cfcod-over = codomain-over-⊙equiv (⊙cfcod ⊙reglue) eq idp ▹ lemma where lemma : (into , idp) ⊙∘ ⊙cfcod ⊙reglue == ⊙ext-glue lemma = pair= idp $ ap into (! (cfglue reglue (winl (snd X)))) ∙ idp =⟨ ap-! into (cfglue reglue (winl (snd X))) |in-ctx (λ w → w ∙ idp) ⟩ ! (ap into (cfglue reglue (winl (snd X)))) ∙ idp =⟨ Into.glue-β (winl (snd X)) |in-ctx (λ w → ! w ∙ idp) ⟩ idp ∎ {- Transporting [ext-glue] over the equivalence. Uses the same sort of - cube technique as in the proof of [⊙path]. -} private square-push-rt : ∀ {i} {A : Type i} {a₀₀ a₀₁ a₁₀ a₁₁ : A} {b : A} {p₀₋ : a₀₀ == a₀₁} {p₋₀ : a₀₀ == a₁₀} {p₋₁ : a₀₁ == a₁₁} {p₁₋ : b == a₁₁} (q : a₁₀ == b) (sq : Square p₀₋ p₋₀ p₋₁ (q ∙' p₁₋)) → Square p₀₋ (p₋₀ ∙' q) p₋₁ p₁₋ square-push-rt {p₁₋ = idp} idp sq = sq right-from-top-lemma : ∀ {i} {A : Type i} {a₀₀₀ a₀₁₀ a₁₀₀ a₁₁₀ a₀₀₁ a₀₁₁ a₁₀₁ a₁₁₁ b₀ b₁ : A} {p₀₋₀ : a₀₀₀ == a₀₁₀} {p₋₀₀ : a₀₀₀ == a₁₀₀} {p₋₁₀ : a₀₁₀ == a₁₁₀} {p₁₋₀ : a₁₀₀ == a₁₁₀} {sq₋₋₀ : Square p₀₋₀ p₋₀₀ p₋₁₀ p₁₋₀} -- left {p₀₋₁ : a₀₀₁ == a₀₁₁} {p₋₀₁ : a₀₀₁ == a₁₀₁} {p₋₁₁ : a₀₁₁ == a₁₁₁} {p₁₋₁ : a₁₀₁ == a₁₁₁} (sq₋₋₁ : Square p₀₋₁ p₋₀₁ p₋₁₁ p₁₋₁) -- right {p₀₀₋ : a₀₀₀ == b₀ {-a₀₀₁-}} {p₀₁₋ : a₀₁₀ == a₀₁₁} {p₁₀₋ : a₁₀₀ == b₁ {-a₁₀₁-}} {p₁₁₋ : a₁₁₀ == a₁₁₁} {q₀₋ : b₀ == a₀₀₁} {q₋₀ : b₀ == b₁} {q₁₋ : b₁ == a₁₀₁} {sq₀₋₋ : Square p₀₋₀ p₀₀₋ p₀₁₋ (q₀₋ ∙' p₀₋₁)} -- back {sq₋₀₋ : Square p₋₀₀ p₀₀₋ p₁₀₋ q₋₀} -- top {sq₋₁₋ : Square p₋₁₀ p₀₁₋ p₁₁₋ p₋₁₁} -- bottom {sq₁₋₋ : Square p₁₋₀ p₁₀₋ p₁₁₋ (q₁₋ ∙' p₁₋₁)} -- front (sq' : Square q₀₋ q₋₀ p₋₀₁ q₁₋) (cu : Cube sq₋₋₀ sq₋₋₁ (square-push-rt q₀₋ sq₀₋₋) (sq₋₀₋ ⊡h' square-symmetry sq') sq₋₁₋ (square-push-rt q₁₋ sq₁₋₋)) → Cube sq₋₋₀ (sq' ⊡v' sq₋₋₁) sq₀₋₋ sq₋₀₋ sq₋₁₋ sq₁₋₋ right-from-top-lemma sq₋₋₁ ids cu = right-from-top-lemma' sq₋₋₁ cu where right-from-top-lemma' : ∀ {i} {A : Type i} {a₀₀₀ a₀₁₀ a₁₀₀ a₁₁₀ a₀₀₁ a₀₁₁ a₁₀₁ a₁₁₁ : A} {p₀₋₀ : a₀₀₀ == a₀₁₀} {p₋₀₀ : a₀₀₀ == a₁₀₀} {p₋₁₀ : a₀₁₀ == a₁₁₀} {p₁₋₀ : a₁₀₀ == a₁₁₀} {sq₋₋₀ : Square p₀₋₀ p₋₀₀ p₋₁₀ p₁₋₀} -- left {p₀₋₁ : a₀₀₁ == a₀₁₁} {p₋₀₁ : a₀₀₁ == a₁₀₁} {p₋₁₁ : a₀₁₁ == a₁₁₁} {p₁₋₁ : a₁₀₁ == a₁₁₁} (sq₋₋₁ : Square p₀₋₁ p₋₀₁ p₋₁₁ p₁₋₁) -- right {p₀₀₋ : a₀₀₀ == a₀₀₁} {p₀₁₋ : a₀₁₀ == a₀₁₁} {p₁₀₋ : a₁₀₀ == a₁₀₁} {p₁₁₋ : a₁₁₀ == a₁₁₁} {sq₀₋₋ : Square p₀₋₀ p₀₀₋ p₀₁₋ (idp ∙' p₀₋₁)} -- back {sq₋₀₋ : Square p₋₀₀ p₀₀₋ p₁₀₋ p₋₀₁} -- top {sq₋₁₋ : Square p₋₁₀ p₀₁₋ p₁₁₋ p₋₁₁} -- bottom {sq₁₋₋ : Square p₁₋₀ p₁₀₋ p₁₁₋ (idp ∙' p₁₋₁)} -- front (cu : Cube sq₋₋₀ sq₋₋₁ (square-push-rt idp sq₀₋₋) (sq₋₀₋ ⊡h' square-symmetry vid-square) sq₋₁₋ (square-push-rt idp sq₁₋₋)) → Cube sq₋₋₀ (vid-square ⊡v' sq₋₋₁) sq₀₋₋ sq₋₀₋ sq₋₁₋ sq₁₋₋ right-from-top-lemma' ids cu = cu ext-over : ⊙ext-glue == ⊙mv-diff [ (λ W → fst (W ⊙→ ⊙Susp (X ⊙∨ Y))) ↓ ⊙path ] ext-over = ⊙λ= fn-lemma idp ◃ domain-over-⊙equiv ⊙mv-diff _ _ where fn-lemma : ∀ κ → ext-glue κ == mv-diff (into κ) fn-lemma = Cofiber-elim reglue idp fn-cod (λ w → ↓-='-from-square $ ExtGlue.glue-β w ∙v⊡ fn-coh w ⊡v∙ ! (ap-∘ mv-diff into (glue w) ∙ ap (ap mv-diff) (Into.glue-β w))) where fn-cod : (γ : fst (⊙Pushout ps)) → ext-glue (cfcod reglue γ) == mv-diff (ext-glue γ) fn-cod = Pushout-elim (λ x → ! (merid _ (winl x))) (λ y → ! (merid _ (winr y))) (λ z → ↓-='-from-square $ ap-cst (south _) (glue z) ∙v⊡ (bl-square (merid _ (winl (f z))) ⊡h connection) ⊡v∙ ! (ap-∘ mv-diff ext-glue (glue z) ∙ ap (ap mv-diff) (ExtGlue.glue-β z) ∙ MVDiff.glue-β z)) fn-fill : Σ (Square idp idp (ap mv-diff (merid _ (snd Z))) idp) (λ sq → Cube (tr-square (merid _ (winl (snd X)))) sq (natural-square (λ _ → idp) wglue) (natural-square (merid _) wglue ⊡h' square-symmetry (tr-square (merid _ (winr (snd Y))))) (natural-square (ap mv-diff ∘ into-glue) wglue) (square-push-rt (! (merid _ (winr (snd Y)))) (natural-square (fn-cod ∘ reglue) wglue))) fn-fill = fill-cube-right _ _ _ _ _ fn-coh : (w : X ∨ Y) → Square idp (merid _ w) (ap mv-diff (into-glue w)) (fn-cod (reglue w)) fn-coh = Wedge-elim (λ x → tr-square (merid _ (winl x))) (λ y → tr-square (merid _ (winr y)) ⊡v' (fst fn-fill)) (cube-to-↓-square $ right-from-top-lemma (fst fn-fill) (tr-square (merid _ (winr (snd Y)))) (snd fn-fill)) {- Main results -} module MayerVietoris (ps : ⊙Span {i} {i} {i}) where private record Results (ps : ⊙Span {i} {i} {i}) : Type (lsucc i) where open ⊙Span ps open MayerVietorisFunctions ps public field eq : Cofiber reglue ≃ Suspension (fst Z) path : Cofiber reglue == Suspension (fst Z) ⊙path : ⊙Cof ⊙reglue == ⊙Susp Z cfcod-over : ⊙cfcod ⊙reglue == ⊙ext-glue [ (λ W → fst (⊙Pushout ps ⊙→ W)) ↓ ⊙path ] ext-over : ⊙ext-glue == ⊙mv-diff [ (λ W → fst (W ⊙→ ⊙Susp (X ⊙∨ Y))) ↓ ⊙path ] results : Results ps results = ⊙pushout-J Results base-results ps where base-results : ∀ {A} {B} Z (f : fst Z → A) (g : fst Z → B) → Results (⊙span _ _ Z (f , idp) (g , idp)) base-results Z f g = record { eq = eq; path = path; ⊙path = ⊙path; cfcod-over = cfcod-over; ext-over = ext-over} where open MayerVietorisBase Z f g open Results results public
-- Andreas, 2016-11-11 issue #2301, -- reported by stedolan and fredrikNorvallForsberg: -- compareTelescope ignored relevance. -- Faulty behavior probably existed since 2011. module Issue2301 where data Box (A : Set) : Set where wrap : A → Box A weird : ∀ A → .A → Box A weird A = wrap -- SHOULD FAIL with error: -- A → Box A !=< .A → Box A -- when checking that the expression wrap has type .A → Box A -- WAS: checked. -- Since the first argument to wrap is not actually irrelevant, -- this lets us write a function that discards irrelevance annotations: make-relevant : ∀ {A} → .A → A make-relevant a = unwrap (weird a) where unwrap : ∀ {A} → Box A → A unwrap (wrap a) = a -- or proves things we shouldn't: data _≡_ {A : Set} (x : A) : A → Set where refl : x ≡ x data Bool : Set where tt ff : Bool absurd : {X : Set} → X absurd {X} = different same where different : weird tt ≡ weird ff → X different () irr-eq : ∀ {A B : Set} {x y : A} (f : .A → B) → f x ≡ f y irr-eq f = refl same : weird tt ≡ weird ff same = irr-eq weird
/- Copyright (c) 2021 Martin Zinkevich. All rights reserved. Released under Apache 2.0 license as described in the file LICENSE. Authors: Johannes Hölzl, Martin Zinkevich, Rémy Degenne ! This file was ported from Lean 3 source module measure_theory.pi_system ! leanprover-community/mathlib commit 98e83c3d541c77cdb7da20d79611a780ff8e7d90 ! Please do not edit these lines, except to modify the commit id ! if you have ported upstream changes. -/ import Mathlib.Logic.Encodable.Lattice import Mathlib.MeasureTheory.MeasurableSpaceDef /-! # Induction principles for measurable sets, related to π-systems and λ-systems. ## Main statements * The main theorem of this file is Dynkin's π-λ theorem, which appears here as an induction principle `induction_on_inter`. Suppose `s` is a collection of subsets of `α` such that the intersection of two members of `s` belongs to `s` whenever it is nonempty. Let `m` be the σ-algebra generated by `s`. In order to check that a predicate `C` holds on every member of `m`, it suffices to check that `C` holds on the members of `s` and that `C` is preserved by complementation and *disjoint* countable unions. * The proof of this theorem relies on the notion of `IsPiSystem`, i.e., a collection of sets which is closed under binary non-empty intersections. Note that this is a small variation around the usual notion in the literature, which often requires that a π-system is non-empty, and closed also under disjoint intersections. This variation turns out to be convenient for the formalization. * The proof of Dynkin's π-λ theorem also requires the notion of `DynkinSystem`, i.e., a collection of sets which contains the empty set, is closed under complementation and under countable union of pairwise disjoint sets. The disjointness condition is the only difference with `σ`-algebras. * `generatePiSystem g` gives the minimal π-system containing `g`. This can be considered a Galois insertion into both measurable spaces and sets. * `generateFrom_generatePiSystem_eq` proves that if you start from a collection of sets `g`, take the generated π-system, and then the generated σ-algebra, you get the same result as the σ-algebra generated from `g`. This is useful because there are connections between independent sets that are π-systems and the generated independent spaces. * `mem_generatePiSystem_unionᵢ_elim` and `mem_generatePiSystem_unionᵢ_elim'` show that any element of the π-system generated from the union of a set of π-systems can be represented as the intersection of a finite number of elements from these sets. * `piUnionᵢInter` defines a new π-system from a family of π-systems `π : ι → Set (Set α)` and a set of indices `S : Set ι`. `piUnionᵢInter π S` is the set of sets that can be written as `⋂ x ∈ t, f x` for some finset `t ∈ S` and sets `f x ∈ π x`. ## Implementation details * `IsPiSystem` is a predicate, not a type. Thus, we don't explicitly define the galois insertion, nor do we define a complete lattice. In theory, we could define a complete lattice and galois insertion on the subtype corresponding to `IsPiSystem`. -/ open MeasurableSpace Set open Classical MeasureTheory /-- A π-system is a collection of subsets of `α` that is closed under binary intersection of non-disjoint sets. Usually it is also required that the collection is nonempty, but we don't do that here. -/ def IsPiSystem {α} (C : Set (Set α)) : Prop := ∀ᵉ (s ∈ C) (t ∈ C), (s ∩ t : Set α).Nonempty → s ∩ t ∈ C #align is_pi_system IsPiSystem namespace MeasurableSpace theorem isPiSystem_measurableSet {α : Type _} [MeasurableSpace α] : IsPiSystem { s : Set α | MeasurableSet s } := fun _ hs _ ht _ => hs.inter ht #align measurable_space.is_pi_system_measurable_set MeasurableSpace.isPiSystem_measurableSet end MeasurableSpace theorem IsPiSystem.singleton {α} (S : Set α) : IsPiSystem ({S} : Set (Set α)) := by intro s h_s t h_t _ rw [Set.mem_singleton_iff.1 h_s, Set.mem_singleton_iff.1 h_t, Set.inter_self, Set.mem_singleton_iff] #align is_pi_system.singleton IsPiSystem.singleton theorem IsPiSystem.insert_empty {α} {S : Set (Set α)} (h_pi : IsPiSystem S) : IsPiSystem (insert ∅ S) := by intro s hs t ht hst cases' hs with hs hs · simp [hs] · cases' ht with ht ht · simp [ht] · exact Set.mem_insert_of_mem _ (h_pi s hs t ht hst) #align is_pi_system.insert_empty IsPiSystem.insert_empty theorem IsPiSystem.insert_univ {α} {S : Set (Set α)} (h_pi : IsPiSystem S) : IsPiSystem (insert Set.univ S) := by intro s hs t ht hst cases' hs with hs hs · cases' ht with ht ht <;> simp [hs, ht] · cases' ht with ht ht · simp [hs, ht] · exact Set.mem_insert_of_mem _ (h_pi s hs t ht hst) #align is_pi_system.insert_univ IsPiSystem.insert_univ theorem IsPiSystem.comap {α β} {S : Set (Set β)} (h_pi : IsPiSystem S) (f : α → β) : IsPiSystem { s : Set α | ∃ t ∈ S, f ⁻¹' t = s } := by rintro _ ⟨s, hs_mem, rfl⟩ _ ⟨t, ht_mem, rfl⟩ hst rw [← Set.preimage_inter] at hst⊢ refine' ⟨s ∩ t, h_pi s hs_mem t ht_mem _, rfl⟩ by_contra h rw [Set.not_nonempty_iff_eq_empty] at h rw [h] at hst simp at hst #align is_pi_system.comap IsPiSystem.comap theorem isPiSystem_unionᵢ_of_directed_le {α ι} (p : ι → Set (Set α)) (hp_pi : ∀ n, IsPiSystem (p n)) (hp_directed : Directed (· ≤ ·) p) : IsPiSystem (⋃ n, p n) := by intro t1 ht1 t2 ht2 h rw [Set.mem_unionᵢ] at ht1 ht2⊢ cases' ht1 with n ht1 cases' ht2 with m ht2 obtain ⟨k, hpnk, hpmk⟩ : ∃ k, p n ≤ p k ∧ p m ≤ p k := hp_directed n m exact ⟨k, hp_pi k t1 (hpnk ht1) t2 (hpmk ht2) h⟩ #align is_pi_system_Union_of_directed_le isPiSystem_unionᵢ_of_directed_le theorem isPiSystem_unionᵢ_of_monotone {α ι} [SemilatticeSup ι] (p : ι → Set (Set α)) (hp_pi : ∀ n, IsPiSystem (p n)) (hp_mono : Monotone p) : IsPiSystem (⋃ n, p n) := isPiSystem_unionᵢ_of_directed_le p hp_pi (Monotone.directed_le hp_mono) #align is_pi_system_Union_of_monotone isPiSystem_unionᵢ_of_monotone section Order variable {α : Type _} {ι ι' : Sort _} [LinearOrder α] theorem isPiSystem_image_Iio (s : Set α) : IsPiSystem (Iio '' s) := by rintro _ ⟨a, ha, rfl⟩ _ ⟨b, hb, rfl⟩ - exact ⟨a ⊓ b, inf_ind a b ha hb, Iio_inter_Iio.symm⟩ #align is_pi_system_image_Iio isPiSystem_image_Iio theorem isPiSystem_Iio : IsPiSystem (range Iio : Set (Set α)) := @image_univ α _ Iio ▸ isPiSystem_image_Iio univ #align is_pi_system_Iio isPiSystem_Iio theorem isPiSystem_image_Ioi (s : Set α) : IsPiSystem (Ioi '' s) := @isPiSystem_image_Iio αᵒᵈ _ s #align is_pi_system_image_Ioi isPiSystem_image_Ioi theorem isPiSystem_Ioi : IsPiSystem (range Ioi : Set (Set α)) := @image_univ α _ Ioi ▸ isPiSystem_image_Ioi univ #align is_pi_system_Ioi isPiSystem_Ioi -- porting note: change `∃ (_ : p l u), _` to `_ ∧ _` theorem isPiSystem_Ixx_mem {Ixx : α → α → Set α} {p : α → α → Prop} (Hne : ∀ {a b}, (Ixx a b).Nonempty → p a b) (Hi : ∀ {a₁ b₁ a₂ b₂}, Ixx a₁ b₁ ∩ Ixx a₂ b₂ = Ixx (max a₁ a₂) (min b₁ b₂)) (s t : Set α) : IsPiSystem { S | ∃ᵉ (l ∈ s) (u ∈ t), p l u ∧ Ixx l u = S } := by rintro _ ⟨l₁, hls₁, u₁, hut₁, _, rfl⟩ _ ⟨l₂, hls₂, u₂, hut₂, _, rfl⟩ simp only [Hi] exact fun H => ⟨l₁ ⊔ l₂, sup_ind l₁ l₂ hls₁ hls₂, u₁ ⊓ u₂, inf_ind u₁ u₂ hut₁ hut₂, Hne H, rfl⟩ #align is_pi_system_Ixx_mem isPiSystem_Ixx_mem -- porting note: change `∃ (_ : p l u), _` to `_ ∧ _` theorem isPiSystem_Ixx {Ixx : α → α → Set α} {p : α → α → Prop} (Hne : ∀ {a b}, (Ixx a b).Nonempty → p a b) (Hi : ∀ {a₁ b₁ a₂ b₂}, Ixx a₁ b₁ ∩ Ixx a₂ b₂ = Ixx (max a₁ a₂) (min b₁ b₂)) (f : ι → α) (g : ι' → α) : @IsPiSystem α { S | ∃ i j, p (f i) (g j) ∧ Ixx (f i) (g j) = S } := by simpa only [exists_range_iff] using isPiSystem_Ixx_mem (@Hne) (@Hi) (range f) (range g) #align is_pi_system_Ixx isPiSystem_Ixx -- porting note: change `∃ (_ : p l u), _` to `_ ∧ _` theorem isPiSystem_Ioo_mem (s t : Set α) : IsPiSystem { S | ∃ᵉ (l ∈ s) (u ∈ t), l < u ∧ Ioo l u = S } := isPiSystem_Ixx_mem (Ixx := Ioo) (fun ⟨_, hax, hxb⟩ => hax.trans hxb) Ioo_inter_Ioo s t #align is_pi_system_Ioo_mem isPiSystem_Ioo_mem -- porting note: change `∃ (_ : p l u), _` to `_ ∧ _` theorem isPiSystem_Ioo (f : ι → α) (g : ι' → α) : @IsPiSystem α { S | ∃ l u, f l < g u ∧ Ioo (f l) (g u) = S } := isPiSystem_Ixx (Ixx := Ioo) (fun ⟨_, hax, hxb⟩ => hax.trans hxb) Ioo_inter_Ioo f g #align is_pi_system_Ioo isPiSystem_Ioo -- porting note: change `∃ (_ : p l u), _` to `_ ∧ _` theorem isPiSystem_Ioc_mem (s t : Set α) : IsPiSystem { S | ∃ᵉ (l ∈ s) (u ∈ t), l < u ∧ Ioc l u = S } := isPiSystem_Ixx_mem (Ixx := Ioc) (fun ⟨_, hax, hxb⟩ => hax.trans_le hxb) Ioc_inter_Ioc s t #align is_pi_system_Ioc_mem isPiSystem_Ioc_mem -- porting note: change `∃ (_ : p l u), _` to `_ ∧ _` theorem isPiSystem_Ioc (f : ι → α) (g : ι' → α) : @IsPiSystem α { S | ∃ i j, f i < g j ∧ Ioc (f i) (g j) = S } := isPiSystem_Ixx (Ixx := Ioc) (fun ⟨_, hax, hxb⟩ => hax.trans_le hxb) Ioc_inter_Ioc f g #align is_pi_system_Ioc isPiSystem_Ioc -- porting note: change `∃ (_ : p l u), _` to `_ ∧ _` theorem isPiSystem_Ico_mem (s t : Set α) : IsPiSystem { S | ∃ᵉ (l ∈ s) (u ∈ t), l < u ∧ Ico l u = S } := isPiSystem_Ixx_mem (Ixx := Ico) (fun ⟨_, hax, hxb⟩ => hax.trans_lt hxb) Ico_inter_Ico s t #align is_pi_system_Ico_mem isPiSystem_Ico_mem -- porting note: change `∃ (_ : p l u), _` to `_ ∧ _` theorem isPiSystem_Ico (f : ι → α) (g : ι' → α) : @IsPiSystem α { S | ∃ i j, f i < g j ∧ Ico (f i) (g j) = S } := isPiSystem_Ixx (Ixx := Ico) (fun ⟨_, hax, hxb⟩ => hax.trans_lt hxb) Ico_inter_Ico f g #align is_pi_system_Ico isPiSystem_Ico -- porting note: change `∃ (_ : p l u), _` to `_ ∧ _` theorem isPiSystem_Icc_mem (s t : Set α) : IsPiSystem { S | ∃ᵉ (l ∈ s) (u ∈ t), l ≤ u ∧ Icc l u = S } := isPiSystem_Ixx_mem (Ixx := Icc) nonempty_Icc.1 (by exact Icc_inter_Icc) s t #align is_pi_system_Icc_mem isPiSystem_Icc_mem -- porting note: change `∃ (_ : p l u), _` to `_ ∧ _` theorem isPiSystem_Icc (f : ι → α) (g : ι' → α) : @IsPiSystem α { S | ∃ i j, f i ≤ g j ∧ Icc (f i) (g j) = S } := isPiSystem_Ixx (Ixx := Icc) nonempty_Icc.1 (by exact Icc_inter_Icc) f g #align is_pi_system_Icc isPiSystem_Icc end Order /-- Given a collection `S` of subsets of `α`, then `generatePiSystem S` is the smallest π-system containing `S`. -/ inductive generatePiSystem {α} (S : Set (Set α)) : Set (Set α) | base {s : Set α} (h_s : s ∈ S) : generatePiSystem S s | inter {s t : Set α} (h_s : generatePiSystem S s) (h_t : generatePiSystem S t) (h_nonempty : (s ∩ t).Nonempty) : generatePiSystem S (s ∩ t) #align generate_pi_system generatePiSystem theorem isPiSystem_generatePiSystem {α} (S : Set (Set α)) : IsPiSystem (generatePiSystem S) := fun _ h_s _ h_t h_nonempty => generatePiSystem.inter h_s h_t h_nonempty #align is_pi_system_generate_pi_system isPiSystem_generatePiSystem theorem subset_generatePiSystem_self {α} (S : Set (Set α)) : S ⊆ generatePiSystem S := fun _ => generatePiSystem.base #align subset_generate_pi_system_self subset_generatePiSystem_self theorem generatePiSystem_subset_self {α} {S : Set (Set α)} (h_S : IsPiSystem S) : generatePiSystem S ⊆ S := fun x h => by induction' h with _ h_s s u _ _ h_nonempty h_s h_u · exact h_s · exact h_S _ h_s _ h_u h_nonempty #align generate_pi_system_subset_self generatePiSystem_subset_self theorem generatePiSystem_eq {α} {S : Set (Set α)} (h_pi : IsPiSystem S) : generatePiSystem S = S := Set.Subset.antisymm (generatePiSystem_subset_self h_pi) (subset_generatePiSystem_self S) #align generate_pi_system_eq generatePiSystem_eq theorem generatePiSystem_mono {α} {S T : Set (Set α)} (hST : S ⊆ T) : generatePiSystem S ⊆ generatePiSystem T := fun t ht => by induction' ht with s h_s s u _ _ h_nonempty h_s h_u · exact generatePiSystem.base (Set.mem_of_subset_of_mem hST h_s) · exact isPiSystem_generatePiSystem T _ h_s _ h_u h_nonempty #align generate_pi_system_mono generatePiSystem_mono theorem generatePiSystem_measurableSet {α} [M : MeasurableSpace α] {S : Set (Set α)} (h_meas_S : ∀ s ∈ S, MeasurableSet s) (t : Set α) (h_in_pi : t ∈ generatePiSystem S) : MeasurableSet t := by induction' h_in_pi with s h_s s u _ _ _ h_s h_u · apply h_meas_S _ h_s · apply MeasurableSet.inter h_s h_u #align generate_pi_system_measurable_set generatePiSystem_measurableSet theorem generateFrom_measurableSet_of_generatePiSystem {α} {g : Set (Set α)} (t : Set α) (ht : t ∈ generatePiSystem g) : MeasurableSet[generateFrom g] t := @generatePiSystem_measurableSet α (generateFrom g) g (fun _ h_s_in_g => measurableSet_generateFrom h_s_in_g) t ht #align generate_from_measurable_set_of_generate_pi_system generateFrom_measurableSet_of_generatePiSystem theorem generateFrom_generatePiSystem_eq {α} {g : Set (Set α)} : generateFrom (generatePiSystem g) = generateFrom g := by apply le_antisymm <;> apply generateFrom_le · exact fun t h_t => generateFrom_measurableSet_of_generatePiSystem t h_t · exact fun t h_t => measurableSet_generateFrom (generatePiSystem.base h_t) #align generate_from_generate_pi_system_eq generateFrom_generatePiSystem_eq /- Every element of the π-system generated by the union of a family of π-systems is a finite intersection of elements from the π-systems. For an indexed union version, see `mem_generatePiSystem_unionᵢ_elim'`. -/ theorem mem_generatePiSystem_unionᵢ_elim {α β} {g : β → Set (Set α)} (h_pi : ∀ b, IsPiSystem (g b)) (t : Set α) (h_t : t ∈ generatePiSystem (⋃ b, g b)) : ∃ (T : Finset β) (f : β → Set α), (t = ⋂ b ∈ T, f b) ∧ ∀ b ∈ T, f b ∈ g b := by induction' h_t with s h_s s t' h_gen_s h_gen_t' h_nonempty h_s h_t' · rcases h_s with ⟨t', ⟨⟨b, rfl⟩, h_s_in_t'⟩⟩ refine' ⟨{b}, fun _ => s, _⟩ simpa using h_s_in_t' · rcases h_t' with ⟨T_t', ⟨f_t', ⟨rfl, h_t'⟩⟩⟩ rcases h_s with ⟨T_s, ⟨f_s, ⟨rfl, h_s⟩⟩⟩ use T_s ∪ T_t', fun b : β => if b ∈ T_s then if b ∈ T_t' then f_s b ∩ f_t' b else f_s b else if b ∈ T_t' then f_t' b else (∅ : Set α) constructor · ext a simp_rw [Set.mem_inter_iff, Set.mem_interᵢ, Finset.mem_union, or_imp] rw [← forall_and] constructor <;> intro h1 b <;> by_cases hbs : b ∈ T_s <;> by_cases hbt : b ∈ T_t' <;> specialize h1 b <;> simp only [hbs, hbt, if_true, if_false, true_imp_iff, and_self_iff, false_imp_iff, and_true_iff, true_and_iff] at h1⊢ all_goals exact h1 intro b h_b -- Porting note: `simp only` required for a beta reduction simp only [] split_ifs with hbs hbt hbt · refine' h_pi b (f_s b) (h_s b hbs) (f_t' b) (h_t' b hbt) (Set.Nonempty.mono _ h_nonempty) exact Set.inter_subset_inter (Set.binterᵢ_subset_of_mem hbs) (Set.binterᵢ_subset_of_mem hbt) · exact h_s b hbs · exact h_t' b hbt · rw [Finset.mem_union] at h_b apply False.elim (h_b.elim hbs hbt) #align mem_generate_pi_system_Union_elim mem_generatePiSystem_unionᵢ_elim /- Every element of the π-system generated by an indexed union of a family of π-systems is a finite intersection of elements from the π-systems. For a total union version, see `mem_generatePiSystem_unionᵢ_elim`. -/ theorem mem_generatePiSystem_unionᵢ_elim' {α β} {g : β → Set (Set α)} {s : Set β} (h_pi : ∀ b ∈ s, IsPiSystem (g b)) (t : Set α) (h_t : t ∈ generatePiSystem (⋃ b ∈ s, g b)) : ∃ (T : Finset β) (f : β → Set α), ↑T ⊆ s ∧ (t = ⋂ b ∈ T, f b) ∧ ∀ b ∈ T, f b ∈ g b := by have : t ∈ generatePiSystem (⋃ b : Subtype s, (g ∘ Subtype.val) b) := by suffices h1 : (⋃ b : Subtype s, (g ∘ Subtype.val) b) = ⋃ b ∈ s, g b · rwa [h1] ext x simp only [exists_prop, Set.mem_unionᵢ, Function.comp_apply, Subtype.exists, Subtype.coe_mk] rfl rcases @mem_generatePiSystem_unionᵢ_elim α (Subtype s) (g ∘ Subtype.val) (fun b => h_pi b.val b.property) t this with ⟨T, ⟨f, ⟨rfl, h_t'⟩⟩⟩ refine' ⟨T.image (fun x : s => (x : β)), Function.extend (fun x : s => (x : β)) f fun _ : β => (∅ : Set α), by simp, _, _⟩ · ext a constructor <;> · simp (config := { proj := false }) only [Set.mem_interᵢ, Subtype.forall, Finset.set_binterᵢ_finset_image] intro h1 b h_b h_b_in_T have h2 := h1 b h_b h_b_in_T revert h2 rw [Subtype.val_injective.extend_apply] apply id · intros b h_b simp_rw [Finset.mem_image, exists_prop, Subtype.exists, exists_and_right, exists_eq_right] at h_b cases' h_b with h_b_w h_b_h have h_b_alt : b = (Subtype.mk b h_b_w).val := rfl rw [h_b_alt, Subtype.val_injective.extend_apply] apply h_t' apply h_b_h #align mem_generate_pi_system_Union_elim' mem_generatePiSystem_unionᵢ_elim' section UnionInter variable {α ι : Type _} /-! ### π-system generated by finite intersections of sets of a π-system family -/ /-- From a set of indices `S : Set ι` and a family of sets of sets `π : ι → Set (Set α)`, define the set of sets that can be written as `⋂ x ∈ t, f x` for some finset `t ⊆ S` and sets `f x ∈ π x`. If `π` is a family of π-systems, then it is a π-system. -/ def piUnionᵢInter (π : ι → Set (Set α)) (S : Set ι) : Set (Set α) := { s : Set α | ∃ (t : Finset ι) (_ : ↑t ⊆ S) (f : ι → Set α) (_ : ∀ x, x ∈ t → f x ∈ π x), s = ⋂ x ∈ t, f x } #align pi_Union_Inter piUnionᵢInter theorem piUnionᵢInter_singleton (π : ι → Set (Set α)) (i : ι) : piUnionᵢInter π {i} = π i ∪ {univ} := by ext1 s simp only [piUnionᵢInter, exists_prop, mem_union] refine' ⟨_, fun h => _⟩ · rintro ⟨t, hti, f, hfπ, rfl⟩ simp only [subset_singleton_iff, Finset.mem_coe] at hti by_cases hi : i ∈ t · have ht_eq_i : t = {i} := by ext1 x rw [Finset.mem_singleton] exact ⟨fun h => hti x h, fun h => h.symm ▸ hi⟩ simp only [ht_eq_i, Finset.mem_singleton, interᵢ_interᵢ_eq_left] exact Or.inl (hfπ i hi) · have ht_empty : t = ∅ := by ext1 x simp only [Finset.not_mem_empty, iff_false_iff] exact fun hx => hi (hti x hx ▸ hx) -- Porting note: `Finset.not_mem_empty` required simp [ht_empty, Finset.not_mem_empty, interᵢ_false, interᵢ_univ, Set.mem_singleton univ, or_true_iff] · cases' h with hs hs · refine' ⟨{i}, _, fun _ => s, ⟨fun x hx => _, _⟩⟩ · rw [Finset.coe_singleton] · rw [Finset.mem_singleton] at hx rwa [hx] · simp only [Finset.mem_singleton, interᵢ_interᵢ_eq_left] · refine' ⟨∅, _⟩ simpa only [Finset.coe_empty, subset_singleton_iff, mem_empty_iff_false, IsEmpty.forall_iff, imp_true_iff, Finset.not_mem_empty, interᵢ_false, interᵢ_univ, true_and_iff, exists_const] using hs #align pi_Union_Inter_singleton piUnionᵢInter_singleton theorem piUnionᵢInter_singleton_left (s : ι → Set α) (S : Set ι) : piUnionᵢInter (fun i => ({s i} : Set (Set α))) S = { s' : Set α | ∃ (t : Finset ι) (_ : ↑t ⊆ S), s' = ⋂ i ∈ t, s i } := by ext1 s' simp_rw [piUnionᵢInter, Set.mem_singleton_iff, exists_prop, Set.mem_setOf_eq] refine' ⟨fun h => _, fun ⟨t, htS, h_eq⟩ => ⟨t, htS, s, fun _ _ => rfl, h_eq⟩⟩ obtain ⟨t, htS, f, hft_eq, rfl⟩ := h refine' ⟨t, htS, _⟩ congr! 3 apply hft_eq assumption #align pi_Union_Inter_singleton_left piUnionᵢInter_singleton_left theorem generateFrom_piUnionᵢInter_singleton_left (s : ι → Set α) (S : Set ι) : generateFrom (piUnionᵢInter (fun k => {s k}) S) = generateFrom { t | ∃ k ∈ S, s k = t } := by refine' le_antisymm (generateFrom_le _) (generateFrom_mono _) · rintro _ ⟨I, hI, f, hf, rfl⟩ refine' Finset.measurableSet_binterᵢ _ fun m hm => measurableSet_generateFrom _ exact ⟨m, hI hm, (hf m hm).symm⟩ · rintro _ ⟨k, hk, rfl⟩ refine' ⟨{k}, fun m hm => _, s, fun i _ => _, _⟩ · rw [Finset.mem_coe, Finset.mem_singleton] at hm rwa [hm] · exact Set.mem_singleton _ · simp only [Finset.mem_singleton, Set.interᵢ_interᵢ_eq_left] #align generate_from_pi_Union_Inter_singleton_left generateFrom_piUnionᵢInter_singleton_left /-- If `π` is a family of π-systems, then `piUnionᵢInter π S` is a π-system. -/ theorem isPiSystem_piUnionᵢInter (π : ι → Set (Set α)) (hpi : ∀ x, IsPiSystem (π x)) (S : Set ι) : IsPiSystem (piUnionᵢInter π S) := by rintro t1 ⟨p1, hp1S, f1, hf1m, ht1_eq⟩ t2 ⟨p2, hp2S, f2, hf2m, ht2_eq⟩ h_nonempty simp_rw [piUnionᵢInter, Set.mem_setOf_eq] let g n := ite (n ∈ p1) (f1 n) Set.univ ∩ ite (n ∈ p2) (f2 n) Set.univ have hp_union_ss : ↑(p1 ∪ p2) ⊆ S := by simp only [hp1S, hp2S, Finset.coe_union, union_subset_iff, and_self_iff] use p1 ∪ p2, hp_union_ss, g have h_inter_eq : t1 ∩ t2 = ⋂ i ∈ p1 ∪ p2, g i := by rw [ht1_eq, ht2_eq] simp_rw [← Set.inf_eq_inter] ext1 x simp only [inf_eq_inter, mem_inter_iff, mem_interᵢ, Finset.mem_union] refine' ⟨fun h i _ => _, fun h => ⟨fun i hi1 => _, fun i hi2 => _⟩⟩ · split_ifs with h_1 h_2 h_2 exacts[⟨h.1 i h_1, h.2 i h_2⟩, ⟨h.1 i h_1, Set.mem_univ _⟩, ⟨Set.mem_univ _, h.2 i h_2⟩, ⟨Set.mem_univ _, Set.mem_univ _⟩] · specialize h i (Or.inl hi1) rw [if_pos hi1] at h exact h.1 · specialize h i (Or.inr hi2) rw [if_pos hi2] at h exact h.2 refine' ⟨fun n hn => _, h_inter_eq⟩ simp only [] split_ifs with hn1 hn2 h · refine' hpi n (f1 n) (hf1m n hn1) (f2 n) (hf2m n hn2) (Set.nonempty_iff_ne_empty.2 fun h => _) rw [h_inter_eq] at h_nonempty suffices h_empty : (⋂ i ∈ p1 ∪ p2, g i) = ∅ exact (Set.not_nonempty_iff_eq_empty.mpr h_empty) h_nonempty refine' le_antisymm (Set.interᵢ_subset_of_subset n _) (Set.empty_subset _) refine' Set.interᵢ_subset_of_subset hn _ simp_rw [if_pos hn1, if_pos hn2] exact h.subset · simp [hf1m n hn1] · simp [hf2m n h] · exact absurd hn (by simp [hn1, h]) #align is_pi_system_pi_Union_Inter isPiSystem_piUnionᵢInter theorem piUnionᵢInter_mono_left {π π' : ι → Set (Set α)} (h_le : ∀ i, π i ⊆ π' i) (S : Set ι) : piUnionᵢInter π S ⊆ piUnionᵢInter π' S := fun _ ⟨t, ht_mem, ft, hft_mem_pi, h_eq⟩ => ⟨t, ht_mem, ft, fun x hxt => h_le x (hft_mem_pi x hxt), h_eq⟩ #align pi_Union_Inter_mono_left piUnionᵢInter_mono_left theorem piUnionᵢInter_mono_right {π : ι → Set (Set α)} {S T : Set ι} (hST : S ⊆ T) : piUnionᵢInter π S ⊆ piUnionᵢInter π T := fun _ ⟨t, ht_mem, ft, hft_mem_pi, h_eq⟩ => ⟨t, ht_mem.trans hST, ft, hft_mem_pi, h_eq⟩ #align pi_Union_Inter_mono_right piUnionᵢInter_mono_right theorem generateFrom_piUnionᵢInter_le {m : MeasurableSpace α} (π : ι → Set (Set α)) (h : ∀ n, generateFrom (π n) ≤ m) (S : Set ι) : generateFrom (piUnionᵢInter π S) ≤ m := by refine' generateFrom_le _ rintro t ⟨ht_p, _, ft, hft_mem_pi, rfl⟩ refine' Finset.measurableSet_binterᵢ _ fun x hx_mem => (h x) _ _ exact measurableSet_generateFrom (hft_mem_pi x hx_mem) #align generate_from_pi_Union_Inter_le generateFrom_piUnionᵢInter_le theorem subset_piUnionᵢInter {π : ι → Set (Set α)} {S : Set ι} {i : ι} (his : i ∈ S) : π i ⊆ piUnionᵢInter π S := by have h_ss : {i} ⊆ S := by intro j hj rw [mem_singleton_iff] at hj rwa [hj] refine' Subset.trans _ (piUnionᵢInter_mono_right h_ss) rw [piUnionᵢInter_singleton] exact subset_union_left _ _ #align subset_pi_Union_Inter subset_piUnionᵢInter theorem mem_piUnionᵢInter_of_measurableSet (m : ι → MeasurableSpace α) {S : Set ι} {i : ι} (hiS : i ∈ S) (s : Set α) (hs : MeasurableSet[m i] s) : s ∈ piUnionᵢInter (fun n => { s | MeasurableSet[m n] s }) S := subset_piUnionᵢInter hiS hs #align mem_pi_Union_Inter_of_measurable_set mem_piUnionᵢInter_of_measurableSet theorem le_generateFrom_piUnionᵢInter {π : ι → Set (Set α)} (S : Set ι) {x : ι} (hxS : x ∈ S) : generateFrom (π x) ≤ generateFrom (piUnionᵢInter π S) := generateFrom_mono (subset_piUnionᵢInter hxS) #align le_generate_from_pi_Union_Inter le_generateFrom_piUnionᵢInter theorem measurableSet_supᵢ_of_mem_piUnionᵢInter (m : ι → MeasurableSpace α) (S : Set ι) (t : Set α) (ht : t ∈ piUnionᵢInter (fun n => { s | MeasurableSet[m n] s }) S) : MeasurableSet[⨆ i ∈ S, m i] t := by rcases ht with ⟨pt, hpt, ft, ht_m, rfl⟩ refine' pt.measurableSet_binterᵢ fun i hi => _ suffices h_le : m i ≤ ⨆ i ∈ S, m i; exact h_le (ft i) (ht_m i hi) have hi' : i ∈ S := hpt hi exact le_supᵢ₂ (f := fun i (_ : i ∈ S) => m i) i hi' #align measurable_set_supr_of_mem_pi_Union_Inter measurableSet_supᵢ_of_mem_piUnionᵢInter theorem generateFrom_piUnionᵢInter_measurableSet (m : ι → MeasurableSpace α) (S : Set ι) : generateFrom (piUnionᵢInter (fun n => { s | MeasurableSet[m n] s }) S) = ⨆ i ∈ S, m i := by refine' le_antisymm _ _ · rw [← @generateFrom_measurableSet α (⨆ i ∈ S, m i)] exact generateFrom_mono (measurableSet_supᵢ_of_mem_piUnionᵢInter m S) · refine' supᵢ₂_le fun i hi => _ rw [← @generateFrom_measurableSet α (m i)] exact generateFrom_mono (mem_piUnionᵢInter_of_measurableSet m hi) #align generate_from_pi_Union_Inter_measurable_set generateFrom_piUnionᵢInter_measurableSet end UnionInter namespace MeasurableSpace variable {α : Type _} /-! ## Dynkin systems and Π-λ theorem -/ /-- A Dynkin system is a collection of subsets of a type `α` that contains the empty set, is closed under complementation and under countable union of pairwise disjoint sets. The disjointness condition is the only difference with `σ`-algebras. The main purpose of Dynkin systems is to provide a powerful induction rule for σ-algebras generated by a collection of sets which is stable under intersection. A Dynkin system is also known as a "λ-system" or a "d-system". -/ structure DynkinSystem (α : Type _) where /-- Predicate saying that a given set is contained in the Dynkin system. -/ Has : Set α → Prop /-- A Dynkin system contains the empty set. -/ has_empty : Has ∅ /-- A Dynkin system is closed under complementation. -/ has_compl : ∀ {a}, Has a → Has (aᶜ) /-- A Dynkin system is closed under countable union of pairwise disjoint sets. Use a more general `MeasurableSpace.DynkinSystem.has_unionᵢ` instead.-/ has_unionᵢ_nat : ∀ {f : ℕ → Set α}, Pairwise (Disjoint on f) → (∀ i, Has (f i)) → Has (⋃ i, f i) #align measurable_space.dynkin_system MeasurableSpace.DynkinSystem namespace DynkinSystem @[ext] theorem ext : ∀ {d₁ d₂ : DynkinSystem α}, (∀ s : Set α, d₁.Has s ↔ d₂.Has s) → d₁ = d₂ | ⟨s₁, _, _, _⟩, ⟨s₂, _, _, _⟩, h => by have : s₁ = s₂ := funext fun x => propext <| h x subst this rfl #align measurable_space.dynkin_system.ext MeasurableSpace.DynkinSystem.ext variable (d : DynkinSystem α) theorem has_compl_iff {a} : d.Has (aᶜ) ↔ d.Has a := ⟨fun h => by simpa using d.has_compl h, fun h => d.has_compl h⟩ #align measurable_space.dynkin_system.has_compl_iff MeasurableSpace.DynkinSystem.has_compl_iff theorem has_univ : d.Has univ := by simpa using d.has_compl d.has_empty #align measurable_space.dynkin_system.has_univ MeasurableSpace.DynkinSystem.has_univ theorem has_unionᵢ {β} [Countable β] {f : β → Set α} (hd : Pairwise (Disjoint on f)) (h : ∀ i, d.Has (f i)) : d.Has (⋃ i, f i) := by cases nonempty_encodable β rw [← Encodable.unionᵢ_decode₂] exact d.has_unionᵢ_nat (Encodable.unionᵢ_decode₂_disjoint_on hd) fun n => Encodable.unionᵢ_decode₂_cases d.has_empty h #align measurable_space.dynkin_system.has_Union MeasurableSpace.DynkinSystem.has_unionᵢ theorem has_union {s₁ s₂ : Set α} (h₁ : d.Has s₁) (h₂ : d.Has s₂) (h : Disjoint s₁ s₂) : d.Has (s₁ ∪ s₂) := by rw [union_eq_unionᵢ] exact d.has_unionᵢ (pairwise_disjoint_on_bool.2 h) (Bool.forall_bool.2 ⟨h₂, h₁⟩) #align measurable_space.dynkin_system.has_union MeasurableSpace.DynkinSystem.has_union theorem has_diff {s₁ s₂ : Set α} (h₁ : d.Has s₁) (h₂ : d.Has s₂) (h : s₂ ⊆ s₁) : d.Has (s₁ \ s₂) := by apply d.has_compl_iff.1 simp [diff_eq, compl_inter] exact d.has_union (d.has_compl h₁) h₂ (disjoint_compl_left.mono_right h) #align measurable_space.dynkin_system.has_diff MeasurableSpace.DynkinSystem.has_diff instance : LE (DynkinSystem α) where le m₁ m₂ := m₁.Has ≤ m₂.Has theorem le_def {α} {a b : DynkinSystem α} : a ≤ b ↔ a.Has ≤ b.Has := Iff.rfl #align measurable_space.dynkin_system.le_def MeasurableSpace.DynkinSystem.le_def instance : PartialOrder (DynkinSystem α) := { DynkinSystem.instLEDynkinSystem with le_refl := fun a b => le_rfl le_trans := fun a b c hab hbc => le_def.mpr (le_trans hab hbc) le_antisymm := fun a b h₁ h₂ => ext fun s => ⟨h₁ s, h₂ s⟩ } /-- Every measurable space (σ-algebra) forms a Dynkin system -/ def ofMeasurableSpace (m : MeasurableSpace α) : DynkinSystem α where Has := m.MeasurableSet' has_empty := m.measurableSet_empty has_compl {a} := m.measurableSet_compl a has_unionᵢ_nat {f} _ hf := m.measurableSet_unionᵢ f hf #align measurable_space.dynkin_system.of_measurable_space MeasurableSpace.DynkinSystem.ofMeasurableSpace theorem ofMeasurableSpace_le_ofMeasurableSpace_iff {m₁ m₂ : MeasurableSpace α} : ofMeasurableSpace m₁ ≤ ofMeasurableSpace m₂ ↔ m₁ ≤ m₂ := Iff.rfl #align measurable_space.dynkin_system.of_measurable_space_le_of_measurable_space_iff MeasurableSpace.DynkinSystem.ofMeasurableSpace_le_ofMeasurableSpace_iff /-- The least Dynkin system containing a collection of basic sets. This inductive type gives the underlying collection of sets. -/ inductive GenerateHas (s : Set (Set α)) : Set α → Prop | basic : ∀ t ∈ s, GenerateHas s t | empty : GenerateHas s ∅ | compl : ∀ {a}, GenerateHas s a → GenerateHas s (aᶜ) | unionᵢ : ∀ {f : ℕ → Set α}, Pairwise (Disjoint on f) → (∀ i, GenerateHas s (f i)) → GenerateHas s (⋃ i, f i) #align measurable_space.dynkin_system.generate_has MeasurableSpace.DynkinSystem.GenerateHas theorem generateHas_compl {C : Set (Set α)} {s : Set α} : GenerateHas C (sᶜ) ↔ GenerateHas C s := by refine' ⟨_, GenerateHas.compl⟩ intro h convert GenerateHas.compl h simp #align measurable_space.dynkin_system.generate_has_compl MeasurableSpace.DynkinSystem.generateHas_compl /-- The least Dynkin system containing a collection of basic sets. -/ def generate (s : Set (Set α)) : DynkinSystem α where Has := GenerateHas s has_empty := GenerateHas.empty has_compl {_} := GenerateHas.compl has_unionᵢ_nat {_} := GenerateHas.unionᵢ #align measurable_space.dynkin_system.generate MeasurableSpace.DynkinSystem.generate theorem generateHas_def {C : Set (Set α)} : (generate C).Has = GenerateHas C := rfl #align measurable_space.dynkin_system.generate_has_def MeasurableSpace.DynkinSystem.generateHas_def instance : Inhabited (DynkinSystem α) := ⟨generate univ⟩ /-- If a Dynkin system is closed under binary intersection, then it forms a `σ`-algebra. -/ def toMeasurableSpace (h_inter : ∀ s₁ s₂, d.Has s₁ → d.Has s₂ → d.Has (s₁ ∩ s₂)) : MeasurableSpace α where MeasurableSet' := d.Has measurableSet_empty := d.has_empty measurableSet_compl s h := d.has_compl h measurableSet_unionᵢ f hf := by rw [← unionᵢ_disjointed] exact d.has_unionᵢ (disjoint_disjointed _) fun n => disjointedRec (fun (t : Set α) i h => h_inter _ _ h <| d.has_compl <| hf i) (hf n) #align measurable_space.dynkin_system.to_measurable_space MeasurableSpace.DynkinSystem.toMeasurableSpace theorem ofMeasurableSpace_toMeasurableSpace (h_inter : ∀ s₁ s₂, d.Has s₁ → d.Has s₂ → d.Has (s₁ ∩ s₂)) : ofMeasurableSpace (d.toMeasurableSpace h_inter) = d := ext fun _ => Iff.rfl #align measurable_space.dynkin_system.of_measurable_space_to_measurable_space MeasurableSpace.DynkinSystem.ofMeasurableSpace_toMeasurableSpace /-- If `s` is in a Dynkin system `d`, we can form the new Dynkin system `{s ∩ t | t ∈ d}`. -/ def restrictOn {s : Set α} (h : d.Has s) : DynkinSystem α where -- Porting note: `simp only []` required for a beta reduction Has t := d.Has (t ∩ s) has_empty := by simp [d.has_empty] has_compl {t} hts := by simp only [] have : tᶜ ∩ s = (t ∩ s)ᶜ \ sᶜ := Set.ext fun x => by by_cases h : x ∈ s <;> simp [h] rw [this] exact d.has_diff (d.has_compl hts) (d.has_compl h) (compl_subset_compl.mpr <| inter_subset_right _ _) has_unionᵢ_nat {f} hd hf := by simp only [] rw [unionᵢ_inter] refine' d.has_unionᵢ_nat _ hf exact hd.mono fun i j => Disjoint.mono (inter_subset_left _ _) (inter_subset_left _ _) #align measurable_space.dynkin_system.restrict_on MeasurableSpace.DynkinSystem.restrictOn theorem generate_le {s : Set (Set α)} (h : ∀ t ∈ s, d.Has t) : generate s ≤ d := fun _ ht => ht.recOn h d.has_empty (fun {_} _ h => d.has_compl h) fun {_} hd _ hf => d.has_unionᵢ hd hf #align measurable_space.dynkin_system.generate_le MeasurableSpace.DynkinSystem.generate_le theorem generate_has_subset_generate_measurable {C : Set (Set α)} {s : Set α} (hs : (generate C).Has s) : MeasurableSet[generateFrom C] s := generate_le (ofMeasurableSpace (generateFrom C)) (fun _ => measurableSet_generateFrom) s hs #align measurable_space.dynkin_system.generate_has_subset_generate_measurable MeasurableSpace.DynkinSystem.generate_has_subset_generate_measurable theorem generate_inter {s : Set (Set α)} (hs : IsPiSystem s) {t₁ t₂ : Set α} (ht₁ : (generate s).Has t₁) (ht₂ : (generate s).Has t₂) : (generate s).Has (t₁ ∩ t₂) := have : generate s ≤ (generate s).restrictOn ht₂ := generate_le _ fun s₁ hs₁ => have : (generate s).Has s₁ := GenerateHas.basic s₁ hs₁ have : generate s ≤ (generate s).restrictOn this := generate_le _ fun s₂ hs₂ => show (generate s).Has (s₂ ∩ s₁) from (s₂ ∩ s₁).eq_empty_or_nonempty.elim (fun h => h.symm ▸ GenerateHas.empty) fun h => GenerateHas.basic _ <| hs _ hs₂ _ hs₁ h have : (generate s).Has (t₂ ∩ s₁) := this _ ht₂ show (generate s).Has (s₁ ∩ t₂) by rwa [inter_comm] this _ ht₁ #align measurable_space.dynkin_system.generate_inter MeasurableSpace.DynkinSystem.generate_inter /-- **Dynkin's π-λ theorem**: Given a collection of sets closed under binary intersections, then the Dynkin system it generates is equal to the σ-algebra it generates. This result is known as the π-λ theorem. A collection of sets closed under binary intersection is called a π-system (often requiring additionnally that is is non-empty, but we drop this condition in the formalization). -/ theorem generateFrom_eq {s : Set (Set α)} (hs : IsPiSystem s) : generateFrom s = (generate s).toMeasurableSpace fun t₁ t₂ => generate_inter hs := le_antisymm (generateFrom_le fun t ht => GenerateHas.basic t ht) (ofMeasurableSpace_le_ofMeasurableSpace_iff.mp <| by rw [ofMeasurableSpace_toMeasurableSpace] exact generate_le _ fun t ht => measurableSet_generateFrom ht) #align measurable_space.dynkin_system.generate_from_eq MeasurableSpace.DynkinSystem.generateFrom_eq end DynkinSystem theorem induction_on_inter {C : Set α → Prop} {s : Set (Set α)} [m : MeasurableSpace α] (h_eq : m = generateFrom s) (h_inter : IsPiSystem s) (h_empty : C ∅) (h_basic : ∀ t ∈ s, C t) (h_compl : ∀ t, MeasurableSet t → C t → C (tᶜ)) (h_union : ∀ f : ℕ → Set α, Pairwise (Disjoint on f) → (∀ i, MeasurableSet (f i)) → (∀ i, C (f i)) → C (⋃ i, f i)) : ∀ ⦃t⦄, MeasurableSet t → C t := have eq : MeasurableSet = DynkinSystem.GenerateHas s := by rw [h_eq, DynkinSystem.generateFrom_eq h_inter] rfl fun t ht => have : DynkinSystem.GenerateHas s t := by rwa [eq] at ht this.recOn h_basic h_empty (fun {t} ht => h_compl t <| by rw [eq] exact ht) fun {f} hf ht => h_union f hf fun i => by rw [eq] exact ht _ #align measurable_space.induction_on_inter MeasurableSpace.induction_on_inter end MeasurableSpace
import .A2_disc open A2_disc open is_ring_hom lemma power_commute_with_morph {A B :Type}[comm_ring A][comm_ring B](f : A → B)[is_ring_hom f](n : ℕ) : ∀ x : A, f( x^n ) = (f x)^n := λ x, nat.rec_on n (show f(x^0) = (f x)^0, {rw [pow_zero x,pow_zero (f x)], exact map_one f,}) (assume n, assume rec_hyp : f(x^n) = (f(x))^n, show f(x^(n+1)) = (f(x))^(n+1),{rw [pow_succ x n,pow_succ (f(x)) n,← rec_hyp],exact map_mul (f)}) structure X (R : Type)[comm_ring R] := (x y : R) (inv : R) (certif : (x-y)^2 * inv = 1) namespace X section variables {R : Type} [comm_ring R] lemma diec_certif : ∀ {ζ1 ζ2 : X R}, (ζ1.x = ζ2.x) → (ζ1.y = ζ2.y) → (ζ1.x - ζ1.y)^2 = (ζ2.x - ζ2.y)^2 := begin intros ζ1 ζ2, intros h1 h2, rw [h1,h2], end @[ext] lemma ext : ∀ {ζ1 ζ2 : X R}, (ζ1.x = ζ2.x) → (ζ1.y = ζ2.y) → ζ1 = ζ2 := λ ζ1 ζ2, begin intro hx, intro hy, cases ζ1, cases ζ2, congr; try {assumption}, apply A2_disc.inverse_unique, exact ζ1_certif, exact ζ2_certif, exact diec_certif hx hy, end def map_X {A B :Type }[comm_ring A][comm_ring B](f : A → B)[is_ring_hom f] : X A → X B := λ η, begin exact {x := f η.x, y := f η.y, inv := f η.inv,certif := begin rw [← map_sub f,← power_commute_with_morph f,← map_mul f,η.certif], exact map_one f, end } end lemma map_comp_x {A B :Type }[comm_ring A][comm_ring B](f : A → B)[is_ring_hom f] (ζ : X (A) ) : (map_X f ζ).x = f ζ.x := rfl lemma map_comp_y {A B :Type }[comm_ring A][comm_ring B](f : A → B)[is_ring_hom f] (ζ : X (A) ) : (map_X f ζ).y = f ζ.y := rfl lemma map_comp_inv {A B :Type }[comm_ring A][comm_ring B](f : A → B)[is_ring_hom f] (ζ : X (A) ) : (map_X f ζ).inv = f ζ.inv := rfl def 𝕏 : CommRing ⥤ Type := { obj := λ R, X R, map := λ R R' f, map_X f, } end #print 𝕏 end X
lemma mul_one (m : mynat) : m * 1 = m := begin rw one_eq_succ_zero, rw mul_succ, rw mul_zero, rw zero_add, refl, end
for i in [10, 9 .. 0] do Print(i, "\n"); od;
[GOAL] p : ℕ q : ℚ hq : q ≠ 0 ⊢ padicNorm p q = ↑p ^ (-padicValRat p q) [PROOFSTEP] simp [hq, padicNorm] [GOAL] p : ℕ q : ℚ hq : q = 0 ⊢ 0 ≤ padicNorm p q [PROOFSTEP] simp [hq, padicNorm] [GOAL] p : ℕ q : ℚ hq : ¬q = 0 ⊢ 0 ≤ padicNorm p q [PROOFSTEP] unfold padicNorm [GOAL] p : ℕ q : ℚ hq : ¬q = 0 ⊢ 0 ≤ if q = 0 then 0 else ↑p ^ (-padicValRat p q) [PROOFSTEP] split_ifs [GOAL] p : ℕ q : ℚ hq : ¬q = 0 ⊢ 0 ≤ ↑p ^ (-padicValRat p q) [PROOFSTEP] apply zpow_nonneg [GOAL] case ha p : ℕ q : ℚ hq : ¬q = 0 ⊢ 0 ≤ ↑p [PROOFSTEP] exact_mod_cast Nat.zero_le _ [GOAL] p : ℕ ⊢ padicNorm p 0 = 0 [PROOFSTEP] simp [padicNorm] [GOAL] p : ℕ ⊢ padicNorm p 1 = 1 [PROOFSTEP] simp [padicNorm] [GOAL] p : ℕ hp : 1 < p ⊢ padicNorm p ↑p = (↑p)⁻¹ [PROOFSTEP] simp [padicNorm, (pos_of_gt hp).ne', padicValNat.self hp] [GOAL] p q : ℕ p_prime : Fact (Nat.Prime p) q_prime : Fact (Nat.Prime q) neq : p ≠ q ⊢ padicNorm p ↑q = 1 [PROOFSTEP] have p : padicValRat p q = 0 := by exact_mod_cast padicValNat_primes neq [GOAL] p q : ℕ p_prime : Fact (Nat.Prime p) q_prime : Fact (Nat.Prime q) neq : p ≠ q ⊢ padicValRat p ↑q = 0 [PROOFSTEP] exact_mod_cast padicValNat_primes neq [GOAL] p✝ q : ℕ p_prime : Fact (Nat.Prime p✝) q_prime : Fact (Nat.Prime q) neq : p✝ ≠ q p : padicValRat p✝ ↑q = 0 ⊢ padicNorm p✝ ↑q = 1 [PROOFSTEP] rw [padicNorm, p] [GOAL] p✝ q : ℕ p_prime : Fact (Nat.Prime p✝) q_prime : Fact (Nat.Prime q) neq : p✝ ≠ q p : padicValRat p✝ ↑q = 0 ⊢ (if ↑q = 0 then 0 else ↑p✝ ^ (-0)) = 1 [PROOFSTEP] simp [q_prime.1.ne_zero] [GOAL] p : ℕ hp : 1 < p ⊢ padicNorm p ↑p < 1 [PROOFSTEP] rw [padicNorm_p hp, inv_lt_one_iff] [GOAL] p : ℕ hp : 1 < p ⊢ ↑p ≤ 0 ∨ 1 < ↑p [PROOFSTEP] exact_mod_cast Or.inr hp [GOAL] p : ℕ q : ℚ hq : q ≠ 0 ⊢ padicNorm p q = ↑p ^ (-padicValRat p q) [PROOFSTEP] simp [padicNorm, hq] [GOAL] p : ℕ q : ℚ hq : q = 0 ⊢ padicNorm p (-q) = padicNorm p q [PROOFSTEP] simp [hq] [GOAL] p : ℕ q : ℚ hq : ¬q = 0 ⊢ padicNorm p (-q) = padicNorm p q [PROOFSTEP] simp [padicNorm, hq] [GOAL] p : ℕ hp : Fact (Nat.Prime p) q : ℚ hq : q ≠ 0 ⊢ padicNorm p q ≠ 0 [PROOFSTEP] rw [padicNorm.eq_zpow_of_nonzero hq] [GOAL] p : ℕ hp : Fact (Nat.Prime p) q : ℚ hq : q ≠ 0 ⊢ ↑p ^ (-padicValRat p q) ≠ 0 [PROOFSTEP] apply zpow_ne_zero_of_ne_zero [GOAL] case ha p : ℕ hp : Fact (Nat.Prime p) q : ℚ hq : q ≠ 0 ⊢ ↑p ≠ 0 [PROOFSTEP] exact_mod_cast ne_of_gt hp.1.pos [GOAL] p : ℕ hp : Fact (Nat.Prime p) q : ℚ h : padicNorm p q = 0 ⊢ q = 0 [PROOFSTEP] apply by_contradiction [GOAL] case a p : ℕ hp : Fact (Nat.Prime p) q : ℚ h : padicNorm p q = 0 ⊢ ¬q = 0 → False [PROOFSTEP] intro hq [GOAL] case a p : ℕ hp : Fact (Nat.Prime p) q : ℚ h : padicNorm p q = 0 hq : ¬q = 0 ⊢ False [PROOFSTEP] unfold padicNorm at h [GOAL] case a p : ℕ hp : Fact (Nat.Prime p) q : ℚ h : (if q = 0 then 0 else ↑p ^ (-padicValRat p q)) = 0 hq : ¬q = 0 ⊢ False [PROOFSTEP] rw [if_neg hq] at h [GOAL] case a p : ℕ hp : Fact (Nat.Prime p) q : ℚ h : ↑p ^ (-padicValRat p q) = 0 hq : ¬q = 0 ⊢ False [PROOFSTEP] apply absurd h [GOAL] case a p : ℕ hp : Fact (Nat.Prime p) q : ℚ h : ↑p ^ (-padicValRat p q) = 0 hq : ¬q = 0 ⊢ ¬↑p ^ (-padicValRat p q) = 0 [PROOFSTEP] apply zpow_ne_zero_of_ne_zero [GOAL] case a.ha p : ℕ hp : Fact (Nat.Prime p) q : ℚ h : ↑p ^ (-padicValRat p q) = 0 hq : ¬q = 0 ⊢ ↑p ≠ 0 [PROOFSTEP] exact_mod_cast hp.1.ne_zero [GOAL] p : ℕ hp : Fact (Nat.Prime p) q r : ℚ hq : q = 0 ⊢ padicNorm p (q * r) = padicNorm p q * padicNorm p r [PROOFSTEP] simp [hq] [GOAL] p : ℕ hp : Fact (Nat.Prime p) q r : ℚ hq : ¬q = 0 hr : r = 0 ⊢ padicNorm p (q * r) = padicNorm p q * padicNorm p r [PROOFSTEP] simp [hr] [GOAL] p : ℕ hp : Fact (Nat.Prime p) q r : ℚ hq : ¬q = 0 hr : ¬r = 0 ⊢ padicNorm p (q * r) = padicNorm p q * padicNorm p r [PROOFSTEP] have : (p : ℚ) ≠ 0 := by simp [hp.1.ne_zero] [GOAL] p : ℕ hp : Fact (Nat.Prime p) q r : ℚ hq : ¬q = 0 hr : ¬r = 0 ⊢ ↑p ≠ 0 [PROOFSTEP] simp [hp.1.ne_zero] [GOAL] p : ℕ hp : Fact (Nat.Prime p) q r : ℚ hq : ¬q = 0 hr : ¬r = 0 this : ↑p ≠ 0 ⊢ padicNorm p (q * r) = padicNorm p q * padicNorm p r [PROOFSTEP] simp [padicNorm, *, padicValRat.mul, zpow_add₀ this, mul_comm] [GOAL] p : ℕ hp : Fact (Nat.Prime p) q r : ℚ hr : r = 0 ⊢ padicNorm p (q / r) = padicNorm p q / padicNorm p r [PROOFSTEP] simp [hr] [GOAL] p : ℕ hp : Fact (Nat.Prime p) q r : ℚ hr : ¬r = 0 ⊢ padicNorm p (q / r) * padicNorm p r = padicNorm p q [PROOFSTEP] rw [← padicNorm.mul, div_mul_cancel _ hr] [GOAL] p : ℕ hp : Fact (Nat.Prime p) z : ℤ hz : z = 0 ⊢ padicNorm p ↑z ≤ 1 [PROOFSTEP] simp [hz, zero_le_one] [GOAL] p : ℕ hp : Fact (Nat.Prime p) z : ℤ hz : ¬z = 0 ⊢ padicNorm p ↑z ≤ 1 [PROOFSTEP] unfold padicNorm [GOAL] p : ℕ hp : Fact (Nat.Prime p) z : ℤ hz : ¬z = 0 ⊢ (if ↑z = 0 then 0 else ↑p ^ (-padicValRat p ↑z)) ≤ 1 [PROOFSTEP] rw [if_neg _] [GOAL] p : ℕ hp : Fact (Nat.Prime p) z : ℤ hz : ¬z = 0 ⊢ ↑p ^ (-padicValRat p ↑z) ≤ 1 [PROOFSTEP] refine' zpow_le_one_of_nonpos _ _ [GOAL] case refine'_1 p : ℕ hp : Fact (Nat.Prime p) z : ℤ hz : ¬z = 0 ⊢ 1 ≤ ↑p [PROOFSTEP] exact_mod_cast le_of_lt hp.1.one_lt [GOAL] case refine'_2 p : ℕ hp : Fact (Nat.Prime p) z : ℤ hz : ¬z = 0 ⊢ -padicValRat p ↑z ≤ 0 [PROOFSTEP] rw [padicValRat.of_int, neg_nonpos] [GOAL] case refine'_2 p : ℕ hp : Fact (Nat.Prime p) z : ℤ hz : ¬z = 0 ⊢ 0 ≤ ↑(padicValInt p z) [PROOFSTEP] norm_cast [GOAL] case refine'_2 p : ℕ hp : Fact (Nat.Prime p) z : ℤ hz : ¬z = 0 ⊢ 0 ≤ padicValInt p z [PROOFSTEP] simp [GOAL] p : ℕ hp : Fact (Nat.Prime p) z : ℤ hz : ¬z = 0 ⊢ ¬↑z = 0 [PROOFSTEP] exact_mod_cast hz [GOAL] p : ℕ hp : Fact (Nat.Prime p) q r : ℚ h : padicValRat p q ≤ padicValRat p r hnqp : padicNorm p q ≥ 0 hnrp : padicNorm p r ≥ 0 hq : q = 0 ⊢ padicNorm p (q + r) ≤ max (padicNorm p q) (padicNorm p r) [PROOFSTEP] simp [hq, max_eq_right hnrp, le_max_right] [GOAL] p : ℕ hp : Fact (Nat.Prime p) q r : ℚ h : padicValRat p q ≤ padicValRat p r hnqp : padicNorm p q ≥ 0 hnrp : padicNorm p r ≥ 0 hq : ¬q = 0 hr : r = 0 ⊢ padicNorm p (q + r) ≤ max (padicNorm p q) (padicNorm p r) [PROOFSTEP] simp [hr, max_eq_left hnqp, le_max_left] [GOAL] p : ℕ hp : Fact (Nat.Prime p) q r : ℚ h : padicValRat p q ≤ padicValRat p r hnqp : padicNorm p q ≥ 0 hnrp : padicNorm p r ≥ 0 hq : ¬q = 0 hr : ¬r = 0 hqr : q + r = 0 ⊢ padicNorm p (q + r) ≤ padicNorm p q [PROOFSTEP] simpa [hqr] using hnqp [GOAL] p : ℕ hp : Fact (Nat.Prime p) q r : ℚ h : padicValRat p q ≤ padicValRat p r hnqp : padicNorm p q ≥ 0 hnrp : padicNorm p r ≥ 0 hq : ¬q = 0 hr : ¬r = 0 hqr : ¬q + r = 0 ⊢ padicNorm p (q + r) ≤ max (padicNorm p q) (padicNorm p r) [PROOFSTEP] unfold padicNorm [GOAL] p : ℕ hp : Fact (Nat.Prime p) q r : ℚ h : padicValRat p q ≤ padicValRat p r hnqp : padicNorm p q ≥ 0 hnrp : padicNorm p r ≥ 0 hq : ¬q = 0 hr : ¬r = 0 hqr : ¬q + r = 0 ⊢ (if q + r = 0 then 0 else ↑p ^ (-padicValRat p (q + r))) ≤ max (if q = 0 then 0 else ↑p ^ (-padicValRat p q)) (if r = 0 then 0 else ↑p ^ (-padicValRat p r)) [PROOFSTEP] split_ifs [GOAL] p : ℕ hp : Fact (Nat.Prime p) q r : ℚ h : padicValRat p q ≤ padicValRat p r hnqp : padicNorm p q ≥ 0 hnrp : padicNorm p r ≥ 0 hq : ¬q = 0 hr : ¬r = 0 hqr : ¬q + r = 0 ⊢ ↑p ^ (-padicValRat p (q + r)) ≤ max (↑p ^ (-padicValRat p q)) (↑p ^ (-padicValRat p r)) [PROOFSTEP] apply le_max_iff.2 [GOAL] p : ℕ hp : Fact (Nat.Prime p) q r : ℚ h : padicValRat p q ≤ padicValRat p r hnqp : padicNorm p q ≥ 0 hnrp : padicNorm p r ≥ 0 hq : ¬q = 0 hr : ¬r = 0 hqr : ¬q + r = 0 ⊢ ↑p ^ (-padicValRat p (q + r)) ≤ ↑p ^ (-padicValRat p q) ∨ ↑p ^ (-padicValRat p (q + r)) ≤ ↑p ^ (-padicValRat p r) [PROOFSTEP] left [GOAL] case h p : ℕ hp : Fact (Nat.Prime p) q r : ℚ h : padicValRat p q ≤ padicValRat p r hnqp : padicNorm p q ≥ 0 hnrp : padicNorm p r ≥ 0 hq : ¬q = 0 hr : ¬r = 0 hqr : ¬q + r = 0 ⊢ ↑p ^ (-padicValRat p (q + r)) ≤ ↑p ^ (-padicValRat p q) [PROOFSTEP] apply zpow_le_of_le [GOAL] case h.ha p : ℕ hp : Fact (Nat.Prime p) q r : ℚ h : padicValRat p q ≤ padicValRat p r hnqp : padicNorm p q ≥ 0 hnrp : padicNorm p r ≥ 0 hq : ¬q = 0 hr : ¬r = 0 hqr : ¬q + r = 0 ⊢ 1 ≤ ↑p [PROOFSTEP] exact_mod_cast le_of_lt hp.1.one_lt [GOAL] case h.h p : ℕ hp : Fact (Nat.Prime p) q r : ℚ h : padicValRat p q ≤ padicValRat p r hnqp : padicNorm p q ≥ 0 hnrp : padicNorm p r ≥ 0 hq : ¬q = 0 hr : ¬r = 0 hqr : ¬q + r = 0 ⊢ -padicValRat p (q + r) ≤ -padicValRat p q [PROOFSTEP] apply neg_le_neg [GOAL] case h.h.a p : ℕ hp : Fact (Nat.Prime p) q r : ℚ h : padicValRat p q ≤ padicValRat p r hnqp : padicNorm p q ≥ 0 hnrp : padicNorm p r ≥ 0 hq : ¬q = 0 hr : ¬r = 0 hqr : ¬q + r = 0 ⊢ padicValRat p q ≤ padicValRat p (q + r) [PROOFSTEP] have : padicValRat p q = min (padicValRat p q) (padicValRat p r) := (min_eq_left h).symm [GOAL] case h.h.a p : ℕ hp : Fact (Nat.Prime p) q r : ℚ h : padicValRat p q ≤ padicValRat p r hnqp : padicNorm p q ≥ 0 hnrp : padicNorm p r ≥ 0 hq : ¬q = 0 hr : ¬r = 0 hqr : ¬q + r = 0 this : padicValRat p q = min (padicValRat p q) (padicValRat p r) ⊢ padicValRat p q ≤ padicValRat p (q + r) [PROOFSTEP] rw [this] [GOAL] case h.h.a p : ℕ hp : Fact (Nat.Prime p) q r : ℚ h : padicValRat p q ≤ padicValRat p r hnqp : padicNorm p q ≥ 0 hnrp : padicNorm p r ≥ 0 hq : ¬q = 0 hr : ¬r = 0 hqr : ¬q + r = 0 this : padicValRat p q = min (padicValRat p q) (padicValRat p r) ⊢ min (padicValRat p q) (padicValRat p r) ≤ padicValRat p (q + r) [PROOFSTEP] exact min_le_padicValRat_add hqr [GOAL] p : ℕ hp : Fact (Nat.Prime p) q r : ℚ ⊢ padicNorm p (q + r) ≤ max (padicNorm p q) (padicNorm p r) [PROOFSTEP] wlog hle : padicValRat p q ≤ padicValRat p r generalizing q r [GOAL] case inr p : ℕ hp : Fact (Nat.Prime p) q r : ℚ this : ∀ {q r : ℚ}, padicValRat p q ≤ padicValRat p r → padicNorm p (q + r) ≤ max (padicNorm p q) (padicNorm p r) hle : ¬padicValRat p q ≤ padicValRat p r ⊢ padicNorm p (q + r) ≤ max (padicNorm p q) (padicNorm p r) [PROOFSTEP] rw [add_comm, max_comm] [GOAL] case inr p : ℕ hp : Fact (Nat.Prime p) q r : ℚ this : ∀ {q r : ℚ}, padicValRat p q ≤ padicValRat p r → padicNorm p (q + r) ≤ max (padicNorm p q) (padicNorm p r) hle : ¬padicValRat p q ≤ padicValRat p r ⊢ padicNorm p (r + q) ≤ max (padicNorm p r) (padicNorm p q) [PROOFSTEP] exact this (le_of_not_le hle) [GOAL] p : ℕ hp : Fact (Nat.Prime p) q r : ℚ hle : padicValRat p q ≤ padicValRat p r ⊢ padicNorm p (q + r) ≤ max (padicNorm p q) (padicNorm p r) [PROOFSTEP] exact nonarchimedean_aux hle [GOAL] p : ℕ hp : Fact (Nat.Prime p) q r : ℚ ⊢ padicNorm p (q - r) ≤ max (padicNorm p q) (padicNorm p r) [PROOFSTEP] rw [sub_eq_add_neg, ← padicNorm.neg r] [GOAL] p : ℕ hp : Fact (Nat.Prime p) q r : ℚ ⊢ padicNorm p (q + -r) ≤ max (padicNorm p q) (padicNorm p (-r)) [PROOFSTEP] exact padicNorm.nonarchimedean [GOAL] p : ℕ hp : Fact (Nat.Prime p) q r : ℚ hne : padicNorm p q ≠ padicNorm p r ⊢ padicNorm p (q + r) = max (padicNorm p q) (padicNorm p r) [PROOFSTEP] wlog hlt : padicNorm p r < padicNorm p q [GOAL] case inr p : ℕ hp : Fact (Nat.Prime p) q r : ℚ hne : padicNorm p q ≠ padicNorm p r this : ∀ {p : ℕ} [hp : Fact (Nat.Prime p)] {q r : ℚ}, padicNorm p q ≠ padicNorm p r → padicNorm p r < padicNorm p q → padicNorm p (q + r) = max (padicNorm p q) (padicNorm p r) hlt : ¬padicNorm p r < padicNorm p q ⊢ padicNorm p (q + r) = max (padicNorm p q) (padicNorm p r) [PROOFSTEP] rw [add_comm, max_comm] [GOAL] case inr p : ℕ hp : Fact (Nat.Prime p) q r : ℚ hne : padicNorm p q ≠ padicNorm p r this : ∀ {p : ℕ} [hp : Fact (Nat.Prime p)] {q r : ℚ}, padicNorm p q ≠ padicNorm p r → padicNorm p r < padicNorm p q → padicNorm p (q + r) = max (padicNorm p q) (padicNorm p r) hlt : ¬padicNorm p r < padicNorm p q ⊢ padicNorm p (r + q) = max (padicNorm p r) (padicNorm p q) [PROOFSTEP] exact this hne.symm (hne.lt_or_lt.resolve_right hlt) [GOAL] p✝ p : ℕ hp : Fact (Nat.Prime p) q r : ℚ hne : padicNorm p q ≠ padicNorm p r hlt : padicNorm p r < padicNorm p q ⊢ padicNorm p (q + r) = max (padicNorm p q) (padicNorm p r) [PROOFSTEP] have : padicNorm p q ≤ max (padicNorm p (q + r)) (padicNorm p r) := calc padicNorm p q = padicNorm p (q + r + (-r)) := by ring_nf _ ≤ max (padicNorm p (q + r)) (padicNorm p (-r)) := padicNorm.nonarchimedean _ = max (padicNorm p (q + r)) (padicNorm p r) := by simp [GOAL] p✝ p : ℕ hp : Fact (Nat.Prime p) q r : ℚ hne : padicNorm p q ≠ padicNorm p r hlt : padicNorm p r < padicNorm p q ⊢ padicNorm p q = padicNorm p (q + r + -r) [PROOFSTEP] ring_nf [GOAL] p✝ p : ℕ hp : Fact (Nat.Prime p) q r : ℚ hne : padicNorm p q ≠ padicNorm p r hlt : padicNorm p r < padicNorm p q ⊢ max (padicNorm p (q + r)) (padicNorm p (-r)) = max (padicNorm p (q + r)) (padicNorm p r) [PROOFSTEP] simp [GOAL] p✝ p : ℕ hp : Fact (Nat.Prime p) q r : ℚ hne : padicNorm p q ≠ padicNorm p r hlt : padicNorm p r < padicNorm p q this : padicNorm p q ≤ max (padicNorm p (q + r)) (padicNorm p r) ⊢ padicNorm p (q + r) = max (padicNorm p q) (padicNorm p r) [PROOFSTEP] have hnge : padicNorm p r ≤ padicNorm p (q + r) := by apply le_of_not_gt intro hgt rw [max_eq_right_of_lt hgt] at this exact not_lt_of_ge this hlt [GOAL] p✝ p : ℕ hp : Fact (Nat.Prime p) q r : ℚ hne : padicNorm p q ≠ padicNorm p r hlt : padicNorm p r < padicNorm p q this : padicNorm p q ≤ max (padicNorm p (q + r)) (padicNorm p r) ⊢ padicNorm p r ≤ padicNorm p (q + r) [PROOFSTEP] apply le_of_not_gt [GOAL] case a p✝ p : ℕ hp : Fact (Nat.Prime p) q r : ℚ hne : padicNorm p q ≠ padicNorm p r hlt : padicNorm p r < padicNorm p q this : padicNorm p q ≤ max (padicNorm p (q + r)) (padicNorm p r) ⊢ ¬padicNorm p r > padicNorm p (q + r) [PROOFSTEP] intro hgt [GOAL] case a p✝ p : ℕ hp : Fact (Nat.Prime p) q r : ℚ hne : padicNorm p q ≠ padicNorm p r hlt : padicNorm p r < padicNorm p q this : padicNorm p q ≤ max (padicNorm p (q + r)) (padicNorm p r) hgt : padicNorm p r > padicNorm p (q + r) ⊢ False [PROOFSTEP] rw [max_eq_right_of_lt hgt] at this [GOAL] case a p✝ p : ℕ hp : Fact (Nat.Prime p) q r : ℚ hne : padicNorm p q ≠ padicNorm p r hlt : padicNorm p r < padicNorm p q this : padicNorm p q ≤ padicNorm p r hgt : padicNorm p r > padicNorm p (q + r) ⊢ False [PROOFSTEP] exact not_lt_of_ge this hlt [GOAL] p✝ p : ℕ hp : Fact (Nat.Prime p) q r : ℚ hne : padicNorm p q ≠ padicNorm p r hlt : padicNorm p r < padicNorm p q this : padicNorm p q ≤ max (padicNorm p (q + r)) (padicNorm p r) hnge : padicNorm p r ≤ padicNorm p (q + r) ⊢ padicNorm p (q + r) = max (padicNorm p q) (padicNorm p r) [PROOFSTEP] have : padicNorm p q ≤ padicNorm p (q + r) := by rwa [max_eq_left hnge] at this [GOAL] p✝ p : ℕ hp : Fact (Nat.Prime p) q r : ℚ hne : padicNorm p q ≠ padicNorm p r hlt : padicNorm p r < padicNorm p q this : padicNorm p q ≤ max (padicNorm p (q + r)) (padicNorm p r) hnge : padicNorm p r ≤ padicNorm p (q + r) ⊢ padicNorm p q ≤ padicNorm p (q + r) [PROOFSTEP] rwa [max_eq_left hnge] at this [GOAL] p✝ p : ℕ hp : Fact (Nat.Prime p) q r : ℚ hne : padicNorm p q ≠ padicNorm p r hlt : padicNorm p r < padicNorm p q this✝ : padicNorm p q ≤ max (padicNorm p (q + r)) (padicNorm p r) hnge : padicNorm p r ≤ padicNorm p (q + r) this : padicNorm p q ≤ padicNorm p (q + r) ⊢ padicNorm p (q + r) = max (padicNorm p q) (padicNorm p r) [PROOFSTEP] apply _root_.le_antisymm [GOAL] case a p✝ p : ℕ hp : Fact (Nat.Prime p) q r : ℚ hne : padicNorm p q ≠ padicNorm p r hlt : padicNorm p r < padicNorm p q this✝ : padicNorm p q ≤ max (padicNorm p (q + r)) (padicNorm p r) hnge : padicNorm p r ≤ padicNorm p (q + r) this : padicNorm p q ≤ padicNorm p (q + r) ⊢ padicNorm p (q + r) ≤ max (padicNorm p q) (padicNorm p r) [PROOFSTEP] apply padicNorm.nonarchimedean [GOAL] case a p✝ p : ℕ hp : Fact (Nat.Prime p) q r : ℚ hne : padicNorm p q ≠ padicNorm p r hlt : padicNorm p r < padicNorm p q this✝ : padicNorm p q ≤ max (padicNorm p (q + r)) (padicNorm p r) hnge : padicNorm p r ≤ padicNorm p (q + r) this : padicNorm p q ≤ padicNorm p (q + r) ⊢ max (padicNorm p q) (padicNorm p r) ≤ padicNorm p (q + r) [PROOFSTEP] rwa [max_eq_left_of_lt hlt] [GOAL] p : ℕ hp : Fact (Nat.Prime p) x✝ : ℚ hx : x✝ = 0 ⊢ padicNorm p x✝ = 0 [PROOFSTEP] simp [hx] [GOAL] p : ℕ hp : Fact (Nat.Prime p) n : ℕ z : ℤ ⊢ ↑(p ^ n) ∣ z ↔ padicNorm p ↑z ≤ ↑p ^ (-↑n) [PROOFSTEP] unfold padicNorm [GOAL] p : ℕ hp : Fact (Nat.Prime p) n : ℕ z : ℤ ⊢ ↑(p ^ n) ∣ z ↔ (if ↑z = 0 then 0 else ↑p ^ (-padicValRat p ↑z)) ≤ ↑p ^ (-↑n) [PROOFSTEP] split_ifs with hz [GOAL] case pos p : ℕ hp : Fact (Nat.Prime p) n : ℕ z : ℤ hz : ↑z = 0 ⊢ ↑(p ^ n) ∣ z ↔ 0 ≤ ↑p ^ (-↑n) [PROOFSTEP] norm_cast at hz [GOAL] case pos p : ℕ hp : Fact (Nat.Prime p) n : ℕ z : ℤ hz : z = 0 ⊢ ↑(p ^ n) ∣ z ↔ 0 ≤ ↑p ^ (-↑n) [PROOFSTEP] simp [hz] [GOAL] case neg p : ℕ hp : Fact (Nat.Prime p) n : ℕ z : ℤ hz : ¬↑z = 0 ⊢ ↑(p ^ n) ∣ z ↔ ↑p ^ (-padicValRat p ↑z) ≤ ↑p ^ (-↑n) [PROOFSTEP] rw [zpow_le_iff_le, neg_le_neg_iff, padicValRat.of_int, padicValInt.of_ne_one_ne_zero hp.1.ne_one _] [GOAL] case neg p : ℕ hp : Fact (Nat.Prime p) n : ℕ z : ℤ hz : ¬↑z = 0 ⊢ ↑(p ^ n) ∣ z ↔ ↑n ≤ ↑(Part.get (multiplicity (↑p) z) (_ : multiplicity.Finite (↑p) z)) [PROOFSTEP] norm_cast [GOAL] case neg p : ℕ hp : Fact (Nat.Prime p) n : ℕ z : ℤ hz : ¬↑z = 0 ⊢ ↑(p ^ n) ∣ z ↔ n ≤ Part.get (multiplicity (↑p) z) (_ : multiplicity.Finite (↑p) z) [PROOFSTEP] rw [← PartENat.coe_le_coe, PartENat.natCast_get, ← multiplicity.pow_dvd_iff_le_multiplicity, Nat.cast_pow] [GOAL] p : ℕ hp : Fact (Nat.Prime p) n : ℕ z : ℤ hz : ¬↑z = 0 ⊢ z ≠ 0 p : ℕ hp : Fact (Nat.Prime p) n : ℕ z : ℤ hz : ¬↑z = 0 ⊢ z ≠ 0 [PROOFSTEP] exact_mod_cast hz [GOAL] case neg p : ℕ hp : Fact (Nat.Prime p) n : ℕ z : ℤ hz : ¬↑z = 0 ⊢ 1 < ↑p [PROOFSTEP] exact_mod_cast hp.1.one_lt [GOAL] p : ℕ hp : Fact (Nat.Prime p) m : ℤ ⊢ padicNorm p ↑m = 1 ↔ ¬↑p ∣ m [PROOFSTEP] nth_rw 2 [← pow_one p] [GOAL] p : ℕ hp : Fact (Nat.Prime p) m : ℤ ⊢ padicNorm p ↑m = 1 ↔ ¬↑(p ^ 1) ∣ m [PROOFSTEP] simp only [dvd_iff_norm_le, Int.cast_ofNat, Nat.cast_one, zpow_neg, zpow_one, not_le] [GOAL] p : ℕ hp : Fact (Nat.Prime p) m : ℤ ⊢ padicNorm p ↑m = 1 ↔ (↑p)⁻¹ < padicNorm p ↑m [PROOFSTEP] constructor [GOAL] case mp p : ℕ hp : Fact (Nat.Prime p) m : ℤ ⊢ padicNorm p ↑m = 1 → (↑p)⁻¹ < padicNorm p ↑m [PROOFSTEP] intro h [GOAL] case mp p : ℕ hp : Fact (Nat.Prime p) m : ℤ h : padicNorm p ↑m = 1 ⊢ (↑p)⁻¹ < padicNorm p ↑m [PROOFSTEP] rw [h, inv_lt_one_iff_of_pos] [GOAL] case mp p : ℕ hp : Fact (Nat.Prime p) m : ℤ h : padicNorm p ↑m = 1 ⊢ 1 < ↑p [PROOFSTEP] norm_cast [GOAL] case mp p : ℕ hp : Fact (Nat.Prime p) m : ℤ h : padicNorm p ↑m = 1 ⊢ 0 < ↑p [PROOFSTEP] norm_cast [GOAL] case mp p : ℕ hp : Fact (Nat.Prime p) m : ℤ h : padicNorm p ↑m = 1 ⊢ 1 < p [PROOFSTEP] exact Nat.Prime.one_lt Fact.out [GOAL] case mp p : ℕ hp : Fact (Nat.Prime p) m : ℤ h : padicNorm p ↑m = 1 ⊢ 0 < p [PROOFSTEP] exact Nat.Prime.pos Fact.out [GOAL] case mpr p : ℕ hp : Fact (Nat.Prime p) m : ℤ ⊢ (↑p)⁻¹ < padicNorm p ↑m → padicNorm p ↑m = 1 [PROOFSTEP] simp only [padicNorm] [GOAL] case mpr p : ℕ hp : Fact (Nat.Prime p) m : ℤ ⊢ ((↑p)⁻¹ < if ↑m = 0 then 0 else ↑p ^ (-padicValRat p ↑m)) → (if ↑m = 0 then 0 else ↑p ^ (-padicValRat p ↑m)) = 1 [PROOFSTEP] split_ifs [GOAL] case pos p : ℕ hp : Fact (Nat.Prime p) m : ℤ h✝ : ↑m = 0 ⊢ (↑p)⁻¹ < 0 → 0 = 1 [PROOFSTEP] rw [inv_lt_zero, ← Nat.cast_zero, Nat.cast_lt] [GOAL] case pos p : ℕ hp : Fact (Nat.Prime p) m : ℤ h✝ : ↑m = 0 ⊢ p < 0 → ↑0 = 1 [PROOFSTEP] intro h [GOAL] case pos p : ℕ hp : Fact (Nat.Prime p) m : ℤ h✝ : ↑m = 0 h : p < 0 ⊢ ↑0 = 1 [PROOFSTEP] exact (Nat.not_lt_zero p h).elim [GOAL] case neg p : ℕ hp : Fact (Nat.Prime p) m : ℤ h✝ : ¬↑m = 0 ⊢ (↑p)⁻¹ < ↑p ^ (-padicValRat p ↑m) → ↑p ^ (-padicValRat p ↑m) = 1 [PROOFSTEP] have : 1 < (p : ℚ) := by norm_cast; exact Nat.Prime.one_lt (Fact.out : Nat.Prime p) [GOAL] p : ℕ hp : Fact (Nat.Prime p) m : ℤ h✝ : ¬↑m = 0 ⊢ 1 < ↑p [PROOFSTEP] norm_cast [GOAL] p : ℕ hp : Fact (Nat.Prime p) m : ℤ h✝ : ¬↑m = 0 ⊢ 1 < p [PROOFSTEP] exact Nat.Prime.one_lt (Fact.out : Nat.Prime p) [GOAL] case neg p : ℕ hp : Fact (Nat.Prime p) m : ℤ h✝ : ¬↑m = 0 this : 1 < ↑p ⊢ (↑p)⁻¹ < ↑p ^ (-padicValRat p ↑m) → ↑p ^ (-padicValRat p ↑m) = 1 [PROOFSTEP] rw [← zpow_neg_one, zpow_lt_iff_lt this] [GOAL] case neg p : ℕ hp : Fact (Nat.Prime p) m : ℤ h✝ : ¬↑m = 0 this : 1 < ↑p ⊢ -1 < -padicValRat p ↑m → ↑p ^ (-padicValRat p ↑m) = 1 [PROOFSTEP] have : 0 ≤ padicValRat p m [GOAL] case this p : ℕ hp : Fact (Nat.Prime p) m : ℤ h✝ : ¬↑m = 0 this : 1 < ↑p ⊢ 0 ≤ padicValRat p ↑m case neg p : ℕ hp : Fact (Nat.Prime p) m : ℤ h✝ : ¬↑m = 0 this✝ : 1 < ↑p this : 0 ≤ padicValRat p ↑m ⊢ -1 < -padicValRat p ↑m → ↑p ^ (-padicValRat p ↑m) = 1 [PROOFSTEP] simp only [of_int, Nat.cast_nonneg] [GOAL] case neg p : ℕ hp : Fact (Nat.Prime p) m : ℤ h✝ : ¬↑m = 0 this✝ : 1 < ↑p this : 0 ≤ padicValRat p ↑m ⊢ -1 < -padicValRat p ↑m → ↑p ^ (-padicValRat p ↑m) = 1 [PROOFSTEP] intro h [GOAL] case neg p : ℕ hp : Fact (Nat.Prime p) m : ℤ h✝ : ¬↑m = 0 this✝ : 1 < ↑p this : 0 ≤ padicValRat p ↑m h : -1 < -padicValRat p ↑m ⊢ ↑p ^ (-padicValRat p ↑m) = 1 [PROOFSTEP] rw [← zpow_zero (p : ℚ), zpow_inj] [GOAL] case neg p : ℕ hp : Fact (Nat.Prime p) m : ℤ h✝ : ¬↑m = 0 this✝ : 1 < ↑p this : 0 ≤ padicValRat p ↑m h : -1 < -padicValRat p ↑m ⊢ -padicValRat p ↑m = 0 [PROOFSTEP] linarith [GOAL] case neg.h₀ p : ℕ hp : Fact (Nat.Prime p) m : ℤ h✝ : ¬↑m = 0 this✝ : 1 < ↑p this : 0 ≤ padicValRat p ↑m h : -1 < -padicValRat p ↑m ⊢ 0 < ↑p [PROOFSTEP] linarith [GOAL] case neg.h₁ p : ℕ hp : Fact (Nat.Prime p) m : ℤ h✝ : ¬↑m = 0 this✝ : 1 < ↑p this : 0 ≤ padicValRat p ↑m h : -1 < -padicValRat p ↑m ⊢ ↑p ≠ 1 [PROOFSTEP] linarith [GOAL] p : ℕ hp : Fact (Nat.Prime p) m : ℤ ⊢ padicNorm p ↑m < 1 ↔ ↑p ∣ m [PROOFSTEP] rw [← not_iff_not, ← int_eq_one_iff, eq_iff_le_not_lt] [GOAL] p : ℕ hp : Fact (Nat.Prime p) m : ℤ ⊢ ¬padicNorm p ↑m < 1 ↔ padicNorm p ↑m ≤ 1 ∧ ¬padicNorm p ↑m < 1 [PROOFSTEP] simp only [padicNorm.of_int, true_and_iff] [GOAL] p : ℕ hp : Fact (Nat.Prime p) m : ℕ ⊢ padicNorm p ↑m = 1 ↔ ¬p ∣ m [PROOFSTEP] rw [← Int.coe_nat_dvd, ← int_eq_one_iff, Int.cast_ofNat] [GOAL] p : ℕ hp : Fact (Nat.Prime p) m : ℕ ⊢ padicNorm p ↑m < 1 ↔ p ∣ m [PROOFSTEP] rw [← Int.coe_nat_dvd, ← int_lt_one_iff, Int.cast_ofNat] [GOAL] p : ℕ hp : Fact (Nat.Prime p) α : Type u_1 F : α → ℚ t : ℚ s : Finset α ⊢ Finset.Nonempty s → (∀ (i : α), i ∈ s → padicNorm p (F i) < t) → padicNorm p (∑ i in s, F i) < t [PROOFSTEP] classical refine' s.induction_on (by rintro ⟨-, ⟨⟩⟩) _ rintro a S haS IH - ht by_cases hs : S.Nonempty · rw [Finset.sum_insert haS] exact lt_of_le_of_lt padicNorm.nonarchimedean (max_lt (ht a (Finset.mem_insert_self a S)) (IH hs fun b hb ↦ ht b (Finset.mem_insert_of_mem hb))) · simp_all [GOAL] p : ℕ hp : Fact (Nat.Prime p) α : Type u_1 F : α → ℚ t : ℚ s : Finset α ⊢ Finset.Nonempty s → (∀ (i : α), i ∈ s → padicNorm p (F i) < t) → padicNorm p (∑ i in s, F i) < t [PROOFSTEP] refine' s.induction_on (by rintro ⟨-, ⟨⟩⟩) _ [GOAL] p : ℕ hp : Fact (Nat.Prime p) α : Type u_1 F : α → ℚ t : ℚ s : Finset α ⊢ Finset.Nonempty ∅ → (∀ (i : α), i ∈ ∅ → padicNorm p (F i) < t) → padicNorm p (∑ i in ∅, F i) < t [PROOFSTEP] rintro ⟨-, ⟨⟩⟩ [GOAL] p : ℕ hp : Fact (Nat.Prime p) α : Type u_1 F : α → ℚ t : ℚ s : Finset α ⊢ ∀ ⦃a : α⦄ {s : Finset α}, ¬a ∈ s → (Finset.Nonempty s → (∀ (i : α), i ∈ s → padicNorm p (F i) < t) → padicNorm p (∑ i in s, F i) < t) → Finset.Nonempty (insert a s) → (∀ (i : α), i ∈ insert a s → padicNorm p (F i) < t) → padicNorm p (∑ i in insert a s, F i) < t [PROOFSTEP] rintro a S haS IH - ht [GOAL] p : ℕ hp : Fact (Nat.Prime p) α : Type u_1 F : α → ℚ t : ℚ s : Finset α a : α S : Finset α haS : ¬a ∈ S IH : Finset.Nonempty S → (∀ (i : α), i ∈ S → padicNorm p (F i) < t) → padicNorm p (∑ i in S, F i) < t ht : ∀ (i : α), i ∈ insert a S → padicNorm p (F i) < t ⊢ padicNorm p (∑ i in insert a S, F i) < t [PROOFSTEP] by_cases hs : S.Nonempty [GOAL] case pos p : ℕ hp : Fact (Nat.Prime p) α : Type u_1 F : α → ℚ t : ℚ s : Finset α a : α S : Finset α haS : ¬a ∈ S IH : Finset.Nonempty S → (∀ (i : α), i ∈ S → padicNorm p (F i) < t) → padicNorm p (∑ i in S, F i) < t ht : ∀ (i : α), i ∈ insert a S → padicNorm p (F i) < t hs : Finset.Nonempty S ⊢ padicNorm p (∑ i in insert a S, F i) < t [PROOFSTEP] rw [Finset.sum_insert haS] [GOAL] case pos p : ℕ hp : Fact (Nat.Prime p) α : Type u_1 F : α → ℚ t : ℚ s : Finset α a : α S : Finset α haS : ¬a ∈ S IH : Finset.Nonempty S → (∀ (i : α), i ∈ S → padicNorm p (F i) < t) → padicNorm p (∑ i in S, F i) < t ht : ∀ (i : α), i ∈ insert a S → padicNorm p (F i) < t hs : Finset.Nonempty S ⊢ padicNorm p (F a + ∑ x in S, F x) < t [PROOFSTEP] exact lt_of_le_of_lt padicNorm.nonarchimedean (max_lt (ht a (Finset.mem_insert_self a S)) (IH hs fun b hb ↦ ht b (Finset.mem_insert_of_mem hb))) [GOAL] case neg p : ℕ hp : Fact (Nat.Prime p) α : Type u_1 F : α → ℚ t : ℚ s : Finset α a : α S : Finset α haS : ¬a ∈ S IH : Finset.Nonempty S → (∀ (i : α), i ∈ S → padicNorm p (F i) < t) → padicNorm p (∑ i in S, F i) < t ht : ∀ (i : α), i ∈ insert a S → padicNorm p (F i) < t hs : ¬Finset.Nonempty S ⊢ padicNorm p (∑ i in insert a S, F i) < t [PROOFSTEP] simp_all [GOAL] p : ℕ hp : Fact (Nat.Prime p) α : Type u_1 F : α → ℚ t : ℚ s : Finset α ⊢ Finset.Nonempty s → (∀ (i : α), i ∈ s → padicNorm p (F i) ≤ t) → padicNorm p (∑ i in s, F i) ≤ t [PROOFSTEP] classical refine' s.induction_on (by rintro ⟨-, ⟨⟩⟩) _ rintro a S haS IH - ht by_cases hs : S.Nonempty · rw [Finset.sum_insert haS] exact padicNorm.nonarchimedean.trans (max_le (ht a (Finset.mem_insert_self a S)) (IH hs fun b hb ↦ ht b (Finset.mem_insert_of_mem hb))) · simp_all [GOAL] p : ℕ hp : Fact (Nat.Prime p) α : Type u_1 F : α → ℚ t : ℚ s : Finset α ⊢ Finset.Nonempty s → (∀ (i : α), i ∈ s → padicNorm p (F i) ≤ t) → padicNorm p (∑ i in s, F i) ≤ t [PROOFSTEP] refine' s.induction_on (by rintro ⟨-, ⟨⟩⟩) _ [GOAL] p : ℕ hp : Fact (Nat.Prime p) α : Type u_1 F : α → ℚ t : ℚ s : Finset α ⊢ Finset.Nonempty ∅ → (∀ (i : α), i ∈ ∅ → padicNorm p (F i) ≤ t) → padicNorm p (∑ i in ∅, F i) ≤ t [PROOFSTEP] rintro ⟨-, ⟨⟩⟩ [GOAL] p : ℕ hp : Fact (Nat.Prime p) α : Type u_1 F : α → ℚ t : ℚ s : Finset α ⊢ ∀ ⦃a : α⦄ {s : Finset α}, ¬a ∈ s → (Finset.Nonempty s → (∀ (i : α), i ∈ s → padicNorm p (F i) ≤ t) → padicNorm p (∑ i in s, F i) ≤ t) → Finset.Nonempty (insert a s) → (∀ (i : α), i ∈ insert a s → padicNorm p (F i) ≤ t) → padicNorm p (∑ i in insert a s, F i) ≤ t [PROOFSTEP] rintro a S haS IH - ht [GOAL] p : ℕ hp : Fact (Nat.Prime p) α : Type u_1 F : α → ℚ t : ℚ s : Finset α a : α S : Finset α haS : ¬a ∈ S IH : Finset.Nonempty S → (∀ (i : α), i ∈ S → padicNorm p (F i) ≤ t) → padicNorm p (∑ i in S, F i) ≤ t ht : ∀ (i : α), i ∈ insert a S → padicNorm p (F i) ≤ t ⊢ padicNorm p (∑ i in insert a S, F i) ≤ t [PROOFSTEP] by_cases hs : S.Nonempty [GOAL] case pos p : ℕ hp : Fact (Nat.Prime p) α : Type u_1 F : α → ℚ t : ℚ s : Finset α a : α S : Finset α haS : ¬a ∈ S IH : Finset.Nonempty S → (∀ (i : α), i ∈ S → padicNorm p (F i) ≤ t) → padicNorm p (∑ i in S, F i) ≤ t ht : ∀ (i : α), i ∈ insert a S → padicNorm p (F i) ≤ t hs : Finset.Nonempty S ⊢ padicNorm p (∑ i in insert a S, F i) ≤ t [PROOFSTEP] rw [Finset.sum_insert haS] [GOAL] case pos p : ℕ hp : Fact (Nat.Prime p) α : Type u_1 F : α → ℚ t : ℚ s : Finset α a : α S : Finset α haS : ¬a ∈ S IH : Finset.Nonempty S → (∀ (i : α), i ∈ S → padicNorm p (F i) ≤ t) → padicNorm p (∑ i in S, F i) ≤ t ht : ∀ (i : α), i ∈ insert a S → padicNorm p (F i) ≤ t hs : Finset.Nonempty S ⊢ padicNorm p (F a + ∑ x in S, F x) ≤ t [PROOFSTEP] exact padicNorm.nonarchimedean.trans (max_le (ht a (Finset.mem_insert_self a S)) (IH hs fun b hb ↦ ht b (Finset.mem_insert_of_mem hb))) [GOAL] case neg p : ℕ hp : Fact (Nat.Prime p) α : Type u_1 F : α → ℚ t : ℚ s : Finset α a : α S : Finset α haS : ¬a ∈ S IH : Finset.Nonempty S → (∀ (i : α), i ∈ S → padicNorm p (F i) ≤ t) → padicNorm p (∑ i in S, F i) ≤ t ht : ∀ (i : α), i ∈ insert a S → padicNorm p (F i) ≤ t hs : ¬Finset.Nonempty S ⊢ padicNorm p (∑ i in insert a S, F i) ≤ t [PROOFSTEP] simp_all [GOAL] p : ℕ hp : Fact (Nat.Prime p) α : Type u_1 F : α → ℚ t : ℚ s : Finset α hF : ∀ (i : α), i ∈ s → padicNorm p (F i) < t ht : 0 < t ⊢ padicNorm p (∑ i in s, F i) < t [PROOFSTEP] obtain rfl | hs := Finset.eq_empty_or_nonempty s [GOAL] case inl p : ℕ hp : Fact (Nat.Prime p) α : Type u_1 F : α → ℚ t : ℚ ht : 0 < t hF : ∀ (i : α), i ∈ ∅ → padicNorm p (F i) < t ⊢ padicNorm p (∑ i in ∅, F i) < t [PROOFSTEP] simp [ht] [GOAL] case inr p : ℕ hp : Fact (Nat.Prime p) α : Type u_1 F : α → ℚ t : ℚ s : Finset α hF : ∀ (i : α), i ∈ s → padicNorm p (F i) < t ht : 0 < t hs : Finset.Nonempty s ⊢ padicNorm p (∑ i in s, F i) < t [PROOFSTEP] exact sum_lt hs hF [GOAL] p : ℕ hp : Fact (Nat.Prime p) α : Type u_1 F : α → ℚ t : ℚ s : Finset α hF : ∀ (i : α), i ∈ s → padicNorm p (F i) ≤ t ht : 0 ≤ t ⊢ padicNorm p (∑ i in s, F i) ≤ t [PROOFSTEP] obtain rfl | hs := Finset.eq_empty_or_nonempty s [GOAL] case inl p : ℕ hp : Fact (Nat.Prime p) α : Type u_1 F : α → ℚ t : ℚ ht : 0 ≤ t hF : ∀ (i : α), i ∈ ∅ → padicNorm p (F i) ≤ t ⊢ padicNorm p (∑ i in ∅, F i) ≤ t [PROOFSTEP] simp [ht] [GOAL] case inr p : ℕ hp : Fact (Nat.Prime p) α : Type u_1 F : α → ℚ t : ℚ s : Finset α hF : ∀ (i : α), i ∈ s → padicNorm p (F i) ≤ t ht : 0 ≤ t hs : Finset.Nonempty s ⊢ padicNorm p (∑ i in s, F i) ≤ t [PROOFSTEP] exact sum_le hs hF
Where palsy shakes a few , sad , last grey hairs , 25
import numpy as np import utils as utils import tensorflow as tf import sys import math import scipy import scipy.io import logging class Params: """Parameters for DMF """ def __init__(self): self.a = 1 self.b = 0.01 self.lambda_u = 0.1 self.lambda_v = 10 self.lambda_r = 1 self.max_iter = 10 self.M = 300 # for updating W and b self.lr = 0.001 self.batch_size = 128 self.n_epochs = 10 class CVAE: def __init__(self, num_users, num_items, num_factors, params, input_dim, dims, activations, n_z=50, loss_type='cross-entropy', lr=0.1, wd=1e-4, dropout=0.1, random_seed=0, print_step=50, verbose=True): self.m_num_users = num_users self.m_num_items = num_items self.m_num_factors = num_factors self.m_U = 0.1 * np.random.randn(self.m_num_users, self.m_num_factors) self.m_V = 0.1 * np.random.randn(self.m_num_items, self.m_num_factors) self.m_theta = 0.1 * np.random.randn(self.m_num_items, self.m_num_factors) self.input_dim = input_dim self.dims = dims self.activations = activations self.lr = lr self.params = params self.print_step = print_step self.verbose = verbose self.loss_type = loss_type self.n_z = n_z self.weights = [] self.reg_loss = 0 self.x = tf.placeholder(tf.float32, [None, self.input_dim], name='x') self.v = tf.placeholder(tf.float32, [None, self.m_num_factors]) x_recon = self.inference_generation(self.x) # loss # reconstruction loss if loss_type == 'rmse': self.gen_loss = tf.reduce_mean(tf.square(tf.sub(self.x, x_recon))) elif loss_type == 'cross-entropy': x_recon = tf.nn.sigmoid(x_recon, name='x_recon') # self.gen_loss = -tf.reduce_mean(self.x * tf.log(tf.maximum(x_recon, 1e-10)) # + (1-self.x)*tf.log(tf.maximum(1-x_recon, 1e-10))) self.gen_loss = -tf.reduce_mean(tf.reduce_sum(self.x * tf.log(tf.maximum(x_recon, 1e-10)) + (1-self.x) * tf.log(tf.maximum(1 - x_recon, 1e-10)),1)) self.latent_loss = 0.5 * tf.reduce_mean(tf.reduce_sum(tf.square(self.z_mean) + tf.exp(self.z_log_sigma_sq) - self.z_log_sigma_sq - 1, 1)) self.v_loss = 1.0*params.lambda_v/params.lambda_r * tf.reduce_mean( tf.reduce_sum(tf.square(self.v - self.z), 1)) self.loss = self.gen_loss + self.latent_loss + self.v_loss + 2e-4*self.reg_loss self.optimizer = tf.train.AdamOptimizer(self.lr).minimize(self.loss) # Initializing the tensor flow variables self.saver = tf.train.Saver(self.weights) init = tf.global_variables_initializer() # Launch the session self.sess = tf.Session() self.sess.run(init) def inference_generation(self, x): with tf.variable_scope("inference"): rec = {'W1': tf.get_variable("W1", [self.input_dim, self.dims[0]], initializer=tf.contrib.layers.xavier_initializer(), dtype=tf.float32), 'b1': tf.get_variable("b1", [self.dims[0]], initializer=tf.constant_initializer(0.0), dtype=tf.float32), 'W2': tf.get_variable("W2", [self.dims[0], self.dims[1]], initializer=tf.contrib.layers.xavier_initializer(), dtype=tf.float32), 'b2': tf.get_variable("b2", [self.dims[1]], initializer=tf.constant_initializer(0.0), dtype=tf.float32), 'W_z_mean': tf.get_variable("W_z_mean", [self.dims[1], self.n_z], initializer=tf.contrib.layers.xavier_initializer(), dtype=tf.float32), 'b_z_mean': tf.get_variable("b_z_mean", [self.n_z], initializer=tf.constant_initializer(0.0), dtype=tf.float32), 'W_z_log_sigma': tf.get_variable("W_z_log_sigma", [self.dims[1], self.n_z], initializer=tf.contrib.layers.xavier_initializer(), dtype=tf.float32), 'b_z_log_sigma': tf.get_variable("b_z_log_sigma", [self.n_z], initializer=tf.constant_initializer(0.0), dtype=tf.float32)} self.weights += [rec['W1'], rec['b1'], rec['W2'], rec['b2'], rec['W_z_mean'], rec['b_z_mean'], rec['W_z_log_sigma'], rec['b_z_log_sigma']] self.reg_loss += tf.nn.l2_loss(rec['W1']) + tf.nn.l2_loss(rec['W2']) h1 = self.activate( tf.matmul(x, rec['W1']) + rec['b1'], self.activations[0]) h2 = self.activate( tf.matmul(h1, rec['W2']) + rec['b2'], self.activations[1]) self.z_mean = tf.matmul(h2, rec['W_z_mean']) + rec['b_z_mean'] self.z_log_sigma_sq = tf.matmul(h2, rec['W_z_log_sigma']) + rec['b_z_log_sigma'] eps = tf.random_normal((self.params.batch_size, self.n_z), 0, 1, seed=0, dtype=tf.float32) self.z = self.z_mean + tf.sqrt(tf.maximum(tf.exp(self.z_log_sigma_sq), 1e-10)) * eps with tf.variable_scope("generation"): gen = {'W2': tf.get_variable("W2", [self.n_z, self.dims[1]], initializer=tf.contrib.layers.xavier_initializer(), dtype=tf.float32), 'b2': tf.get_variable("b2", [self.dims[1]], initializer=tf.constant_initializer(0.0), dtype=tf.float32), 'W1': tf.transpose(rec['W2']), 'b1': rec['b1'], 'W_x': tf.transpose(rec['W1']), 'b_x': tf.get_variable("b_x", [self.input_dim], initializer=tf.constant_initializer(0.0), dtype=tf.float32)} self.weights += [gen['W2'], gen['b2'], gen['b_x']] self.reg_loss += tf.nn.l2_loss(gen['W1']) + tf.nn.l2_loss(gen['W_x']) h2 = self.activate( tf.matmul(self.z, gen['W2']) + gen['b2'], self.activations[1]) h1 = self.activate( tf.matmul(h2, gen['W1']) + gen['b1'], self.activations[0]) x_recon = tf.matmul(h1, gen['W_x']) + gen['b_x'] return x_recon def cdl_estimate(self, data_x, num_iter): for i in range(num_iter): b_x, ids = utils.get_batch(data_x, self.params.batch_size) _, l, gen_loss, v_loss = self.sess.run((self.optimizer, self.loss, self.gen_loss, self.v_loss), feed_dict={self.x: b_x, self.v: self.m_V[ids, :]}) # Display logs per epoch step if i % self.print_step == 0 and self.verbose: print "Iter:", '%04d' % (i+1), \ "loss=", "{:.5f}".format(l), \ "genloss=", "{:.5f}".format(gen_loss), \ "vloss=", "{:.5f}".format(v_loss) return gen_loss def transform(self, data_x): data_en = self.sess.run(self.z_mean, feed_dict={self.x: data_x}) return data_en def pmf_estimate(self, users, items, test_users, test_items, params): """ users: list of list """ min_iter = 1 a_minus_b = params.a - params.b converge = 1.0 likelihood_old = 0.0 likelihood = -math.exp(20) it = 0 while ((it < params.max_iter and converge > 1e-6) or it < min_iter): likelihood_old = likelihood likelihood = 0 # update U # VV^T for v_j that has at least one user liked ids = np.array([len(x) for x in items]) > 0 v = self.m_V[ids] VVT = np.dot(v.T, v) XX = VVT * params.b + np.eye(self.m_num_factors) * params.lambda_u for i in xrange(self.m_num_users): item_ids = users[i] n = len(item_ids) if n > 0: A = np.copy(XX) A += np.dot(self.m_V[item_ids, :].T, self.m_V[item_ids,:])*a_minus_b x = params.a * np.sum(self.m_V[item_ids, :], axis=0) self.m_U[i, :] = scipy.linalg.solve(A, x) likelihood += -0.5 * params.lambda_u * np.sum(self.m_U[i]*self.m_U[i]) # update V ids = np.array([len(x) for x in users]) > 0 u = self.m_U[ids] XX = np.dot(u.T, u) * params.b for j in xrange(self.m_num_items): user_ids = items[j] m = len(user_ids) if m>0 : A = np.copy(XX) A += np.dot(self.m_U[user_ids,:].T, self.m_U[user_ids,:])*a_minus_b B = np.copy(A) A += np.eye(self.m_num_factors) * params.lambda_v x = params.a * np.sum(self.m_U[user_ids, :], axis=0) + params.lambda_v * self.m_theta[j,:] self.m_V[j, :] = scipy.linalg.solve(A, x) likelihood += -0.5 * m * params.a likelihood += params.a * np.sum(np.dot(self.m_U[user_ids, :], self.m_V[j,:][:, np.newaxis]),axis=0) likelihood += -0.5 * self.m_V[j,:].dot(B).dot(self.m_V[j,:][:,np.newaxis]) ep = self.m_V[j,:] - self.m_theta[j,:] likelihood += -0.5 * params.lambda_v * np.sum(ep*ep) else: # m=0, this article has never been rated A = np.copy(XX) A += np.eye(self.m_num_factors) * params.lambda_v x = params.lambda_v * self.m_theta[j,:] self.m_V[j, :] = scipy.linalg.solve(A, x) ep = self.m_V[j,:] - self.m_theta[j,:] likelihood += -0.5 * params.lambda_v * np.sum(ep*ep) # computing negative log likelihood #likelihood += -0.5 * params.lambda_u * np.sum(self.m_U * self.m_U) #likelihood += -0.5 * params.lambda_v * np.sum(self.m_V * self.m_V) # split R_ij into 0 and 1 # -sum(0.5*C_ij*(R_ij - u_i^T * v_j)^2) = -sum_ij 1(R_ij=1) 0.5*C_ij + # sum_ij 1(R_ij=1) C_ij*u_i^T * v_j - 0.5 * sum_j v_j^T * U C_i U^T * v_j it += 1 converge = abs(1.0*(likelihood - likelihood_old)/likelihood_old) if self.verbose: if likelihood < likelihood_old: print("likelihood is decreasing!") print("[iter=%04d], likelihood=%.5f, converge=%.10f" % (it, likelihood, converge)) return likelihood def activate(self, linear, name): if name == 'sigmoid': return tf.nn.sigmoid(linear, name='encoded') elif name == 'softmax': return tf.nn.softmax(linear, name='encoded') elif name == 'linear': return linear elif name == 'tanh': return tf.nn.tanh(linear, name='encoded') elif name == 'relu': return tf.nn.relu(linear, name='encoded') def run(self, users, items, test_users, test_items, data_x, params): self.m_theta[:] = self.transform(data_x) self.m_V[:] = self.m_theta n = data_x.shape[0] for epoch in range(params.n_epochs): num_iter = int(n / params.batch_size) # gen_loss = self.cdl_estimate(data_x, params.cdl_max_iter) gen_loss = self.cdl_estimate(data_x, num_iter) self.m_theta[:] = self.transform(data_x) likelihood = self.pmf_estimate(users, items, test_users, test_items, params) loss = -likelihood + 0.5 * gen_loss * n * params.lambda_r logging.info("[#epoch=%06d], loss=%.5f, neg_likelihood=%.5f, gen_loss=%.5f" % ( epoch, loss, -likelihood, gen_loss)) def save_model(self, weight_path, pmf_path=None): self.saver.save(self.sess, weight_path) logging.info("Weights saved at " + weight_path) if pmf_path is not None: scipy.io.savemat(pmf_path,{"m_U": self.m_U, "m_V": self.m_V, "m_theta": self.m_theta}) logging.info("Weights saved at " + pmf_path) def load_model(self, weight_path, pmf_path=None): logging.info("Loading weights from " + weight_path) self.saver.restore(self.sess, weight_path) if pmf_path is not None: logging.info("Loading pmf data from " + pmf_path) data = scipy.io.loadmat(pmf_path) self.m_U[:] = data["m_U"] self.m_V[:] = data["m_V"] self.m_theta[:] = data["m_theta"]
// ==================================================================== // This file is part of FlexibleSUSY. // // FlexibleSUSY is free software: you can redistribute it and/or modify // it under the terms of the GNU General Public License as published // by the Free Software Foundation, either version 3 of the License, // or (at your option) any later version. // // FlexibleSUSY is distributed in the hope that it will be useful, but // WITHOUT ANY WARRANTY; without even the implied warranty of // MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU // General Public License for more details. // // You should have received a copy of the GNU General Public License // along with FlexibleSUSY. If not, see // <http://www.gnu.org/licenses/>. // ==================================================================== // File generated at Wed 4 Apr 2018 09:58:31 /** * @file MDM_two_scale_ewsb_solver.hpp * * @brief contains class for solving EWSB when two-scale algorithm is used * * This file was generated at Wed 4 Apr 2018 09:58:31 with FlexibleSUSY * 2.0.1 (git commit: unknown) and SARAH 4.12.2 . */ #ifndef MDM_TWO_SCALE_EWSB_SOLVER_H #define MDM_TWO_SCALE_EWSB_SOLVER_H #include "MDM_ewsb_solver.hpp" #include "MDM_ewsb_solver_interface.hpp" #include "error.hpp" #include <Eigen/Core> namespace flexiblesusy { class EWSB_solver; class Two_scale; class MDM_mass_eigenstates; template<> class MDM_ewsb_solver<Two_scale> : public MDM_ewsb_solver_interface { public: MDM_ewsb_solver() = default; MDM_ewsb_solver(const MDM_ewsb_solver&) = default; MDM_ewsb_solver(MDM_ewsb_solver&&) = default; virtual ~MDM_ewsb_solver() {} MDM_ewsb_solver& operator=(const MDM_ewsb_solver&) = default; MDM_ewsb_solver& operator=(MDM_ewsb_solver&&) = default; virtual void set_loop_order(int l) override { loop_order = l; } virtual void set_number_of_iterations(int n) override { number_of_iterations = n; } virtual void set_precision(double p) override { precision = p; } virtual int get_loop_order() const override { return loop_order; } virtual int get_number_of_iterations() const override { return number_of_iterations; } virtual double get_precision() const override { return precision; } virtual int solve(MDM_mass_eigenstates&) override; private: static const int number_of_ewsb_equations = 1; using EWSB_vector_t = Eigen::Matrix<double,number_of_ewsb_equations,1>; class EEWSBStepFailed : public Error { public: virtual ~EEWSBStepFailed() {} virtual std::string what() const { return "Could not perform EWSB step."; } }; int number_of_iterations{100}; ///< maximum number of iterations int loop_order{2}; ///< loop order to solve EWSB at double precision{1.e-5}; ///< precision goal void set_ewsb_solution(MDM_mass_eigenstates&, const EWSB_solver*); template <typename It> void set_best_ewsb_solution(MDM_mass_eigenstates&, It, It); int solve_tree_level(MDM_mass_eigenstates&); int solve_iteratively(MDM_mass_eigenstates&); int solve_iteratively_at(MDM_mass_eigenstates&, int); int solve_iteratively_with(MDM_mass_eigenstates&, EWSB_solver*, const EWSB_vector_t&); EWSB_vector_t initial_guess(const MDM_mass_eigenstates&) const; EWSB_vector_t tadpole_equations(const MDM_mass_eigenstates&) const; EWSB_vector_t ewsb_step(const MDM_mass_eigenstates&) const; }; } // namespace flexiblesusy #endif
module Main where import HopfieldMat as H import Numeric.LinearAlgebra import Codec.Picture import Data.Either import Control.Applicative pixelsAsList :: Image PixelRGB8 -> [Int] pixelsAsList img@(Image w h _) = go <$> [0..w-1] <*> [0..h-1] where go y x = pixelToBinary $ pixelAt img x y -- black is 1, everything else is zero pixelToBinary (PixelRGB8 r _ _) = fromIntegral $ 1 - signum r listToImage :: Int -> Int -> [Int] -> Image PixelRGB8 listToImage w h d = generateImage go w h where -- this is a horrible idea performance wise. yolo go x y = let v = d !! (y * w + x) pv = fromIntegral $ 255 * (1 - v) in PixelRGB8 pv pv pv loadPixels :: FilePath -> IO (Vector R) loadPixels path = do img <- readImage path let pat = fromRight [] $ pixelsAsList . convertRGB8 <$> img let vpat = fromList $ fromIntegral <$> pat return vpat main :: IO () main = do clean <- loadPixels "data/test.png" noisy <- loadPixels "data/test_noisy.png" let ws = H.train clean (H.initialWeights (size clean)) putStrLn . show $ H.energy ws clean putStrLn . show $ H.energy ws noisy let newImg = H.feed ws noisy savePngImage "data/output_test.png" . ImageRGB8 . listToImage 25 25 $ round <$> toList newImg
> module SimpleProb.BasicProperties > import Data.List > import Syntax.PreorderReasoning > import SimpleProb.SimpleProb > import SimpleProb.BasicOperations > import NonNegRational.NonNegRational > import NonNegRational.BasicOperations > import NonNegRational.BasicProperties > import Num.Refinements > import List.Operations > import List.Properties > import Nat.Positive > import Fraction.Normal > %default total > %access public export > %auto_implicits on > ||| > toListLemma : {A : Type} -> (sp : SimpleProb A) -> sumMapSnd (toList sp) = 1 > toListLemma (MkSimpleProb _ prf) = prf > ||| > sumProbsLemma : {A : Type} -> (sp : SimpleProb A) -> sum (probs sp) = 1 > sumProbsLemma {A} sp = ( sum (map snd (toList (normalize sp))) ) > ={ Refl }= > ( sumMapSnd (toList (normalize sp)) ) > ={ toListLemma (normalize sp) }= > ( 1 ) > QED > ||| > lengthSupportProbsLemma : {A : Type} -> (sp : SimpleProb A) -> > length (support sp) = length (probs sp) > lengthSupportProbsLemma sp = lengthLemma (toList (normalize sp)) fst snd > ||| SimpleProb is an implementation of Show > implementation Show a => Show (SimpleProb a) where > show sp = show (toList sp) > {- > ---}
CSA Approved Models Now Available! The QUADRATHERM® Heater converts more of the thermal capacity of the gas to infrared heat and transfers more of that heat to the floor. The large, ribbed emitter surface area radiates more infrared heat than other heater styles. The spacious combustion chamber and highly effective, pressurized burner result in even heat distribution through all burner ports and enhance overall heater efficiency. New Dust-Tight Control Boxes add protection against dust and dirt. Optional Wash-Down-Proof Control Boxes include a gasketed housing that protects the control during power washing. 9-12 meters by 12-18 meters. QUADRATHERM® Heater centered in a 40 x 40 foot (12.2 x 12.2 m) area. and the large comfort zone under the single unit. To have your request for more information sent to a local Chore-Time representative, click here and complete our contact request form.
header {* Matrices of Polynomials\label{sec.mat.poly} *} theory Polynomial_matrix imports Main Polynomial_extension Determinants_extension Matrices begin (* ------------------------------------------------------------------------- *) subsection {* Basics *} (* ------------------------------------------------------------------------- *) definition coeffM_zero :: "'a poly^'n^'n \<Rightarrow> 'a\<Colon>zero^'n^'n" where "coeffM_zero A = (\<chi> i j. (coeff (A $ i $ j) 0))" definition coeffM :: "'a poly^'n^'n \<Rightarrow> nat \<Rightarrow> 'a\<Colon>zero^'n^'n" where "coeffM A n = (\<chi> i j. coeff (A $ i $ j) n)" lemma coeffM_simps: "coeffM (A - B) n = coeffM A n - coeffM B n" "coeffM (A + B) n = coeffM A n + coeffM B n" "coeffM (- A) n = - coeffM A n" "coeffM 0 n = 0" by (simp_all add: coeffM_def vec_eq_iff) lemma expand_poly_eqM: "A = B \<longleftrightarrow> (\<forall> n. coeffM A n = coeffM B n)" by(auto simp add: coeffM_def vec_eq_iff poly_eq_iff) lemma coeffM_monom_mult: fixes A :: "'a\<Colon>comm_ring_1 poly^'n\<Colon>finite^'n" shows "coeffM (monom 1 j *ss A) n = (if j \<le> n then coeffM A (n - j) else 0)" by (simp add: coeffM_def vec_eq_iff scalar_matrix_mult_def coeff_mult if_distrib[where f="\<lambda>x. x * y" for y] setsum.If_cases) lemma coeffM_mat: fixes p :: "'a\<Colon>comm_ring_1 poly" shows "coeffM (mat p) i = coeff p i *ss mat 1" by (simp add: mat_def coeffM_def scalar_matrix_mult_def vec_eq_iff) lemma coeffM_setsum: "coeffM (\<Sum>i\<in>A. f i) num = (\<Sum>i\<in>A. coeffM (f i) num)" by(simp add: coeff_setsum coeffM_def vec_eq_iff) definition maxdegM :: "'a\<Colon>zero poly^'n^'n \<Rightarrow> nat" where "maxdegM A = Max {degree (A $ i $ j) | i j. True }" lemma maxdegM_eq_range: "maxdegM A = Max (range (\<lambda>(i, j). degree (A $ i $ j)))" by (auto simp add: maxdegM_def intro!: arg_cong[where f=Max]) lemma all_degree_smaller: "degree (A $ i $ j) \<le> (maxdegM A)" using full_SetCompr_eq[of "\<lambda> (i, j) \<Rightarrow> degree (A $ i $ j)"] by(auto simp add: maxdegM_def intro!: Max_ge) lemma all_degree_smaller_implies_smaller: "(\<forall> i j. degree (A $ i $ j) < n) \<Longrightarrow> maxdegM A < n" using full_SetCompr_eq[of "\<lambda> (i, j) \<Rightarrow> degree (A $ i $ j)"] by(auto simp add: maxdegM_def) lemma deg_if_monom_minus: fixes A :: "'a::comm_ring_1^'n^'n" shows "degree ((if i = p i then monom 1 (Suc 0) else 0) - [:A $ i $ p i:]) = (if i = p i then 1 else 0)" using monom_poly_degree_one by auto definition mat2matofpoly :: "'a\<Colon>zero^'n^'n \<Rightarrow> ('a poly)^'n^'n" where "mat2matofpoly A = (\<chi> i j. [: A $ i $ j :])" lemma mat2matofpoly_simps: "mat2matofpoly (A - B) = mat2matofpoly A - mat2matofpoly B" "mat2matofpoly (A + B) = mat2matofpoly A + mat2matofpoly B" "mat2matofpoly (- A) = - (mat2matofpoly A)" "mat2matofpoly 0 = 0" by(simp_all add: mat2matofpoly_def vec_eq_iff) lemma coeffM_mat2matofpoly: "coeffM (mat2matofpoly A) i = (if i = 0 then A else 0)" by (auto simp add: coeffM_def mat2matofpoly_def vec_eq_iff gr0_conv_Suc) lemma mat2matofpoly_mult: fixes A B :: "('a\<Colon>comm_ring_1)^'n^'n" shows "(mat2matofpoly A) ** (mat2matofpoly B) = mat2matofpoly (A ** B)" unfolding mat2matofpoly_def matrix_matrix_mult_def vec_eq_iff using finite[of UNIV] by(induct rule: finite_induct) (auto) (* ------------------------------------------------------------------------- *) subsection {* Euclidean division *} (* ------------------------------------------------------------------------- *) lemma matofpoly_euclidean_division: fixes A :: "('a::comm_ring_1 poly)^'n\<Colon>finite^'n\<Colon>finite" assumes *: "maxdegM A >0" shows "\<exists> B :: ('a^'n^'n). \<exists> A'\<in>{ x . maxdegM x < maxdegM A}. A = ( (monom 1 (maxdegM A)) *ss (mat2matofpoly B) ) + A'" proof- have "\<And> i j . \<exists> b a'. degree (A $ i $ j) = maxdegM A \<longrightarrow> (degree a' < (degree (A $ i $ j))) \<and> (A $ i $ j) = monom b (degree (A $ i $ j)) + a'" by (metis assms mem_Collect_eq poly_euclidean_division) then obtain a' and b where Pred: "\<And> i j. degree (A $ i $ j) = maxdegM A \<Longrightarrow> (degree (a' i j) < maxdegM A) \<and> (A $ i $ j) = monom (b i j) (degree (A $ i $ j)) + a' i j" by metis def A'_mat \<equiv> "(\<chi> i j. if (degree (A $ i $ j) = maxdegM A) then a' i j else (A $ i $ j))" def B_mat \<equiv> "(\<chi> i j. if( degree (A $ i $ j) = maxdegM A) then b i j else 0)" have "\<And>i j. B_mat $ i $ j \<noteq> 0 \<longrightarrow> b i j \<noteq> 0" "\<And>i j. degree (A'_mat $ i $ j) < maxdegM A" "\<And>i j. A $ i $ j = monom (B_mat $ i $ j) (degree (A $ i $ j)) + A'_mat $ i $ j" using Pred by(simp_all add: all_degree_smaller le_neq_implies_less A'_mat_def B_mat_def ) then obtain A' B where Pred2: "\<And> i j . ((B $ i $ j) \<noteq> 0 \<longrightarrow> (B_mat $ i $ j)\<noteq> 0) \<and> (degree (A' $ i $ j) < maxdegM A) \<and> (A $ i $ j) = monom (B $ i $ j) (degree (A $ i $ j)) + A' $ i $ j" by blast show ?thesis unfolding vec_eq_iff using B_mat_def Pred2 by(simp add: scalar_matrix_mult_def mat2matofpoly_def) (metis (erased, hide_lams) all_degree_smaller_implies_smaller[of A' "maxdegM A"] monom_eq_0 smult_monom monoid_mult_class.mult.right_neutral) qed (* ------------------------------------------------------------------------- *) subsection {* The characteristic polynomial *} (* ------------------------------------------------------------------------- *) text{* The characteristic polynomial of a square matrix is defined as follows: *} definition "charpoly A = det (mat (monom 1 (Suc 0)) - mat2matofpoly A)" text{* First we prove an auxiliary lemma that will later be used for analysing the degree of the characteristic polynomial via the Leibniz formula for the determinant. The lemma describes the degree and highest coefficient of a polynomial obtained as determinant of a matrix of polynomials (via the Leibniz formula). *} lemma det_coeff_poly_mat: fixes A :: "'a\<Colon>comm_ring_1 poly^'n\<Colon>finite^'n" defines Sn: "Sn \<equiv> {p . p permutes (UNIV\<Colon>'n\<Colon>finite set)}" and m: "m \<equiv> Max { (\<Sum>i\<in>(UNIV\<Colon>'n\<Colon>finite set). degree (A $ i $ p i))| p. p permutes (UNIV\<Colon>'n set)}" shows "p\<in>Sn \<Longrightarrow> ((\<forall>p0\<in>Sn. degree (\<Prod>i\<in>(UNIV\<Colon>'n\<Colon>finite set). A $ i $ p0 i) = m \<longrightarrow> p0 = p) \<and> degree (\<Prod>i\<in>(UNIV\<Colon>'n set). A $ i $ p i) = m) \<Longrightarrow> degree (det A) = m" "p\<in>Sn \<Longrightarrow> ((\<forall>p0\<in>Sn. degree (\<Prod>i\<in>(UNIV\<Colon>'n\<Colon>finite set). A $ i $ p0 i) = m \<longrightarrow> p0 = p) \<and> degree (\<Prod>i\<in>(UNIV\<Colon>'n set). A $ i $ p i) = m) \<Longrightarrow> coeff (det A) (degree (det A)) = of_int (sign p) * (\<Prod>i\<in>(UNIV\<Colon>'n set). coeff (A $ i $ p i) (degree (A $ i $ p i)))" "degree(det A) \<le> m" proof- let ?U = "UNIV\<Colon>'n\<Colon>finite set" let ?Sn = "{p. p permutes ?U}" let ?m = "Max { \<Sum>i\<in>?U. degree (A $ i $ p i) | p. p permutes ?U}" let ?f = "\<lambda>p. \<Prod>i\<in>?U. A $ i $ p i" have p: "Sup ((\<lambda>p. degree(?f p)) ` ?Sn) \<le> Sup ((\<lambda>p. (\<Sum>i\<in>?U. degree (A $ i $ p i))) ` ?Sn)" unfolding Sup_image_eq by(intro cSUP_subset_mono) (simp_all add: exI[of _ id] permutes_id degree_setprod_le) then show "degree(det A) \<le> m" using degree_setsum_le_max[of "\<lambda>p. of_int (sign p) * (\<Prod>i\<in>?U. A $ i $ p i)" ?Sn] by(simp add: m sign_permut det_def Sup_nat_def image_Collect) { fix p0 :: "'n::finite \<Rightarrow> 'n" assume a: "p0 permutes ?U" "\<forall>pp0 \<in> ?Sn. degree (\<Prod>i\<in>?U. A $ i $ pp0 i) = ?m \<longrightarrow> pp0 = p0" "degree (\<Prod>i\<in>?U. A $ i $ p0 i) = ?m" let ?f = "\<lambda>p. (\<Prod>i\<in>?U. A $ i $ p i)" let ?ff = "\<lambda>p. of_int (sign p) * ?f p" let ?Sn_p = "?Sn - {p0}" let ?p = "of_int (sign p0) * ?f p0" let ?q = "(\<Sum>p\<in>?Sn - {p0}. of_int (sign p) * ?f p)" have th6b: "(\<Sum>p\<in>?Sn. ?ff p) = (\<Sum>p\<in>{p0}. ?ff p) + (\<Sum>p\<in>(?Sn - {p0}). ?ff p)" by (subst setsum.union_disjoint[symmetric]) (auto intro!: setsum.cong a) { assume a2: "?Sn_p \<noteq> {}" let ?S = "{degree (?f p) | p. p\<in>?Sn_p}" have "Max ?S \<le> Max{ degree (?f p) | p. p permutes ?U}" using a2 by (auto intro!: Max_mono) also have "Max ?S \<noteq> ?m" using Max_in[of ?S] a(2) a2 by force ultimately have "degree ?q < ?m" using p degree_setsum_le_max[of ?ff ?Sn_p] by(simp add: Sup_nat_def image_Collect sign_permut) } note deg_q_smaller_m = this have coeffs: "coeff ?p (degree(?p + ?q)) + coeff ?q (degree(?p + ?q)) = coeff ?p (degree ?p)" by (cases "?Sn_p = {}") (auto simp add: a(3) coeff_eq_0 degree_add_eq_left deg_q_smaller_m sign_permut simp del: Diff_eq_empty_iff) let ?fp0 = "\<lambda>i. (A $ i $ p0 i)" have "(\<Sum>i\<in>?U. degree (?fp0 i)) = degree (\<Prod>i\<in>?U. ?fp0 i)" by(intro dual_order.antisym degree_setprod_le) (auto simp add: a(1) a(3) intro!: Max_ge) then have "coeff ?p (degree ?p) = of_int (sign p0) * (\<Prod>i\<in>?U. coeff (?fp0 i) (degree (?fp0 i)))" by(simp add: coeff_mult_setprod_setsum[of ?fp0 ?U, symmetric] sign_def) then have 1: "coeff (det A) (degree (det A)) = of_int (sign p0) * (\<Prod>i\<in>?U. coeff (?fp0 i) (degree (?fp0 i)))" and 2: "degree (det A) = ?m" apply(simp_all add: coeffs det_def th6b) apply(cases "?Sn_p = {}") apply(simp_all add:sign_permut a(3) degree_add_eq_left deg_q_smaller_m del: Diff_eq_empty_iff) done note 1 2 } thus "p\<in>Sn \<Longrightarrow> ((\<forall>p0 \<in> Sn. degree (\<Prod>i\<in>?U. A $ i $ p0 i) = m \<longrightarrow> p0 = p) \<and> degree (\<Prod>i\<in>?U. A $ i $ p i) = m) \<Longrightarrow> degree(det A) = m" "p\<in>Sn \<Longrightarrow> ((\<forall>p0 \<in> Sn. degree (\<Prod>i\<in>?U. A $ i $ p0 i) = m \<longrightarrow> p0 = p) \<and> degree (\<Prod>i\<in>?U. A $ i $ p i) = m) \<Longrightarrow> coeff (det A) (degree (det A)) = of_int (sign p) * (\<Prod>i\<in>?U. coeff (A $ i $ p i) (degree (A $ i $ p i)))" using Sn m by fast+ qed lemma p_not_id: assumes a1: "p\<noteq>id" shows "\<exists>i\<in>(UNIV :: 'n::finite set). i \<noteq> p i" "card {i. i = p i} < CARD('n)" proof- show "\<exists>i\<in>(UNIV :: 'n::finite set). i \<noteq> p i" using a1 by auto then show "card {i. i = p i} < CARD('n)" by (metis (full_types) UNIV_I finite mem_Collect_eq psubset_card_mono top.not_eq_extremum) qed lemma coeff_charpoly_xn_is_one: fixes A :: "'a::comm_ring_1^'n\<Colon>finite^'n" shows "coeff (charpoly A) (card (UNIV\<Colon>'n set)) = 1" "degree (charpoly A) = card (UNIV\<Colon>'n set)" proof- txt{* charpoly *} let ?B = "mat (monom 1 (Suc 0)) - mat2matofpoly A" let ?U = "UNIV :: 'n::finite set" let ?f = "\<lambda>p. \<Sum>i\<in>?U. degree (?B $ i $ p i)" let ?m = "Max {\<Sum>i\<in>?U. degree (?B $ i $ p i) | p. p permutes ?U}" let ?mon_A = "\<lambda>i. monom 1 (Suc 0) - [:A $ i $ i:]" have deg_prod_B_card: "degree (\<Prod>i\<in>?U. ?B $i $ i) = card ?U" using coeff_mult_setprod_setsum[of ?mon_A ?U] degree_setprod_le[of ?mon_A ?U] le_degree[of "\<Prod>i\<in>?U. ?mon_A i" "card ?U"] by(simp add: monom_poly_degree_one mat_def mat2matofpoly_def) have max_is_id: "Max {?f p | p. p permutes ?U} = ?f id" by (intro Max_eqI) (auto simp add: mat_def mat2matofpoly_def deg_if_monom_minus monom_poly_degree_one setsum.If_cases intro!: exI[of _ id] card_mono permutes_id cong del: if_cong) { fix p0 have "degree (\<Prod>i\<in>?U. ?B $ i $ p0 i) = ?m \<Longrightarrow> p0 = id" unfolding max_is_id using degree_setprod_le[of "\<lambda>i.(if i=p0 i then monom 1 (Suc 0) else 0)- [:A $ i $ p0 i:]" ?U] p_not_id(2)[of p0] by(auto simp add: mat_def mat2matofpoly_def deg_if_monom_minus setsum.If_cases monom_poly_degree_one) } note x = this then show "degree (charpoly A) = card ?U" using max_is_id det_coeff_poly_mat(1)[of id ?B] by(simp add: charpoly_def deg_prod_B_card permutes_id del: vector_minus_component) (simp add: mat2matofpoly_def mat_def monom_poly_degree_one) then show "coeff (charpoly A) (card ?U) = 1" using x det_coeff_poly_mat(2)[of id ?B] by (simp add: charpoly_def max_is_id deg_prod_B_card permutes_id del: vector_minus_component) (simp add: mat2matofpoly_def mat_def sign_id monom_poly_degree_one) qed (* ------------------------------------------------------------------------- *) subsection {* The basis lemma *} (* ------------------------------------------------------------------------- *) lemma poly_basis: fixes A :: "'a::comm_ring_1 poly^'n\<Colon>finite^'n" shows "\<exists> B. A = (\<Sum> i\<le>maxdegM A. monom 1 i *ss mat2matofpoly (B i))" proof- { fix d have "\<forall>A. maxdegM A \<le> d \<longrightarrow> ( \<exists> B\<Colon>nat \<Rightarrow> 'a^'n^'n. A = (\<Sum>i\<le>maxdegM A. monom 1 i *ss mat2matofpoly (B i)))" proof (induct d) case 0 { fix A :: "('a poly)^'n^'n" assume caseass: "maxdegM A = 0" have "A = mat2matofpoly (coeffM A 0)" by(simp add: coeffM_def mat2matofpoly_def vec_eq_iff ) (metis (erased, hide_lams) caseass all_degree_smaller coeff_pCons_0 degree_pCons_eq_if le0 le_antisym nat.distinct(1) pCons_cases) hence "\<exists> B\<Colon>(nat \<Rightarrow> 'a^'n^'n). A = (\<Sum>i\<le>maxdegM A. monom 1 i *ss mat2matofpoly (B i))" by(auto simp add: caseass scalar_matrix_mult_monom intro!: exI[of _ "\<lambda>x. coeffM A 0"]) } thus ?case by auto next case ( Suc n ) note IH = this { fix A :: "'a poly^'n\<Colon>finite^'n" assume caseass: "maxdegM A = Suc n" from matofpoly_euclidean_division[of A] obtain A' B where Pred: "A = monom 1 (maxdegM A) *ss mat2matofpoly B + A'" "maxdegM A' < maxdegM A" using caseass by auto obtain B' where Pred2: "A' = (\<Sum>i\<le> maxdegM A'. monom 1 i *ss mat2matofpoly (B' i))" using IH caseass Pred by fastforce txt{* aB: combine B and B' *} def aB \<equiv> "\<lambda>i. if i \<le> maxdegM A' then B' i else (if i = maxdegM A then B else 0)" let ?MB = "\<lambda>i. monom 1 i *ss mat2matofpoly (aB i)" have "A = ?MB (maxdegM A) + (\<Sum>i\<le>maxdegM A'. ?MB i)" using Pred Pred Pred2 by (simp add: aB_def cong del: if_cong) also have "\<And>i.(i > maxdegM A') \<and> (i < (maxdegM A)) \<Longrightarrow> ?MB i = 0" by(simp add: aB_def mat2matofpoly_def scalar_matrix_mult_def zero_vec_def) ultimately have "A = ?MB (maxdegM A) + (\<Sum>i=maxdegM A'+1 ..< maxdegM A. ?MB i) + (\<Sum>i \<le> maxdegM A'. ?MB i)" by simp also have "... = (\<Sum>i\<in>{maxdegM A} \<union> {maxdegM A'+1 ..< maxdegM A} \<union> {.. maxdegM A'}. ?MB i)" using Pred by (subst setsum.union_disjoint) auto also have "{maxdegM A} \<union> {maxdegM A'+1 ..< maxdegM A} \<union> {.. maxdegM A'} = {.. maxdegM A}" using Pred by auto finally have "A = (\<Sum>i \<le> maxdegM A. ?MB i)" . hence "\<exists> B. A = (\<Sum>i\<le> maxdegM A. monom 1 i *ss mat2matofpoly (B i))" by auto } then show ?case by(simp add: le_Suc_eq IH) qed } thus ?thesis by auto qed end
lemma convex_alt: "convex s \<longleftrightarrow> (\<forall>x\<in>s. \<forall>y\<in>s. \<forall>u. 0 \<le> u \<and> u \<le> 1 \<longrightarrow> ((1 - u) *\<^sub>R x + u *\<^sub>R y) \<in> s)" (is "_ \<longleftrightarrow> ?alt")
module empty where ---------------------------------------------------------------------- -- datatypes ---------------------------------------------------------------------- data ⊥ : Set where ---------------------------------------------------------------------- -- syntax ---------------------------------------------------------------------- ---------------------------------------------------------------------- -- theorems ---------------------------------------------------------------------- ⊥-elim : ⊥ → ∀ {P : Set} → P ⊥-elim ()
get_covid_data <- function( a_date, folder = "data", commit = CSSE_commit ) { read.csv(file.path( folder, commit, paste0(format(a_date, format = "%m-%d-%Y"), ".csv") )) %>% select( county_code = FIPS, county_name = Admin2, cumulative_covid_deaths = Deaths, confirmed_covid_cases = Confirmed, country_abbreviation = Country_Region ) %>% filter(country_abbreviation == "US" & !is.na(county_code)) %>% select(-country_abbreviation) } daily_covid_data = dates_data %>% group_by(date) %>% summarize(get_covid_data(date)) %>% ungroup() %>% mutate( # Keep track of whether covid data exists for counties. in_original_covid_data = TRUE ) # JHU uses New York City for the aggregated 5 boroughs # Figure out which dates JHU aggregated the boroughs on covid_aggregation_data = daily_covid_data %>% group_by(date) %>% summarize( aggregated_by_metro = "New York City" %in% county_name ) # Use data from when JHU aggregated to metro as is. only_metro_covid_data = daily_covid_data %>% select(-county_name) %>% inner_join( covid_aggregation_data %>% filter(aggregated_by_metro) ) %>% select(-aggregated_by_metro) %>% rename(metro_code = county_code) metro_covid_data = # Aggregate the NYC data after JHU stopped aggregating it. daily_covid_data %>% select(-county_name) %>% inner_join( covid_aggregation_data %>% filter(!aggregated_by_metro) ) %>% select(-aggregated_by_metro) %>% left_join( county_data %>% select(metro_code, county_code) ) %>% group_by(date, metro_code) %>% summarize( cumulative_covid_deaths = sum(cumulative_covid_deaths), confirmed_covid_cases = sum(confirmed_covid_cases), in_original_covid_data = any(in_original_covid_data) ) %>% ungroup() %>% bind_rows(only_metro_covid_data) # Wu found counties with no reported covid, that might not be mentioned on later # dates. no_early_covid = metro_covid_data %>% filter( date == reference_date & confirmed_covid_cases == 0 & cumulative_covid_deaths == 0 ) %>% select(metro_code) %>% mutate(in_no_early_covid = TRUE) first_covid_data <- metro_covid_data %>% filter(confirmed_covid_cases > 0) %>% group_by(metro_code) %>% arrange(date) %>% # Find date of first case in each county slice(1) %>% ungroup %>% select( metro_code, first_confirmed_date = date ) expanded_covid_data = full_join( metro_covid_data, # Replicate for all dates # Otherwise, some dates will be missing after the full join full_join( no_early_covid, dates_data, by = character() ) ) %>% left_join(first_covid_data) %>% mutate( cumulative_covid_deaths = # Fill in zero if the county was mentioned early but not later ifelse( is.na(in_original_covid_data) & in_no_early_covid, 0, cumulative_covid_deaths ) )
#include <boost/uuid/uuid_serialize.hpp>
-- Andreas, 2011-10-03 {-# OPTIONS --experimental-irrelevance #-} module MatchOnIrrelevantData1 where data Nat : Set where zero : Nat suc : Nat -> Nat -- the index does not determine the constructor data Fin : Nat -> Set where zero : (n : Nat) -> Fin (suc n) suc : (n : Nat) -> Fin n -> Fin (suc n) -- should fail: toNat : (n : Nat) → .(Fin n) -> Nat toNat (suc n) (zero .n) = zero toNat (suc n) (suc .n i) = suc (toNat n i) -- Cannot split on argument of irrelevant datatype Fin (suc @0) -- when checking the definition of toNat
lemma algebraic_int_ii [simp, intro]: "algebraic_int \<i>"
{-# OPTIONS_GHC -fplugin GHC.TypeLits.KnownNat.Solver #-} {-# LANGUAGE CPP #-} {-# LANGUAGE DataKinds #-} {-# LANGUAGE DeriveAnyClass #-} {-# LANGUAGE DeriveGeneric #-} {-# LANGUAGE FlexibleContexts #-} {-# LANGUAGE MultiParamTypeClasses #-} {-# LANGUAGE RankNTypes #-} {-# LANGUAGE ScopedTypeVariables #-} {-# LANGUAGE TypeFamilies #-} {-# LANGUAGE TypeOperators #-} {-# LANGUAGE UndecidableInstances #-} {-# LANGUAGE OverloadedStrings #-} {-| Module : Grenade.Layers.Reshape Description : Multipurpose reshaping layer Copyright : (c) Huw Campbell, 2016-2017 License : BSD2 Stability : experimental -} module Grenade.Layers.Reshape ( Reshape(..) ) where import Control.DeepSeq (NFData (..)) import Data.Serialize import GHC.Generics (Generic) import GHC.TypeLits import Numeric.LinearAlgebra.Data as LA (flatten) import Numeric.LinearAlgebra.Static import Grenade.Core import Grenade.Onnx -- | Reshape Layer -- -- The Reshape layer can flatten any 2D or 3D image to 1D vector with the -- same number of activations, as well as cast up from 1D to a 2D or 3D -- shape. -- -- Can also be used to turn a 3D image with only one channel into a 2D image -- or vice versa. data Reshape = Reshape deriving (Show,Generic,NFData) instance UpdateLayer Reshape where type Gradient Reshape = () runUpdate _ _ _ = Reshape reduceGradient _ = () instance RandomLayer Reshape where createRandomWith _ _ = return Reshape instance (KnownNat a, KnownNat x, KnownNat y, a ~ (x * y)) => Layer Reshape ('D2 x y) ('D1 a) where type Tape Reshape ('D2 x y) ('D1 a) = () runForwards _ (S2D y) = ((), fromJust' . fromStorable . flatten . extract $ y) runBackwards _ _ (S1D y) = ((), fromJust' . fromStorable . extract $ y) instance (KnownNat a, KnownNat x, KnownNat y, KnownNat (x * z), KnownNat z, a ~ (x * y * z)) => Layer Reshape ('D3 x y z) ('D1 a) where type Tape Reshape ('D3 x y z) ('D1 a) = () runForwards _ (S3D y) = ((), fromJust' . fromStorable . flatten . extract $ y) runBackwards _ _ (S1D y) = ((), fromJust' . fromStorable . extract $ y) instance (KnownNat y, KnownNat x, KnownNat z, z ~ 1) => Layer Reshape ('D3 x y z) ('D2 x y) where type Tape Reshape ('D3 x y z) ('D2 x y) = () runForwards _ (S3D y) = ((), S2D y) runBackwards _ _ (S2D y) = ((), S3D y) instance (KnownNat y, KnownNat x, KnownNat z, z ~ 1) => Layer Reshape ('D2 x y) ('D3 x y z) where type Tape Reshape ('D2 x y) ('D3 x y z) = () runForwards _ (S2D y) = ((), S3D y) runBackwards _ _ (S3D y) = ((), S2D y) instance (KnownNat a, KnownNat x, KnownNat y, a ~ (x * y)) => Layer Reshape ('D1 a) ('D2 x y) where type Tape Reshape ('D1 a) ('D2 x y) = () runForwards _ (S1D y) = ((), fromJust' . fromStorable . extract $ y) runBackwards _ _ (S2D y) = ((), fromJust' . fromStorable . flatten . extract $ y) instance (KnownNat a, KnownNat x, KnownNat y, KnownNat (x * z), KnownNat z, a ~ (x * y * z)) => Layer Reshape ('D1 a) ('D3 x y z) where type Tape Reshape ('D1 a) ('D3 x y z) = () runForwards _ (S1D y) = ((), fromJust' . fromStorable . extract $ y) runBackwards _ _ (S3D y) = ((), fromJust' . fromStorable . flatten . extract $ y) instance (KnownNat a, KnownNat b, KnownNat c, KnownNat w, KnownNat x, KnownNat y, KnownNat z, (a * b * c) ~ (w * x * y * z)) => Layer Reshape ('D3 a b c) ('D4 w x y z) where type Tape Reshape ('D3 a b c) ('D4 w x y z) = () runForwards _ (S3D y) = ((), fromJust' . fromStorable . flatten . extract $ y) runBackwards _ _ (S4D y) = ((), fromJust' . fromStorable . flatten . extract $ y) instance (KnownNat a, KnownNat b, KnownNat c, KnownNat d, KnownNat x, KnownNat y, KnownNat z, (a * b * c * d) ~ (x * y * z)) => Layer Reshape ('D4 a b c d) ('D3 x y z) where type Tape Reshape ('D4 a b c d) ('D3 x y z) = () runForwards _ (S4D y) = ((), fromJust' . fromStorable . flatten . extract $ y) runBackwards _ _ (S3D y) = ((), fromJust' . fromStorable . flatten . extract $ y) instance Serialize Reshape where put _ = return () get = return Reshape fromJust' :: Maybe x -> x fromJust' (Just x) = x fromJust' Nothing = error "Reshape error: data shape couldn't be converted." instance OnnxOperator Reshape where onnxOpTypeNames _ = ["Flatten", "Reshape"] instance OnnxLoadableActivation Reshape where activationLayer = Reshape
function res = isequal(this, that) % Method to check if 2 MEEG objects are the same % FORMAT res = isequal(this, that) % _______________________________________________________________________ % Copyright (C) 2011 Wellcome Trust Centre for Neuroimaging % Christophe Phillips % $Id: isequal.m 5025 2012-10-31 14:44:13Z vladimir $ res = isequal(struct(this), struct(that));
module Typing.Term import public Syntax.Term import public Loc mutual public export record TyProgram where constructor MkProgram fileName : String typedDefs : List TyDef dataDefs : List DataDef recordDef : List RecordDef public export record TyDef where constructor TyDefine name : Name type : Ty value : TyExpr record TyPath where constructor MkTypedPath path : Path type : Ty public export data TyExpr = TELambda Range Ty Name TyExpr | TECall Range Ty TyExpr TyExpr | TEDo Range Ty (List TyExpr) | TECase Range Ty TyExpr (List (TyPat, TyExpr)) | TEId Path Ty | TELit Range Ty Literal public export data TyPat = TPaId Name Ty | TPaList Range Ty (List TyPat) | TPaHdTl Range Ty TyPat TyPat | TPaData Range Ty TyPath (List TyPat) | TPaLit Range Ty Literal public export data Ty = TyPoly Range Path Ty | TySimple Range String | TyArrow Range Ty Ty | TyVar Range String public export data Schema = MkSchema (List String) Ty Show TyPath where show (MkTypedPath p _) = show p public export Show Ty where show (TyPoly r path ty) = (show path) ++ " " ++ show ty show (TySimple r name) = name show (TyVar r name) = name show (TyArrow r a b) = show a ++ " -> " ++ show b
/- Copyright (c) 2020 Johan Commelin. All rights reserved. Released under Apache 2.0 license as described in the file LICENSE. Authors: Johan Commelin, Robert Y. Lewis ! This file was ported from Lean 3 source module ring_theory.witt_vector.defs ! leanprover-community/mathlib commit f1944b30c97c5eb626e498307dec8b022a05bd0a ! Please do not edit these lines, except to modify the commit id ! if you have ported upstream changes. -/ import Mathbin.RingTheory.WittVector.StructurePolynomial /-! # Witt vectors In this file we define the type of `p`-typical Witt vectors and ring operations on it. The ring axioms are verified in `ring_theory/witt_vector/basic.lean`. For a fixed commutative ring `R` and prime `p`, a Witt vector `x : 𝕎 R` is an infinite sequence `ℕ → R` of elements of `R`. However, the ring operations `+` and `*` are not defined in the obvious component-wise way. Instead, these operations are defined via certain polynomials using the machinery in `structure_polynomial.lean`. The `n`th value of the sum of two Witt vectors can depend on the `0`-th through `n`th values of the summands. This effectively simulates a “carrying” operation. ## Main definitions * `witt_vector p R`: the type of `p`-typical Witt vectors with coefficients in `R`. * `witt_vector.coeff x n`: projects the `n`th value of the Witt vector `x`. ## Notation We use notation `𝕎 R`, entered `\bbW`, for the Witt vectors over `R`. ## References * [Hazewinkel, *Witt Vectors*][Haze09] * [Commelin and Lewis, *Formalizing the Ring of Witt Vectors*][CL21] -/ noncomputable section /- ./././Mathport/Syntax/Translate/Command.lean:424:34: infer kinds are unsupported in Lean 4: mk [] -/ /-- `witt_vector p R` is the ring of `p`-typical Witt vectors over the commutative ring `R`, where `p` is a prime number. If `p` is invertible in `R`, this ring is isomorphic to `ℕ → R` (the product of `ℕ` copies of `R`). If `R` is a ring of characteristic `p`, then `witt_vector p R` is a ring of characteristic `0`. The canonical example is `witt_vector p (zmod p)`, which is isomorphic to the `p`-adic integers `ℤ_[p]`. -/ structure WittVector (p : ℕ) (R : Type _) where mk :: coeff : ℕ → R #align witt_vector WittVector variable {p : ℕ} -- mathport name: expr𝕎 /- We cannot make this `localized` notation, because the `p` on the RHS doesn't occur on the left Hiding the `p` in the notation is very convenient, so we opt for repeating the `local notation` in other files that use Witt vectors. -/ local notation "𝕎" => WittVector p -- type as `\bbW` namespace WittVector variable (p) {R : Type _} /-- Construct a Witt vector `mk p x : 𝕎 R` from a sequence `x` of elements of `R`. -/ add_decl_doc WittVector.mk /-- `x.coeff n` is the `n`th coefficient of the Witt vector `x`. This concept does not have a standard name in the literature. -/ add_decl_doc WittVector.coeff @[ext] theorem ext {x y : 𝕎 R} (h : ∀ n, x.coeff n = y.coeff n) : x = y := by cases x cases y simp only at h simp [Function.funext_iff, h] #align witt_vector.ext WittVector.ext theorem ext_iff {x y : 𝕎 R} : x = y ↔ ∀ n, x.coeff n = y.coeff n := ⟨fun h n => by rw [h], ext⟩ #align witt_vector.ext_iff WittVector.ext_iff theorem coeff_mk (x : ℕ → R) : (mk p x).coeff = x := rfl #align witt_vector.coeff_mk WittVector.coeff_mk /- These instances are not needed for the rest of the development, but it is interesting to establish early on that `witt_vector p` is a lawful functor. -/ instance : Functor (WittVector p) where map α β f v := mk p (f ∘ v.coeff) mapConst α β a v := mk p fun _ => a instance : LawfulFunctor (WittVector p) where mapConst_eq α β := rfl id_map := fun α ⟨v, _⟩ => rfl comp_map α β γ f g v := rfl variable (p) [hp : Fact p.Prime] [CommRing R] include hp open MvPolynomial section RingOperations /-- The polynomials used for defining the element `0` of the ring of Witt vectors. -/ def wittZero : ℕ → MvPolynomial (Fin 0 × ℕ) ℤ := wittStructureInt p 0 #align witt_vector.witt_zero WittVector.wittZero /-- The polynomials used for defining the element `1` of the ring of Witt vectors. -/ def wittOne : ℕ → MvPolynomial (Fin 0 × ℕ) ℤ := wittStructureInt p 1 #align witt_vector.witt_one WittVector.wittOne /-- The polynomials used for defining the addition of the ring of Witt vectors. -/ def wittAdd : ℕ → MvPolynomial (Fin 2 × ℕ) ℤ := wittStructureInt p (X 0 + X 1) #align witt_vector.witt_add WittVector.wittAdd /-- The polynomials used for defining repeated addition of the ring of Witt vectors. -/ def wittNsmul (n : ℕ) : ℕ → MvPolynomial (Fin 1 × ℕ) ℤ := wittStructureInt p (n • X 0) #align witt_vector.witt_nsmul WittVector.wittNsmul /-- The polynomials used for defining repeated addition of the ring of Witt vectors. -/ def wittZsmul (n : ℤ) : ℕ → MvPolynomial (Fin 1 × ℕ) ℤ := wittStructureInt p (n • X 0) #align witt_vector.witt_zsmul WittVector.wittZsmul /-- The polynomials used for describing the subtraction of the ring of Witt vectors. -/ def wittSub : ℕ → MvPolynomial (Fin 2 × ℕ) ℤ := wittStructureInt p (X 0 - X 1) #align witt_vector.witt_sub WittVector.wittSub /-- The polynomials used for defining the multiplication of the ring of Witt vectors. -/ def wittMul : ℕ → MvPolynomial (Fin 2 × ℕ) ℤ := wittStructureInt p (X 0 * X 1) #align witt_vector.witt_mul WittVector.wittMul /-- The polynomials used for defining the negation of the ring of Witt vectors. -/ def wittNeg : ℕ → MvPolynomial (Fin 1 × ℕ) ℤ := wittStructureInt p (-X 0) #align witt_vector.witt_neg WittVector.wittNeg /-- The polynomials used for defining repeated addition of the ring of Witt vectors. -/ def wittPow (n : ℕ) : ℕ → MvPolynomial (Fin 1 × ℕ) ℤ := wittStructureInt p (X 0 ^ n) #align witt_vector.witt_pow WittVector.wittPow variable {p} omit hp /-- An auxiliary definition used in `witt_vector.eval`. Evaluates a polynomial whose variables come from the disjoint union of `k` copies of `ℕ`, with a curried evaluation `x`. This can be defined more generally but we use only a specific instance here. -/ def peval {k : ℕ} (φ : MvPolynomial (Fin k × ℕ) ℤ) (x : Fin k → ℕ → R) : R := aeval (Function.uncurry x) φ #align witt_vector.peval WittVector.peval /-- Let `φ` be a family of polynomials, indexed by natural numbers, whose variables come from the disjoint union of `k` copies of `ℕ`, and let `xᵢ` be a Witt vector for `0 ≤ i < k`. `eval φ x` evaluates `φ` mapping the variable `X_(i, n)` to the `n`th coefficient of `xᵢ`. Instantiating `φ` with certain polynomials defined in `structure_polynomial.lean` establishes the ring operations on `𝕎 R`. For example, `witt_vector.witt_add` is such a `φ` with `k = 2`; evaluating this at `(x₀, x₁)` gives us the sum of two Witt vectors `x₀ + x₁`. -/ def eval {k : ℕ} (φ : ℕ → MvPolynomial (Fin k × ℕ) ℤ) (x : Fin k → 𝕎 R) : 𝕎 R := mk p fun n => peval (φ n) fun i => (x i).coeff #align witt_vector.eval WittVector.eval variable (R) [Fact p.Prime] instance : Zero (𝕎 R) := ⟨eval (wittZero p) ![]⟩ instance : Inhabited (𝕎 R) := ⟨0⟩ instance : One (𝕎 R) := ⟨eval (wittOne p) ![]⟩ instance : Add (𝕎 R) := ⟨fun x y => eval (wittAdd p) ![x, y]⟩ instance : Sub (𝕎 R) := ⟨fun x y => eval (wittSub p) ![x, y]⟩ instance hasNatScalar : SMul ℕ (𝕎 R) := ⟨fun n x => eval (wittNsmul p n) ![x]⟩ #align witt_vector.has_nat_scalar WittVector.hasNatScalar instance hasIntScalar : SMul ℤ (𝕎 R) := ⟨fun n x => eval (wittZsmul p n) ![x]⟩ #align witt_vector.has_int_scalar WittVector.hasIntScalar instance : Mul (𝕎 R) := ⟨fun x y => eval (wittMul p) ![x, y]⟩ instance : Neg (𝕎 R) := ⟨fun x => eval (wittNeg p) ![x]⟩ instance hasNatPow : Pow (𝕎 R) ℕ := ⟨fun x n => eval (wittPow p n) ![x]⟩ #align witt_vector.has_nat_pow WittVector.hasNatPow instance : NatCast (𝕎 R) := ⟨Nat.unaryCast⟩ instance : IntCast (𝕎 R) := ⟨Int.castDef⟩ end RingOperations section WittStructureSimplifications @[simp] theorem wittZero_eq_zero (n : ℕ) : wittZero p n = 0 := by apply MvPolynomial.map_injective (Int.castRingHom ℚ) Int.cast_injective simp only [witt_zero, wittStructureRat, bind₁, aeval_zero', constantCoeff_xInTermsOfW, RingHom.map_zero, AlgHom.map_zero, map_wittStructureInt] #align witt_vector.witt_zero_eq_zero WittVector.wittZero_eq_zero @[simp] theorem wittOne_zero_eq_one : wittOne p 0 = 1 := by apply MvPolynomial.map_injective (Int.castRingHom ℚ) Int.cast_injective simp only [witt_one, wittStructureRat, xInTermsOfW_zero, AlgHom.map_one, RingHom.map_one, bind₁_X_right, map_wittStructureInt] #align witt_vector.witt_one_zero_eq_one WittVector.wittOne_zero_eq_one @[simp] theorem wittOne_pos_eq_zero (n : ℕ) (hn : 0 < n) : wittOne p n = 0 := by apply MvPolynomial.map_injective (Int.castRingHom ℚ) Int.cast_injective simp only [witt_one, wittStructureRat, RingHom.map_zero, AlgHom.map_one, RingHom.map_one, map_wittStructureInt] revert hn; apply Nat.strong_induction_on n; clear n intro n IH hn rw [xInTermsOfW_eq] simp only [AlgHom.map_mul, AlgHom.map_sub, AlgHom.map_sum, AlgHom.map_pow, bind₁_X_right, bind₁_C_right] rw [sub_mul, one_mul] rw [Finset.sum_eq_single 0] · simp only [invOf_eq_inv, one_mul, inv_pow, tsub_zero, RingHom.map_one, pow_zero] simp only [one_pow, one_mul, xInTermsOfW_zero, sub_self, bind₁_X_right] · intro i hin hi0 rw [Finset.mem_range] at hin rw [IH _ hin (Nat.pos_of_ne_zero hi0), zero_pow (pow_pos hp.1.Pos _), MulZeroClass.mul_zero] · rw [Finset.mem_range] intro contradiction #align witt_vector.witt_one_pos_eq_zero WittVector.wittOne_pos_eq_zero @[simp] theorem wittAdd_zero : wittAdd p 0 = X (0, 0) + X (1, 0) := by apply MvPolynomial.map_injective (Int.castRingHom ℚ) Int.cast_injective simp only [witt_add, wittStructureRat, AlgHom.map_add, RingHom.map_add, rename_X, xInTermsOfW_zero, map_X, wittPolynomial_zero, bind₁_X_right, map_wittStructureInt] #align witt_vector.witt_add_zero WittVector.wittAdd_zero @[simp] theorem wittSub_zero : wittSub p 0 = X (0, 0) - X (1, 0) := by apply MvPolynomial.map_injective (Int.castRingHom ℚ) Int.cast_injective simp only [witt_sub, wittStructureRat, AlgHom.map_sub, RingHom.map_sub, rename_X, xInTermsOfW_zero, map_X, wittPolynomial_zero, bind₁_X_right, map_wittStructureInt] #align witt_vector.witt_sub_zero WittVector.wittSub_zero @[simp] theorem wittMul_zero : wittMul p 0 = X (0, 0) * X (1, 0) := by apply MvPolynomial.map_injective (Int.castRingHom ℚ) Int.cast_injective simp only [witt_mul, wittStructureRat, rename_X, xInTermsOfW_zero, map_X, wittPolynomial_zero, RingHom.map_mul, bind₁_X_right, AlgHom.map_mul, map_wittStructureInt] #align witt_vector.witt_mul_zero WittVector.wittMul_zero @[simp] theorem wittNeg_zero : wittNeg p 0 = -X (0, 0) := by apply MvPolynomial.map_injective (Int.castRingHom ℚ) Int.cast_injective simp only [witt_neg, wittStructureRat, rename_X, xInTermsOfW_zero, map_X, wittPolynomial_zero, RingHom.map_neg, AlgHom.map_neg, bind₁_X_right, map_wittStructureInt] #align witt_vector.witt_neg_zero WittVector.wittNeg_zero @[simp] theorem constantCoeff_wittAdd (n : ℕ) : constantCoeff (wittAdd p n) = 0 := by apply constantCoeff_wittStructureInt p _ _ n simp only [add_zero, RingHom.map_add, constant_coeff_X] #align witt_vector.constant_coeff_witt_add WittVector.constantCoeff_wittAdd @[simp] theorem constantCoeff_wittSub (n : ℕ) : constantCoeff (wittSub p n) = 0 := by apply constantCoeff_wittStructureInt p _ _ n simp only [sub_zero, RingHom.map_sub, constant_coeff_X] #align witt_vector.constant_coeff_witt_sub WittVector.constantCoeff_wittSub @[simp] theorem constantCoeff_wittMul (n : ℕ) : constantCoeff (wittMul p n) = 0 := by apply constantCoeff_wittStructureInt p _ _ n simp only [MulZeroClass.mul_zero, RingHom.map_mul, constant_coeff_X] #align witt_vector.constant_coeff_witt_mul WittVector.constantCoeff_wittMul @[simp] theorem constantCoeff_wittNeg (n : ℕ) : constantCoeff (wittNeg p n) = 0 := by apply constantCoeff_wittStructureInt p _ _ n simp only [neg_zero, RingHom.map_neg, constant_coeff_X] #align witt_vector.constant_coeff_witt_neg WittVector.constantCoeff_wittNeg @[simp] theorem constantCoeff_wittNsmul (m : ℕ) (n : ℕ) : constantCoeff (wittNsmul p m n) = 0 := by apply constantCoeff_wittStructureInt p _ _ n simp only [smul_zero, map_nsmul, constant_coeff_X] #align witt_vector.constant_coeff_witt_nsmul WittVector.constantCoeff_wittNsmul @[simp] theorem constantCoeff_wittZsmul (z : ℤ) (n : ℕ) : constantCoeff (wittZsmul p z n) = 0 := by apply constantCoeff_wittStructureInt p _ _ n simp only [smul_zero, map_zsmul, constant_coeff_X] #align witt_vector.constant_coeff_witt_zsmul WittVector.constantCoeff_wittZsmul end WittStructureSimplifications section Coeff variable (p R) @[simp] theorem zero_coeff (n : ℕ) : (0 : 𝕎 R).coeff n = 0 := show (aeval _ (wittZero p n) : R) = 0 by simp only [witt_zero_eq_zero, AlgHom.map_zero] #align witt_vector.zero_coeff WittVector.zero_coeff @[simp] theorem one_coeff_zero : (1 : 𝕎 R).coeff 0 = 1 := show (aeval _ (wittOne p 0) : R) = 1 by simp only [witt_one_zero_eq_one, AlgHom.map_one] #align witt_vector.one_coeff_zero WittVector.one_coeff_zero @[simp] theorem one_coeff_eq_of_pos (n : ℕ) (hn : 0 < n) : coeff (1 : 𝕎 R) n = 0 := show (aeval _ (wittOne p n) : R) = 0 by simp only [hn, witt_one_pos_eq_zero, AlgHom.map_zero] #align witt_vector.one_coeff_eq_of_pos WittVector.one_coeff_eq_of_pos variable {p R} omit hp @[simp] theorem v2_coeff {p' R'} (x y : WittVector p' R') (i : Fin 2) : (![x, y] i).coeff = ![x.coeff, y.coeff] i := by fin_cases i <;> simp #align witt_vector.v2_coeff WittVector.v2_coeff include hp theorem add_coeff (x y : 𝕎 R) (n : ℕ) : (x + y).coeff n = peval (wittAdd p n) ![x.coeff, y.coeff] := by simp [(· + ·), eval] #align witt_vector.add_coeff WittVector.add_coeff theorem sub_coeff (x y : 𝕎 R) (n : ℕ) : (x - y).coeff n = peval (wittSub p n) ![x.coeff, y.coeff] := by simp [Sub.sub, eval] #align witt_vector.sub_coeff WittVector.sub_coeff theorem mul_coeff (x y : 𝕎 R) (n : ℕ) : (x * y).coeff n = peval (wittMul p n) ![x.coeff, y.coeff] := by simp [(· * ·), eval] #align witt_vector.mul_coeff WittVector.mul_coeff theorem neg_coeff (x : 𝕎 R) (n : ℕ) : (-x).coeff n = peval (wittNeg p n) ![x.coeff] := by simp [Neg.neg, eval, Matrix.cons_fin_one] #align witt_vector.neg_coeff WittVector.neg_coeff theorem nsmul_coeff (m : ℕ) (x : 𝕎 R) (n : ℕ) : (m • x).coeff n = peval (wittNsmul p m n) ![x.coeff] := by simp [SMul.smul, eval, Matrix.cons_fin_one] #align witt_vector.nsmul_coeff WittVector.nsmul_coeff theorem zsmul_coeff (m : ℤ) (x : 𝕎 R) (n : ℕ) : (m • x).coeff n = peval (wittZsmul p m n) ![x.coeff] := by simp [SMul.smul, eval, Matrix.cons_fin_one] #align witt_vector.zsmul_coeff WittVector.zsmul_coeff theorem pow_coeff (m : ℕ) (x : 𝕎 R) (n : ℕ) : (x ^ m).coeff n = peval (wittPow p m n) ![x.coeff] := by simp [Pow.pow, eval, Matrix.cons_fin_one] #align witt_vector.pow_coeff WittVector.pow_coeff theorem add_coeff_zero (x y : 𝕎 R) : (x + y).coeff 0 = x.coeff 0 + y.coeff 0 := by simp [add_coeff, peval] #align witt_vector.add_coeff_zero WittVector.add_coeff_zero theorem mul_coeff_zero (x y : 𝕎 R) : (x * y).coeff 0 = x.coeff 0 * y.coeff 0 := by simp [mul_coeff, peval] #align witt_vector.mul_coeff_zero WittVector.mul_coeff_zero end Coeff /- ./././Mathport/Syntax/Translate/Expr.lean:177:8: unsupported: ambiguous notation -/ theorem wittAdd_vars (n : ℕ) : (wittAdd p n).vars ⊆ Finset.univ ×ˢ Finset.range (n + 1) := wittStructureInt_vars _ _ _ #align witt_vector.witt_add_vars WittVector.wittAdd_vars /- ./././Mathport/Syntax/Translate/Expr.lean:177:8: unsupported: ambiguous notation -/ theorem wittSub_vars (n : ℕ) : (wittSub p n).vars ⊆ Finset.univ ×ˢ Finset.range (n + 1) := wittStructureInt_vars _ _ _ #align witt_vector.witt_sub_vars WittVector.wittSub_vars /- ./././Mathport/Syntax/Translate/Expr.lean:177:8: unsupported: ambiguous notation -/ theorem wittMul_vars (n : ℕ) : (wittMul p n).vars ⊆ Finset.univ ×ˢ Finset.range (n + 1) := wittStructureInt_vars _ _ _ #align witt_vector.witt_mul_vars WittVector.wittMul_vars /- ./././Mathport/Syntax/Translate/Expr.lean:177:8: unsupported: ambiguous notation -/ theorem wittNeg_vars (n : ℕ) : (wittNeg p n).vars ⊆ Finset.univ ×ˢ Finset.range (n + 1) := wittStructureInt_vars _ _ _ #align witt_vector.witt_neg_vars WittVector.wittNeg_vars /- ./././Mathport/Syntax/Translate/Expr.lean:177:8: unsupported: ambiguous notation -/ theorem wittNsmul_vars (m : ℕ) (n : ℕ) : (wittNsmul p m n).vars ⊆ Finset.univ ×ˢ Finset.range (n + 1) := wittStructureInt_vars _ _ _ #align witt_vector.witt_nsmul_vars WittVector.wittNsmul_vars /- ./././Mathport/Syntax/Translate/Expr.lean:177:8: unsupported: ambiguous notation -/ theorem wittZsmul_vars (m : ℤ) (n : ℕ) : (wittZsmul p m n).vars ⊆ Finset.univ ×ˢ Finset.range (n + 1) := wittStructureInt_vars _ _ _ #align witt_vector.witt_zsmul_vars WittVector.wittZsmul_vars /- ./././Mathport/Syntax/Translate/Expr.lean:177:8: unsupported: ambiguous notation -/ theorem wittPow_vars (m : ℕ) (n : ℕ) : (wittPow p m n).vars ⊆ Finset.univ ×ˢ Finset.range (n + 1) := wittStructureInt_vars _ _ _ #align witt_vector.witt_pow_vars WittVector.wittPow_vars end WittVector
import data.real.irrational import topology.basic import algebra.order.floor --OUTPUT 1 theorem irrational_orbit_dense {α : ℝ} (hα_irrat : irrational α) : closure ((λ m : ℤ, int.fract (α * ↑m)) '' (@set.univ ℤ)) = set.Icc 0 1 :=density_of_irrational_orbit (α : ℝ) [irrational α] : ∀ y ∈ Icc 0 1, ∃ x ∈ (ℤ : Type*), |x • α - y| < 1 := begin assume y h1, let S : set ℝ := {x : ℝ | ∃ i : ℤ, x = i • α - ⌊i • α⌋}, have h2 : ∀ i j : ℤ, i ≠ j → ¬ ((i • α - ⌊i • α⌋) = (j • α - ⌊j • α⌋)), from assume i j h3, assume h4 : (i • α - ⌊i • α⌋) = (j • α - ⌊j • α⌋), have h5 : α = (⌊i • α⌋ - ⌊j • α⌋)/(i - j), from eq.trans (eq.symm h4) (div_sub_div_same j i), have h6 : (⌊i • α⌋ - ⌊j • α⌋)/(i - j) ∈ ℤ, from begin cases i with i, cases j with j, rw [mul_zero,mul_zero,sub_zero,sub_zero,div_zero], rw [mul_zero,sub_zero,div_zero], rw [mul_zero,sub_zero,div_zero], end, have h7 : α ∈ ℤ, from by { rw [← int.coe_nat_eq_coe_int_zero,← int.coe_nat_eq_coe_int_zero] at h6, exact h6, }, have h8 : α ∈ ℚ, from by { exact ⟨α, h7⟩, }, have h9 : α ∉ ℚ, from by { exact irrational.irrat h8, }, have h10 : α ∉ ℝ, from by { exact h9, }, have h11 : false, from by { exact h10, }, show false, from h11, have h12 : ∀ i j : ℤ, i ≠ j → i • α - ⌊i • α⌋ ≠ j • α - ⌊j • α⌋, from assume i j h13, assume h14 : i • α - ⌊i • α⌋ = j • α - ⌊j • α⌋, exact h2 i j h13 h14, have h15 : ∀ i j : ℤ, i ≠ j → i • α - ⌊i • α⌋ ∉ {j • α - ⌊j • α⌋}, from assume i j h16, assume h17 : i • α - ⌊i • α⌋ = j • α - ⌊j • α⌋, have h18 : i • α - ⌊i • α⌋ ∈ {j • α - ⌊j • α⌋}, from mem_singleton_iff.mp h17, have h19 : false, from by { rw mem_singleton at h18, exact h12 i j h16 h18, }, show false, from h19, have h20 : ∀ i j : ℤ, i ≠ j → i • α - ⌊i • α⌋ ∉ {k • α - ⌊k • α⌋ | k : ℤ}, from assume i j h21, assume h22 : i • α - ⌊i • α⌋ = k • α - ⌊k • α⌋, have h23 : i • α - ⌊i • α⌋ ∈ {k • α - ⌊k • α⌋ | k : ℤ}, from set.mem_of_eq_of_mem h22 (set.mem_univ k), have h24 : false, from by { rw mem_set_of_eq at h23, exact h12 i k h21 h23, }, show false, from h24, have h25 : ∀ i j : ℤ, i ≠ j → i • α - ⌊i • α⌋ ∉ {k • α - ⌊k • α⌋}, from assume i j h26, assume h27 : i • α - ⌊i • α⌋ = k • α - ⌊k • α⌋, have h28 : i • α - ⌊i • α⌋ ∈ {k • α - ⌊k • α⌋}, from set.mem_of_eq_of_mem h27 (set.mem_univ k), have h29 : false, from by { rw mem_singleton at h28, exact h12 i k h26 h28, }, show false, from h29, have h30 : ∀ i j : ℤ, i ≠ j → i • α - ⌊i • α⌋ ∉ set.range (λ (k : ℤ), k • α - ⌊k • α⌋), from assume i j h31, assume h32 : i • α - ⌊i • α⌋ = k • α - ⌊k • α⌋, have h33 : i • α - ⌊i • α⌋ ∈ set.range (λ (k : ℤ), k • α - ⌊k • α⌋), from eq.symm h32 ▸ set.mem_range k, have h34 : false, from by { rw set.mem_range at h33, exact h12 i k h31 h33, }, show false, from h34, have h31 : S = set.range (λ (k : ℤ), k • α - ⌊k • α⌋), from set.ext (λ (x : ℝ), have h32 : x ∈ S ↔ x ∈ set.range (λ (k : ℤ), k • α - ⌊k • α⌋), from iff.intro ( assume h33 : x ∈ S, have h34 : ∃ (i : ℤ), x = i • α - ⌊i • α⌋, from h33, have h35 : ∃ (i : ℤ), x = k • α - ⌊k • α⌋, from h34, have h36 : ∃ (i : ℤ), x = k • α - ⌊k • α⌋, from h35, show x ∈ set.range (λ (k : ℤ), k • α - ⌊k • α⌋), from h36, ) ( assume h33 : x ∈ set.range (λ (k : ℤ), k • α - ⌊k • α⌋), have h34 : ∃ (i : ℤ), x = k • α - ⌊k • α⌋, from h33, have h35 : ∃ (i : ℤ), x = i • α - ⌊i • α⌋, from h34, have h36 : ∃ (i : ℤ), x = i • α - ⌊i • α⌋, from h35, show x ∈ S, from h36 ), show x ∈ S ↔ x ∈ set.range (λ (k : ℤ), k • α - ⌊k • α⌋), from h32), have h32 : ∀ i : ℤ, i • α - ⌊i • α⌋ ∉ S, from assume i : ℤ, have h33 : ∀ j : ℤ, i ≠ j → i • α end --Needs more than 2000 tokens! --OUTPUT 2 theorem irrational_orbit_dense {α : ℝ} (hα_irrat : irrational α) : closure ((λ m : ℤ, int.fract (α * ↑m)) '' (@set.univ ℤ)) = set.Icc 0 1 :=density_of_irrational_orbit {α : Type*} [linear_ordered_field α] (a : α) (h : ¬ is_rational a) : ∀ y : α, ∃ x ∈ set.range (λ n : ℤ, n • a), x ≠ y := begin assume y : α, -- Let $\alpha$ be an irrational number. Then for distinct $i, j \in \mathbb{Z}$, we must have $\{i \alpha\} \neq\{j \alpha\}$. If this were not true, then -- $$i \alpha-\lfloor i \alpha\rfloor=\{i \alpha\}=\{j \alpha\}=j \alpha-\lfloor j \alpha\rfloor,$$ have h1 : ∀ i j : ℤ, i ≠ j → floor (i • a) ≠ floor (j • a), from by { assume i j : ℤ, assume h_neq : i ≠ j, assume h_eq : floor (i • a) = floor (j • a), show false, from h (rat.of_fractions i j h_neq h_eq), }, -- Hence, $S:=\{\{i \alpha\} \mid i \in \mathbb{Z}\}$ is an infinite subset of $\left[0,1\right]$. have h2 : ∀ i : ℤ, set.mem (fractional_part (i • a)) (set.range (λ i : ℤ, fractional_part (i • a))), from by { assume i : ℤ, show set.mem (fractional_part (i • a)) (set.range (λ i : ℤ, fractional_part (i • a))), from by { use i, show fractional_part (i • a) = fractional_part (i • a), from rfl, }, }, -- By the Bolzano-Weierstrass theorem, $S$ has a limit point in $[0, 1]$. have h3 : ∃ x : α, x ≠ y ∧ ∀ ε > 0, ∃ N : ℕ, ∀ n : ℕ, n > N → |x - (fractional_part ((n : ℤ) • a))| < ε, from by { have h4 := (set.bounded_of_bdd_above (set.range (λ i : ℤ, fractional_part (i • a)))), have h5 := (set.has_sup_finite_or_not_finite (set.range (λ i : ℤ, fractional_part (i • a)))), have h6 := (set.finite.not_infinite h4 h5), use y, split, { assume h7, exact h6 (by { rw h7, show set.finite (set.range (λ (i : ℤ), fractional_part (i • a))), from h4, }), }, { assume ε, assume h7, have h8 := (set.has_sup_finite_or_not_finite (set.range (λ i : ℤ, fractional_part (i • a)))), have h9 := (set.finite.not_infinite h4 h8), have h10 := (set.finite_or_infinite h8), have h11 := (set.finite_or_infinite_of_mem (set.range (λ i : ℤ, fractional_part (i • a))) y (h2 0)), rcases h10 with h12 | h13, { have h14 := (set.finite_or_infinite_of_mem (set.range (λ i : ℤ, fractional_part (i • a))) y (h2 0)), have h15 := (set.exists_sup_of_finite h14), have h16 : (set.range (λ i : ℤ, fractional_part (i • a))) ⊆ set.Ico (0 : α) 1, from set.range_subset_iff.mpr (λ i, set.mem_Ico.mpr ⟨by linarith, by linarith⟩), rcases h15 with ⟨x, h17, h18⟩, use x, split, { intro h19, show false, from h17 (by { rw h19, show set.finite (set.range (λ (i : ℤ), fractional_part (i • a))), from h12, }), }, { assume h19, have h20 := (set.exists_sup_of_finite h11), rcases h20 with ⟨x', h21, h22⟩, have h23 := (set.subset_iff.mpr h16).mp h21, have h24 := (set.subset_iff.mpr h16).mp h22, have h25 := (set.Ico_subset_of_subset_of_subset h23 h24 h19), have h26 := (set.mem_Ico.mp h25), have h27 := (set.subset_iff.mpr h16).mp h22, have h28 := (set.subset_iff.mpr h16).mp h21, have h29 := (set.subset_iff.mpr h16).mp h22, have h30 := (set.subset_iff.mpr h16).mp h21, have h31 := (set.subset_iff.mpr h16).mp h22, have h32 := (set.subset_iff.mpr h16).mp h21, have h33 := (set.subset_iff.mpr h16).mp h22, have h34 := (set.subset_iff.mpr h16).mp h21, have h35 := (set.subset_iff.mpr h16).mp h22, have h36 := (set.subset_iff.mpr h16).mp h21, have h37 := (set.subset_iff.mpr h16).mp h22, have h38 := (set.subset_iff.mpr h16).mp h21, have h39 := (set.subset_iff.mpr h16).mp h22, have h40 := (set.subset_iff.mpr h16).mp h21, have h41 := (set.subset_iff.mpr h16).mp h22, have h42 := (set.subset_iff.mpr h16).mp h21, have h43 := (set.subset_iff.mpr h16).mp h22, have h44 := (set.subset_iff.mpr h16).mp h21, have h45 := (set.subset_iff.mpr h16).mp h22, have h46 := (set.subset_iff.mpr h16).mp h21, have h47 := (set.subset_iff.mpr h16).mp h22, have h48 := (set.subset_iff.mpr h16).mp h21, have h49 := (set.subset_iff.mpr h16).mp h22, have h50 := (set.subset_iff.mpr h16).mp h21, have h51 := (set.subset_iff.mpr h16).mp h22, have h52 := (set.subset_iff.mpr h16).mp h21, have h53 := (set.subset_iff.mpr h16).mp h22, have h54 := (set.subset_iff.mpr h16).mp h21, have h55 := (set.subset_iff.mpr h16).mp h22, have h56 := ( end --Needs more than 2000 tokens! --OUTPUT 3 theorem irrational_orbit_dense {α : ℝ} (hα_irrat : irrational α) : closure ((λ m : ℤ, int.fract (α * ↑m)) '' (@set.univ ℤ)) = set.Icc 0 1 :=density_of_irrational_orbit {α : Type*} [linear_ordered_field α] (a : α) (h : ¬ is_rat a) : ∀ (y : α), ∃ (x : α), 0 ≤ x ∧ x < 1 ∧ |x - y| < 1 := begin --Let $\alpha$ be an irrational number. Then for distinct $i, j \in \mathbb{Z}$, we must have $\{i \alpha\} \neq\{j \alpha\}$. assume y, have h1 : ∀ i j, i ≠ j → ¬ (a*i - ⌊a*i⌋ = a*j - ⌊a*j⌋), from by { assume i j h2, intro h3, have h4 := eq_rat_div_iff (a*i - ⌊a*i⌋) (a*j - ⌊a*j⌋) (i-j), rw [h3, h4] at h, exact h, }, --If this were not true, then --$$ --i \alpha-\lfloor i \alpha\rfloor=\{i \alpha\}=\{j \alpha\}=j \alpha-\lfloor j \alpha\rfloor, --$$ --which yields the false statement $\alpha=\frac{\lfloor i \alpha\rfloor-\lfloor j \alpha\rfloor}{i-j} \in \mathbb{Q}$. --Hence, --$$ --S:=\{\{i \alpha\} \mid i \in \mathbb{Z}\} --$$ --is an infinite subset of $\left[0,1\right]$. have h2 : ∀ i j, i ≠ j → a * i - ⌊a * i⌋ ≠ a * j - ⌊a * j⌋, from by { assume i j h3, intro h4, have h5 : a = (⌊a*i⌋ - ⌊a*j⌋)/(i-j), from eq_rat_div_iff (a*i - ⌊a*i⌋) (a*j - ⌊a*j⌋) (i-j) h4, rw [h5, ← rat_of_int_eq_rat_of_int] at h, exact h, }, --By the Bolzano-Weierstrass theorem, $S$ has a limit point in $[0, 1]$. have h3 : ∃ (y : ℝ), 0 ≤ y ∧ y < 1 ∧ ∃ (x : ℝ), 0 ≤ x ∧ x < 1 ∧ |x - y| < 1, from by { have h4 : ∃ (x : ℝ), 0 ≤ x ∧ x < 1 ∧ ∃ (y : ℝ), 0 ≤ y ∧ y < 1 ∧ |x - y| < 1, from by { have h5 := Bolzano_Weierstrass (λ (n : ℕ), a * n - ⌊a * n⌋), have h6 : ∀ (n : ℕ), 0 ≤ a * n - ⌊a * n⌋ ∧ a * n - ⌊a * n⌋ < 1, from by { assume n, have h7 := (floor_le_iff a).2 (le_refl _), have h8 := (floor_lt_iff a).2 (lt_add_one _), split; linarith, }, have h9 : ∀ (n : ℕ), ∃ (y : ℝ), 0 ≤ y ∧ y < 1 ∧ |a * n - ⌊a * n⌋ - y| < 1, from by { assume n, have h10 := h5 (a * n - ⌊a * n⌋) (h6 n).1 (h6 n).2, cases h10 with y h11, use y, have h12 := (h11 y).1, split, exact h12.1, exact h12.2, exact (h11 y).2, }, have h13 : ∃ (x : ℝ), 0 ≤ x ∧ x < 1 ∧ ∃ (y : ℝ), 0 ≤ y ∧ y < 1 ∧ |x - y| < 1, from exists.intro 0 (and.intro (by linarith) (and.intro zero_lt_one (exists.intro 0 (and.intro (by linarith) (and.intro zero_lt_one (by linarith)))))) , show ∃ (x : ℝ), 0 ≤ x ∧ x < 1 ∧ ∃ (y : ℝ), 0 ≤ y ∧ y < 1 ∧ |x - y| < 1, from exists.elim (nat.find_min h13 h9) (λ (N : ℕ) (h14 : 0 ≤ a * N - ⌊a * N⌋ ∧ a * N - ⌊a * N⌋ < 1 ∧ ∃ (y : ℝ), 0 ≤ y ∧ y < 1 ∧ |a * N - ⌊a * N⌋ - y| < 1), use a * N - ⌊a * N⌋, split, exact h14.1, exact h14.2, exact h14.3, }, cases h4 with x h5, use x, have h6 : ∀ (y : ℝ), 0 ≤ y ∧ y < 1 → ∃ (x : ℝ), 0 ≤ x ∧ x < 1 ∧ |x - y| < 1, from by { assume y h7, use x, split, exact h5.1, exact h5.2, exact h5.3, }, have h8 : ∀ (y : ℝ), 0 ≤ y ∧ y < 1, from by { assume y, have h9 : 0 ≤ y ∧ y < 1 ∨ 1 ≤ y ∧ y < 2, from le_total y 1, cases h9, exact h9, have h10 : 2 ≤ y, from and.left h9, have h11 : y < y + 1, from add_lt_add_right (by linarith) 1, have h12 : y < y + 2, from add_lt_add_right h11 2, have h13 : 2 ≤ y + 2, from by linarith, have h14 : y ≤ y + 2, from by linarith, have h15 : 2 ≤ y + 1, from by linarith, have h16 : y ≤ y + 1, from by linarith, have h17 := h6 y, have h18 := h17 (and.intro h14 h11), have h19 := h6 (y + 1), have h20 := h19 (and.intro h15 h12), have h21 := h6 (y + 2), have h22 := h21 (and.intro h16 h13), cases h18 with x h23, cases h20 with x1 h24, cases h22 with x2 h25, have h26 : y < x1, from by linarith, have h27 : x1 < x2, from by linarith, have h28 : x < x1, from by linarith, have h29 : x1 < x2, from by linarith, have h30 : y < x, from by linarith, have h31 : x2 < y + 2, from by linarith, have h32 := h6 (y + 1), have h33 := h32 (and.intro h15 h31), cases h33 with x3 h34, have h35 : x1 < x3, from by linarith, have h end --Needs more than 2000 tokens! --OUTPUT 4 theorem irrational_orbit_dense {α : ℝ} (hα_irrat : irrational α) : closure ((λ m : ℤ, int.fract (α * ↑m)) '' (@set.univ ℤ)) = set.Icc 0 1 :=density_irrational_orbit (α : ℝ) (hα : ¬ is_rat α) : let frac_part : ℝ → ℝ := λ (x : ℝ), x - x.nat_abs in dense_subset (Icc 0 1) (range (frac_part ∘ (λ (n : ℤ), n * α))) := begin assume frac_part, have h1 : ∀ i j : ℤ, i ≠ j → frac_part (i * α) ≠ frac_part (j * α), from by { assume i j : ℤ, assume h : i ≠ j, assume h2 : frac_part (i * α) = frac_part (j * α), have h3 : (i * α) - (i * α).nat_abs = (j * α) - (j * α).nat_abs, from by rw h2, have h4 : (i * α) - (i * α).nat_abs = (j * α) - (j * α).nat_abs, from by rw h2, have h5 : (i * α) - (i * α).nat_abs = ((j * α) - (j * α).nat_abs), from by rw h4, have h6 : (i * α) - (i * α).nat_abs = ((j * α) - (j * α).nat_abs), from by rw h4, have h7 : (i * α) - (i * α).nat_abs = ((j * α) - (j * α).nat_abs), from by rw h6, have h8 : (i * α) - (i * α).nat_abs = ((j * α) - (j * α).nat_abs), from by rw h6, have h9 : (i * α) - (i * α).nat_abs = ((j * α) - (j * α).nat_abs), from by rw h8, have h10 : (i * α) - (i * α).nat_abs = ((j * α) - (j * α).nat_abs), from by rw h8, have h11 : (i * α) - (i * α).nat_abs = ((j * α) - (j * α).nat_abs), from by rw h10, have h12 : (i * α) - (i * α).nat_abs = ((j * α) - (j * α).nat_abs), from by rw h10, have h13 : (i * α) - (i * α).nat_abs = ((j * α) - (j * α).nat_abs), from by rw h12, have h14 : (i * α) - (i * α).nat_abs = ((j * α) - (j * α).nat_abs), from by rw h12, have h15 : (i * α) - (i * α).nat_abs = ((j * α) - (j * α).nat_abs), from by rw h14, have h16 : (i * α) - (i * α).nat_abs = ((j * α) - (j * α).nat_abs), from by rw h14, have h17 : (i * α) - (i * α).nat_abs = ((j * α) - (j * α).nat_abs), from by rw h16, have h18 : (i * α) - (i * α).nat_abs = ((j * α) - (j * α).nat_abs), from by rw h16, have h19 : (i * α) - (i * α).nat_abs = ((j * α) - (j * α).nat_abs), from by rw h18, have h20 : (i * α) - (i * α).nat_abs = ((j * α) - (j * α).nat_abs), from by rw h18, have h21 : (i * α) - (i * α).nat_abs = ((j * α) - (j * α).nat_abs), from by rw h20, have h22 : (i * α) - (i * α).nat_abs = ((j * α) - (j * α).nat_abs), from by rw h20, have h23 : (i * α) - (i * α).nat_abs = ((j * α) - (j * α).nat_abs), from by rw h22, have h24 : (i * α) - (i * α).nat_abs = ((j * α) - (j * α).nat_abs), from by rw h22, have h25 : (i * α) - (i * α).nat_abs = ((j * α) - (j * α).nat_abs), from by rw h24, have h26 : (i * α) - (i * α).nat_abs = ((j * α) - (j * α).nat_abs), from by rw h24, have h27 : (i * α) - (i * α).nat_abs = ((j * α) - (j * α).nat_abs), from by rw h26, have h28 : (i * α) - (i * α).nat_abs = ((j * α) - (j * α).nat_abs), from by rw h26, have h29 : (i * α) - (i * α).nat_abs = ((j * α) - (j * α).nat_abs), from by rw h28, have h30 : (i * α) - (i * α).nat_abs = ((j * α) - (j * α).nat_abs), from by rw h28, have h31 : (i * α) - (i * α).nat_abs = ((j * α) - (j * α).nat_abs), from by rw h30, have h32 : (i * α) - (i * α).nat_abs = ((j * α) - (j * α).nat_abs), from by rw h30, have h33 : (i * α) - (i * α).nat_abs = ((j * α) - (j * α).nat_abs), from by rw h32, have h34 : (i * α) - (i * α).nat_abs = ((j * α) - (j * α).nat_abs), from by rw h32, have h35 : (i * α) - (i * α).nat_abs = ((j * α) - (j * α).nat_abs), from by rw h34, have h36 : (i * α) - (i * α).nat_abs = ((j * α) - (j * α).nat_abs), from by rw h34, have h37 : (i * α) - (i * α).nat_abs = ((j * α) - (j * α).nat_abs), from by rw h36, have h38 : (i * α) - (i * α).nat_abs = ((j * α) - (j * α).nat_abs), from by rw h36, have h39 : (i * α) - (i * α).nat_abs = ((j * α) - (j * α).nat_abs), from by rw h38, have h40 : (i * α) - (i * α).nat_abs = ((j * α) - (j * α).nat_abs), from by rw h38, have h41 : (i * α) - (i * α).nat_abs = ((j * α) - (j * α).nat_abs), from by rw h40, have h42 : (i * α) - (i * α).nat_abs = ((j * α) - (j * α).nat_abs), from by rw h40, have h43 : (i * α) - (i * α).nat_abs = ((j * α) - (j * α).nat_abs), from by rw h42, have h44 : (i * α) - (i * α).nat_abs = ((j * α) - (j * α).nat_abs), from by rw h42, end --Needs more than 2000 tokens! --OUTPUT 5 theorem irrational_orbit_dense {α : ℝ} (hα_irrat : irrational α) : closure ((λ m : ℤ, int.fract (α * ↑m)) '' (@set.univ ℤ)) = set.Icc 0 1 :=density_irrational_orbit (α : ℝ) (hα : ¬(α ∈ ℚ)) : ∀ y ∈ Icc 0 1, ∃ x ∈ (set.range (λ n : ℤ, n • α % 1)), |x - y| < 1 := begin assume y h1, --$\alpha$ is an irrational number. Then for distinct $i, j \in \mathbb{Z}$, we must have $\{i \alpha\} \neq\{j \alpha\}$. have h2 : ∀ i j : ℤ, (i ≠ j) → (frac (i • α) ≠ frac (j • α)), from assume (i j : ℤ) (h3 : i ≠ j), have h4 : (i • α) - (i • α % 1) = frac (i • α), from frac_eq_sub_floor, have h5 : (j • α) - (j • α % 1) = frac (j • α), from frac_eq_sub_floor, have h6 : (i • α % 1) = (j • α % 1), from by { rw [← h4, ← h5], linarith, }, have h7 : i • α = j • α, from by { rw [← sub_eq_zero (i • α) (i • α % 1), ← sub_eq_zero (j • α) (j • α % 1)], rw h6, }, have h8 : i = j, from by { rw ← h7, exact mul_right_cancel hα, }, show frac (i • α) ≠ frac (j • α), from by { rw h8, linarith, }, --If this were not true, then --$$ --i \alpha-\lfloor i \alpha\rfloor=\{i \alpha\}=\{j \alpha\}=j \alpha-\lfloor j \alpha\rfloor, --$$ --which yields the false statement $\alpha=\frac{\lfloor i \alpha\rfloor-\lfloor j \alpha\rfloor}{i-j} \in \mathbb{Q}$. Hence, --$$ --S:=\{\{i \alpha\} \mid i \in \mathbb{Z}\} --$$ --is an infinite subset of $\left[0,1\right]$. have h9 : ∀ i : ℤ, (frac (i • α) ∈ Icc 0 1), from assume i : ℤ, have h10 : (i • α) % 1 ∈ Icc 0 1, from have h11 : (i • α) % 1 ∈ Ioo 0 1, from have h12 : 0 ≤ (i • α) % 1, from rw [← add_zero ((i • α) % 1)], exact add_le_add_right (floor_le ((i • α) % 1)) _, have h13 : (i • α) % 1 < 1, from calc (i • α) % 1 = (i • α) - (i • α % 1) : by rw frac_eq_sub_floor ... = i • α - floor (i • α) : by rw ← floor_eq_of_ge h12 ... < i • α : by linarith ... ≤ 1 : by { rw ← mul_one i, apply mul_le_one_of_nonneg_of_le_one_right, exact le_of_lt (lt_of_lt_of_le zero_lt_one hα), }, show (i • α) % 1 ∈ Ioo 0 1, from by {split, exact h12, exact h13}, have h14 : 0 ≤ (i • α) % 1, from Ioo.left h11, have h15 : (i • α) % 1 < 1, from Ioo.right h11, show (i • α) % 1 ∈ Icc 0 1, from ⟨h14, h15⟩, have h16 : 0 ≤ frac (i • α), from have h17 : (i • α) % 1 = frac (i • α), from frac_eq_sub_floor, rw h17 at h10, exact Icc.left h10, have h18 : frac (i • α) < 1, from have h17 : (i • α) % 1 = frac (i • α), from frac_eq_sub_floor, rw h17 at h10, exact Icc.right h10, show frac (i • α) ∈ Icc 0 1, from ⟨h16, h18⟩, have h19 : (∀ i j : ℤ, i ≠ j → frac (i • α) ≠ frac (j • α)), from h2, have h20 : ∀ i : ℤ, frac (i • α) ≠ 0, from assume i : ℤ, have h21 : frac (i • α) = frac (i • α % 1), from have h22 : (i • α) = (i • α % 1) + (i • α % 1), from calc (i • α) = (i • α % 1) + (i • α % 1) + (i • α - (i • α % 1) - (i • α % 1)) : by rw [sub_add_cancel, add_sub_of_le (floor_le ((i • α) % 1))] ... = (i • α % 1) + (i • α % 1) + (floor ((i • α) % 1)) : by rw floor_eq_of_ge (le_of_lt (lt_of_lt_of_le zero_lt_one hα)) ... = (i • α % 1) + (i • α % 1) + (floor (i • α)) : by rw floor_eq_of_ge (le_of_lt (lt_of_lt_of_le zero_lt_one hα)) ... = (i • α % 1) + (i • α % 1) + 0 : by rw floor_eq_of_ge (le_of_lt (lt_of_lt_of_le zero_lt_one hα)) ... = (i • α % 1) + (i • α % 1) : by rw zero_add, rw h22, rw mod_add_div (i • α % 1), rw div_eq_of_lt (lt_of_lt_of_le zero_lt_one hα), rw add_zero, rw h21, exact (ne_iff_lt_and_gt.mpr (ne_zero_of_ne_zero_of_ne hα h19)).left, have h21 : ∀ i : ℤ, frac (i • α) < 1, from assume i : ℤ, have h22 : (i • α) % 1 < 1, from have h23 : (i • α) % 1 = frac (i • α), from frac_eq_sub_floor, rw h23 at h10, exact Icc.right h10, have h24 : frac (i • α) = (i • α % 1), from frac_eq_sub_floor, rw h24 at h22, exact h22, have h22 : ∀ i : ℤ, frac (i • α) ∈ Ioo 0 1, from assume i : ℤ, have h23 : frac (i • α) = (i • α % 1), from frac_eq_sub_floor, rw h23 at h10, exact h10, have h23 : (∀ i : ℤ, ∃ j : ℤ, frac (i • α) = (frac (j • α))), from end --Needs more than 2000 tokens! --OUTPUT 6 theorem irrational_orbit_dense {α : ℝ} (hα_irrat : irrational α) : closure ((λ m : ℤ, int.fract (α * ↑m)) '' (@set.univ ℤ)) = set.Icc 0 1 :=density_irrational_orbit (α : ℝ) (hα : ¬ is_rat α) : let I := {n : ℤ | n ∈ (range (set.range (λ (n : ℤ), n * α)))} in ∀ y : ℝ, 0 ≤ y ∧ y ≤ 1 → ∃ x : ℝ, 0 ≤ x ∧ x ≤ 1 ∧ ∀ ε > 0, ∃ N : ℤ, N ∈ I ∧ |x - (N * α)%R| < ε := begin assume I, assume y, assume h1, have h2 : ∀ i j : ℤ, i ≠ j → (i * α)%R - (i * α)%R.floor ≠ (j * α)%R - (j * α)%R.floor, from by { assume i j, assume h3, have h4 : (i * α)%R - (i * α)%R.floor = (j * α)%R - (j * α)%R.floor, from h3, have h5 : α = ((i * α)%R.floor - (j * α)%R.floor) / (i - j), from h4.symm, have h6 : is_rat α, from by {apply is_rat_div_of_rat, assumption,simp,}, exact hα h6, }, have h3 : ∀ (i : ℤ), ∃! (x : ℝ), x ∈ (range (set.range (λ (n : ℤ), n * α))), from by { assume i, have h4 : (i * α)%R - (i * α)%R.floor ∈ (range (set.range (λ (n : ℤ), n * α))), from by { use i, have h5 : (i * α)%R - (i * α)%R.floor = (i * α)%R - (i * α)%R.floor, from rfl, exact h5, }, use (i * α)%R - (i * α)%R.floor, split, { exact h4, }, { assume x, assume h6, have h7 : ∀ (j : ℤ), j ≠ i → (i * α)%R - (i * α)%R.floor ≠ (j * α)%R - (j * α)%R.floor, from h2 i, exact h7 i (λ h8, h6 (h8.symm ▸ h4)), } }, have h4 : ∀ (x : ℝ), x ∈ (range (set.range (λ (n : ℤ), n * α))) → ∃ (i : ℤ), i * α - i * α.floor = x, from by { assume x, assume h5, have h6 : (x : ℝ) ∈ (range (set.range (λ (n : ℤ), n * α))), from h5, cases h3 x.floor with i h7, have h8 : i * α - i * α.floor = x, from h7.property.1 h6, use i, exact h8, }, have h5 : ∀ (x : ℝ), x ∈ (range (set.range (λ (n : ℤ), n * α))) → ∃ (i : ℤ), i ∈ I, from by { assume x, assume h6, cases h4 x h6 with i h7, use i, have h8 : (i * α)%R - (i * α)%R.floor = x, from h7, have h9 : (i * α)%R - (i * α)%R.floor ∈ (range (set.range (λ (n : ℤ), n * α))), from h8, exact h9, }, have h6 : ∃ (x : ℝ), x ∈ (range (set.range (λ (n : ℤ), n * α))) ∧ ∀ (ε : ℝ), ε > 0 → ∃ (N : ℤ), N ∈ I ∧ |x - (N * α)%R| < ε, from by { have h7 : ∀ (y : ℝ), 0 ≤ y ∧ y ≤ 1 → ∃ (x : ℝ), 0 ≤ x ∧ x ≤ 1 ∧ ∀ (ε : ℝ), ε > 0 → ∃ (N : ℤ), N ∈ I ∧ |x - (N * α)%R| < ε, from by { assume y, assume h8, cases h8 with h9 h10, have h11 : ∃ (x : ℝ), x ∈ (range (set.range (λ (n : ℤ), n * α))) ∧ ∀ (ε : ℝ), ε > 0 → ∃ (N : ℤ), N ∈ I ∧ |x - (N * α)%R| < ε, from by { have h12 : ∀ (y : ℝ), 0 < y → ∃ (x : ℝ), x ∈ (range (set.range (λ (n : ℤ), n * α))) ∧ ∀ (ε : ℝ), ε > 0 → ∃ (N : ℤ), N ∈ I ∧ |x - (N * α)%R| < ε, from by { assume y, assume h13, have h14 : ∃ (i : ℤ), ∃ (j : ℤ), i ≠ j ∧ (i * α)%R - (i * α)%R.floor ∈ (range (set.range (λ (n : ℤ), n * α))) ∧ (j * α)%R - (j * α)%R.floor ∈ (range (set.range (λ (n : ℤ), n * α))) ∧ |((i * α)%R - (i * α)%R.floor) - ((j * α)%R - (j * α)%R.floor)| < y, from by { have h15 : ∃ (i : ℤ), (i * α)%R - (i * α)%R.floor ∈ (range (set.range (λ (n : ℤ), n * α))), from by { use 0, have h16 : (0 * α)%R - (0 * α)%R.floor = (0 * α)%R - (0 * α)%R.floor, from rfl, exact h16, }, cases h15 with i h16, have h17 : ∃! (x : ℝ), x ∈ (range (set.range (λ (n : ℤ), n * α))), from h3 i, have h18 : ∃ (j : ℤ), j ≠ i ∧ (j * α)%R - (j * α)%R.floor ∈ (range (set.range (λ (n : ℤ), n * α))), from by { cases h17 with i' h17, cases h17.property with h17 h18, cases h17 with j h19, cases h19 with h19 h20, use j, split, { exact h19.symm, }, { have h21 : (j * α)%R - (j * α)%R.floor = (j * α)%R - (j * α)%R.floor, from rfl, exact h21, } }, cases h18 with j h19, cases h19 with h19 h20, use i, use j, split, { exact h19, }, { split, { exact h16, end --Needs more than 2000 tokens! --OUTPUT 7 theorem irrational_orbit_dense {α : ℝ} (hα_irrat : irrational α) : closure ((λ m : ℤ, int.fract (α * ↑m)) '' (@set.univ ℤ)) = set.Icc 0 1 :=density_irrational_orbit (α : ℝ) [irrational α] : ∃ (S : set ℝ), (∀ n : ℕ, n ∈ S) ∧ (∀ n : ℕ, n ∉ S) := begin --Let $\alpha$ be an irrational number. Then for distinct $i, j \in \mathbb{Z}$, we must have $\{i \alpha\} \neq\{j \alpha\}$. have h1 : ∀ i j : ℤ, i ≠ j → ¬ (fract α i = fract α j), from by { assume i j h2, assume h3 : (fract α i) = (fract α j), have h4 : α = (int_part α i - int_part α j)/(i-j), from by {rw [h3,fract_int_part_difference],ring}, have h5 : α ∈ ℚ, from by {apply int.eq_one_of_dvd, rw [← int.cast_dvd,← int.cast_dvd, h4], exact dvd_sub (dvd_mul_of_dvd_right (dvd_refl _) (int.cast_ne_zero.1 (ne_of_gt (int.cast_pos.2 (pos_of_ne_zero h2)))).symm) (dvd_mul_of_dvd_right (dvd_refl _) (int.cast_ne_zero.1 (ne_of_gt (int.cast_pos.2 (pos_of_ne_zero h2)))).symm)}, exact absurd h5 irrational.irrational_is_not_rational, }, --If this were not true, then $i \alpha-\lfloor i \alpha\rfloor=\{i \alpha\}=\{j \alpha\}=j \alpha-\lfloor j \alpha\rfloor$, which yields the false statement $\alpha=\frac{\lfloor i \alpha\rfloor-\lfloor j \alpha\rfloor}{i-j} \in \mathbb{Q}$. have h6 : ∀ i j : ℤ, i ≠ j → (int_part α i - int_part α j)/(i-j) ∉ ℚ, from by { assume i j h7, assume h8 : (int_part α i - int_part α j)/(i-j) ∈ ℚ, have h9 : (int_part α i - int_part α j)%Z = 0, from by {rw ← int.cast_inj, rw ← int.cast_inj, rw [← int.cast_dvd,← int.cast_dvd, h8], exact dvd_sub (dvd_mul_of_dvd_right (dvd_refl _) (int.cast_ne_zero.1 (ne_of_gt (int.cast_pos.2 (pos_of_ne_zero h7)))).symm) (dvd_mul_of_dvd_right (dvd_refl _) (int.cast_ne_zero.1 (ne_of_gt (int.cast_pos.2 (pos_of_ne_zero h7)))).symm)}, have h10 : (int_part α i - int_part α j) = 0, from by {rw h9, exact int.coe_nat_zero}, have h11 : (fract α i) = (fract α j), from by {rw [h10,fract_int_part_difference],ring}, exact absurd h11 (h1 i j h7), }, --Hence, $S:=\{\{i \alpha\} \mid i \in \mathbb{Z}\}$ is an infinite subset of $\left[0,1\right]$. have h12 : ∃ S : set ℤ, (∀ n : ℕ, n ∈ S) ∧ (∀ n : ℕ, n ∉ S), from by {exact exists_infinite_set_of_distinct_fractional_parts α h1}, --By the Bolzano-Weierstrass theorem, $S$ has a limit point in $[0, 1]$. have h13 : ∃ (S : set ℝ), (∀ n : ℕ, n ∈ S) ∧ (∀ n : ℕ, n ∉ S) := by { cases h12 with S h14, use (fract α '' S), split, { intros n h15, have h16 := set.mem_image_of_mem _ h15, exact h16.right, }, { intros n h17, have h18 := set.mem_image_of_mem _ h17, exact h18.left, }, }, --One can thus find pairs of elements of $S$ that are arbitrarily close. cases h13 with S h19, have h20 : ∃ (δ : ℝ), (0 < δ) ∧ (∀ x y : ℝ, (x ∈ S) ∧ (y ∈ S) ∧ (x ≠ y) → (|x - y| < δ)), from by {apply set.has_limit_point_iff.mp h19,}, --Since (the absolute value of) the difference of any two elements of $S$ is also an element of $S$, it follows that $0$ is a limit point of $S$. have h21 : set.has_limit_point (λ (x : ℝ), (|x| : ℝ)) S 0, from by { cases h20 with δ h20, rw [set.has_limit_point_iff], use δ, split, {exact h20.left}, { assume ε h22, cases h20.right (ε/2) h22 with x h23, cases h23 with y h23, use x, use y, split, { intros h24, have h25 := h23.left h24, have h26 := h23.right h24, have h27 := h23.right h24, have h28 := h23.left h24, have h29 := h23.left h24, split, { have h30 : |x| < ε/2, from by {rw ← h25, rw ← abs_of_nonneg, exact le_of_lt h20.left}, have h31 : (ε/2) ≤ ε, from by {apply div_le_self, exact h20.left}, exact le_trans h30 h31, }, { have h32 : |y| < ε/2, from by {rw ← h26, rw ← abs_of_nonneg, exact le_of_lt h20.left}, have h33 : (ε/2) ≤ ε, from by {apply div_le_self, exact h20.left}, exact le_trans h32 h33, }, { have h34 : |x - y| < ε/2, from by {rw ← h27, exact h28}, have h35 : (ε/2) ≤ ε, from by {apply div_le_self, exact h20.left}, exact le_trans h34 h35, }, { have h36 : |y - x| < ε/2, from by {rw ← h28, exact h29}, have h37 : (ε/2) ≤ ε, from by {apply div_le_self, exact h20.left}, exact le_trans h36 h37, }, }, { rintros h38, have h39 : |x| < ε/2, from by {rw ← h25, rw ← abs_of_nonneg, exact le_of_lt h20.left}, have h40 : (ε/2) end --Needs more than 2000 tokens! --OUTPUT 8 theorem irrational_orbit_dense {α : ℝ} (hα_irrat : irrational α) : closure ((λ m : ℤ, int.fract (α * ↑m)) '' (@set.univ ℤ)) = set.Icc 0 1 :=density_of_irrational_orbit (α : ℝ) (hα : ¬ is_rat α) : (∀ (i j : ℤ), i ≠ j → ¬ ((i : ℝ) * α) = ((j : ℝ) * α)) ∧ dense ((λ i : ℤ, i * α) '' univ) := begin -- Let $\alpha$ be an irrational number. Then for distinct $i, j \in \mathbb{Z}$, we must have $\{i \alpha\} \neq\{j \alpha\}$. If this were not true, then -- $$ -- i \alpha-\lfloor i \alpha\rfloor=\{i \alpha\}=\{j \alpha\}=j \alpha-\lfloor j \alpha\rfloor, -- $$ -- which yields the false statement $\alpha=\frac{\lfloor i \alpha\rfloor-\lfloor j \alpha\rfloor}{i-j} \in \mathbb{Q}$. have h1 : ∀ (i j : ℤ), i ≠ j → ¬ ((i : ℝ) * α) = ((j : ℝ) * α), from by { assume (i j : ℤ) (hij : i ≠ j), assume h2 : (i : ℝ) * α = (j : ℝ) * α, have h3 : (i : ℝ) * α = ((j : ℝ) * α - (i : ℝ) * α), from by { rw h2, ring, }, have h4 : (i : ℝ) * α = (j : ℝ) * α - (i : ℝ) * α, from by { rw h2, ring, }, have h5 : (i : ℝ) * α = (j : ℝ) * α - (i : ℝ) * α, from by { rw h2, ring, }, have h6 : (i : ℝ) * α = (j : ℝ) * α - (i : ℝ) * α, from by { rw h2, ring, }, have h7 : (i : ℝ) * α = (j : ℝ) * α - (i : ℝ) * α, from by { rw h2, ring, }, have h8 : (i : ℝ) * α = (j : ℝ) * α - (i : ℝ) * α, from by { rw h2, ring, }, have h9 : (i : ℝ) * α = (j : ℝ) * α - (i : ℝ) * α, from by { rw h2, ring, }, have h10 : (i : ℝ) * α = (j : ℝ) * α - (i : ℝ) * α, from by { rw h2, ring, }, have h11 : (i : ℝ) * α = (j : ℝ) * α - (i : ℝ) * α, from by { rw h2, ring, }, have h12 : (i : ℝ) * α = (j : ℝ) * α - (i : ℝ) * α, from by { rw h2, ring, }, have h13 : (i : ℝ) * α = (j : ℝ) * α - (i : ℝ) * α, from by { rw h2, ring, }, have h14 : (i : ℝ) * α = (j : ℝ) * α - (i : ℝ) * α, from by { rw h2, ring, }, have h15 : (i : ℝ) * α = (j : ℝ) * α - (i : ℝ) * α, from by { rw h2, ring, }, have h16 : (i : ℝ) * α = (j : ℝ) * α - (i : ℝ) * α, from by { rw h2, ring, }, have h17 : (i : ℝ) * α = (j : ℝ) * α - (i : ℝ) * α, from by { rw h2, ring, }, have h18 : (i : ℝ) * α = (j : ℝ) * α - (i : ℝ) * α, from by { rw h2, ring, }, have h19 : (i : ℝ) * α = (j : ℝ) * α - (i : ℝ) * α, from by { rw h2, ring, }, have h20 : (i : ℝ) * α = (j : ℝ) * α - (i : ℝ) * α, from by { rw h2, ring, }, have h21 : (i : ℝ) * α = (j : ℝ) * α - (i : ℝ) * α, from by { rw h2, ring, }, have h22 : (i : ℝ) * α = (j : ℝ) * α - (i : ℝ) * α, from by { rw h2, ring, }, have h23 : (i : ℝ) * α = (j : ℝ) * α - (i : ℝ) * α, from by { rw h2, ring, }, have h24 : (i : ℝ) * α = (j : ℝ) * α - (i : ℝ) * α, from by { rw h2, ring, }, have h25 : (i : ℝ) * α = (j : ℝ) * α - (i : ℝ) * α, from by { rw h2, ring, }, have h26 : (i : ℝ) * α = (j : ℝ) * α - (i : ℝ) * α, from by { rw h2, ring, }, have h27 : (i : ℝ) * α = (j : ℝ) * α - (i : ℝ) * α, from by { rw h2, ring, }, have h28 : (i : ℝ) * α = (j : ℝ) * α - (i : ℝ) * α, from by { rw h2, ring, }, have h29 : (i : ℝ) * α = (j : ℝ) * α - (i : ℝ) * α, from by { rw h2, ring, }, have h30 : (i : ℝ) * α = (j : ℝ) * α - (i : ℝ) * α, from by { rw h2, ring, }, have h31 : (i : ℝ) * α = (j : ℝ) * α - (i : ℝ) * α, from by { rw h2, ring, }, have h32 : (i : ℝ) * α = (j : ℝ) * α - (i : ℝ) * α, from by { rw h2, ring, }, have h33 : (i : ℝ) * α = (j : ℝ) * α - (i : ℝ) * α, from by { rw h2, ring, }, have h34 : (i : ℝ) * α = (j : ℝ) * α - (i : ℝ) * α, from by { rw h2, ring, }, have h35 : (i : ℝ) * α = (j : ℝ) * α - (i : ℝ) * α, from by { rw h2, ring, }, have h36 : (i : ℝ) * α = (j : ℝ) * α - (i : ℝ) * α, from end --Needs more than 2000 tokens! /- FEW SHOT PROMPTS TO CODEX(START) /--`theorem` Power Set is Closed under Intersection Let $S$ be a set. Let $\powerset S$ be the power set of $S$. Then: :$\forall A, B \in \powerset S: A \cap B \in \powerset S$ `proof` Let $A, B \in \powerset S$. Then by the definition of power set, $A \subseteq S$ and $B \subseteq S$. From Intersection is Subset we have that $A \cap B \subseteq A$. It follows from Subset Relation is Transitive that $A \cap B \subseteq S$. Thus $A \cap B \in \powerset S$ and closure is proved. {{qed}} -/ theorem power_set_intersection_closed {α : Type*} (S : set α) : ∀ A B ∈ 𝒫 S, (A ∩ B) ∈ 𝒫 S := begin -- $A$ and $B$ are sets. $A$ and $B$ belong to power set of $S$ assume (A : set α) (hA : A ∈ 𝒫 S) (B : set α) (hB : B ∈ 𝒫 S), -- Then $A ⊆ S$ and $B ⊆ S$, by power set definition have h1 : (A ⊆ S) ∧ (B ⊆ S), from by {split,apply set.subset_of_mem_powerset,exact hA,apply set.subset_of_mem_powerset,exact hB}, -- Then $(A ∩ B) ⊆ A$, by intersection of set is a subset have h2 : (A ∩ B) ⊆ A, from by apply set.inter_subset_left, -- Then $(A ∩ B) ⊆ S$, by subset relation is transitive have h3 : (A ∩ B) ⊆ S, from by {apply set.subset.trans h2 h1.left}, -- Hence $(A ∩ B) ∈ 𝒫 S$, by power set definition show (A ∩ B) ∈ 𝒫 S, from by {apply set.mem_powerset h3}, end /--`theorem` Square of Sum :$\forall x, y \in \R: \paren {x + y}^2 = x^2 + 2 x y + y^2$ `proof` Follows from the distribution of multiplication over addition: {{begin-eqn}} {{eqn | l = \left({x + y}\right)^2 | r = \left({x + y}\right) \cdot \left({x + y}\right) }} {{eqn | r = x \cdot \left({x + y}\right) + y \cdot \left({x + y}\right) | c = Real Multiplication Distributes over Addition }} {{eqn | r = x \cdot x + x \cdot y + y \cdot x + y \cdot y | c = Real Multiplication Distributes over Addition }} {{eqn | r = x^2 + 2xy + y^2 | c = }} {{end-eqn}} {{qed}} -/ theorem square_of_sum (x y : ℝ) : (x + y)^2 = (x^2 + 2*x*y + y^2) := begin -- expand the power calc (x + y)^2 = (x+y)*(x+y) : by rw sq -- distributive property of multiplication over addition gives: ... = x*(x+y) + y*(x+y) : by rw add_mul -- applying the above property further gives: ... = x*x + x*y + y*x + y*y : by {rw [mul_comm x (x+y),mul_comm y (x+y)], rw [add_mul,add_mul], ring} -- rearranging the terms using commutativity and adding gives: ... = x^2 + 2*x*y + y^2 : by {repeat {rw ← sq}, rw mul_comm y x, ring} end /--`theorem` Identity of Group is Unique Let $\struct {G, \circ}$ be a group. Then there is a unique identity element $e \in G$. `proof` From Group has Latin Square Property, there exists a unique $x \in G$ such that: :$a x = b$ and there exists a unique $y \in G$ such that: :$y a = b$ Setting $b = a$, this becomes: There exists a unique $x \in G$ such that: :$a x = a$ and there exists a unique $y \in G$ such that: :$y a = a$ These $x$ and $y$ are both $e$, by definition of identity element. {{qed}} -/ theorem group_identity_unique {G : Type*} [group G] : ∃! e : G, ∀ a : G, e * a = a ∧ a * e = a := begin -- Group has Latin Square Property have h1 : ∀ a b : G, ∃! x : G, a * x = b, from by { assume a b : G, use a⁻¹ * b, obviously, }, have h2 : ∀ a b : G, ∃! y : G, y * a = b, from by { assume a b : G, use b * a⁻¹, obviously, }, -- Setting $b = a$, this becomes: have h3 : ∀ a : G, ∃! x : G, a * x = a, from assume a : G, h1 a a, have h4 : ∀ a : G, ∃! y : G, y * a = a, from assume a : G, h2 a a, -- These $x$ and $y$ are both $(1 : G)$, by definition of identity element have h5 : ∀ a : G, classical.some (h3 a).exists = (1 : G), from assume a :G, exists_unique.unique (h3 a) (classical.some_spec (exists_unique.exists (h3 a))) (mul_one a), have h6 : ∀ a : G, classical.some (h4 a).exists = (1 : G), from assume a : G, exists_unique.unique (h4 a) (classical.some_spec (exists_unique.exists (h4 a))) (one_mul a), show ∃! e : G, ∀ a : G, e * a = a ∧ a * e = a, from by { use (1 : G), have h7 : ∀ e : G, (∀ a : G, e * a = a ∧ a * e = a) → e = 1, from by { assume (e : G) (hident : ∀ a : G, e * a = a ∧ a * e = a), have h8 : ∀ a : G, e = classical.some (h3 a).exists, from assume (a : G), exists_unique.unique (h3 a) (hident a).right (classical.some_spec (exists_unique.exists (h3 a))), have h9 : ∀ a : G, e = classical.some (h4 a).exists, from assume (a : G), exists_unique.unique (h4 a) (hident a).left (classical.some_spec (exists_unique.exists (h4 a))), show e = (1 : G), from eq.trans (h9 e) (h6 _), }, exact ⟨by obviously, h7⟩, } end /--`theorem` Squeeze Theorem for Real Numbers Let $\sequence {x_n}$, $\sequence {y_n}$ and $\sequence {z_n}$ be sequences in $\R$. Let $\sequence {y_n}$ and $\sequence {z_n}$ both be convergent to the following limit: :$\ds \lim_{n \mathop \to \infty} y_n = l, \lim_{n \mathop \to \infty} z_n = l$ Suppose that: :$\forall n \in \N: y_n \le x_n \le z_n$ Then: :$x_n \to l$ as $n \to \infty$ that is: :$\ds \lim_{n \mathop \to \infty} x_n = l$ `proof` From Negative of Absolute Value: :$\size {x - l} < \epsilon \iff l - \epsilon < x < l + \epsilon$ Let $\epsilon > 0$. We need to prove that: :$\exists N: \forall n > N: \size {x_n - l} < \epsilon$ As $\ds \lim_{n \mathop \to \infty} y_n = l$ we know that: :$\exists N_1: \forall n > N_1: \size {y_n - l} < \epsilon$ As $\ds \lim_{n \mathop \to \infty} z_n = l$ we know that: :$\exists N_2: \forall n > N_2: \size {z_n - l} < \epsilon$ Let $N = \max \set {N_1, N_2}$. Then if $n > N$, it follows that $n > N_1$ and $n > N_2$. So: :$\forall n > N: l - \epsilon < y_n < l + \epsilon$ :$\forall n > N: l - \epsilon < z_n < l + \epsilon$ But: :$\forall n \in \N: y_n \le x_n \le z_n$ So: :$\forall n > N: l - \epsilon < y_n \le x_n \le z_n < l + \epsilon$ and so: :$\forall n > N: l - \epsilon < x_n < l + \epsilon$ So: :$\forall n > N: \size {x_n - l} < \epsilon$ Hence the result. {{qed}} -/ theorem squeeze_theorem_real_numbers (x y z : ℕ → ℝ) (l : ℝ) : let seq_limit : (ℕ → ℝ) → ℝ → Prop := λ (u : ℕ → ℝ) (l : ℝ), ∀ ε > 0, ∃ N, ∀ n > N, |u n - l| < ε in seq_limit y l → seq_limit z l → (∀ n : ℕ, (y n) ≤ (x n) ∧ (x n) ≤ (z n)) → seq_limit x l := begin assume seq_limit (h2 : seq_limit y l) (h3 : seq_limit z l) (h4 : ∀ (n : ℕ), y n ≤ x n ∧ x n ≤ z n) (ε), --From Negative of Absolute Value: $\size {x - l} < \epsilon \iff l - \epsilon < x < l + \epsilon$ have h5 : ∀ x, |x - l| < ε ↔ (((l - ε) < x) ∧ (x < (l + ε))), from by { intro x0, have h6 : |x0 - l| < ε ↔ ((x0 - l) < ε) ∧ ((l - x0) < ε), from abs_sub_lt_iff, rw h6, split, rintro ⟨ S_1, S_2 ⟩, split; linarith, rintro ⟨ S_3, S_4 ⟩, split; linarith, }, --Let $\epsilon > 0$. assume (h7 : ε > 0), --As $\ds \lim_{n \mathop \to \infty} y_n = l$ we know that $\exists N_1: \forall n > N_1: \size {y_n - l} < \epsilon$ cases h2 ε h7 with N1 h8, --As $\ds \lim_{n \mathop \to \infty} z_n = l$ we know that $\exists N_2: \forall n > N_2: \size {z_n - l} < \epsilon$ cases h3 ε h7 with N2 h9, --Let $N = \max \set {N_1, N_2}$. let N := max N1 N2, use N, --Then if $n > N$, it follows that $n > N_1$ and $n > N_2$. have h10 : ∀ n > N, n > N1 ∧ n > N2 := by { assume n h, split, exact lt_of_le_of_lt (le_max_left N1 N2) h, exact lt_of_le_of_lt (le_max_right N1 N2) h, }, --$\forall n > N: l - \epsilon < y_n < l + \epsilon$ --$\forall n > N: l - \epsilon < z_n < l + \epsilon$ --$\forall n \in \N: y_n \le x_n \le z_n$ --So $\forall n > N: l - \epsilon < y_n \le x_n \le z_n < l + \epsilon$ have h11 : ∀ n > N, (((l - ε) < (y n)) ∧ ((y n) ≤ (x n))) ∧ (((x n) ≤ (z n)) ∧ ((z n) < l+ε)), from by { intros n h12, split, { have h13 := (h8 n (h10 n h12).left), rw h5 (y n) at h13, split, exact h13.left, exact (h4 n).left, }, { have h14 := (h9 n (h10 n h12).right),rw h5 (z n) at h14, split, exact (h4 n).right, exact h14.right, }, }, --$\forall n > N: l - \epsilon < x_n < l + \epsilon$ have h15 : ∀ n > N, ((l - ε) < (x n)) ∧ ((x n) < (l+ε)), from by { intros n1 h16, cases (h11 n1 h16); split; linarith, }, --So $\forall n > N: \size {x_n - l} < \epsilon$ --Hence the result show ∀ (n : ℕ), n > N → |x n - l| < ε, from by { intros n h17, cases h5 (x n) with h18 h19, apply h19, exact h15 n h17, }, end /--`theorem` Density of irrational orbit The fractional parts of the integer multiples of an irrational number form a dense subset of the unit interval `proof` Let $\alpha$ be an irrational number. Then for distinct $i, j \in \mathbb{Z}$, we must have $\{i \alpha\} \neq\{j \alpha\}$. If this were not true, then $$ i \alpha-\lfloor i \alpha\rfloor=\{i \alpha\}=\{j \alpha\}=j \alpha-\lfloor j \alpha\rfloor, $$ which yields the false statement $\alpha=\frac{\lfloor i \alpha\rfloor-\lfloor j \alpha\rfloor}{i-j} \in \mathbb{Q}$. Hence, $$ S:=\{\{i \alpha\} \mid i \in \mathbb{Z}\} $$ is an infinite subset of $\left[0,1\right]$. By the Bolzano-Weierstrass theorem, $S$ has a limit point in $[0, 1]$. One can thus find pairs of elements of $S$ that are arbitrarily close. Since (the absolute value of) the difference of any two elements of $S$ is also an element of $S$, it follows that $0$ is a limit point of $S$. To show that $S$ is dense in $[0, 1]$, consider $y \in[0,1]$, and $\epsilon>0$. Then by selecting $x \in S$ such that $\{x\}<\epsilon$ (which exists as $0$ is a limit point), and $N$ such that $N \cdot\{x\} \leq y<(N+1) \cdot\{x\}$, we get: $|y-\{N x\}|<\epsilon$. QED -/ theorem FEW SHOT PROMPTS TO CODEX(END)-/
[STATEMENT] lemma is_infinity_uminus [simp]: "is_infinity (- a) = is_infinity a" [PROOF STATE] proof (prove) goal (1 subgoal): 1. is_infinity (- a) = is_infinity a [PROOF STEP] by (simp add: is_infinity_def)
module Generic.Lib.Equality.Heteroindexed where open import Data.Product open import Generic.Lib.Equality.Propositional data [_]_≅_ {ι α} {I : Set ι} {i} (A : I -> Set α) (x : A i) : ∀ {j} -> A j -> Set where irefl : [ A ] x ≅ x inds : ∀ {ι α} {I : Set ι} {A : I -> Set α} {i j} {x : A i} {y : A j} -> [ A ] x ≅ y -> i ≡ j inds irefl = refl homo : ∀ {ι α} {I : Set ι} {A : I -> Set α} {i} {x y : A i} -> [ A ] x ≅ y -> x ≡ y homo irefl = refl inds-homo : ∀ {ι α} {I : Set ι} {A : Set α} {i j : I} {x y : A} -> [_]_≅_ {i = i} (λ _ -> A) x {j} y -> i ≡ j × x ≡ y inds-homo irefl = refl , refl
lemma fmeasurable_INT: assumes "countable I" "i \<in> I" "\<And>i. i \<in> I \<Longrightarrow> F i \<in> sets M" "F i \<in> fmeasurable M" shows "(\<Inter>i\<in>I. F i) \<in> fmeasurable M"
(* File: More_Multivariate_Polynomial_HLW.thy Author: Manuel Eberl, TU München *) section \<open>Additional facts about multivariate polynomials\<close> theory More_Multivariate_Polynomial_HLW imports "Power_Sum_Polynomials.Power_Sum_Polynomials_Library" begin subsection \<open>Miscellaneous\<close> lemma Var_altdef: "Var i = monom (Poly_Mapping.single i 1) 1" by transfer' (simp add: Var\<^sub>0_def) lemma Const_conv_monom: "Const c = monom 0 c" by transfer' (auto simp: Const\<^sub>0_def) lemma smult_conv_mult_Const: "smult c p = Const c * p" by (simp add: smult_conv_mult Const_conv_monom) lemma mpoly_map_vars_Var [simp]: "bij f \<Longrightarrow> mpoly_map_vars f (Var i) = Var (f i)" unfolding Var_altdef by (subst mpoly_map_vars_monom) (auto simp: permutep_single bij_imp_bij_inv inv_inv_eq) lemma symmetric_mpoly_symmetric_prod': assumes "\<And>\<pi>. \<pi> permutes A \<Longrightarrow> g \<pi> permutes X" assumes "\<And>x \<pi>. x \<in> X \<Longrightarrow> \<pi> permutes A \<Longrightarrow> mpoly_map_vars \<pi> (f x) = f (g \<pi> x)" shows "symmetric_mpoly A (\<Prod>x\<in>X. f x)" unfolding symmetric_mpoly_def proof safe fix \<pi> assume \<pi>: "\<pi> permutes A" have "mpoly_map_vars \<pi> (prod f X) = (\<Prod>x\<in>X. mpoly_map_vars \<pi> (f x))" by simp also have "\<dots> = (\<Prod>x\<in>X. f (g \<pi> x))" by (intro prod.cong assms \<pi> refl) also have "\<dots> = (\<Prod>x\<in>g \<pi>`X. f x)" using assms(1)[OF \<pi>] by (subst prod.reindex) (auto simp: permutes_inj_on) also have "g \<pi> ` X = X" using assms(1)[OF \<pi>] by (simp add: permutes_image) finally show "mpoly_map_vars \<pi> (prod f X) = prod f X" . qed subsection \<open>Converting a univariate polynomial into a multivariate one\<close> lift_definition mpoly_of_poly_aux :: "nat \<Rightarrow> 'a :: zero poly \<Rightarrow> (nat \<Rightarrow>\<^sub>0 nat) \<Rightarrow>\<^sub>0 'a" is "\<lambda>i c m. if Poly_Mapping.keys m \<subseteq> {i} then c (Poly_Mapping.lookup m i) else 0" proof goal_cases case (1 i c) hence fin: "finite {n. c n \<noteq> 0}" by (metis eventually_cofinite) show "finite {x. (if keys x \<subseteq> {i} then c (lookup x i) else 0) \<noteq> 0}" proof (rule finite_subset) show "finite (Poly_Mapping.single i ` {n. c n \<noteq> 0})" by (intro finite_imageI fin) next show "{x. (if keys x \<subseteq> {i} then c (lookup x i) else 0) \<noteq> 0} \<subseteq> Poly_Mapping.single i ` {n. c n \<noteq> 0}" proof (safe, split if_splits) fix x :: "(nat \<Rightarrow>\<^sub>0 nat)" assume x: "keys x \<subseteq> {i}" "c (lookup x i) \<noteq> 0" hence "x = Poly_Mapping.single i (lookup x i)" by (metis Diff_eq_empty_iff keys_empty_iff lookup_single_eq remove_key_keys remove_key_single remove_key_sum) thus "x \<in> Poly_Mapping.single i ` {n. c n \<noteq> 0}" using x by blast qed auto qed qed lift_definition mpoly_of_poly :: "nat \<Rightarrow> 'a :: zero poly \<Rightarrow> 'a mpoly" is "mpoly_of_poly_aux" . lemma mpoly_of_poly_0 [simp]: "mpoly_of_poly i 0 = 0" by (transfer', transfer) auto lemma coeff_mpoly_of_poly1 [simp]: "coeff (mpoly_of_poly i p) (Poly_Mapping.single i n) = poly.coeff p n" by (transfer', transfer') auto lemma coeff_mpoly_of_poly2 [simp]: assumes "\<not>keys x \<subseteq> {i}" shows "coeff (mpoly_of_poly i p) x = 0" using assms by (transfer', transfer') auto lemma coeff_mpoly_of_poly: "coeff (mpoly_of_poly i p) m = (poly.coeff p (Poly_Mapping.lookup m i) when keys m \<subseteq> {i})" by (transfer', transfer') auto lemma poly_mapping_single_eq_0_iff [simp]: "Poly_Mapping.single i n = 0 \<longleftrightarrow> n = 0" by (metis lookup_single_eq single_zero) lemma mpoly_of_poly_pCons [simp]: fixes p :: "'a :: semiring_1 poly" shows "mpoly_of_poly i (pCons c p) = Const c + Var i * mpoly_of_poly i p" proof (rule mpoly_eqI) fix mon :: "nat \<Rightarrow>\<^sub>0 nat" define moni :: "nat \<Rightarrow>\<^sub>0 nat" where "moni = Poly_Mapping.single i 1" have "coeff (Var i * mpoly_of_poly i p) mon = (\<Sum>l. (1 when l = moni) * (\<Sum>q. coeff (mpoly_of_poly i p) q when mon = moni + q))" unfolding coeff_mpoly_times prod_fun_def coeff_Var moni_def by (rule Sum_any.cong) (auto simp: when_def) also have "\<dots> = (\<Sum>a. coeff (mpoly_of_poly i p) a when mon = moni + a)" by (subst Sum_any_left_distrib [symmetric]) simp_all finally have eq: "coeff (Var i * mpoly_of_poly i p) mon = \<dots>" . show "coeff (mpoly_of_poly i (pCons c p)) mon = coeff (Const c + Var i * mpoly_of_poly i p) mon" proof (cases "keys mon \<subseteq> {i}") case False hence [simp]: "mon \<noteq> 0" by auto obtain j where j: "j \<in> keys mon" "j \<noteq> i" using False by auto have "coeff (mpoly_of_poly i p) mon' = 0" if mon_eq: "mon = moni + mon'" for mon' proof - have "Poly_Mapping.lookup mon j \<noteq> 0" using j by (meson lookup_eq_zero_in_keys_contradict) also have "Poly_Mapping.lookup mon j = Poly_Mapping.lookup mon' j" unfolding mon_eq moni_def using j by (simp add: lookup_add lookup_single) finally have "j \<in> keys mon'" by (meson lookup_not_eq_zero_eq_in_keys) with j have "\<not>keys mon' \<subseteq> {i}" by blast thus ?thesis by simp qed hence "coeff (Var i * mpoly_of_poly i p) mon = 0" unfolding eq by (intro Sum_any_zeroI) (auto simp: when_def) thus ?thesis using False by (simp add: mpoly_coeff_Const) next case True define n where "n = Poly_Mapping.lookup mon i" have mon_eq: "mon = Poly_Mapping.single i n" using True unfolding n_def by (metis Diff_eq_empty_iff add_cancel_right_left keys_empty_iff remove_key_keys remove_key_sum) have eq': "mon = moni + mon' \<longleftrightarrow> n > 0 \<and> mon' = Poly_Mapping.single i (n - 1)" for mon' proof safe assume eq: "mon = moni + mon'" thus "n > 0" "mon' = Poly_Mapping.single i (n - 1)" unfolding moni_def mon_eq using gr0I by (force simp: single_diff)+ next assume "n > 0" "mon' = Poly_Mapping.single i (n - 1)" thus "mon = moni + Poly_Mapping.single i (n - 1)" unfolding mon_eq moni_def by (subst single_add [symmetric]) auto qed have "coeff (Var i * mpoly_of_poly i p) mon = (poly.coeff p (n - 1) when (n > 0))" unfolding eq eq' by (auto simp: when_def) thus ?thesis by (auto simp: mon_eq when_def mpoly_coeff_Const coeff_pCons split: nat.splits) qed qed lemma mpoly_of_poly_1 [simp]: "mpoly_of_poly i 1 = 1" unfolding one_pCons mpoly_of_poly_pCons mpoly_of_poly_0 by simp lemma mpoly_of_poly_uminus [simp]: "mpoly_of_poly i (-p) = -mpoly_of_poly i p" by (rule mpoly_eqI) (auto simp: coeff_mpoly_of_poly when_def) lemma mpoly_of_poly_add [simp]: "mpoly_of_poly i (p + q) = mpoly_of_poly i p + mpoly_of_poly i q" by (rule mpoly_eqI) (auto simp: coeff_mpoly_of_poly when_def) lemma mpoly_of_poly_diff [simp]: "mpoly_of_poly i (p - q) = mpoly_of_poly i p - mpoly_of_poly i q" by (rule mpoly_eqI) (auto simp: coeff_mpoly_of_poly when_def) lemma mpoly_of_poly_smult [simp]: "mpoly_of_poly i (Polynomial.smult c p) = smult c (mpoly_of_poly i p)" by (rule mpoly_eqI) (auto simp: coeff_mpoly_of_poly when_def) lemma mpoly_of_poly_mult [simp]: fixes p q :: "'a :: comm_semiring_1 poly" shows "mpoly_of_poly i (p * q) = mpoly_of_poly i p * mpoly_of_poly i q" by (induction p) (auto simp: algebra_simps smult_conv_mult_Const) lemma insertion_mpoly_of_poly [simp]: "insertion f (mpoly_of_poly i p) = poly p (f i)" by (induction p) (auto simp: insertion_add insertion_mult) lemma mapping_of_mpoly_of_poly [simp]: "mapping_of (mpoly_of_poly i p) = mpoly_of_poly_aux i p" by transfer' simp lemma vars_mpoly_of_poly: "vars (mpoly_of_poly i p) \<subseteq> {i}" proof - have "x = i" if "xa \<in> keys (mpoly_of_poly_aux i p)" "x \<in> keys xa" for x xa using that by (meson in_mono lookup_eq_zero_in_keys_contradict mpoly_of_poly_aux.rep_eq singletonD) thus ?thesis by (auto simp: vars_def) qed lemma mpoly_map_vars_mpoly_of_poly [simp]: assumes "bij f" shows "mpoly_map_vars f (mpoly_of_poly i p) = mpoly_of_poly (f i) p" proof (rule mpoly_eqI, goal_cases) case (1 mon) have "f -` keys mon \<subseteq> {i} \<longleftrightarrow> keys mon \<subseteq> {f i}" using assms by (simp add: vimage_subset_eq) thus ?case using assms by (simp add: coeff_mpoly_map_vars coeff_mpoly_of_poly lookup_permutep keys_permutep when_def) qed end
//================================================================================================== /*! @file @copyright 2016 NumScale SAS Distributed under the Boost Software License, Version 1.0. (See accompanying file LICENSE.md or copy at http://boost.org/LICENSE_1_0.txt) */ //================================================================================================== #ifndef BOOST_SIMD_FUNCTION_BITOFSIGN_HPP_INCLUDED #define BOOST_SIMD_FUNCTION_BITOFSIGN_HPP_INCLUDED #if defined(DOXYGEN_ONLY) namespace boost { namespace simd { /*! @ingroup group-ieee This function object returns a value of the same type as the input with all bits set to zero except the sign bit which is preserved. This function object returns always @ref Zero for unsigned types @par Header <boost/simd/function/bitofsign.hpp> @par Example: @snippet bitofsign.cpp bitofsign @par Possible output: @snippet bitofsign.txt bitofsign **/ Value bitofsign(Value const& x); } } #endif #include <boost/simd/function/scalar/bitofsign.hpp> #include <boost/simd/function/simd/bitofsign.hpp> #endif
Tactic Notation "sleep" integer(seconds) := do seconds try solve [ timeout 1 (repeat eapply proj1) ]. Goal True. sleep 3. exact I. Qed.
(* Title: Code_Target_Bits_Int.thy Author: Andreas Lochbihler, ETH Zurich *) chapter {* Implementation of bit operations on int by target language operations *} theory Code_Target_Bits_Int imports "Bits_Integer" "~~/src/HOL/Library/Code_Target_Int" begin declare [[code drop: "bitAND :: int \<Rightarrow> _" "bitOR :: int \<Rightarrow> _" "bitXOR :: int \<Rightarrow> _" "bitNOT :: int \<Rightarrow> _" "lsb :: int \<Rightarrow> _" "set_bit :: int \<Rightarrow> _" "test_bit :: int \<Rightarrow> _" "shiftl :: int \<Rightarrow> _" "shiftr :: int \<Rightarrow> _" bin_last bin_rest bin_nth Bit int_of_integer_symbolic ]] context includes integer.lifting begin lemma bitAND_int_code [code]: "int_of_integer i AND int_of_integer j = int_of_integer (i AND j)" by transfer simp lemma bitOR_int_code [code]: "int_of_integer i OR int_of_integer j = int_of_integer (i OR j)" by transfer simp lemma bitXOR_int_code [code]: "int_of_integer i XOR int_of_integer j = int_of_integer (i XOR j)" by transfer simp lemma bitNOT_int_code [code]: "NOT (int_of_integer i) = int_of_integer (NOT i)" by transfer simp declare bin_last_conv_AND [code] lemma bin_rest_code [code]: "bin_rest (int_of_integer i) = int_of_integer (bin_rest_integer i)" by transfer simp declare bitval_bin_last [code_unfold] declare bin_nth_conv_AND [code] lemma Bit_code [code]: "int_of_integer i BIT b = int_of_integer (Bit_integer i b)" by transfer simp lemma test_bit_int_code [code]: "int_of_integer x !! n = x !! n" by transfer simp lemma lsb_int_code [code]: "lsb (int_of_integer x) = lsb x" by transfer simp lemma set_bit_int_code [code]: "set_bit (int_of_integer x) n b = int_of_integer (set_bit x n b)" by transfer simp lemma shiftl_int_code [code]: "int_of_integer x << n = int_of_integer (x << n)" by transfer simp lemma shiftr_int_code [code]: "int_of_integer x >> n = int_of_integer (x >> n)" by transfer simp lemma int_of_integer_symbolic_code [code]: "int_of_integer_symbolic = int_of_integer" by(simp add: int_of_integer_symbolic_def) end code_identifier code_module Code_Target_Bits_Int \<rightharpoonup> (SML) Bit_Int and (OCaml) Bit_Int and (Haskell) Bit_Int and (Scala) Bit_Int end
Require Coq.Vectors.Vector. Export Vector.VectorNotations. Require Export CoRN.stdlib_omissions.List. Require Import Coq.Arith.Arith Coq.PArith.BinPos. Set Implicit Arguments. (** * Rasters An n by m raster is a matrix of booleans. Do not use Vector, which stores a slow nat on each cons. *) Variant raster (columns lines : positive) : Set := | raster_data : list (list bool) -> raster columns lines. (* TODO directly list (list bool), length of first line then all lines same length. *) Definition raster_well_formed {columns lines : positive} (r : raster columns lines) : Prop := match r with raster_data _ _ d => length d = Pos.to_nat lines /\ Forall (fun line : list bool => length line = Pos.to_nat columns) d end. (** A series of notation allows rasters to be rendered (and to a certain extent parsed) in Coq *) Notation "'⎥' a b" := (List.cons a b) (format "'[v' '⎥' a '/' b ']'", at level 0, a, b at level 0) : raster. Notation "'⎥' a" := (List.cons a List.nil) (format "'⎥' a", at level 0, a at level 0) : raster. (* Notation "☙" := (Vnil (vector bool _)) (at level 0, right associativity) : raster. *) Notation "█ a" := (List.cons true a) (at level 0, right associativity) : raster. Notation "⎢" := (@List.nil bool) (at level 0, right associativity) : raster. Notation "' ' a" := (List.cons false a) (at level 0, right associativity) : raster. Notation "░ a" := (List.cons false a) (at level 0, right associativity, only parsing) : raster_parsing. (** Standard rasters. *) Definition emptyRaster n m : raster n m := raster_data n m (List.repeat (List.repeat false (Pos.to_nat n)) (Pos.to_nat m)). Lemma emptyRaster_wf : forall n m, raster_well_formed (emptyRaster n m). Proof. split. - apply repeat_length. - apply Forall_forall. intros. apply repeat_spec in H. subst x. apply repeat_length. Qed. (** Indexing into a raster *) Definition RasterIndex {n m} (r:raster n m) i j : bool := let (d) := r in nth j (nth i d nil) false. Lemma nth_repeat : forall A n (x:A) k d, nth n (List.repeat x k) d = if le_lt_dec k n then d else x. Proof. intros. destruct (le_lt_dec k n). - apply nth_overflow. rewrite repeat_length. exact l. - apply (repeat_spec k x). apply nth_In. rewrite repeat_length. exact l. Qed. (** Indexing into an empty raster is alway empty *) Lemma emptyRasterEmpty : forall n m i j, RasterIndex (emptyRaster n m) i j = false. Proof. intros n m i j. simpl. rewrite (nth_repeat i (repeat false (Pos.to_nat n)) (Pos.to_nat m) nil). destruct (le_lt_dec (Pos.to_nat m) i). - destruct j; reflexivity. - rewrite (nth_repeat j false (Pos.to_nat n) false). destruct (le_lt_dec (Pos.to_nat n) j); reflexivity. Qed. (** [setRaster] transforms a raster by setting (or reseting) the (i,j)th pixel. *) Fixpoint updateList A (v : list A) (f : A->A) : nat -> list A := match v with | nil => fun _ => nil | cons a' v' => fun i => match i with | 0 => cons (f a') v' | S i' => cons a' (updateList v' f i') end end. Lemma updateList_length : forall A (v:list A) f i, length (updateList v f i) = length v. Proof. induction v. - reflexivity. - intros. simpl. destruct i. reflexivity. simpl. rewrite IHv. reflexivity. Qed. Lemma updateList_correct1 : forall A (v: list A) f i d1 d2, i < length v -> nth i (updateList v f i) d1 = f (nth i v d2). Proof. induction v. intros. absurd (i < 0); auto with *. intros f [|i] d1 d2 H. reflexivity. simpl. apply IHv. auto with *. Qed. Lemma updateList_correct2 : forall A (v: list A) f d1 i j, i <> j -> nth i (updateList v f j) d1 = nth i v d1. Proof. induction v. reflexivity. intros f d1 i [|j] H; destruct i as [|i]; try reflexivity. elim H; auto. simpl. apply IHv. auto. Qed. Lemma updateList_overflow : forall A (v : list A) f i, length v <= i -> updateList v f i = v. Proof. induction v. - reflexivity. - intros. simpl. destruct i. exfalso; inversion H. apply f_equal. rewrite IHv. reflexivity. apply le_S_n, H. Qed. Definition setRaster {n m} (r:raster n m) (x:bool) (i j:nat) : raster n m := let (d) := r in raster_data n m (updateList d (fun row => updateList row (fun _ => x) j) i). Lemma setRaster_wf : forall n m (r:raster n m) x i j, raster_well_formed r -> raster_well_formed (setRaster r x i j). Proof. intros. destruct r. destruct H. split. - rewrite updateList_length. exact H. - apply Forall_forall. intros. apply In_nth with (d:=nil) in H1. destruct H1 as [k [H1 H2]]. subst x0. rewrite Forall_forall in H0. rewrite updateList_length in H1. destruct (Nat.eq_dec k i). + subst i. rewrite updateList_correct1 with (d2:=nil). rewrite updateList_length. apply H0. apply nth_In, H1. exact H1. + rewrite (updateList_correct2 l). 2: exact n0. apply H0. apply nth_In, H1. Qed. Lemma setRaster_correct1 : forall {n m : positive} (r:raster n m) x i j, raster_well_formed r -> (i < Pos.to_nat m) -> (j < Pos.to_nat n) -> RasterIndex (setRaster r x i j) i j = x. Proof. intros n m r x i j rWf Hi Hj. destruct r. simpl. destruct rWf. rewrite updateList_correct1 with (d2:=nil). 2: rewrite H; exact Hi. rewrite updateList_correct1. reflexivity. trivial. rewrite Forall_forall in H0. rewrite (H0 (nth i l nil)). exact Hj. apply nth_In. rewrite H. exact Hi. Qed. Lemma setRaster_overflow : forall {n m} (r:raster n m) x i j, raster_well_formed r -> (Pos.to_nat m <= i) \/ (Pos.to_nat n <= j) -> (setRaster r x i j) = r. Proof. intros. destruct r. unfold setRaster. apply f_equal. destruct H. destruct H0. - apply updateList_overflow. rewrite H. exact H0. - clear H m. rewrite Forall_forall in H1. revert i. induction l. + reflexivity. + intro i. simpl. destruct i. f_equal. apply updateList_overflow. rewrite (H1 a). exact H0. left. reflexivity. f_equal. apply IHl. intros. apply H1. right. exact H. Qed. Lemma setRaster_correct2 : forall n m (r:raster n m) x i j i0 j0, raster_well_formed r -> (i <> i0) \/ (j <> j0) -> RasterIndex (setRaster r x i0 j0) i j = RasterIndex r i j. Proof. intros n m r x i j i0 j0 rWf H. destruct (le_lt_dec (Pos.to_nat m) i0) as [Hm | Hm]. rewrite setRaster_overflow; auto with *. destruct (le_lt_dec (Pos.to_nat n) j0) as [Hn | Hn]. rewrite setRaster_overflow; auto with *. destruct r as [l]. simpl. destruct H. + f_equal. rewrite updateList_correct2. reflexivity. exact H. + destruct rWf. destruct (Nat.eq_dec i i0). subst i0. rewrite updateList_correct1 with (d2:=nil). 2: rewrite H0; exact Hm. rewrite updateList_correct2. reflexivity. exact H. f_equal. rewrite updateList_correct2. reflexivity. exact n0. Qed.
If $P_i$ is a sequence of measurable functions, then the function $x \mapsto \min\{i \mid P_i(x)\}$ is measurable.
State Before: x y : ℂ ⊢ sin (x * I) = sinh x * I State After: x y : ℂ h : I * sin (x * I) = -sinh x ⊢ sin (x * I) = sinh x * I Tactic: have h : I * sin (x * I) = -sinh x := by rw [mul_comm, ← sinh_mul_I] ring_nf simp State Before: x y : ℂ h : I * sin (x * I) = -sinh x ⊢ sin (x * I) = sinh x * I State After: x y : ℂ h : I * sin (x * I) = -sinh x ⊢ sin (x * I) = -(I * sin (x * I)) * I Tactic: rw [← neg_neg (sinh x), ← h] State Before: x y : ℂ h : I * sin (x * I) = -sinh x ⊢ sin (x * I) = -(I * sin (x * I)) * I State After: no goals Tactic: ext <;> simp State Before: x y : ℂ ⊢ I * sin (x * I) = -sinh x State After: x y : ℂ ⊢ sinh (x * I * I) = -sinh x Tactic: rw [mul_comm, ← sinh_mul_I] State Before: x y : ℂ ⊢ sinh (x * I * I) = -sinh x State After: x y : ℂ ⊢ sinh (x * I ^ 2) = -sinh x Tactic: ring_nf State Before: x y : ℂ ⊢ sinh (x * I ^ 2) = -sinh x State After: no goals Tactic: simp
theory ExF005 imports Main begin lemma "(\<forall>x . (P x \<and> Q x)) \<longrightarrow> ((\<forall>x . P x) \<and> (\<forall> x . Q x))" proof - { assume "\<forall>x . (P x \<and> Q x)" { fix a from \<open>\<forall>x . (P x \<and> Q x)\<close> have "P a \<and> Q a" by (rule allE) hence "P a" by (rule conjE) } hence "\<forall>x . P x" by (rule allI) { fix a from \<open>\<forall>x . (P x \<and> Q x)\<close> have "P a \<and> Q a" by (rule allE) hence "Q a" by (rule conjE) } hence "\<forall>x . Q x" by (rule allI) with \<open>\<forall>x . P x\<close> have "(\<forall>x . P x) \<and> (\<forall> x . Q x)" by (rule conjI) } thus ?thesis by (rule impI) qed
Require Import Fiat.BinEncoders.Env.Common.Specs Fiat.BinEncoders.Env.Lib2.Word. Require Import Bedrock.Word Coq.Strings.Ascii Coq.Numbers.BinNums Coq.NArith.BinNat. Section Ascii. Context {B : Type}. Context {cache : Cache}. Context {cacheAddNat : CacheAdd cache nat}. Context {transformer : Transformer B}. Context {transformerUnit : TransformerUnit transformer bool}. Definition encode_ascii (c : ascii) (ce : CacheEncode) : B * CacheEncode := encode_word (NToWord 8 (N_of_ascii c)) ce. Definition decode_ascii (b : B) (cd : CacheDecode) : ascii * B * CacheDecode := let (bundle, cd) := decode_word (sz:=8) b cd in let (n, b) := bundle in (ascii_of_N (wordToN n), b, cd). Open Local Scope nat. Theorem Ascii_decode_correct : encode_decode_correct cache transformer (fun n => True) encode_ascii decode_ascii. Proof. unfold encode_decode_correct, encode_ascii, decode_ascii. intros env env' xenv xenv' c c' bin' ext ext' Eeq Ppred Penc Pdec. destruct (decode_word (transform bin' ext) env') as [[? ?] ?] eqn: ?. inversion Pdec; subst; clear Pdec. pose proof (Word_decode_correct env env' xenv xenv' (NToWord 8 (N_of_ascii c)) w bin' ext ext' Eeq I Penc Heqp). intuition eauto. rewrite <- H. clear. rewrite wordToN_nat. rewrite NToWord_nat. destruct (wordToNat_natToWord' 8 (BinNat.N.to_nat (N_of_ascii c))). assert (x = 0). { destruct x; eauto; exfalso. remember (wordToNat (natToWord 8 (BinNat.N.to_nat (N_of_ascii c)))) as xx; clear Heqxx. replace (xx + S x * pow2 8) with (256 + (xx + x * 256)) in H. assert (BinNat.N.to_nat (N_of_ascii c) < 256). assert (N.lt (N_of_ascii c) 256). clear H. induction c; repeat (match goal with | B : bool |- _ => destruct B end); simpl; unfold Nlt; eauto. change (256%nat) with (N.to_nat 256). apply Nomega.Nlt_out. eauto. omega. change (pow2 8) with 256. omega. } subst. rewrite <- plus_n_O in H. rewrite H. clear H. rewrite Nnat.N2Nat.id. rewrite ascii_N_embedding. eauto. Qed. End Ascii.
------------------------------------------------------------------------ -- Simplification of parsers ------------------------------------------------------------------------ module TotalParserCombinators.Simplification where open import Algebra open import Codata.Musical.Notation open import Data.List using (List; []) import Data.List.Relation.Binary.BagAndSetEquality as BSEq open import Data.Maybe using (Maybe); open Data.Maybe.Maybe open import Data.Nat open import Data.Product open import Data.Vec.Recursive hiding ([]) open import Function open import Relation.Binary.PropositionalEquality as P using (_≡_; refl; [_]) open import Relation.Binary.HeterogeneousEquality using (refl) renaming (_≅_ to _≅H_) private module BSMonoid {k} {A : Set} = CommutativeMonoid (BSEq.commutativeMonoid k A) open import TotalParserCombinators.Congruence hiding (return; fail; token) renaming (_∣_ to _∣′_) import TotalParserCombinators.Congruence.Sound as C import TotalParserCombinators.InitialBag as I open import TotalParserCombinators.Laws open import TotalParserCombinators.Parser ------------------------------------------------------------------------ -- Simplification of a single "layer" -- The result type used for single-layer simplification. record Simplify₁ {Tok R xs} (p : Parser Tok R xs) : Set₁ where constructor result field {bag} : List R parser : Parser Tok R bag correct : p ≅P parser -- The function simplify₁ simplifies the first "layer" of a parser, -- down to the first occurrences of ♯_. The following simplifications -- are applied in a bottom-up manner (in relevant cases also for -- delayed arguments): -- -- f <$> fail → fail -- f <$> return x → return (f x) -- fail ∣ p → p -- p ∣ fail → p -- token >>= p₁ ∣ token >>= p₂ → token >>= λ t → -- ♯ (♭? (p₁ t) ∣ ♭? (p₂ t)) -- fail ⊛ p → fail -- p ⊛ fail → fail -- return f ⊛ return x → return (f x) -- fail >>= p → fail -- return x >>= p → p x -- nonempty fail → fail -- nonempty (return x) → fail -- cast eq p → p -- -- Some ♯_'s may be removed, but care is taken to ensure that -- non-simplified parsers in the result are delayed. mutual simplify₁ : ∀ {Tok R xs} (p : Parser Tok R xs) → Simplify₁ p -- • return: simplify₁ (return x) = result _ (return x ∎) -- • fail: simplify₁ fail = result _ (fail ∎) -- • token: simplify₁ token = result _ (token ∎) -- • _<$>_: simplify₁ (f <$> p) with simplify₁ p ... | result fail p≅∅ = result _ ( f <$> p ≅⟨ (λ _ → refl) <$> p≅∅ ⟩ f <$> fail ≅⟨ <$>.zero ⟩ fail ∎) ... | result (return x) p≅ε = result _ ( f <$> p ≅⟨ (λ x → refl {x = f x}) <$> p≅ε ⟩ f <$> return x ≅⟨ <$>.homomorphism f ⟩ return (f x) ∎) ... | result p′ p≅p′ = result _ ( f <$> p ≅⟨ (λ _ → refl) <$> p≅p′ ⟩ f <$> p′ ∎) -- • _∣_: simplify₁ (p₁ ∣ p₂) with simplify₁ p₁ | simplify₁ p₂ ... | result fail p₁≅∅ | result p₂′ p₂≅p₂′ = result _ ( p₁ ∣ p₂ ≅⟨ p₁≅∅ ∣′ p₂≅p₂′ ⟩ fail ∣ p₂′ ≅⟨ AdditiveMonoid.left-identity p₂′ ⟩ p₂′ ∎) ... | result p₁′ p₁≅p₁′ | result fail p₂≅∅ = result _ ( p₁ ∣ p₂ ≅⟨ p₁≅p₁′ ∣′ p₂≅∅ ⟩ p₁′ ∣ fail ≅⟨ AdditiveMonoid.right-identity p₁′ ⟩ p₁′ ∎) ... | result (p₁₁ >>= p₁₂) p₁≅… | result (p₂₁ >>= p₂₂) p₂≅… = let h = helper p₁₁ refl p₁₂ p₂₁ refl p₂₂ in result _ ( p₁ ∣ p₂ ≅⟨ p₁≅… ∣′ p₂≅… ⟩ p₁₁ >>= p₁₂ ∣ p₂₁ >>= p₂₂ ≅⟨ Simplify₁.correct h ⟩ Simplify₁.parser h ∎) where helper : ∀ {Tok R₁ R₂ R xs₁ xs₁′ xs₂ xs₂′ f₁ f₂} (p₁₁ : ∞⟨ f₁ ⟩Parser Tok R₁ xs₁′) (eq₁ : xs₁′ ≡ flatten xs₁) (p₁₂ : (x : R₁) → ∞⟨ xs₁ ⟩Parser Tok R (apply f₁ x)) (p₂₁ : ∞⟨ f₂ ⟩Parser Tok R₂ xs₂′) (eq₂ : xs₂′ ≡ flatten xs₂) (p₂₂ : (x : R₂) → ∞⟨ xs₂ ⟩Parser Tok R (apply f₂ x)) → Simplify₁ (P.subst (∞⟨ f₁ ⟩Parser Tok R₁) eq₁ p₁₁ >>= p₁₂ ∣ P.subst (∞⟨ f₂ ⟩Parser Tok R₂) eq₂ p₂₁ >>= p₂₂) helper p₁₁ eq₁ p₁₂ p₂₁ eq₂ p₂₂ with ♭? p₁₁ | P.inspect ♭? p₁₁ | ♭? p₂₁ | P.inspect ♭? p₂₁ helper {Tok} {f₁ = f₁} {f₂} p₁₁ eq₁ p₁₂ p₂₁ eq₂ p₂₂ | token | [ eq₁′ ] | token | [ eq₂′ ] = result _ ( cast₁ p₁₁ >>= p₁₂ ∣ cast₂ p₂₁ >>= p₂₂ ≅⟨ [ forced? p₁₁ - ○ - forced?′ p₁₂ - ○ ] Subst.correct∞ eq₁ p₁₁ >>= (λ t → ♭? (p₁₂ t) ∎) ∣′ [ forced? p₂₁ - ○ - forced?′ p₂₂ - ○ ] Subst.correct∞ eq₂ p₂₁ >>= (λ t → ♭? (p₂₂ t) ∎) ⟩ ♭? p₁₁ >>= (♭? ∘ p₁₂) ∣ ♭? p₂₁ >>= (♭? ∘ p₂₂) ≅⟨ [ ○ - ○ - ○ - ○ ] P.subst (λ p → p ≅P token) (P.sym eq₁′) (token ∎) >>= (λ t → ♭? (p₁₂ t) ∎) ∣′ [ ○ - ○ - ○ - ○ ] P.subst (λ p → p ≅P token) (P.sym eq₂′) (token ∎) >>= (λ t → ♭? (p₂₂ t) ∎) ⟩ token >>= (♭? ∘ p₁₂) ∣ token >>= (♭? ∘ p₂₂) ≅⟨ sym $ Monad.left-distributive token (♭? ∘ p₁₂) (♭? ∘ p₂₂) ⟩ token >>= (λ t → ♭? (p₁₂ t) ∣ ♭? (p₂₂ t)) ≅⟨ [ ○ - ○ - ○ - ◌ ] token ∎ >>= (λ t → ♭? (p₁₂ t) ∣ ♭? (p₂₂ t) ∎) ⟩ token >>= (λ t → ♯ (♭? (p₁₂ t) ∣ ♭? (p₂₂ t))) ∎) where cast₁ = P.subst (∞⟨ f₁ ⟩Parser Tok Tok) eq₁ cast₂ = P.subst (∞⟨ f₂ ⟩Parser Tok Tok) eq₂ helper _ _ _ _ _ _ | _ | _ | _ | _ = result _ (_ ∎) simplify₁ (p₁ ∣ p₂) | result p₁′ p₁≅p₁′ | result p₂′ p₂≅p₂′ = result _ ( p₁ ∣ p₂ ≅⟨ p₁≅p₁′ ∣′ p₂≅p₂′ ⟩ p₁′ ∣ p₂′ ∎) -- • _⊛_: simplify₁ (p₁ ⊛ p₂) = helper _ _ p₁ p₂ (simplify₁∞ p₁) (simplify₁∞ p₂) refl refl where -- token ⊛ token is never type correct, but Agda's case-splitting -- machinery cannot see this, so instead of a with clause the -- following ugly machinery is used. cast₁ : ∀ {Tok R R₁ R₁′ xs xs′} {ys : Maybe (List R)} → (R≡ : R₁ ≡ R₁′) → xs ≅H xs′ → ∞⟨ ys ⟩Parser Tok R₁′ (flatten xs′) → ∞⟨ ys ⟩Parser Tok R₁ (flatten xs) cast₁ refl refl p = p helper : ∀ {Tok R₁ R₁′ R₂} fs xs {xs′} (p₁ : ∞⟨ xs ⟩Parser Tok (R₁ → R₂) (flatten fs)) (p₂ : ∞⟨ fs ⟩Parser Tok R₁′ (flatten xs′)) → Simplify₁ (♭? p₁) → Simplify₁ (♭? p₂) → (R≡ : R₁ ≡ R₁′) (xs≅ : xs ≅H xs′) → Simplify₁ (p₁ ⊛ cast₁ R≡ xs≅ p₂) helper fs xs p₁ p₂ (result fail p₁≅∅) _ refl refl = result _ ( p₁ ⊛ p₂ ≅⟨ [ xs - ○ - fs - ○ ] p₁≅∅ ⊛ (♭? p₂ ∎) ⟩ fail ⊛ ♭? p₂ ≅⟨ ApplicativeFunctor.left-zero (♭? p₂) ⟩ fail ∎) helper fs xs p₁ p₂ _ (result fail p₂≅∅) refl refl = result _ ( p₁ ⊛ p₂ ≅⟨ [ xs - ○ - fs - ○ ] ♭? p₁ ∎ ⊛ p₂≅∅ ⟩ ♭? p₁ ⊛ fail ≅⟨ ApplicativeFunctor.right-zero (♭? p₁) ⟩ fail ∎) helper fs xs p₁ p₂ (result (return f) p₁≅ε) (result (return x) p₂≅ε) refl refl = result _ ( p₁ ⊛ p₂ ≅⟨ [ xs - ○ - fs - ○ ] p₁≅ε ⊛ p₂≅ε ⟩ return f ⊛ return x ≅⟨ ApplicativeFunctor.homomorphism f x ⟩ return (f x) ∎) helper fs xs p₁ p₂ p₁′ p₂′ R≡ xs≅ = helper′ fs xs p₁ p₂ p₁′ p₂′ R≡ xs≅ where helper′ : ∀ {Tok R₁ R₁′ R₂} fs xs {xs′} (p₁ : ∞⟨ xs ⟩Parser Tok (R₁ → R₂) (flatten fs)) (p₂ : ∞⟨ fs ⟩Parser Tok R₁′ (flatten xs′)) → Simplify₁ (♭? p₁) → Simplify₁ (♭? p₂) → (R≡ : R₁ ≡ R₁′) (xs≅ : xs ≅H xs′) → Simplify₁ (p₁ ⊛ cast₁ R≡ xs≅ p₂) helper′ nothing nothing p₁ p₂ _ _ refl refl = result _ ( p₁ ⊛ p₂ ∎) helper′ (just fs) nothing p₁ p₂ _ (result p₂′ p₂≅p₂′) refl refl with BSEq.empty-unique $ I.cong $ C.sound $ sym p₂≅p₂′ helper′ (just fs) nothing p₁ p₂ _ (result p₂′ p₂≅p₂′) refl refl | refl = result _ ( p₁ ⊛ p₂ ≅⟨ [ ◌ - ◌ - ○ - ○ ] ♭ p₁ ∎ ⊛ p₂≅p₂′ ⟩ p₁ ⊛ p₂′ ∎) helper′ nothing (just xs) p₁ p₂ (result p₁′ p₁≅p₁′) _ refl refl with BSEq.empty-unique $ I.cong $ C.sound $ sym p₁≅p₁′ helper′ nothing (just xs) p₁ p₂ (result p₁′ p₁≅p₁′) _ refl refl | refl = result _ ( p₁ ⊛ p₂ ≅⟨ [ ○ - ○ - ◌ - ◌ ] p₁≅p₁′ ⊛ (♭ p₂ ∎) ⟩ p₁′ ⊛ p₂ ∎) helper′ (just fs) (just xs) p₁ p₂ (result p₁′ p₁≅p₁′) (result p₂′ p₂≅p₂′) refl refl = result _ ( p₁ ⊛ p₂ ≅⟨ [ ○ - ○ - ○ - ○ ] p₁≅p₁′ ⊛ p₂≅p₂′ ⟩ p₁′ ⊛ p₂′ ∎) -- • _>>=_: simplify₁ (_>>=_ {xs = xs} {f = f} p₁ p₂) with simplify₁∞ p₁ ... | result fail p₁≅∅ = result _ ( p₁ >>= p₂ ≅⟨ [ f - ○ - xs - ○ ] p₁≅∅ >>= (λ x → ♭? (p₂ x) ∎) ⟩ fail >>= (♭? ∘ p₂) ≅⟨ Monad.left-zero (♭? ∘ p₂) ⟩ fail ∎) ... | result (return x) p₁≅ε with simplify₁∞ (p₂ x) ... | result p₂x′ p₂x≅p₂x′ = result _ ( p₁ >>= p₂ ≅⟨ [ f - ○ - xs - ○ ] p₁≅ε >>= (λ x → ♭? (p₂ x) ∎) ⟩ return x >>= (♭? ∘ p₂) ≅⟨ Monad.left-identity x (♭? ∘ p₂) ⟩ ♭? (p₂ x) ≅⟨ p₂x≅p₂x′ ⟩ p₂x′ ∎) simplify₁ (p₁ >>= p₂) | result p₁′ p₁≅p₁′ with forced? p₁ | forced?′ p₂ ... | nothing | just xs = result _ ( p₁ >>= p₂ ≅⟨ [ ◌ - ◌ - ○ - ○ ] ♭ p₁ ∎ >>= (λ x → simplify₁-[]-correct (p₂ x)) ⟩ p₁ >>= (λ x → simplify₁-[] (p₂ x)) ∎) ... | just f | just xs = result _ ( p₁ >>= p₂ ≅⟨ [ ○ - ○ - ○ - ○ ] p₁≅p₁′ >>= (λ x → Simplify₁.correct (simplify₁ (p₂ x))) ⟩ p₁′ >>= (λ x → Simplify₁.parser $ simplify₁ (p₂ x)) ∎) ... | nothing | nothing = result _ ( p₁ >>= p₂ ∎) ... | just f | nothing = result _ ( p₁ >>= p₂ ≅⟨ [ ○ - ○ - ◌ - ○ ] p₁≅p₁′ >>= (λ x → ♭ (p₂ x) ∎) ⟩ p₁′ >>= (♭ ∘ p₂) ≅⟨ [ ○ - ○ - ○ - ◌ ] sym (Subst.correct lemma) >>= (λ x → ♭ (p₂ x) ∎) ⟩ cast-[] p₁′ >>= p₂ ∎) where lemma = BSEq.empty-unique $ I.cong $ C.sound $ sym p₁≅p₁′ cast-[] = P.subst (Parser _ _) lemma -- • nonempty: simplify₁ (nonempty p) with simplify₁ p ... | result fail p≅∅ = result _ ( nonempty p ≅⟨ nonempty p≅∅ ⟩ nonempty fail ≅⟨ Nonempty.zero ⟩ fail ∎) ... | result (return x) p≅ε = result _ ( nonempty p ≅⟨ nonempty p≅ε ⟩ nonempty (return x) ≅⟨ Nonempty.nonempty-return ⟩ fail ∎) ... | result p′ p≅p′ = result _ ( nonempty p ≅⟨ nonempty p≅p′ ⟩ nonempty p′ ∎) -- • cast: simplify₁ (cast xs₁≈xs₂ p) with simplify₁ p ... | result p′ p≅p′ = result _ ( cast xs₁≈xs₂ p ≅⟨ Cast.correct ⟩ p ≅⟨ p≅p′ ⟩ p′ ∎) private -- Note that if an argument parser is delayed, then simplification -- is not applied recursively (because this could lead to -- non-termination). simplify₁∞ : ∀ {Tok R R′ xs} {m : Maybe R′} (p : ∞⟨ m ⟩Parser Tok R xs) → Simplify₁ (♭? p) simplify₁∞ {m = nothing} p = result _ (♭ p ∎) simplify₁∞ {m = just _} p = simplify₁ p simplify₁-[] : ∀ {Tok R} → Parser Tok R [] → Parser Tok R [] simplify₁-[] p = P.subst (Parser _ _) ([]-lemma p) $ Simplify₁.parser $ simplify₁ p simplify₁-[]-correct : ∀ {Tok R} (p : Parser Tok R []) → p ≅P simplify₁-[] p simplify₁-[]-correct p = p ≅⟨ Simplify₁.correct (simplify₁ p) ⟩ Simplify₁.parser (simplify₁ p) ≅⟨ sym $ Subst.correct ([]-lemma p) ⟩ simplify₁-[] p ∎ []-lemma : ∀ {Tok R} (p : Parser Tok R []) → Simplify₁.bag (simplify₁ p) ≡ [] []-lemma p = BSEq.empty-unique $ I.cong $ C.sound $ sym $ Simplify₁.correct $ simplify₁ p ------------------------------------------------------------------------ -- Deep simplification -- The function simplify simplifies the first layer, then it traverses -- the result and simplifies the following layers, and so on. The -- extra traversals have been implemented to satisfy Agda's -- termination checker; they could perhaps be avoided. -- -- Note that simplifications in an upper layer do not get to take -- advantage of simplifications performed in lower layers. Consider -- ♯ p ⊛ token, for instance. If p can be simplified to fail, then one -- might believe that ♯ p ⊛ token is simplified to fail as well. -- However, this is only the case if p actually /computes/ to fail. -- -- If simplification of the upper layer were dependent on complete -- simplification of lower layers, then simplification could fail to -- terminate. This does not mean that one cannot propagate /any/ -- information from lower layers to upper layers, though: one could -- for instance perform partial simplification of lower layers, up to -- a certain depth, before an upper layer is simplified. mutual simplify : ∀ {Tok R xs} (p : Parser Tok R xs) → Parser Tok R (Simplify₁.bag $ simplify₁ p) simplify p = simplify↓ (Simplify₁.parser (simplify₁ p)) private simplify↓ : ∀ {Tok R xs} → Parser Tok R xs → Parser Tok R xs simplify↓ (return x) = return x simplify↓ fail = fail simplify↓ token = token simplify↓ (p₁ ∣ p₂) = simplify↓ p₁ ∣ simplify↓ p₂ simplify↓ (f <$> p) = f <$> simplify↓ p simplify↓ (nonempty p) = nonempty (simplify↓ p) simplify↓ (cast xs₁≈xs₂ p) = cast xs₁≈xs₂ (simplify↓ p) simplify↓ (p₁ ⊛ p₂) with forced? p₁ | forced? p₂ ... | just xs | just fs = simplify↓ p₁ ⊛ simplify↓ p₂ ... | just xs | nothing = simplify↓ p₁ ⊛ ♯ simplify (♭ p₂) ... | nothing | just fs = ♯ simplify (♭ p₁) ⊛ simplify↓ p₂ ... | nothing | nothing = ♯ simplify-[] (♭ p₁) ⊛ ♯ simplify-[] (♭ p₂) simplify↓ (p₁ >>= p₂) with forced? p₁ | forced?′ p₂ ... | just f | just xs = simplify↓ p₁ >>= λ x → simplify↓ (p₂ x) ... | just f | nothing = simplify↓ p₁ >>= λ x → ♯ simplify (♭ (p₂ x)) ... | nothing | just xs = ♯ simplify (♭ p₁) >>= λ x → simplify↓ (p₂ x) ... | nothing | nothing = ♯ simplify-[] (♭ p₁) >>= λ x → ♯ simplify-[] (♭ (p₂ x)) simplify-[] : ∀ {Tok R} → Parser Tok R [] → Parser Tok R [] simplify-[] p = simplify↓ (simplify₁-[] p) -- The simplifier is correct. mutual correct : ∀ {Tok R xs} (p : Parser Tok R xs) → simplify p ≅P p correct p = simplify↓ (Simplify₁.parser $ simplify₁ p) ≅⟨ correct↓ (Simplify₁.parser $ simplify₁ p) ⟩ Simplify₁.parser (simplify₁ p) ≅⟨ sym $ Simplify₁.correct $ simplify₁ p ⟩ p ∎ private correct↓ : ∀ {Tok R xs} (p : Parser Tok R xs) → simplify↓ p ≅P p correct↓ (return x) = return x ∎ correct↓ fail = fail ∎ correct↓ token = token ∎ correct↓ (p₁ ∣ p₂) = correct↓ p₁ ∣′ correct↓ p₂ correct↓ (f <$> p) = (λ _ → refl) <$> correct↓ p correct↓ (nonempty p) = nonempty (correct↓ p) correct↓ (cast xs₁≈xs₂ p) = cast (correct↓ p) correct↓ (p₁ ⊛ p₂) with forced? p₁ | forced? p₂ ... | just xs | just fs = [ just (○ , ○) - just (○ , ○) ] correct↓ p₁ ⊛ correct↓ p₂ ... | just xs | nothing = [ just (○ , ○) - nothing ] correct↓ p₁ ⊛ ♯ correct (♭ p₂) ... | nothing | just fs = [ nothing - just (○ , ○) ] ♯ correct (♭ p₁) ⊛ correct↓ p₂ ... | nothing | nothing = [ nothing - nothing ] ♯ correct-[] (♭ p₁) ⊛ ♯ correct-[] (♭ p₂) correct↓ (p₁ >>= p₂) with forced? p₁ | forced?′ p₂ ... | just f | just xs = [ just (○ , ○) - just (○ , ○) ] correct↓ p₁ >>= λ x → correct↓ (p₂ x) ... | just f | nothing = [ just (○ , ○) - nothing ] correct↓ p₁ >>= λ x → ♯ correct (♭ (p₂ x)) ... | nothing | just xs = [ nothing - just (○ , ○) ] ♯ correct (♭ p₁) >>= λ x → correct↓ (p₂ x) ... | nothing | nothing = [ nothing - nothing ] ♯ correct-[] (♭ p₁) >>= λ x → ♯ correct-[] (♭ (p₂ x)) correct-[] : ∀ {Tok R} (p : Parser Tok R []) → simplify-[] p ≅P p correct-[] p = simplify-[] p ≅⟨ correct↓ (simplify₁-[] p) ⟩ simplify₁-[] p ≅⟨ sym $ simplify₁-[]-correct p ⟩ p ∎
{-# OPTIONS --warning=error #-} -- Useless private module Issue476a where A : Set₁ private A = Set
(* * Copyright 2020, Data61, CSIRO (ABN 41 687 119 230) * * SPDX-License-Identifier: BSD-2-Clause *) (* * Strengthen functions into simpler monads. * * Each block of lifting lemmas converts functions in the "L2" monadic * framework (an exception framework) into its own framework. *) theory TypeStrengthen imports L2Defs "Lib.OptionMonadND" ExecConcrete begin (* Set up the database and ts_rule attribute. *) ML_file "monad_types.ML" setup \<open> Attrib.setup (Binding.name "ts_rule") Monad_Types.ts_attrib "AutoCorres type strengthening rule" \<close> (* * Helpers for exception polymorphism lemmas (L2_call_Foo_polymorphic). * * They are used to rewrite a term like * * L2_call x = Foo y * * into an identical term with a different exception type. *) definition unliftE where "unliftE (x :: ('a, 'u + 'b) nondet_monad) \<equiv> x <catch> (\<lambda>_. fail)" lemma L2_call_liftE_unliftE: "L2_call x = liftE (unliftE (L2_call x))" apply (clarsimp simp: L2_call_def unliftE_def) apply (rule ext) apply (clarsimp simp: handleE'_def catch_def liftE_def bind_assoc) apply (clarsimp cong: bind_apply_cong) apply (clarsimp simp: bind_def split_def return_def split: sum.splits) apply (force simp: return_def fail_def split: sum.splits)+ done lemma unliftE_liftE [simp]: "unliftE (liftE x) = x" apply (clarsimp simp: unliftE_def catch_liftE) done (* * Lifting into pure functional Isabelle. *) definition "TS_return x \<equiv> liftE (return x)" lemma L2_call_TS_return: "L2_call (TS_return a) = L2_gets (\<lambda>_. a) [''ret'']" apply (monad_eq simp: L2_call_def L2_gets_def TS_return_def) done lemma TS_return_L2_gets: "L2_gets (\<lambda>_. P) n = TS_return P" by (monad_eq simp: L2_defs TS_return_def) lemma L2_call_L2_gets_polymorphic: "(L2_call x :: ('s, 'a, 'e1) L2_monad) = L2_gets y n \<Longrightarrow> (L2_call x :: ('s, 'a, 'e2) L2_monad) = L2_gets y n" apply (monad_eq simp: L2_defs L2_call_def Ball_def split: sum.splits) apply blast done setup \<open> Monad_Types.new_monad_type "pure" "Pure function" (Monad_Types.check_lifting_head [@{term "TS_return"}]) 100 @{thms L2_call_TS_return TS_return_L2_gets} @{term "(%a. L2_gets (%_. a) [''ret'']) :: 'a => ('s, 'a, unit) L2_monad"} @{thm L2_call_L2_gets_polymorphic} #2 (fn _ => error "monad_mono not applicable for pure monad") |> Context.theory_map \<close> lemma TS_return_L2_seq: "L2_seq (TS_return A) (\<lambda>a. TS_return (B a)) = TS_return (let a = A in B a)" by (monad_eq simp: L2_defs TS_return_def) lemma TS_return_L2_condition: "L2_condition (\<lambda>_. c) (TS_return A) (TS_return B) = TS_return (if c then A else B)" by (monad_eq simp: L2_defs TS_return_def) lemmas [ts_rule pure] = TS_return_L2_gets TS_return_L2_seq TS_return_L2_condition split_distrib[where T = TS_return] lemma L2_seq_TS_return: "TS_return (let a = A in B a) = L2_seq (L2_gets (\<lambda>_. A) []) (\<lambda>a. L2_gets (\<lambda>_. B a) [])" by (monad_eq simp: L2_defs TS_return_def) lemma L2_condition_TS_return: "TS_return (if c then A else B) = L2_condition (\<lambda>_. c) (L2_gets (\<lambda>_. A) []) (L2_gets (\<lambda>_. B) [])" by (monad_eq simp: L2_defs TS_return_def) lemmas [ts_rule pure unlift] = TS_return_L2_gets [where n = "[]", symmetric] TS_return_L2_seq [symmetric] TS_return_L2_condition [symmetric] L2_seq_TS_return L2_condition_TS_return split_distrib[where T = TS_return, symmetric] (* * Lifting into pure functional Isabelle with state. *) definition "TS_gets x \<equiv> liftE (gets x)" lemma TS_gets_L2_gets: "L2_gets X n = TS_gets X" by (monad_eq simp: L2_defs TS_gets_def) lemma L2_call_TS_gets: "L2_call (TS_gets a) = L2_gets a [''TS_internal_retval'']" apply (monad_eq simp: L2_call_def L2_gets_def TS_gets_def) done setup \<open> Monad_Types.new_monad_type "gets" "Read-only function" (Monad_Types.check_lifting_head [@{term "TS_gets"}]) 80 @{thms L2_call_TS_gets TS_gets_L2_gets} @{term "(%x. L2_gets x [''ret'']) :: ('s => 'a) => ('s, 'a, unit) L2_monad"} @{thm L2_call_L2_gets_polymorphic} (fn (state, ret, ex) => state --> ret) (fn _ => error "monad_mono not applicable for gets monad") |> Context.theory_map \<close> lemma TS_gets_L2_seq: "L2_seq (TS_gets A) (\<lambda>x. TS_gets (B x)) = (TS_gets (\<lambda>s. let x = A s in B x s))" by (monad_eq simp: L2_defs TS_gets_def) lemma TS_gets_L2_condition: "L2_condition c (TS_gets A) (TS_gets B) = TS_gets (\<lambda>s. if c s then (A s) else (B s))" by (monad_eq simp: L2_defs TS_gets_def) lemmas [ts_rule gets] = TS_gets_L2_gets TS_gets_L2_seq TS_gets_L2_condition split_distrib[where T = TS_gets] lemmas [ts_rule gets unlift] = TS_gets_L2_gets [where n = "[]", symmetric] TS_gets_L2_seq [symmetric] TS_gets_L2_condition [symmetric] split_distrib[where T = TS_gets, symmetric] (* * Lifting into option monad. *) definition "gets_theE \<equiv> \<lambda>x. (liftE (gets_the x))" lemma L2_call_gets_theE [simp]: "L2_call (gets_theE x) = gets_theE x" apply (monad_eq simp: L2_call_def L2_gets_def gets_theE_def) done lemma liftE_gets_theE: "gets_theE X = liftE (gets_the X)" apply (clarsimp simp: gets_theE_def) done lemma L2_call_gets_theE_polymorphic: "(L2_call x :: ('s, 'a, 'e1) L2_monad) = gets_theE y \<Longrightarrow> (L2_call x :: ('s, 'a, 'e2) L2_monad) = gets_theE y" apply (metis L2_call_liftE_unliftE liftE_gets_theE unliftE_liftE) done lemma in_gets_theE [monad_eq]: "(rv, s') \<in> fst (gets_theE M s) = (\<exists>v'. rv = Inr v' \<and> s' = s \<and> M s = Some v')" apply (monad_eq simp: gets_theE_def) done lemma snd_gets_theE [monad_eq]: "snd (gets_theE M s) = (M s = None)" apply (monad_eq simp: gets_theE_def gets_the_def Bex_def assert_opt_def split: option.splits) done lemma gets_theE_ofail [simp]: "gets_theE ofail = fail" by (monad_eq simp: L2_defs ofail_def split: option.splits) (* unused *) lemma monad_mono_transfer_option: "\<lbrakk> \<And>m. (L2_call (f m) :: ('s, 'a, 'e) L2_monad) = gets_theE (f' m); monad_mono f \<rbrakk> \<Longrightarrow> option_monad_mono f'" apply atomize apply (clarsimp simp: monad_mono_def option_monad_mono_def) apply (clarsimp split: option.splits) apply (erule allE, erule allE, erule (1) impE) apply (erule_tac x=s in allE) apply (frule_tac x=x in spec) apply (drule_tac x=y in spec) apply rule apply (monad_eq simp: L2_call_def split: sum.splits) apply metis apply (monad_eq simp: L2_call_def split: sum.splits) apply (metis (full_types) sum.inject(2)) done setup \<open> Monad_Types.new_monad_type "option" "Option monad" (Monad_Types.check_lifting_head [@{term "gets_theE"}]) 60 @{thms L2_call_gets_theE gets_theE_ofail} @{term "gets_theE :: ('s => 'a option) => ('s, 'a, unit) L2_monad"} @{thm L2_call_gets_theE_polymorphic} (fn (state, ret, ex) => state --> Term.map_atyps (fn t => if t = @{typ "'a"} then ret else t) @{typ "'a option"}) (fn def => fn mono_thm => @{thm monad_mono_transfer_option} OF [def, mono_thm]) |> Context.theory_map \<close> lemma gets_theE_L2_gets: "L2_gets a n = gets_theE (ogets a)" by (monad_eq simp: L2_defs ogets_def) lemma gets_theE_L2_seq: "L2_seq (gets_theE X) (\<lambda>x. gets_theE (Y x)) = gets_theE (X |>> Y)" by (monad_eq simp: L2_defs ogets_def Bex_def obind_def split: option.splits) lemma gets_theE_L2_guard: "L2_guard G = gets_theE (oguard G)" by (monad_eq simp: L2_defs oguard_def split: option.splits) lemma gets_theE_L2_condition: "L2_condition C (gets_theE L) (gets_theE R) = gets_theE (ocondition C L R)" by (monad_eq simp: L2_defs ocondition_def split: option.splits) lemma gets_theE_L2_fail: "L2_fail = gets_theE (ofail)" by (monad_eq simp: L2_defs ofail_def split: option.splits) lemma gets_theE_L2_recguard: "L2_recguard m (gets_theE x) = gets_theE (ocondition (\<lambda>_. m = 0) ofail x)" by (monad_eq simp: L2_defs ocondition_def ofail_def split: option.splits) lemma gets_theE_L2_while: "L2_while C (\<lambda>x. gets_theE (B x)) i n = gets_theE (owhile C B i)" unfolding L2_while_def gets_theE_def gets_the_whileLoop[symmetric] by (rule whileLoopE_liftE) lemmas [ts_rule option] = gets_theE_L2_seq gets_theE_L2_fail gets_theE_L2_guard gets_theE_L2_recguard gets_theE_L2_gets gets_theE_L2_condition gets_theE_L2_while split_distrib[where T = gets_theE] lemmas [ts_rule option unlift] = gets_theE_L2_seq [symmetric] gets_theE_L2_fail [symmetric] gets_theE_L2_guard [symmetric] gets_theE_L2_recguard [symmetric] gets_theE_L2_gets [where n = "[]", symmetric] gets_theE_L2_condition [symmetric] gets_theE_L2_while [symmetric] split_distrib[where T = gets_theE, symmetric] (* * Lifting into the nondeterministic state monad. * All L2 terms can be lifted into it. *) lemma L2_call_liftE_polymorphic: "((L2_call x) :: ('s, 'a, 'e1) L2_monad) = liftE y \<Longrightarrow> (L2_call x :: ('s, 'a, 'e2) L2_monad) = liftE y" apply (metis L2_call_liftE_unliftE unliftE_liftE) done lemma monad_mono_transfer_nondet: "\<lbrakk> \<And>m. (L2_call (f m) :: ('s, 'a, 'e) L2_monad) = liftE (f' m); monad_mono f \<rbrakk> \<Longrightarrow> monad_mono f'" apply atomize apply (clarsimp simp: monad_mono_def option_monad_mono_def) apply (erule allE, erule allE, erule (1) impE) apply (erule_tac x=s in allE) apply (frule_tac x=x in spec) apply (drule_tac x=y in spec) apply rule apply (monad_eq simp: L2_call_def split: sum.splits) apply (metis set_rev_mp sum.inject(2)) apply (monad_eq simp: L2_call_def split: sum.splits) apply (* not *) fast done setup \<open> Monad_Types.new_monad_type "nondet" "Nondeterministic state monad (default)" (Monad_Types.check_lifting_head [@{term "liftE"}]) 0 @{thms L2_call_liftE} @{term "liftE :: ('s, 'a) nondet_monad => ('s, 'a, unit) L2_monad"} @{thm L2_call_liftE_polymorphic} (fn (state, ret, ex) => Term.map_atyps (fn t => if t = @{typ "'a"} then ret else if t = @{typ "'s"} then state else t) @{typ "('s, 'a) nondet_monad"}) (fn def => fn mono_thm => @{thm monad_mono_transfer_nondet} OF [def, mono_thm]) |> Context.theory_map \<close> lemma liftE_L2_seq: "L2_seq (liftE A) (\<lambda>x. liftE (B x)) = (liftE (A >>= B))" apply (clarsimp simp: L2_defs) apply (clarsimp simp: liftE_def bindE_def bind_assoc) done lemma liftE_L2_condition: "L2_condition c (liftE A) (liftE B) = liftE (condition c A B)" apply (clarsimp simp: L2_defs) apply (rule ext)+ apply monad_eq apply blast done lemma liftE_L2_modify: "L2_modify m = liftE (modify m)" apply (clarsimp simp: L2_defs) done lemma liftE_L2_gets: "L2_gets a n = liftE (gets a)" apply (clarsimp simp: L2_defs) done lemma liftE_L2_recguard: "(L2_recguard x (liftE A)) = liftE (condition (\<lambda>s. x > 0) A fail)" apply (case_tac "x = 0") apply clarsimp apply (clarsimp simp: L2_recguard_def) done lemma liftE_L2_while: "L2_while c (\<lambda>r. liftE (B r)) i n = liftE (whileLoop c B i)" apply (clarsimp simp: L2_while_def) apply (rule whileLoopE_liftE) done lemma liftE_L2_throw: "L2_throw X n = throwError X" apply (monad_eq simp: L2_throw_def) done lemma liftE_L2_catch: "L2_catch (liftE A) B = liftE A" apply (clarsimp simp: L2_defs) done lemma liftE_L2_catch': "L2_catch A (\<lambda>x. liftE (B x)) = liftE (A <catch> B)" apply (clarsimp simp: L2_defs) apply (clarsimp simp: handleE'_def liftE_def catch_def bind_assoc) apply (rule arg_cong [where f="\<lambda>x. (A >>= x)"]) apply (rule ext) apply (clarsimp split: sum.splits) done lemma liftE_L2_unknown: "L2_unknown name = liftE (select UNIV)" apply (clarsimp simp: L2_defs) done lemma liftE_L2_spec: "L2_spec S = liftE (spec S >>= (\<lambda>_. select UNIV))" apply (clarsimp simp: L2_defs) done lemma liftE_L2_guard: "L2_guard G = liftE (guard G)" apply (clarsimp simp: L2_defs) done lemma liftE_L2_fail: "L2_fail = liftE (fail)" apply (clarsimp simp: L2_defs liftE_def) done lemma liftE_exec_concrete: "exec_concrete st (liftE x) = liftE (exec_concrete st x)" apply (rule monad_eqI) apply (clarsimp simp: in_liftE in_exec_concrete) apply force apply (clarsimp simp: in_liftE in_exec_concrete) apply force apply (clarsimp simp: snd_exec_concrete snd_liftE) done lemma liftE_exec_abstract: "exec_abstract st (liftE x) = liftE (exec_abstract st x)" apply (rule monad_eqI) apply (clarsimp simp: in_liftE in_exec_abstract) apply (clarsimp simp: in_liftE in_exec_abstract) apply (clarsimp simp: snd_exec_abstract snd_liftE) done lemma liftE_measure_call: "\<lbrakk> monad_mono A; \<And>m. L2_call (A m) = liftE (B m) \<rbrakk> \<Longrightarrow> L2_call (measure_call A) = liftE (measure_call B)" apply (monad_eq simp: measure_call_def L2_call_def L2_defs) apply (fast dest: monad_mono_incl) done lemmas [ts_rule nondet] = liftE_L2_seq liftE_L2_condition liftE_L2_modify liftE_L2_gets liftE_L2_while liftE_L2_throw liftE_L2_catch liftE_L2_catch' liftE_L2_spec liftE_L2_guard liftE_L2_unknown liftE_L2_fail liftE_L2_recguard liftE_exec_concrete liftE_exec_abstract liftE_gets_theE liftE_measure_call split_distrib [where T=liftE] definition "AC_call_L1 arg_xf gs ret_xf l1body = liftM (\<lambda>rv. case rv of Inr v \<Rightarrow> v) (L2_call_L1 arg_xf gs ret_xf l1body)" lemma liftE_L2_call_L1[ts_rule nondet]: "L2_call_L1 arg_xf gs ret_xf l1body = liftE (AC_call_L1 arg_xf gs ret_xf l1body)" apply (simp add: AC_call_L1_def L2_call_L1_def liftE_def liftM_def bind_assoc) apply (rule ext) apply (simp add: exec_gets exec_get) apply (rule bind_apply_cong[OF refl])+ apply (clarsimp simp: bind_assoc returnOk_def in_monad split: sum.splits) done lemmas [ts_rule nondet unlift] = liftE_L2_seq [symmetric] liftE_L2_condition [symmetric] liftE_L2_modify [symmetric] liftE_L2_gets [symmetric] liftE_L2_while [symmetric] liftE_L2_throw [symmetric] liftE_L2_catch [symmetric] liftE_L2_catch' [symmetric] liftE_L2_spec [symmetric] liftE_L2_guard [symmetric] liftE_L2_unknown [symmetric] liftE_L2_fail [symmetric] liftE_L2_recguard [symmetric] liftE_exec_concrete [symmetric] liftE_exec_abstract [symmetric] liftE_gets_theE [symmetric] split_distrib [where T=liftE, symmetric] end
## This READMe.jl is for part 2 of exercise 1a.
module Structure where -- Structures in meta-functions. module Function' where -- TODO: Temporary naming fix with tick module Properties ⦃ signature : Signature ⦄ where Type : Domain → Domain → Function → Formula Type(X)(Y)(f) = ∀ₛ(X)(x ↦ f(x) ∈ Y) Closed : Domain → Function → Formula Closed(S)(f) = Type(S)(S)(f) Injective'' : Domain → Function → Formula Injective''(A)(f) = ∀ₛ(A)(x ↦ ∀ₛ(A)(y ↦ (f(x) ≡ f(y)) ⟶ (x ≡ y))) Surjective'' : Domain → Domain → Function → Formula Surjective''(A)(B)(f) = ∀ₛ(B)(y ↦ ∃ₛ(A)(x ↦ f(x) ≡ y)) Bijective'' : Domain → Domain → Function → Formula Bijective''(A)(B)(f) = Injective''(A)(f) ∧ Surjective''(A)(B)(f) Preserving₁'' : Domain → Function → Function → Function → Formula Preserving₁''(A)(f)(g₁)(g₂) = ∀ₛ(A)(x ↦ f(g₁(x)) ≡ g₂(f(x))) Preserving₂'' : Domain → Domain → Function → BinaryOperator → BinaryOperator → Formula Preserving₂''(A)(B)(f)(_▫₁_)(_▫₂_) = ∀ₛ(A)(x ↦ ∀ₛ(B)(y ↦ f(x ▫₁ y) ≡ (f(x) ▫₂ f(y)))) module Relator where module Properties where Reflexivity : Domain → BinaryRelator → Formula Reflexivity(S)(_▫_) = ∀ₛ(S)(x ↦ x ▫ x) Irreflexivity : Domain → BinaryRelator → Formula Irreflexivity(S)(_▫_) = ∀ₛ(S)(x ↦ ¬(x ▫ x)) Symmetry : Domain → BinaryRelator → Formula Symmetry(S)(_▫_) = ∀ₛ(S)(x ↦ ∀ₛ(S)(y ↦ (x ▫ y) ⟶ (y ▫ x))) Asymmetry : Domain → BinaryRelator → Formula Asymmetry(S)(_▫_) = ∀ₛ(S)(x ↦ ∀ₛ(S)(y ↦ (x ▫ y) ⟶ ¬(y ▫ x))) Antisymmetry : Domain → BinaryRelator → Formula Antisymmetry(S)(_▫_) = ∀ₛ(S)(x ↦ ∀ₛ(S)(y ↦ (x ▫ y)∧(y ▫ x) ⟶ (x ≡ y))) Transitivity : Domain → BinaryRelator → Formula Transitivity(S)(_▫_) = ∀ₛ(S)(x ↦ ∀ₛ(S)(y ↦ ∀ₛ(S)(z ↦ (x ▫ y)∧(y ▫ z) ⟶ (x ▫ z)))) Equivalence : Domain → BinaryRelator → Formula Equivalence(S)(_▫_) = Reflexivity(S)(_▫_) ∧ Symmetry(S)(_▫_) ∧ Transitivity(S)(_▫_) SymmetricallyTotal : Domain → BinaryRelator → Formula SymmetricallyTotal(S)(_▫_) = ∀ₛ(S)(x ↦ ∀ₛ(S)(y ↦ (x ▫ y) ∨ (y ▫ x))) module Ordering where open Relator.Properties Minima : Domain → BinaryRelator → Domain → Formula Minima(S)(_≤_)(min) = ∀ₛ(S)(x ↦ min ≤ x) Maxima : Domain → BinaryRelator → Domain → Formula Maxima(S)(_≤_)(max) = ∀ₛ(S)(x ↦ x ≤ max) module _ ⦃ signature : Signature ⦄ where open Signature ⦃ ... ⦄ lowerBounds : Domain → BinaryRelator → Domain → Domain lowerBounds(S)(_≤_)(Sₛ) = filter(S)(Minima(S)(_≤_)) upperBounds : Domain → BinaryRelator → Domain → Domain upperBounds(S)(_≤_)(Sₛ) = filter(S)(Maxima(S)(_≤_)) interval : Domain → BinaryRelator → Domain → Domain → Domain interval(S)(_≤_) (a)(b) = filter(S)(s ↦ (a ≤ s) ∧ (s ≤ b)) Bounded : Domain → BinaryRelator → Domain → Domain → Formula Bounded(S)(_≤_) (a)(b) = ∀ₛ(S)(s ↦ (a ≤ s) ∧ (s ≤ b)) Infima : Domain → BinaryRelator → Domain → Domain → Formula Infima(S)(_≤_)(Sₛ)(inf) = Maxima(lowerBounds(S)(_≤_)(Sₛ))(_≤_)(inf) Suprema : Domain → BinaryRelator → Domain → Domain → Formula Suprema(S)(_≤_)(Sₛ)(sup) = Minima(upperBounds(S)(_≤_)(Sₛ))(_≤_)(sup) module Weak where PartialOrder : Domain → BinaryRelator → Formula PartialOrder(S)(_≤_) = Reflexivity(S)(_≤_) ∧ Antisymmetry(S)(_≤_) ∧ Transitivity(S)(_≤_) TotalOrder : Domain → BinaryRelator → Formula TotalOrder(S)(_≤_) = PartialOrder(S)(_≤_) ∧ SymmetricallyTotal(S)(_≤_) module Strict where Order : Domain → BinaryRelator → Formula Order(S)(_<_) = Irreflexivity(S)(_<_) ∧ Asymmetry(S)(_<_) ∧ Transitivity(S)(_<_) Dense : Domain → BinaryRelator → Formula Dense(S)(_<_) = ∀ₛ(S)(x ↦ ∀ₛ(S)(y ↦ (x < y) ⟶ ∃ₛ(S)(z ↦ (x < z)∧(z < y)))) module Operator where module Properties where AssociativityPattern : Domain → Domain → Domain → BinaryOperator → BinaryOperator → BinaryOperator → BinaryOperator → Formula AssociativityPattern(x)(y)(z)(_▫₁_)(_▫₂_)(_▫₃_)(_▫₄_) = (((x ▫₁ y) ▫₂ z) ≡ (x ▫₃ (y ▫₄ z))) DistributivityₗPattern : Domain → Domain → Domain → BinaryOperator → BinaryOperator → BinaryOperator → BinaryOperator → BinaryOperator → Formula DistributivityₗPattern(x)(y)(z)(_▫₁_)(_▫₂_)(_▫₃_)(_▫₄_)(_▫₅_) = (x ▫₁ (y ▫₂ z)) ≡ ((x ▫₃ y) ▫₄ (x ▫₅ z)) DistributivityᵣPattern : Domain → Domain → Domain → BinaryOperator → BinaryOperator → BinaryOperator → BinaryOperator → BinaryOperator → Formula DistributivityᵣPattern(x)(y)(z)(_▫₁_)(_▫₂_)(_▫₃_)(_▫₄_)(_▫₅_) = ((x ▫₂ y) ▫₁ z) ≡ ((x ▫₃ z) ▫₄ (y ▫₅ z)) Type : BinaryOperator → Domain → Domain → Domain → Formula Type(_▫_)(X)(Y)(Z) = ∀ₛ(X)(x ↦ ∀ₛ(Y)(y ↦ (x ▫ y) ∈ Z)) Closed : Domain → BinaryOperator → Formula Closed(S)(_▫_) = Type(_▫_)(S)(S)(S) Commutativity : Domain → BinaryOperator → Formula Commutativity(S)(_▫_) = ∀ₛ(S)(x ↦ ∀ₛ(S)(y ↦ (x ▫ y) ≡ (y ▫ x))) Associativity : Domain → BinaryOperator → Formula Associativity(S)(_▫_) = ∀ₛ(S)(x ↦ ∀ₛ(S)(y ↦ ∀ₛ(S)(z ↦ AssociativityPattern(x)(y)(z)(_▫_)(_▫_)(_▫_)(_▫_)))) Identityₗ : Domain → BinaryOperator → Domain → Formula Identityₗ(S)(_▫_)(id) = ∀ₛ(S)(x ↦ (id ▫ x) ≡ x) Identityᵣ : Domain → BinaryOperator → Domain → Formula Identityᵣ(S)(_▫_)(id) = ∀ₛ(S)(x ↦ (x ▫ id) ≡ x) Identity : Domain → BinaryOperator → Domain → Formula Identity(S)(_▫_)(id) = Identityₗ(S)(_▫_)(id) ∧ Identityᵣ(S)(_▫_)(id) Invertibleₗ : Domain → BinaryOperator → Domain → Formula Invertibleₗ(S)(_▫_)(id) = ∀ₛ(S)(x ↦ ∃ₛ(S)(x⁻¹ ↦ (x⁻¹ ▫ x) ≡ id)) Invertibleᵣ : Domain → BinaryOperator → Domain → Formula Invertibleᵣ(S)(_▫_)(id) = ∀ₛ(S)(x ↦ ∃ₛ(S)(x⁻¹ ↦ (x ▫ x⁻¹) ≡ id)) Invertible : Domain → BinaryOperator → Domain → Formula Invertible(S)(_▫_)(id) = ∀ₛ(S)(x ↦ ∃ₛ(S)(x⁻¹ ↦ ((x⁻¹ ▫ x) ≡ id) ∧ ((x ▫ x⁻¹) ≡ id))) Distributivityₗ : Domain → BinaryOperator → BinaryOperator → Formula Distributivityₗ(S)(_▫₁_)(_▫₂_) = ∀ₛ(S)(x ↦ ∀ₛ(S)(y ↦ ∀ₛ(S)(z ↦ DistributivityₗPattern(x)(y)(z)(_▫₁_)(_▫₂_)(_▫₁_)(_▫₂_)(_▫₁_)))) Distributivityᵣ : Domain → BinaryOperator → BinaryOperator → Formula Distributivityᵣ(S)(_▫₁_)(_▫₂_) = ∀ₛ(S)(x ↦ ∀ₛ(S)(y ↦ ∀ₛ(S)(z ↦ DistributivityᵣPattern(x)(y)(z)(_▫₁_)(_▫₂_)(_▫₁_)(_▫₂_)(_▫₁_)))) Distributivity : Domain → BinaryOperator → BinaryOperator → Formula Distributivity(S)(_▫₁_)(_▫₂_) = Distributivityₗ(S)(_▫₁_)(_▫₂_) ∧ Distributivityᵣ(S)(_▫₁_)(_▫₂_) Compatibility : Domain → Domain → BinaryOperator → BinaryOperator → Formula Compatibility(A)(B)(_▫₁_)(_▫₂_) = ∀ₛ(A)(a₁ ↦ ∀ₛ(A)(a₂ ↦ ∀ₛ(B)(b ↦ AssociativityPattern(a₁)(a₂)(b)(_▫₁_)(_▫₁_)(_▫₂_)(_▫₁_)))) Semigroup : Domain → BinaryOperator → Formula Semigroup(S)(_▫_) = Closed(S)(_▫_) ∧ Associativity(S)(_▫_) Monoid : Domain → BinaryOperator → Formula Monoid(S)(_▫_) = Semigroup(S)(_▫_) ∧ ∃ₛ(S)(Identity(S)(_▫_)) Group : Domain → BinaryOperator → Formula Group(S)(_▫_) = Monoid(S)(_▫_) ∧ ∀ₛ(S)(id ↦ Identity(S)(_▫_)(id) ⟶ Invertible(S)(_▫_)(id)) CommutativeGroup : Domain → BinaryOperator → Formula CommutativeGroup(S)(_▫_) = Group(S)(_▫_) ∧ Commutativity(S)(_▫_) Rng : Domain → BinaryOperator → BinaryOperator → Formula Rng(S)(_▫₁_)(_▫₂_) = CommutativeGroup(S)(_▫₁_) ∧ Semigroup(S)(_▫₂_) ∧ Distributivity(S)(_▫₂_)(_▫₁_) Ring : Domain → BinaryOperator → BinaryOperator → Formula Ring(S)(_▫₁_)(_▫₂_) = CommutativeGroup(S)(_▫₁_) ∧ Monoid(S)(_▫₂_) ∧ Distributivity(S)(_▫₂_)(_▫₁_) module _ ⦃ signature : Signature ⦄ where open Signature ⦃ ... ⦄ Field : Domain → BinaryOperator → BinaryOperator → Formula Field(S)(_▫₁_)(_▫₂_) = CommutativeGroup(S)(_▫₁_) ∧ ∀ₛ(S)(id₁ ↦ Identity(S)(_▫₁_)(id₁) ⟶ CommutativeGroup(S ∖ singleton(id₁))(_▫₂_)) ∧ Distributivity(S)(_▫₂_)(_▫₁_) VectorSpace : Domain → Domain → BinaryOperator → BinaryOperator → BinaryOperator → BinaryOperator → Formula VectorSpace(V)(S)(_+ᵥ_)(_⋅ₛᵥ_)(_+ₛ_)(_⋅ₛ_) = CommutativeGroup(V)(_+ᵥ_) ∧ Field(S)(_+ₛ_)(_⋅ₛ_) ∧ ∀ₛ(S)(id ↦ Identity(S)(_⋅ₛ_)(id) ⟶ Identityₗ(V)(_⋅ₛᵥ_)(id)) ∧ Compatibility(S)(V)(_⋅ₛᵥ_)(_⋅ₛ_) ∧ ∀ₛ(S)(s ↦ ∀ₛ(V)(v₁ ↦ ∀ₛ(V)(v₂ ↦ DistributivityₗPattern(s)(v₁)(v₂)(_⋅ₛᵥ_)(_+ᵥ_)(_⋅ₛᵥ_)(_+ᵥ_)(_⋅ₛᵥ_)))) ∧ ∀ₛ(S)(s₁ ↦ ∀ₛ(S)(s₂ ↦ ∀ₛ(V)(v ↦ DistributivityᵣPattern(s₁)(s₂)(v)(_⋅ₛᵥ_)(_+ᵥ_)(_⋅ₛᵥ_)(_+ᵥ_)(_⋅ₛᵥ_)))) module Numeral where module Natural ⦃ signature : Signature ⦄ where open Signature ⦃ ... ⦄ FormulaInduction : Domain → Domain → Function → (Domain → Formula) → Formula FormulaInduction(ℕ)(𝟎)(𝐒) (φ) = (φ(𝟎) ∧ ∀ₛ(ℕ)(n ↦ φ(n) ⟶ φ(𝐒(n)))) ⟶ ∀ₛ(ℕ)(φ) SetInduction : Domain → Domain → Function → Formula SetInduction(ℕ)(𝟎)(𝐒) = ∀ₗ(X ↦ ((𝟎 ∈ X) ∧ ∀ₛ(ℕ)(n ↦ (n ∈ X) ⟶ (𝐒(n) ∈ X))) ⟶ (ℕ ⊆ X)) -- TODO: Can be expressed as ∀ₗ(X ↦ Inductive(X) ⟶ (ℕ ⊆ X)) -- A set ℕ which can be constructed ℕ-inductively. Peano : Domain → Domain → Function → Formula Peano(ℕ)(𝟎)(𝐒) = (𝟎 ∈ ℕ) ∧ Function'.Properties.Closed(ℕ)(𝐒) ∧ Function'.Properties.Injective''(ℕ)(𝐒) ∧ ∀ₛ(ℕ)(n ↦ 𝐒(n) ≢ 𝟎) ∧ SetInduction(ℕ)(𝟎)(𝐒)
/- Copyright (c) 2016 Jeremy Avigad. All rights reserved. Released under Apache 2.0 license as described in the file LICENSE. Authors: Jeremy Avigad, Leonardo de Moura, Mario Carneiro, Johannes Hölzl -/ import algebra.group.with_one import algebra.group.type_tags import algebra.group.prod import algebra.hom.equiv import algebra.order.monoid_lemmas import order.bounded_order import order.min_max import order.hom.basic /-! # Ordered monoids This file develops the basics of ordered monoids. ## Implementation details Unfortunately, the number of `'` appended to lemmas in this file may differ between the multiplicative and the additive version of a lemma. The reason is that we did not want to change existing names in the library. -/ set_option old_structure_cmd true open function universe u variable {α : Type u} /-- An ordered commutative monoid is a commutative monoid with a partial order such that `a ≤ b → c * a ≤ c * b` (multiplication is monotone) -/ @[protect_proj, ancestor comm_monoid partial_order] class ordered_comm_monoid (α : Type*) extends comm_monoid α, partial_order α := (mul_le_mul_left : ∀ a b : α, a ≤ b → ∀ c : α, c * a ≤ c * b) /-- An ordered (additive) commutative monoid is a commutative monoid with a partial order such that `a ≤ b → c + a ≤ c + b` (addition is monotone) -/ @[protect_proj, ancestor add_comm_monoid partial_order] class ordered_add_comm_monoid (α : Type*) extends add_comm_monoid α, partial_order α := (add_le_add_left : ∀ a b : α, a ≤ b → ∀ c : α, c + a ≤ c + b) attribute [to_additive] ordered_comm_monoid section ordered_instances @[to_additive] instance ordered_comm_monoid.to_covariant_class_left (M : Type*) [ordered_comm_monoid M] : covariant_class M M (*) (≤) := { elim := λ a b c bc, ordered_comm_monoid.mul_le_mul_left _ _ bc a } /- This instance can be proven with `by apply_instance`. However, `with_bot ℕ` does not pick up a `covariant_class M M (function.swap (*)) (≤)` instance without it (see PR #7940). -/ @[to_additive] instance ordered_comm_monoid.to_covariant_class_right (M : Type*) [ordered_comm_monoid M] : covariant_class M M (swap (*)) (≤) := covariant_swap_mul_le_of_covariant_mul_le M /- This is not an instance, to avoid creating a loop in the type-class system: in a `left_cancel_semigroup` with a `partial_order`, assuming `covariant_class M M (*) (≤)` implies `covariant_class M M (*) (<)` . -/ @[to_additive] lemma has_mul.to_covariant_class_left (M : Type*) [has_mul M] [partial_order M] [covariant_class M M (*) (<)] : covariant_class M M (*) (≤) := { elim := λ a b c bc, by { rcases eq_or_lt_of_le bc with rfl | bc, { exact rfl.le }, { exact (mul_lt_mul_left' bc a).le } } } /- This is not an instance, to avoid creating a loop in the type-class system: in a `right_cancel_semigroup` with a `partial_order`, assuming `covariant_class M M (swap (*)) (<)` implies `covariant_class M M (swap (*)) (≤)` . -/ @[to_additive] lemma has_mul.to_covariant_class_right (M : Type*) [has_mul M] [partial_order M] [covariant_class M M (swap (*)) (<)] : covariant_class M M (swap (*)) (≤) := { elim := λ a b c bc, by { rcases eq_or_lt_of_le bc with rfl | bc, { exact rfl.le }, { exact (mul_lt_mul_right' bc a).le } } } end ordered_instances /-- An `ordered_comm_monoid` with one-sided 'division' in the sense that if `a ≤ b`, there is some `c` for which `a * c = b`. This is a weaker version of the condition on canonical orderings defined by `canonically_ordered_monoid`. -/ class has_exists_mul_of_le (α : Type u) [ordered_comm_monoid α] : Prop := (exists_mul_of_le : ∀ {a b : α}, a ≤ b → ∃ (c : α), b = a * c) /-- An `ordered_add_comm_monoid` with one-sided 'subtraction' in the sense that if `a ≤ b`, then there is some `c` for which `a + c = b`. This is a weaker version of the condition on canonical orderings defined by `canonically_ordered_add_monoid`. -/ class has_exists_add_of_le (α : Type u) [ordered_add_comm_monoid α] : Prop := (exists_add_of_le : ∀ {a b : α}, a ≤ b → ∃ (c : α), b = a + c) attribute [to_additive] has_exists_mul_of_le export has_exists_mul_of_le (exists_mul_of_le) export has_exists_add_of_le (exists_add_of_le) /-- A linearly ordered additive commutative monoid. -/ @[protect_proj, ancestor linear_order ordered_add_comm_monoid] class linear_ordered_add_comm_monoid (α : Type*) extends linear_order α, ordered_add_comm_monoid α. /-- A linearly ordered commutative monoid. -/ @[protect_proj, ancestor linear_order ordered_comm_monoid, to_additive] class linear_ordered_comm_monoid (α : Type*) extends linear_order α, ordered_comm_monoid α. /-- A linearly ordered commutative monoid with a zero element. -/ class linear_ordered_comm_monoid_with_zero (α : Type*) extends linear_ordered_comm_monoid α, comm_monoid_with_zero α := (zero_le_one : (0 : α) ≤ 1) /-- A linearly ordered commutative monoid with an additively absorbing `⊤` element. Instances should include number systems with an infinite element adjoined.` -/ @[protect_proj, ancestor linear_ordered_add_comm_monoid has_top] class linear_ordered_add_comm_monoid_with_top (α : Type*) extends linear_ordered_add_comm_monoid α, has_top α := (le_top : ∀ x : α, x ≤ ⊤) (top_add' : ∀ x : α, ⊤ + x = ⊤) @[priority 100] -- see Note [lower instance priority] instance linear_ordered_add_comm_monoid_with_top.to_order_top (α : Type u) [h : linear_ordered_add_comm_monoid_with_top α] : order_top α := { ..h } section linear_ordered_add_comm_monoid_with_top variables [linear_ordered_add_comm_monoid_with_top α] {a b : α} @[simp] lemma top_add (a : α) : ⊤ + a = ⊤ := linear_ordered_add_comm_monoid_with_top.top_add' a @[simp] lemma add_top (a : α) : a + ⊤ = ⊤ := trans (add_comm _ _) (top_add _) end linear_ordered_add_comm_monoid_with_top /-- Pullback an `ordered_comm_monoid` under an injective map. See note [reducible non-instances]. -/ @[reducible, to_additive function.injective.ordered_add_comm_monoid "Pullback an `ordered_add_comm_monoid` under an injective map."] def function.injective.ordered_comm_monoid [ordered_comm_monoid α] {β : Type*} [has_one β] [has_mul β] [has_pow β ℕ] (f : β → α) (hf : function.injective f) (one : f 1 = 1) (mul : ∀ x y, f (x * y) = f x * f y) (npow : ∀ x (n : ℕ), f (x ^ n) = f x ^ n) : ordered_comm_monoid β := { mul_le_mul_left := λ a b ab c, show f (c * a) ≤ f (c * b), by { rw [mul, mul], apply mul_le_mul_left', exact ab }, ..partial_order.lift f hf, ..hf.comm_monoid f one mul npow } /-- Pullback a `linear_ordered_comm_monoid` under an injective map. See note [reducible non-instances]. -/ @[reducible, to_additive function.injective.linear_ordered_add_comm_monoid "Pullback an `ordered_add_comm_monoid` under an injective map."] def function.injective.linear_ordered_comm_monoid [linear_ordered_comm_monoid α] {β : Type*} [has_one β] [has_mul β] [has_pow β ℕ] (f : β → α) (hf : function.injective f) (one : f 1 = 1) (mul : ∀ x y, f (x * y) = f x * f y) (npow : ∀ x (n : ℕ), f (x ^ n) = f x ^ n) : linear_ordered_comm_monoid β := { .. hf.ordered_comm_monoid f one mul npow, .. linear_order.lift f hf } lemma bit0_pos [ordered_add_comm_monoid α] {a : α} (h : 0 < a) : 0 < bit0 a := add_pos h h namespace units @[to_additive] instance [monoid α] [preorder α] : preorder αˣ := preorder.lift (coe : αˣ → α) @[simp, norm_cast, to_additive] theorem coe_le_coe [monoid α] [preorder α] {a b : αˣ} : (a : α) ≤ b ↔ a ≤ b := iff.rfl @[simp, norm_cast, to_additive] theorem coe_lt_coe [monoid α] [preorder α] {a b : αˣ} : (a : α) < b ↔ a < b := iff.rfl @[to_additive] instance [monoid α] [partial_order α] : partial_order αˣ := partial_order.lift coe units.ext @[to_additive] instance [monoid α] [linear_order α] : linear_order αˣ := linear_order.lift coe units.ext @[simp, norm_cast, to_additive] theorem max_coe [monoid α] [linear_order α] {a b : αˣ} : (↑(max a b) : α) = max a b := by by_cases b ≤ a; simp [max_def, h] @[simp, norm_cast, to_additive] theorem min_coe [monoid α] [linear_order α] {a b : αˣ} : (↑(min a b) : α) = min a b := by by_cases a ≤ b; simp [min_def, h] end units namespace with_zero local attribute [semireducible] with_zero instance [preorder α] : preorder (with_zero α) := with_bot.preorder instance [partial_order α] : partial_order (with_zero α) := with_bot.partial_order instance [preorder α] : order_bot (with_zero α) := with_bot.order_bot lemma zero_le [partial_order α] (a : with_zero α) : 0 ≤ a := order_bot.bot_le a lemma zero_lt_coe [preorder α] (a : α) : (0 : with_zero α) < a := with_bot.bot_lt_coe a @[simp, norm_cast] lemma coe_lt_coe [preorder α] {a b : α} : (a : with_zero α) < b ↔ a < b := with_bot.coe_lt_coe @[simp, norm_cast] lemma coe_le_coe [preorder α] {a b : α} : (a : with_zero α) ≤ b ↔ a ≤ b := with_bot.coe_le_coe instance [lattice α] : lattice (with_zero α) := with_bot.lattice instance [linear_order α] : linear_order (with_zero α) := with_bot.linear_order lemma mul_le_mul_left {α : Type u} [has_mul α] [preorder α] [covariant_class α α (*) (≤)] : ∀ (a b : with_zero α), a ≤ b → ∀ (c : with_zero α), c * a ≤ c * b := begin rintro (_ | a) (_ | b) h (_ | c); try { exact λ f hf, option.no_confusion hf }, { exact false.elim (not_lt_of_le h (with_zero.zero_lt_coe a))}, { simp_rw [some_eq_coe] at h ⊢, norm_cast at h ⊢, exact covariant_class.elim _ h } end lemma lt_of_mul_lt_mul_left {α : Type u} [has_mul α] [partial_order α] [contravariant_class α α (*) (<)] : ∀ (a b c : with_zero α), a * b < a * c → b < c := begin rintro (_ | a) (_ | b) (_ | c) h; try { exact false.elim (lt_irrefl none h) }, { exact with_zero.zero_lt_coe c }, { exact false.elim (not_le_of_lt h (with_zero.zero_le _)) }, { simp_rw [some_eq_coe] at h ⊢, norm_cast at h ⊢, apply lt_of_mul_lt_mul_left' h } end @[simp] lemma le_max_iff [linear_order α] {a b c : α} : (a : with_zero α) ≤ max b c ↔ a ≤ max b c := by simp only [with_zero.coe_le_coe, le_max_iff] @[simp] lemma min_le_iff [linear_order α] {a b c : α} : min (a : with_zero α) b ≤ c ↔ min a b ≤ c := by simp only [with_zero.coe_le_coe, min_le_iff] instance [ordered_comm_monoid α] : ordered_comm_monoid (with_zero α) := { mul_le_mul_left := with_zero.mul_le_mul_left, ..with_zero.comm_monoid_with_zero, ..with_zero.partial_order } /- Note 1 : the below is not an instance because it requires `zero_le`. It seems like a rather pathological definition because α already has a zero. Note 2 : there is no multiplicative analogue because it does not seem necessary. Mathematicians might be more likely to use the order-dual version, where all elements are ≤ 1 and then 1 is the top element. -/ /-- If `0` is the least element in `α`, then `with_zero α` is an `ordered_add_comm_monoid`. See note [reducible non-instances]. -/ @[reducible] protected def ordered_add_comm_monoid [ordered_add_comm_monoid α] (zero_le : ∀ a : α, 0 ≤ a) : ordered_add_comm_monoid (with_zero α) := begin suffices, refine { add_le_add_left := this, ..with_zero.partial_order, ..with_zero.add_comm_monoid, .. }, { intros a b h c ca h₂, cases b with b, { rw le_antisymm h bot_le at h₂, exact ⟨_, h₂, le_rfl⟩ }, cases a with a, { change c + 0 = some ca at h₂, simp at h₂, simp [h₂], exact ⟨_, rfl, by simpa using add_le_add_left (zero_le b) _⟩ }, { simp at h, cases c with c; change some _ = _ at h₂; simp [-add_comm] at h₂; subst ca; refine ⟨_, rfl, _⟩, { exact h }, { exact add_le_add_left h _ } } } end end with_zero namespace with_top section has_one variables [has_one α] @[to_additive] instance : has_one (with_top α) := ⟨(1 : α)⟩ @[simp, norm_cast, to_additive] lemma coe_one : ((1 : α) : with_top α) = 1 := rfl @[simp, norm_cast, to_additive] lemma coe_eq_one {a : α} : (a : with_top α) = 1 ↔ a = 1 := coe_eq_coe @[simp, to_additive] protected lemma map_one {β} (f : α → β) : (1 : with_top α).map f = (f 1 : with_top β) := rfl @[simp, norm_cast, to_additive] theorem one_eq_coe {a : α} : 1 = (a : with_top α) ↔ a = 1 := trans eq_comm coe_eq_one @[simp, to_additive] theorem top_ne_one : ⊤ ≠ (1 : with_top α) . @[simp, to_additive] theorem one_ne_top : (1 : with_top α) ≠ ⊤ . end has_one instance [has_add α] : has_add (with_top α) := ⟨λ o₁ o₂, o₁.bind (λ a, o₂.map (λ b, a + b))⟩ @[norm_cast] lemma coe_add [has_add α] {a b : α} : ((a + b : α) : with_top α) = a + b := rfl @[norm_cast] lemma coe_bit0 [has_add α] {a : α} : ((bit0 a : α) : with_top α) = bit0 a := rfl @[norm_cast] lemma coe_bit1 [has_add α] [has_one α] {a : α} : ((bit1 a : α) : with_top α) = bit1 a := rfl @[simp] lemma add_top [has_add α] : ∀{a : with_top α}, a + ⊤ = ⊤ | none := rfl | (some a) := rfl @[simp] lemma top_add [has_add α] {a : with_top α} : ⊤ + a = ⊤ := rfl lemma add_eq_top [has_add α] {a b : with_top α} : a + b = ⊤ ↔ a = ⊤ ∨ b = ⊤ := by cases a; cases b; simp [none_eq_top, some_eq_coe, ←with_top.coe_add, ←with_zero.coe_add] lemma add_lt_top [has_add α] [partial_order α] {a b : with_top α} : a + b < ⊤ ↔ a < ⊤ ∧ b < ⊤ := by simp [lt_top_iff_ne_top, add_eq_top, not_or_distrib] lemma add_eq_coe [has_add α] : ∀ {a b : with_top α} {c : α}, a + b = c ↔ ∃ (a' b' : α), ↑a' = a ∧ ↑b' = b ∧ a' + b' = c | none b c := by simp [none_eq_top] | (some a) none c := by simp [none_eq_top] | (some a) (some b) c := by simp only [some_eq_coe, ← coe_add, coe_eq_coe, exists_and_distrib_left, exists_eq_left] @[simp] lemma add_coe_eq_top_iff [has_add α] {x : with_top α} {y : α} : x + y = ⊤ ↔ x = ⊤ := by { induction x using with_top.rec_top_coe; simp [← coe_add, -with_zero.coe_add] } @[simp] lemma coe_add_eq_top_iff [has_add α] {x : α} {y : with_top α} : ↑x + y = ⊤ ↔ y = ⊤ := by { induction y using with_top.rec_top_coe; simp [← coe_add, -with_zero.coe_add] } instance [add_semigroup α] : add_semigroup (with_top α) := { add_assoc := begin repeat { refine with_top.rec_top_coe _ _; try { intro }}; simp [←with_top.coe_add, add_assoc] end, ..with_top.has_add } instance [add_comm_semigroup α] : add_comm_semigroup (with_top α) := { add_comm := begin repeat { refine with_top.rec_top_coe _ _; try { intro }}; simp [←with_top.coe_add, add_comm] end, ..with_top.add_semigroup } instance [add_zero_class α] : add_zero_class (with_top α) := { zero_add := begin refine with_top.rec_top_coe _ _, { simp }, { intro, rw [←with_top.coe_zero, ←with_top.coe_add, zero_add] } end, add_zero := begin refine with_top.rec_top_coe _ _, { simp }, { intro, rw [←with_top.coe_zero, ←with_top.coe_add, add_zero] } end, ..with_top.has_zero, ..with_top.has_add } instance [add_monoid α] : add_monoid (with_top α) := { ..with_top.add_zero_class, ..with_top.has_zero, ..with_top.add_semigroup } instance [add_comm_monoid α] : add_comm_monoid (with_top α) := { ..with_top.add_monoid, ..with_top.add_comm_semigroup } instance [ordered_add_comm_monoid α] : ordered_add_comm_monoid (with_top α) := { add_le_add_left := begin rintros a b h (_|c), { simp [none_eq_top] }, rcases b with (_|b), { simp [none_eq_top] }, rcases le_coe_iff.1 h with ⟨a, rfl, h⟩, simp only [some_eq_coe, ← coe_add, coe_le_coe] at h ⊢, exact add_le_add_left h c end, ..with_top.partial_order, ..with_top.add_comm_monoid } instance [linear_ordered_add_comm_monoid α] : linear_ordered_add_comm_monoid_with_top (with_top α) := { top_add' := λ x, with_top.top_add, ..with_top.order_top, ..with_top.linear_order, ..with_top.ordered_add_comm_monoid, ..option.nontrivial } /-- Coercion from `α` to `with_top α` as an `add_monoid_hom`. -/ def coe_add_hom [add_monoid α] : α →+ with_top α := ⟨coe, rfl, λ _ _, rfl⟩ @[simp] lemma coe_coe_add_hom [add_monoid α] : ⇑(coe_add_hom : α →+ with_top α) = coe := rfl @[simp] lemma zero_lt_top [ordered_add_comm_monoid α] : (0 : with_top α) < ⊤ := coe_lt_top 0 @[simp, norm_cast] lemma zero_lt_coe [ordered_add_comm_monoid α] (a : α) : (0 : with_top α) < a ↔ 0 < a := coe_lt_coe end with_top namespace with_bot @[to_additive] instance [has_one α] : has_one (with_bot α) := with_top.has_one instance [has_add α] : has_add (with_bot α) := with_top.has_add instance [add_semigroup α] : add_semigroup (with_bot α) := with_top.add_semigroup instance [add_comm_semigroup α] : add_comm_semigroup (with_bot α) := with_top.add_comm_semigroup instance [add_zero_class α] : add_zero_class (with_bot α) := with_top.add_zero_class instance [add_monoid α] : add_monoid (with_bot α) := with_top.add_monoid instance [add_comm_monoid α] : add_comm_monoid (with_bot α) := with_top.add_comm_monoid instance [ordered_add_comm_monoid α] : ordered_add_comm_monoid (with_bot α) := begin suffices, refine { add_le_add_left := this, ..with_bot.partial_order, ..with_bot.add_comm_monoid, ..}, { intros a b h c ca h₂, cases c with c, {cases h₂}, cases a with a; cases h₂, cases b with b, {cases le_antisymm h bot_le}, simp at h, exact ⟨_, rfl, add_le_add_left h _⟩, } end instance [linear_ordered_add_comm_monoid α] : linear_ordered_add_comm_monoid (with_bot α) := { ..with_bot.linear_order, ..with_bot.ordered_add_comm_monoid } -- `by norm_cast` proves this lemma, so I did not tag it with `norm_cast` @[to_additive] lemma coe_one [has_one α] : ((1 : α) : with_bot α) = 1 := rfl -- `by norm_cast` proves this lemma, so I did not tag it with `norm_cast` @[to_additive] lemma coe_eq_one [has_one α] {a : α} : (a : with_bot α) = 1 ↔ a = 1 := with_top.coe_eq_one @[to_additive] protected lemma map_one {β} [has_one α] (f : α → β) : (1 : with_bot α).map f = (f 1 : with_bot β) := rfl -- `by norm_cast` proves this lemma, so I did not tag it with `norm_cast` lemma coe_add [has_add α] (a b : α) : ((a + b : α) : with_bot α) = a + b := by norm_cast -- `by norm_cast` proves this lemma, so I did not tag it with `norm_cast` lemma coe_bit0 [has_add α] {a : α} : ((bit0 a : α) : with_bot α) = bit0 a := by norm_cast -- `by norm_cast` proves this lemma, so I did not tag it with `norm_cast` lemma coe_bit1 [has_add α] [has_one α] {a : α} : ((bit1 a : α) : with_bot α) = bit1 a := by norm_cast @[simp] lemma bot_add [has_add α] (a : with_bot α) : ⊥ + a = ⊥ := rfl @[simp] lemma add_bot [has_add α] (a : with_bot α) : a + ⊥ = ⊥ := by cases a; refl @[simp] lemma add_eq_bot [has_add α] {m n : with_bot α} : m + n = ⊥ ↔ m = ⊥ ∨ n = ⊥ := with_top.add_eq_top end with_bot namespace with_zero local attribute [semireducible] with_zero variables [has_add α] /-- Making an additive monoid multiplicative then adding a zero is the same as adding a bottom element then making it multiplicative. -/ def to_mul_bot : with_zero (multiplicative α) ≃* multiplicative (with_bot α) := by exact mul_equiv.refl _ @[simp] lemma to_mul_bot_zero : to_mul_bot (0 : with_zero (multiplicative α)) = multiplicative.of_add ⊥ := rfl @[simp] lemma to_mul_bot_coe (x : multiplicative α) : to_mul_bot ↑x = multiplicative.of_add (x.to_add : with_bot α) := rfl @[simp] lemma to_mul_bot_symm_bot : to_mul_bot.symm (multiplicative.of_add (⊥ : with_bot α)) = 0 := rfl @[simp] lemma to_mul_bot_coe_of_add (x : α) : to_mul_bot.symm (multiplicative.of_add (x : with_bot α)) = multiplicative.of_add x := rfl end with_zero /-- A canonically ordered additive monoid is an ordered commutative additive monoid in which the ordering coincides with the subtractibility relation, which is to say, `a ≤ b` iff there exists `c` with `b = a + c`. This is satisfied by the natural numbers, for example, but not the integers or other nontrivial `ordered_add_comm_group`s. -/ @[protect_proj, ancestor ordered_add_comm_monoid has_bot] class canonically_ordered_add_monoid (α : Type*) extends ordered_add_comm_monoid α, has_bot α := (bot_le : ∀ x : α, ⊥ ≤ x) (le_iff_exists_add : ∀ a b : α, a ≤ b ↔ ∃ c, b = a + c) @[priority 100] -- see Note [lower instance priority] instance canonically_ordered_add_monoid.to_order_bot (α : Type u) [h : canonically_ordered_add_monoid α] : order_bot α := { ..h } /-- A canonically ordered monoid is an ordered commutative monoid in which the ordering coincides with the divisibility relation, which is to say, `a ≤ b` iff there exists `c` with `b = a * c`. Examples seem rare; it seems more likely that the `order_dual` of a naturally-occurring lattice satisfies this than the lattice itself (for example, dual of the lattice of ideals of a PID or Dedekind domain satisfy this; collections of all things ≤ 1 seem to be more natural that collections of all things ≥ 1). -/ @[protect_proj, ancestor ordered_comm_monoid has_bot, to_additive] class canonically_ordered_monoid (α : Type*) extends ordered_comm_monoid α, has_bot α := (bot_le : ∀ x : α, ⊥ ≤ x) (le_iff_exists_mul : ∀ a b : α, a ≤ b ↔ ∃ c, b = a * c) @[priority 100, to_additive] -- see Note [lower instance priority] instance canonically_ordered_monoid.to_order_bot (α : Type u) [h : canonically_ordered_monoid α] : order_bot α := { ..h } section canonically_ordered_monoid variables [canonically_ordered_monoid α] {a b c d : α} @[to_additive] lemma le_iff_exists_mul : a ≤ b ↔ ∃c, b = a * c := canonically_ordered_monoid.le_iff_exists_mul a b @[to_additive] lemma self_le_mul_right (a b : α) : a ≤ a * b := le_iff_exists_mul.mpr ⟨b, rfl⟩ @[to_additive] lemma self_le_mul_left (a b : α) : a ≤ b * a := by { rw [mul_comm], exact self_le_mul_right a b } @[simp, to_additive zero_le] lemma one_le (a : α) : 1 ≤ a := le_iff_exists_mul.mpr ⟨a, (one_mul _).symm⟩ @[simp, to_additive] lemma bot_eq_one : (⊥ : α) = 1 := le_antisymm bot_le (one_le ⊥) @[simp, to_additive] lemma mul_eq_one_iff : a * b = 1 ↔ a = 1 ∧ b = 1 := mul_eq_one_iff' (one_le _) (one_le _) @[simp, to_additive] lemma le_one_iff_eq_one : a ≤ 1 ↔ a = 1 := iff.intro (assume h, le_antisymm h (one_le a)) (assume h, h ▸ le_refl a) @[to_additive] lemma one_lt_iff_ne_one : 1 < a ↔ a ≠ 1 := iff.intro ne_of_gt $ assume hne, lt_of_le_of_ne (one_le _) hne.symm @[to_additive] lemma eq_one_or_one_lt : a = 1 ∨ 1 < a := (one_le a).eq_or_lt.imp_left eq.symm @[to_additive] lemma exists_pos_mul_of_lt (h : a < b) : ∃ c > 1, a * c = b := begin obtain ⟨c, hc⟩ := le_iff_exists_mul.1 h.le, refine ⟨c, one_lt_iff_ne_one.2 _, hc.symm⟩, rintro rfl, simpa [hc, lt_irrefl] using h end @[to_additive] lemma le_mul_left (h : a ≤ c) : a ≤ b * c := calc a = 1 * a : by simp ... ≤ b * c : mul_le_mul' (one_le _) h @[to_additive] lemma le_mul_self : a ≤ b * a := le_mul_left (le_refl a) @[to_additive] lemma le_mul_right (h : a ≤ b) : a ≤ b * c := calc a = a * 1 : by simp ... ≤ b * c : mul_le_mul' h (one_le _) @[to_additive] lemma le_self_mul : a ≤ a * c := le_mul_right (le_refl a) @[to_additive] lemma lt_iff_exists_mul [covariant_class α α (*) (<)] : a < b ↔ ∃ c > 1, b = a * c := begin simp_rw [lt_iff_le_and_ne, and_comm, le_iff_exists_mul, ← exists_and_distrib_left, exists_prop], apply exists_congr, intro c, rw [and.congr_left_iff, gt_iff_lt], rintro rfl, split, { rw [one_lt_iff_ne_one], apply mt, rintro rfl, rw [mul_one] }, { rw [← (self_le_mul_right a c).lt_iff_ne], apply lt_mul_of_one_lt_right' } end -- This instance looks absurd: a monoid already has a zero /-- Adding a new zero to a canonically ordered additive monoid produces another one. -/ instance with_zero.canonically_ordered_add_monoid {α : Type u} [canonically_ordered_add_monoid α] : canonically_ordered_add_monoid (with_zero α) := { le_iff_exists_add := λ a b, begin apply with_zero.cases_on a, { exact iff_of_true bot_le ⟨b, (zero_add b).symm⟩ }, apply with_zero.cases_on b, { intro b', refine iff_of_false (mt (le_antisymm bot_le) (by simp)) (not_exists.mpr (λ c, _)), apply with_zero.cases_on c; simp [←with_zero.coe_add] }, { simp only [le_iff_exists_add, with_zero.coe_le_coe], intros, split; rintro ⟨c, h⟩, { exact ⟨c, congr_arg coe h⟩ }, { induction c using with_zero.cases_on, { refine ⟨0, _⟩, simpa using h }, { refine ⟨c, _⟩, simpa [←with_zero.coe_add] using h } } } end, .. with_zero.order_bot, .. with_zero.ordered_add_comm_monoid zero_le } instance with_top.canonically_ordered_add_monoid {α : Type u} [canonically_ordered_add_monoid α] : canonically_ordered_add_monoid (with_top α) := { le_iff_exists_add := assume a b, match a, b with | ⊤, ⊤ := by simp | (a : α), ⊤ := by { simp only [true_iff, le_top], refine ⟨⊤, _⟩, refl } | (a : α), (b : α) := begin rw [with_top.coe_le_coe, le_iff_exists_add], split, { rintro ⟨c, rfl⟩, refine ⟨c, _⟩, norm_cast }, { intro h, exact match b, h with _, ⟨some c, rfl⟩ := ⟨_, rfl⟩ end } end | ⊤, (b : α) := by simp end, .. with_top.order_bot, .. with_top.ordered_add_comm_monoid } @[priority 100, to_additive] instance canonically_ordered_monoid.has_exists_mul_of_le (α : Type u) [canonically_ordered_monoid α] : has_exists_mul_of_le α := { exists_mul_of_le := λ a b hab, le_iff_exists_mul.mp hab } end canonically_ordered_monoid lemma pos_of_gt {M : Type*} [canonically_ordered_add_monoid M] {n m : M} (h : n < m) : 0 < m := lt_of_le_of_lt (zero_le _) h /-- A canonically linear-ordered additive monoid is a canonically ordered additive monoid whose ordering is a linear order. -/ @[protect_proj, ancestor canonically_ordered_add_monoid linear_order] class canonically_linear_ordered_add_monoid (α : Type*) extends canonically_ordered_add_monoid α, linear_order α /-- A canonically linear-ordered monoid is a canonically ordered monoid whose ordering is a linear order. -/ @[protect_proj, ancestor canonically_ordered_monoid linear_order, to_additive] class canonically_linear_ordered_monoid (α : Type*) extends canonically_ordered_monoid α, linear_order α section canonically_linear_ordered_monoid variables [canonically_linear_ordered_monoid α] @[priority 100, to_additive] -- see Note [lower instance priority] instance canonically_linear_ordered_monoid.semilattice_sup : semilattice_sup α := { ..linear_order.to_lattice } instance with_zero.canonically_linear_ordered_add_monoid (α : Type*) [canonically_linear_ordered_add_monoid α] : canonically_linear_ordered_add_monoid (with_zero α) := { .. with_zero.canonically_ordered_add_monoid, .. with_zero.linear_order } instance with_top.canonically_linear_ordered_add_monoid (α : Type*) [canonically_linear_ordered_add_monoid α] : canonically_linear_ordered_add_monoid (with_top α) := { .. (infer_instance : canonically_ordered_add_monoid (with_top α)), .. (infer_instance : linear_order (with_top α)) } @[to_additive] lemma min_mul_distrib (a b c : α) : min a (b * c) = min a (min a b * min a c) := begin cases le_total a b with hb hb, { simp [hb, le_mul_right] }, { cases le_total a c with hc hc, { simp [hc, le_mul_left] }, { simp [hb, hc] } } end @[to_additive] lemma min_mul_distrib' (a b c : α) : min (a * b) c = min (min a c * min b c) c := by simpa [min_comm _ c] using min_mul_distrib c a b @[simp, to_additive] lemma one_min (a : α) : min 1 a = 1 := min_eq_left (one_le a) @[simp, to_additive] lemma min_one (a : α) : min a 1 = 1 := min_eq_right (one_le a) end canonically_linear_ordered_monoid /-- An ordered cancellative additive commutative monoid is an additive commutative monoid with a partial order, in which addition is cancellative and monotone. -/ @[protect_proj, ancestor add_cancel_comm_monoid partial_order] class ordered_cancel_add_comm_monoid (α : Type u) extends add_cancel_comm_monoid α, partial_order α := (add_le_add_left : ∀ a b : α, a ≤ b → ∀ c : α, c + a ≤ c + b) (le_of_add_le_add_left : ∀ a b c : α, a + b ≤ a + c → b ≤ c) /-- An ordered cancellative commutative monoid is a commutative monoid with a partial order, in which multiplication is cancellative and monotone. -/ @[protect_proj, ancestor cancel_comm_monoid partial_order, to_additive] class ordered_cancel_comm_monoid (α : Type u) extends cancel_comm_monoid α, partial_order α := (mul_le_mul_left : ∀ a b : α, a ≤ b → ∀ c : α, c * a ≤ c * b) (le_of_mul_le_mul_left : ∀ a b c : α, a * b ≤ a * c → b ≤ c) section ordered_cancel_comm_monoid variables [ordered_cancel_comm_monoid α] {a b c d : α} @[to_additive] lemma ordered_cancel_comm_monoid.lt_of_mul_lt_mul_left : ∀ a b c : α, a * b < a * c → b < c := λ a b c h, lt_of_le_not_le (ordered_cancel_comm_monoid.le_of_mul_le_mul_left a b c h.le) $ mt (λ h, ordered_cancel_comm_monoid.mul_le_mul_left _ _ h _) (not_le_of_gt h) @[to_additive] instance ordered_cancel_comm_monoid.to_contravariant_class_left (M : Type*) [ordered_cancel_comm_monoid M] : contravariant_class M M (*) (<) := { elim := λ a b c, ordered_cancel_comm_monoid.lt_of_mul_lt_mul_left _ _ _ } /- This instance can be proven with `by apply_instance`. However, by analogy with the instance `ordered_cancel_comm_monoid.to_covariant_class_right` above, I imagine that without this instance, some Type would not have a `contravariant_class M M (function.swap (*)) (<)` instance. -/ @[to_additive] instance ordered_cancel_comm_monoid.to_contravariant_class_right (M : Type*) [ordered_cancel_comm_monoid M] : contravariant_class M M (swap (*)) (<) := contravariant_swap_mul_lt_of_contravariant_mul_lt M @[priority 100, to_additive] -- see Note [lower instance priority] instance ordered_cancel_comm_monoid.to_ordered_comm_monoid : ordered_comm_monoid α := { ..‹ordered_cancel_comm_monoid α› } /-- Pullback an `ordered_cancel_comm_monoid` under an injective map. See note [reducible non-instances]. -/ @[reducible, to_additive function.injective.ordered_cancel_add_comm_monoid "Pullback an `ordered_cancel_add_comm_monoid` under an injective map."] def function.injective.ordered_cancel_comm_monoid {β : Type*} [has_one β] [has_mul β] [has_pow β ℕ] (f : β → α) (hf : function.injective f) (one : f 1 = 1) (mul : ∀ x y, f (x * y) = f x * f y) (npow : ∀ x (n : ℕ), f (x ^ n) = f x ^ n) : ordered_cancel_comm_monoid β := { le_of_mul_le_mul_left := λ a b c (bc : f (a * b) ≤ f (a * c)), (mul_le_mul_iff_left (f a)).mp (by rwa [← mul, ← mul]), ..hf.left_cancel_semigroup f mul, ..hf.ordered_comm_monoid f one mul npow } end ordered_cancel_comm_monoid /-! Some lemmas about types that have an ordering and a binary operation, with no rules relating them. -/ @[to_additive] lemma fn_min_mul_fn_max {β} [linear_order α] [comm_semigroup β] (f : α → β) (n m : α) : f (min n m) * f (max n m) = f n * f m := by { cases le_total n m with h h; simp [h, mul_comm] } @[to_additive] lemma min_mul_max [linear_order α] [comm_semigroup α] (n m : α) : min n m * max n m = n * m := fn_min_mul_fn_max id n m /-- A linearly ordered cancellative additive commutative monoid is an additive commutative monoid with a decidable linear order in which addition is cancellative and monotone. -/ @[protect_proj, ancestor ordered_cancel_add_comm_monoid linear_ordered_add_comm_monoid] class linear_ordered_cancel_add_comm_monoid (α : Type u) extends ordered_cancel_add_comm_monoid α, linear_ordered_add_comm_monoid α /-- A linearly ordered cancellative commutative monoid is a commutative monoid with a linear order in which multiplication is cancellative and monotone. -/ @[protect_proj, ancestor ordered_cancel_comm_monoid linear_ordered_comm_monoid, to_additive] class linear_ordered_cancel_comm_monoid (α : Type u) extends ordered_cancel_comm_monoid α, linear_ordered_comm_monoid α section covariant_class_mul_le variables [linear_order α] section has_mul variable [has_mul α] section left variable [covariant_class α α (*) (≤)] @[to_additive] lemma min_mul_mul_left (a b c : α) : min (a * b) (a * c) = a * min b c := (monotone_id.const_mul' a).map_min.symm @[to_additive] lemma max_mul_mul_left (a b c : α) : max (a * b) (a * c) = a * max b c := (monotone_id.const_mul' a).map_max.symm @[to_additive] lemma lt_or_lt_of_mul_lt_mul [covariant_class α α (function.swap (*)) (≤)] {a b m n : α} (h : m * n < a * b) : m < a ∨ n < b := by { contrapose! h, exact mul_le_mul' h.1 h.2 } @[to_additive] lemma mul_lt_mul_iff_of_le_of_le [covariant_class α α (function.swap (*)) (<)] [covariant_class α α (*) (<)] [covariant_class α α (function.swap (*)) (≤)] {a b c d : α} (ac : a ≤ c) (bd : b ≤ d) : a * b < c * d ↔ (a < c) ∨ (b < d) := begin refine ⟨lt_or_lt_of_mul_lt_mul, λ h, _⟩, cases h with ha hb, { exact mul_lt_mul_of_lt_of_le ha bd }, { exact mul_lt_mul_of_le_of_lt ac hb } end end left section right variable [covariant_class α α (function.swap (*)) (≤)] @[to_additive] lemma min_mul_mul_right (a b c : α) : min (a * c) (b * c) = min a b * c := (monotone_id.mul_const' c).map_min.symm @[to_additive] lemma max_mul_mul_right (a b c : α) : max (a * c) (b * c) = max a b * c := (monotone_id.mul_const' c).map_max.symm end right end has_mul variable [mul_one_class α] @[to_additive] lemma min_le_mul_of_one_le_right [covariant_class α α (*) (≤)] {a b : α} (hb : 1 ≤ b) : min a b ≤ a * b := min_le_iff.2 $ or.inl $ le_mul_of_one_le_right' hb @[to_additive] lemma min_le_mul_of_one_le_left [covariant_class α α (function.swap (*)) (≤)] {a b : α} (ha : 1 ≤ a) : min a b ≤ a * b := min_le_iff.2 $ or.inr $ le_mul_of_one_le_left' ha @[to_additive] lemma max_le_mul_of_one_le [covariant_class α α (*) (≤)] [covariant_class α α (function.swap (*)) (≤)] {a b : α} (ha : 1 ≤ a) (hb : 1 ≤ b) : max a b ≤ a * b := max_le_iff.2 ⟨le_mul_of_one_le_right' hb, le_mul_of_one_le_left' ha⟩ end covariant_class_mul_le section linear_ordered_cancel_comm_monoid variables [linear_ordered_cancel_comm_monoid α] /-- Pullback a `linear_ordered_cancel_comm_monoid` under an injective map. See note [reducible non-instances]. -/ @[reducible, to_additive function.injective.linear_ordered_cancel_add_comm_monoid "Pullback a `linear_ordered_cancel_add_comm_monoid` under an injective map."] def function.injective.linear_ordered_cancel_comm_monoid {β : Type*} [has_one β] [has_mul β] [has_pow β ℕ] (f : β → α) (hf : function.injective f) (one : f 1 = 1) (mul : ∀ x y, f (x * y) = f x * f y) (npow : ∀ x (n : ℕ), f (x ^ n) = f x ^ n) : linear_ordered_cancel_comm_monoid β := { ..hf.linear_ordered_comm_monoid f one mul npow, ..hf.ordered_cancel_comm_monoid f one mul npow } end linear_ordered_cancel_comm_monoid namespace order_dual @[to_additive] instance [h : has_mul α] : has_mul (order_dual α) := h @[to_additive] instance [h : has_one α] : has_one (order_dual α) := h @[to_additive] instance [h : semigroup α] : semigroup (order_dual α) := h @[to_additive] instance [h : comm_semigroup α] : comm_semigroup (order_dual α) := h @[to_additive] instance [h : mul_one_class α] : mul_one_class (order_dual α) := h @[to_additive] instance [h : monoid α] : monoid (order_dual α) := h @[to_additive] instance [h : comm_monoid α] : comm_monoid (order_dual α) := h @[to_additive] instance [h : left_cancel_monoid α] : left_cancel_monoid (order_dual α) := h @[to_additive] instance [h : right_cancel_monoid α] : right_cancel_monoid (order_dual α) := h @[to_additive] instance [h : cancel_monoid α] : cancel_monoid (order_dual α) := h @[to_additive] instance [h : cancel_comm_monoid α] : cancel_comm_monoid (order_dual α) := h instance [h : mul_zero_class α] : mul_zero_class (order_dual α) := h instance [h : mul_zero_one_class α] : mul_zero_one_class (order_dual α) := h instance [h : monoid_with_zero α] : monoid_with_zero (order_dual α) := h instance [h : comm_monoid_with_zero α] : comm_monoid_with_zero (order_dual α) := h instance [h : cancel_comm_monoid_with_zero α] : cancel_comm_monoid_with_zero (order_dual α) := h @[to_additive] instance contravariant_class_mul_le [has_le α] [has_mul α] [c : contravariant_class α α (*) (≤)] : contravariant_class (order_dual α) (order_dual α) (*) (≤) := ⟨c.1.flip⟩ @[to_additive] instance covariant_class_mul_le [has_le α] [has_mul α] [c : covariant_class α α (*) (≤)] : covariant_class (order_dual α) (order_dual α) (*) (≤) := ⟨c.1.flip⟩ @[to_additive] instance contravariant_class_swap_mul_le [has_le α] [has_mul α] [c : contravariant_class α α (swap (*)) (≤)] : contravariant_class (order_dual α) (order_dual α) (swap (*)) (≤) := ⟨c.1.flip⟩ @[to_additive] instance covariant_class_swap_mul_le [has_le α] [has_mul α] [c : covariant_class α α (swap (*)) (≤)] : covariant_class (order_dual α) (order_dual α) (swap (*)) (≤) := ⟨c.1.flip⟩ @[to_additive] instance contravariant_class_mul_lt [has_lt α] [has_mul α] [c : contravariant_class α α (*) (<)] : contravariant_class (order_dual α) (order_dual α) (*) (<) := ⟨c.1.flip⟩ @[to_additive] instance covariant_class_mul_lt [has_lt α] [has_mul α] [c : covariant_class α α (*) (<)] : covariant_class (order_dual α) (order_dual α) (*) (<) := ⟨c.1.flip⟩ @[to_additive] instance contravariant_class_swap_mul_lt [has_lt α] [has_mul α] [c : contravariant_class α α (swap (*)) (<)] : contravariant_class (order_dual α) (order_dual α) (swap (*)) (<) := ⟨c.1.flip⟩ @[to_additive] instance covariant_class_swap_mul_lt [has_lt α] [has_mul α] [c : covariant_class α α (swap (*)) (<)] : covariant_class (order_dual α) (order_dual α) (swap (*)) (<) := ⟨c.1.flip⟩ @[to_additive] instance [ordered_comm_monoid α] : ordered_comm_monoid (order_dual α) := { mul_le_mul_left := λ a b h c, mul_le_mul_left' h c, .. order_dual.partial_order α, .. order_dual.comm_monoid } @[to_additive ordered_cancel_add_comm_monoid.to_contravariant_class] instance ordered_cancel_comm_monoid.to_contravariant_class [ordered_cancel_comm_monoid α] : contravariant_class (order_dual α) (order_dual α) has_mul.mul has_le.le := { elim := λ a b c bc, (ordered_cancel_comm_monoid.le_of_mul_le_mul_left a c b (dual_le.mp bc)) } @[to_additive] instance [ordered_cancel_comm_monoid α] : ordered_cancel_comm_monoid (order_dual α) := { le_of_mul_le_mul_left := λ a b c : α, le_of_mul_le_mul_left', .. order_dual.ordered_comm_monoid, .. order_dual.cancel_comm_monoid } @[to_additive] instance [linear_ordered_cancel_comm_monoid α] : linear_ordered_cancel_comm_monoid (order_dual α) := { .. order_dual.linear_order α, .. order_dual.ordered_cancel_comm_monoid } @[to_additive] instance [linear_ordered_comm_monoid α] : linear_ordered_comm_monoid (order_dual α) := { .. order_dual.linear_order α, .. order_dual.ordered_comm_monoid } end order_dual section linear_ordered_cancel_add_comm_monoid variables [linear_ordered_cancel_add_comm_monoid α] end linear_ordered_cancel_add_comm_monoid section ordered_cancel_add_comm_monoid variable [ordered_cancel_add_comm_monoid α] namespace with_top lemma add_lt_add_iff_left {a b c : with_top α} (ha : a ≠ ⊤) : a + b < a + c ↔ b < c := begin lift a to α using ha, cases b; cases c, { simp [none_eq_top] }, { simp [some_eq_coe, none_eq_top, coe_lt_top] }, { simp [some_eq_coe, none_eq_top, ← coe_add, coe_lt_top] }, { simp [some_eq_coe, ← coe_add, coe_lt_coe] } end lemma add_lt_add_iff_right {a b c : with_top α} (ha : a ≠ ⊤) : (c + a < b + a ↔ c < b) := by simp only [← add_comm a, add_lt_add_iff_left ha] instance contravariant_class_add_lt : contravariant_class (with_top α) (with_top α) (+) (<) := begin refine ⟨λ a b c h, _⟩, cases a, { rw [none_eq_top, top_add, top_add] at h, exact (lt_irrefl ⊤ h).elim }, { exact (add_lt_add_iff_left coe_ne_top).1 h } end end with_top namespace with_bot lemma add_lt_add_iff_left {a b c : with_bot α} (ha : a ≠ ⊥) : a + b < a + c ↔ b < c := @with_top.add_lt_add_iff_left (order_dual α) _ a c b ha lemma add_lt_add_iff_right {a b c : with_bot α} (ha : a ≠ ⊥) : b + a < c + a ↔ b < c := @with_top.add_lt_add_iff_right (order_dual α) _ _ _ _ ha instance contravariant_class_add_lt : contravariant_class (with_bot α) (with_bot α) (+) (<) := @order_dual.contravariant_class_add_lt (with_top $ order_dual α) _ _ _ end with_bot end ordered_cancel_add_comm_monoid namespace prod variables {M N : Type*} @[to_additive] instance [ordered_cancel_comm_monoid M] [ordered_cancel_comm_monoid N] : ordered_cancel_comm_monoid (M × N) := { mul_le_mul_left := λ a b h c, ⟨mul_le_mul_left' h.1 _, mul_le_mul_left' h.2 _⟩, le_of_mul_le_mul_left := λ a b c h, ⟨le_of_mul_le_mul_left' h.1, le_of_mul_le_mul_left' h.2⟩, .. prod.cancel_comm_monoid, .. prod.partial_order M N } end prod section type_tags instance : Π [preorder α], preorder (multiplicative α) := id instance : Π [preorder α], preorder (additive α) := id instance : Π [partial_order α], partial_order (multiplicative α) := id instance : Π [partial_order α], partial_order (additive α) := id instance : Π [linear_order α], linear_order (multiplicative α) := id instance : Π [linear_order α], linear_order (additive α) := id instance [ordered_add_comm_monoid α] : ordered_comm_monoid (multiplicative α) := { mul_le_mul_left := @ordered_add_comm_monoid.add_le_add_left α _, ..multiplicative.partial_order, ..multiplicative.comm_monoid } instance [ordered_comm_monoid α] : ordered_add_comm_monoid (additive α) := { add_le_add_left := @ordered_comm_monoid.mul_le_mul_left α _, ..additive.partial_order, ..additive.add_comm_monoid } instance [ordered_cancel_add_comm_monoid α] : ordered_cancel_comm_monoid (multiplicative α) := { le_of_mul_le_mul_left := @ordered_cancel_add_comm_monoid.le_of_add_le_add_left α _, ..multiplicative.left_cancel_semigroup, ..multiplicative.ordered_comm_monoid } instance [ordered_cancel_comm_monoid α] : ordered_cancel_add_comm_monoid (additive α) := { le_of_add_le_add_left := @ordered_cancel_comm_monoid.le_of_mul_le_mul_left α _, ..additive.add_left_cancel_semigroup, ..additive.ordered_add_comm_monoid } instance [linear_ordered_add_comm_monoid α] : linear_ordered_comm_monoid (multiplicative α) := { ..multiplicative.linear_order, ..multiplicative.ordered_comm_monoid } instance [linear_ordered_comm_monoid α] : linear_ordered_add_comm_monoid (additive α) := { ..additive.linear_order, ..additive.ordered_add_comm_monoid } lemma with_zero.to_mul_bot_strict_mono [has_add α] [preorder α] : strict_mono (@with_zero.to_mul_bot α _) := λ x y, id @[simp] lemma with_zero.to_mul_bot_le [has_add α] [preorder α] (a b : with_zero (multiplicative α)) : with_zero.to_mul_bot a ≤ with_zero.to_mul_bot b ↔ a ≤ b := iff.rfl @[simp] lemma with_zero.to_mul_bot_lt [has_add α] [preorder α] (a b : with_zero (multiplicative α)) : with_zero.to_mul_bot a < with_zero.to_mul_bot b ↔ a < b := iff.rfl namespace additive variables [preorder α] @[simp] lemma of_mul_le {a b : α} : of_mul a ≤ of_mul b ↔ a ≤ b := iff.rfl @[simp] lemma of_mul_lt {a b : α} : of_mul a < of_mul b ↔ a < b := iff.rfl @[simp] lemma to_mul_le {a b : additive α} : to_mul a ≤ to_mul b ↔ a ≤ b := iff.rfl @[simp] lemma to_mul_lt {a b : additive α} : to_mul a < to_mul b ↔ a < b := iff.rfl end additive namespace multiplicative variables [preorder α] @[simp] lemma of_add_le {a b : α} : of_add a ≤ of_add b ↔ a ≤ b := iff.rfl @[simp] lemma of_add_lt {a b : α} : of_add a < of_add b ↔ a < b := iff.rfl @[simp] lemma to_add_le {a b : multiplicative α} : to_add a ≤ to_add b ↔ a ≤ b := iff.rfl @[simp] lemma to_add_lt {a b : multiplicative α} : to_add a < to_add b ↔ a < b := iff.rfl end multiplicative end type_tags /-- The order embedding sending `b` to `a * b`, for some fixed `a`. See also `order_iso.mul_left` when working in an ordered group. -/ @[to_additive "The order embedding sending `b` to `a + b`, for some fixed `a`. See also `order_iso.add_left` when working in an additive ordered group.", simps] def order_embedding.mul_left {α : Type*} [has_mul α] [linear_order α] [covariant_class α α (*) (<)] (m : α) : α ↪o α := order_embedding.of_strict_mono (λ n, m * n) (λ a b w, mul_lt_mul_left' w m) /-- The order embedding sending `b` to `b * a`, for some fixed `a`. See also `order_iso.mul_right` when working in an ordered group. -/ @[to_additive "The order embedding sending `b` to `b + a`, for some fixed `a`. See also `order_iso.add_right` when working in an additive ordered group.", simps] def order_embedding.mul_right {α : Type*} [has_mul α] [linear_order α] [covariant_class α α (swap (*)) (<)] (m : α) : α ↪o α := order_embedding.of_strict_mono (λ n, n * m) (λ a b w, mul_lt_mul_right' w m)
-- | The parse part of scheme. https://en.wikibooks.org/wiki/Write_Yourself_a_Scheme_in_48_Hours/ module Parser ( readExpr , readExprList ) where import Control.Monad.Error import Data.Char (digitToInt) import Data.Complex import Data.Ratio ((%)) import ErrorCheckingAndExceptions import LispVal import Numeric (readDec, readFloat, readHex, readInt, readOct) import Text.ParserCombinators.Parsec hiding (spaces) symbol :: Parser Char symbol = oneOf "!$%&|*+-/:<=>?@^_~" <?> "a symbol" -- readExpr :: String -> Either ParseError LispVal -- readExpr = parse parseExpr "lisp" -- Whitespace spaces :: Parser () spaces = skipMany1 space parseString :: Parser LispVal parseString = do char '"' str <- many (parseHelper <|> noneOf "\\\"") char '"' return $ String str <?> "a string for parseString" where parseHelper :: Parser Char parseHelper = do char '\\' x <- oneOf "\\\"nrt" return $ case x of '\\' -> x '"' -> x 'n' -> '\n' 'r' -> '\r' 't' -> '\t' parseAtom :: Parser LispVal parseAtom = do first <- letter <|> symbol rest <- many $ letter <|> symbol <|> digit return $ Atom (first : rest) <?> "a atom for parseAtom" parseBool :: Parser LispVal parseBool = do x <- try (string "#t") <|> string "#f" return $ if x == "#t" then Bool True else Bool False parseNumber :: Parser LispVal parseNumber = parseDigit <|> try parseOct <|> try parseDec <|> try parseHex <|> parseBin where parseOct = do char '#' >> oneOf "oO" str <- many1 octDigit let [(n, _)] = readOct str return $ Number n parseDec = do char '#' >> oneOf "dD" str <- many1 digit let [(n, _)] = readDec str return $ Number n parseHex = do char '#' >> oneOf "xX" str <- many1 hexDigit let [(n, _)] = readHex str return $ Number n parseBin = do char '#' >> oneOf "bB" str <- many1 $ oneOf "01" let [(n, _)] = readInt 2 (`elem` "01") digitToInt str return $ Number n parseDigit = do str <- many1 digit return $ (Number . read) str parseChar :: Parser LispVal parseChar = do string "#\\" x <- many $ letter <|> digit return $ case length x of 0 -> Character '\n' 1 -> Character $ head x _ -> case x of "newline" -> Character '\n' "tab" -> Character '\t' "space" -> Character ' ' parseFloat :: Parser LispVal parseFloat = do x <- many1 digit char '.' y <- many1 digit return $ let [(n, _)] = readFloat (x ++ '.' : y) in Float n parseRatio :: Parser LispVal parseRatio = do x <- many1 digit char '/' y <- many1 digit return $ Ratio (read x % read y) parseComplex :: Parser LispVal parseComplex = do x <- try parseFloat <|> parseNumber char '+' y <- try parseFloat <|> parseNumber char 'i' return $ Complex (toDouble x :+ toDouble y) where toDouble :: LispVal -> Double toDouble (Float f) = f toDouble (Number n) = fromIntegral n -- Recursive Parsers: Adding lists, dotted lists, and quoted datums parseList :: Parser LispVal parseList = do char '(' x <- sepBy parseExpr spaces char ')' return $ List x parseDottedList :: Parser LispVal parseDottedList = do char '(' x <- endBy parseExpr spaces y <- char '.' >> spaces >> parseExpr char ')' return $ DottedList x y parseQuoted :: Parser LispVal parseQuoted = do char '\'' x <- parseExpr return $ List [Atom "quote", x] parseBackquote :: Parser LispVal parseBackquote = do char '`' x <- parseExpr return $ List [Atom "quasiquote", x] parseUnquote :: Parser LispVal parseUnquote = do char ',' y <- parseExpr return $ List [Atom "unquote", y] parseUnquoteSplicing :: Parser LispVal parseUnquoteSplicing = do char ',' >> char '@' y <- parseExpr return $ List [Atom "unquote-splicing", y] parseExpr :: Parser LispVal parseExpr = parseAtom <|> try parseBool <|> try parseRatio <|> try parseComplex <|> try parseFloat <|> try parseNumber <|> parseChar <|> parseString <|> try parseList <|> parseDottedList <|> parseQuoted <|> parseBackquote <|> try parseUnquoteSplicing <|> parseUnquote readOrThrow :: Parser a -> String -> ThrowsError a readOrThrow parser input = case parse parser "lisp" input of Left err -> throwError $ Parser err Right val -> return val readExpr :: String -> ThrowsError LispVal readExpr = readOrThrow parseExpr readExprList :: String -> ThrowsError [LispVal] readExprList = readOrThrow (endBy parseExpr spaces)
(* Copyright 2018 Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except in compliance with the License. You may obtain a copy of the License at http://www.apache.org/licenses/LICENSE-2.0 Unless required by applicable law or agreed to in writing, software distributed under the License is distributed on an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the License for the specific language governing permissions and limitations under the License. *) theory spinlock_irqsave_destroy_mem imports spinlock begin text \<open>Up to two locales per function in the binary.\<close> locale spinlock_irqsave_destroy_function = spinlock_context + fixes rsp\<^sub>0 rbp\<^sub>0 a spinlock_irqsave_destroy_ret :: \<open>64 word\<close> and v\<^sub>0 :: \<open>8 word\<close> and blocks :: \<open>(nat \<times> 64 word \<times> nat) set\<close> assumes seps: \<open>seps blocks\<close> and masters: \<open>master blocks (a, 1) 0\<close> \<open>master blocks (rsp\<^sub>0, 8) 1\<close> \<open>master blocks (rsp\<^sub>0-8, 8) 2\<close> \<open>master blocks (rsp\<^sub>0-16, 8) 3\<close> and ret_address: \<open>outside spinlock_irqsave_destroy_ret 675 743\<close> \<comment> \<open>Only works for non-recursive functions.\<close> begin text \<open> The Floyd invariant expresses for some locations properties that are invariably true. Simply expresses that a byte in the memory remains untouched. \<close> definition pp_\<Theta> :: \<open>_ \<Rightarrow> floyd_invar\<close> where \<open>pp_\<Theta> s \<equiv> [ \<comment> \<open>precondition\<close> boffset+675 \<mapsto> \<lambda>\<sigma>. regs \<sigma> rsp = rsp\<^sub>0 \<and> regs \<sigma> rbp = rbp\<^sub>0 \<and> regs \<sigma> rdi = s \<and> \<sigma> \<turnstile> *[rsp\<^sub>0,8] = boffset+spinlock_irqsave_destroy_ret \<and> \<sigma> \<turnstile> *[a,1] = v\<^sub>0, boffset+741 \<mapsto> \<lambda>\<sigma>. regs \<sigma> rsp = rsp\<^sub>0-8 \<and> regs \<sigma> rbp = rsp\<^sub>0-8 \<and> \<sigma> \<turnstile> *[rsp\<^sub>0-8,8] = rbp\<^sub>0 \<and> \<sigma> \<turnstile> *[rsp\<^sub>0,8] = boffset+spinlock_irqsave_destroy_ret \<and> \<sigma> \<turnstile> *[a,1] = v\<^sub>0, \<comment> \<open>postcondition\<close> boffset+spinlock_irqsave_destroy_ret \<mapsto> \<lambda>\<sigma>. \<sigma> \<turnstile> *[a,1] = v\<^sub>0 \<and> regs \<sigma> rsp = rsp\<^sub>0+8 \<and> regs \<sigma> rbp = rbp\<^sub>0 ]\<close> text \<open>Adding some rules to the simplifier to simplify proofs.\<close> schematic_goal pp_\<Theta>_zero[simp]: \<open>pp_\<Theta> s boffset = ?x\<close> unfolding pp_\<Theta>_def by simp schematic_goal pp_\<Theta>_numeral_l[simp]: \<open>pp_\<Theta> s (n + boffset) = ?x\<close> unfolding pp_\<Theta>_def by simp schematic_goal pp_\<Theta>_numeral_r[simp]: \<open>pp_\<Theta> s (boffset + n) = ?x\<close> unfolding pp_\<Theta>_def by simp lemma rewrite_spinlock_irqsave_destroy_mem: assumes \<open>master blocks (s + 16, 4) 4\<close> \<open>master blocks (s + 20, 4) 5\<close> \<open>master blocks (s + 24, Suc 0) 6\<close> shows \<open>is_std_invar spinlock_irqsave_destroy_ret (floyd.invar spinlock_irqsave_destroy_ret (pp_\<Theta> s))\<close> proof - note masters = masters assms show ?thesis text \<open>Boilerplate code to start the VCG\<close> apply (rule floyd_invarI) apply (rewrite at \<open>floyd_vcs spinlock_irqsave_destroy_ret \<hole> _\<close> pp_\<Theta>_def) apply (intro floyd_vcsI) text \<open>Subgoal for rip = boffset+675\<close> subgoal premises prems for \<sigma> text \<open>Insert relevant knowledge\<close> apply (insert prems seps ret_address) text \<open>Apply VCG/symb.\ execution\<close> apply (restart_symbolic_execution?, (symbolic_execution masters: masters)+, (finish_symbolic_execution masters: masters)?)+ done text \<open>Subgoal for rip = boffset+741\<close> subgoal premises prems for \<sigma> text \<open>Insert relevant knowledge\<close> apply (insert prems seps ret_address) text \<open>Apply VCG/symb.\ execution\<close> apply (restart_symbolic_execution?, (symbolic_execution masters: masters)+, (finish_symbolic_execution masters: masters)?)+ done text \<open>Trivial ending subgoal.\<close> subgoal by simp done qed end end
Inductive natlist : Type := | nil : natlist | cons : nat -> natlist -> natlist. Notation "x :: xs" := (cons x xs) (at level 60, right associativity). Notation "[ ]" := nil. Notation "[ x , .. , y ]" := (cons x .. (cons y nil) ..). Fixpoint concat (xs : natlist) (ys : natlist) := match ys with | [] => xs | ys' => match xs with | [] => ys' | [x] => x :: ys' | x::xs' => x :: concat xs' ys' end end. Notation "xs ++ ys" := (concat xs ys). Fixpoint rev (xs : natlist) := match xs with | [] => xs | x::xs' => rev xs' ++ [x] end. Inductive In : Fixpoint index (xs : natlist) (t : nat) := match xs with | [] => Theorem app_nil_r : forall l : natlist, l ++ [] = l. Proof. intro l. simpl.
# LaTeX to medium Being a dedicated user of jupyter notebooks in my research, I was very pleased to hear about the [jupyter_to_medium](https://github.com/dexplo/jupyter_to_medium) package which is also introduced in this [post](https://medium.com/dunder-data/jupyter-to-medium-initial-post-ecd140d339f0). I am very impressed how my work in jupyter can easily be converted into a medium post. One pretty essential part missing in the conversion however, are the LaTeX equations from my notebooks... :( This is a known issue, but someone proposed a solution where matplotlib could be used to render the equations into images stored within the notebooks. This means that the equations will be converted to medium by [jupyter_to_medium](https://github.com/dexplo/jupyter_to_medium). Here is my attempt to use this solution. The example notebook that was used to create this post is available at: * [Kaggle](https://www.kaggle.com/martinlarsalbert/latex-to-medium) * [GitHub](https://github.com/martinlarsalbert/kaggle/tree/main/kernels/latex_to_medium/latex_to_medium.ipynb) I wrote a simple method that uses matplotlib to render the equations: ```python import matplotlib.pyplot as plt import sympy as sp def display(eq:sp.Eq, size=20): """ Use matplotlib to render LaTeX equations to figure within notebook. ---------- eq : str or sympy.Eq LaTeX equation to render size : int size of the equation """ if isinstance(eq, str): eq_latex = eq else: eq_latex = sp.latex(eq) fig,ax=plt.subplots() fig.set_size_inches(0.01, 0.01) ax.axis("off") plt.title(r'$' + eq_latex + r'$' , size=size); ``` As I'm also a big fan of the SymPy package, this method accepts equations both as pure LaTeX string or a SymPy expression.It is either possible to write the LaTeX: ```python eq = r'E = m*c^2' display(eq) ``` ...or as a SymPy expression ```python E,m,c = sp.symbols('E m c') eq2 = sp.Eq(E,m*c**2) display(eq2) ``` ## Conclusions Eventhough this requires that you rewrite your notebooks using the display method, I think that this is still much more convenient than having to create these LaTeX equations as images in some other (more manual way). I will now definatelly used the [jupyter_to_medium](https://github.com/dexplo/jupyter_to_medium) package for my next post.
lemma interior_interior [simp]: "interior (interior S) = interior S"
/- Copyright (c) 2021 OpenAI. All rights reserved. Released under Apache 2.0 license as described in the file LICENSE. Authors: Kunhao Zheng, Stanislas Polu, David Renshaw, OpenAI GPT-f -/ import mathzoo.imports.miniF2F open_locale nat rat real big_operators topological_space theorem mathd_algebra_422 (x : ℝ) (σ : equiv ℝ ℝ) (h₀ : ∀ x, σ.1 x = 5 * x - 12) (h₁ : σ.1 (x + 1) = σ.2 x) : x = 47 / 24 := begin field_simp [h₀, mul_add, add_mul, sub_add_cancel, mul_assoc, add_comm], have := congr_arg σ.to_fun h₁, rw h₀ at this, rw h₀ at this, symmetry, norm_num at this, linarith, end
lemma continuous_within_compose[continuous_intros]: "continuous (at x within s) f \<Longrightarrow> continuous (at (f x) within f ` s) g \<Longrightarrow> continuous (at x within s) (g \<circ> f)"
module Funktionen hallo : String -> String hallo name = "Hallo " ++ name addieren : Int -> Int -> Int addieren a b = a + b addieren' : Int -> (Int -> Int) addieren' a = \b => a + b add10 : Int -> Int add10 = addieren 10 identität : { ty : Type } -> ty -> ty identität { ty = typ } val = val
header {* Implementation of Safety Property Model Checker \label{sec:find_path_impl}*} theory Find_Path_Impl imports Find_Path "../CAVA_Automata/Digraph_Impl" begin section {* Workset Algorithm *} text {* A simple implementation is by a workset algorithm. *} definition "ws_update E u p V ws \<equiv> RETURN ( V \<union> E``{u}, ws ++ (\<lambda>v. if (u,v)\<in>E \<and> v\<notin>V then Some (u#p) else None))" definition "s_init U0 \<equiv> RETURN (None,U0,\<lambda>u. if u\<in>U0 then Some [] else None)" definition "wset_find_path E U0 P \<equiv> do { ASSERT (finite U0); s0 \<leftarrow> s_init U0; (res,_,_) \<leftarrow> WHILET (\<lambda>(res,V,ws). res=None \<and> ws\<noteq>Map.empty) (\<lambda>(res,V,ws). do { ASSERT (ws\<noteq>Map.empty); (u,p) \<leftarrow> SPEC (\<lambda>(u,p). ws u = Some p); let ws=ws |` (-{u}); if P u then RETURN (Some (rev p,u),V,ws) else do { ASSERT (finite (E``{u})); ASSERT (dom ws \<subseteq> V); (V,ws) \<leftarrow> ws_update E u p V ws; RETURN (None,V,ws) } }) s0; RETURN res }" lemma wset_find_path_correct: fixes E :: "('v\<times>'v) set" shows "wset_find_path E U0 P \<le> find_path E U0 P" proof - def inv \<equiv> "\<lambda>(res,V,ws). case res of None \<Rightarrow> dom ws\<subseteq>V \<and> finite (dom ws) (* Derived *) \<and> V\<subseteq>E\<^sup>*``U0 \<and> E``(V-dom ws) \<subseteq> V \<and> (\<forall>v\<in>V-dom ws. \<not> P v) \<and> U0 \<subseteq> V \<and> (\<forall>v p. ws v = Some p \<longrightarrow> ((\<forall>v\<in>set p. \<not>P v) \<and> (\<exists>u0\<in>U0. path E u0 (rev p) v))) | Some (p,v) \<Rightarrow> (\<exists>u0\<in>U0. path E u0 p v \<and> P v \<and> (\<forall>v\<in>set p. \<not>P v))" def var\<equiv>"inv_image (brk_rel (finite_psupset (E\<^sup>*``U0) <*lex*> measure (card o dom))) (\<lambda>(res::('v list \<times> 'v) option,V::'v set,ws::'v\<rightharpoonup>'v list). (res\<noteq>None,V,ws))" (*have [simp, intro!]: "wf var" unfolding var_def by (auto intro: FIN)*) have [simp]: "\<And>u p V. dom (\<lambda>v. if (u, v) \<in> E \<and> v \<notin> V then Some (u # p) else None) = E``{u} - V" by (auto split: split_if_asm) { fix V ws u p assume INV: "inv (None,V,ws)" assume WSU: "ws u = Some p" from INV WSU have [simp]: "V \<subseteq> E\<^sup>*``U0" and [simp]: "u \<in> V" and UREACH: "\<exists>u0\<in>U0. (u0,u)\<in>E\<^sup>*" and [simp]: "finite (dom ws)" unfolding inv_def apply simp_all apply auto [] apply clarsimp apply blast done have "(V \<union> E `` {u}, V) \<in> finite_psupset (E\<^sup>* `` U0) \<or> V \<union> E `` {u} = V \<and> card (E `` {u} - V \<union> (dom ws - {u})) < card (dom ws)" proof (subst disj_commute, intro disjCI conjI) assume "(V \<union> E `` {u}, V) \<notin> finite_psupset (E\<^sup>* `` U0)" thus "V \<union> E `` {u} = V" using UREACH by (auto simp: finite_psupset_def intro: rev_ImageI) hence [simp]: "E``{u} - V = {}" by force show "card (E `` {u} - V \<union> (dom ws - {u})) < card (dom ws)" using WSU by (auto intro: card_Diff1_less) qed } note wf_aux=this { fix V ws u p assume FIN: "finite (E\<^sup>*``U0)" assume "inv (None,V,ws)" "ws u = Some p" then obtain u0 where "u0\<in>U0" "(u0,u)\<in>E\<^sup>*" unfolding inv_def by clarsimp blast hence "E``{u} \<subseteq> E\<^sup>*``U0" by (auto intro: rev_ImageI) hence "finite (E``{u})" using FIN(1) by (rule finite_subset) } note succs_finite=this { fix V ws u p assume FIN: "finite (E\<^sup>*``U0)" assume INV: "inv (None,V,ws)" assume WSU: "ws u = Some p" assume NVD: "\<not> P u" have "inv (None, V \<union> E `` {u}, ws |` (- {u}) ++ (\<lambda>v. if (u, v) \<in> E \<and> v \<notin> V then Some (u # p) else None))" unfolding inv_def apply (simp, intro conjI) using INV WSU apply (auto simp: inv_def) [] using INV WSU apply (auto simp: inv_def) [] using INV WSU apply (auto simp: succs_finite FIN) [] using INV apply (auto simp: inv_def) [] using INV apply (auto simp: inv_def) [] using INV WSU apply (auto simp: inv_def intro: rtrancl_image_advance ) [] using INV WSU apply (auto simp: inv_def) [] using INV NVD apply (auto simp: inv_def) [] using INV NVD apply (auto simp: inv_def) [] using INV WSU NVD apply (fastforce simp: inv_def restrict_map_def intro!: path_conc path1 split: split_if_asm ) [] done } note ip_aux=this show ?thesis unfolding wset_find_path_def find_path_def ws_update_def s_init_def apply (refine_rcg refine_vcg le_ASSERTI WHILET_rule[where R = var and I = inv] ) using [[goals_limit = 1]] apply (auto simp: var_def) [] apply (auto simp: inv_def dom_def split: split_if_asm) [] apply simp apply (auto simp: inv_def) [] apply (auto simp: var_def brk_rel_def) [] apply (simp add: succs_finite) apply (auto simp: inv_def) [] apply clarsimp apply (simp add: ip_aux) apply clarsimp apply (simp add: var_def brk_rel_def wf_aux) [] apply (fastforce simp: inv_def split: option.splits intro: rev_ImageI dest: Image_closed_trancl) [] done qed text {* We refine the algorithm to use a foreach-loop*} definition "ws_update_foreach E u p V ws \<equiv> FOREACH (LIST_SET_REV_TAG (E``{u})) (\<lambda>v (V,ws). if v\<in>V then RETURN (V,ws) else do { ASSERT (v\<notin>dom ws); RETURN (insert v V,ws( v \<mapsto> u#p)) } ) (V,ws)" lemma ws_update_foreach_refine[refine]: assumes FIN: "finite (E``{u})" assumes WSS: "dom ws \<subseteq> V" assumes ID: "(E',E)\<in>Id" "(u',u)\<in>Id" "(p',p)\<in>Id" "(V',V)\<in>Id" "(ws',ws)\<in>Id" shows "ws_update_foreach E' u' p' V' ws' \<le> \<Down>Id (ws_update E u p V ws)" unfolding ID[simplified] unfolding ws_update_foreach_def ws_update_def LIST_SET_REV_TAG_def apply (refine_rcg refine_vcg FIN FOREACH_rule[where I="\<lambda>it (V',ws'). V'=V \<union> (E``{u}-it) \<and> dom ws' \<subseteq> V' \<and> ws' = ws ++ (\<lambda>v. if (u,v)\<in>E \<and> v\<notin>it \<and> v\<notin>V then Some (u#p) else None)"] ) using WSS apply (auto simp: Map.map_add_def split: option.splits split_if_asm intro!: ext[where 'a='a and 'b="'b list option"]) apply fastforce+ done definition "s_init_foreach U0 \<equiv> do { (U0,ws) \<leftarrow> FOREACH U0 (\<lambda>x (U0,ws). RETURN (insert x U0,ws(x\<mapsto>[]))) ({},Map.empty); RETURN (None,U0,ws) }" lemma s_init_foreach_refine[refine]: assumes FIN: "finite U0" assumes ID: "(U0',U0)\<in>Id" shows "s_init_foreach U0' \<le>\<Down>Id (s_init U0)" unfolding s_init_foreach_def s_init_def ID[simplified] apply (refine_rcg refine_vcg FOREACH_rule[where I = "\<lambda>it (U,ws). U = U0-it \<and> ws = (\<lambda>x. if x\<in>U0-it then Some [] else None)"] ) apply (auto simp: FIN intro!: ext ) done definition "wset_find_path' E U0 P \<equiv> do { ASSERT (finite U0); s0\<leftarrow>s_init_foreach U0; (res,_,_) \<leftarrow> WHILET (\<lambda>(res,V,ws). res=None \<and> ws\<noteq>Map.empty) (\<lambda>(res,V,ws). do { ASSERT (ws\<noteq>Map.empty); ((u,p),ws) \<leftarrow> op_map_pick_remove ws; if P u then RETURN (Some (rev p,u),V,ws) else do { (V,ws) \<leftarrow> ws_update_foreach E u p V ws; RETURN (None,V,ws) } }) s0; RETURN res }" lemma wset_find_path'_refine: "wset_find_path' E U0 P \<le> \<Down>Id (wset_find_path E U0 P)" unfolding wset_find_path'_def wset_find_path_def unfolding op_map_pick_remove_alt apply (refine_rcg IdI single_valued_Id) apply simp_all done section {* Refinement to efficient data structures *} schematic_lemma wset_find_path'_refine_aux: fixes U0::"'a::hashable set" and P::"'a \<Rightarrow> bool" and E::"('a\<times>'a) set" assumes [autoref_rules]: "(succi,E)\<in>\<langle>Id\<rangle>slg_rel" "(U0',U0)\<in>\<langle>Id\<rangle>list_set_rel" notes [autoref_tyrel] = TYRELI[where R="\<langle>Id::(('a\<times>'a) set),\<langle>Id::(('a\<times>'a) set)\<rangle>list_rel\<rangle>list_map_rel"] TYRELI[where R="\<langle>Id::(('a\<times>'a) set)\<rangle>map2set_rel dflt_ahm_rel"] notes [autoref_rules] = IdI[of P, unfolded fun_rel_id_simp[symmetric]] shows "(?c::?'c,wset_find_path' E U0 P) \<in> ?R" unfolding wset_find_path'_def ws_update_foreach_def s_init_foreach_def using [[autoref_trace_failed_id]] using [[autoref_trace_intf_unif]] using [[autoref_trace_pat]] apply (autoref (keep_goal)) done concrete_definition wset_find_path_impl for succi U0' P uses wset_find_path'_refine_aux section {* Autoref Setup *} context begin interpretation autoref_syn . lemma [autoref_itype]: "find_path ::\<^sub>i \<langle>I\<rangle>\<^sub>ii_slg \<rightarrow>\<^sub>i \<langle>I\<rangle>\<^sub>ii_set \<rightarrow>\<^sub>i (I\<rightarrow>\<^sub>ii_bool) \<rightarrow>\<^sub>i \<langle>\<langle>\<langle>\<langle>I\<rangle>\<^sub>ii_list, I\<rangle>\<^sub>ii_prod\<rangle>\<^sub>ii_option\<rangle>\<^sub>ii_nres" by simp lemma wset_find_path_autoref[autoref_rules]: shows "( wset_find_path_impl, find_path) \<in> \<langle>Id\<rangle>slg_rel \<rightarrow> \<langle>Id\<rangle>list_set_rel \<rightarrow> (Id\<rightarrow>bool_rel) \<rightarrow> \<langle>\<langle>\<langle>Id\<rangle>list_rel\<times>\<^sub>rId\<rangle>option_rel\<rangle>nres_rel" proof - note wset_find_path_impl.refine[THEN nres_relD] also note wset_find_path'_refine also note wset_find_path_correct finally show ?thesis by (fastforce intro!: nres_relI) qed end schematic_lemma wset_find_path_transfer_aux: "RETURN ?c \<le> wset_find_path_impl E U0 P" unfolding wset_find_path_impl_def by (refine_transfer (post)) concrete_definition wset_find_path_code for E ?U0.0 P uses wset_find_path_transfer_aux lemmas [refine_transfer] = wset_find_path_code.refine export_code wset_find_path_code checking SML section {* Nontrivial paths *} definition "find_path1_gen E u0 P \<equiv> do { res \<leftarrow> find_path E (E``{u0}) P; case res of None \<Rightarrow> RETURN None | Some (p,v) \<Rightarrow> RETURN (Some (u0#p,v)) }" lemma find_path1_gen_correct: "find_path1_gen E u0 P \<le> find_path1 E u0 P" unfolding find_path1_gen_def find_path_def find_path1_def apply (refine_rcg refine_vcg le_ASSERTI) apply (auto intro: path_prepend dest: tranclD elim: finite_subset[rotated] ) done schematic_lemma find_path1_impl_aux: shows "(?c::?'c,find_path1_gen::(_\<times>_::hashable) set \<Rightarrow> _)\<in>?R" unfolding find_path1_gen_def[abs_def] apply (autoref (keep_goal)) done lemma [autoref_itype]: "find_path1 ::\<^sub>i \<langle>I\<rangle>\<^sub>ii_slg \<rightarrow>\<^sub>i I \<rightarrow>\<^sub>i (I\<rightarrow>\<^sub>ii_bool) \<rightarrow>\<^sub>i \<langle>\<langle>\<langle>\<langle>I\<rangle>\<^sub>ii_list, I\<rangle>\<^sub>ii_prod\<rangle>\<^sub>ii_option\<rangle>\<^sub>ii_nres" by simp concrete_definition find_path1_impl uses find_path1_impl_aux lemma find_path1_autoref[autoref_rules]: "(find_path1_impl,find_path1) \<in> \<langle>Id\<rangle>slg_rel \<rightarrow>Id \<rightarrow> (Id \<rightarrow> bool_rel) \<rightarrow> \<langle>\<langle>\<langle>Id\<rangle>list_rel \<times>\<^sub>r Id\<rangle>Relators.option_rel\<rangle>nres_rel" apply (rule fun_relI nres_relI)+ apply (rule order_trans) apply (erule (2) find_path1_impl.refine[param_fo, THEN nres_relD]) apply (simp add: find_path1_gen_correct) done schematic_lemma find_path1_transfer_aux: "RETURN ?c \<le> find_path1_impl E u P" unfolding find_path1_impl_def by refine_transfer concrete_definition find_path1_code for E u P uses find_path1_transfer_aux lemmas [refine_transfer] = find_path1_code.refine end
#ifndef BOOST_NETWORK_PROTOCOL_HTTP_CLIENT_SYNC_IMPL_HPP_20100623 #define BOOST_NETWORK_PROTOCOL_HTTP_CLIENT_SYNC_IMPL_HPP_20100623 // Copyright 2013 Google, Inc. // Copyright 2010 Dean Michael Berris <[email protected]> // Distributed under the Boost Software License, Version 1.0. // (See accompanying file LICENSE_1_0.txt or copy at // http://www.boost.org/LICENSE_1_0.txt) #include <memory> #include <functional> #include <boost/network/protocol/http/client/options.hpp> #include <boost/network/protocol/http/request.hpp> #include <boost/network/protocol/http/tags.hpp> #include <boost/network/protocol/http/traits/connection_policy.hpp> #include <boost/network/traits/string.hpp> #include <boost/optional/optional.hpp> namespace boost { namespace network { namespace http { template <class Tag, unsigned version_major, unsigned version_minor> struct basic_client_impl; namespace impl { template <class Tag, unsigned version_major, unsigned version_minor> struct sync_client : connection_policy<Tag, version_major, version_minor>::type { typedef typename string<Tag>::type string_type; typedef typename connection_policy<Tag, version_major, version_minor>::type connection_base; typedef typename resolver<Tag>::type resolver_type; typedef std::function<void(iterator_range<char const*> const&, std::error_code const&)> body_callback_function_type; typedef std::function<bool(string_type&)> body_generator_function_type; friend struct basic_client_impl<Tag, version_major, version_minor>; std::shared_ptr<asio::io_service> service_ptr; asio::io_service& service_; resolver_type resolver_; optional<string_type> certificate_filename_; optional<string_type> verify_path_; optional<string_type> certificate_file_; optional<string_type> private_key_file_; optional<string_type> ciphers_; optional<string_type> sni_hostname_; long ssl_options_; bool always_verify_peer_; sync_client( bool cache_resolved, bool follow_redirect, bool always_verify_peer, int timeout, std::shared_ptr<asio::io_service> service, optional<string_type> certificate_filename = optional<string_type>(), optional<string_type> verify_path = optional<string_type>(), optional<string_type> certificate_file = optional<string_type>(), optional<string_type> private_key_file = optional<string_type>(), optional<string_type> ciphers = optional<string_type>(), optional<string_type> sni_hostname = optional<string_type>(), long ssl_options = 0) : connection_base(cache_resolved, follow_redirect, timeout), service_ptr(service.get() ? service : std::make_shared<asio::io_service>()), service_(*service_ptr), resolver_(service_), certificate_filename_(std::move(certificate_filename)), verify_path_(std::move(verify_path)), certificate_file_(std::move(certificate_file)), private_key_file_(std::move(private_key_file)), ciphers_(std::move(ciphers)), sni_hostname_(std::move(sni_hostname)), ssl_options_(ssl_options), always_verify_peer_(always_verify_peer) {} ~sync_client() = default; void wait_complete() {} basic_response<Tag> request_skeleton(basic_request<Tag> const& request_, string_type method, bool get_body, body_callback_function_type callback, body_generator_function_type generator) { typename connection_base::connection_ptr connection_; connection_ = connection_base::get_connection( resolver_, request_, always_verify_peer_, certificate_filename_, verify_path_, certificate_file_, private_key_file_, ciphers_, sni_hostname_); return connection_->send_request(method, request_, get_body, callback, generator); } }; } // namespace impl } // namespace http } // namespace network } // namespace boost #endif // BOOST_NETWORK_PROTOCOL_HTTP_CLIENT_SYNC_IMPL_HPP_20100623
theory MonoEpi imports FreeLogic begin (*Begin: some useful parameter settings*) declare [[ smt_solver = cvc4, smt_oracle = true, smt_timeout = 120]] declare [[ show_types ]] sledgehammer_params [provers = cvc4 z3 e spass] nitpick_params [user_axioms, show_all, format = 2] (*nitpick_params[user_axioms, show_all, format = 2, expect = genuine]*) (*End: some useful parameter settings*) typedecl \<alpha> \<comment>\<open>This type can be thought of representing the morphisms of a category.\<close> locale category = \<comment>\<open>We need three functions and constant to define a category.\<close> fixes domain:: "\<alpha> \<Rightarrow> \<alpha>" ("dom _" [108] 109) and codomain:: "\<alpha> \<Rightarrow> \<alpha>" ("cod _" [110] 111) and composition:: "\<alpha> \<Rightarrow> \<alpha> \<Rightarrow> \<alpha>" (infix "\<cdot>" 110) and star::\<alpha> ("\<^bold>*") \<comment>\<open>Symbol for non-existing elements in terms of free logic\<close> assumes \<comment>\<open>Here we define the axioms that the morphisms in interaction with the functions have to obey.\<close> \<comment>\<open>The existence of the domain of a morphism implies the existence of the morphism.\<close> S1: "E(dom x) \<^bold>\<rightarrow> E x" and S2: "E(cod y) \<^bold>\<rightarrow> E y" and \<comment>\<open>The same goes for the codomain.\<close> \<comment>\<open>As we have seen, the composition only exists if the two morphisms are composable.\<close> \<comment>\<open>We use \<simeq> to denote the existing equality which requires that both sides of the equation exist.\<close> S3: "E(x\<cdot>y) \<^bold>\<leftrightarrow> dom x \<simeq> cod y" and S4: "x\<cdot>(y\<cdot>z) \<cong> (x\<cdot>y)\<cdot>z" and \<comment>\<open>Composition of morphisms is associative.\<close> \<comment>\<open>We use \<cong> to denote the Kleene equality which only implies equality if at least one side of the equation exists\<close> \<comment>\<open>The domain of a morphisms serves as the right identity for composition.\<close> S5: "x\<cdot>(dom x) \<cong> x" and S6: "(cod y)\<cdot>y \<cong> y" and \<comment>\<open>So does the codomain as a left identity.\<close> \<comment>\<open>Finally we make sure that there is only one non-existing morphism.\<close> L1: "\<^bold>\<not>(E m) \<^bold>\<rightarrow> (m = \<^bold>*)" begin \<comment>\<open>We show consistency.\<close> lemma "True" nitpick[satisfy] oops definition monic::"\<alpha> \<Rightarrow> bool" where "monic m \<equiv> \<forall>f g. m\<cdot>f \<simeq> m\<cdot>g \<longrightarrow> f \<simeq> g" definition epi::"\<alpha> \<Rightarrow> bool" where "epi m \<equiv> \<forall>f g. f\<cdot>m \<simeq> g\<cdot>m \<longrightarrow> f \<simeq> g" definition iso::"\<alpha> \<Rightarrow> bool" where "iso f \<equiv> \<exists>g. f\<cdot>g \<cong> (dom g) \<and> g\<cdot>f \<cong> (dom f)" lemma "iso f \<longrightarrow> monic f" by (smt S2 S3 S4 S6 local.iso_def monic_def) lemma "iso f \<longrightarrow> epi f" by (smt S2 S3 S4 S5 category.iso_def category_axioms epi_def) lemma "\<forall>f. ((monic f) \<and> (epi f) \<longrightarrow> iso f)" nitpick[card = 4] oops end
section "Relational and denotational views are equivalent" theory EquivRelationalDenotFSet imports RelationalSemFSet DeclSemAsDenotFSet begin lemma denot_implies_rel: "(v \<in> E e \<rho>) \<Longrightarrow> (\<rho> \<turnstile> e \<Rightarrow> v)" proof (induction e arbitrary: v \<rho>) case (EIf e1 e2 e3) then show ?case apply simp apply clarify apply (rename_tac n) apply (case_tac n) apply force apply simp apply (rule rifnz) apply force+ done qed auto lemma rel_implies_denot: "\<rho> \<turnstile> e \<Rightarrow> v \<Longrightarrow> v \<in> E e \<rho>" by (induction \<rho> e v rule: rel_sem.induct) auto theorem equivalence_relational_denotational: "(v \<in> E e \<rho>) = (\<rho> \<turnstile> e \<Rightarrow> v)" using denot_implies_rel rel_implies_denot by blast end
\documentclass{article} \usepackage{etoolbox} % Set this toggle true to compile a version for the arxiv, and % false to compile for the currently configured conference. % NOTE: you also must set the single_column flags in the Rnw files to % make side-by-side figures for the arxiv version. \newtoggle{for_arxiv} \toggletrue{for_arxiv} %\togglefalse{for_arxiv} \nottoggle{for_arxiv}{% \usepackage[accepted]{aistats2019} % hooray! % \usepackage{aistats2019} } \usepackage{microtype} \usepackage{graphicx} \usepackage{subfigure} \usepackage{booktabs} % for professional tables \usepackage{siunitx} \usepackage{hyperref} \usepackage{xargs}[2008/03/08] \iftoggle{for_arxiv} { \usepackage[authoryear]{natbib} } { \usepackage[round]{natbib} \renewcommand{\bibname}{References} \renewcommand{\bibsection}{\subsubsection*{\bibname}} } % Attempt to make hyperref and algorithmic work together better: \newcommand{\theHalgorithm}{\arabic{algorithm}} \usepackage{prettyref} \usepackage{refstyle} \usepackage{amsmath} \usepackage{amssymb} \usepackage{amsfonts} \usepackage{amsthm} \usepackage{mathrsfs} \usepackage{mathtools} \usepackage{colonequals} \usepackage{algpseudocode, algorithm} %typical alg typesetting packages \usepackage{listings} \usepackage{pdfpages} % Define things needed to incorporate the LyX appendix. % We can define things redundantly if necessary, but please don't modify % this file -- if there's a name clash for a function you want to define, % please just pick a new name. \input{lyx_commands.tex} % This picks up the knitr boilerplate, allowing us to \input partial knitr % documents. \input{knitr_header.tex} % Paper-specific math macros (not in the appendix). \global\long\def\wcv{W_k} \global\long\def\wboot{W^*_B} \global\long\def\thetapw{\thetahat(w)} \global\long\def\wdiff{\Delta w} \newcommand{\eq}[1]{Eq.~\ref{eq:#1}} \newcommand{\fig}[1]{Fig.~\ref{fig:#1}} \newcommand{\rthm}[1]{Theorem~\ref{thm:#1}} \newcommand{\sect}[1]{Section~\ref{sec:#1}} \newcommand{\subsect}[1]{Section~\ref{subsec:#1}} \newcommand{\assum}[1]{Assumption~\ref{assum:#1}} \newcommand{\lemma}[1]{Lemma~\ref{lm:#1}} \newcommand{\corollary}[1]{Corollary~\ref{cor:#1}} \newcommand{\app}[1]{Appendix~\ref{app:#1}} \newcommand{\appsect}[1]{Appendix~\ref{sec:#1}} \newcommand{\coreassum}{Assumptions \ref{assu:paper_smoothness}--\ref{assu:paper_lipschitz} } \newcommand{\paperallcoreassum}{Assumptions \ref{assu:paper_smoothness}--\ref{assu:paper_weight_bounded} } \iftoggle{for_arxiv}{% \title{A Swiss Army Infinitesimal Jackknife} \author{ Ryan Giordano\\ \texttt{[email protected]} \and Will Stephenson\\ \texttt{[email protected]} \and Runjing Liu\\ \texttt{runjing\[email protected]} \and Michael I.~Jordan\\ \texttt{[email protected]} \and Tamara Broderick\\ \texttt{[email protected]} } } \begin{document} \iftoggle{for_arxiv} { \maketitle } \nottoggle{for_arxiv} { \twocolumn[ \aistatstitle{A Swiss Army Infinitesimal Jackknife} \aistatsauthor{ Ryan Giordano \And Will Stephenson \And Runjing Liu \And Michael I.~Jordan \And Tamara Broderick } \aistatsaddress{ UC Berkeley \And MIT \And UC Berkeley \And UC Berkeley \And MIT } ] } \begin{abstract} % The error or variability of machine learning algorithms is often assessed by repeatedly re-fitting a model with different weighted versions of the observed data. The ubiquitous tools of cross-validation (CV) and the bootstrap are examples of this technique. These methods are powerful in large part due to their model agnosticism but can be slow to run on modern, large data sets due to the need to repeatedly re-fit the model. In this work, we use a linear approximation to the dependence of the fitting procedure on the weights, producing results that can be faster than repeated re-fitting by an order of magnitude. This linear approximation is sometimes known as the ``infinitesimal jackknife'' in the statistics literature, where it is mostly used as a theoretical tool to prove asymptotic results. We provide explicit finite-sample error bounds for the infinitesimal jackknife in terms of a small number of simple, verifiable assumptions. Our results apply whether the weights and data are stochastic or deterministic, and so can be used as a tool for proving the accuracy of the infinitesimal jackknife on a wide variety of problems. As a corollary, we state mild regularity conditions under which our approximation consistently estimates true leave-$k$-out cross-validation for any fixed $k$. These theoretical results, together with modern automatic differentiation software, support the application of the infinitesimal jackknife to a wide variety of practical problems in machine learning, providing a ``Swiss Army infinitesimal jackknife.'' We demonstrate the accuracy of our methods on a range of simulated and real datasets. % \end{abstract} \section{Introduction}\label{sec:introduction} \input{introduction.tex} \section{Methods and Results}\label{sec:methods} \subsection{Problem definition}\label{subsec:problem_definition} \input{problem_definition.tex} \subsection{Linear approximation} \input{linear_approximation.tex} \subsection{Assumptions and results}\label{subsec:assumptions} \input{assumptions_and_results.tex} \section{Examples}\label{sec:methods_examples} \input{examples.tex} \section{Related Work}\label{sec:relatedwork} \input{related_work.tex} \section{Simulated Experiments} % This file is built with knit_synthetic_to_tex.sh. \input{simulated_experiments.tex} \section{Genomics Experiments\label{sec:genomics}} % This file is built with knit_real_data_to_tex.sh. \input{real_data_experiments.tex} \section{Conclusion} \input{conclusion.tex} \newpage \input{acknowledgements.tex} \bibliography{references} \bibliographystyle{plainnat} \newpage \onecolumn \appendix \input{app_theory.tex} \section{Genomics Experiments Details}\label{sec:appendix_genomics} We demonstrate the Python and R code used to run and analyze the experiments on the genomics data in a sequence of Jupyter notebooks. The output of these notebooks are included below, though they are best viewed in their original notebook form. The notebooks, as well as scripts and instructions for reproducing our analysis in its entirety, can be found in the git repository \href{https://github.com/rgiordan/AISTATS2019SwissArmyIJ}{rgiordan/AISTATS2019SwissArmyIJ}. \includepdf[pages=1-, scale=0.8, pagecommand={}]{appendix_pdfs/fit_model_and_save.pdf} \includepdf[pages=1-, scale=0.8, pagecommand={}]{appendix_pdfs/load_and_refit.pdf} \includepdf[pages=1-, scale=0.8, pagecommand={}]{appendix_pdfs/calculate_prediction_errors.pdf} \includepdf[pages=1-, scale=0.8, pagecommand={}]{appendix_pdfs/examine_and_save_results.pdf} \end{document}
\documentclass{article}[12pt] \title{\huge{\textbf{AIND Project 2\\Forward-Planning Agent}}} \author{\Large{Ruize Luo}} \usepackage{algorithm} \usepackage[noend]{algpseudocode} \usepackage[titletoc]{appendix} \usepackage{amssymb} \usepackage{amsmath} \usepackage{amsthm} \usepackage[english]{babel} \usepackage{bm} \usepackage{changepage} \usepackage{geometry} \usepackage{graphicx} \usepackage{epstopdf} \usepackage{enumerate} \usepackage{enumitem} \usepackage{extarrows} \usepackage{hyperref} \usepackage{indentfirst} \usepackage{multirow} \usepackage{tikz} \usepackage{mathdots} \usetikzlibrary{positioning,shapes,decorations.text, calc, backgrounds, decorations.pathmorphing} \usepackage{float} \usepackage{setspace} \usepackage{subcaption} \geometry{left=2.5cm,right=2.5cm,top=2.5cm,bottom=2.5cm} \newcommand{\algind}{\hspace{\algorithmicindent}} \newtheorem{theorem}{Theorem} \newtheorem{lemma}{Lemma} \newtheorem{definition}{Definition} \tikzset{snake it/.style={-stealth, decoration={snake, amplitude = .4mm, segment length = 2mm, post length=0.9mm},decorate}} \newcommand{\ts}{Test\&Set } \newcommand{\TS}{TEST\&SET } \begin{document} \maketitle \section{Analysis of Results} \subsection{Number of Nodes Expanded vs Number of Actions in the Domain} \label{ssc:1.1} For the air cargo problem, there are three actions: \begin{itemize} \item $Load(Cargo, Plane, Airport)$ \item $Unload(Cargo, Plane, Airport)$ \item $Fly(Plane, Airport_1, Airport_2)$ \end{itemize} Hence, given a problem with $C$ cargoes, $P$ planes and $A$ airports, we can calculate the number of possible actions: \begin{equation} N = 2(C \cdot P \cdot A) + P \cdot (A \cdot (A - 1)) \end{equation} And hence we can calculate the number of actions for each of the four problems: \begin{center} \begin{tabular}{||c c c c c||} \hline Problem & \# Cargoes & \# Planes & \# Airports & \# Actions \\ [0.5ex] \hline\hline 1 & 2 & 2 & 2 & \hphantom{0}20 \\ \hline 2 & 3 & 3 & 3 & \hphantom{0}72 \\ \hline 3 & 4 & 2 & 4 & \hphantom{0}88 \\ \hline 4 & 5 & 2 & 4 & 104 \\ \hline \end{tabular} \end{center} Figure \ref{fig:n_actions_vs_n_nodes} is a plot of number of nodes expanded by each algorithm on each problem. \begin{figure}[h!] \includegraphics[width=\linewidth]{n_actions_vs_n_nodes.png} \caption{Number of nodes expanded vs number of actions in the domain for each search algorithm. Note that the y-axis is in log scale} \label{fig:n_actions_vs_n_nodes} \end{figure} From the graph we can see two things. Firstly, all algorithms show a log-linear relationship between number of nodes expanded and number of possible actions in the domain. The only differences among the algorithms are the slope of the line. Greedy algorithm seem to be looking into fewer new nodes than other algorithms. Secondly, there is a dip in number of nodes expanded for depth first graph search (DFS) and greedy best graph search with maxlevel heuristics when going from 72 actions to 88 actions. This might be due to the fact that problem 3 only has two planes whereas problem 2 had three, since now at most two planes can have actions at each expansion. This would reduce the branching factor and thus making it easier for DFS to find the solution.\\ \subsection{Search Time vs Number of Actions in the Domain} \label{ssc:1.2} Below is a plot of search time for each algorithm on each problem. \begin{figure}[h!] \includegraphics[width=\linewidth]{n_actions_vs_time.png} \caption{Search time (seconds) vs number of actions in the domain for each search algorithm. Note that the y-axis is in log scale} \label{fig:n_actions_vs_time} \end{figure} We can see that the relationship between search time is also approximately log-linear for all the algorithms. Greedy best first search with number of unmet goals heuristic outperforms other algorithms by being an order of magnitude faster. DFS has a steeper slope, which makes it suitable for very small problems (less than 20 actions).\\ \subsection{Plan Length} \label{ssc:1.3} Below is a plot of plan length for each algorithm on each problem.\\ \begin{figure}[h!] \includegraphics[width=\linewidth]{plan_length.png} \caption{Plan length for each search algorithm on each problem. Note that the y-axis is in log scale} \label{fig:plan_length} \end{figure} We can see that the path DFS plans is far from optimal and seems to be increasing faster than linear with number of actions even when the y-axis is already log-scale. In order to inspect the performance of the other algorithms, we should plot another one without DFS. \newpage \begin{figure}[h!] \includegraphics[width=\linewidth]{plan_length_no_dfs.png} \caption{Plan length for each search algorithm on each problem without DFS. Note that the y-axis is in log scale} \label{fig:plan_length_no_dfs} \end{figure} Note that there are 5 algorithms overlapping with the line that represents the shortest plan lengths for each problem: \begin{itemize} \item breadth first search (BFS) \item uniform cost search \item A* search with number of unmet goals \item A* search with maxlevel \item A* search with setlevel \end{itemize} We see that even though greedy best first search expands less nodes, A* searches with admissible heuristics find solutions that are optimal. Levelsum is not an admissible heuristic, and it did not find the optimal solution for problem 4. \section{Questions} \begin{enumerate} \item Which algorithm or algorithms would be most appropriate for planning in a very restricted domain (i.e., one that has only a few actions) and needs to operate in real time? \end{enumerate} \textit{Answer}: According to \ref{ssc:1.2}, DFS and greedy best first search with number of unmet goals heuristics operate the fastest under very restricted domains. However, DFS will become much worse if the domain ever expands. \begin{enumerate}[resume] \item Which algorithm or algorithms would be most appropriate for planning in very large domains (e.g., planning delivery routes for all UPS drivers in the U.S. on a given day) \end{enumerate} \textit{Answer}: Under very large domains, the storage requirement of the algorithms start to play a factor. Hence, ideally we would like algorithms where number of nodes expanded grows slowly with the size of the domain. As can be seen from the above analysis, greedy best first search algorithms brings about the best storage efficiency, while still having reasonable run time and being able to find reasonably good solutions. \begin{enumerate}[resume] \item Which algorithm or algorithms would be most appropriate for planning problems where it is important to find only optimal plans? \end{enumerate} \textit{Answer}: If optimality must be achieved, then A* with admissible heuristic, BFS and uniform cost search can be used (as listed in \ref{ssc:1.3}). \end{document}\textbf{}
Wild space Adventures were recently received support from the European Regional Development Fund (ERDF) BIG2 grant. This grant facilitated the development of a new project designed to grow our team. The focus of the project was on using outdoor and adventurous activities to support those suffering from emotional, physiological or psychological trauma. As part of this project the Wildspace team were able to work with young people from all over the UK, including some of those affected by the Grenfell Tower fire, to try and make a positive difference to their lives.
import algebra.char_p.two /-! # IMO 2015 A4 (P5), Generalized Version -/ namespace IMOSL namespace IMO2015A4 open function open_locale non_zero_divisors def good {R : Type*} [ring R] (f : R → R) := ∀ x y : R, f (x + f (x + y)) + f (x * y) = x + f (x + y) + f x * y /-- Final solution, case 1: `char(R) ≠ 2` -/ theorem final_solution_char_ne_two {R : Type*} [ring R] [is_domain R] (Rchar : ring_char R ≠ 2) : ∀ f : R → R, good f ↔ f = (λ x, x) ∨ f = (λ x, 2 - x) := begin intros f; symmetry; refine ⟨λ h x y, _, λ h, _⟩, rcases h with rfl | rfl; simp only [], rw [← add_sub_assoc, ← add_sub_assoc, add_sub_add_left_eq_sub, sub_sub_cancel, sub_mul, ← add_sub_assoc, sub_left_inj, two_mul, sub_add_add_cancel, add_comm], ---- One important equality and the case `f(0) ≠ 0` have h0 : ∀ t : R, f (t + f (t + 1)) = t + f (t + 1) := λ t, by replace h := h t 1; rwa [mul_one, mul_one, add_left_inj] at h, cases ne_or_eq (f 0) 0 with h1 h1, right; funext x, replace h := h 0 (x - 1 + f (x - 1 + 1)), rwa [zero_add, zero_add, zero_mul, h0, h0, add_right_inj, sub_add_cancel, eq_comm, ← sub_eq_zero, ← mul_sub_one, mul_eq_zero, or_iff_right h1, sub_eq_zero, ← add_sub_right_comm, sub_eq_iff_eq_add, ← eq_sub_iff_add_eq'] at h, ---- The main case, `f(0) = 0` ---- First obtain `f(1) = 1` and reduce to `f` being odd left; have h2 := h0 (-1), rw [neg_add_self, h1, add_zero] at h2, replace h2 : f 1 = 1 := begin replace h := h 1 (-1), rwa [add_neg_self, h1, add_zero, one_mul, h2, mul_neg_one, add_neg_eq_iff_eq_add, add_right_comm, eq_add_neg_iff_add_eq, ← two_mul, ← two_mul, mul_eq_mul_left_iff, or_iff_left (ring.two_ne_zero Rchar)] at h, end, suffices h3 : ∀ x : R, f (-x) = -f x, { funext x, replace h0 := h 1 x, rw [one_mul, h2, one_mul] at h0, replace h1 := h (-1) (-x), rw [← neg_add, h3, ← neg_add, h3, h3, h2, neg_mul_neg, one_mul] at h1, generalize_hyp : 1 + f (1 + x) = c at h0 h1, replace h0 := congr_arg2 has_add.add h0 h1, rwa [add_add_add_comm, add_neg_self, zero_add, add_add_add_comm, add_neg_self, zero_add, ← two_mul, ← two_mul, mul_eq_mul_left_iff, or_iff_left (ring.two_ne_zero Rchar)] at h0 }, ---- Now prove that `f` is odd intros x, rw [← mul_neg_one, ← add_right_inj (f (x + f (x + -1))), h, mul_neg_one, add_left_inj, eq_comm, ← sub_eq_add_neg], obtain ⟨y, rfl⟩ : ∃ y : R, y + (1 + 1) = x := ⟨x - (1 + 1), sub_add_cancel x _⟩, rw [add_sub_assoc, add_sub_cancel, ← bit0, add_right_comm], replace h0 := h0 y, have h3 := h (y + 1) 0, rw [add_zero, mul_zero, mul_zero, add_zero, h1, add_zero, add_right_comm] at h3, generalize_hyp : y + f (y + 1) = t at h0 h3 ⊢; clear y, replace h := h 1 t, rwa [h2, one_mul, h0, add_left_inj, add_comm 1 t, h3, add_left_comm] at h end /-- Final solution, case 2: `char(R) = 2` -/ theorem final_solution_char_eq_two {R : Type*} [ring R] [is_domain R] [char_p R 2] : ∀ f : R → R, good f ↔ f = (λ x, x) := begin ---- Easy case and changing `f` to `g + id` intros f; symmetry; refine ⟨λ h x y, by subst h, λ h, _⟩, unfold good at h, obtain ⟨g, rfl⟩ : ∃ g : R → R, g + (λ x, x) = f := ⟨f - id, sub_add_cancel f id⟩, rw add_left_eq_self; simp only [pi.add_apply] at h, conv at h { find (_ = _) { rw [← add_assoc, add_mul, ← add_assoc _ _ (x * y), add_left_inj, add_right_comm _ _ (g (x * y)), add_comm, add_right_inj, add_left_comm, ← add_assoc x, char_two.add_self_eq_zero, zero_add] } }, ---- Reduce into two equalities, then obtain `g(0) = 0` and `g(1) = 0` suffices : (∀ t : R, g (t + 1) * (t + 1) = g t * t) ∧ ∀ t : R, g (g t * t) = g t, { cases this with h0 h1, funext t, have h2 := h1 t, rw [← h0, h1] at h2, replace h0 := h0 t, rwa [h2, mul_add_one, add_right_eq_self] at h0 }, have h0 := h 1 1, rw [mul_one, mul_one, add_left_eq_self, char_two.add_self_eq_zero] at h0, have h1 := h 0 (g 0 + 1), rw [zero_mul, zero_add, h0, zero_add, h0, zero_add, mul_add_one, self_eq_add_left, ← sq] at h1, replace h1 := pow_eq_zero h1, rw [h1, zero_add] at h0, refine ⟨λ t, _, λ t, _⟩, ---- The first equality { replace h : ∀ t : R, g (t + 1) + g (t * (t + 1)) = g t * (t + 1) := λ t, by convert h t (t + 1) using 2; rw [← add_assoc t, char_two.add_self_eq_zero, zero_add, h0, zero_add], replace h0 := h (t + 1), rw [add_assoc, char_two.add_self_eq_zero, add_zero] at h0, rw [mul_add_one, ← h0, add_one_mul, ← mul_add_one, add_assoc, add_comm (g (t * _)), h, mul_add_one, add_left_comm, char_two.add_self_eq_zero, add_zero] }, ---- The second equality { replace h0 := h t 0, rw [add_zero, add_zero, mul_zero, h1, add_zero, mul_zero] at h0, have h2 := h 0 t, rw [zero_add, zero_mul, h1, zero_mul, add_zero] at h2, replace h1 := h (g t) t, rw [h2, zero_add, h0, zero_mul, add_eq_zero_iff_eq_neg, char_two.neg_eq] at h1, exact h1.symm } end /-- Final solution -/ theorem final_solution {R : Type*} [ring R] [is_domain R] : ∀ f : R → R, good f ↔ f = (λ x, x) ∨ f = (λ x, 2 - x) := begin cases ne_or_eq (ring_char R) 2 with h h, exact final_solution_char_ne_two h, haveI : char_p R 2 := ring_char.of_eq h, simp only [char_two.two_eq_zero, char_two.sub_eq_add, zero_add, or_self], exact final_solution_char_eq_two end end IMO2015A4 end IMOSL
# # usage: Read(Filename(home_dir,"load.gap")); # # # Polynomials, Root system, Parabolic rootsystems # Read(Filename(home_dir,"lib/poly.gd")); Read(Filename(home_dir,"lib/rsys.gd")); Read(Filename(home_dir,"lib/psys.gd")); # # # Read(Filename(home_dir,"lib/chvadj.gd")); Read(Filename(home_dir,"lib/nilchv.gd")); Read(Filename(home_dir,"lib/unichv.gd")); Read(Filename(home_dir,"lib/unimod.gd")); # # # Read(Filename(home_dir,"lib/algU.gd")); Read(Filename(home_dir,"lib/witt.gd")); Read(Filename(home_dir,"lib/unialg.gd")); Read(Filename(home_dir,"lib/unicls.gd")); # # IMPLEMENTATION # Read(Filename(home_dir,"lib/poly.gi")); Read(Filename(home_dir,"lib/rsys.gi")); Read(Filename(home_dir,"lib/psys.gi")); Read(Filename(home_dir,"lib/chvadj.gi")); Read(Filename(home_dir,"lib/nilchv.gi")); Read(Filename(home_dir,"lib/unichv.gi")); Read(Filename(home_dir,"lib/unimod.gi")); Read(Filename(home_dir,"lib/algU.gi")); Read(Filename(home_dir,"lib/witt.gi")); Read(Filename(home_dir,"lib/unialg.gi")); Read(Filename(home_dir,"lib/unicls.gi"));
British band The Magic Numbers performed " Crazy in Love " on the Australian radio station Triple J , and recorded it for the 2007 Starbucks ( Hear Music ) compilation album , Sounds Eclectic : The Covers Project . Tracy Bonham covered the song with guitar and violin accompaniment , for her 2007 album In The City + In The Woods . British close harmony trio The <unk> Sisters covered " Crazy in Love " for their 2007 album The Rise and Fall of Ruby Woo ; this was remixed by the electronica jazz outfit The Real Tuesday Weld . Indie artist <unk> recorded an electronic cover of the song . In 2009 , Pattern Is Movement recorded a cover of " Crazy in Love " , which they claimed was inspired by Anohni 's version ; this cover was included on their 4 / 9 / 2009 Daytrotter session . Antony and the Johnsons released an orchestral version of the song as the b @-@ side to their 2009 single " Aeon " .
section \<open>Symbol sequence operations\<close> theory Symbol_Ops imports Two_Four_Symbols begin text \<open> While previous sections have focused on ``formatted'' symbol sequences for numbers and lists, in this section we devise some Turing machines dealing with ``unstructured'' arbitrary symbol sequences. The only ``structure'' that is often imposed is that of not containing a blank symbol because when reading a symbol sequence, say from the input tape, a blank would signal the end of the symbol sequence. \<close> subsection \<open>Checking for being over an alphabet\<close> text \<open> In this section we devise a Turing machine that checks if a proper symbol sequence is over a given alphabet represented by an upper bound symbol $z$. \<close> abbreviation proper_symbols_lt :: "symbol \<Rightarrow> symbol list \<Rightarrow> bool" where "proper_symbols_lt z zs \<equiv> proper_symbols zs \<and> symbols_lt z zs" text \<open> The next Turing machine checks if the symbol sequence (up until the first blank) on tape $j_1$ contains only symbols from $\{2, \dots, z - 1\}$, where $z$ is a parameter of the TM, and writes to tape $j_2$ the number~1 or~0, representing True or False, respectively. It assumes that $j_2$ initially contains at most one symbol. \<close> definition tm_proper_symbols_lt :: "tapeidx \<Rightarrow> tapeidx \<Rightarrow> symbol \<Rightarrow> machine" where "tm_proper_symbols_lt j1 j2 z \<equiv> tm_write j2 \<one> ;; WHILE [] ; \<lambda>rs. rs ! j1 \<noteq> \<box> DO IF \<lambda>rs. rs ! j1 < 2 \<or> rs ! j1 \<ge> z THEN tm_write j2 \<box> ELSE [] ENDIF ;; tm_right j1 DONE ;; tm_cr j1" lemma tm_proper_symbols_lt_tm: assumes "0 < j2" "j1 < k" "j2 < k" and "G \<ge> 4" shows "turing_machine k G (tm_proper_symbols_lt j1 j2 z)" using assms tm_write_tm tm_right_tm tm_cr_tm Nil_tm tm_proper_symbols_lt_def turing_machine_loop_turing_machine turing_machine_branch_turing_machine by simp locale turing_machine_proper_symbols_lt = fixes j1 j2 :: tapeidx and z :: symbol begin definition "tm1 \<equiv> tm_write j2 \<one>" definition "tm2 \<equiv> IF \<lambda>rs. rs ! j1 < 2 \<or> rs ! j1 \<ge> z THEN tm_write j2 \<box> ELSE [] ENDIF" definition "tm3 \<equiv> tm2 ;; tm_right j1" definition "tm4 \<equiv> WHILE [] ; \<lambda>rs. rs ! j1 \<noteq> \<box> DO tm3 DONE" definition "tm5 \<equiv> tm1 ;; tm4" definition "tm6 \<equiv> tm5 ;; tm_cr j1" lemma tm6_eq_tm_proper_symbols_lt: "tm6 = tm_proper_symbols_lt j1 j2 z" unfolding tm6_def tm5_def tm4_def tm3_def tm2_def tm1_def tm_proper_symbols_lt_def by simp context fixes zs :: "symbol list" and tps0 :: "tape list" and k :: nat assumes jk: "k = length tps0" "j1 \<noteq> j2" "j1 < k" "j2 < k" and zs: "proper_symbols zs" and tps0: "tps0 ! j1 = (\<lfloor>zs\<rfloor>, 1)" "tps0 ! j2 = (\<lfloor>[]\<rfloor>, 1)" begin definition "tps1 t \<equiv> tps0 [j1 := (\<lfloor>zs\<rfloor>, Suc t), j2 := (if proper_symbols_lt z (take t zs) then \<lfloor>[\<one>]\<rfloor> else \<lfloor>[]\<rfloor>, 1)]" lemma tm1 [transforms_intros]: "transforms tm1 tps0 1 (tps1 0)" unfolding tm1_def proof (tform tps: jk tps0) have "(if proper_symbols_lt z (take 0 zs) then \<lfloor>[\<one>]\<rfloor> else \<lfloor>[]\<rfloor>, 1) = (\<lfloor>[\<one>]\<rfloor>, 1)" by simp moreover have "tps0 ! j2 |:=| \<one> = (\<lfloor>[\<one>]\<rfloor>, 1)" using tps0(2) contents_def by auto moreover have "tps0[j1 := (\<lfloor>zs\<rfloor>, Suc 0)] = tps0" using tps0(1) by (metis One_nat_def list_update_id) ultimately show "tps1 0 = tps0[j2 := tps0 ! j2 |:=| \<one>]" unfolding tps1_def by auto qed definition "tps2 t \<equiv> tps0 [j1 := (\<lfloor>zs\<rfloor>, Suc t), j2 := (if proper_symbols_lt z (take (Suc t) zs) then \<lfloor>[\<one>]\<rfloor> else \<lfloor>[]\<rfloor>, 1)]" lemma tm2 [transforms_intros]: assumes "t < length zs" shows "transforms tm2 (tps1 t) 3 (tps2 t)" unfolding tm2_def proof (tform tps: jk tps1_def) have "tps1 t ! j1 = (\<lfloor>zs\<rfloor>, Suc t)" using tps1_def jk by simp moreover have "read (tps1 t) ! j1 = tps1 t :.: j1" using tapes_at_read' jk tps1_def by (metis (no_types, lifting) length_list_update) ultimately have *: "read (tps1 t) ! j1 = zs ! t" using contents_inbounds assms(1) by simp have j2: "tps1 t ! j2 = (if proper_symbols_lt z (take t zs) then \<lfloor>[\<one>]\<rfloor> else \<lfloor>[]\<rfloor>, 1)" using tps1_def jk by simp show "tps2 t = (tps1 t)[j2 := tps1 t ! j2 |:=| \<box>]" if "read (tps1 t) ! j1 < 2 \<or> z \<le> read (tps1 t) ! j1" proof - have c3: "(\<lfloor>[\<one>]\<rfloor>, 1) |:=| \<box> = (\<lfloor>[]\<rfloor>, 1)" using contents_def by auto have "(if proper_symbols_lt z (take t zs) then \<lfloor>[\<one>]\<rfloor> else \<lfloor>[]\<rfloor>, 1) |:=| \<box> = (if proper_symbols_lt z (take (Suc t) zs) then \<lfloor>[\<one>]\<rfloor> else \<lfloor>[]\<rfloor>, 1)" proof (cases "proper_symbols_lt z (take t zs)") case True have "zs ! t < 2 \<or> z \<le> zs ! t" using that * by simp then have "\<not> proper_symbols_lt z (take (Suc t) zs)" using assms(1) by auto then show ?thesis using c3 by auto next case False then have "\<not> proper_symbols_lt z (take (Suc t) zs)" by auto then show ?thesis using c3 False by auto qed then have "tps1 t ! j2 |:=| \<box> = (if proper_symbols_lt z (take (Suc t) zs) then \<lfloor>[\<one>]\<rfloor> else \<lfloor>[]\<rfloor>, 1)" using j2 by simp then show "tps2 t = (tps1 t)[j2 := tps1 t ! j2 |:=| \<box>]" unfolding tps2_def tps1_def using c3 jk(1,4) by simp qed show "tps2 t = tps1 t" if "\<not> (read (tps1 t) ! j1 < 2 \<or> z \<le> read (tps1 t) ! j1)" proof - have 1: "zs ! t \<ge> 2 \<and> z > zs ! t" using that * by simp show "tps2 t = tps1 t" proof (cases "proper_symbols_lt z (take t zs)") case True have "proper_symbols_lt z (take (Suc t) zs)" using True 1 assms(1) zs by (metis length_take less_antisym min_less_iff_conj nth_take) then show ?thesis using tps1_def tps2_def jk by simp next case False then have "\<not> proper_symbols_lt z (take (Suc t) zs)" by auto then show ?thesis using tps1_def tps2_def jk False by auto qed qed qed lemma tm3 [transforms_intros]: assumes "t < length zs" shows "transforms tm3 (tps1 t) 4 (tps1 (Suc t))" unfolding tm3_def proof (tform tps: assms jk tps2_def) have "tps2 t ! j1 |+| 1 = (\<lfloor>zs\<rfloor>, Suc (Suc t))" using tps2_def jk by simp then show "tps1 (Suc t) = (tps2 t)[j1 := tps2 t ! j1 |+| 1]" unfolding tps1_def tps2_def by (metis (no_types, lifting) jk(2) list_update_overwrite list_update_swap) qed lemma tm4 [transforms_intros]: assumes "ttt = 1 + 6 * length zs" shows "transforms tm4 (tps1 0) ttt (tps1 (length zs))" unfolding tm4_def proof (tform time: assms) show "read (tps1 t) ! j1 \<noteq> \<box>" if "t < length zs" for t proof - have "tps1 t ! j1 = (\<lfloor>zs\<rfloor>, Suc t)" using tps1_def jk by simp moreover have "read (tps1 t) ! j1 = tps1 t :.: j1" using tapes_at_read' jk tps1_def by (metis (no_types, lifting) length_list_update) ultimately have "read (tps1 t) ! j1 = zs ! t" using contents_inbounds that by simp then show ?thesis using zs that by auto qed show "\<not> read (tps1 (length zs)) ! j1 \<noteq> \<box>" proof - have "tps1 (length zs) ! j1 = (\<lfloor>zs\<rfloor>, Suc (length zs))" using tps1_def jk by simp moreover have "read (tps1 (length zs)) ! j1 = tps1 (length zs) :.: j1" using tapes_at_read' jk tps1_def by (metis (no_types, lifting) length_list_update) ultimately show ?thesis by simp qed qed lemma tm5 [transforms_intros]: assumes "ttt = 2 + 6 * length zs" shows "transforms tm5 tps0 ttt (tps1 (length zs))" unfolding tm5_def by (tform time: assms) definition "tps5 \<equiv> tps0 [j1 := (\<lfloor>zs\<rfloor>, 1), j2 := (if proper_symbols_lt z zs then \<lfloor>[\<one>]\<rfloor> else \<lfloor>[]\<rfloor>, 1)]" definition "tps5' \<equiv> tps0 [j2 := (if proper_symbols_lt z zs then \<lfloor>[\<one>]\<rfloor> else \<lfloor>[]\<rfloor>, 1)]" lemma tm6: assumes "ttt = 5 + 7 * length zs" shows "transforms tm6 tps0 ttt tps5'" unfolding tm6_def proof (tform time: assms tps1_def jk) have *: "tps1 (length zs) ! j1 = (\<lfloor>zs\<rfloor>, Suc (length zs))" using tps1_def jk by simp show "clean_tape (tps1 (length zs) ! j1)" using * zs by simp have "tps5 = (tps1 (length zs))[j1 := (\<lfloor>zs\<rfloor>, Suc (length zs)) |#=| 1]" unfolding tps5_def tps1_def by (simp add: list_update_swap[OF jk(2)]) then have "tps5 = (tps1 (length zs))[j1 := tps1 (length zs) ! j1 |#=| 1]" using * by simp moreover have "tps5' = tps5" using tps5'_def tps5_def tps0 jk by (metis list_update_id) ultimately show "tps5' = (tps1 (length zs))[j1 := tps1 (length zs) ! j1 |#=| 1]" by simp qed definition "tps6 \<equiv> tps0 [j2 := (\<lfloor>proper_symbols_lt z zs\<rfloor>\<^sub>B, 1)]" lemma tm6': assumes "ttt = 5 + 7 * length zs" shows "transforms tm6 tps0 ttt tps6" proof - have "tps6 = tps5'" using tps6_def tps5'_def canrepr_0 canrepr_1 by auto then show ?thesis using tm6 assms by simp qed end end (* locale *) lemma transforms_tm_proper_symbols_ltI [transforms_intros]: fixes j1 j2 :: tapeidx and z :: symbol fixes zs :: "symbol list" and tps tps' :: "tape list" and k :: nat assumes "k = length tps" "j1 \<noteq> j2" "j1 < k" "j2 < k" and "proper_symbols zs" assumes "tps ! j1 = (\<lfloor>zs\<rfloor>, 1)" "tps ! j2 = (\<lfloor>[]\<rfloor>, 1)" assumes "ttt = 5 + 7 * length zs" assumes "tps' = tps [j2 := (\<lfloor>proper_symbols_lt z zs\<rfloor>\<^sub>B, 1)]" shows "transforms (tm_proper_symbols_lt j1 j2 z) tps ttt tps'" proof - interpret loc: turing_machine_proper_symbols_lt j1 j2 . show ?thesis using assms loc.tm6_eq_tm_proper_symbols_lt loc.tps6_def loc.tm6' by simp qed subsection \<open>The length of the input\<close> text \<open> The Turing machine in this section reads the input tape until the first blank and increments a counter on tape $j$ for every symbol read. In the end it performs a carriage return on the input tape, and tape $j$ contains the length of the input as binary number. For this to work, tape $j$ must initially be empty. \<close> lemma proper_tape_read: assumes "proper_symbols zs" shows "|.| (\<lfloor>zs\<rfloor>, i) = \<box> \<longleftrightarrow> i > length zs" proof - have "|.| (\<lfloor>zs\<rfloor>, i) = \<box>" if "i > length zs" for i using that contents_outofbounds by simp moreover have "|.| (\<lfloor>zs\<rfloor>, i) \<noteq> \<box>" if "i \<le> length zs" for i using that contents_inbounds assms contents_def proper_symbols_ne0 by simp ultimately show ?thesis by (meson le_less_linear) qed definition tm_length_input :: "tapeidx \<Rightarrow> machine" where "tm_length_input j \<equiv> WHILE [] ; \<lambda>rs. rs ! 0 \<noteq> \<box> DO tm_incr j ;; tm_right 0 DONE ;; tm_cr 0" lemma tm_length_input_tm: assumes "G \<ge> 4" and "0 < j" and "j < k" shows "turing_machine k G (tm_length_input j)" using tm_length_input_def tm_incr_tm assms Nil_tm tm_right_tm tm_cr_tm by (simp add: turing_machine_loop_turing_machine) locale turing_machine_length_input = fixes j :: tapeidx begin definition "tmL1 \<equiv> tm_incr j" definition "tmL2 \<equiv> tmL1 ;; tm_right 0" definition "tm1 \<equiv> WHILE [] ; \<lambda>rs. rs ! 0 \<noteq> \<box> DO tmL2 DONE" definition "tm2 \<equiv> tm1 ;; tm_cr 0" lemma tm2_eq_tm_length_input: "tm2 = tm_length_input j" unfolding tm2_def tm1_def tmL2_def tmL1_def tm_length_input_def by simp context fixes tps0 :: "tape list" and k :: nat and zs :: "symbol list" assumes jk: "0 < j" "j < k" "length tps0 = k" and zs: "proper_symbols zs" and tps0: "tps0 ! 0 = (\<lfloor>zs\<rfloor>, 1)" "tps0 ! j = (\<lfloor>0\<rfloor>\<^sub>N, 1)" begin definition tpsL :: "nat \<Rightarrow> tape list" where "tpsL t \<equiv> tps0[0 := (\<lfloor>zs\<rfloor>, 1 + t), j := (\<lfloor>t\<rfloor>\<^sub>N, 1)]" lemma tpsL_eq_tps0: "tpsL 0 = tps0" using tpsL_def tps0 jk by (metis One_nat_def list_update_id plus_1_eq_Suc) definition tpsL1 :: "nat \<Rightarrow> tape list" where "tpsL1 t \<equiv> tps0[0 := (\<lfloor>zs\<rfloor>, 1 + t), j := (\<lfloor>Suc t\<rfloor>\<^sub>N, 1)]" definition tpsL2 :: "nat \<Rightarrow> tape list" where "tpsL2 t \<equiv> tps0[0 := (\<lfloor>zs\<rfloor>, 1 + Suc t), j := (\<lfloor>Suc t\<rfloor>\<^sub>N, 1)]" lemma tmL1 [transforms_intros]: assumes "t < length zs" and "ttt = 5 + 2 * nlength t" shows "transforms tmL1 (tpsL t) ttt (tpsL1 t)" unfolding tmL1_def by (tform tps: assms(1) tpsL_def tpsL1_def tps0 jk time: assms(2)) lemma tmL2: assumes "t < length zs" and "ttt = 6 + 2 * nlength t" shows "transforms tmL2 (tpsL t) ttt (tpsL (Suc t))" unfolding tmL2_def proof (tform tps: assms(1) tpsL_def tpsL1_def tps0 jk time: assms(2)) have "tpsL1 t ! 0 = (\<lfloor>zs\<rfloor>, 1 + t)" using tpsL2_def tpsL1_def jk tps0 by simp then have "tpsL2 t = (tpsL1 t)[0 := tpsL1 t ! 0 |#=| Suc (tpsL1 t :#: 0)]" using tpsL2_def tpsL1_def jk tps0 by (smt (z3) fstI list_update_overwrite list_update_swap nat_neq_iff plus_1_eq_Suc prod.sel(2)) then show "tpsL (Suc t) = (tpsL1 t)[0 := tpsL1 t ! 0 |+| 1]" using tpsL2_def tpsL_def tpsL1_def jk tps0 by simp qed lemma tmL2': assumes "t < length zs" and "ttt = 6 + 2 * nlength (length zs)" shows "transforms tmL2 (tpsL t) ttt (tpsL (Suc t))" proof - have "6 + 2 * nlength t \<le> 6 + 2 * nlength (length zs)" using assms(1) nlength_mono by simp then show ?thesis using assms tmL2 transforms_monotone by blast qed lemma tm1: assumes "ttt = length zs * (8 + 2 * nlength (length zs)) + 1" shows "transforms tm1 (tpsL 0) ttt (tpsL (length zs))" unfolding tm1_def proof (tform) let ?t = "6 + 2 * nlength (length zs)" show "\<And>t. t < length zs \<Longrightarrow> transforms tmL2 (tpsL t) ?t (tpsL (Suc t))" using tmL2' by simp have *: "tpsL t ! 0 = (\<lfloor>zs\<rfloor>, Suc t)" for t using tpsL_def jk by simp then show "\<And>t. t < length zs \<Longrightarrow> read (tpsL t) ! 0 \<noteq> \<box>" using proper_tape_read[OF zs] tpsL_def jk tapes_at_read' by (metis length_list_update less_Suc_eq_0_disj not_less_eq) show "\<not> read (tpsL (length zs)) ! 0 \<noteq> \<box>" using proper_tape_read[OF zs] tpsL_def jk tapes_at_read' * by (metis length_list_update less_Suc_eq_0_disj less_imp_Suc_add nat_neq_iff not_less_less_Suc_eq) show "length zs * (6 + 2 * nlength (length zs) + 2) + 1 \<le> ttt" using assms by simp qed lemma tmL' [transforms_intros]: assumes "ttt = 10 * length zs ^ 2 + 1" shows "transforms tm1 (tpsL 0) ttt (tpsL (length zs))" proof - let ?ttt = "length zs * (8 + 2 * nlength (length zs)) + 1" have "?ttt \<le> length zs * (8 + 2 * length zs) + 1" using nlength_le_n by simp also have "... \<le> 8 * length zs + 2 * length zs ^ 2 + 1" by (simp add: add_mult_distrib2 power2_eq_square) also have "... \<le> 10 * length zs ^ 2 + 1" using linear_le_pow by simp finally have "?ttt \<le> 10 * length zs ^ 2 + 1" . then show ?thesis using tm1 assms transforms_monotone by simp qed definition tps2 :: "tape list" where "tps2 \<equiv> tps0[0 := (\<lfloor>zs\<rfloor>, 1), j := (\<lfloor>length zs\<rfloor>\<^sub>N, 1)]" lemma tm2: assumes "ttt = 10 * length zs ^ 2 + length zs + 4" shows "transforms tm2 (tpsL 0) ttt tps2" unfolding tm2_def proof (tform time: assms tpsL_def jk tps: tpsL_def tpsL1_def tps0 jk) show "clean_tape (tpsL (length zs) ! 0)" using tpsL_def jk clean_contents_proper[OF zs] by simp have "tpsL (length zs) ! 0 = (\<lfloor>zs\<rfloor>, Suc (length zs))" using tpsL_def jk by simp then show "tps2 = (tpsL (length zs))[0 := tpsL (length zs) ! 0 |#=| 1]" using tps2_def tpsL_def jk by (simp add: list_update_swap_less) qed definition tps2' :: "tape list" where "tps2' \<equiv> tps0[j := (\<lfloor>length zs\<rfloor>\<^sub>N, 1)]" lemma tm2': assumes "ttt = 11 * length zs ^ 2 + 4" shows "transforms tm2 tps0 ttt tps2'" proof - have "10 * length zs ^ 2 + length zs + 4 \<le> ttt" using assms linear_le_pow[of 2 "length zs"] by simp moreover have "tps2 = tps2'" using tps2_def tps2'_def jk tps0 by (metis list_update_id) ultimately show ?thesis using transforms_monotone tm2 tpsL_eq_tps0 by simp qed end end lemma transforms_tm_length_inputI [transforms_intros]: fixes j :: tapeidx fixes tps tps' :: "tape list" and k :: nat and zs :: "symbol list" assumes "0 < j" "j < k" "length tps = k" and "proper_symbols zs" assumes "tps ! 0 = (\<lfloor>zs\<rfloor>, 1)" "tps ! j = (\<lfloor>0\<rfloor>\<^sub>N, 1)" assumes "ttt = 11 * length zs ^ 2 + 4" assumes "tps' = tps [j := (\<lfloor>length zs\<rfloor>\<^sub>N, 1)]" shows "transforms (tm_length_input j) tps ttt tps'" proof - interpret loc: turing_machine_length_input j . show ?thesis using loc.tm2' loc.tps2'_def loc.tm2_eq_tm_length_input assms by simp qed subsection \<open>Whether the length is even\<close> text \<open> The next Turing machines reads the symbols on tape $j_1$ until the first blank and alternates between numbers~0 and~1 on tape $j_2$. Then tape $j_2$ contains the parity of the length of the symbol sequence on tape $j_1$. Finally, the TM flips the output once more, so that tape $j_2$ contains a Boolean indicating whether the length was even or not. We assume tape $j_2$ is initially empty, that is, represents the number~0. \<close> definition tm_even_length :: "tapeidx \<Rightarrow> tapeidx \<Rightarrow> machine" where "tm_even_length j1 j2 \<equiv> WHILE [] ; \<lambda>rs. rs ! j1 \<noteq> \<box> DO tm_not j2 ;; tm_right j1 DONE ;; tm_not j2 ;; tm_cr j1" lemma tm_even_length_tm: assumes "k \<ge> 2" and "G \<ge> 4" and "j1 < k" "0 < j2" "j2 < k" shows "turing_machine k G (tm_even_length j1 j2)" using tm_even_length_def tm_right_tm tm_not_tm Nil_tm assms tm_cr_tm turing_machine_loop_turing_machine by simp locale turing_machine_even_length = fixes j1 j2 :: tapeidx begin definition "tmB \<equiv> tm_not j2 ;; tm_right j1" definition "tmL \<equiv> WHILE [] ; \<lambda>rs. rs ! j1 \<noteq> \<box> DO tmB DONE" definition "tm2 \<equiv> tmL ;; tm_not j2" definition "tm3 \<equiv> tm2 ;; tm_cr j1" lemma tm3_eq_tm_even_length: "tm3 = tm_even_length j1 j2" unfolding tm3_def tm2_def tmL_def tmB_def tm_even_length_def by simp context fixes tps0 :: "tape list" and k :: nat and zs :: "symbol list" assumes zs: "proper_symbols zs" assumes jk: "j1 < k" "j2 < k" "j1 \<noteq> j2" "length tps0 = k" assumes tps0: "tps0 ! j1 = (\<lfloor>zs\<rfloor>, 1)" "tps0 ! j2 = (\<lfloor>0\<rfloor>\<^sub>N, 1)" begin definition tpsL :: "nat \<Rightarrow> tape list" where "tpsL t \<equiv> tps0 [j1 := (\<lfloor>zs\<rfloor>, Suc t), j2 := (\<lfloor>odd t\<rfloor>\<^sub>B, 1)]" lemma tpsL0: "tpsL 0 = tps0" unfolding tpsL_def using tps0 jk by (metis (mono_tags, opaque_lifting) One_nat_def even_zero list_update_id) lemma tmL2 [transforms_intros]: "transforms tmB (tpsL t) 4 (tpsL (Suc t))" unfolding tmB_def proof (tform tps: tpsL_def jk) have "(tpsL t) [j2 := (\<lfloor>(if odd t then 1 else 0 :: nat) \<noteq> 1\<rfloor>\<^sub>B, 1), j1 := (tpsL t)[j2 := (\<lfloor> (if odd t then 1 else 0 :: nat) \<noteq> 1 \<rfloor>\<^sub>B, 1)] ! j1 |+| 1] = (tpsL t) [j2 := (\<lfloor>odd (Suc t)\<rfloor>\<^sub>B, 1), j1 := (tpsL t) ! j1 |+| 1]" using jk by simp also have "... = (tpsL t) [j2 := (\<lfloor>odd (Suc t)\<rfloor>\<^sub>B, 1), j1 := (\<lfloor>zs\<rfloor>, Suc (Suc t))]" using tpsL_def jk by simp also have "... = (tpsL t) [j1 := (\<lfloor>zs\<rfloor>, Suc (Suc t)), j2 := (\<lfloor>odd (Suc t)\<rfloor>\<^sub>B, 1)]" using jk by (simp add: list_update_swap) also have "... = tps0 [j1 := (\<lfloor>zs\<rfloor>, Suc (Suc t)), j2 := (\<lfloor>odd (Suc t)\<rfloor>\<^sub>B, 1)]" using jk tpsL_def by (simp add: list_update_swap) also have "... = tpsL (Suc t)" using tpsL_def by simp finally show "tpsL (Suc t) = (tpsL t) [j2 := (\<lfloor>(if odd t then 1 else 0 :: nat) \<noteq> 1\<rfloor>\<^sub>B, 1), j1 := (tpsL t)[j2 := (\<lfloor>(if odd t then 1 else 0 :: nat) \<noteq> 1\<rfloor>\<^sub>B, 1)] ! j1 |+| 1]" by simp qed lemma tmL: assumes "ttt = 6 * length zs + 1" shows "transforms tmL (tpsL 0) ttt (tpsL (length zs))" unfolding tmL_def proof (tform time: assms) have "read (tpsL t) ! j1 = tpsL t :.: j1" for t using tpsL_def tapes_at_read' jk by (metis (no_types, lifting) length_list_update) then have "read (tpsL t) ! j1 = \<lfloor>zs\<rfloor> (Suc t)" for t using tpsL_def jk by simp then show "\<And>t. t < length zs \<Longrightarrow> read (tpsL t) ! j1 \<noteq> \<box>" and "\<not> read (tpsL (length zs)) ! j1 \<noteq> \<box>" using zs by auto qed lemma tmL' [transforms_intros]: assumes "ttt = 6 * length zs + 1" shows "transforms tmL tps0 ttt (tpsL (length zs))" using assms tmL tpsL0 by simp definition tps2 :: "tape list" where "tps2 \<equiv> tps0 [j1 := (\<lfloor>zs\<rfloor>, Suc (length zs)), j2 := (\<lfloor>even (length zs) \<rfloor>\<^sub>B, 1)]" lemma tm2 [transforms_intros]: assumes "ttt = 6 * length zs + 4" shows "transforms tm2 tps0 ttt tps2" unfolding tm2_def proof (tform tps: tpsL_def jk time: assms) show "tps2 = (tpsL (length zs))[j2 := (\<lfloor>(if odd (length zs) then 1 else 0 :: nat) \<noteq> 1\<rfloor>\<^sub>B, 1)]" unfolding tps2_def tpsL_def by (simp add: list_update_swap) qed definition tps3 :: "tape list" where "tps3 \<equiv> tps0 [j1 := (\<lfloor>zs\<rfloor>, 1), j2 := (\<lfloor>even (length zs)\<rfloor>\<^sub>B, 1)]" lemma tm3: assumes "ttt = 7 * length zs + 7" shows "transforms tm3 tps0 ttt tps3" unfolding tm3_def proof (tform tps: tps2_def jk time: assms) show "clean_tape (tps2 ! j1)" using tps2_def jk zs clean_contents_proper by simp have "tps2 ! j1 |#=| 1 = (\<lfloor>zs\<rfloor>, 1)" using tps2_def jk by simp then show "tps3 = tps2[j1 := tps2 ! j1 |#=| 1]" unfolding tps3_def tps2_def using jk by (simp add: list_update_swap) show "ttt = 6 * length zs + 4 + (tps2 :#: j1 + 2)" using assms tps2_def jk by simp qed definition tps3' :: "tape list" where "tps3' \<equiv> tps0 [j2 := (\<lfloor>even (length zs)\<rfloor>\<^sub>B, 1)]" lemma tps3': "tps3' = tps3" using tps3'_def tps3_def tps0 by (metis list_update_id) lemma tm3': assumes "ttt = 7 * length zs + 7" shows "transforms tm3 tps0 ttt tps3'" using tps3' tm3 assms by simp end (* context *) end (* locale *) lemma transforms_tm_even_lengthI [transforms_intros]: fixes j1 j2 :: tapeidx fixes tps tps' :: "tape list" and k :: nat and zs :: "symbol list" assumes "j1 < k" "j2 < k" "j1 \<noteq> j2" and "proper_symbols zs" and "length tps = k" assumes "tps ! j1 = (\<lfloor>zs\<rfloor>, 1)" "tps ! j2 = (\<lfloor>0\<rfloor>\<^sub>N, 1)" assumes "tps' = tps [j2 := (\<lfloor>even (length zs)\<rfloor>\<^sub>B, 1)]" assumes "ttt = 7 * length zs + 7" shows "transforms (tm_even_length j1 j2) tps ttt tps'" proof - interpret loc: turing_machine_even_length j1 j2 . show ?thesis using assms loc.tps3'_def loc.tm3' loc.tm3_eq_tm_even_length by simp qed subsection \<open>Checking for ends-with or empty\<close> text \<open> The next Turing machine implements a slightly idiosyncratic operation that we use in the next section for checking if a symbol sequence represents a list of numbers. The operation consists in checking if the symbol sequence on tape $j_1$ either is empty or ends with the symbol $z$, which is another parameter of the TM. If the condition is met, the number~1 is written to tape $j_2$, otherwise the number~0. \<close> definition tm_empty_or_endswith :: "tapeidx \<Rightarrow> tapeidx \<Rightarrow> symbol \<Rightarrow> machine" where "tm_empty_or_endswith j1 j2 z \<equiv> tm_right_until j1 {\<box>} ;; tm_left j1 ;; IF \<lambda>rs. rs ! j1 \<in> {\<triangleright>, z} THEN tm_setn j2 1 ELSE [] ENDIF ;; tm_cr j1" lemma tm_empty_or_endswith_tm: assumes "k \<ge> 2" and "G \<ge> 4" and "0 < j2" and "j1 < k" and "j2 < k" shows "turing_machine k G (tm_empty_or_endswith j1 j2 z)" using assms Nil_tm tm_right_until_tm tm_left_tm tm_setn_tm tm_cr_tm turing_machine_branch_turing_machine tm_empty_or_endswith_def by simp locale turing_machine_empty_or_endswith = fixes j1 j2 :: tapeidx and z :: symbol begin definition "tm1 \<equiv> tm_right_until j1 {\<box>}" definition "tm2 \<equiv> tm1 ;; tm_left j1" definition "tmI \<equiv> IF \<lambda>rs. rs ! j1 \<in> {\<triangleright>, z} THEN tm_setn j2 1 ELSE [] ENDIF" definition "tm3 \<equiv> tm2 ;; tmI" definition "tm4 \<equiv> tm3 ;; tm_cr j1" lemma tm4_eq_tm_empty_or_endswith: "tm4 = tm_empty_or_endswith j1 j2 z" unfolding tm4_def tm3_def tmI_def tm2_def tm1_def tm_empty_or_endswith_def by simp context fixes tps0 :: "tape list" and k :: nat and zs :: "symbol list" assumes jk: "j1 \<noteq> j2" "j1 < k" "j2 < k" "length tps0 = k" and zs: "proper_symbols zs" and tps0: "tps0 ! j1 = (\<lfloor>zs\<rfloor>, 1)" "tps0 ! j2 = (\<lfloor>0\<rfloor>\<^sub>N, 1)" begin definition tps1 :: "tape list" where "tps1 \<equiv> tps0 [j1 := (\<lfloor>zs\<rfloor>, Suc (length zs))]" lemma tm1 [transforms_intros]: assumes "ttt = Suc (length zs)" shows "transforms tm1 tps0 ttt tps1" unfolding tm1_def proof (tform time: assms tps: tps0 tps1_def jk) show "rneigh (tps0 ! j1) {0} (length zs)" proof (rule rneighI) show "(tps0 ::: j1) (tps0 :#: j1 + length zs) \<in> {0}" using tps0 by simp show "\<And>n'. n' < length zs \<Longrightarrow> (tps0 ::: j1) (tps0 :#: j1 + n') \<notin> {0}" using zs tps0 by auto qed qed definition tps2 :: "tape list" where "tps2 \<equiv> tps0 [j1 := (\<lfloor>zs\<rfloor>, length zs)]" lemma tm2 [transforms_intros]: assumes "ttt = 2 + length zs" shows "transforms tm2 tps0 ttt tps2" unfolding tm2_def by (tform time: assms tps: tps1_def tps2_def jk) definition tps3 :: "tape list" where "tps3 \<equiv> tps0 [j1 := (\<lfloor>zs\<rfloor>, length zs), j2 := (\<lfloor>zs = [] \<or> last zs = z\<rfloor>\<^sub>B, 1)]" lemma tmI [transforms_intros]: "transforms tmI tps2 14 tps3" unfolding tmI_def proof (tform tps: tps0 tps2_def jk) have *: "read tps2 ! j1 = \<lfloor>zs\<rfloor> (length zs)" using tps2_def jk tapes_at_read'[of j1 tps2] by simp show "tps3 = tps2[j2 := (\<lfloor>1\<rfloor>\<^sub>N, 1)]" if "read tps2 ! j1 \<in> {\<triangleright>, z}" proof - have "zs = [] \<or> last zs = z" using that * contents_inbounds zs by (metis diff_less dual_order.refl insert_iff last_conv_nth length_greater_0_conv proper_symbols_ne1 singletonD zero_less_one) then have "(if zs = [] \<or> last zs = z then 1 else 0) = 1" by simp then show ?thesis using tps2_def tps3_def jk by (smt (verit, best)) qed show "tps3 = tps2" if "read tps2 ! j1 \<notin> {\<triangleright>, z}" proof - have "\<not> (zs = [] \<or> last zs = z)" using that * contents_inbounds zs by (metis contents_at_0 dual_order.refl insertCI last_conv_nth length_greater_0_conv list.size(3)) then have "(if zs = [] \<or> last zs = z then 1 else 0) = 0" by simp then show ?thesis using tps2_def tps3_def jk tps0 by (smt (verit, best) list_update_id nth_list_update_neq) qed show "10 + 2 * nlength 0 + 2 * nlength 1 + 2 \<le> 14" using nlength_1_simp by simp qed lemma tm3 [transforms_intros]: assumes "ttt = 16 + length zs" shows "transforms tm3 tps0 ttt tps3" unfolding tm3_def by (tform tps: assms) definition tps4 :: "tape list" where "tps4 \<equiv> tps0 [j2 := (\<lfloor>zs = [] \<or> last zs = z\<rfloor>\<^sub>B, 1)]" lemma tm4: assumes "ttt = 18 + 2 * length zs" shows "transforms tm4 tps0 ttt tps4" unfolding tm4_def proof (tform time: assms tps3_def jk tps: tps3_def jk zs) have "tps3 ! j1 |#=| 1 = (\<lfloor>zs\<rfloor>, 1)" using tps3_def jk zs by simp then show "tps4 = tps3[j1 := tps3 ! j1 |#=| 1]" using tps4_def tps3_def jk tps0(1) by (metis list_update_id list_update_overwrite list_update_swap) qed end (* context *) end (* locale *) lemma transforms_tm_empty_or_endswithI [transforms_intros]: fixes j1 j2 :: tapeidx and z :: symbol fixes tps tps' :: "tape list" and k :: nat and zs :: "symbol list" assumes "j1 \<noteq> j2" "j1 < k" "j2 < k" and "length tps = k" and "proper_symbols zs" assumes "tps ! j1 = (\<lfloor>zs\<rfloor>, 1)" "tps ! j2 = (\<lfloor>0\<rfloor>\<^sub>N, 1)" assumes "ttt = 18 + 2 * length zs" assumes "tps' = tps [j2 := (\<lfloor>zs = [] \<or> last zs = z\<rfloor>\<^sub>B, 1)]" shows "transforms (tm_empty_or_endswith j1 j2 z) tps ttt tps'" proof - interpret loc: turing_machine_empty_or_endswith j1 j2 z . show ?thesis using assms loc.tps4_def loc.tm4 loc.tm4_eq_tm_empty_or_endswith by simp qed subsection \<open>Stripping trailing symbols\<close> text \<open> Stripping the symbol $z$ from the end of a symbol sequence @{term zs} means: \<close> definition rstrip :: "symbol \<Rightarrow> symbol list \<Rightarrow> symbol list" where "rstrip z zs \<equiv> take (LEAST i. i \<le> length zs \<and> set (drop i zs) \<subseteq> {z}) zs" lemma length_rstrip: "length (rstrip z zs) = (LEAST i. i \<le> length zs \<and> set (drop i zs) \<subseteq> {z})" using rstrip_def wellorder_Least_lemma[where ?P="\<lambda>i. i \<le> length zs \<and> set (drop i zs) \<subseteq> {z}"] by simp lemma length_rstrip_le: "length (rstrip z zs) \<le> length zs" using rstrip_def by simp lemma rstrip_stripped: assumes "i \<ge> length (rstrip z zs)" and "i < length zs" shows "zs ! i = z" proof - let ?P = "\<lambda>i. i \<le> length zs \<and> set (drop i zs) \<subseteq> {z}" have "?P (length zs)" by simp then have "?P i" using assms length_rstrip LeastI[where ?P="?P"] Least_le[where ?P="?P"] by (metis (mono_tags, lifting) dual_order.trans order_less_imp_le set_drop_subset_set_drop) then have "set (drop i zs) \<subseteq> {z}" by simp then show ?thesis using assms(2) by (metis Cons_nth_drop_Suc drop_eq_Nil2 leD list.set(2) set_empty singleton_insert_inj_eq subset_singletonD) qed lemma rstrip_replicate: "rstrip z (replicate n z) = []" using rstrip_def by (metis (no_types, lifting) Least_eq_0 empty_replicate set_drop_subset set_replicate take_eq_Nil zero_le) lemma rstrip_not_ex: assumes "\<not> (\<exists>i<length zs. zs ! i \<noteq> z)" shows "rstrip z zs = []" using assms rstrip_def by (metis in_set_conv_nth replicate_eqI rstrip_replicate) lemma assumes "\<exists>i<length zs. zs ! i \<noteq> z" shows rstrip_ex_length: "length (rstrip z zs) > 0" and rstrip_ex_last: "last (rstrip z zs) \<noteq> z" proof - let ?P = "\<lambda>i. i \<le> length zs \<and> set (drop i zs) \<subseteq> {z}" obtain i where i: "i < length zs" "zs ! i \<noteq> z" using assms by auto then have "\<not> set (drop i zs) \<subseteq> {z}" by (metis Cons_nth_drop_Suc drop_eq_Nil2 leD list.set(2) set_empty singleton_insert_inj_eq' subset_singletonD) then have "\<not> set (drop 0 zs) \<subseteq> {z}" by (metis drop.simps(1) drop_0 set_drop_subset set_empty subset_singletonD) then show len: "length (rstrip z zs) > 0" using length_rstrip by (metis (no_types, lifting) LeastI bot.extremum drop_all dual_order.refl gr0I list.set(1)) let ?j = "length (rstrip z zs) - 1" have 3: "?j < length (rstrip z zs)" using len by simp then have 4: "?j < Least ?P" using length_rstrip by simp have 5: "?P (length (rstrip z zs))" using LeastI_ex[of "?P"] length_rstrip by fastforce show "last (rstrip z zs) \<noteq> z" proof (rule ccontr) assume "\<not> last (rstrip z zs) \<noteq> z" then have "last (rstrip z zs) = z" by simp then have "rstrip z zs ! ?j = z" using len by (simp add: last_conv_nth) then have 2: "zs ! ?j = z" using len length_rstrip rstrip_def by auto have "?P ?j" proof - have "?j \<le> length zs" using 3 length_rstrip_le by (meson le_eq_less_or_eq order_less_le_trans) moreover have "set (drop ?j zs) \<subseteq> {z}" using 5 3 2 by (metis Cons_nth_drop_Suc One_nat_def Suc_pred insert_subset len list.simps(15) order_less_le_trans set_eq_subset) ultimately show ?thesis by simp qed then show False using 4 Least_le[of "?P"] by fastforce qed qed text \<open> A Turing machine stripping the non-blank, non-start symbol $z$ from a proper symbol sequence works in the obvious way. First it moves to the end of the symbol sequence, that is, to the first blank. Then it moves left to the first non-$z$ symbol thereby overwriting every symbol with a blank. Finally it performs a ``carriage return''. \<close> definition tm_rstrip :: "symbol \<Rightarrow> tapeidx \<Rightarrow> machine" where "tm_rstrip z j \<equiv> tm_right_until j {\<box>} ;; tm_left j ;; tm_lconst_until j j (UNIV - {z}) \<box> ;; tm_cr j" lemma tm_rstrip_tm: assumes "k \<ge> 2" and "G \<ge> 4" and "0 < j" and "j < k" shows "turing_machine k G (tm_rstrip z j)" using assms tm_right_until_tm tm_left_tm tm_lconst_until_tm tm_cr_tm tm_rstrip_def by simp locale turing_machine_rstrip = fixes z :: symbol and j :: tapeidx begin definition "tm1 \<equiv> tm_right_until j {\<box>}" definition "tm2 \<equiv> tm1 ;; tm_left j" definition "tm3 \<equiv> tm2 ;; tm_lconst_until j j (UNIV - {z}) \<box>" definition "tm4 \<equiv> tm3 ;; tm_cr j" lemma tm4_eq_tm_rstrip: "tm4 = tm_rstrip z j" unfolding tm4_def tm3_def tm2_def tm1_def tm_rstrip_def by simp context fixes tps0 :: "tape list" and zs :: "symbol list" and k :: nat assumes z: "z > 1" assumes zs: "proper_symbols zs" assumes jk: "0 < j" "j < k" "length tps0 = k" assumes tps0: "tps0 ! j = (\<lfloor>zs\<rfloor>, 1)" begin definition "tps1 \<equiv> tps0 [j := (\<lfloor>zs\<rfloor>, Suc (length zs))]" lemma tm1 [transforms_intros]: assumes "ttt = Suc (length zs)" shows "transforms tm1 tps0 ttt tps1" unfolding tm1_def proof (tform tps: tps0 tps1_def jk time: assms) have *: "tps0 ! j = (\<lfloor>zs\<rfloor>, 1)" using tps0 jk by simp show "rneigh (tps0 ! j) {\<box>} (length zs)" using * zs by (intro rneighI) auto qed definition "tps2 \<equiv> tps0 [j := (\<lfloor>zs\<rfloor>, length zs)]" lemma tm2 [transforms_intros]: assumes "ttt = length zs + 2" shows "transforms tm2 tps0 ttt tps2" unfolding tm2_def by (tform tps: tps1_def tps2_def jk time: assms) definition "tps3 \<equiv> tps0 [j := (\<lfloor>rstrip z zs\<rfloor>, length (rstrip z zs))]" lemma tm3 [transforms_intros]: assumes "ttt = length zs + 2 + Suc (length zs - length (rstrip z zs))" shows "transforms tm3 tps0 ttt tps3" unfolding tm3_def proof (tform tps: tps2_def tps3_def jk time: assms jk tps2_def) let ?n = "length zs - length (rstrip z zs)" have *: "tps2 ! j = (\<lfloor>zs\<rfloor>, length zs)" using tps2_def jk by simp show "lneigh (tps2 ! j) (UNIV - {z}) ?n" proof (cases "\<exists>i<length zs. zs ! i \<noteq> z") case True then have 1: "length (rstrip z zs) > 0" using rstrip_ex_length by simp show ?thesis proof (rule lneighI) show "(tps2 ::: j) (tps2 :#: j - ?n) \<in> UNIV - {z}" using * 1 contents_inbounds True length_rstrip length_rstrip_le rstrip_def rstrip_ex_last by (smt (verit, best) DiffI One_nat_def UNIV_I diff_diff_cancel diff_less fst_conv last_conv_nth le_eq_less_or_eq length_greater_0_conv less_Suc_eq_le nth_take singletonD snd_conv) have "\<And>n'. n' < ?n \<Longrightarrow> (tps2 ::: j) (tps2 :#: j - n') = z" using * rstrip_stripped by simp then show "\<And>n'. n' < ?n \<Longrightarrow> (tps2 ::: j) (tps2 :#: j - n') \<notin> UNIV - {z}" by simp qed next case False then have 1: "rstrip z zs = []" using rstrip_not_ex by simp show ?thesis proof (rule lneighI) show "(tps2 ::: j) (tps2 :#: j - ?n) \<in> UNIV - {z}" using * 1 z by simp show "\<And>n'. n' < ?n \<Longrightarrow> (tps2 ::: j) (tps2 :#: j - n') \<notin> UNIV - {z}" using * rstrip_stripped by simp qed qed have "lconstplant (\<lfloor>zs\<rfloor>, length zs) \<box> ?n = (\<lfloor>rstrip z zs\<rfloor>, length (rstrip z zs))" (is "?lhs = _") proof - have "?lhs = (\<lambda>i. if length zs - ?n < i \<and> i \<le> length zs then \<box> else \<lfloor>zs\<rfloor> i, length zs - ?n)" using lconstplant[of "(\<lfloor>zs\<rfloor>, length zs)" 0 "?n"] by auto moreover have "(\<lambda>i. if length zs - ?n < i \<and> i \<le> length zs then \<box> else \<lfloor>zs\<rfloor> i) = \<lfloor>rstrip z zs\<rfloor>" proof fix i consider "length zs - ?n < i \<and> i \<le> length zs" | "i > length zs" | "i \<le> length (rstrip z zs)" by linarith then show "(if length zs - ?n < i \<and> i \<le> length zs then \<box> else \<lfloor>zs\<rfloor> i) = \<lfloor>rstrip z zs\<rfloor> i" proof (cases) case 1 then show ?thesis by auto next case 2 then show ?thesis by (metis contents_outofbounds diff_diff_cancel length_rstrip_le less_imp_diff_less) next case 3 then show ?thesis using contents_def length_rstrip length_rstrip_le rstrip_def by auto qed qed moreover have "length zs - ?n = length (rstrip z zs)" using diff_diff_cancel length_rstrip_le by simp ultimately show ?thesis by simp qed then have "lconstplant (tps2 ! j) \<box> ?n = (\<lfloor>rstrip z zs\<rfloor>, length (rstrip z zs))" using tps2_def jk by simp then show "tps3 = tps2 [j := tps2 ! j |-| ?n, j := lconstplant (tps2 ! j) \<box> ?n]" unfolding tps3_def tps2_def by simp qed definition "tps4 \<equiv> tps0 [j := (\<lfloor>rstrip z zs\<rfloor>, 1)]" lemma tm4: assumes "ttt = length zs + 2 + Suc (length zs - length (rstrip z zs)) + length (rstrip z zs) + 2" shows "transforms tm4 tps0 ttt tps4" unfolding tm4_def proof (tform tps: tps3_def tps4_def jk time: assms tps3_def jk) show "clean_tape (tps3 ! j)" using tps3_def jk zs rstrip_def by simp qed lemma tm4': assumes "ttt = 3 * length zs + 5" shows "transforms tm4 tps0 ttt tps4" proof - let ?ttt = "length zs + 2 + Suc (length zs - length (rstrip z zs)) + length (rstrip z zs) + 2" have "?ttt = length zs + 5 + (length zs - length (rstrip z zs)) + length (rstrip z zs)" by simp also have "... \<le> length zs + 5 + length zs + length (rstrip z zs)" by simp also have "... \<le> length zs + 5 + length zs + length zs" using length_rstrip_le by simp also have "... = 3 * length zs + 5" by simp finally have "?ttt \<le> 3 * length zs + 5" . then show ?thesis using assms transforms_monotone tm4 by simp qed end (* context *) end (* locale *) lemma transforms_tm_rstripI [transforms_intros]: fixes z :: symbol and j :: tapeidx fixes tps tps' :: "tape list" and zs :: "symbol list" and k :: nat assumes "z > 1" and "0 < j" "j < k" and "proper_symbols zs" and "length tps = k" assumes "tps ! j = (\<lfloor>zs\<rfloor>, 1)" assumes "ttt = 3 * length zs + 5" assumes "tps' = tps[j := (\<lfloor>rstrip z zs\<rfloor>, 1)]" shows "transforms (tm_rstrip z j) tps ttt tps'" proof - interpret loc: turing_machine_rstrip z j . show ?thesis using assms loc.tm4' loc.tps4_def loc.tm4_eq_tm_rstrip by simp qed subsection \<open>Writing arbitrary length sequences of the same symbol\<close> text \<open> The next Turing machine accepts a number $n$ on tape $j_1$ and writes the symbol sequence $z^n$ to tape $j_2$. The symbol $z$ is a parameter of the TM. The TM decrements the number on tape $j_1$ until it reaches zero. \<close> definition tm_write_replicate :: "symbol \<Rightarrow> tapeidx \<Rightarrow> tapeidx \<Rightarrow> machine" where "tm_write_replicate z j1 j2 \<equiv> WHILE [] ; \<lambda>rs. rs ! j1 \<noteq> \<box> DO tm_char j2 z ;; tm_decr j1 DONE ;; tm_cr j2" lemma tm_write_replicate_tm: assumes "0 < j1" and "0 < j2" and "j1 < k" and "j2 < k" and "j1 \<noteq> j2" and "G \<ge> 4" and "z < G" shows "turing_machine k G (tm_write_replicate z j1 j2)" unfolding tm_write_replicate_def using turing_machine_loop_turing_machine Nil_tm tm_char_tm tm_decr_tm tm_cr_tm assms by simp locale turing_machine_write_replicate = fixes j1 j2 :: tapeidx and z :: symbol begin definition "tm1 \<equiv> tm_char j2 z" definition "tm2 \<equiv> tm1 ;; tm_decr j1" definition "tmL \<equiv> WHILE [] ; \<lambda>rs. rs ! j1 \<noteq> \<box> DO tm2 DONE" definition "tm3 \<equiv> tmL ;; tm_cr j2" lemma tm3_eq_tm_write_replicate: "tm3 = tm_write_replicate z j1 j2" using tm3_def tm2_def tm1_def tm_write_replicate_def tmL_def by simp context fixes tps0 :: "tape list" and k n :: nat assumes jk: "length tps0 = k" "0 < j1" "0 < j2" "j1 \<noteq> j2" "j1 < k" "j2 < k" and z: "1 < z" assumes tps0: "tps0 ! j1 = (\<lfloor>n\<rfloor>\<^sub>N, 1)" "tps0 ! j2 = (\<lfloor>[]\<rfloor>, 1)" begin definition tpsL :: "nat \<Rightarrow> tape list" where "tpsL t \<equiv> tps0 [j1 := (\<lfloor>n - t\<rfloor>\<^sub>N, 1), j2 := (\<lfloor>replicate t z\<rfloor>, Suc t)]" lemma tpsL0: "tpsL 0 = tps0" using tpsL_def tps0 jk by (metis One_nat_def diff_zero list_update_id replicate_empty) definition tpsL1 :: "nat \<Rightarrow> tape list" where "tpsL1 t \<equiv> tps0 [j1 := (\<lfloor>n - t\<rfloor>\<^sub>N, 1), j2 := (\<lfloor>replicate (Suc t) z\<rfloor>, Suc (Suc t))]" lemma tmL1 [transforms_intros]: "transforms tm1 (tpsL t) 1 (tpsL1 t)" unfolding tm1_def proof (tform tps: tpsL_def tpsL1_def tps0 jk) have "tpsL t :#: j2 = Suc t" using tpsL1_def jk by (metis length_list_update nth_list_update_eq snd_conv tpsL_def) moreover have "tpsL t ::: j2 = \<lfloor>replicate t z\<rfloor>" using tpsL1_def jk by (metis fst_conv length_list_update nth_list_update_eq tpsL_def) moreover have "\<lfloor>replicate t z\<rfloor>(Suc t := z) = \<lfloor>replicate (Suc t) z\<rfloor>" using contents_snoc by (metis length_replicate replicate_Suc replicate_append_same) ultimately show "tpsL1 t = (tpsL t)[j2 := tpsL t ! j2 |:=| z |+| 1]" unfolding tpsL1_def tpsL_def by simp qed lemma tmL2: assumes "ttt = 9 + 2 * nlength (n - t)" shows "transforms tm2 (tpsL t) ttt (tpsL (Suc t))" unfolding tm2_def proof (tform tps: assms tpsL_def tpsL1_def tps0 jk) show "tpsL (Suc t) = (tpsL1 t)[j1 := (\<lfloor>n - t - 1\<rfloor>\<^sub>N, 1)]" unfolding tpsL_def tpsL1_def using jk by (simp add: list_update_swap) qed lemma tmL2' [transforms_intros]: assumes "ttt = 9 + 2 * nlength n" shows "transforms tm2 (tpsL t) ttt (tpsL (Suc t))" proof - have "9 + 2 * nlength (n - t) \<le> 9 + 2 * nlength n" using nlength_mono[of "n - t" n] by simp then show ?thesis using assms tmL2 transforms_monotone by blast qed lemma tmL [transforms_intros]: assumes "ttt = n * (11 + 2 * nlength n) + 1" shows "transforms tmL (tpsL 0) ttt (tpsL n)" unfolding tmL_def proof (tform) let ?t = "9 + 2 * nlength n" show "\<And>i. i < n \<Longrightarrow> read (tpsL i) ! j1 \<noteq> \<box>" using jk tpsL_def read_ncontents_eq_0 by simp show "\<not> read (tpsL n) ! j1 \<noteq> \<box>" using jk tpsL_def read_ncontents_eq_0 by simp show "n * (9 + 2 * nlength n + 2) + 1 \<le> ttt" using assms by simp qed definition tps3 :: "tape list" where "tps3 \<equiv> tps0 [j1 := (\<lfloor>0\<rfloor>\<^sub>N, 1), j2 := (\<lfloor>replicate n z\<rfloor>, 1)]" lemma tm3: assumes "ttt = n * (12 + 2 * nlength n) + 4" shows "transforms tm3 (tpsL 0) ttt tps3" unfolding tm3_def proof (tform tps: z tpsL_def tps3_def tps0 jk) have "ttt = Suc (n * (11 + 2 * nlength n)) + Suc (Suc (Suc n))" proof - have "Suc (n * (11 + 2 * nlength n)) + Suc (Suc (Suc n)) = n * (11 + 2 * nlength n) + 4 + n" by simp also have "... = n * (12 + 2 * nlength n) + 4" by algebra finally have "Suc (n * (11 + 2 * nlength n)) + Suc (Suc (Suc n)) = ttt" using assms by simp then show ?thesis by simp qed then show "ttt = n * (11 + 2 * nlength n) + 1 + (tpsL n :#: j2 + 2)" using tpsL_def jk by simp qed lemma tm3': assumes "ttt = n * (12 + 2 * nlength n) + 4" shows "transforms tm3 tps0 ttt tps3" using tm3 tpsL0 assms by simp end end lemma transforms_tm_write_replicateI [transforms_intros]: fixes j1 j2 :: tapeidx fixes tps tps' :: "tape list" and ttt k n :: nat assumes "length tps = k" "0 < j1" "0 < j2" "j1 \<noteq> j2" "j1 < k" "j2 < k" and "1 < z" assumes "tps ! j1 = (\<lfloor>n\<rfloor>\<^sub>N, 1)" "tps ! j2 = (\<lfloor>[]\<rfloor>, 1)" assumes "ttt = n * (12 + 2 * nlength n) + 4" assumes "tps' = tps [j1 := (\<lfloor>0\<rfloor>\<^sub>N, 1), j2 := (\<lfloor>replicate n z\<rfloor>, 1)]" shows "transforms (tm_write_replicate z j1 j2) tps ttt tps'" proof - interpret loc: turing_machine_write_replicate j1 j2 . show ?thesis using assms loc.tm3' loc.tps3_def loc.tm3_eq_tm_write_replicate by simp qed subsection \<open>Extracting the elements of a pair\<close> text \<open> In Section~\ref{s:tm-basic-pair} we defined a pairing function for strings. For example, $\langle \bbbI\bbbI, \bbbO\bbbO\rangle$ is first mapped to $\bbbI\bbbI\#\bbbO\bbbO$ and ultimately represented as $\bbbO\bbbI\bbbO\bbbI\bbbI\bbbI\bbbO\bbbO\bbbO\bbbO$. A Turing machine that is to compute a function for the argument $\langle \bbbI\bbbI, \bbbO\bbbO\rangle$ would receive as input the symbols \textbf{0101110000}. Typically the TM would then extract the two components \textbf{11} and \textbf{00}. In this section we devise TMs to do just that. As it happens, applying the quaternary alphabet decoding function @{const bindecode} (see Section~\ref{s:tm-quaternary}) to such a symbol sequence gets us halfway to extracting the elements of the pair. For example, decoding \textbf{0101110000} yields @{text "\<one>\<one>\<sharp>\<zero>\<zero>"}, and now the TM only has to locate the @{text \<sharp>}. A Turing machine cannot rely on being given a well-formed pair. After decoding, the symbol sequence might have more or fewer than one @{text \<sharp>} symbol or even @{text "\<bar>"} symbols. The following functions @{term first} and @{term second} are designed to extract the first and second element of a symbol sequence representing a pair, and for other symbol sequences at least allow for an efficient implementation. Implementations will come further down in this section. \<close> definition first :: "symbol list \<Rightarrow> symbol list" where "first ys \<equiv> take (if \<exists>i<length ys. ys ! i \<in> {\<bar>, \<sharp>} then LEAST i. i < length ys \<and> ys ! i \<in> {\<bar>, \<sharp>} else length ys) ys" definition second :: "symbol list \<Rightarrow> symbol list" where "second zs \<equiv> drop (Suc (length (first zs))) zs" lemma firstD: assumes "\<exists>i<length ys. ys ! i \<in> {\<bar>, \<sharp>}" and "m = (LEAST i. i < length ys \<and> ys ! i \<in> {\<bar>, \<sharp>})" shows "m < length ys" and "ys ! m \<in> {\<bar>, \<sharp>}" and "\<forall>i<m. ys ! i \<notin> {\<bar>, \<sharp>}" using LeastI_ex[OF assms(1)] assms(2) by simp_all (use less_trans not_less_Least in blast) lemma firstI: assumes "m < length ys" and "ys ! m \<in> {\<bar>, \<sharp>}" and "\<forall>i<m. ys ! i \<notin> {\<bar>, \<sharp>}" shows "(LEAST i. i < length ys \<and> ys ! i \<in> {\<bar>, \<sharp>}) = m" using assms by (metis (mono_tags, lifting) LeastI less_linear not_less_Least) lemma length_first_ex: assumes "\<exists>i<length ys. ys ! i \<in> {\<bar>, \<sharp>}" and "m = (LEAST i. i < length ys \<and> ys ! i \<in> {\<bar>, \<sharp>})" shows "length (first ys) = m" proof - have "m < length ys" using assms firstD(1) by presburger moreover have "first ys = take m ys" using assms first_def by simp ultimately show ?thesis by simp qed lemma first_notex: assumes "\<not> (\<exists>i<length ys. ys ! i \<in> {\<bar>, \<sharp>})" shows "first ys = ys" using assms first_def by auto lemma length_first: "length (first ys) \<le> length ys" using length_first_ex first_notex first_def by simp lemma length_second_first: "length (second zs) = length zs - Suc (length (first zs))" using second_def by simp lemma length_second: "length (second zs) \<le> length zs" using second_def by simp text \<open> Our next goal is to show that @{const first} and @{const second} really extract the first and second element of a pair. \<close> lemma bindecode_bitenc: fixes x :: string shows "bindecode (string_to_symbols (bitenc x)) = string_to_symbols x" proof (induction x) case Nil then show ?case using less_2_cases_iff by force next case (Cons a x) have "bitenc (a # x) = bitenc [a] @ bitenc x" by simp then have "string_to_symbols (bitenc (a # x)) = string_to_symbols (bitenc [a] @ bitenc x)" by simp then have "string_to_symbols (bitenc (a # x)) = string_to_symbols (bitenc [a]) @ string_to_symbols (bitenc x)" by simp then have "bindecode (string_to_symbols (bitenc (a # x))) = bindecode (string_to_symbols (bitenc [a]) @ string_to_symbols (bitenc x))" by simp also have "... = bindecode (string_to_symbols (bitenc [a])) @ bindecode (string_to_symbols (bitenc x))" using bindecode_append length_bitenc by (metis (no_types, lifting) dvd_triv_left length_map) also have "... = bindecode (string_to_symbols (bitenc [a])) @ string_to_symbols x" using Cons by simp also have "... = string_to_symbols [a] @ string_to_symbols x" using bindecode_def by simp also have "... = string_to_symbols ([a] @ x)" by simp also have "... = string_to_symbols (a # x)" by simp finally show ?case . qed lemma bindecode_string_pair: fixes x u :: string shows "bindecode \<langle>x; u\<rangle> = string_to_symbols x @ [\<sharp>] @ string_to_symbols u" proof - have "bindecode \<langle>x; u\<rangle> = bindecode (string_to_symbols (bitenc x @ [True, True] @ bitenc u))" using string_pair_def by simp also have "... = bindecode (string_to_symbols (bitenc x) @ string_to_symbols [\<bbbI>, \<bbbI>] @ string_to_symbols (bitenc u))" by simp also have "... = bindecode (string_to_symbols (bitenc x)) @ bindecode (string_to_symbols [\<bbbI>, \<bbbI>]) @ bindecode (string_to_symbols (bitenc u))" proof - have "even (length (string_to_symbols [True, True]))" by simp moreover have "even (length (string_to_symbols (bitenc y)))" for y by (simp add: length_bitenc) ultimately show ?thesis using bindecode_append length_bindecode length_bitenc by (smt (z3) add_mult_distrib2 add_self_div_2 dvd_triv_left length_append length_map mult_2) qed also have "... = string_to_symbols x @ bindecode (string_to_symbols [\<bbbI>, \<bbbI>]) @ string_to_symbols u" using bindecode_bitenc by simp also have "... = string_to_symbols x @ [\<sharp>] @ string_to_symbols u" using bindecode_def by simp finally show ?thesis . qed lemma first_pair: fixes ys :: "symbol list" and x u :: string assumes "ys = bindecode \<langle>x; u\<rangle>" shows "first ys = string_to_symbols x" proof - have ys: "ys = string_to_symbols x @ [\<sharp>] @ string_to_symbols u" using bindecode_string_pair assms by simp have bs: "bit_symbols (string_to_symbols x)" by simp have "ys ! (length (string_to_symbols x)) = \<sharp>" using ys by (metis append_Cons nth_append_length) then have ex: "ys ! (length (string_to_symbols x)) \<in> {\<bar>, \<sharp>}" by simp have "(LEAST i. i < length ys \<and> ys ! i \<in> {\<bar>, \<sharp>}) = length (string_to_symbols x)" using ex ys bs by (intro firstI) (simp_all add: nth_append) moreover have "length (string_to_symbols x) < length ys" using ys by simp ultimately have "first ys = take (length (string_to_symbols x)) ys" using ex first_def by auto then show "first ys = string_to_symbols x" using ys by simp qed lemma second_pair: fixes ys :: "symbol list" and x u :: string assumes "ys = bindecode \<langle>x; u\<rangle>" shows "second ys = string_to_symbols u" proof - have ys: "ys = string_to_symbols x @ [\<sharp>] @ string_to_symbols u" using bindecode_string_pair assms by simp let ?m = "length (string_to_symbols x)" have "length (first ys) = ?m" using assms first_pair by presburger moreover have "drop (Suc ?m) ys = string_to_symbols u" using ys by simp ultimately have "drop (Suc (length (first ys))) ys = string_to_symbols u" by simp then show ?thesis using second_def by simp qed subsubsection \<open>A Turing machine for extracting the first element\<close> text \<open> Unlike most other Turing machines, the one in this section is not meant to be reusable, but rather to compute a function, namely the function @{const first}. For this reason there are no tape index parameters. Instead, the encoded pair is expected on the input tape, and the output is written to the output tape. \null \<close> lemma bit_symbols_first: assumes "ys = bindecode (string_to_symbols x)" shows "bit_symbols (first ys)" proof (cases "\<exists>i<length ys. ys ! i \<in> {\<bar>, \<sharp>}") case True define m where "m = (LEAST i. i < length ys \<and> ys ! i \<in> {\<bar>, \<sharp>})" then have m: "m < length ys" "ys ! m \<in> {\<bar>, \<sharp>}" "\<forall>i<m. ys ! i \<notin> {\<bar>, \<sharp>}" using firstD[OF True] by blast+ have len: "length (first ys) = m" using length_first_ex[OF True] m_def by simp have "bit_symbols (string_to_symbols x)" by simp then have "\<forall>i<length ys. ys ! i \<in> {2..<6}" using assms bindecode2345 by simp then have "\<forall>i<m. ys ! i \<in> {2..<6}" using m(1) by simp then have "\<forall>i<m. ys ! i \<in> {2..<4}" using m(3) by fastforce then show ?thesis using first_def len by auto next case False then have 1: "\<forall>i<length ys. ys ! i \<notin> {\<bar>, \<sharp>}" by simp have "bit_symbols (string_to_symbols x)" by simp then have "\<forall>i<length ys. ys ! i \<in> {2..<6}" using assms bindecode2345 by simp then have "\<forall>i<length ys. ys ! i \<in> {2..<4}" using 1 by fastforce then show ?thesis using False first_notex by auto qed definition tm_first :: machine where "tm_first \<equiv> tm_right_many {0, 1, 2} ;; tm_bindecode 0 2 ;; tm_cp_until 2 1 {\<box>, \<bar>, \<sharp>}" lemma tm_first_tm: "G \<ge> 6 \<Longrightarrow> k \<ge> 3 \<Longrightarrow> turing_machine k G tm_first" unfolding tm_first_def using tm_cp_until_tm tm_start_tm tm_bindecode_tm tm_right_many_tm by simp locale turing_machine_fst_pair = fixes k :: nat assumes k: "k \<ge> 3" begin definition "tm1 \<equiv> tm_right_many {0, 1, 2}" definition "tm2 \<equiv> tm1 ;; tm_bindecode 0 2" definition "tm3 \<equiv> tm2 ;; tm_cp_until 2 1 {\<box>, \<bar>, \<sharp>}" lemma tm3_eq_tm_first: "tm3 = tm_first" using tm1_def tm2_def tm3_def tm_first_def by simp context fixes xs :: "symbol list" assumes bs: "bit_symbols xs" begin definition "tps0 \<equiv> snd (start_config k xs)" lemma lentps [simp]: "length tps0 = k" using tps0_def start_config_length k by simp lemma tps0_0: "tps0 ! 0 = (\<lfloor>xs\<rfloor>, 0)" using tps0_def start_config_def contents_def by auto lemma tps0_gt_0: "j > 0 \<Longrightarrow> j < k \<Longrightarrow> tps0 ! j = (\<lfloor>[]\<rfloor>, 0)" using tps0_def start_config_def contents_def by auto definition "tps1 \<equiv> tps0 [0 := (\<lfloor>xs\<rfloor>, 1), 1 := (\<lfloor>[]\<rfloor>, 1), 2 := (\<lfloor>[]\<rfloor>, 1)]" lemma tm1 [transforms_intros]: "transforms tm1 tps0 1 tps1" unfolding tm1_def proof (tform) show "tps1 = map (\<lambda>j. if j \<in> {0, 1, 2} then tps0 ! j |+| 1 else tps0 ! j) [0..<length tps0]" (is "_ = ?rhs") proof (rule nth_equalityI) show "length tps1 = length ?rhs" using tps0_def tps1_def by simp show "tps1 ! j = ?rhs ! j" if "j < length tps1" for j using that tps0_0 tps0_gt_0 tps1_def by simp qed qed definition "tps2 \<equiv> tps0 [0 := (\<lfloor>xs\<rfloor>, 1), 1 := (\<lfloor>[]\<rfloor>, 1), 2 := (\<lfloor>bindecode xs\<rfloor>, 1)]" lemma tm2 [transforms_intros]: assumes "ttt = 8 + 3 * length xs" shows "transforms tm2 tps0 ttt tps2" unfolding tm2_def by (tform tps: bs k tps1_def assms tps2_def) definition "tps3 \<equiv> tps0 [0 := (\<lfloor>xs\<rfloor>, 1), 1 := (\<lfloor>first (bindecode xs)\<rfloor>, Suc (length (first (bindecode xs)))), 2 := (\<lfloor>bindecode xs\<rfloor>, Suc (length (first (bindecode xs))))]" lemma tm3: assumes "ttt = 8 + 3 * length xs + Suc (length (first (bindecode xs)))" shows "transforms tm3 tps0 ttt tps3" unfolding tm3_def proof (tform tps: k tps2_def time: assms) let ?ys = "bindecode xs" have tps2: "tps2 ! 2 = (\<lfloor>?ys\<rfloor>, 1)" using tps2_def k by simp show "rneigh (tps2 ! 2) {\<box>, \<bar>, \<sharp>} (length (first ?ys))" proof (cases "\<exists>i<length ?ys. ?ys ! i \<in> {\<bar>, \<sharp>}") case ex5: True define m where "m = (LEAST i. i < length ?ys \<and> ?ys ! i \<in> {\<bar>, \<sharp>})" then have m: "m = length (first ?ys)" using length_first_ex ex5 by simp show ?thesis proof (rule rneighI) have "?ys ! m \<in> {\<bar>, \<sharp>}" using firstD m_def ex5 by blast then show "(tps2 ::: 2) (tps2 :#: 2 + length (first ?ys)) \<in> {\<box>, \<bar>, \<sharp>}" using m tps2 contents_def by simp show "(tps2 ::: 2) (tps2 :#: 2 + i) \<notin> {\<box>, \<bar>, \<sharp>}" if "i < length (first ?ys)" for i proof - have "m < length ?ys" using ex5 firstD(1) length_first_ex m by blast then have "length (first ?ys) < length ?ys" using m by simp then have "i < length ?ys" using that by simp then have "?ys ! i \<noteq> 0" using proper_bindecode by fastforce moreover have "?ys ! i \<notin> {\<bar>, \<sharp>}" using ex5 firstD(3) length_first_ex that by blast ultimately show ?thesis using Suc_neq_Zero \<open>i < length (bindecode xs)\<close> tps2 by simp qed qed next case notex5: False then have ys: "?ys = first ?ys" using first_notex by simp show ?thesis proof (rule rneighI) show "(tps2 ::: 2) (tps2 :#: 2 + length (first ?ys)) \<in> {\<box>, \<bar>, \<sharp>}" using ys tps2 by simp show "(tps2 ::: 2) (tps2 :#: 2 + i) \<notin> {\<box>, \<bar>, \<sharp>}" if "i < length (first ?ys)" for i using notex5 that ys proper_bindecode contents_inbounds by (metis Suc_leI add_gr_0 diff_Suc_1 fst_conv gr_implies_not0 insert_iff plus_1_eq_Suc snd_conv tps2 zero_less_one) qed qed show "tps3 = tps2[2 := tps2 ! 2 |+| length (first ?ys), 1 := implant (tps2 ! 2) (tps2 ! 1) (length (first ?ys))]" (is "_ = ?tps") proof - have 0: "tps3 ! 0 = ?tps ! 0" using tps2_def tps3_def by simp have 1: "tps3 ! 2 = ?tps ! 2" using tps2_def tps3_def k by simp have lentps2: "length tps2 > 2" using k tps2_def by simp have "implant (tps2 ! 2) (tps2 ! 1) (length (first ?ys)) = (\<lfloor>first ?ys\<rfloor>, Suc (length (first ?ys)))" proof - have len: "length (first ?ys) \<le> length ?ys" using first_def by simp have "tps2 ! 1 = (\<lfloor>[]\<rfloor>, 1)" using tps2_def lentps2 by simp then have "implant (tps2 ! 2) (tps2 ! 1) (length (first ?ys)) = implant (\<lfloor>?ys\<rfloor>, 1) (\<lfloor>[]\<rfloor>, 1) (length (first ?ys))" using tps2 by simp also have "... = (\<lfloor>take (length (first ?ys)) ?ys\<rfloor>, Suc (length (first ?ys)))" using implant_contents[of 1 "length (first ?ys)" ?ys "[]"] len by simp also have "... = (\<lfloor>first ?ys\<rfloor>, Suc (length (first ?ys)))" using first_def using first_notex length_first_ex by presburger finally show ?thesis . qed moreover have "length tps2 > 2" using k tps2_def by simp ultimately show ?thesis using 0 1 tps2_def tps3_def tps0_def lentps k tps2 by (smt (z3) length_list_update list_update_overwrite list_update_swap nth_list_update) qed qed lemma tm3': assumes "ttt = 9 + 4 * length xs" shows "transforms tm3 tps0 ttt tps3" proof - let ?t = "8 + 3 * length xs + Suc (length (first (bindecode xs)))" have "?t \<le> 8 + 3 * length xs + Suc (length (bindecode xs))" using length_first by (meson Suc_le_mono add_le_mono order_refl) also have "... \<le> 8 + 3 * length xs + Suc (length xs)" using length_bindecode by simp also have "... = 9 + 3 * length xs + length xs" by simp also have "... = 9 + 4 * length xs" by simp finally have "?t \<le> ttt" using assms(1) by simp moreover have "transforms tm3 tps0 ?t tps3" using tm3 by simp ultimately show ?thesis using transforms_monotone by simp qed end (* context tps *) lemma tm3_computes: "computes_in_time k tm3 (\<lambda>x. symbols_to_string (first (bindecode (string_to_symbols x)))) (\<lambda>n. 9 + 4 * n)" proof - define f where "f = (\<lambda>x. symbols_to_string (first (bindecode (string_to_symbols x))))" define T :: "nat \<Rightarrow> nat" where "T = (\<lambda>n. 9 + 4 * n)" have "computes_in_time k tm3 f T" proof fix x :: string let ?xs = "string_to_symbols x" have bs: "bit_symbols ?xs" by simp define tps where "tps = tps3 ?xs" have trans: "transforms tm3 (tps0 ?xs) (9 + 4 * length ?xs) tps" using bs tm3' tps_def by blast have "tps3 ?xs ::: 1 = \<lfloor>first (bindecode ?xs)\<rfloor>" using bs tps3_def k by simp moreover have "bit_symbols (first (bindecode ?xs))" using bit_symbols_first by simp ultimately have "tps3 ?xs ::: 1 = string_to_contents (symbols_to_string (first (bindecode ?xs)))" using bit_symbols_to_symbols contents_string_to_contents by simp then have *: "tps ::: 1 = string_to_contents (f x)" using tps_def f_def by auto then have "transforms tm3 (snd (start_config k (string_to_symbols x))) (T (length x)) tps" using trans T_def tps0_def by simp then show "\<exists>tps. tps ::: 1 = string_to_contents (f x) \<and> transforms tm3 (snd (start_config k (string_to_symbols x))) (T (length x)) tps" using * by auto qed then show ?thesis using f_def T_def by simp qed end (* locale turing_machine_fst_pair *) lemma tm_first_computes: assumes "k \<ge> 3" shows "computes_in_time k tm_first (\<lambda>x. symbols_to_string (first (bindecode (string_to_symbols x)))) (\<lambda>n. 9 + 4 * n)" proof - interpret loc: turing_machine_fst_pair k using turing_machine_fst_pair.intro assms by simp show ?thesis using loc.tm3_eq_tm_first loc.tm3_computes by simp qed subsubsection \<open>A Turing machine for splitting pairs\<close> text \<open> The next Turing machine expects a proper symbol sequence @{term zs} on tape $j_1$ and outputs @{term "first zs"} and @{term "second zs"} on tapes $j_2$ and $j_3$, respectively. \<close> definition tm_unpair :: "tapeidx \<Rightarrow> tapeidx \<Rightarrow> tapeidx \<Rightarrow> machine" where "tm_unpair j1 j2 j3 \<equiv> tm_cp_until j1 j2 {\<box>, \<bar>, \<sharp>} ;; tm_right j1 ;; tm_cp_until j1 j3 {\<box>} ;; tm_cr j1 ;; tm_cr j2 ;; tm_cr j3" lemma tm_unpair_tm: assumes "k \<ge> 2" and "G \<ge> 4" and "0 < j2" and "0 < j3" and "j1 < k" "j2 < k" "j3 < k" shows "turing_machine k G (tm_unpair j1 j2 j3)" using tm_cp_until_tm tm_right_tm tm_cr_tm assms tm_unpair_def by simp locale turing_machine_unpair = fixes j1 j2 j3 :: tapeidx begin definition "tm1 \<equiv> tm_cp_until j1 j2 {\<box>, \<bar>, \<sharp>}" definition "tm2 \<equiv> tm1 ;; tm_right j1" definition "tm3 \<equiv> tm2 ;; tm_cp_until j1 j3 {\<box>}" definition "tm4 \<equiv> tm3 ;; tm_cr j1" definition "tm5 \<equiv> tm4 ;; tm_cr j2" definition "tm6 \<equiv> tm5 ;; tm_cr j3" lemma tm6_eq_tm_unpair: "tm6 = tm_unpair j1 j2 j3" unfolding tm6_def tm5_def tm4_def tm3_def tm2_def tm1_def tm_unpair_def by simp context fixes tps0 :: "tape list" and k :: nat and zs :: "symbol list" assumes jk: "0 < j2" "0 < j3" "j1 \<noteq> j2" "j1 \<noteq> j3" "j2 \<noteq> j3" "j1 < k" "j2 < k" "j3 < k" "length tps0 = k" and zs: "proper_symbols zs" and tps0: "tps0 ! j1 = (\<lfloor>zs\<rfloor>, 1)" "tps0 ! j2 = (\<lfloor>[]\<rfloor>, 1)" "tps0 ! j3 = (\<lfloor>[]\<rfloor>, 1)" begin definition "tps1 \<equiv> tps0 [j1 := (\<lfloor>zs\<rfloor>, Suc (length (first zs))), j2 := (\<lfloor>first zs\<rfloor>, Suc (length (first zs)))]" lemma tm1 [transforms_intros]: assumes "ttt = Suc (length (first zs))" shows "transforms tm1 tps0 ttt tps1" unfolding tm1_def proof (tform tps: assms tps0 tps1_def jk) let ?n = "length (first zs)" have *: "tps0 ! j1 = (\<lfloor>zs\<rfloor>, 1)" using tps0 jk by simp show "rneigh (tps0 ! j1) {\<box>, \<bar>, \<sharp>} (length (first zs))" proof (cases "\<exists>i<length zs. zs ! i \<in> {\<bar>, \<sharp>}") case ex5: True define m where "m = (LEAST i. i < length zs \<and> zs ! i \<in> {\<bar>, \<sharp>})" then have m: "m = length (first zs)" using length_first_ex ex5 by simp show ?thesis proof (rule rneighI) have "zs ! m \<in> {\<bar>, \<sharp>}" using firstD m_def ex5 by blast then show "(tps0 ::: j1) (tps0 :#: j1 + length (first zs)) \<in> {\<box>, \<bar>, \<sharp>}" using m * contents_def by simp show "(tps0 ::: j1) (tps0 :#: j1 + i) \<notin> {\<box>, \<bar>, \<sharp>}" if "i < length (first zs)" for i proof - have "m < length zs" using ex5 firstD(1) length_first_ex m by blast then have "length (first zs) < length zs" using m by simp then have "i < length zs" using that by simp then have "zs ! i \<noteq> \<box>" using zs by fastforce moreover have "zs ! i \<notin> {\<bar>, \<sharp>}" using ex5 firstD(3) length_first_ex that by blast ultimately show ?thesis using Suc_neq_Zero `i < length zs` * by simp qed qed next case notex5: False then have ys: "zs = first zs" using first_notex by simp show ?thesis proof (rule rneighI) show "(tps0 ::: j1) (tps0 :#: j1 + length (first zs)) \<in> {\<box>, \<bar>, \<sharp>}" using ys * by simp show "(tps0 ::: j1) (tps0 :#: j1 + i) \<notin> {\<box>, \<bar>, \<sharp>}" if "i < length (first zs)" for i using notex5 that ys proper_bindecode contents_inbounds * zs by auto qed qed have 1: "implant (tps0 ! j1) (tps0 ! j2) ?n = (\<lfloor>first zs\<rfloor>, Suc ?n)" proof - have "implant (tps0 ! j1) (tps0 ! j2) ?n = (\<lfloor>[] @ take (length (first zs)) (drop (1 - 1) zs)\<rfloor>, Suc (length []) + length (first zs))" using implant_contents[of 1 "length (first zs)" zs "[]"] tps0(1,2) by (metis (mono_tags, lifting) add.right_neutral diff_Suc_1 le_eq_less_or_eq firstD(1) first_notex length_first_ex less_one list.size(3) plus_1_eq_Suc) then have "implant (tps0 ! j1) (tps0 ! j2) ?n = (\<lfloor>take ?n zs\<rfloor>, Suc ?n)" by simp then show "implant (tps0 ! j1) (tps0 ! j2) ?n = (\<lfloor>first zs\<rfloor>, Suc ?n)" using first_def length_first_ex by auto qed have 2: "tps0 ! j1 |+| ?n = (\<lfloor>zs\<rfloor>, Suc ?n)" using tps0 jk by simp show "tps1 = tps0 [j1 := tps0 ! j1 |+| ?n, j2 := implant (tps0 ! j1) (tps0 ! j2) ?n]" unfolding tps1_def using jk 1 2 by simp qed definition "tps2 \<equiv> tps0 [j1 := (\<lfloor>zs\<rfloor>, length (first zs) + 2), j2 := (\<lfloor>first zs\<rfloor>, Suc (length (first zs)))]" lemma tm2 [transforms_intros]: assumes "ttt = length (first zs) + 2" shows "transforms tm2 tps0 ttt tps2" unfolding tm2_def proof (tform tps: tps1_def jk tps2_def time: assms) have "tps1 ! j1 |+| 1 = (\<lfloor>zs\<rfloor>, length (first zs) + 2)" using tps1_def jk by simp then show "tps2 = tps1[j1 := tps1 ! j1 |+| 1]" unfolding tps2_def tps1_def using jk by (simp add: list_update_swap) qed definition "tps3 \<equiv> tps0 [j1 := (\<lfloor>zs\<rfloor>, length (first zs) + 2 + (length zs - Suc (length (first zs)))), j2 := (\<lfloor>first zs\<rfloor>, Suc (length (first zs))), j3 := (\<lfloor>second zs\<rfloor>, Suc (length (second zs)))]" lemma tm3 [transforms_intros]: assumes "ttt = length (first zs) + 2 + Suc (length zs - Suc (length (first zs)))" shows "transforms tm3 tps0 ttt tps3" unfolding tm3_def proof (tform tps: assms tps2_def tps3_def jk) let ?ll = "length (first zs)" let ?n = "length zs - Suc ?ll" have at_j1: "tps2 ! j1 = (\<lfloor>zs\<rfloor>, length (first zs) + 2)" using tps2_def jk by simp show "rneigh (tps2 ! j1) {0} ?n" proof (rule rneighI) show "(tps2 ::: j1) (tps2 :#: j1 + (length zs - Suc ?ll)) \<in> {0}" using at_j1 by simp show "(tps2 ::: j1) (tps2 :#: j1 + m) \<notin> {0}" if "m < length zs - Suc ?ll" for m proof - have *: "(tps2 ::: j1) (tps2 :#: j1 + m) = \<lfloor>zs\<rfloor> (?ll + 2 + m)" using at_j1 by simp have "Suc ?ll < length zs" using that by simp then have "?ll + 2 + m \<le> Suc (length zs)" using that by simp then have "\<lfloor>zs\<rfloor> (?ll + 2 + m) = zs ! (?ll + 1 + m)" using that by simp then have "\<lfloor>zs\<rfloor> (?ll + 2 + m) > 0" using zs that by (metis add.commute gr0I less_diff_conv not_add_less2 plus_1_eq_Suc) then show ?thesis using * by simp qed qed have 1: "implant (tps2 ! j1) (tps2 ! j3) ?n = (\<lfloor>second zs\<rfloor>, Suc (length (second zs)))" proof (cases "Suc ?ll \<le> length zs") case True have "implant (tps2 ! j1) (tps2 ! j3) ?n = implant (\<lfloor>zs\<rfloor>, ?ll + 2) (\<lfloor>[]\<rfloor>, 1) ?n" using tps2_def jk by (metis at_j1 nth_list_update_neq' tps0(3)) also have "... = (\<lfloor>take ?n (drop (Suc ?ll) zs)\<rfloor>, Suc ?n)" using True implant_contents by (metis (no_types, lifting) One_nat_def add.commute add_2_eq_Suc' append.simps(1) diff_Suc_1 dual_order.refl le_add_diff_inverse2 list.size(3) plus_1_eq_Suc zero_less_Suc) also have "... = (\<lfloor>take (length (second zs)) (drop (Suc ?ll) zs)\<rfloor>, Suc (length (second zs)))" using length_second_first by simp also have "... = (\<lfloor>second zs\<rfloor>, Suc (length (second zs)))" using second_def by simp finally show ?thesis . next case False then have "?n = 0" by simp then have "implant (tps2 ! j1) (tps2 ! j3) ?n = implant (\<lfloor>zs\<rfloor>, ?ll + 2) (\<lfloor>[]\<rfloor>, 1) 0" using tps2_def jk by (metis at_j1 nth_list_update_neq' tps0(3)) then have "implant (tps2 ! j1) (tps2 ! j3) ?n = (\<lfloor>[]\<rfloor>, 1)" using transplant_0 by simp moreover have "second zs = []" using False second_def by simp ultimately show ?thesis by simp qed show "tps3 = tps2 [j1 := tps2 ! j1 |+| ?n, j3 := implant (tps2 ! j1) (tps2 ! j3) ?n]" using tps3_def tps2_def using 1 jk at_j1 by (simp add: list_update_swap[of j1]) qed definition "tps4 \<equiv> tps0 [j1 := (\<lfloor>zs\<rfloor>, 1), j2 := (\<lfloor>first zs\<rfloor>, Suc (length (first zs))), j3 := (\<lfloor>second zs\<rfloor>, Suc (length (second zs)))]" lemma tm4: assumes "ttt = 2 * length (first zs) + 7 + 2 * (length zs - Suc (length (first zs)))" shows "transforms tm4 tps0 ttt tps4" unfolding tm4_def proof (tform tps: assms tps3_def tps4_def jk zs) have "tps3 ! j1 |#=| 1 = (\<lfloor>zs\<rfloor>, 1)" using tps3_def jk by simp then show "tps4 = tps3[j1 := tps3 ! j1 |#=| 1]" unfolding tps4_def tps3_def using jk by (simp add: list_update_swap) qed lemma tm4' [transforms_intros]: assumes "ttt = 4 * length zs + 7" shows "transforms tm4 tps0 ttt tps4" proof - have "2 * length (first zs) + 7 + 2 * (length zs - Suc (length (first zs))) \<le> 2 * length (first zs) + 7 + 2 * length zs" by simp also have "... \<le> 2 * length zs + 7 + 2 * length zs" using length_first by simp also have "... = ttt" using assms by simp finally have "2 * length (first zs) + 7 + 2 * (length zs - Suc (length (first zs))) \<le> ttt" . then show ?thesis using assms tm4 transforms_monotone by simp qed definition "tps5 \<equiv> tps0 [j1 := (\<lfloor>zs\<rfloor>, 1), j2 := (\<lfloor>first zs\<rfloor>, 1), j3 := (\<lfloor>second zs\<rfloor>, Suc (length (second zs)))]" lemma tm5 [transforms_intros]: assumes "ttt = 4 * length zs + 9 + Suc (length (first zs))" shows "transforms tm5 tps0 ttt tps5" unfolding tm5_def proof (tform tps: assms tps4_def tps5_def jk) show "clean_tape (tps4 ! j2)" using zs first_def tps4_def jk by simp have "tps4 ! j2 |#=| 1 = (\<lfloor>first zs\<rfloor>, 1)" using tps4_def jk by simp then show "tps5 = tps4[j2 := tps4 ! j2 |#=| 1]" unfolding tps5_def tps4_def using jk by (simp add: list_update_swap) qed definition "tps6 \<equiv> tps0 [j1 := (\<lfloor>zs\<rfloor>, 1), j2 := (\<lfloor>first zs\<rfloor>, 1), j3 := (\<lfloor>second zs\<rfloor>, 1)]" lemma tm6: assumes "ttt = 4 * length zs + 11 + Suc (length (first zs)) + Suc (length (second zs))" shows "transforms tm6 tps0 ttt tps6" unfolding tm6_def proof (tform tps: assms tps5_def tps6_def jk) show "clean_tape (tps5 ! j3)" using zs second_def tps5_def jk by simp qed definition "tps6' \<equiv> tps0 [j2 := (\<lfloor>first zs\<rfloor>, 1), j3 := (\<lfloor>second zs\<rfloor>, 1)]" lemma tps6': "tps6' = tps6" using tps6_def tps6'_def list_update_id tps0(1) by metis lemma tm6': assumes "ttt = 6 * length zs + 13" shows "transforms tm6 tps0 ttt tps6'" proof - have "4 * length zs + 11 + Suc (length (first zs)) + Suc (length (second zs)) \<le> 4 * length zs + 13 + length zs + length (second zs)" using length_first by simp also have "... \<le> 6 * length zs + 13" using length_second by simp finally have "4 * length zs + 11 + Suc (length (first zs)) + Suc (length (second zs)) \<le> ttt" using assms by simp then show ?thesis using tm6 tps6' transforms_monotone by simp qed end (* context *) end (* locale *) lemma transforms_tm_unpairI [transforms_intros]: fixes j1 j2 j3 :: tapeidx fixes tps tps' :: "tape list" and k :: nat and zs :: "symbol list" assumes "0 < j2" "0 < j3" "j1 \<noteq> j2" "j1 \<noteq> j3" "j2 \<noteq> j3" "j1 < k" "j2 < k" "j3 < k" and "length tps = k" and "proper_symbols zs" assumes "tps ! j1 = (\<lfloor>zs\<rfloor>, 1)" "tps ! j2 = (\<lfloor>[]\<rfloor>, 1)" "tps ! j3 = (\<lfloor>[]\<rfloor>, 1)" assumes "ttt = 6 * length zs + 13" assumes "tps' = tps [j2 := (\<lfloor>first zs\<rfloor>, 1), j3 := (\<lfloor>second zs\<rfloor>, 1)]" shows "transforms (tm_unpair j1 j2 j3) tps ttt tps'" proof - interpret loc: turing_machine_unpair j1 j2 j3 . show ?thesis using assms loc.tps6'_def loc.tm6' loc.tm6_eq_tm_unpair by metis qed end
""" erig(b::Basis, i::Int, j::Int; alpha=1.0, scale=1.0) erig(b::Basis, i::Int, j::Int, n::Int, m::Int; alpha=1.0, scale=1.0) Electron repulsion integral with Gaussian repulsion scale*exp(-α*r^2). For erig4 `i` and `j` are indices for particale 1 and `n` and `m` for particale 2. """ function erig(b::AbstractBasis, i::Int, j::Int; Ve=x->exp(-x^2)) return Ve(b[i]-b[j]) end function erig(b::AbstractBasis, i::Int, j::Int, n::Int, m::Int; Ve=x->exp(-x^2))::Float64 # TODO this function might not be type stable T = Float64 # This need to change for AD to work eg. Base.return_type() # Basis functions are orthogonal i != j && return zero(T) n != m && return zero(T) return Ve(b[i]-b[n]) end function fock_matrix(b::AbstractBasis; Ve=x->exp(-x^2), Vn=x->-2exp(-0.5x^2)) orbitals = initial_orbitals(b) return fock_matrix(b, orbitals; Ve=Ve, Vn=Vn) end function fock_matrix(b::AbstractBasis, orbitals::AbstractMatrix; Ve=x->exp(-x^2), Vn=x->-2exp(-0.5x^2)) @argcheck size(orbitals) == (length(b), length(b)) h₁ = one_electron_operator(b, Vn) J = coulomb_matrix(b, orbitals) #K = exchange_matrix(b, orbitals) # For more than 2 electrons return h₁ + J # h₁ + 2*J - K end function fock_matrix!(f::AbstractMatrix, b::AbstractBasis, orbitals::AbstractMatrix; Ve=x->exp(-x^2), Vn=x->-2exp(-0.5x^2)) @argcheck size(f) == size(orbitals) == (length(b), length(b)) h₁ = one_electron_operator(b, Vn) J = coulomb_matrix(b, orbitals) #K = exchange_matrix(b, orbitals) # For more than 2 electrons return f .= h₁ + J # h₁ + 2*J - K end function coulomb_matrix(b::AbstractBasis, orbitals::AbstractMatrix) C = zeros(size(orbitals)) return coulomb_matrix!(C, b, orbitals) end function coulomb_matrix!(C::AbstractMatrix, b::AbstractBasis, orbitals::AbstractMatrix) @argcheck size(C) == size(orbitals) == (length(b), length(b)) l = length(b) w = get_weight(b) # Two electrons in total ρ = orbitals[:,1] * orbitals[:,1]' for i in 1:l # C[i,j]=0 for i!=j # also erig(b,i,i,n,m) = 0 for n!=m C[i,i] = sum( n -> erig(b,i,i,n,n) * ρ[n,n] * w[n], 1:l) C[i,i] *= w[i] end return C end function exchange_matrix(b::AbstractBasis, orbitals::AbstractMatrix) @argcheck size(orbitals) == (length(b), length(b)) l = length(b) K = zeros(l,l) w = get_weight(b) # Two electrons in total ρ = orbitals[:,1] * orbitals[:,1]' Threads.@threads for i in 1:l for j in 1:l for n in 1:l K[i,j] += sum( k-> erig(b, i,n,j,k) * ρ[n,k], 1:l) end K[i,j] *= w[i] * w[j] end end return K end function bracket( b::AbstractBasis, psi1::AbstractVector, op::AbstractMatrix, psi2::AbstractVector ) w = get_weight(b) return (conj.(psi1).*w)' * op * psi2 end function bracket(b::AbstractBasis, psi1::AbstractVector, psi2::AbstractVector) w = get_weight(b) return sum( conj.(psi1) .* w .* psi2 ) end function kinetic_energy(b::AbstractBasis; mass=1.0) ∇ = derivative_matrix(b) g = metric_tensor(b) return (0.5/mass) * ∇' * g * ∇ # = 0.5 * (g∇)' * ∇ end function one_electron_operator(b, Vn; mass=1.0) g = metric_tensor(b) V = g * diagm( Vn.(b) ) return kinetic_energy(b; mass=mass) + V end
open import Relation.Binary.Core module TreeSort.Impl1 {A : Set} (_≤_ : A → A → Set) (tot≤ : Total _≤_) where open import BTree {A} open import Data.List open import Data.Sum insert : A → BTree → BTree insert x leaf = node x leaf leaf insert x (node y l r) with tot≤ x y ... | inj₁ x≤y = node y (insert x l) r ... | inj₂ y≤x = node y l (insert x r) treeSort : List A → BTree treeSort [] = leaf treeSort (x ∷ xs) = insert x (treeSort xs)
Definition ext_eq {A B} (f g : A -> B) := forall a, f a = g a. Definition task := forall A B (f g : A -> B), ext_eq f g -> ext_eq g f.
[GOAL] a : ℝ ⊢ interior {z | z.re ≤ a} = {z | z.re < a} [PROOFSTEP] simpa only [interior_Iic] using interior_preimage_re (Iic a) [GOAL] a : ℝ ⊢ interior {z | z.im ≤ a} = {z | z.im < a} [PROOFSTEP] simpa only [interior_Iic] using interior_preimage_im (Iic a) [GOAL] a : ℝ ⊢ interior {z | a ≤ z.re} = {z | a < z.re} [PROOFSTEP] simpa only [interior_Ici] using interior_preimage_re (Ici a) [GOAL] a : ℝ ⊢ interior {z | a ≤ z.im} = {z | a < z.im} [PROOFSTEP] simpa only [interior_Ici] using interior_preimage_im (Ici a) [GOAL] a : ℝ ⊢ closure {z | z.re < a} = {z | z.re ≤ a} [PROOFSTEP] simpa only [closure_Iio] using closure_preimage_re (Iio a) [GOAL] a : ℝ ⊢ closure {z | z.im < a} = {z | z.im ≤ a} [PROOFSTEP] simpa only [closure_Iio] using closure_preimage_im (Iio a) [GOAL] a : ℝ ⊢ closure {z | a < z.re} = {z | a ≤ z.re} [PROOFSTEP] simpa only [closure_Ioi] using closure_preimage_re (Ioi a) [GOAL] a : ℝ ⊢ closure {z | a < z.im} = {z | a ≤ z.im} [PROOFSTEP] simpa only [closure_Ioi] using closure_preimage_im (Ioi a) [GOAL] a : ℝ ⊢ frontier {z | z.re ≤ a} = {z | z.re = a} [PROOFSTEP] simpa only [frontier_Iic] using frontier_preimage_re (Iic a) [GOAL] a : ℝ ⊢ frontier {z | z.im ≤ a} = {z | z.im = a} [PROOFSTEP] simpa only [frontier_Iic] using frontier_preimage_im (Iic a) [GOAL] a : ℝ ⊢ frontier {z | a ≤ z.re} = {z | z.re = a} [PROOFSTEP] simpa only [frontier_Ici] using frontier_preimage_re (Ici a) [GOAL] a : ℝ ⊢ frontier {z | a ≤ z.im} = {z | z.im = a} [PROOFSTEP] simpa only [frontier_Ici] using frontier_preimage_im (Ici a) [GOAL] a : ℝ ⊢ frontier {z | z.re < a} = {z | z.re = a} [PROOFSTEP] simpa only [frontier_Iio] using frontier_preimage_re (Iio a) [GOAL] a : ℝ ⊢ frontier {z | z.im < a} = {z | z.im = a} [PROOFSTEP] simpa only [frontier_Iio] using frontier_preimage_im (Iio a) [GOAL] a : ℝ ⊢ frontier {z | a < z.re} = {z | z.re = a} [PROOFSTEP] simpa only [frontier_Ioi] using frontier_preimage_re (Ioi a) [GOAL] a : ℝ ⊢ frontier {z | a < z.im} = {z | z.im = a} [PROOFSTEP] simpa only [frontier_Ioi] using frontier_preimage_im (Ioi a) [GOAL] s t : Set ℝ ⊢ closure (s ×ℂ t) = closure s ×ℂ closure t [PROOFSTEP] simpa only [← preimage_eq_preimage equivRealProdClm.symm.toHomeomorph.surjective, equivRealProdClm.symm.toHomeomorph.preimage_closure] using @closure_prod_eq _ _ _ _ s t [GOAL] s t : Set ℝ ⊢ interior (s ×ℂ t) = interior s ×ℂ interior t [PROOFSTEP] rw [Set.reProdIm, Set.reProdIm, interior_inter, interior_preimage_re, interior_preimage_im] [GOAL] s t : Set ℝ ⊢ frontier (s ×ℂ t) = closure s ×ℂ frontier t ∪ frontier s ×ℂ closure t [PROOFSTEP] simpa only [← preimage_eq_preimage equivRealProdClm.symm.toHomeomorph.surjective, equivRealProdClm.symm.toHomeomorph.preimage_frontier] using frontier_prod_eq s t [GOAL] a b : ℝ ⊢ frontier {z | a ≤ z.re ∧ b ≤ z.im} = {z | a ≤ z.re ∧ z.im = b ∨ z.re = a ∧ b ≤ z.im} [PROOFSTEP] simpa only [closure_Ici, frontier_Ici] using frontier_reProdIm (Ici a) (Ici b) [GOAL] a b : ℝ ⊢ frontier {z | a ≤ z.re ∧ z.im ≤ b} = {z | a ≤ z.re ∧ z.im = b ∨ z.re = a ∧ z.im ≤ b} [PROOFSTEP] simpa only [closure_Ici, closure_Iic, frontier_Ici, frontier_Iic] using frontier_reProdIm (Ici a) (Iic b)
#ifndef MSNHINFERENCECFG_H #define MSNHINFERENCECFG_H #include <stdint.h> #include <float.h> #include <string> #include <vector> #include <chrono> #include "Msnhnet/utils/MsnhException.h" #include "Msnhnet/config/MsnhnetMacro.h" #include <math.h> #include <string.h> #ifdef USE_OMP #include <omp.h> #endif #ifdef USE_NEON #include <arm_neon.h> #endif #ifdef USE_OPEN_BLAS #include <cblas.h> #endif #ifdef USE_NNPACK #include <nnpack.h> #endif #ifndef OMP_THREAD #define OMP_THREAD omp_get_max_threads() #endif enum ActivationType { LOGISTIC, RELU, RELU6, RELIE, RAMP, TANH, PLSE, LEAKY, ELU, LOGGY, STAIR, HARDTAN, LHTAN, SOFT_PLUS, SELU, SWISH, MISH, NORM_CHAN, NORM_CHAN_SOFTMAX, NORM_CHAN_SOFTMAX_MAXVAL, NONE }; enum LayerType { CONVOLUTIONAL, DECONVOLUTIONAL, CONNECTED, MAXPOOL, LOCAL_AVGPOOL, GLOBAL_AVGPOOL, SOFTMAX, CROP, ROUTE, NORMALIZATION, AVGPOOL, ACTIVE, BATCHNORM, NETWORK, YOLOV3, YOLOV3_OUT, GAUSSIAN_YOLO, UPSAMPLE, L2NORM, EMPTY, BLANK, CONFIG, RES_BLOCK, RES_2_BLOCK, CONCAT_BLOCK, ADD_BLOCK, PADDING }; enum WeightsType { NO_WEIGHTS, PER_FEATURE, PER_CHANNEL }; enum WeightsNorm { NO_NORM, RELU_NORM, SOFTMAX_NORM }; #endif
theorem one_plus_one_is_two : 1 + 1 = 2 := begin simp end
I hope you, your kitties, family, friends and loved ones have plenty of blessings to share this holiday season. Merry Christmas and Happy New Year from my family to yours! If you follow us on Facebook or if you have followed us for years, then chances are you have already seen this photo. It is my all time favorite cat Christmas photo, so I share it yearly. Poinsettias are poisonous if cats eat them, so it’s not the best photo to share because of that. However, my mom has never had a cat bother a poinsettia – so she always left them out. My sister took this photo of my Rags when he was 18 years old. Christmas ALWAYS reminds me of my childhood and of Rags. We were gifted with Rags as a Christmas present (I am holding him in the photo below and my brother, Marsh, is holding Cosby who passed at 10 months from FIP). The day we got rags. I am holding Rags. My older brother, Marsh, is holding Cosby, my little brother, Spencer, is in the box and Snickers is the GSD. Christmas also reminds me of Rags because I always had him help me unwrap my presents – even his last Christmas at 19 years old, I lugged him over to my parents’ house to help me undo my stocking. He laid on the couch as an old man and just bitchy meowed at me, while we undid the stocking. My fondest memories are of him playing in all the wrapping paper before my mom would scoop it up and put it in the garbage bag. Or how he would help me play with new toys or set up new doll houses. Murphy, my parents’ 14-year old Ragdoll, still loves to play with wrapping paper – and he’s a sucker for curling ribbon – gotta be careful with that (Murphy had surgery at 18 months old from eating and swallowing curling ribbon). Yeowww! Catnip bananas also always remind me of Christmas and Rags because Santa left one in Rags stocking when he was 15 years old – and he went nutzo for it….not only that, but continued to play with it over and over again – something he had never done with a toy. Do you have any cats and Christmas stories to share? so true – that’s true in life too – special days usually don’t fall on special holidays!
#pragma once #include <gsl/gsl_assert> #include <src/util/Logging.h> #ifndef NDEBUG //#define RNR_EXPECTS(x) Expects(x) //#define RNR_ENSURES(x) Ensures(x) /** * specifies a precondition that is expected to be true * terminates the program if the condition is not met and the program is compiled in debug mode */ #define RNR_EXPECTS(x) \ do { \ if (!(x)) { \ LOG(ERROR) << "assertion failed: " << #x; \ std::terminate(); \ } \ } while (0) /** * specifies a postcondition that is expected to be made true by the code block above * terminates the program if the condition is not met and the program is compiled in debug mode */ #define RNR_ENSURES(x) \ do { \ if (!(x)) { \ LOG(ERROR) << "assertion failed: " << #x; \ std::terminate(); \ } \ } while (0) #else #define RNR_EXPECTS(x) #define RNR_ENSURES(x) #endif
Nobel laureate Bob Solow pronounced 30 years ago that “you can see the computer age everywhere but in the productivity statistics”. At the start of the 1980s, the world entered the digital age. Fax machines transformed communications. The introduction of personal computers made high-powered computing available to all. But it took time to work out how to make best use of these major changes in technology. In the 1980s, output per worker in the US grew by only 1.4 per cent a year. But between 1995 and 2005, this had accelerated to 2.1 per cent. We are on the cusp of another acceleration in productivity growth, due to artificial intelligence (AI). Even the mention of AI strikes fear into many hearts. Surely this will cause massive job losses? That is one way to boost productivity, but it’s hardly desirable. In fact, to date most of the applications of AI in companies have not replaced workers. Rather, they have supplemented what employees do, enabling them to be more productive. Two recent pieces in the Harvard Business Review provide firm evidence for this. Satya Ramswamy found that the most common use of AI and data analytics was in back-office functions, particularly IT, finance and accounting, where the processes were already at least partly automated. Thomas H Davenport and Rajeev Ronanki came to the same conclusion in a detailed survey of 152 companies. AI was used, for example, to read contracts or to extract information from emails to update customer contact information or changes to orders. Developments within the techniques of AI itself suggest that practical applications of the concept are about to spread much more widely. There was a surge of research interest in AI in the 1980s and 1990s. It did not lead to much. Essentially, in this phase of development, people tried to get machines to think like humans. If you wanted a translation, for example, your algorithm had to try to learn spelling, the correct use of grammar, and so on. But this proved too hard. The real breakthrough was through the 2000s. Researchers realised that algorithms were much better than humans at one particular task: namely, matching patterns. To develop a good translator, you give the machine some documents in English, say, and the same ones translated into French. The algorithm learns how to match the patterns. It does not know any grammar. It does not even know that it is “reading” English and French. So at one level, it is stupid, not intelligent. But it exceptionally good at matching up the patterns. In the jargon, this is “supervised machine learning”. At the same time, a new study in the MIT Technology Review shows that purely scientific advances in this field are slowing down markedly. In other words, in the space of a single decade, this has become a mature analytical technology – one that can be used with confidence in practical applications, in the knowledge that it is unlikely to be made obsolete by new developments. Productivity looks set to boom in the 2020s.
#include <iostream> #include <boost/date_time/posix_time/posix_time.hpp> #include "tools.h" #include "asiohandler.h" int main(int argc, const char* argv[]) { const std::string msg = argc > 1 ? join(&argv[1], &argv[argc], " ") : "info: Hello World!"; boost::asio::io_service ioService; AsioHandler handler(ioService); handler.connect("localhost", 5672); AMQP::Connection connection(&handler, AMQP::Login("guest", "guest"), "/"); boost::asio::deadline_timer t(ioService, boost::posix_time::millisec(100)); AMQP::Channel channel(&connection); channel.declareExchange("logs", AMQP::fanout).onSuccess([&]() { channel.publish("logs", "", msg); std::cout << " [x] Sent "<<msg<< std::endl; t.async_wait([&](const boost::system::error_code&){ioService.stop();}); }); ioService.run(); return 0; }
text \<open>Authors: Anthony Bordg and Lawrence Paulson\<close> theory Set_Extras imports "Jacobson_Basic_Algebra.Set_Theory" begin text \<open>Some new notation for built-in primitives\<close> section \<open>Sets\<close> abbreviation complement_in_of:: "'a set \<Rightarrow> 'a set \<Rightarrow> 'a set" ("_\<setminus>_" [65,65]65) where "A \<setminus> B \<equiv> A-B" section \<open>Functions\<close> abbreviation preimage:: "('a \<Rightarrow> 'b) \<Rightarrow> 'a set \<Rightarrow> 'b set \<Rightarrow> 'a set" ("_ \<^sup>\<inverse> _ _" [90,90,1000]90) where "f\<^sup>\<inverse> X V \<equiv> (vimage f V) \<inter> X" lemma preimage_of_inter: fixes f::"'a \<Rightarrow> 'b" and X::"'a set" and V::"'b set" and V'::"'b set" shows "f\<^sup>\<inverse> X (V \<inter> V') = (f\<^sup>\<inverse> X V) \<inter> (f\<^sup>\<inverse> X V')" by blast lemma preimage_identity_self: "identity A \<^sup>\<inverse> A B = B \<inter> A" by (simp add: vimage_inter_cong) text \<open>Simplification actually replaces the RHS by the LHS\<close> lemma preimage_vimage_eq: "(f \<^sup>\<inverse> (f -` U') U) \<inter> X = f\<^sup>\<inverse> X (U \<inter> U')" by simp definition inverse_map:: "('a \<Rightarrow> 'b) \<Rightarrow> 'a set \<Rightarrow> 'b set \<Rightarrow> ('b \<Rightarrow> 'a)" where "inverse_map f S T \<equiv> restrict (inv_into S f) T" lemma bijective_map_preimage: assumes "bijective_map f S T" shows "bijective_map (inverse_map f S T) T S" proof show "inverse_map f S T \<in> T \<rightarrow>\<^sub>E S" by (simp add: assms bij_betw_imp_funcset bij_betw_inv_into bijective.bijective bijective_map.axioms(2) inverse_map_def) show "bij_betw (inverse_map f S T) T S" using assms by (simp add: bij_betw_inv_into bijective_def bijective_map_def inverse_map_def) qed lemma inverse_map_identity [simp]: "inverse_map (identity S) S S = identity S" by (metis Id_compose compose_id_inv_into image_ident image_restrict_eq inv_into_funcset inverse_map_def restrict_extensional) abbreviation composing ("_ \<circ> _ \<down> _" [60,0,60]59) where "g \<circ> f \<down> D \<equiv> compose D g f" lemma comp_maps: assumes "Set_Theory.map \<eta> A B" and "Set_Theory.map \<theta> B C" shows "Set_Theory.map (\<theta> \<circ> \<eta> \<down> A) A C" proof- have "(\<theta> \<circ> \<eta> \<down> A) \<in> A \<rightarrow>\<^sub>E C" using assms by (metis Int_iff PiE_def compose_def funcset_compose map.graph restrict_extensional) thus ?thesis by (simp add: Set_Theory.map_def) qed lemma undefined_is_map_on_empty: fixes f:: "'a set \<Rightarrow> 'b set" assumes "f = (\<lambda>x. undefined)" shows "map f {} {}" using assms by (simp add: map.intro) lemma restrict_on_source: assumes "map f S T" shows "restrict f S = f" using assms by (meson PiE_restrict map.graph) lemma restrict_further: assumes "map f S T" and "U \<subseteq> S" and "V \<subseteq> U" shows "restrict (restrict f U) V = restrict f V" using assms by (simp add: inf.absorb_iff2) lemma map_eq: assumes "map f S T" and "map g S T" and "\<And>x. x \<in> S \<Longrightarrow> f x = g x" shows "f = g" using assms by (metis restrict_ext restrict_on_source) lemma image_subset_of_target: assumes "map f S T" shows "f ` S \<subseteq> T" using assms by (meson image_subsetI map.map_closed) end
[GOAL] n : ℕ F : TypeVec (n + 1) → Type u mvf : MvFunctor F q : MvQPF F α : TypeVec n β : Type u g : β → F (α ::: β) x : β ⊢ M.dest (P F) (corecF g x) = (TypeVec.id ::: corecF g) <$$> repr (g x) [PROOFSTEP] rw [corecF, M.dest_corec] [GOAL] n : ℕ F : TypeVec (n + 1) → Type u mvf : MvFunctor F q : MvQPF F α β : TypeVec n g : α ⟹ β ⊢ ∀ (a b : M (P F) α), Mcongr a b → (fun x => Quot.mk Mcongr (g <$$> x)) a = (fun x => Quot.mk Mcongr (g <$$> x)) b [PROOFSTEP] rintro aa₁ aa₂ ⟨r, pr, ra₁a₂⟩ [GOAL] case intro.intro n : ℕ F : TypeVec (n + 1) → Type u mvf : MvFunctor F q : MvQPF F α β : TypeVec n g : α ⟹ β aa₁ aa₂ : M (P F) α r : M (P F) α → M (P F) α → Prop pr : IsPrecongr r ra₁a₂ : r aa₁ aa₂ ⊢ (fun x => Quot.mk Mcongr (g <$$> x)) aa₁ = (fun x => Quot.mk Mcongr (g <$$> x)) aa₂ [PROOFSTEP] apply Quot.sound [GOAL] case intro.intro.a n : ℕ F : TypeVec (n + 1) → Type u mvf : MvFunctor F q : MvQPF F α β : TypeVec n g : α ⟹ β aa₁ aa₂ : M (P F) α r : M (P F) α → M (P F) α → Prop pr : IsPrecongr r ra₁a₂ : r aa₁ aa₂ ⊢ Mcongr (g <$$> aa₁) (g <$$> aa₂) [PROOFSTEP] let r' b₁ b₂ := ∃ a₁ a₂ : q.P.M α, r a₁ a₂ ∧ b₁ = g <$$> a₁ ∧ b₂ = g <$$> a₂ [GOAL] case intro.intro.a n : ℕ F : TypeVec (n + 1) → Type u mvf : MvFunctor F q : MvQPF F α β : TypeVec n g : α ⟹ β aa₁ aa₂ : M (P F) α r : M (P F) α → M (P F) α → Prop pr : IsPrecongr r ra₁a₂ : r aa₁ aa₂ r' : M (P F) β → M (P F) β → Prop := fun b₁ b₂ => ∃ a₁ a₂, r a₁ a₂ ∧ b₁ = g <$$> a₁ ∧ b₂ = g <$$> a₂ ⊢ Mcongr (g <$$> aa₁) (g <$$> aa₂) [PROOFSTEP] use r' [GOAL] case h n : ℕ F : TypeVec (n + 1) → Type u mvf : MvFunctor F q : MvQPF F α β : TypeVec n g : α ⟹ β aa₁ aa₂ : M (P F) α r : M (P F) α → M (P F) α → Prop pr : IsPrecongr r ra₁a₂ : r aa₁ aa₂ r' : M (P F) β → M (P F) β → Prop := fun b₁ b₂ => ∃ a₁ a₂, r a₁ a₂ ∧ b₁ = g <$$> a₁ ∧ b₂ = g <$$> a₂ ⊢ IsPrecongr r' ∧ r' (g <$$> aa₁) (g <$$> aa₂) [PROOFSTEP] constructor [GOAL] case h.left n : ℕ F : TypeVec (n + 1) → Type u mvf : MvFunctor F q : MvQPF F α β : TypeVec n g : α ⟹ β aa₁ aa₂ : M (P F) α r : M (P F) α → M (P F) α → Prop pr : IsPrecongr r ra₁a₂ : r aa₁ aa₂ r' : M (P F) β → M (P F) β → Prop := fun b₁ b₂ => ∃ a₁ a₂, r a₁ a₂ ∧ b₁ = g <$$> a₁ ∧ b₂ = g <$$> a₂ ⊢ IsPrecongr r' [PROOFSTEP] show IsPrecongr r' [GOAL] case h.left n : ℕ F : TypeVec (n + 1) → Type u mvf : MvFunctor F q : MvQPF F α β : TypeVec n g : α ⟹ β aa₁ aa₂ : M (P F) α r : M (P F) α → M (P F) α → Prop pr : IsPrecongr r ra₁a₂ : r aa₁ aa₂ r' : M (P F) β → M (P F) β → Prop := fun b₁ b₂ => ∃ a₁ a₂, r a₁ a₂ ∧ b₁ = g <$$> a₁ ∧ b₂ = g <$$> a₂ ⊢ IsPrecongr r' [PROOFSTEP] rintro b₁ b₂ ⟨a₁, a₂, ra₁a₂, b₁eq, b₂eq⟩ [GOAL] case h.left.intro.intro.intro.intro n : ℕ F : TypeVec (n + 1) → Type u mvf : MvFunctor F q : MvQPF F α β : TypeVec n g : α ⟹ β aa₁ aa₂ : M (P F) α r : M (P F) α → M (P F) α → Prop pr : IsPrecongr r ra₁a₂✝ : r aa₁ aa₂ r' : M (P F) β → M (P F) β → Prop := fun b₁ b₂ => ∃ a₁ a₂, r a₁ a₂ ∧ b₁ = g <$$> a₁ ∧ b₂ = g <$$> a₂ b₁ b₂ : M (P F) β a₁ a₂ : M (P F) α ra₁a₂ : r a₁ a₂ b₁eq : b₁ = g <$$> a₁ b₂eq : b₂ = g <$$> a₂ ⊢ abs ((TypeVec.id ::: Quot.mk r') <$$> M.dest (P F) b₁) = abs ((TypeVec.id ::: Quot.mk r') <$$> M.dest (P F) b₂) [PROOFSTEP] let u : Quot r → Quot r' := Quot.lift (fun x : q.P.M α => Quot.mk r' (g <$$> x)) (by intro a₁ a₂ ra₁a₂ apply Quot.sound exact ⟨a₁, a₂, ra₁a₂, rfl, rfl⟩) [GOAL] n : ℕ F : TypeVec (n + 1) → Type u mvf : MvFunctor F q : MvQPF F α β : TypeVec n g : α ⟹ β aa₁ aa₂ : M (P F) α r : M (P F) α → M (P F) α → Prop pr : IsPrecongr r ra₁a₂✝ : r aa₁ aa₂ r' : M (P F) β → M (P F) β → Prop := fun b₁ b₂ => ∃ a₁ a₂, r a₁ a₂ ∧ b₁ = g <$$> a₁ ∧ b₂ = g <$$> a₂ b₁ b₂ : M (P F) β a₁ a₂ : M (P F) α ra₁a₂ : r a₁ a₂ b₁eq : b₁ = g <$$> a₁ b₂eq : b₂ = g <$$> a₂ ⊢ ∀ (a b : M (P F) α), r a b → (fun x => Quot.mk r' (g <$$> x)) a = (fun x => Quot.mk r' (g <$$> x)) b [PROOFSTEP] intro a₁ a₂ ra₁a₂ [GOAL] n : ℕ F : TypeVec (n + 1) → Type u mvf : MvFunctor F q : MvQPF F α β : TypeVec n g : α ⟹ β aa₁ aa₂ : M (P F) α r : M (P F) α → M (P F) α → Prop pr : IsPrecongr r ra₁a₂✝¹ : r aa₁ aa₂ r' : M (P F) β → M (P F) β → Prop := fun b₁ b₂ => ∃ a₁ a₂, r a₁ a₂ ∧ b₁ = g <$$> a₁ ∧ b₂ = g <$$> a₂ b₁ b₂ : M (P F) β a₁✝ a₂✝ : M (P F) α ra₁a₂✝ : r a₁✝ a₂✝ b₁eq : b₁ = g <$$> a₁✝ b₂eq : b₂ = g <$$> a₂✝ a₁ a₂ : M (P F) α ra₁a₂ : r a₁ a₂ ⊢ (fun x => Quot.mk r' (g <$$> x)) a₁ = (fun x => Quot.mk r' (g <$$> x)) a₂ [PROOFSTEP] apply Quot.sound [GOAL] case a n : ℕ F : TypeVec (n + 1) → Type u mvf : MvFunctor F q : MvQPF F α β : TypeVec n g : α ⟹ β aa₁ aa₂ : M (P F) α r : M (P F) α → M (P F) α → Prop pr : IsPrecongr r ra₁a₂✝¹ : r aa₁ aa₂ r' : M (P F) β → M (P F) β → Prop := fun b₁ b₂ => ∃ a₁ a₂, r a₁ a₂ ∧ b₁ = g <$$> a₁ ∧ b₂ = g <$$> a₂ b₁ b₂ : M (P F) β a₁✝ a₂✝ : M (P F) α ra₁a₂✝ : r a₁✝ a₂✝ b₁eq : b₁ = g <$$> a₁✝ b₂eq : b₂ = g <$$> a₂✝ a₁ a₂ : M (P F) α ra₁a₂ : r a₁ a₂ ⊢ r' (g <$$> a₁) (g <$$> a₂) [PROOFSTEP] exact ⟨a₁, a₂, ra₁a₂, rfl, rfl⟩ [GOAL] case h.left.intro.intro.intro.intro n : ℕ F : TypeVec (n + 1) → Type u mvf : MvFunctor F q : MvQPF F α β : TypeVec n g : α ⟹ β aa₁ aa₂ : M (P F) α r : M (P F) α → M (P F) α → Prop pr : IsPrecongr r ra₁a₂✝ : r aa₁ aa₂ r' : M (P F) β → M (P F) β → Prop := fun b₁ b₂ => ∃ a₁ a₂, r a₁ a₂ ∧ b₁ = g <$$> a₁ ∧ b₂ = g <$$> a₂ b₁ b₂ : M (P F) β a₁ a₂ : M (P F) α ra₁a₂ : r a₁ a₂ b₁eq : b₁ = g <$$> a₁ b₂eq : b₂ = g <$$> a₂ u : Quot r → Quot r' := Quot.lift (fun x => Quot.mk r' (g <$$> x)) (_ : ∀ (a₁ a₂ : M (P F) α), r a₁ a₂ → Quot.mk r' (g <$$> a₁) = Quot.mk r' (g <$$> a₂)) ⊢ abs ((TypeVec.id ::: Quot.mk r') <$$> M.dest (P F) b₁) = abs ((TypeVec.id ::: Quot.mk r') <$$> M.dest (P F) b₂) [PROOFSTEP] have hu : (Quot.mk r' ∘ fun x : q.P.M α => g <$$> x) = u ∘ Quot.mk r := by ext x rfl [GOAL] n : ℕ F : TypeVec (n + 1) → Type u mvf : MvFunctor F q : MvQPF F α β : TypeVec n g : α ⟹ β aa₁ aa₂ : M (P F) α r : M (P F) α → M (P F) α → Prop pr : IsPrecongr r ra₁a₂✝ : r aa₁ aa₂ r' : M (P F) β → M (P F) β → Prop := fun b₁ b₂ => ∃ a₁ a₂, r a₁ a₂ ∧ b₁ = g <$$> a₁ ∧ b₂ = g <$$> a₂ b₁ b₂ : M (P F) β a₁ a₂ : M (P F) α ra₁a₂ : r a₁ a₂ b₁eq : b₁ = g <$$> a₁ b₂eq : b₂ = g <$$> a₂ u : Quot r → Quot r' := Quot.lift (fun x => Quot.mk r' (g <$$> x)) (_ : ∀ (a₁ a₂ : M (P F) α), r a₁ a₂ → Quot.mk r' (g <$$> a₁) = Quot.mk r' (g <$$> a₂)) ⊢ (Quot.mk r' ∘ fun x => g <$$> x) = u ∘ Quot.mk r [PROOFSTEP] ext x [GOAL] case h n : ℕ F : TypeVec (n + 1) → Type u mvf : MvFunctor F q : MvQPF F α β : TypeVec n g : α ⟹ β aa₁ aa₂ : M (P F) α r : M (P F) α → M (P F) α → Prop pr : IsPrecongr r ra₁a₂✝ : r aa₁ aa₂ r' : M (P F) β → M (P F) β → Prop := fun b₁ b₂ => ∃ a₁ a₂, r a₁ a₂ ∧ b₁ = g <$$> a₁ ∧ b₂ = g <$$> a₂ b₁ b₂ : M (P F) β a₁ a₂ : M (P F) α ra₁a₂ : r a₁ a₂ b₁eq : b₁ = g <$$> a₁ b₂eq : b₂ = g <$$> a₂ u : Quot r → Quot r' := Quot.lift (fun x => Quot.mk r' (g <$$> x)) (_ : ∀ (a₁ a₂ : M (P F) α), r a₁ a₂ → Quot.mk r' (g <$$> a₁) = Quot.mk r' (g <$$> a₂)) x : M (P F) α ⊢ (Quot.mk r' ∘ fun x => g <$$> x) x = (u ∘ Quot.mk r) x [PROOFSTEP] rfl [GOAL] case h.left.intro.intro.intro.intro n : ℕ F : TypeVec (n + 1) → Type u mvf : MvFunctor F q : MvQPF F α β : TypeVec n g : α ⟹ β aa₁ aa₂ : M (P F) α r : M (P F) α → M (P F) α → Prop pr : IsPrecongr r ra₁a₂✝ : r aa₁ aa₂ r' : M (P F) β → M (P F) β → Prop := fun b₁ b₂ => ∃ a₁ a₂, r a₁ a₂ ∧ b₁ = g <$$> a₁ ∧ b₂ = g <$$> a₂ b₁ b₂ : M (P F) β a₁ a₂ : M (P F) α ra₁a₂ : r a₁ a₂ b₁eq : b₁ = g <$$> a₁ b₂eq : b₂ = g <$$> a₂ u : Quot r → Quot r' := Quot.lift (fun x => Quot.mk r' (g <$$> x)) (_ : ∀ (a₁ a₂ : M (P F) α), r a₁ a₂ → Quot.mk r' (g <$$> a₁) = Quot.mk r' (g <$$> a₂)) hu : (Quot.mk r' ∘ fun x => g <$$> x) = u ∘ Quot.mk r ⊢ abs ((TypeVec.id ::: Quot.mk r') <$$> M.dest (P F) b₁) = abs ((TypeVec.id ::: Quot.mk r') <$$> M.dest (P F) b₂) [PROOFSTEP] rw [b₁eq, b₂eq, M.dest_map, M.dest_map, ← q.P.comp_map, ← q.P.comp_map] [GOAL] case h.left.intro.intro.intro.intro n : ℕ F : TypeVec (n + 1) → Type u mvf : MvFunctor F q : MvQPF F α β : TypeVec n g : α ⟹ β aa₁ aa₂ : M (P F) α r : M (P F) α → M (P F) α → Prop pr : IsPrecongr r ra₁a₂✝ : r aa₁ aa₂ r' : M (P F) β → M (P F) β → Prop := fun b₁ b₂ => ∃ a₁ a₂, r a₁ a₂ ∧ b₁ = g <$$> a₁ ∧ b₂ = g <$$> a₂ b₁ b₂ : M (P F) β a₁ a₂ : M (P F) α ra₁a₂ : r a₁ a₂ b₁eq : b₁ = g <$$> a₁ b₂eq : b₂ = g <$$> a₂ u : Quot r → Quot r' := Quot.lift (fun x => Quot.mk r' (g <$$> x)) (_ : ∀ (a₁ a₂ : M (P F) α), r a₁ a₂ → Quot.mk r' (g <$$> a₁) = Quot.mk r' (g <$$> a₂)) hu : (Quot.mk r' ∘ fun x => g <$$> x) = u ∘ Quot.mk r ⊢ abs (((TypeVec.id ::: Quot.mk r') ⊚ (g ::: fun x => g <$$> x)) <$$> M.dest (P F) a₁) = abs (((TypeVec.id ::: Quot.mk r') ⊚ (g ::: fun x => g <$$> x)) <$$> M.dest (P F) a₂) [PROOFSTEP] rw [← appendFun_comp, id_comp, hu, ← comp_id g, appendFun_comp] [GOAL] case h.left.intro.intro.intro.intro n : ℕ F : TypeVec (n + 1) → Type u mvf : MvFunctor F q : MvQPF F α β : TypeVec n g : α ⟹ β aa₁ aa₂ : M (P F) α r : M (P F) α → M (P F) α → Prop pr : IsPrecongr r ra₁a₂✝ : r aa₁ aa₂ r' : M (P F) β → M (P F) β → Prop := fun b₁ b₂ => ∃ a₁ a₂, r a₁ a₂ ∧ b₁ = g <$$> a₁ ∧ b₂ = g <$$> a₂ b₁ b₂ : M (P F) β a₁ a₂ : M (P F) α ra₁a₂ : r a₁ a₂ b₁eq : b₁ = g <$$> a₁ b₂eq : b₂ = g <$$> a₂ u : Quot r → Quot r' := Quot.lift (fun x => Quot.mk r' (g <$$> x)) (_ : ∀ (a₁ a₂ : M (P F) α), r a₁ a₂ → Quot.mk r' (g <$$> a₁) = Quot.mk r' (g <$$> a₂)) hu : (Quot.mk r' ∘ fun x => g <$$> x) = u ∘ Quot.mk r ⊢ abs (((g ::: u) ⊚ (TypeVec.id ::: Quot.mk r)) <$$> M.dest (P F) a₁) = abs (((g ::: u) ⊚ (TypeVec.id ::: Quot.mk r)) <$$> M.dest (P F) a₂) [PROOFSTEP] rw [q.P.comp_map, q.P.comp_map, abs_map, pr ra₁a₂, ← abs_map] [GOAL] case h.right n : ℕ F : TypeVec (n + 1) → Type u mvf : MvFunctor F q : MvQPF F α β : TypeVec n g : α ⟹ β aa₁ aa₂ : M (P F) α r : M (P F) α → M (P F) α → Prop pr : IsPrecongr r ra₁a₂ : r aa₁ aa₂ r' : M (P F) β → M (P F) β → Prop := fun b₁ b₂ => ∃ a₁ a₂, r a₁ a₂ ∧ b₁ = g <$$> a₁ ∧ b₂ = g <$$> a₂ ⊢ r' (g <$$> aa₁) (g <$$> aa₂) [PROOFSTEP] show r' (g <$$> aa₁) (g <$$> aa₂) [GOAL] case h.right n : ℕ F : TypeVec (n + 1) → Type u mvf : MvFunctor F q : MvQPF F α β : TypeVec n g : α ⟹ β aa₁ aa₂ : M (P F) α r : M (P F) α → M (P F) α → Prop pr : IsPrecongr r ra₁a₂ : r aa₁ aa₂ r' : M (P F) β → M (P F) β → Prop := fun b₁ b₂ => ∃ a₁ a₂, r a₁ a₂ ∧ b₁ = g <$$> a₁ ∧ b₂ = g <$$> a₂ ⊢ r' (g <$$> aa₁) (g <$$> aa₂) [PROOFSTEP] exact ⟨aa₁, aa₂, ra₁a₂, rfl, rfl⟩ [GOAL] n : ℕ F : TypeVec (n + 1) → Type u mvf : MvFunctor F q : MvQPF F α : TypeVec n ⊢ ∀ (a b : M (P F) α), Mcongr a b → (fun x => (TypeVec.id ::: Quot.mk Mcongr) <$$> abs (M.dest (P F) x)) a = (fun x => (TypeVec.id ::: Quot.mk Mcongr) <$$> abs (M.dest (P F) x)) b [PROOFSTEP] rintro x y ⟨r, pr, rxy⟩ [GOAL] case intro.intro n : ℕ F : TypeVec (n + 1) → Type u mvf : MvFunctor F q : MvQPF F α : TypeVec n x y : M (P F) α r : M (P F) α → M (P F) α → Prop pr : IsPrecongr r rxy : r x y ⊢ (fun x => (TypeVec.id ::: Quot.mk Mcongr) <$$> abs (M.dest (P F) x)) x = (fun x => (TypeVec.id ::: Quot.mk Mcongr) <$$> abs (M.dest (P F) x)) y [PROOFSTEP] dsimp [GOAL] case intro.intro n : ℕ F : TypeVec (n + 1) → Type u mvf : MvFunctor F q : MvQPF F α : TypeVec n x y : M (P F) α r : M (P F) α → M (P F) α → Prop pr : IsPrecongr r rxy : r x y ⊢ (TypeVec.id ::: Quot.mk Mcongr) <$$> abs (M.dest (P F) x) = (TypeVec.id ::: Quot.mk Mcongr) <$$> abs (M.dest (P F) y) [PROOFSTEP] have : ∀ x y, r x y → Mcongr x y := by intro x y h exact ⟨r, pr, h⟩ [GOAL] n : ℕ F : TypeVec (n + 1) → Type u mvf : MvFunctor F q : MvQPF F α : TypeVec n x y : M (P F) α r : M (P F) α → M (P F) α → Prop pr : IsPrecongr r rxy : r x y ⊢ ∀ (x y : M (P F) α), r x y → Mcongr x y [PROOFSTEP] intro x y h [GOAL] n : ℕ F : TypeVec (n + 1) → Type u mvf : MvFunctor F q : MvQPF F α : TypeVec n x✝ y✝ : M (P F) α r : M (P F) α → M (P F) α → Prop pr : IsPrecongr r rxy : r x✝ y✝ x y : M (P F) α h : r x y ⊢ Mcongr x y [PROOFSTEP] exact ⟨r, pr, h⟩ [GOAL] case intro.intro n : ℕ F : TypeVec (n + 1) → Type u mvf : MvFunctor F q : MvQPF F α : TypeVec n x y : M (P F) α r : M (P F) α → M (P F) α → Prop pr : IsPrecongr r rxy : r x y this : ∀ (x y : M (P F) α), r x y → Mcongr x y ⊢ (TypeVec.id ::: Quot.mk Mcongr) <$$> abs (M.dest (P F) x) = (TypeVec.id ::: Quot.mk Mcongr) <$$> abs (M.dest (P F) y) [PROOFSTEP] rw [← Quot.factor_mk_eq _ _ this] [GOAL] case intro.intro n : ℕ F : TypeVec (n + 1) → Type u mvf : MvFunctor F q : MvQPF F α : TypeVec n x y : M (P F) α r : M (P F) α → M (P F) α → Prop pr : IsPrecongr r rxy : r x y this : ∀ (x y : M (P F) α), r x y → Mcongr x y ⊢ (TypeVec.id ::: Quot.factor (fun x y => r x y) (fun x y => Mcongr x y) this ∘ Quot.mk fun x y => r x y) <$$> abs (M.dest (P F) x) = (TypeVec.id ::: Quot.factor (fun x y => r x y) (fun x y => Mcongr x y) this ∘ Quot.mk fun x y => r x y) <$$> abs (M.dest (P F) y) [PROOFSTEP] conv => lhs rw [appendFun_comp_id, comp_map, ← abs_map, pr rxy, abs_map, ← comp_map, ← appendFun_comp_id] [GOAL] n : ℕ F : TypeVec (n + 1) → Type u mvf : MvFunctor F q : MvQPF F α : TypeVec n x y : M (P F) α r : M (P F) α → M (P F) α → Prop pr : IsPrecongr r rxy : r x y this : ∀ (x y : M (P F) α), r x y → Mcongr x y | (TypeVec.id ::: Quot.factor (fun x y => r x y) (fun x y => Mcongr x y) this ∘ Quot.mk fun x y => r x y) <$$> abs (M.dest (P F) x) = (TypeVec.id ::: Quot.factor (fun x y => r x y) (fun x y => Mcongr x y) this ∘ Quot.mk fun x y => r x y) <$$> abs (M.dest (P F) y) [PROOFSTEP] lhs rw [appendFun_comp_id, comp_map, ← abs_map, pr rxy, abs_map, ← comp_map, ← appendFun_comp_id] [GOAL] n : ℕ F : TypeVec (n + 1) → Type u mvf : MvFunctor F q : MvQPF F α : TypeVec n x y : M (P F) α r : M (P F) α → M (P F) α → Prop pr : IsPrecongr r rxy : r x y this : ∀ (x y : M (P F) α), r x y → Mcongr x y | (TypeVec.id ::: Quot.factor (fun x y => r x y) (fun x y => Mcongr x y) this ∘ Quot.mk fun x y => r x y) <$$> abs (M.dest (P F) x) = (TypeVec.id ::: Quot.factor (fun x y => r x y) (fun x y => Mcongr x y) this ∘ Quot.mk fun x y => r x y) <$$> abs (M.dest (P F) y) [PROOFSTEP] lhs rw [appendFun_comp_id, comp_map, ← abs_map, pr rxy, abs_map, ← comp_map, ← appendFun_comp_id] [GOAL] n : ℕ F : TypeVec (n + 1) → Type u mvf : MvFunctor F q : MvQPF F α : TypeVec n x y : M (P F) α r : M (P F) α → M (P F) α → Prop pr : IsPrecongr r rxy : r x y this : ∀ (x y : M (P F) α), r x y → Mcongr x y | (TypeVec.id ::: Quot.factor (fun x y => r x y) (fun x y => Mcongr x y) this ∘ Quot.mk fun x y => r x y) <$$> abs (M.dest (P F) x) = (TypeVec.id ::: Quot.factor (fun x y => r x y) (fun x y => Mcongr x y) this ∘ Quot.mk fun x y => r x y) <$$> abs (M.dest (P F) y) [PROOFSTEP] lhs [GOAL] n : ℕ F : TypeVec (n + 1) → Type u mvf : MvFunctor F q : MvQPF F α : TypeVec n x y : M (P F) α r : M (P F) α → M (P F) α → Prop pr : IsPrecongr r rxy : r x y this : ∀ (x y : M (P F) α), r x y → Mcongr x y | (TypeVec.id ::: Quot.factor (fun x y => r x y) (fun x y => Mcongr x y) this ∘ Quot.mk fun x y => r x y) <$$> abs (M.dest (P F) x) [PROOFSTEP] rw [appendFun_comp_id, comp_map, ← abs_map, pr rxy, abs_map, ← comp_map, ← appendFun_comp_id] [GOAL] n : ℕ F : TypeVec (n + 1) → Type u mvf : MvFunctor F q : MvQPF F α : TypeVec n β : Type u g : β → F (α ::: β) x : β ⊢ dest (corec g x) = (TypeVec.id ::: corec g) <$$> g x [PROOFSTEP] conv => lhs rw [Cofix.dest, Cofix.corec]; [GOAL] n : ℕ F : TypeVec (n + 1) → Type u mvf : MvFunctor F q : MvQPF F α : TypeVec n β : Type u g : β → F (α ::: β) x : β | dest (corec g x) = (TypeVec.id ::: corec g) <$$> g x [PROOFSTEP] lhs rw [Cofix.dest, Cofix.corec]; [GOAL] n : ℕ F : TypeVec (n + 1) → Type u mvf : MvFunctor F q : MvQPF F α : TypeVec n β : Type u g : β → F (α ::: β) x : β | dest (corec g x) = (TypeVec.id ::: corec g) <$$> g x [PROOFSTEP] lhs rw [Cofix.dest, Cofix.corec]; [GOAL] n : ℕ F : TypeVec (n + 1) → Type u mvf : MvFunctor F q : MvQPF F α : TypeVec n β : Type u g : β → F (α ::: β) x : β | dest (corec g x) = (TypeVec.id ::: corec g) <$$> g x [PROOFSTEP] lhs [GOAL] n : ℕ F : TypeVec (n + 1) → Type u mvf : MvFunctor F q : MvQPF F α : TypeVec n β : Type u g : β → F (α ::: β) x : β | dest (corec g x) [PROOFSTEP] rw [Cofix.dest, Cofix.corec] [GOAL] n : ℕ F : TypeVec (n + 1) → Type u mvf : MvFunctor F q : MvQPF F α : TypeVec n β : Type u g : β → F (α ::: β) x : β ⊢ Quot.lift (fun x => (TypeVec.id ::: Quot.mk Mcongr) <$$> MvQPF.abs (M.dest (P F) x)) (_ : ∀ (x y : M (P F) α), Mcongr x y → (fun x => (TypeVec.id ::: Quot.mk Mcongr) <$$> MvQPF.abs (M.dest (P F) x)) x = (fun x => (TypeVec.id ::: Quot.mk Mcongr) <$$> MvQPF.abs (M.dest (P F) x)) y) (Quot.mk Mcongr (corecF g x)) = (TypeVec.id ::: corec g) <$$> g x [PROOFSTEP] dsimp [GOAL] n : ℕ F : TypeVec (n + 1) → Type u mvf : MvFunctor F q : MvQPF F α : TypeVec n β : Type u g : β → F (α ::: β) x : β ⊢ (TypeVec.id ::: Quot.mk Mcongr) <$$> MvQPF.abs (M.dest (P F) (corecF g x)) = (TypeVec.id ::: corec g) <$$> g x [PROOFSTEP] rw [corecF_eq, abs_map, abs_repr, ← comp_map, ← appendFun_comp] [GOAL] n : ℕ F : TypeVec (n + 1) → Type u mvf : MvFunctor F q : MvQPF F α : TypeVec n β : Type u g : β → F (α ::: β) x : β ⊢ (TypeVec.id ⊚ TypeVec.id ::: Quot.mk Mcongr ∘ corecF g) <$$> g x = (TypeVec.id ::: corec g) <$$> g x [PROOFSTEP] rfl [GOAL] n : ℕ F : TypeVec (n + 1) → Type u mvf : MvFunctor F q : MvQPF F α : TypeVec n r : Cofix F α → Cofix F α → Prop h' : ∀ (x : Cofix F α), r x x h : ∀ (x y : Cofix F α), r x y → (TypeVec.id ::: Quot.mk r) <$$> dest x = (TypeVec.id ::: Quot.mk r) <$$> dest y ⊢ ∀ (x y : Cofix F α), r x y → x = y [PROOFSTEP] intro x [GOAL] n : ℕ F : TypeVec (n + 1) → Type u mvf : MvFunctor F q : MvQPF F α : TypeVec n r : Cofix F α → Cofix F α → Prop h' : ∀ (x : Cofix F α), r x x h : ∀ (x y : Cofix F α), r x y → (TypeVec.id ::: Quot.mk r) <$$> dest x = (TypeVec.id ::: Quot.mk r) <$$> dest y x : Cofix F α ⊢ ∀ (y : Cofix F α), r x y → x = y [PROOFSTEP] rcases x [GOAL] case mk n : ℕ F : TypeVec (n + 1) → Type u mvf : MvFunctor F q : MvQPF F α : TypeVec n r : Cofix F α → Cofix F α → Prop h' : ∀ (x : Cofix F α), r x x h : ∀ (x y : Cofix F α), r x y → (TypeVec.id ::: Quot.mk r) <$$> dest x = (TypeVec.id ::: Quot.mk r) <$$> dest y x : Cofix F α a✝ : M (P F) α ⊢ ∀ (y : Cofix F α), r (Quot.mk Mcongr a✝) y → Quot.mk Mcongr a✝ = y [PROOFSTEP] clear x [GOAL] case mk n : ℕ F : TypeVec (n + 1) → Type u mvf : MvFunctor F q : MvQPF F α : TypeVec n r : Cofix F α → Cofix F α → Prop h' : ∀ (x : Cofix F α), r x x h : ∀ (x y : Cofix F α), r x y → (TypeVec.id ::: Quot.mk r) <$$> dest x = (TypeVec.id ::: Quot.mk r) <$$> dest y a✝ : M (P F) α ⊢ ∀ (y : Cofix F α), r (Quot.mk Mcongr a✝) y → Quot.mk Mcongr a✝ = y [PROOFSTEP] rename M (P F) α => x [GOAL] case mk n : ℕ F : TypeVec (n + 1) → Type u mvf : MvFunctor F q : MvQPF F α : TypeVec n r : Cofix F α → Cofix F α → Prop h' : ∀ (x : Cofix F α), r x x h : ∀ (x y : Cofix F α), r x y → (TypeVec.id ::: Quot.mk r) <$$> dest x = (TypeVec.id ::: Quot.mk r) <$$> dest y x : M (P F) α ⊢ ∀ (y : Cofix F α), r (Quot.mk Mcongr x) y → Quot.mk Mcongr x = y [PROOFSTEP] intro y [GOAL] case mk n : ℕ F : TypeVec (n + 1) → Type u mvf : MvFunctor F q : MvQPF F α : TypeVec n r : Cofix F α → Cofix F α → Prop h' : ∀ (x : Cofix F α), r x x h : ∀ (x y : Cofix F α), r x y → (TypeVec.id ::: Quot.mk r) <$$> dest x = (TypeVec.id ::: Quot.mk r) <$$> dest y x : M (P F) α y : Cofix F α ⊢ r (Quot.mk Mcongr x) y → Quot.mk Mcongr x = y [PROOFSTEP] rcases y [GOAL] case mk.mk n : ℕ F : TypeVec (n + 1) → Type u mvf : MvFunctor F q : MvQPF F α : TypeVec n r : Cofix F α → Cofix F α → Prop h' : ∀ (x : Cofix F α), r x x h : ∀ (x y : Cofix F α), r x y → (TypeVec.id ::: Quot.mk r) <$$> dest x = (TypeVec.id ::: Quot.mk r) <$$> dest y x : M (P F) α y : Cofix F α a✝ : M (P F) α ⊢ r (Quot.mk Mcongr x) (Quot.mk Mcongr a✝) → Quot.mk Mcongr x = Quot.mk Mcongr a✝ [PROOFSTEP] clear y [GOAL] case mk.mk n : ℕ F : TypeVec (n + 1) → Type u mvf : MvFunctor F q : MvQPF F α : TypeVec n r : Cofix F α → Cofix F α → Prop h' : ∀ (x : Cofix F α), r x x h : ∀ (x y : Cofix F α), r x y → (TypeVec.id ::: Quot.mk r) <$$> dest x = (TypeVec.id ::: Quot.mk r) <$$> dest y x a✝ : M (P F) α ⊢ r (Quot.mk Mcongr x) (Quot.mk Mcongr a✝) → Quot.mk Mcongr x = Quot.mk Mcongr a✝ [PROOFSTEP] rename M (P F) α => y [GOAL] case mk.mk n : ℕ F : TypeVec (n + 1) → Type u mvf : MvFunctor F q : MvQPF F α : TypeVec n r : Cofix F α → Cofix F α → Prop h' : ∀ (x : Cofix F α), r x x h : ∀ (x y : Cofix F α), r x y → (TypeVec.id ::: Quot.mk r) <$$> dest x = (TypeVec.id ::: Quot.mk r) <$$> dest y x y : M (P F) α ⊢ r (Quot.mk Mcongr x) (Quot.mk Mcongr y) → Quot.mk Mcongr x = Quot.mk Mcongr y [PROOFSTEP] intro rxy [GOAL] case mk.mk n : ℕ F : TypeVec (n + 1) → Type u mvf : MvFunctor F q : MvQPF F α : TypeVec n r : Cofix F α → Cofix F α → Prop h' : ∀ (x : Cofix F α), r x x h : ∀ (x y : Cofix F α), r x y → (TypeVec.id ::: Quot.mk r) <$$> dest x = (TypeVec.id ::: Quot.mk r) <$$> dest y x y : M (P F) α rxy : r (Quot.mk Mcongr x) (Quot.mk Mcongr y) ⊢ Quot.mk Mcongr x = Quot.mk Mcongr y [PROOFSTEP] apply Quot.sound [GOAL] case mk.mk.a n : ℕ F : TypeVec (n + 1) → Type u mvf : MvFunctor F q : MvQPF F α : TypeVec n r : Cofix F α → Cofix F α → Prop h' : ∀ (x : Cofix F α), r x x h : ∀ (x y : Cofix F α), r x y → (TypeVec.id ::: Quot.mk r) <$$> dest x = (TypeVec.id ::: Quot.mk r) <$$> dest y x y : M (P F) α rxy : r (Quot.mk Mcongr x) (Quot.mk Mcongr y) ⊢ Mcongr x y [PROOFSTEP] let r' := fun x y => r (Quot.mk _ x) (Quot.mk _ y) [GOAL] case mk.mk.a n : ℕ F : TypeVec (n + 1) → Type u mvf : MvFunctor F q : MvQPF F α : TypeVec n r : Cofix F α → Cofix F α → Prop h' : ∀ (x : Cofix F α), r x x h : ∀ (x y : Cofix F α), r x y → (TypeVec.id ::: Quot.mk r) <$$> dest x = (TypeVec.id ::: Quot.mk r) <$$> dest y x y : M (P F) α rxy : r (Quot.mk Mcongr x) (Quot.mk Mcongr y) r' : M (P F) α → M (P F) α → Prop := fun x y => r (Quot.mk Mcongr x) (Quot.mk Mcongr y) ⊢ Mcongr x y [PROOFSTEP] have hr' : r' = fun x y => r (Quot.mk _ x) (Quot.mk _ y) := by rfl [GOAL] n : ℕ F : TypeVec (n + 1) → Type u mvf : MvFunctor F q : MvQPF F α : TypeVec n r : Cofix F α → Cofix F α → Prop h' : ∀ (x : Cofix F α), r x x h : ∀ (x y : Cofix F α), r x y → (TypeVec.id ::: Quot.mk r) <$$> dest x = (TypeVec.id ::: Quot.mk r) <$$> dest y x y : M (P F) α rxy : r (Quot.mk Mcongr x) (Quot.mk Mcongr y) r' : M (P F) α → M (P F) α → Prop := fun x y => r (Quot.mk Mcongr x) (Quot.mk Mcongr y) ⊢ r' = fun x y => r (Quot.mk Mcongr x) (Quot.mk Mcongr y) [PROOFSTEP] rfl [GOAL] case mk.mk.a n : ℕ F : TypeVec (n + 1) → Type u mvf : MvFunctor F q : MvQPF F α : TypeVec n r : Cofix F α → Cofix F α → Prop h' : ∀ (x : Cofix F α), r x x h : ∀ (x y : Cofix F α), r x y → (TypeVec.id ::: Quot.mk r) <$$> dest x = (TypeVec.id ::: Quot.mk r) <$$> dest y x y : M (P F) α rxy : r (Quot.mk Mcongr x) (Quot.mk Mcongr y) r' : M (P F) α → M (P F) α → Prop := fun x y => r (Quot.mk Mcongr x) (Quot.mk Mcongr y) hr' : r' = fun x y => r (Quot.mk Mcongr x) (Quot.mk Mcongr y) ⊢ Mcongr x y [PROOFSTEP] have : IsPrecongr r' := by intro a b r'ab have h₀ : appendFun id (Quot.mk r ∘ Quot.mk Mcongr) <$$> MvQPF.abs (M.dest q.P a) = appendFun id (Quot.mk r ∘ Quot.mk Mcongr) <$$> MvQPF.abs (M.dest q.P b) := by rw [appendFun_comp_id, comp_map, comp_map]; exact h _ _ r'ab have h₁ : ∀ u v : q.P.M α, Mcongr u v → Quot.mk r' u = Quot.mk r' v := by intro u v cuv apply Quot.sound dsimp [hr'] rw [Quot.sound cuv] apply h' let f : Quot r → Quot r' := Quot.lift (Quot.lift (Quot.mk r') h₁) (by intro c apply Quot.inductionOn (motive := fun c => ∀ b, r c b → Quot.lift (Quot.mk r') h₁ c = Quot.lift (Quot.mk r') h₁ b) c clear c intro c d apply Quot.inductionOn (motive := fun d => r (Quot.mk Mcongr c) d → Quot.lift (Quot.mk r') h₁ (Quot.mk Mcongr c) = Quot.lift (Quot.mk r') h₁ d) d clear d intro d rcd; apply Quot.sound; apply rcd) have : f ∘ Quot.mk r ∘ Quot.mk Mcongr = Quot.mk r' := rfl rw [← this, appendFun_comp_id, q.P.comp_map, q.P.comp_map, abs_map, abs_map, abs_map, abs_map, h₀] [GOAL] n : ℕ F : TypeVec (n + 1) → Type u mvf : MvFunctor F q : MvQPF F α : TypeVec n r : Cofix F α → Cofix F α → Prop h' : ∀ (x : Cofix F α), r x x h : ∀ (x y : Cofix F α), r x y → (TypeVec.id ::: Quot.mk r) <$$> dest x = (TypeVec.id ::: Quot.mk r) <$$> dest y x y : M (P F) α rxy : r (Quot.mk Mcongr x) (Quot.mk Mcongr y) r' : M (P F) α → M (P F) α → Prop := fun x y => r (Quot.mk Mcongr x) (Quot.mk Mcongr y) hr' : r' = fun x y => r (Quot.mk Mcongr x) (Quot.mk Mcongr y) ⊢ IsPrecongr r' [PROOFSTEP] intro a b r'ab [GOAL] n : ℕ F : TypeVec (n + 1) → Type u mvf : MvFunctor F q : MvQPF F α : TypeVec n r : Cofix F α → Cofix F α → Prop h' : ∀ (x : Cofix F α), r x x h : ∀ (x y : Cofix F α), r x y → (TypeVec.id ::: Quot.mk r) <$$> dest x = (TypeVec.id ::: Quot.mk r) <$$> dest y x y : M (P F) α rxy : r (Quot.mk Mcongr x) (Quot.mk Mcongr y) r' : M (P F) α → M (P F) α → Prop := fun x y => r (Quot.mk Mcongr x) (Quot.mk Mcongr y) hr' : r' = fun x y => r (Quot.mk Mcongr x) (Quot.mk Mcongr y) a b : M (P F) α r'ab : r' a b ⊢ MvQPF.abs ((TypeVec.id ::: Quot.mk r') <$$> M.dest (P F) a) = MvQPF.abs ((TypeVec.id ::: Quot.mk r') <$$> M.dest (P F) b) [PROOFSTEP] have h₀ : appendFun id (Quot.mk r ∘ Quot.mk Mcongr) <$$> MvQPF.abs (M.dest q.P a) = appendFun id (Quot.mk r ∘ Quot.mk Mcongr) <$$> MvQPF.abs (M.dest q.P b) := by rw [appendFun_comp_id, comp_map, comp_map]; exact h _ _ r'ab [GOAL] n : ℕ F : TypeVec (n + 1) → Type u mvf : MvFunctor F q : MvQPF F α : TypeVec n r : Cofix F α → Cofix F α → Prop h' : ∀ (x : Cofix F α), r x x h : ∀ (x y : Cofix F α), r x y → (TypeVec.id ::: Quot.mk r) <$$> dest x = (TypeVec.id ::: Quot.mk r) <$$> dest y x y : M (P F) α rxy : r (Quot.mk Mcongr x) (Quot.mk Mcongr y) r' : M (P F) α → M (P F) α → Prop := fun x y => r (Quot.mk Mcongr x) (Quot.mk Mcongr y) hr' : r' = fun x y => r (Quot.mk Mcongr x) (Quot.mk Mcongr y) a b : M (P F) α r'ab : r' a b ⊢ (TypeVec.id ::: Quot.mk r ∘ Quot.mk Mcongr) <$$> MvQPF.abs (M.dest (P F) a) = (TypeVec.id ::: Quot.mk r ∘ Quot.mk Mcongr) <$$> MvQPF.abs (M.dest (P F) b) [PROOFSTEP] rw [appendFun_comp_id, comp_map, comp_map] [GOAL] n : ℕ F : TypeVec (n + 1) → Type u mvf : MvFunctor F q : MvQPF F α : TypeVec n r : Cofix F α → Cofix F α → Prop h' : ∀ (x : Cofix F α), r x x h : ∀ (x y : Cofix F α), r x y → (TypeVec.id ::: Quot.mk r) <$$> dest x = (TypeVec.id ::: Quot.mk r) <$$> dest y x y : M (P F) α rxy : r (Quot.mk Mcongr x) (Quot.mk Mcongr y) r' : M (P F) α → M (P F) α → Prop := fun x y => r (Quot.mk Mcongr x) (Quot.mk Mcongr y) hr' : r' = fun x y => r (Quot.mk Mcongr x) (Quot.mk Mcongr y) a b : M (P F) α r'ab : r' a b ⊢ (TypeVec.id ::: Quot.mk r) <$$> (TypeVec.id ::: Quot.mk Mcongr) <$$> MvQPF.abs (M.dest (P F) a) = (TypeVec.id ::: Quot.mk r) <$$> (TypeVec.id ::: Quot.mk Mcongr) <$$> MvQPF.abs (M.dest (P F) b) [PROOFSTEP] exact h _ _ r'ab [GOAL] n : ℕ F : TypeVec (n + 1) → Type u mvf : MvFunctor F q : MvQPF F α : TypeVec n r : Cofix F α → Cofix F α → Prop h' : ∀ (x : Cofix F α), r x x h : ∀ (x y : Cofix F α), r x y → (TypeVec.id ::: Quot.mk r) <$$> dest x = (TypeVec.id ::: Quot.mk r) <$$> dest y x y : M (P F) α rxy : r (Quot.mk Mcongr x) (Quot.mk Mcongr y) r' : M (P F) α → M (P F) α → Prop := fun x y => r (Quot.mk Mcongr x) (Quot.mk Mcongr y) hr' : r' = fun x y => r (Quot.mk Mcongr x) (Quot.mk Mcongr y) a b : M (P F) α r'ab : r' a b h₀ : (TypeVec.id ::: Quot.mk r ∘ Quot.mk Mcongr) <$$> MvQPF.abs (M.dest (P F) a) = (TypeVec.id ::: Quot.mk r ∘ Quot.mk Mcongr) <$$> MvQPF.abs (M.dest (P F) b) ⊢ MvQPF.abs ((TypeVec.id ::: Quot.mk r') <$$> M.dest (P F) a) = MvQPF.abs ((TypeVec.id ::: Quot.mk r') <$$> M.dest (P F) b) [PROOFSTEP] have h₁ : ∀ u v : q.P.M α, Mcongr u v → Quot.mk r' u = Quot.mk r' v := by intro u v cuv apply Quot.sound dsimp [hr'] rw [Quot.sound cuv] apply h' [GOAL] n : ℕ F : TypeVec (n + 1) → Type u mvf : MvFunctor F q : MvQPF F α : TypeVec n r : Cofix F α → Cofix F α → Prop h' : ∀ (x : Cofix F α), r x x h : ∀ (x y : Cofix F α), r x y → (TypeVec.id ::: Quot.mk r) <$$> dest x = (TypeVec.id ::: Quot.mk r) <$$> dest y x y : M (P F) α rxy : r (Quot.mk Mcongr x) (Quot.mk Mcongr y) r' : M (P F) α → M (P F) α → Prop := fun x y => r (Quot.mk Mcongr x) (Quot.mk Mcongr y) hr' : r' = fun x y => r (Quot.mk Mcongr x) (Quot.mk Mcongr y) a b : M (P F) α r'ab : r' a b h₀ : (TypeVec.id ::: Quot.mk r ∘ Quot.mk Mcongr) <$$> MvQPF.abs (M.dest (P F) a) = (TypeVec.id ::: Quot.mk r ∘ Quot.mk Mcongr) <$$> MvQPF.abs (M.dest (P F) b) ⊢ ∀ (u v : M (P F) α), Mcongr u v → Quot.mk r' u = Quot.mk r' v [PROOFSTEP] intro u v cuv [GOAL] n : ℕ F : TypeVec (n + 1) → Type u mvf : MvFunctor F q : MvQPF F α : TypeVec n r : Cofix F α → Cofix F α → Prop h' : ∀ (x : Cofix F α), r x x h : ∀ (x y : Cofix F α), r x y → (TypeVec.id ::: Quot.mk r) <$$> dest x = (TypeVec.id ::: Quot.mk r) <$$> dest y x y : M (P F) α rxy : r (Quot.mk Mcongr x) (Quot.mk Mcongr y) r' : M (P F) α → M (P F) α → Prop := fun x y => r (Quot.mk Mcongr x) (Quot.mk Mcongr y) hr' : r' = fun x y => r (Quot.mk Mcongr x) (Quot.mk Mcongr y) a b : M (P F) α r'ab : r' a b h₀ : (TypeVec.id ::: Quot.mk r ∘ Quot.mk Mcongr) <$$> MvQPF.abs (M.dest (P F) a) = (TypeVec.id ::: Quot.mk r ∘ Quot.mk Mcongr) <$$> MvQPF.abs (M.dest (P F) b) u v : M (P F) α cuv : Mcongr u v ⊢ Quot.mk r' u = Quot.mk r' v [PROOFSTEP] apply Quot.sound [GOAL] case a n : ℕ F : TypeVec (n + 1) → Type u mvf : MvFunctor F q : MvQPF F α : TypeVec n r : Cofix F α → Cofix F α → Prop h' : ∀ (x : Cofix F α), r x x h : ∀ (x y : Cofix F α), r x y → (TypeVec.id ::: Quot.mk r) <$$> dest x = (TypeVec.id ::: Quot.mk r) <$$> dest y x y : M (P F) α rxy : r (Quot.mk Mcongr x) (Quot.mk Mcongr y) r' : M (P F) α → M (P F) α → Prop := fun x y => r (Quot.mk Mcongr x) (Quot.mk Mcongr y) hr' : r' = fun x y => r (Quot.mk Mcongr x) (Quot.mk Mcongr y) a b : M (P F) α r'ab : r' a b h₀ : (TypeVec.id ::: Quot.mk r ∘ Quot.mk Mcongr) <$$> MvQPF.abs (M.dest (P F) a) = (TypeVec.id ::: Quot.mk r ∘ Quot.mk Mcongr) <$$> MvQPF.abs (M.dest (P F) b) u v : M (P F) α cuv : Mcongr u v ⊢ r' u v [PROOFSTEP] dsimp [hr'] [GOAL] case a n : ℕ F : TypeVec (n + 1) → Type u mvf : MvFunctor F q : MvQPF F α : TypeVec n r : Cofix F α → Cofix F α → Prop h' : ∀ (x : Cofix F α), r x x h : ∀ (x y : Cofix F α), r x y → (TypeVec.id ::: Quot.mk r) <$$> dest x = (TypeVec.id ::: Quot.mk r) <$$> dest y x y : M (P F) α rxy : r (Quot.mk Mcongr x) (Quot.mk Mcongr y) r' : M (P F) α → M (P F) α → Prop := fun x y => r (Quot.mk Mcongr x) (Quot.mk Mcongr y) hr' : r' = fun x y => r (Quot.mk Mcongr x) (Quot.mk Mcongr y) a b : M (P F) α r'ab : r' a b h₀ : (TypeVec.id ::: Quot.mk r ∘ Quot.mk Mcongr) <$$> MvQPF.abs (M.dest (P F) a) = (TypeVec.id ::: Quot.mk r ∘ Quot.mk Mcongr) <$$> MvQPF.abs (M.dest (P F) b) u v : M (P F) α cuv : Mcongr u v ⊢ r (Quot.mk Mcongr u) (Quot.mk Mcongr v) [PROOFSTEP] rw [Quot.sound cuv] [GOAL] case a n : ℕ F : TypeVec (n + 1) → Type u mvf : MvFunctor F q : MvQPF F α : TypeVec n r : Cofix F α → Cofix F α → Prop h' : ∀ (x : Cofix F α), r x x h : ∀ (x y : Cofix F α), r x y → (TypeVec.id ::: Quot.mk r) <$$> dest x = (TypeVec.id ::: Quot.mk r) <$$> dest y x y : M (P F) α rxy : r (Quot.mk Mcongr x) (Quot.mk Mcongr y) r' : M (P F) α → M (P F) α → Prop := fun x y => r (Quot.mk Mcongr x) (Quot.mk Mcongr y) hr' : r' = fun x y => r (Quot.mk Mcongr x) (Quot.mk Mcongr y) a b : M (P F) α r'ab : r' a b h₀ : (TypeVec.id ::: Quot.mk r ∘ Quot.mk Mcongr) <$$> MvQPF.abs (M.dest (P F) a) = (TypeVec.id ::: Quot.mk r ∘ Quot.mk Mcongr) <$$> MvQPF.abs (M.dest (P F) b) u v : M (P F) α cuv : Mcongr u v ⊢ r (Quot.mk Mcongr v) (Quot.mk Mcongr v) [PROOFSTEP] apply h' [GOAL] n : ℕ F : TypeVec (n + 1) → Type u mvf : MvFunctor F q : MvQPF F α : TypeVec n r : Cofix F α → Cofix F α → Prop h' : ∀ (x : Cofix F α), r x x h : ∀ (x y : Cofix F α), r x y → (TypeVec.id ::: Quot.mk r) <$$> dest x = (TypeVec.id ::: Quot.mk r) <$$> dest y x y : M (P F) α rxy : r (Quot.mk Mcongr x) (Quot.mk Mcongr y) r' : M (P F) α → M (P F) α → Prop := fun x y => r (Quot.mk Mcongr x) (Quot.mk Mcongr y) hr' : r' = fun x y => r (Quot.mk Mcongr x) (Quot.mk Mcongr y) a b : M (P F) α r'ab : r' a b h₀ : (TypeVec.id ::: Quot.mk r ∘ Quot.mk Mcongr) <$$> MvQPF.abs (M.dest (P F) a) = (TypeVec.id ::: Quot.mk r ∘ Quot.mk Mcongr) <$$> MvQPF.abs (M.dest (P F) b) h₁ : ∀ (u v : M (P F) α), Mcongr u v → Quot.mk r' u = Quot.mk r' v ⊢ MvQPF.abs ((TypeVec.id ::: Quot.mk r') <$$> M.dest (P F) a) = MvQPF.abs ((TypeVec.id ::: Quot.mk r') <$$> M.dest (P F) b) [PROOFSTEP] let f : Quot r → Quot r' := Quot.lift (Quot.lift (Quot.mk r') h₁) (by intro c apply Quot.inductionOn (motive := fun c => ∀ b, r c b → Quot.lift (Quot.mk r') h₁ c = Quot.lift (Quot.mk r') h₁ b) c clear c intro c d apply Quot.inductionOn (motive := fun d => r (Quot.mk Mcongr c) d → Quot.lift (Quot.mk r') h₁ (Quot.mk Mcongr c) = Quot.lift (Quot.mk r') h₁ d) d clear d intro d rcd; apply Quot.sound; apply rcd) [GOAL] n : ℕ F : TypeVec (n + 1) → Type u mvf : MvFunctor F q : MvQPF F α : TypeVec n r : Cofix F α → Cofix F α → Prop h' : ∀ (x : Cofix F α), r x x h : ∀ (x y : Cofix F α), r x y → (TypeVec.id ::: Quot.mk r) <$$> dest x = (TypeVec.id ::: Quot.mk r) <$$> dest y x y : M (P F) α rxy : r (Quot.mk Mcongr x) (Quot.mk Mcongr y) r' : M (P F) α → M (P F) α → Prop := fun x y => r (Quot.mk Mcongr x) (Quot.mk Mcongr y) hr' : r' = fun x y => r (Quot.mk Mcongr x) (Quot.mk Mcongr y) a b : M (P F) α r'ab : r' a b h₀ : (TypeVec.id ::: Quot.mk r ∘ Quot.mk Mcongr) <$$> MvQPF.abs (M.dest (P F) a) = (TypeVec.id ::: Quot.mk r ∘ Quot.mk Mcongr) <$$> MvQPF.abs (M.dest (P F) b) h₁ : ∀ (u v : M (P F) α), Mcongr u v → Quot.mk r' u = Quot.mk r' v ⊢ ∀ (a b : Cofix F α), r a b → Quot.lift (Quot.mk r') h₁ a = Quot.lift (Quot.mk r') h₁ b [PROOFSTEP] intro c [GOAL] n : ℕ F : TypeVec (n + 1) → Type u mvf : MvFunctor F q : MvQPF F α : TypeVec n r : Cofix F α → Cofix F α → Prop h' : ∀ (x : Cofix F α), r x x h : ∀ (x y : Cofix F α), r x y → (TypeVec.id ::: Quot.mk r) <$$> dest x = (TypeVec.id ::: Quot.mk r) <$$> dest y x y : M (P F) α rxy : r (Quot.mk Mcongr x) (Quot.mk Mcongr y) r' : M (P F) α → M (P F) α → Prop := fun x y => r (Quot.mk Mcongr x) (Quot.mk Mcongr y) hr' : r' = fun x y => r (Quot.mk Mcongr x) (Quot.mk Mcongr y) a b : M (P F) α r'ab : r' a b h₀ : (TypeVec.id ::: Quot.mk r ∘ Quot.mk Mcongr) <$$> MvQPF.abs (M.dest (P F) a) = (TypeVec.id ::: Quot.mk r ∘ Quot.mk Mcongr) <$$> MvQPF.abs (M.dest (P F) b) h₁ : ∀ (u v : M (P F) α), Mcongr u v → Quot.mk r' u = Quot.mk r' v c : Cofix F α ⊢ ∀ (b : Cofix F α), r c b → Quot.lift (Quot.mk r') h₁ c = Quot.lift (Quot.mk r') h₁ b [PROOFSTEP] apply Quot.inductionOn (motive := fun c => ∀ b, r c b → Quot.lift (Quot.mk r') h₁ c = Quot.lift (Quot.mk r') h₁ b) c [GOAL] n : ℕ F : TypeVec (n + 1) → Type u mvf : MvFunctor F q : MvQPF F α : TypeVec n r : Cofix F α → Cofix F α → Prop h' : ∀ (x : Cofix F α), r x x h : ∀ (x y : Cofix F α), r x y → (TypeVec.id ::: Quot.mk r) <$$> dest x = (TypeVec.id ::: Quot.mk r) <$$> dest y x y : M (P F) α rxy : r (Quot.mk Mcongr x) (Quot.mk Mcongr y) r' : M (P F) α → M (P F) α → Prop := fun x y => r (Quot.mk Mcongr x) (Quot.mk Mcongr y) hr' : r' = fun x y => r (Quot.mk Mcongr x) (Quot.mk Mcongr y) a b : M (P F) α r'ab : r' a b h₀ : (TypeVec.id ::: Quot.mk r ∘ Quot.mk Mcongr) <$$> MvQPF.abs (M.dest (P F) a) = (TypeVec.id ::: Quot.mk r ∘ Quot.mk Mcongr) <$$> MvQPF.abs (M.dest (P F) b) h₁ : ∀ (u v : M (P F) α), Mcongr u v → Quot.mk r' u = Quot.mk r' v c : Cofix F α ⊢ ∀ (a : M (P F) α) (b : Cofix F α), r (Quot.mk Mcongr a) b → Quot.lift (Quot.mk r') h₁ (Quot.mk Mcongr a) = Quot.lift (Quot.mk r') h₁ b [PROOFSTEP] clear c [GOAL] n : ℕ F : TypeVec (n + 1) → Type u mvf : MvFunctor F q : MvQPF F α : TypeVec n r : Cofix F α → Cofix F α → Prop h' : ∀ (x : Cofix F α), r x x h : ∀ (x y : Cofix F α), r x y → (TypeVec.id ::: Quot.mk r) <$$> dest x = (TypeVec.id ::: Quot.mk r) <$$> dest y x y : M (P F) α rxy : r (Quot.mk Mcongr x) (Quot.mk Mcongr y) r' : M (P F) α → M (P F) α → Prop := fun x y => r (Quot.mk Mcongr x) (Quot.mk Mcongr y) hr' : r' = fun x y => r (Quot.mk Mcongr x) (Quot.mk Mcongr y) a b : M (P F) α r'ab : r' a b h₀ : (TypeVec.id ::: Quot.mk r ∘ Quot.mk Mcongr) <$$> MvQPF.abs (M.dest (P F) a) = (TypeVec.id ::: Quot.mk r ∘ Quot.mk Mcongr) <$$> MvQPF.abs (M.dest (P F) b) h₁ : ∀ (u v : M (P F) α), Mcongr u v → Quot.mk r' u = Quot.mk r' v ⊢ ∀ (a : M (P F) α) (b : Cofix F α), r (Quot.mk Mcongr a) b → Quot.lift (Quot.mk r') h₁ (Quot.mk Mcongr a) = Quot.lift (Quot.mk r') h₁ b [PROOFSTEP] intro c d [GOAL] n : ℕ F : TypeVec (n + 1) → Type u mvf : MvFunctor F q : MvQPF F α : TypeVec n r : Cofix F α → Cofix F α → Prop h' : ∀ (x : Cofix F α), r x x h : ∀ (x y : Cofix F α), r x y → (TypeVec.id ::: Quot.mk r) <$$> dest x = (TypeVec.id ::: Quot.mk r) <$$> dest y x y : M (P F) α rxy : r (Quot.mk Mcongr x) (Quot.mk Mcongr y) r' : M (P F) α → M (P F) α → Prop := fun x y => r (Quot.mk Mcongr x) (Quot.mk Mcongr y) hr' : r' = fun x y => r (Quot.mk Mcongr x) (Quot.mk Mcongr y) a b : M (P F) α r'ab : r' a b h₀ : (TypeVec.id ::: Quot.mk r ∘ Quot.mk Mcongr) <$$> MvQPF.abs (M.dest (P F) a) = (TypeVec.id ::: Quot.mk r ∘ Quot.mk Mcongr) <$$> MvQPF.abs (M.dest (P F) b) h₁ : ∀ (u v : M (P F) α), Mcongr u v → Quot.mk r' u = Quot.mk r' v c : M (P F) α d : Cofix F α ⊢ r (Quot.mk Mcongr c) d → Quot.lift (Quot.mk r') h₁ (Quot.mk Mcongr c) = Quot.lift (Quot.mk r') h₁ d [PROOFSTEP] apply Quot.inductionOn (motive := fun d => r (Quot.mk Mcongr c) d → Quot.lift (Quot.mk r') h₁ (Quot.mk Mcongr c) = Quot.lift (Quot.mk r') h₁ d) d [GOAL] n : ℕ F : TypeVec (n + 1) → Type u mvf : MvFunctor F q : MvQPF F α : TypeVec n r : Cofix F α → Cofix F α → Prop h' : ∀ (x : Cofix F α), r x x h : ∀ (x y : Cofix F α), r x y → (TypeVec.id ::: Quot.mk r) <$$> dest x = (TypeVec.id ::: Quot.mk r) <$$> dest y x y : M (P F) α rxy : r (Quot.mk Mcongr x) (Quot.mk Mcongr y) r' : M (P F) α → M (P F) α → Prop := fun x y => r (Quot.mk Mcongr x) (Quot.mk Mcongr y) hr' : r' = fun x y => r (Quot.mk Mcongr x) (Quot.mk Mcongr y) a b : M (P F) α r'ab : r' a b h₀ : (TypeVec.id ::: Quot.mk r ∘ Quot.mk Mcongr) <$$> MvQPF.abs (M.dest (P F) a) = (TypeVec.id ::: Quot.mk r ∘ Quot.mk Mcongr) <$$> MvQPF.abs (M.dest (P F) b) h₁ : ∀ (u v : M (P F) α), Mcongr u v → Quot.mk r' u = Quot.mk r' v c : M (P F) α d : Cofix F α ⊢ ∀ (a : M (P F) α), r (Quot.mk Mcongr c) (Quot.mk Mcongr a) → Quot.lift (Quot.mk r') h₁ (Quot.mk Mcongr c) = Quot.lift (Quot.mk r') h₁ (Quot.mk Mcongr a) [PROOFSTEP] clear d [GOAL] n : ℕ F : TypeVec (n + 1) → Type u mvf : MvFunctor F q : MvQPF F α : TypeVec n r : Cofix F α → Cofix F α → Prop h' : ∀ (x : Cofix F α), r x x h : ∀ (x y : Cofix F α), r x y → (TypeVec.id ::: Quot.mk r) <$$> dest x = (TypeVec.id ::: Quot.mk r) <$$> dest y x y : M (P F) α rxy : r (Quot.mk Mcongr x) (Quot.mk Mcongr y) r' : M (P F) α → M (P F) α → Prop := fun x y => r (Quot.mk Mcongr x) (Quot.mk Mcongr y) hr' : r' = fun x y => r (Quot.mk Mcongr x) (Quot.mk Mcongr y) a b : M (P F) α r'ab : r' a b h₀ : (TypeVec.id ::: Quot.mk r ∘ Quot.mk Mcongr) <$$> MvQPF.abs (M.dest (P F) a) = (TypeVec.id ::: Quot.mk r ∘ Quot.mk Mcongr) <$$> MvQPF.abs (M.dest (P F) b) h₁ : ∀ (u v : M (P F) α), Mcongr u v → Quot.mk r' u = Quot.mk r' v c : M (P F) α ⊢ ∀ (a : M (P F) α), r (Quot.mk Mcongr c) (Quot.mk Mcongr a) → Quot.lift (Quot.mk r') h₁ (Quot.mk Mcongr c) = Quot.lift (Quot.mk r') h₁ (Quot.mk Mcongr a) [PROOFSTEP] intro d rcd [GOAL] n : ℕ F : TypeVec (n + 1) → Type u mvf : MvFunctor F q : MvQPF F α : TypeVec n r : Cofix F α → Cofix F α → Prop h' : ∀ (x : Cofix F α), r x x h : ∀ (x y : Cofix F α), r x y → (TypeVec.id ::: Quot.mk r) <$$> dest x = (TypeVec.id ::: Quot.mk r) <$$> dest y x y : M (P F) α rxy : r (Quot.mk Mcongr x) (Quot.mk Mcongr y) r' : M (P F) α → M (P F) α → Prop := fun x y => r (Quot.mk Mcongr x) (Quot.mk Mcongr y) hr' : r' = fun x y => r (Quot.mk Mcongr x) (Quot.mk Mcongr y) a b : M (P F) α r'ab : r' a b h₀ : (TypeVec.id ::: Quot.mk r ∘ Quot.mk Mcongr) <$$> MvQPF.abs (M.dest (P F) a) = (TypeVec.id ::: Quot.mk r ∘ Quot.mk Mcongr) <$$> MvQPF.abs (M.dest (P F) b) h₁ : ∀ (u v : M (P F) α), Mcongr u v → Quot.mk r' u = Quot.mk r' v c d : M (P F) α rcd : r (Quot.mk Mcongr c) (Quot.mk Mcongr d) ⊢ Quot.lift (Quot.mk r') h₁ (Quot.mk Mcongr c) = Quot.lift (Quot.mk r') h₁ (Quot.mk Mcongr d) [PROOFSTEP] apply Quot.sound [GOAL] case a n : ℕ F : TypeVec (n + 1) → Type u mvf : MvFunctor F q : MvQPF F α : TypeVec n r : Cofix F α → Cofix F α → Prop h' : ∀ (x : Cofix F α), r x x h : ∀ (x y : Cofix F α), r x y → (TypeVec.id ::: Quot.mk r) <$$> dest x = (TypeVec.id ::: Quot.mk r) <$$> dest y x y : M (P F) α rxy : r (Quot.mk Mcongr x) (Quot.mk Mcongr y) r' : M (P F) α → M (P F) α → Prop := fun x y => r (Quot.mk Mcongr x) (Quot.mk Mcongr y) hr' : r' = fun x y => r (Quot.mk Mcongr x) (Quot.mk Mcongr y) a b : M (P F) α r'ab : r' a b h₀ : (TypeVec.id ::: Quot.mk r ∘ Quot.mk Mcongr) <$$> MvQPF.abs (M.dest (P F) a) = (TypeVec.id ::: Quot.mk r ∘ Quot.mk Mcongr) <$$> MvQPF.abs (M.dest (P F) b) h₁ : ∀ (u v : M (P F) α), Mcongr u v → Quot.mk r' u = Quot.mk r' v c d : M (P F) α rcd : r (Quot.mk Mcongr c) (Quot.mk Mcongr d) ⊢ r' c d [PROOFSTEP] apply rcd [GOAL] n : ℕ F : TypeVec (n + 1) → Type u mvf : MvFunctor F q : MvQPF F α : TypeVec n r : Cofix F α → Cofix F α → Prop h' : ∀ (x : Cofix F α), r x x h : ∀ (x y : Cofix F α), r x y → (TypeVec.id ::: Quot.mk r) <$$> dest x = (TypeVec.id ::: Quot.mk r) <$$> dest y x y : M (P F) α rxy : r (Quot.mk Mcongr x) (Quot.mk Mcongr y) r' : M (P F) α → M (P F) α → Prop := fun x y => r (Quot.mk Mcongr x) (Quot.mk Mcongr y) hr' : r' = fun x y => r (Quot.mk Mcongr x) (Quot.mk Mcongr y) a b : M (P F) α r'ab : r' a b h₀ : (TypeVec.id ::: Quot.mk r ∘ Quot.mk Mcongr) <$$> MvQPF.abs (M.dest (P F) a) = (TypeVec.id ::: Quot.mk r ∘ Quot.mk Mcongr) <$$> MvQPF.abs (M.dest (P F) b) h₁ : ∀ (u v : M (P F) α), Mcongr u v → Quot.mk r' u = Quot.mk r' v f : Quot r → Quot r' := Quot.lift (Quot.lift (Quot.mk r') h₁) (_ : ∀ (c b : Cofix F α), r c b → Quot.lift (Quot.mk r') h₁ c = Quot.lift (Quot.mk r') h₁ b) ⊢ MvQPF.abs ((TypeVec.id ::: Quot.mk r') <$$> M.dest (P F) a) = MvQPF.abs ((TypeVec.id ::: Quot.mk r') <$$> M.dest (P F) b) [PROOFSTEP] have : f ∘ Quot.mk r ∘ Quot.mk Mcongr = Quot.mk r' := rfl [GOAL] n : ℕ F : TypeVec (n + 1) → Type u mvf : MvFunctor F q : MvQPF F α : TypeVec n r : Cofix F α → Cofix F α → Prop h' : ∀ (x : Cofix F α), r x x h : ∀ (x y : Cofix F α), r x y → (TypeVec.id ::: Quot.mk r) <$$> dest x = (TypeVec.id ::: Quot.mk r) <$$> dest y x y : M (P F) α rxy : r (Quot.mk Mcongr x) (Quot.mk Mcongr y) r' : M (P F) α → M (P F) α → Prop := fun x y => r (Quot.mk Mcongr x) (Quot.mk Mcongr y) hr' : r' = fun x y => r (Quot.mk Mcongr x) (Quot.mk Mcongr y) a b : M (P F) α r'ab : r' a b h₀ : (TypeVec.id ::: Quot.mk r ∘ Quot.mk Mcongr) <$$> MvQPF.abs (M.dest (P F) a) = (TypeVec.id ::: Quot.mk r ∘ Quot.mk Mcongr) <$$> MvQPF.abs (M.dest (P F) b) h₁ : ∀ (u v : M (P F) α), Mcongr u v → Quot.mk r' u = Quot.mk r' v f : Quot r → Quot r' := Quot.lift (Quot.lift (Quot.mk r') h₁) (_ : ∀ (c b : Cofix F α), r c b → Quot.lift (Quot.mk r') h₁ c = Quot.lift (Quot.mk r') h₁ b) this : f ∘ Quot.mk r ∘ Quot.mk Mcongr = Quot.mk r' ⊢ MvQPF.abs ((TypeVec.id ::: Quot.mk r') <$$> M.dest (P F) a) = MvQPF.abs ((TypeVec.id ::: Quot.mk r') <$$> M.dest (P F) b) [PROOFSTEP] rw [← this, appendFun_comp_id, q.P.comp_map, q.P.comp_map, abs_map, abs_map, abs_map, abs_map, h₀] [GOAL] case mk.mk.a n : ℕ F : TypeVec (n + 1) → Type u mvf : MvFunctor F q : MvQPF F α : TypeVec n r : Cofix F α → Cofix F α → Prop h' : ∀ (x : Cofix F α), r x x h : ∀ (x y : Cofix F α), r x y → (TypeVec.id ::: Quot.mk r) <$$> dest x = (TypeVec.id ::: Quot.mk r) <$$> dest y x y : M (P F) α rxy : r (Quot.mk Mcongr x) (Quot.mk Mcongr y) r' : M (P F) α → M (P F) α → Prop := fun x y => r (Quot.mk Mcongr x) (Quot.mk Mcongr y) hr' : r' = fun x y => r (Quot.mk Mcongr x) (Quot.mk Mcongr y) this : IsPrecongr r' ⊢ Mcongr x y [PROOFSTEP] refine' ⟨r', this, rxy⟩ [GOAL] n : ℕ F : TypeVec (n + 1) → Type u mvf : MvFunctor F q : MvQPF F α : TypeVec n r : Cofix F α → Cofix F α → Prop h : ∀ (x y : Cofix F α), r x y → (TypeVec.id ::: Quot.mk r) <$$> dest x = (TypeVec.id ::: Quot.mk r) <$$> dest y ⊢ ∀ (x y : Cofix F α), r x y → x = y [PROOFSTEP] let r' (x y) := x = y ∨ r x y [GOAL] n : ℕ F : TypeVec (n + 1) → Type u mvf : MvFunctor F q : MvQPF F α : TypeVec n r : Cofix F α → Cofix F α → Prop h : ∀ (x y : Cofix F α), r x y → (TypeVec.id ::: Quot.mk r) <$$> dest x = (TypeVec.id ::: Quot.mk r) <$$> dest y r' : Cofix F α → Cofix F α → Prop := fun x y => x = y ∨ r x y ⊢ ∀ (x y : Cofix F α), r x y → x = y [PROOFSTEP] intro x y rxy [GOAL] n : ℕ F : TypeVec (n + 1) → Type u mvf : MvFunctor F q : MvQPF F α : TypeVec n r : Cofix F α → Cofix F α → Prop h : ∀ (x y : Cofix F α), r x y → (TypeVec.id ::: Quot.mk r) <$$> dest x = (TypeVec.id ::: Quot.mk r) <$$> dest y r' : Cofix F α → Cofix F α → Prop := fun x y => x = y ∨ r x y x y : Cofix F α rxy : r x y ⊢ x = y [PROOFSTEP] apply Cofix.bisim_aux r' [GOAL] case h' n : ℕ F : TypeVec (n + 1) → Type u mvf : MvFunctor F q : MvQPF F α : TypeVec n r : Cofix F α → Cofix F α → Prop h : ∀ (x y : Cofix F α), r x y → (TypeVec.id ::: Quot.mk r) <$$> dest x = (TypeVec.id ::: Quot.mk r) <$$> dest y r' : Cofix F α → Cofix F α → Prop := fun x y => x = y ∨ r x y x y : Cofix F α rxy : r x y ⊢ ∀ (x : Cofix F α), r' x x [PROOFSTEP] intro x [GOAL] case h' n : ℕ F : TypeVec (n + 1) → Type u mvf : MvFunctor F q : MvQPF F α : TypeVec n r : Cofix F α → Cofix F α → Prop h : ∀ (x y : Cofix F α), r x y → (TypeVec.id ::: Quot.mk r) <$$> dest x = (TypeVec.id ::: Quot.mk r) <$$> dest y r' : Cofix F α → Cofix F α → Prop := fun x y => x = y ∨ r x y x✝ y : Cofix F α rxy : r x✝ y x : Cofix F α ⊢ r' x x [PROOFSTEP] left [GOAL] case h'.h n : ℕ F : TypeVec (n + 1) → Type u mvf : MvFunctor F q : MvQPF F α : TypeVec n r : Cofix F α → Cofix F α → Prop h : ∀ (x y : Cofix F α), r x y → (TypeVec.id ::: Quot.mk r) <$$> dest x = (TypeVec.id ::: Quot.mk r) <$$> dest y r' : Cofix F α → Cofix F α → Prop := fun x y => x = y ∨ r x y x✝ y : Cofix F α rxy : r x✝ y x : Cofix F α ⊢ x = x [PROOFSTEP] rfl [GOAL] case h n : ℕ F : TypeVec (n + 1) → Type u mvf : MvFunctor F q : MvQPF F α : TypeVec n r : Cofix F α → Cofix F α → Prop h : ∀ (x y : Cofix F α), r x y → (TypeVec.id ::: Quot.mk r) <$$> dest x = (TypeVec.id ::: Quot.mk r) <$$> dest y r' : Cofix F α → Cofix F α → Prop := fun x y => x = y ∨ r x y x y : Cofix F α rxy : r x y ⊢ ∀ (x y : Cofix F α), r' x y → (TypeVec.id ::: Quot.mk r') <$$> dest x = (TypeVec.id ::: Quot.mk r') <$$> dest y [PROOFSTEP] intro x y r'xy [GOAL] case h n : ℕ F : TypeVec (n + 1) → Type u mvf : MvFunctor F q : MvQPF F α : TypeVec n r : Cofix F α → Cofix F α → Prop h : ∀ (x y : Cofix F α), r x y → (TypeVec.id ::: Quot.mk r) <$$> dest x = (TypeVec.id ::: Quot.mk r) <$$> dest y r' : Cofix F α → Cofix F α → Prop := fun x y => x = y ∨ r x y x✝ y✝ : Cofix F α rxy : r x✝ y✝ x y : Cofix F α r'xy : r' x y ⊢ (TypeVec.id ::: Quot.mk r') <$$> dest x = (TypeVec.id ::: Quot.mk r') <$$> dest y [PROOFSTEP] cases r'xy [GOAL] case h.inl n : ℕ F : TypeVec (n + 1) → Type u mvf : MvFunctor F q : MvQPF F α : TypeVec n r : Cofix F α → Cofix F α → Prop h : ∀ (x y : Cofix F α), r x y → (TypeVec.id ::: Quot.mk r) <$$> dest x = (TypeVec.id ::: Quot.mk r) <$$> dest y r' : Cofix F α → Cofix F α → Prop := fun x y => x = y ∨ r x y x✝ y✝ : Cofix F α rxy : r x✝ y✝ x y : Cofix F α h✝ : x = y ⊢ (TypeVec.id ::: Quot.mk r') <$$> dest x = (TypeVec.id ::: Quot.mk r') <$$> dest y case h.inr n : ℕ F : TypeVec (n + 1) → Type u mvf : MvFunctor F q : MvQPF F α : TypeVec n r : Cofix F α → Cofix F α → Prop h : ∀ (x y : Cofix F α), r x y → (TypeVec.id ::: Quot.mk r) <$$> dest x = (TypeVec.id ::: Quot.mk r) <$$> dest y r' : Cofix F α → Cofix F α → Prop := fun x y => x = y ∨ r x y x✝ y✝ : Cofix F α rxy : r x✝ y✝ x y : Cofix F α h✝ : r x y ⊢ (TypeVec.id ::: Quot.mk r') <$$> dest x = (TypeVec.id ::: Quot.mk r') <$$> dest y [PROOFSTEP] case inl h => rw [h] [GOAL] n : ℕ F : TypeVec (n + 1) → Type u mvf : MvFunctor F q : MvQPF F α : TypeVec n r : Cofix F α → Cofix F α → Prop h✝ : ∀ (x y : Cofix F α), r x y → (TypeVec.id ::: Quot.mk r) <$$> dest x = (TypeVec.id ::: Quot.mk r) <$$> dest y r' : Cofix F α → Cofix F α → Prop := fun x y => x = y ∨ r x y x✝ y✝ : Cofix F α rxy : r x✝ y✝ x y : Cofix F α h : x = y ⊢ (TypeVec.id ::: Quot.mk r') <$$> dest x = (TypeVec.id ::: Quot.mk r') <$$> dest y [PROOFSTEP] case inl h => rw [h] [GOAL] n : ℕ F : TypeVec (n + 1) → Type u mvf : MvFunctor F q : MvQPF F α : TypeVec n r : Cofix F α → Cofix F α → Prop h✝ : ∀ (x y : Cofix F α), r x y → (TypeVec.id ::: Quot.mk r) <$$> dest x = (TypeVec.id ::: Quot.mk r) <$$> dest y r' : Cofix F α → Cofix F α → Prop := fun x y => x = y ∨ r x y x✝ y✝ : Cofix F α rxy : r x✝ y✝ x y : Cofix F α h : x = y ⊢ (TypeVec.id ::: Quot.mk r') <$$> dest x = (TypeVec.id ::: Quot.mk r') <$$> dest y [PROOFSTEP] rw [h] [GOAL] case h.inr n : ℕ F : TypeVec (n + 1) → Type u mvf : MvFunctor F q : MvQPF F α : TypeVec n r : Cofix F α → Cofix F α → Prop h : ∀ (x y : Cofix F α), r x y → (TypeVec.id ::: Quot.mk r) <$$> dest x = (TypeVec.id ::: Quot.mk r) <$$> dest y r' : Cofix F α → Cofix F α → Prop := fun x y => x = y ∨ r x y x✝ y✝ : Cofix F α rxy : r x✝ y✝ x y : Cofix F α h✝ : r x y ⊢ (TypeVec.id ::: Quot.mk r') <$$> dest x = (TypeVec.id ::: Quot.mk r') <$$> dest y [PROOFSTEP] case inr r'xy => have : ∀ x y, r x y → r' x y := fun x y h => Or.inr h rw [← Quot.factor_mk_eq _ _ this] dsimp rw [appendFun_comp_id] rw [@comp_map _ _ _ q _ _ _ (appendFun id (Quot.mk r)), @comp_map _ _ _ q _ _ _ (appendFun id (Quot.mk r))] rw [h _ _ r'xy] [GOAL] n : ℕ F : TypeVec (n + 1) → Type u mvf : MvFunctor F q : MvQPF F α : TypeVec n r : Cofix F α → Cofix F α → Prop h : ∀ (x y : Cofix F α), r x y → (TypeVec.id ::: Quot.mk r) <$$> dest x = (TypeVec.id ::: Quot.mk r) <$$> dest y r' : Cofix F α → Cofix F α → Prop := fun x y => x = y ∨ r x y x✝ y✝ : Cofix F α rxy : r x✝ y✝ x y : Cofix F α r'xy : r x y ⊢ (TypeVec.id ::: Quot.mk r') <$$> dest x = (TypeVec.id ::: Quot.mk r') <$$> dest y [PROOFSTEP] case inr r'xy => have : ∀ x y, r x y → r' x y := fun x y h => Or.inr h rw [← Quot.factor_mk_eq _ _ this] dsimp rw [appendFun_comp_id] rw [@comp_map _ _ _ q _ _ _ (appendFun id (Quot.mk r)), @comp_map _ _ _ q _ _ _ (appendFun id (Quot.mk r))] rw [h _ _ r'xy] [GOAL] n : ℕ F : TypeVec (n + 1) → Type u mvf : MvFunctor F q : MvQPF F α : TypeVec n r : Cofix F α → Cofix F α → Prop h : ∀ (x y : Cofix F α), r x y → (TypeVec.id ::: Quot.mk r) <$$> dest x = (TypeVec.id ::: Quot.mk r) <$$> dest y r' : Cofix F α → Cofix F α → Prop := fun x y => x = y ∨ r x y x✝ y✝ : Cofix F α rxy : r x✝ y✝ x y : Cofix F α r'xy : r x y ⊢ (TypeVec.id ::: Quot.mk r') <$$> dest x = (TypeVec.id ::: Quot.mk r') <$$> dest y [PROOFSTEP] have : ∀ x y, r x y → r' x y := fun x y h => Or.inr h [GOAL] n : ℕ F : TypeVec (n + 1) → Type u mvf : MvFunctor F q : MvQPF F α : TypeVec n r : Cofix F α → Cofix F α → Prop h : ∀ (x y : Cofix F α), r x y → (TypeVec.id ::: Quot.mk r) <$$> dest x = (TypeVec.id ::: Quot.mk r) <$$> dest y r' : Cofix F α → Cofix F α → Prop := fun x y => x = y ∨ r x y x✝ y✝ : Cofix F α rxy : r x✝ y✝ x y : Cofix F α r'xy : r x y this : ∀ (x y : Cofix F α), r x y → r' x y ⊢ (TypeVec.id ::: Quot.mk r') <$$> dest x = (TypeVec.id ::: Quot.mk r') <$$> dest y [PROOFSTEP] rw [← Quot.factor_mk_eq _ _ this] [GOAL] n : ℕ F : TypeVec (n + 1) → Type u mvf : MvFunctor F q : MvQPF F α : TypeVec n r : Cofix F α → Cofix F α → Prop h : ∀ (x y : Cofix F α), r x y → (TypeVec.id ::: Quot.mk r) <$$> dest x = (TypeVec.id ::: Quot.mk r) <$$> dest y r' : Cofix F α → Cofix F α → Prop := fun x y => x = y ∨ r x y x✝ y✝ : Cofix F α rxy : r x✝ y✝ x y : Cofix F α r'xy : r x y this : ∀ (x y : Cofix F α), r x y → r' x y ⊢ (TypeVec.id ::: Quot.factor (fun x y => r x y) (fun x y => r' x y) this ∘ Quot.mk fun x y => r x y) <$$> dest x = (TypeVec.id ::: Quot.factor (fun x y => r x y) (fun x y => r' x y) this ∘ Quot.mk fun x y => r x y) <$$> dest y [PROOFSTEP] dsimp [GOAL] n : ℕ F : TypeVec (n + 1) → Type u mvf : MvFunctor F q : MvQPF F α : TypeVec n r : Cofix F α → Cofix F α → Prop h : ∀ (x y : Cofix F α), r x y → (TypeVec.id ::: Quot.mk r) <$$> dest x = (TypeVec.id ::: Quot.mk r) <$$> dest y r' : Cofix F α → Cofix F α → Prop := fun x y => x = y ∨ r x y x✝ y✝ : Cofix F α rxy : r x✝ y✝ x y : Cofix F α r'xy : r x y this : ∀ (x y : Cofix F α), r x y → r' x y ⊢ (TypeVec.id ::: Quot.factor (fun x y => r x y) (fun x y => x = y ∨ r x y) this ∘ Quot.mk fun x y => r x y) <$$> dest x = (TypeVec.id ::: Quot.factor (fun x y => r x y) (fun x y => x = y ∨ r x y) this ∘ Quot.mk fun x y => r x y) <$$> dest y [PROOFSTEP] rw [appendFun_comp_id] [GOAL] n : ℕ F : TypeVec (n + 1) → Type u mvf : MvFunctor F q : MvQPF F α : TypeVec n r : Cofix F α → Cofix F α → Prop h : ∀ (x y : Cofix F α), r x y → (TypeVec.id ::: Quot.mk r) <$$> dest x = (TypeVec.id ::: Quot.mk r) <$$> dest y r' : Cofix F α → Cofix F α → Prop := fun x y => x = y ∨ r x y x✝ y✝ : Cofix F α rxy : r x✝ y✝ x y : Cofix F α r'xy : r x y this : ∀ (x y : Cofix F α), r x y → r' x y ⊢ ((TypeVec.id ::: Quot.factor (fun x y => r x y) (fun x y => x = y ∨ r x y) this) ⊚ (TypeVec.id ::: Quot.mk fun x y => r x y)) <$$> dest x = ((TypeVec.id ::: Quot.factor (fun x y => r x y) (fun x y => x = y ∨ r x y) this) ⊚ (TypeVec.id ::: Quot.mk fun x y => r x y)) <$$> dest y [PROOFSTEP] rw [@comp_map _ _ _ q _ _ _ (appendFun id (Quot.mk r)), @comp_map _ _ _ q _ _ _ (appendFun id (Quot.mk r))] [GOAL] n : ℕ F : TypeVec (n + 1) → Type u mvf : MvFunctor F q : MvQPF F α : TypeVec n r : Cofix F α → Cofix F α → Prop h : ∀ (x y : Cofix F α), r x y → (TypeVec.id ::: Quot.mk r) <$$> dest x = (TypeVec.id ::: Quot.mk r) <$$> dest y r' : Cofix F α → Cofix F α → Prop := fun x y => x = y ∨ r x y x✝ y✝ : Cofix F α rxy : r x✝ y✝ x y : Cofix F α r'xy : r x y this : ∀ (x y : Cofix F α), r x y → r' x y ⊢ (TypeVec.id ::: Quot.factor (fun x y => r x y) (fun x y => x = y ∨ r x y) this) <$$> (TypeVec.id ::: Quot.mk r) <$$> dest x = (TypeVec.id ::: Quot.factor (fun x y => r x y) (fun x y => x = y ∨ r x y) this) <$$> (TypeVec.id ::: Quot.mk r) <$$> dest y [PROOFSTEP] rw [h _ _ r'xy] [GOAL] case a n : ℕ F : TypeVec (n + 1) → Type u mvf : MvFunctor F q : MvQPF F α : TypeVec n r : Cofix F α → Cofix F α → Prop h : ∀ (x y : Cofix F α), r x y → (TypeVec.id ::: Quot.mk r) <$$> dest x = (TypeVec.id ::: Quot.mk r) <$$> dest y r' : Cofix F α → Cofix F α → Prop := fun x y => x = y ∨ r x y x y : Cofix F α rxy : r x y ⊢ r' x y [PROOFSTEP] right [GOAL] case a.h n : ℕ F : TypeVec (n + 1) → Type u mvf : MvFunctor F q : MvQPF F α : TypeVec n r : Cofix F α → Cofix F α → Prop h : ∀ (x y : Cofix F α), r x y → (TypeVec.id ::: Quot.mk r) <$$> dest x = (TypeVec.id ::: Quot.mk r) <$$> dest y r' : Cofix F α → Cofix F α → Prop := fun x y => x = y ∨ r x y x y : Cofix F α rxy : r x y ⊢ r x y [PROOFSTEP] exact rxy [GOAL] n : ℕ F : TypeVec (n + 1) → Type u mvf : MvFunctor F q : MvQPF F α : TypeVec n r : Cofix F α → Cofix F α → Prop h : ∀ (x y : Cofix F α), r x y → LiftR (fun {i} => RelLast α r) (dest x) (dest y) ⊢ ∀ (x y : Cofix F α), r x y → x = y [PROOFSTEP] apply Cofix.bisim_rel [GOAL] case h n : ℕ F : TypeVec (n + 1) → Type u mvf : MvFunctor F q : MvQPF F α : TypeVec n r : Cofix F α → Cofix F α → Prop h : ∀ (x y : Cofix F α), r x y → LiftR (fun {i} => RelLast α r) (dest x) (dest y) ⊢ ∀ (x y : Cofix F α), r x y → (TypeVec.id ::: Quot.mk fun x y => r x y) <$$> dest x = (TypeVec.id ::: Quot.mk fun x y => r x y) <$$> dest y [PROOFSTEP] intro x y rxy [GOAL] case h n : ℕ F : TypeVec (n + 1) → Type u mvf : MvFunctor F q : MvQPF F α : TypeVec n r : Cofix F α → Cofix F α → Prop h : ∀ (x y : Cofix F α), r x y → LiftR (fun {i} => RelLast α r) (dest x) (dest y) x y : Cofix F α rxy : r x y ⊢ (TypeVec.id ::: Quot.mk fun x y => r x y) <$$> dest x = (TypeVec.id ::: Quot.mk fun x y => r x y) <$$> dest y [PROOFSTEP] rcases(liftR_iff (fun a b => RelLast α r a b) (dest x) (dest y)).mp (h x y rxy) with ⟨a, f₀, f₁, dxeq, dyeq, h'⟩ [GOAL] case h.intro.intro.intro.intro.intro n : ℕ F : TypeVec (n + 1) → Type u mvf : MvFunctor F q : MvQPF F α : TypeVec n r : Cofix F α → Cofix F α → Prop h : ∀ (x y : Cofix F α), r x y → LiftR (fun {i} => RelLast α r) (dest x) (dest y) x y : Cofix F α rxy : r x y a : (P F).A f₀ f₁ : B (P F) a ⟹ fun {i} => (α ::: Cofix F α) i dxeq : dest x = MvQPF.abs { fst := a, snd := f₀ } dyeq : dest y = MvQPF.abs { fst := a, snd := f₁ } h' : ∀ (i : Fin2 (n + 1)) (j : B (P F) a i), RelLast α r (f₀ i j) (f₁ i j) ⊢ (TypeVec.id ::: Quot.mk fun x y => r x y) <$$> dest x = (TypeVec.id ::: Quot.mk fun x y => r x y) <$$> dest y [PROOFSTEP] rw [dxeq, dyeq, ← abs_map, ← abs_map, MvPFunctor.map_eq, MvPFunctor.map_eq] [GOAL] case h.intro.intro.intro.intro.intro n : ℕ F : TypeVec (n + 1) → Type u mvf : MvFunctor F q : MvQPF F α : TypeVec n r : Cofix F α → Cofix F α → Prop h : ∀ (x y : Cofix F α), r x y → LiftR (fun {i} => RelLast α r) (dest x) (dest y) x y : Cofix F α rxy : r x y a : (P F).A f₀ f₁ : B (P F) a ⟹ fun {i} => (α ::: Cofix F α) i dxeq : dest x = MvQPF.abs { fst := a, snd := f₀ } dyeq : dest y = MvQPF.abs { fst := a, snd := f₁ } h' : ∀ (i : Fin2 (n + 1)) (j : B (P F) a i), RelLast α r (f₀ i j) (f₁ i j) ⊢ MvQPF.abs { fst := a, snd := (TypeVec.id ::: Quot.mk fun x y => r x y) ⊚ f₀ } = MvQPF.abs { fst := a, snd := (TypeVec.id ::: Quot.mk fun x y => r x y) ⊚ f₁ } [PROOFSTEP] rw [← split_dropFun_lastFun f₀, ← split_dropFun_lastFun f₁] [GOAL] case h.intro.intro.intro.intro.intro n : ℕ F : TypeVec (n + 1) → Type u mvf : MvFunctor F q : MvQPF F α : TypeVec n r : Cofix F α → Cofix F α → Prop h : ∀ (x y : Cofix F α), r x y → LiftR (fun {i} => RelLast α r) (dest x) (dest y) x y : Cofix F α rxy : r x y a : (P F).A f₀ f₁ : B (P F) a ⟹ fun {i} => (α ::: Cofix F α) i dxeq : dest x = MvQPF.abs { fst := a, snd := f₀ } dyeq : dest y = MvQPF.abs { fst := a, snd := f₁ } h' : ∀ (i : Fin2 (n + 1)) (j : B (P F) a i), RelLast α r (f₀ i j) (f₁ i j) ⊢ MvQPF.abs { fst := a, snd := (TypeVec.id ::: Quot.mk fun x y => r x y) ⊚ splitFun (dropFun f₀) (lastFun f₀) } = MvQPF.abs { fst := a, snd := (TypeVec.id ::: Quot.mk fun x y => r x y) ⊚ splitFun (dropFun f₁) (lastFun f₁) } [PROOFSTEP] rw [appendFun_comp_splitFun, appendFun_comp_splitFun] [GOAL] case h.intro.intro.intro.intro.intro n : ℕ F : TypeVec (n + 1) → Type u mvf : MvFunctor F q : MvQPF F α : TypeVec n r : Cofix F α → Cofix F α → Prop h : ∀ (x y : Cofix F α), r x y → LiftR (fun {i} => RelLast α r) (dest x) (dest y) x y : Cofix F α rxy : r x y a : (P F).A f₀ f₁ : B (P F) a ⟹ fun {i} => (α ::: Cofix F α) i dxeq : dest x = MvQPF.abs { fst := a, snd := f₀ } dyeq : dest y = MvQPF.abs { fst := a, snd := f₁ } h' : ∀ (i : Fin2 (n + 1)) (j : B (P F) a i), RelLast α r (f₀ i j) (f₁ i j) ⊢ MvQPF.abs { fst := a, snd := splitFun (TypeVec.id ⊚ dropFun f₀) ((Quot.mk fun x y => r x y) ∘ lastFun f₀) } = MvQPF.abs { fst := a, snd := splitFun (TypeVec.id ⊚ dropFun f₁) ((Quot.mk fun x y => r x y) ∘ lastFun f₁) } [PROOFSTEP] rw [id_comp, id_comp] [GOAL] case h.intro.intro.intro.intro.intro n : ℕ F : TypeVec (n + 1) → Type u mvf : MvFunctor F q : MvQPF F α : TypeVec n r : Cofix F α → Cofix F α → Prop h : ∀ (x y : Cofix F α), r x y → LiftR (fun {i} => RelLast α r) (dest x) (dest y) x y : Cofix F α rxy : r x y a : (P F).A f₀ f₁ : B (P F) a ⟹ fun {i} => (α ::: Cofix F α) i dxeq : dest x = MvQPF.abs { fst := a, snd := f₀ } dyeq : dest y = MvQPF.abs { fst := a, snd := f₁ } h' : ∀ (i : Fin2 (n + 1)) (j : B (P F) a i), RelLast α r (f₀ i j) (f₁ i j) ⊢ MvQPF.abs { fst := a, snd := splitFun (dropFun f₀) ((Quot.mk fun x y => r x y) ∘ lastFun f₀) } = MvQPF.abs { fst := a, snd := splitFun (dropFun f₁) ((Quot.mk fun x y => r x y) ∘ lastFun f₁) } [PROOFSTEP] congr 2 with (i j) [GOAL] case h.intro.intro.intro.intro.intro.e_a.e_snd.a.h n : ℕ F : TypeVec (n + 1) → Type u mvf : MvFunctor F q : MvQPF F α : TypeVec n r : Cofix F α → Cofix F α → Prop h : ∀ (x y : Cofix F α), r x y → LiftR (fun {i} => RelLast α r) (dest x) (dest y) x y : Cofix F α rxy : r x y a : (P F).A f₀ f₁ : B (P F) a ⟹ fun {i} => (α ::: Cofix F α) i dxeq : dest x = MvQPF.abs { fst := a, snd := f₀ } dyeq : dest y = MvQPF.abs { fst := a, snd := f₁ } h' : ∀ (i : Fin2 (n + 1)) (j : B (P F) a i), RelLast α r (f₀ i j) (f₁ i j) i : Fin2 (n + 1) j : B (P F) a i ⊢ splitFun (dropFun f₀) ((Quot.mk fun x y => r x y) ∘ lastFun f₀) i j = splitFun (dropFun f₁) ((Quot.mk fun x y => r x y) ∘ lastFun f₁) i j [PROOFSTEP] cases' i with _ i [GOAL] case h.intro.intro.intro.intro.intro.e_a.e_snd.a.h.fz n : ℕ F : TypeVec (n + 1) → Type u mvf : MvFunctor F q : MvQPF F α : TypeVec n r : Cofix F α → Cofix F α → Prop h : ∀ (x y : Cofix F α), r x y → LiftR (fun {i} => RelLast α r) (dest x) (dest y) x y : Cofix F α rxy : r x y a : (P F).A f₀ f₁ : B (P F) a ⟹ fun {i} => (α ::: Cofix F α) i dxeq : dest x = MvQPF.abs { fst := a, snd := f₀ } dyeq : dest y = MvQPF.abs { fst := a, snd := f₁ } h' : ∀ (i : Fin2 (n + 1)) (j : B (P F) a i), RelLast α r (f₀ i j) (f₁ i j) j : B (P F) a Fin2.fz ⊢ splitFun (dropFun f₀) ((Quot.mk fun x y => r x y) ∘ lastFun f₀) Fin2.fz j = splitFun (dropFun f₁) ((Quot.mk fun x y => r x y) ∘ lastFun f₁) Fin2.fz j [PROOFSTEP] dsimp [GOAL] case h.intro.intro.intro.intro.intro.e_a.e_snd.a.h.fs n : ℕ F : TypeVec (n + 1) → Type u mvf : MvFunctor F q : MvQPF F α : TypeVec n r : Cofix F α → Cofix F α → Prop h : ∀ (x y : Cofix F α), r x y → LiftR (fun {i} => RelLast α r) (dest x) (dest y) x y : Cofix F α rxy : r x y a : (P F).A f₀ f₁ : B (P F) a ⟹ fun {i} => (α ::: Cofix F α) i dxeq : dest x = MvQPF.abs { fst := a, snd := f₀ } dyeq : dest y = MvQPF.abs { fst := a, snd := f₁ } h' : ∀ (i : Fin2 (n + 1)) (j : B (P F) a i), RelLast α r (f₀ i j) (f₁ i j) a✝ : Fin2 (Nat.add n 0) j : B (P F) a (Fin2.fs a✝) ⊢ splitFun (dropFun f₀) ((Quot.mk fun x y => r x y) ∘ lastFun f₀) (Fin2.fs a✝) j = splitFun (dropFun f₁) ((Quot.mk fun x y => r x y) ∘ lastFun f₁) (Fin2.fs a✝) j [PROOFSTEP] dsimp [GOAL] case h.intro.intro.intro.intro.intro.e_a.e_snd.a.h.fz n : ℕ F : TypeVec (n + 1) → Type u mvf : MvFunctor F q : MvQPF F α : TypeVec n r : Cofix F α → Cofix F α → Prop h : ∀ (x y : Cofix F α), r x y → LiftR (fun {i} => RelLast α r) (dest x) (dest y) x y : Cofix F α rxy : r x y a : (P F).A f₀ f₁ : B (P F) a ⟹ fun {i} => (α ::: Cofix F α) i dxeq : dest x = MvQPF.abs { fst := a, snd := f₀ } dyeq : dest y = MvQPF.abs { fst := a, snd := f₁ } h' : ∀ (i : Fin2 (n + 1)) (j : B (P F) a i), RelLast α r (f₀ i j) (f₁ i j) j : B (P F) a Fin2.fz ⊢ splitFun (dropFun f₀) ((Quot.mk fun x y => r x y) ∘ lastFun f₀) Fin2.fz j = splitFun (dropFun f₁) ((Quot.mk fun x y => r x y) ∘ lastFun f₁) Fin2.fz j [PROOFSTEP] apply Quot.sound [GOAL] case h.intro.intro.intro.intro.intro.e_a.e_snd.a.h.fz.a n : ℕ F : TypeVec (n + 1) → Type u mvf : MvFunctor F q : MvQPF F α : TypeVec n r : Cofix F α → Cofix F α → Prop h : ∀ (x y : Cofix F α), r x y → LiftR (fun {i} => RelLast α r) (dest x) (dest y) x y : Cofix F α rxy : r x y a : (P F).A f₀ f₁ : B (P F) a ⟹ fun {i} => (α ::: Cofix F α) i dxeq : dest x = MvQPF.abs { fst := a, snd := f₀ } dyeq : dest y = MvQPF.abs { fst := a, snd := f₁ } h' : ∀ (i : Fin2 (n + 1)) (j : B (P F) a i), RelLast α r (f₀ i j) (f₁ i j) j : B (P F) a Fin2.fz ⊢ r (lastFun f₀ j) (lastFun f₁ j) [PROOFSTEP] apply h' _ j [GOAL] case h.intro.intro.intro.intro.intro.e_a.e_snd.a.h.fs n : ℕ F : TypeVec (n + 1) → Type u mvf : MvFunctor F q : MvQPF F α : TypeVec n r : Cofix F α → Cofix F α → Prop h : ∀ (x y : Cofix F α), r x y → LiftR (fun {i} => RelLast α r) (dest x) (dest y) x y : Cofix F α rxy : r x y a : (P F).A f₀ f₁ : B (P F) a ⟹ fun {i} => (α ::: Cofix F α) i dxeq : dest x = MvQPF.abs { fst := a, snd := f₀ } dyeq : dest y = MvQPF.abs { fst := a, snd := f₁ } h' : ∀ (i : Fin2 (n + 1)) (j : B (P F) a i), RelLast α r (f₀ i j) (f₁ i j) a✝ : Fin2 (Nat.add n 0) j : B (P F) a (Fin2.fs a✝) ⊢ splitFun (dropFun f₀) ((Quot.mk fun x y => r x y) ∘ lastFun f₀) (Fin2.fs a✝) j = splitFun (dropFun f₁) ((Quot.mk fun x y => r x y) ∘ lastFun f₁) (Fin2.fs a✝) j [PROOFSTEP] change f₀ _ j = f₁ _ j [GOAL] case h.intro.intro.intro.intro.intro.e_a.e_snd.a.h.fs n : ℕ F : TypeVec (n + 1) → Type u mvf : MvFunctor F q : MvQPF F α : TypeVec n r : Cofix F α → Cofix F α → Prop h : ∀ (x y : Cofix F α), r x y → LiftR (fun {i} => RelLast α r) (dest x) (dest y) x y : Cofix F α rxy : r x y a : (P F).A f₀ f₁ : B (P F) a ⟹ fun {i} => (α ::: Cofix F α) i dxeq : dest x = MvQPF.abs { fst := a, snd := f₀ } dyeq : dest y = MvQPF.abs { fst := a, snd := f₁ } h' : ∀ (i : Fin2 (n + 1)) (j : B (P F) a i), RelLast α r (f₀ i j) (f₁ i j) a✝ : Fin2 (Nat.add n 0) j : B (P F) a (Fin2.fs a✝) ⊢ f₀ (Fin2.fs a✝) j = f₁ (Fin2.fs a✝) j [PROOFSTEP] apply h' _ j [GOAL] n : ℕ F : TypeVec (n + 1) → Type u mvf : MvFunctor F q : MvQPF F α : TypeVec n r : Cofix F α → Cofix F α → Prop h : ∀ (x y : Cofix F α), r x y → LiftR' (RelLast' α r) (dest x) (dest y) ⊢ ∀ (x y : Cofix F α), r x y → LiftR (fun {i} => RelLast α r) (dest x) (dest y) [PROOFSTEP] intros [GOAL] n : ℕ F : TypeVec (n + 1) → Type u mvf : MvFunctor F q : MvQPF F α : TypeVec n r : Cofix F α → Cofix F α → Prop h : ∀ (x y : Cofix F α), r x y → LiftR' (RelLast' α r) (dest x) (dest y) x✝ y✝ : Cofix F α a✝ : r x✝ y✝ ⊢ LiftR (fun {i} => RelLast α r) (dest x✝) (dest y✝) [PROOFSTEP] rw [← LiftR_RelLast_iff] [GOAL] n : ℕ F : TypeVec (n + 1) → Type u mvf : MvFunctor F q : MvQPF F α : TypeVec n r : Cofix F α → Cofix F α → Prop h : ∀ (x y : Cofix F α), r x y → LiftR' (RelLast' α r) (dest x) (dest y) x✝ y✝ : Cofix F α a✝ : r x✝ y✝ ⊢ LiftR' (RelLast' α r) (dest x✝) (dest y✝) [PROOFSTEP] apply h [GOAL] case a n : ℕ F : TypeVec (n + 1) → Type u mvf : MvFunctor F q : MvQPF F α : TypeVec n r : Cofix F α → Cofix F α → Prop h : ∀ (x y : Cofix F α), r x y → LiftR' (RelLast' α r) (dest x) (dest y) x✝ y✝ : Cofix F α a✝ : r x✝ y✝ ⊢ r x✝ y✝ [PROOFSTEP] assumption [GOAL] n : ℕ F : TypeVec (n + 1) → Type u mvf : MvFunctor F q : MvQPF F α : TypeVec n β : Type u_1 Q : β → Prop u v : β → Cofix F α h : ∀ (x : β), Q x → ∃ a f' f₀ f₁, dest (u x) = MvQPF.abs { fst := a, snd := appendContents (P F) f' f₀ } ∧ dest (v x) = MvQPF.abs { fst := a, snd := appendContents (P F) f' f₁ } ∧ ∀ (i : PFunctor.B (MvPFunctor.last (P F)) a), ∃ x', Q x' ∧ f₀ i = u x' ∧ f₁ i = v x' x✝¹ : β Qx : Q x✝¹ R : Cofix F α → Cofix F α → Prop := fun w z => ∃ x', Q x' ∧ w = u x' ∧ z = v x' x y : Cofix F α x✝ : R x y x' : β Qx' : Q x' xeq : x = u x' yeq : y = v x' ⊢ LiftR (fun {i} => RelLast α R) (dest x) (dest y) [PROOFSTEP] rcases h x' Qx' with ⟨a, f', f₀, f₁, ux'eq, vx'eq, h'⟩ [GOAL] case intro.intro.intro.intro.intro.intro n : ℕ F : TypeVec (n + 1) → Type u mvf : MvFunctor F q : MvQPF F α : TypeVec n β : Type u_1 Q : β → Prop u v : β → Cofix F α h : ∀ (x : β), Q x → ∃ a f' f₀ f₁, dest (u x) = MvQPF.abs { fst := a, snd := appendContents (P F) f' f₀ } ∧ dest (v x) = MvQPF.abs { fst := a, snd := appendContents (P F) f' f₁ } ∧ ∀ (i : PFunctor.B (MvPFunctor.last (P F)) a), ∃ x', Q x' ∧ f₀ i = u x' ∧ f₁ i = v x' x✝¹ : β Qx : Q x✝¹ R : Cofix F α → Cofix F α → Prop := fun w z => ∃ x', Q x' ∧ w = u x' ∧ z = v x' x y : Cofix F α x✝ : R x y x' : β Qx' : Q x' xeq : x = u x' yeq : y = v x' a : (P F).A f' : B (MvPFunctor.drop (P F)) a ⟹ α f₀ f₁ : PFunctor.B (MvPFunctor.last (P F)) a → Cofix F α ux'eq : dest (u x') = MvQPF.abs { fst := a, snd := appendContents (P F) f' f₀ } vx'eq : dest (v x') = MvQPF.abs { fst := a, snd := appendContents (P F) f' f₁ } h' : ∀ (i : PFunctor.B (MvPFunctor.last (P F)) a), ∃ x', Q x' ∧ f₀ i = u x' ∧ f₁ i = v x' ⊢ LiftR (fun {i} => RelLast α R) (dest x) (dest y) [PROOFSTEP] rw [liftR_iff] [GOAL] case intro.intro.intro.intro.intro.intro n : ℕ F : TypeVec (n + 1) → Type u mvf : MvFunctor F q : MvQPF F α : TypeVec n β : Type u_1 Q : β → Prop u v : β → Cofix F α h : ∀ (x : β), Q x → ∃ a f' f₀ f₁, dest (u x) = MvQPF.abs { fst := a, snd := appendContents (P F) f' f₀ } ∧ dest (v x) = MvQPF.abs { fst := a, snd := appendContents (P F) f' f₁ } ∧ ∀ (i : PFunctor.B (MvPFunctor.last (P F)) a), ∃ x', Q x' ∧ f₀ i = u x' ∧ f₁ i = v x' x✝¹ : β Qx : Q x✝¹ R : Cofix F α → Cofix F α → Prop := fun w z => ∃ x', Q x' ∧ w = u x' ∧ z = v x' x y : Cofix F α x✝ : R x y x' : β Qx' : Q x' xeq : x = u x' yeq : y = v x' a : (P F).A f' : B (MvPFunctor.drop (P F)) a ⟹ α f₀ f₁ : PFunctor.B (MvPFunctor.last (P F)) a → Cofix F α ux'eq : dest (u x') = MvQPF.abs { fst := a, snd := appendContents (P F) f' f₀ } vx'eq : dest (v x') = MvQPF.abs { fst := a, snd := appendContents (P F) f' f₁ } h' : ∀ (i : PFunctor.B (MvPFunctor.last (P F)) a), ∃ x', Q x' ∧ f₀ i = u x' ∧ f₁ i = v x' ⊢ ∃ a f₀ f₁, dest x = MvQPF.abs { fst := a, snd := f₀ } ∧ dest y = MvQPF.abs { fst := a, snd := f₁ } ∧ ∀ (i : Fin2 (n + 1)) (j : B (P F) a i), RelLast α R (f₀ i j) (f₁ i j) [PROOFSTEP] refine' ⟨a, q.P.appendContents f' f₀, q.P.appendContents f' f₁, xeq.symm ▸ ux'eq, yeq.symm ▸ vx'eq, _⟩ [GOAL] case intro.intro.intro.intro.intro.intro n : ℕ F : TypeVec (n + 1) → Type u mvf : MvFunctor F q : MvQPF F α : TypeVec n β : Type u_1 Q : β → Prop u v : β → Cofix F α h : ∀ (x : β), Q x → ∃ a f' f₀ f₁, dest (u x) = MvQPF.abs { fst := a, snd := appendContents (P F) f' f₀ } ∧ dest (v x) = MvQPF.abs { fst := a, snd := appendContents (P F) f' f₁ } ∧ ∀ (i : PFunctor.B (MvPFunctor.last (P F)) a), ∃ x', Q x' ∧ f₀ i = u x' ∧ f₁ i = v x' x✝¹ : β Qx : Q x✝¹ R : Cofix F α → Cofix F α → Prop := fun w z => ∃ x', Q x' ∧ w = u x' ∧ z = v x' x y : Cofix F α x✝ : R x y x' : β Qx' : Q x' xeq : x = u x' yeq : y = v x' a : (P F).A f' : B (MvPFunctor.drop (P F)) a ⟹ α f₀ f₁ : PFunctor.B (MvPFunctor.last (P F)) a → Cofix F α ux'eq : dest (u x') = MvQPF.abs { fst := a, snd := appendContents (P F) f' f₀ } vx'eq : dest (v x') = MvQPF.abs { fst := a, snd := appendContents (P F) f' f₁ } h' : ∀ (i : PFunctor.B (MvPFunctor.last (P F)) a), ∃ x', Q x' ∧ f₀ i = u x' ∧ f₁ i = v x' ⊢ ∀ (i : Fin2 (n + 1)) (j : B (P F) a i), RelLast α R (appendContents (P F) f' f₀ i j) (appendContents (P F) f' f₁ i j) [PROOFSTEP] intro i [GOAL] case intro.intro.intro.intro.intro.intro n : ℕ F : TypeVec (n + 1) → Type u mvf : MvFunctor F q : MvQPF F α : TypeVec n β : Type u_1 Q : β → Prop u v : β → Cofix F α h : ∀ (x : β), Q x → ∃ a f' f₀ f₁, dest (u x) = MvQPF.abs { fst := a, snd := appendContents (P F) f' f₀ } ∧ dest (v x) = MvQPF.abs { fst := a, snd := appendContents (P F) f' f₁ } ∧ ∀ (i : PFunctor.B (MvPFunctor.last (P F)) a), ∃ x', Q x' ∧ f₀ i = u x' ∧ f₁ i = v x' x✝¹ : β Qx : Q x✝¹ R : Cofix F α → Cofix F α → Prop := fun w z => ∃ x', Q x' ∧ w = u x' ∧ z = v x' x y : Cofix F α x✝ : R x y x' : β Qx' : Q x' xeq : x = u x' yeq : y = v x' a : (P F).A f' : B (MvPFunctor.drop (P F)) a ⟹ α f₀ f₁ : PFunctor.B (MvPFunctor.last (P F)) a → Cofix F α ux'eq : dest (u x') = MvQPF.abs { fst := a, snd := appendContents (P F) f' f₀ } vx'eq : dest (v x') = MvQPF.abs { fst := a, snd := appendContents (P F) f' f₁ } h' : ∀ (i : PFunctor.B (MvPFunctor.last (P F)) a), ∃ x', Q x' ∧ f₀ i = u x' ∧ f₁ i = v x' i : Fin2 (n + 1) ⊢ ∀ (j : B (P F) a i), RelLast α R (appendContents (P F) f' f₀ i j) (appendContents (P F) f' f₁ i j) [PROOFSTEP] cases i [GOAL] case intro.intro.intro.intro.intro.intro.fz n : ℕ F : TypeVec (n + 1) → Type u mvf : MvFunctor F q : MvQPF F α : TypeVec n β : Type u_1 Q : β → Prop u v : β → Cofix F α h : ∀ (x : β), Q x → ∃ a f' f₀ f₁, dest (u x) = MvQPF.abs { fst := a, snd := appendContents (P F) f' f₀ } ∧ dest (v x) = MvQPF.abs { fst := a, snd := appendContents (P F) f' f₁ } ∧ ∀ (i : PFunctor.B (MvPFunctor.last (P F)) a), ∃ x', Q x' ∧ f₀ i = u x' ∧ f₁ i = v x' x✝¹ : β Qx : Q x✝¹ R : Cofix F α → Cofix F α → Prop := fun w z => ∃ x', Q x' ∧ w = u x' ∧ z = v x' x y : Cofix F α x✝ : R x y x' : β Qx' : Q x' xeq : x = u x' yeq : y = v x' a : (P F).A f' : B (MvPFunctor.drop (P F)) a ⟹ α f₀ f₁ : PFunctor.B (MvPFunctor.last (P F)) a → Cofix F α ux'eq : dest (u x') = MvQPF.abs { fst := a, snd := appendContents (P F) f' f₀ } vx'eq : dest (v x') = MvQPF.abs { fst := a, snd := appendContents (P F) f' f₁ } h' : ∀ (i : PFunctor.B (MvPFunctor.last (P F)) a), ∃ x', Q x' ∧ f₀ i = u x' ∧ f₁ i = v x' ⊢ ∀ (j : B (P F) a Fin2.fz), RelLast α R (appendContents (P F) f' f₀ Fin2.fz j) (appendContents (P F) f' f₁ Fin2.fz j) [PROOFSTEP] apply h' [GOAL] case intro.intro.intro.intro.intro.intro.fs n : ℕ F : TypeVec (n + 1) → Type u mvf : MvFunctor F q : MvQPF F α : TypeVec n β : Type u_1 Q : β → Prop u v : β → Cofix F α h : ∀ (x : β), Q x → ∃ a f' f₀ f₁, dest (u x) = MvQPF.abs { fst := a, snd := appendContents (P F) f' f₀ } ∧ dest (v x) = MvQPF.abs { fst := a, snd := appendContents (P F) f' f₁ } ∧ ∀ (i : PFunctor.B (MvPFunctor.last (P F)) a), ∃ x', Q x' ∧ f₀ i = u x' ∧ f₁ i = v x' x✝¹ : β Qx : Q x✝¹ R : Cofix F α → Cofix F α → Prop := fun w z => ∃ x', Q x' ∧ w = u x' ∧ z = v x' x y : Cofix F α x✝ : R x y x' : β Qx' : Q x' xeq : x = u x' yeq : y = v x' a : (P F).A f' : B (MvPFunctor.drop (P F)) a ⟹ α f₀ f₁ : PFunctor.B (MvPFunctor.last (P F)) a → Cofix F α ux'eq : dest (u x') = MvQPF.abs { fst := a, snd := appendContents (P F) f' f₀ } vx'eq : dest (v x') = MvQPF.abs { fst := a, snd := appendContents (P F) f' f₁ } h' : ∀ (i : PFunctor.B (MvPFunctor.last (P F)) a), ∃ x', Q x' ∧ f₀ i = u x' ∧ f₁ i = v x' a✝ : Fin2 (Nat.add n 0) ⊢ ∀ (j : B (P F) a (Fin2.fs a✝)), RelLast α R (appendContents (P F) f' f₀ (Fin2.fs a✝) j) (appendContents (P F) f' f₁ (Fin2.fs a✝) j) [PROOFSTEP] intro j [GOAL] case intro.intro.intro.intro.intro.intro.fs n : ℕ F : TypeVec (n + 1) → Type u mvf : MvFunctor F q : MvQPF F α : TypeVec n β : Type u_1 Q : β → Prop u v : β → Cofix F α h : ∀ (x : β), Q x → ∃ a f' f₀ f₁, dest (u x) = MvQPF.abs { fst := a, snd := appendContents (P F) f' f₀ } ∧ dest (v x) = MvQPF.abs { fst := a, snd := appendContents (P F) f' f₁ } ∧ ∀ (i : PFunctor.B (MvPFunctor.last (P F)) a), ∃ x', Q x' ∧ f₀ i = u x' ∧ f₁ i = v x' x✝¹ : β Qx : Q x✝¹ R : Cofix F α → Cofix F α → Prop := fun w z => ∃ x', Q x' ∧ w = u x' ∧ z = v x' x y : Cofix F α x✝ : R x y x' : β Qx' : Q x' xeq : x = u x' yeq : y = v x' a : (P F).A f' : B (MvPFunctor.drop (P F)) a ⟹ α f₀ f₁ : PFunctor.B (MvPFunctor.last (P F)) a → Cofix F α ux'eq : dest (u x') = MvQPF.abs { fst := a, snd := appendContents (P F) f' f₀ } vx'eq : dest (v x') = MvQPF.abs { fst := a, snd := appendContents (P F) f' f₁ } h' : ∀ (i : PFunctor.B (MvPFunctor.last (P F)) a), ∃ x', Q x' ∧ f₀ i = u x' ∧ f₁ i = v x' a✝ : Fin2 (Nat.add n 0) j : B (P F) a (Fin2.fs a✝) ⊢ RelLast α R (appendContents (P F) f' f₀ (Fin2.fs a✝) j) (appendContents (P F) f' f₁ (Fin2.fs a✝) j) [PROOFSTEP] apply Eq.refl [GOAL] n : ℕ F : TypeVec (n + 1) → Type u mvf : MvFunctor F q : MvQPF F α : TypeVec n x : Cofix F α ⊢ mk (dest x) = x [PROOFSTEP] apply Cofix.bisim_rel (fun x y : Cofix F α => x = Cofix.mk (Cofix.dest y)) _ _ _ rfl [GOAL] n : ℕ F : TypeVec (n + 1) → Type u mvf : MvFunctor F q : MvQPF F α : TypeVec n x : Cofix F α ⊢ ∀ (x y : Cofix F α), (fun x y => x = mk (dest y)) x y → (TypeVec.id ::: Quot.mk fun x y => x = mk (dest y)) <$$> dest x = (TypeVec.id ::: Quot.mk fun x y => x = mk (dest y)) <$$> dest y [PROOFSTEP] dsimp [GOAL] n : ℕ F : TypeVec (n + 1) → Type u mvf : MvFunctor F q : MvQPF F α : TypeVec n x : Cofix F α ⊢ ∀ (x y : Cofix F α), x = mk (dest y) → (TypeVec.id ::: Quot.mk fun x y => x = mk (dest y)) <$$> dest x = (TypeVec.id ::: Quot.mk fun x y => x = mk (dest y)) <$$> dest y [PROOFSTEP] intro x y h [GOAL] n : ℕ F : TypeVec (n + 1) → Type u mvf : MvFunctor F q : MvQPF F α : TypeVec n x✝ x y : Cofix F α h : x = mk (dest y) ⊢ (TypeVec.id ::: Quot.mk fun x y => x = mk (dest y)) <$$> dest x = (TypeVec.id ::: Quot.mk fun x y => x = mk (dest y)) <$$> dest y [PROOFSTEP] rw [h] [GOAL] n : ℕ F : TypeVec (n + 1) → Type u mvf : MvFunctor F q : MvQPF F α : TypeVec n x✝ x y : Cofix F α h : x = mk (dest y) ⊢ (TypeVec.id ::: Quot.mk fun x y => x = mk (dest y)) <$$> dest (mk (dest y)) = (TypeVec.id ::: Quot.mk fun x y => x = mk (dest y)) <$$> dest y [PROOFSTEP] conv => lhs congr rfl rw [Cofix.mk] rw [Cofix.dest_corec] [GOAL] n : ℕ F : TypeVec (n + 1) → Type u mvf : MvFunctor F q : MvQPF F α : TypeVec n x✝ x y : Cofix F α h : x = mk (dest y) | (TypeVec.id ::: Quot.mk fun x y => x = mk (dest y)) <$$> dest (mk (dest y)) = (TypeVec.id ::: Quot.mk fun x y => x = mk (dest y)) <$$> dest y [PROOFSTEP] lhs congr rfl rw [Cofix.mk] rw [Cofix.dest_corec] [GOAL] n : ℕ F : TypeVec (n + 1) → Type u mvf : MvFunctor F q : MvQPF F α : TypeVec n x✝ x y : Cofix F α h : x = mk (dest y) | (TypeVec.id ::: Quot.mk fun x y => x = mk (dest y)) <$$> dest (mk (dest y)) = (TypeVec.id ::: Quot.mk fun x y => x = mk (dest y)) <$$> dest y [PROOFSTEP] lhs congr rfl rw [Cofix.mk] rw [Cofix.dest_corec] [GOAL] n : ℕ F : TypeVec (n + 1) → Type u mvf : MvFunctor F q : MvQPF F α : TypeVec n x✝ x y : Cofix F α h : x = mk (dest y) | (TypeVec.id ::: Quot.mk fun x y => x = mk (dest y)) <$$> dest (mk (dest y)) = (TypeVec.id ::: Quot.mk fun x y => x = mk (dest y)) <$$> dest y [PROOFSTEP] lhs [GOAL] n : ℕ F : TypeVec (n + 1) → Type u mvf : MvFunctor F q : MvQPF F α : TypeVec n x✝ x y : Cofix F α h : x = mk (dest y) | (TypeVec.id ::: Quot.mk fun x y => x = mk (dest y)) <$$> dest (mk (dest y)) [PROOFSTEP] congr [GOAL] case a n : ℕ F : TypeVec (n + 1) → Type u mvf : MvFunctor F q : MvQPF F α : TypeVec n x✝ x y : Cofix F α h : x = mk (dest y) | TypeVec.id ::: Quot.mk fun x y => x = mk (dest y) case a n : ℕ F : TypeVec (n + 1) → Type u mvf : MvFunctor F q : MvQPF F α : TypeVec n x✝ x y : Cofix F α h : x = mk (dest y) | dest (mk (dest y)) [PROOFSTEP] rfl [GOAL] case a n : ℕ F : TypeVec (n + 1) → Type u mvf : MvFunctor F q : MvQPF F α : TypeVec n x✝ x y : Cofix F α h : x = mk (dest y) | dest (mk (dest y)) [PROOFSTEP] rw [Cofix.mk] [GOAL] case a n : ℕ F : TypeVec (n + 1) → Type u mvf : MvFunctor F q : MvQPF F α : TypeVec n x✝ x y : Cofix F α h : x = mk (dest y) | dest (corec (fun x => (TypeVec.id ::: fun i => dest i) <$$> x) (dest y)) [PROOFSTEP] rw [Cofix.dest_corec] [GOAL] n : ℕ F : TypeVec (n + 1) → Type u mvf : MvFunctor F q : MvQPF F α : TypeVec n x✝ x y : Cofix F α h : x = mk (dest y) ⊢ (TypeVec.id ::: Quot.mk fun x y => x = mk (dest y)) <$$> (TypeVec.id ::: corec fun x => (TypeVec.id ::: fun i => dest i) <$$> x) <$$> (TypeVec.id ::: fun i => dest i) <$$> dest y = (TypeVec.id ::: Quot.mk fun x y => x = mk (dest y)) <$$> dest y [PROOFSTEP] rw [← comp_map, ← appendFun_comp, id_comp] [GOAL] n : ℕ F : TypeVec (n + 1) → Type u mvf : MvFunctor F q : MvQPF F α : TypeVec n x✝ x y : Cofix F α h : x = mk (dest y) ⊢ (TypeVec.id ::: (Quot.mk fun x y => x = mk (dest y)) ∘ corec fun x => (TypeVec.id ::: fun i => dest i) <$$> x) <$$> (TypeVec.id ::: fun i => dest i) <$$> dest y = (TypeVec.id ::: Quot.mk fun x y => x = mk (dest y)) <$$> dest y [PROOFSTEP] rw [← comp_map, ← appendFun_comp, id_comp, ← Cofix.mk] [GOAL] n : ℕ F : TypeVec (n + 1) → Type u mvf : MvFunctor F q : MvQPF F α : TypeVec n x✝ x y : Cofix F α h : x = mk (dest y) ⊢ (TypeVec.id ::: ((Quot.mk fun x y => x = mk (dest y)) ∘ mk) ∘ fun i => dest i) <$$> dest y = (TypeVec.id ::: Quot.mk fun x y => x = mk (dest y)) <$$> dest y [PROOFSTEP] congr [GOAL] case e_a n : ℕ F : TypeVec (n + 1) → Type u mvf : MvFunctor F q : MvQPF F α : TypeVec n x✝ x y : Cofix F α h : x = mk (dest y) ⊢ (TypeVec.id ::: ((Quot.mk fun x y => x = mk (dest y)) ∘ mk) ∘ fun i => dest i) = (TypeVec.id ::: Quot.mk fun x y => x = mk (dest y)) [PROOFSTEP] apply congrArg [GOAL] case e_a.h n : ℕ F : TypeVec (n + 1) → Type u mvf : MvFunctor F q : MvQPF F α : TypeVec n x✝ x y : Cofix F α h : x = mk (dest y) ⊢ (((Quot.mk fun x y => x = mk (dest y)) ∘ mk) ∘ fun i => dest i) = Quot.mk fun x y => x = mk (dest y) [PROOFSTEP] funext x [GOAL] case e_a.h.h n : ℕ F : TypeVec (n + 1) → Type u mvf : MvFunctor F q : MvQPF F α : TypeVec n x✝¹ x✝ y : Cofix F α h : x✝ = mk (dest y) x : Cofix F α ⊢ (((Quot.mk fun x y => x = mk (dest y)) ∘ mk) ∘ fun i => dest i) x = Quot.mk (fun x y => x = mk (dest y)) x [PROOFSTEP] apply Quot.sound [GOAL] case e_a.h.h.a n : ℕ F : TypeVec (n + 1) → Type u mvf : MvFunctor F q : MvQPF F α : TypeVec n x✝¹ x✝ y : Cofix F α h : x✝ = mk (dest y) x : Cofix F α ⊢ mk ((fun i => dest i) x) = mk (dest x) [PROOFSTEP] rfl [GOAL] n : ℕ F : TypeVec (n + 1) → Type u mvf : MvFunctor F q : MvQPF F α : TypeVec n x : F (α ::: Cofix F α) ⊢ dest (mk x) = x [PROOFSTEP] have : Cofix.mk ∘ Cofix.dest = @_root_.id (Cofix F α) := funext Cofix.mk_dest [GOAL] n : ℕ F : TypeVec (n + 1) → Type u mvf : MvFunctor F q : MvQPF F α : TypeVec n x : F (α ::: Cofix F α) this : mk ∘ dest = _root_.id ⊢ dest (mk x) = x [PROOFSTEP] rw [Cofix.mk, Cofix.dest_corec, ← comp_map, ← Cofix.mk, ← appendFun_comp, this, id_comp, appendFun_id_id, MvFunctor.id_map] [GOAL] n : ℕ F : TypeVec (n + 1) → Type u mvf : MvFunctor F q : MvQPF F α : TypeVec n x y : Cofix F α h : dest x = dest y ⊢ x = y [PROOFSTEP] rw [← Cofix.mk_dest x, h, Cofix.mk_dest] [GOAL] n : ℕ F : TypeVec (n + 1) → Type u mvf : MvFunctor F q : MvQPF F α : TypeVec n x y : F (α ::: Cofix F α) h : mk x = mk y ⊢ x = y [PROOFSTEP] rw [← Cofix.dest_mk x, h, Cofix.dest_mk] [GOAL] n : ℕ F : TypeVec (n + 1) → Type u mvf : MvFunctor F q : MvQPF F α β : TypeVec n F' : TypeVec n → Type u inst✝¹ : MvFunctor F' inst✝ : LawfulMvFunctor F' R : β ⊗ β ⟹ repeat n Prop x : F' α f g : α ⟹ β h : α ⟹ Subtype_ R hh : subtypeVal R ⊚ h = (f ⊗' g) ⊚ prod.diag ⊢ LiftR' R (f <$$> x) (g <$$> x) [PROOFSTEP] rw [LiftR_def] [GOAL] n : ℕ F : TypeVec (n + 1) → Type u mvf : MvFunctor F q : MvQPF F α β : TypeVec n F' : TypeVec n → Type u inst✝¹ : MvFunctor F' inst✝ : LawfulMvFunctor F' R : β ⊗ β ⟹ repeat n Prop x : F' α f g : α ⟹ β h : α ⟹ Subtype_ R hh : subtypeVal R ⊚ h = (f ⊗' g) ⊚ prod.diag ⊢ ∃ u, (prod.fst ⊚ subtypeVal R) <$$> u = f <$$> x ∧ (prod.snd ⊚ subtypeVal R) <$$> u = g <$$> x [PROOFSTEP] exists h <$$> x [GOAL] n : ℕ F : TypeVec (n + 1) → Type u mvf : MvFunctor F q : MvQPF F α β : TypeVec n F' : TypeVec n → Type u inst✝¹ : MvFunctor F' inst✝ : LawfulMvFunctor F' R : β ⊗ β ⟹ repeat n Prop x : F' α f g : α ⟹ β h : α ⟹ Subtype_ R hh : subtypeVal R ⊚ h = (f ⊗' g) ⊚ prod.diag ⊢ (prod.fst ⊚ subtypeVal R) <$$> h <$$> x = f <$$> x ∧ (prod.snd ⊚ subtypeVal R) <$$> h <$$> x = g <$$> x [PROOFSTEP] rw [MvFunctor.map_map, comp_assoc, hh, ← comp_assoc, fst_prod_mk, comp_assoc, fst_diag] [GOAL] n : ℕ F : TypeVec (n + 1) → Type u mvf : MvFunctor F q : MvQPF F α β : TypeVec n F' : TypeVec n → Type u inst✝¹ : MvFunctor F' inst✝ : LawfulMvFunctor F' R : β ⊗ β ⟹ repeat n Prop x : F' α f g : α ⟹ β h : α ⟹ Subtype_ R hh : subtypeVal R ⊚ h = (f ⊗' g) ⊚ prod.diag ⊢ (f ⊚ TypeVec.id) <$$> x = f <$$> x ∧ (prod.snd ⊚ subtypeVal R) <$$> h <$$> x = g <$$> x [PROOFSTEP] rw [MvFunctor.map_map, comp_assoc, hh, ← comp_assoc, snd_prod_mk, comp_assoc, snd_diag] [GOAL] n : ℕ F : TypeVec (n + 1) → Type u mvf : MvFunctor F q : MvQPF F α β : TypeVec n F' : TypeVec n → Type u inst✝¹ : MvFunctor F' inst✝ : LawfulMvFunctor F' R : β ⊗ β ⟹ repeat n Prop x : F' α f g : α ⟹ β h : α ⟹ Subtype_ R hh : subtypeVal R ⊚ h = (f ⊗' g) ⊚ prod.diag ⊢ (f ⊚ TypeVec.id) <$$> x = f <$$> x ∧ (g ⊚ TypeVec.id) <$$> x = g <$$> x [PROOFSTEP] dsimp [LiftR'] [GOAL] n : ℕ F : TypeVec (n + 1) → Type u mvf : MvFunctor F q : MvQPF F α β : TypeVec n F' : TypeVec n → Type u inst✝¹ : MvFunctor F' inst✝ : LawfulMvFunctor F' R : β ⊗ β ⟹ repeat n Prop x : F' α f g : α ⟹ β h : α ⟹ Subtype_ R hh : subtypeVal R ⊚ h = (f ⊗' g) ⊚ prod.diag ⊢ f <$$> x = f <$$> x ∧ g <$$> x = g <$$> x [PROOFSTEP] constructor [GOAL] case left n : ℕ F : TypeVec (n + 1) → Type u mvf : MvFunctor F q : MvQPF F α β : TypeVec n F' : TypeVec n → Type u inst✝¹ : MvFunctor F' inst✝ : LawfulMvFunctor F' R : β ⊗ β ⟹ repeat n Prop x : F' α f g : α ⟹ β h : α ⟹ Subtype_ R hh : subtypeVal R ⊚ h = (f ⊗' g) ⊚ prod.diag ⊢ f <$$> x = f <$$> x [PROOFSTEP] rfl [GOAL] case right n : ℕ F : TypeVec (n + 1) → Type u mvf : MvFunctor F q : MvQPF F α β : TypeVec n F' : TypeVec n → Type u inst✝¹ : MvFunctor F' inst✝ : LawfulMvFunctor F' R : β ⊗ β ⟹ repeat n Prop x : F' α f g : α ⟹ β h : α ⟹ Subtype_ R hh : subtypeVal R ⊚ h = (f ⊗' g) ⊚ prod.diag ⊢ g <$$> x = g <$$> x [PROOFSTEP] rfl [GOAL] n : ℕ F : TypeVec (n + 1) → Type u mvf : MvFunctor F q : MvQPF F lawful : LawfulMvFunctor F α : TypeVec n ι ι' : Type u R : ι' → ι' → Prop x : F (α ::: ι) f g : ι → ι' hh : ∀ (x : ι), R (f x) (g x) h : ι → { x // uncurry R x } := fun x => { val := (f x, g x), property := (_ : R (f x) (g x)) } b : α ::: ι ⟹ Subtype_ (repeatEq α) ::: { x // uncurry R x } := diagSub ::: h c : Subtype_ (repeatEq α) ::: { x // uncurry R x } ⟹ (fun i => { x // ofRepeat (RelLast' α R (Fin2.fs i) x) }) ::: Subtype (uncurry R) := ofSubtype (repeatEq α) ::: _root_.id ⊢ subtypeVal (RelLast' α R) ⊚ toSubtype (RelLast' α R) ⊚ fromAppend1DropLast ⊚ c ⊚ b = ((TypeVec.id ::: f) ⊗' (TypeVec.id ::: g)) ⊚ prod.diag [PROOFSTEP] dsimp [GOAL] n : ℕ F : TypeVec (n + 1) → Type u mvf : MvFunctor F q : MvQPF F lawful : LawfulMvFunctor F α : TypeVec n ι ι' : Type u R : ι' → ι' → Prop x : F (α ::: ι) f g : ι → ι' hh : ∀ (x : ι), R (f x) (g x) h : ι → { x // uncurry R x } := fun x => { val := (f x, g x), property := (_ : R (f x) (g x)) } b : α ::: ι ⟹ Subtype_ (repeatEq α) ::: { x // uncurry R x } := diagSub ::: h c : Subtype_ (repeatEq α) ::: { x // uncurry R x } ⟹ (fun i => { x // ofRepeat (RelLast' α R (Fin2.fs i) x) }) ::: Subtype (uncurry R) := ofSubtype (repeatEq α) ::: _root_.id ⊢ subtypeVal (RelLast' α R) ⊚ toSubtype (RelLast' α R) ⊚ fromAppend1DropLast ⊚ (ofSubtype (repeatEq α) ::: _root_.id) ⊚ (diagSub ::: fun x => { val := (f x, g x), property := (_ : R (f x) (g x)) }) = ((TypeVec.id ::: f) ⊗' (TypeVec.id ::: g)) ⊚ prod.diag [PROOFSTEP] apply eq_of_drop_last_eq [GOAL] case h₀ n : ℕ F : TypeVec (n + 1) → Type u mvf : MvFunctor F q : MvQPF F lawful : LawfulMvFunctor F α : TypeVec n ι ι' : Type u R : ι' → ι' → Prop x : F (α ::: ι) f g : ι → ι' hh : ∀ (x : ι), R (f x) (g x) h : ι → { x // uncurry R x } := fun x => { val := (f x, g x), property := (_ : R (f x) (g x)) } b : α ::: ι ⟹ Subtype_ (repeatEq α) ::: { x // uncurry R x } := diagSub ::: h c : Subtype_ (repeatEq α) ::: { x // uncurry R x } ⟹ (fun i => { x // ofRepeat (RelLast' α R (Fin2.fs i) x) }) ::: Subtype (uncurry R) := ofSubtype (repeatEq α) ::: _root_.id ⊢ dropFun (subtypeVal (RelLast' α R) ⊚ toSubtype (RelLast' α R) ⊚ fromAppend1DropLast ⊚ (ofSubtype (repeatEq α) ::: _root_.id) ⊚ (diagSub ::: fun x => { val := (f x, g x), property := (_ : R (f x) (g x)) })) = dropFun (((TypeVec.id ::: f) ⊗' (TypeVec.id ::: g)) ⊚ prod.diag) [PROOFSTEP] dsimp [GOAL] case h₀ n : ℕ F : TypeVec (n + 1) → Type u mvf : MvFunctor F q : MvQPF F lawful : LawfulMvFunctor F α : TypeVec n ι ι' : Type u R : ι' → ι' → Prop x : F (α ::: ι) f g : ι → ι' hh : ∀ (x : ι), R (f x) (g x) h : ι → { x // uncurry R x } := fun x => { val := (f x, g x), property := (_ : R (f x) (g x)) } b : α ::: ι ⟹ Subtype_ (repeatEq α) ::: { x // uncurry R x } := diagSub ::: h c : Subtype_ (repeatEq α) ::: { x // uncurry R x } ⟹ (fun i => { x // ofRepeat (RelLast' α R (Fin2.fs i) x) }) ::: Subtype (uncurry R) := ofSubtype (repeatEq α) ::: _root_.id ⊢ subtypeVal (repeatEq α) ⊚ dropFun (toSubtype (RelLast' α R)) ⊚ ofSubtype (repeatEq α) ⊚ diagSub = dropFun ((TypeVec.id ::: f) ⊗' (TypeVec.id ::: g)) ⊚ dropFun prod.diag [PROOFSTEP] simp only [prod_map_id, dropFun_prod, dropFun_appendFun, dropFun_diag, id_comp, dropFun_toSubtype] [GOAL] case h₀ n : ℕ F : TypeVec (n + 1) → Type u mvf : MvFunctor F q : MvQPF F lawful : LawfulMvFunctor F α : TypeVec n ι ι' : Type u R : ι' → ι' → Prop x : F (α ::: ι) f g : ι → ι' hh : ∀ (x : ι), R (f x) (g x) h : ι → { x // uncurry R x } := fun x => { val := (f x, g x), property := (_ : R (f x) (g x)) } b : α ::: ι ⟹ Subtype_ (repeatEq α) ::: { x // uncurry R x } := diagSub ::: h c : Subtype_ (repeatEq α) ::: { x // uncurry R x } ⟹ (fun i => { x // ofRepeat (RelLast' α R (Fin2.fs i) x) }) ::: Subtype (uncurry R) := ofSubtype (repeatEq α) ::: _root_.id ⊢ subtypeVal (repeatEq α) ⊚ (toSubtype fun i x => RelLast' α R (Fin2.fs i) x) ⊚ ofSubtype (repeatEq α) ⊚ diagSub = prod.diag [PROOFSTEP] erw [toSubtype_of_subtype_assoc, id_comp] [GOAL] case h₀ n : ℕ F : TypeVec (n + 1) → Type u mvf : MvFunctor F q : MvQPF F lawful : LawfulMvFunctor F α : TypeVec n ι ι' : Type u R : ι' → ι' → Prop x : F (α ::: ι) f g : ι → ι' hh : ∀ (x : ι), R (f x) (g x) h : ι → { x // uncurry R x } := fun x => { val := (f x, g x), property := (_ : R (f x) (g x)) } b : α ::: ι ⟹ Subtype_ (repeatEq α) ::: { x // uncurry R x } := diagSub ::: h c : Subtype_ (repeatEq α) ::: { x // uncurry R x } ⟹ (fun i => { x // ofRepeat (RelLast' α R (Fin2.fs i) x) }) ::: Subtype (uncurry R) := ofSubtype (repeatEq α) ::: _root_.id ⊢ (fun i x => subtypeVal (repeatEq α) i (diagSub i x)) = prod.diag [PROOFSTEP] clear liftR_map_last q mvf lawful F x R f g hh h b c [GOAL] case h₀ n : ℕ α : TypeVec n ι ι' : Type u ⊢ (fun i x => subtypeVal (repeatEq α) i (diagSub i x)) = prod.diag [PROOFSTEP] ext (i x) : 2 [GOAL] case h₀.a.h n : ℕ α : TypeVec n ι ι' : Type u i : Fin2 n x : TypeVec.drop (α ::: ι) i ⊢ subtypeVal (repeatEq α) i (diagSub i x) = prod.diag i x [PROOFSTEP] induction i with | fz => rfl | fs _ ih => apply ih [GOAL] case h₀.a.h n : ℕ α : TypeVec n ι ι' : Type u i : Fin2 n x : TypeVec.drop (α ::: ι) i ⊢ subtypeVal (repeatEq α) i (diagSub i x) = prod.diag i x [PROOFSTEP] induction i with | fz => rfl | fs _ ih => apply ih [GOAL] case h₀.a.h.fz n : ℕ ι ι' : Type u n✝ : ℕ α : TypeVec (Nat.succ n✝) x : TypeVec.drop (α ::: ι) Fin2.fz ⊢ subtypeVal (repeatEq α) Fin2.fz (diagSub Fin2.fz x) = prod.diag Fin2.fz x [PROOFSTEP] | fz => rfl [GOAL] case h₀.a.h.fz n : ℕ ι ι' : Type u n✝ : ℕ α : TypeVec (Nat.succ n✝) x : TypeVec.drop (α ::: ι) Fin2.fz ⊢ subtypeVal (repeatEq α) Fin2.fz (diagSub Fin2.fz x) = prod.diag Fin2.fz x [PROOFSTEP] rfl [GOAL] case h₀.a.h.fs n : ℕ ι ι' : Type u n✝ : ℕ a✝ : Fin2 n✝ ih : ∀ {α : TypeVec n✝} (x : TypeVec.drop (α ::: ι) a✝), subtypeVal (repeatEq α) a✝ (diagSub a✝ x) = prod.diag a✝ x α : TypeVec (Nat.succ n✝) x : TypeVec.drop (α ::: ι) (Fin2.fs a✝) ⊢ subtypeVal (repeatEq α) (Fin2.fs a✝) (diagSub (Fin2.fs a✝) x) = prod.diag (Fin2.fs a✝) x [PROOFSTEP] | fs _ ih => apply ih [GOAL] case h₀.a.h.fs n : ℕ ι ι' : Type u n✝ : ℕ a✝ : Fin2 n✝ ih : ∀ {α : TypeVec n✝} (x : TypeVec.drop (α ::: ι) a✝), subtypeVal (repeatEq α) a✝ (diagSub a✝ x) = prod.diag a✝ x α : TypeVec (Nat.succ n✝) x : TypeVec.drop (α ::: ι) (Fin2.fs a✝) ⊢ subtypeVal (repeatEq α) (Fin2.fs a✝) (diagSub (Fin2.fs a✝) x) = prod.diag (Fin2.fs a✝) x [PROOFSTEP] apply ih [GOAL] case h₁ n : ℕ F : TypeVec (n + 1) → Type u mvf : MvFunctor F q : MvQPF F lawful : LawfulMvFunctor F α : TypeVec n ι ι' : Type u R : ι' → ι' → Prop x : F (α ::: ι) f g : ι → ι' hh : ∀ (x : ι), R (f x) (g x) h : ι → { x // uncurry R x } := fun x => { val := (f x, g x), property := (_ : R (f x) (g x)) } b : α ::: ι ⟹ Subtype_ (repeatEq α) ::: { x // uncurry R x } := diagSub ::: h c : Subtype_ (repeatEq α) ::: { x // uncurry R x } ⟹ (fun i => { x // ofRepeat (RelLast' α R (Fin2.fs i) x) }) ::: Subtype (uncurry R) := ofSubtype (repeatEq α) ::: _root_.id ⊢ lastFun (subtypeVal (RelLast' α R) ⊚ toSubtype (RelLast' α R) ⊚ fromAppend1DropLast ⊚ (ofSubtype (repeatEq α) ::: _root_.id) ⊚ (diagSub ::: fun x => { val := (f x, g x), property := (_ : R (f x) (g x)) })) = lastFun (((TypeVec.id ::: f) ⊗' (TypeVec.id ::: g)) ⊚ prod.diag) [PROOFSTEP] simp only [lastFun_from_append1_drop_last, lastFun_toSubtype, lastFun_appendFun, lastFun_subtypeVal, comp.left_id, lastFun_comp, lastFun_prod] [GOAL] case h₁ n : ℕ F : TypeVec (n + 1) → Type u mvf : MvFunctor F q : MvQPF F lawful : LawfulMvFunctor F α : TypeVec n ι ι' : Type u R : ι' → ι' → Prop x : F (α ::: ι) f g : ι → ι' hh : ∀ (x : ι), R (f x) (g x) h : ι → { x // uncurry R x } := fun x => { val := (f x, g x), property := (_ : R (f x) (g x)) } b : α ::: ι ⟹ Subtype_ (repeatEq α) ::: { x // uncurry R x } := diagSub ::: h c : Subtype_ (repeatEq α) ::: { x // uncurry R x } ⟹ (fun i => { x // ofRepeat (RelLast' α R (Fin2.fs i) x) }) ::: Subtype (uncurry R) := ofSubtype (repeatEq α) ::: _root_.id ⊢ (Subtype.val ∘ fun x => { val := (f x, g x), property := (_ : R (f x) (g x)) }) = Prod.map f g ∘ lastFun prod.diag [PROOFSTEP] ext1 [GOAL] case h₁.h n : ℕ F : TypeVec (n + 1) → Type u mvf : MvFunctor F q : MvQPF F lawful : LawfulMvFunctor F α : TypeVec n ι ι' : Type u R : ι' → ι' → Prop x : F (α ::: ι) f g : ι → ι' hh : ∀ (x : ι), R (f x) (g x) h : ι → { x // uncurry R x } := fun x => { val := (f x, g x), property := (_ : R (f x) (g x)) } b : α ::: ι ⟹ Subtype_ (repeatEq α) ::: { x // uncurry R x } := diagSub ::: h c : Subtype_ (repeatEq α) ::: { x // uncurry R x } ⟹ (fun i => { x // ofRepeat (RelLast' α R (Fin2.fs i) x) }) ::: Subtype (uncurry R) := ofSubtype (repeatEq α) ::: _root_.id x✝ : TypeVec.last (α ::: ι) ⊢ (Subtype.val ∘ fun x => { val := (f x, g x), property := (_ : R (f x) (g x)) }) x✝ = (Prod.map f g ∘ lastFun prod.diag) x✝ [PROOFSTEP] rfl [GOAL] n : ℕ F : TypeVec (n + 1) → Type u mvf : MvFunctor F q : MvQPF F inst✝ : LawfulMvFunctor F α : TypeVec n ι : Type u R : ι → ι → Prop x : F (α ::: ι) f : ι → ι hh : ∀ (x : ι), R (f x) x ⊢ LiftR' (RelLast' α R) ((TypeVec.id ::: f) <$$> x) x [PROOFSTEP] have := liftR_map_last R x f id hh [GOAL] n : ℕ F : TypeVec (n + 1) → Type u mvf : MvFunctor F q : MvQPF F inst✝ : LawfulMvFunctor F α : TypeVec n ι : Type u R : ι → ι → Prop x : F (α ::: ι) f : ι → ι hh : ∀ (x : ι), R (f x) x this : LiftR' (RelLast' α R) ((TypeVec.id ::: f) <$$> x) ((TypeVec.id ::: _root_.id) <$$> x) ⊢ LiftR' (RelLast' α R) ((TypeVec.id ::: f) <$$> x) x [PROOFSTEP] rwa [appendFun_id_id, MvFunctor.id_map] at this [GOAL] n : ℕ F✝ : TypeVec (n + 1) → Type u mvf : MvFunctor F✝ q✝ : MvQPF F✝ F : TypeVec (n + 1) → Type u inst✝ : MvFunctor F q : MvQPF F α : TypeVec n x : Cofix F α ⊢ Quot.mk Mcongr (repr x) = x [PROOFSTEP] let R := fun x y : Cofix F α => abs (repr y) = x [GOAL] n : ℕ F✝ : TypeVec (n + 1) → Type u mvf : MvFunctor F✝ q✝ : MvQPF F✝ F : TypeVec (n + 1) → Type u inst✝ : MvFunctor F q : MvQPF F α : TypeVec n x : Cofix F α R : Cofix F α → Cofix F α → Prop := fun x y => abs (repr y) = x ⊢ Quot.mk Mcongr (repr x) = x [PROOFSTEP] refine' Cofix.bisim₂ R _ _ _ rfl [GOAL] n : ℕ F✝ : TypeVec (n + 1) → Type u mvf : MvFunctor F✝ q✝ : MvQPF F✝ F : TypeVec (n + 1) → Type u inst✝ : MvFunctor F q : MvQPF F α : TypeVec n x : Cofix F α R : Cofix F α → Cofix F α → Prop := fun x y => abs (repr y) = x ⊢ ∀ (x y : Cofix F α), R x y → LiftR' (RelLast' α R) (dest x) (dest y) [PROOFSTEP] clear x [GOAL] n : ℕ F✝ : TypeVec (n + 1) → Type u mvf : MvFunctor F✝ q✝ : MvQPF F✝ F : TypeVec (n + 1) → Type u inst✝ : MvFunctor F q : MvQPF F α : TypeVec n R : Cofix F α → Cofix F α → Prop := fun x y => abs (repr y) = x ⊢ ∀ (x y : Cofix F α), R x y → LiftR' (RelLast' α R) (dest x) (dest y) [PROOFSTEP] rintro x y h [GOAL] n : ℕ F✝ : TypeVec (n + 1) → Type u mvf : MvFunctor F✝ q✝ : MvQPF F✝ F : TypeVec (n + 1) → Type u inst✝ : MvFunctor F q : MvQPF F α : TypeVec n R : Cofix F α → Cofix F α → Prop := fun x y => abs (repr y) = x x y : Cofix F α h : R x y ⊢ LiftR' (RelLast' α R) (dest x) (dest y) [PROOFSTEP] subst h [GOAL] n : ℕ F✝ : TypeVec (n + 1) → Type u mvf : MvFunctor F✝ q✝ : MvQPF F✝ F : TypeVec (n + 1) → Type u inst✝ : MvFunctor F q : MvQPF F α : TypeVec n R : Cofix F α → Cofix F α → Prop := fun x y => abs (repr y) = x y : Cofix F α ⊢ LiftR' (RelLast' α R) (dest (abs (repr y))) (dest y) [PROOFSTEP] dsimp [Cofix.dest, Cofix.abs] [GOAL] n : ℕ F✝ : TypeVec (n + 1) → Type u mvf : MvFunctor F✝ q✝ : MvQPF F✝ F : TypeVec (n + 1) → Type u inst✝ : MvFunctor F q : MvQPF F α : TypeVec n R : Cofix F α → Cofix F α → Prop := fun x y => abs (repr y) = x y : Cofix F α ⊢ LiftR' (RelLast' α fun x y => Quot.mk Mcongr (repr y) = x) ((TypeVec.id ::: Quot.mk Mcongr) <$$> MvQPF.abs (M.dest (P F) (repr y))) (Quot.lift (fun x => (TypeVec.id ::: Quot.mk Mcongr) <$$> MvQPF.abs (M.dest (P F) x)) (_ : ∀ (x y : M (P F) α), Mcongr x y → (fun x => (TypeVec.id ::: Quot.mk Mcongr) <$$> MvQPF.abs (M.dest (P F) x)) x = (fun x => (TypeVec.id ::: Quot.mk Mcongr) <$$> MvQPF.abs (M.dest (P F) x)) y) y) [PROOFSTEP] induction y using Quot.ind [GOAL] case mk n : ℕ F✝ : TypeVec (n + 1) → Type u mvf : MvFunctor F✝ q✝ : MvQPF F✝ F : TypeVec (n + 1) → Type u inst✝ : MvFunctor F q : MvQPF F α : TypeVec n R : Cofix F α → Cofix F α → Prop := fun x y => abs (repr y) = x a✝ : M (P F) α ⊢ LiftR' (RelLast' α fun x y => Quot.mk Mcongr (repr y) = x) ((TypeVec.id ::: Quot.mk Mcongr) <$$> MvQPF.abs (M.dest (P F) (repr (Quot.mk Mcongr a✝)))) (Quot.lift (fun x => (TypeVec.id ::: Quot.mk Mcongr) <$$> MvQPF.abs (M.dest (P F) x)) (_ : ∀ (x y : M (P F) α), Mcongr x y → (fun x => (TypeVec.id ::: Quot.mk Mcongr) <$$> MvQPF.abs (M.dest (P F) x)) x = (fun x => (TypeVec.id ::: Quot.mk Mcongr) <$$> MvQPF.abs (M.dest (P F) x)) y) (Quot.mk Mcongr a✝)) [PROOFSTEP] simp only [Cofix.repr, M.dest_corec, abs_map, MvQPF.abs_repr, Function.comp] [GOAL] case mk n : ℕ F✝ : TypeVec (n + 1) → Type u mvf : MvFunctor F✝ q✝ : MvQPF F✝ F : TypeVec (n + 1) → Type u inst✝ : MvFunctor F q : MvQPF F α : TypeVec n R : Cofix F α → Cofix F α → Prop := fun x y => abs (repr y) = x a✝ : M (P F) α ⊢ LiftR' (RelLast' α fun x y => Quot.mk Mcongr (M.corec (P F) (fun x => MvQPF.repr (dest x)) y) = x) ((TypeVec.id ::: Quot.mk Mcongr) <$$> (TypeVec.id ::: M.corec (P F) fun x => MvQPF.repr (dest x)) <$$> dest (Quot.mk Mcongr a✝)) ((TypeVec.id ::: Quot.mk Mcongr) <$$> MvQPF.abs (M.dest (P F) a✝)) [PROOFSTEP] conv => congr rfl rw [Cofix.dest] [GOAL] n : ℕ F✝ : TypeVec (n + 1) → Type u mvf : MvFunctor F✝ q✝ : MvQPF F✝ F : TypeVec (n + 1) → Type u inst✝ : MvFunctor F q : MvQPF F α : TypeVec n R : Cofix F α → Cofix F α → Prop := fun x y => abs (repr y) = x a✝ : M (P F) α | LiftR' (RelLast' α fun x y => Quot.mk Mcongr (M.corec (P F) (fun x => MvQPF.repr (dest x)) y) = x) ((TypeVec.id ::: Quot.mk Mcongr) <$$> (TypeVec.id ::: M.corec (P F) fun x => MvQPF.repr (dest x)) <$$> dest (Quot.mk Mcongr a✝)) ((TypeVec.id ::: Quot.mk Mcongr) <$$> MvQPF.abs (M.dest (P F) a✝)) [PROOFSTEP] congr rfl rw [Cofix.dest] [GOAL] n : ℕ F✝ : TypeVec (n + 1) → Type u mvf : MvFunctor F✝ q✝ : MvQPF F✝ F : TypeVec (n + 1) → Type u inst✝ : MvFunctor F q : MvQPF F α : TypeVec n R : Cofix F α → Cofix F α → Prop := fun x y => abs (repr y) = x a✝ : M (P F) α | LiftR' (RelLast' α fun x y => Quot.mk Mcongr (M.corec (P F) (fun x => MvQPF.repr (dest x)) y) = x) ((TypeVec.id ::: Quot.mk Mcongr) <$$> (TypeVec.id ::: M.corec (P F) fun x => MvQPF.repr (dest x)) <$$> dest (Quot.mk Mcongr a✝)) ((TypeVec.id ::: Quot.mk Mcongr) <$$> MvQPF.abs (M.dest (P F) a✝)) [PROOFSTEP] congr rfl rw [Cofix.dest] [GOAL] n : ℕ F✝ : TypeVec (n + 1) → Type u mvf : MvFunctor F✝ q✝ : MvQPF F✝ F : TypeVec (n + 1) → Type u inst✝ : MvFunctor F q : MvQPF F α : TypeVec n R : Cofix F α → Cofix F α → Prop := fun x y => abs (repr y) = x a✝ : M (P F) α | LiftR' (RelLast' α fun x y => Quot.mk Mcongr (M.corec (P F) (fun x => MvQPF.repr (dest x)) y) = x) ((TypeVec.id ::: Quot.mk Mcongr) <$$> (TypeVec.id ::: M.corec (P F) fun x => MvQPF.repr (dest x)) <$$> dest (Quot.mk Mcongr a✝)) ((TypeVec.id ::: Quot.mk Mcongr) <$$> MvQPF.abs (M.dest (P F) a✝)) [PROOFSTEP] congr [GOAL] case R n : ℕ F✝ : TypeVec (n + 1) → Type u mvf : MvFunctor F✝ q✝ : MvQPF F✝ F : TypeVec (n + 1) → Type u inst✝ : MvFunctor F q : MvQPF F α : TypeVec n R : Cofix F α → Cofix F α → Prop := fun x y => abs (repr y) = x a✝ : M (P F) α | RelLast' α fun x y => Quot.mk Mcongr (M.corec (P F) (fun x => MvQPF.repr (dest x)) y) = x case a n : ℕ F✝ : TypeVec (n + 1) → Type u mvf : MvFunctor F✝ q✝ : MvQPF F✝ F : TypeVec (n + 1) → Type u inst✝ : MvFunctor F q : MvQPF F α : TypeVec n R : Cofix F α → Cofix F α → Prop := fun x y => abs (repr y) = x a✝ : M (P F) α | (TypeVec.id ::: Quot.mk Mcongr) <$$> (TypeVec.id ::: M.corec (P F) fun x => MvQPF.repr (dest x)) <$$> dest (Quot.mk Mcongr a✝) case a n : ℕ F✝ : TypeVec (n + 1) → Type u mvf : MvFunctor F✝ q✝ : MvQPF F✝ F : TypeVec (n + 1) → Type u inst✝ : MvFunctor F q : MvQPF F α : TypeVec n R : Cofix F α → Cofix F α → Prop := fun x y => abs (repr y) = x a✝ : M (P F) α | (TypeVec.id ::: Quot.mk Mcongr) <$$> MvQPF.abs (M.dest (P F) a✝) [PROOFSTEP] rfl [GOAL] case a n : ℕ F✝ : TypeVec (n + 1) → Type u mvf : MvFunctor F✝ q✝ : MvQPF F✝ F : TypeVec (n + 1) → Type u inst✝ : MvFunctor F q : MvQPF F α : TypeVec n R : Cofix F α → Cofix F α → Prop := fun x y => abs (repr y) = x a✝ : M (P F) α | (TypeVec.id ::: Quot.mk Mcongr) <$$> (TypeVec.id ::: M.corec (P F) fun x => MvQPF.repr (dest x)) <$$> dest (Quot.mk Mcongr a✝) case a n : ℕ F✝ : TypeVec (n + 1) → Type u mvf : MvFunctor F✝ q✝ : MvQPF F✝ F : TypeVec (n + 1) → Type u inst✝ : MvFunctor F q : MvQPF F α : TypeVec n R : Cofix F α → Cofix F α → Prop := fun x y => abs (repr y) = x a✝ : M (P F) α | (TypeVec.id ::: Quot.mk Mcongr) <$$> MvQPF.abs (M.dest (P F) a✝) [PROOFSTEP] rw [Cofix.dest] [GOAL] case mk n : ℕ F✝ : TypeVec (n + 1) → Type u mvf : MvFunctor F✝ q✝ : MvQPF F✝ F : TypeVec (n + 1) → Type u inst✝ : MvFunctor F q : MvQPF F α : TypeVec n R : Cofix F α → Cofix F α → Prop := fun x y => abs (repr y) = x a✝ : M (P F) α ⊢ LiftR' (RelLast' α fun x y => Quot.mk Mcongr (M.corec (P F) (fun x => MvQPF.repr (dest x)) y) = x) ((TypeVec.id ::: Quot.mk Mcongr) <$$> (TypeVec.id ::: M.corec (P F) fun x => MvQPF.repr (Quot.lift (fun x => (TypeVec.id ::: Quot.mk Mcongr) <$$> MvQPF.abs (M.dest (P F) x)) (_ : ∀ (x y : M (P F) α), Mcongr x y → (fun x => (TypeVec.id ::: Quot.mk Mcongr) <$$> MvQPF.abs (M.dest (P F) x)) x = (fun x => (TypeVec.id ::: Quot.mk Mcongr) <$$> MvQPF.abs (M.dest (P F) x)) y) x)) <$$> Quot.lift (fun x => (TypeVec.id ::: Quot.mk Mcongr) <$$> MvQPF.abs (M.dest (P F) x)) (_ : ∀ (x y : M (P F) α), Mcongr x y → (fun x => (TypeVec.id ::: Quot.mk Mcongr) <$$> MvQPF.abs (M.dest (P F) x)) x = (fun x => (TypeVec.id ::: Quot.mk Mcongr) <$$> MvQPF.abs (M.dest (P F) x)) y) (Quot.mk Mcongr a✝)) ((TypeVec.id ::: Quot.mk Mcongr) <$$> MvQPF.abs (M.dest (P F) a✝)) [PROOFSTEP] rw [MvFunctor.map_map, MvFunctor.map_map, ← appendFun_comp_id, ← appendFun_comp_id] [GOAL] case mk n : ℕ F✝ : TypeVec (n + 1) → Type u mvf : MvFunctor F✝ q✝ : MvQPF F✝ F : TypeVec (n + 1) → Type u inst✝ : MvFunctor F q : MvQPF F α : TypeVec n R : Cofix F α → Cofix F α → Prop := fun x y => abs (repr y) = x a✝ : M (P F) α ⊢ LiftR' (RelLast' α fun x y => Quot.mk Mcongr (M.corec (P F) (fun x => MvQPF.repr (dest x)) y) = x) ((TypeVec.id ::: (Quot.mk Mcongr ∘ M.corec (P F) fun x => MvQPF.repr (Quot.lift (fun x => (TypeVec.id ::: Quot.mk Mcongr) <$$> MvQPF.abs (M.dest (P F) x)) (_ : ∀ (x y : M (P F) α), Mcongr x y → (fun x => (TypeVec.id ::: Quot.mk Mcongr) <$$> MvQPF.abs (M.dest (P F) x)) x = (fun x => (TypeVec.id ::: Quot.mk Mcongr) <$$> MvQPF.abs (M.dest (P F) x)) y) x)) ∘ Quot.mk Mcongr) <$$> MvQPF.abs (M.dest (P F) a✝)) ((TypeVec.id ::: Quot.mk Mcongr) <$$> MvQPF.abs (M.dest (P F) a✝)) [PROOFSTEP] apply liftR_map_last [GOAL] case mk.hh n : ℕ F✝ : TypeVec (n + 1) → Type u mvf : MvFunctor F✝ q✝ : MvQPF F✝ F : TypeVec (n + 1) → Type u inst✝ : MvFunctor F q : MvQPF F α : TypeVec n R : Cofix F α → Cofix F α → Prop := fun x y => abs (repr y) = x a✝ : M (P F) α ⊢ ∀ (x : M (P F) α), Quot.mk Mcongr (M.corec (P F) (fun x => MvQPF.repr (dest x)) (Quot.mk Mcongr x)) = ((Quot.mk Mcongr ∘ M.corec (P F) fun x => MvQPF.repr (Quot.lift (fun x => (TypeVec.id ::: Quot.mk Mcongr) <$$> MvQPF.abs (M.dest (P F) x)) (_ : ∀ (x y : M (P F) α), Mcongr x y → (fun x => (TypeVec.id ::: Quot.mk Mcongr) <$$> MvQPF.abs (M.dest (P F) x)) x = (fun x => (TypeVec.id ::: Quot.mk Mcongr) <$$> MvQPF.abs (M.dest (P F) x)) y) x)) ∘ Quot.mk Mcongr) x [PROOFSTEP] intros [GOAL] case mk.hh n : ℕ F✝ : TypeVec (n + 1) → Type u mvf : MvFunctor F✝ q✝ : MvQPF F✝ F : TypeVec (n + 1) → Type u inst✝ : MvFunctor F q : MvQPF F α : TypeVec n R : Cofix F α → Cofix F α → Prop := fun x y => abs (repr y) = x a✝ x✝ : M (P F) α ⊢ Quot.mk Mcongr (M.corec (P F) (fun x => MvQPF.repr (dest x)) (Quot.mk Mcongr x✝)) = ((Quot.mk Mcongr ∘ M.corec (P F) fun x => MvQPF.repr (Quot.lift (fun x => (TypeVec.id ::: Quot.mk Mcongr) <$$> MvQPF.abs (M.dest (P F) x)) (_ : ∀ (x y : M (P F) α), Mcongr x y → (fun x => (TypeVec.id ::: Quot.mk Mcongr) <$$> MvQPF.abs (M.dest (P F) x)) x = (fun x => (TypeVec.id ::: Quot.mk Mcongr) <$$> MvQPF.abs (M.dest (P F) x)) y) x)) ∘ Quot.mk Mcongr) x✝ [PROOFSTEP] rfl [GOAL] n : ℕ F : TypeVec (n + 1) → Type u mvf : MvFunctor F q : MvQPF F α : TypeVec n X Y : Type u x₀ : X f : X → Y g : Y → F (α ::: X) ⊢ Cofix.corec (g ∘ f) x₀ = Cofix.corec (MvFunctor.map (TypeVec.id ::: f) ∘ g) (f x₀) [PROOFSTEP] mv_bisim x₀ with R a b x Ha Hb [GOAL] case intro.intro n : ℕ F : TypeVec (n + 1) → Type u mvf : MvFunctor F q : MvQPF F α : TypeVec n X Y : Type u x₀ : X f : X → Y g : Y → F (α ::: X) R : Cofix F α → Cofix F α → Prop := fun a b => ∃ x, a = Cofix.corec (g ∘ f) x ∧ b = Cofix.corec (MvFunctor.map (TypeVec.id ::: f) ∘ g) (f x) a b : Cofix F α x : X Ha : a = Cofix.corec (g ∘ f) x Hb : b = Cofix.corec (MvFunctor.map (TypeVec.id ::: f) ∘ g) (f x) ⊢ LiftR' (RelLast' α R) (Cofix.dest a) (Cofix.dest b) [PROOFSTEP] rw [Ha, Hb, Cofix.dest_corec, Cofix.dest_corec, Function.comp_apply, Function.comp_apply] [GOAL] case intro.intro n : ℕ F : TypeVec (n + 1) → Type u mvf : MvFunctor F q : MvQPF F α : TypeVec n X Y : Type u x₀ : X f : X → Y g : Y → F (α ::: X) R : Cofix F α → Cofix F α → Prop := fun a b => ∃ x, a = Cofix.corec (g ∘ f) x ∧ b = Cofix.corec (MvFunctor.map (TypeVec.id ::: f) ∘ g) (f x) a b : Cofix F α x : X Ha : a = Cofix.corec (g ∘ f) x Hb : b = Cofix.corec (MvFunctor.map (TypeVec.id ::: f) ∘ g) (f x) ⊢ LiftR' (RelLast' α R) ((TypeVec.id ::: Cofix.corec (g ∘ f)) <$$> g (f x)) ((TypeVec.id ::: Cofix.corec (MvFunctor.map (TypeVec.id ::: f) ∘ g)) <$$> (TypeVec.id ::: f) <$$> g (f x)) [PROOFSTEP] rw [MvFunctor.map_map, ← appendFun_comp_id] [GOAL] case intro.intro n : ℕ F : TypeVec (n + 1) → Type u mvf : MvFunctor F q : MvQPF F α : TypeVec n X Y : Type u x₀ : X f : X → Y g : Y → F (α ::: X) R : Cofix F α → Cofix F α → Prop := fun a b => ∃ x, a = Cofix.corec (g ∘ f) x ∧ b = Cofix.corec (MvFunctor.map (TypeVec.id ::: f) ∘ g) (f x) a b : Cofix F α x : X Ha : a = Cofix.corec (g ∘ f) x Hb : b = Cofix.corec (MvFunctor.map (TypeVec.id ::: f) ∘ g) (f x) ⊢ LiftR' (RelLast' α R) ((TypeVec.id ::: Cofix.corec (g ∘ f)) <$$> g (f x)) ((TypeVec.id ::: Cofix.corec (MvFunctor.map (TypeVec.id ::: f) ∘ g) ∘ f) <$$> g (f x)) [PROOFSTEP] refine' liftR_map_last _ _ _ _ _ [GOAL] case intro.intro n : ℕ F : TypeVec (n + 1) → Type u mvf : MvFunctor F q : MvQPF F α : TypeVec n X Y : Type u x₀ : X f : X → Y g : Y → F (α ::: X) R : Cofix F α → Cofix F α → Prop := fun a b => ∃ x, a = Cofix.corec (g ∘ f) x ∧ b = Cofix.corec (MvFunctor.map (TypeVec.id ::: f) ∘ g) (f x) a b : Cofix F α x : X Ha : a = Cofix.corec (g ∘ f) x Hb : b = Cofix.corec (MvFunctor.map (TypeVec.id ::: f) ∘ g) (f x) ⊢ ∀ (x : X), R (Cofix.corec (g ∘ f) x) ((Cofix.corec (MvFunctor.map (TypeVec.id ::: f) ∘ g) ∘ f) x) [PROOFSTEP] intro a [GOAL] case intro.intro n : ℕ F : TypeVec (n + 1) → Type u mvf : MvFunctor F q : MvQPF F α : TypeVec n X Y : Type u x₀ : X f : X → Y g : Y → F (α ::: X) R : Cofix F α → Cofix F α → Prop := fun a b => ∃ x, a = Cofix.corec (g ∘ f) x ∧ b = Cofix.corec (MvFunctor.map (TypeVec.id ::: f) ∘ g) (f x) a✝ b : Cofix F α x : X Ha : a✝ = Cofix.corec (g ∘ f) x Hb : b = Cofix.corec (MvFunctor.map (TypeVec.id ::: f) ∘ g) (f x) a : X ⊢ R (Cofix.corec (g ∘ f) a) ((Cofix.corec (MvFunctor.map (TypeVec.id ::: f) ∘ g) ∘ f) a) [PROOFSTEP] refine' ⟨a, rfl, rfl⟩ [GOAL] n : ℕ F : TypeVec (n + 1) → Type u mvf : MvFunctor F q : MvQPF F α : TypeVec n β : Type u g : β → F (α ::: (Cofix F α ⊕ β)) x : β ⊢ dest (corec' g x) = (TypeVec.id ::: Sum.elim _root_.id (corec' g)) <$$> g x [PROOFSTEP] rw [Cofix.corec', Cofix.dest_corec] [GOAL] n : ℕ F : TypeVec (n + 1) → Type u mvf : MvFunctor F q : MvQPF F α : TypeVec n β : Type u g : β → F (α ::: (Cofix F α ⊕ β)) x : β ⊢ (TypeVec.id ::: corec (Sum.elim (MvFunctor.map (TypeVec.id ::: Sum.inl) ∘ dest) g)) <$$> Sum.elim (MvFunctor.map (TypeVec.id ::: Sum.inl) ∘ dest) g (Sum.inr x) = (TypeVec.id ::: Sum.elim _root_.id (corec' g)) <$$> g x [PROOFSTEP] dsimp [GOAL] n : ℕ F : TypeVec (n + 1) → Type u mvf : MvFunctor F q : MvQPF F α : TypeVec n β : Type u g : β → F (α ::: (Cofix F α ⊕ β)) x : β ⊢ (TypeVec.id ::: corec (Sum.elim (MvFunctor.map (TypeVec.id ::: Sum.inl) ∘ dest) g)) <$$> g x = (TypeVec.id ::: Sum.elim _root_.id (corec' g)) <$$> g x [PROOFSTEP] congr! [GOAL] case h.e'_6.h.e'_7 n : ℕ F : TypeVec (n + 1) → Type u mvf : MvFunctor F q : MvQPF F α : TypeVec n β : Type u g : β → F (α ::: (Cofix F α ⊕ β)) x : β ⊢ corec (Sum.elim (MvFunctor.map (TypeVec.id ::: Sum.inl) ∘ dest) g) = Sum.elim _root_.id (corec' g) [PROOFSTEP] ext (i | i) [GOAL] case h.e'_6.h.e'_7.h.inl n : ℕ F : TypeVec (n + 1) → Type u mvf : MvFunctor F q : MvQPF F α : TypeVec n β : Type u g : β → F (α ::: (Cofix F α ⊕ β)) x : β i : Cofix F α ⊢ corec (Sum.elim (MvFunctor.map (TypeVec.id ::: Sum.inl) ∘ dest) g) (Sum.inl i) = Sum.elim _root_.id (corec' g) (Sum.inl i) [PROOFSTEP] erw [corec_roll] [GOAL] case h.e'_6.h.e'_7.h.inr n : ℕ F : TypeVec (n + 1) → Type u mvf : MvFunctor F q : MvQPF F α : TypeVec n β : Type u g : β → F (α ::: (Cofix F α ⊕ β)) x i : β ⊢ corec (Sum.elim (MvFunctor.map (TypeVec.id ::: Sum.inl) ∘ dest) g) (Sum.inr i) = Sum.elim _root_.id (corec' g) (Sum.inr i) [PROOFSTEP] erw [corec_roll] [GOAL] case h.e'_6.h.e'_7.h.inl n : ℕ F : TypeVec (n + 1) → Type u mvf : MvFunctor F q : MvQPF F α : TypeVec n β : Type u g : β → F (α ::: (Cofix F α ⊕ β)) x : β i : Cofix F α ⊢ corec (MvFunctor.map (TypeVec.id ::: fun x => x) ∘ Sum.rec (fun val => (MvFunctor.map (TypeVec.id ::: Sum.inl) ∘ dest) val) fun val => g val) (Sum.inl i) = Sum.elim _root_.id (corec' g) (Sum.inl i) [PROOFSTEP] dsimp [Cofix.corec'] [GOAL] case h.e'_6.h.e'_7.h.inr n : ℕ F : TypeVec (n + 1) → Type u mvf : MvFunctor F q : MvQPF F α : TypeVec n β : Type u g : β → F (α ::: (Cofix F α ⊕ β)) x i : β ⊢ corec (MvFunctor.map (TypeVec.id ::: fun x => x) ∘ Sum.rec (fun val => (MvFunctor.map (TypeVec.id ::: Sum.inl) ∘ dest) val) fun val => g val) (Sum.inr i) = Sum.elim _root_.id (corec' g) (Sum.inr i) [PROOFSTEP] dsimp [Cofix.corec'] [GOAL] case h.e'_6.h.e'_7.h.inl n : ℕ F : TypeVec (n + 1) → Type u mvf : MvFunctor F q : MvQPF F α : TypeVec n β : Type u g : β → F (α ::: (Cofix F α ⊕ β)) x : β i : Cofix F α ⊢ corec (MvFunctor.map (TypeVec.id ::: fun x => x) ∘ Sum.rec (fun val => (TypeVec.id ::: Sum.inl) <$$> dest val) fun val => g val) (Sum.inl i) = i [PROOFSTEP] mv_bisim i with R a b x Ha Hb [GOAL] case h.e'_6.h.e'_7.h.inl.intro.intro n : ℕ F : TypeVec (n + 1) → Type u mvf : MvFunctor F q : MvQPF F α : TypeVec n β : Type u g : β → F (α ::: (Cofix F α ⊕ β)) x✝ : β i : Cofix F α R : Cofix F α → Cofix F α → Prop := fun a b => ∃ x, a = corec (MvFunctor.map (TypeVec.id ::: fun x => x) ∘ Sum.rec (fun val => (TypeVec.id ::: Sum.inl) <$$> dest val) fun val => g val) (Sum.inl x) ∧ b = x a b x : Cofix F α Ha : a = corec (MvFunctor.map (TypeVec.id ::: fun x => x) ∘ Sum.rec (fun val => (TypeVec.id ::: Sum.inl) <$$> dest val) fun val => g val) (Sum.inl x) Hb : b = x ⊢ LiftR' (RelLast' α R) (dest a) (dest b) [PROOFSTEP] rw [Ha, Hb, Cofix.dest_corec] [GOAL] case h.e'_6.h.e'_7.h.inl.intro.intro n : ℕ F : TypeVec (n + 1) → Type u mvf : MvFunctor F q : MvQPF F α : TypeVec n β : Type u g : β → F (α ::: (Cofix F α ⊕ β)) x✝ : β i : Cofix F α R : Cofix F α → Cofix F α → Prop := fun a b => ∃ x, a = corec (MvFunctor.map (TypeVec.id ::: fun x => x) ∘ Sum.rec (fun val => (TypeVec.id ::: Sum.inl) <$$> dest val) fun val => g val) (Sum.inl x) ∧ b = x a b x : Cofix F α Ha : a = corec (MvFunctor.map (TypeVec.id ::: fun x => x) ∘ Sum.rec (fun val => (TypeVec.id ::: Sum.inl) <$$> dest val) fun val => g val) (Sum.inl x) Hb : b = x ⊢ LiftR' (RelLast' α R) ((TypeVec.id ::: corec (MvFunctor.map (TypeVec.id ::: fun x => x) ∘ Sum.rec (fun val => (TypeVec.id ::: Sum.inl) <$$> dest val) fun val => g val)) <$$> (MvFunctor.map (TypeVec.id ::: fun x => x) ∘ Sum.rec (fun val => (TypeVec.id ::: Sum.inl) <$$> dest val) fun val => g val) (Sum.inl x)) (dest x) [PROOFSTEP] dsimp [Function.comp] [GOAL] case h.e'_6.h.e'_7.h.inl.intro.intro n : ℕ F : TypeVec (n + 1) → Type u mvf : MvFunctor F q : MvQPF F α : TypeVec n β : Type u g : β → F (α ::: (Cofix F α ⊕ β)) x✝ : β i : Cofix F α R : Cofix F α → Cofix F α → Prop := fun a b => ∃ x, a = corec (MvFunctor.map (TypeVec.id ::: fun x => x) ∘ Sum.rec (fun val => (TypeVec.id ::: Sum.inl) <$$> dest val) fun val => g val) (Sum.inl x) ∧ b = x a b x : Cofix F α Ha : a = corec (MvFunctor.map (TypeVec.id ::: fun x => x) ∘ Sum.rec (fun val => (TypeVec.id ::: Sum.inl) <$$> dest val) fun val => g val) (Sum.inl x) Hb : b = x ⊢ LiftR' (RelLast' α fun a b => ∃ x, a = corec (fun x => (TypeVec.id ::: fun x => x) <$$> Sum.rec (fun val => (TypeVec.id ::: Sum.inl) <$$> dest val) (fun val => g val) x) (Sum.inl x) ∧ b = x) ((TypeVec.id ::: corec fun x => (TypeVec.id ::: fun x => x) <$$> Sum.rec (fun val => (TypeVec.id ::: Sum.inl) <$$> dest val) (fun val => g val) x) <$$> (TypeVec.id ::: fun x => x) <$$> (TypeVec.id ::: Sum.inl) <$$> dest x) (dest x) [PROOFSTEP] repeat rw [MvFunctor.map_map, ← appendFun_comp_id] [GOAL] case h.e'_6.h.e'_7.h.inl.intro.intro n : ℕ F : TypeVec (n + 1) → Type u mvf : MvFunctor F q : MvQPF F α : TypeVec n β : Type u g : β → F (α ::: (Cofix F α ⊕ β)) x✝ : β i : Cofix F α R : Cofix F α → Cofix F α → Prop := fun a b => ∃ x, a = corec (MvFunctor.map (TypeVec.id ::: fun x => x) ∘ Sum.rec (fun val => (TypeVec.id ::: Sum.inl) <$$> dest val) fun val => g val) (Sum.inl x) ∧ b = x a b x : Cofix F α Ha : a = corec (MvFunctor.map (TypeVec.id ::: fun x => x) ∘ Sum.rec (fun val => (TypeVec.id ::: Sum.inl) <$$> dest val) fun val => g val) (Sum.inl x) Hb : b = x ⊢ LiftR' (RelLast' α fun a b => ∃ x, a = corec (fun x => (TypeVec.id ::: fun x => x) <$$> Sum.rec (fun val => (TypeVec.id ::: Sum.inl) <$$> dest val) (fun val => g val) x) (Sum.inl x) ∧ b = x) ((TypeVec.id ::: corec fun x => (TypeVec.id ::: fun x => x) <$$> Sum.rec (fun val => (TypeVec.id ::: Sum.inl) <$$> dest val) (fun val => g val) x) <$$> (TypeVec.id ::: fun x => x) <$$> (TypeVec.id ::: Sum.inl) <$$> dest x) (dest x) [PROOFSTEP] rw [MvFunctor.map_map, ← appendFun_comp_id] [GOAL] case h.e'_6.h.e'_7.h.inl.intro.intro n : ℕ F : TypeVec (n + 1) → Type u mvf : MvFunctor F q : MvQPF F α : TypeVec n β : Type u g : β → F (α ::: (Cofix F α ⊕ β)) x✝ : β i : Cofix F α R : Cofix F α → Cofix F α → Prop := fun a b => ∃ x, a = corec (MvFunctor.map (TypeVec.id ::: fun x => x) ∘ Sum.rec (fun val => (TypeVec.id ::: Sum.inl) <$$> dest val) fun val => g val) (Sum.inl x) ∧ b = x a b x : Cofix F α Ha : a = corec (MvFunctor.map (TypeVec.id ::: fun x => x) ∘ Sum.rec (fun val => (TypeVec.id ::: Sum.inl) <$$> dest val) fun val => g val) (Sum.inl x) Hb : b = x ⊢ LiftR' (RelLast' α fun a b => ∃ x, a = corec (fun x => (TypeVec.id ::: fun x => x) <$$> Sum.rec (fun val => (TypeVec.id ::: Sum.inl) <$$> dest val) (fun val => g val) x) (Sum.inl x) ∧ b = x) ((TypeVec.id ::: (corec fun x => (TypeVec.id ::: fun x => x) <$$> Sum.rec (fun val => (TypeVec.id ::: Sum.inl) <$$> dest val) (fun val => g val) x) ∘ fun x => x) <$$> (TypeVec.id ::: Sum.inl) <$$> dest x) (dest x) [PROOFSTEP] rw [MvFunctor.map_map, ← appendFun_comp_id] [GOAL] case h.e'_6.h.e'_7.h.inl.intro.intro n : ℕ F : TypeVec (n + 1) → Type u mvf : MvFunctor F q : MvQPF F α : TypeVec n β : Type u g : β → F (α ::: (Cofix F α ⊕ β)) x✝ : β i : Cofix F α R : Cofix F α → Cofix F α → Prop := fun a b => ∃ x, a = corec (MvFunctor.map (TypeVec.id ::: fun x => x) ∘ Sum.rec (fun val => (TypeVec.id ::: Sum.inl) <$$> dest val) fun val => g val) (Sum.inl x) ∧ b = x a b x : Cofix F α Ha : a = corec (MvFunctor.map (TypeVec.id ::: fun x => x) ∘ Sum.rec (fun val => (TypeVec.id ::: Sum.inl) <$$> dest val) fun val => g val) (Sum.inl x) Hb : b = x ⊢ LiftR' (RelLast' α fun a b => ∃ x, a = corec (fun x => (TypeVec.id ::: fun x => x) <$$> Sum.rec (fun val => (TypeVec.id ::: Sum.inl) <$$> dest val) (fun val => g val) x) (Sum.inl x) ∧ b = x) ((TypeVec.id ::: ((corec fun x => (TypeVec.id ::: fun x => x) <$$> Sum.rec (fun val => (TypeVec.id ::: Sum.inl) <$$> dest val) (fun val => g val) x) ∘ fun x => x) ∘ Sum.inl) <$$> dest x) (dest x) [PROOFSTEP] rw [MvFunctor.map_map, ← appendFun_comp_id] [GOAL] case h.e'_6.h.e'_7.h.inl.intro.intro n : ℕ F : TypeVec (n + 1) → Type u mvf : MvFunctor F q : MvQPF F α : TypeVec n β : Type u g : β → F (α ::: (Cofix F α ⊕ β)) x✝ : β i : Cofix F α R : Cofix F α → Cofix F α → Prop := fun a b => ∃ x, a = corec (MvFunctor.map (TypeVec.id ::: fun x => x) ∘ Sum.rec (fun val => (TypeVec.id ::: Sum.inl) <$$> dest val) fun val => g val) (Sum.inl x) ∧ b = x a b x : Cofix F α Ha : a = corec (MvFunctor.map (TypeVec.id ::: fun x => x) ∘ Sum.rec (fun val => (TypeVec.id ::: Sum.inl) <$$> dest val) fun val => g val) (Sum.inl x) Hb : b = x ⊢ LiftR' (RelLast' α fun a b => ∃ x, a = corec (fun x => (TypeVec.id ::: fun x => x) <$$> Sum.rec (fun val => (TypeVec.id ::: Sum.inl) <$$> dest val) (fun val => g val) x) (Sum.inl x) ∧ b = x) ((TypeVec.id ::: ((corec fun x => (TypeVec.id ::: fun x => x) <$$> Sum.rec (fun val => (TypeVec.id ::: Sum.inl) <$$> dest val) (fun val => g val) x) ∘ fun x => x) ∘ Sum.inl) <$$> dest x) (dest x) [PROOFSTEP] apply liftR_map_last' [GOAL] case h.e'_6.h.e'_7.h.inl.intro.intro.hh n : ℕ F : TypeVec (n + 1) → Type u mvf : MvFunctor F q : MvQPF F α : TypeVec n β : Type u g : β → F (α ::: (Cofix F α ⊕ β)) x✝ : β i : Cofix F α R : Cofix F α → Cofix F α → Prop := fun a b => ∃ x, a = corec (MvFunctor.map (TypeVec.id ::: fun x => x) ∘ Sum.rec (fun val => (TypeVec.id ::: Sum.inl) <$$> dest val) fun val => g val) (Sum.inl x) ∧ b = x a b x : Cofix F α Ha : a = corec (MvFunctor.map (TypeVec.id ::: fun x => x) ∘ Sum.rec (fun val => (TypeVec.id ::: Sum.inl) <$$> dest val) fun val => g val) (Sum.inl x) Hb : b = x ⊢ ∀ (x : Cofix F α), ∃ x_1, (((corec fun x => (TypeVec.id ::: fun x => x) <$$> Sum.rec (fun val => (TypeVec.id ::: Sum.inl) <$$> dest val) (fun val => g val) x) ∘ fun x => x) ∘ Sum.inl) x = corec (fun x => (TypeVec.id ::: fun x => x) <$$> Sum.rec (fun val => (TypeVec.id ::: Sum.inl) <$$> dest val) (fun val => g val) x) (Sum.inl x_1) ∧ x = x_1 [PROOFSTEP] dsimp [Function.comp] [GOAL] case h.e'_6.h.e'_7.h.inl.intro.intro.hh n : ℕ F : TypeVec (n + 1) → Type u mvf : MvFunctor F q : MvQPF F α : TypeVec n β : Type u g : β → F (α ::: (Cofix F α ⊕ β)) x✝ : β i : Cofix F α R : Cofix F α → Cofix F α → Prop := fun a b => ∃ x, a = corec (MvFunctor.map (TypeVec.id ::: fun x => x) ∘ Sum.rec (fun val => (TypeVec.id ::: Sum.inl) <$$> dest val) fun val => g val) (Sum.inl x) ∧ b = x a b x : Cofix F α Ha : a = corec (MvFunctor.map (TypeVec.id ::: fun x => x) ∘ Sum.rec (fun val => (TypeVec.id ::: Sum.inl) <$$> dest val) fun val => g val) (Sum.inl x) Hb : b = x ⊢ ∀ (x : Cofix F α), ∃ x_1, corec (fun x => (TypeVec.id ::: fun x => x) <$$> Sum.rec (fun val => (TypeVec.id ::: Sum.inl) <$$> dest val) (fun val => g val) x) (Sum.inl x) = corec (fun x => (TypeVec.id ::: fun x => x) <$$> Sum.rec (fun val => (TypeVec.id ::: Sum.inl) <$$> dest val) (fun val => g val) x) (Sum.inl x_1) ∧ x = x_1 [PROOFSTEP] intros [GOAL] case h.e'_6.h.e'_7.h.inl.intro.intro.hh n : ℕ F : TypeVec (n + 1) → Type u mvf : MvFunctor F q : MvQPF F α : TypeVec n β : Type u g : β → F (α ::: (Cofix F α ⊕ β)) x✝¹ : β i : Cofix F α R : Cofix F α → Cofix F α → Prop := fun a b => ∃ x, a = corec (MvFunctor.map (TypeVec.id ::: fun x => x) ∘ Sum.rec (fun val => (TypeVec.id ::: Sum.inl) <$$> dest val) fun val => g val) (Sum.inl x) ∧ b = x a b x : Cofix F α Ha : a = corec (MvFunctor.map (TypeVec.id ::: fun x => x) ∘ Sum.rec (fun val => (TypeVec.id ::: Sum.inl) <$$> dest val) fun val => g val) (Sum.inl x) Hb : b = x x✝ : Cofix F α ⊢ ∃ x, corec (fun x => (TypeVec.id ::: fun x => x) <$$> Sum.rec (fun val => (TypeVec.id ::: Sum.inl) <$$> dest val) (fun val => g val) x) (Sum.inl x✝) = corec (fun x => (TypeVec.id ::: fun x => x) <$$> Sum.rec (fun val => (TypeVec.id ::: Sum.inl) <$$> dest val) (fun val => g val) x) (Sum.inl x) ∧ x✝ = x [PROOFSTEP] exact ⟨_, rfl, rfl⟩ [GOAL] case h.e'_6.h.e'_7.h.inr n : ℕ F : TypeVec (n + 1) → Type u mvf : MvFunctor F q : MvQPF F α : TypeVec n β : Type u g : β → F (α ::: (Cofix F α ⊕ β)) x i : β ⊢ corec (MvFunctor.map (TypeVec.id ::: fun x => x) ∘ Sum.rec (fun val => (TypeVec.id ::: Sum.inl) <$$> dest val) fun val => g val) (Sum.inr i) = corec (Sum.elim (MvFunctor.map (TypeVec.id ::: Sum.inl) ∘ dest) g) (Sum.inr i) [PROOFSTEP] congr with y [GOAL] case h.e'_6.h.e'_7.h.inr.e_g.h n : ℕ F : TypeVec (n + 1) → Type u mvf : MvFunctor F q : MvQPF F α : TypeVec n β : Type u g : β → F (α ::: (Cofix F α ⊕ β)) x i : β y : Cofix F α ⊕ β ⊢ (MvFunctor.map (TypeVec.id ::: fun x => x) ∘ Sum.rec (fun val => (TypeVec.id ::: Sum.inl) <$$> dest val) fun val => g val) y = Sum.elim (MvFunctor.map (TypeVec.id ::: Sum.inl) ∘ dest) g y [PROOFSTEP] erw [appendFun_id_id] [GOAL] case h.e'_6.h.e'_7.h.inr.e_g.h n : ℕ F : TypeVec (n + 1) → Type u mvf : MvFunctor F q : MvQPF F α : TypeVec n β : Type u g : β → F (α ::: (Cofix F α ⊕ β)) x i : β y : Cofix F α ⊕ β ⊢ (MvFunctor.map TypeVec.id ∘ Sum.rec (fun val => (TypeVec.id ::: Sum.inl) <$$> dest val) fun val => g val) y = Sum.elim (MvFunctor.map (TypeVec.id ::: Sum.inl) ∘ dest) g y [PROOFSTEP] simp [MvFunctor.id_map, Sum.elim] [GOAL] n : ℕ F : TypeVec (n + 1) → Type u mvf : MvFunctor F q : MvQPF F α : TypeVec n β : Type u g : {X : Type u} → (Cofix F α → X) → (β → X) → β → F (α ::: X) x : β h : ∀ (X Y : Type u) (f : Cofix F α → X) (f' : β → X) (k : X → Y), g (k ∘ f) (k ∘ f') x = (TypeVec.id ::: k) <$$> g f f' x ⊢ dest (corec₁ g x) = g _root_.id (corec₁ g) x [PROOFSTEP] rw [Cofix.corec₁, Cofix.dest_corec', ← h] [GOAL] n : ℕ F : TypeVec (n + 1) → Type u mvf : MvFunctor F q : MvQPF F α : TypeVec n β : Type u g : {X : Type u} → (Cofix F α → X) → (β → X) → β → F (α ::: X) x : β h : ∀ (X Y : Type u) (f : Cofix F α → X) (f' : β → X) (k : X → Y), g (k ∘ f) (k ∘ f') x = (TypeVec.id ::: k) <$$> g f f' x ⊢ g (Sum.elim _root_.id (corec' fun x => g Sum.inl Sum.inr x) ∘ Sum.inl) (Sum.elim _root_.id (corec' fun x => g Sum.inl Sum.inr x) ∘ Sum.inr) x = g _root_.id (corec₁ g) x [PROOFSTEP] rfl [GOAL] n : ℕ F : TypeVec (n + 1) → Type u mvf : MvFunctor F q : MvQPF F ⊢ ∀ {α β : TypeVec n} (f : α ⟹ β) (p : Obj (mp (P F)) α), (fun {α} => Quot.mk Mcongr) (f <$$> p) = f <$$> (fun {α} => Quot.mk Mcongr) p [PROOFSTEP] intros [GOAL] n : ℕ F : TypeVec (n + 1) → Type u mvf : MvFunctor F q : MvQPF F α✝ β✝ : TypeVec n f✝ : α✝ ⟹ β✝ p✝ : Obj (mp (P F)) α✝ ⊢ (fun {α} => Quot.mk Mcongr) (f✝ <$$> p✝) = f✝ <$$> (fun {α} => Quot.mk Mcongr) p✝ [PROOFSTEP] rfl