backward - A Backward-Chaining Inference Engine
A simple programming language and inference engine powered by backward chaining. When given rules and facts, it will deduce new information.
Installation
pip install backward
Usage
>>> from backward import Backward
>>> ctx = Backward()
>>> _ = ctx.evaluate("a => b")
>>> _ = ctx.evaluate("b => c")
>>> _ = ctx.evaluate("= a") # a is true
>>> ctx.evaluate("a b c") # are b and c true?
[True, True, True]
You can also type python -m backward into your shell to enter an interactive REPL.
Syntax
C => E # C implies E A & B & C => D # A and B and C implies D A | B => C # A or B implies C A & !B => F # A and not B implies F C | !G => H # C or not G implies H V ^ W => X # V xor W implies X A & B => Y & Z # A and B implies Y and Z = A B G # Initial facts : A, B and G are true. All others are false. G V X # What are G, V and X ?
Contributing
Pull requests are welcome. For major changes, please open an issue first to discuss what you would like to change. Please make sure to update tests as appropriate.
Metadata
Release files for backward 0.0.4
For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.
Source distribution (sdist)
| File | Size | Uploaded | |
|---|---|---|---|
| backward-0.0.4.tar.gz | 4.2 kB | Details |
Built distribution (wheel)
| File | Interpreter | ABI | Platform | Reset |
|---|---|---|---|---|
| backward-0.0.4-py3-none-any.whl | Python 3 | none | any | Details |
Total release size: 13.3 kB
Release files / backward-0.0.4.tar.gz
| Download URL | backward-0.0.4.tar.gz |
|---|---|
| Size | 4.2 kB |
| Tags | Source |
|
SHA-256 checksum How to use checksums |
6d2f83ae03331bcce1f900e64122f314b37293ce63a25002ed91a5a52cd41fdc
|
|
BLAKE2b-256 checksum How to use checksums |
c3d933df1dc2dd7bc230e109a54ee72c31d30343f653e85c591745c27bc67836
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
No |
| Uploaded via |
twine/3.2.0 pkginfo/1.5.0.1 requests/2.24.0 setuptools/41.2.0 requests-toolbelt/0.9.1 tqdm/4.47.0 CPython/3.8.3
|
Release files / backward-0.0.4-py3-none-any.whl
| Download URL | backward-0.0.4-py3-none-any.whl |
|---|---|
| Size | 9.1 kB |
| Tags | Python 3 |
|
SHA-256 checksum How to use checksums |
d0179533763c1b303b00ab7dc1d145384e8a501834fd0bed4fba2cf0dce2de1e
|
|
BLAKE2b-256 checksum How to use checksums |
18c4501d046cc949f419422be2bdc5d64054fefd34c6b3392d74e472344736c9
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
No |
| Uploaded via |
twine/3.2.0 pkginfo/1.5.0.1 requests/2.24.0 setuptools/41.2.0 requests-toolbelt/0.9.1 tqdm/4.47.0 CPython/3.8.3
|