l3lab/ntp-mathlib huggingface dataset:
@[simp]
theorem coe_coord_of_subsingleton_eq_one [Subsingleton ι] (i : ι) : (b.coord i : P → k) = 1 := by
  ext q
  have hp : (range b).Subsingleton := by
    

Proof state:
ι : Type u_1
ι' : Type u_2
k : Type u_3
V : Type u_4
P : Type u_5
inst✝⁴ : AddCommGroup V
inst✝³ : AffineSpace V P
inst✝² : Ring k
inst✝¹ : Module k V
b : AffineBasis ι k P
s : Finset ι
i✝ j : ι
e : ι ≃ ι'
inst✝ : Subsingleton ι
i : ι
q : P
⊢ Set.Subsingleton (range ⇑b)

Next tactic:
rw [← image_univ]
@[simp]
theorem coe_coord_of_subsingleton_eq_one [Subsingleton ι] (i : ι) : (b.coord i : P → k) = 1 := by
  ext q
  have hp : (range b).Subsingleton := by
    rw [← image_univ]
    

Proof state:
ι : Type u_1
ι' : Type u_2
k : Type u_3
V : Type u_4
P : Type u_5
inst✝⁴ : AddCommGroup V
inst✝³ : AffineSpace V P
inst✝² : Ring k
inst✝¹ : Module k V
b : AffineBasis ι k P
s : Finset ι
i✝ j : ι
e : ι ≃ ι'
inst✝ : Subsingleton ι
i : ι
q : P
⊢ Set.Subsingleton (⇑b '' univ)

Next tactic:
apply Subsingleton.image
@[simp]
theorem coe_coord_of_subsingleton_eq_one [Subsingleton ι] (i : ι) : (b.coord i : P → k) = 1 := by
  ext q
  have hp : (range b).Subsingleton := by
    rw [← image_univ]
    apply Subsingleton.image
    

Proof state:
case hs
ι : Type u_1
ι' : Type u_2
k : Type u_3
V : Type u_4
P : Type u_5
inst✝⁴ : AddCommGroup V
inst✝³ : AffineSpace V P
inst✝² : Ring k
inst✝¹ : Module k V
b : AffineBasis ι k P
s : Finset ι
i✝ j : ι
e : ι ≃ ι'
inst✝ : Subsingleton ι
i : ι
q : P
⊢ Set.Subsingleton univ

Next tactic:
apply subsingleton_of_subsingleton
@[simp]
theorem coe_coord_of_subsingleton_eq_one [Subsingleton ι] (i : ι) : (b.coord i : P → k) = 1 := by
  ext q
  have hp : (range b).Subsingleton := by
    rw [← image_univ]
    apply Subsingleton.image
    apply subsingleton_of_subsingleton
  

Proof state:
case h
ι : Type u_1
ι' : Type u_2
k : Type u_3
V : Type u_4
P : Type u_5
inst✝⁴ : AddCommGroup V
inst✝³ : AffineSpace V P
inst✝² : Ring k
inst✝¹ : Module k V
b : AffineBasis ι k P
s : Finset ι
i✝ j : ι
e : ι ≃ ι'
inst✝ : Subsingleton ι
i : ι
q : P
hp : Set.Subsingleton (range ⇑b)
⊢ (coord b i) q = OfNat.ofNat 1 q

Next tactic:
haveI := AffineSubspace.subsingleton_of_subsingleton_span_eq_top hp b.tot
@[simp]
theorem coe_coord_of_subsingleton_eq_one [Subsingleton ι] (i : ι) : (b.coord i : P → k) = 1 := by
  ext q
  have hp : (range b).Subsingleton := by
    rw [← image_univ]
    apply Subsingleton.image
    apply subsingleton_of_subsingleton
  haveI := AffineSubspace.subsingleton_of_subsingleton_span_eq_top hp b.tot
  

Proof state:
case h
ι : Type u_1
ι' : Type u_2
k : Type u_3
V : Type u_4
P : Type u_5
inst✝⁴ : AddCommGroup V
inst✝³ : AffineSpace V P
inst✝² : Ring k
inst✝¹ : Module k V
b : AffineBasis ι k P
s : Finset ι
i✝ j : ι
e : ι ≃ ι'
inst✝ : Subsingleton ι
i : ι
q : P
hp : Set.Subsingleton (range ⇑b)
this : Subsingleton P
⊢ (coord b i) q = OfNat.ofNat 1 q

Next tactic:
let s : Finset ι := {i}
@[simp]
theorem coe_coord_of_subsingleton_eq_one [Subsingleton ι] (i : ι) : (b.coord i : P → k) = 1 := by
  ext q
  have hp : (range b).Subsingleton := by
    rw [← image_univ]
    apply Subsingleton.image
    apply subsingleton_of_subsingleton
  haveI := AffineSubspace.subsingleton_of_subsingleton_span_eq_top hp b.tot
  let s : Finset ι := {i}
  

Proof state:
case h
ι : Type u_1
ι' : Type u_2
k : Type u_3
V : Type u_4
P : Type u_5
inst✝⁴ : AddCommGroup V
inst✝³ : AffineSpace V P
inst✝² : Ring k
inst✝¹ : Module k V
b : AffineBasis ι k P
s✝ : Finset ι
i✝ j : ι
e : ι ≃ ι'
inst✝ : Subsingleton ι
i : ι
q : P
hp : Set.Subsingleton (range ⇑b)
this : Subsingleton P
s : Finset ι := {i}
⊢ (coord b i) q = OfNat.ofNat 1 q

Next tactic:
have hi : i ∈ s := by simp
@[simp]
theorem coe_coord_of_subsingleton_eq_one [Subsingleton ι] (i : ι) : (b.coord i : P → k) = 1 := by
  ext q
  have hp : (range b).Subsingleton := by
    rw [← image_univ]
    apply Subsingleton.image
    apply subsingleton_of_subsingleton
  haveI := AffineSubspace.subsingleton_of_subsingleton_span_eq_top hp b.tot
  let s : Finset ι := {i}
  have hi : i ∈ s := by 

Proof state:
ι : Type u_1
ι' : Type u_2
k : Type u_3
V : Type u_4
P : Type u_5
inst✝⁴ : AddCommGroup V
inst✝³ : AffineSpace V P
inst✝² : Ring k
inst✝¹ : Module k V
b : AffineBasis ι k P
s✝ : Finset ι
i✝ j : ι
e : ι ≃ ι'
inst✝ : Subsingleton ι
i : ι
q : P
hp : Set.Subsingleton (range ⇑b)
this : Subsingleton P
s : Finset ι := {i}
⊢ i ∈ s

Next tactic:
simp
@[simp]
theorem coe_coord_of_subsingleton_eq_one [Subsingleton ι] (i : ι) : (b.coord i : P → k) = 1 := by
  ext q
  have hp : (range b).Subsingleton := by
    rw [← image_univ]
    apply Subsingleton.image
    apply subsingleton_of_subsingleton
  haveI := AffineSubspace.subsingleton_of_subsingleton_span_eq_top hp b.tot
  let s : Finset ι := {i}
  have hi : i ∈ s := by simp
  

Proof state:
case h
ι : Type u_1
ι' : Type u_2
k : Type u_3
V : Type u_4
P : Type u_5
inst✝⁴ : AddCommGroup V
inst✝³ : AffineSpace V P
inst✝² : Ring k
inst✝¹ : Module k V
b : AffineBasis ι k P
s✝ : Finset ι
i✝ j : ι
e : ι ≃ ι'
inst✝ : Subsingleton ι
i : ι
q : P
hp : Set.Subsingleton (range ⇑b)
this : Subsingleton P
s : Finset ι := {i}
hi : i ∈ s
⊢ (coord b i) q = OfNat.ofNat 1 q

Next tactic:
have hw : s.sum (Function.const ι (1 : k)) = 1 := by simp
@[simp]
theorem coe_coord_of_subsingleton_eq_one [Subsingleton ι] (i : ι) : (b.coord i : P → k) = 1 := by
  ext q
  have hp : (range b).Subsingleton := by
    rw [← image_univ]
    apply Subsingleton.image
    apply subsingleton_of_subsingleton
  haveI := AffineSubspace.subsingleton_of_subsingleton_span_eq_top hp b.tot
  let s : Finset ι := {i}
  have hi : i ∈ s := by simp
  have hw : s.sum (Function.const ι (1 : k)) = 1 := by 

Proof state:
ι : Type u_1
ι' : Type u_2
k : Type u_3
V : Type u_4
P : Type u_5
inst✝⁴ : AddCommGroup V
inst✝³ : AffineSpace V P
inst✝² : Ring k
inst✝¹ : Module k V
b : AffineBasis ι k P
s✝ : Finset ι
i✝ j : ι
e : ι ≃ ι'
inst✝ : Subsingleton ι
i : ι
q : P
hp : Set.Subsingleton (range ⇑b)
this : Subsingleton P
s : Finset ι := {i}
hi : i ∈ s
⊢ Finset.sum s (Function.const ι 1) = 1

Next tactic:
simp
@[simp]
theorem coe_coord_of_subsingleton_eq_one [Subsingleton ι] (i : ι) : (b.coord i : P → k) = 1 := by
  ext q
  have hp : (range b).Subsingleton := by
    rw [← image_univ]
    apply Subsingleton.image
    apply subsingleton_of_subsingleton
  haveI := AffineSubspace.subsingleton_of_subsingleton_span_eq_top hp b.tot
  let s : Finset ι := {i}
  have hi : i ∈ s := by simp
  have hw : s.sum (Function.const ι (1 : k)) = 1 := by simp
  

Proof state:
case h
ι : Type u_1
ι' : Type u_2
k : Type u_3
V : Type u_4
P : Type u_5
inst✝⁴ : AddCommGroup V
inst✝³ : AffineSpace V P
inst✝² : Ring k
inst✝¹ : Module k V
b : AffineBasis ι k P
s✝ : Finset ι
i✝ j : ι
e : ι ≃ ι'
inst✝ : Subsingleton ι
i : ι
q : P
hp : Set.Subsingleton (range ⇑b)
this : Subsingleton P
s : Finset ι := {i}
hi : i ∈ s
hw : Finset.sum s (Function.const ι 1) = 1
⊢ (coord b i) q = OfNat.ofNat 1 q

Next tactic:
have hq : q = s.affineCombination k b (Function.const ι (1 : k)) := by
    simp [eq_iff_true_of_subsingleton]
@[simp]
theorem coe_coord_of_subsingleton_eq_one [Subsingleton ι] (i : ι) : (b.coord i : P → k) = 1 := by
  ext q
  have hp : (range b).Subsingleton := by
    rw [← image_univ]
    apply Subsingleton.image
    apply subsingleton_of_subsingleton
  haveI := AffineSubspace.subsingleton_of_subsingleton_span_eq_top hp b.tot
  let s : Finset ι := {i}
  have hi : i ∈ s := by simp
  have hw : s.sum (Function.const ι (1 : k)) = 1 := by simp
  have hq : q = s.affineCombination k b (Function.const ι (1 : k)) := by
    

Proof state:
ι : Type u_1
ι' : Type u_2
k : Type u_3
V : Type u_4
P : Type u_5
inst✝⁴ : AddCommGroup V
inst✝³ : AffineSpace V P
inst✝² : Ring k
inst✝¹ : Module k V
b : AffineBasis ι k P
s✝ : Finset ι
i✝ j : ι
e : ι ≃ ι'
inst✝ : Subsingleton ι
i : ι
q : P
hp : Set.Subsingleton (range ⇑b)
this : Subsingleton P
s : Finset ι := {i}
hi : i ∈ s
hw : Finset.sum s (Function.const ι 1) = 1
⊢ q = (Finset.affineCombination k s ⇑b) (Function.const ι 1)

Next tactic:
simp [eq_iff_true_of_subsingleton]
@[simp]
theorem coe_coord_of_subsingleton_eq_one [Subsingleton ι] (i : ι) : (b.coord i : P → k) = 1 := by
  ext q
  have hp : (range b).Subsingleton := by
    rw [← image_univ]
    apply Subsingleton.image
    apply subsingleton_of_subsingleton
  haveI := AffineSubspace.subsingleton_of_subsingleton_span_eq_top hp b.tot
  let s : Finset ι := {i}
  have hi : i ∈ s := by simp
  have hw : s.sum (Function.const ι (1 : k)) = 1 := by simp
  have hq : q = s.affineCombination k b (Function.const ι (1 : k)) := by
    simp [eq_iff_true_of_subsingleton]
  

Proof state:
case h
ι : Type u_1
ι' : Type u_2
k : Type u_3
V : Type u_4
P : Type u_5
inst✝⁴ : AddCommGroup V
inst✝³ : AffineSpace V P
inst✝² : Ring k
inst✝¹ : Module k V
b : AffineBasis ι k P
s✝ : Finset ι
i✝ j : ι
e : ι ≃ ι'
inst✝ : Subsingleton ι
i : ι
q : P
hp : Set.Subsingleton (range ⇑b)
this : Subsingleton P
s : Finset ι := {i}
hi : i ∈ s
hw : Finset.sum s (Function.const ι 1) = 1
hq : q = (Finset.affineCombination k s ⇑b) (Function.const ι 1)
⊢ (coord b i) q = OfNat.ofNat 1 q

Next tactic:
rw [Pi.one_apply, hq, b.coord_apply_combination_of_mem hi hw, Function.const_apply]
theorem surjective_coord [Nontrivial ι] (i : ι) : Function.Surjective <| b.coord i := by
  

Proof state:
ι : Type u_1
ι' : Type u_2
k : Type u_3
V : Type u_4
P : Type u_5
inst✝⁴ : AddCommGroup V
inst✝³ : AffineSpace V P
inst✝² : Ring k
inst✝¹ : Module k V
b : AffineBasis ι k P
s : Finset ι
i✝ j : ι
e : ι ≃ ι'
inst✝ : Nontrivial ι
i : ι
⊢ Function.Surjective ⇑(coord b i)

Next tactic:
classical
    intro x
    obtain ⟨j, hij⟩ := exists_ne i
    let s : Finset ι := {i, j}
    have hi : i ∈ s := by simp
    have _ : j ∈ s := by simp
    let w : ι → k := fun j' => if j' = i then x else 1 - x
    have hw : s.sum w = 1 := by simp [Finset.sum_ite, Finset.filter_insert, hij]
    use s.affineCombination k b w
    simp [b.coord_apply_combination_of_mem hi hw]
theorem surjective_coord [Nontrivial ι] (i : ι) : Function.Surjective <| b.coord i := by
  classical
    

Proof state:
ι : Type u_1
ι' : Type u_2
k : Type u_3
V : Type u_4
P : Type u_5
inst✝⁴ : AddCommGroup V
inst✝³ : AffineSpace V P
inst✝² : Ring k
inst✝¹ : Module k V
b : AffineBasis ι k P
s : Finset ι
i✝ j : ι
e : ι ≃ ι'
inst✝ : Nontrivial ι
i : ι
⊢ Function.Surjective ⇑(coord b i)

Next tactic:
intro x
theorem surjective_coord [Nontrivial ι] (i : ι) : Function.Surjective <| b.coord i := by
  classical
    intro x
    

Proof state:
ι : Type u_1
ι' : Type u_2
k : Type u_3
V : Type u_4
P : Type u_5
inst✝⁴ : AddCommGroup V
inst✝³ : AffineSpace V P
inst✝² : Ring k
inst✝¹ : Module k V
b : AffineBasis ι k P
s : Finset ι
i✝ j : ι
e : ι ≃ ι'
inst✝ : Nontrivial ι
i : ι
x : k
⊢ ∃ a, (coord b i) a = x

Next tactic:
obtain ⟨j, hij⟩ := exists_ne i
theorem surjective_coord [Nontrivial ι] (i : ι) : Function.Surjective <| b.coord i := by
  classical
    intro x
    obtain ⟨j, hij⟩ := exists_ne i
    

Proof state:
case intro
ι : Type u_1
ι' : Type u_2
k : Type u_3
V : Type u_4
P : Type u_5
inst✝⁴ : AddCommGroup V
inst✝³ : AffineSpace V P
inst✝² : Ring k
inst✝¹ : Module k V
b : AffineBasis ι k P
s : Finset ι
i✝ j✝ : ι
e : ι ≃ ι'
inst✝ : Nontrivial ι
i : ι
x : k
j : ι
hij : j ≠ i
⊢ ∃ a, (coord b i) a = x

Next tactic:
let s : Finset ι := {i, j}
theorem surjective_coord [Nontrivial ι] (i : ι) : Function.Surjective <| b.coord i := by
  classical
    intro x
    obtain ⟨j, hij⟩ := exists_ne i
    let s : Finset ι := {i, j}
    

