logic.spad line 2454 [edit on github]
ILogic is an algebra with true
, false
and other 'unproven' values
returns true
(boolean true
) if Intuitionistic Logic values are the same. Translates from Intuitionistic Logic to Boolean Logic
returns true
if this is an atom, that is a leaf node otherwise return false
if this is a compound term
assumes ln
contains a list of factors which must be true
for the whole to be true
(such as the list produced by factor). From this deductions attempts to produce a list of other proposition that must also be true
by using modus ponens. This is used to determine the returned type when converting ILogic to types by using the Curry-Howard isomorphism.
splits n
into a list of factors which must be true
for the whole to be true
. This assumes that the top level is already a set of factors separated by /\
otherwise the result will just be a list with one entry: 'n'
. This is used when converting ILogic to types by using the Curry-Howard isomorphism.
returns child nodes if this is a compound term otherwise returns []
implies(a, b)
returns the logical implication of ILogic a and b
. a is premise, b
is conclusion, result is false
(contradiction) if premise=true and conclusion=false does not mean there is a causal connection
false
(contradiction) is a logical constant.
true
is a logical constant.
if this is a compound op then opType returns the type of that op: "IMPLY"::Symbol =implies "AND"::Symbol=/\ "OR"::Symbol=\/
"NOT"::Symbol=~ "OTHER"::Symbol=not compound op
Constructs intuitionistic logic terms from a string notation assumes format like this: <term> : :=
var | <term>/\spad<term> | <term>\/
<term> | <term>-><term> | "("<term>")"
Constructs intuitionistic logic terms from a string notation assumes format like this: <term2> : :=
var | "("<term>")" <term> : :=
var | <term>/\spad<term> | <term>\/
<term> | <term>-><term> | "("<term>")"
parseTerm is used by parseIL. It would rarely be called externally but it is here to allow it to call parseIL that is to allow circular calls
Constructs a proposition
attempt to simplify theory apply recursively to subnodes normally this should not be necessary since logic values are interpreted when constructed
creates a string representation of this term and its sub-terms
similar to 'toString' but does not put outer compound terms in brackets
returns: "T"::Symbol = T
"F"::Symbol = _|_
"E"::Symbol = error "P"::Symbol = proposition "C"::Symbol = compound Constructs lambda term and bind any variables with the name provided
~(x)
returns the logical complement of x
. TODO not sure if complement should be included here? intuitionistic logic can have complement but has different axioms to complement in Boolean algebra. Equivalent capability can be provided by implication.