Carregar apresentação
A apresentação está carregando. Por favor, espere
PublicouHeloísa Brasil Alterado mais de 9 anos atrás
2
1 Semântica de Ações Ações Básicas, Ações Funcionais e Notação de Dados
3
2 Notação de Ações Básica ações básicas são usadas para especificar fluxo de controle ações básicas não estão relacionadas com nenhuma espécie de informação corrente a execução de uma ação consiste de passos atômicos de execução, feitos por um ou mais agentes consideraremos um único agente
4
3 Ações Básicas ações primitivas complete : action. escape : action. fail : action. diverge : action. commit : action. unfold : action.
5
4 Ações Básicas (cont.) combinadores de ações unfolding _ :: action -> action. _ or _ :: action, action -> action. _ and _ :: action, action -> action. _ and then _ :: action, action -> action.
6
5 Exemplos de Ações Básicas complete complete or fail complete and then fail unfolding (unfold or fail)
7
6 Semântica da Notação de Ações Regras de Inferência (Semântica Natural) antecedente 1 antecedente 2... antecedente n consequente Ações t, b, s |- a > o, t’, b’, s’ Produtores t, b, s |- y > d
8
Semântica das Ações Básicas t, b, s |- complete > completed, (), {}, s t, b, s |- a 1 > completed, t 1, b 1, s 1 t, b, s 1 |- a 2 > completed, t 2, b 2, s 2 mergeable b 1 b 2 t, b, s |- a 1 and a 2 > completed, t 1 ^ t 2, b 1 + b 2, s 2 (COMPLETE) (AND-3) (AND-2) (AND-1) t, b, s |- a 1 > o 1, t 1, b 1, s 1 o 1 <> completed t, b, s |- a 1 and a 2 > o 1, t 1, b 1, s 1 t, b, s |- a 1 > completed, t 1, b 1, s 1 t, b, s 1 |- a 2 > o 2, t 2, b 2, s 2 o 2 <> completed t, b, s |- a 1 and a 2 > o 2, t 2, b 2, s 2 t, b, s |- fail > failed, (), {}, s (FAIL)
9
8 Comandos /NanoSpecimen/Abstract Syntax/Comandos grammar: (1) Comando = [[ Identificador := Expressão ]] | [[ while Expressão do Comando end ]] | [[ local Declaração in Comando end ]] | [[ Comando ; Comando ]].
10
/NanoSpecimen/Semantic Functions/Comandos introduces: execute _. execute _ :: Comando -> action. (1)... (2) execute [[ while E:Expressão do C:Comando ]] = unfolding | | evaluate E | then | | | check (it is 1) and then execute C and then unfold | | or | | | check not (it is 1).
11
(3) … (4) execute [[ C 1 :Comando ; C 2 :Comando ]] = execute C 1 and then execute C 2.
12
11 Notação de Ações Funcional ações give _ :: yielder -> action. regive : action. choose _ :: yielder -> action. check _ :: yielder -> action. _ then _ :: action, action -> action. produtores given _ :: data -> yielder. given _ # _ :: datum, positive-integer -> yielder. it : yielder.
13
12 Exemplos de Ações Funcionais give 5 give sum(3,4) choose a natural (check true and then give 1) or (check not true and then give 0)
14
Semântica das Ações Funcionais t, b, s |- y > d t, b, s |- give y > completed, (d), {}, s t, b, s |- a 1 > completed, t 1, b 1, s 1 t 1, b, s 1 |- a 2 > completed, t 2, b 2, s 2 t, b, s |- a 1 then a 2 > completed, t 2, b 1 + b 2, s 2 (GIVE) (THEN-3) (THEN-2) (THEN-1) t, b, s |- a 1 > o 1, t 1, b 1, s 1 o 1 <> completed t, b, s |- a 1 then a 2 > o 1, t 1, b 1, s 1 t, b, s |- a 1 > completed, t 1, b 1, s 1 t 1, b, s 1 |- a 2 > o 2, t 2, b 2, s 2 o 2 <> completed t, b, s |- a 1 then a 2 > o 2, t 2, b 2, s 2
15
/NanoSpecimen/Abstract Syntax/Expressões grammar: Expressão = Numeral-Inteiro | Identificador | [[ if Expressão then Expressão else Expressão ]] | [[ Identificador ( Expressão ) ]] | [[ Expressão Operador Expressão ]] | [[ ( Expressão ) ]]. Operador = + | - | * | / | = | <.
16
/NanoSpecimen/Semantic Functions/Expressões introduces: avalie _. avalie _ :: Expressão -> action. (1) avalie N:Numeral-Inteiro = give the valor-de N. (2) avalie I:Identificador = | give the integer bound to token-de I or | give the integer stored in the cell bound to token-de I. (3) avalie [[ I:Identificador ( E:Expressão ) ]] = | avalie E then | enact (application of the abstraction bound to token-de I to the given integer).
17
(4) avalie [[if E 1 :Expressão then E 2 :Expressão else E 3 :Expressão ]] = | avalie E 1 then | | (check it is true) and then avalie E 2 | or | | (check not(it is true) and then avalie E 3. (5) avalie [[ E 1 :Expressão O:Operador E 2 :Expressão ]] = | avalie E 1 and avalie E 2 then | apliqueOperador O. (6) avalie [[ ( E:Expressão ) ]] = avalie E.
18
/NanoSpecimen/Semantic Functions/Operadores introduces: aplicaOperador _. aplicaOperador _ :: Operador -> action. (1) aplicaOperador “ + ” = give sum(the given integer#1, the given integer#2). (2) aplicaOperador “ - ” = give difference(the given integer#1, the given integer#2). (3) aplicaOperador “ * ” = give product(the given integer#1, the given integer#2). (4) aplicaOperador “ / ” = give quotient(the given integer#1, the given integer#2).
19
(5) aplicaOperador “ = “ = | check (the given integer#1 is the given integer#2) | and then give 1 or | check not(the given integer#1 is the given integer#2) | and then give 0. (6) aplicaOperador “ < “ = | check (the given integer#1 is less than the given integer#2) | and then give 1 or | check not(the given integer#1 is less than the given integer#2) | and then give 0.
20
19 Notação de Dados
21
20 Notação de Dados General. Instant. Tuples. Truth-Values. Numbers. Characters. Lists. Strings. Syntax. Sets. Maps.
22
21 Tuplas Generics component = . Basics tuple > component. () : tuple. ( _, _ ) :: tuple, tuple tuple (total, associative, unit is ()). _? :: tuple -> tuple. _ * :: tuple -> tuple. _ + :: tuple -> tuple. _ - :: tuple, natural -> tuple.
23
22 Tuplas (cont.) Specifics count _ :: tuple -> natural (total). _ is _:: tuple, tuple -> truth-value (partial).
24
23 Booleanos (Truth-Values) Basics truth-value = true | false (individual). Specifics if _ then _ else_ :: truth-value, x, y -> x | y (linear). when _ then _ :: truth-value, x - > x (partial). there is _:: x -> truth-value (total). not _ :: truth-value -> truth-value (total). both _:: (truth-value,truth-value) -> truth-value. either _:: (truth-value,truth-value) -> truth-value.
25
24 Números Naturais Basics natural = 0 | positive-integer ( disjoint ). 0 : natural. successor _ :: natural positive-integer ( total, injective ). Specifics 1, 2, 3, 4, 5, 6, 7, 8, 9 : natural. _0, _1, _2, _3, _4, _5, _6, _7, _8, _9 : natural natural ( total ). sum _ :: natural* natural ( total, associative, commutative, unit is 0). product _ :: natural* natural ( total, associative, commutative, unit is 1).
26
25 Números Inteiros Basics integer = 0 | nonzero-integer (disjoint). nonzero-integer = positive-integer | negative-integer (disjoint). successor _ :: integer integer (total, injective). predecessor _ :: integer integer (total, injective). Specifics negation _ :: integer integer (total). absolute _ :: integer integer (total). difference _ :: (integer, integer) integer (total).
27
26 Caracteres Basics character = . character of _ :: natural -> character (partial, injective). code _ :: character -> natural (total, injective). Alphanumerics character >= digit | letter (disjoint). digit = ‘0’ | ‘1’ |... | ‘9’ (individual). letter = lowercase letter | uppercase letter (disjoint). lowercase _ :: character -> character (total). uppercase _ :: character -> character (total).
28
27 Caracteres (cont.) ASCII code _ :: character -> natural [max octal “177”] (total). character = graphic-character | control-character.
29
28 Generics item = . Basics flat-list = list of item*. list of _ :: item* flat-list ( total, injective ). Specifics _ [_] :: flat-list, item flat-list. items _ :: flat-list items* ( total, injective ). head _ :: flat-list item ( partial ). tail _ :: flat-list flat-list ( partial ). empty-list : flat-list. concatenation _ :: flat-list* flat-list ( total, associative, unit is empty-list). Listas Não-aninhadas
30
29 Generics leaf = item | . Basics list = list of tree*. tree = leaf | list ( disjoint ). list of _ :: tree* -> list ( total, injective ). Listas Aninhadas
31
30 Listas Aninhadas (cont.) Specifics _ [ _ ] :: list, tree -> list. branches _ :: list -> tree* ( total, injective ). leaves _ :: head _ :: tail _ :: empty-list : list. concatenation _ :: list* -> list ( total, associative, unit is empty-list).
32
31 Basics character item. l string = flat-list [character]. string of _ :: character* string ( total, injective ). characters _ :: string character* ( total, injective ). l ““ : string. _ ^ _ :: string, string string ( total, associative, unit is ““). Alphanumerics lowercase _ :: string string ( total ). uppercase _ :: string string ( total ). decimal _ :: string of digit+ natural ( total ). octal _ :: string of octal-digit+ natural ( total ). l octal-digit = ‘0’ | ‘1’ | ‘2’ | ‘3’ | ‘4’ | ‘5’ | ‘6’ | ‘7’. Strings
33
32 Basics syntax-tree = character | list [syntax-tree] ( disjoint ). Specifics l [[ ]] : syntax-tree. [[ _ ]] :: syntax-tree* syntax-tree ( total ). [[ _ _ ]] :: syntax-tree*, syntax-tree* syntax-tree ( total ).... : syntax-tree*. : syntax-tree* syntax-tree ( total ). : syntax-tree*, syntax-tree* syntax-tree ( total ).... Sintaxe (Árvores Sintáticas)
34
33 Generics nonset-element = . _ is _ :: nonset-element, nonset-element truth-value ( total ). Basics set = set of element*. element = nonset-element | set ( disjoint ). set of _ :: element* set ( individual ). Conjuntos
35
34 Conjuntos (cont.) Specifics _ [ _ ] :: set, element set. elements _ :: set element* (strict, linear). empty-set : set. _ [in _ ] :: element, set element (partial). _ [not in _] :: element, set element (partial).
36
35 Generics nonmap-range = . Basics map = disjoint-union (map of element to range)*. range = nonmap-range | map ( disjoint ). map of _ to _ :: element, range map ( total, injective ). empty-map : map. disjoint-union _ :: map* map ( partial, associative, commutative, unit is empty-map). mapped-set _ :: map -> set ( total ). Mapeamentos
37
36 Mapeamentos (cont.) Specifics _ [ _ to _ ] :: set, element set. _ at _ :: map, element range (partial). overlay _ :: map* map (total, associative, idempotent, unit is empty-map). l_ restricted to _ :: map, set -> map (total). l_ omitting _ :: map, set -> map (total).
38
37 Action Notation/Basic/Data includes: Data Notation/General. ldatum <= component. ldatum >= truth-value | rational | character | list | set | map | abstraction (disjoint). ldistinct-datum <= datum. ldistinct-datum >= truth-value | rational | character | list [distinct-datum] | set [distinct-datum] | map [distinct-datum to distinct-datum]. includes: Data Notation/Instant/Distinction (distinct- datum for s). ldata = datum*. la _, an _, the _, of _, some _ :: data -> data (total).
39
38 Algumas Inclusões entre Sortes de Dados Padrões tuple item truth-value component flat-list character string set approximation map range tree nonmap-range listsyntax-tree positive-rationalnatural 0 nonzero-rational leaf integer rational letterdigit element nonset-element graphic-charactercontrol-character nonzero-integernegative-rational negative-integerpositive-integer
40
/NanoSpecimen/Abstract Syntax needs: DataNotation/Characters/ASCII ( letter, digit ) closed. grammar: Identificadores Identificador = letter | Identificador letter | Identificador digit. Literais Numeral-Inteiro = digit | Numeral-Inteiro digit.
41
/NanoSpecimen/Semantic Functions/Identificadores introduces: token-de _. token-de _ :: Identificador -> token. (1) token-de I:Identificador = I. /NanoSpecimen/Semantic Functions/Literais introduces: valor-de _. valor-de _ :: Numeral-Inteiro -> integer. (1) valor-de [[ 0 ]] = 0.... (10) valor-de [[ 9 ]] = 9. (11) valor-de [[ N D ]] = sum (product (valor-de N, 10), valor-de D).
42
41 Resumo/Notação de Dados A notação de tuplas inclui uma forma de expressões regulares. Tuplas são usadas para prover operações com um número arbitrário de argumentos. Vários sortes, como component, são deixados abertos para uma especialização quando necessária. Caracteres podem ser especializados para qualquer conjunto de caracteres desejado, como ASCII, por exemplo.
43
42 Resumo/Notação de Dados Listas, conjuntos e mapeamentos podem ser aninhados, enquanto tuplas podem ser só concatenadas. Árvores sintáticas têm unicamente caracteres como ramos. Strings são listas planas de caracteres, por isso também árvores sintáticas.
Apresentações semelhantes
© 2024 SlidePlayer.com.br Inc.
All rights reserved.