Skip to content

Commit

Permalink
Change symbols rappresentation
Browse files Browse the repository at this point in the history
  • Loading branch information
Mroik committed May 9, 2024
1 parent d915f99 commit 4e0aacb
Show file tree
Hide file tree
Showing 2 changed files with 8 additions and 8 deletions.
6 changes: 3 additions & 3 deletions src/fitch.rs
Original file line number Diff line number Diff line change
Expand Up @@ -16,9 +16,9 @@ impl Display for Proposition {
match self {
Self::Absurdum => write!(f, "⊥"),
Self::Term(name) => write!(f, "{}", name),
Self::And(left, right) => write!(f, "({} ^ {})", left, right),
Self::Or(left, right) => write!(f, "({} v {})", left, right),
Self::Not(t) => write!(f, "(!{})", t),
Self::And(left, right) => write!(f, "({} & {})", left, right),
Self::Or(left, right) => write!(f, "({} | {})", left, right),
Self::Not(t) => write!(f, "(~{})", t),
Self::Implies(left, right) => write!(f, "({} => {})", left, right),
Self::Iff(left, right) => write!(f, "({} <=> {})", left, right),
}
Expand Down
10 changes: 5 additions & 5 deletions src/parser.rs
Original file line number Diff line number Diff line change
Expand Up @@ -51,7 +51,7 @@ fn parse_and(queue: &str) -> Result {
Result::Failure => Result::Failure,
Result::Success(left, rest) => {
queue = rest.trim_start();
if queue.is_empty() || queue.chars().nth(0).unwrap() != '^' {
if queue.is_empty() || queue.chars().nth(0).unwrap() != '&' {
return Result::Failure;
}
queue = queue[1..].trim_start();
Expand Down Expand Up @@ -83,7 +83,7 @@ fn parse_or(queue: &str) -> Result {
Result::Failure => Result::Failure,
Result::Success(left, rest) => {
queue = rest.trim_start();
if queue.is_empty() || queue.chars().nth(0).unwrap() != 'v' {
if queue.is_empty() || queue.chars().nth(0).unwrap() != '|' {
return Result::Failure;
}
queue = queue[1..].trim_start();
Expand Down Expand Up @@ -249,7 +249,7 @@ mod tests {

#[test]
fn parse_and_test() {
let queue = " (A ^ B) ";
let queue = " (A & B) ";
let a = Proposition::new_term("A");
let b = Proposition::new_term("B");
match parse_and(queue) {
Expand All @@ -263,7 +263,7 @@ mod tests {

#[test]
fn parse_or_test() {
let queue = " (A v B) ";
let queue = " (A | B) ";
let a = Proposition::new_term("A");
let b = Proposition::new_term("B");
match parse_or(queue) {
Expand Down Expand Up @@ -323,7 +323,7 @@ mod tests {
let left = Proposition::new_or(&a, &b);
let right = Proposition::new_and(&a, &b);
let ris = Proposition::new_and(&left, &right);
let queue = " ((A v B) ^ (A ^ B)) ";
let queue = " ((A | B) & (A & B)) ";
match parse_expression(queue) {
Result::Failure => assert!(false),
Result::Success(p, rest) => {
Expand Down

0 comments on commit 4e0aacb

Please sign in to comment.