Proof state:
case intro
ι : Type u_1
ι' : Type u_2
k : Type u_3
V : Type u_4
P : Type u_5
inst✝⁴ : AddCommGroup V
inst✝³ : AffineSpace V P
inst✝² : Ring k
inst✝¹ : Module k V
b : AffineBasis ι k P
s✝ : Finset ι
i✝ j✝ : ι
e : ι ≃ ι'
inst✝ : Nontrivial ι
i : ι
x : k
j : ι
hij : j ≠ i
s : Finset ι := {i, j}
⊢ ∃ a, (coord b i) a = x

Next tactic:
have hi : i ∈ s := by simp
theorem surjective_coord [Nontrivial ι] (i : ι) : Function.Surjective <| b.coord i := by
  classical
    intro x
    obtain ⟨j, hij⟩ := exists_ne i
    let s : Finset ι := {i, j}
    have hi : i ∈ s := by 

Proof state:
ι : Type u_1
ι' : Type u_2
k : Type u_3
V : Type u_4
P : Type u_5
inst✝⁴ : AddCommGroup V
inst✝³ : AffineSpace V P
inst✝² : Ring k
inst✝¹ : Module k V
b : AffineBasis ι k P
s✝ : Finset ι
i✝ j✝ : ι
e : ι ≃ ι'
inst✝ : Nontrivial ι
i : ι
x : k
j : ι
hij : j ≠ i
s : Finset ι := {i, j}
⊢ i ∈ s

Next tactic:
simp
theorem surjective_coord [Nontrivial ι] (i : ι) : Function.Surjective <| b.coord i := by
  classical
    intro x
    obtain ⟨j, hij⟩ := exists_ne i
    let s : Finset ι := {i, j}
    have hi : i ∈ s := by simp
    

Proof state:
case intro
ι : Type u_1
ι' : Type u_2
k : Type u_3
V : Type u_4
P : Type u_5
inst✝⁴ : AddCommGroup V
inst✝³ : AffineSpace V P
inst✝² : Ring k
inst✝¹ : Module k V
b : AffineBasis ι k P
s✝ : Finset ι
i✝ j✝ : ι
e : ι ≃ ι'
inst✝ : Nontrivial ι
i : ι
x : k
j : ι
hij : j ≠ i
s : Finset ι := {i, j}
hi : i ∈ s
⊢ ∃ a, (coord b i) a = x

Next tactic:
have _ : j ∈ s := by simp
theorem surjective_coord [Nontrivial ι] (i : ι) : Function.Surjective <| b.coord i := by
  classical
    intro x
    obtain ⟨j, hij⟩ := exists_ne i
    let s : Finset ι := {i, j}
    have hi : i ∈ s := by simp
    have _ : j ∈ s := by 

Proof state:
ι : Type u_1
ι' : Type u_2
k : Type u_3
V : Type u_4
P : Type u_5
inst✝⁴ : AddCommGroup V
inst✝³ : AffineSpace V P
inst✝² : Ring k
inst✝¹ : Module k V
b : AffineBasis ι k P
s✝ : Finset ι
i✝ j✝ : ι
e : ι ≃ ι'
inst✝ : Nontrivial ι
i : ι
x : k
j : ι
hij : j ≠ i
s : Finset ι := {i, j}
hi : i ∈ s
⊢ j ∈ s

Next tactic:
simp
theorem surjective_coord [Nontrivial ι] (i : ι) : Function.Surjective <| b.coord i := by
  classical
    intro x
    obtain ⟨j, hij⟩ := exists_ne i
    let s : Finset ι := {i, j}
    have hi : i ∈ s := by simp
    have _ : j ∈ s := by simp
    

Proof state:
case intro
ι : Type u_1
ι' : Type u_2
k : Type u_3
V : Type u_4
P : Type u_5
inst✝⁴ : AddCommGroup V
inst✝³ : AffineSpace V P
inst✝² : Ring k
inst✝¹ : Module k V
b : AffineBasis ι k P
s✝ : Finset ι
i✝ j✝ : ι
e : ι ≃ ι'
inst✝ : Nontrivial ι
i : ι
x : k
j : ι
hij : j ≠ i
s : Finset ι := {i, j}
hi : i ∈ s
x✝ : j ∈ s
⊢ ∃ a, (coord b i) a = x

Next tactic:
let w : ι → k := fun j' => if j' = i then x else 1 - x
theorem surjective_coord [Nontrivial ι] (i : ι) : Function.Surjective <| b.coord i := by
  classical
    intro x
    obtain ⟨j, hij⟩ := exists_ne i
    let s : Finset ι := {i, j}
    have hi : i ∈ s := by simp
    have _ : j ∈ s := by simp
    let w : ι → k := fun j' => if j' = i then x else 1 - x
    

Proof state:
case intro
ι : Type u_1
ι' : Type u_2
k : Type u_3
V : Type u_4
P : Type u_5
inst✝⁴ : AddCommGroup V
inst✝³ : AffineSpace V P
inst✝² : Ring k
inst✝¹ : Module k V
b : AffineBasis ι k P
s✝ : Finset ι
i✝ j✝ : ι
e : ι ≃ ι'
inst✝ : Nontrivial ι
i : ι
x : k
j : ι
hij : j ≠ i
s : Finset ι := {i, j}
hi : i ∈ s
x✝ : j ∈ s
w : ι → k := fun j' => if j' = i then x else 1 - x
⊢ ∃ a, (coord b i) a = x

Next tactic:
have hw : s.sum w = 1 := by simp [Finset.sum_ite, Finset.filter_insert, hij]
theorem surjective_coord [Nontrivial ι] (i : ι) : Function.Surjective <| b.coord i := by
  classical
    intro x
    obtain ⟨j, hij⟩ := exists_ne i
    let s : Finset ι := {i, j}
    have hi : i ∈ s := by simp
    have _ : j ∈ s := by simp
    let w : ι → k := fun j' => if j' = i then x else 1 - x
    have hw : s.sum w = 1 := by 

Proof state:
ι : Type u_1
ι' : Type u_2
k : Type u_3
V : Type u_4
P : Type u_5
inst✝⁴ : AddCommGroup V
inst✝³ : AffineSpace V P
inst✝² : Ring k
inst✝¹ : Module k V
b : AffineBasis ι k P
s✝ : Finset ι
i✝ j✝ : ι
e : ι ≃ ι'
inst✝ : Nontrivial ι
i : ι
x : k
j : ι
hij : j ≠ i
s : Finset ι := {i, j}
hi : i ∈ s
x✝ : j ∈ s
w : ι → k := fun j' => if j' = i then x else 1 - x
⊢ Finset.sum s w = 1

Next tactic:
simp [Finset.sum_ite, Finset.filter_insert, hij]
theorem surjective_coord [Nontrivial ι] (i : ι) : Function.Surjective <| b.coord i := by
  classical
    intro x
    obtain ⟨j, hij⟩ := exists_ne i
    let s : Finset ι := {i, j}
    have hi : i ∈ s := by simp
    have _ : j ∈ s := by simp
    let w : ι → k := fun j' => if j' = i then x else 1 - x
    have hw : s.sum w = 1 := by simp [Finset.sum_ite, Finset.filter_insert, hij]
    

Proof state:
case intro
ι : Type u_1
ι' : Type u_2
k : Type u_3
V : Type u_4
P : Type u_5
inst✝⁴ : AddCommGroup V
inst✝³ : AffineSpace V P
inst✝² : Ring k
inst✝¹ : Module k V
b : AffineBasis ι k P
s✝ : Finset ι
i✝ j✝ : ι
e : ι ≃ ι'
inst✝ : Nontrivial ι
i : ι
x : k
j : ι
hij : j ≠ i
s : Finset ι := {i, j}
hi : i ∈ s
x✝ : j ∈ s
w : ι → k := fun j' => if j' = i then x else 1 - x
hw : Finset.sum s w = 1
⊢ ∃ a, (coord b i) a = x

Next tactic:
use s.affineCombination k b w
theorem surjective_coord [Nontrivial ι] (i : ι) : Function.Surjective <| b.coord i := by
  classical
    intro x
    obtain ⟨j, hij⟩ := exists_ne i
    let s : Finset ι := {i, j}
    have hi : i ∈ s := by simp
    have _ : j ∈ s := by simp
    let w : ι → k := fun j' => if j' = i then x else 1 - x
    have hw : s.sum w = 1 := by simp [Finset.sum_ite, Finset.filter_insert, hij]
    use s.affineCombination k b w
    

Proof state:
case h
ι : Type u_1
ι' : Type u_2
k : Type u_3
V : Type u_4
P : Type u_5
inst✝⁴ : AddCommGroup V
inst✝³ : AffineSpace V P
inst✝² : Ring k
inst✝¹ : Module k V
b : AffineBasis ι k P
s✝ : Finset ι
i✝ j✝ : ι
e : ι ≃ ι'
inst✝ : Nontrivial ι
i : ι
x : k
j : ι
hij : j ≠ i
s : Finset ι := {i, j}
hi : i ∈ s
x✝ : j ∈ s
w : ι → k := fun j' => if j' = i then x else 1 - x
hw : Finset.sum s w = 1
⊢ (coord b i) ((Finset.affineCombination k s ⇑b) w) = x

Next tactic:
simp [b.coord_apply_combination_of_mem hi hw]
/-- Barycentric coordinates as an affine map. -/
noncomputable def coords : P →ᵃ[k] ι → k where
  toFun q i := b.coord i q
  linear :=
    { toFun := fun v i => -(b.basisOf i).sumCoords v
      map_add' := fun v w => by
        

Proof state:
ι : Type u_1
ι' : Type u_2
k : Type u_3
V : Type u_4
P : Type u_5
inst✝³ : AddCommGroup V
inst✝² : AffineSpace V P
inst✝¹ : Ring k
inst✝ : Module k V
b : AffineBasis ι k P
s : Finset ι
i j : ι
e : ι ≃ ι'
v w : V
⊢ (fun v i => -(Basis.sumCoords (basisOf b i)) v) (v + w) =
    (fun v i => -(Basis.sumCoords (basisOf b i)) v) v + (fun v i => -(Basis.sumCoords (basisOf b i)) v) w

Next tactic:
ext i
/-- Barycentric coordinates as an affine map. -/
noncomputable def coords : P →ᵃ[k] ι → k where
  toFun q i := b.coord i q
  linear :=
    { toFun := fun v i => -(b.basisOf i).sumCoords v
      map_add' := fun v w => by
        ext i
        

Proof state:
case h
ι : Type u_1
ι' : Type u_2
k : Type u_3
V : Type u_4
P : Type u_5
inst✝³ : AddCommGroup V
inst✝² : AffineSpace V P
inst✝¹ : Ring k
inst✝ : Module k V
b : AffineBasis ι k P
s : Finset ι
i✝ j : ι
e : ι ≃ ι'
v w : V
i : ι
⊢ (fun v i => -(Basis.sumCoords (basisOf b i)) v) (v + w) i =
    ((fun v i => -(Basis.sumCoords (basisOf b i)) v) v + (fun v i => -(Basis.sumCoords (basisOf b i)) v) w) i

Next tactic:
simp only [LinearMap.map_add, Pi.add_apply, neg_add]
/-- Barycentric coordinates as an affine map. -/
noncomputable def coords : P →ᵃ[k] ι → k where
  toFun q i := b.coord i q
  linear :=
    { toFun := fun v i => -(b.basisOf i).sumCoords v
      map_add' := fun v w => by
        ext i
        simp only [LinearMap.map_add, Pi.add_apply, neg_add]
      map_smul' := fun t v => by
        

Proof state:
ι : Type u_1
ι' : Type u_2
k : Type u_3
V : Type u_4
P : Type u_5
inst✝³ : AddCommGroup V
inst✝² : AffineSpace V P
inst✝¹ : Ring k
inst✝ : Module k V
b : AffineBasis ι k P
s : Finset ι
i j : ι
e : ι ≃ ι'
t : k
v : V
⊢ AddHom.toFun
      { toFun := fun v i => -(Basis.sumCoords (basisOf b i)) v,
        map_add' :=
          (_ :
            ∀ (v w : V),
              (fun v i => -(Basis.sumCoords (basisOf b i)) v) (v + w) =
                (fun v i => -(Basis.sumCoords (basisOf b i)) v) v + (fun v i => -(Basis.sumCoords (basisOf b i)) v) w) }
      (t • v) =
    (RingHom.id k) t •
      AddHom.toFun
        { toFun := fun v i => -(Basis.sumCoords (basisOf b i)) v,
          map_add' :=
            (_ :
              ∀ (v w : V),
                (fun v i => -(Basis.sumCoords (basisOf b i)) v) (v + w) =
                  (fun v i => -(Basis.sumCoords (basisOf b i)) v) v +
                    (fun v i => -(Basis.sumCoords (basisOf b i)) v) w) }
        v

Next tactic:
ext i
/-- Barycentric coordinates as an affine map. -/
noncomputable def coords : P →ᵃ[k] ι → k where
  toFun q i := b.coord i q
  linear :=
    { toFun := fun v i => -(b.basisOf i).sumCoords v
      map_add' := fun v w => by
        ext i
        simp only [LinearMap.map_add, Pi.add_apply, neg_add]
      map_smul' := fun t v => by
        ext i
        

Proof state:
case h
ι : Type u_1
ι' : Type u_2
k : Type u_3
V : Type u_4
P : Type u_5
inst✝³ : AddCommGroup V
inst✝² : AffineSpace V P
inst✝¹ : Ring k
inst✝ : Module k V
b : AffineBasis ι k P
s : Finset ι
i✝ j : ι
e : ι ≃ ι'
t : k
v : V
i : ι
⊢ AddHom.toFun
      { toFun := fun v i => -(Basis.sumCoords (basisOf b i)) v,
        map_add' :=
          (_ :
            ∀ (v w : V),
              (fun v i => -(Basis.sumCoords (basisOf b i)) v) (v + w) =
                (fun v i => -(Basis.sumCoords (basisOf b i)) v) v + (fun v i => -(Basis.sumCoords (basisOf b i)) v) w) }
      (t • v) i =
    ((RingHom.id k) t •
        AddHom.toFun
          { toFun := fun v i => -(Basis.sumCoords (basisOf b i)) v,
            map_add' :=
              (_ :
                ∀ (v w : V),
                  (fun v i => -(Basis.sumCoords (basisOf b i)) v) (v + w) =
                    (fun v i => -(Basis.sumCoords (basisOf b i)) v) v +
                      (fun v i => -(Basis.sumCoords (basisOf b i)) v) w) }
          v)
      i

Next tactic:
simp only [LinearMap.map_smul, Pi.smul_apply, smul_neg, RingHom.id_apply, mul_neg]
/-- Barycentric coordinates as an affine map. -/
noncomputable def coords : P →ᵃ[k] ι → k where
  toFun q i := b.coord i q
  linear :=
    { toFun := fun v i => -(b.basisOf i).sumCoords v
      map_add' := fun v w => by
        ext i
        simp only [LinearMap.map_add, Pi.add_apply, neg_add]
      map_smul' := fun t v => by
        ext i
        simp only [LinearMap.map_smul, Pi.smul_apply, smul_neg, RingHom.id_apply, mul_neg] }
  map_vadd' p v := by
    

Proof state:
ι : Type u_1
ι' : Type u_2
k : Type u_3
V : Type u_4
P : Type u_5
inst✝³ : AddCommGroup V
inst✝² : AffineSpace V P
inst✝¹ : Ring k
inst✝ : Module k V
b : AffineBasis ι k P
s : Finset ι
i j : ι
e : ι ≃ ι'
p : P
v : V
⊢ (fun q i => (coord b i) q) (v +ᵥ p) =
    {
          toAddHom :=
            { toFun := fun v i => -(Basis.sumCoords (basisOf b i)) v,
              map_add' :=
                (_ :
                  ∀ (v w : V),
                    (fun v i => -(Basis.sumCoords (basisOf b i)) v) (v + w) =
                      (fun v i => -(Basis.sumCoords (basisOf b i)) v) v +
                        (fun v i => -(Basis.sumCoords (basisOf b i)) v) w) },
          map_smul' :=
            (_ :
              ∀ (t : k) (v : V),
                AddHom.toFun
                    { toFun := fun v i => -(Basis.sumCoords (basisOf b i)) v,
                      map_add' :=
                        (_ :
                          ∀ (v w : V),
                            (fun v i => -(Basis.sumCoords (basisOf b i)) v) (v + w) =
                              (fun v i => -(Basis.sumCoords (basisOf b i)) v) v +
                                (fun v i => -(Basis.sumCoords (basisOf b i)) v) w) }
                    (t • v) =
                  (RingHom.id k) t •
                    AddHom.toFun
                      { toFun := fun v i => -(Basis.sumCoords (basisOf b i)) v,
                        map_add' :=
                          (_ :
                            ∀ (v w : V),
                              (fun v i => -(Basis.sumCoords (basisOf b i)) v) (v + w) =
                                (fun v i => -(Basis.sumCoords (basisOf b i)) v) v +
                                  (fun v i => -(Basis.sumCoords (basisOf b i)) v) w) }
                      v) }
        v +ᵥ
      (fun q i => (coord b i) q) p

Next tactic:
ext i