LNN
LNN copied to clipboard
Model equivalence
Allow two models to be compared to one another using __eq__
dunder.
This compares all the formulae, their connectivity and corresponding facts at convergence (i.e. does not consider any gradient computations)
What are the important slots to compare in _Formula
?
I have these slots compared for equivalence:
- name
- world
- arity
- variables
- operands
- unique_vars
What other slots are important for comparison? Is grounding_table also important?
We also want groundings and corresponding truth values. One idea is to compare all groundings gotten from this and then compare their states or more directly their truth tensors. Comparing tensors is more general and applies to fuzzy truth values whereas states are limited to classical logic since for fuzzy logic the state just says it's fuzzy.
#71 included the equivalence checks for objects to allow neurons and symbols to be matched. Since each model is simply a collection of connected formulae, we should have all objects required for this --- each formula will directly tell us about the following:
name world arity variables operands unique_vars
Its still required to pull out the equivalence of different models, which requires us to store/match the variables in the model:
- nodes
- node_names
- query etc.