l3lab/ntp-mathlib huggingface dataset:
/-- Two orthonormal bases with the same orientation determine the same "determinant" top-dimensional
form on `E`, and conversely. -/
theorem same_orientation_iff_det_eq_det :
    e.toBasis.det = f.toBasis.det ↔ e.toBasis.orientation = f.toBasis.orientation := by
  constructor
  · intro h
    dsimp [Basis.orientation]
    

Proof state:
case mp
E : Type u_1
inst✝³ : NormedAddCommGroup E
inst✝² : InnerProductSpace ℝ E
ι : Type u_2
inst✝¹ : Fintype ι
inst✝ : DecidableEq ι
ne : Nonempty ι
e f : OrthonormalBasis ι ℝ E
x : Orientation ℝ E ι
h : Basis.det (OrthonormalBasis.toBasis e) = Basis.det (OrthonormalBasis.toBasis f)
⊢ rayOfNeZero ℝ (Basis.det (OrthonormalBasis.toBasis e)) (_ : Basis.det (OrthonormalBasis.toBasis e) ≠ 0) =
    rayOfNeZero ℝ (Basis.det (OrthonormalBasis.toBasis f)) (_ : Basis.det (OrthonormalBasis.toBasis f) ≠ 0)

Next tactic:
congr
/-- Two orthonormal bases with the same orientation determine the same "determinant" top-dimensional
form on `E`, and conversely. -/
theorem same_orientation_iff_det_eq_det :
    e.toBasis.det = f.toBasis.det ↔ e.toBasis.orientation = f.toBasis.orientation := by
  constructor
  · intro h
    dsimp [Basis.orientation]
    congr
  · 

Proof state:
case mpr
E : Type u_1
inst✝³ : NormedAddCommGroup E
inst✝² : InnerProductSpace ℝ E
ι : Type u_2
inst✝¹ : Fintype ι
inst✝ : DecidableEq ι
ne : Nonempty ι
e f : OrthonormalBasis ι ℝ E
x : Orientation ℝ E ι
⊢ Basis.orientation (OrthonormalBasis.toBasis e) = Basis.orientation (OrthonormalBasis.toBasis f) →
    Basis.det (OrthonormalBasis.toBasis e) = Basis.det (OrthonormalBasis.toBasis f)

Next tactic:
intro h
/-- Two orthonormal bases with the same orientation determine the same "determinant" top-dimensional
form on `E`, and conversely. -/
theorem same_orientation_iff_det_eq_det :
    e.toBasis.det = f.toBasis.det ↔ e.toBasis.orientation = f.toBasis.orientation := by
  constructor
  · intro h
    dsimp [Basis.orientation]
    congr
  · intro h
    

Proof state:
case mpr
E : Type u_1
inst✝³ : NormedAddCommGroup E
inst✝² : InnerProductSpace ℝ E
ι : Type u_2
inst✝¹ : Fintype ι
inst✝ : DecidableEq ι
ne : Nonempty ι
e f : OrthonormalBasis ι ℝ E
x : Orientation ℝ E ι
h : Basis.orientation (OrthonormalBasis.toBasis e) = Basis.orientation (OrthonormalBasis.toBasis f)
⊢ Basis.det (OrthonormalBasis.toBasis e) = Basis.det (OrthonormalBasis.toBasis f)

Next tactic:
rw [e.toBasis.det.eq_smul_basis_det f.toBasis]
/-- Two orthonormal bases with the same orientation determine the same "determinant" top-dimensional
form on `E`, and conversely. -/
theorem same_orientation_iff_det_eq_det :
    e.toBasis.det = f.toBasis.det ↔ e.toBasis.orientation = f.toBasis.orientation := by
  constructor
  · intro h
    dsimp [Basis.orientation]
    congr
  · intro h
    rw [e.toBasis.det.eq_smul_basis_det f.toBasis]
    

Proof state:
case mpr
E : Type u_1
inst✝³ : NormedAddCommGroup E
inst✝² : InnerProductSpace ℝ E
ι : Type u_2
inst✝¹ : Fintype ι
inst✝ : DecidableEq ι
ne : Nonempty ι
e f : OrthonormalBasis ι ℝ E
x : Orientation ℝ E ι
h : Basis.orientation (OrthonormalBasis.toBasis e) = Basis.orientation (OrthonormalBasis.toBasis f)
⊢ (Basis.det (OrthonormalBasis.toBasis e)) ⇑(OrthonormalBasis.toBasis f) • Basis.det (OrthonormalBasis.toBasis f) =
    Basis.det (OrthonormalBasis.toBasis f)

