Theorem: SatisfiesM.seq
File: Std/Classes/LawfulMonad.lean

tactic: match f, x, hf, hx with | _, _, ⟨f, rfl⟩, ⟨x, rfl⟩ => ?_
state_before: m : Type u_1 → Type u_2
α α✝ : Type u_1
p₁ : (α → α✝) → Prop
f : m (α → α✝)
p₂ : α → Prop
q : α✝ → Prop
inst✝¹ : Applicative m
inst✝ : LawfulApplicative m
x : m α
hf : SatisfiesM p₁ f
hx : SatisfiesM p₂ x
H : ∀ {f : α → α✝} {a : α}, p₁ f → p₂ a → q (f a)
⊢ SatisfiesM q (Seq.seq f fun x_1 => x)

tactic: refine ⟨(fun ⟨a, h₁⟩ ⟨b, h₂⟩ => ⟨a b, H h₁ h₂⟩) <$> f <*> x, ?_⟩
state_before: m : Type u_1 → Type u_2
α α✝ : Type u_1
p₁ : (α → α✝) → Prop
f✝ : m (α → α✝)
p₂ : α → Prop
q : α✝ → Prop
inst✝¹ : Applicative m
inst✝ : LawfulApplicative m
x✝ : m α
hf : SatisfiesM p₁ f✝
hx : SatisfiesM p₂ x✝
H : ∀ {f : α → α✝} {a : α}, p₁ f → p₂ a → q (f a)
f : m { a // p₁ a }
x : m { a // p₂ a }
⊢ SatisfiesM q (Seq.seq (Subtype.val <$> f) fun x_1 => Subtype.val <$> x)

tactic: simp only [← pure_seq]
state_before: m : Type u_1 → Type u_2
α α✝ : Type u_1
p₁ : (α → α✝) → Prop
f✝ : m (α → α✝)
p₂ : α → Prop
q : α✝ → Prop
inst✝¹ : Applicative m
inst✝ : LawfulApplicative m
x✝ : m α
hf : SatisfiesM p₁ f✝
hx : SatisfiesM p₂ x✝
H : ∀ {f : α → α✝} {a : α}, p₁ f → p₂ a → q (f a)
f : m { a // p₁ a }
x : m { a // p₂ a }
⊢ (Subtype.val <$>
      Seq.seq
        ((fun x x_1 =>
            match x with
            | { val := a, property := h₁ } =>
              match x_1 with
              | { val := b, property := h₂ } => { val := a b, property := (_ : q (a b)) }) <$>
          f)
        fun x_1 => x) =
    Seq.seq (Subtype.val <$> f) fun x_1 => Subtype.val <$> x

tactic: simp [SatisfiesM, seq_assoc]
state_before: m : Type u_1 → Type u_2
α α✝ : Type u_1
p₁ : (α → α✝) → Prop
f✝ : m (α → α✝)
p₂ : α → Prop
q : α✝ → Prop
inst✝¹ : Applicative m
inst✝ : LawfulApplicative m
x✝ : m α
hf : SatisfiesM p₁ f✝
hx : SatisfiesM p₂ x✝
H : ∀ {f : α → α✝} {a : α}, p₁ f → p₂ a → q (f a)
f : m { a // p₁ a }
x : m { a // p₂ a }
⊢ (Seq.seq (pure Subtype.val) fun x_1 =>
      Seq.seq
        (Seq.seq (pure fun x x_2 => { val := Subtype.val x x_2.val, property := (_ : q (Subtype.val x x_2.val)) })
          fun x => f)
        fun x_2 => x) =
    Seq.seq (Seq.seq (pure Subtype.val) fun x => f) fun x_1 => Seq.seq (pure Subtype.val) fun x_2 => x

tactic: simp only [← pure_seq]
state_before: m : Type u_1 → Type u_2
α α✝ : Type u_1
p₁ : (α → α✝) → Prop
f✝ : m (α → α✝)
p₂ : α → Prop
q : α✝ → Prop
inst✝¹ : Applicative m
inst✝ : LawfulApplicative m
x✝ : m α
hf : SatisfiesM p₁ f✝
hx : SatisfiesM p₂ x✝
H : ∀ {f : α → α✝} {a : α}, p₁ f → p₂ a → q (f a)
f : m { a // p₁ a }
x : m { a // p₂ a }
⊢ (Seq.seq
      (Seq.seq
        (pure
          (Function.comp Subtype.val ∘ fun x x_1 =>
            { val := Subtype.val x x_1.val, property := (_ : q (Subtype.val x x_1.val)) }))
        fun x => f)
      fun x_1 => x) =
    Seq.seq ((fun h => h Subtype.val) <$> Function.comp <$> Seq.seq (pure Subtype.val) fun x => f) fun x_1 => x

tactic: simp [seq_assoc, Function.comp]
state_before: m : Type u_1 → Type u_2
α α✝ : Type u_1
p₁ : (α → α✝) → Prop
f✝ : m (α → α✝)
p₂ : α → Prop
q : α✝ → Prop
inst✝¹ : Applicative m
inst✝ : LawfulApplicative m
x✝ : m α
hf : SatisfiesM p₁ f✝
hx : SatisfiesM p₂ x✝
H : ∀ {f : α → α✝} {a : α}, p₁ f → p₂ a → q (f a)
f : m { a // p₁ a }
x : m { a // p₂ a }
⊢ (Seq.seq
      (Seq.seq
        (pure
          (Function.comp Subtype.val ∘ fun x x_1 =>
            { val := Subtype.val x x_1.val, property := (_ : q (Subtype.val x x_1.val)) }))
        fun x => f)
      fun x_1 => x) =
    Seq.seq
      (Seq.seq (pure fun h => h Subtype.val) fun x =>
        Seq.seq (pure Function.comp) fun x => Seq.seq (pure Subtype.val) fun x => f)
      fun x_1 => x