Guards in a nutshell

This chapter presents succinctly the different kinds of guards that are available to write mathematical rules (for further details, see Appendix C). For each guard, the following elements are presented:

  • syntax,

  • possibly its semantics,

  • a textual description of its behaviour.

It must be noted that certain guards have a mathematical semantics only under special circumstances (e.g. the bsearch guard).

The following guards may be employed to obtain one or several hypothesis from the stack, by processing first the most recently inserted hypothesis.

SyntaxSemantics

bgetallhyp(H)

H

bgethyp(H)

H

binhyp(H)

H

The following guard checks if s is an element of STRING.

SyntaxSemantics

bstring(s)

s : STRING

The following guard checks if P is a conjunction.

SyntaxSemantics

bpattern(P, (Q & R))

P <=> (Q & R)

The bsearch guard has a mathematic semantics when the list in which the search is performed is the argument list of an associative and commutative operator. This is the case for the operators &, or, / and /. This is also the case of the operator , (comma) for a list of quantified variables. One must thus check that the application of the rule remains within such cases.

SyntaxSemantics

bsearch(N, (P, Q), M)

(P, Q) = (M, N)

bsearch(N, (P & Q), M)

(P & Q) <=> (M & N)

bsearch(d, (a or b), c)

(a or b) <=> (c or d)

bsearch(d, (a / b), c)

a / b = c / d

bsearch(d, (a / b), c)

a / b <=> c / d

The following guard succeeds if t is true and has the form a op b.

SyntaxSemantics

btest(t)

t

The following guard checks if n is a numeric value both positive and smaller or equal to maxint.

SyntaxSemantics

n : NATURAL

The following guard succeeds if both arguments succeed.

SyntaxSemantics

band(P, Q)

Semantics of P and semantics of Q

The role of the following guards is to verify the relationship between wildcards representing variables and wildcards representing expressions.

SyntaxSemantics

bvrb(x)

x

blvar(x)

x

x P

x (if x P)

bfresh(x, P, y)

y (if y P)

Last updated