Skip to the content.

ForTheL’s TEX dialect

Marcel Schütz

December 2022

Contents

1 Conventions

This syntax reference is written in NBNF, an extension of BNF, where the following conventions are adopted.

Pattern Meaning
pattern₁ | pattern₂ | … | patternₙ Choice
[ pattern ] Option
( pattern ) Grouping
{ pattern } Zero or more repetitions
pattern₁ pattern₂ … patternₙ Concatenation
"string" Case-sensitive string
'string' Case-insensitive string
⟨identifier⟩ Non-terminal
⟪identifier⟫ Alphabet (see below)
⟪identifier⟫ \ (expr₁, …, exprₙ) A character (i.e. single-character string) that matches the alphabet ⟪identifier⟫, but none of the expressions expr₁, …, exprₙ which can either be case-sensitive or case-insensitive characters.
⟪identifier⟫* \ (expr₁, …, exprₙ) All words over the alphabet ⟪identifier⟫ that do not match any of the expressions expr₁, …, exprₙ which can either be case-sensitive or case-insensitive strings.
⟪identifier⟫+ \ (expr₁, …, exprₙ) All non-empty words over the alphabet ⟪identifier⟫ that do not match any of the expressions expr₁, …, exprₙ which can either be case-sensitive or case-insensitive strings.

An alphabet is a non-terminal, where the right-hand side of its definition must consist of an expression of the form expr₁ | expr₂ | … | exprₙ, where exprₙ, …, exprₙ can be single case-sensitive characters or so-called character lists, i.e. expressions of the form "char₁" | ... | "char₂" (here the ... are part of the syntax), where char₁ and char₂ are arbitrary characters. Such a character list accepts all characters in the Unicode table from the code point of char₁ to the code point of char₂.

To avoid parentheses, we assume that choice has a lower precedence than concatenation.

Within a string the following characters have to be escaped by prepending a backslash to them: \, ", '. Any special characters can be represented by the pattern \U+XXXX;, where XXXX is its hexadecimal Unicode code point.

Moreover, identifiers of non-terminals and alphabets are only allowed to contain the letters “a” - “z”, “A” - “Z”, the digits “0” - “9”, spaces and the characters “-” and “_“.

2 TEX extraction

This chapter describes a specification of an “extractor” which extracts the content of forthel environments from a TEX document, i.e. everything enclosed within the tags \begin{forthel} and \begin{forthel}. This means a parser for the grammar described in this chapter is intended to accept any arbitrary string of characters from Unicode’s Basic Latin code block and returns the content of all forthel environments it contains.

⟨tex document⟩ = [ ⟨ignored text⟩ ] { \\begin{forthel}” ⟨tex text⟩ \\end{forthel}” [ ⟨ignored text⟩ ] }

Text before any occurence of the string \begin{forthel} is intended to be ignored by a ForTheL compiler. Hence it can be arbitrary text not containing \begin{forthel} as a substring.

⟨ignored text⟩ = ““
| ⟪Latin⟫ \ {\\} ⟨ignored text⟩
| \\ ⟪Latin⟫ \ {\\} ⟨ignored text⟩
| \\\\ ⟪Latin⟫ \ {“b”} ⟨ignored text⟩
| \\\\b” ⟪Latin⟫ \ {“e”} ⟨ignored text⟩
| \\\\be” ⟪Latin⟫ \ {“g”} ⟨ignored text⟩
| \\\\beg” ⟪Latin⟫ \ {“i”} ⟨ignored text⟩
| \\\\begi” ⟪Latin⟫ \ {“n”} ⟨ignored text⟩
| \\\\begin” ⟪Latin⟫ \ {“{”} ⟨ignored text⟩
| \\\\begin{” ⟪Latin⟫ \ {“f”} ⟨ignored text⟩
| \\\\begin{f” ⟪Latin⟫ \ {“o”} ⟨ignored text⟩
| \\\\begin{fo” ⟪Latin⟫ \ {“r”} ⟨ignored text⟩
| \\\\begin{for” ⟪Latin⟫ \ {“t”} ⟨ignored text⟩
| \\\\begin{fort” ⟪Latin⟫ \ {“h”} ⟨ignored text⟩
| \\\\begin{forth” ⟪Latin⟫ \ {“e”} ⟨ignored text⟩
| \\\\begin{forthe” ⟪Latin⟫ \ {“l”} ⟨ignored text⟩
| \\\\begin{forthel” ⟪Latin⟫ \ {“}”} ⟨ignored text⟩

A ForTheL text is an arbitrary text which does not contain the string \end{forthel}:

⟨forthel text⟩ = ““
| ⟪Latin⟫ \ {\\} ⟨forthel text⟩
| \\ ⟪Latin⟫ \ {\\} ⟨forthel text⟩
| \\\\ ⟪Latin⟫ \ {“e”} ⟨forthel text⟩
| \\\\e” ⟪Latin⟫ \ {“n”} ⟨forthel text⟩
| \\\\en” ⟪Latin⟫ \ {“d”} ⟨forthel text⟩
| \\\\end” ⟪Latin⟫ \ {“{”} ⟨forthel text⟩
| \\\\end{” ⟪Latin⟫ \ {“f”} ⟨forthel text⟩
| \\\\end{f” ⟪Latin⟫ \ {“o”} ⟨forthel text⟩
| \\\\end{fo” ⟪Latin⟫ \ {“r”} ⟨forthel text⟩
| \\\\end{for” ⟪Latin⟫ \ {“t”} ⟨forthel text⟩
| \\\\end{fort” ⟪Latin⟫ \ {“h”} ⟨forthel text⟩
| \\\\end{forth” ⟪Latin⟫ \ {“e”} ⟨forthel text⟩
| \\\\end{forthe” ⟪Latin⟫ \ {“l”} ⟨forthel text⟩
| \\\\end{forthel” ⟪Latin⟫ \ {“}”} ⟨forthel text⟩
⟪Latin⟫ = \U+0009; | … | \U+000D;
| \U+0020; | … | “~”

3 TEX lexing

This chapter describes a specification of a lexer for the content of forthel environments within a TEX document. This means a parser for the grammar described in this chapter is intended to accept any arbitrary string of characters from Unicode’s Basic Latin code block and split it into TEX lexemes. (Note that we use the word token as a synonym for lexeme in the following to match the usage of the word token in the referenced literature.)

3.1 Tokens

⟨white token⟩ = ⟪Horizontal space⟫
| ⟪Vertical space⟫
| “$”
| \\\\
| \\[”
| \\]”
| \\left”
| \\middle”
| \\right”
| ⟨comment⟩
⟨alphanumeric token⟩ = ⟪Alphanum⟫ { ⟪Alphanum⟫ }
⟨symbolic token⟩ = ⟪Symbol⟫ \ {“%”, \\}
⟨backslashed token⟩ = \\ ( ⟪Alphanum⟫+ \ {“left”, “middle”, “right”} | ⟪Symbol⟫ \ {\\, “[”, “]”} )

The following rules are only needed to specify certain special tokens in the next paragraphs.

⟨alphabetic token⟩ = ⟪Letter⟫ { ⟪Letter⟫ }
⟨numeric token⟩ = ⟪Digit⟫ { ⟪Digit⟫ }

3.2 Special symbols

⟨lower greek letter⟩ = \\alpha”
| \\beta”
| \\gamma”
| \\delta”
| \\epsilon”
| \\zeta”
| \\eta”
| \\theta”
| \\iota”
| \\kappa”
| \\lambda”
| \\mu”
| \\nu”
| \\xi”
| \\pi”
| \\rho”
| \\sigma”
| \\tau”
| \\upsilon”
| \\phi”
| \\omicron”
| \\chi”
| \\psi”
| \\omega”
⟨upper greek letter⟩ = \\Gamma”
| \\Delta”
| \\Theta”
| \\Lambda”
| \\Xi”
| \\Pi”
| \\Sigma”
| \\Upsilon”
| \\Phi”
| \\Psi”
| \\Omega”
⟨varied greek letter⟩ = \\varbeta”
| \\varepsilon”
| \\vartheta”
| \\varkappa”
| \\varpi”
| \\varvarpi”
| \\varrho”
| \\varvarrho”
| \\varsigma”
| \\varphi”
⟨argument symbol⟩ = ⟨alphanumeric character⟩
| ⟪Symbol⟫ \ {“%”, “]”}

3.3 Special tokens

⟨regular alphabetic token⟩ = ⟪Letter⟫+ \ {‘the’, ‘a’, ‘an’, ‘is’, ‘are’, ‘be’}
⟨regular alphanumeric token⟩ = ⟪Alphanum⟫+ \ {‘the’, ‘a’, ‘an’, ‘is’, ‘are’, ‘be’}
⟨regular symbolic token⟩ = ⟪Symbol⟫ \ {“%”, “.”}
⟨label token⟩ = ⟨alphanumeric token⟩
| “_“
⟨variable token⟩ = ⟪Letter⟫ { ⟪Alphanum⟫ }
⟨var token⟩ = ⟨alphabetic token⟩
⟨argument token⟩ = ⟨alphanumeric token⟩
| ⟪Symbol⟫ \ {“%”, “]”}
⟨environment name token⟩ = ⟨alphanumeric token⟩
| ⟪Symbol⟫ \ {“%”, “]”}

3.4 Alphabets

⟪Alphanum⟫ = “0” | … | “9”
| “A” | … | “Z”
| “a” | … | “z”
⟪Letter⟫ = “A” | … | “Z”
| “a” | … | “z”
⟪Digit⟫ = “0” | … | “9”
⟪Symbol⟫ = “!” | … | “/”
| “:” | … | “@”
| “[” | … | “`”
| “{” | … | “~”

Horizontal tab or space:

⟪Horizontal Space⟫ = \U+0009;
| \U+0020;

Line feed, vertical tab, form feed or chrriage return:

⟪Vertical Space⟫ = \U+000A;
| \U+000B;
| \U+000C;
| \U+000D;
⟪Visible Character⟫ = “!” | … | “~”

4 TEX parsing

This chapter describes a specification of a parser for lexed TEX documents. This means a parser for the grammar described in this chapter is intended to accept a list of lexemes generated by a parser for the grammar described in the previous chapter and returns for instance an abstract syntax tree for such an FTL-TeX document.

⟨tex text⟩ = { ⟨forthel section⟩ }

4.1 Special strings

4.1.1 Labels

⟨name⟩ = “(” ⟨label⟩ “)”

The following rule is adopted from [2].

⟨reference⟩ = “(” ‘by’ ⟨ref⟩ { “,” ⟨ref⟩ } “)”
⟨ref⟩ = ⟨label⟩
| ( \\ref” | \\nameref” | \\cref” ) “{” ⟨label⟩ “}”
⟨variables⟩ = ⟨variable⟩ { “,” ⟨variable⟩ }
⟨variable⟩ = ( ⟨variable token⟩ | ⟨greek letter⟩ ) { \’ }
⟨qed⟩ = ( ‘qed’ | ‘end’ | ‘obvious’ | ‘trivial’ ) [ ⟨reference⟩ ] “.”

4.2 Keywords

⟨assume⟩ = ‘assume’
| ‘presume’
| ‘suppose’
⟨iff⟩ = ‘iff’
| ‘if’ ‘and’ ‘only’ ‘if’
| ‘when’ ‘and’ ‘only’ ‘when’
⟨is⟩ = ‘is’
| ‘are’
| ‘be’
⟨does⟩ = ‘does’
| ‘do’
⟨has⟩ = ‘has’
| ‘have’
⟨with⟩ = ‘with’
| ‘of’
| ‘having’
⟨let us⟩ = ‘let’ ‘us’
| ‘we’ ‘can’
⟨stand for⟩ = ‘stand’ ‘for’
| ‘denote’
⟨then⟩ = ‘then’
| ‘hence’
| ‘thus’
| ‘therefore’
| ‘consequently’
⟨indefinite article⟩ = ‘a’
| ‘an’
⟨definite article⟩ = ‘the’

4.3 Instructions

⟨instruction⟩ = “[” ⟨instr⟩ “]”

4.3.1 Command instructions

⟨command instr⟩ = “exit”
| “quit”
| “thesis”
| “context”
| “filter”
| “rules”

4.3.2 Limit instructions

⟨limit instruction⟩ = ⟨limit instr⟩ ⟨limit⟩
⟨limit instr⟩ = “timelimit”
| “memorylimit”
| “depthlimit”
| “checktime”
| “checkdepth”
⟨limit⟩ = ⟨numeric token⟩

4.3.3 Flag instructions

⟨flag instruction⟩ = ⟨flag instr⟩ ⟨bool⟩
⟨flag instr⟩ = “prove”
| “check”
| “checkconsistency”
| “symsign”
| “info”
| “thesis”
| “filter”
| “skipfail”
| “flat”
| “printgoal”
| “printsection”
| “printcheck”
| “printunfold”
| “printreason”
| “printprover”
| “printfulltask”
| “dump”
| “printsimp”
| “printthesis”
| “unfold”
| “unfoldsf”
| “unfoldlow”
| “unfoldlowsf”
| “translation”
| “tex”
⟨bool⟩ = “yes”
| “no”
| “on”
| “off”

4.3.4 Argument instructions

⟨argument instruction⟩ = ⟨argument instr⟩ ( \\path” “{” ⟨argument⟩ “}” | ⟨argument⟩ )
⟨argument instr⟩ = “read”
| “readtex”
| “library”
| “provers”
| “prover”

4.3.5 Synonym instructions

⟨synonym instruction⟩ = “synonym” ⟨regular alphabetic token⟩ { “/” [ “-” ] ⟨regular alphabetic token⟩ }

4.3.6 Drop instructions

⟨drop instruction⟩ = “/” ( ⟨command instr⟩ | ⟨limit instr⟩ | ⟨flag instr⟩ )

4.4 Declarations

⟨variable declaration⟩ = ‘let’ ⟨variables⟩ ⟨stand for⟩ [ ⟨article⟩ ] ⟨class noun⟩ “.”
⟨notion declaration⟩ = ‘let’ ⟨notion pattern⟩ ⟨stand for⟩ [ ⟨article⟩ ] ⟨class noun⟩ “.”
⟨function declaration⟩ = ‘let’ ⟨function pattern⟩ ⟨stand for⟩ ⟨plain term⟩ “.”
⟨predicate declaration⟩ = ‘let’ ⟨predicate pattern⟩ ⟨stand for⟩ ⟨statement⟩ “.”

4.5 Patterns

4.5.1 Notion, function and predicate patterns

The usage of ⟨indefinite article⟩ is necessary to tell a variable from a notion pattern and hence a type declaration from a notion declaration.

4.5.2 General patterns

Note that we ignore variables in the definition of (symbolic) patterns since on a syntactic level they cannot be distinguished from other tokens.

4.6 Top-level sections

⟨environment label⟩ = “[” [ ⟨label⟩ ] “]”
| [ “[” ⟨environment name token⟩ { ⟨environment name token⟩ } “]” ] ( \\label” | \\printlabel” ) “{” ⟨label⟩ “}”

4.6.1 Axioms

⟨axiom⟩ = \\begin” “{” “axiom” “}” [ ⟨environment label⟩ ] { ⟨assumption⟩ } ⟨axiom affirmation⟩ \\end” “{” “axiom” “}”
| \\begin” “{” “axiom” ”}” [ ⟨environment label⟩ ] { ⟨assumption⟩ } ⟨axiom affirmation⟩ \\end” ”{” ”axiom” “}”
⟨axiom affirmation⟩ = [ ⟨then⟩ ] ⟨statement⟩ “.”

4.6.2 Definitions

⟨definition⟩ = \\begin” “{” “definition” “}” [ ⟨environment label⟩ ] { ⟨assumption⟩ } ⟨definition affirmation⟩ \\end” “{” “definition” “}”
| \\begin” “{” “definition” ”}” [ ⟨environment label⟩ ] { ⟨assumption⟩ } ⟨definition affirmation⟩ \\end” ”{” ”definition” “}”

The following rule is adopted from [2].

⟨definition affirmation⟩ = ⟨definition statement⟩ “.”

4.6.3 Signature extensions

⟨signature extension⟩ = \\begin” “{” “signature” “}” [ ⟨environment label⟩ ] { ⟨assumption⟩ } ⟨signature affirmation⟩ \\end” “{” “signature” “}”
| \\begin” “{” “signature” ”}” [ ⟨environment label⟩ ] { ⟨assumption⟩ } ⟨signature affirmation⟩ \\end” ”{” ”signature” “}”

The following rule is adopted from [2].

⟨signature affirmation⟩ = ⟨signature statement⟩ “.”

4.6.4 Theorems

⟨theorem⟩ = \\begin” “{” “theorem” “}” [ ⟨environment label⟩ ] { ⟨assumption⟩ } ⟨theorem affirmation⟩ \\end” “{” “theorem” “}”
| \\begin” “{” “theorem” ”}” [ ⟨environment label⟩ ] { ⟨assumption⟩ } ⟨theorem affirmation⟩ \\end” ”{” ”theorem” “}”
| \\begin” “{” “proposition” “}” [ “[” [ ⟨label⟩ ] “]” ] { ⟨assumption⟩ } ⟨theorem affirmation⟩ \\end” “{” “proposition” “}”
| \\begin” “{” “proposition” ”}” [ ”[” [ ⟨label⟩ ] ”]” ] { ⟨assumption⟩ } ⟨theorem affirmation⟩ \\end” ”{” ”proposition” “}”
| \\begin” “{” “lemma” “}” [ “[” [ ⟨label⟩ ] “]” ] { ⟨assumption⟩ } ⟨theorem affirmation⟩ \\end” “{” “lemma” “}”
| \\begin” “{” “lemma” ”}” [ ”[” [ ⟨label⟩ ] ”]” ] { ⟨assumption⟩ } ⟨theorem affirmation⟩ \\end” ”{” ”lemma” “}”
| \\begin” “{” “corollary” “}” [ “[” [ ⟨label⟩ ] “]” ] { ⟨assumption⟩ } ⟨theorem affirmation⟩ \\end” “{” “corollary” “}”
| \\begin” “{” “corollary” ”}” [ ”[” [ ⟨label⟩ ] ”]” ] { ⟨assumption⟩ } ⟨theorem affirmation⟩ \\end” ”{” ”corollary” “}”
⟨theorem affirmation⟩ = [ ⟨then⟩ ] ⟨statement⟩ [ ⟨reference⟩ ] “.”

4.7 Assumptions

⟨assumption⟩ = [ ⟨name⟩ ] ⟨assumption prefix⟩ ⟨statement⟩ “.”

The following rule is adopted from [2].

⟨assumption prefix⟩ = ‘let’
| [ ⟨let us⟩ ] ⟨assume⟩ [ ‘that’ ]

4.8 Definition and notion statements

4.8.1 Definition statements

The following rule is adopted from [2].

⟨notion definition⟩ = ⟨notion head⟩ ( “=” | ⟨is⟩ [ ‘equal’ ‘to’ ] ) [ ⟨article⟩ ] ⟨class noun⟩
⟨function definition⟩ = ⟨function head⟩ ( “=” | ⟨is⟩ [ ‘equal’ ‘to’ ] ) [ ⟨article⟩ ] ( ⟨class noun⟩ | ⟨plain term⟩ )
⟨predicate definition⟩ = ⟨predicate head⟩ ( ⟨iff⟩ | “<” “=” “>” | \\iff” ) ⟨statement⟩

4.8.2 Signature statements

The following rule is adopted from [2].

⟨notion signature⟩ = ⟨notion head⟩ ⟨is⟩ [ ⟨article⟩ ] ( ⟨class noun⟩ | ‘notion’ | ‘constant’ )
⟨predicate signature⟩ = ⟨predicate head⟩ ( ‘implies’ | ‘is’ | “=” “>” | \\implies” ) ⟨statement⟩
| ⟨predicate head⟩ ‘is’ [ ⟨article⟩ ] ( ‘atom’ | ‘relation’ )

Note that in contrast to the rules before, ⟨predicate signature⟩ requires an 'is' instead of an ⟨is⟩.

4.8.3 Notion, function and predicate heads

The rules in this paragraph are adopted from [2].

4.9 Proofs

⟨top-level proof⟩ = \\begin” “{” “proof” “}” [ “[” ‘by’ ⟨method⟩ “]” ] { ⟨proof step⟩ } \\end” “{” “proof” “}”
⟨low-level proof⟩ = ⟨proof head⟩ { ⟨proof step⟩ } ⟨qed⟩
| ‘indeed’ ⟨confirmation⟩
⟨proof head⟩ = ‘proof’ [ ‘by’ ⟨method⟩ ] “.”

Note that in contrast to ⟨proof step⟩ low-level definitions cannot be followed by a proof.

The following rule is adopted from [2].

⟨method⟩ = ‘contradiction’
| ‘case’ ‘analysis’
| ‘induction’ [ ‘on’ ⟨plain term⟩ ]
⟨low-level theorem head⟩ = ⟨let us⟩ ( ‘show’ | ‘prove’ | ‘demonstrate’ ) [ ‘by’ ⟨method⟩ ] ‘that’
⟨choose⟩ = [ ⟨name⟩ ] [ ⟨then⟩ ] [ ⟨let us⟩ ] ( ‘take’ | ‘choose’ | ‘consider’ ) [ ⟨article⟩ ] ⟨notions⟩ [ ⟨reference⟩ ] “.”
⟨case⟩ = [ ⟨name⟩ ] ‘case’ ⟨statement⟩ [ ⟨reference⟩ ] “.” { ⟨proof step⟩ } ⟨qed⟩
⟨affirmation⟩ = [ ⟨name⟩ ] [ ⟨then⟩ ] ⟨statement⟩ [ ⟨reference⟩ ] “.”
⟨equality chain⟩ = [ ⟨name⟩ ] ⟨symbolic term⟩ “.” “=” ⟨symbolic term⟩ [ ⟨reference⟩ ] { “.” “=” ⟨symbolic term⟩ [ ⟨reference⟩ ] } “.”

4.10 Low-level definitions

4.10.1 Class definitions

⟨class definition⟩ = ‘define’ ⟨variable⟩ ‘=’ ( ⟨class term⟩ | ⟨class-of term⟩ ) “.”
⟨descriptive class term⟩ = ( “{” | \\{” ) ( ⟨separation⟩ | ⟨separation in text-mode⟩ ) ( “|” | “:” | \\mid” ) ( ⟨statement⟩ | ⟨statement in text-mode⟩ ) ( “}” | \\}” )
| \\class” “{” ( ⟨separation⟩ | ⟨separation in text-mode⟩ ) “|” ( ⟨statement⟩ | ⟨statement in text-mode⟩ | ⟨statement in classtext-mode⟩ ) “}”
⟨enumerative class term⟩ = ( “{” | \\{” ) ⟨term⟩ { “,” ⟨term⟩ } ( “}” | \\}” )
⟨class-of term⟩ = ( ‘class’ | ‘classes’ | ‘collection’ | ‘collections’ ) [ ⟨variable⟩ ] ‘of’ [ ‘all’ ] ⟨notion⟩
⟨separation⟩ = ⟨term⟩
| ⟨term⟩ ( ‘in’ | \\in” ) ( ⟨term⟩ | ⟨class term⟩ | ⟨class-of term⟩ )
⟨separation in text-mode⟩ = \\text” “{” ⟨separation⟩ “}”

4.10.2 Function definitions

⟨function definition⟩ = ‘define’ ⟨variable⟩ “(” ⟨variable⟩ [ “,” ⟨variable⟩ ] “)” “=” ⟨function body⟩ ‘for’ ( ⟨variable⟩ | “(” ⟨variable⟩ “,” ⟨variable⟩ “)” ) ( ‘in’ | \\in” ) ⟨term⟩ “.”
| ‘define’ ⟨variable⟩ “=” ⟨lambda term⟩ “.”
⟨function parameter⟩ = ⟨variable⟩
| “(” ⟨variable⟩ “,” ⟨variable⟩ “)”
⟨case function⟩ = ‘case’ ⟨statement⟩ ( “-” “>” | \\rightarrow” ) ⟨plain function term⟩ [ “,” ⟨case function⟩ ]
| \\begin” “{” “cases” “}” ⟨case term⟩ “&” [ “:” ] ⟨case statement⟩ { ⟨case term⟩ “&” [ “:” ] ⟨case statement⟩ } \\end” “{” “cases” “}”

Note that linebreaks via \\ are ignored by Naproche, so you can (and should) use them to separate several cases if you use the second option of ⟨case function⟩

⟨case term⟩ = ⟨plain function term⟩
⟨plain function term⟩ = ⟨choice term⟩ | ⟨function term⟩
| \\text” “{” ( ⟨choice term⟩ | ⟨function term⟩ ) “}”
⟨low-level-def choice⟩ = ‘choose’ [ ⟨article⟩ ] ⟨notion⟩
| "</span></span> <span class="NBNF_terminal"><span class="NBNF_case_sensitive_string">" ‘choose’ [ ⟨article⟩ ] ⟨notion⟩ \’ \’
| ‘define’ ⟨variable⟩ “=” ( ⟨class term⟩ | ⟨class-of term⟩ | ⟨lambda term⟩ )
| "</span></span> <span class="NBNF_terminal"><span class="NBNF_case_sensitive_string">" ‘define’ ⟨variable⟩ “=” ( ⟨class term⟩ | ⟨class-of term⟩ | ⟨lambda term⟩ ) \’ \’
⟨lambda term⟩ = \\fun” ( ⟨variable⟩ | “(” ⟨variable⟩ “,” ⟨variable⟩ “)” ) \\in” ⟨lambda domain⟩ “.” ⟨lambda body⟩

4.11 Statements

⟨statement in text-mode⟩ = \\text” “{” ⟨statement⟩ “}”
⟨statement in classtext-mode⟩ = \\classtext” “{” ⟨statement⟩ “}”
⟨quantified statement⟩ = ⟨quantifier chain⟩ ⟨statement⟩
⟨if-then statement⟩ = ‘if’ ⟨statement⟩ ‘then’ ⟨statement⟩
⟨it-is-wrong statement⟩ = ‘it’ ‘is’ ‘wrong’ ‘that’ ⟨statement⟩
⟨and chain⟩ = ⟨atomic statement⟩ { ‘and’ ⟨atomic statement⟩ }
⟨or chain⟩ = ⟨atomic statement⟩ { ‘or’ ⟨atomic statement⟩ }
⟨neither-nor chain⟩ = ‘neither’ ⟨atomic statement⟩ ‘nor’ ⟨atomic statement⟩ { ‘nor’ ⟨atomic statement⟩ }
⟨quantifier chain⟩ = ‘for’ ⟨quantified notion⟩ { “,” ⟨quantified notion⟩ }
⟨chain end⟩ = ‘and’ ⟨headed statement⟩
| ‘or’ ⟨headed statement⟩
| ⟨iff⟩ ⟨statement⟩
| ( ‘when’ | ‘where’ ) ⟨statement⟩

4.11.1 Atomic statements

⟨atomic statement⟩ = ⟨simple statement⟩
| ⟨there-is statement⟩
| [ ‘we’ ‘have’ ] ( ⟨symbolic statement⟩ | ⟨constant statement⟩ )
⟨there-is statement⟩ = ‘there’ ( ‘is’ | ‘exists’ | ‘exist’ ) ( ⟨no notion⟩ | [ ⟨article⟩ ] ⟨notions⟩ )
⟨constant statement⟩ = [ ⟨article⟩ ] ( ‘thesis’ | ‘contrary’ | ‘contradiction’ )
⟨late quantifiers⟩ = ‘for’ ⟨quantified notion⟩ { ( “,” | ‘and’ ) ⟨quantified notion⟩ }

4.11.2 Symbolic formulas

⟨symbolic formula⟩ = ⟨biimplication⟩
⟨biimplication⟩ = ⟨implication⟩ [ ( “<” “=” “>” | \\iff” ) ⟨implication⟩ ]
⟨implication⟩ = ⟨disjunction⟩ [ ( “=” “>” | \\implies” ) ⟨implication⟩ ]
⟨disjunction⟩ = ⟨conjunction⟩ [ ( \\ “/” | \\vee” ) ⟨disjunction⟩ ]
⟨conjunction⟩ = ⟨non-binary formula⟩ [ ( “/” \\ | \\wedge” ) ⟨conjunction⟩ ]
⟨universal formula⟩ = ( ‘forall’ | \\forall” ) ⟨symbolic notion⟩ ⟨non-binary formula⟩
⟨existential statement⟩ = ( ‘exists’ | \\exists” ) ⟨symbolic notion⟩ ⟨non-binary formula⟩
⟨negation⟩ = ‘not’ ⟨non-binary formula⟩
⟨separated formula⟩ = “:” ⟨symbolic formula⟩
⟨atomic formula⟩ = ⟨symbolic relation⟩
| “(” ( ⟨statement⟩ | ⟨statement in text-mode⟩ ) “)”
⟨symbolic tail⟩ = ⟨infix tail⟩
| ⟨right tail⟩
⟨right tail⟩ = ⟨primitive right predicate⟩
⟨term chain⟩ = ⟨symbolic term⟩ { “,” ⟨symbolic term⟩ }

4.12 Notions

⟨notions⟩ = ⟨notion⟩ { ( “,” | ‘and’ ) ⟨notion⟩ }

The following rule is adopted from [2].

⟨no notion⟩ = ‘no’ ⟨notion⟩

The following rule is adopted from [2].

⟨quantified notion⟩ = ( ‘every’ | ‘all’ | ‘any’ | ‘each’ ) ⟨notion⟩
| ‘some’ ⟨notion⟩
| ‘no’ ⟨notion⟩
⟨symbolic notion⟩ = ⟨variables⟩ [ ⟨pattern⟩ ]

4.12.1 Relations

The following rule is adopted from [2].

4.12.2 Nouns

The following rule is adopted from [2].

The following rule is adopted from [2].

4.12.3 Attributes

The rules defined in this paragraph are adopted from [2].

⟨right attribute⟩ = ⟨is-predicate⟩ { ‘and’ ⟨is-predicate⟩ }
| ‘that’ ⟨does-predicate⟩ { ‘and’ ⟨does-predicate⟩ }
| ‘such’ ‘that’ ⟨statement⟩

4.12.4 Predicates

The rules defined in this paragraph are adopted from [2].

⟨is-predicate⟩ = [ ‘not’ ] ⟨primitive adjective⟩
| [ ‘not’ ] [ ‘pairwise’ ] ⟨primitive m-adjective⟩
| ⟨with⟩ ⟨has-predicate⟩
⟨is-a-predicate⟩ = [ ‘not’ ] ⟨indefinite article⟩ ⟨class noun⟩
| [ ‘not’ ] ⟨definite term⟩
⟨does-predicate⟩ = [ ⟨does⟩ ] [ ‘not’ ] ⟨primitive verb⟩
| [ ⟨does⟩ ] [ ‘not’ ] [ ‘pairwise’ ] ⟨primitive m-verb⟩
| ⟨has⟩ ⟨has-predicate⟩
| ⟨is⟩ ⟨is-predicate⟩ { ‘and’ ⟨is-predicate⟩ }
| ⟨is⟩ ⟨is-a-predicate⟩ { ‘and’ ⟨is-a-predicate⟩ }
⟨has-predicate⟩ = [ ⟨article⟩ ] ⟨possessed noun⟩ { ‘and’ [ ⟨article⟩ ] ⟨possessed noun⟩ }

4.12.5 Adjectives

⟨primitive simple adjective⟩ = ⟨alphabetic pattern⟩
⟨primitive simple m-adjective⟩ = ⟨alphabetic pattern⟩

4.12.6 Verbs

4.13 Terms

The rules defined in this paragraph are adopted from [2].

⟨terms⟩ = ⟨term⟩ { ( “,” | ‘and’ ) ⟨term⟩ }
⟨tightest symbolic term⟩ = ⟨primitive postfix operator⟩
| “(” ⟨symbolic term⟩ “)”
| ⟨variable⟩

4.13.1 Operators

⟨primitive prefix operator⟩ = ⟨pattern⟩ ⟨tighter symbolic term⟩

4.13.2 Plain terms

The following rule is adopted from [2].

5 References

This reference is based on:

  • [1] Steffen Frerix, Text-orientated Formalization Methods, Rheinische Friedrich-Wilhelms-Universität Bonn, 2018

  • [2] Andrei Paskevich, The syntax and semantics of the ForTheL language, Université Paris XII - Val de Marne, Kiev National Taras Shevchenko University, 2007

  • [3] The source code of Naproche’s ForTheL parser: https://github.com/naproche/naproche

6 Copyright

Marcel Schütz, CC BY-SA 4.0.