Skip to content
This repository has been archived by the owner on Aug 9, 2024. It is now read-only.

Commit

Permalink
Fix double negation
Browse files Browse the repository at this point in the history
`(!p->!q ->~q)&p` was being converted into `((!!p→!q)→!q)∧p`
  • Loading branch information
Laifsyn committed May 9, 2024
1 parent e4d78f0 commit 1a171c0
Show file tree
Hide file tree
Showing 2 changed files with 3 additions and 1 deletion.
Original file line number Diff line number Diff line change
Expand Up @@ -165,7 +165,7 @@ static Optional<Result<Expression, String>> try_next_expression(TokenStream stre
} else if (token instanceof Token.IDENTIFIER(String identfier)) {
// Inserta expresión de IDENTIFIER
Expression insert_exp = new Expression.IDENTIFIER(identfier);
if (last_token instanceof Token.NOT) {
if (last_token instanceof Token.NOT && exp_builder instanceof ExpressionBuilder.IntoLR_Expression) {
insert_exp = new Expression.NEGATING(insert_exp);
}
var insert_result = try_insert_exp(exp_builder, insert_exp);
Expand Down
2 changes: 2 additions & 0 deletions src/main/java/com/utp/clsEstructuraDatos/pry3/Main.java
Original file line number Diff line number Diff line change
Expand Up @@ -23,6 +23,8 @@ public static void main(String[] args) {
"p&q",
"(p&q)^r|(p^q)",
"(!(p->q) ->~q)&p",
"(!p->q ->~q)&p",
"(!(!p->!q) ->~q)&p",

};

Expand Down

0 comments on commit 1a171c0

Please sign in to comment.