-
Notifications
You must be signed in to change notification settings - Fork 93
[WIP] ChainRules Mathematical Manifesto #133
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Conversation
The definition of valid differential would be much clearer if written in terms of type unions instead of sets of types. |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Some typos :)
docs/src/math.md
Outdated
|
||
----- | ||
|
||
### REWRITE: Differential Type |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Could we simplify even further by saying something like the following:
A type \mathcal D
is a valid differential type for primal type \mathcal P
if
- addition between a primal in
\mathcal P
and differential in\mathcal D
yields another primal in\mathcal P
- addition of two differentials in
\mathcal D
produces another differential in\mathcal D
. We say that\mathcal D
is closed under addition.
This avoids a lot of mathematical complexity that I'm not sure we really need (unless I'm missing something...)
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
We need the ability to add 2 differentials of different types and come back with another differential, potentially of a 3rd type.
Common example would be [1.0,2.0,3.0] + Zero() = [1.0,2.0,3.0]
another isi
Composite{Foo, NamedTuple{(:x,),Tuple{Float64}})(x=2.0)
+
Composite{Foo, NamedTuple{(:y,),Tuple{Float64}})(y=3.0)
=
Composite{Foo, NamedTuple{(:x,:y),Tuple{Float64,Float64}})(x=2.0, y=3.0)
Co-Authored-By: willtebbutt <[email protected]>
Co-Authored-By: simeonschaub <[email protected]>
Co-Authored-By: willtebbutt <[email protected]>
|
||
It is written around the Julia idea of types. | ||
Which do not nessicarily correspond too closely with the idea of Programming Language Theory (static) types, | ||
nor with type-theory types. |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This can be brought up a line? I think the standard is one sentence per line.
There's also a couple other cases that break this standard throughout.
We thus can have defined different ``+`` | ||
for different input types, and so will not distinguish between them. | ||
The functions thus stand alone from the types, | ||
except that a set of input types may special case them. | ||
Where as most similar definitions might decribe a object as a type and some operations on the type, | ||
we can consider them seperately. |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I feel like this reads a bit strange. I understand what you mean, but with multiple dispatch we would be distinguishing between different types. Just the higher level abstraction of Base.+
would remain the same to the end user.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
There is a fun thing in a lot of math write ups that say:
"A vector space over a field
F
is a setV
together with two operations*
and+
that satisfy the eight axioms"
and treat the *
and +
as part of the vector space.
And then for a different vector space, it will be defined with *'
and +'
etc,
completely distrinct.
Where as we are saying that we will treat +
as always a thing that exists.
But yeah this bit does read weirdly
Co-Authored-By: willtebbutt <[email protected]>
Looks very promising! Just a couple of additional thoughts:
|
|
||
|
||
- If there exists a type-union ``\mathbb U``, with ``\mathcal D <: \mathbb U``, | ||
- if for all ``u :: \mathbb U`` and for all ``p :: \mathcal P``, there exists a ``q :: \mathcal P`` such that `u + p = p + u = q` |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Technically, Rational
s wouldn't form a Primal Type according to this definition, since typemax(Int)//1 + typemax(Int)//1
doesn't correspond to any value q
, since it throws an error. We might want to loosen this and allow for some edge cases throwing exceptions.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Yep, I think a disclaimer at the top about for purposes of these definitions one can ignore overflow underflow etc
We use some notation here based closely off of how JuliaLang indicates type relationships. </br> | ||
- ``d::\mathcal D``: a value ``d`` of type ``\mathcal D``, or the assertion that the value ``d`` has type ``\mathcal D`` </br> |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I don't think the </br>
are necessary?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Yeah, it just fixes how Atom renders it
Indeed we should explain it here. added to the TODO
Yes, we should I just don't know them.
Yeah, but we will ignore that in this write up.
Yeah, basically. |
Here is all the math that I want in the PR. |
Pages 1 and 2, of 9 pages are written |
@oxinabox what's the status of this PR. Has it been superceded? |
Largely superceded by https://www.juliadiff.org/ChainRulesCore.jl/dev/design/many_differentials.html |
Closing this because it is on the wrong package now |
This PR includes my attempt to explain the math behind chainrules.
In particular behind how we define a Differential
Preview Docs Build
TODO: