Packages

Guesswork is a logic programming library for Elixir. It is heavily inspired by Prolog, but attempts to use idiomatic Elixir when expressing problems and their solutions.

Current section

Files

Jump to
guesswork lib guesswork knowledge_base.ex
Raw

lib/guesswork/knowledge_base.ex

defmodule Guesswork.KnowledgeBase do
@moduledoc """
Represents a querable knowledge base.
"""
alias Guesswork.Ast.Fact
alias Guesswork.Ast.Rule
@doc """
Pulls all facts could match the supplied fact.
The only requirement is that all true matches be returned, so theoretically
all the facts could simply be dumped by the this function.
"""
@callback get_possible_facts(query :: Fact.t()) :: [Fact.t()]
@doc """
Pulls all falsehoods could match the supplied fact.
The only requirement is that all true matches be returned, so theoretically
all the falsehoods could simply be dumped by the this function.
"""
@callback get_possible_falsehoods(query :: Fact.t()) :: [Fact.t()]
@doc """
Pulls all rules could match the supplied fact.
The only requirement is that all true matches be returned, so theoretically
all the rules could simply be dumped by the this function.
"""
@callback get_possible_rules(query :: Fact.t()) :: [Rule.t()]
end