• No se han encontrado resultados

Higiene pública

In document FACULTAD DE MEDICINA (página 93-97)

3. Estudio crítico

3.3. Estudio estadístico de las ponencias

3.4.6. Higiene pública

x{n} x{n − 1} x{n + 1} [shiftup x](σ (x{n − 1}))

y{n} y{n} y{n} [shiftup x](σ (y{n}))

Table 4: CINNI’s explicit substitution operators. The top row shows substitu-tion expressions, which are being applied to the indexed variables in the leftmost column.

substitution [lift ], which represents a more general substitution that avoids capturing free names. See the referenced paper for a detailed discussion of a similar instance of CINNI for the π-calculus.

op [_:=_] : Var AParam -> Subst . op [shiftup_] : Var -> Subst . op [lift__] : Var Subst -> Subst .

The sort Subst is the sort of substitutions. The effect of these substitution operators on indexed variables is illustrated in Table 4, where we assume that x 6= y and σ is a meta-variable ranging over terms of sort Subst. For instance, the following set of equations specify the lift substitution.

eq [lift a S] a{0} = a{0} .

eq [lift a S] a{s(n)} = [shiftup a] S a{n} .

ceq [lift a S] b{n} = [shiftup a] S b{n} if a =/= b .

The substitutions, as described above, are the same in every instance of CINNI because they do not depend on the particular language being specified.

Once they are extended from variables to expressions in the language, the CINNI instance is distinguished from instances for other languages. In general, if the we denote by ⇑x S the lift substitution [lift x S], a CINNI substitution is extended to language expressions by adding, for each syntactic constructor f of arity n in the language, an equation of the form,

S f (P1, . . . , Pn) = f (⇑Pj1,1. . . ⇑Pj1,m1 S P1, . . . , ⇑Pjn,1 . . . ⇑Pjn,mn S Pn) (3) where each Piis an expression in the language, and Pji,1, . . . , Pji,miare the vari-able arguments that f binds in the ith expression argument Pi. This equation instantiated to Orc expressions along with examples are further discussed in the next section where the specification of Orc expressions in Maude are introduced.

8.2 Syntax Specifications and Examples

Building on the observations made above, we present the abstract syntax of Orc specified in Maude in Table 5.

fmod ORC-SYNTAX is

op _;_ : DeclList Expr -> Prog [ctor prec 50] . op nilD : -> DeclList [ctor] .

op _;_ : DeclList DeclList -> DeclList [ctor assoc id: nilD prec 40] . op __:=_ : ExprName FParamList Expr -> Decl [ctor frozen(3) prec 30] . op zero : -> Expr [ctor] .

op _(_) : SiteName AParamList -> Expr [ctor prec 10] . op _(_) : ExprName AParamList -> Expr [ctor prec 10] . op !_ : IVar -> Expr [ctor prec 5] .

op !_ : Const -> Expr [ctor prec 5] .

op _>_>_ : Expr Var Expr -> Expr [ctor frozen(3) prec 15 gather (e & E)] . op _|_ : Expr Expr -> Expr [ctor assoc comm prec 20] .

op _where_:in_ : Expr Var Expr -> Expr [ctor prec 25 gather (E & e)] . op ?_ : Handle -> Expr [ctor prec 1] .

endfm

Table 5: An excerpt from the functional module ORC-SYNTAX which specifies the extended syntax of Orc in Maude.

The special expression ? H, where H is a handle name, is not part of the original syntax but is required in the semantics rules of the language to represent a site call that is yet to return. The name H acts as a identifier for the call. Based on the algebraic properties of the Orc language constructs [10, 27], the sequential and asymmetric parallel composition operators are declared right associative, while the symmetric parallel operator is fully associative, commutative, and has the identity zero. Furthermore, the left annihilator axiom of sequential composition is specified, as an equation (using the eq keyword), as follows.

eq zero > x > f = zero .

In addition to the operators of Table 5, a few syntactic sugar operators are defined below, where S and F are meta-variables of sorts SiteName and ExprName. respectively.

op _:=_ : ExprName Expr -> Decl [prec 30] . eq E := f = E nilF := f .

op _() : SiteName -> Expr [prec 10] . op _() : ExprName -> Expr [prec 10] . eq M() = M(nilA) .

eq E() = E(nilA) .

Finally, the prec attribute, which appears in Table 5 and in the syntactic sugar operators above, specifies operator precedence; the lower the number associ-ated with an operator, the higher the operator precedence. For instance, the expression

’sFormat(’vn{0}) > ’vx > ’sDisplay(’vx{0}) where ’vn :in ’sCNN() | ’sBBC() is correctly parsed as

(((’sFormat(’vn{0})) > ’vx > (’sDisplay(’vx{0})))

where ’vn :in ((’sBBC()) | (’sCNN())) Using these syntactic specifications, the program Priority given in Section 4.1, for instance, is represented as a term of the the theory ORC-SYNTAX as follows:

’eDelayedN := rtimer(1) > ’vz > (let(’vu{0}) where ’vu :in ’sN()) ; let(’vx{0}) where ’vx :in ’sM() | ’eDelayedN()

The CINNI calculus for explicit substitution is also extended to expressions.

When a substitution is applied to an expression, the substitution propagates down the expression tree while keeping track of bound variable instances, so that the substitution can be correctly performed with no free variable capture.

The substitutions are defined with equations that are instances of the equation 3 above. In our case, the most interesting CINNI equations are the sequential and the asymmetric parallel composition equations:

eq S (f > x > f’) = (S f) > x > ([lift x S] f’) .

eq S (f where x :in f’) = ([lift x S] f) where x :in (S f’) .

To illustrate how substitutions applied to expressions are performed, consider the expression

’eGetNews := ’sFormat(’vn{0}, ’vp{0}) > ’vx > ’sDisplay(’vx{0}) where ’vn :in ’sCNN()

We first note that ’vn{0} and ’vx{0} are bound in ’sFormat( ’vn{0}, ’vp{0}

) > ’vx > ’sDisplay( ’vx{0} ) and ’sDisplay(’vx{0}), respectively, while

’vp{0} occurs free in ’eGetNews. The zero index appearing in these occur-rences means that if the variable is bound, then it is bound by the nearest binding occurrence of that variable. Now, suppose that we want to substitute

’va{0} for ’vp{0} in ’eGetNews, that is, we want to evaluate [’vp := ’va{0}]

’eGetNews. This substitution is simple (no free variable capture), and when ap-plied to ’eGetNews yields the expression

’sFormat(’vn{0}, ’va{0}) > ’vx > ’sDisplay(’vx{0}) where ’vn :in ’sCNN() However, the substitution, [’vp := ’vn{0}] has the potential of causing the free occurrence of ’vp{0} to be captured by the binding occurrence of ’vn.

CINNI resolves this issue by renaming (shifting up the name of) the variable, giving the following expression as the result of the substitution.

’sFormat(’vn{0}, ’vn{1}) > ’vx > ’sDisplay(’vx{0}) where ’vn :in ’sCNN()

Note that ’vn{1} is still free in the resulting expression. Finally, note that the substitutions [’vx := ’va{0}] and [’vn := ’va{0}] have no effect on

’eGetNews, since there are no free occurrences of these variables in the expres-sion. Other substitutions in which a variable is replaced by a constant value or a site name are simpler since neither values nor site names occur free or bound in an expression.

In document FACULTAD DE MEDICINA (página 93-97)