LNN
LNN copied to clipboard
Downward inference from fully quantified universal
@KyleErwin the code below seems to have two issues
- Setting the truth of the universal quantifier doesn't directly update the proposition
- Downward inference from the universal seems to break
from lnn import *
x = Variable('x')
cry = Predicate('Cry')
sad = Predicate('Sad')
rule = Forall(x, Implies(cry(x), sad(x)))
model = Model()
model.add_knowledge(rule, cry)
model.add_data({
cry: {
'John': Fact.TRUE,
'Bob': Fact.TRUE,
},
rule: Fact.TRUE,
})
model.print()
model.infer()
model.print()
File "lnn/symbolic/logic/unary_operator.py", line 165, in downward
return self._fully_quantified_downward()
File "lnn/symbolic/logic/unary_operator.py", line 270, in _fully_quantified_downward
return operand.neuron.aggregate_bounds(groundings, bounds[..., 0])
IndexError: index 0 is out of bounds for dimension 1 with size 0