funext
K : Type
inst✝⁹ : RCLike K
m : Type → Type
m' : outParam (Type → Type)
inst✝⁸ : Monad m
inst✝⁷ : Monad m'
inst✝⁶ : RevDerivMonad K m m'
inst✝⁵ : LawfulMonad m
inst✝⁴ : LawfulMonad m'
S : Type
inst✝³ : SemiInnerProductSpace K S
X : Type
inst✝² : SemiInnerProductSpace K X
Y : Type ?u.264984
inst✝¹ : SemiInnerProductSpace K Y
Z : Type ?u.264995
inst✝ : SemiInnerProductSpace K Z
f : X → S → S
ha0 : HasAdjDiff K fun xs => f xs.1 xs.2
⊢ (revDerivM K fun x => modify (f x)) = fun x => do
    let __do_lift ← get
    let sdf : S × (S → X × S) := revDeriv K (fun xs => f xs.1 xs.2) (x, __do_lift)
    set sdf.1
    pure
        ((), fun x => do
          let __do_lift ← get
          let dxs : X × S := sdf.2 __do_lift
          set dxs.2
          pure dxs.1)
case h.h
K : Type
inst✝⁹ : RCLike K
m : Type → Type
m' : outParam (Type → Type)
inst✝⁸ : Monad m
inst✝⁷ : Monad m'
inst✝⁶ : RevDerivMonad K m m'
inst✝⁵ : LawfulMonad m
inst✝⁴ : LawfulMonad m'
S : Type
inst✝³ : SemiInnerProductSpace K S
X : Type
inst✝² : SemiInnerProductSpace K X
Y : Type ?u.264984
inst✝¹ : SemiInnerProductSpace K Y
Z : Type ?u.264995
inst✝ : SemiInnerProductSpace K Z
f : X → S → S
ha0 : HasAdjDiff K fun xs => f xs.1 xs.2
x✝¹ : X
x✝ : S
⊢ revDerivM K (fun x => modify (f x)) x✝¹ x✝ =
    (get >>= fun __do_lift =>
        let sdf := revDeriv K (fun xs => f xs.1 xs.2) (x✝¹, __do_lift);
        do
        set sdf.1
        pure
            ((), fun x => do
              let __do_lift ← get
              let dxs : X × S := sdf.2 __do_lift
              set dxs.2
              pure dxs.1))
      x✝