Theorem: Filter.mem_traverse_iff
File: Mathlib/Order/Filter/Basic.lean

tactic: constructor
state_before: α : Type u
β : Type v
γ : Type w
δ : Type ?u.305467
ι : Sort x
α' β' γ' : Type u
f : β' → Filter α'
s : γ' → Set α'
fs : List β'
t : Set (List α')
⊢ t ∈ traverse f fs ↔ ∃ us, Forall₂ (fun b s => s ∈ f b) fs us ∧ sequence us ⊆ t

tactic: induction fs generalizing t
state_before: case mp
α : Type u
β : Type v
γ : Type w
δ : Type ?u.305467
ι : Sort x
α' β' γ' : Type u
f : β' → Filter α'
s : γ' → Set α'
fs : List β'
t : Set (List α')
⊢ t ∈ traverse f fs → ∃ us, Forall₂ (fun b s => s ∈ f b) fs us ∧ sequence us ⊆ t

tactic: case nil =>
  simp only [sequence, mem_pure, imp_self, forall₂_nil_left_iff, exists_eq_left, Set.pure_def,
    singleton_subset_iff, traverse_nil]
state_before: case mp.nil
α : Type u
β : Type v
γ : Type w
δ : Type ?u.305467
ι : Sort x
α' β' γ' : Type u
f : β' → Filter α'
s : γ' → Set α'
t : Set (List α')
⊢ t ∈ traverse f [] → ∃ us, Forall₂ (fun b s => s ∈ f b) [] us ∧ sequence us ⊆ t

case mp.cons
α : Type u
β : Type v
γ : Type w
δ : Type ?u.305467
ι : Sort x
α' β' γ' : Type u
f : β' → Filter α'
s : γ' → Set α'
head✝ : β'
tail✝ : List β'
tail_ih✝ : ∀ (t : Set (List α')), t ∈ traverse f tail✝ → ∃ us, Forall₂ (fun b s => s ∈ f b) tail✝ us ∧ sequence us ⊆ t
t : Set (List α')
⊢ t ∈ traverse f (head✝ :: tail✝) → ∃ us, Forall₂ (fun b s => s ∈ f b) (head✝ :: tail✝) us ∧ sequence us ⊆ t

tactic: case cons b fs ih =>
  intro ht
  rcases mem_seq_iff.1 ht with ⟨u, hu, v, hv, ht⟩
  rcases mem_map_iff_exists_image.1 hu with ⟨w, hw, hwu⟩
  rcases ih v hv with ⟨us, hus, hu⟩
  exact ⟨w::us, Forall₂.cons hw hus, (Set.seq_mono hwu hu).trans ht⟩
state_before: case mp.cons
α : Type u
β : Type v
γ : Type w
δ : Type ?u.305467
ι : Sort x
α' β' γ' : Type u
f : β' → Filter α'
s : γ' → Set α'
head✝ : β'
tail✝ : List β'
tail_ih✝ : ∀ (t : Set (List α')), t ∈ traverse f tail✝ → ∃ us, Forall₂ (fun b s => s ∈ f b) tail✝ us ∧ sequence us ⊆ t
t : Set (List α')
⊢ t ∈ traverse f (head✝ :: tail✝) → ∃ us, Forall₂ (fun b s => s ∈ f b) (head✝ :: tail✝) us ∧ sequence us ⊆ t

tactic: simp only [sequence, mem_pure, imp_self, forall₂_nil_left_iff, exists_eq_left, Set.pure_def,
  singleton_subset_iff, traverse_nil]
state_before: α : Type u
β : Type v
γ : Type w
δ : Type ?u.305467
ι : Sort x
α' β' γ' : Type u
f : β' → Filter α'
s : γ' → Set α'
t : Set (List α')
⊢ t ∈ traverse f [] → ∃ us, Forall₂ (fun b s => s ∈ f b) [] us ∧ sequence us ⊆ t

tactic: intro ht
state_before: α : Type u
β : Type v
γ : Type w
δ : Type ?u.305467
ι : Sort x
α' β' γ' : Type u
f : β' → Filter α'
s : γ' → Set α'
b : β'
fs : List β'
ih : ∀ (t : Set (List α')), t ∈ traverse f fs → ∃ us, Forall₂ (fun b s => s ∈ f b) fs us ∧ sequence us ⊆ t
t : Set (List α')
⊢ t ∈ traverse f (b :: fs) → ∃ us, Forall₂ (fun b s => s ∈ f b) (b :: fs) us ∧ sequence us ⊆ t

tactic: rcases mem_seq_iff.1 ht with ⟨u, hu, v, hv, ht⟩
state_before: α : Type u
β : Type v
γ : Type w
δ : Type ?u.305467
ι : Sort x
α' β' γ' : Type u
f : β' → Filter α'
s : γ' → Set α'
b : β'
fs : List β'
ih : ∀ (t : Set (List α')), t ∈ traverse f fs → ∃ us, Forall₂ (fun b s => s ∈ f b) fs us ∧ sequence us ⊆ t
t : Set (List α')
ht : t ∈ traverse f (b :: fs)
⊢ ∃ us, Forall₂ (fun b s => s ∈ f b) (b :: fs) us ∧ sequence us ⊆ t

tactic: rcases mem_map_iff_exists_image.1 hu with ⟨w, hw, hwu⟩
state_before: case intro.intro.intro.intro
α : Type u
β : Type v
γ : Type w
δ : Type ?u.305467
ι : Sort x
α' β' γ' : Type u
f : β' → Filter α'
s : γ' → Set α'
b : β'
fs : List β'
ih : ∀ (t : Set (List α')), t ∈ traverse f fs → ∃ us, Forall₂ (fun b s => s ∈ f b) fs us ∧ sequence us ⊆ t
t : Set (List α')
ht✝ : t ∈ traverse f (b :: fs)
u : Set (List α' → List α')
hu : u ∈ cons <$> f b
v : Set (List α')
hv : v ∈ (fun x => List.traverse f fs) ()
ht : Set.seq u v ⊆ t
⊢ ∃ us, Forall₂ (fun b s => s ∈ f b) (b :: fs) us ∧ sequence us ⊆ t

tactic: rcases ih v hv with ⟨us, hus, hu⟩
state_before: case intro.intro.intro.intro.intro.intro
α : Type u
β : Type v
γ : Type w
δ : Type ?u.305467
ι : Sort x
α' β' γ' : Type u
f : β' → Filter α'
s : γ' → Set α'
b : β'
fs : List β'
ih : ∀ (t : Set (List α')), t ∈ traverse f fs → ∃ us, Forall₂ (fun b s => s ∈ f b) fs us ∧ sequence us ⊆ t
t : Set (List α')
ht✝ : t ∈ traverse f (b :: fs)
u : Set (List α' → List α')
hu : u ∈ cons <$> f b
v : Set (List α')
hv : v ∈ (fun x => List.traverse f fs) ()
ht : Set.seq u v ⊆ t
w : Set α'
hw : w ∈ f b
hwu : cons '' w ⊆ u
⊢ ∃ us, Forall₂ (fun b s => s ∈ f b) (b :: fs) us ∧ sequence us ⊆ t

tactic: exact ⟨w::us, Forall₂.cons hw hus, (Set.seq_mono hwu hu).trans ht⟩
state_before: case intro.intro.intro.intro.intro.intro.intro.intro
α : Type u
β : Type v
γ : Type w
δ : Type ?u.305467
ι : Sort x
α' β' γ' : Type u
f : β' → Filter α'
s : γ' → Set α'
b : β'
fs : List β'
ih : ∀ (t : Set (List α')), t ∈ traverse f fs → ∃ us, Forall₂ (fun b s => s ∈ f b) fs us ∧ sequence us ⊆ t
t : Set (List α')
ht✝ : t ∈ traverse f (b :: fs)
u : Set (List α' → List α')
hu✝ : u ∈ cons <$> f b
v : Set (List α')
hv : v ∈ (fun x => List.traverse f fs) ()
ht : Set.seq u v ⊆ t
w : Set α'
hw : w ∈ f b
hwu : cons '' w ⊆ u
us : List (Set α')
hus : Forall₂ (fun b s => s ∈ f b) fs us
hu : sequence us ⊆ v
⊢ ∃ us, Forall₂ (fun b s => s ∈ f b) (b :: fs) us ∧ sequence us ⊆ t

tactic: rintro ⟨us, hus, hs⟩
state_before: case mpr
α : Type u
β : Type v
γ : Type w
δ : Type ?u.305467
ι : Sort x
α' β' γ' : Type u
f : β' → Filter α'
s : γ' → Set α'
fs : List β'
t : Set (List α')
⊢ (∃ us, Forall₂ (fun b s => s ∈ f b) fs us ∧ sequence us ⊆ t) → t ∈ traverse f fs

tactic: exact mem_of_superset (mem_traverse _ _ hus) hs
state_before: case mpr.intro.intro
α : Type u
β : Type v
γ : Type w
δ : Type ?u.305467
ι : Sort x
α' β' γ' : Type u
f : β' → Filter α'
s : γ' → Set α'
fs : List β'
t : Set (List α')
us : List (Set α')
hus : Forall₂ (fun b s => s ∈ f b) fs us
hs : sequence us ⊆ t
⊢ t ∈ traverse f fs