This file:
http://angg.twu.net/gab/README.html
(find-gab "README")
Author: Eduardo Ochs
Varsion: 2012may15
Public domain.
__ _ __
/ / __ _ __ _| |__ \ \
| | / _` |/ _` | '_ \ | |
< < | (_| | (_| | |_) | > >
| | \__, |\__,_|_.__/ | |
\_\ |___/ /_/
GabCalc - a calculator for mathematical expressions involving
quantifiers and set comprehension, inspired by Andrej Bauer's PLZoo
Note: this is not a proper README yet!
I have only made one public announcement, for a TINY part of gab.lua...
Because the rest is still a mess!
See: http://angg.twu.net/gab/gab-lpeg.lua
Introduction: examples
======================
This e-script
(eepitch-gab)
(eepitch-kill)
(eepitch-gab)
pev "Fa a<-{2,3,4}. Ex b<-{2,3,4}. a*b>10"
pev "{(x,y) | x<-{2,3}, y<-{3,4}, x pev "Fa a<-{2,3,4}. Ex b<-{2,3,4}. a*b>10"
Fa a <- {2, 3, 4}. Ex b <- {2, 3, 4}. a*b > 10
Fa__________.
| |
<-_. Ex__________.
| | | |
a {}_.__. <-_. >_____.
| | | | | | |
2 3 4 b {}_.__. *__. 10
| | | | |
2 3 4 a b
F
> pev "{(x,y) | x<-{2,3}, y<-{3,4}, x pev "(\\ a. a*a)(5)"
(\a.a*a)(5)
Ap_______.
| |
\__. 5
| |
a *__.
| |
a a
25
>
Files
=====
Code:
http://angg.twu.net/gab/gab.lua
(find-gab "gab.lua")
Tests:
http://angg.twu.net/gab/gab-tests.lua
(find-gab "gab-tests.lua")
The LPeg tricks used in the parser:
http://angg.twu.net/gab/gab-lpeg.lua
(find-gab "gab-lpeg.lua")
Old files (some are obsolete, some are garbage):
http://angg.twu.net/gab/gab-oldparser.lua
(find-gab "gab-oldparser.lua")
http://angg.twu.net/gab/gabriela-app.lua
(find-gab "gabriela-app.lua")
http://angg.twu.net/gab/gabriela.lua
(find-gab "gabriela.lua")
The development is being made with eev and eepitch - see:
http://angg.twu.net/eev-current/eepitch.el.html
http://angg.twu.net/eev-current/eev-intro.el.html
History
=======
One of the courses that I teach at the university where I work is
Discrete Mathematics ("MD").
The Teaching Assistant for MD in 2011, Gabriela Avila de Queiroz,
chose to do as her reseach project a program that could interpret some
expressions involving nested quantifiers, and calculate their results.
She had some difficulties with Lua, and ended up writing it in C.
In the beginning of 2012 I ported her program to Lua, and started
learning ML with the intent of extending a language from PLZoo to add
quantifiers to it - and, later, also adding categorical operations.
But then I went back to Lua - possibly temporarily - and started
adding features to the calculator in Lua - a printer that used infix
notation, an evaluator, printers of expressions in a lisp-y form and
in tree form, set comprehension, lambda forms and function
application, definitions, a bare-bones way to calculate and print
grids of values (like in spreasheets), a primitive recursive-descent
parser written in Lua that required spaces between any two tokens, and
a "real" parser written in LPeg.
Some Medium-Term Goals
======================
If/then/else. Abbreviations. Sets of the form {a,...,b} (with
ellipsis). Debugging tools. Set membership and equality. Better
support for defining functions. Functions defined in Lua. Memoization.
Inductive definitions. Substitution operators (like [x:=4](x*x)).
Reduction rules and tools for operating on a certain subexpression.
Expressions that keep their history.
Plotting points.
Full support for two-dimensional "modal" and "intuitionistic"
truth-values - for toposes of the form Set^D, where is the poset
generated by a subset of N×N.
Interface with dednat5.
Thunks and lazyness.
The Logo
========
Here:
http://angg.twu.net/gab/gab.png
It was adapted from:
http://www.pbs.org/design/2009/09/stealing-the-perfect-color-scheme.html
http://www.pbs.org/design/images/rothko.jpg
and created with Gimp's color picker and this:
http://angg.twu.net/elisp/myxpm.el.html#gab
(find-angg "elisp/myxpm.el" "gab")
-- Local Variables:
-- coding: raw-text-unix
-- ee-anchor-format: "«%s»"
-- End: