|
@@ -1,113 +1,20 @@
|
|
|
# vim: set fileencoding=utf-8 :
|
|
# vim: set fileencoding=utf-8 :
|
|
|
-
|
|
|
|
|
- - Fix BisonSyntaxError location tracking.
|
|
|
|
|
-
|
|
|
|
|
- - Sort polynom by its exponents?
|
|
|
|
|
-
|
|
|
|
|
- - Fix division by zero caused by "0/0": Catch exception in front-end
|
|
|
|
|
-
|
|
|
|
|
-smvv@multivac ~/work/trs $ printf "a/0\n??" | ./main.py
|
|
|
|
|
-Traceback (most recent call last):
|
|
|
|
|
- File "./main.py", line 75, in <module>
|
|
|
|
|
- main()
|
|
|
|
|
- File "./main.py", line 64, in main
|
|
|
|
|
- node = p.run(debug=args.debug)
|
|
|
|
|
- File "/home/smvv/work/trs/external/pybison/src/python/bison.py", line 258, in run
|
|
|
|
|
- self.report_last_error(filename, e)
|
|
|
|
|
- File "/home/smvv/work/trs/external/pybison/src/python/bison.py", line 251, in run
|
|
|
|
|
- self.engine.runEngine(debug)
|
|
|
|
|
- File "bison_.pyx", line 592, in bison_.ParserEngine.runEngine (build/external/pybison/bison_.c:592)
|
|
|
|
|
- File "/home/smvv/work/trs/src/parser.py", line 195, in hook_handler
|
|
|
|
|
- possibilities = handler(retval)
|
|
|
|
|
- File "/home/smvv/work/trs/src/rules/fractions.py", line 23, in match_constant_division
|
|
|
|
|
- raise ZeroDivisionError('Division by zero: %s.' % node)
|
|
|
|
|
-ZeroDivisionError: Division by zero: a / 0.
|
|
|
|
|
-
|
|
|
|
|
-smvv@multivac ~/work/trs $ printf "0/0\n??" | ./main.py
|
|
|
|
|
-Traceback (most recent call last):
|
|
|
|
|
- File "./main.py", line 75, in <module>
|
|
|
|
|
- main()
|
|
|
|
|
- File "./main.py", line 64, in main
|
|
|
|
|
- node = p.run(debug=args.debug)
|
|
|
|
|
- File "/home/smvv/work/trs/external/pybison/src/python/bison.py", line 258, in run
|
|
|
|
|
- self.report_last_error(filename, e)
|
|
|
|
|
- File "/home/smvv/work/trs/external/pybison/src/python/bison.py", line 251, in run
|
|
|
|
|
- self.engine.runEngine(debug)
|
|
|
|
|
- File "bison_.pyx", line 592, in bison_.ParserEngine.runEngine (build/external/pybison/bison_.c:592)
|
|
|
|
|
- File "/home/smvv/work/trs/src/parser.py", line 195, in hook_handler
|
|
|
|
|
- possibilities = handler(retval)
|
|
|
|
|
- File "/home/smvv/work/trs/src/rules/numerics.py", line 73, in match_divide_numerics
|
|
|
|
|
- divide = not divmod(n.value, dv)[1]
|
|
|
|
|
-ZeroDivisionError: integer division or modulo by zero
|
|
|
|
|
-
|
|
|
|
|
- Last possibilities reduce to a similar result.
|
|
- Last possibilities reduce to a similar result.
|
|
|
|
|
|
|
|
-smvv@multivac ~/work/trs $ printf "0/1\n??" | ./main.py
|
|
|
|
|
-<Possibility root="0 / 1" handler=divide_numerics args=(0, 1)>
|
|
|
|
|
-Division of 0 by 1 reduces to 0.
|
|
|
|
|
-Division of 0 by 1 reduces to 0.
|
|
|
|
|
-
|
|
|
|
|
- ExpressionNode.equals() werkend maken voor alle cases (negatie).
|
|
- ExpressionNode.equals() werkend maken voor alle cases (negatie).
|
|
|
|
|
|
|
|
- - validation: preorder traversal implementatie vergelijken met andere
|
|
|
|
|
- implementaties.
|
|
|
|
|
-
|
|
|
|
|
- - No matches for sin(pi), sin(2pi), sin(4pi), etc...
|
|
|
|
|
-
|
|
|
|
|
- Create unit tests for node inequivalence operator.
|
|
- Create unit tests for node inequivalence operator.
|
|
|
|
|
|
|
|
- Line printer: 1 / (n + n)x -> 1 / (n + n) * x
|
|
- Line printer: 1 / (n + n)x -> 1 / (n + n) * x
|
|
|
|
|
|
|
|
- - Unit tests for strategy.
|
|
|
|
|
-
|
|
|
|
|
- - Parser: add unit tests for operator associativity (derivatives/integrals).
|
|
|
|
|
-
|
|
|
|
|
- Modules:
|
|
- Modules:
|
|
|
+ Equations with substitution
|
|
+ Equations with substitution
|
|
|
- + Sort
|
|
|
|
|
- + Gonio
|
|
|
|
|
|
|
+ + Gonio, no matches for sin(pi), sin(2pi), sin(4pi), etc...
|
|
|
|
|
|
|
|
- Add parentheses to integral bounds where needed:
|
|
- Add parentheses to integral bounds where needed:
|
|
|
int_(-1)^2 ... dx
|
|
int_(-1)^2 ... dx
|
|
|
or, fix parser error using the following notation:
|
|
or, fix parser error using the following notation:
|
|
|
int_-1^2 ... dx
|
|
int_-1^2 ... dx
|
|
|
|
|
|
|
|
- - Base hint selection on the desired final expression.
|
|
|
|
|
- To generate a hint for expression list A, ..., B:
|
|
|
|
|
- 1. Create a possibility tree for A.
|
|
|
|
|
- 2. Validate all expressions up to B:
|
|
|
|
|
- set ROOT = A
|
|
|
|
|
-
|
|
|
|
|
- for each expression C in <A, B] do:
|
|
|
|
|
- if final answer of C is not equal to final answer of A:
|
|
|
|
|
- validation failes at c
|
|
|
|
|
-
|
|
|
|
|
- find C in the possibility tree, traversing from ROOT
|
|
|
|
|
-
|
|
|
|
|
- if not found:
|
|
|
|
|
- validation continues, but generate an efficiency warning at C
|
|
|
|
|
- # FIXME: validation fails at C?
|
|
|
|
|
-
|
|
|
|
|
- set ROOT = C
|
|
|
|
|
- 3. Generate a hint:
|
|
|
|
|
- # ROOT should now be equal to B, so lookup of B is unnecessary
|
|
|
|
|
- set N = empty dictionary
|
|
|
|
|
-
|
|
|
|
|
- for each possibility of ROOT P node do:
|
|
|
|
|
- evaluate P(B) until the final expression of A is reached
|
|
|
|
|
- set N[P] = the number of explicit possibilities that have been applied in the evaluation
|
|
|
|
|
-
|
|
|
|
|
- the hint is that P for which the value of N[P] the smallest
|
|
|
|
|
-
|
|
|
|
|
- - Optimization: put possibility tree in hashmap: {'expression': [(handler, args, 'applied_expression')], ...}
|
|
|
|
|
- This hashmap can be used to speedup the calculation of possbility trees.
|
|
|
|
|
-
|
|
|
|
|
- Fix: int -cf(x) dx (caused infinite loop)
|
|
- Fix: int -cf(x) dx (caused infinite loop)
|
|
|
-
|
|
|
|
|
-- Idea for validation that is not really working ATM:
|
|
|
|
|
- When validating that a => b:
|
|
|
|
|
- Apply reductions to a to obtain A, this costs N steps.
|
|
|
|
|
- Apply reductions to b to obtain B, this costs M steps.
|
|
|
|
|
- if A != B, validation fails (return status 0)
|
|
|
|
|
- else if M >= N, the uses has done a useless or bad step (return status 1)
|
|
|
|
|
- otherwise (if M < N), the user has reduced the expression correctly (return status 2)
|
|
|
|
|
|
|
+ Solution: remove baby steps that rewrites f(x) to f(x) ^ 1
|