Gory Details {#gorydetails} ============ This chapter presents all syntactic elements of CafeOBJ as well as several meta-concepts in alphabetic order. Concepts are cross-linked for easy accessibility. ## `?` ## {#help} lists all top-level commands. The `?` can be used after many of the top-level commands to obtain help. ## `! ` ## {#commandexec} TODO Currently not working!! On Unix only, forks a shell and executes the given ``. ## `**`, `**>` ## {#starstar} Starts a comment which extends to the end of the line. With the additional `>` the comment is displayed while evaluated by the interpreter. Related: [`--`](#dashdash) [comments](#comments) ## `--`, `-->` ## {#dashdash} Starts a comment which extends to the end of the line. With the additional `>` the comment is displayed while evaluated by the interpreter. Related: [`**`](#starstar) [comments](#comments) ## `=` ## {#axeq} The syntax element `=` introduces an axiom of the equational theory, and is different from `==` which specifies an equality based on rewriting. Related: [`==`](#equality) [`eq`](#eq) ## `==` ## {#equality} The predicate `==` is a binary operator defined for each visible sort and is defined in terms of evaluation. That is, for ground terms `t` and `t'` of the same sort, `t == t'` evaluates to `true` iff terms reduce to a common term. This is different from the equational `=` which specifies the equality of the theory. ## `==>` ## {#transrel} This binary predicate is defined on each visible sort, and defines the transition relation, which is reflexive, transitive, and closed under operator application. It expresses the fact that two states (terms) are connected via transitions. Related: [`trans`](#trans) [`=(*)=>`](#transsearch) ## `=*=` ## {#bequality} The predicate for behavioural equivalence, written `=*=`, is a binary operator defined on each hidden sort. TODO: old manual very unclear ... both about `=*=` and `accept =*= proof` ??? (page 46 of old manual) ## `=(n)=>` `=(n,m)=>` ## {#transsearch} See [search predicate](#searchpredicate) ## `=/=` ## {#ineq} Negation of the predicate [`==`](#equality). ## `accept =*= proof` switch ## {#switch-accept} TODO missing documentation difficult - see TODO for [`=*=`](#bequality) ## `all axioms` switch ## {#switch-all-axioms) Controls whether axioms from included modules are shown during a `show` invocation. Related: [`show`](#show) ## `always memo` switch ## {#switch-always-memo) Turns on memorization of computation also for operators without the [`memo`](#opattr) operator attribute. Related: [`memo` switch](#switch-memo) [operator attributes](#opattr) ## `apply [ ] ` ## {#apply} Applies one of the following actions `reduce`, `exec`, `print`, or a rewrite rule to the term in focus. `reduce`, `exec`, `print` ~ the operation acts on the (sub)term specified by `` and ``. rewrite rule ~ in this case a rewrite rule spec has to be given in the following form: `[+|-][].` where `` is the name of a module, and `` either a number n - in which case the n. equation in the current module is used, or the label of an equation. If the `` is not given, the equations of the current module are considered. If the leading `+` or no leading character is given, the equation is applied left-to-right, which with a leading `-` the equation is applied right-to-left. The `` is of the form `with { = } +,` and is used when applying a rewrite rule. In this case the variables in the rule are bound to the given term. `` is either `within` or `at`. In the former case the action is applied at or inside the (sub)term specified by the following selection. In the later case it means exactely at the (sub)term. Finally, the `` is an expression ` { of } *` where each `` is one of `top`, `term` ~ Selects the whole term `subterm` ~ Selects the pre-chosen subterm (see [`choose`](#choose)) `( )` ~ A list of numbers separated by blanks as in `(2 1)` indicates a subterm by tree search. `(2 1)` means the first argument of the second argument. `[ .. ]` ~ This selector can only be used with associative operators. It indicates a subterm in a flattened structure and selects the subterm between and including the two numbers given. `[n .. n]` can be abbreviated to `[n]`. Example: If the term is `a * b * c * d * e`, then the expression `[2 .. 4]` selects the subterm `b * c * d`. `{ }` ~ This selector can only be used with associative and commutative operators. It indicates a subterm in a multiset structure obtained from selecting the subterms at position given by the numbers. Example: If the operator `_*_` is declared as associative and commutative, and the current term is `b * c * d * c * e`, then then the expression `{2, 4, 5}` selects the subterm `c * c * e`. Related: [`choose`](#choose) [`start`](#start) ## `auto context` switch ## {#switch-auto-context} Possible values: `on` or `off`, default is `off`. If this switch is `on`, the context will automatically switch to the most recent module, i.e., defining a module or inspecting a module's content will switch the current module. ## `autoload` ## {#autoload} TODO No documentation in original manual, no idea! ## `axioms { }` ## {#axioms} Block enclosing declarations of variables, equations, and transitions. Other statements are not allowed within the `axioms` block. Optional structuring of the statements in a module. Related: [`signature`](#signature) [`imports`](#imports) [`var`](#var) [`eq`](#eq) [`trans`](#trans) ## `bceq [ ] = if .` ## {#bceq} Alias: `bcq` Defines a behaviour conditional equation. For details see [`ceq`](#ceq). Related: [`eq`](#eq) [`ceq`](#ceq) [`beq`](#beq) ## `beq [ ] = .` ## {#beq} Defines a behaviour equation. For details see [`eq`](#eq). Related: [`eq`](#eq) [`ceq`](#ceq) [`bceq`](#bceq) ## `bctrans [ ] => if .` ## {#bctrans} Defines a behaviour conditional transition. For details see [`ctrans`](#ctrans). Related [`trans`](#trans) [`ctrans`](#ctrans) [`btrans`](#btrans) ## `bop : -> ` ## {#bop} Defines a behavioural operator by its domain, codomain, and the term construct. `` is a space separated list of sort names containing *exactely* one hidden sort. `` is a single sort name. For `` see the explanations of [`op`](#op). Related: [`op`](#op) ## `bpred : ` ## {#bpred} Short hand for `op : -> Bool` defining a behavioural predicate. Related: [`op`](#op) [`bop`](#op) [`pred`](#bpred) ## `breduce [ in : ] .` ## {#breduce} Alias: `bred` Reduce the given term in the given module, if `` is given, otherwise in the current module. For `breduce` equations, possibly conditional, possibly behavioural, are taken into account for reduction. Related: [`execute`](#execute) [`reduce`](#reduce) ## `btrans [ ] => .` ## {#btrans} Defines a behaviour transition. For details see [`trans`](#trans). Related [`trans`](#trans) [`ctrans`](#ctrans) [`bctrans`](#bctrans) ## `cbred` ## {#cbred} TODO no documentation ## `cd ` ## {#cd} Change the current working directory, like the Unix counterpart. The argument is necessary. No kind of expansion or substitution is done. Related: [`pwd`](#pwd) [`ls`](#ls) ## `ceq [ ] = if .` ## {#ceq} Defines a conditional equation. Spaces around the `if` are obligatory. `` needs to be a Boolean term. For other requirements see [`eq`](#eq). Related: [`eq`](#eq) [`beq`](#beq) [`bceq`](#bceq) ## `check ` switch ## {#switch-check} These switches turn on automatic checking of certain properties: `check coherency` ~ TODO `check compatibility` ~ see the [`check`](#check) command `check import` ~ TODO `check regularity` ~ see the [`check`](#check) command `check sensible` ~ TODO ## `check ` ## {#check} This command allows for checking of certain properties of modules and operators. `check regularity ` ~ Checks whether the module given by the module expression `` is regular. `check compatibility ` ~ Checks whether term rewriting system of the module given by the module expression `` is compatible, i.e., every application of every rewrite rule to every well-formed term results in a well-formed term. (This is not necessarily the case in order-sorted rewriting!) `check laziness ` ~ Checks whether the given operator can be evaluated lazily. If not `` is given, all operators of the current module are checked. Related: [`regularize`](#regularize) ## `choose ` ## {#choose} Chooses a subterm by the given ``. See [`apply`](#apply) for details on ``. Related: [`apply`](#apply) [`start`](#start) [`strat` in operator attributes](#opattr) ## `clean memo` ## {#cleanmemo} Resets (clears) the memo storages of the system. Memorized computations are forgotten. Related: [`clean memo` switch](#switch-clean-memo) ## `clean memo` switch ## {#switch-clean-memo} Possible values: `on`, `off`, default `off`. tells the system to be forgetful. TODO what is the difference between `set memo off` and `set clean memo off` ## `close` ## {#close} This command closes a modification of a module started by `open`. Related: [`open`](#open) ## comments ## {#comments} The interpreter accepts the following strings as start of a comment that extends to the end of the line: `--`, `-->`, `**`, `**>`. The difference in the variants with `>` is that the comment is displayed when run through the interpreter. Related: [`**`](#starstar) [`--`](#dashdash) ## `cond limit` switch ## {#switch-cond-limit} TODO missing documentation ## `ctrans [ ] => .` ## {#ctrans} Defines a conditional transition. For details see [`trans`](#trans) and [`ceq`](#ceq). Related [`trans`](#trans) [`btrans`](#ctrans) [`bctrans`](#bctrans) ## `describe ` ## {#describe} like the `show` command with more details. See `describe ?` for the possible set of invocations. Related: [`show`](#show) ## `eof` ## {#eof} Terminates reading of the current file. Allows for keeping untested code or documentations below the `eof` mark. Has to be on a line by itself without leading spaces. ## `eq [ ] = .` ## {#eq} Declares an axiom, or equation. Spaces around the `=` are necessary to separate the left from the right hand side. The terms given must belong to the same connected component in the graph defined by the sort ordering. In simple words, the objects determined by the terms must be interpretable as of the same sort. The optional part `` serves two purposes, one is to give an axiom an identifier, and one is to modify its behaviour. The `` is of the form: ` [