internlm/Lean-Github huggingface dataset:
Theorem: Prod.mk.arg_fstsnd.revDeriv2_rule
Proof state before:
K : Type
inst✝⁴ : RCLike K
X : Type
inst✝³ : SemiInnerProductSpace K X
Y : Type
inst✝² : SemiInnerProductSpace K Y
Z : Type
inst✝¹ : SemiInnerProductSpace K Z
W : Type
inst✝ : SemiInnerProductSpace K W
g : W → X → Y
f : W → X → Z
hg : HasAdjDiff K fun x => g x.1 x.2
hf : HasAdjDiff K fun x => f x.1 x.2
⊢ (fun w x =>
      ((fun w x => (g w x, f w x)) w x, fun dy =>
        match (motive := W × X → W → W × X)
          semiAdjoint K
            (cderiv K
              (fun x =>
                match x with
                | (w, x) => (fun w x => (g w x, f w x)) w x)
              (w, x))
            dy with
        | (dw, dx) => fun dw' => (dw' + dw, dx))) =
    fun w x =>
    let ydg :=
      (g w x, fun dy =>
        match (motive := W × X → W → W × X)
          semiAdjoint K
            (cderiv K
              (fun x =>
                match x with
                | (w, x) => g w x)
              (w, x))
            dy with
        | (dw, dx) => fun dw' => (dw' + dw, dx));
    let zdf :=
      ((fun x x_1 =>
            match x with
            | (w, x) => f w x)
          (w, x) (),
        fun dy =>
        match (motive := (W × X) × Unit → W × X → (W × X) × Unit)
          semiAdjoint K
            (cderiv K
              (fun x =>
                match x with
                | (w, x) =>
                  (fun x x_1 =>
                      match x with
                      | (w, x) => f w x)
                    w x)
              ((w, x), ()))
            dy with
        | (dw, dx) => fun dw' => (dw' + dw, dx));
    ((ydg.1, zdf.1), fun dyz dw =>
      let dwx := ydg.2 dyz.1 dw;
      (zdf.2 dyz.2 dwx).1)
Tactic:
simp
Proof state after:
K : Type
inst✝⁴ : RCLike K
X : Type
inst✝³ : SemiInnerProductSpace K X
Y : Type
inst✝² : SemiInnerProductSpace K Y
Z : Type
inst✝¹ : SemiInnerProductSpace K Z
W : Type
inst✝ : SemiInnerProductSpace K W
g : W → X → Y
f : W → X → Z
hg : HasAdjDiff K fun x => g x.1 x.2
hf : HasAdjDiff K fun x => f x.1 x.2
⊢ (fun w x =>
      ((g w x, f w x), fun dy dw' =>
        (dw' + (semiAdjoint K (cderiv K (fun x => (g x.1 x.2, f x.1 x.2)) (w, x)) dy).1,
          (semiAdjoint K (cderiv K (fun x => (g x.1 x.2, f x.1 x.2)) (w, x)) dy).2))) =
    fun w x =>
    ((g w x, f w x), fun dyz dw =>
      (dw + (semiAdjoint K (cderiv K (fun x => g x.1 x.2) (w, x)) dyz.1).1,
          (semiAdjoint K (cderiv K (fun x => g x.1 x.2) (w, x)) dyz.1).2) +
        (semiAdjoint K (cderiv K (fun x => f x.1.1 x.1.2) ((w, x), ())) dyz.2).1)
Theorem: Prod.mk.arg_fstsnd.revDeriv2_rule
Proof state before:
K : Type
inst✝⁴ : RCLike K
X : Type
inst✝³ : SemiInnerProductSpace K X
Y : Type
inst✝² : SemiInnerProductSpace K Y
Z : Type
inst✝¹ : SemiInnerProductSpace K Z
W : Type
inst✝ : SemiInnerProductSpace K W
g : W → X → Y
f : W → X → Z
hg : HasAdjDiff K fun x => g x.1 x.2
hf : HasAdjDiff K fun x => f x.1 x.2
⊢ (fun w x =>
      ((g w x, f w x), fun dy dw' =>
        (dw' + (semiAdjoint K (cderiv K (fun x => (g x.1 x.2, f x.1 x.2)) (w, x)) dy).1,
          (semiAdjoint K (cderiv K (fun x => (g x.1 x.2, f x.1 x.2)) (w, x)) dy).2))) =
    fun w x =>
    ((g w x, f w x), fun dyz dw =>
      (dw + (semiAdjoint K (cderiv K (fun x => g x.1 x.2) (w, x)) dyz.1).1,
          (semiAdjoint K (cderiv K (fun x => g x.1 x.2) (w, x)) dyz.1).2) +
        (semiAdjoint K (cderiv K (fun x => f x.1.1 x.1.2) ((w, x), ())) dyz.2).1)
