|
|||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
java.lang.Object java.awt.Component java.awt.Container java.awt.Panel java.applet.Applet godel.Godel3
public class Godel3
This applet implements the conversion of a function (expressed as a computer program) into an arithmetical formula. This is the program which carries out the most important part of this Gödel's incompleteness theorem project. It works very much like a compiler, you input a program written in a programming language, and it tranforms this program into another form. In this case, rather than producing executable output, it expresses the program in terms of the Gödel number of an arithmetical formula.
Nested Class Summary | |
---|---|
(package private) class |
Godel3.Funinfo
Holds information about Haskell function |
(package private) class |
Godel3.IdList
List of identifiers |
(package private) class |
Godel3.TExpr
Holds an encoded representation of an expression |
Nested classes/interfaces inherited from class java.applet.Applet |
---|
java.applet.Applet.AccessibleApplet |
Nested classes/interfaces inherited from class java.awt.Panel |
---|
java.awt.Panel.AccessibleAWTPanel |
Nested classes/interfaces inherited from class java.awt.Container |
---|
java.awt.Container.AccessibleAWTContainer |
Nested classes/interfaces inherited from class java.awt.Component |
---|
java.awt.Component.AccessibleAWTComponent, java.awt.Component.BaselineResizeBehavior, java.awt.Component.BltBufferStrategy, java.awt.Component.FlipBufferStrategy |
Field Summary | |
---|---|
(package private) javax.swing.JButton |
but3
Press to encode statement of the form y=f(x) for a function f |
(package private) javax.swing.JButton |
but4
Press to encode statement of the form σ1 |
(package private) javax.swing.JButton |
but5
Press to encode statement of the form σ2 |
(package private) java.math.BigInteger |
c0
Coded form of zero |
(package private) int |
Csp
Stack pointer for CStore |
(package private) java.math.BigInteger[] |
Cstore
Store for coded conditions |
(package private) char |
curch
current character |
(package private) java.math.BigInteger |
curnum
current item if it is an integer |
(package private) int |
curtok
current item if it is a token |
(package private) java.lang.String |
curword
current item if it is an identifier |
(package private) java.util.BitSet |
dep1
Set of function nos. |
(package private) java.util.BitSet |
dep2
Set of function nos. |
(package private) int[] |
deplist
list of numbers of functions used in code |
(package private) int |
Esp
Stack pointer for EStore |
(package private) int[] |
Estore
Store for variables which need ∃ condition before current piece of code |
(package private) int |
fdct
Counter for deplist |
(package private) javax.swing.JTextField |
fedit
Edit area for name of function for y=f(x) encoding |
(package private) Godel3.Funinfo |
finf
info for function currently being compiled |
(package private) Godel3.Funinfo[] |
finfo
Store for information about functions |
(package private) java.math.BigInteger |
FOUR
|
(package private) java.math.BigInteger[] |
Fstore
Store for code of functions |
(package private) Godel3.IdList |
FunList
Function names |
(package private) java.lang.Error |
InvInp
General compilation error |
(package private) int |
itype
Type of current item |
(package private) java.lang.String |
lfile
Haskell file loaded automatically |
(package private) int |
locv
|
(package private) int |
nonf
number of functions without a name 2 i.e. |
(package private) java.math.BigInteger[] |
numc
Bitstream forms of 0-3 (0,0',0'',0''') |
(package private) javax.swing.JTextArea |
plines
Text area for input of Haskell code |
(package private) int |
pos
Current position in strin |
(package private) java.math.BigInteger |
predefs
Encoded form of predefined functions |
(package private) javax.swing.JTextArea |
prnum
Text area for output of Gödel number of Gödel statement |
(package private) java.util.List |
ResList
Reserved words in List form |
(package private) java.lang.String[] |
reswords
Reserved words |
private static long |
serialVersionUID
|
(package private) java.lang.String |
strin
Holds the Haskell code |
(package private) java.math.BigInteger |
THREE
|
(package private) char[][] |
tokens
2 character tokens |
(package private) java.lang.Error |
TypeErr
More specific type Error |
(package private) Godel3.IdList |
VarList
Haskell variable names |
(package private) int[] |
Varstore
Store for info about Haskell variables Match position in VarList. |
(package private) int |
vbase
counter for int form of variables |
(package private) java.math.BigInteger |
Vloc
coded form of variable x1 (locv) |
(package private) int |
z0
int form of first variable (x) |
(package private) java.math.BigInteger |
Z0
coded form of first variable (x) |
(package private) java.math.BigInteger |
ZERO
|
Fields inherited from class java.awt.Component |
---|
BOTTOM_ALIGNMENT, CENTER_ALIGNMENT, LEFT_ALIGNMENT, RIGHT_ALIGNMENT, TOP_ALIGNMENT |
Fields inherited from interface java.awt.image.ImageObserver |
---|
ABORT, ALLBITS, ERROR, FRAMEBITS, HEIGHT, PROPERTIES, SOMEBITS, WIDTH |
Constructor Summary | |
---|---|
Godel3()
|
Method Summary | |
---|---|
void |
actionPerformed(java.awt.event.ActionEvent e)
responds to button press |
(package private) void |
addcond(java.math.BigInteger A)
Add a condition to the list |
(package private) java.math.BigInteger |
binop(java.math.BigInteger x1,
int op,
java.math.BigInteger x2)
Encodes the result of a binary operator |
(package private) void |
calcdep(int f)
Recursively calculates which functions a function depends upon f may be recursively defined, but mutual recursion is not allowed |
(package private) void |
calcdeps(int f)
Calculates which functions a function depends upon, using calcdep |
void |
caretUpdate(javax.swing.event.CaretEvent e)
Reset caret colour after it's turned red to show an error |
(package private) boolean |
chkch(char c)
Checks whether the current item is a single character matching c |
(package private) int |
chkchS(java.lang.String S)
Checks whether the current item is a single character in S. |
(package private) void |
chkchv(char c)
requires the current item to be a single character matching c |
(package private) void |
chkIntv()
Requires current item to be 'Integer' reserved word |
(package private) void |
chkResv(int i)
Ensures that current word is a given reserved word |
(package private) void |
chktokv(int t)
Checks whether the current item is a 2 character token number t |
(package private) void |
DefFn(java.lang.String name)
Deals with the definition part of a function (which must be present) |
(package private) java.math.BigInteger |
diag(java.math.BigInteger n)
¬(∀z (z=num(n)⇒¬#n) |
(package private) java.math.BigInteger |
DoFun(int id)
Processes body of a function |
(package private) java.math.BigInteger |
exists(int v,
java.math.BigInteger T)
∃ #v #T |
(package private) Godel3.TExpr |
expr10()
Function calls, variables, numbers,[], (expr),duples |
(package private) Godel3.TExpr |
expr2(int vareq)
if, case and let and || operator |
(package private) Godel3.TExpr |
expr3()
&& operator |
(package private) Godel3.TExpr |
expr4()
relational operators |
(package private) Godel3.TExpr |
expr5()
|
(package private) Godel3.TExpr |
expr6()
+ and - |
(package private) Godel3.TExpr |
expr7()
, `div`, `mod` |
(package private) Godel3.TExpr |
expr9()
!! operator |
(package private) java.math.BigInteger |
falll(int v,
java.math.BigInteger t1)
∀ #v #t1 |
(package private) void |
fcompile()
compiles the functions defined in the plines edit, |
(package private) java.math.BigInteger |
funcround(java.math.BigInteger fcode)
|
(package private) void |
getitem()
Gets item from input text. |
(package private) int |
getType()
Gets type descriptor. |
(package private) void |
getword()
Requires a word, that is an identifier or reserved word |
(package private) java.math.BigInteger |
impp(java.math.BigInteger A,
java.math.BigInteger B)
#A ⇒ #B |
void |
init()
Initalise applet |
(package private) java.math.BigInteger |
iseq(java.math.BigInteger t1,
java.math.BigInteger t2)
Code for #t1=#t2 |
(package private) java.math.BigInteger |
J(java.math.BigInteger t1,
java.math.BigInteger t2)
J is a 1 to 1 functio combining two integers into one |
(package private) java.math.BigInteger |
Jn(int[] vs,
int n)
Combines n integer variables into one integer |
(package private) java.math.BigInteger |
lessthan(java.math.BigInteger t1,
java.math.BigInteger t2)
#t1<#t2 |
(package private) int |
makesym(int type)
Defines the current identifier to be a variable of a given type |
(package private) int |
mulop()
#0, `div` #1, `mod` #2 |
(package private) int |
newV()
new arithmetic variable |
(package private) java.math.BigInteger |
nott(java.math.BigInteger A)
Encode ¬#A |
(package private) java.math.BigInteger |
num(java.math.BigInteger x)
Encodes a number as an arithmetic expression |
(package private) void |
paramcond(int v,
int fno)
#v<Nf |
(package private) void |
parse1()
Parses program in strin |
(package private) void |
predefines()
produces the code for predefined list operators (:),(!!) and functions length and tail |
(package private) java.math.BigInteger |
resconds(int csb,
int esb,
int vsb)
∃ variables (∧ Conditions) |
(package private) java.math.BigInteger |
sigma(java.math.BigInteger phi)
σφ |
(package private) void |
skipsps()
moves pos to the first non-whitespace character |
(package private) java.math.BigInteger |
unop(int op,
java.math.BigInteger x1)
Encodes the result of the unary operator |
(package private) java.math.BigInteger |
varb(int n)
|
(package private) java.math.BigInteger |
varb0(int n)
|
(package private) java.math.BigInteger |
vform(java.math.BigInteger Term)
Creates (if needed) a variable equal to a given term |
(package private) java.math.BigInteger |
yisfx(java.lang.String fname)
|
Methods inherited from class java.applet.Applet |
---|
destroy, getAccessibleContext, getAppletContext, getAppletInfo, getAudioClip, getAudioClip, getCodeBase, getDocumentBase, getImage, getImage, getLocale, getParameter, getParameterInfo, isActive, newAudioClip, play, play, resize, resize, setStub, showStatus, start, stop |
Methods inherited from class java.awt.Panel |
---|
addNotify |
Methods inherited from class java.awt.Container |
---|
add, add, add, add, add, addContainerListener, addImpl, addPropertyChangeListener, addPropertyChangeListener, applyComponentOrientation, areFocusTraversalKeysSet, countComponents, deliverEvent, doLayout, findComponentAt, findComponentAt, getAlignmentX, getAlignmentY, getComponent, getComponentAt, getComponentAt, getComponentCount, getComponents, getComponentZOrder, getContainerListeners, getFocusTraversalKeys, getFocusTraversalPolicy, getInsets, getLayout, getListeners, getMaximumSize, getMinimumSize, getMousePosition, getPreferredSize, insets, invalidate, isAncestorOf, isFocusCycleRoot, isFocusCycleRoot, isFocusTraversalPolicyProvider, isFocusTraversalPolicySet, layout, list, list, locate, minimumSize, paint, paintComponents, paramString, preferredSize, print, printComponents, processContainerEvent, processEvent, remove, remove, removeAll, removeContainerListener, removeNotify, setComponentZOrder, setFocusCycleRoot, setFocusTraversalKeys, setFocusTraversalPolicy, setFocusTraversalPolicyProvider, setFont, setLayout, transferFocusBackward, transferFocusDownCycle, update, validate, validateTree |
Methods inherited from class java.awt.Component |
---|
action, add, addComponentListener, addFocusListener, addHierarchyBoundsListener, addHierarchyListener, addInputMethodListener, addKeyListener, addMouseListener, addMouseMotionListener, addMouseWheelListener, bounds, checkImage, checkImage, coalesceEvents, contains, contains, createImage, createImage, createVolatileImage, createVolatileImage, disable, disableEvents, dispatchEvent, enable, enable, enableEvents, enableInputMethods, firePropertyChange, firePropertyChange, firePropertyChange, firePropertyChange, firePropertyChange, firePropertyChange, firePropertyChange, firePropertyChange, firePropertyChange, getBackground, getBaseline, getBaselineResizeBehavior, getBounds, getBounds, getColorModel, getComponentListeners, getComponentOrientation, getCursor, getDropTarget, getFocusCycleRootAncestor, getFocusListeners, getFocusTraversalKeysEnabled, getFont, getFontMetrics, getForeground, getGraphics, getGraphicsConfiguration, getHeight, getHierarchyBoundsListeners, getHierarchyListeners, getIgnoreRepaint, getInputContext, getInputMethodListeners, getInputMethodRequests, getKeyListeners, getLocation, getLocation, getLocationOnScreen, getMouseListeners, getMouseMotionListeners, getMousePosition, getMouseWheelListeners, getName, getParent, getPeer, getPropertyChangeListeners, getPropertyChangeListeners, getSize, getSize, getToolkit, getTreeLock, getWidth, getX, getY, gotFocus, handleEvent, hasFocus, hide, imageUpdate, inside, isBackgroundSet, isCursorSet, isDisplayable, isDoubleBuffered, isEnabled, isFocusable, isFocusOwner, isFocusTraversable, isFontSet, isForegroundSet, isLightweight, isMaximumSizeSet, isMinimumSizeSet, isOpaque, isPreferredSizeSet, isShowing, isValid, isVisible, keyDown, keyUp, list, list, list, location, lostFocus, mouseDown, mouseDrag, mouseEnter, mouseExit, mouseMove, mouseUp, move, nextFocus, paintAll, postEvent, prepareImage, prepareImage, printAll, processComponentEvent, processFocusEvent, processHierarchyBoundsEvent, processHierarchyEvent, processInputMethodEvent, processKeyEvent, processMouseEvent, processMouseMotionEvent, processMouseWheelEvent, remove, removeComponentListener, removeFocusListener, removeHierarchyBoundsListener, removeHierarchyListener, removeInputMethodListener, removeKeyListener, removeMouseListener, removeMouseMotionListener, removeMouseWheelListener, removePropertyChangeListener, removePropertyChangeListener, repaint, repaint, repaint, repaint, requestFocus, requestFocus, requestFocusInWindow, requestFocusInWindow, reshape, setBackground, setBounds, setBounds, setComponentOrientation, setCursor, setDropTarget, setEnabled, setFocusable, setFocusTraversalKeysEnabled, setForeground, setIgnoreRepaint, setLocale, setLocation, setLocation, setMaximumSize, setMinimumSize, setName, setPreferredSize, setSize, setSize, setVisible, show, show, size, toString, transferFocus, transferFocusUpCycle |
Methods inherited from class java.lang.Object |
---|
clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait |
Field Detail |
---|
private static final long serialVersionUID
java.lang.String lfile
int vbase
Godel3.Funinfo[] finfo
int nonf
final int locv
int[] deplist
java.lang.String[] reswords
char[][] tokens
Godel3.IdList FunList
Godel3.IdList VarList
java.util.List ResList
java.math.BigInteger[] Fstore
java.math.BigInteger[] Cstore
int[] Estore
int[] Varstore
javax.swing.JButton but3
javax.swing.JButton but4
javax.swing.JButton but5
javax.swing.JTextField fedit
javax.swing.JTextArea prnum
javax.swing.JTextArea plines
java.lang.String strin
int pos
int fdct
int Csp
int Esp
java.lang.Error InvInp
java.lang.Error TypeErr
final java.math.BigInteger THREE
final java.math.BigInteger FOUR
final java.math.BigInteger ZERO
java.math.BigInteger predefs
final java.math.BigInteger c0
final java.math.BigInteger Vloc
final java.math.BigInteger Z0
final int z0
Godel3.Funinfo finf
java.util.BitSet dep1
java.util.BitSet dep2
java.math.BigInteger[] numc
int itype
char curch
java.math.BigInteger curnum
java.lang.String curword
int curtok
Constructor Detail |
---|
public Godel3()
Method Detail |
---|
int newV()
public void init()
init
in class java.applet.Applet
public void caretUpdate(javax.swing.event.CaretEvent e)
caretUpdate
in interface javax.swing.event.CaretListener
java.math.BigInteger iseq(java.math.BigInteger t1, java.math.BigInteger t2)
java.math.BigInteger falll(int v, java.math.BigInteger t1)
void paramcond(int v, int fno)
java.math.BigInteger lessthan(java.math.BigInteger t1, java.math.BigInteger t2)
java.math.BigInteger diag(java.math.BigInteger n)
java.math.BigInteger exists(int v, java.math.BigInteger T)
java.math.BigInteger sigma(java.math.BigInteger phi)
void predefines()
void calcdep(int f)
f
- index of functionvoid calcdeps(int f)
f
- index of functionvoid fcompile()
java.math.BigInteger funcround(java.math.BigInteger fcode)
java.math.BigInteger yisfx(java.lang.String fname)
public void actionPerformed(java.awt.event.ActionEvent e)
actionPerformed
in interface java.awt.event.ActionListener
java.math.BigInteger num(java.math.BigInteger x)
void skipsps()
void getitem()
void getword()
boolean chkch(char c)
int chkchS(java.lang.String S)
S
- characters considered
void chkchv(char c)
c
- the character to matchvoid chktokv(int t)
java.math.BigInteger unop(int op, java.math.BigInteger x1)
java.math.BigInteger binop(java.math.BigInteger x1, int op, java.math.BigInteger x2)
java.math.BigInteger impp(java.math.BigInteger A, java.math.BigInteger B)
Godel3.TExpr expr10()
Godel3.TExpr expr9()
int mulop()
Godel3.TExpr expr7()
Godel3.TExpr expr6()
Godel3.TExpr expr5()
java.math.BigInteger nott(java.math.BigInteger A)
void addcond(java.math.BigInteger A)
java.math.BigInteger resconds(int csb, int esb, int vsb)
Godel3.TExpr expr4()
Godel3.TExpr expr3()
Godel3.TExpr expr2(int vareq)
void chkIntv()
int getType()
void DefFn(java.lang.String name)
int makesym(int type)
type
-
java.math.BigInteger varb0(int n)
n
- - an int representation of an arithmetic variable
java.math.BigInteger varb(int n)
n
- - an int representation of an arithmetic variable
java.math.BigInteger J(java.math.BigInteger t1, java.math.BigInteger t2)
t1
- 1st termt2
- 2nd term
java.math.BigInteger Jn(int[] vs, int n)
vs
- int representation of variablesn
- number of variables
java.math.BigInteger vform(java.math.BigInteger Term)
Term
-
java.math.BigInteger DoFun(int id)
id
- function identifier
void chkResv(int i)
i
- Number of reserved word requiredvoid parse1()
|
|||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |