Herb-AI / HerbConstraints.jl

Constraints for Herb.jl
https://herb-ai.github.io/
MIT License
0 stars 0 forks source link

Stronger inference for `Contains` #50

Open Whebon opened 1 month ago

Whebon commented 1 month ago

The Contains(rule) constraint does a dfs in the program tree and stores all holes that can contain can contain the target rule.

Additionally, each non-uniform hole is also stored in that list, even if that hole does not contain the target rule. This is because the children of a non-uniform hole are not instantiated yet and could potentially hold a 2. Depending on the grammar, this is either possible or not. The constraint could check this property and ignore holes that can, by grammar definition, never expand to the target rule.