Tactic:
conv => lhs; fun_trans
Proof state after:
K : Type
inst✝⁴ : RCLike K
X : Type
inst✝³ : SemiInnerProductSpace K X
Y : Type
inst✝² : SemiInnerProductSpace K Y
Z : Type
inst✝¹ : SemiInnerProductSpace K Z
W : Type
inst✝ : SemiInnerProductSpace K W
g : W → X → Y
f : W → X → Z
hg : HasAdjDiff K fun x => g x.1 x.2
hf : HasAdjDiff K fun x => f x.1 x.2
⊢ (fun w x =>
      ((g w x, f w x), fun dy dw' =>
        (dw' +
            ((semiAdjoint K (fun x_1 => cderiv K (fun x => g x.1 x.2) (w, x) x_1) dy.1).1 +
              (semiAdjoint K (fun x_1 => cderiv K (fun x => f x.1 x.2) (w, x) x_1) dy.2).1),
          (semiAdjoint K (fun x_1 => cderiv K (fun x => g x.1 x.2) (w, x) x_1) dy.1).2 +
            (semiAdjoint K (fun x_1 => cderiv K (fun x => f x.1 x.2) (w, x) x_1) dy.2).2))) =
    fun w x =>
    ((g w x, f w x), fun dyz dw =>
      (dw + (semiAdjoint K (cderiv K (fun x => g x.1 x.2) (w, x)) dyz.1).1,
          (semiAdjoint K (cderiv K (fun x => g x.1 x.2) (w, x)) dyz.1).2) +
        (semiAdjoint K (cderiv K (fun x => f x.1.1 x.1.2) ((w, x), ())) dyz.2).1)
Theorem: Prod.mk.arg_fstsnd.revDeriv2_rule
Proof state before:
K : Type
inst✝⁴ : RCLike K
X : Type
inst✝³ : SemiInnerProductSpace K X
Y : Type
inst✝² : SemiInnerProductSpace K Y
Z : Type
inst✝¹ : SemiInnerProductSpace K Z
W : Type
inst✝ : SemiInnerProductSpace K W
g : W → X → Y
f : W → X → Z
hg : HasAdjDiff K fun x => g x.1 x.2
hf : HasAdjDiff K fun x => f x.1 x.2
⊢ (fun w x =>
      ((g w x, f w x), fun dy dw' =>
        (dw' +
            ((semiAdjoint K (fun x_1 => cderiv K (fun x => g x.1 x.2) (w, x) x_1) dy.1).1 +
              (semiAdjoint K (fun x_1 => cderiv K (fun x => f x.1 x.2) (w, x) x_1) dy.2).1),
          (semiAdjoint K (fun x_1 => cderiv K (fun x => g x.1 x.2) (w, x) x_1) dy.1).2 +
            (semiAdjoint K (fun x_1 => cderiv K (fun x => f x.1 x.2) (w, x) x_1) dy.2).2))) =
    fun w x =>
    ((g w x, f w x), fun dyz dw =>
      (dw + (semiAdjoint K (cderiv K (fun x => g x.1 x.2) (w, x)) dyz.1).1,
          (semiAdjoint K (cderiv K (fun x => g x.1 x.2) (w, x)) dyz.1).2) +
        (semiAdjoint K (cderiv K (fun x => f x.1.1 x.1.2) ((w, x), ())) dyz.2).1)
Tactic:
funext w x
Proof state after:
case h.h
K : Type
inst✝⁴ : RCLike K
X : Type
inst✝³ : SemiInnerProductSpace K X
Y : Type
inst✝² : SemiInnerProductSpace K Y
Z : Type
inst✝¹ : SemiInnerProductSpace K Z
W : Type
inst✝ : SemiInnerProductSpace K W
g : W → X → Y
f : W → X → Z
hg : HasAdjDiff K fun x => g x.1 x.2
hf : HasAdjDiff K fun x => f x.1 x.2
w : W
x : X
⊢ ((g w x, f w x), fun dy dw' =>
      (dw' +
          ((semiAdjoint K (fun x_1 => cderiv K (fun x => g x.1 x.2) (w, x) x_1) dy.1).1 +
            (semiAdjoint K (fun x_1 => cderiv K (fun x => f x.1 x.2) (w, x) x_1) dy.2).1),
        (semiAdjoint K (fun x_1 => cderiv K (fun x => g x.1 x.2) (w, x) x_1) dy.1).2 +
          (semiAdjoint K (fun x_1 => cderiv K (fun x => f x.1 x.2) (w, x) x_1) dy.2).2)) =
    ((g w x, f w x), fun dyz dw =>
      (dw + (semiAdjoint K (cderiv K (fun x => g x.1 x.2) (w, x)) dyz.1).1,
          (semiAdjoint K (cderiv K (fun x => g x.1 x.2) (w, x)) dyz.1).2) +
        (semiAdjoint K (cderiv K (fun x => f x.1.1 x.1.2) ((w, x), ())) dyz.2).1)
