| 1 |
## Ctrl-D ## {#ctrld} |
| 2 |
|
| 3 |
Terminates the input and exit from the interpreter. |
| 4 |
|
| 5 |
## `! <command>` ## {#commandexec} |
| 6 |
|
| 7 |
On Unix only, forks a shell and executes the given `<command>`. |
| 8 |
|
| 9 |
## `#define <pattern> := <term> .` ## {#sharp-define} |
| 10 |
|
| 11 |
Defines <pattern> to be <term>, that is, when <pattern> |
| 12 |
appers in term, it is expanded to <term> and then parsed. |
| 13 |
|
| 14 |
## `**`, `**>` ## {#starstar} |
| 15 |
|
| 16 |
Starts a comment which extends to the end of the line. |
| 17 |
With the additional `>` the comment is displayed while |
| 18 |
evaluated by the interpreter. |
| 19 |
|
| 20 |
Related: [comments](#comments), [`--`](#starstar) |
| 21 |
|
| 22 |
## `--`, `-->` ## {#dashdash} |
| 23 |
|
| 24 |
Starts a comment which extends to the end of the line. |
| 25 |
With the additional `>` the comment is displayed while |
| 26 |
evaluated by the interpreter. |
| 27 |
|
| 28 |
Related: [comments](#comments), [`**`](#starstar) |
| 29 |
|
| 30 |
## `.` ## {#dotsep} |
| 31 |
|
| 32 |
Input separator |
| 33 |
|
| 34 |
## `=` ## {#axeq} |
| 35 |
|
| 36 |
The syntax element `=` introduces an axiom of the equational theory, |
| 37 |
and is different from `==` which specifies an equality based on |
| 38 |
rewriting. |
| 39 |
|
| 40 |
Related: [`eq`](#eq), [`==`](#equality) |
| 41 |
|
| 42 |
## `=(n)=>`, `=(n,m)=>`, `=()=>` ## {#searchpredsymb} |
| 43 |
|
| 44 |
See [`search predicates`](#searchpredicate) |
| 45 |
|
| 46 |
## `=*=` ## {#bequality} |
| 47 |
|
| 48 |
The predicate for behavioral equivalence, written `=*=`, is a binary |
| 49 |
operator defined on each hidden sort. |
| 50 |
|
| 51 |
## `=/=` ## {#notequal} |
| 52 |
|
| 53 |
Negation of the predicate `==`. |
| 54 |
|
| 55 |
Related: [`==`](#equality) |
| 56 |
|
| 57 |
## `==` ## {#equality} |
| 58 |
|
| 59 |
The predicate `==` is a binary operator defined for each visible sort |
| 60 |
and is defined in terms of evaluation. That is, for ground terms `t` |
| 61 |
and `t'` of the same sort, `t == t'` evaluates to `true` iff terms |
| 62 |
reduce to a common term. This is different from the equational `=` |
| 63 |
which specifies the equality of the theory. |
| 64 |
|
| 65 |
## `==>` ## {#transrel} |
| 66 |
|
| 67 |
This binary predicate is defined on each visible sort, and defines the |
| 68 |
transition relation, which is reflexive, transitive, and closed under |
| 69 |
operator application. It expresses the fact that two states (terms) |
| 70 |
are connected via transitions. |
| 71 |
|
| 72 |
Related: [search predicates](#searchpredicate), [`trans`](#trans) |
| 73 |
|
| 74 |
## `? [<term>]` ## {#help} |
| 75 |
|
| 76 |
Without any argument, shows the brief guide of online help system. |
| 77 |
With argument gives the reference manual description of `term`. |
| 78 |
In addition to this, many commands allow for passing `?` as argument |
| 79 |
to obtain further help. |
| 80 |
|
| 81 |
In case examples are provided for the `<term>`, they can be displayed |
| 82 |
using `?ex <term>`. In this case the normal help output will also contain |
| 83 |
an informational message that examples are available. |
| 84 |
|
| 85 |
When called as ?? both documentation and examples are shown. |
| 86 |
|
| 87 |
## `?apropos <term> [<term> ...]` ## {#apropos} |
| 88 |
|
| 89 |
Searches all available online docs for the terms passed. |
| 90 |
Terms are separated by white space. Each term is tested independently |
| 91 |
and all terms have to match. Testing is done either by simple sub-string |
| 92 |
search, or, if the term looks like a regular expression (Perl style), |
| 93 |
by regex matching. In case a regex-like term cannot be parsed as regular |
| 94 |
expression, it is used in normal sub-string search mode. |
| 95 |
|
| 96 |
Note: Fancy quoting with single and double quotes might lead to unexpected problems. |
| 97 |
|
| 98 |
### Example ### |
| 99 |
|
| 100 |
````` |
| 101 |
CafeOBJ> ?ap prec oper |
| 102 |
````` |
| 103 |
will search for all entries that contain both `prec` and `oper` as |
| 104 |
sub-strings. Matching is done as simple sub-string match. |
| 105 |
|
| 106 |
````` |
| 107 |
CafeOBJ> ?ap foo att[er] |
| 108 |
````` |
| 109 |
will search for entries that contain the string `foo` as well as |
| 110 |
either the string `atte` or `attr`. |
| 111 |
|
| 112 |
|
| 113 |
## `?com [ <term> ]` ## {#help-commands} |
| 114 |
|
| 115 |
List commands or declarations categorized by the key <term>. |
| 116 |
<term> is one of 'decl', 'module', 'parse', 'rewrite', |
| 117 |
'inspect', 'switch', 'proof', 'system', 'inspect', 'library', 'help', 'io' or 'misc'. |
| 118 |
If <term> is omitted, the list of available <term> will be printed. |
| 119 |
|
| 120 |
## `[` ## {#sortsymbol} |
| 121 |
|
| 122 |
Starts a sort declaration. See [sort declaration](#sort) for details. |
| 123 |
|
| 124 |
## `accept =*= proof` switch ## {#switch-accept} |
| 125 |
|
| 126 |
accept system's automatic proof of congruency of `=*=` |
| 127 |
|
| 128 |
## `all axioms` switch ## {#switch-all-axioms} |
| 129 |
|
| 130 |
Controls whether axioms from included modules are shown |
| 131 |
during a `show` invocation. |
| 132 |
|
| 133 |
Related: [`show`](#show) |
| 134 |
|
| 135 |
## `always memo` switch ## {#switch-always-memo} |
| 136 |
|
| 137 |
Turns on memorization of computation also for operators without |
| 138 |
the [`memo`](#opattr) operator attribute. |
| 139 |
|
| 140 |
Related: [operator attributes](#opattr), [`memo`](#switch-memo) |
| 141 |
|
| 142 |
## `:apply (<tactic> ...) [to <goal-name>]` ## {#citp-apply} |
| 143 |
|
| 144 |
Apply the list of tactics given within parenthesis to either |
| 145 |
the current goal, or the goal given as `<goal-name>`. |
| 146 |
|
| 147 |
Related: [`citp`](#citp) |
| 148 |
|
| 149 |
## `apply <action> [ <subst> ] <range> <selection>` ## {#apply} |
| 150 |
|
| 151 |
Applies one of the following actions `reduce`, `exec`, `print`, or a |
| 152 |
rewrite rule to the term in focus. |
| 153 |
|
| 154 |
`reduce`, `exec`, `print` |
| 155 |
~ the operation acts on the (sub)term specified by `<range>` and |
| 156 |
`<selection>`. |
| 157 |
|
| 158 |
rewrite rule |
| 159 |
~ in this case a rewrite rule spec has to be given in the following |
| 160 |
form: |
| 161 |
|
| 162 |
`[+|-][<mod_name>].<rule-id>` |
| 163 |
|
| 164 |
where `<mod_name>` is the name of a module, and `<rule-id>` either |
| 165 |
a number n - in which case the n. equation in the current module |
| 166 |
is used, or the label of an equation. If the `<mod_name>` is not |
| 167 |
given, the equations of the current module are considered. If the |
| 168 |
leading `+` or no leading character is given, the equation is |
| 169 |
applied left-to-right, which with a leading `-` the equation is |
| 170 |
applied right-to-left. |
| 171 |
|
| 172 |
The `<subst>` is of the form |
| 173 |
|
| 174 |
`with { <var_name> = <term> } +,` |
| 175 |
|
| 176 |
and is used when applying a rewrite rule. In this case the variables |
| 177 |
in the rule are bound to the given term. |
| 178 |
|
| 179 |
`<range>` is either `within` or `at`. In the former case the action is |
| 180 |
applied at or inside the (sub)term specified by the following |
| 181 |
selection. In the later case it means exactly at the (sub)term. |
| 182 |
|
| 183 |
Finally, the `<selection>` is an expression |
| 184 |
|
| 185 |
`<selector> { of <selector> } *` |
| 186 |
|
| 187 |
where each `<selector>` is one of |
| 188 |
|
| 189 |
`top`, `term` |
| 190 |
~ Selects the whole term |
| 191 |
|
| 192 |
`subterm` |
| 193 |
~ Selects the pre-chosen subterm (see [`choose`](#choose)) |
| 194 |
|
| 195 |
`( <number_list> )` |
| 196 |
~ A list of numbers separated by blanks as in `(2 1)` indicates a |
| 197 |
subterm by tree search. `(2 1)` means the first argument of the |
| 198 |
second argument. |
| 199 |
|
| 200 |
`[ <number1> .. <number2> ]` |
| 201 |
~ This selector can only be used with associative operators. It |
| 202 |
indicates a subterm in a flattened structure and selects the |
| 203 |
subterm between and including the two numbers given. `[n .. n]` |
| 204 |
can be abbreviated to `[n]`. |
| 205 |
|
| 206 |
Example: If the term is `a * b * c * d * e`, then the |
| 207 |
expression `[2 .. 4]` selects the subterm `b * c * d`. |
| 208 |
|
| 209 |
`{ <number_set> }` |
| 210 |
~ This selector can only be used with associative and commutative |
| 211 |
operators. It indicates a subterm in a multiset structure obtained |
| 212 |
from selecting the subterms at position given by the numbers. |
| 213 |
|
| 214 |
Example: If the operator `_*_` is declared as associative and |
| 215 |
commutative, and the current term is `b * c * d * c * e`, then |
| 216 |
then the expression `{2, 4, 5}` selects the subterm `c * c * e`. |
| 217 |
|
| 218 |
Related: [`start`](#start), [`choose`](#choose) |
| 219 |
|
| 220 |
## `:auto` ## {#citp-auto} |
| 221 |
|
| 222 |
Applies the following set of tactics: `(SI CA TC IP RD)`. |
| 223 |
|
| 224 |
Related: [`citp`](#citp) |
| 225 |
|
| 226 |
## `auto context` switch ## {#switch-auto-context} |
| 227 |
|
| 228 |
Possible values: `on` or `off`, default is `off`. |
| 229 |
|
| 230 |
If this switch is `on`, the context will automatically switch to |
| 231 |
the most recent module, i.e., defining a module or inspecting |
| 232 |
a module's content will switch the current module. |
| 233 |
|
| 234 |
## `autoload <module-name> <file-name>` ## {#autoload} |
| 235 |
|
| 236 |
When evaluating a <module-name> and found that |
| 237 |
it is not yet declared, the system read in <file-name> then |
| 238 |
retries the evaluation. |
| 239 |
|
| 240 |
Related: [`no autoload`](#no-autoload) |
| 241 |
|
| 242 |
## `ax [ <label-exp> ] <term> = <term>` . ## {#ax} |
| 243 |
|
| 244 |
(pignose) |
| 245 |
|
| 246 |
## `axioms { <decls> }` ## {#axioms} |
| 247 |
|
| 248 |
Block enclosing declarations of variables, equations, and |
| 249 |
transitions. |
| 250 |
Other statements are not allowed within the `axioms` block. |
| 251 |
Optional structuring of the statements in a module. |
| 252 |
|
| 253 |
Related: [`trans`](#trans), [`eq`](#eq), [`var`](#var), [`imports`](#imports), [`signature`](#signature) |
| 254 |
|
| 255 |
## `:backward equation|rule` ## {#citp-backward} |
| 256 |
|
| 257 |
Like [`:equation`](#citp-equation) and [`:rule`](#citp-rule), but exchange the left and right side. |
| 258 |
|
| 259 |
Related: [`:rule`](#citp-rule), [`:equation`](#citp-equation), [`:cp`](#citp-cp), [`citp`](#citp) |
| 260 |
|
| 261 |
## `bax [ <label-exp> ] <term> = <term>` . ## {#bax} |
| 262 |
|
| 263 |
(pignose) |
| 264 |
|
| 265 |
## `bceq [ <label-exp> ] <term> = <term> if <boolterm> .` ## {#bceq} |
| 266 |
|
| 267 |
Defines a behavioral conditional equation. For details see [`ceq`](#ceq). |
| 268 |
|
| 269 |
Related: [`beq`](#beq), [`ceq`](#ceq), [`eq`](#eq) |
| 270 |
|
| 271 |
## `bcrule [ <label-exp> ] <term> => <term> if <term> .` ## {#bcrule} |
| 272 |
|
| 273 |
Synonym of [`bctrans`](#bctrans) |
| 274 |
|
| 275 |
Related: [`bctrans`](#bctrans) |
| 276 |
|
| 277 |
## `bctrans [ <label-exp> ] <term> => <term> if <bool> .` ## {#bctrans} |
| 278 |
|
| 279 |
Defines a behavioral conditional transition. |
| 280 |
For details see [`ctrans`](#ctrans). |
| 281 |
|
| 282 |
Related: [`btrans`](#btrans), [`ctrans`](#ctrans), [`trans`](#trans) |
| 283 |
|
| 284 |
## `beq [ <label-exp> ] <term> = <term> .` ## {#beq} |
| 285 |
|
| 286 |
Defines a behavioral equation. For details see [`eq`](#eq). |
| 287 |
|
| 288 |
Related: [`bceq`](#bceq), [`ceq`](#ceq), [`eq`](#eq) |
| 289 |
|
| 290 |
## `bgoal <term> .` ## {#bgoal} |
| 291 |
|
| 292 |
(pignose) |
| 293 |
|
| 294 |
## `bgrind [in <module-name> :] <boolean-term> .` ## {#bgrind} |
| 295 |
|
| 296 |
Print given boolean term in 'grind'ed manner after computes its xor-and normal form. |
| 297 |
|
| 298 |
## `:bgrind [in <goal-name> :] <boolean-term> .` ## {#citp-bgrind} |
| 299 |
|
| 300 |
Used diring [CITP](#citp) proofs instead of [`bgrind`](#bgrind) |
| 301 |
|
| 302 |
## `{bguess | :bguess} {imply|and|or} [ with <predicate name> ]` ## {#bguess} |
| 303 |
|
| 304 |
Try to find true/false assignments which satisfies the Bool term |
| 305 |
specified by 'binspect' or ':binspect'. |
| 306 |
|
| 307 |
## `binspect [in <module-name> :] <boolean-term> .` ## {#binspect} |
| 308 |
|
| 309 |
Start an inspection of a Boolean term, that is, and abstracted |
| 310 |
form of the Boolean term is constructed. The abstracted term is shown (like calling [`bshow`](#bshow). |
| 311 |
|
| 312 |
### Example ### |
| 313 |
|
| 314 |
|
| 315 |
~~~~~ |
| 316 |
CafeOBJ> module BTE { [S] |
| 317 |
preds p1 p2 p3 p4 p5 p6 p7 : S |
| 318 |
ops a b c : -> S . |
| 319 |
} |
| 320 |
CafeOBJ> binspect in BTE : (p1(X:S) or p2(X)) and p3(Y:S) or (p4(Y) and p1(Y)) . |
| 321 |
... |
| 322 |
--> ((p4(Y:S) and p1(Y)) xor ((p3(Y) and p1(X:S)) xor ((p2(X) and (p3(Y) and p1(X))) xor ((p3(Y) and p2(X)) xor ((p3(Y) and (p2(X) and (p4(Y) and p1(Y)))) xor ((p3(Y) and (p2(X) and (p1(X) and (p1(Y) and p4(Y))))) xor (p1(X) and (p3(Y) and (p1(Y) and p4(Y)))))))))) |
| 323 |
... |
| 324 |
~~~~~ |
| 325 |
|
| 326 |
## `:binspect [in <goal-name> :] <boolean-term> .` ## {#citp-binspect} |
| 327 |
|
| 328 |
Used during [CITP](#citp) proofs instead of [`binspect`](#binspect) |
| 329 |
|
| 330 |
## `bop <op-spec> : <sorts> -> <sort>` ## {#bop} |
| 331 |
|
| 332 |
Defines a behavioral operator by its domain, co-domain, and the term |
| 333 |
construct. `<sorts>` is a space separated list of sort names containing |
| 334 |
*exactly* one hidden sort. `<sort>` is a single sort name. |
| 335 |
|
| 336 |
For `<op-spec>` see the explanations of [`op`](#op). |
| 337 |
|
| 338 |
Related: [`op`](#op) |
| 339 |
|
| 340 |
## `bpred <op-spec> : <sorts>` ## {#bpred} |
| 341 |
|
| 342 |
Short hand for `op <op-spec> : <sorts> -> Bool` defining a |
| 343 |
behavioral predicate. |
| 344 |
|
| 345 |
Related: [`pred`](#pred), [`bop`](#bop), [`op`](#op) |
| 346 |
|
| 347 |
## `breduce [ in <mod-exp> : ] <term> .` ## {#breduce} |
| 348 |
|
| 349 |
Reduce the given term in the given module, if `<mod-exp>` is given, |
| 350 |
otherwise in the current module. |
| 351 |
|
| 352 |
For `breduce` equations, possibly conditional, possibly behavioral, are taken |
| 353 |
into account for reduction. |
| 354 |
|
| 355 |
Related: [`reduce`](#reduce), [`execute`](#execute) |
| 356 |
|
| 357 |
## `{bresolve | :bresolve} [<limit>] [all]` ## {#bresolve} |
| 358 |
|
| 359 |
Computes all possible variable assignments that render an abstracted |
| 360 |
term `true`. The variant with leading colon is for usage during a [CITP](#citp) proof. |
| 361 |
If an optional argument 'all' is specified, all solutions will be searched. |
| 362 |
Optional <limit> specifies maximal number of variable combination, i.e. |
| 363 |
if there are 3 variables v1, v2, and v3, and <limit> is 2, |
| 364 |
the following cases are examined: |
| 365 |
(1) v1 : true/false |
| 366 |
(2) v2 : true/false |
| 367 |
(3) v3 : true/false |
| 368 |
(4) v1/v2 : combinations of true/false of two variables |
| 369 |
(5) v1/v3 : combinations of true/false of two variables |
| 370 |
(6) v2/v3 : combinations of true/false of two variables |
| 371 |
|
| 372 |
### Example ### |
| 373 |
|
| 374 |
|
| 375 |
~~~~~ |
| 376 |
CafeOBJ> bresolve 2 all |
| 377 |
|
| 378 |
** (1) The following assignment(s) makes the term to be 'true'. |
| 379 |
[1] { P-3:Bool |-> true } |
| 380 |
where |
| 381 |
p-3 = P4(Y:S) |
| 382 |
|
| 383 |
[2] { P-4:Bool |-> true } |
| 384 |
where |
| 385 |
p-4 = P1(X:S) |
| 386 |
|
| 387 |
** (2) The following assignment(s) makes the term to be 'true'. |
| 388 |
[1] { P-1:Bool |-> true, P-2:Bool |-> true } |
| 389 |
where |
| 390 |
p-1 = P3(Y:S) |
| 391 |
p-2 = P2(X:S) |
| 392 |
... |
| 393 |
~~~~~ |
| 394 |
|
| 395 |
## `brule [ <label-exp> ] <term> => <term> .` ## {#brule} |
| 396 |
|
| 397 |
Synonym of [`btrans`](#btrans). |
| 398 |
|
| 399 |
Related: [`btrans`](#btrans) |
| 400 |
|
| 401 |
## `{bshow | :bshow} [{ tree | grind }]` ## {#bshow} |
| 402 |
|
| 403 |
Shows the abstracted Boolean term computed by [`binspect`](#binspect). |
| 404 |
If the argument `tree` is given, prints out a the abstracted term in tree form. |
| 405 |
The variant with leading colon is for usage during a [CITP](#citp) proof. |
| 406 |
|
| 407 |
### Example ### |
| 408 |
|
| 409 |
|
| 410 |
~~~~~ |
| 411 |
CafeOBJ> bshow |
| 412 |
((P-1:Bool and (P-2:Bool and (P-3:Bool and P-4:Bool))) xor ((P-1 and (P-2 and (P-4 and (P-5:Bool and P-3)))) xor ((P-2 and (P-1 and (P-5 and P-3))) xor ((P-5 and P-3) xor ((P-4 and (P-3 and P-5)) xor ((P-4 and P-3) xor (P-2 and P-1))))))) |
| 413 |
where |
| 414 |
P-1:Bool |-> p4(Y:S) |
| 415 |
P-2:Bool |-> p1(Y:S) |
| 416 |
P-3:Bool |-> p3(Y:S) |
| 417 |
P-4:Bool |-> p1(X:S) |
| 418 |
P-5:Bool |-> p2(X:S) |
| 419 |
~~~~~ |
| 420 |
|
| 421 |
## `bsort token-predicate creater printer term-predicate` ## {#bsort} |
| 422 |
|
| 423 |
Defines a built-in sort. Internal use only. |
| 424 |
|
| 425 |
## `btrans [ <label-exp> ] <term> => <term> .` ## {#btrans} |
| 426 |
|
| 427 |
Defines a behavioral transition. For details see [`trans`](#trans). |
| 428 |
|
| 429 |
Related: [`bctrans`](#bctrans), [`ctrans`](#ctrans), [`trans`](#trans) |
| 430 |
|
| 431 |
## `cbred [ in <mod-exp> :] <term> .` ## {#cbred} |
| 432 |
|
| 433 |
circular coinductive reduction: see |
| 434 |
_Goguen, Lin, Rosu: Circular Coinductive Rewriting_ |
| 435 |
(Proceedings of Automated Software Engineering 2000) for details. |
| 436 |
|
| 437 |
## `cd <dirname>` ## {#cd} |
| 438 |
|
| 439 |
Change the current working directory, like the Unix counterpart. |
| 440 |
The argument is necessary. No kind of expansion or substitution is done. |
| 441 |
|
| 442 |
Related: [`ls`](#ls), [`pwd`](#pwd) |
| 443 |
|
| 444 |
## `ceq [ <label-exp> ] <term> = <term> if <boolterm> .` ## {#ceq} |
| 445 |
|
| 446 |
Defines a conditional equation. Spaces around the `if` are obligatory. |
| 447 |
`<boolterm>` needs to be a Boolean term. For other requirements |
| 448 |
see [`eq`](#eq). |
| 449 |
|
| 450 |
Related: [`bceq`](#bceq), [`beq`](#beq), [`eq`](#eq) |
| 451 |
|
| 452 |
## `check <options>` ## {#check} |
| 453 |
|
| 454 |
This command allows for checking of certain properties of modules and |
| 455 |
operators. |
| 456 |
|
| 457 |
`check regularity <mod_exp>` |
| 458 |
~ Checks whether the module given by the module expression |
| 459 |
`<mod_exp>` is regular. |
| 460 |
|
| 461 |
`check compatibility <mod_exp>` |
| 462 |
~ Checks whether term rewriting system of the module given by the |
| 463 |
module expression `<mod_exp>` is compatible, i.e., every |
| 464 |
application of every rewrite rule to every well-formed term |
| 465 |
results in a well-formed term. (This is not necessarily the case |
| 466 |
in order-sorted rewriting!) |
| 467 |
|
| 468 |
`check laziness <op_name>` |
| 469 |
~ Checks whether the given operator can be evaluated lazily. If not |
| 470 |
`<op_name>` is given, all operators of the current module are |
| 471 |
checked. |
| 472 |
|
| 473 |
Related: [`regularize`](#regularize) |
| 474 |
|
| 475 |
## `check <something>` switch ## {#switch-check} |
| 476 |
|
| 477 |
These switches turn on automatic checking of certain properties: |
| 478 |
|
| 479 |
`check coherency` |
| 480 |
~ check whether transitions and equations are coherent |
| 481 |
|
| 482 |
`check compatibility` |
| 483 |
~ see the [`check`](#check) command |
| 484 |
|
| 485 |
`check import` |
| 486 |
~ check conflicting importing mode of submodules |
| 487 |
|
| 488 |
`check regularity` |
| 489 |
~ see the [`check`](#check) command |
| 490 |
|
| 491 |
`check sensible` |
| 492 |
~ check whether a signature is sensible |
| 493 |
|
| 494 |
## `choose <selection>` ## {#choose} |
| 495 |
|
| 496 |
Chooses a subterm by the given `<selection>`. See [`apply`](#apply) |
| 497 |
for details on `<selection>`. |
| 498 |
|
| 499 |
Related: [`strat` in operator attributes](#opattr), [`start`](#start), [`apply`](#apply) |
| 500 |
|
| 501 |
## CITP ## {#citp} |
| 502 |
|
| 503 |
Constructor Based Induction Theorem Prover |
| 504 |
|
| 505 |
The sub-system provides a certain level of automatization for theorem proving. |
| 506 |
|
| 507 |
Please see the accompanying manual for CITP for details. |
| 508 |
|
| 509 |
Related: [`:attr`](#target_not_found), [`:reset`](#citp-reset), [`:embed`](#citp-embed), [`:use`](#citp-use), [`:ord`](#citp-order), [`:imp`](#citp-imply), [`:def`](#citp-def), [`:ctf-`](#citp-ctf-), [`:ctf`](#citp-ctf), [`:csp-`](#citp-csp-), [`:csp`](#citp-csp), [`:red`](#citp-red), [`:select`](#citp-select), [`:backward`](#citp-backward), [`:rule`](#citp-rule), [`:equation`](#citp-equation), [`:cp`](#citp-cp), [`:init`](#citp-init), [`:roll`](#citp-roll), [`:auto`](#citp-auto), [`:ind`](#citp-ind), [`:apply`](#citp-apply), [`:goal`](#citp-goal) |
| 510 |
|
| 511 |
## `clause <term> .` ## {#clause} |
| 512 |
|
| 513 |
(pignose) |
| 514 |
|
| 515 |
## `clean memo` ## {#cleanmemo} |
| 516 |
|
| 517 |
Resets (clears) the memo storage of the system. Memorized computations |
| 518 |
are forgotten. |
| 519 |
|
| 520 |
Related: [clean memo switch](#switch-clean-memo) |
| 521 |
|
| 522 |
## `clean memo` switch ## {#switch-clean-memo} |
| 523 |
|
| 524 |
Possible values: `on`, `off`, default `off`. |
| 525 |
|
| 526 |
tells the system to be forgetful. |
| 527 |
|
| 528 |
## `close` ## {#close} |
| 529 |
|
| 530 |
This command closes a modification of a module started by [`open`](#open). |
| 531 |
|
| 532 |
Related: [`open`](#open) |
| 533 |
|
| 534 |
## `commands` ## {#comshelp} |
| 535 |
|
| 536 |
Print outs the list of main toplevel commands. |
| 537 |
|
| 538 |
## comments ## {#comments} |
| 539 |
|
| 540 |
The interpreter accepts the following strings as start of a comment |
| 541 |
that extends to the end of the line: `--`, `-->`, `**`, `**>`. |
| 542 |
|
| 543 |
The difference in the variants with `>` is that the comment is |
| 544 |
displayed when run through the interpreter. |
| 545 |
|
| 546 |
Related: [`--`](#starstar), [`**`](#starstar) |
| 547 |
|
| 548 |
## `cond limit` switch ## {#switch-cond-limit} |
| 549 |
|
| 550 |
Setting maximal number of evaluation of condition part |
| 551 |
of an axiom. This is useful for detecting a kind of inifinite loop |
| 552 |
of rewriting. |
| 553 |
|
| 554 |
## `cont` ## {#cont} |
| 555 |
|
| 556 |
In [step mode](#switch-step), continues the reduction until |
| 557 |
a [stop pattern](#switch-stop-pattern) has been found. |
| 558 |
|
| 559 |
## `:cp { "[" <label> "]" | "(" <sentence> . ")" } >< { "[" <label> "]" | "(" <sentence> .")" }` ## {#citp-cp} |
| 560 |
|
| 561 |
Computes the critical pair of the two given equations. |
| 562 |
Here either a label or a full equation can be used to specify the equations. |
| 563 |
|
| 564 |
Related: [`citp`](#citp) |
| 565 |
|
| 566 |
### Example ### |
| 567 |
|
| 568 |
|
| 569 |
~~~~~ |
| 570 |
:cp (ceq top(sq(S@Sys)) = I@Pid if pc(S@Sys,I@Pid) = cs .) |
| 571 |
>< |
| 572 |
(ceq top(sq(S@Sys)) = J@Pid if pc(S@Sys,J@Pid) = cs .) |
| 573 |
~~~~~ |
| 574 |
|
| 575 |
## `crule [ <label-exp> ] <term> => <term> if <term> .` ## {#crule} |
| 576 |
|
| 577 |
Synonym of [`ctrans`](#ctrans) |
| 578 |
|
| 579 |
Related: [`rule`](#rule), [`ctrans`](#ctrans) |
| 580 |
|
| 581 |
## `:csp { eq [ <label-exp>] <term> = <term> . ...}` ## {#citp-csp} |
| 582 |
|
| 583 |
Applies case splitting after a set of equations. Each of these |
| 584 |
equations creates one new sub-goal with the equation added. |
| 585 |
|
| 586 |
The system does not check whether given set of equations exhausts all |
| 587 |
possible values. |
| 588 |
|
| 589 |
Not discharged sub-goals will remain in the reduced form. |
| 590 |
|
| 591 |
Related: [`:csp-`](#citp-csp-), [`citp`](#citp) |
| 592 |
|
| 593 |
## `:csp- { eq [ <label-exp>] <term> = <term> . ...}` ## {#citp-csp-} |
| 594 |
|
| 595 |
Like [`:csp`](#citp-csp), but if sub-goals are not discharged, the |
| 596 |
CITP prover returns to the original state before the reduce action. |
| 597 |
|
| 598 |
Related: [`:csp`](#citp-csp), [`citp`](#citp) |
| 599 |
|
| 600 |
## `:ctf { eq [ <label-exp> ] <term> = <term> .}` ## {#citp-ctf} |
| 601 |
|
| 602 |
Applies case splitting after a set of boolean expressions. |
| 603 |
Not discharged sub-goals will remain in the reduced form. |
| 604 |
|
| 605 |
Related: [`:ctf-`](#citp-ctf-), [`citp`](#citp) |
| 606 |
|
| 607 |
## `:ctf- { eq [ <label-exp> ] <term> = <term> .}` ## {#citp-ctf-} |
| 608 |
|
| 609 |
Like [`:ctf`](#citp-ctf), but if sub-goals are not discharged, the |
| 610 |
CITP prover returns to the original state before the reduce action. |
| 611 |
|
| 612 |
Related: [`:ctf`](#citp-ctf), [`citp`](#citp) |
| 613 |
|
| 614 |
## `ctrans [ <label-exp> ] <term> => <term> if <term> .` ## {#ctrans} |
| 615 |
|
| 616 |
Defines a conditional transition. For details see [`trans`](#trans) |
| 617 |
and [`ceq`](#ceq). |
| 618 |
|
| 619 |
Related: [`bctrans`](#bctrans), [`btrans`](#btrans), [`trans`](#trans) |
| 620 |
|
| 621 |
## `db reset` ## {#db} |
| 622 |
|
| 623 |
(pignose) |
| 624 |
|
| 625 |
## `:def <symbol> = { <ctf> | <csp> | <init> }` ## {#citp-def} |
| 626 |
|
| 627 |
Assigns a name to a specific case splitting (`:ctf` or `:csp`) |
| 628 |
or induction `:ind`), |
| 629 |
so that it can be used as tactics in `:apply`. |
| 630 |
|
| 631 |
Related: [`citp`](#citp) |
| 632 |
|
| 633 |
### Example ### |
| 634 |
|
| 635 |
~~~~~ |
| 636 |
:def name-0 = :ind { :on (<Variable>...) :base <Term> . :step <Term> . } |
| 637 |
:def name-1 = :ctf [ <Term> . ] |
| 638 |
:def name-2 = :ctf-{ eq LHS = RHS . } |
| 639 |
:def name-3 = :csp { eq lhs1 = rhs1 . eq lhs2 = rhs2 . } |
| 640 |
:def name-4 = :csp-{ eq lhs3 = rhs3 . eq lhs4 = rhs4 . } |
| 641 |
:apply(name-0 TC name-1 name-2 name-3 name-4) |
| 642 |
~~~~~ |
| 643 |
|
| 644 |
## `demod` ## {#demod} |
| 645 |
|
| 646 |
(pignose) |
| 647 |
|
| 648 |
## `:describe proof` ## {#citp-describe} |
| 649 |
|
| 650 |
Describes the current proof in more detail. |
| 651 |
|
| 652 |
Related: [`:show`](#citp-show), [`citp`](#citp) |
| 653 |
|
| 654 |
### Example ### |
| 655 |
|
| 656 |
|
| 657 |
~~~~~ |
| 658 |
PNAT> :describe proof |
| 659 |
==> root* |
| 660 |
-- context module: #Goal-root |
| 661 |
-- targeted sentences: |
| 662 |
eq [lemma-1]: M:PNat + 0 = M . |
| 663 |
eq [lemma-2]: M:PNat + s N:PNat = s (M + N) . |
| 664 |
[si] 1* |
| 665 |
-- context module: #Goal-1 |
| 666 |
-- targeted sentences: |
| 667 |
eq [lemma-1]: 0 + 0 = 0 . |
| 668 |
eq [lemma-2]: 0 + s N:PNat = s (0 + N) . |
| 669 |
... |
| 670 |
~~~~~ |
| 671 |
|
| 672 |
## `describe <something>` ## {#describe} |
| 673 |
|
| 674 |
Similar to the `show` command but with more details. Call `describe ?` for |
| 675 |
the possible set of invocations. |
| 676 |
|
| 677 |
Related: [`show`](#show) |
| 678 |
|
| 679 |
## `dirs` ## {#dirs} |
| 680 |
|
| 681 |
Displays the current push stack. |
| 682 |
|
| 683 |
Related: [`popd`](#popd), [`pwd`](#pwd), [`pushd`](#pushd), [`cd`](#cd), [`ls`](#ls) |
| 684 |
|
| 685 |
## `dribble { <file-name> | .}` ## {#dribble} |
| 686 |
|
| 687 |
If <file-name> is give, the evaluation process of the system is |
| 688 |
output to the <file-name> in internal form. '.' stops the recording. |
| 689 |
Only usefule for developer of the system. |
| 690 |
|
| 691 |
## `:embed (<label> ... <label>) as <module_name>` ## {#citp-embed} |
| 692 |
|
| 693 |
Incorporate proved goals into the module specified by <module_name> |
| 694 |
which will import the current proof context module. |
| 695 |
|
| 696 |
## `eof` ## {#eof} |
| 697 |
|
| 698 |
Terminates reading of the current file. Allows for keeping |
| 699 |
untested code or documentations below the `eof` mark. Has |
| 700 |
to be on a line by itself without leading spaces. |
| 701 |
|
| 702 |
## `eq [ <label-exp> ] <term> = <term> .` ## {#eq} |
| 703 |
|
| 704 |
Declares an axiom, or equation. |
| 705 |
|
| 706 |
Spaces around the `=` are necessary to separate the left from |
| 707 |
the right hand side. The terms given must belong to the |
| 708 |
same connected component in the graph defined by the sort ordering. |
| 709 |
|
| 710 |
In simple words, the objects determined by the terms must be |
| 711 |
interpretable as of the same sort. |
| 712 |
|
| 713 |
The optional part `<label-exp>` serves two purposes, one is to give |
| 714 |
an axiom an identifier, and one is to modify its behavior. The |
| 715 |
`<label-exp>` is of the form: |
| 716 |
|
| 717 |
` [ <modifier> <label> ] : ` |
| 718 |
|
| 719 |
Warning: The square brackets here are *not* specifying optional |
| 720 |
components, but syntactical elements. Thus, a labeled axiom |
| 721 |
can look like: |
| 722 |
|
| 723 |
`eq[foobar] : foo = bar .` |
| 724 |
|
| 725 |
The `<modifier>` part is used to change the rewriting behavior of |
| 726 |
the axiom. There are at the moment two possible |
| 727 |
modifiers, namely `:m-and (:m-and-also)` and `:m-or (:m-or-else)`. |
| 728 |
Both make sense only for operators where the arguments come from an |
| 729 |
associative sort. |
| 730 |
In this case both modifiers create all possible permutations |
| 731 |
of the arguments and rewrite the original term to the conjunction |
| 732 |
in case of `:m-and` or to the disjunction in case of `:m-or` of all |
| 733 |
the generated terms. |
| 734 |
|
| 735 |
Assume that `NatSet` is a sort with associative constructor modeling |
| 736 |
a set of natural number, and let |
| 737 |
|
| 738 |
````` |
| 739 |
pred p1: Nat . |
| 740 |
ops q1 q2 : NatSet -> Bool . |
| 741 |
eq [:m-and]: q1(N1:Nat NS:NatSet) = p1(N1) . |
| 742 |
eq [:m-or]: q2(N1:Nat NS:NatSet) = p1(N1) . |
| 743 |
````` |
| 744 |
|
| 745 |
In this case an expression like `q1(1 2 3)` would reduce to |
| 746 |
`p1(1) and p1(2) and p1(3)` (modulo AC), and `q2(1 2 3)` into |
| 747 |
the same term with `or` instead. |
| 748 |
|
| 749 |
Related: [`bceq`](#bceq), [`beq`](#beq), [`ceq`](#ceq) |
| 750 |
|
| 751 |
## `:equation` ## {#citp-equation} |
| 752 |
|
| 753 |
Adds the critical pair computed by the last [`:cp`](#citp-cp) command |
| 754 |
as equation to the current goal. |
| 755 |
|
| 756 |
Related: [`:rule`](#citp-rule), [`:cp`](#citp-cp), [`citp`](#citp) |
| 757 |
|
| 758 |
## `esc return` ## {#escape} |
| 759 |
|
| 760 |
In case that, after hitting `return` expecting some feed-back, |
| 761 |
no such feed-back whatsoever is returned, typing the `escape` key followed by the |
| 762 |
`return` key will make the interpreter discard the preceding input |
| 763 |
and make a fresh start. |
| 764 |
|
| 765 |
## `exec limit` switch ## {#switch-exec-limit} |
| 766 |
|
| 767 |
Possible values: integers, default limit 4611686018427387903. |
| 768 |
|
| 769 |
Controls the number of maximal transition steps. |
| 770 |
|
| 771 |
Related: [`reduce`](#reduce) |
| 772 |
|
| 773 |
## `exec trace` switch ## {#switch-exec-trace} |
| 774 |
|
| 775 |
Possible values: `on` `off, default `off`. |
| 776 |
|
| 777 |
controls whether further output is provided during reductions. |
| 778 |
|
| 779 |
Related: [`reduce`](#reduce) |
| 780 |
|
| 781 |
## `exec! [ in <mod-exp> : ] <term> .` ## {#execute-dash} |
| 782 |
|
| 783 |
Obsolete command. Implicitly invokes RWL search predicate in a |
| 784 |
specific manner. |
| 785 |
|
| 786 |
## `execute [ in <mod-exp> : ] <term> .` ## {#execute} |
| 787 |
|
| 788 |
Reduce the given term in the given module, if `<mod-exp>` is given, |
| 789 |
otherwise in the current module. |
| 790 |
|
| 791 |
For `execute` equations and transitions, possibly conditional, are taken |
| 792 |
into account for reduction. |
| 793 |
|
| 794 |
Related: [`reduce`](#reduce), [`breduce`](#breduce) |
| 795 |
|
| 796 |
## `extending ( <modexp> )` ## {#extending} |
| 797 |
|
| 798 |
Imports the object specified by `modexp` into the current |
| 799 |
module, allowing models to be inflated, but not collapsing. |
| 800 |
See [`module expression`](#moduleexpression) for format of `modexp`. |
| 801 |
|
| 802 |
Related: [`using`](#using), [`protecting`](#protecting), [`including`](#including) |
| 803 |
|
| 804 |
## `find {+rule | -rule}` ## {#find} |
| 805 |
|
| 806 |
Find all axioms which possibly rewrite the current term. |
| 807 |
|
| 808 |
## `find all rules` switch ## {#switch-find-all-rules} |
| 809 |
|
| 810 |
If this switch is on, the [`apply`](#apply) command |
| 811 |
will search for applicable rules not only in the set of |
| 812 |
user-defined equations, but also in those added by the system. |
| 813 |
|
| 814 |
## `flag(<name>, { on | off })` ## {#flag} |
| 815 |
|
| 816 |
(pignose) |
| 817 |
|
| 818 |
## `full reset` ## {#fullreset} |
| 819 |
|
| 820 |
Reinitializes the internal state of the system. All supplied modules |
| 821 |
definitions are lost. |
| 822 |
|
| 823 |
Related: [`prelude`](#prelude), [`reset`](#reset) |
| 824 |
|
| 825 |
## `gendoc <pathname>` ## {#gendoc} |
| 826 |
|
| 827 |
generates reference manual from system's on line help documents, |
| 828 |
and save it to `pathname`. |
| 829 |
|
| 830 |
## `:goal { <sentence> . ... }` ## {#citp-goal} |
| 831 |
|
| 832 |
Define the initial goal for CITP |
| 833 |
|
| 834 |
Related: [`citp`](#citp) |
| 835 |
|
| 836 |
### Example ### |
| 837 |
|
| 838 |
|
| 839 |
~~~~~ |
| 840 |
CafeOBJ> select PNAT . |
| 841 |
PNAT> :goal { |
| 842 |
eq [lemma-1]: M:PNat + 0 = M . |
| 843 |
eq [lemma-2]: M:PNat + s N:PNat = s( M + N ) . |
| 844 |
} |
| 845 |
~~~~~ |
| 846 |
|
| 847 |
## `goal <term> .` ## {#goal} |
| 848 |
|
| 849 |
(pignose) |
| 850 |
|
| 851 |
## `:imp "[" <label> "]" by "{" <variable> <- <term>; ..."}"` ## {#citp-imply} |
| 852 |
|
| 853 |
TODO (future extension) |
| 854 |
|
| 855 |
Related: [`citp`](#citp) |
| 856 |
|
| 857 |
## `imports { <import-decl> }` ## {#imports} |
| 858 |
|
| 859 |
Block enclosing import of other modules (`protecting` etc). |
| 860 |
Other statements are not allowed within the `imports` block. |
| 861 |
Optional structuring of the statements in a module. |
| 862 |
|
| 863 |
Related: [`using`](#using), [`protecting`](#protecting), [`including`](#including), [`extending`](#extending), [`axioms`](#axioms), [`signature`](#signature) |
| 864 |
|
| 865 |
## `include BOOL` switch ## {#switch-include-bool} |
| 866 |
|
| 867 |
Possible values: `on` `off`, default `on`. |
| 868 |
|
| 869 |
By default a couple of built-in modules are implicitly imported with |
| 870 |
protecting mode. In particular, BOOL is of practical importance. It |
| 871 |
defines Boolean operators. It is imported to admit conditional |
| 872 |
axioms. |
| 873 |
|
| 874 |
This switch allows to disable automatic inclusion of BOOL. |
| 875 |
|
| 876 |
## `include RWL` switch ## {#switch-include-rwl} |
| 877 |
|
| 878 |
Possible values: `on` `off`, default `off`. |
| 879 |
|
| 880 |
This switch allows to disable automatic inclusion of RWL. |
| 881 |
|
| 882 |
## `including ( <modexp> )` ## {#including} |
| 883 |
|
| 884 |
Imports the object specified by `modexp` into the current |
| 885 |
module. |
| 886 |
|
| 887 |
See [`module expression`](#moduleexpression) for format of `modexp`. |
| 888 |
|
| 889 |
Related: [module expression](#moduleexpression), [`using`](#using), [`protecting`](#protecting), [`extending`](#extending) |
| 890 |
|
| 891 |
## `:ind { on (<variable> ...) | |
| 892 |
'{' on (<variable> ...) |
| 893 |
base (<Term> . ... <Term> .) |
| 894 |
step (<Term> . ... <Term> .) |
| 895 |
'}'` ## {#citp-ind} |
| 896 |
|
| 897 |
':ind on (<variable> ...)' defines the variable for the induction tactic of CITP. |
| 898 |
':ind { ... }' defines induction variable(s) and base pattern and step pattern specified by <Term>s. |
| 899 |
|
| 900 |
Related: [`citp`](#citp) |
| 901 |
|
| 902 |
### Example ### |
| 903 |
|
| 904 |
|
| 905 |
~~~~~ |
| 906 |
:ind on (M:PNat) |
| 907 |
:ind { on (M:PNat) |
| 908 |
base (<Term> . ... <Term> .) |
| 909 |
step (<Term> . ... <Term> .) |
| 910 |
} |
| 911 |
~~~~~ |
| 912 |
|
| 913 |
## `init [as <name>] { "[" <label> "]" | "(" <sentence> "")} by "{" <variable> <- <term>; ... "}"` ## {#init} |
| 914 |
|
| 915 |
Instantiates an equation specified by `<label>` by replacing the `<variable>`s |
| 916 |
in the equation with the respective `<term>`s. The resulting equation is added |
| 917 |
to the set of axioms. |
| 918 |
If optional `as <name>` is given, label of the instantiated axiom is overwritten by <name>. |
| 919 |
|
| 920 |
Related: [`open`](#open) |
| 921 |
|
| 922 |
## `:init [as <name>] { "[" <label> "]" | "(" <sentence> "")} by "{" <variable> <- <term>; ... "}"` ## {#citp-init} |
| 923 |
|
| 924 |
Instantiates an equation specified by `<label>` by replacing the `<variable>`s |
| 925 |
in the equation with the respective `<term>`s. The resulting equation is added |
| 926 |
to the set of axioms. |
| 927 |
If optional `as <name>` is given, label of the instantiated axiom is overwritten by <name>. |
| 928 |
|
| 929 |
Related: [`citp`](#citp) |
| 930 |
|
| 931 |
## `input <pathname>` ## {#input} |
| 932 |
|
| 933 |
Requests the system to read the file specified by the |
| 934 |
pathname. The file itself may contain `input` commands. |
| 935 |
CafeOBJ reads the file up to the end, or until it encounters |
| 936 |
a line that only contains (the literal) `eof`. |
| 937 |
|
| 938 |
## `inspect <term>` ## {#inspect} |
| 939 |
|
| 940 |
Inspect the internal structure of `<term>`. |
| 941 |
|
| 942 |
## instantiation of parameterized modules ## {#instantiation} |
| 943 |
|
| 944 |
Parameterized modules allow for instantiation. The process of |
| 945 |
instantiation binds actual parameters to formal parameters. The result |
| 946 |
of an instantiation is a new module, obtained by replacing occurrences |
| 947 |
of parameter sorts and operators by their actual counterparts. If, as |
| 948 |
a result of instantiation, a module is imported twice, it is assumed |
| 949 |
to be imported once and shared throughout. |
| 950 |
|
| 951 |
Instantiation is done by |
| 952 |
|
| 953 |
`<module_name> ( <bindings> )` |
| 954 |
|
| 955 |
where `<module_name>` is the name of a parameterized module, and |
| 956 |
`<bindings>` is a comma-separated list of binding constructs. |
| 957 |
|
| 958 |
using declared views |
| 959 |
~ you may bind an already declared view to a parameter: |
| 960 |
|
| 961 |
`<parameter> <= <view_name>` |
| 962 |
|
| 963 |
If a module `M` has a parameter `X :: T` and a view `V` from `T` |
| 964 |
to `M'` is declared, `V` may be bound to `X`, with the effect that |
| 965 |
|
| 966 |
1. The sort and operator names of `T` that appear in the body |
| 967 |
of `M` are replaced by those in `M'`, in accordance with `V`, |
| 968 |
|
| 969 |
2. The common submodules of `M` and `M'` are shared. |
| 970 |
|
| 971 |
using ephemeral views |
| 972 |
~ In this case the view is declared and used at the same time. |
| 973 |
|
| 974 |
`<parameter> <= view to <mod_name> { <view_elements> }` |
| 975 |
|
| 976 |
See [`view`](#view) for details concerning `<view_elements>`. The |
| 977 |
`from` parameter in the `view` declaration is taken from |
| 978 |
`<parameter>`. |
| 979 |
|
| 980 |
|
| 981 |
To make notation more succinct, parameters can be identified also by |
| 982 |
position instead of names as in |
| 983 |
|
| 984 |
`<mod_name> ( <view_name>, <view_name> )` |
| 985 |
|
| 986 |
which would bind the `<view_name>`s to the respective parameters |
| 987 |
of the parameterized module `<mod_name>`. |
| 988 |
|
| 989 |
This can be combined with the ephemeral definition of a view like in |
| 990 |
the following example (assume `ILIST` has two parameters): |
| 991 |
|
| 992 |
~~~~~ |
| 993 |
module NAT-ILIST { |
| 994 |
protecting ( ILIST(SIMPLE-NAT { sort Elt -> Nat }, |
| 995 |
DATATYPE { sort Elt -> Data }) ) |
| 996 |
} |
| 997 |
~~~~~ |
| 998 |
|
| 999 |
## `:is` ## {#citp-is} |
| 1000 |
|
| 1001 |
Boolean expression: `A :is B` where `A` is a term and |
| 1002 |
`B` is a sort. Returns true if `A` is of sort `B`. |
| 1003 |
|
| 1004 |
## `let <identifier> = <term> .` ## {#let} |
| 1005 |
|
| 1006 |
Using `let` one can define aliases, or context variables. Bindings |
| 1007 |
are local to the current module. Variable defined with `let` can be |
| 1008 |
used in various commands like `reduce` and `parse`. |
| 1009 |
|
| 1010 |
Although `let` defined variable behave very similar to syntactic |
| 1011 |
shorthands, they are not. The right hand side `<term>` needs to |
| 1012 |
be a fully parsable expression. |
| 1013 |
|
| 1014 |
## `lex (<op>, ..., <op>)` ## {#lex} |
| 1015 |
|
| 1016 |
(pignose) |
| 1017 |
|
| 1018 |
## `libpath` switch ## {#switch-libpath} |
| 1019 |
|
| 1020 |
Possible values: list of strings. |
| 1021 |
|
| 1022 |
The switch `libpath` contains a list of directories where CafeOBJ |
| 1023 |
searches for include files. Addition and removal of directories can be |
| 1024 |
done with |
| 1025 |
|
| 1026 |
````` |
| 1027 |
set libpath + <path1>:<path2>:... |
| 1028 |
set libpath - <path1>:<path2>:... |
| 1029 |
````` |
| 1030 |
|
| 1031 |
or the full libpath reset by `set libpath <path1>:<path2>:...` |
| 1032 |
|
| 1033 |
The current directory has a privileged status: It is always searched |
| 1034 |
first and cannot be suppressed. |
| 1035 |
|
| 1036 |
## `lisp` ## {#lisp} |
| 1037 |
|
| 1038 |
Evaluates the following lisp expression. |
| 1039 |
|
| 1040 |
### Example ### |
| 1041 |
|
| 1042 |
````` |
| 1043 |
CafeOBJ> lisp (+ 4 5) |
| 1044 |
(+ 4 5) -> 9 |
| 1045 |
````` |
| 1046 |
|
| 1047 |
## `lispq` ## {#lispq} |
| 1048 |
|
| 1049 |
Evaluates the following lisp expression, but does not |
| 1050 |
display the result (q for quiet). |
| 1051 |
|
| 1052 |
## `list { axiom | sos | usable | flag | param | option | demod }` ## {#list} |
| 1053 |
|
| 1054 |
(pignose) |
| 1055 |
|
| 1056 |
## `look up <something>` ## {#lookup} |
| 1057 |
|
| 1058 |
displays the location (module) and further information |
| 1059 |
where `<something>` has been defined. |
| 1060 |
|
| 1061 |
### Example ### |
| 1062 |
|
| 1063 |
~~~~~ |
| 1064 |
open INT . |
| 1065 |
%INT> look up Nat . |
| 1066 |
|
| 1067 |
Nat |
| 1068 |
- sort declared in NAT-VALUE |
| 1069 |
- operator: |
| 1070 |
op Nat : -> SortId { constr prec: 0 } |
| 1071 |
-- declared in module NAT-VALUE |
| 1072 |
|
| 1073 |
%INT> |
| 1074 |
~~~~~ |
| 1075 |
|
| 1076 |
## `ls <pathname>` ## {#ls} |
| 1077 |
|
| 1078 |
lists the given `pathname`. Argument is obligatory. |
| 1079 |
|
| 1080 |
Related: [`pwd`](#pwd), [`cd`](#cd) |
| 1081 |
|
| 1082 |
## `make <mod_name> ( <mod_exp> )` ## {#make} |
| 1083 |
|
| 1084 |
This commands defines a new module `<mod_name>` by evaluating the |
| 1085 |
module expression `<mod_exp>`. |
| 1086 |
|
| 1087 |
Related: [`module expression`](#moduleexpression) |
| 1088 |
|
| 1089 |
## `match <term_spec> to <pattern> .` ## {#match} |
| 1090 |
|
| 1091 |
Matches the term denoted by `<term_spec>` to the |
| 1092 |
pattern. `<term_spec>` is either `top` or `term` for the term set by |
| 1093 |
the `start` command; `subterm` for the term selected by the `choose` |
| 1094 |
command; `it` has the same meaning as `subterm` if `choose` was used, |
| 1095 |
otherwise the same meaning as `top`, or a normal term expression. |
| 1096 |
|
| 1097 |
The given `<pattern>` is either `rules`, `-rules`, `+rules`, one of |
| 1098 |
these three prefixed by `all`, or a term. If one of the `rules` are |
| 1099 |
given, all the rules where the left side (for `+rules`), the right |
| 1100 |
side (for `-rules`), or any side (for `rules`) matches. If the `all` |
| 1101 |
(with separating space) is given all rules in the current context, |
| 1102 |
including those declared in built-in modules, are inspected. |
| 1103 |
|
| 1104 |
If a term is given, then the two terms are matched, and if successful, |
| 1105 |
the matching substitution is printed. |
| 1106 |
|
| 1107 |
## `memo` switch ## {#switch-memo} |
| 1108 |
|
| 1109 |
controls the memorization of computations. The system memorizes |
| 1110 |
evaluations of operators declared with the [`memo`](#opattr) operator |
| 1111 |
attribute. Turning this switch off disables all memorization. |
| 1112 |
|
| 1113 |
## `[sys:]module[!|*] <modname> [ ( <params> ) ] [ <principal_sort_spec> ] { mod_elements ... }` ## {#module} |
| 1114 |
|
| 1115 |
Defines a module, the basic building block of CafeOBJ. Possible elements |
| 1116 |
are declarations of |
| 1117 |
|
| 1118 |
- import - see `protecting`, `extending`, `including`, `using` |
| 1119 |
- sorts - see `sort declaration` |
| 1120 |
- variable - see `var` |
| 1121 |
- equation - see `op`, `eq`, `ceq`, `bop`, `beq`, `bceq` |
| 1122 |
- transition - see `trans`, `ctrans`, `btrans`, `bctrans` |
| 1123 |
|
| 1124 |
`modname` is an arbitrary string. |
| 1125 |
|
| 1126 |
`module*` introduces a loose semantic based module. |
| 1127 |
|
| 1128 |
`module!` introduces a strict semantic based module. |
| 1129 |
|
| 1130 |
`module` introduces a module without specified semantic type. |
| 1131 |
|
| 1132 |
If `params` are given, it is a parameterized module. |
| 1133 |
See [`parameterized module`](#parameterizedmodule) for more details. |
| 1134 |
|
| 1135 |
If `principal_sort_spec` is given, it has to be of the form |
| 1136 |
`principal-sort <sortname>` (or `p-sort <sortname>`). The principal |
| 1137 |
sort of the module is specified, which allows more concise `view`s from |
| 1138 |
single-sort modules as the sort mapping needs not be given. |
| 1139 |
|
| 1140 |
## `module expression` ## {#moduleexpression} |
| 1141 |
|
| 1142 |
In various syntax elements not only module names itself, but whole |
| 1143 |
module expressions can appear. A typical example is |
| 1144 |
|
| 1145 |
`open <mod_exp> .` |
| 1146 |
|
| 1147 |
which opens a module expression. The following constructs are |
| 1148 |
supported: |
| 1149 |
|
| 1150 |
module name |
| 1151 |
~ using the name of a module |
| 1152 |
|
| 1153 |
renaming |
| 1154 |
~ `<mod_exp> * { <mappings> }` |
| 1155 |
|
| 1156 |
This expressions describes a new module where sort and/or |
| 1157 |
operators are renamed. |
| 1158 |
`<mappings>` are like in the case of [`view`](#view) a comma |
| 1159 |
separated list of mappings of either sorts (`sort` and `hsort`) or |
| 1160 |
operators (`op` and `bop`). Source names may be qualified, while |
| 1161 |
target names are not, they are required to be new names. Renaming |
| 1162 |
is often used in combination with [instantiation](#instantiation). |
| 1163 |
|
| 1164 |
summation |
| 1165 |
~ `<mod_exp> + <mod_exp>` |
| 1166 |
|
| 1167 |
This expression describes a module consisting of all the module |
| 1168 |
elements of the summands. If a submodule is imported more than |
| 1169 |
once, it is assumed to be shared. |
| 1170 |
|
| 1171 |
## `names <mod-exp>` . ## {#names} |
| 1172 |
|
| 1173 |
List up all the named objects in module <mod-exp>. |
| 1174 |
|
| 1175 |
## `no autoload <module-name>` ## {#no-autoload} |
| 1176 |
|
| 1177 |
Stop `autoload` of module with the name <module-name> . |
| 1178 |
Please refer to `autoload` command. |
| 1179 |
|
| 1180 |
Related: [`autoload`](#autoload) |
| 1181 |
|
| 1182 |
## `:normalize { on | off}` ## {#citp-normalize} |
| 1183 |
|
| 1184 |
Normalize the LHS of an instance of the axiom generated by :init command. |
| 1185 |
|
| 1186 |
Related: [`citp`](#citp) |
| 1187 |
|
| 1188 |
## on-the-fly declarations ## {#onthefly} |
| 1189 |
|
| 1190 |
Variables and constants can be declared *on-the-fly* (or *inline*). If an |
| 1191 |
equation contains a qualified variable (see [qualified term](#qualified)), |
| 1192 |
i.e., `<name>:<sort-name>`, then from this point on *within* the current |
| 1193 |
equation only `<name>` is declared as a variable of sort `<sort-name>`. |
| 1194 |
|
| 1195 |
It is allowed to redeclare a previously defined variable name via |
| 1196 |
an on-the-fly declaration, but as mentioned above, not via an |
| 1197 |
explicit redeclaration. |
| 1198 |
|
| 1199 |
Using a predeclared variable name within an equation first as is, |
| 1200 |
that is as the predeclared variable, and later on in the same |
| 1201 |
equation with an on-the-fly declaration is forbidden. That is, under |
| 1202 |
the assumption that `A` has been declared beforehand, the following |
| 1203 |
equation is *not* valid: |
| 1204 |
|
| 1205 |
`eq foo(A, A:S) = A .` |
| 1206 |
|
| 1207 |
On-the-fly declaration of constants are done the same way, where the |
| 1208 |
`<name>` is a constant name as in ``a:Nat`. Using this construct is |
| 1209 |
similar to defining an operator |
| 1210 |
|
| 1211 |
`op <name> : -> <sort>` |
| 1212 |
|
| 1213 |
or in the above example, `op a : -> Nat .`, besides that the |
| 1214 |
on-the-fly declaration of constants, like to one of variables, is only |
| 1215 |
valid in the current context (i.e., term or axiom). These constant |
| 1216 |
definitions are quite common in proof scores. |
| 1217 |
|
| 1218 |
Related: [`var`](#var) |
| 1219 |
|
| 1220 |
## `op <op-spec> : <sorts> -> <sort> { <attribute-list> }` ## {#op} |
| 1221 |
|
| 1222 |
Defines an operator by its domain, co-domain, and the term construct. |
| 1223 |
`<sorts>` is a space separated list of sort names, `<sort>` is a |
| 1224 |
single sort name. |
| 1225 |
`<op-spec>` can be of the following forms: |
| 1226 |
|
| 1227 |
prefix-spec |
| 1228 |
~ the `<op-spec>` does not contain a literal `_`: |
| 1229 |
This defines a normal prefix operator with domain `<sorts>` and |
| 1230 |
co-domain `<sort>` |
| 1231 |
|
| 1232 |
Example: `op f : S T -> U` |
| 1233 |
mixfix-spec |
| 1234 |
~ the `<op-spec>` contains exactly as many literal `_` as there are |
| 1235 |
sort names in `<sorts>`: |
| 1236 |
This defines an arbitrary mixfix (including postfix) operator |
| 1237 |
where the arguments are inserted into the positions designated |
| 1238 |
by the underbars. |
| 1239 |
|
| 1240 |
Example: `op _+_ : S S -> S` |
| 1241 |
|
| 1242 |
For the description of `<attribute-list>` see the entry for |
| 1243 |
[operator attributes](#opattr). |
| 1244 |
|
| 1245 |
## `open <mod_exp> .` ## {#open} |
| 1246 |
|
| 1247 |
This command opens the module specified by the module expression |
| 1248 |
`<mod_exp>` and allows for declaration of new sorts, operators, etc. |
| 1249 |
|
| 1250 |
Related: [`select`](#select), [`module expression`](#moduleexpression), [`close`](#close) |
| 1251 |
|
| 1252 |
## `operator attributes` ## {#opattr} |
| 1253 |
|
| 1254 |
In the specification of an operator using the [`op`](#op) (and |
| 1255 |
related) keyword, attributes of the operator can be specified. |
| 1256 |
An `<attribute-list>` is a space-separate list of single |
| 1257 |
attribute definitions. Currently the following attributes are |
| 1258 |
supported |
| 1259 |
|
| 1260 |
`associative` |
| 1261 |
~ specifies an associative operator, alias `assoc` |
| 1262 |
|
| 1263 |
`commutative` |
| 1264 |
~ specifies a commutative operator, alias `comm` |
| 1265 |
|
| 1266 |
`itempotence` |
| 1267 |
~ specifies an idempotent operator, alias `idem` |
| 1268 |
|
| 1269 |
`id: <const>` |
| 1270 |
~ specifies that an identity of the operator exists and |
| 1271 |
that it is `<const>` |
| 1272 |
|
| 1273 |
`prec: <int>` |
| 1274 |
~ specifies the parsing precedence of the operator, an integer <int>. |
| 1275 |
Smaller precedence values designate stronger binding. See |
| 1276 |
[operator precedence](#opprec) for details of the predefined |
| 1277 |
operator precedence values. |
| 1278 |
|
| 1279 |
`l-assoc` and `r-assoc` |
| 1280 |
~ specifies that the operator is left-associative or |
| 1281 |
right-associative |
| 1282 |
|
| 1283 |
`constr` |
| 1284 |
~ specifies that the operator is a constructor of the coarity sort. |
| 1285 |
(not evaluated at the moment) |
| 1286 |
|
| 1287 |
|
| 1288 |
`strat: ( <int-list> )` |
| 1289 |
~ specifies the evaluation strategy. Each integer in the list refers |
| 1290 |
to an argument of the operator, where `0` refers to the whole term, |
| 1291 |
`1` for the first argument, etc. Evaluation proceeds in order of |
| 1292 |
the `<int-list>`. Example: |
| 1293 |
|
| 1294 |
`op if_then_else_fi : Bool Int Int -> Int { strat: (1 0) }` |
| 1295 |
|
| 1296 |
In this case the first argument (the Boolean term) is tried to |
| 1297 |
be evaluated, and depending on that either the second or third. |
| 1298 |
But if the first (Boolean) argument cannot be evaluated, |
| 1299 |
no evaluation in the subterms will appear. |
| 1300 |
|
| 1301 |
Using negative values allows for lazy evaluation of the corresponding |
| 1302 |
arguments. |
| 1303 |
|
| 1304 |
`memo` |
| 1305 |
~ tells the system to remember the results of evaluations where the |
| 1306 |
operator appeared. See [`memo` switch](#switch-memo) for details. |
| 1307 |
|
| 1308 |
Remarks: |
| 1309 |
|
| 1310 |
- Several operators of the same arity/coarity can be defined by |
| 1311 |
using `ops` instead of `op`: |
| 1312 |
|
| 1313 |
`ops f g : S -> S` |
| 1314 |
|
| 1315 |
For the case of mixfix operators the underbars have to be given |
| 1316 |
and the expression surrounded by parenthesis: |
| 1317 |
|
| 1318 |
`ops (_+_) (_*_) : S S -> S` |
| 1319 |
|
| 1320 |
- Spaces *can* be part of the operator name, thus an operator |
| 1321 |
definition of `op foo op : S -> S` is valid, but not advisable, |
| 1322 |
as parsing needs hints. |
| 1323 |
|
| 1324 |
- A single underbar cannot be an operator name. |
| 1325 |
|
| 1326 |
Related: [`bop`](#bop) |
| 1327 |
|
| 1328 |
## `operator precedence` ## {#opprec} |
| 1329 |
|
| 1330 |
CafeOBJ allows for complete freedom of syntax, in particular infix |
| 1331 |
operators and overloading. To correctly parse terms that are ambiguous, |
| 1332 |
all operators have precedence values. These values can be adjusted |
| 1333 |
manually during definition of the operator |
| 1334 |
(see [operator attributes](#opattr)). In absence of manual |
| 1335 |
specification of the operator precedence, the values are determined by |
| 1336 |
the following rules: |
| 1337 |
|
| 1338 |
- standard prefix operators, i.e., those of the form `op f : S1 .. Sk -> S`, |
| 1339 |
receive operator precedence value 0. |
| 1340 |
- unary operators, i.e., those of the form `op u_ : S1 -> S`, receive |
| 1341 |
precedence 15. |
| 1342 |
- mix-fix operators with first and last token being arguments, i.e., |
| 1343 |
those of the form `op _ arg-or-op _ : S1 .. Sk -> S`, receive |
| 1344 |
precedence 41. |
| 1345 |
- all other operators (constants, operators of the form `a _ b`, etc.) |
| 1346 |
receive precedence 0. |
| 1347 |
|
| 1348 |
Related: [operator attributes](#opattr) |
| 1349 |
|
| 1350 |
## `option { reset | = <name> }` ## {#option} |
| 1351 |
|
| 1352 |
(pignose) |
| 1353 |
|
| 1354 |
## `:order (<op>, ..., <op>)` ## {#citp-order} |
| 1355 |
|
| 1356 |
|
| 1357 |
|
| 1358 |
## `param(<name>, <value>)` ## {#param} |
| 1359 |
|
| 1360 |
(pignose) |
| 1361 |
|
| 1362 |
## `parameterized module` ## {#parameterizedmodule} |
| 1363 |
|
| 1364 |
A module with a parameter list (see `module`) is a parameterized module. |
| 1365 |
Parameters are given as a comma (`,`) separated list. Each parameter is |
| 1366 |
of the form `[ <import_mode> ] <param_name> :: <module_name>` |
| 1367 |
(spaces around `::` are obligatory). |
| 1368 |
|
| 1369 |
The parameter's module gives minimal requirements on the module |
| 1370 |
instantiation. |
| 1371 |
|
| 1372 |
Within the module declaration sorts and operators of the parameter |
| 1373 |
are qualified with `.<parameter_name>` as seen in the example below. |
| 1374 |
|
| 1375 |
Related: [qualified sort](#qualifiedother) |
| 1376 |
|
| 1377 |
### Example ### |
| 1378 |
|
| 1379 |
~~~~~ |
| 1380 |
mod* C { |
| 1381 |
[A] |
| 1382 |
op add : A A -> A . |
| 1383 |
} |
| 1384 |
mod! TWICE(X :: C) { |
| 1385 |
op twice : A.X -> A.X . |
| 1386 |
eq twice(E:A.X) = add.X(E,E) . |
| 1387 |
} |
| 1388 |
~~~~~ |
| 1389 |
|
| 1390 |
## `parse [ in <mod-exp> : ] <term> .` ## {#parse} |
| 1391 |
|
| 1392 |
Tries to parse the given term within the module specified by |
| 1393 |
the module expression `<mod-exp>`, or the current module if not given, |
| 1394 |
and returns the parsed and qualified term. |
| 1395 |
|
| 1396 |
In case of ambiguous terms, i.e., different possible parse trees, the |
| 1397 |
command will prompt for one of the trees. |
| 1398 |
|
| 1399 |
Related: [`qualified term`](#qualified) |
| 1400 |
|
| 1401 |
## `parse normalize` switch ## {#switch-parse-normalize} |
| 1402 |
|
| 1403 |
If this switch is 'on' (defalult is 'off'), terms with |
| 1404 |
associative operators are always parsed as right associative. |
| 1405 |
|
| 1406 |
## `popd` ## {#popd} |
| 1407 |
|
| 1408 |
Changes the current working directory to the last on on the push stack. |
| 1409 |
|
| 1410 |
Related: [`dirs`](#dirs), [`pwd`](#pwd), [`pushd`](#pushd), [`cd`](#cd), [`ls`](#ls) |
| 1411 |
|
| 1412 |
## `pred <op-spec> : <sorts>` ## {#pred} |
| 1413 |
|
| 1414 |
Short hand for `op <op-spec> : <sorts> -> Bool` defining a predicate. |
| 1415 |
|
| 1416 |
Related: [`bpred`](#bpred), [`op`](#op) |
| 1417 |
|
| 1418 |
## `prelude <file>` ## {#prelude} |
| 1419 |
|
| 1420 |
Loads the given `<file>` as prelude. That is, a call to |
| 1421 |
[`reset`](#reset) will reset the definitions made in this file. |
| 1422 |
|
| 1423 |
Related: [`full reset`](#fullreset), [`reset`](#reset) |
| 1424 |
|
| 1425 |
## `print depth` switch ## {#switch-print-depth} |
| 1426 |
|
| 1427 |
Possible values: natural numbers, default `unlimited`. |
| 1428 |
|
| 1429 |
Controls to which depth terms are printed. |
| 1430 |
|
| 1431 |
## `print mode` switch ## {#switch-print-mode} |
| 1432 |
|
| 1433 |
Possible values: `normal` `fancy` `tree` `s-expr` |
| 1434 |
|
| 1435 |
Selects one of the print modes. |
| 1436 |
|
| 1437 |
## `print trs` switch ## {#switch-print-trs} |
| 1438 |
|
| 1439 |
Possible values: `on` `off`, default `off` |
| 1440 |
|
| 1441 |
If set to `on`, print the rules used during reduction of |
| 1442 |
`=(_,_)=>+_if_suchThat_{_}`. |
| 1443 |
|
| 1444 |
Related: [`search predicates`](#searchpredicate) |
| 1445 |
|
| 1446 |
## `protect <module-name>` ## {#protect} |
| 1447 |
|
| 1448 |
Protect a module from being overwritten. |
| 1449 |
Some modules vital for the system are initially protected. |
| 1450 |
Can be reversed with `unprotect`. |
| 1451 |
|
| 1452 |
Related: [`unprotect`](#unprotect) |
| 1453 |
|
| 1454 |
## `protecting ( <modexp> )` ## {#protecting} |
| 1455 |
|
| 1456 |
Imports the object specified by `modexp` into the current |
| 1457 |
module, preserving all intended models as they are. |
| 1458 |
See [`module expression`](#moduleexpression) for format of `modexp`. |
| 1459 |
|
| 1460 |
Related: [`including`](#including), [`using`](#using), [`extending`](#extending) |
| 1461 |
|
| 1462 |
## `provide <feature>` ## {#provide} |
| 1463 |
|
| 1464 |
Discharges a feature requirement: once `provide`d, all the subsequent |
| 1465 |
`require`ments of a feature are assumed to have been fulfilled |
| 1466 |
already. |
| 1467 |
|
| 1468 |
Related: [`require`](#require) |
| 1469 |
|
| 1470 |
## `pushd <directory>` ## {#pushd} |
| 1471 |
|
| 1472 |
Changes the working directory to `<directory>`, and puts the |
| 1473 |
current directory onto the push stack. Going back can be done with `pop`. |
| 1474 |
|
| 1475 |
Related: [`dirs`](#dirs), [`pwd`](#pwd), [`popd`](#popd), [`cd`](#cd), [`ls`](#ls) |
| 1476 |
|
| 1477 |
## `pvar <var-name> : <sort-name>` ## {#pvar} |
| 1478 |
|
| 1479 |
(pignose) |
| 1480 |
|
| 1481 |
Related: [`vars`](#var), [`var`](#var) |
| 1482 |
|
| 1483 |
## `pwd` ## {#pwd} |
| 1484 |
|
| 1485 |
Prints the current working directory. |
| 1486 |
|
| 1487 |
Related: [`dirs`](#dirs), [`popd`](#popd), [`pushd`](#pushd), [`ls`](#ls), [`cd`](#cd) |
| 1488 |
|
| 1489 |
## qualified sort/operator/parameter ## {#qualifiedother} |
| 1490 |
|
| 1491 |
CafeOBJ allows for using the same name for different sorts, |
| 1492 |
operators, and parameters. One example is declaring the same sort in |
| 1493 |
different modules. In case it is necessary to qualify the sort, |
| 1494 |
operator, or parameter, the intended module name can be affixed after |
| 1495 |
a literal `.`: `<name>.<modname>` |
| 1496 |
|
| 1497 |
Example: In case the same sort `Nat` is declared in both the module |
| 1498 |
`SIMPLE-NAT` and `PANAT`, one can use `Nat.SIMPLE-NAT` to reference |
| 1499 |
the sort from the former module. |
| 1500 |
|
| 1501 |
Furthermore, a similar case can arise when operators of the same name |
| 1502 |
have been declared with different number of arguments. During operator |
| 1503 |
renaming (see [view](#view)) the need |
| 1504 |
for qualification of the number of parameters might arise. In this |
| 1505 |
case the number can be specified after an affixed `/`: |
| 1506 |
`<opname>/<argnr>` |
| 1507 |
|
| 1508 |
Related: [`qualified term`](#qualified), [`parameterized module`](#parameterizedmodule) |
| 1509 |
|
| 1510 |
## `qualified term` ## {#qualified} |
| 1511 |
|
| 1512 |
In case that a term can be parsed into different sort, it is possible to |
| 1513 |
qualify the term to one of the possible sorts by affixing it with |
| 1514 |
`: <sort-name>` (spaces before and after the `:` are optional). |
| 1515 |
|
| 1516 |
Related: [`parse`](#parse) |
| 1517 |
|
| 1518 |
### Example ### |
| 1519 |
|
| 1520 |
`(1):NzNat` `(2):Nat` |
| 1521 |
|
| 1522 |
## `quiet` switch ## {#switch-quiet} |
| 1523 |
|
| 1524 |
Possible values: `on` `off`, default `off` |
| 1525 |
|
| 1526 |
If set to `on`, the system only issues error messages. |
| 1527 |
|
| 1528 |
Related: [`verbose`](#switch-verbose) |
| 1529 |
|
| 1530 |
## `quit` ## {#quit} |
| 1531 |
|
| 1532 |
Leaves the CafeOBJ interpreter. |
| 1533 |
|
| 1534 |
## `{ :red | :exec | :bred } [in <goal-name> :] <term> .` ## {#citp-red} |
| 1535 |
|
| 1536 |
reduce the term in specified goal <goal-name>. |
| 1537 |
|
| 1538 |
Related: [`citp`](#citp) |
| 1539 |
|
| 1540 |
## `reduce [ in <mod-exp> : ] <term> .` ## {#reduce} |
| 1541 |
|
| 1542 |
Reduce the given term in the given module, if `<mod-exp>` is given, |
| 1543 |
otherwise in the current module. |
| 1544 |
|
| 1545 |
For `reduce` only equations and conditional equations are taken into |
| 1546 |
account for reduction. |
| 1547 |
|
| 1548 |
Related: [`breduce`](#breduce), [`execute`](#execute) |
| 1549 |
|
| 1550 |
## `reduce conditions` switch ## {#switch-reduce-conditions} |
| 1551 |
|
| 1552 |
Possible values: `on` `off`, default `off`. |
| 1553 |
|
| 1554 |
When using [`apply`](#apply) to step through a reduction, this switch |
| 1555 |
allows to turn on automatic reduction of conditions in conditional |
| 1556 |
equations. |
| 1557 |
|
| 1558 |
Related: [`apply`](#apply) |
| 1559 |
|
| 1560 |
## `regularize <mod-name>` ## {#regularize} |
| 1561 |
|
| 1562 |
Regularizes the signature of the given module, ensuring that every |
| 1563 |
term has exactly one minimal parse tree. In this process additional |
| 1564 |
sorts are generated to ensure unique least sort of all terms. |
| 1565 |
|
| 1566 |
Modules can be automatically regularized by the interpreter if the |
| 1567 |
`regularize signature` switch is turn to `on`. |
| 1568 |
|
| 1569 |
## `regularize signature` switch ## {#switch-regularize-signature} |
| 1570 |
|
| 1571 |
See [`regularize](#regularize) |
| 1572 |
|
| 1573 |
## `require <feature> [ <pathname> ]` ## {#require} |
| 1574 |
|
| 1575 |
Requires a feature, which usually |
| 1576 |
denotes a set of module definitions. Given this command, the |
| 1577 |
system searches for a file named the feature, and read the file |
| 1578 |
if found. If the `<feature>` contains `::`, they are treated as |
| 1579 |
path separators. |
| 1580 |
|
| 1581 |
If a pathname is given, the system searches for a file |
| 1582 |
named the pathname instead. |
| 1583 |
|
| 1584 |
|
| 1585 |
Related: [`provide`](#provide) |
| 1586 |
|
| 1587 |
### Example ### |
| 1588 |
|
| 1589 |
|
| 1590 |
~~~~~ |
| 1591 |
CafeOBJ> require foo::bar |
| 1592 |
~~~~~ |
| 1593 |
would search for `foo/bar.cafe` in the pathes from `libpath` |
| 1594 |
|
| 1595 |
## `:reset` ## {#citp-reset} |
| 1596 |
|
| 1597 |
Discard the current proof session. |
| 1598 |
|
| 1599 |
## `reset` ## {#reset} |
| 1600 |
|
| 1601 |
Restores the definitions of built-in modules and preludes, but does not |
| 1602 |
affect other modules. |
| 1603 |
|
| 1604 |
Related: [`prelude`](#prelude), [`full reset`](#fullreset) |
| 1605 |
|
| 1606 |
## `resolve {. | <file-path> }` ## {#resolve} |
| 1607 |
|
| 1608 |
(pignose) |
| 1609 |
|
| 1610 |
## `restore <pathname>` ## {#restore} |
| 1611 |
|
| 1612 |
Restores module definitions from the designated file `pathname` which |
| 1613 |
has been saved with the `save` command. `input` can also be used but |
| 1614 |
the effects might be different. |
| 1615 |
|
| 1616 |
TODO -- should we keep the different effects? What is the real difference? |
| 1617 |
|
| 1618 |
|
| 1619 |
Related: [`save-system`](#target_not_found), [`save`](#save), [`input`](#input) |
| 1620 |
|
| 1621 |
## `rewrite limit` switch ## {#switch-rewrite} |
| 1622 |
|
| 1623 |
Possible values: positive integers, default not specified. |
| 1624 |
|
| 1625 |
Allows limiting the number of rewrite steps during a step-wise |
| 1626 |
execution. |
| 1627 |
|
| 1628 |
Related: [`step switch`](#switch-step) |
| 1629 |
|
| 1630 |
## `:roll back` ## {#citp-roll} |
| 1631 |
|
| 1632 |
Reverts the strategy that led to the current target goal. |
| 1633 |
The current target goal is removed from the proof tree. |
| 1634 |
|
| 1635 |
Related: [`citp`](#citp) |
| 1636 |
|
| 1637 |
## `:rule` ## {#citp-rule} |
| 1638 |
|
| 1639 |
Adds the critical pair computed by the last [`:cp`](#citp-cp) command |
| 1640 |
as rule to the current goal. |
| 1641 |
|
| 1642 |
Related: [`:equation`](#citp-equation), [`:cp`](#citp-cp), [`citp`](#citp) |
| 1643 |
|
| 1644 |
## `rule [ <label-exp> ] <term> => <term> .` ## {#rule} |
| 1645 |
|
| 1646 |
Synonym of [`trans`](#trans). |
| 1647 |
|
| 1648 |
Related: [`trans`](#trans) |
| 1649 |
|
| 1650 |
## `save <pathname>` ## {#save} |
| 1651 |
|
| 1652 |
Saves module definitions into the designated file `pathname`. |
| 1653 |
File names should be suffixed with `.bin`. |
| 1654 |
|
| 1655 |
`save` also saves the contents of prelude files as well as module definitions |
| 1656 |
given in the current session. |
| 1657 |
|
| 1658 |
|
| 1659 |
Related: [`save-system`](#target_not_found), [`restore`](#restore), [`input`](#input) |
| 1660 |
|
| 1661 |
## `save-option <name>` ## {#save-option} |
| 1662 |
|
| 1663 |
(pignose) |
| 1664 |
|
| 1665 |
## `scase (<term>) in (<mod-exp>) as <name> { <decl> ..} : <term> .` ## {#scase} |
| 1666 |
|
| 1667 |
Obsolete citp command. Split the goal by user specified cases. |
| 1668 |
|
| 1669 |
## `search predicates` ## {#searchpredicate} |
| 1670 |
|
| 1671 |
CafeOBJ provides a whole set of search predicates, that searches |
| 1672 |
the reachable states starting from a given state, optionally checking |
| 1673 |
additional conditions. All of them based on the following three basic ones: |
| 1674 |
|
| 1675 |
- `S =(n,m)=>* SS [if Pred]` search states reachable by 0 or more transitions; |
| 1676 |
- `S =(n,m)=>+ SS [if Pred]` search states reachable by 1 or more transitions; |
| 1677 |
- `S =(n,m)=>! SS [if Pred]` search states reachable by 0 or more transitions, and |
| 1678 |
require that the reached state is a final state, i.e., no further |
| 1679 |
transitions can be applied. |
| 1680 |
|
| 1681 |
To allow for conditional transitions, a transition is only considered |
| 1682 |
in the search if `Pred` holds. |
| 1683 |
|
| 1684 |
The parameters `n` and `m` in these search predicates: |
| 1685 |
|
| 1686 |
- `n`, a natural number or `*`, gives the maximal number of solutions |
| 1687 |
to be searched. If `*` is given all solutions are searched |
| 1688 |
exhaustively. |
| 1689 |
- `m`, a natural number but not `*`, gives the maximal depth up to |
| 1690 |
which search is performed. |
| 1691 |
|
| 1692 |
The predicates return true if there is a (chain of) transitions |
| 1693 |
that fits the parameters (`n`,`m`, and `*`, `+`, `!`) and connects `S` |
| 1694 |
with `SS`. |
| 1695 |
|
| 1696 |
There are two orthogonal extension to this search predicate, one |
| 1697 |
adds a `suchThat` clause, one adds a `withStateEq` clause. |
| 1698 |
|
| 1699 |
`S =(n,m)=>* SS [if Pred1] suchThat Pred2` |
| 1700 |
~ (and similar for `!` and `+`) In this case not only the existence, |
| 1701 |
of a transition sequence is tested, but also whether the predicate |
| 1702 |
`Pred2`, which normally takes `S` and `SS` as arguments, holds. |
| 1703 |
|
| 1704 |
`S =(n,m)=>* SS [if Pred1] withStateEq Pred2` |
| 1705 |
~ (and similar for `!` and `+`) `Pred2` is used to determine whether |
| 1706 |
a search continues at `SS` or not, by comparing `SS` with all |
| 1707 |
states that have been traversed in the current search. If the |
| 1708 |
predicate `Pred2` returns true on the combination of `SS` as |
| 1709 |
first argument, and any of the previously visited states as |
| 1710 |
second argument, then the search is *not* continued after `SS`. |
| 1711 |
(This is a kind of loop detection.) |
| 1712 |
|
| 1713 |
These two cases can also be combined into |
| 1714 |
|
| 1715 |
`S =(n,m)=>* SS [if Pred1] suchThat Pred2 withStateEq Pred3` |
| 1716 |
|
| 1717 |
## `:select <goal-name>` ## {#citp-select} |
| 1718 |
|
| 1719 |
Select a goal for further application of tactics. |
| 1720 |
|
| 1721 |
Related: [`citp`](#citp) |
| 1722 |
|
| 1723 |
## `select <mod_exp> . ` ## {#select} |
| 1724 |
|
| 1725 |
Selects a module given by the module expression `<mod_exp>` as the |
| 1726 |
current module. All further operations are carried out within the |
| 1727 |
given module. In contrast to `open` this does not allow for |
| 1728 |
modification of the module, e.g., addition of new sorts etc. |
| 1729 |
|
| 1730 |
Related: [`module expression`](#moduleexpression), [`open`](#open) |
| 1731 |
|
| 1732 |
## `:set(<name>, { on | off | show })` ## {#citp-set} |
| 1733 |
|
| 1734 |
Set or show various flags of CITP CafeOBJ. |
| 1735 |
|
| 1736 |
Related: [`citp`](#citp) |
| 1737 |
|
| 1738 |
## `set <name> [option] <value>` ## {#set} |
| 1739 |
|
| 1740 |
Depending on the type of the switch, options and value specification varies. |
| 1741 |
Possible value types for switches are Boolean (`on`, `off`), string (`"value"`), |
| 1742 |
integers (5434443), lists (lisp syntax). |
| 1743 |
|
| 1744 |
For a list of all available switches, use `set ?`. To see the current |
| 1745 |
values, use `show switches`. To single out two general purpose switches, |
| 1746 |
`verbose` and `quiet` tell the system to behave in the respective way. |
| 1747 |
|
| 1748 |
Related: [`switches`](#switches), [`show`](#show) |
| 1749 |
|
| 1750 |
## `:show goal|unproved|proof|discharged` ## {#citp-show} |
| 1751 |
|
| 1752 |
Shows the current goal, the up-to-now unproven (sub-)goals, and the current proof. |
| 1753 |
|
| 1754 |
Related: [`:describe`](#citp-describe), [`citp`](#citp) |
| 1755 |
|
| 1756 |
### Example ### |
| 1757 |
|
| 1758 |
|
| 1759 |
~~~~~ |
| 1760 |
PNAT> :show proof |
| 1761 |
root* |
| 1762 |
[si] 1* |
| 1763 |
[ca] 1-1* |
| 1764 |
[ca] 1-2* |
| 1765 |
[tc] 1-2-1* |
| 1766 |
[si] 2* |
| 1767 |
[ca] 2-1* |
| 1768 |
[ca] 2-2* |
| 1769 |
[tc] 2-2-1* |
| 1770 |
PNAT> |
| 1771 |
~~~~~ |
| 1772 |
|
| 1773 |
## `show <something>` ## {#show} |
| 1774 |
|
| 1775 |
The `show` command provides various ways to inspect all kind of objects |
| 1776 |
of the CafeOBJ language. For a full list call `show ?`. |
| 1777 |
|
| 1778 |
Some of the more important (but far from complete list) ways to call |
| 1779 |
the `show` command are: |
| 1780 |
|
| 1781 |
- `show [ <modexp> ]` - describes the current modules of the one specified |
| 1782 |
as argument |
| 1783 |
- `show module tree [ <modexp> ]` - displays submodules of <modexp> in tree format |
| 1784 |
- `show switches` - lists all possible switches |
| 1785 |
- `show term [ tree ]` - displays a term, possible in tree format |
| 1786 |
|
| 1787 |
See the entry for [`switches`](#switches) for a full list. |
| 1788 |
|
| 1789 |
Related: [`describe`](#describe), [`switches`](#switches) |
| 1790 |
|
| 1791 |
## `show mode` switch ## {#switch-show-mode} |
| 1792 |
|
| 1793 |
Possible values for `set show mode <mode>` are `cafeobj` and `meta`. |
| 1794 |
|
| 1795 |
## `sigmatch (<mod-exp>) to (<mod-exp>)` ## {#sigmatch} |
| 1796 |
|
| 1797 |
(pignose) |
| 1798 |
|
| 1799 |
## `signature { <sig-decl> }` ## {#signature} |
| 1800 |
|
| 1801 |
Block enclosing declarations of sorts and operators. |
| 1802 |
Other statements are not allowed within the `signature` block. |
| 1803 |
Optional structuring of the statements in a module. |
| 1804 |
|
| 1805 |
Related: [`op`](#op), [`sort`](#sort), [`imports`](#imports), [`axioms`](#axioms) |
| 1806 |
|
| 1807 |
## sort declaration ## {#sort} |
| 1808 |
|
| 1809 |
CafeOBJ supports two kind of sorts, visible and hidden sorts. Visible |
| 1810 |
sorts are introduced between `[` and `]`, while hidden sorts are introduced |
| 1811 |
between `*[` and `]*`. |
| 1812 |
|
| 1813 |
~~~~ |
| 1814 |
[ Nat ] |
| 1815 |
*[ Obs ]* |
| 1816 |
~~~~ |
| 1817 |
|
| 1818 |
Several sorts can be declared at the same time, as in `[ Nat Int ]`. |
| 1819 |
|
| 1820 |
Since CafeOBJ is based on order sorting, sorts can form a partial order. |
| 1821 |
Definition of the partial order can be interleaved by giving |
| 1822 |
|
| 1823 |
~~~~ |
| 1824 |
[ <sorts> < <sorts> ] |
| 1825 |
~~~~ |
| 1826 |
|
| 1827 |
Where `sorts` is a list of sort names. This declaration defines an inclusion |
| 1828 |
relation between each pair or left and right sorts. |
| 1829 |
|
| 1830 |
### Example ### |
| 1831 |
|
| 1832 |
~~~~ |
| 1833 |
[ A B , C D < A < E, B < D ] |
| 1834 |
~~~~ |
| 1835 |
|
| 1836 |
defines five sorts `A`,...,`E`, with the following relations: |
| 1837 |
`C < A`, `D < A`, `A < E`, `B < D`. |
| 1838 |
|
| 1839 |
## `sos { = | + | - } { <clause> , ... }` ## {#sos} |
| 1840 |
|
| 1841 |
(pignose) |
| 1842 |
|
| 1843 |
## `:spoiler { on | off}` ## {#citp-spoiler} |
| 1844 |
|
| 1845 |
If the spoiler flag is on, after a strategy other than RD and SI |
| 1846 |
has been applied, the generated sub-goals are automatically checked for |
| 1847 |
provability using the RD strategy. Defaults to `off`. |
| 1848 |
|
| 1849 |
Related: [`citp`](#citp) |
| 1850 |
|
| 1851 |
## `start <term> .` ## {#start} |
| 1852 |
|
| 1853 |
Sets the focus onto the given term `<term>` of the currently opened |
| 1854 |
module or context. Commands like `apply`, `choose`, or `match` will |
| 1855 |
then operate on this term. |
| 1856 |
|
| 1857 |
Related: [`match`](#match), [`choose`](#choose), [`apply`](#apply) |
| 1858 |
|
| 1859 |
## `statistics` switch ## {#switch-statistics} |
| 1860 |
|
| 1861 |
Possible values: `on` `off`, default `on`. |
| 1862 |
|
| 1863 |
After each reduction details about the reduction are |
| 1864 |
shown. Information shown are the time for parsing the expression, the |
| 1865 |
number of rewrites and run time during rewriting, and the number of |
| 1866 |
total matches performed during the reduce. |
| 1867 |
|
| 1868 |
## `step` switch ## {#switch-step} |
| 1869 |
|
| 1870 |
Possible values: `on` `off`, default `off`. |
| 1871 |
|
| 1872 |
With this switch turned on, rewriting proceeds in steps and prompts |
| 1873 |
the user interactively. At each prompt the following commands can be |
| 1874 |
given to the stepper (with our without leading colon `:`): |
| 1875 |
|
| 1876 |
`help` |
| 1877 |
: (`h`, `?`) print out help page |
| 1878 |
`next` |
| 1879 |
: (`n`) go one step |
| 1880 |
`continue` |
| 1881 |
: (`c`) continue rewriting without stepping |
| 1882 |
`quit` |
| 1883 |
: (`q`) leave stepper continuing rewrite |
| 1884 |
`abort` |
| 1885 |
: (`a`) abort rewriting |
| 1886 |
`rule` |
| 1887 |
: (`r`) print out current rewrite rule |
| 1888 |
`subst` |
| 1889 |
: (`s`) print out substitution |
| 1890 |
`limit` |
| 1891 |
: (`l`) print out rewrite limit count |
| 1892 |
`pattern` |
| 1893 |
: (`p`) print out stop pattern |
| 1894 |
`stop [<term>] .` |
| 1895 |
: set (or unset) stop pattern |
| 1896 |
`rwt [<number>] .` |
| 1897 |
: set (or unset) max number of rewrite |
| 1898 |
|
| 1899 |
Other standard CafeOBJ commands that can be used are [`show`](#show), |
| 1900 |
[`describe`](#describe), [`dirs`](#dirs), [`set`](#set), [`cd`](#cd), |
| 1901 |
[`ls`](#ls), [`pwd`](#pwd), [`pushd`](#pushd), [`popd`](#popd), |
| 1902 |
[`lisp`](#lisp), [`lispq`](#lisp), and (on Unix only) |
| 1903 |
[`!`](#commandexec). |
| 1904 |
|
| 1905 |
## `stop` ## {#stop} |
| 1906 |
|
| 1907 |
Equivalent to [`stop pattern switch`](#switch-stop-pattern) |
| 1908 |
|
| 1909 |
## `stop pattern` switch ## {#switch-stop-pattern} |
| 1910 |
|
| 1911 |
In [step mode](#switch-step), this command causes reductions to stop when the reductants get to |
| 1912 |
containing subterms that match the given term. If no term is given, |
| 1913 |
this restriction is lifted. |
| 1914 |
|
| 1915 |
Related: [`step switch`](#switch-step) |
| 1916 |
|
| 1917 |
### Example ### |
| 1918 |
|
| 1919 |
|
| 1920 |
~~~~~ |
| 1921 |
CafeOBJ> open NAT . |
| 1922 |
%NAT> set step on . |
| 1923 |
%NAT> set stop pattern s 2 . |
| 1924 |
%NAT> red s s s s s s s s s 0 . |
| 1925 |
>> target: (s 0) |
| 1926 |
STEP[1]? c |
| 1927 |
>> term matches to stop pattern: (s 2) |
| 1928 |
<< will stop rewriting |
| 1929 |
>> stop because matches stop pattern. |
| 1930 |
>> target: (s 2) |
| 1931 |
STEP[3]? c |
| 1932 |
(9):NzNat |
| 1933 |
~~~~~ |
| 1934 |
|
| 1935 |
## switches ## {#switches} |
| 1936 |
|
| 1937 |
Switches control various aspects of the computations and behavior |
| 1938 |
of CafeOBJ. The current list of switches and their values can be |
| 1939 |
shown with |
| 1940 |
|
| 1941 |
````` |
| 1942 |
show switches |
| 1943 |
````` |
| 1944 |
|
| 1945 |
The single switches are described separately in this manual. |
| 1946 |
|
| 1947 |
Related: [`show`](#show), [`set`](#set) |
| 1948 |
|
| 1949 |
## `:theory <op_name> : <arity> -> <coarity> { assoc | comm | id: <term> }` ## {#citp-theory} |
| 1950 |
|
| 1951 |
Adds operator theory 'associativity', 'commutativity', and/or 'identity' to |
| 1952 |
an operator specfied by '<op_name> : <arity> -> <coarity> . |
| 1953 |
|
| 1954 |
## `trace [whole]` switch ## {#switch-trace} |
| 1955 |
|
| 1956 |
During evaluation, it is sometimes desirable to see the rewrite |
| 1957 |
sequences, not just the results. Setting the switch `trace whole` will |
| 1958 |
result in the resultant term of each rewrite step being |
| 1959 |
printed. Setting the switch `trace` will result in the display of |
| 1960 |
which rule, substitution, and replacement are used. |
| 1961 |
|
| 1962 |
## `trans [ <label-exp> ] <term> => <term> .` ## {#trans} |
| 1963 |
|
| 1964 |
Defines a transition, which is like an equation but without |
| 1965 |
symmetry. |
| 1966 |
|
| 1967 |
See [`eq`](#eq) for specification of requirements on `<label-exp>` |
| 1968 |
and the terms. |
| 1969 |
|
| 1970 |
Transitions and equations server similar, but different purpose. In |
| 1971 |
particular, reductions (both with or without behavior axioms used) do |
| 1972 |
not take transitions into account. Only [`exec`](#execute) also uses |
| 1973 |
transitions. On the other hand, the built-in |
| 1974 |
[search predicate](#searchpredicate) searches all possible transitions |
| 1975 |
from a given term. |
| 1976 |
|
| 1977 |
## `unprotect <module-name>` ## {#unprotect} |
| 1978 |
|
| 1979 |
Remove overwrite protection from a module that has been protected |
| 1980 |
with the `protect` call. Some modules vital for the system |
| 1981 |
are initially protected. |
| 1982 |
|
| 1983 |
Related: [`protect`](#protect) |
| 1984 |
|
| 1985 |
## `:use (<label> ... <label>)` ## {#citp-use} |
| 1986 |
|
| 1987 |
Incorporate discharged goal sentences as new axioms. |
| 1988 |
|
| 1989 |
## `using ( <modexp> )` ## {#using} |
| 1990 |
|
| 1991 |
Imports the object specified by `modexp` into the current |
| 1992 |
module without any restrictions on the models. |
| 1993 |
See [`module expression`](#moduleexpression) for format of `modexp`. |
| 1994 |
|
| 1995 |
Related: [`protecting`](#protecting), [`including`](#including), [`extending`](#extending) |
| 1996 |
|
| 1997 |
## `var <var-name> : <sort-name>` ## {#var} |
| 1998 |
|
| 1999 |
Declares a variable `<var-name>` to be of sort `<sort-name>`. |
| 2000 |
The scope of the variable is the current module. |
| 2001 |
Redeclarations of variable names are not allowed. |
| 2002 |
Several variable of the same sort can be declared at the same time |
| 2003 |
using the `vars` construct: |
| 2004 |
|
| 2005 |
`vars <var-name> ... : <sort-name>` |
| 2006 |
|
| 2007 |
Related: [`on-the-fly`](#onthefly), [`qualified term`](#qualified), [`op`](#op) |
| 2008 |
|
| 2009 |
## `:verbose { on | off }` ## {#citp-verbose} |
| 2010 |
|
| 2011 |
Turns on verbose reporting of the CITP subsystem. |
| 2012 |
|
| 2013 |
Related: [`citp`](#citp) |
| 2014 |
|
| 2015 |
## `verbose` switch ## {#switch-verbose} |
| 2016 |
|
| 2017 |
Possible values: `on` `off`, default `off`. |
| 2018 |
|
| 2019 |
If turn `on`, the system is much more verbose in many commands. |
| 2020 |
|
| 2021 |
Related: [`quiet switch`](#switch-quiet) |
| 2022 |
|
| 2023 |
## `version` ## {#version} |
| 2024 |
|
| 2025 |
Prints out the version of CafeOBJ. |
| 2026 |
|
| 2027 |
## `view <name> from <modname> to <modname> { <viewelems> }` ## {#view} |
| 2028 |
|
| 2029 |
A view specifies ways to bind actual parameters to formal parameters |
| 2030 |
(see [parameterized module](#parameterizedmodule)). The view has to |
| 2031 |
specify the mapping of the sorts as well as the operators. |
| 2032 |
|
| 2033 |
The `<viewelems>` is a comma-separated list of expressions specifying |
| 2034 |
these mappings: |
| 2035 |
|
| 2036 |
~~~~ |
| 2037 |
sort <sortname> -> <sortname> |
| 2038 |
hsort <sortname> -> <sortname> |
| 2039 |
op <opname> -> <opname> |
| 2040 |
bop <opname> -> <opname> |
| 2041 |
~~~~ |
| 2042 |
|
| 2043 |
and also can contain variable declarations. |
| 2044 |
|
| 2045 |
Infix operators are represented as terms containing the operator with |
| 2046 |
either literal underscores `_`, or variables: `_*_` or `X * Y`. |
| 2047 |
The `<opname>` can be qualified. |
| 2048 |
|
| 2049 |
In specifying views some rules can be omitted: |
| 2050 |
|
| 2051 |
1. If the source and target modules have common submodules, all the |
| 2052 |
sorts and modules declared therein are assumed to be mapped to |
| 2053 |
themselves; |
| 2054 |
|
| 2055 |
2. If the source and target modules have sorts and/or operators with |
| 2056 |
identical names, they are mapped to their respective counterparts; |
| 2057 |
|
| 2058 |
3. If the source module has a single sort and the target has a |
| 2059 |
principal sort, the single sort is mapped to the principal sort. |
| 2060 |
|
| 2061 |
|
| 2062 |
### Example ### |
| 2063 |
|
| 2064 |
Assume a module `MONOID` with sort `M` and ops `e` and `*` |
| 2065 |
are given, and another `SIMPLE-NAT` with sort `Nat` and operators `0` |
| 2066 |
and `+` (with the same arity). Then the following expression |
| 2067 |
constitutes a view: |
| 2068 |
|
| 2069 |
~~~~~ |
| 2070 |
view NAT-AS-MONOID from MONOID to SIMPLE-NAT { |
| 2071 |
sort M -> Nat, |
| 2072 |
op e -> 0, |
| 2073 |
op _*_ -> _+_ |
| 2074 |
} |
| 2075 |
~~~~~ |
| 2076 |
|