Skip to content

Commit 0e1ac9e

Browse files
committed
fix #156
1 parent b88ca6c commit 0e1ac9e

3 files changed

Lines changed: 24 additions & 6 deletions

File tree

CHANGELOG.md

Lines changed: 10 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -212,6 +212,16 @@
212212
lower precedence (230-235) than comparison operators (245) and set relations
213213
(240), so compound propositions parse correctly without requiring parentheses.
214214

215+
- **([#156](https://github.com/cortex-js/compute-engine/issues/156)) Logical
216+
Connective Arrows**: Added support for lowercase arrow notation in logical
217+
expressions:
218+
- `\rightarrow` now parses as `Implies` (previously parsed as `To` for
219+
set/function mapping)
220+
- `\leftrightarrow` now parses as `Equivalent` (previously produced an
221+
"unexpected-command" error)
222+
- The uppercase variants `\Rightarrow` and `\Leftrightarrow` continue to work
223+
- `\to` remains available for function/set mapping notation (e.g., `f: A \to B`)
224+
215225
- **Simplification Rules**: Added and fixed several simplification rules:
216226
- `x + x` now correctly simplifies to `2x` (term combination)
217227
- `e^x * e^{-x}` now correctly simplifies to `1` (exponential inverse)

src/compute-engine/latex-syntax/dictionary/definitions-algebra.ts

Lines changed: 0 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -7,10 +7,4 @@ export const DEFINITIONS_ALGEBRA: LatexDictionary = [
77
kind: 'infix',
88
precedence: 270, // MathML rightwards arrow
99
},
10-
{
11-
latexTrigger: ['\\rightarrow'],
12-
kind: 'infix',
13-
precedence: 270, // MathML rightwards arrow
14-
parse: 'To',
15-
},
1610
];

src/compute-engine/latex-syntax/dictionary/definitions-logic.ts

Lines changed: 14 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -159,6 +159,13 @@ export const DEFINITIONS_LOGIC: LatexDictionary = [
159159
associativity: 'right',
160160
parse: 'Implies',
161161
},
162+
{
163+
latexTrigger: ['\\rightarrow'],
164+
kind: 'infix',
165+
precedence: 220,
166+
associativity: 'right',
167+
parse: 'Implies',
168+
},
162169

163170
{
164171
name: 'Equivalent', // MathML: identical to, Mathematica: Congruent
@@ -174,6 +181,13 @@ export const DEFINITIONS_LOGIC: LatexDictionary = [
174181
precedence: 219,
175182
parse: 'Equivalent',
176183
},
184+
{
185+
latexTrigger: ['\\leftrightarrow'],
186+
kind: 'infix',
187+
associativity: 'right',
188+
precedence: 219,
189+
parse: 'Equivalent',
190+
},
177191
{
178192
latexTrigger: ['\\equiv'],
179193
kind: 'infix',

0 commit comments

Comments
 (0)