Theorem: Prod.mk.arg_fstsnd.revDeriv2_rule
Proof state before:
case h.h
K : Type
inst✝⁴ : RCLike K
X : Type
inst✝³ : SemiInnerProductSpace K X
Y : Type
inst✝² : SemiInnerProductSpace K Y
Z : Type
inst✝¹ : SemiInnerProductSpace K Z
W : Type
inst✝ : SemiInnerProductSpace K W
g : W → X → Y
f : W → X → Z
hg : HasAdjDiff K fun x => g x.1 x.2
hf : HasAdjDiff K fun x => f x.1 x.2
w : W
x : X
⊢ ((g w x, f w x), fun dy dw' =>
      (dw' +
          ((semiAdjoint K (fun x_1 => cderiv K (fun x => g x.1 x.2) (w, x) x_1) dy.1).1 +
            (semiAdjoint K (fun x_1 => cderiv K (fun x => f x.1 x.2) (w, x) x_1) dy.2).1),
        (semiAdjoint K (fun x_1 => cderiv K (fun x => g x.1 x.2) (w, x) x_1) dy.1).2 +
          (semiAdjoint K (fun x_1 => cderiv K (fun x => f x.1 x.2) (w, x) x_1) dy.2).2)) =
    ((g w x, f w x), fun dyz dw =>
      (dw + (semiAdjoint K (cderiv K (fun x => g x.1 x.2) (w, x)) dyz.1).1,
          (semiAdjoint K (cderiv K (fun x => g x.1 x.2) (w, x)) dyz.1).2) +
        (semiAdjoint K (cderiv K (fun x => f x.1.1 x.1.2) ((w, x), ())) dyz.2).1)
Tactic:
simp
Proof state after:
case h.h
K : Type
inst✝⁴ : RCLike K
X : Type
inst✝³ : SemiInnerProductSpace K X
Y : Type
inst✝² : SemiInnerProductSpace K Y
Z : Type
inst✝¹ : SemiInnerProductSpace K Z
W : Type
inst✝ : SemiInnerProductSpace K W
g : W → X → Y
f : W → X → Z
hg : HasAdjDiff K fun x => g x.1 x.2
hf : HasAdjDiff K fun x => f x.1 x.2
w : W
x : X
⊢ (fun dy dw' =>
      (dw' +
          ((semiAdjoint K (fun x_1 => cderiv K (fun x => g x.1 x.2) (w, x) x_1) dy.1).1 +
            (semiAdjoint K (fun x_1 => cderiv K (fun x => f x.1 x.2) (w, x) x_1) dy.2).1),
        (semiAdjoint K (fun x_1 => cderiv K (fun x => g x.1 x.2) (w, x) x_1) dy.1).2 +
          (semiAdjoint K (fun x_1 => cderiv K (fun x => f x.1 x.2) (w, x) x_1) dy.2).2)) =
    fun dyz dw =>
    (dw + (semiAdjoint K (cderiv K (fun x => g x.1 x.2) (w, x)) dyz.1).1,
        (semiAdjoint K (cderiv K (fun x => g x.1 x.2) (w, x)) dyz.1).2) +
      (semiAdjoint K (cderiv K (fun x => f x.1.1 x.1.2) ((w, x), ())) dyz.2).1
Theorem: Prod.mk.arg_fstsnd.revDeriv2_rule
Proof state before:
case h.h
K : Type
inst✝⁴ : RCLike K
X : Type
inst✝³ : SemiInnerProductSpace K X
Y : Type
inst✝² : SemiInnerProductSpace K Y
Z : Type
inst✝¹ : SemiInnerProductSpace K Z
W : Type
inst✝ : SemiInnerProductSpace K W
g : W → X → Y
f : W → X → Z
hg : HasAdjDiff K fun x => g x.1 x.2
hf : HasAdjDiff K fun x => f x.1 x.2
w : W
x : X
⊢ (fun dy dw' =>
      (dw' +
          ((semiAdjoint K (fun x_1 => cderiv K (fun x => g x.1 x.2) (w, x) x_1) dy.1).1 +
            (semiAdjoint K (fun x_1 => cderiv K (fun x => f x.1 x.2) (w, x) x_1) dy.2).1),
        (semiAdjoint K (fun x_1 => cderiv K (fun x => g x.1 x.2) (w, x) x_1) dy.1).2 +
          (semiAdjoint K (fun x_1 => cderiv K (fun x => f x.1 x.2) (w, x) x_1) dy.2).2)) =
    fun dyz dw =>
    (dw + (semiAdjoint K (cderiv K (fun x => g x.1 x.2) (w, x)) dyz.1).1,
        (semiAdjoint K (cderiv K (fun x => g x.1 x.2) (w, x)) dyz.1).2) +
      (semiAdjoint K (cderiv K (fun x => f x.1.1 x.1.2) ((w, x), ())) dyz.2).1
Tactic:
funext (dy,dz) dw
Proof state after:
case h.h.h.h
K : Type
inst✝⁴ : RCLike K
X : Type
inst✝³ : SemiInnerProductSpace K X
Y : Type
inst✝² : SemiInnerProductSpace K Y
Z : Type
inst✝¹ : SemiInnerProductSpace K Z
W : Type
inst✝ : SemiInnerProductSpace K W
g : W → X → Y
f : W → X → Z
hg : HasAdjDiff K fun x => g x.1 x.2
hf : HasAdjDiff K fun x => f x.1 x.2
w : W
x : X
dy : Y
dz : Z
dw : W
⊢ (dw +
        ((semiAdjoint K (fun x_1 => cderiv K (fun x => g x.1 x.2) (w, x) x_1) (dy, dz).1).1 +
          (semiAdjoint K (fun x_1 => cderiv K (fun x => f x.1 x.2) (w, x) x_1) (dy, dz).2).1),
      (semiAdjoint K (fun x_1 => cderiv K (fun x => g x.1 x.2) (w, x) x_1) (dy, dz).1).2 +
        (semiAdjoint K (fun x_1 => cderiv K (fun x => f x.1 x.2) (w, x) x_1) (dy, dz).2).2) =
    (dw + (semiAdjoint K (cderiv K (fun x => g x.1 x.2) (w, x)) (dy, dz).1).1,
        (semiAdjoint K (cderiv K (fun x => g x.1 x.2) (w, x)) (dy, dz).1).2) +
      (semiAdjoint K (cderiv K (fun x => f x.1.1 x.1.2) ((w, x), ())) (dy, dz).2).1
Theorem: Prod.mk.arg_fstsnd.revDeriv2_rule
Proof state before:
case h.h.h.h
K : Type
inst✝⁴ : RCLike K
X : Type
inst✝³ : SemiInnerProductSpace K X
Y : Type
inst✝² : SemiInnerProductSpace K Y
Z : Type
inst✝¹ : SemiInnerProductSpace K Z
W : Type
inst✝ : SemiInnerProductSpace K W
g : W → X → Y
f : W → X → Z
hg : HasAdjDiff K fun x => g x.1 x.2
hf : HasAdjDiff K fun x => f x.1 x.2
w : W
x : X
dy : Y
dz : Z
dw : W
⊢ (dw +
        ((semiAdjoint K (fun x_1 => cderiv K (fun x => g x.1 x.2) (w, x) x_1) (dy, dz).1).1 +
          (semiAdjoint K (fun x_1 => cderiv K (fun x => f x.1 x.2) (w, x) x_1) (dy, dz).2).1),
      (semiAdjoint K (fun x_1 => cderiv K (fun x => g x.1 x.2) (w, x) x_1) (dy, dz).1).2 +
        (semiAdjoint K (fun x_1 => cderiv K (fun x => f x.1 x.2) (w, x) x_1) (dy, dz).2).2) =
    (dw + (semiAdjoint K (cderiv K (fun x => g x.1 x.2) (w, x)) (dy, dz).1).1,
        (semiAdjoint K (cderiv K (fun x => g x.1 x.2) (w, x)) (dy, dz).1).2) +
      (semiAdjoint K (cderiv K (fun x => f x.1.1 x.1.2) ((w, x), ())) (dy, dz).2).1
Tactic:
ext
Proof state after:
case h.h.h.h.a
K : Type
inst✝⁴ : RCLike K
X : Type
inst✝³ : SemiInnerProductSpace K X
Y : Type
inst✝² : SemiInnerProductSpace K Y
Z : Type
inst✝¹ : SemiInnerProductSpace K Z
W : Type
inst✝ : SemiInnerProductSpace K W
g : W → X → Y
f : W → X → Z
hg : HasAdjDiff K fun x => g x.1 x.2
hf : HasAdjDiff K fun x => f x.1 x.2
w : W
x : X
dy : Y
dz : Z
dw : W
⊢ (dw +
          ((semiAdjoint K (fun x_1 => cderiv K (fun x => g x.1 x.2) (w, x) x_1) (dy, dz).1).1 +
            (semiAdjoint K (fun x_1 => cderiv K (fun x => f x.1 x.2) (w, x) x_1) (dy, dz).2).1),
        (semiAdjoint K (fun x_1 => cderiv K (fun x => g x.1 x.2) (w, x) x_1) (dy, dz).1).2 +
          (semiAdjoint K (fun x_1 => cderiv K (fun x => f x.1 x.2) (w, x) x_1) (dy, dz).2).2).1 =
    ((dw + (semiAdjoint K (cderiv K (fun x => g x.1 x.2) (w, x)) (dy, dz).1).1,
          (semiAdjoint K (cderiv K (fun x => g x.1 x.2) (w, x)) (dy, dz).1).2) +
        (semiAdjoint K (cderiv K (fun x => f x.1.1 x.1.2) ((w, x), ())) (dy, dz).2).1).1

case h.h.h.h.a
K : Type
inst✝⁴ : RCLike K
X : Type
inst✝³ : SemiInnerProductSpace K X
Y : Type
inst✝² : SemiInnerProductSpace K Y
Z : Type
inst✝¹ : SemiInnerProductSpace K Z
W : Type
inst✝ : SemiInnerProductSpace K W
g : W → X → Y
f : W → X → Z
hg : HasAdjDiff K fun x => g x.1 x.2
hf : HasAdjDiff K fun x => f x.1 x.2
w : W
x : X
dy : Y
dz : Z
dw : W
⊢ (dw +
          ((semiAdjoint K (fun x_1 => cderiv K (fun x => g x.1 x.2) (w, x) x_1) (dy, dz).1).1 +
            (semiAdjoint K (fun x_1 => cderiv K (fun x => f x.1 x.2) (w, x) x_1) (dy, dz).2).1),
        (semiAdjoint K (fun x_1 => cderiv K (fun x => g x.1 x.2) (w, x) x_1) (dy, dz).1).2 +
          (semiAdjoint K (fun x_1 => cderiv K (fun x => f x.1 x.2) (w, x) x_1) (dy, dz).2).2).2 =
    ((dw + (semiAdjoint K (cderiv K (fun x => g x.1 x.2) (w, x)) (dy, dz).1).1,
          (semiAdjoint K (cderiv K (fun x => g x.1 x.2) (w, x)) (dy, dz).1).2) +
        (semiAdjoint K (cderiv K (fun x => f x.1.1 x.1.2) ((w, x), ())) (dy, dz).2).1).2
Theorem: Prod.mk.arg_fstsnd.revDeriv2_rule
Proof state before:
case h.h.h.h.a
K : Type
inst✝⁴ : RCLike K
X : Type
inst✝³ : SemiInnerProductSpace K X
Y : Type
inst✝² : SemiInnerProductSpace K Y
Z : Type
inst✝¹ : SemiInnerProductSpace K Z
W : Type
inst✝ : SemiInnerProductSpace K W
g : W → X → Y
f : W → X → Z
hg : HasAdjDiff K fun x => g x.1 x.2
hf : HasAdjDiff K fun x => f x.1 x.2
w : W
x : X
dy : Y
dz : Z
dw : W
⊢ (dw +
          ((semiAdjoint K (fun x_1 => cderiv K (fun x => g x.1 x.2) (w, x) x_1) (dy, dz).1).1 +
            (semiAdjoint K (fun x_1 => cderiv K (fun x => f x.1 x.2) (w, x) x_1) (dy, dz).2).1),
        (semiAdjoint K (fun x_1 => cderiv K (fun x => g x.1 x.2) (w, x) x_1) (dy, dz).1).2 +
          (semiAdjoint K (fun x_1 => cderiv K (fun x => f x.1 x.2) (w, x) x_1) (dy, dz).2).2).1 =
    ((dw + (semiAdjoint K (cderiv K (fun x => g x.1 x.2) (w, x)) (dy, dz).1).1,
          (semiAdjoint K (cderiv K (fun x => g x.1 x.2) (w, x)) (dy, dz).1).2) +
        (semiAdjoint K (cderiv K (fun x => f x.1.1 x.1.2) ((w, x), ())) (dy, dz).2).1).1

