Skip to main content

A small programming language that can deduce new information when given a set of rules and facts.

Project description

A small programming language that can deduce new information when given a set of rules and facts.

made-with-python PyPI-package-version PyPI-license PyPI-python-versions travis-ci PyPI-downloads-month

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 call python -m backward from 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.

Project details


Download files

Download the file for your platform. If you're not sure which to choose, learn more about installing packages.

Source Distribution

backward-0.0.2.tar.gz (4.1 kB view details)

Uploaded Source

Built Distribution

backward-0.0.2-py3-none-any.whl (10.6 kB view details)

Uploaded Python 3

File details

Details for the file backward-0.0.2.tar.gz.

File metadata

  • Download URL: backward-0.0.2.tar.gz
  • Upload date:
  • Size: 4.1 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/3.1.1 pkginfo/1.5.0.1 requests/2.23.0 setuptools/46.1.3 requests-toolbelt/0.9.1 tqdm/4.45.0 CPython/3.8.2

File hashes

Hashes for backward-0.0.2.tar.gz
Algorithm Hash digest
SHA256 a3e5d3d01ff9fc46be3e071bed90c7e7d97c0794063f083c89754af51e4bbac0
MD5 ade7f3fd6da36e0b6baf3484571587a5
BLAKE2b-256 d8881fee09f1a3fa01fbe5cfed64634d7a1f69db3e9066da5f9c29dfb9409c2e

See more details on using hashes here.

File details

Details for the file backward-0.0.2-py3-none-any.whl.

File metadata

  • Download URL: backward-0.0.2-py3-none-any.whl
  • Upload date:
  • Size: 10.6 kB
  • Tags: Python 3
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/3.1.1 pkginfo/1.5.0.1 requests/2.23.0 setuptools/46.1.3 requests-toolbelt/0.9.1 tqdm/4.45.0 CPython/3.8.2

File hashes

Hashes for backward-0.0.2-py3-none-any.whl
Algorithm Hash digest
SHA256 66e59352edd00fae91b4e07a1c74a56de479979a0b06949488ee340fe9571ef6
MD5 42c5e8ee0d691e366065f0f71fd05cbe
BLAKE2b-256 14e172cd752ec21ee49e5ad965d46970860b3ad49856c39c4f37de54bc44baec

See more details on using hashes here.

Supported by

AWS AWS Cloud computing and Security Sponsor Datadog Datadog Monitoring Fastly Fastly CDN Google Google Download Analytics Microsoft Microsoft PSF Sponsor Pingdom Pingdom Monitoring Sentry Sentry Error logging StatusPage StatusPage Status page