A Formal Semantics on Net Delay in Verilog-HDL

合集下载

OMEGA “Correct Development of Real-Time Embedded

OMEGA “Correct Development of Real-Time Embedded

Softw Syst ModelDOI10.1007/s10270-006-0043-7S P E C I A L S E C T I O N PA P E RSupporting UML-based development of embedded systems by formal techniquesJozef Hooman·Hillel Kugler·Iulian Ober·Anjelika Votintseva·Yuri YushteinReceived:20December2005/Revised:2October2006/Accepted:9October2006©Springer-Verlag2007Abstract We describe an approach to support UML-based development of embedded systems by formal techniques.A subset of UML is extended with timing annotations and given a formal semantics.UML models are translated,via XMI,to the input format of formal tools,to allow timed and non-timed model checking and interactive theorem proving.Moreover,the Play-Engine Communicated by Dr.Susanne Graf.This work has been supported by EU-project IST33522–OMEGA“Correct Development of Real-Time Embedded Systems in UML”.For more information,seehttp://www-omega.imag.fr/.During this project,the second author was at the Weizmann Institute of Science,the third author at VERIMAG,the fourth author at OFFIS,and thefifth author at NLR.J.Hooman(B)Embedded Systems Institute,Eindhoven,The Netherlandse-mail:hooman@cs.ru.nlJ.HoomanRadboud University,Nijmegen,The NetherlandsH.KuglerNew York University,New York,NY,USAe-mail:kugler@I.OberToulouse-II University,Toulouse,Francee-mail:ober@univ-tlse2.frA.VotintsevaCT SE1Siemens AG,Munich,Germanye-mail:anjelika.votintseva@Y.YushteinCIMSOLUTIONS B.V.,Vianen,The Netherlandse-mail:yushtein@xs4all.nl tool is used to execute and analyze requirements by means of live sequence charts.We apply the approach to a part of an industrial case study,the MARS system,and report about the experiences,results and conclusions.Keywords Formal methods·UML·Embedded systems·Real-time1IntroductionWe report about our results and experiences on com-bining a number of formal techniques with UML-based development.This work has been carried out in the con-text of the EU project OMEGA(Correct Development of Real-Time Embedded systems in UML).A general aim of this project is to improve the quality of software for embedded systems by the use of formal techniques.Embedded systems typically have an intensive real-time interaction with their environment.Although UML [3]has not been designed originally for such systems,one can observe an increasing use of object-oriented tech-niques and UML in this domain.There exists a num-ber of specialized methods[43,11],a UML profile for Schedulability,Performance and Time[35]and several dedicated CASE tools(e.g.,Artisan’s Real-time Stu-dio,Rhapsody of I-Logix,Rational Rose RealTime,and Telelogic TAU).Embedded applications typically have strong require-ments on the correctness of the software.This,however, is not easy to achieve,since these applications are typi-cally highly innovative,have intricate assumptions about the behavior of their environment,and are developed quite incrementally.Hence,it is important to detect errors as soon as possible during the development pro-cess.In this paper,we address the use of formal methodsJ.Hooman et al.to improve the quality of UML-based development of embedded systems.There exists already a number of formal techniques that have been applied to UML[41,30].Early approaches to formal verification based on model check-ing UML models actually only consider single sub-languages of UML,like statecharts[29,26],and they effectively verify only a single object in isolation.The vUML tool[38]provides a predefined set of checks of invariants,e.g.,absence of deadlocks,queue overflows, and unreachability of invalid states.The specification language of[44]is the temporal logic of the underlying model checker,hence far from the level of UML.The work on model checking of xUML[46]is closest to the UVE approach described in this paper.A rich set of UML language concepts and features,like parallelism, inheritance,object creation/destruction,etc.are sup-ported by the xUML approach.But it only deals with closed systems without taking a non-deterministic envi-ronment into account.Moreover,the used requirement specification language is restricted to a set of temporal patterns and has no graphical representation.Related to the IFx tool considered in this paper for model checking real-time properties is the translation of timed UML state machines[24]to Uppaal[28].Relevant is also the work in the context of the Fujaba real-time tool suite for UML-based development on the integra-tion of Uppaal[7].To support interactive verification of untimed UML models,a development environment has been developed[45],based on the theorem prover PVS[36].A proposal for a general framework to inte-grate tools for UML and formal methods can be found in[32].However,most techniques are not coupled to CASE tools and are based on a very small subset of UML. Often,it is difficult to express timing properties con-veniently and at a sufficient level of abstraction,and assumptions about the environment can usually be expressed only by including the environment explic-itly in the model,leading to a closed system.In the OMEGA project we investigated how this situation can be improved.We mention a few important points of the OMEGA approach:a tight integration of formal tech-niques in the development process,a sufficiently large subset of UML which allows convenient modeling of embedded systems,and the combination of techniques.To be able to integrate formal techniques,we have established a coupling with commercial UML-based CASE tools by translating the standard XMI repre-sentation of a UML model into the format of formal tools,such as model checkers and theorem provers.In this way,the formal tools can be applied to a UML model that has been edited by means of any commercial UML-based CASE tool which is able to generate XMI. Although XMI is the XML standard for UML,unfor-tunately,most current UML tools use slightly different versions of XMI.In OMEGA we have concentrated on the XMI versions of Rational Rose and Rhapsody of I-Logix.The latter has been used for all experiments described in this paper.To obtain a coherent set of tools,without having to deal immediately with the full UML language,we have defined a convenient subset of UML,called the OMEGA kernel language,which is close to the core UML language described in[13].Basically,this consists of class diagrams for specifying the structure of the sys-tem,including structural relationships like generaliza-tion,association,and composition,and state machines to describe the behavior of classes.Objects may communi-cate by means of(asynchronous)signals and operations.The language has been extended with suitable prim-itives to express real-time behavior.Timing extensions have been proposed,called the OMEGA real-time pro-file for UML,based on the profile for Schedulability, Time and Performance.Details can be found in[12]. The sequence diagrams of UML have been replaced by LSCs[8]which are more expressive[25]and also have been extended with primitives to express timing[19]. LSCs can be captured by the user by means of a sepa-rate tool,the Play-Engine.Note that our work on UML was mainly based on UML1.4,since that was the stan-dard during most of our project.Because we concentrate on the core modeling capability of UML,the differences with UML2.0[34]are not very relevant.Clearly the coherence of this tool set also requires a common semantic model.Within OMEGA,this led to extensive discussions and decisions on semantic varia-tion points and unclear issues in the definition of UML. Our starting point was an operational semantics[10,9] which was especially inspired by the execution mecha-nism of Rhapsody.Whereas many formal methods requireflat state machines,this semantics also includes hierarchy and orthogonality which is convenient for modeling.This semantic model,based on labeled tran-sition systems,turned out to be convenient for the inte-gration of the commercial tool and model checking.We reformulated the semantics to make it more suit-able for interactive theorem proving.For instance,we abstracted from the pending request table for operation calls in[9]and used explicit synchronization between caller and callee.Moreover,the semantics has been defined in an incremental way,starting from a basic non-timed semantics.This has been extended with a continuous notion of time in an orthogonal way.Sim-ilarly,threads of control have been added in a modular way.More details can be found in[23],which clarifies aSupporting UML-based development of embedded systems by formal techniquesnumber of semantic questions and decisions,e.g.,con-cerning the passing of control and the dispatching of signal events.Another relevant aspect of the OMEGA approach is the combination of various formal techniques,to obtain flexible support with e.g.,various specification styles, different visualizations,the possibility to deal with both closed and open systems—with assumptions about the environment,and both automated checks and user guided verification,depending on the properties to be verified.By experimenting with various tools on indus-trial examples,the aim is to derive guidelines about when and how to use the formal techniques.In particular,we consider the support of UML-based development by the following four formal techniques:–Live Sequence Charts(LSCs),to capture specifica-tions,using the Play-Engine tool–Model checking of functional properties by means of the UVE tool–Timed model checking,using the IFx tool–Interactive verification supported by the PVS theo-rem proverMore details about these techniques will be given in Sect.3.The main aim of this paper is to describe the appli-cation of the formal techniques to UML models of an industrial case study,which has been provided by one of the industrial partners of the OMEGA project.We pres-ent the results of applying thefirst versions of the devel-oped tools to the original model,leading to an interme-diate conclusion about what had to be improved.Next the application has been remodeled and we put more emphasis on the combined application of the improved tools.In general,the emphasis of this paper is on global results,experiences with the case studies,and general conclusions.Hence,we will neither expose all features of the techniques used,nor show the full functionality of all tools.During the case study we have often used preliminary versions of the tools,and the experiments illustrate tool development within the OMEGA project. Moreover,note that the aim is not to compare the tools, which would also be difficult because they have different goals and are rather complementary.Instead,the focus is on the synergy of the approaches and the possibilities to exploit the combination of the tools.The rest of this paper is structured as follows.In Sec-tion2we introduce the industrial case study,the UML model of a part of it,and the properties to be verified for this part.Section3contains a brief introduction to the four formal techniques used,illustrated by their applica-tion to the UML model of the case study.Next,in Sect.4 we redesign the considered part of the case study,to facilitate compositional techniques and abstraction,and apply the OMEGA techniques to this new model.An evaluation of the specification and verification experi-ments is presented in Sect.5.Finally,concluding remarks can be found in Sect.6.2The MARS systemWe describe a selected part of the MARS system (Medium Altitude Reconnaissance System)from the NLR.1This system has been used as a common real-time embedded application within the OMEGA project.The system controls the operation of a reconnais-sance photo camera in an aircraft;ground survey pho-tographs are taken by the camera during theflight.To obtain high-resolution images,the MARS system coun-teracts the image quality degradation caused by the for-ward motion of the aircraft by creating a compensation motion of thefilm during thefilm exposure,based on the current aircraft altitude,ground speed,etc.The sys-tem also performs health monitoring and alarm process-ing functions.The Reconnaissance Control Unit(RCU) is responsible for the three major categories of tasks: camera andfilm exposure control,film annotation,and system health monitoring and alarm processing.In order to perform the camera andfilm-exposure control functions the RCU acquires the current altitude and velocity data from the avionics data bus of the air-craft.Based on these values it computes thefilm Frame Rate to be used and the value for the Forward Motion Compensation(FMC)signal.The computed values are sent to the trigger and exposure module via a serial link.To perform thefilm annotation functions,the RCU acquires the current navigation data(latitude,longitude and heading)as well as the time-of-day value from the avionics data bus of the aircraft.It formats the data and sends it to the annotation module via the serial link. Upon completion of each frame exposure,the camera halts thefilm and issues an annotation request to the annotation module.Upon reception of this request the annotation module provides the current annotation data to the camera to annotate the current frame.The anno-tation cycle must be completed before the next frame exposure begins.The navigation and altitude data messages are pro-vided by the corresponding subsystems of the aircraft. These data sources are independent and not synchro-1National Aerospace Laboratory,the Netherlands,http:// www.nlr.nl.J.Hooman et al.nized;they provide data with a period P of25ms and a jitter J of±5ms(i.e.data may arrive up to5ms earlier or later).Data messages may occasionally be lost due to transmission errors.The system has hard timing constraints,such as requirements on the age of data used for exposure con-trol,on the data acquisition and on processing time in order to accommodate the data rate of the avionics data bus.The system is mission-critical as it is used for medium altitude reconnaissance missions over poten-tially hostile territories.Corrupted mission results will involve unnecessary additional risks to both the air-craft and the pilot in repeated attempts to execute the mission.2.1UML model of part of the MARS systemHere we present only a small part of the complete sys-tem,namely the data bus manager which is part of the data acquisition subsystem of the MARS system;the class diagram is given in Fig.1.For simplicity,we often refer to the DatabusManager as the MARS system.The focus is on the classes ControllerMonitor and Message-Receiver in an environment represented by the classes DatabusController,altDataSource,and navDataSource. The last two actors represent the data sources for alti-tude and navigation data.The main class is the Mes-sageReceiver which processes the incoming data.The controller monitor periodically calls an operation of the bus controller to obtain its status.In case of an error the monitor will send the evControllerError signal to the message receiver.The monitor sends the evControlle-rOK signal to the receiver if the bus controller indicates that the error situation is resolved.For each class the behavior of its objects is defined by means of a state machine and methods(program text)for its so-called primitive operations.Non-primi-tive operations of a class are defined by means of its state machine(this is not used in the MARS case study).The state machine of the class DataSource,is depicted in Fig.2.It expresses that,non-deterministically,either data is sent,represented by primitive operation send-Data,or no data is transmitted.The primitive operation sendData is overridden by the subclasses altDataSource and navDataSource to generate events evAltDataMsg and evNavDataMsg,respectively.This state machine uses interval conditions on clocks to model the non-determinism introduced by the starting time and by jit-ter.All transitions here are interpreted as delayable according to the terminology of timed automata with urgency[4],meaning that once they are enabled,they will be taken before their time guard becomes false (unless they are disabled by some other discrete tran-sition).Together with usual non-Zenoness assumption, this guarantees in this example that the computation cannot get stalled in any state.The behavior of the MessageReceiver is modeled by the state machine diagram depicted in Fig.3.The speci-fication of the system expresses that a few failures from the data sources can be tolerated,but if one of theFig.1Class diagram of the data bus managerSupporting UML-based development of embedded systems by formal techniques Fig.2State machinediagram of a data sourceFig.3State machine diagram of the Message Receiversources fails to send data for three consecutive times, the receiver enters a BusError state.In state Operational failures are detected by the time-out of timers navDa-taTimer and altDataTimer.The number of consecutive failures of each data source is stored into failure coun-ters NavMsgTimeoutCount and AltMsgTimeoutCount. If one of these counters has value3,the receiver enters the bus error state(note that by the run to completion assumption adopted in UML,this will be done before accepting a new signal event).The receiver recovers from the bus error state if it receives correct data for at least two consecutive times from both data sources.In the BusError state,the coun-ters NavMsgCount and AltMsgCount are used to count consecutively accepted messages of each type.BusEr-ror is also the initial state,since the system should only be in state operational when sufficient messages have been received from both sources.State ControllerError is entered and exited based on the events received from the controller monitor.J.Hooman et al.Similarly,the behavior of the ControllerMonitor has been modeled by means of state machines.Details are not shown here,since the main focus is on the detection of failures of the data sources and the response to these failures.2.2Properties of the MARS systemDuring our verification experiments,we concentrated on the following two properties of the MARS system: 1.Timely detection of a Databus Controller error,leading to the ControllerError state of the Message Receiver,and proper recovery,i.e.returning to state BusError if the Controller is OK again.2.Timely detection of an error in the databus,basedon data message arrival monitoring,leading to state BusError,and proper recovery.These properties include timing constraints to specify maximum response times.As shown in Fig.4,for prop-erty2this can be split into two cases:–Maximal response time to errors.This is defined as the upper bound on the time R1between the moment the last message has been received froma faulty data source and the moment of the switch tostate BusError.–Maximal response time to recovery.This is defined as the upper bound on the time R2between the receipt of thefirst message in a series of correct messages and the actual moment of the switch to state Opera-tional.2.3Abstracting from real-timeOften system specifications are split into functional and non-functional(including timing)requirements.This provides an opportunity to apply non-timed modeling and verification to the functional properties.To investi-gate this on the MARS system,we have extracted a non-timed version of the message receiver by abstracting from the setting of timers to particular time-out values. In order to make message loss observable in this non-timed model,the signals evNavDataMsgTimeout and evAltDataMsgTimeout have been introduced.The data sources non-deterministically choose between sending a data message or sending a time-out event which models message loss.The state machine of the message receiver is depicted in Fig.5.3Applying OMEGA techniquesWe briefly describe the OMEGA techniques and mainly focus on the results of applying them to the MARS case study.We start with the LSCs in Sect.3.1,present func-tional and timed model checking by UVE and IFx in Sects.3.2and3.3,respectively,andfinally describe inter-active theorem proving by means of PVS in Sect.3.4.3.1LSCThe Play-Engine tool[20,21]supports the specification and execution of scenario-based requirements.The underlying language for requirement specification is that of live sequence charts(LSCs)[8].Live sequence charts are a powerful extension of the classical message sequence charts(MSCs)[48],that while retaining the intuitive spirit of MSCs,enhances their expressive power.LSCs distinguish between behaviors that may happen in the system(existential)from those that must happen(universal).Among other extensions they also allow specifying timing requirements[19]and generic properties using symbolic instances[31].The Play-Engine assumes a discrete time model and adopts the synchrony hypothesis.As mentioned above,one of the main extensions in LSCs—relative to classical MSCs—is the ability to distinguish between possible and mandatory behavior,Fig.4Response times of the message receiverSupporting UML-based development of embedded systems by formal techniquesFig.5Non-timed state machine diagram of the message receiver Fig.6High level systembehavior of camera controlJ.Hooman et al.using two types of charts.An existential chart describes a possible scenario in the system.Figure6depicts an exis-tential chart,as denoted by the dashed border,which represents a high level system behavior of the camera control.The vertical instances correspond to the partic-ipating objects—AvionicsDatabus,RCU,Exposu-reModule,Camera and the external object Control-Panel.Time progresses from top to bottom,thus the order of the events in this chart is NavData,AltDa-ta,ComputeFramerate,ComputeFMC,FrameRate, FMC,StartFilming,ActivateExposures,trig-gerExposure and FMC.In general,a scenario defines a partial order on the events appearing in the chart, where events on the same object line occur according to the visual order from top to bottom,and any given mes-sage can be received only after being sent.Since Fig.6is an existential chart,it specifies that there exists at least one run of the system which exhibits the sequence of events described above.An example of a universal chart appears in Fig.7.A universal chart contains a prechart(dashed hexagon), which specifies the scenario which,if successfully exe-cuted,forces the system to satisfy the actual chart body. In Fig.7the prechart starts with a time tick,followed by two assignments(first ADS_Time variable stores the global time,denoted by Time,and then AltSend vari-able stores the value of ADS_Time modulo the altitude data cycle AD_Cycle)and a condition which together check whether time has reached a multiple of the alti-tude data cycle AD_Cycle.If this is the case,the behav-ior specified in the main chart must follow.The main chart consists of an if-then-else construct;in this case the condition is a probabilistic choice,where with95% probability the altitude message is sent within5time units with no error and with5%probability there is an error with the altitude message.In a similar way the cyclic behavior for the navigation data is specified.The expressive power of universal charts,based on the pattern“prechart implies main chart”,forms the basis of an executable semantics for an LSC require-ment model.As a response to an external event or time progress,a prechart may be satisfied,thus triggering the system events in the main chart to be executed according to the partial order,and these events may in turn acti-vate additional universal charts.Play-out,the executable mechanism implemented in the Play-Engine tool,mon-itors progress along charts and performs system events in the main charts for universal charts that have been activated,trying to complete all universal charts suc-cessfully.As the events are being executed,their effects are visualized via a Graphical User Interface(GUI), thus providing an animation of the system behavior.The same GUI is used in an earlier stage called“play-in”to Fig.7Universal chart concerning the altitude data source capture the LSCs by demonstrating the scenarios,while the Play-Engine records the behavior in the from of an LSC,thus providing an intuitive way for capturing the scenario-based requirements.The work described here addresses the execution and the analysis of the require-ments rather then on the process of capturing them;the interested reader is referred to[20]for more informa-tion on play-in.Play-out is actually an iterative process where after each step taken by the user,the Play-Engine computes a super-step,which is a sequence of events carried out by the system as its response to the event input by the user.One of the problems with play-out in its origi-nal form is related to the inherent non-determinism allowed by the LSC language.LSCs is a declarative, inter-object language,and as such it enables formulating high level behavior in pieces(e.g.,scenario fragments), leaving open details that may depend on the implemen-tation.This non-determinism,although very useful in early requirement stages,can cause undesired under-Supporting UML-based development of embedded systems by formal techniquesspecification when one attempts to consider LSCs as the system’s executable behavior.The play-out mechanism of[20]is rather naive when faced with non-determinism, and makes essentially an arbitrary choice among the possible responses.This choice may later cause a viola-tion of the requirements,whereas by making a different choice the requirements could have been satisfied.To address this challenge,[15]introduces a more pow-erful technique for executing LSCs,called smart play-out.It takes a significant step towards removing the sources of non-determinism during execution,proceed-ing in a way that eliminates some of the dead-end exe-cutions that lead to violations.Smart play-out[15,16] uses verification methods,mainly model-checking,to execute and analyze LSCs.There are various modes in which smart play-out can work.In one of the modes, smart play-out functions as an enhanced play-out mech-anism,helping the execution to avoid deadlocks and vio-lations.In this mode,smart play-out utilizes verification techniques to run programs,rather than to verify them. In another mode,smart play-out is given an existential chart and asked if it can be satisfied without violating any of the universal charts.If it manages to satisfy the existential chart,the satisfying run is played out,provid-ing full information on the execution and reflecting the behavior via the GUI.3.1.1Results of LSC experimentsWe have specified a high-level requirements model for the MARS application using universal LSCs.To explore the behavior of the system,the model has been simu-lated using the play-out capabilities of the Play-Engine. During play-out the active charts are displayed with a line which specifies how much progress has been made by each instance,as shown in Fig.8.Existential charts were used to test and verify system behavior;they do not drive the execution,but can be traced during play-out mode(depicted by a magnifying glass containing the letter“T”in the upper left corner) showing the progress along the scenario as shown in Fig.9.Another example of an existential chart is depicted in Fig.10.In this scenario,after AltMsg(True)occurs at the BusController,the RCU sends receiveExpDa-ta to the ExposureModule.This scenario also includes a timing constraint;time is stored immediately after AltMsg(True)occurs and the timed condition speci-fies that no more than70time units should have passed before the receiveExpData is received.Being an existential chart,Fig.10implies that there is at least one run of the system satisfying this scenario.In early system design such charts serve as“sanitychecks”Fig.8Example of play-outshowing that certain desirable behavior can be exhibited by the system.The user can then run play-out mode and attempt to drive the system behavior to satisfy the chart by providing the appropriate external events.A system-atic way to check if a given existential chart can be sat-isfied by a set of universal charts is by invoking smart play-out with this query.If a satisfying run is found by smart play-out it will be displayed to the user,otherwise smart play-out proves that that it is impossible to satisfy the existential chart.The ability to prove that an exis-tential chart cannot be satisfied is an advantage of smart play-out over the“naive”play-out mechanism.We have used this capability in our model by setting existential charts to designate a scenario that should never occur (anti-scenario);if this existential chart is traced to com-pletion it indicates a problem in the design or in the specification of the universal charts.If smart play-out proves that this existential chart cannot be satisfied,we are guaranteed that this bad behavior is not allowed to occur.。

对温斯顿·丘吉尔《关于希特勒入侵苏联的演讲》的文体分析6200字

对温斯顿·丘吉尔《关于希特勒入侵苏联的演讲》的文体分析6200字

对温斯顿·丘吉尔《关于希特勒入侵苏联的演讲》的文体分析6200字本文从分析文体的角度出发对温斯顿·丘吉尔的著名演讲《关于希特勒入侵苏联的演讲》中所使用的文体手段进行了详尽的分析,引导读者赏析中大量使用的平行、重复、押韵、比喻等修辞手法是如何使演讲稿达到音、形、义的完美结合,进而对演讲文体的风格进行了简要的论述。

文体学;音位学;词汇和语法;语义学The style of writing to Winston Churchill“Speech on Hitler’sInvasion of the U.S.S.R.” is analysedLi TingThe detailed analysis the main body of a book has been carried out from angle style of writing means used by the middle starting off giving a lecture “give a lecture about that Hitler invades Soviet” to Churchillian Winston ? q famousness analysing style of writing, guides reader to award Xi paralleling in the original Da Liang Shi Yong, repeats, is in rhyme, allegory waits rhetoric gimmick has been that draft reaches the tone, the shape, righteous consummation combines how to make to give a lecture, the style of writing style has carried out brief discussion on to giving a lecture then.Stylistics; Phonemics; Vocabulary and grammar; SemanticsG89C1673-8209(2009)02-0236-02Written by Winston Churchill, Speech on Hitler’s Invasion of the U.S.S.R. is full of powerful thoughts, magnificent expressions and well-structured. At that time, the U.S.S.R. was in danger and the disaster would quickly turn to the British. The goal of this speech was to arouse British people and win the cooperation of the USA, so, this speech is persuasive as its functional tenor is concerned; so far as the personal tenor is concerned, it is formal. General features of this speech can be summarized as: this persuasive speech is the speaking of what is written to be spoken to an audience on a formal occasion, so it presents features of formal written language while exhibiting characteristics of the written mode with its highly logical organization of thoughts, closely-knit structure and formal language. Just as language is multifunctional, so style is multileveled: Stylistic features can be formed at the three distinct levels: ① The level of Phonology; ② The level of Lexis and Grammar; ③ The level of Semantics. In order to find out the items of stylistic significance in this famous speech, this paper aims at analyzing it from one level of its language to another.1 Stylistic features at the first level―phonological features.Repetition of the previous initial sound may arouse the addressees’ sensitivity to the sound quality of a text, which includes Alliteration, as in “dull, drilled, docile”, “for his hearth and home”,Assonance, as in “clanking, heel-clicking”, “cowing and tying”. Besides, when the phoneticsymbolism is concerned, explosive sounds like[b],[p],[t],[d],[g],[k]usually gives a feeling of suddenness and strength while liquids and nasals a sense of peace and harmony. Winston used a series of explosives like “dandified, dull, docile, drilled, brutish, plodding, etc.” to impress his audience with the violent aggression of the Nazi army.2 Stylistic features at the second level―grammatical and lexical features.As public speeches are intended to inform, to persuade, and to appeal, most sentences are statements, as is shown in Churchill’s speech with only one question and two commands used in the whole speech. We know that casual speech tends to use short sentences. But a glance at Churchill’s speech reveals that its sentences are mostly long and complex ones. Though there can be several clauses in a longer sentence, they mainly come after the main clause, which presents no difficulty for the audience to comprehend. There are no sentences that are incomplete or elliptical. These characteristics show the double traits of public speaking: it is formal as is required of written language, and it is yet not difficult to understand at the time of the delivery as is required of the spoken mode. Stressing the idea by using synonyms or repeating the same word impinges on the audience’s ears, adding force, clearness or balance to a sentence. Examples for this can be found in Winston’s speech, e.g. “We have but one aim and one single, irrevocable purpose.” “…for we must speak out now at once, without a day’s delay.”3 Stylistic features at the third level―semantic features.The level of semantics concentrates on how the cohesive devices, paragraphing, discourse patterning, rhetorical devices and role structures contribute to the meaning of the text as a whole. Here, we will mainly focus on the rhetorical devices used in the speech. Clear organization is vital to speech making. Persuasive speeches, especially policy speeches often fall into problem-solution order. In Churchill’s speech, he showed how serious the problem was and the real intension of the Nazi regime. After having convinced the audience, Churchill called them to act with united strength. Besides, rhetorical devices are also employed by Churchill to make his speech vivid and forceful. Parallel structures are not only even in structure, but also coherent in meaning. They function not only as a kind of rhetoric device, but as a means of coherence as well. With its repetition of the sentence structure, the theme of the speech is closely connected and clearly illustrated. With so many parallel structures, the whole speech goes on smoothly and logically. The use of many parallel structures in this speech has filled the speech with strength and clear logic, e.g. “We will never parley, we will never negotiate…” “Behind all this glare, behind all this storm…” Repetition of the same word at the beginning or end of successive clauses or sentences helps create a strong emotional effect. For example: “ Any man or state who… Any man or state who…”In conclusion, Churchill’s Speech on Hitler’s Invasion of the U.S.S.R. is very typical of public persuasive speeches, with its stylistic characteristics on semantic, grammatical, lexical and phonological levels. As an excellent combination of sound, form and meaning, this speech has no doubt made significant contributions in the history and the present.参考文献[1] 张汉熙.《高级英语》上册[M],北京:外语教学与研究出版社,1995[2]徐有志.《英语文体学教程》[M].高等教育出版社,2005[3]徐有志.《现代英语文体学》[M].开封:河南大学出版社,1992[4]秦秋白.《英语文体和文体要略》[M]. 上海:上海外语教育出版社出,2006[5]霍晓军.《从文体学角度看FROST的诗》[J]. 太原:太原教育学院学报,2004。

英语语义学 Semantics

英语语义学 Semantics

SemanticsSemanticsSemantics is the study of the meaning of linguistic units, words and sentences in particular.Semantics = Theory of MeaningIts goal is to reveal how language are matched with their proper meanings by the speakers of that language.Lexical semantics—the study of word meanings. it deals not only with the meanings of individual words but also the relationship between the meanings of different words.Compositional semantics—is concerned exclusively with the meanings of phrases and sentences.History of Semantics1893 - French linguist Breal coined ―semantique‖.1897 – Breal first use it as the science of meaning.1900 – Its English version came out.1980s – semantics began to be introduced into China.One of the most famous books on semantics is The Meaning of Meaning(1923). Semantic Triangle 语义三角Concept(meaning)refers tosymbolizesSymbol Thing(word)(referent)stands forThe Referential Theory 指称论Concept (Meaning): the mental image, the abstraction or generalization of objects of the same kind.Referent (Thing): the physical entity or actual object, event, idea or whatever if denoted by a word, phrase or expression.Concept VS. Referent (Thing)A referent may exist in the physical world.The concept is abstracted from the referent and labeled by a word.Sense 语义Sense is the inherent meaning of the linguistic form independent of situational context.It’s abstract and de-contextualized.Sense RelationsSense relations between wordsWords are in different sense relations with each other.There are generally 5 kinds of sense relations:1) synonymy 同义2) antonymy 反义3) hyponymy 上下义4) polysemy 一词多义5) homonymy 同音同形异义1. SynonymyIt is the sameness or close similarity of meaning.Words that are close in meaning are called synonyms.2. AntonymyIt is the oppositeness of meaning.Words that are opposite in meaning are antonyms.Oppositeness can be found on different dimensions:Gradable antonymyComplementary antonymyConverse antonymy (relational opposites)Gradable antonymy 分级反义词good/ bad, long /short, narrow/ wideThe members of a pair differ in terms of degree. The denial of one is not necessarily the assertion of the other. There are often intermediate forms between them.Not good≠badHot ---warm---cool---coldComplementary antonymy 互补反义词alive/ dead, male/ female, present/ absent, pass/ fail , boy/ girlIt is characterized by the feature that the denial of one member of the pair implies the assertion of the other and the assertion of one means the denial of the other.Converse antonymy 换位反义词(relational opposites关系对立反义词)buy/ sell, lend/ borrow, before /after,teacher/ student, above /belowThe members of a pair do not constitute a positive-negative opposition. They show the reversal of a relationship between two entities.ExerciseClassify the following pairs of antonyms:Gradable antonymyComplementary antonymyConverse antonymymarried-single male-female hot-coldgive-take big-small awake-asleepnorth-south logical-illogical win-losebuy-sell doctor-patient above-below3. Hyponymy上下义关系It is the sense relation between two words in which the meaning of one word is included in the meaning of another word.HyponymyMusical instruments ---piano flute guitar violin tuba tromboneFish---snapper salmon bass sole troutSalmon---chinook spring coho king sockey4. PolysemyA word is polysemic if it has more than one meaning.Wood:family treea geographical area with many trees5. HomonymyWhen two or more words are the same in pronunciation or in spelling or in both but different in meaning, they are called homonyms.3 types of homonyms:perfect homonyms(同音同形异义词)homographs(同形异义词)homophones (同音异义词).Perfect homonymsPerfect homonyms are words which are the same in both pronunciation and spelling but different in meaning.bank (银行、河岸)bear (容忍、生(孩子))sound (声音、完美的)HomographsHomographs are words which are the same in spelling, but different in pronunciation and meaning."bow" /bəʊ/ -----"弓―"bow" /bau/ -----"鞠躬"HomophonesHomophones are words which are the same in pronunciation, but different in spelling and meaning.tail / taleto / two / toopair / pearsee / seaI / eyepiece / peace。

An OCL Semantics Specified with QVT

An OCL Semantics Specified with QVT

An OCL Semantics Specified with QVTSlaviˇs a Markovi´c and Thomas Baar´Ecole Polytechnique F´e d´e rale de Lausanne(EPFL)School of Computer and Communication SciencesCH-1015Lausanne,Switzerland{slavisa.markovic,thomas.baar}@epfl.chAbstract.Metamodeling became in the last decade a widely acceptedtool to describe the(abstract)syntax of modeling languages in a con-cise,but yet precise way.For the description of the language’s semantics,the situation is less satisfactory and formal semantics definitions are stillseen as a challenge.In this paper,we propose an approach to specifythe semantics of modeling languages in a graphical way.As an example,we describe the evaluation semantics of OCL by transformation ruleswritten in the graphical formalism QVT.We believe that the graphicalformat of our OCL semantics has natural advantages with respect to un-derstandability compared to existing formalizations of OCL’s semantics.Our semantics can also be seen as a reference implementation of an OCLevaluator,because the transformation rules can be executed by any QVTcompliant transformation engine.1IntroductionModeling is an important activity in all engineering disciplines,including soft-ware development.While the general purpose modeling language UML has proven to be versatile enough for many different domains(see,e.g.,chapter 1of[1]),it has also been recognized that the structure and the behavior of the system under development can often be captured as well with a much simpler, domain-specific modeling language[2].UML and DSLs have much in common.Their abstract syntax is usually de-fined by a metamodel and UML’s core modeling concepts such as Class,Object, State,etc.can also be found,possibly under a different name,in many DSLs. If a DSL comprises a constraint language,i.e.a language to impose restrictions on the modeled system,then some core concepts of UML’s constraint language OCL such as model navigation,variable quantification and pre-defined functions are likely to be used.In this paper,we present a new approach to define the se-mantics of constraint languages formally.We illustrate our approach on a rather complex example,the semantics of OCL,but since our technique is based on gen-eral techniques such as metamodeling and model transformation,the semantics of other constraint languages can be defined in a similar way.This work was supported by Swiss National Scientific Research Fund under the reference number200020-109492/1.Before sketching existing approaches to define the semantics of OCL it isworthwhile to reflect the purpose and semantics of UML diagrams that can alsobe used without OCL constraints.A diagrammatic UML model describes thestructure and behavior of a system at a certain level of details.The structureof the system clarifies which states(in UML jargon also called snapshots)thesystem can have and the behavioral description imposes restrictions on systemchanges.The question on how a class diagram corresponds to the state spaceof the system it describes has particular relevance for our later considerations.This correspondence(or semantics)of class diagrams has been given in theliterature in many different forms,e.g.by an informal description(see UMLUser Guide[1]),by a mapping of classes into a set-theoretic domain(see[3]),bya metamodel of the semantic domain.The metamodel for the semantic domainbecame in UML1.x a part of the UML language standard because it is the basisfor object diagrams,which are used to visualize system states.The purpose of an OCL constraint is to make the already existing diagram-matic UML model more precise.For instance,a constraint attached as an invari-ant to a class shrinks the statespace to those states of the system,in which theconstraint is evaluated to true.A pair of OCL constraints(preCond,postCond)attached as pre-/postcondition to an operation op means that the implementa-tion of op can realize only those state transitions(preState,postState),for whichpostCond is evaluated in postState to true whenever preCond is evaluated inpreS to true.No matter for which purpose an OCL constraint is used(as an in-variant,as a guard,within pre-/postcondition),the semantics of the constraintcan always be reduced to the question,how the evaluation of a constraint ina given state is defined.In the literature,the evaluation function eval:Con-straint x State→{true,false,undefined}is defined either mathematically by structural induction over Constraint(see official OCL semantics,appendix Ain[4])or by embedding OCL into another logic[5].While these two approacheshave basically succeeded in describing the evaluation of OCL constraints in aformal,non-ambiguous manner,they still have some disadvantages.One draw-back is the gap between OCL’s official syntax definition(which is given as ametamodel)and the OCL syntax,given by structural induction,that is assumedin the semantics definition.The main,very related drawback,however,is under-standability.We made the experience that many of our students,who learnedOCL in our course,were quite reluctant to deepen their knowledge on OCLby reading the official mathematical semantics,just because it is presented ina format they are not very familiar with(in set theory).If the purpose of thesemantics is to inform the prospective OCL users about all the details of thelanguage,then the semantics should be given in a format OCL users are familiarwith.One technique how this can be achieved is metamodeling.Metamodels arealready frequently used in abstract syntax definitions.Metamodels are very ex-pressive and easy to understand for people who have a background in modeling(at least,these are our personal experiences we made with students).As men-tioned above,metamodeling has already been applied to cover also the semanticsof class diagrams.Even more,the section’Semantics Described using UML’in [4]presents already a metamodeling approach for the evaluation of OCL ex-pressions.We took this approach as a starting point but added some impor-tant improvements.The most striking difference is how the evaluation process is modeled:In[4],evaluation is modeled by Evaluation-metaclasses whereas in our approach this is described by transformation rules written in QVT.We also changed the metamodel of the semantic domain significantly for many reasons; one was to have a better representation of predefined datatypes.Our approach has been implemented using the QVT engine provided by Together Architect for Eclipse.To summarize,our semantics of OCL is specified with a metamodeling ap-proach using MOF,OCL and QVT as a formalism at the metalevel.Since QVT depends also heavily on OCL,there is the natural question if our approach does not describe the OCL semantics in terms of OCL and thus has fallen into the trap of meta-circularity.We have avoided this trap because the semantics of the OCL used at the metalevel is given by an external mechanism,in our case by the semantics implemented by the QVT engine of Together Architect.The de-pendency of our semantics definition on a tool implementation might be seen as a drawback but for the purpose of our semantics–to help OCL users to deepen their knowledge on the peculiarities of OCL evaluation–this is not really an ing a tool as an’anchor’for our OCL semantics has also signifi-cant advantages such as automatic tool support(note that our OCL semantics is fully executable by QVT engines)andflexibility(users can easily adapt the OCL semantics to their needs).The rest of the paper is organized as follows.In Sect.2,we sketch our ap-proach and show,by way of illustration,a concrete application scenario for our semantics.The steps the evaluator actually has to perform are formalized as graphical QVT rules in Sect.3.Section4contains related work,while Sect.5 draws some conclusion and points to problems,which we plan to address in the near future.2Our Metamodel Based Approach for OCL Evaluation In this section we briefly review the technique and concepts our approach relies on and illustrate with a simple example the evaluation of OCL constraints.2.1Official Metamodels for UML/OCLWe base our semantics for OCL on the official metamodels for UML and OCL. We support the lastfinalized version of OCL2.0[4]but since this version still refers to UML1.5[6]we were forced to support UML1.5instead of UML2.0. Figures1and2show the parts of the UML and OCL metamodels that are relevant for this paper.Please note that Fig.1contains also in its upper part a metamodel of the semantic domain of class diagrams.In add of3). thethe, it possible to clearly distinguish a datatype object from its value.Fig.3.Changed Metamodel for OCL -SemanticsStock inv :.capacity>self .numOfItemsFig.4.Example -Class Diagram and Snapshot2.3We example.In Fig.4,a shown.The model numOfItems ,both of number of items it class Stockrequires be smaller than the satisfies the attached invariant because for each instance of Stock (class Stock has only one(a)(b)(c)(d)Fig.5.Evaluation of OCL expressions seen as an AST:(a)Initial AST (b)Leaf nodes evaluated (c)Middle nodes evaluated (d)Complete AST evaluatedthat in this example we were not concerned about concrete binding of the self variable.The problem of variable binding is discussed in Sect.2.4.The initial idea of our approach is that an OCL constraint can be analogously evaluated by annotating directly the OCL metamodel instance instead of the AST.SnapshotFig.6.OCL Constraint Before Evaluationfrom Fig.yetbecause The been finished state(Fig.6)(Op-,thetwo 7and 3,Fig.7.OCL Constraint After Evaluation in a Given Snapshot variables to current values.The binding of variables is realized in the OCL meta-model by the class NameValueBinding,which maps one free variable name to one value.Every OCL expression can have arbitrarily many bindings,the only restriction is the uniqueness of variable names within the set of linked NameVal-ueBinding instances.In the invariant of the Stock example we have used one free variable self. Although self is a predefined variable in OCL,it can be treated the same way as all other variables,which are introduced in Iterator Expressions.For example, the invariants e l f.c a p a c i t y>s e l f.numOfItemscan be rewritten asStock.a l l I n s t a n c e s−>f o r A l l(s e l f|s e l f.cap acity>s e l f.numOfItems)The binding of variables is done in a top-down approach.In other words, variable bindings are passed from an expression to all its sub-expressions.Some expressions do not only pass the current bindings,but also add/change bindings. An example for adding new value-name bindings will be explained in more details in Sect.3where the evaluation rules for forAll expressions are explained.Figure8shows the process of binding passing on a concrete example.In the upper part,the initial situation is given:The top-expression already has one binding nvb for variable self.In the lower part of thefigure,all subexpressions of the top-expression are bound to the same NameValueBinding as the top-expression.3Evaluation Rules Formalized in QVTThe previous section has shown the main idea of our approach:we annotate all intermediate results of a constraint evaluation directly to the instance of the OCL metamodel.What has not been specified yet are the evaluation steps themselves,Fig.8.Binding Passingfor example,that an AttributeCallExp is always evaluated to the attribute value on that object to which the source expression of AttributeCallExp evaluates.In this section,we specify these evaluation steps formally in form of QVT rules.These rules are minimal in the sense that they do not capture any opti-mization for an efficient evaluation nor impose any restrictions on the evaluation ordering,unless they are really necessary.3.1QVTQVT is a recent OMG standard for model transformations(see[8]for a detailed account on QVT’s semantics),which are described by a set of transformation rules.For our application scenario of QVT rules,source and target model are al-ways instances of the same metamodel;the metamodel for UML/OCL including the small changes we have proposed in Sect.2.Each QVT rule consists of two patterns(LHS,RHS),which are(incomplete)instantiations of the UML/OCL metamodel.When a QVT rule is applied on a given source model,a LHS match-ing sub model of the source model is searched.Then,the target model is obtained by rewriting the matching sub model by a new sub model that is derived from RHS under the same matching.If more than one QVT rule match on a given source model,one of them is non-deterministically applied.The model transfor-mation terminates as soon as none of the QVT rules is applicable on the current model.3.2A Catalog of RulesTo specify the evaluation process,we have to formalize for each non-abstract subclass of metaclass OclExpression one or more QVT rules.Due to space limit, only the most important rules can be presented in this subsection.In order to give a representative selection of our rules,we categorized them according to the kind of expression they target:Navigation Expressions,OCL PredefinedOperations ,Iterator Expressions ,and Atomic Expressions .For each category,we discuss one or two rules in detail.The main goal is to demonstrate that the evaluation of all kinds of OCL expressions can be formulated using QVT in an intuitive way.Navigation Expressions OCL expressions of this category are instances of AttributeCallExp and AssociationEndCallExp .Such expressions are evaluated by ’navigating’from the object,to which the source expression is evaluated,to that element in the object diagram,which is referenced by the attribute or asso-ciation end.Before the source expression can be evaluated,the current binding of variables has to be passed from the parent expression to the sub expression.We show in Fig.9how the binding rule is defined for AttributeCallExp .When applying this rule,the binding of the parent object ace (represented by a link from ace to the multiobject nvb in LHS)is passed to subexpression o (a link from o to nvb is established in RHS).Analogous rules exist for all other kinds of OCL expressions which have subexpressions.For the (subclasses of)LoopExp (see below)one needs also additional rules for handling the binding because the subexpressions are evaluated under a different binding than the parent expres-sion.Fig.9.Attribute Call Expression Bindings Passingrule d ,in two state on which the evaluation is performed.Since the evaluation of OCL rules does not have any side-effect on the system state,the lower parts of LHS and RHS will always coincide.AssociationEndCallExp We discuss here only the case of navigating to an unordered association end with multiplicity greater than 1(the case of multi-plicities equal to 1is very similar to AttributeCallExp ).The rule shown in Fig.11Fig.10.Attribute Call Expression Evaluationspecifies that the value of aece is a newly created object of type SetTypeValue whose elements refer to all objects o2that can be reached from object o via a link for ae .Again,object o is the evaluation of source expression oe .The rule shown in Fig.11contains at few locations the multiplicities 1-1at the link between two multiobjects,for example at the link between le2and l .This is an enrichment of the official QVT semantics on links between two multiobjects.Standard QVTinFig.11.Association End Call Expression Evaluation that Results in Set of ObjectsOCL Predefined Operations Expressions from this category are instances of the metaclass OperationCallExp but the called operation is a predefined one, such as+,=.These operations are declared and informally explained in the chapter on the OCL library in[4].As an example,we explain in the following theFig.13.Equal Operation Evaluation for IntegersFig.14.ForAll-Evaluation RulesIterator Expressions Iterator expressions are those in OCL which have as the main operator one from select,reject,forAll,iterate,exists,collect or isUnique.Since all these expressions can be expressed by macros based on iterate,it would be sufficient to refer for their semantics just to the semantics of iterate.We show here nevertheless a semantics for forAll,that is independent from the semantics of iterate.The rules describing the semantics of forAll are, compared with iterate,easier to understand,but contain already all mecha-nisms needed to describe iterate(see Fig.14).The rule ForAll-Initialisation makes a copy of evaluation of the source ex-pression,and assigns it under the role current to ie.Furthermore,the role intermediateResult is initialized with true and,for some technical reasons,the attribute freshBinding of ie is set to false and the evaluation of body expression oe is also initialized with true.The rule ForAll-IteratorBinding updates the binding on body expression oe for the iterator variable v with a new value vp.The element with the same value vp is chosen from the collection current and is removed afterwards from this collection.The attribute freshBinding is set to true and the evaluation of body expression oe is removed(note that the binding for oe has changed and the old evaluation of oe became obsolete).The rule ForAll-IntermediateEvaluation updates the intermediateResult of ie based on the new evaluation of oe.Furthermore,the value of attribute fresh-Binding isflipped.Thefinal rule ForAll-evaluation covers the case when the collection current of ie is empty.In this case the value of ie is set to that value which intermedi-ateResult currently has.Atomic Expressions This category consists of expressions such as LiteralExp and VariableExp that do not have any subexpressions.As an example we present rules for these two cases.In Fig.15,the evaluation of IntegerLiteralExp is shown. By applying this rule,a new IntegerValue is created that refers to the same integer as attribute integerSymbol in ie.Note,that this type of expressions does not need variable bindings because their evaluation does not depend on the evaluation of any variable.Figure16shows the evaluation rule for VariableExp. When this rule is applied,a new link is created between VariableExp and the value to which NameValueBinding,with the same name as VariableDeclaration, is connected.Fig.15.Integer Literal Expression EvaluationFig.16.Variable Expression Evaluation4Related WorkThe only paper we are aware of that shares similar interests in applying a graph-transformation based approach in order to deal with OCL constraints is[9].In this paper,a graphical visualization of OCL constraints is proposed.On top of this notation,simplification rules for OCL constraints are proposed,that implicitly also define a semantics for OCL.However,the semantics of OCL is not developed as systematically as in our approach,only the simplification rules for select are shown.Since[9]was published at a time where OCL did not have an official metamodel,the graph-transformation rules had to be based on another language definition.For a different kind of languages,behaviorial languages,Engels et al.define in[10]their dynamic semantics in form of graph-transformation rules,which are similar to our QVT rules.As an example,the semantics of UML statechart diagrams is presented.St¨a rk et al.define in[11]a formal semantics of Java.Even if they use a com-pletely different notation to specify an operational semantics,we see nevertheless a lot of striking similarities.St¨a rk et al.map the state space of a Java program to an Abstract State Machine(ASM)and describe possible state changes by a set of ASM rules that manipulate the Abstract Syntax Tree of a program.As shown in our motivating example,there are no principal differences between an AST and an instance of the metamodel.Also,ASM and QVT rules are based on the same mechanisms(pattern matching and rewriting).5Conclusions and Future WorkWe developed a metamodel-based,graphical definition of the semantics of OCL. Our semantics consists of a metamodel of the semantic domain(we slightly adapted existing metamodels from UML1.x)and a set of transformation rules written in QVT that specify formally the evaluation of an OCL constraint in a snapshot.To read our semantics,one does not need advanced skills in mathe-matics or even knowledge in formal logic;it is sufficient to have a basic under-standing of metamodeling and QVT.The most important advantage,however, is theflexibility our approach offers to adapt the semantics of OCL to domain-specific needs.Since the evaluation rules can directly be executed by any QVT compliant tool,it is now very easy to provide tool support for a new dialect of OCL.This is an important step forward to the OMG’s vision to treat OCL as a family of languages.We are currently investigating how an OCL semantics given in form of QVT rules can be used to argue on the semantical correctness of refactoring rules for UML/OCL,which we have defined as well in form of QVT rules.A refac-toring rule describes small changes on UML class diagrams with attached OCL constraints.A rule is considered to be syntactically correct if in all applicable situations the refactored UML/OCL model is syntactically well-formed.We call a rule semantically correct if in any given snapshot the evaluation of the originalOCL constraint and the refactored OCL constraint yields to the same result(in fact,this view is a simplified one since the snapshots are sometimes refactored as well).To argue on semantical correctness of refactoring rules,it has been very handy to have the OCL semantics specified in the same formalism as refactoring rules,in QVT.A more detailed description together with a complete argumen-tation on the semantical correctness of the MoveAttribute refactoring rule can be found in[12].Another branch of future activities is the description of the semantics of pro-gramming languages with graphical QVT rules.Our ultimate goal is to demon-strate that also the description of the semantics of a programming language can be given in an easily understandable,intuitive format.This mightfinally con-tribute to a new style of language definitions where the semantics of the language can be formally defined as easy and straightforward as it is today already the case with the syntax of languages.References1.Grady Booch,James Rumbaugh,and Ivar Jacobson.The Unified Modeling Lan-guage User Guide.Addison-Wesley,second edition,2005.2.Marjan Mernik,Jan Heering,and Anthony M.Sloane.When and how to developdomain-specific languages.ACM Computing Surveys,37(4):316–344,2005.3.Mark Richters.A precise approach to validating UML models and OCL con-straints.PhD thesis,Bremer Institut f¨u r Sichere Systeme,Universit¨a t Bremen, Logos-Verlag,Berlin,2001.4.OMG.UML2.0OCL Specification–OMG Final Adopted Specification.OMGDocument ptc/03-10-14,Oct2003.5.Achim D.Brucker and Burkhart Wolff.A proposal for a formal OCL semanticsin Isabelle/HOL.In Victor Carre˜n o,C´e sar Mu˜n oz,and Sofi`e ne Tashar,editors, TPHOLs,volume2410of LNCS,pages99–114.Springer,2002.6.OMG.UML1.5Specification.OMG Document formal/03-03-01,March2003.7.OMG.UML2.0Infrastructure Specification.OMG Document ptc/03-09-15,Sep2003.8.OMG.Meta object facility(MOF)2.0Query/View/Transformation Specification.OMG Document ptc/05-11-01,Nov2005.9.Paolo Bottoni,Manuel Koch,Francesco Parisi-Presicce,and Gabriele Taentzer.Consistency checking and visualization of OCL constraints.In UML2000,volume 1939of LNCS,pages294–308.Springer,2000.10.Gregor Engels,Jan Hendrik Hausmann,Reiko Heckel,and Stefan Sauer.Dynamicmeta modeling:A graphical approach to the operational semantics of behavioral diagrams in UML.In UML2000,volume1939of LNCS,pages323–337.Springer, 2000.11.Robert F.St¨a rk,Joachim Schmid,and Egon B¨o rger.Java and the Java VirtualMachine-Definition,Verification,Validation.Springer,2001.12.Thomas Baar and Slaviˇs a Markovi´c.A graphical approach to prove the semanticpreservation of UML/OCL refactoring rules.In Proceedings,Sixth International Andrei Ershov Memorial Conference,Perspectives of System Informatics(PSI), Novosibirsk,Russia,LNCS.Springer,July2006.To appear.。

semantics知识点总结

semantics知识点总结

semantics知识点总结Semantics is the study of meaning in language. It is concerned with how words and sentences are interpreted, how meaning is assigned to linguistic expressions, and how meaning is inferred from language. In this summary, we will explore some key concepts and topics in semantics, including the following:1. Meaning and reference2. Sense and reference3. Truth-conditional semantics4. Lexical semantics5. Compositional semantics6. Pragmatics and semantics7. Ambiguity and vagueness8. Semantic changeMeaning and referenceMeaning is a fundamental concept in semantics. It refers to the content or interpretation that is associated with a linguistic expression. The study of meaning in linguistics is concerned with understanding how meaning is established and conveyed in language. Reference, on the other hand, is the relationship between a linguistic expression and the real world entities to which it refers. For example, the word "dog" refers to the concept of a four-legged animal that is commonly kept as a pet. The study of reference in semantics is concerned with understanding how words and sentences refer to objects and entities in the world.Sense and referenceThe distinction between sense and reference is an important concept in semantics. Sense refers to the meaning or concept associated with a linguistic expression, while reference refers to the real world entities to which a linguistic expression refers. For example, the words "morning star" and "evening star" have the same reference - the planet Venus - but different senses, as they are used to describe the planet at different times of the day. Frege, a prominent philosopher of language, introduced this important distinction in his work on semantics.Truth-conditional semanticsTruth-conditional semantics is an approach to semantics that seeks to understand meaning in terms of truth conditions. According to this view, the meaning of a sentence isdetermined by the conditions under which it would be true or false. For example, the meaning of the sentence "The cat is on the mat" is determined by the conditions under which this statement would be true - i.e. if there is a cat on the mat. Truth-conditional semantics has been influential in the development of formal semantics, and it provides a formal framework for analyzing meaning in natural language.Lexical semanticsLexical semantics is the study of meaning at the level of words and lexical items. It is concerned with understanding the meanings of individual words, as well as the relationships between words in a language. Lexical semantics examines how words are related to each other in terms of synonymy, antonymy, hyponymy, and other semantic relationships. It also explores the different senses and meanings that a word can have, and how these meanings are related to each other. Lexical semantics plays a crucial role in understanding the meaning of sentences and discourse.Compositional semanticsCompositional semantics is the study of how the meanings of words and sentences are combined to create complex meanings. It seeks to understand how the meanings of individual words are combined in sentences to produce the overall meaning of a sentence or utterance. Compositional semantics is concerned with understanding the rules and principles that govern the composition of meaning in natural language. It also explores the relationship between syntax and semantics, and how the structure of sentences contributes to the interpretation of meaning.Pragmatics and semanticsPragmatics is the study of how language is used in context, and how meaning is influenced by the context of language use. Pragmatics is closely related to semantics, but it focuses on the use of language in communication, and how meaning is affected by factors such as the speaker's intentions, the hearer's inferences, and the context in which the language is used. While semantics is concerned with the literal meaning of linguistic expressions, pragmatics is concerned with the implied meaning that arises from the use of language in context.Ambiguity and vaguenessAmbiguity and vagueness are common phenomena in natural language, and they pose challenges for semantic analysis. Ambiguity refers to situations where a linguistic expression has multiple possible meanings, and it is unclear which meaning is intended. For example, the word "bank" can refer to a financial institution or the edge of a river. Vagueness, on the other hand, refers to situations where the boundaries of a linguistic expression are unclear or indistinct. For example, the word "tall" is vague because it is not always clear what height qualifies as "tall". Semantics seeks to understand how ambiguity and vagueness arise in language, and how they can be resolved or managed in communication.Semantic changeSemantic change refers to the process by which the meanings of words and linguistic expressions evolve over time. Over the course of history, languages undergo semantic change, as words acquire new meanings, lose old meanings, or change in their semantic associations. Semantic change can occur through processes such as metaphor, metonymy, broadening, narrowing, and generalization. Understanding semantic change is important for the study of historical linguistics and the diachronic analysis of language.ConclusionSemantics is a rich and complex area of study that plays a fundamental role in understanding the meaning of language. It encompasses a wide range of topics and concepts, and it has important implications for fields such as philosophy of language, cognitive science, and natural language processing. By exploring the key concepts and topics in semantics, we can gain valuable insights into how meaning is established and conveyed in language, and how we can analyze and understand the rich complexity of linguistic expressions.。

胡壮麟语言学课件Chapter 5_semantics

胡壮麟语言学课件Chapter 5_semantics

3. The meaning of meaning
C. K. Ogden & I. A. Richards (1923). The Meaning of Meaning.John means to write.A green light means to go.Health means everything.His look was full of meaning.What is the meaning of life?What does ‘capitalist’ mean to you?What does ‘cornea’ mean?
domicile: very formal, officialresidence: formalabode: poetichome: generalsteed: poetichorse: generalnag: slanggee-gee: baby language
Hale Waihona Puke 3.4 Affective meaning
3.2 Connotative meaning
The communicative value an expression has by virtue of what it refers to, over and above its purely conceptual content.A multitude of additional, non-criterial properties, including not only physical characteristics but also psychological and social properties, as well as typical features.

Under consideration for publication in Formal Aspects of Computing Concurrency and Refineme

Under consideration for publication in Formal Aspects of ComputingConcurrency and Refinement in the Unified Modeling LanguageJim Davies and Charles CrichtonOxford University Computing Laboratory,Wolfson Building,Parks Road,Oxford,UKAbstract.This paper defines a formal semantics for a subset of the Unified Modeling Language(UML). It shows how suitable combinations of class,object,state,and sequence diagrams can be associated with patterns of interaction,expressed in the event notation of Communicating Sequential Processes(CSP). The diagram semantics is then extended to give a meaning to complete models—suitable combinations of diagrams—and thus a concurrency semantics for object models written in UML.This model semantics is in turn used to define a theory of refinement,based upon existing notions of data and process refinement. Keywords:Unified Modeling Language;Object-oriented Design;Object Modelling;Concurrency;Refine-ment;Communicating Sequential Processes.1.IntroductionThe evolution of the Unified Modeling Language(UML)[OMG01]is of tremendous significance for the field of software engineering.The definition of a single framework in which to place the sketches,diagrams, pictures,and formulae that shape and communicate our understanding of complex designs is a welcome development,and the widespread acceptance of this framework makes it an ideal vehicle for the application of formal,mathematical techniques.In this paper,we show how object models described using the diagram notations of UML can be au-tomatically translated into a formal language of interaction:Hoare’s Communicating Sequential Processes (CSP)[Hoa85].The behavioural properties of these designs—the order in which messages may be sent, the possible consequences of concurrent execution of certain operations,whether a particular scenario is possible—can then be calculated and explored.We show also how the existing refinement orderings defined upon processes can be applied to the be-havioural refinement of object-oriented designs.The question of whether one design is a suitable refactoring of another can be reduced to a question of behavioural refinement:that is,a question of whether every behaviour of one design is allowed for in the description of the other.The resulting theory of refinement for object models is supported by existing refinement-checking technology[FSE].Our translation requires more than just a semantics for the individual diagram notations:it requires a Correspondence and offprint requests to:Jim Davies,Oxford University Computing Laboratory,Wolfson Building,Parks Road, Oxford,OX13QD,UK.e-mail:Jim.Davies@2J.Davies and C.Crichton behavioural semantics for the models that are produced when these notations are used in combination.We will express both diagram and model semantics in terms of CSP events and processes.As our aims include facilitating automatic analysis,we will employ the machine-readable dialect of CSP[Ros97],which can be used as input to animation and refinement-checking tools.The paper begins with a review of the various diagram notations that we have chosen to support: class diagrams,object diagrams,state(or statechart)diagrams,and sequence diagrams.This is followed, in Section3,by an explanation of how these diagrams can be given a behavioural semantics in terms of machine-readable CSP.In Section4,we show how the diagram semantics can be extended to give a meaning to complete object models,in terms of the sequences of actions that may be performed,and the sets of actions that may be blocked.We show how—by associating state diagrams with operations—we can create models that are adequate for the description of the concurrent execution of multiple operations upon the same object.This model semantics can be used to define theories of refinement for object models written in UML. In Section5,we show how different notions of process and data refinement can be put to practical use in the analysis and development of object models written in UML.The paper ends with a discussion of the prospects for automated analysis,and a review of related work.2.Object modellingA model in UML is a collection of diagrams,illustrating different aspects of a design,together with related properties or requirements.Each of these diagrams conveys some information about the architecture,at-tributes,and behaviour of the system being modelled.As we might expect,the UML documentation asserts that“Every complex system is best approached through a small set of nearly independent views of a model. No single view is sufficient.”[OMG01,Section1.2.2]We might expect,too,that two different models—two different combinations of diagrams—could be used as descriptions of the same system.To demonstrate the use of the different diagram notations,we will consider a model of a simple com-munication protocol,whose only dynamic property of interest(at our chosen level of abstraction)isflow control:the transmitter waits for an acknowledgement that a message has been output by the receiver before accepting another for transmission.In each case,our interpretation of the diagram notation will be just one or many possible interpretations: other semantics may be defined with different purposes in mind.Indeed,even the formal translations that we produce could be completed in different ways.The processes that we use to represent the implicit mechanisms for event communication and operation invocation are just one way of resolving the semantic variation points in the UML specification[OMG01].2.1.Class diagramsA class diagram identifies the entities in the system,and describes the potential relationships between them.It provides structure to a behavioural semantics—giving the signatures of objects—and places constraints upon reachable configurations,but does not directly describe the behaviour of any component.Such a diagram comprises a number of class boxes,and a number of lines—representing associations—between them.Each class box may have up to three partitions below the name box,listing attributes,operations,and signals,respectively.Some associations may be implemented as attributes:in this case,the value of the attribute is a reference to another object(or a collection of objects).An association line can show the navigability of the relationship(using arrowheads),its multiplicity,and the names used in reference.The operations of a class may be described as synchronous or asynchronous,and may be subject to different degrees of concurrency control:the concurrency attribute of an operation explains whether that operation may be invoked concurrently with other operations on the same object.The class diagram may describe also the signature of each operation:the argument and result types.A typical implementation for an UML operation is a method or function call in the target programming language.Signals are an abstract,asynchronous means of communication.Although signals may be implemented in the same way as operations,they are more likely to correspond to sequences of calls,perhaps involving the use of a package or library that has not been modelled.The class diagram may list the names of the signals that can be received by each class.Concurrency and Refinement in the UML3Fig.1.A class diagram for the simple protocolFig.2.An object diagram for the simple protocolA class diagram may include also information about inheritance:which classes are defined as extensions of others.This may have a bearing upon the behavioural semantics,in that there may be a choice of (implementations of)operations that could be invoked in response to a particular call.The structure of our semantics allows for the subsequent addition of a selection mechanism,but the automatic determination of such a mechanism from information in the class diagram is left as a subject for separate,future study.The class diagram for our simple protocol is given in Figure1;it identifies the two main protocol components—a transmitter and a receiver—as well as two abstract,interface entities—a user and a lis-tener.The association between the transmitter and the receiver tells us that each is capable of referring to the other.The transmitter will use the name rec for the receiver object that it knows about;the receiver will use the name trans for the transmitter object.The associations are all1to1:a user object will refer to a single transmitter object,a transmitter will refer to a single receiver,and a receiver will refer to a single listener.In this model,the listener is unable to refer to the receiver:the association between these two classes is navigable only in the other direction.All communication in this model is described in terms of signals:the user may send an in signal to the transmitter,which may send a message signal to the receiver,which may send an out signal to the listener. The receiver may send an ack signal to the transmitter,which may send a ready signal to the user.The class diagram tells us which events may be sent;the state diagram will tell us how the arrival of one event may trigger actions,such as the sending of another event.2.2.Object diagramsObject diagrams are class diagrams in which only instances—or objects—are present.Such a diagram can be used to describe a particular state of the system,or to characterise a region of the state space—each object may be annotated with a constraint upon attribute values.In a behavioural semantics,an object diagram can be used to describe an initial configuration.In the object diagram of Figure2,the association instance(or link)between transmitter and receiver is stereotyped as reliable,to indicate that signals are reliably transmitted between the objects.In UML,the fact that two objects are linked in an object diagram does not mean that communication between them is necessarily reliable,whether in terms of signal transmission or operation invocation.4J.Davies and C.CrichtonFig.3.State diagrams for the transmitter and receiver classes2.3.State diagramsA state diagram describes the behaviour of an object or operation in terms of the performance of actions in response to the arrival of events.We will consider two kinds of events:call events and signal events.The occurrence of a call event corresponds to the beginning on an execution of an operation upon the current object;the occurrence of a signal event corresponds to the successful arrival of a signal.The possible effects of an event are described by labelled transitions between states in the state diagram.Each transition may be labelled with a trigger event,a guard,and a sequence of actions.If an event occurs,and there is a corresponding transition starting from the current state,then the guard is evaluated.Should the guard prove to be true,based on the values of the object attributes,and any attributes associated with the event itself,then the sequence of actions will be performed:the future behaviour of the object is then described by the target state of the transition.Should the guard prove to be false,then the event will be discarded,and the object will remain in the current(source)state.Some of the transitions in a diagram may have no trigger events:these are called completion transitions, and arefired as soon as the source state is entered(and any entry actions have been completed).An important feature of the state diagram language is the run-to-completion property:following the occurrence of an event, no further events will be accepted until every action triggered by that event,including those associated with any subsequently-enabled completion transitions,has been performed.The state diagram notation contains many other features:notably,entry and exit actions,change events, prioritised and timed transitions,and composite states.The semantics of diagrams using entry and exit actions is easily derived from the semantics of equivalent diagrams in which these actions are prepended and appended to the relevant transitions.The other features require extensions to the semantics presented here: suitable extensions are discussed in Section7.Figure3presents two state diagrams:one for the transmitter class,and another for the receiver.A transmitter object can be in one of two states:it is ready for a new message from its client,or it is waiting for an acknowledgement from the receiver.The arrival of a new message m is represented by an occurrence of the event in(m);this has the effect of sending a signal message(m)to the receiver rec.There is no blocking of signal events:unless it is still completing a sequence of actions triggered earlier, an object will accept any signal.However,if there are no transitions labelled with that signal,and if it is not explicitly deferred by the current state,then the signal will be immediately discarded.In Figure3,if an in event arrives while the transmitter is in the Waiting state,then it will be discarded;similarly,if an ack arrives when the transmitter is in the Ready state,then it will be discarded.Concurrency and Refinement in the UML5Fig.4.A sequence diagram2.4.Sequence diagramsA sequence diagram describes a scenario in terms of messages sent between various objects.The messages are presented as horizontal lines labelled with the name of an event or operation.The objects are boxes with a vertical,broken line descending from them;the objects may be anonymous,or they may be named according to the attributes and associations presented in the class diagram for the current model.The vertical,broken lines—called lifelines—are used to impose a temporal order upon the messages presented.Where two message lines begin(or end)at the same lifeline,the message whose line is nearer the top of the diagram must be sent(or received)before the other.Moving down a lifeline corresponds to the passage of time.A sequence diagram may represent the creation(or destruction)of one of the objects involved by explicitly starting(or ending)a lifeline within the diagram.In the sequence diagram of Figure4,all of the objects have been created before the scenario,and none are destroyed during it.This diagram illustrates a desirable behaviour of our simple protocol,in which a single message m is passed from the User to the Listener via the two objects of our protocol.The features presented here form only a small subset of those available within the sequence and interaction diagram languages of UML.Our use of the notation here is purely as an indication of what could be achieved.2.5.Operation diagramsThe UML documentation admits the possibility of multiple,concurrent calls of operations upon a single object.Each operation has a concurrency attribute,which may take one of three values:•sequential:concurrent calls on the same object should be avoided;•guarded:concurrent calls are permitted,but the operations will be executed sequentially;each new execution will be blocked until the previous execution has completed;•concurrent:concurrent calls are permitted,and the operations may be executed concurrently;the cor-responding sequences of transitions and actions may be interleaved.This information—which would normally be presented in the class diagram—can be carried forward from the model to an implementation,using features such as the synchronized mechanism in Java.If we attempt to include information about the progress of multiple executions of different operations within a single‘object’state diagram,the result is likely to be unreadable.The possibility of concurrent execution multiplies the number of states that may be of interest;any operation may be associated with a state space of its own,describing its progress through the various actions and conditions that its performance may entail.The effect of an action may depend upon the value of temporary variables or objects—the local state of the current execution—as well as the value of object attributes.6J.Davies and C.CrichtonFig.5.Printer class diagramFig.6.Printer state diagramEven the behaviour of a class with a single operation could become difficult to describe if this operation had more than two points at which it reads from,or writes to,the attributes of the object.Such an approach would require also a relaxation of the run-to-completion assumption for state diagrams:if a single diagram is to describe the effect of concurrent execution,then the underlying state machine must be able to accept a second call event before the action sequence corresponding to thefirst has been completed.The only practical solution is to use a different state diagram for each compound operation:that is,for each operation that has more than one point of interaction with the shared state;the effect of any other, atomic operation can still be represented as a single transition,triggered by a call event,on the main state diagram.We will use the term operation diagram for a state diagram that has been used to describe the behaviour of an operation.As an example of this approach,consider how we might describe the behaviour of objects of the Printer class shown in Figure5.Objects of this class have a single,integer-valued data attribute called alarm,and two operations print and service;neither operation expects an argument or a return value.There are also several signals:start,stop,open,and close.The object state diagram for the printer class is shown in Figure6.This diagram does not include call events for either operation,but instead shows how the state space of the printer object can be partitioned into two regions:Idle and Printing.The difference between the two regions lies in the effect of the open event:if the current state of the printer is in Printing,then this event leads to a state in which all events will be ignored,and both operations will be blocked;this last effect is achieved by setting the single attribute alarm to a non-zero value.Each operation is described by a separate operation(state)diagram:both are shown in Figure7.The labelling of the initial transitions is a(suggested)notational short-cut,indicating that the execution should be blocked if this condition is not true.The same result can be produced by adding an additional state, immediately following the initial one,with a guarded choice of completion transitions.In this example,the two operations do not make assignments directly,but instead act upon the shared state by sending signals. Apart from fulfilling the original need for a model that can describe concurrent execution,this approach hasConcurrency and Refinement in the UML7Fig.7.Printer operation state diagramsthe additional advantage of separating two concerns:the definition of(an abstraction of)the state,and the description of the operations.We should emphasise that it is impossible to describe the effects of concurrent execution,or the invocation of an operation upon the current object,without adopting this operation diagram approach(as a corollary, we might observe that it is thus impossible to describe recursive operations in a single UML state diagram). The only alternative would be to relax the run-to-completion assumption,which would render the state diagram notation all-but-unusable.The language of operation diagrams is a sublanguage of that of state diagrams:an operation diagram cannot accept call events,except for the initial,implicit call event that creates an instance.The state diagram that describes the chosen abstraction of the attribute state may have call events,but only for operations that are atomic at the current level of abstraction.3.Diagram semanticsTo construct a formal semantics for a UML diagram,we require a mapping from the graphical constructs to some mathematical domain:this mapping is a formal equivalent of the existing informal semantics for the diagram language—an explanation of what each construct means.There are many ways in which we might define this mapping,depending upon the purpose to which the resulting semantics will be put.As is the case with programming languages,a likely purpose for a formal semantics is to predict and reason about patterns of behaviour.Architectural and static properties are relatively easy to deduce;it is behaviour—and in particular,concurrent behaviour—that is harder to comprehend.For that reason,we will concentrate upon the construction of a formal semantics that is adequate for the analysis of behaviour:one that tells us how the system as described may evolve,in terms of interactions visible at its interface.In this section,we explain how individual diagrams may be mapped to processes; in the following section,we will see how to combine these processes to obtain the semantics of a complete model.Our presentation here is exemplary:an explicit semantic function would need to map documents that define UML models to documents that define CSP representations.In this paper,we describe this function in terms of its effect upon simple UML models.Its implementation,which requires mechanisms for namespaces, dynamic binding,and polymorphic channels in CSP,is a challenge in itself.3.1.Process notationIn the language of CSP,processes are defined in terms of the occurrence and availability of abstract events: atomic,synchronous,communications.In the machine-readable dialect,events are introduced as elements of channels.For example,the declarationchannel c:A.B8J.Davies and C.Crichton introduces a set of compound events,each of the form c.a.b,where a is drawn from the set A and b is drawn from the set B.Following such a declaration,we may use the expression{|c|}to refer to all of the events whose names start with the prefix c.The prefix process a->P is ready to perform the event a;if this event is performed,the future behaviour of this process is described by term P.The symbol[]denotes an external choice of(sets of)behaviours:a menu of possible interactions.The external choice symbol may be used in both binary and indexed forms. For example,the process[]i:I@a(i)->P(i)represents an external choice over all of the processes a(i)->P(i):the resulting process is ready to engage in any event of the form a(i),for i in I,and then behave as the process P(i).The input choice expression c?x->P(x)represents an external choice in which every alternative begins with an event from the channel set{|c|}.The corresponding output expression c!v->P is no choice at all:any variables appearing in the value expression v must already have been declared.(The process language is declarative,in that any variable takes a value at the point of declaration,and retains that value for the remainder of its scope).We will often use a combination of?and!to abbreviate a complex,indexed external choice over a set of compound events,in which some components are already determined.The expression c?x!d?y!e->Pdenotes an external choice in which the values of x and y—the symbols preceded by a question mark—are drawn from the set of all possible values for that component of the channel,and the values of d and e are fixed.We might expect the future behaviour P to be parameterised by x and y.The internal choice symbol|˜|denotes an internal choice of(sets of)behaviours.A process described as P|˜|Q will behave as P or as Q.The choice is not exclusive,in that both alternatives may be made available.We use this notation to represent a choice made within the current component,or—at least—on the far side of this interface.For example,the(indexed)internal choice|˜|i:I@P(i)represents a component whose behaviour may be any of P(i).(In the machine-readable dialect,the indexing set I must befinite).The interrupt operator/\has the effect of adding an external choice to every event menu present in the expansion of itsfirst argument.For example,(a->b->P)/\Q=a->b->(P/\Q)[]Q[]QWe will use this operator P whenever we have a complex pattern of behaviour that may be interrupted—permanently—by the beginning of another pattern Q.Processes are usually composed using a binary parallel operator,which specifies the set of events to be shared between its two arguments:the set of events that can occur only if performed simultaneously by both processes.The expression P[|A|]Q denotes the parallel combination of two processes,P and Q,sharing every event in the set A.If the shared set is empty,we write|||,rather than[|{}|].Either form of parallel combination may be used in prefix,indexed form;as in the case of internal choice,the indexing set must befinite.In CSP,sharing does not entail concealment:shared events remain visible,and may be subsequently shared with other components.The hiding operator is used to conceal,or internalise,sets of events:the expression P\A denotes a process that behaves exactly as P,except that events from the set A are no longer visible:they may not be shared with,and do not require the cooperation of,other processes.As processes are defined entirely in terms of their(remaining)external events,use of the hiding operator may mean that the resulting process is undefined,or divergent.This situation is quite different from that of the(fully-defined) process STOP,which can perform no events,and is used to represent the end of a pattern of behaviour.Concurrency and Refinement in the UML9 The let...within...construct allows for the scoping of process names;definitions made between let and within apply only for the term immediately following within.There are Bool and Int datatypes, for Boolean and integer values,respectively.Other types may be introduced using datatype definitions;for example,the definitiondatatype BinaryTree=empty|node.Int.BinaryTree.BinaryTreedefines a type of binary trees with integer values at the nodes.This is only the briefest of introductions to the process language:a more comprehensive introduction can be found in[Hoa85]or[Ros97].3.2.Actions and eventsOur behavioural semantics will be defined as a translation from object models to processes.We must begin, however,with an explanation of how the actions and events of our object models are to be translated into abstract(CSP)events.With the exception of local actions,actions and events will be represented as a compound abstract events,in which two of the components are used to identify the source and target of the abstract communication.If the communication represents the semantics of an operation call,then it may produce one of three results:if the operation in question may be invoked concurrently,and thus has its own operation(state) diagram,then a new state machine will be created to process the event;if the operation may not be invoked concurrently,and does not have its own diagram,then the event will be processed by the state machine representing the object;if the operation is a constructor(a create operation),then it will be processed by the class,and a new state machine will be created,representing a new object.Each state machine will be represented as a separate process.The source and target of each abstract communication will be processes representing state machines: objects,operation executions,or classes.3.2.1.ActionsA call action corresponds to a call of an operation.The start of the action can be represented as a compound event of the formcallAction.from.to.operation.argumentswhere from is the reference of the source process,to is the reference of the target,operation is the name of the operation,and arguments are the call parameters.A return action corresponds to the completion of an operation,from the point of view of the called operation(and its associated object).It can be represented as a compound event of the form returnAction.from.to.operation.valuewhere to is the reference of the original caller object,from is the reference of the original target,and value is the returned value.A send action corresponds to the sending of a signal,and will be represented as a compound event of the formsendAction.from.to.signal.argumentswhere from is the reference of the caller object,to is the reference of the target,signal is the name of the operation,and arguments are the call parameters.A create action corresponds to the creation of a new object.In our semantics,this action will be repre-sented as a pair of compound events:the eventcallAction.from.to.create.argumentsrepresents the beginning of the action,and a corresponding returnEvent its completion.The value associated with this second event will be the reference of the new object created.A destroy action corresponds to the destruction of an object;this is an asynchronous operation,and may be represented as a single event of the form。

Frame Semantics(英文版)

Chapter 10Frame semanticsFrame semanticsCharles J. Fillmore1. IntroductionWith the term ‘frame semantics’ I have in mind a research program in empirical semantics and a descriptive framework for presenting the results of such research. Frame semantics offers a particular way of looking at word meanings, as well as a way of characterizing principles for creating new words and phrases, for add-ing new meanings to words, and for assembling the meanings of elements in a text into the total meaning of the text. By the term ‘frame’ I have in mind any system of concepts related in such a way that to understand any one of them you have to understand the whole structure in which it fits; when one of the things in such a structure is introduced into a text, or into a conversation, all of the others are automatically made available. I intend the word ‘frame’ as used here to be a general cover term for the set of concepts variously known, in the literature on natural language understanding, as ‘schema’, ‘script’, ‘scenario’, ‘ideational scaf-folding’, ‘cognitive model’, or ‘folk theory’.1Frame semantics comes out of traditions of empirical semantics rather than formal semantics. It is most akin to ethnographic semantics, the work of the anthropologist who moves into an alien culture and asks such questions as, ‘What categories of experience are encoded by the members of this speech community through the linguistic choices that they make when they talk?’ A frame semantics outlook is not (or is not necessarily) incompatible with work and results in formal semantics; but it differs importantly from formal semantics in emphasizing the continuities, rather than the discontinuities, between language and experience. The ideas I will be presenting in this paper represent not so much a genuine theory of empirical semantics as a set of warnings about the kinds of problems such a theory will have to deal with. If we wish, we can think of the remarks I make as ‘pre-formal’ rather than ‘non-formalist’; I claim to be listing, and as well as I can to be describing, phenomena which must be well understood and carefully described before serious formal theorizing about them can become possible.In the view I am presenting, words represent categorizations of experience, and Originally published in1982 in Linguistics in the Morning Calm,Linguistic Society of Korea(ed.), 111–137.Seoul:Hanshin Publishing Company.Reprinted with permission.374 Carles. J. Fillmoreeach of these categories is underlain by a motivating situation occurring against a background of knowledge and experience. With respect to word meanings, frame semantic research can be thought of as the effort to understand what reason a speech community might have found for creating the category represented by the word, and to explain the word’s meaning by presenting and clarifying that reason.An analogy that I find helpful in distinguishing the operation and the goals of frame semantics from those of standard views of compositional semantics is between a grammar and a set of tools – tools like hammers and knives, but also like clocks and shoes and pencils. To know about tools is to know what they look like and what they are made of – the phonology and morphology, so to speak– but it is also to know what people use them for, why people are interested in doing the things that they use them for, and maybe even what kinds of people use them. In this analogy, it is possible to think of a linguistic text, not as a record of ‘small meanings’ which give the interpreter the job of assembling these into a ‘big meaning’ (the meaning of the containing text), but rather as a record of the tools that somebody used in carrying out a particular activity. The job of interpreting a text, then, is analogous to the job of figuring out what activity the people had to be engaged in who used these tools in this order.2. A private history of the concept ‘frame’I trace my own interest in semantic frames through my career-long interest in lexical structure and lexical semantics. As a graduate student (at the University of Michigan in the late fifties) I spent a lot of time exploring the co-occurrence privileges of words, and I tried to develop distribution classes of English words using strings of words or strings of word classes as the ‘frames’ within which I could discover appropriate classes of mutually substitutable elements. This way of working, standard for a long time in phonological and morphological investigations, had been developed with particular rigor for purposes of syntactic description by Charles Fries (Fries 1952) and played an important role in the development of ‘tagmemic formulas’ in the work of Kenneth Pike (Pike 1967), the scholars who most directly influenced my thinking during this period. Substitutability within the same ‘slot’ in such a ‘frame’ was subject to certain (poorly articulated) con-ditions of meaning-preservation or structure-preservation, or sometimes merely meaningfulness-preservation. In this conception, the ‘frame’ (with its single open ‘slot’) was considered capable of leading to the discovery of important function-ing word classes or grammatical categories. As an example of the workings of such a procedure, we can take the frame consisting of two complete clauses and a gap between them, as in John is Mary’s husband – he doesn’t live with her. The substitution in this frame of but and yet suggests that these two words have (byChapter 10: Frame semantics 375 this diagnostic at least) very similar functions; insertion of moreover or however¬suggest the existence of conjunctions functioning semantically similarly to but and yet but requiring sentence boundaries. The conjunctions AND and OR can meaningfully be inserted into the frame, but in each case (and in each case with different effect) the logical or rhetorical ‘point’ of the whole utterance differs importantly from that brought about by but or yet. In each of these cases, what one came to know about these words was the kind of structures with which they could occur and what function they had within those structures.In the early sixties, together with William S.-Y. Wang and eventually D. Ter-ence Langendoen and a number of other colleagues, I was associated with the Project on Linguistic Analysis at the Ohio State University. My work on that project was largely devoted to the classification of English verbs, but now not only according to the surface-syntactic frames which were hospitable to them, but also according to their grammatical ‘behavior’, thought of in terms of the sensitivity of structures containing them to particular grammatical ‘transformations.’ This project was whole-heartedly transformationalist, basing its operations at first on the earliest work on English transformational grammar by Chomsky (1957) and Lees (1961), and in its later stages on advances within the theory suggested by the work of Peter Rosenbaum (Rosenbaum 1967) and the book which established the standard working paradigm for transformationalist studies of English, Chomsky (1965). What animated this work was the belief that discoveries in the ‘behavior’ of particular classes of words led to discoveries in the structure of the grammar of English. This was so because it was believed that the distributional properties of individual words discovered by this research could only be accommodated if the grammar of the language operated under particular working principles. My own work from this period included a small monograph on indirect object verbs (Fillmore 1961) and a paper which pointed to the eventual recognition of the transformational cycle as an operating principle in a formal grammar of English (Fillmore 1963).The project’s work on verbs was at first completely syntactic, in the sense that what was sought was, for each verb, a full account (expressed in terms of subcat-egorization features) of the deep structure syntactic frames which were hospitable to it, and a full account (expressed in terms of rule features) of the various paths or ‘transformational histories’ by which sentences containing them could be transformed into surface sentences. The kind of work I have in mind was carried on with much greater thoroughness by Fred Householder and his colleagues at Indiana University (Householder et al 1964), and with extreme care and sophis-tication by Maurice Gross and his team in Paris on the verbs and adjectives of French (Gross 1975).In the late sixties I began to believe that certain kinds of groupings of verbs and classifications of clause types could be stated more meaningfully if the struc-376 Carles. J. Fillmoretures with which verbs were initially associated were described in terms of the semantic roles of their associated arguments. I had become aware of certain American and European work on dependency grammar and valence theory, and it seemed clear to me that what was really important about a verb was its ‘semantic valence’ (as one might call it), a description of the semantic role of its arguments. Valence theory and dependency grammar did not assign the same classificatory role to the ‘predicate’ (or ‘VP’) that one found in transformationalist work (see, e.g., Tesnière 1959); the kind of semantic classifications that I needed could be made more complete and sensible, I believed, if, instead of relying on theoreti-cally separate kinds of distributional statements such as ‘strict subcategorization features’ and ‘selectional features,’ one could take into account the semantic roles of all arguments of a predication, that of the ‘subject’ being simply one of them. Questioning, ultimately, the relevance of the assumed basic immediate-constitu-ency cut between subject and predicate, I proposed that verbs could be seen as basically having two kinds of features relevant to their distribution in sentences: the first a deep-structure valence description expressed in terms of what I called ‘case frames’, the second a description in terms of rule features. What I called ‘case frames’ amounted to descriptions of predicating words that communicated such information as the following: ‘Such-and-such a verb occurs in expressions containing three nominals, one designating an actor who performs the act desig-nated by the verb, one designating an object on which the actor’s act has a state-changing influence, and one designating an object through the manipulation of which the actor brings about the mentioned state change.’ In symbols this state-ment could be represented as [— A P I], the letters standing for ‘Agent’, ‘Patient’ and ‘Instrument’. Actually, the kind of description I sought distinguished ‘case frames’ as the structures in actual individual sentences in which the verbs could appear from ‘case frame features’ as representations of the class of ‘case frames’ into which particular verbs could be inserted. In the description of ‘case frame features’ it was possible to notice which of the ‘cases’ were obligatory, which were optional, what selectional dependencies obtained among them, and so on (see Fillmore 1968).We were developing a kind of mixed syntactic-semantic valence description of verbs, and we noticed that the separate valence patterns seemed to character-ize semantic types of verbs, such as verbs of perception, causation, movement, etc. Within these syntactic valence types, however, it seemed that some semantic generalizations were lost. There seemed to be important differences between give it to john and send it to chicago that could not be illuminated merely by showing what syntactic rules separate give from send, just as there seemed to be semantic commonalities between rob and steal ¬buy and sell ¬enjoy and amuse, etc., which were lost in the syntactic class separation of these verbs.My ultimate goal in this work in ‘case grammar’ (as the framework cameChapter 10: Frame semantics 377 to be called) was the development of a ‘valence dictionary’ which was to differ importantly from the kinds of valence dictionaries appearing in Europe (e.g., Helbig and Schenkel 1973) by having its semantic valence taken as basic and by having as much as possible of its syntactic valence accounted for by general rules. (Thus, it was not thought to be necessary to explain, in individual lexical entries, which of the arguments in a [V A P I] predication of the type described above was to be the subject and which was to be the object, since such matters were automatically predicted by the grammar with reference to a set of general principles concerning the mapping from configurations of semantic cases into configurations of grammatical relations.)Although the concept of ‘frame’ in various fields within cognitive psychology appears to have origins quite independent of linguistics, its use in case grammar was continuous, in my own thinking, with the use to which I have put it in ‘frame semantics’. In particular, I thought of each case frame as characterizing a small abstract ‘scene’ or ‘situation’, so that to understand the semantic structure of the verb it was necessary to understand the properties of such schematized scenes.The scene schemata definable by the system of semantic cases (a system of semantic role notions which I held to be maximally general and defining a mini-mal and possibly universal repertory) was sufficient, I believed, for understanding those aspects of the semantic structure of a verb which were linked to the verb’s basic syntactic properties and to an understanding of the ways in which differ-ent languages differently shaped their minimal clauses, but they were clearly not adequate for describing with any completeness the semantic structure of the clauses containing individual verbs.This theory of semantic roles fell short of providing the detail needed for semantic description; it came more and more to seem that another independent level of role structure was needed for the semantic description of verbs in par-ticular limited domains. One possible way of devising a fuller account of lexical semantics is to associate some mechanism for deriving sets of truth conditions for a clause from semantic information individually attached to given predicates; but it seemed to me more profitable to believe that there are larger cognitive structures capable of providing a new layer of semantic role notions in terms of which whole domains of vocabulary could be semantically characterized.My first attempt to describe one such cognitive structure was in a paper on ‘Verbs of judging’ (Fillmore 1971) – verbs like blame ¬accuse ¬criticize – for which I needed to be able to imagine a kind of ‘scene schematization’ that was essentially different from the sort associated with ‘case frames’. In devising a framework for describing the elements in this class of verbs, I found it useful to distinguish a person who formed or expressed some sort of judgment on the worth or behavior of some situation or individual (and I called such a person the Judge); a person concerning whose behavior or character it was relevant for the378 Carles. J. FillmoreJudge to make a judgment (I called this person the Defendant); and some situa-tion concerning which it seemed relevant for the Judge to be making a Judgment (and this I called simply the Situation). In terms of this framework, then, I chose to describe accuse as a verb usable for asserting that the Judge, presupposing the badness of the Situation, claimed that the Defendant was responsible for the Situ-ation; I described criticize as usable for asserting that the Judge, presupposing the Defendant’s responsibility for the Situation, presented arguments for believ-ing that the Situation was in some way blameworthy. The details of my descrip-tion have been ‘criticized’ (see esp. McCawley 1975), but the point remains that we have here not just a group of individual words, but a ‘domain’ of vocabulary whose elements somehow presuppose a schematization of human judgment and behavior involving notions of worth, responsibility, judgment, etc., such that one would want to say that nobody can really understand the meanings of the words in that domain who does not understand the social institutions or the structures of experience which they presuppose.A second domain in which I attempted to characterize a cognitive ‘scene’ with the same function was that of the ‘commercial event’ (see Fillmore 1977b). In particular, I tried to show that a large and important set of English verbs could be seen as semantically related to each other by virtue of the different ways in which they ‘indexed’ or ‘evoked’ the same general ‘scene’. The elements of this schematic scene included a person interested in exchanging money for goods (the Buyer), a person interested in exchanging goods for money (the Seller), the goods which the Buyer did or could acquire (the Goods), and the money acquired (or sought) by the seller (the Money). Using the terms of this framework, it was then possible to say that the verb buy focuses on the actions of the Buyer with respect to the Goods, backgrounding the Seller and the Money; that the verb sell focuses on the actions of the Seller with respect to the Goods, backgrounding the Buyer and the Money; that the verb pay focuses on the actions of the Buyer with respect to both the Money and the Seller, backgrounding the Goods, and so on, with such verbs as spend, cost, charge, and a number of others somewhat more peripheral to these. Again, the point of the description was to argue that nobody could be said to know the meanings of these verbs who did not know the details of the kind of scene which provided the background and motivation for the categories which these words represent. Using the word ‘frame’ for the structured way in which the scene is presented or remembered, we can say that the frame structures the word-meanings, and that the word ‘evokes’ the frame.The structures I have mentioned so far can be thought of as motivating the categories speakers wish to bring into play when describing situations that might be independent of the actual speech situation, the conversational con-text. A second and equally important kind of framing is the framing of the actual communication situation. When we understand a piece of language, weChapter 10: Frame semantics 379 bring to the task both our ability to assign schematizations of the phases or components of the ‘world’ that the text somehow characterizes, and our ability to schematize the situation in which this piece of language is being produced. We have both ‘cognitive frames’ and ‘interactional frames’, the latter having to do with how we conceptualize what is going on between the speaker and the hearer, or between the author and the reader. By the early seventies I had become influenced by work on speech acts, performativity, and pragmatics in general, and had begun contributing to this field in the form of a number of writings on presuppositions and deixis (see, e.g., Fillmore 1975). Knowledge of deictic categories requires an understanding of the ways in which tenses, person marking morphemes, demonstrative categories, etc., schematize the communi-cating situation; knowledge of illocutionary points, principles of conversational cooperation, and routinized speech events, contribute to the full understand-ing of most conversational exchanges. Further, knowing that a text is, say, an obituary, a proposal of marriage, a business contract, or a folktale, provides knowledge about how to interpret particular passages in it, how to expect the text to develop, and how to know when it is finished. It is frequently the case that such expectations combine with the actual material of the text to lead to the text’s correct interpretation. And once again this is accomplished by having in mind an abstract structure of expectations which brings with it roles, purposes, natural or conventionalized sequences of event types, and all the rest of the apparatus that we wish to associate with the notion of ‘frame’.In the mid-seventies I came into contact with the work of Eleanor Rosch (Rosch 1973) and that of Brent Berlin and Paul Kay (Berlin and Kay 1969) and began to see the importance of the notion of ‘prototype’ in understanding the nature of human categorization. Through the work of Karl Zimmer (Zimmer 1971) and Pamela Downing (Downing 1977) on the relevance of categorizing contexts to principles of word-formation and, in work that reflects fruitful collaboration with Paul Kay and George Lakoff, I began to propose descriptions of word meanings that made use of the prototype notion. One generalization that seemed valid was that very often the frame or background against which the meaning of a word is defined and understood is a fairly large slice of the surrounding culture, and this background understanding is best understood as a ‘prototype’ rather than as a genuine body of assumptions about what the world is like. It is frequently useful, when trying to state truth conditions for the appropriateness of predicating the word of something, to construct a simple definition of the word, allowing the com-plexity of fit between uses of the word and real world situations to be attributed to the details of the prototype background frame rather than to the details of the word’s meaning. Thus we could define an orphan as a child whose parents are no longer living, and then understand the category as motivated against a background of a particular kind: in this assumed background world, children depend on their380Carles. J. Fillmoreparents for care and guidance and parents accept the responsibility of providing this care and guidance without question; a person without parents has a special status, for society, only up to a particular age, because during this period a society needs to provide some special way of providing care and instruction. The category orphan does not have ‘built into it’ any specification of the age after which it is no longer relevant to speak of somebody as an orphan, because that understanding is a part of the background prototype; a boy in his twenties is generally regarded as being able to take care of himself and to have passed the age where the main guidance is expected to come from his family. It is that background informa-tion which determines the fact that the word orphan would not be appropriately used of such a boy, rather than information that is to be separately built into a description of the word’s meaning. In the prototype situation, an orphan is seen as somebody deserving of pity and concern; hence the point of the joke about the young man on trial for the murder of his parents who asked the court for mercy on the grounds that he was an orphan: the prototype scene against which society has a reason to categorize some children as orphans does not take into account the case in which a child orphans himself.As a second example of a category that has to be fitted onto a background of institutions and practices we can consider the word breakfast. To understand this word is to understand the practice in our culture of having three meals a day, at more or less conventionally established times of the day, and for one of these meals to be the one which is eaten early in the day, after a period of sleep, and for it to consist of a somewhat unique menu (the details of which can vary from community to community). What is interesting about the word breakfast is that each of the three conditions most typically associated with it can be independently absent still allowing native speakers to use the word. The fact that someone can work through the night without sleep, and then at sun-up have a meal of eggs, toast, coffee and orange juice, and call that meal breakfast, shows clearly that the ‘post-sleep’ character of the category is not criterial; the fact that someone can sleep through the morning, wake up at three o‘clock in the afternoon, and sit down to a meal of eggs, toast, coffee and orange juice, and call that meal breakfast, shows that the ‘early morning’ character of the category is also not criterial; and lastly, the fact that a person can sleep through the night, wake up in the morning, have cabbage soup and chocolate pie ‘for breakfast’, shows that the ‘breakfast menu’ character of the concept is also not criterial. (This in spite of the fact that an American restaurant that advertises its willingness to serve breakfast at any time is referring precisely to the stereotyped breakfast ingredients.) What we want to say, when we observe usage phenomena like that, is not that we have so far failed to capture the true core of the word’s meaning, but rather that the word gives us a category which can be used in many different contexts, this range of contexts determined by the multiple aspects of its prototypic use – the use it hasChapter 10: Frame semantics 381 when the conditions of the background situation more or less exactly match the defining prototype.The descriptive framework which is in the process of evolving out of all of the above considerations is one in which words and other linguistic forms and categories are seen as indexing semantic or cognitive categories which are them-selves recognized as participating in larger conceptual structures of some sort, all of this made intelligible by knowing something about the kinds of settings or contexts in which a community found a need to make such categories available to its participants, the background of experiences and practices within which such contexts could arise, the categories, the contexts, and the backgrounds themselves all understood in terms of prototypes.3. Further illustrations and some terminological proposalsA ‘frame’, as the notion plays a role in the description of linguistic meanings, is a system of categories structured in accordance with some motivating context. Some words exist in order to provide access to knowledge of such frames to the participants in the communication process, and simultaneously serve to perform a categorization which takes such framing for granted.The motivating context is some body of understandings, some pattern of prac-tices, or some history of social institutions, against which we find intelligible the creation of a particular category in the history of the language community. The word week-end conveys what it conveys both because of the calendric seven-day cycle and because of a particular practice of devoting a relatively larger continu-ous block of days within such a cycle to public work and two continuous days to one’s private life. If we had only one ‘day of rest’ there would be no need for the word week-end; one could simply use the name of that day. If we had three days of work and four days of rest, then too it seems unlikely that the name for the period devoted to one’s private life would have been given that name. (If the work week is gradually shortened, the word week-end might stay; but it is unlikely that the category could have developed naturally if from the start the number of days devoted to work were shorter than the number of the remain-ing days. An acquaintance of mine who works only on Wednesdays, pleased at being able to enjoy ‘a long week-end’, recognizes that the word is here being used facetiously.)The word vegetarian means what it means, when used of people in our cul-ture, because the category of ‘someone who eats only vegetables’ is a relevant and interesting category only against the background of a community many or most of whose members regularly eat meat. Notice that the word designates, not just someone who eats plant food, but someone who eats only plant food.382 Carles. J. FillmoreFurthermore, it is used most appropriately for situations in which the individual so designated avoids meat deliberately and for a purpose. The purpose might be one of beliefs about nutrition, or it may be one of concerns for animal life; but the word is not used (in a sentence like John is a vegetarian.) to describe people whose diet does not include meat because they are unable to find any, or because they cannot afford to buy it.Occasionally one comes upon a term whose motivating context is very spe-cific. One such is the compound flip strength, used, I am told, in the pornographic literature business. Some publishers of pornographic novels instruct their authors to include a certain quota of high interest words on every page, so that a potential customer, in a bookstore, while ‘flipping’ the pages of the book, will, no matter where he opens the book, find evidence that the book is filled with wonderful and exciting goings-on. A book which has a high ratio of nasty words per page has high flip strength; a book which has these words more widely distributed has low flip strength. As I understand the word, an editor of such a publication venture might reject a manuscript, requesting that it be returned only after its flip strength has been raised.With this last example, it is extremely clear that the background context is absolutely essential to understanding the category. It is not that the conditions for using the word cannot be stated without this background understanding (rela-tive flip strength of novels could easily be determined by a computer), but that the word’s meaning cannot be truly understood by someone who is unaware of those human concerns and problems which provide the reason for the category’s existence.We can say that, in the process of using a language, a speaker ‘applies’ a frame to a situation, and shows that he intends this frame to be applied by using words recognized as grounded in such a frame. What is going on here seems to corre-spond, within the ordinary vocabulary of a language, to lexical material in scientific discourse that is describable as ‘theory laden’: the word phlogiston is ‘theory-laden’; the reason it is no longer used in serious discourse is that nobody accepts the theory within which it is a concept. That is, nobody schematizes the physical world in a way that would give a reason to speak of part of it as phlogiston.To illustrate the point with items from everyday language, we can consider the words land and ground (which I have described elsewhere but cannot forego mentioning here). The difference between these two words appears to be best expressed by saying that land designates the dry surface of the earth as it is dis-tinct from the sea, whereas ground designates the dry surface of the earth as it is distinct from the air above it. The words land and ground, then, differ not so much in what it is that they can be used to identify, but in how they situate that thing in a larger frame. It is by our recognition of this frame contrast that we are able to understand that a bird that ‘spends its life on the land’ is being described。

chapter 5 Semantics英语专业语言学PPT

• Problem: What is the link?
Triangle of Reference by Ogden & Richards
Contextualism
3. Contextualism: Meaning should be studied in terms of situation, use, context.
• morning star 启明星 , evening star冥王星
Major sense relations— homonymy 121
• Homonymy 同音/形异义,including: ➢Homophones同音词: rain/reign,
night/night, ➢Homographs同形词:bow v./ n., tear v./
• Linguistic forms having the same sense may have different references in different situations.
• Linguistic forms with the same reference might differ in sense.
5.Reflective/reflected meaning反映义
(association with another sense of the same expression) e.g. intercourse, nucleur
6. Collocative meaning 搭配义 p.116:
• The associations of a word gets because of the meanings of words which tend to occur in its linguistic context.

Under consideration for publication in Formal Aspects of Computing A Formal Relationship Be

Under consideration for publication in Formal Aspects of ComputingA Formal Relationship Between Program Slicing and Partial EvaluationDavid W.Binkley1,Sebastian Danicic2,Mark Harman3and Lahcen Ouarbya21Department of Computer Science,Loyola College,4501N.Charles Street,Baltimore,Maryland21210-2699,USA;2Department of Computing,Goldsmiths College,University of London,New Cross,London SE146NW,UK.3Department of Computer Science,King’s College London,Strand,London WC2R2LS,UK.Keywords:Conditioned Program Slicing;Partial EvaluationAbstract.A formal relationship between program slicing and partial evaluation is established.It is proved that for terminating programs,a residual program produced by partial evaluation is semantically equivalent to a conditioned slice.1.IntroductionPartial evaluation and slicing are both program specialisation techniques that attempt to simplify a program. Partial evaluation[JGS93]involves the evaluation of static computation,while slicing[BH04,Tip95]involves the removal of parts of the program which do not affect the values of selected variables at execution points of interest.Both techniques have common applications including optimisation,program comprehension,dependence analysis and testing[BF98,CHM+98a,Das98,DFM96,DHN98,Ers78,JR94,HD97].It may be productive, in the future,therefore,to explore the similarities and differences between partial evaluation and slicing and to investigate hybrid approaches that combine the two.In spite of this,research on partial evaluation and slicing has largely been conducted by two disjoint communities and so there has been relatively little work on the similarities and differences between the two techniques and none which establishes any formal relationship between the two.This paper explores these similarities and differences,establishing a formal relationship between the residual program of partial evaluation and a form of slice known as a conditioned slice[CCD98,DFHH00, DDH+02,DDH04,FDHH04,DDF+04,HHD+01,FHHD01,HHF+02].The paper uses a program projection2 D.Binkley,S.Danicic,M.Harman,L.Ouarbyaframework[HBD03,HD97]that allows for the definition of various forms of program projection,which preserve only a projection of the original program’s semantics.The rest of this paper is organised as follows:Sections2and3briefly review partial evaluation and slicing respectively.A semantics that is preserved by slicing is given in Section4.Section5introduces the theoretical framework of program projection which allows different transformation methodologies to be compared.It is shown how different slicing techniques can be expressed using the framework of Section5and the semantics of Section4.Section6expresses partial evaluation in terms of the framework in order to formally compare it with slicing.It is established that a residual program of a terminating program is semantically equivalent to a conditioned slice.Section7describes some applications of the theoretical results of the paper,showing how partial evaluation and amorphous slicing can be combined to produce amorphous conditioned slices and how the precision of syntax preserving conditioned slicing could be improved using information from partial evaluation.Section8presents related work and Section9summarises the paper.2.Partial EvaluationMany programs contain computations that can be performed at compile time.Optimising compilers exploit such computations by pre-computing their values.Partial evaluation(also known as mixed computation) takes this process one step further by allowing some of the inputs to a program to be statically determined(or statically‘bound’).By propagating that binding-time information‘forward’through the program,additional static computations can be identified.Static computations can be performed at compile time,often reducing the program’s size and run time.Partial evaluation was originally considered as an extension of compiler theory,used as a means of im-proving efficiency[Ers78]and of creating compilers and compiler generators from interpreters[Fut71,Fut99a, Fut99b,JSS89].Initial work concerned declarative languages,for which the semantics were comparatively ‘clean’[BHO+76,GJ89,JSS85,Har78,Ste75].Consequently,the propagation of binding time information was definable in terms of the formal semantics of the programming language concerned.More recently, partial evaluation-based approaches to software engineering[CHM+98a],program comprehension[BF98], state-based testing[DHN98]and multimedia computing[Dra98]have been explored.The initial work on declarative language partial evaluation has also been extended to the imperative programming paradigm, most notably by the early work on[And92,GJ91,KKZG95]and by more recent work on partial evaluation using dependence graphs by Das[Das98]and the Tempo partial evaluation system for a large subset of the C programming language[CHM+98b].Algorithms for partial evaluation typically consist of two phases:an initial Binding Time Analysis(BTA) followed by a manipulation phase(called‘specialisation’).The result of this specialisation is a program, called the residual program.Some authors[RT96,SGJ94]use the term‘specialisation’to describe the more general concept of tailoring a program to a specific task.This nomenclature includes both partial evaluation and slicing as special cases of specialisation.Example.Consider the power program in Figure1(in order to simplify the following example,it will be assumed that the input to a program is taken from those variables that are referenced before being defined. This will allow program fragments and whole programs to be considered in a similar way).Suppose the value of n is determined to be4.The results of BTA for this program are shown in the right-hand sections of thefigure(S indicates that a variable is determined to be static at the associated point,D indicates that it is determined to be dynamic).Using the results of BTA,it can be seen that the variable n remains static throughout the computation and therefore it will be safe to specialise the program by unfolding the loop controlled by n.This specialisation phase leads to the construction of the residual program in Figure2.As originally formulated[BHO+76,Ers78,Fut71,Har78,JSS85,Ste75],the residual program was con-structed with respect to the instantiation of selected inputs withfixed values.Futamura and Nogi[FN87] introduced a more generalised form of partial evaluation,in which residual programs are constructed with respect to a set of initial states characterised by afirst order predicate logic expression on input variables. Gl¨u ck and Sørensen[GS96]cite four varieties of partial evaluator.These are•Monovariant,where each function of the original program results in at most one function in the residual program.•Polyvariant where each function of the original program may result in more than one function in the residual program.A Formal Relationship Between Program Slicing and Partial Evaluation3r=1;D S Swhile(n>0)D S D{n=n-1;D S Dr=r*x;}D S Dprintf("%d",r);D S Dr=1;r=r*x;r=r*x;r=r*x;r=r*x;printf("%d",r);base=2;count=0;for(i=0;i<N;i++)for(i=0;i<N;i++){if(A[i]%base==0){count++;R[N-i-1]=A[i];R[N-i-1]=A[i];}}b=(A[0]==R[0]);b=(A[0]==R[0]);b=(A[0]==A[N-1]);Fig.3.Amorphous and Syntax-preserving Slices4 D.Binkley,S.Danicic,M.Harman,L.Ouarbyamaintenance[GL91],testing[Bin98,Bin97,GHS92,HD95,HHD99,HHF+02],program integration[HPR89, BHR95]and software conformance certification[KS98].There are several surveys of slicing,techniques and applications[BG96,HH01,De01,Tip95].In addition to capturing a projection of a program’s semantics,the original application of slicing required a syntactic property:a slice must preserve a projection of the original program’s syntax.Traditionally,slicing has used a‘statement deletion’for this projection largely for historical reasons.This derives from the original application of slicing[Wei79]to debugging,where the motivation for slicing was to remove statements and associated control structures that could not have been responsible for an error.The importance of this syntactic requirement varies from application to application.For re-engineering,program comprehension and testing it is primarily the semantic property of a slice that is of interest.Conditioned slicing[CCD98]is the act of simplifying a program assuming that the states of the program at certain chosen points in its execution satisfy certain properties.What distinguishes conditioned slicing from other forms of slicing is mainly its implementation[DFHH00,DDH+02,FDHH04,DDF+04].Conditioned slicing combines the standard techniques of slicing with symbolic execution and theorem proving.Conditioned slicers are required to reason about the validity of paths under certain conditions using symbolic execution and automated theorem proving.The simplifying power of the conditioned slicer depends on two things:1.The precision of the symbolic executor which handles propagation of state and path information.2.The precision of the underlying theorem prover which determines the truth of propositions about statesand paths.By using an approximation to a program’s semantics using a form of symbolic execution,and by being willing to accept approximate results from the theorem proving itself,conditioning allows us to adopt reasoning that does not require the full force of inductive proofs.The theorem proving used in programming conditioning is lightweight when compared to the theorem proving required for a complete formal analysis of a program. As in the case of traditional slicing,conditioned slicing only simplifies programs by deletion.Semantically,as will be seen later,conditioned slicing is very closely related to both traditional slicing and partial evaluation.Amorphous slicing[HBD03]is a variation of slicing,in which simplification is not limited to statement deletion.For this reason it is clearly closer to partial evaluation than the other forms.To illustrate,consider the example in Figure3.The original program reverses the array A,keeping a count(in the variable count) of the number of array elements which are exactly divisible by base.The program also records whether or not thefirst and last element of the array are identical(in the variable b).The integer N(the size of the array A),is a compile-time constant.The array A is an input parameter to the program fragment.The original program is in the leftmost column of thefigure.The syntax-preserving end-slice for the value of the variable b is in the central column and the amorphous slice is in the rightmost column of thefigure.Figure3makes it clear that amorphous slices can be smaller than their syntactically constrained counter-parts.Of course,it is a more challenging problem to compute amorphous slices.Recently proposed algorithms [Bin99,HHZM01]represent initial attempts at addressing this problem.Notice also that the variable base is statically determined,and so it could be‘partially evaluated away’in the original program and in its syntax-preserving end-slice.Since N is also statically determined,the loop can also be replaced by a sequence of N assignments.The combination of these partial evaluation steps together with syntax-preserving end-slicing,could almost produce the amorphous slice,as shown in Figure4. This suggests that amorphous slicing might be achievable as a combination of syntax-preserving end-slicing and partial evaluation.However,the program produced by mixing partial evaluation and syntax-preserving end-slicing,is only valid slice because the computation was static for the unwanted array elements,R[i]for (i<N)and the unwanted variables base and count.Had the value of N or base been inputs,then partial evaluation would have had no effect.However,this example shows that there is a connection between the residual program of partial evaluation and amorphous forms of program slicing.This observation motivates the formal examination of this connection which follows.4.Semantics of SlicingOriginally,program slicing was defined in terms of an algorithm[Wei79].Informally,this algorithm simplified programs both syntactically,and semantically.Given a program P and a set of variables J,Weiser’s algorithm produces a program P′smaller than P which‘behaves the same’with respect to J.Weiser,in fact proved that in all states where P terminates,P′also terminates and agrees with P on all the variables in J.A Formal Relationship Between Program Slicing and Partial Evaluation5 Original Partially Evaluated Syntax-Preserving end-slice for b1Other authors have produced semantics which they claim to be preserved by slicing.These include the lazy semantics of Cartwright and Felleisen[CF89]and the transfinite semantics of Giacobazzi and Mastroeni[GM03].6 D.Binkley,S.Danicic,M.Harman,L.OuarbyaM:P→Σ⊥→Σ⊥s kip statementM[[abort]]σ ⊥Assignment statementsM[[S1;S2]]σ M[[S2]](M[[S1]]σ)i f statementsM[[w hile(b)S]] fix(λf·λσ·E[[b]]σ→f(M[[S]]σ),σ)Fig.5.Standard Semantics for a Simple Procedural language.Definition1(det:E→P(V)).Given an expression e,det(e)is defined as follows:1.For all x∈det(e),there exists two statesσ1,σ2differing only on x such that:E[[e]]σ1=E[[e]]σ2.2.For all x∈det(e),and for all statesσ1,σ2differing only on x,E[[e]]σ1=E[[e]]σ2.If det(e)contains a variable which has⊥as a value inσ,then the whole expression is evaluated to⊥inσ. Otherwise the lazy value,E L,of an expression is the same as its strict value,E.The meaning of an expression in our lazy semantics is the function,E L:E→Σ⊥−→V⊥.given by E L eσ ⊥if∃v∈det(e)withσv=⊥.E eσotherwise.The lazy meaning of a program is given by the function M L,which,as in the case of standard semantics, is a state to state function:M L:P−→Σ⊥−→Σ⊥.Lazy semantics of the s kip statementM L[[abort]]σ σUnlike in standard semantics,the lazy meaning of the abort statement is the same as lazy meaning ofA Formal Relationship Between Program Slicing and Partial Evaluation7Program p Program q Program r Program sM L[[x=e]]σ σ[x←E L[[e]]σ]As in standard semantics,the meaning of an assignment is obtained by updating the state with the new value of the variable assigned to it.In the case of lazy semantics,this value is the lazy value of the corre-sponding expression.Since in lazy semantics,there are states which map some variables to proper values and other variables to⊥,the assignment rule implies that a variable can‘recover’from being undefined as demonstrated by program p in Figure6,where after the loop x has the value⊥but it recovers to5 after the assignment x=5.Lazy semantics of the statement sequencesM L[[i f(B)S1e lse S2]]σ E L[[B]]σ→M L[[S1]]σ,M L[[S2]]σ,M L[[S1]]σ⊓M L[[S2]]σwhereσ1⊓σ2,the meet ofσ1andσ2,is defined asλi·σ1(i)=σ2(i)→σ1(i),⊥and the notation a→b,c,d is shorthand for if a is true return b otherwise if a is false return c otherwise if a is⊥return d and the notation a→b,c is shorthand for if a is true return b otherwise return c.The difference between this and standard semantics is when the guard evaluates to⊥.If a variable x is assigned different values in the t hen and e lse parts its lazy value will be⊥.On the other hand,if the value of x is the same in the t hen and e lse parts then this should be itsfinal value even if the guard is ⊥,as,in this case,the value of x does not depend on the guard.Consider,for example,program q in Figure6.Given an initial stateσ={x→1,y→1,z→⊥},the value i f predicate,z>0inσis⊥.However,thefinal value of the variable x is1whichever branch of the conditional is executed.For this reason,the lazy value of the variable x after executing program q in σis deemed to be1.8 D.Binkley,S.Danicic,M.Harman,L.OuarbyaThe value of the variable y has different values after executing the t hen branch from when executing e lse branch,and hence,thefinal value of the variable y is⊥2.Before the lazy meaning of a w hile loops can be given,loop unfoldings,W n(B,S)for each n∈I N are defined:W0(B,S) abortW n+1(B,S) i f(B){S;W n(B,S)}e lse s kipLazy semantics of w hile loops2Unlike this semantics,the value of the variable x after executing program q in Figure6in the stateσwhen using the lazy semantics by Cartwright and Felleisen[CF89]or the transfinite semantics by Giacobazzi and Mastroeni[GM03]is⊥.This is a result of the fact that their semantics loses all information about the variables defined in the t hen or e lse parts of an i f statement in states where its predicate is undefined.A Formal Relationship Between Program Slicing and Partial Evaluation 9That is,the syntax must not ‘get worse’as a result of projection of a program,while the semantics of the projected program must remain equivalent to the original.Definition 3(A program transformation satisfies a projection).A program transformation f satisfies a (<∼,≈)–projection if and only if for all programs p ,f (p )is a (<∼,≈)–projection of p .Clearly,every program transformation satisfies the weakest (<∼A ,≈A )–projection where p <∼A q and p ≈A qfor all programs p and q .Trivially,if a technique satisfies a particular (<∼,≈)–projection then it satisfies all weaker projections.The weakest projection is useless as it tells us nothing.Clearly the stronger projection that we find,the more precisely we capture behaviour.The purpose of the projection framework is to capture the behaviour of each technique or algorithm sufficiently strongly to at least distinguish it from other techniques.Alternatively,the projection framework can be used in the inverse manner for not categorising but defining classes of algorithms.We may define,say,a ζ–transformation to be any transformation which satisfies (<∼ζ,≈ζ)–projection where <∼ζis a given ordering and ≈ζis a given equivalence as defined above.ing the Framework to Express SlicingThe projection framework has successfully been used to categorise a variety of slicing techniques.As an introduction to the projection framework it is shown how three kinds of slices:(traditional)syntax-preserving slices,amorphous slices,and conditioned slices are categorised using it.This subsection describes the syntactic and semantic relations for these three kinds of slices.It is then shown how partial evaluation can also be expressed using the framework.5.1.1.Syntax-Preserving SlicingIt is helpful in discussing slicing to think of each line of a program as a single (labelled or numbered)node of a program’s Control Flow Graph (CFG).The following definition formalises the oft-quoted remark:“a slice is a subset of the program from which it is constructed.”It defines Syntax-Preserving Ordering ,the ordering for syntax-preserving slicing,denoted <∼SP .(In the sequel,subscripts are added to <∼and ≈to distinguish different instantiations of the respective relations.)Definition 4(Syntax-Preserving Ordering).Let F be a partial function which takes a program and returns a function from line numbers to statements,such that the function F (p )maps l to c iffprogram p contains the statement c at line number l .Syntax-preserving syntactic ordering is defined as follows:p <∼SP q ⇔F (p )⊆F (q ).Definition 5(End-Slice Equivalence).Given two programs p and q ,and a set of variables V ,p is end-slice semantically equivalent to q ,written p ≈V SPq ,if and only if for all states σ,for all variables v ∈V ,M L [[p ]]σv =M L [[q ]]σv.Instantiating Definitions 4and 5into Definition 2,the following definition of an end-slice is obtained:Definition 6(Syntax-Preserving End-Slice).Program q is a Syntax-Preserving End-slice of program p with respect to set of variables V if and only if qis a (<∼SP ,≈V SP )–projection of p .5.1.2.Amorphous SlicingTo define amorphous slicing,only the syntactic relation needs to be altered;the semantic relation remains the same.For amorphous slicing,a natural choice for a syntactic relation is that p is less than q if it contains10 D.Binkley,S.Danicic,M.Harman,L.Ouarbya fewer statements.Such a definition of the syntactic relation naturally depends upon how statements are to be counted.The approach adopted in this paper,in keeping with the spirit of slicing,is to count the nodes in the CFG [HRB88,OO84].Definition 7(Amorphous Syntactic Ordering).Let F (p )be the number of nodes in the CFG of program p .The amorphous syntactic relation,<∼AS ,is defined as follows:p <∼AS q ⇔F (p )≤F (q )Definition 8(Amorphous Semantic Equivalence).≈AS =≈SPDefinition 9(Amorphous Static Slicing).Program q is an amorphous static slice of program p with respect to the set of variables V if and only if qis a (<∼AS ,≈V SP )–projection of p .Amorphous slicing subsumes (i.e.,it is weaker than)syntax-preserving end-slicing because <∼SP ⊆<∼AS and ≈AS =≈SP .As a consequence of this,any implementation of syntax-preserving slicing is also an implementation of amorphous slicing,albeit a rather sub-optimal implementation.Therefore,there will always be an amorphous slice which contains no more CFG nodes than the syntax-preserving end-slice constructed for the same set of variables.Of course,there will often be an amorphous slice which contains fewer nodes than the corresponding syntax-preserving end-slice.This makes amorphous slicing attractive when preservation of syntax is unimportant.5.1.3.Conditioned SlicingFinally,conditional slicing is defined in the projection framework.As will be seen,the residual program produced by partial evaluation is most closely related to a conditioned slice [CCD98].Traditionally [CCD98,DFHH00]conditioned slices have been constructed by statement deletion.Thus,the definition of the con-ditioned slice syntactic ordering is the same as the syntax-preserving ordering used for syntax-preserving end-slicing.Definition 10(Conditioned Syntactic Ordering).The conditioned syntactic relation,<∼CS ,is defined as follows:<∼CS =<∼SPFor example,the conditioned program in Figure 7is ‘lower’than the original program according to <∼CS ,because the conditioned program contains a subset of the statements of the original.The semantic equivalence preserved by conditioned slicing is defined as follows:Definition 11(Conditioned Semantic Equivalence).Program p ′is conditioned equivalent to program p with respect to (V,Σ),written p ≈(V,Σ)CSp ′if and only if ∀σ∈Σ,∀v ∈V,M L [[p ]]σv =M L [[p ′]]σvThat is,for a set of states Σand variables V conditioned slicing preserves the values of variables in V when the program is executed in a state in Σ.For example,the conditioned program in Figure 7is conditioned equivalent to the original with respect to (x,y )when x is the set of all program variables and y is the set of all possible states,since the conditioned program and the original produce identical answers for all variables in all states.Combining these two definitions into the framework yields:Definition 12(Conditioned Slice).Program q is a conditioned slice of program p with respect to the slicing criterion (V,i )if and only if q is a (<∼CS ,≈(V,Σ)CS )–projection of p .Original program Conditioned programThe syntactic ordering used in partial evaluation also differs from that used in both syntax-preserving and amorphous slicing.There are situations where the two relations will agree,for example,both would allow3the transformation[[x=x+2;x=x-1;]]⇒[[x++;]]However,there are also situations where the two relations disagree.This occurs,for example,when a transformation reduces the number of CFG nodes,but increases the execution time.In this case amorphous slicing allows the transformation,but residualisation does not.The preceding discussion indicates that partial evaluation is both semantically and syntactically different from slicing(though bothfit the projection framework defined in Section5).However,there are similarities between the two approaches to program specialisation.Specifically,setting aside the differences between the syntactic ordering for slicing and partial evaluation,we will prove the following statement can be made about the relationship between partial evaluation and conditioned slicing.Theorem6.1.Let q be a residual program constructed from a program p,with respect to a set of statesΣIf q terminates in all statesσinΣthen q is semantically equivalent to a conditioned slice of p constructed with respect to the slicing criterion I−(SV(p,Σ),Σ).Since partial evaluation is defined in terms of strict semantics,M,and conditioned slicing in terms of lazy semantics M L,wefirst need a result which says that a terminating program’s lazy and strict meanings are identical:Proposition1.Let P be a program andσbe a state inΣ,then M[[P]]σ=⊥=⇒M L[[P]]σ=M[[P]]σ. Proof.This is proved by structural induction over the language being considered.s kip statementThe result is vacuously true as,M[[abort]]σ=⊥for allσinΣ.Assignment statementsLetσbe a state inΣwith M[[i f(B)S1e lse S2]]σ=⊥.Then it follows that E L[[B]]σ=E[[B]]σ=⊥asσis a state inΣ.If E L[[B]]σ=True,then M[[i f(B)S1e lse S2]]σis reduced to just M[[S1]]σand M L[[i f(B)S1e lse S2]]σis reduced to just M L[[S1]]σand the result follows immediately from the induc-tion hypothesis.Similarly,if E L[[B]]σ=False as M[[i f(B)S1e lse S2]]σis reduced to just M[[S2]]σand M L[[i f(B)S1e lse S2]]σis reduced to just M L[[S2]]σ.Sequences3This transformation is allowed by the definition of partial evaluation,but is not typically exploited in partial evaluation systems.Letσ∈Σwith M[[S1;S2]]σ=⊥.Hence,M[[S2]]M[[S1]]σ=⊥and M[[S1]]σ=⊥.The result follows immediately by application of the semantics rule for sequences and the induction hypothesis:M L[[S1;S2]]σ=M L[[S2]]M L[[S1]]σ(by definition)=M[[S2]]M[[S1]]σ(induction hypothesis)=M[[S1;S2]]σ.While loops7.ApplicationsThe correspondence between partial evaluation and conditioned slicing has potential practical applications in program slicing.This section illustrates some of these potential applications,by showing how existing partial evaluation and slicing techniques could be combined in order to improve slicing.Consider the example in Figure8.In this example,there are four program fragments.These will be referred to by points of the compass.The original program is the northerly program fragment.Previous work on conditioned slicing could be applied to this program fragment in an attempt to reduce the program, using knowledge gleaned from the symbolic states of the program as it is symbolically executed.For the purpose of this discussion,it will be supposed that the set of states with respect to which the conditioning takes places is the set of all possible states.Applying the existing approaches to conditioning[DDF+04,FDHH04]the program would not be sim-plified,because current approaches to conditioning have no ability to explore multiple loop executions.For example,using the tool ConSUS[DDF+04],the conditioned slice obtained is the entire program.ConSUS combines symbolic execution with theorem proving to obtain conditioned slices.The symbolic executor works out path conditions,while the theorem prover is used to determine which statements must fail to be executed due to the values of these path conditions.ConSUS can recognise some situations where a loop fails to exe-cute and can exploit limited information about the symbolic execution of the loop,but it fails to detect that the test if total>10is redundant.This is because the symbolic execution does not symbolically execute the unfolded body of the loop.However,if the program were to have beenfirst partially evaluated,then the loop body would have been ing this unfolded loop body,the symbolic executor would be able to provide more information about the terminating state of the loop to the theorem prover,allowing it to determine that the test if total>10is redundant.This would lead to the improved syntax preserving conditioned slice in the easterly quadrant.This conditioned slice is thinner than that produced by any existing tool for conditioned slicing, showing that the combination of partial evaluation and conditioned slicing can produce improvements in existing conditioned slicing approaches.A more dramatic improvement in slicing technology is obtained by exploiting the combination of amor-phous slicing and partial evaluation.Amorphous slicing is known to reduce the size of slices because it allows transformation to be applied[De01,DDF+04,HBD03,War02].This is to be contrasted with syntax–preserving slicing which allows only statement deletion.It would be desirable to construct a tool for amorphous conditioned slicing.Such a tool would im-prove the simplification power of static syntax–preserving slicing,both because it would be amorphous(not syntax–preserving)and because it would be conditioned(not static).Hitherto,no such slicing tool has been constructed;it has proved hard tofind effective algorithms for syntax–preserving conditioned slicing,so amorphous conditioned slicing would seem to be an even harder problem.Ward[War03]has shown how a form of amorphous conditioned slicing(called a semantic slice)could be produce by combining the transfor-mations of FermaT[War99]with slicing,but he gives no general algorithm for semantic slicing.The existence of effective algorithms for amorphous conditioned slicing therefore remains an open problem.The combination of amorphous static slicing and partial evaluation may yield algorithms for amor-phous conditioned slicing.Consider the program in the southerly quadrant of Figure8.This program is an amorphous conditioned slice of the original program in the northerly quadrant.Currently,no slicing tool is available which can produce this program and there are no algorithms in the literature for amorphous conditioned slicing.Applying partial evaluation(using a tools like tempo[CHM+98b]),to the original program in the northerly quadrant,the residual program in the westerly quadrant is obtained.By applying amorphous slicing to this residual program(using a tool like LinIAS[HHM+04])the desired amorphous conditioned slice in the southerly quadrant is obtained.The primary role of this paper is theoretical;it demonstrates the correspondence between slicing and partial evaluation.However,the importance of this result is likely to be the application of the connection between the two,in work on practical techniques for computing slices.The tantalising observations in this section show that it is possible to combine existing techniques for amorphous slicing and partial evaluation to produce amorphous conditioned slices;a form of slicing for which there are no currently existing techniques.。

  1. 1、下载文档前请自行甄别文档内容的完整性,平台不提供额外的编辑、内容补充、找答案等附加服务。
  2. 2、"仅部分预览"的文档,不可在线预览部分如存在完整性等问题,可反馈申请退款(可完整预览的文档不适用该条件!)。
  3. 3、如文档侵犯您的权益,请联系客服反馈,我们会尽快为您处理(人工客服工作时间:9:00-18:30)。

A Formal Semantics on Net Delay in Verilog-HDLHisashi Sasaki. Toshiba Corp., Semiconductor Company.STE Building 1000-1, Kasama-cho, Sakae-ku, Yokohama 247-8585, Japan,hisashi3.sasaki@toshiba.co.jpAbstractThis paper presents a formal semantics for the wire data structure and behavior such as continuous assignment and inertial delay in Verilog-HDL. Its language-interoperability also clarifies the background why VHDL experts so frequently fall in the misinterpretation on the cancellation of scheduled events regarding on the wire concept in Verilog-HDL.1. IntroductionThere are many works on formal semantics for VHDL. Their primary purpose is to provide the theoretical framework to promote the understanding of the semantics. These works have been not recognized as practical tools yet. Recently a successful application of formal approach to define the analog and mixed-signal extension are known to validate the semantic consistency of the proposed standard even during its development process, and resulted in successful contribution to standardization activity [3,4,5]. Now the formal specification is becoming widely accepted in EDA community and strongly recognized as a new tool in defining languages, for example, SLDL regards it as a prerequisite technical item to be considered.On the other hand, a few works are known for Verilog-HDL. The Berge’s book [1] gives the first comprehensive discussion to compare VHDL and Verilog-HDL. However, it is descriptive explanation not based on a formal method. Gordon’s appeal [6] is the first declaration that formal method is necessary for Verilog-HDL too. At that time, formal semantics is not explicitly established, and their work is still in progress at present. Most of today’s discussions [11,12] still remains based on non-formal method. Borrione’s work [7] is the first successful paper by formal approach. But their discussion is limited to synchronous design and their aim is to provide the synthesis semantics, not simulation one. Sasaki [8], Lasseter [10,14] and Li [13] independently developed formal simulation semantics by Abstract State Machine (ASM), operational semantics and Interval Temporal Logic (ITL) respectively. Lasseter’s and Li's works focused only on Verilog-HDL. Sasaki’s work provided the common foundation for VHDL and Verilog-HDL which admits the discussion on interoperability issues between the both. In this paper, we will enhance our semantic analysis for Verilog-HDL by adding the formal formulation on net delay mechanism.This paper deeply enhances the discussion proposed by Stewart [9]. Our discussion not only provides the direct description of semantic behavior, but also reveals the background why VHDL experts fall in the misinterpretation mentioned in his paper.2. Preliminary backgroundIn the previous Sasaki’s work [8], the following item are focused to establish the clarification of delicate differences between the two languages.(1) delay mechanism: There are not only the distinctiontransport delay and inertial delay but also the delicate differences between the concept of transport delay in VHDL and modified transport delay and pure transport delay in Verilog-HDL.(2) waveform: Only single element is admissible inVerilog-HDL, but multiple-element is admissible in VHDL. The successive assignments of Verilog-HDL can generate the multiple waveform (equivalent counterpart supported by VHDL) effectively. (3) thread of control: It controls the flow of control tosuspend the user-defined process in VHDL and always block in Verilog-HDL, and triggers the simulation kernels. The blocking property of Verilog-HDL assignment is expressed by the semantic rule, in which the suspended flag is set to true to show the suspension, the timeout data is set by computing from the delay specification, and the activation flag of driver is set true if requested. On the other hand, non-blocking does not include such settings.(4) overwrite property of signal driver: Verilog-HDLdoes not remove the events scheduled by the previous assignment. VHDL removes all the events scheduled by the previous assignment.In order to assure to establish the common foundation for the both languages, we intentionally ignored the delicate differences in the two simulation cycles.(1) The stratification mechanism of Verilog-HDL isignored. The separated treatment of non-blocking assignments and blocking assignment is replaced by the formulation using the thread of control.(2) non-deterministic behavior of Verilog-HDLconcurrent process. LRM explicitly requests the order preservation that the event must be scheduled in the simulation queue in accordance with the syntactic order when there are multiple assignments for the same target in the same always block (the same concurrent process).(3) resolution: Verilog-HDL has two type of signals:wire and register. Wires should be resolved by the signal resolution mechanism such as wired-or or wired-and. But registers should modify the driver by adding the new event. Therefor, the reuse of resolution mechanism for VHDL is applicable for wires, not for registers.(4) In the LRM for Verilog-HDL, there is no concept ofsignal driver. However, the introduction of the concept is not harmful but useful. The flat (uniform) treatment of all events for signals could be organized as the driver just like as the concept VHDL has adopted.By ignoring the above differences of the two simulation cycles, we can reuse both the semantic functions and the simulation cycle as the common foundations, which are already developed by ASM [2].3. The problem: misunderstanding on net delayThe task to get accurate understanding on net delay is not easy from reading LRM in Verilog-HDL. For example, syntax does not always reflect the semantic classification of objects: the two delay3 options have different meanings in the following BNF rule (FIG.1): all other wire refers net delay data found in net declaration rather globally. When we generates a driver, we refers a delay data found in continuous assignment. Its reference is confined in that driver locally.Although this fact could be read carefully from the chapter 6.1.3 LRM (FIG.2), the accurate understanding for the propagation of signal change seems not so easy.This descriptive explanation may cause the wrong interpretation about net delay. Let illustrate such semantic fault by using the following stimulus and net delay description [9] (FIG.3, FIG.4).A wrong interpretation (FIG.5, FIG.6): At the current time Tc=30, the waveform r2=0 (called w1) is scheduled at Tc+30+10 = 70. Next, at the current time Tc=30+25=55, the waveform r1=0 (called w2) is scheduled at Tc+20+10 = 85. At the same time, the effect by r1 is directly propagated to w, the waveform w2should overwrite the waveform w1. Therefore, the value of w is ‘0’ at the time 85, and is keeping its old value ‘1’until that time 85. That causes the cancellation of the event of r2 (the waveform w1).This wrong interpretation suggests that we may believe that cancellation of all previous events by the new assignment removes the events more excessively than one must expect. The correct interpretation (FIG.7, FIG.8) is based on the resolution mechanism on wires. The waveform r2=0 is scheduled at the time 30+30=60, and the waveform r1=0 is schedule at the time 55+20=75.Next the waveform is resolved, and then the result is delayed by 10 cycles (net delay). Finally, w = ‘x’ at the time 60+10=70, w=”0” at the time 75+10=85.This paper will extend my previous work [8] by augmenting the treatment for net delay mechanism for continuous assignment. The Stewart’s discussion [9] is the first proposal pointing out the insufficiency of the definition on the net delay. His solution was the introduction of the new function “combine2” (for example, see FIG.9) to explicitly describe the signal resolution.The Stewart’s function “combine2” explains thesemantics via the syntactic rewriting of Verilog-HDL source code, and therefore it is indirect semantics. If we want to know what is the differences between the two descriptions (compare FIG.4 with FIG.10 and FIG.11) including the warning or error interpretation, the immediate answer is not found by the combine2. Anyway, it is disadvantage that he could not mention the semantics for a continuous assignment.4. Formal semantics for net delayOn the other hand, our approach will directly specify the semantic behavior by the ASM description. It is our advantage, for example, to explicitly reveal the relationship between the data specified by net delay declaration and events scheduling for signal driver. As the simulation model is common to the both languages, note that the concept of net delay is defined too in VHDL simultaneously (however, syntax is not proposed yet.). The target semantics is implemented by the equivalent always block in FIG.12.This definition is similar to the definition for the concurrent signal assignment in VHDL, which reflects the nature of iterative (continuous) evaluation: whenever a signal changes, a new event is scheduled. In fact, this definition is not mentioned in the LRM. However, we will intentionally introduce such an artificial definition via the sequential counterpart for continuous assignment, which is called “sequential continuous assignment”. Its semantic rule is given as FIG.13.The semantic functions and semantic objects are summarized as follows. These are almost originally formulated by [2], and a few of them are enhanced by [8].- driver(P, S): the driver of signal S in process P. It is the sequence of <value, time> - a pair to represent the scheduled events.- active(d) : the flag to show whether the drive d is active or not. The simulation kernel to activate the computation process to set the driving value, the effective value and the current value refers it.- SingleWaveform: the waveform to be newly appended to a driver. Its value part is computed from the evaluation of the expression Expr. Note that the renaming of this semantic object from "Waveform" (VHDL) to "SingleWaveform" (Verilog-HDL). This suggests that only single element is admissible as waveform in Verilog-HDL.- d |> T : the relative future part of the driver d with respect to the time T. This is an enhanced semantic function in order to insert a SingleWaveform to driver.- Time’ : the absolute time value summated from the specified assignment delay Time, the net delay netDelay(S) and the current simulation time Tc.- tail (d) : the tail part of the driver d as a list.- d |< T : the relative past part of the driver d with respect to the time T.- first (d) : the first part of the driver d as a list.- ^ : the concatenation operator to append waveforms. To implement a "transport delay" mechanism, it is sufficient (the reject function is not necessary.) - reject : the function to implement “inertial delay”mechanism by removing the small-width pulses such as glitch. The combination of waveform append, trimming of waveform by first, and the relative past part of the driver with this function reject will produce the final rejected waveform.The net delay data is stored in the variable netDelay(S) whose value is set by the instance of net declaration and the data is possible to be shared globally by referring S in any other continuous assignment. This shows the explicit relation between the net declaration and the event scheduling in continuous assignment. To represent the event insertion, the two functions d | > T (future part) and d |< T (past part) are used. If the specified delay time is zero, then the drive is set “active” immediately. This is implemented by using the active flag active(driver(Process, S)). The simulation kernel provides the resolution mechanism with respect to the drivers.We can develop a further semantic discussion. For instance, FIG.14 describes the semantic rule for VHDL transport delay. Using this rule, we can recognize precisely semantic difference between Verilog-HDL and VHDL. (1) It cancels the future part of waveform by replacing all the previous waveform by newly generated “Waveform” specified in that assignment. On the other hand, FIG.13 keeps the future part of the driver by appending it directly. (2) Here the transport delay mechanism is implemented as the concatenation of the value of driver at the time (Tc+Time1) and “Waveform”. FIG.13 uses the function "reject" which shows the inertial delay mechanism. (3) Additionally, we can also easily identify the differences from the two transport delay mechanisms of Verilog-HDL by [8]. The pure transport delay for continuos assignment copies the driver itself, not appending the waveform. The modified transportdelay for assignments (blocking/non-blocking) keeps the future parts. (4) There is no netDelay(S) part in the rule for registers. This shows the difference between nets and registers in Verilog-HDL. Thus, the precise semantic comparisons have achieved.Finally, we should discuss the background why the misinterpretation mentioned by Stewart [9] was taken. (1) In Verilog-HDL, the cancellation of event should not be occurred for registers. On the contrary, in VHDL, an event may be cancelled by the future events scheduled by other signal assignment. At first study, we cannot determine which mechanism is chosen for wires. (2) As there is no concept for “sequential continuous assignment” in the LRM, the propagation of event is not well formulated. By these fact (1) and (2), the interaction between the propagation mechanism and the resolution mechanism is not well formulated by the descriptive explanation in the LRM.In the meta-position of language understanding, by the above discussion, we have showed why such a misinterpretation is popular. A Verilog-HDL expert, who only has learned Verilog-HDL, cannot think about the cancellation of scheduled event. On the other hand, a VHDL expert, who only has learned VHDL, implicitly assumes the cancellation. When a VHDL expert tries to learn Verilog-HDL, as both languages seem to be very similar, the difference is not recognized. A Verilog-HDL expert may not give the immediate correction for VHDL expert's misinterpretation because the cancellation is out of reach of his think. Such a recognition gap was bridged by the interoperable property of our semantic model. 5. SummaryAs a conclusion, a formal semantic analysis for Verilog-HDL and VHDL is enhanced on net delay mechanism in order to give the common simulation model especially focusing on signal scheduling mechanism. Based on this model, we have also clarified the background why the semantic misinterpretation is so popular for VHDL experts. Our semantics is expected to become a coherent first step for a future semantic interoperability analysis on multi-semantic-domain such as Verilog-AMS and VHDL-AMS.References> @ J-M. Berge et al, chapter 9, Verilog and VHDL, in VHDL Designer’s Reference, pp.231-317, Kluwer Academic Publishers, 1992.[2] E gon Boerger et al., A Formal Definition of anAbstract VHDL’93 Simulator by EA-Machines, in Formal Semantics for VHDL, pp.107-139, Carlos D.Kloos, et al. (Editors) “Formal Semantics for VHDL”Kluwer Academic Publishers, 1995./gasm/hardware.htm#vhdl [3] H isashi Sasaki, et al., Semantic Validation of VHDL-AMS by Abstract State Machine, pp.61-68, IEEE/VIUF BMAS97. October 1997.http://katayama-www.cs.titech.ac.jp/~sasaki/vhdl_ams/[4] T akeshi Sasaki, et al., Semantic Analysis of VHDL-AMS by Attribute Grammar, FDL98. September 1998.[5] T om Kazmierski, A formal description of VHDL-AMS analogue systems, DATE98, pp. 916-920. [6] M ike Gordon, The Semantic Challenge of Verilog-HDL, LICS’95, 1995./users/mjcg/[7] D ominique Borrione, et al., An approach to Verilog-VHDL interoperability for synchronous designs, CHARME’97. October 1997. http://www-tima-vds.imag.fr/Publications/Charme97.ps[8] H isashi Sasaki, A Formal Semantics for Verilog-VHDL Simulation Interoperability by Abstract State Machine, DATE99, pp. 353-357.[9] D aryl Stewart, Combining Verilog Signals in Nets,May 13, 1997. /users/ [10] J ohn Fiskio-Lasseter, A Formal Description ofBehavioral Verilog Based on Axiomatic Semantics.Tech. Rep. TR-98-04, Univ. of Oregon. 1998./~johnfl/thesis/[11] J ohn Willis et al., Verilog: Dialect of VHDL?, VIUFSpring 1996.[12] D .J. Smith, VHDL & Verilog Compared &Contrasted – Plus Modeled Example Written in VHDL, Verilog and C. DAC 1996.[13] X iaoshan Li, Formal Semantics of Verilog HDL,FDL99, August 1999. (to appear)[14] J ohn Fiskio-Lasseter, Amr Sabry. Putting OperationalTechniques to the Test: A syntactic Theory for Behavioral Verilog./~sabry/papers/index.html。

相关文档
最新文档