Theorem: Function.Injective.map_atTop_finset_prod_eq
File: Mathlib/Order/Filter/AtTopBot.lean

tactic: haveI := Classical.decEq β
state_before: ι : Type ?u.378253
ι' : Type ?u.378256
α : Type u_1
β : Type u_3
γ : Type u_2
inst✝ : CommMonoid α
g : γ → β
hg : Injective g
f : β → α
hf : ∀ (x : β), ¬x ∈ Set.range g → f x = 1
⊢ Filter.map (fun s => ∏ i in s, f (g i)) atTop = Filter.map (fun s => ∏ i in s, f i) atTop

tactic: apply le_antisymm <;> refine' map_atTop_finset_prod_le_of_prod_eq fun s => _
state_before: ι : Type ?u.378253
ι' : Type ?u.378256
α : Type u_1
β : Type u_3
γ : Type u_2
inst✝ : CommMonoid α
g : γ → β
hg : Injective g
f : β → α
hf : ∀ (x : β), ¬x ∈ Set.range g → f x = 1
this : DecidableEq β
⊢ Filter.map (fun s => ∏ i in s, f (g i)) atTop = Filter.map (fun s => ∏ i in s, f i) atTop

tactic: refine' ⟨s.preimage g (hg.injOn _), fun t ht => _⟩
state_before: case a
ι : Type ?u.378253
ι' : Type ?u.378256
α : Type u_1
β : Type u_3
γ : Type u_2
inst✝ : CommMonoid α
g : γ → β
hg : Injective g
f : β → α
hf : ∀ (x : β), ¬x ∈ Set.range g → f x = 1
this : DecidableEq β
s : Finset β
⊢ ∃ v, ∀ (v' : Finset γ), v ⊆ v' → ∃ u', s ⊆ u' ∧ ∏ x in u', f x = ∏ b in v', f (g b)

tactic: refine' ⟨t.image g ∪ s, Finset.subset_union_right _ _, _⟩
state_before: case a
ι : Type ?u.378253
ι' : Type ?u.378256
α : Type u_1
β : Type u_3
γ : Type u_2
inst✝ : CommMonoid α
g : γ → β
hg : Injective g
f : β → α
hf : ∀ (x : β), ¬x ∈ Set.range g → f x = 1
this : DecidableEq β
s : Finset β
t : Finset γ
ht : Finset.preimage s g (_ : InjOn g (g ⁻¹' ↑s)) ⊆ t
⊢ ∃ u', s ⊆ u' ∧ ∏ x in u', f x = ∏ b in t, f (g b)

tactic: rw [← Finset.prod_image (hg.injOn _)]
state_before: case a
ι : Type ?u.378253
ι' : Type ?u.378256
α : Type u_1
β : Type u_3
γ : Type u_2
inst✝ : CommMonoid α
g : γ → β
hg : Injective g
f : β → α
hf : ∀ (x : β), ¬x ∈ Set.range g → f x = 1
this : DecidableEq β
s : Finset β
t : Finset γ
ht : Finset.preimage s g (_ : InjOn g (g ⁻¹' ↑s)) ⊆ t
⊢ ∏ x in Finset.image g t ∪ s, f x = ∏ b in t, f (g b)

tactic: refine' (prod_subset (subset_union_left _ _) _).symm
state_before: case a
ι : Type ?u.378253
ι' : Type ?u.378256
α : Type u_1
β : Type u_3
γ : Type u_2
inst✝ : CommMonoid α
g : γ → β
hg : Injective g
f : β → α
hf : ∀ (x : β), ¬x ∈ Set.range g → f x = 1
this : DecidableEq β
s : Finset β
t : Finset γ
ht : Finset.preimage s g (_ : InjOn g (g ⁻¹' ↑s)) ⊆ t
⊢ ∏ x in Finset.image g t ∪ s, f x = ∏ x in Finset.image (fun x => g x) t, f x

tactic: simp only [Finset.mem_union, Finset.mem_image]
state_before: case a
ι : Type ?u.378253
ι' : Type ?u.378256
α : Type u_1
β : Type u_3
γ : Type u_2
inst✝ : CommMonoid α
g : γ → β
hg : Injective g
f : β → α
hf : ∀ (x : β), ¬x ∈ Set.range g → f x = 1
this : DecidableEq β
s : Finset β
t : Finset γ
ht : Finset.preimage s g (_ : InjOn g (g ⁻¹' ↑s)) ⊆ t
⊢ ∀ (x : β), x ∈ Finset.image g t ∪ s → ¬x ∈ Finset.image g t → f x = 1

tactic: refine' fun y hy hyt => hf y (mt _ hyt)
state_before: case a
ι : Type ?u.378253
ι' : Type ?u.378256
α : Type u_1
β : Type u_3
γ : Type u_2
inst✝ : CommMonoid α
g : γ → β
hg : Injective g
f : β → α
hf : ∀ (x : β), ¬x ∈ Set.range g → f x = 1
this : DecidableEq β
s : Finset β
t : Finset γ
ht : Finset.preimage s g (_ : InjOn g (g ⁻¹' ↑s)) ⊆ t
⊢ ∀ (x : β), (∃ a, a ∈ t ∧ g a = x) ∨ x ∈ s → (¬∃ a, a ∈ t ∧ g a = x) → f x = 1

tactic: rintro ⟨x, rfl⟩
state_before: case a
ι : Type ?u.378253
ι' : Type ?u.378256
α : Type u_1
β : Type u_3
γ : Type u_2
inst✝ : CommMonoid α
g : γ → β
hg : Injective g
f : β → α
hf : ∀ (x : β), ¬x ∈ Set.range g → f x = 1
this : DecidableEq β
s : Finset β
t : Finset γ
ht : Finset.preimage s g (_ : InjOn g (g ⁻¹' ↑s)) ⊆ t
y : β
hy : (∃ a, a ∈ t ∧ g a = y) ∨ y ∈ s
hyt : ¬∃ a, a ∈ t ∧ g a = y
⊢ y ∈ Set.range g → ∃ a, a ∈ t ∧ g a = y

tactic: exact ⟨x, ht (Finset.mem_preimage.2 <| hy.resolve_left hyt), rfl⟩
state_before: case a.intro
ι : Type ?u.378253
ι' : Type ?u.378256
α : Type u_1
β : Type u_3
γ : Type u_2
inst✝ : CommMonoid α
g : γ → β
hg : Injective g
f : β → α
hf : ∀ (x : β), ¬x ∈ Set.range g → f x = 1
this : DecidableEq β
s : Finset β
t : Finset γ
ht : Finset.preimage s g (_ : InjOn g (g ⁻¹' ↑s)) ⊆ t
x : γ
hy : (∃ a, a ∈ t ∧ g a = g x) ∨ g x ∈ s
hyt : ¬∃ a, a ∈ t ∧ g a = g x
⊢ ∃ a, a ∈ t ∧ g a = g x

tactic: refine' ⟨s.image g, fun t ht => _⟩
state_before: case a
ι : Type ?u.378253
ι' : Type ?u.378256
α : Type u_1
β : Type u_3
γ : Type u_2
inst✝ : CommMonoid α
g : γ → β
hg : Injective g
f : β → α
hf : ∀ (x : β), ¬x ∈ Set.range g → f x = 1
this : DecidableEq β
s : Finset γ
⊢ ∃ v, ∀ (v' : Finset β), v ⊆ v' → ∃ u', s ⊆ u' ∧ ∏ x in u', f (g x) = ∏ b in v', f b

tactic: simp only [← prod_preimage _ _ (hg.injOn _) _ fun x _ => hf x]
state_before: case a
ι : Type ?u.378253
ι' : Type ?u.378256
α : Type u_1
β : Type u_3
γ : Type u_2
inst✝ : CommMonoid α
g : γ → β
hg : Injective g
f : β → α
hf : ∀ (x : β), ¬x ∈ Set.range g → f x = 1
this : DecidableEq β
s : Finset γ
t : Finset β
ht : Finset.image g s ⊆ t
⊢ ∃ u', s ⊆ u' ∧ ∏ x in u', f (g x) = ∏ b in t, f b

tactic: exact ⟨_, (image_subset_iff_subset_preimage _).1 ht, rfl⟩
state_before: case a
ι : Type ?u.378253
ι' : Type ?u.378256
α : Type u_1
β : Type u_3
γ : Type u_2
inst✝ : CommMonoid α
g : γ → β
hg : Injective g
f : β → α
hf : ∀ (x : β), ¬x ∈ Set.range g → f x = 1
this : DecidableEq β
s : Finset γ
t : Finset β
ht : Finset.image g s ⊆ t
⊢ ∃ u', s ⊆ u' ∧ ∏ x in u', f (g x) = ∏ x in Finset.preimage t g (_ : InjOn g (g ⁻¹' ↑t)), f (g x)