Next tactic:
simp [e.det_to_matrix_orthonormalBasis_of_same_orientation f h]
/-- Two orthonormal bases with opposite orientations determine opposite "determinant"
top-dimensional forms on `E`. -/
theorem det_eq_neg_det_of_opposite_orientation (h : e.toBasis.orientation ≠ f.toBasis.orientation) :
    e.toBasis.det = -f.toBasis.det := by
  

Proof state:
E : Type u_1
inst✝³ : NormedAddCommGroup E
inst✝² : InnerProductSpace ℝ E
ι : Type u_2
inst✝¹ : Fintype ι
inst✝ : DecidableEq ι
ne : Nonempty ι
e f : OrthonormalBasis ι ℝ E
x : Orientation ℝ E ι
h : Basis.orientation (OrthonormalBasis.toBasis e) ≠ Basis.orientation (OrthonormalBasis.toBasis f)
⊢ Basis.det (OrthonormalBasis.toBasis e) = -Basis.det (OrthonormalBasis.toBasis f)

Next tactic:
rw [e.toBasis.det.eq_smul_basis_det f.toBasis]
/-- Two orthonormal bases with opposite orientations determine opposite "determinant"
top-dimensional forms on `E`. -/
theorem det_eq_neg_det_of_opposite_orientation (h : e.toBasis.orientation ≠ f.toBasis.orientation) :
    e.toBasis.det = -f.toBasis.det := by
  rw [e.toBasis.det.eq_smul_basis_det f.toBasis]
  -- Porting note: added `neg_one_smul` with explicit type
  

Proof state:
E : Type u_1
inst✝³ : NormedAddCommGroup E
inst✝² : InnerProductSpace ℝ E
ι : Type u_2
inst✝¹ : Fintype ι
inst✝ : DecidableEq ι
ne : Nonempty ι
e f : OrthonormalBasis ι ℝ E
x : Orientation ℝ E ι
h : Basis.orientation (OrthonormalBasis.toBasis e) ≠ Basis.orientation (OrthonormalBasis.toBasis f)
⊢ (Basis.det (OrthonormalBasis.toBasis e)) ⇑(OrthonormalBasis.toBasis f) • Basis.det (OrthonormalBasis.toBasis f) =
    -Basis.det (OrthonormalBasis.toBasis f)

Next tactic:
simp [e.det_to_matrix_orthonormalBasis_of_opposite_orientation f h,
    neg_one_smul ℝ (M := E [Λ^ι]→ₗ[ℝ] ℝ)]
/-- `OrthonormalBasis.adjustToOrientation`, applied to an orthonormal basis, preserves the
property of orthonormality. -/
theorem orthonormal_adjustToOrientation : Orthonormal ℝ (e.toBasis.adjustToOrientation x) := by
  

Proof state:
E : Type u_1
inst✝³ : NormedAddCommGroup E
inst✝² : InnerProductSpace ℝ E
ι : Type u_2
inst✝¹ : Fintype ι
inst✝ : DecidableEq ι
ne : Nonempty ι
e f : OrthonormalBasis ι ℝ E
x : Orientation ℝ E ι
⊢ Orthonormal ℝ ⇑(Basis.adjustToOrientation (OrthonormalBasis.toBasis e) x)

Next tactic:
apply e.orthonormal.orthonormal_of_forall_eq_or_eq_neg
/-- `OrthonormalBasis.adjustToOrientation`, applied to an orthonormal basis, preserves the
property of orthonormality. -/
theorem orthonormal_adjustToOrientation : Orthonormal ℝ (e.toBasis.adjustToOrientation x) := by
  apply e.orthonormal.orthonormal_of_forall_eq_or_eq_neg
  

Proof state:
E : Type u_1
inst✝³ : NormedAddCommGroup E
inst✝² : InnerProductSpace ℝ E
ι : Type u_2
inst✝¹ : Fintype ι
inst✝ : DecidableEq ι
ne : Nonempty ι
e f : OrthonormalBasis ι ℝ E
x : Orientation ℝ E ι
⊢ ∀ (i : ι),
    (Basis.adjustToOrientation (OrthonormalBasis.toBasis e) x) i = e i ∨
      (Basis.adjustToOrientation (OrthonormalBasis.toBasis e) x) i = -e i

Next tactic:
simpa using e.toBasis.adjustToOrientation_apply_eq_or_eq_neg x
/-- `adjustToOrientation` gives an orthonormal basis with the required orientation. -/
@[simp]
theorem orientation_adjustToOrientation : (e.adjustToOrientation x).toBasis.orientation = x := by
  

Proof state:
E : Type u_1
inst✝³ : NormedAddCommGroup E
inst✝² : InnerProductSpace ℝ E
ι : Type u_2
inst✝¹ : Fintype ι
inst✝ : DecidableEq ι
ne : Nonempty ι
e f : OrthonormalBasis ι ℝ E
x : Orientation ℝ E ι
⊢ Basis.orientation (OrthonormalBasis.toBasis (adjustToOrientation e x)) = x

Next tactic:
rw [e.toBasis_adjustToOrientation]
/-- `adjustToOrientation` gives an orthonormal basis with the required orientation. -/
@[simp]
theorem orientation_adjustToOrientation : (e.adjustToOrientation x).toBasis.orientation = x := by
  rw [e.toBasis_adjustToOrientation]
  

Proof state:
E : Type u_1
inst✝³ : NormedAddCommGroup E
inst✝² : InnerProductSpace ℝ E
ι : Type u_2
inst✝¹ : Fintype ι
inst✝ : DecidableEq ι
ne : Nonempty ι
e f : OrthonormalBasis ι ℝ E
x : Orientation ℝ E ι
⊢ Basis.orientation (Basis.adjustToOrientation (OrthonormalBasis.toBasis e) x) = x

Next tactic:
exact e.toBasis.orientation_adjustToOrientation x
/-- Every basis vector from `adjustToOrientation` is either that from the original basis or its
negation. -/
theorem adjustToOrientation_apply_eq_or_eq_neg (i : ι) :
    e.adjustToOrientation x i = e i ∨ e.adjustToOrientation x i = -e i := by
  

Proof state:
E : Type u_1
inst✝³ : NormedAddCommGroup E
inst✝² : InnerProductSpace ℝ E
ι : Type u_2
inst✝¹ : Fintype ι
inst✝ : DecidableEq ι
ne : Nonempty ι
e f : OrthonormalBasis ι ℝ E
x : Orientation ℝ E ι
i : ι
⊢ (adjustToOrientation e x) i = e i ∨ (adjustToOrientation e x) i = -e i

Next tactic:
simpa [← e.toBasis_adjustToOrientation] using
    e.toBasis.adjustToOrientation_apply_eq_or_eq_neg x i
theorem det_adjustToOrientation :
    (e.adjustToOrientation x).toBasis.det = e.toBasis.det ∨
      (e.adjustToOrientation x).toBasis.det = -e.toBasis.det := by
  

Proof state:
E : Type u_1
inst✝³ : NormedAddCommGroup E
inst✝² : InnerProductSpace ℝ E
ι : Type u_2
inst✝¹ : Fintype ι
inst✝ : DecidableEq ι
ne : Nonempty ι
e f : OrthonormalBasis ι ℝ E
x : Orientation ℝ E ι
⊢ Basis.det (OrthonormalBasis.toBasis (adjustToOrientation e x)) = Basis.det (OrthonormalBasis.toBasis e) ∨
    Basis.det (OrthonormalBasis.toBasis (adjustToOrientation e x)) = -Basis.det (OrthonormalBasis.toBasis e)

Next tactic:
simpa using e.toBasis.det_adjustToOrientation x
theorem abs_det_adjustToOrientation (v : ι → E) :
    |(e.adjustToOrientation x).toBasis.det v| = |e.toBasis.det v| := by
  

Proof state:
E : Type u_1
inst✝³ : NormedAddCommGroup E
inst✝² : InnerProductSpace ℝ E
ι : Type u_2
inst✝¹ : Fintype ι
inst✝ : DecidableEq ι
ne : Nonempty ι
e f : OrthonormalBasis ι ℝ E
x : Orientation ℝ E ι
v : ι → E
⊢ |(Basis.det (OrthonormalBasis.toBasis (adjustToOrientation e x))) v| = |(Basis.det (OrthonormalBasis.toBasis e)) v|

