File: help

package info (click to toggle)
ladr 0.0.200902a-2
  • links: PTS
  • area: main
  • in suites: squeeze
  • size: 11,400 kB
  • ctags: 7,168
  • sloc: ansic: 59,953; perl: 1,006; python: 620; makefile: 403; sh: 86; csh: 58; modula3: 13
file content (29 lines) | stat: -rw-r--r-- 1,278 bytes parent folder | download | duplicates (3)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29

I have to evaluate ground expressions involving division by 0.
Expressions have (+ * - div mod < <= > >= =) and the leaves are integers.
div and mod produce integers.

1. We can't just fail when see division by zero, because, e.g.,
3/0 = 3/0 has to evaluate to TRUE.

2. We can't say that division by 0 produces a special value "undefined",
which is propagated up to the top of the expression, because, e.g.,
3/0 = 3/0 (undefined=undefined) has to evaluate to TRUE, and
3/0 = 4/0 (undefined=undefined) has to evaluate to FALSE.

3. <+,-,*> is the ring of integers, so simplification with x*0=0 and
x-x = 0 can get rid of subexpressions involving division by 0.

Current idea: starting with an expression with < <= > >= or = at the
root, simplify to a unique canonical form.  If that gets rid of
all division by 0 (including mod 0), we should have TRUE or FALSE,
and we're done.  Otherwise, if the root is =, it is TRUE iff the
2 arguments are identical.  If it is some other relation, it is
FALSE.

However, I don't know if this theory has unique canonical forms.
such that two terms are equal iff their canincal forms are identical.

What is this theory, anyway?  <+,-,*> is the ring of integers,
but when we add / and mod, we don't have a field (no multiplicative
inverses).