Presentation is loading. Please wait.

Presentation is loading. Please wait.

GENETICA’S BASIC SYNTACTIC AND SEMANTIC PROPERTIES In order to answer these questions we should start from GENETICA's syntax and semantics.

Similar presentations


Presentation on theme: "GENETICA’S BASIC SYNTACTIC AND SEMANTIC PROPERTIES In order to answer these questions we should start from GENETICA's syntax and semantics."— Presentation transcript:

1 GENETICA’S BASIC SYNTACTIC AND SEMANTIC PROPERTIES In order to answer these questions we should start from GENETICA's syntax and semantics.

2 … the connectives app (apply) and chs (choose) which implement the universal and the existential quantifier respectively, … GENETICA's connectives include the basic logical connectives and, or, not, … All operations, functions and relations in GENETICA are referred to as "formulas". Atomic formulas include arithmetic operations, list processing functions and both inclusion and equality relations. Each atomic formula can be either confirmed or disconfirmed depending on input terms. (F N, con, S in, Ref lst, S out ) NameConnective Input Section Reference Section Output Section and, or, not, app, chs, rec, opt (…, (Ref N, Ref Sin, Ref Sout ), …) FORMULA DEFINITION Non atomic formulas are defined as "formula definitions". A formula definition in GENETICA is a list … … where the first element is the name of the formula, … … the second is a connective, … … the third is the input section as a list of input variables, … … the fourth is the reference section as a list of references to formulas which are called when the non atomic formula is called, … … and the fifth is the output section as a list of output variables. … the connective rec which implements conditional recursion, … … and the connective opt, which connects the solution-creation formula with the solution-evaluation formula in optimization problems. A formula reference is a triplet, where the first element is the name of the referenced formula, the second is the input section and the third is the output section of the reference. A program in GENETICA is a list of formula definitions. Note that the syntax of the prototype version described in Genetica_Documentation.pdf and implemented in Proto.exe differs from the syntax presented here in that the output section comes before the input section in both the formula definition and the formula reference.

3 F 0, constructed with the "optimization" connective, has input terms a 1, a 2, a 3 while includes references to F 1 and F 2. F 1 creates a potential solution represented by x 1, x 2, x 3. The potential solution is evaluated by F 2, which calculates x 4 : the value to be maximized. F 0 returns the potential solution. This is a sample GENETICA program that includes the definitions of four non atomic formulas, named F 0, F 1, F 2 and F 3. F 1 is constructed with the and connective, which means that it is confirmed if and only if all references are confirmed. F 1 includes four references to atomic formulas.

4 mem (L) (v) v is a random element of the list L The atomic formula mem (which stands for "member") returns a random element of a list.

5 mem (L) (v) v is a random element of the list L in (a, b) (v) v is a random value in the real interval [a, b] The atomic formula in returns a random value within a real interval. Such formulas, where given the input values confirmation can be achieved with different data productions, will be referred to as multiple confirmation formulas.

6 Formulas that exhibit deterministic behavior, such as the atomic formula sml (smaller), which compares two numbers, or the atomic formulas sqr (square root) and mns (minus) which perform arithmetic operations, will be referred to as single confirmation formulas.

7 F 3 is constructed with or, which means that it is confirmed if and only if at least one reference is confirmed. Formulas constructed with or return a single list, having as elements the values both referenced in the output section and produced by confirmed calls to the referenced formulas. F 2, which is also constructed with and, includes a reference to F 3, which returns a list of real numbers, and a reference to mem which returns an element of the list.

8 1 2 3456 7 89 1011 A program can be represented as a tree structure, referred to as the "syntax tree", where each formula definition is represented as a node having child nodes the definitions of the referenced formulas. Atomic formulas are represented as terminals (leaf nodes). The formula of which the definition is represented as the root of the syntax tree represents the problem statement. This formula will be referred to as the "root formula". A call to a formula is an a execution of the program represented by the formula. When a non atomic formula is called, all the referenced formulas are recursively called in a dept-first, left-to-right mode. In this case the call-tree is isomorphic with the syntax tree. In other cases is not. Now some examples of the latter cases will be presented.

9 In the case of the existential quantifier (connective chs) the non atomic formula is confirmed if and only if at least one reference call is confirmed, while the output is the list of the output vector values of the confirmed reference calls. (v 1, v 2, v 3, v 4 ) v1v1 u1u1 w1w1 v2v2 u2u2 w2w2 v3v3 u3u3 w3w3 v4v4 u4u4 w4w4 ((u 1, w 1 ), (u 2, w 2 ), (u 3, w 3 ), (u 4, w 4 )) Syntax Tree F0F0 F1F1 Call Tree F0F0 F1F1 F1F1 F1F1 F1F1 QUANTIFIERS Here, the formula F 0 is constructed with the connective app (apply) which represents the universal quantifier. Such formulas include only one referenced formula, … … while the first variable in the input section represents a list. The referenced formula is called once for each element of the list, where each element substitutes the homonymous input variable. The respective output values are calculated. The output of the non atomic formula, which is confirmed if and only if all the reference calls are confirmed, is the list of the output vector values of the latter calls. Here the syntax tree has only one branch: F 0 makes a reference to F 1. However, the call-tree has four branches as F 1 is called four times (as many as the elements of the input list).

10 Call Tree F0F0 F1F1 F2F2 F0F0 Syntax Tree F0F0 F1F1 F2F2 F1F1 F2F2 F0F0 F1F1 F2F2 F0F0 RECURSION Here, the formula F 0 is constructed with the connective rec which represents conditional recursion. The first referenced formula, named F 1, represents the termination condition, while the second one, named F 2, creates values for the input variables of the recursive call to F 0. This is the syntax tree. Let us see the call-tree now. First the termination condition is called. If this call is disconfirmed the formula creating the recursion input values is called. If the latter call is confirmed the recursive call is realized… … until either the termination condition is confirmed (in which case recursion is also confirmed) or the formula creating the recursion input values is disconfirmed (in which case recursion is also disconfirmed).

11 call (L in ) (L out ) (F, x 1, … x n ) F (x 1, … x n )(y 1, … y n ) HIGH ORDER FORMULAS The atomic formula named call performs high-order calls, i.e. calls to formulas whose name is included in the input section. The input section includes a single list. The first element of this list (represented here by an F) is the name of a formula to be called, while the remaining elements are the input values of the F call. The formula named F is called and the output values of this call are returned as a single list by the high-order call. In this case the syntax tree of the formula named call includes a single node, as this formula is an atomic one, but the call-tree is the call-tree of the F call.

12 Continued in Section_4.PPS


Download ppt "GENETICA’S BASIC SYNTACTIC AND SEMANTIC PROPERTIES In order to answer these questions we should start from GENETICA's syntax and semantics."

Similar presentations


Ads by Google