"Mathematics is the logical syntax of language" (Carnap).
Concept
MENTAL is based on expressions that have a generic syntax, which we call hypersyntax, because it transcends particular syntaxes.
The syntax of MENTAL expressions falls into two categories:
Those using explicit operators, such as: + (addition), / (qualitative particularization), = (substitution), and so on. Operators can only be of two types: monadic and dyadic. Their corresponding expressions are called, respectively, monadic and dyadic. Operators act on operands, which are expressions.
Those using delimiting parentheses: serial expression (sequence), parallel expression (set), distribution and generic expression. This type of syntax aligns with the philosophy of the so-called "Boundary Mathematics" [see Applications - Mathematics - Laws of Form].
MENTAL uses both systems (operators and delimiters). Operators can be considered shallow because they "touch" or are in contact with arguments. Delimiters are of the deep type.
Symbols
Symbols are used as explicit operators, one symbol for each semantic primitive. The use of symbols is justified by offering the following advantages:
It simplifies the specification as much as possible. The code is very compact, but readable.
Facilitates combinatorics.
It makes the language independent of particular languages. There are no keywords, unlike traditional programming languages.
They try to evoke universal concepts, going beyond the sign. Signs are of a superficial type and require interpretation. Symbols are of a deep, universal type and possess meaning.
Monadic Operator
Syntax
In general, a monadic operator ⊥ is placed after the argument x. It is the postfix notation: x⊥
Justification
The object-action model is used, i.e., the argument is specified first and then the operation to be performed on it.
Examples
x! // run x
x° // self-test x
x↓ // access the contents of x
Exploring properties
To determine the possible properties of a monadic operator ⊥, let's explore the following syntactic forms:
Normal recursion: x⊥⊥=(x⊥)⊥ (assumes associativity on the left)
Conceptual recursion (self-application): x(⊥⊥) (apply the ⊥ operator to itself)
Null expression: θ⊥
Existential expression: α⊥
Universal expression: Ω⊥
Creative criteria (exploration of possible new semantics)
In order to search for possible new semantics, we will explore alternative syntactic forms.
Isolated monadic operator: ⊥ (operator without argument)
In this case, the argument is implicit.
Example: ¡ (end current execution)
Monadic operator on the left: ⊥x
Examples: .123 (the decimal point is an operator)
Embedded monadic operator: x⊥y
In this case, despite being monadic, ⊥ acts on both arguments.
Example: 123.456 (eq. 123. + .456)
Diadic Operator
Sintaxis
When an operator ⊥ acts on two arguments, the infix notation is used: x⊥y
Justification
Simplifies the specification, as no parentheses are needed.
It is an easy and simple way to use, the same one used in arithmetic expressions.
It facilitates understanding, since the operator is used as a link between the two arguments.
Examples
x+y // add x and y
x*y // multiply x and y
x∪y // join x and y
Exploring properties
To determine the possible properties of a dyadic operator ⊥, let's explore the following syntactic forms:
Equal expressions: x⊥x (if evaluated as x, idempotent)
Creative criteria (exploration of possible new semantics)
In order to explore possible new semantics, we will explore alternative syntactic forms.
Isolated operator: ⊥ (operator without argument)
Prefijo: ⊥x
The operator, despite being dyadic, is intended to be used as a prefix.
Examples: +x −x
Postfijo: x⊥
The dyadic operator is used as a postfix.
Example: x☆ // rep. x x x x ... (infinite repetition)
Polyadic operator
In MENTAL there are no polyadic operators, but there are indirect ways for a ⊥ operator to act on n arguments:
By an expression of the form (x1 ⊥ x2 ⊥ ... ⊥ xn), which is interpreted with left associativity: ((x1⊥x2)⊥x3) ... ⊥xn)
Another way is that one of the arguments of the dyadic operator is a sequence, for example,
+⊣(3 7 5 4) // ev. (3+7+5+4)
ab⊣(3 7 5 4) // ev. (3 ab 7 ab 5 ab 4)
By means of delimiting parentheses, which is explained below.
Types of Delimiters
Curved parentheses
Specify sequences. For example, (a b c).
Its components are evaluated in series.
They are used to delimit expressions, along with operators and targets.
You can specify as many pairs of curly brackets as you wish, since they are equivalent to only one. For example, ((a b c)) is equivalent to (a b c).
They can have a temporary character and disappear after operations.
There are also "loose" sequences, which include blanks at the ends to indicate that it is a sequence.
Examples:
xyz // represents (x and z)
(a b c) // sequence
a+b // rep. (a + b)
ab+cd // rep. (ab + cd)
a*(b+c) // rep. (a * (b + c))
x(y-1)z // rep. (x y-1 z)
(((a))) // evaluates as a
a*((((b+c)))) // equals a*(b+c)
( abc ) // equals ( (a b c) ) (loose sequence containing a sequence
Curly braces
They are used to specify sets. For example, {a b c}.
Its components are evaluated in parallel.
They have a stable character.
Examples:
{x and z} // set
{a 123 b} // set consisting of two atomic elements and one sequence
{a {1 2 3} b} // set containing one set
Angle brackets
Delimit the scope of a generic expression.
They can contain parameters, which are specified in bold.
Examples:
〈(c = a+b)〉 // specifies that always c is the sum of a and b
〈x+y〉 // represents all expressions that are sum of two expressions.
〈( f(xy) = x+y+5 )〉 // function of two parameters (x and y)
Square brackets
They are used to specify distributions.
Two levels of nested parentheses are used: 1) an external one, which specifies the scope of the operation, 2) more internal ones, which are the operands to be distributed.
The outer level is optional; if not specified, the distribution is local.
There are two types: normal and linear.
Examples:
[[a b] [c d]] // rep. ac ad bc bd (normal distribution with scope)
[⌊a b⌋ ⌊c d⌋] // rep. ac bd (linear distribution with scope)
[a b]*2 // rep. a*2 b*2 (local normal distribution)
⌊a b⌋*⌊u v⌋ // rep. a*u b*v (local linear distribution)