diff --git a/SciLean/Core/FloatAsReal.lean b/SciLean/Core/FloatAsReal.lean index 5edeb9c2..327f28da 100644 --- a/SciLean/Core/FloatAsReal.lean +++ b/SciLean/Core/FloatAsReal.lean @@ -8,8 +8,8 @@ instance : CommRing Float where zero_mul := by intros; apply isomorph.ext `FloatToReal; simp; ftrans; simp mul_zero := by intros; apply isomorph.ext `FloatToReal; simp; ftrans mul_comm := by intros; apply isomorph.ext `FloatToReal; simp; ftrans; rw[mul_comm] - left_distrib := by intros; apply isomorph.ext `FloatToReal; simp; ftrans; simp; ftrans; simp; rw[mul_add] - right_distrib := by intros; apply isomorph.ext `FloatToReal; simp; ftrans; simp; ftrans; simp; rw[add_mul] + left_distrib := by intros; apply isomorph.ext `FloatToReal; simp; ftrans; simp; ftrans; rw[mul_add] + right_distrib := by intros; apply isomorph.ext `FloatToReal; simp; ftrans; simp; ftrans; rw[add_mul] mul_one := by intros; apply isomorph.ext `FloatToReal; simp; ftrans one_mul := by intros; apply isomorph.ext `FloatToReal; simp; ftrans; simp npow n x := x.pow (n.toFloat) --- TODO: change this implementation @@ -180,7 +180,7 @@ theorem conj_float (a : Float) @[simp] theorem re_float (a : Float) - : IsROrC.re a = a := by simp[Coe.coe]; sorry_proof + : IsROrC.re a = a := by sorry_proof open ComplexConjugate @[simp] diff --git a/SciLean/Core/FunctionTransformations/FwdCDeriv.lean b/SciLean/Core/FunctionTransformations/FwdCDeriv.lean index 958b182d..1827a26b 100644 --- a/SciLean/Core/FunctionTransformations/FwdCDeriv.lean +++ b/SciLean/Core/FunctionTransformations/FwdCDeriv.lean @@ -625,10 +625,9 @@ theorem SciLean.Norm2.norm2.arg_a0.fwdCDeriv_rule let ydy := fwdCDeriv R f x dx (‖ydy.1‖₂²[R], 2 * ⟪ydy.2, ydy.1⟫[R]) := by - -- simp_rw [← SemiInnerProductSpace.inner_norm2] - simp[fwdCDeriv] + unfold fwdCDeriv funext x dx - ftrans + ftrans; simp open Scalar in @[ftrans] @@ -642,8 +641,8 @@ theorem SciLean.norm₂.arg_x.fwdCDeriv_rule let ynorm := ‖ydy.1‖₂[R] (ynorm, ynorm⁻¹ * ⟪ydy.2,ydy.1⟫[R]) := by - simp[fwdCDeriv] + unfold fwdCDeriv funext dx - ftrans + ftrans; simp end InnerProductSpace diff --git a/SciLean/Core/FunctionTransformations/Isomorph.lean b/SciLean/Core/FunctionTransformations/Isomorph.lean index d1a17b20..d5d059e8 100644 --- a/SciLean/Core/FunctionTransformations/Isomorph.lean +++ b/SciLean/Core/FunctionTransformations/Isomorph.lean @@ -22,7 +22,7 @@ theorem id_rule = fun (x : α') => x := by - simp[isomorph] + funext _; simp[isomorph] theorem const_rule (y : β) @@ -30,7 +30,7 @@ theorem const_rule (y : β) = fun (_ : α') => (IsomorphicType.equiv tag) y := by - simp[isomorph] + funext _; simp[isomorph] variable {α} variable (β) @@ -40,7 +40,7 @@ theorem proj_rule = fun (f : α' → β') => f ((IsomorphicType.equiv tag) x) := by - simp[isomorph, invIsomorph, IsomorphicType.equiv] + funext _; simp[isomorph, invIsomorph, IsomorphicType.equiv] variable {β} theorem comp_rule @@ -49,7 +49,7 @@ theorem comp_rule = fun x => isomorph tag f (isomorph tag g x) := by - simp[isomorph] + funext _; simp[isomorph] theorem let_rule (f : α → β → γ) (g : α → β) diff --git a/SciLean/Core/FunctionTransformations/RevCDeriv.lean b/SciLean/Core/FunctionTransformations/RevCDeriv.lean index ee8be755..2268c2d9 100644 --- a/SciLean/Core/FunctionTransformations/RevCDeriv.lean +++ b/SciLean/Core/FunctionTransformations/RevCDeriv.lean @@ -1154,7 +1154,7 @@ theorem SciLean.EnumType.sum.arg_f.revCDeriv_rule {ι : Type _} [EnumType ι] by have _ := fun i => (hf i).1 have _ := fun i => (hf i).2 - simp [revCDeriv] + unfold revCDeriv funext x; simp ftrans sorry_proof @@ -1222,7 +1222,7 @@ theorem Inner.inner.arg_a0a1.revCDeriv_rule by have ⟨_,_⟩ := hf have ⟨_,_⟩ := hg - simp[revCDeriv] + unfold revCDeriv funext x; simp ftrans only simp diff --git a/SciLean/Core/FunctionTransformations/RevDeriv.lean b/SciLean/Core/FunctionTransformations/RevDeriv.lean index 9742d7a5..2a0e055b 100644 --- a/SciLean/Core/FunctionTransformations/RevDeriv.lean +++ b/SciLean/Core/FunctionTransformations/RevDeriv.lean @@ -322,7 +322,7 @@ theorem id_rule fun i de => oneHot i de) := by - simp[revDerivProj, revDeriv.id_rule] + unfold revDerivProj; simp[revDeriv.id_rule] variable{E} @@ -334,7 +334,7 @@ theorem const_rule (x : E) (x, fun i (de : EI i) => 0) := by - simp[revDerivProj, revDeriv.const_rule] + unfold revDerivProj; simp[revDeriv.const_rule] variable {Y} theorem proj_rule [DecidableEq I] (i : ι) @@ -347,7 +347,7 @@ theorem proj_rule [DecidableEq I] (i : ι) else 0) := by - simp[revDerivProj, revDeriv.proj_rule] + unfold revDerivProj; simp[revDeriv.proj_rule] theorem comp_rule (f : Y → E) (g : X → Y) @@ -361,7 +361,7 @@ theorem comp_rule fun i de => ydg'.2 (zdf'.2 i de)) := by - simp[revDerivProj, revDeriv.comp_rule _ _ _ hf hg] + unfold revDerivProj; simp[revDeriv.comp_rule _ _ _ hf hg] theorem let_rule @@ -377,7 +377,7 @@ theorem let_rule let dxy := zdf'.2 i dei ydg'.2 dxy.2 dxy.1) := by - simp[revDerivProj, revDerivUpdate, revDeriv.let_rule _ _ _ hf hg] + unfold revDerivProj; simp[revDeriv.let_rule _ _ _ hf hg] theorem pi_rule (f : X → ι → Y) (hf : ∀ i, HasAdjDiff K (f · i)) @@ -426,7 +426,7 @@ theorem const_rule (x : E) (x, fun i de dx => dx) := by - simp[revDerivProjUpdate,revDerivProj.const_rule] + unfold revDerivProjUpdate; simp[revDerivProj.const_rule] variable {Y} @@ -1274,7 +1274,9 @@ theorem HMul.hMul.arg_a0a1.revDeriv_rule fun x => let ydf := revDerivUpdate K f x let zdg := revDeriv K g x - (ydf.1 * zdg.1, fun dx' => (ydf.2 (conj zdg.1 * dx') (zdg.2 (conj ydf.1 * dx')))) := + (ydf.1 * zdg.1, fun dx' => + let dx' := dx' + (ydf.2 (conj zdg.1 * dx') (zdg.2 (conj ydf.1 * dx')))) := by have ⟨_,_⟩ := hf have ⟨_,_⟩ := hg @@ -1290,7 +1292,9 @@ theorem HMul.hMul.arg_a0a1.revDerivUpdate_rule fun x => let ydf := revDerivUpdate K f x let zdg := revDerivUpdate K g x - (ydf.1 * zdg.1, fun dx' dx => (ydf.2 (conj zdg.1 * dx') (zdg.2 (conj ydf.1 * dx') dx))) := + (ydf.1 * zdg.1, fun dx' dx => + let dx' := dx' + (ydf.2 (conj zdg.1 * dx') (zdg.2 (conj ydf.1 * dx') dx))) := by have ⟨_,_⟩ := hf have ⟨_,_⟩ := hg @@ -1306,7 +1310,9 @@ theorem HMul.hMul.arg_a0a1.revDerivProj_rule fun x => let ydf := revDerivUpdate K f x let zdg := revDeriv K g x - (ydf.1 * zdg.1, fun _ dy => ydf.2 ((conj zdg.1)*dy) (zdg.2 (conj ydf.1* dy))) := + (ydf.1 * zdg.1, fun _ dy => + let dy := dy + ydf.2 ((conj zdg.1)*dy) (zdg.2 (conj ydf.1* dy))) := by unfold revDerivProj ftrans; simp[oneHot, structMake] @@ -1320,7 +1326,9 @@ theorem HMul.hMul.arg_a0a1.revDerivProjUpdate_rule fun x => let ydf := revDerivUpdate K f x let zdg := revDerivUpdate K g x - (ydf.1 * zdg.1, fun _ dy dx => ydf.2 ((conj zdg.1)*dy) (zdg.2 (conj ydf.1* dy) dx)) := + (ydf.1 * zdg.1, fun _ dy dx => + let dy := dy + ydf.2 ((conj zdg.1)*dy) (zdg.2 (conj ydf.1* dy) dx)) := by unfold revDerivProjUpdate ftrans; simp[revDerivUpdate,add_assoc] @@ -1432,6 +1440,7 @@ theorem HDiv.hDiv.arg_a0a1.revDerivUpdate_rule let b := c * conj zdg.1 ((zdg.2 (a • dx') (ydf.2 (b • dx') dx)))) := by + funext simp[revDerivUpdate]; ftrans simp[revDerivUpdate,smul_push,neg_pull,revDeriv,smul_add,smul_sub,add_assoc,mul_assoc] @@ -1542,9 +1551,7 @@ theorem SciLean.EnumType.sum.arg_f.revDeriv_rule {ι : Type} [EnumType ι] by have _ := fun i => (hf i).1 have _ := fun i => (hf i).2 - simp [revDeriv] - funext x; simp - ftrans; ftrans + funext sorry_proof @@ -1581,7 +1588,7 @@ theorem SciLean.EnumType.sum.arg_f.revDerivProj_rule {ι : Type} [EnumType ι] dx := ydf.2 (j,i) dy dx dx) := by - simp[revDerivProj]; ftrans; simp; sorry_proof + funext; simp[revDerivProj]; ftrans; simp; sorry_proof @[ftrans] @@ -1598,7 +1605,7 @@ theorem SciLean.EnumType.sum.arg_f.revDerivProjUpdate_rule {ι : Type} [EnumType dx := ydf.2 (j,i) dy dx dx) := by - simp[revDerivProjUpdate]; ftrans; simp; sorry_proof + funext; simp[revDerivProjUpdate]; ftrans; simp; sorry_proof -- d/ite ----------------------------------------------------------------------- @@ -1740,7 +1747,7 @@ theorem Inner.inner.arg_a0a1.revDeriv_rule by have ⟨_,_⟩ := hf have ⟨_,_⟩ := hg - simp[revDeriv,revDerivUpdate] + funext; simp[revDeriv,revDerivUpdate] ftrans only; simp ftrans; simp[smul_pull] @@ -1758,7 +1765,7 @@ theorem Inner.inner.arg_a0a1.revDerivUpdate_rule y₂dg.2 (dr • y₁df.1) (y₁df.2 (dr • y₂dg.1) dx) ) := by - simp[revDerivUpdate] + unfold revDerivUpdate ftrans; simp[revDerivUpdate,add_assoc] @[ftrans] @@ -1774,6 +1781,7 @@ theorem Inner.inner.arg_a0a1.revDerivProj_rule fun _ dr => y₂dg.2 (dr • y₁df.1) (y₁df.2 (dr • y₂dg.1))) := by + funext simp[revDerivProj] ftrans; simp[oneHot, structMake] @@ -1790,6 +1798,7 @@ theorem Inner.inner.arg_a0a1.revDerivProjUpdate_rule fun _ dr dx => y₂dg.2 (dr • y₁df.1) (y₁df.2 (dr • y₂dg.1) dx)) := by + funext simp[revDerivProjUpdate] ftrans; simp[revDerivUpdate,add_assoc] diff --git a/SciLean/Core/Monads/ForIn.lean b/SciLean/Core/Monads/ForIn.lean index f54bd95b..467e44b2 100644 --- a/SciLean/Core/Monads/ForIn.lean +++ b/SciLean/Core/Monads/ForIn.lean @@ -61,8 +61,11 @@ example let ydy ← fwdDerivM K (fun (xy : X×Y) => f xy.1 a xy.2) (x,ydy.1) (dx,ydy.2) return .yield ydy) := by + funext simp [forIn,Std.Range.forIn,Std.Range.forIn.loop,Std.Range.forIn.loop.match_1] ftrans + rfl + -------------------------------------------------------------------------------- diff --git a/SciLean/Core/Monads/Id.lean b/SciLean/Core/Monads/Id.lean index 4ae3f2d0..b9d42518 100644 --- a/SciLean/Core/Monads/Id.lean +++ b/SciLean/Core/Monads/Id.lean @@ -30,7 +30,7 @@ noncomputable instance : RevDerivMonad K Id Id where revDerivM f := revCDeriv K f HasAdjDiffM f := HasAdjDiff K f - revDerivM_pure f := by simp[pure,revCDeriv] + revDerivM_pure f := by intros; funext; simp[pure,revCDeriv] revDerivM_bind := by intros; simp; ftrans; rfl revDerivM_pair y := by intros; simp; ftrans; simp[revCDeriv] HasAdjDiffM_pure := by simp[pure] diff --git a/SciLean/Core/Monads/StateT.lean b/SciLean/Core/Monads/StateT.lean index 970a6ca1..eead4d03 100644 --- a/SciLean/Core/Monads/StateT.lean +++ b/SciLean/Core/Monads/StateT.lean @@ -24,8 +24,8 @@ instance (S : Type _) [Vec K S] : FwdDerivMonad K (StateT S m) (StateT (S×S) m' fwdDerivM_pure f h := by + intros; funext; simp[pure, StateT.pure, fwdCDeriv] - funext x dx sds ftrans simp [fwdCDeriv] @@ -89,6 +89,7 @@ theorem _root_.getThe.arg.fwdDerivValM_rule = getThe (S×S) := by + funext simp[getThe, MonadStateOf.get, StateT.get,fwdDerivValM, fwdDerivM, pure, StateT.pure] ftrans simp @@ -111,6 +112,7 @@ theorem _root_.MonadState.get.arg.fwdDerivValM_rule = get := by + funext simp[MonadState.get, getThe, MonadStateOf.get, StateT.get,fwdDerivValM, fwdDerivM] ftrans simp @@ -163,6 +165,7 @@ theorem _root_.MonadStateOf.set.arg_a0.fwdDerivM_rule set sds pure ((),())) := by + funext simp[set, StateT.set,fwdDerivM, bind,Bind.bind, StateT.bind] ftrans; congr; simp; rfl @@ -190,6 +193,7 @@ theorem _root_.modifyThe.arg_f.fwdDerivM_rule sds) pure ((),())) := by + funext simp[modifyThe, modifyGet, MonadStateOf.modifyGet, StateT.modifyGet,fwdDerivM,bind,Bind.bind, StateT.bind] ftrans; congr; simp; rfl @@ -217,6 +221,7 @@ theorem _root_.modify.arg_f.fwdDerivM_rule sds) pure ((),())) := by + funext simp[modify, modifyGet, MonadStateOf.modifyGet, StateT.modifyGet,fwdDerivM,bind,Bind.bind, StateT.bind] ftrans; congr; simp; rfl @@ -241,10 +246,10 @@ instance (S : Type _) [SemiInnerProductSpace K S] : RevDerivMonad K (StateT S m) revDerivM_pure f h := by + funext simp[pure, StateT.pure, revCDeriv] - funext x s ftrans - simp [revCDeriv] + simp [revCDeriv]; rfl revDerivM_bind f g hf hg := by @@ -262,7 +267,7 @@ instance (S : Type _) [SemiInnerProductSpace K S] : RevDerivMonad K (StateT S m) simp[bind, StateT.bind, StateT.bind.match_1, pure, StateT.pure] ftrans only simp - congr; funext ysdf; congr; funext dx ds; congr; funext (dx,ds); simp + congr; funext ysdf; congr; funext dx ds; congr; funext (dx,ds); simp; rfl HasAdjDiffM_pure f hf := by @@ -307,8 +312,9 @@ theorem _root_.getThe.arg.revDerivValM_rule (do pure ((← getThe S), fun ds => modifyThe S (fun ds' => ds + ds'))) := by + funext simp[getThe, MonadStateOf.get, StateT.get,revDerivValM, revDerivM, pure, StateT.pure, bind, StateT.bind, set, StateT.set, modifyThe, modify, MonadStateOf.modifyGet, StateT.modifyGet] - ftrans; simp + ftrans; simp; congr -- MonadState.get -------------------------------------------------------------- -------------------------------------------------------------------------------- @@ -329,8 +335,9 @@ theorem _root_.MonadState.get.arg.revDerivValM_rule (do pure ((← get), fun ds => modify (fun ds' => ds + ds'))) := by + funext simp[MonadState.get, getThe, MonadStateOf.get, StateT.get,revDerivValM, revDerivM, pure, StateT.pure, bind, StateT.bind, set, StateT.set, modifyThe, modify, MonadStateOf.modifyGet, StateT.modifyGet, modifyGet] - ftrans; simp + ftrans; simp; congr -- -- setThe ---------------------------------------------------------------------- @@ -387,8 +394,9 @@ theorem _root_.MonadStateOf.set.arg_a0.revDerivM_rule set (0:S) pure dx)) := by + funext simp[set, StateT.set, revDerivM, getThe, MonadStateOf.get, StateT.get, bind, StateT.bind, pure, StateT.pure, get] - ftrans; simp + ftrans; simp; congr; funext; simp[StateT.get, StateT.bind,StateT.set,StateT.pure] -- -- modifyThe ---------------------------------------------------------------------- -- -------------------------------------------------------------------------------- @@ -446,8 +454,9 @@ theorem _root_.modify.arg_f.revDerivM_rule set dxs.2 pure dxs.1)) := by + funext simp[modifyThe, modifyGet, MonadStateOf.modifyGet, StateT.modifyGet,revDerivM, bind, StateT.bind, getThe, MonadStateOf.get, StateT.get, set, StateT.set, get, pure, StateT.pure, modify] - ftrans; simp + ftrans; simp; congr; funext; simp[StateT.bind,StateT.pure,StateT.get,StateT.set] end RevDerivMonad diff --git a/SciLean/Core/Objects/IsomorphicType.lean b/SciLean/Core/Objects/IsomorphicType.lean index 5f734bc2..ff395577 100644 --- a/SciLean/Core/Objects/IsomorphicType.lean +++ b/SciLean/Core/Objects/IsomorphicType.lean @@ -61,8 +61,8 @@ instance : IsomorphicType tag (α → β) (α' → β') where equiv := { toFun := fun f => isomorph tag f invFun := fun f => invIsomorph tag f - left_inv := by simp[-isomorph.app, Function.LeftInverse, IsomorphicType.equiv, isomorph, invIsomorph] - right_inv := by simp[Function.LeftInverse, Function.RightInverse, IsomorphicType.equiv, isomorph, invIsomorph] + left_inv := by intro f; funext x; simp [-isomorph.app, IsomorphicType.equiv, isomorph, invIsomorph] + right_inv := by intro f; funext x; simp[IsomorphicType.equiv, isomorph, invIsomorph] } instance (P : Prop) : IsomorphicType tag P P where diff --git a/SciLean/Data/ArrayType/Algebra.lean b/SciLean/Data/ArrayType/Algebra.lean index 7c4f24ff..eeba009a 100644 --- a/SciLean/Data/ArrayType/Algebra.lean +++ b/SciLean/Data/ArrayType/Algebra.lean @@ -54,32 +54,32 @@ instance (priority := low) [ArrayType Cont Idx Elem] [Vec K Elem] [TestFunctions : TestFunctions Cont where TestFunction x := ∀ i, TestFunction (x[i]) -noncomputable -instance (priority := low) [ArrayType Cont Idx Elem] [NormedAddCommGroup Elem] - : NormedAddCommGroup Cont where - norm := fun x => (∑ i, ‖x[i]‖^2).sqrt - dist_self := sorry_proof - dist_comm := sorry_proof - dist_triangle := sorry_proof - edist_dist := sorry_proof - eq_of_dist_eq_zero := sorry_proof - -instance (priority := low) [ArrayType Cont Idx Elem] [NormedAddCommGroup Elem] [NormedSpace K Elem] - : NormedSpace K Cont where - one_smul := sorry_proof - mul_smul := sorry_proof - smul_zero := sorry_proof - smul_add := sorry_proof - add_smul := sorry_proof - zero_smul := sorry_proof - norm_smul_le := sorry_proof - -instance (priority := low) [ArrayType Cont Idx Elem] [NormedAddCommGroup Elem] [InnerProductSpace K Elem] - : InnerProductSpace K Cont where - norm_sq_eq_inner := sorry_proof - conj_symm := sorry_proof - add_left := sorry_proof - smul_left := sorry_proof +-- noncomputable +-- instance (priority := low) [ArrayType Cont Idx Elem] [NormedAddCommGroup Elem] +-- : NormedAddCommGroup Cont where +-- norm := fun x => (∑ i, ‖x[i]‖^2).sqrt +-- dist_self := sorry_proof +-- dist_comm := sorry_proof +-- dist_triangle := sorry_proof +-- edist_dist := sorry_proof +-- eq_of_dist_eq_zero := sorry_proof + +-- instance (priority := low) [ArrayType Cont Idx Elem] [NormedAddCommGroup Elem] [NormedSpace K Elem] +-- : NormedSpace K Cont where +-- one_smul := sorry_proof +-- mul_smul := sorry_proof +-- smul_zero := sorry_proof +-- smul_add := sorry_proof +-- add_smul := sorry_proof +-- zero_smul := sorry_proof +-- norm_smul_le := sorry_proof + +-- instance (priority := low) [ArrayType Cont Idx Elem] [NormedAddCommGroup Elem] [InnerProductSpace K Elem] +-- : InnerProductSpace K Cont where +-- norm_sq_eq_inner := sorry_proof +-- conj_symm := sorry_proof +-- add_left := sorry_proof +-- smul_left := sorry_proof instance (priority := low) [ArrayType Cont Idx Elem] [SemiInnerProductSpace K Elem] : SemiInnerProductSpace K Cont where diff --git a/SciLean/Data/ArrayType/Properties.lean b/SciLean/Data/ArrayType/Properties.lean index 97a4d021..27fd3107 100644 --- a/SciLean/Data/ArrayType/Properties.lean +++ b/SciLean/Data/ArrayType/Properties.lean @@ -29,17 +29,17 @@ variable -- (hf : IsContinuousLinearMap K f) -- : IsContinuousLinearMap K (λ x => getElem (f x) idx dom) := sorry_proof -@[fprop] -theorem GetElem.getElem.arg_xs.Differentiable_rule - (f : X → Cont) (idx : Idx) (dom) - (hf : Differentiable K f) - : Differentiable K (λ x => getElem (f x) idx dom) := sorry_proof +-- @[fprop] +-- theorem GetElem.getElem.arg_xs.Differentiable_rule +-- (f : X → Cont) (idx : Idx) (dom) +-- (hf : Differentiable K f) +-- : Differentiable K (λ x => getElem (f x) idx dom) := sorry_proof -@[fprop] -theorem GetElem.getElem.arg_xs.DifferentiableAt_rule - (f : X → Cont) (idx : Idx) (dom) (x : X) - (hf : DifferentiableAt K f x) - : DifferentiableAt K (λ x => getElem (f x) idx dom) x := sorry_proof +-- @[fprop] +-- theorem GetElem.getElem.arg_xs.DifferentiableAt_rule +-- (f : X → Cont) (idx : Idx) (dom) (x : X) +-- (hf : DifferentiableAt K f x) +-- : DifferentiableAt K (λ x => getElem (f x) idx dom) x := sorry_proof -- TODO: fderiv, fwdFDeriv, adjoint, revFDeriv @@ -285,23 +285,23 @@ variable {X : Type _} [NormedAddCommGroup X] [NormedSpace K X] [NormedAddCommGroup Elem] [NormedSpace K Elem] -@[fprop] -theorem SetElem.setElem.arg_elem.IsContinuousLinearMap_rule - (cont : X → Cont) (idx : Idx) (elem : X → Elem) - (hcont : IsContinuousLinearMap K cont) (helem : IsContinuousLinearMap K elem) - : IsContinuousLinearMap K (λ x => setElem (0:Cont) idx (elem x)) := sorry_proof +-- @[fprop] +-- theorem SetElem.setElem.arg_elem.IsContinuousLinearMap_rule +-- (cont : X → Cont) (idx : Idx) (elem : X → Elem) +-- (hcont : IsContinuousLinearMap K cont) (helem : IsContinuousLinearMap K elem) +-- : IsContinuousLinearMap K (λ x => setElem (0:Cont) idx (elem x)) := sorry_proof -@[fprop] -theorem SetElem.setElem.arg_contelem.Differentiable_rule - (cont : X → Cont) (idx : Idx) (elem : X → Elem) - (hcont : Differentiable K cont) (helem : Differentiable K elem) - : Differentiable K (λ x => setElem (cont x) idx (elem x)) := sorry_proof +-- @[fprop] +-- theorem SetElem.setElem.arg_contelem.Differentiable_rule +-- (cont : X → Cont) (idx : Idx) (elem : X → Elem) +-- (hcont : Differentiable K cont) (helem : Differentiable K elem) +-- : Differentiable K (λ x => setElem (cont x) idx (elem x)) := sorry_proof -@[fprop] -theorem SetElem.setElem.arg_contelem.DifferentiableAt_rule - (cont : X → Cont) (idx : Idx) (elem : X → Elem) (x : X) - (hcont : DifferentiableAt K cont x) (helem : DifferentiableAt K elem x) - : DifferentiableAt K (λ x => setElem (cont x) idx (elem x)) x := sorry_proof +-- @[fprop] +-- theorem SetElem.setElem.arg_contelem.DifferentiableAt_rule +-- (cont : X → Cont) (idx : Idx) (elem : X → Elem) (x : X) +-- (hcont : DifferentiableAt K cont x) (helem : DifferentiableAt K elem x) +-- : DifferentiableAt K (λ x => setElem (cont x) idx (elem x)) x := sorry_proof end OnNormedSpaces @@ -474,23 +474,23 @@ variable {X : Type _} [NormedAddCommGroup X] [NormedSpace K X] [NormedAddCommGroup Elem] [NormedSpace K Elem] -@[fprop] -theorem IntroElem.introElem.arg_f.IsContinuousLinearMap_rule - (f : X → Idx → Elem) - (hf : IsContinuousLinearMap K f) - : IsContinuousLinearMap K (λ x => introElem (Cont:=Cont) (f x)) := sorry_proof +-- @[fprop] +-- theorem IntroElem.introElem.arg_f.IsContinuousLinearMap_rule +-- (f : X → Idx → Elem) +-- (hf : IsContinuousLinearMap K f) +-- : IsContinuousLinearMap K (λ x => introElem (Cont:=Cont) (f x)) := sorry_proof -@[fprop] -theorem IntroElem.introElem.arg_f.Differentiable_rule [Fintype Idx] - (f : X → Idx → Elem) - (hf : Differentiable K f) - : Differentiable K (λ x => introElem (Cont:=Cont) (f x)) := sorry_proof +-- @[fprop] +-- theorem IntroElem.introElem.arg_f.Differentiable_rule [Fintype Idx] +-- (f : X → Idx → Elem) +-- (hf : Differentiable K f) +-- : Differentiable K (λ x => introElem (Cont:=Cont) (f x)) := sorry_proof -@[fprop] -theorem IntroElem.introElem.arg_f.DifferentiableAt_rule [Fintype Idx] - (f : X → Idx → Elem) (x : X) - (hf : DifferentiableAt K f x) - : DifferentiableAt K (λ x => introElem (Cont:=Cont) (f x)) x := sorry_proof +-- @[fprop] +-- theorem IntroElem.introElem.arg_f.DifferentiableAt_rule [Fintype Idx] +-- (f : X → Idx → Elem) (x : X) +-- (hf : DifferentiableAt K f x) +-- : DifferentiableAt K (λ x => introElem (Cont:=Cont) (f x)) x := sorry_proof end OnNormedSpaces @@ -641,31 +641,31 @@ variable {X : Type _} [NormedAddCommGroup X] [NormedSpace K X] [NormedAddCommGroup Elem] [NormedSpace K Elem] -@[fprop] -theorem ArrayType.map.arg_f.IsContinuousLinearMap_rule - (f : X → Elem → Elem) (arr : Cont) - (hf : IsContinuousLinearMap K f) - : IsContinuousLinearMap K (λ x => map (f x) arr) := sorry_proof +-- @[fprop] +-- theorem ArrayType.map.arg_f.IsContinuousLinearMap_rule +-- (f : X → Elem → Elem) (arr : Cont) +-- (hf : IsContinuousLinearMap K f) +-- : IsContinuousLinearMap K (λ x => map (f x) arr) := sorry_proof -@[fprop] -theorem ArrayType.map.arg_arr.IsContinuousLinearMap_rule - (f : Elem → Elem) (arr : X → Cont) - (harr : IsContinuousLinearMap K arr) - : IsContinuousLinearMap K (λ x => map f (arr x)) := sorry_proof +-- @[fprop] +-- theorem ArrayType.map.arg_arr.IsContinuousLinearMap_rule +-- (f : Elem → Elem) (arr : X → Cont) +-- (harr : IsContinuousLinearMap K arr) +-- : IsContinuousLinearMap K (λ x => map f (arr x)) := sorry_proof -@[fprop] -theorem ArrayType.map.arg_farr.Differentiable_rule - (f : X → Elem → Elem) (arr : X → Cont) - (hf : Differentiable K (fun (xe : X×Elem) => f xe.1 xe.2)) - (harr : Differentiable K arr) - : Differentiable K (λ x => map (f x) (arr x)) := sorry_proof +-- @[fprop] +-- theorem ArrayType.map.arg_farr.Differentiable_rule +-- (f : X → Elem → Elem) (arr : X → Cont) +-- (hf : Differentiable K (fun (xe : X×Elem) => f xe.1 xe.2)) +-- (harr : Differentiable K arr) +-- : Differentiable K (λ x => map (f x) (arr x)) := sorry_proof -@[fprop] -theorem ArrayType.map.arg_farr.DifferentiableAt_rule - (f : X → Elem → Elem) (arr : X → Cont) (x : X) - (hf : ∀ i, DifferentiableAt K (fun (xe : X×Elem) => f xe.1 xe.2) (x, (arr x)[i])) - (harr : DifferentiableAt K arr x) - : DifferentiableAt K (λ x => map (f x) (arr x)) x := sorry_proof +-- @[fprop] +-- theorem ArrayType.map.arg_farr.DifferentiableAt_rule +-- (f : X → Elem → Elem) (arr : X → Cont) (x : X) +-- (hf : ∀ i, DifferentiableAt K (fun (xe : X×Elem) => f xe.1 xe.2) (x, (arr x)[i])) +-- (harr : DifferentiableAt K arr x) +-- : DifferentiableAt K (λ x => map (f x) (arr x)) x := sorry_proof -- TODO: fderiv, fwdFDeriv, adjoint, revFDeriv diff --git a/lake-manifest.json b/lake-manifest.json index 5418b925..ae23ea79 100644 --- a/lake-manifest.json +++ b/lake-manifest.json @@ -1,52 +1,59 @@ -{"version": 6, - "packagesDir": "lake-packages", +{"version": 7, + "packagesDir": ".lake/packages", "packages": - [{"git": - {"url": "https://github.com/leanprover-community/mathlib4", - "subDir?": null, - "rev": "9e03d9ced7ba4d2bf95f9ed7da0e3a3ffbc81d9e", - "opts": {}, - "name": "mathlib", - "inputRev?": "master", - "inherited": false}}, - {"git": - {"url": "https://github.com/leanprover/std4", - "subDir?": null, - "rev": "fb07d160aff0e8bdf403a78a5167fc7acf9c8227", - "opts": {}, - "name": "std", - "inputRev?": "main", - "inherited": true}}, - {"git": - {"url": "https://github.com/leanprover-community/quote4", - "subDir?": null, - "rev": "511eb96eca98a7474683b8ae55193a7e7c51bc39", - "opts": {}, - "name": "Qq", - "inputRev?": "master", - "inherited": true}}, - {"git": - {"url": "https://github.com/leanprover-community/aesop", - "subDir?": null, - "rev": "cb87803274405db79ec578fc07c4730c093efb90", - "opts": {}, - "name": "aesop", - "inputRev?": "master", - "inherited": true}}, - {"git": - {"url": "https://github.com/leanprover/lean4-cli", - "subDir?": null, - "rev": "a751d21d4b68c999accb6fc5d960538af26ad5ec", - "opts": {}, - "name": "Cli", - "inputRev?": "main", - "inherited": true}}, - {"git": - {"url": "https://github.com/leanprover-community/ProofWidgets4", - "subDir?": null, - "rev": "f1a5c7808b001305ba07d8626f45ee054282f589", - "opts": {}, - "name": "proofwidgets", - "inputRev?": "v0.0.21", - "inherited": true}}], - "name": "scilean"} + [{"url": "https://github.com/leanprover/std4", + "type": "git", + "subDir": null, + "rev": "bf8a6ea960d5a99f8e30cbf5597ab05cd233eadf", + "name": "std", + "manifestFile": "lake-manifest.json", + "inputRev": "main", + "inherited": true, + "configFile": "lakefile.lean"}, + {"url": "https://github.com/leanprover-community/quote4", + "type": "git", + "subDir": null, + "rev": "d3a1d25f3eba0d93a58d5d3d027ffa78ece07755", + "name": "Qq", + "manifestFile": "lake-manifest.json", + "inputRev": "master", + "inherited": true, + "configFile": "lakefile.lean"}, + {"url": "https://github.com/leanprover-community/aesop", + "type": "git", + "subDir": null, + "rev": "c7cff4551258d31c0d2d453b3f9cbca757d445f1", + "name": "aesop", + "manifestFile": "lake-manifest.json", + "inputRev": "master", + "inherited": true, + "configFile": "lakefile.lean"}, + {"url": "https://github.com/leanprover-community/ProofWidgets4", + "type": "git", + "subDir": null, + "rev": "909febc72b4f64628f8d35cd0554f8a90b6e0749", + "name": "proofwidgets", + "manifestFile": "lake-manifest.json", + "inputRev": "v0.0.23", + "inherited": true, + "configFile": "lakefile.lean"}, + {"url": "https://github.com/leanprover/lean4-cli", + "type": "git", + "subDir": null, + "rev": "a751d21d4b68c999accb6fc5d960538af26ad5ec", + "name": "Cli", + "manifestFile": "lake-manifest.json", + "inputRev": "main", + "inherited": true, + "configFile": "lakefile.lean"}, + {"url": "https://github.com/leanprover-community/mathlib4", + "type": "git", + "subDir": null, + "rev": "ce7d2c1bca1c28a59234520e4e8026b2c3437f57", + "name": "mathlib", + "manifestFile": "lake-manifest.json", + "inputRev": "master", + "inherited": false, + "configFile": "lakefile.lean"}], + "name": "scilean", + "lakeDir": ".lake"} diff --git a/lean-toolchain b/lean-toolchain index 734efddd..24a3cdb8 100644 --- a/lean-toolchain +++ b/lean-toolchain @@ -1 +1 @@ -leanprover/lean4:v4.3.0-rc1 \ No newline at end of file +leanprover/lean4:v4.3.0-rc2 diff --git a/test/basic_gradients.lean b/test/basic_gradients.lean index 622d22c1..a985b2b4 100644 --- a/test/basic_gradients.lean +++ b/test/basic_gradients.lean @@ -228,6 +228,6 @@ example (w : K ^ (Idx' (-5) 5 × Idx' (-5) 5)) ⊞ i => ∑ (j : (Idx' (-5) 5 × Idx' (-5) 5)), w[(j.2,j.1)] * dy[(-j.2.1 +ᵥ i.fst, -j.1.1 +ᵥ i.snd)] := by conv => lhs; unfold gradient; ftrans - + sorry_proof diff --git a/test/generate_ftrans.lean b/test/generate_ftrans.lean index c3c3cede..47a6b2cf 100644 --- a/test/generate_ftrans.lean +++ b/test/generate_ftrans.lean @@ -1,4 +1,5 @@ import SciLean.Core +import SciLean.Core.Meta.GenerateRevCDeriv' open Lean SciLean