Next tactic:
simp [toBasis_adjustToOrientation]
/-- An orthonormal basis, indexed by `Fin n`, with the given orientation. -/
protected def finOrthonormalBasis (hn : 0 < n) (h : finrank ℝ E = n) (x : Orientation ℝ E (Fin n)) :
    OrthonormalBasis (Fin n) ℝ E := by
  

Proof state:
E : Type u_1
inst✝¹ : NormedAddCommGroup E
inst✝ : InnerProductSpace ℝ E
n : ℕ
hn : 0 < n
h : finrank ℝ E = n
x : Orientation ℝ E (Fin n)
⊢ OrthonormalBasis (Fin n) ℝ E

Next tactic:
haveI := Fin.pos_iff_nonempty.1 hn
/-- An orthonormal basis, indexed by `Fin n`, with the given orientation. -/
protected def finOrthonormalBasis (hn : 0 < n) (h : finrank ℝ E = n) (x : Orientation ℝ E (Fin n)) :
    OrthonormalBasis (Fin n) ℝ E := by
  haveI := Fin.pos_iff_nonempty.1 hn
  

Proof state:
E : Type u_1
inst✝¹ : NormedAddCommGroup E
inst✝ : InnerProductSpace ℝ E
n : ℕ
hn : 0 < n
h : finrank ℝ E = n
x : Orientation ℝ E (Fin n)
this : Nonempty (Fin n)
⊢ OrthonormalBasis (Fin n) ℝ E

Next tactic:
haveI := finiteDimensional_of_finrank (h.symm ▸ hn : 0 < finrank ℝ E)
/-- An orthonormal basis, indexed by `Fin n`, with the given orientation. -/
protected def finOrthonormalBasis (hn : 0 < n) (h : finrank ℝ E = n) (x : Orientation ℝ E (Fin n)) :
    OrthonormalBasis (Fin n) ℝ E := by
  haveI := Fin.pos_iff_nonempty.1 hn
  haveI := finiteDimensional_of_finrank (h.symm ▸ hn : 0 < finrank ℝ E)
  

Proof state:
E : Type u_1
inst✝¹ : NormedAddCommGroup E
inst✝ : InnerProductSpace ℝ E
n : ℕ
hn : 0 < n
h : finrank ℝ E = n
x : Orientation ℝ E (Fin n)
this✝ : Nonempty (Fin n)
this : FiniteDimensional ℝ E
⊢ OrthonormalBasis (Fin n) ℝ E

Next tactic:
exact ((@stdOrthonormalBasis _ _ _ _ _ this).reindex <| finCongr h).adjustToOrientation x
/-- `Orientation.finOrthonormalBasis` gives a basis with the required orientation. -/
@[simp]
theorem finOrthonormalBasis_orientation (hn : 0 < n) (h : finrank ℝ E = n)
    (x : Orientation ℝ E (Fin n)) : (x.finOrthonormalBasis hn h).toBasis.orientation = x := by
  

Proof state:
E : Type u_1
inst✝¹ : NormedAddCommGroup E
inst✝ : InnerProductSpace ℝ E
n : ℕ
hn : 0 < n
h : finrank ℝ E = n
x : Orientation ℝ E (Fin n)
⊢ Basis.orientation (OrthonormalBasis.toBasis (Orientation.finOrthonormalBasis hn h x)) = x

Next tactic:
haveI := Fin.pos_iff_nonempty.1 hn
/-- `Orientation.finOrthonormalBasis` gives a basis with the required orientation. -/
@[simp]
theorem finOrthonormalBasis_orientation (hn : 0 < n) (h : finrank ℝ E = n)
    (x : Orientation ℝ E (Fin n)) : (x.finOrthonormalBasis hn h).toBasis.orientation = x := by
  haveI := Fin.pos_iff_nonempty.1 hn
  

Proof state:
E : Type u_1
inst✝¹ : NormedAddCommGroup E
inst✝ : InnerProductSpace ℝ E
n : ℕ
hn : 0 < n
h : finrank ℝ E = n
x : Orientation ℝ E (Fin n)
this : Nonempty (Fin n)
⊢ Basis.orientation (OrthonormalBasis.toBasis (Orientation.finOrthonormalBasis hn h x)) = x

