Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Precedence of the logical operations is not rendered correctly #156

Open
mathematicswizard opened this issue Mar 30, 2024 · 0 comments
Open

Comments

@mathematicswizard
Copy link

Description

The Compute Engine doesn't recognize the precedence of the logical operations.

Steps to Reproduce

Write some propositions with logical connectives in a mathfield, such as:
3=4\vee 7=8
A\subseteq B\wedge\emptyset\subset B

Actual Behavior

These propositions renders to the following MathJSON:
["Equal",3,["And",["Error",["ErrorCode","'incompatible-domain'","Booleans","PositiveIntegers"],4],["Error",["ErrorCode","'incompatible-domain'","Booleans","PositiveIntegers"],5]],7]
["SubsetEqual","A",["Subset",["And","B",["Error",["ErrorCode","'incompatible-domain'","Booleans","Sets"],"EmptySet"]],"B"]]

Expected Behavior

["Or",["Equal",3,4],["Equal",7,8]]
["And",["SubsetEqual","A","B"],["Subset","EmptySet","B"]]

An error occurs because the Compute Engine reads all these propositions as simple propositions and not compound ones. So it find the first relational symbol and expects to find a noun to the left of it and a noun to the right it.

To note - adding parentheses "solves" the problem and the MathJSON is as above. But the paraentheses in these cases a superfluous - even without them these are still WFF's; these propositions cannot be interpreted in any other way - that is why the parentheses are not needed, and the Compute Engine should have read them accordingly.

Environment

I have never checked if this worked in the past. Did this with the latest version of mathlive in the demo page and adding to the developer console this code:
formula._mathfield.getValue("math-json")

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Development

No branches or pull requests

1 participant