l3lab/ntp-mathlib huggingface dataset:
theorem hasDerivAt_of_tendstoUniformlyOnFilter [NeBot l]
    (hf' : TendstoUniformlyOnFilter f' g' l (𝓝 x))
    (hf : ∀ᶠ n : ι × 𝕜 in l ×ˢ 𝓝 x, HasDerivAt (f n.1) (f' n.1 n.2) n.2)
    (hfg : ∀ᶠ y in 𝓝 x, Tendsto (fun n => f n y) l (𝓝 (g y))) : HasDerivAt g (g' x) x := by
  -- The first part of the proof rewrites `hf` and the goal to be functions so that Lean
  -- can recognize them when we apply `hasFDerivAt_of_tendstoUniformlyOnFilter`
  let F' n z := (1 : 𝕜 →L[𝕜] 𝕜).smulRight (f' n z)
  let G' z := (1 : 𝕜 →L[𝕜] 𝕜).smulRight (g' z)
  simp_rw [hasDerivAt_iff_hasFDerivAt] at hf ⊢
  -- Now we need to rewrite hf' in terms of continuous_linear_maps. The tricky part is that
  -- operator norms are written in terms of `≤` whereas metrics are written in terms of `<`. So we
  -- need to shrink `ε` utilizing the archimedean property of `ℝ`
  have hf' : TendstoUniformlyOnFilter F' G' l (𝓝 x) := by
    rw [Metric.tendstoUniformlyOnFilter_iff] at hf' ⊢
    intro ε hε
    obtain ⟨q, hq, hq'⟩ := exists_between hε.lt
    apply (hf' q hq).mono
    intro n hn
    refine' lt_of_le_of_lt _ hq'
    simp only [dist_eq_norm] at hn ⊢
    refine' ContinuousLinearMap.op_norm_le_bound _ hq.le _
    intro z
    simp only [ContinuousLinearMap.coe_sub', Pi.sub_apply, ContinuousLinearMap.smulRight_apply,
      ContinuousLinearMap.one_apply]
    rw [← smul_sub, norm_smul, mul_comm]
    

Proof state:
case intro.intro
ι : Type u_1
l : Filter ι
𝕜 : Type u_2
inst✝³ : IsROrC 𝕜
G : Type u_3
inst✝² : NormedAddCommGroup G
inst✝¹ : NormedSpace 𝕜 G
f : ι → 𝕜 → G
g : 𝕜 → G
f' : ι → 𝕜 → G
g' : 𝕜 → G
x : 𝕜
inst✝ : NeBot l
hf' : ∀ ε > 0, ∀ᶠ (n : ι × 𝕜) in l ×ˢ 𝓝 x, dist (g' n.2) (f' n.1 n.2) < ε
hfg : ∀ᶠ (y : 𝕜) in 𝓝 x, Tendsto (fun n => f n y) l (𝓝 (g y))
F' : ι → 𝕜 → 𝕜 →L[𝕜] G := fun n z => ContinuousLinearMap.smulRight 1 (f' n z)
G' : 𝕜 → 𝕜 →L[𝕜] G := fun z => ContinuousLinearMap.smulRight 1 (g' z)
hf : ∀ᶠ (n : ι × 𝕜) in l ×ˢ 𝓝 x, HasFDerivAt (f n.1) (ContinuousLinearMap.smulRight 1 (f' n.1 n.2)) n.2
ε : ℝ
hε : ε > 0
q : ℝ
hq : 0 < q
hq' : q < ε
n : ι × 𝕜
hn : ‖g' n.2 - f' n.1 n.2‖ < q
z : 𝕜
⊢ ‖g' n.2 - f' n.1 n.2‖ * ‖z‖ ≤ q * ‖z‖

Next tactic:
gcongr
theorem hasDerivAt_of_tendstoUniformlyOnFilter [NeBot l]
    (hf' : TendstoUniformlyOnFilter f' g' l (𝓝 x))
    (hf : ∀ᶠ n : ι × 𝕜 in l ×ˢ 𝓝 x, HasDerivAt (f n.1) (f' n.1 n.2) n.2)
    (hfg : ∀ᶠ y in 𝓝 x, Tendsto (fun n => f n y) l (𝓝 (g y))) : HasDerivAt g (g' x) x := by
  -- The first part of the proof rewrites `hf` and the goal to be functions so that Lean
  -- can recognize them when we apply `hasFDerivAt_of_tendstoUniformlyOnFilter`
  let F' n z := (1 : 𝕜 →L[𝕜] 𝕜).smulRight (f' n z)
  let G' z := (1 : 𝕜 →L[𝕜] 𝕜).smulRight (g' z)
  simp_rw [hasDerivAt_iff_hasFDerivAt] at hf ⊢
  -- Now we need to rewrite hf' in terms of continuous_linear_maps. The tricky part is that
  -- operator norms are written in terms of `≤` whereas metrics are written in terms of `<`. So we
  -- need to shrink `ε` utilizing the archimedean property of `ℝ`
  have hf' : TendstoUniformlyOnFilter F' G' l (𝓝 x) := by
    rw [Metric.tendstoUniformlyOnFilter_iff] at hf' ⊢
    intro ε hε
    obtain ⟨q, hq, hq'⟩ := exists_between hε.lt
    apply (hf' q hq).mono
    intro n hn
    refine' lt_of_le_of_lt _ hq'
    simp only [dist_eq_norm] at hn ⊢
    refine' ContinuousLinearMap.op_norm_le_bound _ hq.le _
    intro z
    simp only [ContinuousLinearMap.coe_sub', Pi.sub_apply, ContinuousLinearMap.smulRight_apply,
      ContinuousLinearMap.one_apply]
    rw [← smul_sub, norm_smul, mul_comm]
    gcongr
  

Proof state:
ι : Type u_1
l : Filter ι
𝕜 : Type u_2
inst✝³ : IsROrC 𝕜
G : Type u_3
inst✝² : NormedAddCommGroup G
inst✝¹ : NormedSpace 𝕜 G
f : ι → 𝕜 → G
g : 𝕜 → G
f' : ι → 𝕜 → G
g' : 𝕜 → G
x : 𝕜
inst✝ : NeBot l
hf'✝ : TendstoUniformlyOnFilter f' g' l (𝓝 x)
hfg : ∀ᶠ (y : 𝕜) in 𝓝 x, Tendsto (fun n => f n y) l (𝓝 (g y))
F' : ι → 𝕜 → 𝕜 →L[𝕜] G := fun n z => ContinuousLinearMap.smulRight 1 (f' n z)
G' : 𝕜 → 𝕜 →L[𝕜] G := fun z => ContinuousLinearMap.smulRight 1 (g' z)
hf : ∀ᶠ (n : ι × 𝕜) in l ×ˢ 𝓝 x, HasFDerivAt (f n.1) (ContinuousLinearMap.smulRight 1 (f' n.1 n.2)) n.2
hf' : TendstoUniformlyOnFilter F' G' l (𝓝 x)
⊢ HasFDerivAt g (ContinuousLinearMap.smulRight 1 (g' x)) x

Next tactic:
exact hasFDerivAt_of_tendstoUniformlyOnFilter hf' hf hfg
theorem hasDerivAt_of_tendstoLocallyUniformlyOn [NeBot l] {s : Set 𝕜} (hs : IsOpen s)
    (hf' : TendstoLocallyUniformlyOn f' g' l s)
    (hf : ∀ᶠ n in l, ∀ x ∈ s, HasDerivAt (f n) (f' n x) x)
    (hfg : ∀ x ∈ s, Tendsto (fun n => f n x) l (𝓝 (g x))) (hx : x ∈ s) : HasDerivAt g (g' x) x := by
  

Proof state:
ι : Type u_1
l : Filter ι
𝕜 : Type u_2
inst✝³ : IsROrC 𝕜
G : Type u_3
inst✝² : NormedAddCommGroup G
inst✝¹ : NormedSpace 𝕜 G
f : ι → 𝕜 → G
g : 𝕜 → G
f' : ι → 𝕜 → G
g' : 𝕜 → G
x : 𝕜
inst✝ : NeBot l
s : Set 𝕜
hs : IsOpen s
hf' : TendstoLocallyUniformlyOn f' g' l s
hf : ∀ᶠ (n : ι) in l, ∀ x ∈ s, HasDerivAt (f n) (f' n x) x
hfg : ∀ x ∈ s, Tendsto (fun n => f n x) l (𝓝 (g x))
hx : x ∈ s
⊢ HasDerivAt g (g' x) x

Next tactic:
have h1 : s ∈ 𝓝 x := hs.mem_nhds hx
theorem hasDerivAt_of_tendstoLocallyUniformlyOn [NeBot l] {s : Set 𝕜} (hs : IsOpen s)
    (hf' : TendstoLocallyUniformlyOn f' g' l s)
    (hf : ∀ᶠ n in l, ∀ x ∈ s, HasDerivAt (f n) (f' n x) x)
    (hfg : ∀ x ∈ s, Tendsto (fun n => f n x) l (𝓝 (g x))) (hx : x ∈ s) : HasDerivAt g (g' x) x := by
  have h1 : s ∈ 𝓝 x := hs.mem_nhds hx
  

Proof state:
ι : Type u_1
l : Filter ι
𝕜 : Type u_2
inst✝³ : IsROrC 𝕜
G : Type u_3
inst✝² : NormedAddCommGroup G
inst✝¹ : NormedSpace 𝕜 G
f : ι → 𝕜 → G
g : 𝕜 → G
f' : ι → 𝕜 → G
g' : 𝕜 → G
x : 𝕜
inst✝ : NeBot l
s : Set 𝕜
hs : IsOpen s
hf' : TendstoLocallyUniformlyOn f' g' l s
hf : ∀ᶠ (n : ι) in l, ∀ x ∈ s, HasDerivAt (f n) (f' n x) x
hfg : ∀ x ∈ s, Tendsto (fun n => f n x) l (𝓝 (g x))
hx : x ∈ s
h1 : s ∈ 𝓝 x
⊢ HasDerivAt g (g' x) x

Next tactic:
have h2 : ∀ᶠ n : ι × 𝕜 in l ×ˢ 𝓝 x, HasDerivAt (f n.1) (f' n.1 n.2) n.2 :=
    eventually_prod_iff.2 ⟨_, hf, fun x => x ∈ s, h1, fun {n} => id⟩
theorem hasDerivAt_of_tendstoLocallyUniformlyOn [NeBot l] {s : Set 𝕜} (hs : IsOpen s)
    (hf' : TendstoLocallyUniformlyOn f' g' l s)
    (hf : ∀ᶠ n in l, ∀ x ∈ s, HasDerivAt (f n) (f' n x) x)
    (hfg : ∀ x ∈ s, Tendsto (fun n => f n x) l (𝓝 (g x))) (hx : x ∈ s) : HasDerivAt g (g' x) x := by
  have h1 : s ∈ 𝓝 x := hs.mem_nhds hx
  have h2 : ∀ᶠ n : ι × 𝕜 in l ×ˢ 𝓝 x, HasDerivAt (f n.1) (f' n.1 n.2) n.2 :=
    eventually_prod_iff.2 ⟨_, hf, fun x => x ∈ s, h1, fun {n} => id⟩
  

Proof state:
ι : Type u_1
l : Filter ι
𝕜 : Type u_2
inst✝³ : IsROrC 𝕜
G : Type u_3
inst✝² : NormedAddCommGroup G
inst✝¹ : NormedSpace 𝕜 G
f : ι → 𝕜 → G
g : 𝕜 → G
f' : ι → 𝕜 → G
g' : 𝕜 → G
x : 𝕜
inst✝ : NeBot l
s : Set 𝕜
hs : IsOpen s
hf' : TendstoLocallyUniformlyOn f' g' l s
hf : ∀ᶠ (n : ι) in l, ∀ x ∈ s, HasDerivAt (f n) (f' n x) x
hfg : ∀ x ∈ s, Tendsto (fun n => f n x) l (𝓝 (g x))
hx : x ∈ s
h1 : s ∈ 𝓝 x
h2 : ∀ᶠ (n : ι × 𝕜) in l ×ˢ 𝓝 x, HasDerivAt (f n.1) (f' n.1 n.2) n.2
⊢ HasDerivAt g (g' x) x

Next tactic:
refine' hasDerivAt_of_tendstoUniformlyOnFilter _ h2 (eventually_of_mem h1 hfg)
theorem hasDerivAt_of_tendstoLocallyUniformlyOn [NeBot l] {s : Set 𝕜} (hs : IsOpen s)
    (hf' : TendstoLocallyUniformlyOn f' g' l s)
    (hf : ∀ᶠ n in l, ∀ x ∈ s, HasDerivAt (f n) (f' n x) x)
    (hfg : ∀ x ∈ s, Tendsto (fun n => f n x) l (𝓝 (g x))) (hx : x ∈ s) : HasDerivAt g (g' x) x := by
  have h1 : s ∈ 𝓝 x := hs.mem_nhds hx
  have h2 : ∀ᶠ n : ι × 𝕜 in l ×ˢ 𝓝 x, HasDerivAt (f n.1) (f' n.1 n.2) n.2 :=
    eventually_prod_iff.2 ⟨_, hf, fun x => x ∈ s, h1, fun {n} => id⟩
  refine' hasDerivAt_of_tendstoUniformlyOnFilter _ h2 (eventually_of_mem h1 hfg)
  

Proof state:
ι : Type u_1
l : Filter ι
𝕜 : Type u_2
inst✝³ : IsROrC 𝕜
G : Type u_3
inst✝² : NormedAddCommGroup G
inst✝¹ : NormedSpace 𝕜 G
f : ι → 𝕜 → G
g : 𝕜 → G
f' : ι → 𝕜 → G
g' : 𝕜 → G
x : 𝕜
inst✝ : NeBot l
s : Set 𝕜
hs : IsOpen s
hf' : TendstoLocallyUniformlyOn f' g' l s
hf : ∀ᶠ (n : ι) in l, ∀ x ∈ s, HasDerivAt (f n) (f' n x) x
hfg : ∀ x ∈ s, Tendsto (fun n => f n x) l (𝓝 (g x))
hx : x ∈ s
h1 : s ∈ 𝓝 x
h2 : ∀ᶠ (n : ι × 𝕜) in l ×ˢ 𝓝 x, HasDerivAt (f n.1) (f' n.1 n.2) n.2
⊢ TendstoUniformlyOnFilter f' g' l (𝓝 x)

Next tactic:
simpa [IsOpen.nhdsWithin_eq hs hx] using tendstoLocallyUniformlyOn_iff_filter.mp hf' x hx
/-- A slight variant of `hasDerivAt_of_tendstoLocallyUniformlyOn` with the assumption stated in
terms of `DifferentiableOn` rather than `HasDerivAt`. This makes a few proofs nicer in complex
analysis where holomorphicity is assumed but the derivative is not known a priori. -/
theorem hasDerivAt_of_tendsto_locally_uniformly_on' [NeBot l] {s : Set 𝕜} (hs : IsOpen s)
    (hf' : TendstoLocallyUniformlyOn (deriv ∘ f) g' l s)
    (hf : ∀ᶠ n in l, DifferentiableOn 𝕜 (f n) s)
    (hfg : ∀ x ∈ s, Tendsto (fun n => f n x) l (𝓝 (g x))) (hx : x ∈ s) : HasDerivAt g (g' x) x := by
  

Proof state:
ι : Type u_1
l : Filter ι
𝕜 : Type u_2
inst✝³ : IsROrC 𝕜
G : Type u_3
inst✝² : NormedAddCommGroup G
inst✝¹ : NormedSpace 𝕜 G
f : ι → 𝕜 → G
g : 𝕜 → G
f' : ι → 𝕜 → G
g' : 𝕜 → G
x : 𝕜
inst✝ : NeBot l
s : Set 𝕜
hs : IsOpen s
hf' : TendstoLocallyUniformlyOn (deriv ∘ f) g' l s
hf : ∀ᶠ (n : ι) in l, DifferentiableOn 𝕜 (f n) s
hfg : ∀ x ∈ s, Tendsto (fun n => f n x) l (𝓝 (g x))
hx : x ∈ s
⊢ HasDerivAt g (g' x) x

Next tactic:
refine' hasDerivAt_of_tendstoLocallyUniformlyOn hs hf' _ hfg hx
/-- A slight variant of `hasDerivAt_of_tendstoLocallyUniformlyOn` with the assumption stated in
terms of `DifferentiableOn` rather than `HasDerivAt`. This makes a few proofs nicer in complex
analysis where holomorphicity is assumed but the derivative is not known a priori. -/
theorem hasDerivAt_of_tendsto_locally_uniformly_on' [NeBot l] {s : Set 𝕜} (hs : IsOpen s)
    (hf' : TendstoLocallyUniformlyOn (deriv ∘ f) g' l s)
    (hf : ∀ᶠ n in l, DifferentiableOn 𝕜 (f n) s)
    (hfg : ∀ x ∈ s, Tendsto (fun n => f n x) l (𝓝 (g x))) (hx : x ∈ s) : HasDerivAt g (g' x) x := by
  refine' hasDerivAt_of_tendstoLocallyUniformlyOn hs hf' _ hfg hx
  

Proof state:
ι : Type u_1
l : Filter ι
𝕜 : Type u_2
inst✝³ : IsROrC 𝕜
G : Type u_3
inst✝² : NormedAddCommGroup G
inst✝¹ : NormedSpace 𝕜 G
f : ι → 𝕜 → G
g : 𝕜 → G
f' : ι → 𝕜 → G
g' : 𝕜 → G
x : 𝕜
inst✝ : NeBot l
s : Set 𝕜
hs : IsOpen s
hf' : TendstoLocallyUniformlyOn (deriv ∘ f) g' l s
hf : ∀ᶠ (n : ι) in l, DifferentiableOn 𝕜 (f n) s
hfg : ∀ x ∈ s, Tendsto (fun n => f n x) l (𝓝 (g x))
hx : x ∈ s
⊢ ∀ᶠ (n : ι) in l, ∀ x ∈ s, HasDerivAt (fun x => f n x) ((deriv ∘ f) n x) x

Next tactic:
filter_upwards [hf] with n h z hz using ((h z hz).differentiableAt (hs.mem_nhds hz)).hasDerivAt
theorem hasDerivAt_of_tendstoUniformly [NeBot l] (hf' : TendstoUniformly f' g' l)
    (hf : ∀ᶠ n in l, ∀ x : 𝕜, HasDerivAt (f n) (f' n x) x)
    (hfg : ∀ x : 𝕜, Tendsto (fun n => f n x) l (𝓝 (g x))) : ∀ x : 𝕜, HasDerivAt g (g' x) x := by
  

Proof state:
ι : Type u_1
l : Filter ι
𝕜 : Type u_2
inst✝³ : IsROrC 𝕜
G : Type u_3
inst✝² : NormedAddCommGroup G
inst✝¹ : NormedSpace 𝕜 G
f : ι → 𝕜 → G
g : 𝕜 → G
f' : ι → 𝕜 → G
g' : 𝕜 → G
x : 𝕜
inst✝ : NeBot l
hf' : TendstoUniformly f' g' l
hf : ∀ᶠ (n : ι) in l, ∀ (x : 𝕜), HasDerivAt (f n) (f' n x) x
hfg : ∀ (x : 𝕜), Tendsto (fun n => f n x) l (𝓝 (g x))
⊢ ∀ (x : 𝕜), HasDerivAt g (g' x) x

Next tactic:
intro x
theorem hasDerivAt_of_tendstoUniformly [NeBot l] (hf' : TendstoUniformly f' g' l)
    (hf : ∀ᶠ n in l, ∀ x : 𝕜, HasDerivAt (f n) (f' n x) x)
    (hfg : ∀ x : 𝕜, Tendsto (fun n => f n x) l (𝓝 (g x))) : ∀ x : 𝕜, HasDerivAt g (g' x) x := by
  intro x
  

Proof state:
ι : Type u_1
l : Filter ι
𝕜 : Type u_2
inst✝³ : IsROrC 𝕜
G : Type u_3
inst✝² : NormedAddCommGroup G
inst✝¹ : NormedSpace 𝕜 G
f : ι → 𝕜 → G
g : 𝕜 → G
f' : ι → 𝕜 → G
g' : 𝕜 → G
x✝ : 𝕜
inst✝ : NeBot l
hf' : TendstoUniformly f' g' l
hf : ∀ᶠ (n : ι) in l, ∀ (x : 𝕜), HasDerivAt (f n) (f' n x) x
hfg : ∀ (x : 𝕜), Tendsto (fun n => f n x) l (𝓝 (g x))
x : 𝕜
⊢ HasDerivAt g (g' x) x

Next tactic:
have hf : ∀ᶠ n in l, ∀ x : 𝕜, x ∈ Set.univ → HasDerivAt (f n) (f' n x) x := by
    filter_upwards [hf] with n h x _ using h x
theorem hasDerivAt_of_tendstoUniformly [NeBot l] (hf' : TendstoUniformly f' g' l)
    (hf : ∀ᶠ n in l, ∀ x : 𝕜, HasDerivAt (f n) (f' n x) x)
    (hfg : ∀ x : 𝕜, Tendsto (fun n => f n x) l (𝓝 (g x))) : ∀ x : 𝕜, HasDerivAt g (g' x) x := by
  intro x
  have hf : ∀ᶠ n in l, ∀ x : 𝕜, x ∈ Set.univ → HasDerivAt (f n) (f' n x) x := by
    

Proof state:
ι : Type u_1
l : Filter ι
𝕜 : Type u_2
inst✝³ : IsROrC 𝕜
G : Type u_3
inst✝² : NormedAddCommGroup G
inst✝¹ : NormedSpace 𝕜 G
f : ι → 𝕜 → G
g : 𝕜 → G
f' : ι → 𝕜 → G
g' : 𝕜 → G
x✝ : 𝕜
inst✝ : NeBot l
hf' : TendstoUniformly f' g' l
hf : ∀ᶠ (n : ι) in l, ∀ (x : 𝕜), HasDerivAt (f n) (f' n x) x
hfg : ∀ (x : 𝕜), Tendsto (fun n => f n x) l (𝓝 (g x))
x : 𝕜
⊢ ∀ᶠ (n : ι) in l, ∀ x ∈ Set.univ, HasDerivAt (f n) (f' n x) x

Next tactic:
filter_upwards [hf] with n h x _ using h x
theorem hasDerivAt_of_tendstoUniformly [NeBot l] (hf' : TendstoUniformly f' g' l)
    (hf : ∀ᶠ n in l, ∀ x : 𝕜, HasDerivAt (f n) (f' n x) x)
    (hfg : ∀ x : 𝕜, Tendsto (fun n => f n x) l (𝓝 (g x))) : ∀ x : 𝕜, HasDerivAt g (g' x) x := by
  intro x
  have hf : ∀ᶠ n in l, ∀ x : 𝕜, x ∈ Set.univ → HasDerivAt (f n) (f' n x) x := by
    filter_upwards [hf] with n h x _ using h x
  

Proof state:
ι : Type u_1
l : Filter ι
𝕜 : Type u_2
inst✝³ : IsROrC 𝕜
G : Type u_3
inst✝² : NormedAddCommGroup G
inst✝¹ : NormedSpace 𝕜 G
f : ι → 𝕜 → G
g : 𝕜 → G
f' : ι → 𝕜 → G
g' : 𝕜 → G
x✝ : 𝕜
inst✝ : NeBot l
hf' : TendstoUniformly f' g' l
hf✝ : ∀ᶠ (n : ι) in l, ∀ (x : 𝕜), HasDerivAt (f n) (f' n x) x
hfg : ∀ (x : 𝕜), Tendsto (fun n => f n x) l (𝓝 (g x))
x : 𝕜
hf : ∀ᶠ (n : ι) in l, ∀ x ∈ Set.univ, HasDerivAt (f n) (f' n x) x
⊢ HasDerivAt g (g' x) x

Next tactic:
have hfg : ∀ x : 𝕜, x ∈ Set.univ → Tendsto (fun n => f n x) l (𝓝 (g x)) := by simp [hfg]
theorem hasDerivAt_of_tendstoUniformly [NeBot l] (hf' : TendstoUniformly f' g' l)
    (hf : ∀ᶠ n in l, ∀ x : 𝕜, HasDerivAt (f n) (f' n x) x)
    (hfg : ∀ x : 𝕜, Tendsto (fun n => f n x) l (𝓝 (g x))) : ∀ x : 𝕜, HasDerivAt g (g' x) x := by
  intro x
  have hf : ∀ᶠ n in l, ∀ x : 𝕜, x ∈ Set.univ → HasDerivAt (f n) (f' n x) x := by
    filter_upwards [hf] with n h x _ using h x
  have hfg : ∀ x : 𝕜, x ∈ Set.univ → Tendsto (fun n => f n x) l (𝓝 (g x)) := by 

Proof state:
ι : Type u_1
l : Filter ι
𝕜 : Type u_2
inst✝³ : IsROrC 𝕜
G : Type u_3
inst✝² : NormedAddCommGroup G
inst✝¹ : NormedSpace 𝕜 G
f : ι → 𝕜 → G
g : 𝕜 → G
f' : ι → 𝕜 → G
g' : 𝕜 → G
x✝ : 𝕜
inst✝ : NeBot l
hf' : TendstoUniformly f' g' l
hf✝ : ∀ᶠ (n : ι) in l, ∀ (x : 𝕜), HasDerivAt (f n) (f' n x) x
hfg : ∀ (x : 𝕜), Tendsto (fun n => f n x) l (𝓝 (g x))
x : 𝕜
hf : ∀ᶠ (n : ι) in l, ∀ x ∈ Set.univ, HasDerivAt (f n) (f' n x) x
⊢ ∀ x ∈ Set.univ, Tendsto (fun n => f n x) l (𝓝 (g x))

Next tactic:
simp [hfg]
theorem hasDerivAt_of_tendstoUniformly [NeBot l] (hf' : TendstoUniformly f' g' l)
    (hf : ∀ᶠ n in l, ∀ x : 𝕜, HasDerivAt (f n) (f' n x) x)
    (hfg : ∀ x : 𝕜, Tendsto (fun n => f n x) l (𝓝 (g x))) : ∀ x : 𝕜, HasDerivAt g (g' x) x := by
  intro x
  have hf : ∀ᶠ n in l, ∀ x : 𝕜, x ∈ Set.univ → HasDerivAt (f n) (f' n x) x := by
    filter_upwards [hf] with n h x _ using h x
  have hfg : ∀ x : 𝕜, x ∈ Set.univ → Tendsto (fun n => f n x) l (𝓝 (g x)) := by simp [hfg]
  

Proof state:
ι : Type u_1
l : Filter ι
𝕜 : Type u_2
inst✝³ : IsROrC 𝕜
G : Type u_3
inst✝² : NormedAddCommGroup G
inst✝¹ : NormedSpace 𝕜 G
f : ι → 𝕜 → G
g : 𝕜 → G
f' : ι → 𝕜 → G
g' : 𝕜 → G
x✝ : 𝕜
inst✝ : NeBot l
hf' : TendstoUniformly f' g' l
hf✝ : ∀ᶠ (n : ι) in l, ∀ (x : 𝕜), HasDerivAt (f n) (f' n x) x
hfg✝ : ∀ (x : 𝕜), Tendsto (fun n => f n x) l (𝓝 (g x))
x : 𝕜
hf : ∀ᶠ (n : ι) in l, ∀ x ∈ Set.univ, HasDerivAt (f n) (f' n x) x
hfg : ∀ x ∈ Set.univ, Tendsto (fun n => f n x) l (𝓝 (g x))
⊢ HasDerivAt g (g' x) x

Next tactic:
have hf' : TendstoUniformlyOn f' g' l Set.univ := by rwa [tendstoUniformlyOn_univ]
theorem hasDerivAt_of_tendstoUniformly [NeBot l] (hf' : TendstoUniformly f' g' l)
    (hf : ∀ᶠ n in l, ∀ x : 𝕜, HasDerivAt (f n) (f' n x) x)
    (hfg : ∀ x : 𝕜, Tendsto (fun n => f n x) l (𝓝 (g x))) : ∀ x : 𝕜, HasDerivAt g (g' x) x := by
  intro x
  have hf : ∀ᶠ n in l, ∀ x : 𝕜, x ∈ Set.univ → HasDerivAt (f n) (f' n x) x := by
    filter_upwards [hf] with n h x _ using h x
  have hfg : ∀ x : 𝕜, x ∈ Set.univ → Tendsto (fun n => f n x) l (𝓝 (g x)) := by simp [hfg]
  have hf' : TendstoUniformlyOn f' g' l Set.univ := by 

Proof state:
ι : Type u_1
l : Filter ι
𝕜 : Type u_2
inst✝³ : IsROrC 𝕜
G : Type u_3
inst✝² : NormedAddCommGroup G
inst✝¹ : NormedSpace 𝕜 G
f : ι → 𝕜 → G
g : 𝕜 → G
f' : ι → 𝕜 → G
g' : 𝕜 → G
x✝ : 𝕜
inst✝ : NeBot l
hf' : TendstoUniformly f' g' l
hf✝ : ∀ᶠ (n : ι) in l, ∀ (x : 𝕜), HasDerivAt (f n) (f' n x) x
hfg✝ : ∀ (x : 𝕜), Tendsto (fun n => f n x) l (𝓝 (g x))
x : 𝕜
hf : ∀ᶠ (n : ι) in l, ∀ x ∈ Set.univ, HasDerivAt (f n) (f' n x) x
hfg : ∀ x ∈ Set.univ, Tendsto (fun n => f n x) l (𝓝 (g x))
⊢ TendstoUniformlyOn f' g' l Set.univ

Next tactic:
rwa [tendstoUniformlyOn_univ]
theorem hasDerivAt_of_tendstoUniformly [NeBot l] (hf' : TendstoUniformly f' g' l)
    (hf : ∀ᶠ n in l, ∀ x : 𝕜, HasDerivAt (f n) (f' n x) x)
    (hfg : ∀ x : 𝕜, Tendsto (fun n => f n x) l (𝓝 (g x))) : ∀ x : 𝕜, HasDerivAt g (g' x) x := by
  intro x
  have hf : ∀ᶠ n in l, ∀ x : 𝕜, x ∈ Set.univ → HasDerivAt (f n) (f' n x) x := by
    filter_upwards [hf] with n h x _ using h x
  have hfg : ∀ x : 𝕜, x ∈ Set.univ → Tendsto (fun n => f n x) l (𝓝 (g x)) := by simp [hfg]
  have hf' : TendstoUniformlyOn f' g' l Set.univ := by rwa [tendstoUniformlyOn_univ]
  

Proof state:
ι : Type u_1
l : Filter ι
𝕜 : Type u_2
inst✝³ : IsROrC 𝕜
G : Type u_3
inst✝² : NormedAddCommGroup G
inst✝¹ : NormedSpace 𝕜 G
f : ι → 𝕜 → G
g : 𝕜 → G
f' : ι → 𝕜 → G
g' : 𝕜 → G
x✝ : 𝕜
inst✝ : NeBot l
hf'✝ : TendstoUniformly f' g' l
hf✝ : ∀ᶠ (n : ι) in l, ∀ (x : 𝕜), HasDerivAt (f n) (f' n x) x
hfg✝ : ∀ (x : 𝕜), Tendsto (fun n => f n x) l (𝓝 (g x))
x : 𝕜
hf : ∀ᶠ (n : ι) in l, ∀ x ∈ Set.univ, HasDerivAt (f n) (f' n x) x
hfg : ∀ x ∈ Set.univ, Tendsto (fun n => f n x) l (𝓝 (g x))
hf' : TendstoUniformlyOn f' g' l Set.univ
⊢ HasDerivAt g (g' x) x

Next tactic:
exact hasDerivAt_of_tendstoUniformlyOn isOpen_univ hf' hf hfg x (Set.mem_univ x)
@[simp]
theorem zero_rmatch (x : List α) : rmatch 0 x = false := by
  

Proof state:
α : Type u_1
β : Type u_2
γ : Type u_3
dec : DecidableEq α
a b : α
x : List α
⊢ rmatch 0 x = false

Next tactic:
induction x
@[simp]
theorem zero_rmatch (x : List α) : rmatch 0 x = false := by
  induction x <;> 

Proof state:
case nil
α : Type u_1
β : Type u_2
γ : Type u_3
dec : DecidableEq α
a b : α
⊢ rmatch 0 [] = false

Next tactic:
simp [rmatch, matchEpsilon, *]
@[simp]
theorem zero_rmatch (x : List α) : rmatch 0 x = false := by
  induction x <;> 

Proof state:
case cons
α : Type u_1
β : Type u_2
γ : Type u_3
dec : DecidableEq α
a b head✝ : α
tail✝ : List α
tail_ih✝ : rmatch 0 tail✝ = false
⊢ rmatch 0 (head✝ :: tail✝) = false

Next tactic:
simp [rmatch, matchEpsilon, *]
theorem one_rmatch_iff (x : List α) : rmatch 1 x ↔ x = [] := by
  

Proof state:
α : Type u_1
β : Type u_2
γ : Type u_3
dec : DecidableEq α
a b : α
x : List α
⊢ rmatch 1 x = true ↔ x = []

Next tactic:
induction x
theorem one_rmatch_iff (x : List α) : rmatch 1 x ↔ x = [] := by
  induction x <;> 

Proof state:
case nil
α : Type u_1
β : Type u_2
γ : Type u_3
dec : DecidableEq α
a b : α
⊢ rmatch 1 [] = true ↔ [] = []

Next tactic:
simp [rmatch, matchEpsilon, *]
theorem one_rmatch_iff (x : List α) : rmatch 1 x ↔ x = [] := by
  induction x <;> 

Proof state:
case cons
α : Type u_1
β : Type u_2
γ : Type u_3
dec : DecidableEq α
a b head✝ : α
tail✝ : List α
tail_ih✝ : rmatch 1 tail✝ = true ↔ tail✝ = []
⊢ rmatch 1 (head✝ :: tail✝) = true ↔ head✝ :: tail✝ = []

Next tactic:
simp [rmatch, matchEpsilon, *]
theorem char_rmatch_iff (a : α) (x : List α) : rmatch (char a) x ↔ x = [a] := by
  

Proof state:
α : Type u_1
β : Type u_2
γ : Type u_3
dec : DecidableEq α
a✝ b a : α
x : List α
⊢ rmatch (char a) x = true ↔ x = [a]

Next tactic:
cases' x with _ x
theorem char_rmatch_iff (a : α) (x : List α) : rmatch (char a) x ↔ x = [a] := by
  cases' x with _ x
  · 

Proof state:
case nil
α : Type u_1
β : Type u_2
γ : Type u_3
dec : DecidableEq α
a✝ b a : α
⊢ rmatch (char a) [] = true ↔ [] = [a]

Next tactic:
exact of_decide_eq_true rfl
theorem char_rmatch_iff (a : α) (x : List α) : rmatch (char a) x ↔ x = [a] := by
  cases' x with _ x
  · exact of_decide_eq_true rfl
  

Proof state:
case cons
α : Type u_1
β : Type u_2
γ : Type u_3
dec : DecidableEq α
a✝ b a head✝ : α
x : List α
⊢ rmatch (char a) (head✝ :: x) = true ↔ head✝ :: x = [a]

Next tactic:
cases' x with head tail
theorem char_rmatch_iff (a : α) (x : List α) : rmatch (char a) x ↔ x = [a] := by
  cases' x with _ x
  · exact of_decide_eq_true rfl
  cases' x with head tail
  · 

Proof state:
case cons.nil
α : Type u_1
β : Type u_2
γ : Type u_3
dec : DecidableEq α
a✝ b a head✝ : α
⊢ rmatch (char a) [head✝] = true ↔ [head✝] = [a]

Next tactic:
rw [rmatch, deriv]
theorem char_rmatch_iff (a : α) (x : List α) : rmatch (char a) x ↔ x = [a] := by
  cases' x with _ x
  · exact of_decide_eq_true rfl
  cases' x with head tail
  · rw [rmatch, deriv]
    

Proof state:
case cons.nil
α : Type u_1
β : Type u_2
γ : Type u_3
dec : DecidableEq α
a✝ b a head✝ : α
⊢ rmatch (if a = head✝ then 1 else 0) [] = true ↔ [head✝] = [a]

Next tactic:
split_ifs
theorem char_rmatch_iff (a : α) (x : List α) : rmatch (char a) x ↔ x = [a] := by
  cases' x with _ x
  · exact of_decide_eq_true rfl
  cases' x with head tail
  · rw [rmatch, deriv]
    split_ifs
    · 

Proof state:
case pos
α : Type u_1
β : Type u_2
γ : Type u_3
dec : DecidableEq α
a✝ b a head✝ : α
h✝ : a = head✝
⊢ rmatch 1 [] = true ↔ [head✝] = [a]

Next tactic:
tauto
theorem char_rmatch_iff (a : α) (x : List α) : rmatch (char a) x ↔ x = [a] := by
  cases' x with _ x
  · exact of_decide_eq_true rfl
  cases' x with head tail
  · rw [rmatch, deriv]
    split_ifs
    · tauto
    · 

Proof state:
case neg
α : Type u_1
β : Type u_2
γ : Type u_3
dec : DecidableEq α
a✝ b a head✝ : α
h✝ : ¬a = head✝
⊢ rmatch 0 [] = true ↔ [head✝] = [a]

Next tactic:
simp [List.singleton_inj]
theorem char_rmatch_iff (a : α) (x : List α) : rmatch (char a) x ↔ x = [a] := by
  cases' x with _ x
  · exact of_decide_eq_true rfl
  cases' x with head tail
  · rw [rmatch, deriv]
    split_ifs
    · tauto
    · simp [List.singleton_inj]; 

Proof state:
case neg
α : Type u_1
β : Type u_2
γ : Type u_3
dec : DecidableEq α
a✝ b a head✝ : α
h✝ : ¬a = head✝
⊢ ¬head✝ = a

Next tactic:
tauto
theorem char_rmatch_iff (a : α) (x : List α) : rmatch (char a) x ↔ x = [a] := by
  cases' x with _ x
  · exact of_decide_eq_true rfl
  cases' x with head tail
  · rw [rmatch, deriv]
    split_ifs
    · tauto
    · simp [List.singleton_inj]; tauto
  · 

Proof state:
case cons.cons
α : Type u_1
β : Type u_2
γ : Type u_3
dec : DecidableEq α
a✝ b a head✝ head : α
tail : List α
⊢ rmatch (char a) (head✝ :: head :: tail) = true ↔ head✝ :: head :: tail = [a]

Next tactic:
rw [rmatch, rmatch, deriv]
theorem char_rmatch_iff (a : α) (x : List α) : rmatch (char a) x ↔ x = [a] := by
  cases' x with _ x
  · exact of_decide_eq_true rfl
  cases' x with head tail
  · rw [rmatch, deriv]
    split_ifs
    · tauto
    · simp [List.singleton_inj]; tauto
  · rw [rmatch, rmatch, deriv]
    

Proof state:
case cons.cons
α : Type u_1
β : Type u_2
γ : Type u_3
dec : DecidableEq α
a✝ b a head✝ head : α
tail : List α
⊢ rmatch (deriv (if a = head✝ then 1 else 0) head) tail = true ↔ head✝ :: head :: tail = [a]

Next tactic:
split_ifs with h
theorem char_rmatch_iff (a : α) (x : List α) : rmatch (char a) x ↔ x = [a] := by
  cases' x with _ x
  · exact of_decide_eq_true rfl
  cases' x with head tail
  · rw [rmatch, deriv]
    split_ifs
    · tauto
    · simp [List.singleton_inj]; tauto
  · rw [rmatch, rmatch, deriv]
    split_ifs with h
    · 

Proof state:
case pos
α : Type u_1
β : Type u_2
γ : Type u_3
dec : DecidableEq α
a✝ b a head✝ head : α
tail : List α
h : a = head✝
⊢ rmatch (deriv 1 head) tail = true ↔ head✝ :: head :: tail = [a]

Next tactic:
simp only [deriv_one, zero_rmatch, cons.injEq, and_false]