
Orbital library  
PREV CLASS NEXT CLASS  FRAMES NO FRAMES  
SUMMARY: NESTED  FIELD  CONSTR  METHOD  DETAIL: FIELD  CONSTR  METHOD 
java.lang.Object orbital.moon.logic.ClassicalLogic
public class ClassicalLogic
Implementation of modern but classical predicate logic (firstorder logic).
true
(⊤), or false
(⊥).
It is a twovalued logic."nowhere in the decimal representation of π does the digit 7 occur 77 times (with the occurrences immediately following each other)"
"Ancient Greeks worshipped Zeus" (cf. free logic)
For the classical logic, the logical deduction relation is called
logic sequence (⊨) or semantic sequence. It is a logic inference (correct deduction).
Then the inference relation is written as ⊢,
the inference operation is called consequenceoperation Cn
and the implication is called material classical implication and written as ⇒.
The classical logic is truthfunctional and it is:
For the ClassicalLogic the inference operation is called the consequence operation Cn
over ⊨.
Kurt Gödel's Vollständigkeitssatz (1930) proves that there is a sound and complete calculus for firstorder logic ⊨ that is semidecidable. Alonzo Church (1936) and Alan Turing (1936) simultaneously showed that ⊨ is undecidable. (Since the tautological formulas are undecidable, and therefore satisfiable formulas are not even semidecidable.) The first constructive proof for a sound and complete calculus for ⊨ was due to Alan Robinson (1965).
However, Kurt Gödel's Unvollständigkeitssatz (1931) proves that in firstorder logic, the arithmetic theory Theory(N,+,*) is not axiomatizable and thus undecidable. This shows that every sound calculus for an extended firstorder logic including arithmetic (N,+,*) and mathematical induction (for N) is incomplete (whatever axioms and inference rules it might have).
Higherorder logic inference rules must be unsound or incomplete anyway. In any case, at least the part of firstorder predicate logic without quantifiers, which is called propositional logic, has a simple sound and complete calculus that makes it decidable.
Nested Class Summary  

static class 
ClassicalLogic.InferenceMechanism
Specifies the inference mechanism applied for the inference relation . 
static class 
ClassicalLogic.Utilities
Formula transformation utilities. 
Field Summary  

static ClassicalLogic.InferenceMechanism 
PROPOSITIONAL_INFERENCE
Propositional inference. 
static ClassicalLogic.InferenceMechanism 
RESOLUTION_HEURISTIC_INFERENCE

static ClassicalLogic.InferenceMechanism 
RESOLUTION_INFERENCE
Resolution inference. 
static ClassicalLogic.InferenceMechanism 
RESOLUTION_SATURATION_INFERENCE

static ClassicalLogic.InferenceMechanism 
SEMANTIC_INFERENCE
Semantic inference with truthtables. 
static java.lang.String 
usage

Constructor Summary  

ClassicalLogic()


ClassicalLogic(ClassicalLogic.InferenceMechanism inferenceMechanism)
Create a classical logic with the specified inference mechanism. 
Method Summary  

Expression.Composite 
compose(Expression compositor,
Expression[] arguments)
Create a compound expression representation with a composition operation. 
Formula.Composite 
composeDelayed(Formula f,
Expression[] arguments,
Notation notation)
Delayed composition of a symbol with some arguments. 
Formula.Composite 
composeFixed(Symbol fsymbol,
Functor f,
Expression[] arguments)
Instant composition of functors with a fixed core interperation Usually for predicates etc. 
Interpretation 
coreInterpretation()
Get the core interpretation which is fixed for this logic. 
Signature 
coreSignature()
Get the core signature which is supported by the language of this expression syntax. 
Expression[] 
createAllExpressions(java.lang.String expressions)
Create a sequence of (compound) expressions by parsing a list of expressions. 
Expression 
createAtomic(Symbol symbol)
Create an atomic expression representation of a noncompound sign. 
Expression 
createExpression(java.lang.String expression)
Create a term representation by parsing a (compound) expression. In fact, parsing expressions is only possible with a concrete syntax. So implementations of this method are encouraged to define and parse a standard notation which can often be close to the default notation of the abstract syntax. . 
Formula 
createFixedSymbol(Symbol symbol,
java.lang.Object referent,
boolean core)
Construct (a formula view of) an atomic symbol with a fixed interpretation. 
Formula 
createFormula(java.lang.String expression)
Deprecated. Use (Formula) createExpression(expression) instead. 
Formula 
createSymbol(Symbol symbol)
Construct (a formula view of) an atomic symbol. 
Expression 
createTerm(java.lang.String expression)
Parses single term. 
protected ClassicalLogic.InferenceMechanism 
getInferenceMechanism()

boolean 
infer(java.lang.String w,
java.lang.String d)
Inference (facade for convenience). 
Inference 
inference()
Get the inference relation ~_{K} according to the implementation calculus K. 
static void 
main(java.lang.String[] arg)
toolmain 
protected static boolean 
proveAll(java.io.Reader rd,
orbital.moon.logic.ModernLogic logic,
boolean all_true)
Prove all conjectures read from a reader. 
boolean 
satisfy(Interpretation I,
Formula F)
Defines the semantic satisfaction relation ⊧. 
Signature 
scanSignature(java.lang.String expression)
Scan for the signature Σ of all syntactic symbols in an expression. 
void 
setInferenceMechanism(ClassicalLogic.InferenceMechanism mechanism)
Set the inference mechanism applied for the inference relation . 
java.lang.String 
toString()

protected void 
validateAtomic(Symbol symbol)
This method validates that a symbol obeys the syntactical conventions imposed by this logic (if any). 
Methods inherited from class java.lang.Object 

clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait 
Field Detail 

public static final java.lang.String usage
public static final ClassicalLogic.InferenceMechanism RESOLUTION_INFERENCE
public static final ClassicalLogic.InferenceMechanism RESOLUTION_HEURISTIC_INFERENCE
public static final ClassicalLogic.InferenceMechanism RESOLUTION_SATURATION_INFERENCE
public static final ClassicalLogic.InferenceMechanism PROPOSITIONAL_INFERENCE
public static final ClassicalLogic.InferenceMechanism SEMANTIC_INFERENCE
This inference mechanism is usually slow, but has the advantage of involving no calculus but directly following the semantics of formulas. Inspite of its bad average performance, it may be superior to other propositional inference mechanisms in pathological cases or cases with a very small number of different propositional atoms and large formulas.
Constructor Detail 

public ClassicalLogic()
public ClassicalLogic(ClassicalLogic.InferenceMechanism inferenceMechanism)
inferenceMechanism
 the inference mechanism applied for the inference relation
.setInferenceMechanism(InferenceMechanism)
Method Detail 

public static void main(java.lang.String[] arg) throws java.lang.Exception
java.lang.Exception
public java.lang.String toString()
public void setInferenceMechanism(ClassicalLogic.InferenceMechanism mechanism)
inference relation
.
inference()
,
SEMANTIC_INFERENCE
,
RESOLUTION_INFERENCE
protected ClassicalLogic.InferenceMechanism getInferenceMechanism()
public Expression createTerm(java.lang.String expression) throws ParseException
ParseException
createExpression(String)
public Expression.Composite compose(Expression compositor, Expression[] arguments) throws ParseException
Logic
Signature.get(String,Object[])
may be useful for determining the right functor symbol
for a composition in case of an atomic
compositor.
☡ Be aware that this method does a composition (in the sense of semiotics) of signs/expressions, but not usually a composition (in the sense of mathematics) of functions. Mathematically speaking, the composition that this method performs would usually be called application instead of composition. Although composition (in the sense of mathematics) and application are correlated, they have different types at first sight
Yet together withλ
abstraction,
composition can be expressed in terms of application (as the definition above shows).
And in conjunction with the (selective) identification of type
void→σ' with σ'
application can also be expressed per composition.
compose
in interface Logic
compose
in interface ExpressionBuilder
compositor
 the expression that is used for composing the arguments.arguments
 the arguments a
passed to the combining operation.
compositor(a[0],…,a[a.length1])
ParseException
 if the composition expression is syntactically malformed.
Either due to a lexical or grammatical error (also due to wrong type of arguments).public boolean satisfy(Interpretation I, Formula F)
Logic
For multivalued logics, the above definition of a semantic satisfaction relation would experience a small generalization
Unlike the implementation method Formula.apply(Object)
, this surface method
must automatically consider the core interpretation
of this logic for symbol interpretations (and possible redefinitions) as well.
I
 the interpretation within which to evaluate F.F
 the formula to check whether it is satisfied in I.
Logic.coreInterpretation()
public Inference inference()
Logic
public Signature coreSignature()
ExpressionSyntax
The core "signature" contains the logical signs that inherently belong to this term algebra and are not subject to interpretation. Logical signs are logical constants like true, false, and logical operators like ¬, ∧, ∨, →, ∀, ∃. The latter are also called logical junctors.
Note that some authors do not count the core "signature" as part of the proper signature Σ but would rather call it "meta"signature.
Logic.coreInterpretation()
public Interpretation coreInterpretation()
Logic
This will usually contain the interpretation functors of logical operators like ¬, ∧, ∨, →, ⇔, ∀ and ∃.
ExpressionSyntax.coreSignature()
public Expression[] createAllExpressions(java.lang.String expressions) throws ParseException
createExpression(String)
, but restricted to lists of expressions.
For example, in the context of conjectures when given
{A&B, A&~C}an implementation could parse it as two formulas
A&B
and A&~C
.
expressions
 the comma separated list of expressions to parse.
ParseException
createExpression(String)
public Formula createFormula(java.lang.String expression) throws ParseException
(Formula) createExpression(expression)
instead.
ParseException
protected static final boolean proveAll(java.io.Reader rd, orbital.moon.logic.ModernLogic logic, boolean all_true) throws ParseException, java.io.IOException
<premise> (, <premise>)^{*} = <conclusion> # <comment> <EOL> <formula> == <formula> # <comment> <EOL> ...
rd
 the source for the conjectures to prove.logic
 the logic to use.all_true
 If true
this method will return whether all conjectures in rd
could be proven.
If false
this method will return whether some conjectures in rd
could be proven.
ParseException
java.io.IOException
LogicParser.readTRS(Reader,ExpressionSyntax,Function)
public Expression createAtomic(Symbol symbol)
Logic
Atomic symbols are either elemental atoms, strings or numbers. ☡ In contrast, a logical formula that is not compound of something (on the level of logical junctors) like "P(x,y)" is sometimes called atom.
createAtomic
in interface Logic
createAtomic
in interface ExpressionBuilder
symbol
 the symbol whose atomic expression representation to create.
public Formula createSymbol(Symbol symbol)
symbol
 the symbol for which to create a formula representationExpressionBuilder.createAtomic(Symbol)
public Formula createFixedSymbol(Symbol symbol, java.lang.Object referent, boolean core)
symbol
 the symbol for which to create a formula representationreferent
 the fixed interpretation of this symbolcore
 whether symbol is in the core such that it does not belong to the proper signature.ExpressionBuilder.createAtomic(Symbol)
public Formula.Composite composeDelayed(Formula f, Expression[] arguments, Notation notation)
f
 the compositing formula.arguments
 the arguments to the composition by f.notation
 the notation for the composition (usually determined by the composing symbol).public Formula.Composite composeFixed(Symbol fsymbol, Functor f, Expression[] arguments)
f
 the compositing formula.arguments
 the arguments to the composition by f.fsymbol
 the symbol with with the fixed interpretation f.public Expression createExpression(java.lang.String expression) throws ParseException
In fact, parsing expressions is only possible with a concrete syntax. So implementations of this method are encouraged to define and parse a standard notation which can often be close to the default notation of the abstract syntax.
. Parses single formulas or sequences of formulas delimited by comma and enclosed in curly brackets. Sequences of expressions are represented by a special compound expression encapsulating the array of expressions as itscomponent
.
createExpression
in interface Logic
createExpression
in interface ExpressionSyntax
expression
 the compound expression to parse.
A string of ""
denotes the empty expression.
However note that the empty expression may not be accepted in some term algebras.
Those parsers rejecting the empty expression are then inclined to throw a ParseException,
instead.
ParseException
 when the expression is syntactically malformed.
Either due to a lexical or grammatical error.public Signature scanSignature(java.lang.String expression) throws ParseException
ExpressionSyntax
However, note that this method does not necessarily perform rich type querying. Especially for userdefined functions with an arbitrary argumenttype structure, it is generally recommended to construct the relevant signature entries explicitly.
scanSignature
in interface ExpressionSyntax
expression
 the expression that should be scanned for symbol names.
ParseException
 (optional) when the expression is syntactically malformed.
Either due to a lexical or grammatical error.
(optional behaviour for performance reasons).
Will not throw ParseExceptions if createExpression would not either.ExpressionSyntax.coreSignature()
,
"Factory Method"public boolean infer(java.lang.String w, java.lang.String d) throws ParseException
w
 the comma separated list of premise expressions to parse.
ParseException
createAllExpressions(String)
,
createExpression(String)
,
Inference.infer(Formula[],Formula)
protected void validateAtomic(Symbol symbol) throws java.lang.IllegalArgumentException
java.lang.IllegalArgumentException
 if signifier is not an identifier.

Orbital library 1.3.0: 11 Apr 2009 

PREV CLASS NEXT CLASS  FRAMES NO FRAMES  
SUMMARY: NESTED  FIELD  CONSTR  METHOD  DETAIL: FIELD  CONSTR  METHOD 