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

tactic: constructor
state_before: α β γ : 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
state_after: case mp
α β γ : 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

case mpr
α β γ : 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: induction fs generalizing t with
| nil =>
  simp only [sequence, mem_pure, imp_self, forall₂_nil_left_iff, exists_eq_left, Set.pure_def,
    singleton_subset_iff, traverse_nil]
| 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
α β γ : 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
state_after: no goals

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: case mp.nil
α β γ : Type u
f : β → Filter α
s : γ → Set α
t : Set (List α)
⊢ t ∈ traverse f [] → ∃ us, Forall₂ (fun b s => s ∈ f b) [] us ∧ sequence us ⊆ t
state_after: no goals

tactic: intro ht
state_before: case mp.cons
α β γ : Type u
f : β → Filter α
s : γ → Set α
b : β
fs : List β
ih : ∀ 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
state_after: case mp.cons
α β γ : Type u
f : β → Filter α
s : γ → Set α
b : β
fs : List β
ih : ∀ 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_seq_iff.1 ht with ⟨u, hu, v, hv, ht⟩
state_before: case mp.cons
α β γ : Type u
f : β → Filter α
s : γ → Set α
b : β
fs : List β
ih : ∀ 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
state_after: case mp.cons.intro.intro.intro.intro
α β γ : Type u
f : β → Filter α
s : γ → Set α
b : β
fs : List β
ih : ∀ 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 : u.seq v ⊆ t
⊢ ∃ 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 mp.cons.intro.intro.intro.intro
α β γ : Type u
f : β → Filter α
s : γ → Set α
b : β
fs : List β
ih : ∀ 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 : u.seq v ⊆ t
⊢ ∃ us, Forall₂ (fun b s => s ∈ f b) (b :: fs) us ∧ sequence us ⊆ t
state_after: case mp.cons.intro.intro.intro.intro.intro.intro
α β γ : Type u
f : β → Filter α
s : γ → Set α
b : β
fs : List β
ih : ∀ 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 : u.seq 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: rcases ih v hv with ⟨us, hus, hu⟩
state_before: case mp.cons.intro.intro.intro.intro.intro.intro
α β γ : Type u
f : β → Filter α
s : γ → Set α
b : β
fs : List β
ih : ∀ 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 : u.seq 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
state_after: case mp.cons.intro.intro.intro.intro.intro.intro.intro.intro
α β γ : Type u
f : β → Filter α
s : γ → Set α
b : β
fs : List β
ih : ∀ 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 : u.seq 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: exact ⟨w::us, Forall₂.cons hw hus, (Set.seq_mono hwu hu).trans ht⟩
state_before: case mp.cons.intro.intro.intro.intro.intro.intro.intro.intro
α β γ : Type u
f : β → Filter α
s : γ → Set α
b : β
fs : List β
ih : ∀ 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 : u.seq 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
state_after: no goals

tactic: rintro ⟨us, hus, hs⟩
state_before: case mpr
α β γ : 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
state_after: case mpr.intro.intro
α β γ : 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

tactic: exact mem_of_superset (mem_traverse _ _ hus) hs
state_before: case mpr.intro.intro
α β γ : 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
state_after: no goals