Module ImportFrom alias alias ImportFrom alias alias alias ImportFrom alias ClassDef bases NameLoad body Assign NameStore Num FunctionDef arguments args NameParam NameParam defaults NameLoad body Assign AttributeStore NameLoad attr Call NameLoad Assign AttributeStore NameLoad attr Call NameLoad If UnaryOpNot NameLoad body Assign NameStore BinOpMod Str AttributeLoad NameLoad attr AugAssignAdd AttributeStore NameLoad attr Num Assign AttributeStore NameLoad attr NameLoad decorator_list FunctionDef arguments args NameParam defaults vararg body Expr Str Assign NameStore Call NameLoad NameLoad Expr Call AttributeLoad AttributeLoad NameLoad attr attr NameLoad For NameStore Call NameLoad NameLoad body If CompareNotIn NameLoad AttributeLoad NameLoad attr body Assign SubscriptStore AttributeLoad NameLoad attr Index NameLoad Call NameLoad Expr Call AttributeLoad SubscriptLoad AttributeLoad NameLoad attr Index NameLoad attr NameLoad decorator_list FunctionDef arguments args NameParam defaults vararg body FunctionDef arguments args NameParam defaults body Assign NameStore Call NameLoad NameLoad NameLoad Assign NameStore ListComp SubscriptLoad AttributeLoad NameLoad attr Index NameLoad comprehension NameStore Call NameLoad NameLoad CompareIn NameLoad AttributeLoad NameLoad attr If NameLoad body Assign NameStore Call NameLoad Call NameLoad NameLoad keyword NameLoad orelse Assign NameStore AttributeLoad NameLoad attr Assign NameStore ListComp NameLoad comprehension TupleStore NameStore NameStore Call NameLoad NameLoad Call NameLoad NameLoad Assign NameStore ListComp NameLoad comprehension TupleStore NameStore NameStore Call NameLoad NameLoad UnaryOpNot Call NameLoad NameLoad Assign NameStore Call NameLoad NameLoad NameLoad Assign NameStore Call NameLoad NameLoad NameLoad Assert UnaryOpNot Call NameLoad GeneratorExp CompareIn NameLoad NameLoad comprehension NameStore NameLoad Return GeneratorExp Call NameLoad Call NameLoad Call NameLoad NameLoad Call NameLoad NameLoad NameLoad NameLoad comprehension NameStore AttributeLoad NameLoad attr CompareEq NameLoad Call NameLoad NameLoad NameLoad decorator_list Return NameLoad decorator_list FunctionDef arguments args NameParam defaults body Return BinOpAdd Str AttributeLoad NameLoad attr decorator_list Assign NameStore NameLoad decorator_list FunctionDef arguments args NameParam defaults vararg body Expr Str Expr Call AttributeLoad NameLoad attr NameLoad decorator_list FunctionDef arguments args NameParam defaults vararg body Expr Str For NameStore NameLoad body Expr Call NameLoad NameLoad NameLoad decorator_list
N/A util intersection index core conde reify isvar toolz merge Relation N/A object N/A N/A _id 0 __init__ N/A N/A self name N/A None N/A N/A N/A self facts N/A set N/A N/A self index N/A dict N/A N/A name N/A N/A name N/A _%d N/A Relation _id N/A N/A Relation _id 1 N/A N/A self name name N/A add_fact N/A N/A self N/A inputs N/A N/A  Add a fact to the knowledgebase.

        See Also:
            fact
            facts
         N/A fact N/A tuple inputs N/A N/A N/A N/A self facts add fact N/A key N/A enumerate inputs N/A N/A N/A key N/A self index N/A N/A N/A N/A self index N/A key N/A set N/A N/A N/A N/A N/A self index N/A key add fact N/A __call__ N/A N/A self N/A args N/A f N/A N/A s N/A N/A N/A args2 N/A reify args s N/A subsets N/A N/A N/A self index N/A key N/A key N/A enumerate args N/A key N/A self index N/A subsets N/A N/A facts N/A intersection N/A sorted subsets key len N/A N/A facts N/A self facts N/A varinds N/A i N/A N/A i arg N/A enumerate args2 N/A isvar arg N/A valinds N/A i N/A N/A i arg N/A enumerate args2 N/A N/A isvar arg N/A vars N/A index args2 varinds N/A vals N/A index args2 valinds N/A N/A N/A any N/A N/A var s N/A var vars N/A N/A N/A merge N/A dict N/A zip vars N/A index fact varinds s N/A fact N/A self facts N/A vals N/A index fact valinds N/A N/A f N/A __str__ N/A N/A self N/A N/A N/A N/A Rel:  N/A self name N/A N/A __repr__ __str__ N/A fact N/A N/A rel N/A args N/A N/A  Declare a fact

    >>> from logpy import fact, Relation, var, run
    >>> parent = Relation()
    >>> fact(parent, "Homer", "Bart")
    >>> fact(parent, "Homer", "Lisa")

    >>> x = var()
    >>> run(1, x, parent(x, "Bart"))
    ('Homer',)
     N/A N/A N/A rel add_fact args N/A facts N/A N/A rel N/A lists N/A N/A  Declare several facts

    >>> from logpy import fact, Relation, var, run
    >>> parent = Relation()
    >>> facts(parent,  ("Homer", "Bart"),
    ...                ("Homer", "Lisa"))

    >>> x = var()
    >>> run(1, x, parent(x, "Bart"))
    ('Homer',)
     N/A l lists N/A N/A N/A fact rel l N/A