l3lab/ntp-mathlib huggingface dataset:
theorem tendsto_nhds {β : Type*} {f : List α → β} {r : List α → Filter β}
    (h_nil : Tendsto f (pure []) (r []))
    (h_cons :
      ∀ l a,
        Tendsto f (𝓝 l) (r l) →
          Tendsto (fun p : α × List α => f (p.1::p.2)) (𝓝 a ×ˢ 𝓝 l) (r (a::l))) :
    ∀ l, Tendsto f (𝓝 l) (r l)
  | [] => by rwa [nhds_nil]
  | a::l => by
    

Proof state:
α : Type u_1
β✝ : Type u_2
inst✝¹ : TopologicalSpace α
inst✝ : TopologicalSpace β✝
β : Type u_3
f : List α → β
r : List α → Filter β
h_nil : Tendsto f (pure []) (r [])
h_cons : ∀ (l : List α) (a : α), Tendsto f (𝓝 l) (r l) → Tendsto (fun p => f (p.1 :: p.2)) (𝓝 a ×ˢ 𝓝 l) (r (a :: l))
a : α
l : List α
⊢ Tendsto f (𝓝 (a :: l)) (r (a :: l))

Next tactic:
rw [tendsto_cons_iff]
theorem tendsto_nhds {β : Type*} {f : List α → β} {r : List α → Filter β}
    (h_nil : Tendsto f (pure []) (r []))
    (h_cons :
      ∀ l a,
        Tendsto f (𝓝 l) (r l) →
          Tendsto (fun p : α × List α => f (p.1::p.2)) (𝓝 a ×ˢ 𝓝 l) (r (a::l))) :
    ∀ l, Tendsto f (𝓝 l) (r l)
  | [] => by rwa [nhds_nil]
  | a::l => by
    rw [tendsto_cons_iff]; 

Proof state:
α : Type u_1
β✝ : Type u_2
inst✝¹ : TopologicalSpace α
inst✝ : TopologicalSpace β✝
β : Type u_3
f : List α → β
r : List α → Filter β
h_nil : Tendsto f (pure []) (r [])
h_cons : ∀ (l : List α) (a : α), Tendsto f (𝓝 l) (r l) → Tendsto (fun p => f (p.1 :: p.2)) (𝓝 a ×ˢ 𝓝 l) (r (a :: l))
a : α
l : List α
⊢ Tendsto (fun p => f (p.1 :: p.2)) (𝓝 a ×ˢ 𝓝 l) (r (a :: l))

Next tactic:
exact h_cons l a (@tendsto_nhds _ _ _ h_nil h_cons l)
theorem continuousAt_length : ∀ l : List α, ContinuousAt List.length l := by
  

Proof state:
α : Type u_1
β : Type u_2
inst✝¹ : TopologicalSpace α
inst✝ : TopologicalSpace β
⊢ ∀ (l : List α), ContinuousAt length l

Next tactic:
simp only [ContinuousAt, nhds_discrete]
theorem continuousAt_length : ∀ l : List α, ContinuousAt List.length l := by
  simp only [ContinuousAt, nhds_discrete]
  

Proof state:
α : Type u_1
β : Type u_2
inst✝¹ : TopologicalSpace α
inst✝ : TopologicalSpace β
⊢ ∀ (l : List α), Tendsto length (𝓝 l) (pure (length l))

Next tactic:
refine' tendsto_nhds _ _
theorem continuousAt_length : ∀ l : List α, ContinuousAt List.length l := by
  simp only [ContinuousAt, nhds_discrete]
  refine' tendsto_nhds _ _
  · 

Proof state:
case refine'_1
α : Type u_1
β : Type u_2
inst✝¹ : TopologicalSpace α
inst✝ : TopologicalSpace β
⊢ Tendsto length (pure []) (pure (length []))

Next tactic:
exact tendsto_pure_pure _ _
theorem continuousAt_length : ∀ l : List α, ContinuousAt List.length l := by
  simp only [ContinuousAt, nhds_discrete]
  refine' tendsto_nhds _ _
  · exact tendsto_pure_pure _ _
  · 

Proof state:
case refine'_2
α : Type u_1
β : Type u_2
inst✝¹ : TopologicalSpace α
inst✝ : TopologicalSpace β
⊢ ∀ (l : List α) (a : α),
    Tendsto length (𝓝 l) (pure (length l)) →
      Tendsto (fun p => length (p.1 :: p.2)) (𝓝 a ×ˢ 𝓝 l) (pure (length (a :: l)))

Next tactic:
intro l a ih
theorem continuousAt_length : ∀ l : List α, ContinuousAt List.length l := by
  simp only [ContinuousAt, nhds_discrete]
  refine' tendsto_nhds _ _
  · exact tendsto_pure_pure _ _
  · intro l a ih
    

Proof state:
case refine'_2
α : Type u_1
β : Type u_2
inst✝¹ : TopologicalSpace α
inst✝ : TopologicalSpace β
l : List α
a : α
ih : Tendsto length (𝓝 l) (pure (length l))
⊢ Tendsto (fun p => length (p.1 :: p.2)) (𝓝 a ×ˢ 𝓝 l) (pure (length (a :: l)))

Next tactic:
dsimp only [List.length]
theorem continuousAt_length : ∀ l : List α, ContinuousAt List.length l := by
  simp only [ContinuousAt, nhds_discrete]
  refine' tendsto_nhds _ _
  · exact tendsto_pure_pure _ _
  · intro l a ih
    dsimp only [List.length]
    

Proof state:
case refine'_2
α : Type u_1
β : Type u_2
inst✝¹ : TopologicalSpace α
inst✝ : TopologicalSpace β
l : List α
a : α
ih : Tendsto length (𝓝 l) (pure (length l))
⊢ Tendsto (fun p => length p.2 + 1) (𝓝 a ×ˢ 𝓝 l) (pure (length l + 1))

Next tactic:
refine' Tendsto.comp (tendsto_pure_pure (fun x => x + 1) _) _
theorem continuousAt_length : ∀ l : List α, ContinuousAt List.length l := by
  simp only [ContinuousAt, nhds_discrete]
  refine' tendsto_nhds _ _
  · exact tendsto_pure_pure _ _
  · intro l a ih
    dsimp only [List.length]
    refine' Tendsto.comp (tendsto_pure_pure (fun x => x + 1) _) _
    

Proof state:
case refine'_2
α : Type u_1
β : Type u_2
inst✝¹ : TopologicalSpace α
inst✝ : TopologicalSpace β
l : List α
a : α
ih : Tendsto length (𝓝 l) (pure (length l))
⊢ Tendsto (fun p => Nat.add (length p.2) 0) (𝓝 a ×ˢ 𝓝 l) (pure (length l))

Next tactic:
refine' Tendsto.comp ih tendsto_snd
theorem tendsto_insertNth' {a : α} :
    ∀ {n : ℕ} {l : List α},
      Tendsto (fun p : α × List α => insertNth n p.1 p.2) (𝓝 a ×ˢ 𝓝 l) (𝓝 (insertNth n a l))
  | 0, l => tendsto_cons
  | n + 1, [] => by 

Proof state:
α : Type u_1
β : Type u_2
inst✝¹ : TopologicalSpace α
inst✝ : TopologicalSpace β
a : α
n : ℕ
⊢ Tendsto (fun p => insertNth (n + 1) p.1 p.2) (𝓝 a ×ˢ 𝓝 []) (𝓝 (insertNth (n + 1) a []))

Next tactic:
simp
theorem tendsto_insertNth' {a : α} :
    ∀ {n : ℕ} {l : List α},
      Tendsto (fun p : α × List α => insertNth n p.1 p.2) (𝓝 a ×ˢ 𝓝 l) (𝓝 (insertNth n a l))
  | 0, l => tendsto_cons
  | n + 1, [] => by simp
  | n + 1, a'::l => by
    

Proof state:
α : Type u_1
β : Type u_2
inst✝¹ : TopologicalSpace α
inst✝ : TopologicalSpace β
a : α
n : ℕ
a' : α
l : List α
⊢ Tendsto (fun p => insertNth (n + 1) p.1 p.2) (𝓝 a ×ˢ 𝓝 (a' :: l)) (𝓝 (insertNth (n + 1) a (a' :: l)))

Next tactic:
have : 𝓝 a ×ˢ 𝓝 (a'::l) =
        (𝓝 a ×ˢ (𝓝 a' ×ˢ 𝓝 l)).map fun p : α × α × List α => (p.1, p.2.1::p.2.2) := by
      simp only [nhds_cons, Filter.prod_eq, ← Filter.map_def, ← Filter.seq_eq_filter_seq]
      simp [-Filter.map_def, (· ∘ ·), functor_norm]
theorem tendsto_insertNth' {a : α} :
    ∀ {n : ℕ} {l : List α},
      Tendsto (fun p : α × List α => insertNth n p.1 p.2) (𝓝 a ×ˢ 𝓝 l) (𝓝 (insertNth n a l))
  | 0, l => tendsto_cons
  | n + 1, [] => by simp
  | n + 1, a'::l => by
    have : 𝓝 a ×ˢ 𝓝 (a'::l) =
        (𝓝 a ×ˢ (𝓝 a' ×ˢ 𝓝 l)).map fun p : α × α × List α => (p.1, p.2.1::p.2.2) := by
      

Proof state:
α : Type u_1
β : Type u_2
inst✝¹ : TopologicalSpace α
inst✝ : TopologicalSpace β
a : α
n : ℕ
a' : α
l : List α
⊢ 𝓝 a ×ˢ 𝓝 (a' :: l) = Filter.map (fun p => (p.1, p.2.1 :: p.2.2)) (𝓝 a ×ˢ 𝓝 a' ×ˢ 𝓝 l)

Next tactic:
simp only [nhds_cons, Filter.prod_eq, ← Filter.map_def, ← Filter.seq_eq_filter_seq]
theorem tendsto_insertNth' {a : α} :
    ∀ {n : ℕ} {l : List α},
      Tendsto (fun p : α × List α => insertNth n p.1 p.2) (𝓝 a ×ˢ 𝓝 l) (𝓝 (insertNth n a l))
  | 0, l => tendsto_cons
  | n + 1, [] => by simp
  | n + 1, a'::l => by
    have : 𝓝 a ×ˢ 𝓝 (a'::l) =
        (𝓝 a ×ˢ (𝓝 a' ×ˢ 𝓝 l)).map fun p : α × α × List α => (p.1, p.2.1::p.2.2) := by
      simp only [nhds_cons, Filter.prod_eq, ← Filter.map_def, ← Filter.seq_eq_filter_seq]
      

Proof state:
α : Type u_1
β : Type u_2
inst✝¹ : TopologicalSpace α
inst✝ : TopologicalSpace β
a : α
n : ℕ
a' : α
l : List α
⊢ (Seq.seq (Prod.mk <$> 𝓝 a) fun x => Seq.seq (cons <$> 𝓝 a') fun x => 𝓝 l) =
    (fun p => (p.1, p.2.1 :: p.2.2)) <$> Seq.seq (Prod.mk <$> 𝓝 a) fun x => Seq.seq (Prod.mk <$> 𝓝 a') fun x => 𝓝 l

Next tactic:
simp [-Filter.map_def, (· ∘ ·), functor_norm]
theorem tendsto_insertNth' {a : α} :
    ∀ {n : ℕ} {l : List α},
      Tendsto (fun p : α × List α => insertNth n p.1 p.2) (𝓝 a ×ˢ 𝓝 l) (𝓝 (insertNth n a l))
  | 0, l => tendsto_cons
  | n + 1, [] => by simp
  | n + 1, a'::l => by
    have : 𝓝 a ×ˢ 𝓝 (a'::l) =
        (𝓝 a ×ˢ (𝓝 a' ×ˢ 𝓝 l)).map fun p : α × α × List α => (p.1, p.2.1::p.2.2) := by
      simp only [nhds_cons, Filter.prod_eq, ← Filter.map_def, ← Filter.seq_eq_filter_seq]
      simp [-Filter.map_def, (· ∘ ·), functor_norm]
    

Proof state:
α : Type u_1
β : Type u_2
inst✝¹ : TopologicalSpace α
inst✝ : TopologicalSpace β
a : α
n : ℕ
a' : α
l : List α
this : 𝓝 a ×ˢ 𝓝 (a' :: l) = Filter.map (fun p => (p.1, p.2.1 :: p.2.2)) (𝓝 a ×ˢ 𝓝 a' ×ˢ 𝓝 l)
⊢ Tendsto (fun p => insertNth (n + 1) p.1 p.2) (𝓝 a ×ˢ 𝓝 (a' :: l)) (𝓝 (insertNth (n + 1) a (a' :: l)))

Next tactic:
rw [this, tendsto_map'_iff]
theorem tendsto_insertNth' {a : α} :
    ∀ {n : ℕ} {l : List α},
      Tendsto (fun p : α × List α => insertNth n p.1 p.2) (𝓝 a ×ˢ 𝓝 l) (𝓝 (insertNth n a l))
  | 0, l => tendsto_cons
  | n + 1, [] => by simp
  | n + 1, a'::l => by
    have : 𝓝 a ×ˢ 𝓝 (a'::l) =
        (𝓝 a ×ˢ (𝓝 a' ×ˢ 𝓝 l)).map fun p : α × α × List α => (p.1, p.2.1::p.2.2) := by
      simp only [nhds_cons, Filter.prod_eq, ← Filter.map_def, ← Filter.seq_eq_filter_seq]
      simp [-Filter.map_def, (· ∘ ·), functor_norm]
    rw [this, tendsto_map'_iff]
    

Proof state:
α : Type u_1
β : Type u_2
inst✝¹ : TopologicalSpace α
inst✝ : TopologicalSpace β
a : α
n : ℕ
a' : α
l : List α
this : 𝓝 a ×ˢ 𝓝 (a' :: l) = Filter.map (fun p => (p.1, p.2.1 :: p.2.2)) (𝓝 a ×ˢ 𝓝 a' ×ˢ 𝓝 l)
⊢ Tendsto ((fun p => insertNth (n + 1) p.1 p.2) ∘ fun p => (p.1, p.2.1 :: p.2.2)) (𝓝 a ×ˢ 𝓝 a' ×ˢ 𝓝 l)
    (𝓝 (insertNth (n + 1) a (a' :: l)))

Next tactic:
exact
      (tendsto_fst.comp tendsto_snd).cons
        ((@tendsto_insertNth' _ n l).comp <| tendsto_fst.prod_mk <| tendsto_snd.comp tendsto_snd)
theorem continuous_insertNth {n : ℕ} : Continuous fun p : α × List α => insertNth n p.1 p.2 :=
  continuous_iff_continuousAt.mpr fun ⟨a, l⟩ => by
    

Proof state:
α : Type u_1
β : Type u_2
inst✝¹ : TopologicalSpace α
inst✝ : TopologicalSpace β
n : ℕ
x✝ : α × List α
a : α
l : List α
⊢ ContinuousAt (fun p => insertNth n p.1 p.2) (a, l)

Next tactic:
rw [ContinuousAt, nhds_prod_eq]
theorem continuous_insertNth {n : ℕ} : Continuous fun p : α × List α => insertNth n p.1 p.2 :=
  continuous_iff_continuousAt.mpr fun ⟨a, l⟩ => by
    rw [ContinuousAt, nhds_prod_eq]; 

Proof state:
α : Type u_1
β : Type u_2
inst✝¹ : TopologicalSpace α
inst✝ : TopologicalSpace β
n : ℕ
x✝ : α × List α
a : α
l : List α
⊢ Tendsto (fun p => insertNth n p.1 p.2) (𝓝 a ×ˢ 𝓝 l) (𝓝 (insertNth n (a, l).1 (a, l).2))

Next tactic:
exact tendsto_insertNth'
theorem tendsto_removeNth :
    ∀ {n : ℕ} {l : List α}, Tendsto (fun l => removeNth l n) (𝓝 l) (𝓝 (removeNth l n))
  | _, [] => by 

Proof state:
α : Type u_1
β : Type u_2
inst✝¹ : TopologicalSpace α
inst✝ : TopologicalSpace β
x✝ : ℕ
⊢ Tendsto (fun l => removeNth l x✝) (𝓝 []) (𝓝 (removeNth [] x✝))

Next tactic:
rw [nhds_nil]
theorem tendsto_removeNth :
    ∀ {n : ℕ} {l : List α}, Tendsto (fun l => removeNth l n) (𝓝 l) (𝓝 (removeNth l n))
  | _, [] => by rw [nhds_nil]; 

Proof state:
α : Type u_1
β : Type u_2
inst✝¹ : TopologicalSpace α
inst✝ : TopologicalSpace β
x✝ : ℕ
⊢ Tendsto (fun l => removeNth l x✝) (pure []) (𝓝 (removeNth [] x✝))

Next tactic:
exact tendsto_pure_nhds _ _
theorem tendsto_removeNth :
    ∀ {n : ℕ} {l : List α}, Tendsto (fun l => removeNth l n) (𝓝 l) (𝓝 (removeNth l n))
  | _, [] => by rw [nhds_nil]; exact tendsto_pure_nhds _ _
  | 0, a::l => by 

Proof state:
α : Type u_1
β : Type u_2
inst✝¹ : TopologicalSpace α
inst✝ : TopologicalSpace β
a : α
l : List α
⊢ Tendsto (fun l => removeNth l 0) (𝓝 (a :: l)) (𝓝 (removeNth (a :: l) 0))

Next tactic:
rw [tendsto_cons_iff]
theorem tendsto_removeNth :
    ∀ {n : ℕ} {l : List α}, Tendsto (fun l => removeNth l n) (𝓝 l) (𝓝 (removeNth l n))
  | _, [] => by rw [nhds_nil]; exact tendsto_pure_nhds _ _
  | 0, a::l => by rw [tendsto_cons_iff]; 

Proof state:
α : Type u_1
β : Type u_2
inst✝¹ : TopologicalSpace α
inst✝ : TopologicalSpace β
a : α
l : List α
⊢ Tendsto (fun p => removeNth (p.1 :: p.2) 0) (𝓝 a ×ˢ 𝓝 l) (𝓝 (removeNth (a :: l) 0))

Next tactic:
exact tendsto_snd
theorem tendsto_removeNth :
    ∀ {n : ℕ} {l : List α}, Tendsto (fun l => removeNth l n) (𝓝 l) (𝓝 (removeNth l n))
  | _, [] => by rw [nhds_nil]; exact tendsto_pure_nhds _ _
  | 0, a::l => by rw [tendsto_cons_iff]; exact tendsto_snd
  | n + 1, a::l => by
    

Proof state:
α : Type u_1
β : Type u_2
inst✝¹ : TopologicalSpace α
inst✝ : TopologicalSpace β
n : ℕ
a : α
l : List α
⊢ Tendsto (fun l => removeNth l (n + 1)) (𝓝 (a :: l)) (𝓝 (removeNth (a :: l) (n + 1)))

Next tactic:
rw [tendsto_cons_iff]
theorem tendsto_removeNth :
    ∀ {n : ℕ} {l : List α}, Tendsto (fun l => removeNth l n) (𝓝 l) (𝓝 (removeNth l n))
  | _, [] => by rw [nhds_nil]; exact tendsto_pure_nhds _ _
  | 0, a::l => by rw [tendsto_cons_iff]; exact tendsto_snd
  | n + 1, a::l => by
    rw [tendsto_cons_iff]
    

Proof state:
α : Type u_1
β : Type u_2
inst✝¹ : TopologicalSpace α
inst✝ : TopologicalSpace β
n : ℕ
a : α
l : List α
⊢ Tendsto (fun p => removeNth (p.1 :: p.2) (n + 1)) (𝓝 a ×ˢ 𝓝 l) (𝓝 (removeNth (a :: l) (n + 1)))

Next tactic:
dsimp [removeNth]
theorem tendsto_removeNth :
    ∀ {n : ℕ} {l : List α}, Tendsto (fun l => removeNth l n) (𝓝 l) (𝓝 (removeNth l n))
  | _, [] => by rw [nhds_nil]; exact tendsto_pure_nhds _ _
  | 0, a::l => by rw [tendsto_cons_iff]; exact tendsto_snd
  | n + 1, a::l => by
    rw [tendsto_cons_iff]
    dsimp [removeNth]
    

Proof state:
α : Type u_1
β : Type u_2
inst✝¹ : TopologicalSpace α
inst✝ : TopologicalSpace β
n : ℕ
a : α
l : List α
⊢ Tendsto (fun p => p.1 :: removeNth p.2 n) (𝓝 a ×ˢ 𝓝 l) (𝓝 (a :: removeNth l n))

Next tactic:
exact tendsto_fst.cons ((@tendsto_removeNth n l).comp tendsto_snd)
@[to_additive]
theorem tendsto_prod [Monoid α] [ContinuousMul α] {l : List α} :
    Tendsto List.prod (𝓝 l) (𝓝 l.prod) := by
  

Proof state:
α : Type u_1
β : Type u_2
inst✝³ : TopologicalSpace α
inst✝² : TopologicalSpace β
inst✝¹ : Monoid α
inst✝ : ContinuousMul α
l : List α
⊢ Tendsto prod (𝓝 l) (𝓝 (prod l))

Next tactic:
induction' l with x l ih
@[to_additive]
theorem tendsto_prod [Monoid α] [ContinuousMul α] {l : List α} :
    Tendsto List.prod (𝓝 l) (𝓝 l.prod) := by
  induction' l with x l ih
  · 

Proof state:
case nil
α : Type u_1
β : Type u_2
inst✝³ : TopologicalSpace α
inst✝² : TopologicalSpace β
inst✝¹ : Monoid α
inst✝ : ContinuousMul α
⊢ Tendsto prod (𝓝 []) (𝓝 (prod []))

Next tactic:
simp (config := { contextual := true }) [nhds_nil, mem_of_mem_nhds, tendsto_pure_left]
@[to_additive]
theorem tendsto_prod [Monoid α] [ContinuousMul α] {l : List α} :
    Tendsto List.prod (𝓝 l) (𝓝 l.prod) := by
  induction' l with x l ih
  · simp (config := { contextual := true }) [nhds_nil, mem_of_mem_nhds, tendsto_pure_left]
  

Proof state:
case cons
α : Type u_1
β : Type u_2
inst✝³ : TopologicalSpace α
inst✝² : TopologicalSpace β
inst✝¹ : Monoid α
inst✝ : ContinuousMul α
x : α
l : List α
ih : Tendsto prod (𝓝 l) (𝓝 (prod l))
⊢ Tendsto prod (𝓝 (x :: l)) (𝓝 (prod (x :: l)))

Next tactic:
simp_rw [tendsto_cons_iff, prod_cons]
@[to_additive]
theorem tendsto_prod [Monoid α] [ContinuousMul α] {l : List α} :
    Tendsto List.prod (𝓝 l) (𝓝 l.prod) := by
  induction' l with x l ih
  · simp (config := { contextual := true }) [nhds_nil, mem_of_mem_nhds, tendsto_pure_left]
  simp_rw [tendsto_cons_iff, prod_cons]
  

Proof state:
case cons
α : Type u_1
β : Type u_2
inst✝³ : TopologicalSpace α
inst✝² : TopologicalSpace β
inst✝¹ : Monoid α
inst✝ : ContinuousMul α
x : α
l : List α
ih : Tendsto prod (𝓝 l) (𝓝 (prod l))
⊢ Tendsto (fun p => p.1 * prod p.2) (𝓝 x ×ˢ 𝓝 l) (𝓝 (x * prod l))

Next tactic:
have := continuous_iff_continuousAt.mp continuous_mul (x, l.prod)
@[to_additive]
theorem tendsto_prod [Monoid α] [ContinuousMul α] {l : List α} :
    Tendsto List.prod (𝓝 l) (𝓝 l.prod) := by
  induction' l with x l ih
  · simp (config := { contextual := true }) [nhds_nil, mem_of_mem_nhds, tendsto_pure_left]
  simp_rw [tendsto_cons_iff, prod_cons]
  have := continuous_iff_continuousAt.mp continuous_mul (x, l.prod)
  

Proof state:
case cons
α : Type u_1
β : Type u_2
inst✝³ : TopologicalSpace α
inst✝² : TopologicalSpace β
inst✝¹ : Monoid α
inst✝ : ContinuousMul α
x : α
l : List α
ih : Tendsto prod (𝓝 l) (𝓝 (prod l))
this : ContinuousAt (fun p => p.1 * p.2) (x, prod l)
⊢ Tendsto (fun p => p.1 * prod p.2) (𝓝 x ×ˢ 𝓝 l) (𝓝 (x * prod l))

Next tactic:
rw [ContinuousAt, nhds_prod_eq] at this
@[to_additive]
theorem tendsto_prod [Monoid α] [ContinuousMul α] {l : List α} :
    Tendsto List.prod (𝓝 l) (𝓝 l.prod) := by
  induction' l with x l ih
  · simp (config := { contextual := true }) [nhds_nil, mem_of_mem_nhds, tendsto_pure_left]
  simp_rw [tendsto_cons_iff, prod_cons]
  have := continuous_iff_continuousAt.mp continuous_mul (x, l.prod)
  rw [ContinuousAt, nhds_prod_eq] at this
  

Proof state:
case cons
α : Type u_1
β : Type u_2
inst✝³ : TopologicalSpace α
inst✝² : TopologicalSpace β
inst✝¹ : Monoid α
inst✝ : ContinuousMul α
x : α
l : List α
ih : Tendsto prod (𝓝 l) (𝓝 (prod l))
this : Tendsto (fun p => p.1 * p.2) (𝓝 x ×ˢ 𝓝 (prod l)) (𝓝 ((x, prod l).1 * (x, prod l).2))
⊢ Tendsto (fun p => p.1 * prod p.2) (𝓝 x ×ˢ 𝓝 l) (𝓝 (x * prod l))

Next tactic:
exact this.comp (tendsto_id.prod_map ih)
instance (n : ℕ) : TopologicalSpace (Vector α n) := by 

Proof state:
α : Type u_1
β : Type u_2
inst✝¹ : TopologicalSpace α
inst✝ : TopologicalSpace β
n : ℕ
⊢ TopologicalSpace (Vector α n)

Next tactic:
unfold Vector
instance (n : ℕ) : TopologicalSpace (Vector α n) := by unfold Vector; 

Proof state:
α : Type u_1
β : Type u_2
inst✝¹ : TopologicalSpace α
inst✝ : TopologicalSpace β
n : ℕ
⊢ TopologicalSpace { l // List.length l = n }

Next tactic:
infer_instance
theorem tendsto_cons {n : ℕ} {a : α} {l : Vector α n} :
    Tendsto (fun p : α × Vector α n => p.1 ::ᵥ p.2) (𝓝 a ×ˢ 𝓝 l) (𝓝 (a ::ᵥ l)) := by
  

Proof state:
α : Type u_1
β : Type u_2
inst✝¹ : TopologicalSpace α
inst✝ : TopologicalSpace β
n : ℕ
a : α
l : Vector α n
⊢ Tendsto (fun p => p.1 ::ᵥ p.2) (𝓝 a ×ˢ 𝓝 l) (𝓝 (a ::ᵥ l))

Next tactic:
rw [tendsto_subtype_rng, cons_val]
theorem tendsto_cons {n : ℕ} {a : α} {l : Vector α n} :
    Tendsto (fun p : α × Vector α n => p.1 ::ᵥ p.2) (𝓝 a ×ˢ 𝓝 l) (𝓝 (a ::ᵥ l)) := by
  rw [tendsto_subtype_rng, cons_val]
  

Proof state:
α : Type u_1
β : Type u_2
inst✝¹ : TopologicalSpace α
inst✝ : TopologicalSpace β
n : ℕ
a : α
l : Vector α n
⊢ Tendsto (fun x => ↑(x.1 ::ᵥ x.2)) (𝓝 a ×ˢ 𝓝 l) (𝓝 (a :: ↑l))

Next tactic:
exact tendsto_fst.cons (Tendsto.comp continuousAt_subtype_val tendsto_snd)
theorem tendsto_insertNth {n : ℕ} {i : Fin (n + 1)} {a : α} :
    ∀ {l : Vector α n},
      Tendsto (fun p : α × Vector α n => insertNth p.1 i p.2) (𝓝 a ×ˢ 𝓝 l) (𝓝 (insertNth a i l))
  | ⟨l, hl⟩ => by
    

Proof state:
α : Type u_1
β : Type u_2
inst✝¹ : TopologicalSpace α
inst✝ : TopologicalSpace β
n : ℕ
i : Fin (n + 1)
a : α
l : List α
hl : List.length l = n
⊢ Tendsto (fun p => insertNth p.1 i p.2) (𝓝 a ×ˢ 𝓝 { val := l, property := hl })
    (𝓝 (insertNth a i { val := l, property := hl }))

Next tactic:
rw [insertNth, tendsto_subtype_rng]
theorem tendsto_insertNth {n : ℕ} {i : Fin (n + 1)} {a : α} :
    ∀ {l : Vector α n},
      Tendsto (fun p : α × Vector α n => insertNth p.1 i p.2) (𝓝 a ×ˢ 𝓝 l) (𝓝 (insertNth a i l))
  | ⟨l, hl⟩ => by
    rw [insertNth, tendsto_subtype_rng]
    

Proof state:
α : Type u_1
β : Type u_2
inst✝¹ : TopologicalSpace α
inst✝ : TopologicalSpace β
n : ℕ
i : Fin (n + 1)
a : α
l : List α
hl : List.length l = n
⊢ Tendsto (fun x => ↑(insertNth x.1 i x.2)) (𝓝 a ×ˢ 𝓝 { val := l, property := hl })
    (𝓝
      ↑{ val := List.insertNth (↑i) a ↑{ val := l, property := hl },
          property := (_ : List.length (List.insertNth (↑i) a ↑{ val := l, property := hl }) = n + 1) })

Next tactic:
simp only [insertNth_val]
theorem tendsto_insertNth {n : ℕ} {i : Fin (n + 1)} {a : α} :
    ∀ {l : Vector α n},
      Tendsto (fun p : α × Vector α n => insertNth p.1 i p.2) (𝓝 a ×ˢ 𝓝 l) (𝓝 (insertNth a i l))
  | ⟨l, hl⟩ => by
    rw [insertNth, tendsto_subtype_rng]
    simp only [insertNth_val]
    

Proof state:
α : Type u_1
β : Type u_2
inst✝¹ : TopologicalSpace α
inst✝ : TopologicalSpace β
n : ℕ
i : Fin (n + 1)
a : α
l : List α
hl : List.length l = n
⊢ Tendsto (fun x => List.insertNth (↑i) x.1 ↑x.2) (𝓝 a ×ˢ 𝓝 { val := l, property := hl }) (𝓝 (List.insertNth (↑i) a l))

Next tactic:
exact List.tendsto_insertNth tendsto_fst (Tendsto.comp continuousAt_subtype_val tendsto_snd : _)
theorem continuous_insertNth' {n : ℕ} {i : Fin (n + 1)} :
    Continuous fun p : α × Vector α n => insertNth p.1 i p.2 :=
  continuous_iff_continuousAt.mpr fun ⟨a, l⟩ => by
    

Proof state:
α : Type u_1
β : Type u_2
inst✝¹ : TopologicalSpace α
inst✝ : TopologicalSpace β
n : ℕ
i : Fin (n + 1)
x✝ : α × Vector α n
a : α
l : Vector α n
⊢ ContinuousAt (fun p => insertNth p.1 i p.2) (a, l)

Next tactic:
rw [ContinuousAt, nhds_prod_eq]
theorem continuous_insertNth' {n : ℕ} {i : Fin (n + 1)} :
    Continuous fun p : α × Vector α n => insertNth p.1 i p.2 :=
  continuous_iff_continuousAt.mpr fun ⟨a, l⟩ => by
    rw [ContinuousAt, nhds_prod_eq]; 

Proof state:
α : Type u_1
β : Type u_2
inst✝¹ : TopologicalSpace α
inst✝ : TopologicalSpace β
n : ℕ
i : Fin (n + 1)
x✝ : α × Vector α n
a : α
l : Vector α n
⊢ Tendsto (fun p => insertNth p.1 i p.2) (𝓝 a ×ˢ 𝓝 l) (𝓝 (insertNth (a, l).1 i (a, l).2))

Next tactic:
exact tendsto_insertNth
theorem continuousAt_removeNth {n : ℕ} {i : Fin (n + 1)} :
    ∀ {l : Vector α (n + 1)}, ContinuousAt (removeNth i) l
  | ⟨l, hl⟩ => by
    

Proof state:
α : Type u_1
β : Type u_2
inst✝¹ : TopologicalSpace α
inst✝ : TopologicalSpace β
n : ℕ
i : Fin (n + 1)
l : List α
hl : List.length l = n + 1
⊢ ContinuousAt (removeNth i) { val := l, property := hl }

Next tactic:
rw [ContinuousAt, removeNth, tendsto_subtype_rng]
theorem continuousAt_removeNth {n : ℕ} {i : Fin (n + 1)} :
    ∀ {l : Vector α (n + 1)}, ContinuousAt (removeNth i) l
  | ⟨l, hl⟩ => by
    rw [ContinuousAt, removeNth, tendsto_subtype_rng]
    

Proof state:
α : Type u_1
β : Type u_2
inst✝¹ : TopologicalSpace α
inst✝ : TopologicalSpace β
n : ℕ
i : Fin (n + 1)
l : List α
hl : List.length l = n + 1
⊢ Tendsto (fun x => ↑(removeNth i x)) (𝓝 { val := l, property := hl })
    (𝓝
      ↑(match { val := l, property := hl } with
        | { val := l, property := p } =>
          { val := List.removeNth l ↑i, property := (_ : List.length (List.removeNth l ↑i) = n + 1 - 1) }))

Next tactic:
simp only [Vector.removeNth_val]
theorem continuousAt_removeNth {n : ℕ} {i : Fin (n + 1)} :
    ∀ {l : Vector α (n + 1)}, ContinuousAt (removeNth i) l
  | ⟨l, hl⟩ => by
    rw [ContinuousAt, removeNth, tendsto_subtype_rng]
    simp only [Vector.removeNth_val]
    

Proof state:
α : Type u_1
β : Type u_2
inst✝¹ : TopologicalSpace α
inst✝ : TopologicalSpace β
n : ℕ
i : Fin (n + 1)
l : List α
hl : List.length l = n + 1
⊢ Tendsto (fun x => List.removeNth ↑x ↑i) (𝓝 { val := l, property := hl }) (𝓝 (List.removeNth l ↑i))

Next tactic:
exact Tendsto.comp List.tendsto_removeNth continuousAt_subtype_val
/-- Any homeomorphism is a homotopy equivalence.
-/
def toHomotopyEquiv (h : X ≃ₜ Y) : X ≃ₕ Y where
  toFun := h
  invFun := h.symm
  left_inv := by 

Proof state:
X : Type u
Y : Type v
Z : Type w
Z' : Type x
inst✝³ : TopologicalSpace X
inst✝² : TopologicalSpace Y
inst✝¹ : TopologicalSpace Z
inst✝ : TopologicalSpace Z'
h : X ≃ₜ Y
⊢ Homotopic (comp (toContinuousMap (Homeomorph.symm h)) (toContinuousMap h)) (ContinuousMap.id X)

Next tactic:
rw [symm_comp_toContinuousMap]
/-- Any homeomorphism is a homotopy equivalence.
-/
def toHomotopyEquiv (h : X ≃ₜ Y) : X ≃ₕ Y where
  toFun := h
  invFun := h.symm
  left_inv := by rw [symm_comp_toContinuousMap]
  right_inv := by 

Proof state:
X : Type u
Y : Type v
Z : Type w
Z' : Type x
inst✝³ : TopologicalSpace X
inst✝² : TopologicalSpace Y
inst✝¹ : TopologicalSpace Z
inst✝ : TopologicalSpace Z'
h : X ≃ₜ Y
⊢ Homotopic (comp (toContinuousMap h) (toContinuousMap (Homeomorph.symm h))) (ContinuousMap.id Y)

Next tactic:
rw [toContinuousMap_comp_symm]
/--
If `X` is homotopy equivalent to `Y`, and `Y` is homotopy equivalent to `Z`, then `X` is homotopy
equivalent to `Z`.
-/
@[simps!]
def trans (h₁ : X ≃ₕ Y) (h₂ : Y ≃ₕ Z) : X ≃ₕ Z where
  toFun := h₂.toFun.comp h₁.toFun
  invFun := h₁.invFun.comp h₂.invFun
  left_inv := by
    

Proof state:
X : Type u
Y : Type v
Z : Type w
Z' : Type x
inst✝³ : TopologicalSpace X
inst✝² : TopologicalSpace Y
inst✝¹ : TopologicalSpace Z
inst✝ : TopologicalSpace Z'
h₁ : X ≃ₕ Y
h₂ : Y ≃ₕ Z
⊢ Homotopic (comp (comp h₁.invFun h₂.invFun) (comp h₂.toFun h₁.toFun)) (ContinuousMap.id X)

Next tactic:
refine Homotopic.trans ?_ h₁.left_inv