Next tactic:
haveI := finiteDimensional_of_finrank (h.symm ▸ hn : 0 < finrank ℝ E)
/-- `Orientation.finOrthonormalBasis` gives a basis with the required orientation. -/
@[simp]
theorem finOrthonormalBasis_orientation (hn : 0 < n) (h : finrank ℝ E = n)
    (x : Orientation ℝ E (Fin n)) : (x.finOrthonormalBasis hn h).toBasis.orientation = x := by
  haveI := Fin.pos_iff_nonempty.1 hn
  haveI := finiteDimensional_of_finrank (h.symm ▸ hn : 0 < finrank ℝ E)
  

Proof state:
E : Type u_1
inst✝¹ : NormedAddCommGroup E
inst✝ : InnerProductSpace ℝ E
n : ℕ
hn : 0 < n
h : finrank ℝ E = n
x : Orientation ℝ E (Fin n)
this✝ : Nonempty (Fin n)
this : FiniteDimensional ℝ E
⊢ Basis.orientation (OrthonormalBasis.toBasis (Orientation.finOrthonormalBasis hn h x)) = x

Next tactic:
exact ((@stdOrthonormalBasis _ _ _ _ _ this).reindex <|
    finCongr h).orientation_adjustToOrientation x
/-- The volume form on an oriented real inner product space, a nonvanishing top-dimensional
alternating form uniquely defined by compatibility with the orientation and inner product structure.
-/
irreducible_def volumeForm : E [Λ^Fin n]→ₗ[ℝ] ℝ := by
  

Proof state:
E : Type u_1
inst✝¹ : NormedAddCommGroup E
inst✝ : InnerProductSpace ℝ E
n : ℕ
_i : Fact (finrank ℝ E = n)
o : Orientation ℝ E (Fin n)
⊢ E [Λ^Fin n]→ₗ[ℝ] ℝ

Next tactic:
classical
    cases' n with n
    · let opos : E [Λ^Fin 0]→ₗ[ℝ] ℝ := .constOfIsEmpty ℝ E (Fin 0) (1 : ℝ)
      exact o.eq_or_eq_neg_of_isEmpty.by_cases (fun _ => opos) fun _ => -opos
    · exact (o.finOrthonormalBasis n.succ_pos _i.out).toBasis.det
/-- The volume form on an oriented real inner product space, a nonvanishing top-dimensional
alternating form uniquely defined by compatibility with the orientation and inner product structure.
-/
irreducible_def volumeForm : E [Λ^Fin n]→ₗ[ℝ] ℝ := by
  classical
    

Proof state:
E : Type u_1
inst✝¹ : NormedAddCommGroup E
inst✝ : InnerProductSpace ℝ E
n : ℕ
_i : Fact (finrank ℝ E = n)
o : Orientation ℝ E (Fin n)
⊢ E [Λ^Fin n]→ₗ[ℝ] ℝ

Next tactic:
cases' n with n
/-- The volume form on an oriented real inner product space, a nonvanishing top-dimensional
alternating form uniquely defined by compatibility with the orientation and inner product structure.
-/
irreducible_def volumeForm : E [Λ^Fin n]→ₗ[ℝ] ℝ := by
  classical
    cases' n with n
    · 

Proof state:
case zero
E : Type u_1
inst✝¹ : NormedAddCommGroup E
inst✝ : InnerProductSpace ℝ E
_i : Fact (finrank ℝ E = Nat.zero)
o : Orientation ℝ E (Fin Nat.zero)
⊢ E [Λ^Fin Nat.zero]→ₗ[ℝ] ℝ

Next tactic:
let opos : E [Λ^Fin 0]→ₗ[ℝ] ℝ := .constOfIsEmpty ℝ E (Fin 0) (1 : ℝ)
/-- The volume form on an oriented real inner product space, a nonvanishing top-dimensional
alternating form uniquely defined by compatibility with the orientation and inner product structure.
-/
irreducible_def volumeForm : E [Λ^Fin n]→ₗ[ℝ] ℝ := by
  classical
    cases' n with n
    · let opos : E [Λ^Fin 0]→ₗ[ℝ] ℝ := .constOfIsEmpty ℝ E (Fin 0) (1 : ℝ)
      

Proof state:
case zero
E : Type u_1
inst✝¹ : NormedAddCommGroup E
inst✝ : InnerProductSpace ℝ E
_i : Fact (finrank ℝ E = Nat.zero)
o : Orientation ℝ E (Fin Nat.zero)
opos : E [Λ^Fin 0]→ₗ[ℝ] ℝ := AlternatingMap.constOfIsEmpty ℝ E (Fin 0) 1
⊢ E [Λ^Fin Nat.zero]→ₗ[ℝ] ℝ

