Ecosyste.ms: Awesome
An open API service indexing awesome lists of open source software.
https://github.com/PawelJastrzebski/propositional
Rust Propositional Logic Library
https://github.com/PawelJastrzebski/propositional
Last synced: 1 day ago
JSON representation
Rust Propositional Logic Library
- Host: GitHub
- URL: https://github.com/PawelJastrzebski/propositional
- Owner: PawelJastrzebski
- Created: 2024-06-28T07:07:10.000Z (5 months ago)
- Default Branch: main
- Last Pushed: 2024-07-01T19:25:21.000Z (5 months ago)
- Last Synced: 2024-11-09T02:08:56.680Z (8 days ago)
- Language: Rust
- Size: 8.79 KB
- Stars: 0
- Watchers: 1
- Forks: 0
- Open Issues: 0
-
Metadata Files:
- Readme: README.md
Awesome Lists containing this project
- awesome-rust-formalized-reasoning - Propositional Logic - propositional Logic Library . (Propositional logic / Libraries)
README
# Propositional Logic
This crate offers tools for defining and manipulating logical propositions using symbols and connectives like and, or, and implies. It simplifies the creation of logical expressions and the evaluation of their truth values within defined logical contexts.
Useful for educational purposes, AI projects, and any application requiring formal logical reasoning.
## Examples
```rust
use propositional::prelude::*;let rain = symbol!("it's raining");
let cloud = symbol!("it's cloudy");let world = and!(
implies!(rain, cloud),
rain
);println!("It is cloudy? {:?}", check(&world, &cloud));
//-> It is cloudy? Some(true)
```
Source: [wikipedia.org](https://en.wikipedia.org/wiki/Propositional_calculus#Arguments)```rust
use propositional::prelude::*;let rain = symbol!("It is raining.");
let hagrid = symbol!("Harry visited Hagrid.");
let dumbledore = symbol!("Harry visited Dumbledore.");let knowledge = and!(
implies!(not!(rain), hagrid),
or!(hagrid, dumbledore),
not!(and!(hagrid, dumbledore)),
dumbledore
);println!("It is raining? {:?}", check(&knowledge, &rain));
//-> It is raining? Some(true)
```
Source: [CS50](https://youtu.be/HWQLez87vqM?si=ULqkreSQPM2Y1n42&t=1692)## Acknowledgments
Based on: CS50’s Introduction to Artificial Intelligence with Python.