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)
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)
match f, x, hf, hx with | _, _, ⟨f, rfl⟩, ⟨x, rfl⟩ => ?_
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
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)
refine ⟨(fun ⟨a, h₁⟩ ⟨b, h₂⟩ => ⟨a b, H h₁ h₂⟩) <$> f <*> x, ?_⟩
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
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
simp only [← pure_seq]
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
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
simp [SatisfiesM, seq_assoc]
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
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
simp only [← pure_seq]
no goals
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
simp [seq_assoc, Function.comp]