Next tactic:
exact o.eq_or_eq_neg_of_isEmpty.by_cases (fun _ => opos) fun _ => -opos
/-- The volume form on an oriented real inner product space, a nonvanishing top-dimensional
alternating form uniquely defined by compatibility with the orientation and inner product structure.
-/
irreducible_def volumeForm : E [Λ^Fin n]→ₗ[ℝ] ℝ := by
  classical
    cases' n with n
    · let opos : E [Λ^Fin 0]→ₗ[ℝ] ℝ := .constOfIsEmpty ℝ E (Fin 0) (1 : ℝ)
      exact o.eq_or_eq_neg_of_isEmpty.by_cases (fun _ => opos) fun _ => -opos
    · 

Proof state:
case succ
E : Type u_1
inst✝¹ : NormedAddCommGroup E
inst✝ : InnerProductSpace ℝ E
n : ℕ
_i : Fact (finrank ℝ E = Nat.succ n)
o : Orientation ℝ E (Fin (Nat.succ n))
⊢ E [Λ^Fin (Nat.succ n)]→ₗ[ℝ] ℝ

Next tactic:
exact (o.finOrthonormalBasis n.succ_pos _i.out).toBasis.det
@[simp]
theorem volumeForm_zero_pos [_i : Fact (finrank ℝ E = 0)] :
    Orientation.volumeForm (positiveOrientation : Orientation ℝ E (Fin 0)) =
      AlternatingMap.constLinearEquivOfIsEmpty 1 := by
  

Proof state:
E : Type u_1
inst✝¹ : NormedAddCommGroup E
inst✝ : InnerProductSpace ℝ E
n : ℕ
_i✝ : Fact (finrank ℝ E = n)
o : Orientation ℝ E (Fin n)
_i : Fact (finrank ℝ E = 0)
⊢ volumeForm positiveOrientation = AlternatingMap.constLinearEquivOfIsEmpty 1

Next tactic:
simp [volumeForm, Or.by_cases, if_pos]
theorem volumeForm_zero_neg [_i : Fact (finrank ℝ E = 0)] :
    Orientation.volumeForm (-positiveOrientation : Orientation ℝ E (Fin 0)) =
      -AlternatingMap.constLinearEquivOfIsEmpty 1 := by
  

Proof state:
E : Type u_1
inst✝¹ : NormedAddCommGroup E
inst✝ : InnerProductSpace ℝ E
n : ℕ
_i✝ : Fact (finrank ℝ E = n)
o : Orientation ℝ E (Fin n)
_i : Fact (finrank ℝ E = 0)
⊢ volumeForm (-positiveOrientation) = -AlternatingMap.constLinearEquivOfIsEmpty 1

Next tactic:
simp_rw [volumeForm, Or.by_cases, positiveOrientation]
theorem volumeForm_zero_neg [_i : Fact (finrank ℝ E = 0)] :
    Orientation.volumeForm (-positiveOrientation : Orientation ℝ E (Fin 0)) =
      -AlternatingMap.constLinearEquivOfIsEmpty 1 := by
  simp_rw [volumeForm, Or.by_cases, positiveOrientation]
  

Proof state:
E : Type u_1
inst✝¹ : NormedAddCommGroup E
inst✝ : InnerProductSpace ℝ E
n : ℕ
_i✝ : Fact (finrank ℝ E = n)
o : Orientation ℝ E (Fin n)
_i : Fact (finrank ℝ E = 0)
⊢ Nat.rec (motive := fun t => 0 = t → E [Λ^Fin 0]→ₗ[ℝ] ℝ)
      (fun h =>
        if hp :
            -rayOfNeZero ℝ (AlternatingMap.constLinearEquivOfIsEmpty 1)
                  (_ :
                    AlternatingMap.constLinearEquivOfIsEmpty 1 ≠
                      AlternatingMap.constLinearEquivOfIsEmpty AddMonoid.toZero.1) =
              rayOfNeZero ℝ (AlternatingMap.constLinearEquivOfIsEmpty 1)
                (_ :
                  AlternatingMap.constLinearEquivOfIsEmpty 1 ≠
                    AlternatingMap.constLinearEquivOfIsEmpty AddMonoid.toZero.1) then
          AlternatingMap.constOfIsEmpty ℝ E (Fin 0) 1
        else -AlternatingMap.constOfIsEmpty ℝ E (Fin 0) 1)
      (fun n n_ih h =>
        Eq.rec (motive := fun x x_1 => [_i : Fact (finrank ℝ E = x)] → Orientation ℝ E (Fin x) → E [Λ^Fin x]→ₗ[ℝ] ℝ)
          (fun [Fact (finrank ℝ E = Nat.succ n)] o =>
            Basis.det
              (OrthonormalBasis.toBasis
                (Orientation.finOrthonormalBasis (_ : 0 < Nat.succ n) (_ : finrank ℝ E = Nat.succ n) o)))
          (_ : Nat.succ n = 0)
          (-rayOfNeZero ℝ (AlternatingMap.constLinearEquivOfIsEmpty 1)
              (_ :
                AlternatingMap.constLinearEquivOfIsEmpty 1 ≠
                  AlternatingMap.constLinearEquivOfIsEmpty AddMonoid.toZero.1)))
      0 (_ : 0 = 0) =
    -AlternatingMap.constLinearEquivOfIsEmpty 1

