You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
We should have a macro that makes writing symbolic functions as easy as writing normal functions. Something like
@symbolic(ThRing) functionfoo(a, b)
a^2+ b^2end
should produce a symbolic function in the theory of rings out of the context [a,b]. Then symbolic functions should be able to be applied inside other symbolic functions, so we could have
@symbolic(ThRing) functionbar(x,y,z)
foo(x,y) +foo(y,z)
end
Of course, this should support types, so that we have
@symbolic(ThModule) functioninterpolate(r::Scalar, v::Vector, w::Vector)::Vector
(1- r) * v + r * w
end
This should extend to "symbolic structs".
@symbolic(ThRing) struct Pos2D
x
y
end@symbolic(ThRing) functionabs2(p::Pos2D)
foo(p.x, p.y)
end
Finally, we should support some sort of "comptime" abstraction, where symbolic functions can have parameters which are Julia values. Something like:
@symbolic(ThRing) functionpower(n::Int)(a)
acc =1for i in (@julia1):n
acc = acc * a
end
acc
end
This would expand into a Julia function that looked something like
functionpower(n::Int)
_context =...
_a =Trm(Lvl(1; context=true))
function_mul(x,y)
Trm(getlevel(ThRing.*), [x,y])
end
_1 =Trm(getlevel(ThRing.one), [])
acc = _1
for i in1:n
acc =_mul(acc, _a)
endTrmInContext(_context, acc)
end
I think this is a good design for how to work with #73. Of course, this takes us dangerously close to implementing Agda in Julia, but I think this actually shouldn't be too hard (famous last words).
The text was updated successfully, but these errors were encountered:
We should have a macro that makes writing symbolic functions as easy as writing normal functions. Something like
should produce a symbolic function in the theory of rings out of the context
[a,b]
. Then symbolic functions should be able to be applied inside other symbolic functions, so we could haveOf course, this should support types, so that we have
This should extend to "symbolic structs".
Finally, we should support some sort of "comptime" abstraction, where symbolic functions can have parameters which are Julia values. Something like:
This would expand into a Julia function that looked something like
I think this is a good design for how to work with #73. Of course, this takes us dangerously close to implementing Agda in Julia, but I think this actually shouldn't be too hard (famous last words).
The text was updated successfully, but these errors were encountered: