File: Mathlib/LinearAlgebra/Orientation.lean

full_name: Orientation
code: /-- An orientation of a module, intended to be used when `ι` is a `Fintype` with the same
cardinality as a basis. -/
abbrev Orientation 
goal: Type (max (max u_4 u_1) u_2)

full_name: Module.Oriented
code: /-- A type class fixing an orientation of a module. -/
class Module.Oriented where
  /-- Fix a positive orientation. -/
  positiveOrientation : Orientation R M ι
goal: Type (max (max u_1 u_2) u_4)

full_name: Module.Oriented.positiveOrientation
code: /-- A type class fixing an orientation of a module. -/
class Module.Oriented where
  /-- Fix a positive orientation. -/
  positiveOrientation : Orientation R M ι
goal: Orientation R M ι

full_name: Orientation.map
code: /-- An equivalence between modules implies an equivalence between orientations. -/
def Orientation.map (e : M ≃ₗ[R] N) : Orientation R M ι ≃ Orientation R N ι 
goal: Orientation R M ι ≃ Orientation R N ι

full_name: Orientation.map_apply
code: @[simp]
theorem Orientation.map_apply (e : M ≃ₗ[R] N) (v : M [⋀^ι]→ₗ[R] R) (hv : v ≠ 0) :
    Orientation.map ι e (rayOfNeZero _ v hv) =
      rayOfNeZero _ (v.compLinearMap e.symm) (mt (v.compLinearEquiv_eq_zero_iff e.symm).mp hv) 
goal: (Orientation.map ι e) (rayOfNeZero R v hv) = rayOfNeZero R (v.compLinearMap ↑e.symm) ⋯

full_name: Orientation.map_refl
code: @[simp]
theorem Orientation.map_refl : (Orientation.map ι <| LinearEquiv.refl R M) = Equiv.refl _ 
goal: Orientation.map ι (LinearEquiv.refl R M) = Equiv.refl (Orientation R M ι)

full_name: Orientation.map_symm
code: @[simp]
theorem Orientation.map_symm (e : M ≃ₗ[R] N) :
    (Orientation.map ι e).symm = Orientation.map ι e.symm 
goal: (Orientation.map ι e).symm = Orientation.map ι e.symm