Next tactic:
apply if_neg
theorem volumeForm_zero_neg [_i : Fact (finrank ℝ E = 0)] :
    Orientation.volumeForm (-positiveOrientation : Orientation ℝ E (Fin 0)) =
      -AlternatingMap.constLinearEquivOfIsEmpty 1 := by
  simp_rw [volumeForm, Or.by_cases, positiveOrientation]
  apply if_neg
  

Proof state:
case hnc
E : Type u_1
inst✝¹ : NormedAddCommGroup E
inst✝ : InnerProductSpace ℝ E
n : ℕ
_i✝ : Fact (finrank ℝ E = n)
o : Orientation ℝ E (Fin n)
_i : Fact (finrank ℝ E = 0)
⊢ ¬-rayOfNeZero ℝ (AlternatingMap.constLinearEquivOfIsEmpty 1)
          (_ :
            AlternatingMap.constLinearEquivOfIsEmpty 1 ≠ AlternatingMap.constLinearEquivOfIsEmpty AddMonoid.toZero.1) =
      rayOfNeZero ℝ (AlternatingMap.constLinearEquivOfIsEmpty 1)
        (_ : AlternatingMap.constLinearEquivOfIsEmpty 1 ≠ AlternatingMap.constLinearEquivOfIsEmpty AddMonoid.toZero.1)

Next tactic:
simp only [neg_rayOfNeZero]
theorem volumeForm_zero_neg [_i : Fact (finrank ℝ E = 0)] :
    Orientation.volumeForm (-positiveOrientation : Orientation ℝ E (Fin 0)) =
      -AlternatingMap.constLinearEquivOfIsEmpty 1 := by
  simp_rw [volumeForm, Or.by_cases, positiveOrientation]
  apply if_neg
  simp only [neg_rayOfNeZero]
  

Proof state:
case hnc
E : Type u_1
inst✝¹ : NormedAddCommGroup E
inst✝ : InnerProductSpace ℝ E
n : ℕ
_i✝ : Fact (finrank ℝ E = n)
o : Orientation ℝ E (Fin n)
_i : Fact (finrank ℝ E = 0)
⊢ ¬rayOfNeZero ℝ (-AlternatingMap.constLinearEquivOfIsEmpty 1) (_ : -AlternatingMap.constLinearEquivOfIsEmpty 1 ≠ 0) =
      rayOfNeZero ℝ (AlternatingMap.constLinearEquivOfIsEmpty 1)
        (_ : AlternatingMap.constLinearEquivOfIsEmpty 1 ≠ AlternatingMap.constLinearEquivOfIsEmpty AddMonoid.toZero.1)

Next tactic:
rw [ray_eq_iff, SameRay.sameRay_comm]
theorem volumeForm_zero_neg [_i : Fact (finrank ℝ E = 0)] :
    Orientation.volumeForm (-positiveOrientation : Orientation ℝ E (Fin 0)) =
      -AlternatingMap.constLinearEquivOfIsEmpty 1 := by
  simp_rw [volumeForm, Or.by_cases, positiveOrientation]
  apply if_neg
  simp only [neg_rayOfNeZero]
  rw [ray_eq_iff, SameRay.sameRay_comm]
  

Proof state:
case hnc
E : Type u_1
inst✝¹ : NormedAddCommGroup E
inst✝ : InnerProductSpace ℝ E
n : ℕ
_i✝ : Fact (finrank ℝ E = n)
o : Orientation ℝ E (Fin n)
_i : Fact (finrank ℝ E = 0)
⊢ ¬SameRay ℝ (AlternatingMap.constLinearEquivOfIsEmpty 1) (-AlternatingMap.constLinearEquivOfIsEmpty 1)

Next tactic:
intro h
theorem volumeForm_zero_neg [_i : Fact (finrank ℝ E = 0)] :
    Orientation.volumeForm (-positiveOrientation : Orientation ℝ E (Fin 0)) =
      -AlternatingMap.constLinearEquivOfIsEmpty 1 := by
  simp_rw [volumeForm, Or.by_cases, positiveOrientation]
  apply if_neg
  simp only [neg_rayOfNeZero]
  rw [ray_eq_iff, SameRay.sameRay_comm]
  intro h
  

Proof state:
case hnc
E : Type u_1
inst✝¹ : NormedAddCommGroup E
inst✝ : InnerProductSpace ℝ E
n : ℕ
_i✝ : Fact (finrank ℝ E = n)
o : Orientation ℝ E (Fin n)
_i : Fact (finrank ℝ E = 0)
h : SameRay ℝ (AlternatingMap.constLinearEquivOfIsEmpty 1) (-AlternatingMap.constLinearEquivOfIsEmpty 1)
⊢ False

Next tactic:
simpa using
    congr_arg AlternatingMap.constLinearEquivOfIsEmpty.symm (eq_zero_of_sameRay_self_neg h)
/-- The volume form on an oriented real inner product space can be evaluated as the determinant with
respect to any orthonormal basis of the space compatible with the orientation. -/
theorem volumeForm_robust (b : OrthonormalBasis (Fin n) ℝ E) (hb : b.toBasis.orientation = o) :
    o.volumeForm = b.toBasis.det := by
  

Proof state:
E : Type u_1
inst✝¹ : NormedAddCommGroup E
inst✝ : InnerProductSpace ℝ E
n : ℕ
_i : Fact (finrank ℝ E = n)
o : Orientation ℝ E (Fin n)
b : OrthonormalBasis (Fin n) ℝ E
hb : Basis.orientation (OrthonormalBasis.toBasis b) = o
⊢ volumeForm o = Basis.det (OrthonormalBasis.toBasis b)

Next tactic:
cases n
/-- The volume form on an oriented real inner product space can be evaluated as the determinant with
respect to any orthonormal basis of the space compatible with the orientation. -/
theorem volumeForm_robust (b : OrthonormalBasis (Fin n) ℝ E) (hb : b.toBasis.orientation = o) :
    o.volumeForm = b.toBasis.det := by
  cases n
  · 

Proof state:
case zero
E : Type u_1
inst✝¹ : NormedAddCommGroup E
inst✝ : InnerProductSpace ℝ E
_i : Fact (finrank ℝ E = Nat.zero)
o : Orientation ℝ E (Fin Nat.zero)
b : OrthonormalBasis (Fin Nat.zero) ℝ E
hb : Basis.orientation (OrthonormalBasis.toBasis b) = o
⊢ volumeForm o = Basis.det (OrthonormalBasis.toBasis b)

Next tactic:
classical
      have : o = positiveOrientation := hb.symm.trans b.toBasis.orientation_isEmpty
      simp_rw [volumeForm, Or.by_cases, dif_pos this, Basis.det_isEmpty]
/-- The volume form on an oriented real inner product space can be evaluated as the determinant with
respect to any orthonormal basis of the space compatible with the orientation. -/
theorem volumeForm_robust (b : OrthonormalBasis (Fin n) ℝ E) (hb : b.toBasis.orientation = o) :
    o.volumeForm = b.toBasis.det := by
  cases n
  · classical
      

Proof state:
case zero
E : Type u_1
inst✝¹ : NormedAddCommGroup E
inst✝ : InnerProductSpace ℝ E
_i : Fact (finrank ℝ E = Nat.zero)
o : Orientation ℝ E (Fin Nat.zero)
b : OrthonormalBasis (Fin Nat.zero) ℝ E
hb : Basis.orientation (OrthonormalBasis.toBasis b) = o
⊢ volumeForm o = Basis.det (OrthonormalBasis.toBasis b)

Next tactic:
have : o = positiveOrientation := hb.symm.trans b.toBasis.orientation_isEmpty