Skip to content
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

Concrete Values #996

Open
wants to merge 30 commits into
base: main
Choose a base branch
from
Open

Concrete Values #996

wants to merge 30 commits into from

Conversation

zaneenders
Copy link
Collaborator

@zaneenders zaneenders commented Sep 30, 2024

This PR surfaces the "true error" of an expression for the local error tree in Odyessy.

Before merging:

  • Finish the Unit test with correct values.
  • Approx Nodes
  • Display values with value->json?
  • Is ulp-error correct?
  • Split out true error from core and remove flag?

@zaneenders zaneenders marked this pull request as draft September 30, 2024 19:09
@zaneenders zaneenders changed the title Basic Difference for local error endpoint. Basic difference for local error endpoint. Sep 30, 2024
@zaneenders zaneenders force-pushed the zane-concrete-values branch 2 times, most recently from d45ea39 to a81c8ca Compare October 2, 2024 19:47
@zaneenders zaneenders force-pushed the zane-concrete-values branch 3 times, most recently from ef428e7 to 10726db Compare October 10, 2024 21:12
@zaneenders zaneenders marked this pull request as ready for review October 10, 2024 22:45
@zaneenders zaneenders changed the title Basic difference for local error endpoint. Concrete Values Oct 13, 2024
src/core/localize.rkt Outdated Show resolved Hide resolved
[(? literal?) 0]
[(? variable?) 0]
[(approx aprx-spec impl) exact] ;; TODO not sure what to do here.
[`(if ,c ,ift ,iff) 0]
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Isn't true error also possible here? Like, shouldn't it be the same as the true error in ift and iff?

(match (vector-ref nodes root)
[(? literal?) 0]
[(? variable?) 0]
[(approx aprx-spec impl) exact] ;; TODO not sure what to do here.
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I think this can also have true error? The exact value is the exact value of aprx-spec, the computed value is the value of impl, they can differ.

src/core/localize.rkt Outdated Show resolved Hide resolved
src/core/localize.rkt Outdated Show resolved Hide resolved
(define modifed-vars (append all-vars `(__exact)))
(define true-error-expr (list `(- ,spec __exact)))
(define diffMachine
(rival-compile true-error-expr modifed-vars (list flonum-discretization)))
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

If this is UI-only maybe it's fine but this way of doing it is slow, because you're compiling a separate machine for every single subexpression and every single input. It would be more efficient to do this in two passes: first compute the exact value for each subexpression for each input; then compile a second machine with one input and output per subexpression and feed in each input + each subexpression's exact value for that input.

Copy link
Collaborator Author

@zaneenders zaneenders Oct 19, 2024

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Ok i'm a little confused on this. Do you mean something like?

(define exact-var-name '__exact)
(define extended
  (for/list ([ctx (in-list ctx-list)])
    (context-extend ctx exact-var-name (context-repr ctx))))
(define compare-specs
  (for/list ([spec (in-list spec-list)])
    `(- ,spec ,exact-var-name)))
(define compare-fn (eval-progs-real compare-specs extended))

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants