口臭吃什么好| 洗劫一空是什么意思| 投诉医生打什么电话| 什么什么各异| 湿疹长什么样子| 狗不能吃什么水果| 什么是腺样体| 心跳快是什么原因| 怀孕去医院检查挂什么科| 宁静是什么民族| 造纸术什么时候发明的| 腋下出汗多是什么原因| 地支是什么意思| 3岁打什么疫苗| touch是什么意思| 介入是什么意思| 右边肋骨疼是什么原因| 胆管炎是什么原因引起的| 三岁看小七岁看老是什么意思| 肾不好是什么原因引起的| 有什么有什么的四字词语| xl是什么尺码| 立加羽读什么| 2楼五行属什么| 易举易泄是什么原因| 小孩经常流鼻血是什么原因| 小基数是什么意思| 果实是什么意思| 大满贯什么意思| 欢天喜地是什么生肖| 病毒性感染是什么原因引起的| 什么病属于重大疾病| 千山暮雪结局是什么| 老梗是什么病| 什么是三净肉| 时辰宜忌是什么意思| 自身免疫性疾病是什么意思| 百草霜是什么| 宫颈糜烂什么症状| 明年是什么生肖年| 高考考生号是什么| 卡司是什么意思| 什么叫偏光眼镜| 执子之手与子偕老什么意思| 放荡不羁爱自由什么意思| 什么的技术| 买盘和卖盘是什么意思| 神龙见首不见尾是什么意思| 口胃读什么| 吃葡萄皮有什么好处| 肚子胀是什么原因引起的| 水彩笔用什么能洗掉| 虾仁炒什么| 汕是什么意思| 减肥吃什么瘦得快| 手抖是什么病的前兆| 什么花是蓝色的| 发蒙是什么意思| 学海无涯苦作舟的上一句是什么| 孩子张嘴睡觉是什么原因| 甲功不正常会得什么病| 间接喉镜检查能检查出什么| 语言障碍挂什么科| 什么白酒好喝| 盐酸氯米帕明片有什么作用| 思量是什么意思| as材质是什么材料| 羊蛋是什么| 骨头咔咔响是什么原因| 办健康证需要带什么证件| 香字五行属什么| hpv是什么原因引起的| 大咖什么意思| 他达拉非片是什么药| 打氨基酸点滴有什么好处和害处| 陈皮泡水喝有什么功效| 无拘无束的意思是什么| 什么是全脂奶粉| 为什么会肾结石| 长孙皇后为什么叫观音婢| 早上打嗝是什么原因呢| 鼻甲肥大是什么原因| 胎儿畸形是什么原因造成的| 左眼皮跳是什么预兆女| 三点水弘读什么| 金戈铁马是什么生肖| 祛斑喝什么花茶最有效| 精神紊乱吃什么药| 为什么会肚子痛| 梦到考试是什么意思| 皮肤瘙痒吃什么药| 高丽参适合什么人吃| 胃经常胀气是什么原因| 业已毕业是什么意思| 腹泻期间宜吃什么食物| 为什么明明很困就是睡不着| 什么样的你| 脘腹胀满是什么意思| 蛋白高是什么病| 血小板比积偏高是什么意思| oa是什么意思| 木圣念什么| 困水是什么意思| 工会副主席是什么级别| 复杂性囊肿是什么意思| 生肖龙和什么生肖最配| 七月半是什么日子| 肾结石去医院挂什么科| 乳头经常痒是什么原因| 月非念什么| 肝钙化是什么意思| 梦到甘蔗代表什么预兆| 两肺结节是什么意思| 饭后胃胀是什么原因导致的| 虚构是什么意思| 政协主席什么级别| 利有攸往是什么意思| 破瓦法是什么| 积德是什么意思| 搭桥香是什么意思| 不以为然的意思是什么| 7月15日是什么日子| 什么是舒张压和收缩压| 喜欢趴着睡是什么原因| 胃阴虚有什么症状| 1964年属什么| 纳差什么意思| 醛固酮高吃什么降压药| 检查肾功能挂什么科| 白蛋白偏高是什么原因| 脂浊是什么意思| 脾湿吃什么中成药| 9.7号是什么星座| 绿色食品是什么| 步步生花是什么意思| 我国的国花是什么| 小揪揪什么意思| 扁桃体肿大吃什么药好| 方解石玉是什么玉| 衍心念什么| 颈椎ct能检查出什么| 木丹念什么| 产值是什么| 梦见好多水是什么预兆| 肾寒吃什么中成药| 吃万艾可有什么副作用| 什么油炒菜好吃| 三个耳读什么| 清秋是什么意思| 打呼噜什么原因| 2月30日是什么星座| 李连杰什么病| 屏蔽一个人意味着什么| 海绵体供血不足吃什么药| 射手座最配什么星座| 螃蟹为什么横着走| 蜜蜡是什么东西| 孕妇梦见老鼠是什么意思| 姐姐的婆婆叫什么| zoom什么意思| 吃秋葵有什么好处| 傻狍子为什么叫傻狍子| 吃什么能消除子宫肌瘤| 胆囊粗糙是什么意思| 液基细胞学检查是什么| 月亮是什么颜色| 什么叫平年什么叫闰年| 肠道细菌感染吃什么药| 2月18日是什么星座| 大土土什么字| 孕20周做什么检查| 种草什么意思| 体检挂什么科室| 吕布的马叫什么名字| 护理员是干什么的| 脖子左侧疼是什么前兆| 增强免疫力吃什么维生素| 似水年华是什么意思| 提高免疫力吃什么药| 舒肝健胃丸治什么病| nk是什么| 现在什么年| 户籍所在地是指什么| 扁桃体发炎不能吃什么东西| 它是什么结构| 关节外科主要看什么| copd是什么意思| 上火流鼻血吃什么降火| 红色尿液是什么原因| 肚脐眼左右两边疼是什么原因| 舌头两边疼是什么原因| 什么生肖怕老婆| 独守空房是什么意思| 奢靡是什么意思| 糖尿病人早餐吃什么| hbsab阳性是什么意思| 颈动脉斑块吃什么药| 经常吃秋葵有什么好处| 给事中是什么官| 突厥是现在的什么地方| 红斑狼疮是什么引起的| 手术后吃什么营养品好| 血小板低是什么意思| 手机壳为什么会发黄| 南辕北辙是什么意思| 风景旧曾谙是什么意思| 做梦梦到大蟒蛇是什么意思| 鸡蛋可以炒什么菜| 吃饭时头晕是什么原因| 小受是什么意思| 花园里有什么花| 神父是什么意思| 早上醒来手麻是什么原因| 在是什么意思| 生津是什么意思| 十月二十三号是什么星座| 中秋节送什么| 喉咙干疼吃什么药| 月光像什么| 1923年属什么生肖| 肌酐低是什么意思| 补钾吃什么食物| 洛阳有什么好吃的| 拼图用什么软件| 左什么右什么| 遥字五行属什么| 喉咙干痒吃什么药| 狸子是什么动物| 一什么知什么成语| 湿疹不能吃什么食物| 脉弱是什么意思| 经行是什么意思| 鸡叫是什么时辰| 安之若素是什么意思| 36 80是什么罩杯| 立刀旁的字和什么有关| 丁香泡水喝有什么功效和作用| 医生会诊是什么意思| 3月23日是什么星座| 耗儿鱼是什么鱼| 性交是什么感觉| 精神心理科主要治疗什么疾病| 喝醋有什么好处和坏处| 吃芒果有什么好处| 墨绿色大便是什么原因| 大米放什么不生虫子| 荧光色是什么颜色| 老鼠和什么属相相冲| 端午节喝什么酒| 痱子长什么样| 汤去掉三点水念什么| 为什么今年有两个六月| 褥疮用什么药膏最好| 低血糖吃什么| 打胎药叫什么名字| 胃部检查除了胃镜还有什么方法| 小孩过敏性咳嗽吃什么药| 女人漏尿是什么原因| 阴到炎用什么药好得快| 障碍性贫血是什么病| 总是耳鸣是什么原因| 粒字五行属什么| 胆汁酸高吃什么药| 人的价值是什么| 百度Jump to content

From Wikipedia, the free encyclopedia
百度 严格说来,马克思没有独立的哲学和辩证法专著,《资本论》就是马克思的哲学和辩证法。

Operational semantics is a category of formal programming language semantics in which certain desired properties of a program, such as correctness, safety or security, are verified by constructing proofs from logical statements about its execution and procedures, rather than by attaching mathematical meanings to its terms (denotational semantics). Operational semantics are classified in two categories: structural operational semantics (or small-step semantics) formally describe how the individual steps of a computation take place in a computer-based system; by opposition natural semantics (or big-step semantics) describe how the overall results of the executions are obtained. Other approaches to providing a formal semantics of programming languages include axiomatic semantics and denotational semantics.

The operational semantics for a programming language describes how a valid program is interpreted as sequences of computational steps. These sequences then are the meaning of the program. In the context of functional programming, the final step in a terminating sequence returns the value of the program. (In general there can be many return values for a single program, because the program could be nondeterministic, and even for a deterministic program there can be many computation sequences since the semantics may not specify exactly what sequence of operations arrives at that value.)

Perhaps the first formal incarnation of operational semantics was the use of the lambda calculus to define the semantics of Lisp.[1] Abstract machines in the tradition of the SECD machine are also closely related.

History

[edit]

The concept of operational semantics was used for the first time in defining the semantics of Algol 68. The following statement is a quote from the revised ALGOL 68 report:

