https://github.com/formulae-org/package-logic-js
Logic package for Fōrmulæ, in JavaScript
https://github.com/formulae-org/package-logic-js
conditional conjunction disjunction equivalence exclusive-disjunction existential-quantifier formulae javascript logic negation predicate-logic predicates universal-quantifiers
Last synced: 6 months ago
JSON representation
Logic package for Fōrmulæ, in JavaScript
- Host: GitHub
- URL: https://github.com/formulae-org/package-logic-js
- Owner: formulae-org
- License: agpl-3.0
- Created: 2023-04-13T04:38:50.000Z (over 2 years ago)
- Default Branch: main
- Last Pushed: 2025-03-21T04:20:49.000Z (7 months ago)
- Last Synced: 2025-03-21T05:23:41.834Z (7 months ago)
- Topics: conditional, conjunction, disjunction, equivalence, exclusive-disjunction, existential-quantifier, formulae, javascript, logic, negation, predicate-logic, predicates, universal-quantifiers
- Language: JavaScript
- Homepage:
- Size: 70.3 KB
- Stars: 1
- Watchers: 1
- Forks: 0
- Open Issues: 0
-
Metadata Files:
- Readme: README.md
- License: LICENSE
Awesome Lists containing this project
README
# package-logic-js
Complex arithmetic package for the [Fōrmulæ](https://formulae.org) programming language.
Fōrmulæ is also a software framework for visualization, edition and manipulation of complex expressions, from many fields. The code for an specific field —i.e. arithmetics— is encapsulated in a single unit called a Fōrmulæ **package**.
This repository contains the source code for the **logic package**. It is intended to the computation of logical operations.
The GitHub organization [formulae-org](https://github.com/formulae-org) encompasses the source code for the rest of packages, as well as the [web application](https://github.com/formulae-org/formulae-js).
### Capabilities ###
* Visualization of the [truth values](https://en.wikipedia.org/wiki/Truth_value) *true* and *false*
* Visualization of logic operations. Users can choose between:
| Operation | Traditional notation | Mnemonic notation |
| ----- |:-----:|:-----:|
| [Negation](https://en.wikipedia.org/wiki/Negation) | $\neg P$ | $\text{NOT } P$ |
| [Conjunction](https://en.wikipedia.org/wiki/Logical_conjunction) | $P \land Q$ | $P \text{ AND } Q$ |
| [Disjunction](https://en.wikipedia.org/wiki/Logical_disjunction) | $P \lor Q$ | $P \text{ OR } Q$ |
| [Conditional](https://en.wikipedia.org/wiki/Material_conditional) | $P \to Q$ | $P \text{ IF } Q$ |
| [Equivalence](https://en.wikipedia.org/wiki/Logical_biconditional) | $P \leftrightarrow Q$ | $P \text{ IFF } Q$ |
| [Exclusive disjunction](https://en.wikipedia.org/wiki/Exclusive_or) | $P \oplus Q$ | $P \text{ XOR } Q$ |* Visualization of [predicate](https://en.wikipedia.org/wiki/Predicate_(mathematical_logic)) expressions
* Nullary or 0-arity predicates, visualized as its own name, e.g. $P$
* [First order logic](https://en.wikipedia.org/wiki/First-order_logic) predicates, with a given number of [terms](https://en.wikipedia.org/wiki/Term_(logic)), visualized as $P(t_1, t_2, ..., t_n)$
* Visualization of [universal quantifier](https://en.wikipedia.org/wiki/Universal_quantification), shown as $\forall$
* Visualization of [existential quantifier](https://en.wikipedia.org/wiki/Existential_quantification), shown as $\exists$
* Reduction of the logic operations [negation](https://en.wikipedia.org/wiki/Negation), [conjunction](https://en.wikipedia.org/wiki/Logical_conjunction), [disjunction](https://en.wikipedia.org/wiki/Logical_disjunction), [conditional](https://en.wikipedia.org/wiki/Material_conditional), [equivalence](https://en.wikipedia.org/wiki/Logical_biconditional) and [exclusive disjunction](https://en.wikipedia.org/wiki/Exclusive_or)
* Conversion from/to numeric values (true ⇔ 1, false ⇔ 0)### Examples ###
The following Fōrmulæ scripts use expressions from the **logic package**:
* [Truth table](https://formulae.org/?script=examples/Truth_table)