Skip to content

Commit

Permalink
revDerivUpdate rule for setElem
Browse files Browse the repository at this point in the history
  • Loading branch information
lecopivo committed Oct 2, 2023
1 parent f0e24d3 commit a6b4787
Showing 1 changed file with 23 additions and 1 deletion.
24 changes: 23 additions & 1 deletion SciLean/Data/ArrayType/Properties.lean
Original file line number Diff line number Diff line change
Expand Up @@ -203,7 +203,8 @@ theorem GetElem.getElem.arg_xs.revDerivUpdate_rule_simple
by
unfold revDerivUpdate; ftrans; sorry_proof

theorem GetElem.getElem.arg_xs.revDerivUpdate_rule_pi
@[ftrans]
theorem GetElem.getElem.arg_xs_i.revDerivUpdate_rule
(f : X → Cont) (dom)
(hf : HasAdjDiff K f)
: revDerivUpdate K (fun x idx => getElem (f x) idx dom)
Expand Down Expand Up @@ -405,6 +406,27 @@ by
have ⟨_,_⟩ := helem
unfold revCDeriv; ftrans; ftrans; simp


@[ftrans]
theorem SetElem.setElem.arg_contelem.revDerivUpdate_rule
(cont : X → Cont) (idx : Idx) (elem : X → Elem)
(hcont : HasAdjDiff K cont) (helem : HasAdjDiff K elem)
: revDerivUpdate K (fun x => setElem (cont x) idx (elem x))
=
fun x =>
let cdc := revDerivUpdate K cont x
let ede := revDerivUpdate K elem x
(setElem cdc.1 idx ede.1,
fun dcont' k dx =>
let delem' := dcont'[idx]
ede.2 delem' k (cdc.2 (setElem dcont' idx 0) k dx)
) :=
by
have ⟨_,_⟩ := hcont
have ⟨_,_⟩ := helem
unfold revDerivUpdate; ftrans; ftrans; simp[add_assoc]


end OnSemiInnerProductSpace


Expand Down

0 comments on commit a6b4787

Please sign in to comment.