case h.h.h.h.a
K : Type
inst✝⁴ : RCLike K
X : Type
inst✝³ : SemiInnerProductSpace K X
Y : Type
inst✝² : SemiInnerProductSpace K Y
Z : Type
inst✝¹ : SemiInnerProductSpace K Z
W : Type
inst✝ : SemiInnerProductSpace K W
g : W → X → Y
f : W → X → Z
hg : HasAdjDiff K fun x => g x.1 x.2
hf : HasAdjDiff K fun x => f x.1 x.2
w : W
x : X
dy : Y
dz : Z
dw : W
⊢ (dw +
          ((semiAdjoint K (fun x_1 => cderiv K (fun x => g x.1 x.2) (w, x) x_1) (dy, dz).1).1 +
            (semiAdjoint K (fun x_1 => cderiv K (fun x => f x.1 x.2) (w, x) x_1) (dy, dz).2).1),
        (semiAdjoint K (fun x_1 => cderiv K (fun x => g x.1 x.2) (w, x) x_1) (dy, dz).1).2 +
          (semiAdjoint K (fun x_1 => cderiv K (fun x => f x.1 x.2) (w, x) x_1) (dy, dz).2).2).2 =
    ((dw + (semiAdjoint K (cderiv K (fun x => g x.1 x.2) (w, x)) (dy, dz).1).1,
          (semiAdjoint K (cderiv K (fun x => g x.1 x.2) (w, x)) (dy, dz).1).2) +
        (semiAdjoint K (cderiv K (fun x => f x.1.1 x.1.2) ((w, x), ())) (dy, dz).2).1).2
Tactic:
. simp[add_assoc]; sorry_proof
Proof state after:
case h.h.h.h.a
K : Type
inst✝⁴ : RCLike K
X : Type
inst✝³ : SemiInnerProductSpace K X
Y : Type
inst✝² : SemiInnerProductSpace K Y
Z : Type
inst✝¹ : SemiInnerProductSpace K Z
W : Type
inst✝ : SemiInnerProductSpace K W
g : W → X → Y
f : W → X → Z
hg : HasAdjDiff K fun x => g x.1 x.2
hf : HasAdjDiff K fun x => f x.1 x.2
w : W
x : X
dy : Y
dz : Z
dw : W
⊢ (dw +
          ((semiAdjoint K (fun x_1 => cderiv K (fun x => g x.1 x.2) (w, x) x_1) (dy, dz).1).1 +
            (semiAdjoint K (fun x_1 => cderiv K (fun x => f x.1 x.2) (w, x) x_1) (dy, dz).2).1),
        (semiAdjoint K (fun x_1 => cderiv K (fun x => g x.1 x.2) (w, x) x_1) (dy, dz).1).2 +
          (semiAdjoint K (fun x_1 => cderiv K (fun x => f x.1 x.2) (w, x) x_1) (dy, dz).2).2).2 =
    ((dw + (semiAdjoint K (cderiv K (fun x => g x.1 x.2) (w, x)) (dy, dz).1).1,
          (semiAdjoint K (cderiv K (fun x => g x.1 x.2) (w, x)) (dy, dz).1).2) +
        (semiAdjoint K (cderiv K (fun x => f x.1.1 x.1.2) ((w, x), ())) (dy, dz).2).1).2
Theorem: Prod.mk.arg_fstsnd.revDeriv2_rule
Proof state before:
case h.h.h.h.a
K : Type
inst✝⁴ : RCLike K
X : Type
inst✝³ : SemiInnerProductSpace K X
Y : Type
inst✝² : SemiInnerProductSpace K Y
Z : Type
inst✝¹ : SemiInnerProductSpace K Z
W : Type
inst✝ : SemiInnerProductSpace K W
g : W → X → Y
f : W → X → Z
hg : HasAdjDiff K fun x => g x.1 x.2
hf : HasAdjDiff K fun x => f x.1 x.2
w : W
x : X
dy : Y
dz : Z
dw : W
⊢ (dw +
          ((semiAdjoint K (fun x_1 => cderiv K (fun x => g x.1 x.2) (w, x) x_1) (dy, dz).1).1 +
            (semiAdjoint K (fun x_1 => cderiv K (fun x => f x.1 x.2) (w, x) x_1) (dy, dz).2).1),
        (semiAdjoint K (fun x_1 => cderiv K (fun x => g x.1 x.2) (w, x) x_1) (dy, dz).1).2 +
          (semiAdjoint K (fun x_1 => cderiv K (fun x => f x.1 x.2) (w, x) x_1) (dy, dz).2).2).2 =
    ((dw + (semiAdjoint K (cderiv K (fun x => g x.1 x.2) (w, x)) (dy, dz).1).1,
          (semiAdjoint K (cderiv K (fun x => g x.1 x.2) (w, x)) (dy, dz).1).2) +
        (semiAdjoint K (cderiv K (fun x => f x.1.1 x.1.2) ((w, x), ())) (dy, dz).2).1).2
Tactic:
. simp; sorry_proof
Proof state after:
no goals
Theorem: Prod.mk.arg_fstsnd.revDeriv2_rule
Proof state before:
case h.h.h.h.a
K : Type
inst✝⁴ : RCLike K
X : Type
inst✝³ : SemiInnerProductSpace K X
Y : Type
inst✝² : SemiInnerProductSpace K Y
Z : Type
inst✝¹ : SemiInnerProductSpace K Z
W : Type
inst✝ : SemiInnerProductSpace K W
g : W → X → Y
f : W → X → Z
hg : HasAdjDiff K fun x => g x.1 x.2
hf : HasAdjDiff K fun x => f x.1 x.2
w : W
x : X
dy : Y
dz : Z
dw : W
⊢ (dw +
          ((semiAdjoint K (fun x_1 => cderiv K (fun x => g x.1 x.2) (w, x) x_1) (dy, dz).1).1 +
            (semiAdjoint K (fun x_1 => cderiv K (fun x => f x.1 x.2) (w, x) x_1) (dy, dz).2).1),
        (semiAdjoint K (fun x_1 => cderiv K (fun x => g x.1 x.2) (w, x) x_1) (dy, dz).1).2 +
          (semiAdjoint K (fun x_1 => cderiv K (fun x => f x.1 x.2) (w, x) x_1) (dy, dz).2).2).1 =
    ((dw + (semiAdjoint K (cderiv K (fun x => g x.1 x.2) (w, x)) (dy, dz).1).1,
          (semiAdjoint K (cderiv K (fun x => g x.1 x.2) (w, x)) (dy, dz).1).2) +
        (semiAdjoint K (cderiv K (fun x => f x.1.1 x.1.2) ((w, x), ())) (dy, dz).2).1).1
Tactic:
simp[add_assoc]
Proof state after:
case h.h.h.h.a
K : Type
inst✝⁴ : RCLike K
X : Type
inst✝³ : SemiInnerProductSpace K X
Y : Type
inst✝² : SemiInnerProductSpace K Y
Z : Type
inst✝¹ : SemiInnerProductSpace K Z
W : Type
inst✝ : SemiInnerProductSpace K W
g : W → X → Y
f : W → X → Z
hg : HasAdjDiff K fun x => g x.1 x.2
hf : HasAdjDiff K fun x => f x.1 x.2
w : W
x : X
dy : Y
dz : Z
dw : W
⊢ (semiAdjoint K (fun x_1 => cderiv K (fun x => f x.1 x.2) (w, x) x_1) dz).1 =
    (semiAdjoint K (cderiv K (fun x => f x.1.1 x.1.2) ((w, x), ())) dz).1.1
Theorem: Prod.mk.arg_fstsnd.revDeriv2_rule
Proof state before:
case h.h.h.h.a
K : Type
inst✝⁴ : RCLike K
X : Type
inst✝³ : SemiInnerProductSpace K X
Y : Type
inst✝² : SemiInnerProductSpace K Y
Z : Type
inst✝¹ : SemiInnerProductSpace K Z
W : Type
inst✝ : SemiInnerProductSpace K W
g : W → X → Y
f : W → X → Z
hg : HasAdjDiff K fun x => g x.1 x.2
hf : HasAdjDiff K fun x => f x.1 x.2
w : W
x : X
dy : Y
dz : Z
dw : W
⊢ (semiAdjoint K (fun x_1 => cderiv K (fun x => f x.1 x.2) (w, x) x_1) dz).1 =
    (semiAdjoint K (cderiv K (fun x => f x.1.1 x.1.2) ((w, x), ())) dz).1.1
Tactic:
sorry_proof
Proof state after:
no goals
Theorem: Prod.mk.arg_fstsnd.revDeriv2_rule
Proof state before:
case h.h.h.h.a
K : Type
inst✝⁴ : RCLike K
X : Type
inst✝³ : SemiInnerProductSpace K X
Y : Type
inst✝² : SemiInnerProductSpace K Y
Z : Type
inst✝¹ : SemiInnerProductSpace K Z
W : Type
inst✝ : SemiInnerProductSpace K W
g : W → X → Y
f : W → X → Z
hg : HasAdjDiff K fun x => g x.1 x.2
hf : HasAdjDiff K fun x => f x.1 x.2
w : W
x : X
dy : Y
dz : Z
dw : W
⊢ (dw +
          ((semiAdjoint K (fun x_1 => cderiv K (fun x => g x.1 x.2) (w, x) x_1) (dy, dz).1).1 +
            (semiAdjoint K (fun x_1 => cderiv K (fun x => f x.1 x.2) (w, x) x_1) (dy, dz).2).1),
        (semiAdjoint K (fun x_1 => cderiv K (fun x => g x.1 x.2) (w, x) x_1) (dy, dz).1).2 +
          (semiAdjoint K (fun x_1 => cderiv K (fun x => f x.1 x.2) (w, x) x_1) (dy, dz).2).2).2 =
    ((dw + (semiAdjoint K (cderiv K (fun x => g x.1 x.2) (w, x)) (dy, dz).1).1,
          (semiAdjoint K (cderiv K (fun x => g x.1 x.2) (w, x)) (dy, dz).1).2) +
        (semiAdjoint K (cderiv K (fun x => f x.1.1 x.1.2) ((w, x), ())) (dy, dz).2).1).2
