Skip to content

add arena evaluator as symbolic alternative, test #18

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

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

Conversation

maxdeliso
Copy link
Owner

@maxdeliso maxdeliso commented Apr 27, 2025

Adds an alternative evaluator which uses a hash-consing arena which guarantees exactly one representation per tree, using pseudorandom integer distribution and a bucketing scheme.

               ┌────────────  “arena”  ────────────┐
               │  parallel columns (contiguous)    │
 index (id)    │ kind  sym  left  right  hash32    │     bucket table
───────────────┼──────────────────────────────── ──┤   (hash → head id)
     0  (S)    │  0     1     –      –       1     │    ┌─┐
     1  (K)    │  0     2     –      –       2     │ h0 │3│──►2──►…  (nextIdx list)
     2  (I)    │  0     3     –      –       3     │    └─┘
     3         │  1     –     0      1     0xA7…   │ h1 ─┬──►4
     4         │  1     –     3      2     0x5C…   │ h2 ─┴──►…
     …         │  …                                │
               └───────────────────────────────────┘

see also: https://www.cs.tufts.edu/~nr/cs257/archive/henry-baker/cons-lazy-alloc.pdf

@maxdeliso maxdeliso self-assigned this Apr 27, 2025
@maxdeliso maxdeliso marked this pull request as ready for review April 27, 2025 21:46
@maxdeliso maxdeliso requested a review from gbenscoter April 28, 2025 02:30
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.

1 participant