文档下载 文档下载导航
设为首页 | 加入收藏
搜索 请输入内容:  
 导航当前位置: 文档下载 > 所有分类 > A Denotational Approach to Measuring Complexity in Functional Programs
侵权投诉

A Denotational Approach to Measuring Complexity in Functional Programs

A Denotational Approach to Measuring Complexity in Functional Programs

1.1. TYPES OF SEMANTIC FUNCTIONS

3

large amount of time. Furthermore, when various parts of an evaluation are delayed we may have di culty predicting if and when evaluation will occur, adding to the problem of predicting the time it takes to evaluate a program.

1.1.1 Denotational vs. Operational

1.1 Types of Semantic functions

a natural operational semantics describes how to nd the result of an expression in one big step. The equivalent to the transition rules above would thus be

e1?! e01 e1e2?! e01e2 (lam x:e)e2?! e2=x]e where e2=x]e indicates the expression e with e2 substituted for all free occurrences of x. Conversely, e1=) lam x:e e2=x]e=) v e1 (e2 )=) v

In this dissertation there will be two independent classi cations of semantic functions. The rst, common to most discussions of semantics is the distinction between operational semantics and denotational semantics. In general, an operational semantics for a programming language is provided as a collection of rules describing the steps taken by an abstract machine during expression evaluation. Many operational semantics come in one of two forms: transition (or single-step) semantics and natural (or big-step) semantics. A transition semantics for a language describes the rules for making a single action in the process of an evaluation. For example, if we let e?! e0 mean that the expression e reduces to e0 in one step, then the following could be rules for the evaluation of an application:

where e=) v means that e evaluates to the ( nal) result v . A denotational semantics, on the other hand, is a function mapping expressions to meanings,

which typically are some form of mathematical entity. In particular, a denotational semantics forms the meaning of an expression from the meanings of its syntactic subparts. The natural deduction rule for application listed previously was not derived from the rules for evaluating e1 and e2, but from rules for e1 and e2=x]e. If we say that e] is the denotational meaning of an expression e, however, then the equivalent de nition for an application would look something like the following:

e1 (e2)]]= e1] ( e2] ) i.e., the meaning of e1 (e2 ) only requires the meanings of e1 and e2 . This property, called compositionality, can often be an advantage to analysis as we do not have to account for anything but the expression itself and knowledge of the mathematical structure of the collection of meanings. It is not always clear whether it is better to use an operational semantics or a denotational semantics. Depending on the exact language and semantics in use, either the denotational semantics or the operational semantics can be more intuitively\correct," thus in cases where the correctness of the de nition is the goal, it is best to use the form that is more intuitively correct regardless of whether it is an operational or denotational semantics. In cases where the relation between the semantics and the computer instructions is important, an operational semantics is more likely to be the appropriate one to use. In cases where compositionality is a goal, a denotational semantics will be desired. If the desired semantics is not the one that is most obviously correct, another type of semantics will frequently be used as well, and then the two forms of semantics will need to be shown

上一页第17页

你可能喜欢

热门文档

相关文档

站点地图 | 文档上传 | 侵权投诉 | 手机版
本站所有资源均来自互联网,本站只负责收集和整理,均不承担任何法律责任,如有侵权等其它行为请联系我们.
文档下载 Copyright 2013 doc.guandang.net All Rights Reserved.  -  email