l3lab/ntp-mathlib huggingface dataset:
theorem IsPreconnected.prod [TopologicalSpace β] {s : Set α} {t : Set β} (hs : IsPreconnected s)
    (ht : IsPreconnected t) : IsPreconnected (s ×ˢ t) := by
  apply isPreconnected_of_forall_pair
  rintro ⟨a₁, b₁⟩ ⟨ha₁, hb₁⟩ ⟨a₂, b₂⟩ ⟨ha₂, hb₂⟩
  refine' ⟨Prod.mk a₁ '' t ∪ flip Prod.mk b₂ '' s, _, .inl ⟨b₁, hb₁, rfl⟩, .inr ⟨a₂, ha₂, rfl⟩, _⟩
  · rintro _ (⟨y, hy, rfl⟩ | ⟨x, hx, rfl⟩)
    

Proof state:
case H.mk.intro.mk.intro.refine'_1.inl.intro.intro
α : Type u
β : Type v
ι : Type u_1
π : ι → Type u_2
inst✝¹ : TopologicalSpace α
s✝ t✝ u v : Set α
inst✝ : TopologicalSpace β
s : Set α
t : Set β
hs : IsPreconnected s
ht : IsPreconnected t
a₁ : α
b₁ : β
ha₁ : (a₁, b₁).1 ∈ s
hb₁ : (a₁, b₁).2 ∈ t
a₂ : α
b₂ : β
ha₂ : (a₂, b₂).1 ∈ s
hb₂ : (a₂, b₂).2 ∈ t
y : β
hy : y ∈ t
⊢ (a₁, y) ∈ s ×ˢ t
case H.mk.intro.mk.intro.refine'_1.inr.intro.intro
α : Type u
β : Type v
ι : Type u_1
π : ι → Type u_2
inst✝¹ : TopologicalSpace α
s✝ t✝ u v : Set α
inst✝ : TopologicalSpace β
s : Set α
t : Set β
hs : IsPreconnected s
ht : IsPreconnected t
a₁ : α
b₁ : β
ha₁ : (a₁, b₁).1 ∈ s
hb₁ : (a₁, b₁).2 ∈ t
a₂ : α
b₂ : β
ha₂ : (a₂, b₂).1 ∈ s
hb₂ : (a₂, b₂).2 ∈ t
x : α
hx : x ∈ s
⊢ flip Prod.mk b₂ x ∈ s ×ˢ t

Next tactic:
exacts [⟨ha₁, hy⟩, ⟨hx, hb₂⟩]
theorem IsPreconnected.prod [TopologicalSpace β] {s : Set α} {t : Set β} (hs : IsPreconnected s)
    (ht : IsPreconnected t) : IsPreconnected (s ×ˢ t) := by
  apply isPreconnected_of_forall_pair
  rintro ⟨a₁, b₁⟩ ⟨ha₁, hb₁⟩ ⟨a₂, b₂⟩ ⟨ha₂, hb₂⟩
  refine' ⟨Prod.mk a₁ '' t ∪ flip Prod.mk b₂ '' s, _, .inl ⟨b₁, hb₁, rfl⟩, .inr ⟨a₂, ha₂, rfl⟩, _⟩
  · rintro _ (⟨y, hy, rfl⟩ | ⟨x, hx, rfl⟩)
    exacts [⟨ha₁, hy⟩, ⟨hx, hb₂⟩]
  · 

Proof state:
case H.mk.intro.mk.intro.refine'_2
α : Type u
β : Type v
ι : Type u_1
π : ι → Type u_2
inst✝¹ : TopologicalSpace α
s✝ t✝ u v : Set α
inst✝ : TopologicalSpace β
s : Set α
t : Set β
hs : IsPreconnected s
ht : IsPreconnected t
a₁ : α
b₁ : β
ha₁ : (a₁, b₁).1 ∈ s
hb₁ : (a₁, b₁).2 ∈ t
a₂ : α
b₂ : β
ha₂ : (a₂, b₂).1 ∈ s
hb₂ : (a₂, b₂).2 ∈ t
⊢ IsPreconnected (Prod.mk a₁ '' t ∪ flip Prod.mk b₂ '' s)

Next tactic:
exact (ht.image _ (Continuous.Prod.mk _).continuousOn).union (a₁, b₂) ⟨b₂, hb₂, rfl⟩
      ⟨a₁, ha₁, rfl⟩ (hs.image _ (continuous_id.prod_mk continuous_const).continuousOn)
theorem isPreconnected_univ_pi [∀ i, TopologicalSpace (π i)] {s : ∀ i, Set (π i)}
    (hs : ∀ i, IsPreconnected (s i)) : IsPreconnected (pi univ s) := by
  

Proof state:
α : Type u
β : Type v
ι : Type u_1
π : ι → Type u_2
inst✝¹ : TopologicalSpace α
s✝ t u v : Set α
inst✝ : (i : ι) → TopologicalSpace (π i)
s : (i : ι) → Set (π i)
hs : ∀ (i : ι), IsPreconnected (s i)
⊢ IsPreconnected (pi univ s)

Next tactic:
rintro u v uo vo hsuv ⟨f, hfs, hfu⟩ ⟨g, hgs, hgv⟩
theorem isPreconnected_univ_pi [∀ i, TopologicalSpace (π i)] {s : ∀ i, Set (π i)}
    (hs : ∀ i, IsPreconnected (s i)) : IsPreconnected (pi univ s) := by
  rintro u v uo vo hsuv ⟨f, hfs, hfu⟩ ⟨g, hgs, hgv⟩
  

Proof state:
case intro.intro.intro.intro
α : Type u
β : Type v
ι : Type u_1
π : ι → Type u_2
inst✝¹ : TopologicalSpace α
s✝ t u✝ v✝ : Set α
inst✝ : (i : ι) → TopologicalSpace (π i)
s : (i : ι) → Set (π i)
hs : ∀ (i : ι), IsPreconnected (s i)
u v : Set ((i : ι) → π i)
uo : IsOpen u
vo : IsOpen v
hsuv : pi univ s ⊆ u ∪ v
f : (i : ι) → π i
hfs : f ∈ pi univ s
hfu : f ∈ u
g : (i : ι) → π i
hgs : g ∈ pi univ s
hgv : g ∈ v
⊢ Set.Nonempty (pi univ s ∩ (u ∩ v))

Next tactic:
rcases exists_finset_piecewise_mem_of_mem_nhds (uo.mem_nhds hfu) g with ⟨I, hI⟩
theorem isPreconnected_univ_pi [∀ i, TopologicalSpace (π i)] {s : ∀ i, Set (π i)}
    (hs : ∀ i, IsPreconnected (s i)) : IsPreconnected (pi univ s) := by
  rintro u v uo vo hsuv ⟨f, hfs, hfu⟩ ⟨g, hgs, hgv⟩
  rcases exists_finset_piecewise_mem_of_mem_nhds (uo.mem_nhds hfu) g with ⟨I, hI⟩
  

Proof state:
case intro.intro.intro.intro.intro
α : Type u
β : Type v
ι : Type u_1
π : ι → Type u_2
inst✝¹ : TopologicalSpace α
s✝ t u✝ v✝ : Set α
inst✝ : (i : ι) → TopologicalSpace (π i)
s : (i : ι) → Set (π i)
hs : ∀ (i : ι), IsPreconnected (s i)
u v : Set ((i : ι) → π i)
uo : IsOpen u
vo : IsOpen v
hsuv : pi univ s ⊆ u ∪ v
f : (i : ι) → π i
hfs : f ∈ pi univ s
hfu : f ∈ u
g : (i : ι) → π i
hgs : g ∈ pi univ s
hgv : g ∈ v
I : Finset ι
hI : Finset.piecewise I f g ∈ u
⊢ Set.Nonempty (pi univ s ∩ (u ∩ v))

Next tactic:
induction' I using Finset.induction_on with i I _ ihI
theorem isPreconnected_univ_pi [∀ i, TopologicalSpace (π i)] {s : ∀ i, Set (π i)}
    (hs : ∀ i, IsPreconnected (s i)) : IsPreconnected (pi univ s) := by
  rintro u v uo vo hsuv ⟨f, hfs, hfu⟩ ⟨g, hgs, hgv⟩
  rcases exists_finset_piecewise_mem_of_mem_nhds (uo.mem_nhds hfu) g with ⟨I, hI⟩
  induction' I using Finset.induction_on with i I _ ihI
  · 

Proof state:
case intro.intro.intro.intro.intro.empty
α : Type u
β : Type v
ι : Type u_1
π : ι → Type u_2
inst✝¹ : TopologicalSpace α
s✝ t u✝ v✝ : Set α
inst✝ : (i : ι) → TopologicalSpace (π i)
s : (i : ι) → Set (π i)
hs : ∀ (i : ι), IsPreconnected (s i)
u v : Set ((i : ι) → π i)
uo : IsOpen u
vo : IsOpen v
hsuv : pi univ s ⊆ u ∪ v
f : (i : ι) → π i
hfs : f ∈ pi univ s
hfu : f ∈ u
g : (i : ι) → π i
hgs : g ∈ pi univ s
hgv : g ∈ v
hI : Finset.piecewise ∅ f g ∈ u
⊢ Set.Nonempty (pi univ s ∩ (u ∩ v))

Next tactic:
refine' ⟨g, hgs, ⟨_, hgv⟩⟩
theorem isPreconnected_univ_pi [∀ i, TopologicalSpace (π i)] {s : ∀ i, Set (π i)}
    (hs : ∀ i, IsPreconnected (s i)) : IsPreconnected (pi univ s) := by
  rintro u v uo vo hsuv ⟨f, hfs, hfu⟩ ⟨g, hgs, hgv⟩
  rcases exists_finset_piecewise_mem_of_mem_nhds (uo.mem_nhds hfu) g with ⟨I, hI⟩
  induction' I using Finset.induction_on with i I _ ihI
  · refine' ⟨g, hgs, ⟨_, hgv⟩⟩
    

Proof state:
case intro.intro.intro.intro.intro.empty
α : Type u
β : Type v
ι : Type u_1
π : ι → Type u_2
inst✝¹ : TopologicalSpace α
s✝ t u✝ v✝ : Set α
inst✝ : (i : ι) → TopologicalSpace (π i)
s : (i : ι) → Set (π i)
hs : ∀ (i : ι), IsPreconnected (s i)
u v : Set ((i : ι) → π i)
uo : IsOpen u
vo : IsOpen v
hsuv : pi univ s ⊆ u ∪ v
f : (i : ι) → π i
hfs : f ∈ pi univ s
hfu : f ∈ u
g : (i : ι) → π i
hgs : g ∈ pi univ s
hgv : g ∈ v
hI : Finset.piecewise ∅ f g ∈ u
⊢ g ∈ u

Next tactic:
simpa using hI
theorem isPreconnected_univ_pi [∀ i, TopologicalSpace (π i)] {s : ∀ i, Set (π i)}
    (hs : ∀ i, IsPreconnected (s i)) : IsPreconnected (pi univ s) := by
  rintro u v uo vo hsuv ⟨f, hfs, hfu⟩ ⟨g, hgs, hgv⟩
  rcases exists_finset_piecewise_mem_of_mem_nhds (uo.mem_nhds hfu) g with ⟨I, hI⟩
  induction' I using Finset.induction_on with i I _ ihI
  · refine' ⟨g, hgs, ⟨_, hgv⟩⟩
    simpa using hI
  · 

Proof state:
case intro.intro.intro.intro.intro.insert
α : Type u
β : Type v
ι : Type u_1
π : ι → Type u_2
inst✝¹ : TopologicalSpace α
s✝ t u✝ v✝ : Set α
inst✝ : (i : ι) → TopologicalSpace (π i)
s : (i : ι) → Set (π i)
hs : ∀ (i : ι), IsPreconnected (s i)
u v : Set ((i : ι) → π i)
uo : IsOpen u
vo : IsOpen v
hsuv : pi univ s ⊆ u ∪ v
f : (i : ι) → π i
hfs : f ∈ pi univ s
hfu : f ∈ u
g : (i : ι) → π i
hgs : g ∈ pi univ s
hgv : g ∈ v
i : ι
I : Finset ι
a✝ : i ∉ I
ihI : Finset.piecewise I f g ∈ u → Set.Nonempty (pi univ s ∩ (u ∩ v))
hI : Finset.piecewise (insert i I) f g ∈ u
⊢ Set.Nonempty (pi univ s ∩ (u ∩ v))

Next tactic:
rw [Finset.piecewise_insert] at hI
theorem isPreconnected_univ_pi [∀ i, TopologicalSpace (π i)] {s : ∀ i, Set (π i)}
    (hs : ∀ i, IsPreconnected (s i)) : IsPreconnected (pi univ s) := by
  rintro u v uo vo hsuv ⟨f, hfs, hfu⟩ ⟨g, hgs, hgv⟩
  rcases exists_finset_piecewise_mem_of_mem_nhds (uo.mem_nhds hfu) g with ⟨I, hI⟩
  induction' I using Finset.induction_on with i I _ ihI
  · refine' ⟨g, hgs, ⟨_, hgv⟩⟩
    simpa using hI
  · rw [Finset.piecewise_insert] at hI
    

Proof state:
case intro.intro.intro.intro.intro.insert
α : Type u
β : Type v
ι : Type u_1
π : ι → Type u_2
inst✝¹ : TopologicalSpace α
s✝ t u✝ v✝ : Set α
inst✝ : (i : ι) → TopologicalSpace (π i)
s : (i : ι) → Set (π i)
hs : ∀ (i : ι), IsPreconnected (s i)
u v : Set ((i : ι) → π i)
uo : IsOpen u
vo : IsOpen v
hsuv : pi univ s ⊆ u ∪ v
f : (i : ι) → π i
hfs : f ∈ pi univ s
hfu : f ∈ u
g : (i : ι) → π i
hgs : g ∈ pi univ s
hgv : g ∈ v
i : ι
I : Finset ι
a✝ : i ∉ I
ihI : Finset.piecewise I f g ∈ u → Set.Nonempty (pi univ s ∩ (u ∩ v))
hI : update (Finset.piecewise I f g) i (f i) ∈ u
⊢ Set.Nonempty (pi univ s ∩ (u ∩ v))

Next tactic:
have := I.piecewise_mem_set_pi hfs hgs
theorem isPreconnected_univ_pi [∀ i, TopologicalSpace (π i)] {s : ∀ i, Set (π i)}
    (hs : ∀ i, IsPreconnected (s i)) : IsPreconnected (pi univ s) := by
  rintro u v uo vo hsuv ⟨f, hfs, hfu⟩ ⟨g, hgs, hgv⟩
  rcases exists_finset_piecewise_mem_of_mem_nhds (uo.mem_nhds hfu) g with ⟨I, hI⟩
  induction' I using Finset.induction_on with i I _ ihI
  · refine' ⟨g, hgs, ⟨_, hgv⟩⟩
    simpa using hI
  · rw [Finset.piecewise_insert] at hI
    have := I.piecewise_mem_set_pi hfs hgs
    

Proof state:
case intro.intro.intro.intro.intro.insert
α : Type u
β : Type v
ι : Type u_1
π : ι → Type u_2
inst✝¹ : TopologicalSpace α
s✝ t u✝ v✝ : Set α
inst✝ : (i : ι) → TopologicalSpace (π i)
s : (i : ι) → Set (π i)
hs : ∀ (i : ι), IsPreconnected (s i)
u v : Set ((i : ι) → π i)
uo : IsOpen u
vo : IsOpen v
hsuv : pi univ s ⊆ u ∪ v
f : (i : ι) → π i
hfs : f ∈ pi univ s
hfu : f ∈ u
g : (i : ι) → π i
hgs : g ∈ pi univ s
hgv : g ∈ v
i : ι
I : Finset ι
a✝ : i ∉ I
ihI : Finset.piecewise I f g ∈ u → Set.Nonempty (pi univ s ∩ (u ∩ v))
hI : update (Finset.piecewise I f g) i (f i) ∈ u
this : Finset.piecewise I f g ∈ pi univ s
⊢ Set.Nonempty (pi univ s ∩ (u ∩ v))

Next tactic:
refine' (hsuv this).elim ihI fun h => _
theorem isPreconnected_univ_pi [∀ i, TopologicalSpace (π i)] {s : ∀ i, Set (π i)}
    (hs : ∀ i, IsPreconnected (s i)) : IsPreconnected (pi univ s) := by
  rintro u v uo vo hsuv ⟨f, hfs, hfu⟩ ⟨g, hgs, hgv⟩
  rcases exists_finset_piecewise_mem_of_mem_nhds (uo.mem_nhds hfu) g with ⟨I, hI⟩
  induction' I using Finset.induction_on with i I _ ihI
  · refine' ⟨g, hgs, ⟨_, hgv⟩⟩
    simpa using hI
  · rw [Finset.piecewise_insert] at hI
    have := I.piecewise_mem_set_pi hfs hgs
    refine' (hsuv this).elim ihI fun h => _
    

Proof state:
case intro.intro.intro.intro.intro.insert
α : Type u
β : Type v
ι : Type u_1
π : ι → Type u_2
inst✝¹ : TopologicalSpace α
s✝ t u✝ v✝ : Set α
inst✝ : (i : ι) → TopologicalSpace (π i)
s : (i : ι) → Set (π i)
hs : ∀ (i : ι), IsPreconnected (s i)
u v : Set ((i : ι) → π i)
uo : IsOpen u
vo : IsOpen v
hsuv : pi univ s ⊆ u ∪ v
f : (i : ι) → π i
hfs : f ∈ pi univ s
hfu : f ∈ u
g : (i : ι) → π i
hgs : g ∈ pi univ s
hgv : g ∈ v
i : ι
I : Finset ι
a✝ : i ∉ I
ihI : Finset.piecewise I f g ∈ u → Set.Nonempty (pi univ s ∩ (u ∩ v))
hI : update (Finset.piecewise I f g) i (f i) ∈ u
this : Finset.piecewise I f g ∈ pi univ s
h : Finset.piecewise I f g ∈ v
⊢ Set.Nonempty (pi univ s ∩ (u ∩ v))

Next tactic:
set S := update (I.piecewise f g) i '' s i
theorem isPreconnected_univ_pi [∀ i, TopologicalSpace (π i)] {s : ∀ i, Set (π i)}
    (hs : ∀ i, IsPreconnected (s i)) : IsPreconnected (pi univ s) := by
  rintro u v uo vo hsuv ⟨f, hfs, hfu⟩ ⟨g, hgs, hgv⟩
  rcases exists_finset_piecewise_mem_of_mem_nhds (uo.mem_nhds hfu) g with ⟨I, hI⟩
  induction' I using Finset.induction_on with i I _ ihI
  · refine' ⟨g, hgs, ⟨_, hgv⟩⟩
    simpa using hI
  · rw [Finset.piecewise_insert] at hI
    have := I.piecewise_mem_set_pi hfs hgs
    refine' (hsuv this).elim ihI fun h => _
    set S := update (I.piecewise f g) i '' s i
    

Proof state:
case intro.intro.intro.intro.intro.insert
α : Type u
β : Type v
ι : Type u_1
π : ι → Type u_2
inst✝¹ : TopologicalSpace α
s✝ t u✝ v✝ : Set α
inst✝ : (i : ι) → TopologicalSpace (π i)
s : (i : ι) → Set (π i)
hs : ∀ (i : ι), IsPreconnected (s i)
u v : Set ((i : ι) → π i)
uo : IsOpen u
vo : IsOpen v
hsuv : pi univ s ⊆ u ∪ v
f : (i : ι) → π i
hfs : f ∈ pi univ s
hfu : f ∈ u
g : (i : ι) → π i
hgs : g ∈ pi univ s
hgv : g ∈ v
i : ι
I : Finset ι
a✝ : i ∉ I
ihI : Finset.piecewise I f g ∈ u → Set.Nonempty (pi univ s ∩ (u ∩ v))
hI : update (Finset.piecewise I f g) i (f i) ∈ u
this : Finset.piecewise I f g ∈ pi univ s
h : Finset.piecewise I f g ∈ v
S : Set ((a : ι) → π a) := update (Finset.piecewise I f g) i '' s i
⊢ Set.Nonempty (pi univ s ∩ (u ∩ v))

Next tactic:
have hsub : S ⊆ pi univ s := by
      refine' image_subset_iff.2 fun z hz => _
      rwa [update_preimage_univ_pi]
      exact fun j _ => this j trivial
theorem isPreconnected_univ_pi [∀ i, TopologicalSpace (π i)] {s : ∀ i, Set (π i)}
    (hs : ∀ i, IsPreconnected (s i)) : IsPreconnected (pi univ s) := by
  rintro u v uo vo hsuv ⟨f, hfs, hfu⟩ ⟨g, hgs, hgv⟩
  rcases exists_finset_piecewise_mem_of_mem_nhds (uo.mem_nhds hfu) g with ⟨I, hI⟩
  induction' I using Finset.induction_on with i I _ ihI
  · refine' ⟨g, hgs, ⟨_, hgv⟩⟩
    simpa using hI
  · rw [Finset.piecewise_insert] at hI
    have := I.piecewise_mem_set_pi hfs hgs
    refine' (hsuv this).elim ihI fun h => _
    set S := update (I.piecewise f g) i '' s i
    have hsub : S ⊆ pi univ s := by
      

Proof state:
α : Type u
β : Type v
ι : Type u_1
π : ι → Type u_2
inst✝¹ : TopologicalSpace α
s✝ t u✝ v✝ : Set α
inst✝ : (i : ι) → TopologicalSpace (π i)
s : (i : ι) → Set (π i)
hs : ∀ (i : ι), IsPreconnected (s i)
u v : Set ((i : ι) → π i)
uo : IsOpen u
vo : IsOpen v
hsuv : pi univ s ⊆ u ∪ v
f : (i : ι) → π i
hfs : f ∈ pi univ s
hfu : f ∈ u
g : (i : ι) → π i
hgs : g ∈ pi univ s
hgv : g ∈ v
i : ι
I : Finset ι
a✝ : i ∉ I
ihI : Finset.piecewise I f g ∈ u → Set.Nonempty (pi univ s ∩ (u ∩ v))
hI : update (Finset.piecewise I f g) i (f i) ∈ u
this : Finset.piecewise I f g ∈ pi univ s
h : Finset.piecewise I f g ∈ v
S : Set ((a : ι) → π a) := update (Finset.piecewise I f g) i '' s i
⊢ S ⊆ pi univ s

Next tactic:
refine' image_subset_iff.2 fun z hz => _
theorem isPreconnected_univ_pi [∀ i, TopologicalSpace (π i)] {s : ∀ i, Set (π i)}
    (hs : ∀ i, IsPreconnected (s i)) : IsPreconnected (pi univ s) := by
  rintro u v uo vo hsuv ⟨f, hfs, hfu⟩ ⟨g, hgs, hgv⟩
  rcases exists_finset_piecewise_mem_of_mem_nhds (uo.mem_nhds hfu) g with ⟨I, hI⟩
  induction' I using Finset.induction_on with i I _ ihI
  · refine' ⟨g, hgs, ⟨_, hgv⟩⟩
    simpa using hI
  · rw [Finset.piecewise_insert] at hI
    have := I.piecewise_mem_set_pi hfs hgs
    refine' (hsuv this).elim ihI fun h => _
    set S := update (I.piecewise f g) i '' s i
    have hsub : S ⊆ pi univ s := by
      refine' image_subset_iff.2 fun z hz => _
      

Proof state:
α : Type u
β : Type v
ι : Type u_1
π : ι → Type u_2
inst✝¹ : TopologicalSpace α
s✝ t u✝ v✝ : Set α
inst✝ : (i : ι) → TopologicalSpace (π i)
s : (i : ι) → Set (π i)
hs : ∀ (i : ι), IsPreconnected (s i)
u v : Set ((i : ι) → π i)
uo : IsOpen u
vo : IsOpen v
hsuv : pi univ s ⊆ u ∪ v
f : (i : ι) → π i
hfs : f ∈ pi univ s
hfu : f ∈ u
g : (i : ι) → π i
hgs : g ∈ pi univ s
hgv : g ∈ v
i : ι
I : Finset ι
a✝ : i ∉ I
ihI : Finset.piecewise I f g ∈ u → Set.Nonempty (pi univ s ∩ (u ∩ v))
hI : update (Finset.piecewise I f g) i (f i) ∈ u
this : Finset.piecewise I f g ∈ pi univ s
h : Finset.piecewise I f g ∈ v
S : Set ((a : ι) → π a) := update (Finset.piecewise I f g) i '' s i
z : π i
hz : z ∈ s i
⊢ z ∈ update (Finset.piecewise I f g) i ⁻¹' pi univ s

Next tactic:
rwa [update_preimage_univ_pi]
theorem isPreconnected_univ_pi [∀ i, TopologicalSpace (π i)] {s : ∀ i, Set (π i)}
    (hs : ∀ i, IsPreconnected (s i)) : IsPreconnected (pi univ s) := by
  rintro u v uo vo hsuv ⟨f, hfs, hfu⟩ ⟨g, hgs, hgv⟩
  rcases exists_finset_piecewise_mem_of_mem_nhds (uo.mem_nhds hfu) g with ⟨I, hI⟩
  induction' I using Finset.induction_on with i I _ ihI
  · refine' ⟨g, hgs, ⟨_, hgv⟩⟩
    simpa using hI
  · rw [Finset.piecewise_insert] at hI
    have := I.piecewise_mem_set_pi hfs hgs
    refine' (hsuv this).elim ihI fun h => _
    set S := update (I.piecewise f g) i '' s i
    have hsub : S ⊆ pi univ s := by
      refine' image_subset_iff.2 fun z hz => _
      rwa [update_preimage_univ_pi]
      

Proof state:
α : Type u
β : Type v
ι : Type u_1
π : ι → Type u_2
inst✝¹ : TopologicalSpace α
s✝ t u✝ v✝ : Set α
inst✝ : (i : ι) → TopologicalSpace (π i)
s : (i : ι) → Set (π i)
hs : ∀ (i : ι), IsPreconnected (s i)
u v : Set ((i : ι) → π i)
uo : IsOpen u
vo : IsOpen v
hsuv : pi univ s ⊆ u ∪ v
f : (i : ι) → π i
hfs : f ∈ pi univ s
hfu : f ∈ u
g : (i : ι) → π i
hgs : g ∈ pi univ s
hgv : g ∈ v
i : ι
I : Finset ι
a✝ : i ∉ I
ihI : Finset.piecewise I f g ∈ u → Set.Nonempty (pi univ s ∩ (u ∩ v))
hI : update (Finset.piecewise I f g) i (f i) ∈ u
this : Finset.piecewise I f g ∈ pi univ s
h : Finset.piecewise I f g ∈ v
S : Set ((a : ι) → π a) := update (Finset.piecewise I f g) i '' s i
z : π i
hz : z ∈ s i
⊢ ∀ (j : ι), j ≠ i → Finset.piecewise I f g j ∈ s j

Next tactic:
exact fun j _ => this j trivial
theorem isPreconnected_univ_pi [∀ i, TopologicalSpace (π i)] {s : ∀ i, Set (π i)}
    (hs : ∀ i, IsPreconnected (s i)) : IsPreconnected (pi univ s) := by
  rintro u v uo vo hsuv ⟨f, hfs, hfu⟩ ⟨g, hgs, hgv⟩
  rcases exists_finset_piecewise_mem_of_mem_nhds (uo.mem_nhds hfu) g with ⟨I, hI⟩
  induction' I using Finset.induction_on with i I _ ihI
  · refine' ⟨g, hgs, ⟨_, hgv⟩⟩
    simpa using hI
  · rw [Finset.piecewise_insert] at hI
    have := I.piecewise_mem_set_pi hfs hgs
    refine' (hsuv this).elim ihI fun h => _
    set S := update (I.piecewise f g) i '' s i
    have hsub : S ⊆ pi univ s := by
      refine' image_subset_iff.2 fun z hz => _
      rwa [update_preimage_univ_pi]
      exact fun j _ => this j trivial
    