full_name: Orientation.reindex
code: /-- An equivalence between indices implies an equivalence between orientations. -/
def Orientation.reindex (e : ι ≃ ι') : Orientation R M ι ≃ Orientation R M ι' 
goal: Orientation R M ι ≃ Orientation R M ι'

full_name: Orientation.reindex_apply
code: @[simp]
theorem Orientation.reindex_apply (e : ι ≃ ι') (v : M [⋀^ι]→ₗ[R] R) (hv : v ≠ 0) :
    Orientation.reindex R M e (rayOfNeZero _ v hv) =
      rayOfNeZero _ (v.domDomCongr e) (mt (v.domDomCongr_eq_zero_iff e).mp hv) 
goal: (Orientation.reindex R M e) (rayOfNeZero R v hv) = rayOfNeZero R (AlternatingMap.domDomCongr e v) ⋯

full_name: Orientation.reindex_refl
code: @[simp]
theorem Orientation.reindex_refl : (Orientation.reindex R M <| Equiv.refl ι) = Equiv.refl _ 
goal: Orientation.reindex R M (Equiv.refl ι) = Equiv.refl (Orientation R M ι)

full_name: Orientation.reindex_symm
code: @[simp]
theorem Orientation.reindex_symm (e : ι ≃ ι') :
    (Orientation.reindex R M e).symm = Orientation.reindex R M e.symm 
goal: (Orientation.reindex R M e).symm = Orientation.reindex R M e.symm

full_name: IsEmpty.oriented
code: /-- A module is canonically oriented with respect to an empty index type. -/
instance (priority := 100) IsEmpty.oriented [IsEmpty ι] : Module.Oriented R M ι 
goal: Module.Oriented R M ι

full_name: Orientation.map_positiveOrientation_of_isEmpty
code: @[simp]
theorem Orientation.map_positiveOrientation_of_isEmpty [IsEmpty ι] (f : M ≃ₗ[R] N) :
    Orientation.map ι f positiveOrientation = positiveOrientation 
goal: (Orientation.map ι f) positiveOrientation = positiveOrientation

full_name: Orientation.map_of_isEmpty
code: @[simp]
theorem Orientation.map_of_isEmpty [IsEmpty ι] (x : Orientation R M ι) (f : M ≃ₗ[R] M) :
    Orientation.map ι f x = x 
goal: (Orientation.map ι f) x = x

full_name: Orientation.map_neg
code: @[simp]
protected theorem Orientation.map_neg {ι : Type*} (f : M ≃ₗ[R] N) (x : Orientation R M ι) :
    Orientation.map ι f (-x) = -Orientation.map ι f x 
goal: (Orientation.map ι f) (-x) = -(Orientation.map ι f) x

full_name: Orientation.reindex_neg
code: @[simp]
protected theorem Orientation.reindex_neg {ι ι' : Type*} (e : ι ≃ ι') (x : Orientation R M ι) :
    Orientation.reindex R M e (-x) = -Orientation.reindex R M e x 
goal: (Orientation.reindex R M e) (-x) = -(Orientation.reindex R M e) x

full_name: Basis.map_orientation_eq_det_inv_smul
code: /-- The value of `Orientation.map` when the index type has the cardinality of a basis, in terms
of `f.det`. -/
theorem map_orientation_eq_det_inv_smul [Finite ι] (e : Basis ι R M) (x : Orientation R M ι)
    (f : M ≃ₗ[R] M) : Orientation.map ι f x = (LinearEquiv.det f)⁻¹ • x 
goal: (Orientation.map ι f) x = (LinearEquiv.det f)⁻¹ • x

full_name: Basis.orientation
code: /-- The orientation given by a basis. -/
protected def orientation (e : Basis ι R M) : Orientation R M ι 
goal: Orientation R M ι

full_name: Basis.orientation_map
code: theorem orientation_map (e : Basis ι R M) (f : M ≃ₗ[R] N) :
    (e.map f).orientation = Orientation.map ι f e.orientation 
goal: (e.map f).orientation = (Orientation.map ι f) e.orientation

full_name: Basis.orientation_reindex
code: theorem orientation_reindex (e : Basis ι R M) (eι : ι ≃ ι') :
    (e.reindex eι).orientation = Orientation.reindex R M eι e.orientation 
goal: (e.reindex eι).orientation = (Orientation.reindex R M eι) e.orientation

full_name: Basis.orientation_unitsSMul
code: /-- The orientation given by a basis derived using `units_smul`, in terms of the product of those
units. -/
theorem orientation_unitsSMul (e : Basis ι R M) (w : ι → Units R) :
    (e.unitsSMul w).orientation = (∏ i, w i)⁻¹ • e.orientation 
goal: (e.unitsSMul w).orientation = (∏ i : ι, w i)⁻¹ • e.orientation

full_name: Basis.orientation_isEmpty
code: @[simp]
theorem orientation_isEmpty [IsEmpty ι] (b : Basis ι R M) :
    b.orientation = positiveOrientation 
goal: b.orientation = positiveOrientation

full_name: Orientation.eq_or_eq_neg_of_isEmpty
code: /-- A module `M` over a linearly ordered commutative ring has precisely two "orientations" with
respect to an empty index type. (Note that these are only orientations of `M` of in the conventional
mathematical sense if `M` is zero-dimensional.) -/
theorem eq_or_eq_neg_of_isEmpty [IsEmpty ι] (o : Orientation R M ι) :
    o = positiveOrientation ∨ o = -positiveOrientation 
goal: o = positiveOrientation ∨ o = -positiveOrientation

full_name: Basis.orientation_eq_iff_det_pos
code: /-- The orientations given by two bases are equal if and only if the determinant of one basis
with respect to the other is positive. -/
theorem orientation_eq_iff_det_pos (e₁ e₂ : Basis ι R M) :
    e₁.orientation = e₂.orientation ↔ 0 < e₁.det e₂ 
goal: e₁.orientation = e₂.orientation ↔ 0 < e₁.det ⇑e₂

full_name: Basis.orientation_eq_or_eq_neg
code: /-- Given a basis, any orientation equals the orientation given by that basis or its negation. -/
theorem orientation_eq_or_eq_neg (e : Basis ι R M) (x : Orientation R M ι) :
    x = e.orientation ∨ x = -e.orientation 
goal: x = e.orientation ∨ x = -e.orientation

full_name: Basis.orientation_ne_iff_eq_neg
code: /-- Given a basis, an orientation equals the negation of that given by that basis if and only
if it does not equal that given by that basis. -/
theorem orientation_ne_iff_eq_neg (e : Basis ι R M) (x : Orientation R M ι) :
    x ≠ e.orientation ↔ x = -e.orientation 
goal: x ≠ e.orientation ↔ x = -e.orientation

full_name: Basis.orientation_comp_linearEquiv_eq_iff_det_pos
code: /-- Composing a basis with a linear equiv gives the same orientation if and only if the
determinant is positive. -/
theorem orientation_comp_linearEquiv_eq_iff_det_pos (e : Basis ι R M) (f : M ≃ₗ[R] M) :
    (e.map f).orientation = e.orientation ↔ 0 < LinearMap.det (f : M →ₗ[R] M) 
goal: (e.map f).orientation = e.orientation ↔ 0 < LinearMap.det ↑f

full_name: Basis.orientation_comp_linearEquiv_eq_neg_iff_det_neg
code: /-- Composing a basis with a linear equiv gives the negation of that orientation if and only if
the determinant is negative. -/
theorem orientation_comp_linearEquiv_eq_neg_iff_det_neg (e : Basis ι R M) (f : M ≃ₗ[R] M) :
    (e.map f).orientation = -e.orientation ↔ LinearMap.det (f : M →ₗ[R] M) < 0 
goal: (e.map f).orientation = -e.orientation ↔ LinearMap.det ↑f < 0

full_name: Basis.orientation_neg_single
code: /-- Negating a single basis vector (represented using `units_smul`) negates the corresponding
orientation. -/
@[simp]
theorem orientation_neg_single (e : Basis ι R M) (i : ι) :
    (e.unitsSMul (Function.update 1 i (-1))).orientation = -e.orientation 
goal: (e.unitsSMul (Function.update 1 i (-1))).orientation = -e.orientation

full_name: Basis.adjustToOrientation
code: /-- Given a basis and an orientation, return a basis giving that orientation: either the original
basis, or one constructed by negating a single (arbitrary) basis vector. -/
def adjustToOrientation [Nonempty ι] (e : Basis ι R M) (x : Orientation R M ι) :
    Basis ι R M 
goal: Basis ι R M

full_name: Basis.orientation_adjustToOrientation
code: /-- `adjust_to_orientation` gives a basis with the required orientation. -/
@[simp]
theorem orientation_adjustToOrientation [Nonempty ι] (e : Basis ι R M)
    (x : Orientation R M ι) : (e.adjustToOrientation x).orientation = x 
goal: (e.adjustToOrientation x).orientation = x

full_name: Basis.adjustToOrientation_apply_eq_or_eq_neg
code: /-- Every basis vector from `adjust_to_orientation` is either that from the original basis or its
negation. -/
theorem adjustToOrientation_apply_eq_or_eq_neg [Nonempty ι] (e : Basis ι R M)
    (x : Orientation R M ι) (i : ι) :
    e.adjustToOrientation x i = e i ∨ e.adjustToOrientation x i = -e i 
goal: (e.adjustToOrientation x) i = e i ∨ (e.adjustToOrientation x) i = -e i

full_name: Basis.det_adjustToOrientation
code: theorem det_adjustToOrientation [Nonempty ι] (e : Basis ι R M)
    (x : Orientation R M ι) :
    (e.adjustToOrientation x).det = e.det ∨ (e.adjustToOrientation x).det = -e.det 
goal: (e.adjustToOrientation x).det = e.det ∨ (e.adjustToOrientation x).det = -e.det

full_name: Basis.abs_det_adjustToOrientation
code: @[simp]
theorem abs_det_adjustToOrientation [Nonempty ι] (e : Basis ι R M)
    (x : Orientation R M ι) (v : ι → M) : |(e.adjustToOrientation x).det v| = |e.det v| 
goal: |(e.adjustToOrientation x).det v| = |e.det v|

full_name: Orientation.eq_or_eq_neg
code: /-- If the index type has cardinality equal to the finite dimension, any two orientations are
equal or negations. -/
theorem eq_or_eq_neg (x₁ x₂ : Orientation R M ι) (h : Fintype.card ι = finrank R M) :
    x₁ = x₂ ∨ x₁ = -x₂ 
goal: x₁ = x₂ ∨ x₁ = -x₂

full_name: Orientation.ne_iff_eq_neg
code: /-- If the index type has cardinality equal to the finite dimension, an orientation equals the
negation of another orientation if and only if they are not equal. -/
theorem ne_iff_eq_neg (x₁ x₂ : Orientation R M ι) (h : Fintype.card ι = finrank R M) :
    x₁ ≠ x₂ ↔ x₁ = -x₂ 
goal: x₁ ≠ x₂ ↔ x₁ = -x₂

full_name: Orientation.map_eq_det_inv_smul
code: /-- The value of `Orientation.map` when the index type has cardinality equal to the finite
dimension, in terms of `f.det`. -/
theorem map_eq_det_inv_smul (x : Orientation R M ι) (f : M ≃ₗ[R] M)
    (h : Fintype.card ι = finrank R M) : Orientation.map ι f x = (LinearEquiv.det f)⁻¹ • x 
goal: (Orientation.map ι f) x = (LinearEquiv.det f)⁻¹ • x

full_name: Orientation.map_eq_iff_det_pos
code: /-- If the index type has cardinality equal to the finite dimension, composing an alternating
map with the same linear equiv on each argument gives the same orientation if and only if the
determinant is positive. -/
theorem map_eq_iff_det_pos (x : Orientation R M ι) (f : M ≃ₗ[R] M)
    (h : Fintype.card ι = finrank R M) :
    Orientation.map ι f x = x ↔ 0 < LinearMap.det (f : M →ₗ[R] M) 
goal: (Orientation.map ι f) x = x ↔ 0 < LinearMap.det ↑f

full_name: Orientation.map_eq_neg_iff_det_neg
code: /-- If the index type has cardinality equal to the finite dimension, composing an alternating
map with the same linear equiv on each argument gives the negation of that orientation if and
only if the determinant is negative. -/
theorem map_eq_neg_iff_det_neg (x : Orientation R M ι) (f : M ≃ₗ[R] M)
    (h : Fintype.card ι = finrank R M) :
    Orientation.map ι f x = -x ↔ LinearMap.det (f : M →ₗ[R] M) < 0 
goal: (Orientation.map ι f) x = -x ↔ LinearMap.det ↑f < 0

full_name: Orientation.someBasis
code: /-- If the index type has cardinality equal to the finite dimension, a basis with the given
orientation. -/
def someBasis [Nonempty ι] [DecidableEq ι] (x : Orientation R M ι)
    (h : Fintype.card ι = finrank R M) : Basis ι R M 
goal: Basis ι R M

full_name: Orientation.someBasis_orientation
code: /-- `some_basis` gives a basis with the required orientation. -/
@[simp]
theorem someBasis_orientation [Nonempty ι] [DecidableEq ι] (x : Orientation R M ι)
    (h : Fintype.card ι = finrank R M) : (x.someBasis h).orientation = x 
goal: (x.someBasis h).orientation = x