Tactic:
simp
Proof state after:
case h.h.h.h.a
K : Type
inst✝⁴ : RCLike K
X : Type
inst✝³ : SemiInnerProductSpace K X
Y : Type
inst✝² : SemiInnerProductSpace K Y
Z : Type
inst✝¹ : SemiInnerProductSpace K Z
W : Type
inst✝ : SemiInnerProductSpace K W
g : W → X → Y
f : W → X → Z
hg : HasAdjDiff K fun x => g x.1 x.2
hf : HasAdjDiff K fun x => f x.1 x.2
w : W
x : X
dy : Y
dz : Z
dw : W
⊢ (semiAdjoint K (fun x_1 => cderiv K (fun x => f x.1 x.2) (w, x) x_1) dz).2 =
    (semiAdjoint K (cderiv K (fun x => f x.1.1 x.1.2) ((w, x), ())) dz).1.2
Theorem: Prod.mk.arg_fstsnd.revDeriv2_rule
Proof state before:
case h.h.h.h.a
K : Type
inst✝⁴ : RCLike K
X : Type
inst✝³ : SemiInnerProductSpace K X
Y : Type
inst✝² : SemiInnerProductSpace K Y
Z : Type
inst✝¹ : SemiInnerProductSpace K Z
W : Type
inst✝ : SemiInnerProductSpace K W
g : W → X → Y
f : W → X → Z
hg : HasAdjDiff K fun x => g x.1 x.2
hf : HasAdjDiff K fun x => f x.1 x.2
w : W
x : X
dy : Y
dz : Z
dw : W
⊢ (semiAdjoint K (fun x_1 => cderiv K (fun x => f x.1 x.2) (w, x) x_1) dz).2 =
    (semiAdjoint K (cderiv K (fun x => f x.1.1 x.1.2) ((w, x), ())) dz).1.2
Tactic:
sorry_proof
Proof state after:
no goals
Theorem: Prod.fst.arg_self.revDeriv2_rule
Proof state before:
K : Type
inst✝⁴ : RCLike K
X : Type
inst✝³ : SemiInnerProductSpace K X
Y : Type
inst✝² : SemiInnerProductSpace K Y
Z : Type
inst✝¹ : SemiInnerProductSpace K Z
W : Type
inst✝ : SemiInnerProductSpace K W
f : W → X → Y × Z
hf :
  HasAdjDiff K fun x =>
    match x with
    | (w, x) => f w x
⊢ (revDeriv2 K fun w x => (f w x).1) = fun w x =>
    let zdf := revDeriv2Proj K (Unit ⊕ Unit) f w x (Sum.inl ());
    zdf
Tactic:
unfold revDeriv2Proj revDeriv2
Proof state after:
K : Type
inst✝⁴ : RCLike K
X : Type
inst✝³ : SemiInnerProductSpace K X
Y : Type
inst✝² : SemiInnerProductSpace K Y
Z : Type
inst✝¹ : SemiInnerProductSpace K Z
W : Type
inst✝ : SemiInnerProductSpace K W
f : W → X → Y × Z
hf :
  HasAdjDiff K fun x =>
    match x with
    | (w, x) => f w x
⊢ (fun w x =>
      ((fun w x => (f w x).1) w x, fun dy =>
        match (motive := W × X → W → W × X)
          semiAdjoint K
            (cderiv K
              (fun x =>
                match x with
                | (w, x) => (fun w x => (f w x).1) w x)
              (w, x))
            dy with
        | (dw, dx) => fun dw' => (dw' + dw, dx))) =
    fun w x =>
    let zdf :=
      let ydf :=
        (f w x, fun dy =>
          match (motive := W × X → W → W × X)
            semiAdjoint K
              (cderiv K
                (fun x =>
                  match x with
                  | (w, x) => f w x)
                (w, x))
              dy with
          | (dw, dx) => fun dw' => (dw' + dw, dx));
      (structProj ydf.1 (Sum.inl ()), fun dyi => ydf.2 (oneHot (Sum.inl ()) dyi));
    zdf