Show HN: Vector-logic, a lightweight rules engine from first principles
1–10 of 10 posts
Re: Show HN: Vector-logic, a lightweight rules engine from first principles
#2We built vector-logic (it's on PyPI) and wrote a hands-on guide for Towards Data Science: https://towardsdatascience.com/building-a-rules-engine-from-...
The whole framework is based on a theory we call 'State Algebra,' which we co-authored for arXiv: https://arxiv.org/abs/2509.10326
Happy to answer any questions!
Re: Show HN: Vector-logic, a lightweight rules engine from first principles
#3Re: Show HN: Vector-logic, a lightweight rules engine from first principles
#4How does this compare to something like Prolog?
vector-logic is light-weight propositional logic inference engine. Optimised for simple queries like "what is the value of 'y' given all rules and evidences", and also allows you to iterate through the entire valid set (all valid assignments).
We also bothered to make the interface very simple and intuitive - you'll have very shallow learning curve.
Re: Show HN: Vector-logic, a lightweight rules engine from first principles
#5Re: Show HN: Vector-logic, a lightweight rules engine from first principles
#6Hi Dmitry. This is really cool -- thanks for sharing! This is very clean and intuitive, and it definitely come in handy when I'm mapping out systems logic.
Re: Show HN: Vector-logic, a lightweight rules engine from first principles
#7Re: Show HN: Vector-logic, a lightweight rules engine from first principles
#8Is it brute force or uses some sort of heuristics?
First of all, it uses compact representatin of rules - similar to DNF, but converted to a sparse matrix.
Second, for the inference (which is a process of compiling the knowledge base) the order in which rules are compiled is crucial. We use two types of heuristic optimisations for this process, one is based on Jaccard similarity, another is so called predator-pray heuristics.
Happy to give more details, let me know
Re: Show HN: Vector-logic, a lightweight rules engine from first principles
#9Is it brute force or uses some sort of heuristics?
Good point. Yes, it uses optimisation for various tasks. First of all, it uses compact representatin of rules - similar to DNF, but converted to a sparse matrix. Second, for the inference (which is a process of compiling the knowledge base) the order in which rules are compiled is crucial. We use two types of heuristic optimisations for this process, one is based on Jaccard similarity, another is so called predator-p…
Re: Show HN: Vector-logic, a lightweight rules engine from first principles
#10Earlier quoted context omitted.
Good point. Yes, it uses optimisation for various tasks. First of all, it uses compact representatin of rules - similar to DNF, but converted to a sparse matrix. Second, for the inference (which is a process of compiling the knowledge base) the order in which rules are compiled is crucial. We use two types of heuristic optimisations for this process, one is based on Jaccard similarity, another is so called predator-p…
I checked your benchmarks. Runtime with 30 rules is 5x longer than with 45 rules. Am I missing something?