Proof state:
case intro.intro.intro.intro.intro.insert
α : Type u
β : Type v
ι : Type u_1
π : ι → Type u_2
inst✝¹ : TopologicalSpace α
s✝ t u✝ v✝ : Set α
inst✝ : (i : ι) → TopologicalSpace (π i)
s : (i : ι) → Set (π i)
hs : ∀ (i : ι), IsPreconnected (s i)
u v : Set ((i : ι) → π i)
uo : IsOpen u
vo : IsOpen v
hsuv : pi univ s ⊆ u ∪ v
f : (i : ι) → π i
hfs : f ∈ pi univ s
hfu : f ∈ u
g : (i : ι) → π i
hgs : g ∈ pi univ s
hgv : g ∈ v
i : ι
I : Finset ι
a✝ : i ∉ I
ihI : Finset.piecewise I f g ∈ u → Set.Nonempty (pi univ s ∩ (u ∩ v))
hI : update (Finset.piecewise I f g) i (f i) ∈ u
this : Finset.piecewise I f g ∈ pi univ s
h : Finset.piecewise I f g ∈ v
S : Set ((a : ι) → π a) := update (Finset.piecewise I f g) i '' s i
hsub : S ⊆ pi univ s
⊢ Set.Nonempty (pi univ s ∩ (u ∩ v))

Next tactic:
have hconn : IsPreconnected S :=
      (hs i).image _ (continuous_const.update i continuous_id).continuousOn
theorem isPreconnected_univ_pi [∀ i, TopologicalSpace (π i)] {s : ∀ i, Set (π i)}
    (hs : ∀ i, IsPreconnected (s i)) : IsPreconnected (pi univ s) := by
  rintro u v uo vo hsuv ⟨f, hfs, hfu⟩ ⟨g, hgs, hgv⟩
  rcases exists_finset_piecewise_mem_of_mem_nhds (uo.mem_nhds hfu) g with ⟨I, hI⟩
  induction' I using Finset.induction_on with i I _ ihI
  · refine' ⟨g, hgs, ⟨_, hgv⟩⟩
    simpa using hI
  · rw [Finset.piecewise_insert] at hI
    have := I.piecewise_mem_set_pi hfs hgs
    refine' (hsuv this).elim ihI fun h => _
    set S := update (I.piecewise f g) i '' s i
    have hsub : S ⊆ pi univ s := by
      refine' image_subset_iff.2 fun z hz => _
      rwa [update_preimage_univ_pi]
      exact fun j _ => this j trivial
    have hconn : IsPreconnected S :=
      (hs i).image _ (continuous_const.update i continuous_id).continuousOn
    

Proof state:
case intro.intro.intro.intro.intro.insert
α : Type u
β : Type v
ι : Type u_1
π : ι → Type u_2
inst✝¹ : TopologicalSpace α
s✝ t u✝ v✝ : Set α
inst✝ : (i : ι) → TopologicalSpace (π i)
s : (i : ι) → Set (π i)
hs : ∀ (i : ι), IsPreconnected (s i)
u v : Set ((i : ι) → π i)
uo : IsOpen u
vo : IsOpen v
hsuv : pi univ s ⊆ u ∪ v
f : (i : ι) → π i
hfs : f ∈ pi univ s
hfu : f ∈ u
g : (i : ι) → π i
hgs : g ∈ pi univ s
hgv : g ∈ v
i : ι
I : Finset ι
a✝ : i ∉ I
ihI : Finset.piecewise I f g ∈ u → Set.Nonempty (pi univ s ∩ (u ∩ v))
hI : update (Finset.piecewise I f g) i (f i) ∈ u
this : Finset.piecewise I f g ∈ pi univ s
h : Finset.piecewise I f g ∈ v
S : Set ((a : ι) → π a) := update (Finset.piecewise I f g) i '' s i
hsub : S ⊆ pi univ s
hconn : IsPreconnected S
⊢ Set.Nonempty (pi univ s ∩ (u ∩ v))

Next tactic:
have hSu : (S ∩ u).Nonempty := ⟨_, mem_image_of_mem _ (hfs _ trivial), hI⟩
theorem isPreconnected_univ_pi [∀ i, TopologicalSpace (π i)] {s : ∀ i, Set (π i)}
    (hs : ∀ i, IsPreconnected (s i)) : IsPreconnected (pi univ s) := by
  rintro u v uo vo hsuv ⟨f, hfs, hfu⟩ ⟨g, hgs, hgv⟩
  rcases exists_finset_piecewise_mem_of_mem_nhds (uo.mem_nhds hfu) g with ⟨I, hI⟩
  induction' I using Finset.induction_on with i I _ ihI
  · refine' ⟨g, hgs, ⟨_, hgv⟩⟩
    simpa using hI
  · rw [Finset.piecewise_insert] at hI
    have := I.piecewise_mem_set_pi hfs hgs
    refine' (hsuv this).elim ihI fun h => _
    set S := update (I.piecewise f g) i '' s i
    have hsub : S ⊆ pi univ s := by
      refine' image_subset_iff.2 fun z hz => _
      rwa [update_preimage_univ_pi]
      exact fun j _ => this j trivial
    have hconn : IsPreconnected S :=
      (hs i).image _ (continuous_const.update i continuous_id).continuousOn
    have hSu : (S ∩ u).Nonempty := ⟨_, mem_image_of_mem _ (hfs _ trivial), hI⟩
    

Proof state:
case intro.intro.intro.intro.intro.insert
α : Type u
β : Type v
ι : Type u_1
π : ι → Type u_2
inst✝¹ : TopologicalSpace α
s✝ t u✝ v✝ : Set α
inst✝ : (i : ι) → TopologicalSpace (π i)
s : (i : ι) → Set (π i)
hs : ∀ (i : ι), IsPreconnected (s i)
u v : Set ((i : ι) → π i)
uo : IsOpen u
vo : IsOpen v
hsuv : pi univ s ⊆ u ∪ v
f : (i : ι) → π i
hfs : f ∈ pi univ s
hfu : f ∈ u
g : (i : ι) → π i
hgs : g ∈ pi univ s
hgv : g ∈ v
i : ι
I : Finset ι
a✝ : i ∉ I
ihI : Finset.piecewise I f g ∈ u → Set.Nonempty (pi univ s ∩ (u ∩ v))
hI : update (Finset.piecewise I f g) i (f i) ∈ u
this : Finset.piecewise I f g ∈ pi univ s
h : Finset.piecewise I f g ∈ v
S : Set ((a : ι) → π a) := update (Finset.piecewise I f g) i '' s i
hsub : S ⊆ pi univ s
hconn : IsPreconnected S
hSu : Set.Nonempty (S ∩ u)
⊢ Set.Nonempty (pi univ s ∩ (u ∩ v))

Next tactic:
have hSv : (S ∩ v).Nonempty := ⟨_, ⟨_, this _ trivial, update_eq_self _ _⟩, h⟩
theorem isPreconnected_univ_pi [∀ i, TopologicalSpace (π i)] {s : ∀ i, Set (π i)}
    (hs : ∀ i, IsPreconnected (s i)) : IsPreconnected (pi univ s) := by
  rintro u v uo vo hsuv ⟨f, hfs, hfu⟩ ⟨g, hgs, hgv⟩
  rcases exists_finset_piecewise_mem_of_mem_nhds (uo.mem_nhds hfu) g with ⟨I, hI⟩
  induction' I using Finset.induction_on with i I _ ihI
  · refine' ⟨g, hgs, ⟨_, hgv⟩⟩
    simpa using hI
  · rw [Finset.piecewise_insert] at hI
    have := I.piecewise_mem_set_pi hfs hgs
    refine' (hsuv this).elim ihI fun h => _
    set S := update (I.piecewise f g) i '' s i
    have hsub : S ⊆ pi univ s := by
      refine' image_subset_iff.2 fun z hz => _
      rwa [update_preimage_univ_pi]
      exact fun j _ => this j trivial
    have hconn : IsPreconnected S :=
      (hs i).image _ (continuous_const.update i continuous_id).continuousOn
    have hSu : (S ∩ u).Nonempty := ⟨_, mem_image_of_mem _ (hfs _ trivial), hI⟩
    have hSv : (S ∩ v).Nonempty := ⟨_, ⟨_, this _ trivial, update_eq_self _ _⟩, h⟩
    

Proof state:
case intro.intro.intro.intro.intro.insert
α : Type u
β : Type v
ι : Type u_1
π : ι → Type u_2
inst✝¹ : TopologicalSpace α
s✝ t u✝ v✝ : Set α
inst✝ : (i : ι) → TopologicalSpace (π i)
s : (i : ι) → Set (π i)
hs : ∀ (i : ι), IsPreconnected (s i)
u v : Set ((i : ι) → π i)
uo : IsOpen u
vo : IsOpen v
hsuv : pi univ s ⊆ u ∪ v
f : (i : ι) → π i
hfs : f ∈ pi univ s
hfu : f ∈ u
g : (i : ι) → π i
hgs : g ∈ pi univ s
hgv : g ∈ v
i : ι
I : Finset ι
a✝ : i ∉ I
ihI : Finset.piecewise I f g ∈ u → Set.Nonempty (pi univ s ∩ (u ∩ v))
hI : update (Finset.piecewise I f g) i (f i) ∈ u
this : Finset.piecewise I f g ∈ pi univ s
h : Finset.piecewise I f g ∈ v
S : Set ((a : ι) → π a) := update (Finset.piecewise I f g) i '' s i
hsub : S ⊆ pi univ s
hconn : IsPreconnected S
hSu : Set.Nonempty (S ∩ u)
hSv : Set.Nonempty (S ∩ v)
⊢ Set.Nonempty (pi univ s ∩ (u ∩ v))

Next tactic:
refine' (hconn u v uo vo (hsub.trans hsuv) hSu hSv).mono _