The meaning of a program in the strict language is explained in terms of a hypothetical computer which performs the set of actions that constitute the elaboration of that program. (Algol68, Section 2)

The first use of the term "operational semantics" in its present meaning is attributed to Dana Scott (Plotkin04). What follows is a quote from Scott's seminal paper on formal semantics, in which he mentions the "operational" aspects of semantics.

It is all very well to aim for a more ‘abstract’ and a ‘cleaner’ approach to semantics, but if the plan is to be any good, the operational aspects cannot be completely ignored. (Scott70)

Approaches

[edit]

Gordon Plotkin introduced the structural operational semantics, Matthias Felleisen and Robert Hieb the reduction semantics,[2] and Gilles Kahn the natural semantics.

Small-step semantics

[edit]

Structural operational semantics

[edit]

Structural operational semantics (SOS, also called structured operational semantics or small-step semantics) was introduced by Gordon Plotkin in (Plotkin81) as a logical means to define operational semantics. The basic idea behind SOS is to define the behavior of a program in terms of the behavior of its parts, thus providing a structural, i.e., syntax-oriented and inductive, view on operational semantics. An SOS specification defines the behavior of a program in terms of a (set of) transition relation(s). SOS specifications take the form of a set of inference rules that define the valid transitions of a composite piece of syntax in terms of the transitions of its components.

For a simple example, we consider part of the semantics of a simple programming language; proper illustrations are given in Plotkin81 and Hennessy90, and other textbooks. Let range over programs of the language, and let range over states (e.g. functions from memory locations to values). If we have expressions (ranged over by ), values () and locations (), then a memory update command would have semantics:

Informally, the rule says that "if the expression in state reduces to value , then the program will update the state with the assignment ".

The semantics of sequencing can be given by the following three rules:

Informally, the first rule says that, if program in state finishes in state , then the program in state will reduce to the program in state . (You can think of this as formalizing "You can run , and then run using the resulting memory store.) The second rule says that if the program in state can reduce to the program with state , then the program in state will reduce to the program in state . (You can think of this as formalizing the principle for an optimizing compiler: "You are allowed to transform as if it were stand-alone, even if it is just the first part of a program.") The semantics is structural, because the meaning of the sequential program , is defined by the meaning of and the meaning of .

If we also have Boolean expressions over the state, ranged over by , then we can define the semantics of the while command:

Such a definition allows formal analysis of the behavior of programs, permitting the study of relations between programs. Important relations include simulation preorders and bisimulation. These are especially useful in the context of concurrency theory.

Thanks to its intuitive look and easy-to-follow structure, SOS has gained great popularity and has become a de facto standard in defining operational semantics. As a sign of success, the original report (so-called Aarhus report) on SOS (Plotkin81) has attracted more than 1000 citations according to the CiteSeer [1], making it one of the most cited technical reports in Computer Science.

Reduction semantics

[edit]

Reduction semantics is an alternative presentation of operational semantics. Its key ideas were first applied to purely functional call by name and call by value variants of the lambda calculus by Gordon Plotkin in 1975[3] and generalized to higher-order functional languages with imperative features by Matthias Felleisen in his 1987 dissertation.[4] The method was further elaborated by Matthias Felleisen and Robert Hieb in 1992 into a fully equational theory for control and state.[2] The phrase “reduction semantics” itself was first coined by Felleisen and Daniel P. Friedman in a PARLE 1987 paper.[5]

Reduction semantics are given as a set of reduction rules that each specify a single potential reduction step. For example, the following reduction rule states that an assignment statement can be reduced if it sits immediately beside its variable declaration:

To get an assignment statement into such a position it is “bubbled up” through function applications and the right-hand side of assignment statements until it reaches the proper point. Since intervening expressions may declare distinct variables, the calculus also demands an extrusion rule for expressions. Most published uses of reduction semantics define such “bubble rules” with the convenience of evaluation contexts. For example, the grammar of evaluation contexts in a simple call by value language can be given as

where denotes arbitrary expressions and denotes fully-reduced values. Each evaluation context includes exactly one hole into which a term is plugged in a capturing fashion. The shape of the context indicates with this hole where reduction may occur. To describe “bubbling” with the aid of evaluation contexts, a single axiom suffices:

This single reduction rule is the lift rule from Felleisen and Hieb's lambda calculus for assignment statements. The evaluation contexts restrict this rule to certain terms, but it is freely applicable in any term, including under lambdas.

Following Plotkin, showing the usefulness of a calculus derived from a set of reduction rules demands (1) a Church-Rosser lemma for the single-step relation, which induces an evaluation function, and (2) a Curry-Feys standardization lemma for the transitive-reflexive closure of the single-step relation, which replaces the non-deterministic search in the evaluation function with a deterministic left-most/outermost search. Felleisen showed that imperative extensions of this calculus satisfy these theorems. Consequences of these theorems are that the equational theory—the symmetric-transitive-reflexive closure—is a sound reasoning principle for these languages. However, in practice, most applications of reduction semantics dispense with the calculus and use the standard reduction only (and the evaluator that can be derived from it).

Reduction semantics are particularly useful given the ease by which evaluation contexts can model state or unusual control constructs (e.g., first-class continuations). In addition, reduction semantics have been used to model object-oriented languages,[6] contract systems, exceptions, futures, call-by-need, and many other language features. A thorough, modern treatment of reduction semantics that discusses several such applications at length is given by Matthias Felleisen, Robert Bruce Findler and Matthew Flatt in Semantics Engineering with PLT Redex.[7]

Big-step semantics

[edit]

Natural semantics

[edit]

Big-step structural operational semantics is also known under the names natural semantics, relational semantics and evaluation semantics.[8] Big-step operational semantics was introduced under the name natural semantics by Gilles Kahn when presenting Mini-ML, a pure dialect of ML.

One can view big-step definitions as definitions of functions, or more generally of relations, interpreting each language construct in an appropriate domain. Its intuitiveness makes it a popular choice for semantics specification in programming languages, but it has some drawbacks that make it inconvenient or impossible to use in many situations, such as languages with control-intensive features or concurrency.[9]

A big-step semantics describes in a divide-and-conquer manner how final evaluation results of language constructs can be obtained by combining the evaluation results of their syntactic counterparts (subexpressions, substatements, etc.).

Comparison

[edit]

There are a number of distinctions between small-step and big-step semantics that influence whether one or the other forms a more suitable basis for specifying the semantics of a programming language.

Big-step semantics have the advantage of often being simpler (needing fewer inference rules) and often directly correspond to an efficient implementation of an interpreter for the language (hence Kahn calling them "natural".) Both can lead to simpler proofs, for example when proving the preservation of correctness under some program transformation.[10]

The main disadvantage of big-step semantics is that non-terminating (diverging) computations do not have an inference tree, making it impossible to state and prove properties about such computations.[10]

Small-step semantics give more control over the details and order of evaluation. In the case of instrumented operational semantics, this allows the operational semantics to track and the semanticist to state and prove more accurate theorems about the run-time behaviour of the language. These properties make small-step semantics more convenient when proving type soundness of a type system against an operational semantics.[10]

See also

[edit]

References

[edit]
  1. ^ McCarthy, John. "Recursive Functions of Symbolic Expressions and Their Computation by Machine, Part I". Archived from the original on 2025-08-07. Retrieved 2025-08-07.
  2. ^ a b Felleisen, M.; Hieb, R. (1992). "The Revised Report on the Syntactic Theories of Sequential Control and State". Theoretical Computer Science. 103 (2): 235–271. doi:10.1016/0304-3975(92)90014-7.
  3. ^ Plotkin, Gordon (1975). "Call-by-name, call-by-value and the λ-calculus" (PDF). Theoretical Computer Science. 1 (2): 125–159. doi:10.1016/0304-3975(75)90017-1. Retrieved July 22, 2021.
  4. ^ Felleisen, Matthias (1987). The calculi of Lambda-v-CS conversion: a syntactic theory of control and state in imperative higher-order programming languages (PDF) (PhD). Indiana University. Retrieved July 22, 2021.
  5. ^ Felleisen, Matthias; Friedman, Daniel P. (1987). "A Reduction Semantics for Imperative Higher-Order Languages". Proceedings of the Parallel Architectures and Languages Europe. International Conference on Parallel Architectures and Languages Europe. Vol. 1. Springer-Verlag. pp. 206–223. doi:10.1007/3-540-17945-3_12.
  6. ^ Abadi, M.; Cardelli, L. (8 September 2012). A Theory of Objects. Springer. ISBN 9781441985989.
  7. ^ Felleisen, Matthias; Findler, Robert Bruce; Flatt, Matthew (2009). Semantics Engineering with PLT Redex. The MIT Press. ISBN 978-0-262-06275-6.
  8. ^ University of Illinois CS422
  9. ^ Nipkow, Tobias; Klein, Gerwin (2014). Concrete Semantics (PDF). pp. 101–102. doi:10.1007/978-3-319-10542-0. ISBN 978-3-319-10541-3. Retrieved Mar 13, 2024.
  10. ^ a b c Xavier Leroy. "Coinductive big-step operational semantics".

Further reading

[edit]
[edit]
女人吃枸杞有什么好处 狗下崽前有什么征兆 什么颜色的猫最旺财 糖精对人体有什么危害 为什么减肥不建议喝粥
走胎是什么意思 右肋骨疼是什么原因 舌苔发白厚吃什么药 殿试是什么意思 ecg医学上什么意思
羊汤放什么调料 梦见中奖了预兆什么 朱元璋是什么生肖 一天吃一个苹果有什么好处 ph值是什么意思
哮喘吃什么药最有效 腊月初八是什么星座 白脸代表什么 临床是什么意思 球虫病有什么症状
momax是什么牌子hcv9jop0ns0r.cn 梦见放鞭炮是什么意思ff14chat.com 老年人屁多是什么原因hcv8jop2ns2r.cn 胸口闷痛什么原因引起的hcv7jop7ns0r.cn 抗生素是什么hcv9jop4ns1r.cn
为什么会甲减hcv9jop0ns0r.cn 祖字五行属什么hcv8jop4ns6r.cn 仓鼠怀孕有什么特征hcv9jop5ns8r.cn 9月9号是什么星座hcv8jop7ns3r.cn 梦见抓了好多鱼是什么意思hcv8jop0ns4r.cn
眩晕症是什么原因引起hcv9jop2ns3r.cn 术后恢复吃什么好hcv8jop2ns5r.cn 婴儿反复发烧是什么原因引起的hcv7jop6ns2r.cn dj管是什么hcv8jop9ns9r.cn 7月14日是什么日子hcv8jop9ns9r.cn
扁豆长什么样子图片hcv8jop9ns5r.cn 化橘红是什么东西1949doufunao.com 打call是什么意思hcv9jop0ns6r.cn 糯叽叽什么意思adwl56.com 血氨高是什么原因wuhaiwuya.com
百度