On the Relationship between Model-Based Debugging and Program Slicing
- 格式:pdf
- 大小:132.67 KB
- 文档页数:8
Py2neo是一个Python的Neo4j图形数据库驱动程序,它允许我们在Python应用程序中便捷地操作和管理Neo4j数据库。
在Py2neo 中,merge是一个非常重要的方法,它可以用来将节点和关系合并到数据库中。
在本文中,我将深入探讨Py2neo的merge用法,并结合具体示例来详细说明其深度和广度。
一、merge方法的基本概念在Py2neo中,merge方法被用来执行节点和关系的合并操作。
它的基本语法如下所示:```graph.merge(entity, label, primary_key)```其中,- entity表示要合并的实体,可以是节点或关系。
- label表示实体的标签,用来指定要合并的实体类型。
- primary_key表示实体的主键,用来指定实体的唯一标识符。
二、节点的合并在Py2neo中,通过merge方法可以将节点合并到数据库中。
假设我们有一个Person节点,其属性包括name和age,我们可以使用merge方法将此节点合并到数据库中,并指定name属性作为主键,示例如下:```from py2neo import Graph, Nodegraph = Graph()node = Node("Person", name="Alice", age=30)graph.merge(node, "Person", "name")```在这个示例中,我们创建了一个Person节点,并将其合并到数据库中。
如果数据库中已经存在名为Alice的Person节点,merge方法会根据name属性进行匹配,如果不存在,则会创建该节点并添加到数据库中。
三、关系的合并除了节点,merge方法还可以用来合并关系。
假设我们有两个节点分别表示Person和Company,并且它们之间存在投资关系,我们可以使用merge方法将投资关系合并到数据库中,示例如下:```from py2neo import Relationshipperson = graph.nodes.match("Person", name="Alice").first() company = graph.nodes.match("Company", name="ABC").first() relation = Relationship(person, "INVEST",pany,amount=1000000)graph.merge(relation, "Person", "name")```在这个示例中,我们首先获取了两个节点分别表示Person和Company,然后创建了一个投资关系,并使用merge方法将其合并到数据库中。
道德与法律的关系(The relationship between morality and law)The relationship between morality and lawTo analyze the relationship between law and morality, we must first understand the meaning of morality. Generally, the mention of morality, there is no doubt that people will associate it with kindness, beauty, justice, glory together, and law, but also as a way to adjust social relations, through social customs, people's beliefs to implement. Therefore, it is understood that morality is the sum of the norms of behavior that regulate the relationship between man and society. Morality is a complete concept, rooted in the customs and habits, in the primitive society, people living in a kinship based clan society, customs adjustment depends mainly on the clan members, concluded from the food distribution to the marriage, reflects the positive role of customs. However, with the complexity of social life, social relations become more complex, simply by the customs and habits have not completely adjusted, so the moral is generated, and so the moral is not abstract from people's heart, but not from religious theology, but on the basis of a certain material. On the moral philosophy as the superstructure, is to maintain the economic base class, with the development of productive forces, the customs and ethics to adjust all social relations has been impossible, the society need more powerful, more standards and norms to adjust, the law will be generated. The emergence of the law does not mean that the adjustment of social relations no longer depends on morality, and the law has its limitations in the way of adjustment and the scope of adjustment, and morality is still an important means of adjusting social relations. Both law and morality play an important role in the adjustment of socialrelations. Morality, as a way of adjusting social relations, is inseparable from its content and characteristics. In terms of its content, morality is valuable. Value, that is, goodness, beauty, justice, glory, justice, etc., is the highest level of morality, and also the highest standard of judging people's wishes and behaviors. [1]. School of natural law in the western jurisprudence, the value analysis method to study the law, explore the law, they will be more visible in connection with morality, moral evaluation of legal also has an important role, this is an important difference between moral and habits, to see whether the two value evaluation function. In addition to its value, morality has the following characteristics. First, morality has class nature. Different classes have different moral, for example, the American Declaration of independence expressed by the North American bourgeois moral criticism of British rule, the Communist Manifesto expressed by the working class of bourgeois moral criticism, deeply reflects the different class moral opposition. Second, the morality is material restriction, the aforementioned produce and material basis of morality is inseparable, it is decided by the material basis of society, change and development of material basis, the nature and content of moral development and change accordingly. Third, common morality is mainly reflected in the content, because of moral justice, goodness, beauty and other content accords with people's values, can be generally accepted by people, for example, respect for human dignity and equality, mutual respect, protect the environment, but not ignorant, help each other, as people in economic, political, cultural and other exchanges in various fields increasingly close, common morality will be more concentrated. Confucianism is the mainstream consciousness Chinese in traditional culture, theprocess of Chinese legal history is actually the process of Confucianism, therefore, the relationship between law and morality is embodied in Confucianism, the Confucian thought of "supplementing" concept is also reflected in the later Chinese law. For example, Confucius believes that good law embodies a spirit of benevolence, in addition, it must play a role in maintenance of filial piety, he said "the implicit father for the child, the father" is against the then implicate Kin inhumane legal principles, emphasizing the value of kinship and filial piety. Chinese law?? the provisions of "concealment", namely "father son for hidden moral law". Xunzi said: it is not indecent, too. (Xunzi? Slim?). Courtesy is the moral, meaning that does not conform to the ritual law is not a real law, that is to say the true law must reflect a moral spirit, the moral spirit is the "ceremony", so Chinese feudal legal system is a kind of etiquette. In the west, it is different from china. Chinese is a large agricultural country, self-sufficient, but western manynationalities, adjacent to each other, mainly rely on commercial relations with other countries, the western commodity economy is developed, so the adjustment of commercial economy in the field of private law is developed. People prefer to live freely in a free, equal and equitable environment. Therefore, morality, which is free, equal and fair, promotes the evolution of the law in this direction. For example, Bodenheimer, an American jurist, said: "in unfair competition.",Some reform in recent years, the courts and the legislature of, must be attributed to enhance and improve the moral sense, and thus the prevailing notion that commercial society must rely on more than moral condemnation means to effectively protectagainst some kinds of reprehensible without ethical business conduct. In addition, there have been some new developments in the area of fraudulent advertising, [2]. He believes that some business ethics should be given legal force. One of the basic principles of civil law or commercial law principle, a moral obligation into legal obligations, therefore, from the relationship between western law and morality, the law of evolution of the west is successful, so far as many Eastern countries for reference. In the front, we are talking about the development model of the relationship between law and morality in China and the West. Then what is the relationship between law and morality? The first performance in the consistency of law and morality, that is the same purpose, law and morality at the same time as the superstructure, is restricted by the economic basis, but also has a certain historical independence, they are to safeguard the interests of the ruling class, an important means of adjusting social relations. Secondly, law and morality complement each other in function, and law and morality belong to the category of social spiritual civilization. They are ways to adjust social relations, and they function differently in different environments. In our example, in times of peace, the rulers generally pay much attention to the role of morality, in effect ruled, however in the riots in the rulers will tend to use legal means to suppress opposition, we can see that the moral is the basis of law, the law is the moral barrier, the legal system is not perfect, social disorder that leads to moral decay, conversely, if the law justly, equality, can also promote the role of moral education, at the same time, the implementation of the law of morality also play a supporting role, through the public opinion and personal moral beliefs to ensure legal compliance,but also can promote the judicial and law enforcement justice. Morality is a means of crime prevention, punishment is afterwards punishment, and moral education publicity can also reduce crime rate. Generally speaking, some people who are guilty of crimes, although they have a weak sense of law, are more morally bankrupt, such as homicide, robbery, arson and other crimes, and most of them have no human rights concept. Most of the crimes of theft are intended for nothing, while corruption, dereliction of duty and so on are no social responsibility or professional ethics. The relationship between law and morality is also manifested in the convergence of content. The front has mentioned the earliest law by morality evolved, now, law and morality are mutually independent, but the law is still on the basis of ethic, legal moral norms into legal norms, the provisions of the positive values for the law should follow the guidelines. For example, the principle of good faith in civil law, and unfair competition principle, discuss business to hair in front of the principle of fairness, respect principle, so that the original is reflected in the moral obligation is realized through legislation. At the same time, the law will also be some negative moral obligations in the form of legislation prohibited, such as the prohibition of fraud, perjury, corruption and bribery, in violation of the moral, is a violation of the law. Therefore, ordinary people can know what crime is and what is not criminal behavior only by virtue of common sense. They can not always explain the cause of crime blindly, and most of them are morally bankrupt. On the other hand, some legal norms are, in turn, a new kind of moral norm. Such as "no red light running", "forbidden building", "adjacent relations" is also a social morality. The law prohibits black market trade, prohibits unfair competition,and prohibits the sale of fake and shoddy goods. It is also a business ethic to comply with these regulations. Although the law and morality are closely linked, is common even in some aspects, but two of them belong to different superstructure, can not be completely equal to the moral law, of course, can not replace the moral law, if the conversion of all moral principles for legal principles, then the code became a moral code, which is not conducive to the progress of mankind, so the law and morality are essentially different. First, the history and the way of law and morality which is different from the historical process, the view, law is the product of a certain historical stage of human society, primitive society without law, each historical period and social morality exists in human society, any society or moral behavior standard, in addition, with national, racial, religious, the custom is different, and the law in a country or a region, is unified, they produce from the way the law is through the national legislative amendment and repeal, only grasp the state power of the class, this class will be transformed into a national compulsory, universal binding law. And morality is transformed by people's long-term habits and customs, and the laws are enforced by national coercive power,And morality relies more on public opinion and the people's inner faith and conscience to comply with [3]. Second, the scope of law and morality, the law is divided into crime and non crime, legal and moral standards of the law, is the main distinction of good and evil, these two lines can overlap each other in a certain range, can be independent of each other, there are many kinds of situations: (1) the negative moral law is also prohibited. Such as homicide, arson, poisoning, and a seriesof criminal acts. (2) some moral standards do not deny, and the laws prohibit them. Negligent crime. (3) the moral standards are affirmed, and the laws are forbidden, such as the Hamlet character in the feudal society or the evil law against the ruling class. (4) morality does not promote, but the law permits, such as: divorce, but if a person has long been persecuted by domestic violence and divorce, modern law and morality are supported. To sum up, the legal and moral adjustment and scope, have overlapping part, there are conflicting, single and moral laws, this part is the "minimum moral", abide by the law, is at least a moral obligation, but the law does not intervene or not moral intervention intervention. In terms of personal integrity, quality, or interpersonal relationships, in this sense, morality is more applicable than law. Laws that have nothing to do with morality, which can be adjusted by morality, can only be adjusted by law. As the rise of economic law, administrative law, environmental law, some just procedural provisions, and less moral relationship, or Never mind, not only by these laws that criminal law moral can be judged, therefore, from this perspective, the scope of law than moral guangzhou. Of course, in regulating the laws of man and nature, such as environmental protection law, it is not entirely irrelevant to morality. As a result of environmental pollution and destruction of ecological balance, people's attitude towards nature is regarded as a new moral problem. Such as deforestation, air pollution and other acts must be punished by law, also condemned by the moral opinion. In a word, both the law and morality develop with the development of human life, and the scope of adjustment is expanding day by day. Finally, the consequences are different, but the illegal moral cause two consequences, one is the legal punishment, not only in theprimitive society, moral customs, primitive society, people naturally will form some tribal taboos, they regarded as the crime of violation of taboos, violators often to all kinds of punishment, such as confession, expulsion. Two, the condemnation of conscience and the pressure of public opinion, each person's ability to bear the conscience is not the same, if individuals do not exist such a conscience, and even ignore public opinion, then the moral norm is invalid. For example, in the face of a drowning man, a person has the ability to save without the rescue, and if he thinks his actions are not wrong, then morality is lost to him. Sometimes an individual's conscience fails to recognize that his actions are immoral, and in another period, and at another time, it is immoral to realize that his actions are immoral. But the law is different, it is backed up by the force of the country, when the implementation of the illegal behavior, does not need to consider the illegal subject capacity, only according to the standards applicable law, make the evaluation, in violation of the law should bear the legal consequences, subject to legal sanctions. The difference between morality and law is not entirely in the presence of coercion or morality, but it can compel the people to fulfill their moral obligations with the help of social invisible pressure. The difference between law and morality shows that law is not omnipotent, and the coercive means to ensure the enforcement of law are not omnipotent. The limitations and weaknesses of its inherent law, required by the moral support and supplement, we should make full use of the legal and moral two mechanisms to be adjusted to form and maintain an orderly and efficient justice of freedom and fraternity social life style [4]. People often think that the consistency of law and morality, individual in violation of thelaw is in violation of the moral, but the relationship between law and morality is not so simple, although they have many similarities, but after all, two different nature, affected by factors such as history, value conflict is the two most intense. From the China history, conflict of law and morality is particularly intense, and the solution of this conflict is often the legal and moral subject, recorded such a case in "Houhanshu", served as Prime Minister of Qi Yuan bridge, a dutiful son for father revenge and kill people, and prison prisoner in bridge yuan for that matter, touched by their filial piety, to be released, but not for the matter, the magistrate in charge of the case, according to the law of the murder of his Chicago road killed. Under the bridge in the county magistrate kill element, the reason is the official county magistrate cool storm, the case is really intriguing, in accordance with the law of the magistrate become criminals sentenced to death, and the murderer has become to forgive the dutiful son, received sympathy. On the scales of morality and law,The people obviously add emotional weight to the moral side. There is also a case, in the period of the Republic of China, Shi Jianqiao's father in a straight from the war, Sun Chuanfang was unfortunately captured by Sun Chuanfang, brutally murdered him. When he was twenty years old, the frail woman Shi Jianqiao determined to revenge, careful planning, and finally on 1935 in Tianjin Sun Chuanfang will be killed, and then calmly surrender. At that time the public sympathy for her actions, some celebrities such as Feng Yuxiang, Li Liejun, Yu have signed a letter asking the court to pardon her crime. It seems that the tradition of morality above law has been ingrained in china.Today, the "loyalty" case also reflects the moral conflict. In ancient times, this conflict does not exist today, the law does not allow the public, even so, the public is often judge sentencing discretionary lighter plot. In the west, however, sometimes the opposite is true. The people pursue the legitimacy of law more than morality and go to extremes. Such as the famous Simpson case, evidence and motive all can prove that Simpson did, because the police forensics illegal, illegal and criminal procedure law, gloves and Simpson found on the spot. The hand model is not the same, the court found guilty of "legal" although Xin, but for the society not moral. The conflict between law and morality is inevitable, and it is affected by many aspects. At the same time, the development of society, morality, Yi Suizhi, but the law is relatively backward, prone to conflict. Furthermore, his legal transplantation of a country, which is now in conflict with the original method, but after all I think of social morality, the legal and moral conflict, because the two are completely different social forms, they are consistent, but their value is not one-to-one, if is one-to-one correspondence so, there will be no difference between law and morality, as mentioned before, the code will become a moral code, no social force constraints into chaos. The conflict of value between law and morality is inevitable. Although this conflict can not be completely eliminated, it should be minimized. First of all, the construction of morality should be carried out simultaneously with the construction of the law. In the legislative reform, moral factors should be taken into consideration, so that the law will not deviate from the moral mainstream. Secondly, in the process of transplanting the law, attention should be paid to the national conditions of this country. Third, we should strengthen legal publicityso that people's thinking will rise from the moral level to the legal level. Therefore, how is the legal moralization, the moral legalization is most important. The morality embodied by law is accepted by the broad masses of the people, and morality has the nature of law and is complied with by the people. It is the most perfect interpretation of the relationship between law and morality.。
1. What are the difference between general linguistics and descriptive linguistics and what sis the relationship between them? (P.1)A: Differences between general and descriptive linguistics:(1) They have different goals:General linguistics deals with language; descriptive linguistics study one particular language;(2) They have different aims:General linguistics aims at developing a theory that describes the rules of human language in general;Descriptive linguistics attempts to establish a model that describes the rules of this particular language.Relationships between general and descriptive linguistics:General and descriptive linguistics depend on each other:(1) General linguistics provides descriptive linguistics with a general framework in which a particular language can be analyzed and described; (2) The resulting descriptions of particular languages supply empirical evidence which may confirm or refute the models put forward by general linguists.2. What is the nature of language? (P7)Language is a system of arbitrary vocal symbols, which is creative, double-structured and changeable.3. What is the difference between langue and parole? (P2/P24)a. Langue is the system of language. Parole is the speakers’ speech.b. Langue refers to the abstract system of a language, while parole refers to the concrete act of speaking in a definite time, place and situation.c. Langue underlies parole and parole, in turn, is a manifestation of langue.4. What is the difference between competence and performance? (P2)a. Competence is the speaker-hearer’s knowledge of his language.b. Performance is the actual use of language in concrete situations.c. Competence is abstract, while performance is concrete.5. Why do linguists maintain that language is primarily speech? (P4) Linguists maintain that language is primarily speech, and not the written form. This view may be justified by the following reasons.a. Biologically speaking, children begin to learn to speak much earlier than to learn to read and write.b. Functionally speaking, the spoken form is used more frequently than the written form in our daily life.c. Historically speaking, all human languages were spoken before they were written and there are still many languages in the world today which have not been written down.The emphasis on the spoken form indicates that linguistic study is primarily based on the data collected from living speech.6. What does it mean by saying that language is arbitrary, creative and double-structured? (P4-5)A. The relationship between the sounds and their meaning is arbitrary.B. Language is creative.a. Every language contains an infinite number of sentences, which, however, are generated by a small set of rules and a finite set of words.b. The length of a sentence has no limit in theory.c. The rules with recursive properly can account for the creative aspect of language.C. Language is double-structured. There are two levels: grammatically-meaningful and sound-meaningless.7. What features of language can differentiate human languages from animal communicative systems? (P7)Human language is a system of arbitrary vocal symbols, which is creative, double-structured and changeable. Those unique features like creativity, duality of structure and changeability can differentiate human languages from animal communicative systems and enable human languages to be the most efficient, flexible and versatile means of communication in the world.8. How many stages does the scientific method have? What are they? (P9) There are four stages of scientific method:a. collecting data,b. forming a hypothesisc. testing the hypothesisd. drawing conclusions9. What are the three linguistic biases? (P9-10, P7)a. One common linguistic bias is that some languages are primitive and some languages are advanced.b. Another deep-rooted bias is that only the standard variety is the pure form of a language.c. Change is not natural for all living languages and such a language is a sign of corruption and decay.10. How is a rule constructed? (P15)a. To construct a rule, the linguist starts with collecting data.b. Based on the data collected, he may construct a very simple rule as a tentative version.c. Then he examines the tentative rule against further data. If the additional data do not agree with it, he has to modify it.d. He keeps on testing the rule and, accordingly, revising the rule until the rule can account for all the relevant data collected.Thus, the rule formed is open to further modifications.11. Give examples to illustrate the two features of an adequate model of competence: explicitness and generativeness. (P15-16/P6)a. By saying a linguistic model is explicit, we mean that the rules the model contains are clearly and precisely defined. Even a computer can produce all and only the grammatical sentences if the rules are fed to the machine.b. By saying the model is generative, we mean that the model contains only a small set of rules which, however, can generate an indefinitely large number ofc. For example, “so…that” is explicit, but they can generate infinite sentences. eg. He is so fat that he could not ran fast.He was so lazy that he never washed his clothes.…12. What are the four types of linguistic knowledge? (P18-19)The four types of linguistic knowledge are phonological, morphological, syntactic and semantic.a. Phonological knowledge is a native speaker’s intuition about the sounds and sound patterns of his language.b. Morphological knowledge is a native speaker’s intuition about how a word is formed.c. Syntactic knowledge is a native speaker’s intuition about whether a sentence is grammatical or not.c. Semantic knowledge is a native speaker’s intuition about the meaning of language.13. Why is Saussre regarded as the former of modern linguistics? (P21-22)a. The obvious reason is that the book under his name “A Course in General Linguistics” is the first real essay on linguistic theory.b. In this book, quite a few theoretical distinctions introduced have become foundations of linguistic study and exerted great influence on the later development linguistics.c. Chief among them are the distinctions between synchronic and diachronic, syntagmatic and paradigmatic, langue and parole.14. Give examples to illustrate the difference between synchronic and diachronic. (P22)a. If we study the changes in the Chinese language that took place between the 1940’s and the 1960’s, it would be a diachronic study.b. But if we study the Chinese language in the 1940’s, then it would be a synchronic study.concerned with the historical development of a language and the latter is concerned with the “state” of a language at a particular point of time.15. Give examples to illustrate the difference between syntagmatic and paradigmatic. (P116-118/P22-23)a. A syntagmatic relation refers to the sequential characteristic of speech.b. A paradigmatic relation is a relation between a linguistic element in an utterance and linguistic elements outside that utterance.c. We can go tomorrow syntagmatic relationShe may come soonI will ask nextY ou could sleep now………paradigmatic relation16. What is a consonant and what is a vowel? (P30)a. A consonant is a speech sound where the airstream from the longs is either completely blocked, partially blocked or where the opening is so narrow that the air escapes with audible friction.b. A vowel is a speech sound in which the airstream from the lungs is not blocked in any way in the mouth or throat, and which is usually pronounced with vibrations of the vocal cords.17. Is the spelling of words a reliable means of describing English sounds? Why or Why not? (P30-31)No, it isn’t.a. Sometimes a single letter may represent different sounds.b. Sometimes, different letters or combinations of letters may r4epresent a single sound.c. The advantage of this system is that within the system, one symbol represents one sound and every symbol has a consistent value.18. What is the difference between plosives and affricates? (P37)b. Affricates are brought together to form a complete closure but not followed by a sudden release, rather by a low release with audile friction.19. What is the difference between phonetics and phonology? (P20, P53)a. English phonetics is concerned with all speech sounds that occur in the English language. It studies how those sounds are produced, transmitted and perceived, and how they re described and classified.b. Different from English phonetics, English phonology does not deal with the actual production of English sounds, but with the abstract aspects: the function of sounds and their patterns of combination.20. What are the three conditions of a minimal pair? (P54)a. They are different in meaningb. They differ only in one sound segment.c. The different sounds occur in the same position in strings.21. Give examples to illustrate the differences between phonemes, phones and allophones. (P90)a. Phonemes are said to be minimal distinctive units in the sound system of a language.b. Phones are the realizations of phonemes.c. Allophones are the realizations of a particular phoneme.d. For example,22. Give examples to illustrate the differences between contrastive distribution, complementary distribution and free variation. (P59-60)a. If two or more sounds can occur in the same environment and the substitution of one sound for another brings about a change in meaning, they are in contrastive distribution.b. If two or more sounds never appear in the same environment, they are said toc. If two or more sounds can occur in the same environment and the substitution of one sound for another does not cause a change in meaning, they are said to be in free variation.d. The sounds either in contrastive distribution or in free variation can occur in the same environment. The difference between them lies in the fact that in the former case, the substitution of one sound for another results in a change in meaning, but this does not happen in the latter case. Complementary distribution is clearly different from the previous two types of distribution. The sounds in complementary distribution never occur in the same environment.23 What are the 3 principles of identifying phonemes? (P61)a. The sounds that are in contrastive distribution are different phonemesb. The sounds that are always in free variation are allophones of the same phoneme.c. The sounds that are in complementary distribution and also phonetically similar are allophones of the same phoneme.24. What is the difference between segmental features and suprasegmental features? What are the suprasegmental features? (P69)a. The distinctive features, which can only have an effect on one sound segment, are called segmental features.b. The distinctive features, which can affect more than one sound segment and can also contrast meaning, are called suprasegmental features.25. What’s the difference between phonemes and morphemes? (P54, P83)a. Phoneme is defined as a minimal distinctive unit in the sound system of a language.b. A morpheme is defined as a minimal meaningful unit in the grammatical system of a language.26. What are interrelations between semantic and structural classifications of morphemes? (P84, P86)a. Semantically, morphemes are grouped into general categories: root morphemes (roots) and affixational morphemes (affixes).b. Structurally, they fall into two classes: free morphemes and bound morphemes.c. All free morphemes are roots, but not all roots are free morphemes. All affixes are bound morphemes, but not all bound morphemes are affixes..27. Please explain the difference between inflectional and derivational28. How do we judge whether two or more minimal meaningful sequences of phonemes are one morph or different morphs? (P92-93)a. If two or more minimal meaningful sequences of phonemes are identical in both form and meaning, then they are regarded as one morph.b. If two or more minimal meaningful sequences of phonemes are the same in form but different in meaning, then there are as many morphs as there are meanings.c. If two or more minimal meaningful sequences of phonemes are the same in meaning but different in form, then there are as many morphs as there are forms.d. If two or more minimal meaningful sequences of phonemes are different both in form and meaning, there are as many morphs as there different forms and meanings.If two or more morphs are semantically identical and also in complementary distributing, they are then said to allomorphs of the same morpheme; otherwise, they belong to different morphemes.30. What is IC analysis? (P99/P126)a. IC analysis simply means that we divide the morphemes of a word into the two groups and then divide each group into subgroups and so on, until we reach single morphemes.b. Labeled IC simply means that we divide the morphemes of a word or the words of a sentence into the two groups and then divide each group into subgroups and so on, until we reach single morphemes of a word on a signal word of a sentence..31. What is the difference between an empty morph and a zero morph? (P97-98)a. Empty morph is defined as a morph that has form but no meaning.b. Zero morph is defined as a morph that has no form but has meaning.32. What are two ways of studying sentences? Explain them. (P116)a. We make structural descriptions of sentences to illustrate the parts of a sentence and the relationships among them, this is called static study.b. We examine the process by which sentences are generated by syntactic rules this is called dynamic study.33. What are the three syntactic relations? (P116-118)a. Sequential or syntagmatic relations are refers to the linear ordering of the words and the phrases within a sentence.b. Substitutional (paradigmatic) relation is a kind of relation between linguistic forms in a sentence and linguistic forms outside the sentence.c. Hierarchical relation shows us the inner layering of sentences.34. What are the differences between surface structure and deep structure?a. A surface structure corresponds to the linear arrangement of words; a deep structure corresponds to the meaningful grouping of words.b. A surface structure is relatively concrete, and a deep structure is abstract.c. A surfaces structure gives the form of a sentence; while the deep structure gives the meaning of a sentence.d. A surface structure is pronounceable, but a deep structure is not pronounceable.35. What are the three kinds of operations performed by T-rules? (P180)a. rearranging the sentence elements;b. adding a new element to the phrase marker;c. deleting an element from the phrase marker.36. What are the differences between PS rules and T-rules? (P139)a. TG grammar has assumed that to generate sentences, we start with deep structures and then transform them into surface structures.b. Deep structures are generated by phrase structure rules (PS rules), and surface structures are derived from their deep structures by transformational rules (T-rules).英语语言学概论11Phonetics has three sub-branches:(1) articulatory phonetics that is concerned with how a sound is produced by the vocal organs;(2) acoustic phonetics that deals with how a sound is transmitted from the speaker ’s mouth to the listener ’s ears;(3) auditory phonetics that investigates how a sound is perceived by the listener.2. Speech organs1-nasal cavity; 2-lips; 3-teeth; 4-aveolar ridge; 5-hard palate 6-velum (soft palate); 7-uvula; 8-apex (tip) of tongue; 9-blade (front) of tongue;10-dorsum (back) of tongue; 11-oral cavity;12-pharynx; 13-epiglottis;14-larynx; 15-vocal cords; 16-trachea; 17-esophagus;。
What is emotional intelligenceAnd the ability to deal with the relationship between oneself and others. Emotional intelligence reflects the ability of individuals to grasp and handle emotional problems. Emotions often go before reason. It is irrational, and its material base is primarily related to the brain stem system. The frontal lobe has a controlling effect on emotion.Second, the basis for intelligence and emotional intelligence is different. Emotional intelligence and intelligence are linked to genetics and environmental factors, but they differ from genetics and environmental factors. The relationship between IQ and genetics is much greater than social environmental factors. According to the concise British encyclopedia · intelligence quotient "ent ry load:" according to the survey, about 70-80% of intelligence differences is the result of genetic inheritance, 20-30% of the intelligence difference is due to affected by different environments." The formation and development of emotional intelligence, the innate factors also exist. For example, "the basic expression of human beings is seen in all human beings and is consistent across cultures." (" emotional intelligence ", Pan Yunming editor, China city press, page 22) American psychologist ekman's research shows that people can never contact with the outside world in the New Guinea correctly judge other people in the photo look. But there is a big cultural difference. The study of folklore shows that there are significant differences in emotional expression of different nationalities. Child psychology research shows that the emotional ability of children born blind children is relatively weak due to the social impact of social communication barriers. Anthropological research shows that the emotions of primitivehuman beings are greatly different from those of civilized people. They are irritable, moody and have poor self-control. Some anthropological researchers in the United States believe that the emotional control of human childhood is so weak that it looks like a collective mental illness in today's eyes. In recent history, we can also see that people's emotions are easily influenced by the social environment, and people always have a deep-rooted conformity mentality. The social sentiments of Germany during world war ii exemplifies this.Third, intelligence and emotional intelligence play a different role. The function of intelligence is to understand things better. People with high IQ, thinking quality, strong learning ability, understanding depth is deep, easily made outstanding achievements in the field of a professional, become expert in a particular field. Surveys show that many highly intelligent people become experts, academics, professors, judges, lawyers, journalists, and others in their fields. Emotional intelligence is primarily related to irrational factors, which influence the motivation of knowledge and practice. It enhances or weakens the drive to recognize things by affecting people's interests, will, and willpower. People with low IQ and high eq, while not as efficient as those with high IQ, can sometimes learn better and achieve more than those with high iqs. Because of the perseverance of the spirit makes the diligence redeems stupidity. In addition, emotional intelligence is the ability of self and other people to grasp and adjust their emotions, so it is important to deal with the relationship. Its effects are closely related to social life, relationships, health and marital status. People with low emotional intelligence have strong interpersonal relationships, marriages break down and leadership levels arelow. People with higher eq usually have healthier emotions, have a fuller marriage and family, and have good relationships. Eight ways to improve your eqIt is good for everyone to learn to draw the right psychological boundaries.You may think unclear boundaries with others is a good thing, so that we can follow one's inclinationsly, and also need not strongly bargaining with each other. This may sound reasonable, but the downside is that people often hurt your feelings and you don't know it.Actually observe around you is not hard to find, line capacity difference is prone to develop phobic people and they don't against predators, and more willing to talk to a third party. If we are the person who violates the other person's psychological boundaries and finds out the truth, we will feel like a cold-blooded idiot. At the same time we feel hurt because we blame ourselves for our mistakes.。
江西省2025届高三11月阶段检测考高三英语试卷试卷共8页,67小题,满分150分。
考试用时120分钟。
注意事项:1.考查范围:高中全部内容。
2.答卷前,考生务必将自己的姓名、准考证号等填写在答题卡指定位置上。
3.回答选择题时,选出每小题答案后,用铅笔把答题卡上对应题目的答案标号涂黑。
如需改动,用橡皮擦干净后,再选涂其他答案标号。
回答非选择题时,将答案写在答题卡上。
写在本试卷上无效。
4.考生必须保持答题卡的整洁。
考试结束后,请将答题卡交回。
第一部分听力(共两节,满分30 分)做题时,先将答案标在试卷上,录音内容结束后,你将有两分钟的时间将试卷上的答案转涂到答题卡上。
第一节(共5小题;每小题1.5分,满分7.5分)听下面5段对话。
每段对话后有一个小题,从题中所给的A、B、C 三个选项中选出最佳选项,并标在试卷的相应位置。
听完每段对话后,你都有10秒钟的时间来回答有关小题和阅读下一小题。
每段对话仅读一遍。
例:How much is the shirtA.19.15. B.9.18. C.9.15.答案是C。
1.What kind of beefsteak would the man likeA.Medium rare one. B.Medium one. C.Well done one. 2.What is the man doing nowA.Making a call. B.Making a bid. C.Applying a bid. 3.What’s the woman’s last nameA.Nangong qing. B.Qing. C.Nangong.4.What does the man want to doA.Make a reservation. B.Buy a restaurant. C.Change a room. 5.What will the man probably wearA.Blue pants. B.White coat. C.Shorts.第二节(共15小题;每小题1.5分,满分22.5分)听下面5段对话或独白,每段对话或独白后有几个小题,从题中所给的A、B、C三个选项中选出最佳选项,并标在试卷的相应位置。
英语专业本科论文《茶花女》英语专业本科论文《茶花女》` An Analysis on Male-centered Consciousness in The Lady of the Camellias Acknowledgement In writing this thesis, I have benefited from the presence of my teachers and my classmates. They generously helped me collect materials I needed and made many invaluable suggestions. I hereby extend my grateful thanks to them for their kind help, without which the paper would notChen Ke, who guided me throughout my writing of this thesis. She carefully read the whole draft and offered painstaking and precious criticism. Her standards of academic excellence have made my revision an exciting and gratifying experience.without the help of those individuals and organizations hereafter mentioned with gratitude: the Foreign Language Department, the University Library and its staff. An Analysis on Male-centered Consciousness in The Lady of the Camellias Abstract The Lady of the Camellias was a masterpiece of world literature and even was presented on the stage for many times. And as we all know, The Lady of the Camellias was the first foreign novel that entered our country. It played an importantrole in modern Chinese literature. It was a tragic love story between Marguerite Gautier, a prostitute and a young bourgeois, Armand Duval. Marguerite was not only a prostitute but also a beautiful girl with pure heart. She sacrificed everything she had for love, even her own life. This essay analyzed the tragic story of The Lady of the Camellias from the prospective of male-centered consciousness. The paper is divided into four parts: the first part introduces the author, the writing background, story itself, and other basic information; the second part introduces the gender theory and male-centered consciousness which belongs to it; the third part analyzes the domination of Alexandre Dumas Fils’s male-centered consciousness on the Novel from different aspects, such as heroine’s identity, character, life experience, indication, women’s thoughts, the uneven relationship between woman and man, the author’s narrative technique; the fourth part sums up the paper and puts forward its practical significance. The tragic ending of the heroine was due to a multitude of reasons. But the main reason should be the domination of male-centered consciousness on the society and people’s thought. We should realize that the male-centered consciousness impacted not only literature works but also every aspects of people’s life. Key Words: Gendertheory; Male-centered Consciousness; The Lady of the Camellias 摘要《茶花女》是法国亚历山大·小仲马的代表作,是一部世界文学经典,曾被多次搬上舞台银幕。
英语四级试卷模拟考试一、写作(15%)题目: The Importance of Reading Classics。
要求:1. 阐述阅读经典著作的重要性;2. 给出你对阅读经典著作的建议;3. 字数不少于120字,不多于180字。
二、听力理解(35%)Section A.Directions: In this section, you will hear 8 short conversations and 2 long conversations. At the end of each conversation, one or more questions will be asked about what was said. Both the conversation and the questions will be spoken only once. After each question there will be a pause. During the pause, you must read the four choices marked A), B), C) and D), and decide which is the best answer.Short Conversations (1 - 8)1. A) At a bookstore.B) At a library.C) At a supermarket.D) At a post office.Question: Where does the conversation most probably take place?2. A) He is a teacher.B) He is a doctor.C) He is a lawyer.D) He is a businessman.Question: What does the man do?3. A) She likes the movie very much.B) She doesn't like the movie at all.C) She thinks the movie is just so - so.D) She hasn't seen the movie yet.Question: What does the woman think of the movie?4. A) Go to the park.B) Go to the cinema.C) Stay at home.D) Do some shopping.Question: What are they going to do?5. A) 8:00.B) 8:15.C) 8:30.D) 8:45.Question: What time is it now?6. A) By car.B) By bus.C) By train.D) By plane.Question: How will they go to Beijing?7. A) Red.B) Blue.C) Green.D) Yellow.Question: What color does the woman like best?8. A) Husband and wife.B) Father and daughter.C) Teacher and student.D) Boss and employee.Question: What's the relationship between the two speakers?Long Conversations (9 - 15)Conversation 1.Questions 9 - 11 are based on the conversation you have just heard.9. A) She wants to find a part - time job.B) She wants to travel around the world.C) She wants to study abroad.D) She wants to start her own business.Question: What does the woman want to do?10. A) Her parents.B) Her friends.C) Her teachers.D) Her classmates.Question: Who can give her some advice?11. A) This weekend.B) Next week.C) Next month.D) Next year.Question: When will she make a decision?Conversation 2.Questions 12 - 15 are based on the conversation you have just heard.12. A) It's too expensive.B) It's too big.C) It's too small.D) It's too far from her office.Question: What's the problem with the apartment?13. A) 1000 yuan.B) 1200 yuan.C) 1500 yuan.D) 1800 yuan.Question: How much is the rent?14. A) One.B) Two.C) Three.D) Four.Question: How many rooms are there in the apartment?15. A) She will rent it.B) She will think about it.C) She will look for another apartment.D) She will buy an apartment.Question: What will the woman do?Section B.Directions: In this section, you will hear 3 short passages. At the end of each passage, you will hear some questions. Both the passage and the questions will be spoken only once. After each question there will be a pause. During the pause, you must read the four choices marked A), B), C) and D), and decide which is the best answer.Passage 1.Questions 16 - 18 are based on the passage you have just heard.16. A) In 1990.B) In 1995.C) In 2000.D) In 2005.Question: When was the company founded?17. A) Computers.B) Mobile phones.C) Cars.D) Clothes.Question: What does the company produce?18. A) In Asia.B) In Europe.C) In America.D) In Africa.Question: Where is the company's main market?Passage 2.Questions 19 - 21 are based on the passage you have just heard.19. A) Reading.B) Writing.C) Speaking.D) Listening.Question: Which skill is the most important in language learning?20. A) By reading a lot of books.B) By watching English movies.C) By listening to English songs.D) By talking with native speakers.Question: How can one improve their speaking skills?21. A) Once a week.B) Twice a week.C) Three times a week.D) Every day.Question: How often should one practice speaking?Passage 3.Questions 22 - 25 are based on the passage you have just heard.22. A) To make friends.B) To get information.C) To kill time.D) To do business.Question: Why do people use the Internet?23. A) Chatting.B) Shopping.C) Studying.D) Working.Question: Which is the most popular activity on the Internet?24. A) It's convenient.B) It's cheap.C) It's interesting.D) It's safe.Question: What's the advantage of online shopping?25. A) They are worried about the security.B) They don't like shopping online.C) They don't know how to use the Internet.D) They prefer to go to the real stores.Question: Why do some people not like online shopping?Section C.Directions: In this section, you will hear a passage three times. When the passage is read for the first time, you should listen carefully for its general idea. When the passage is read for the second time, you are required to fill in the blanks with the exact words you have just heard.When the passage is read for the third time, you should check what you have written.Passage.The Internet has become an important part of our daily lives. We can use it to do many things, such as getting information, _(26)_, chatting with friends, and so on. However, the Internet also has some _(27)_. For example, some people may use it to spread false information or _(28)_. So we should use the Internet _(29)_ and be careful not to be _(30)_ by the false information.三、阅读理解(35%)Section A.Directions: In this section, there is a passage with ten blanks. You are required to select one word for each blank from a list of choices given in a word bank following the passage. Read the passage through carefully before making your choices. Each choice in the word bank is identified by a letter. Please mark the corresponding letter for each item on Answer Sheet 2. You may not use any of the words in the word bank more than once.Questions 31 - 40 are based on the following passage.The development of modern technology has brought great _(31)_ to our lives. For example, we can use mobile phones to communicate with others_(32)_ no matter where they are. We can also use the Internet to get a large amount of information in a very short time. However, modern technology also has some _(33)_. For example, some people are so _(34)_ on mobile phones that they ignore the people around them. And the over - use of the Internet may also cause some _(35)_ problems, such as information overload and Internet addiction.So, we should make good use of modern technology and at the same time _(36)_ its negative effects. We should not let modern technology _(37)_ our lives, but use it to improve our quality of life. For example, we can set _(38)_ for using mobile phones and the Internet, and use them in a _(39)_ way. In addition, we should also encourage people to communicate face - to - face more often and _(40)_ the real world.Word Bank.A) benefits.B) addicted.C) easily.D) negative.E) control.F) limits.G) enjoy.H) psychological.I) replace.J) properly.Section B.Directions: In this section, you will read several passages. Each passage is followed by several questions based on its content. You are to answer these questions on the basis of what is stated or implied in the passage.Passage 1.Questions 41 - 45 are based on the following passage.The idea of having a single career has been an old - fashioned concept for quite some time now. People are increasingly choosing to have multiple careers throughout their lives. There are several reasons for this trend.First, the job market is constantly changing. New industries are emerging, and old ones are disappearing. This means that people may need to retrain and change their careers in order to stay employed. For example,with the rise of the digital age, many people who used to work intraditional print media have had to learn new skills in order to work in online media.Second, people are living longer and healthier lives. This gives them more time to pursue different interests and careers. They may want to try something new after spending many years in one field. For example, a person who has worked as a doctor for 20 years may decide to study art and become an artist in their later years.Finally, having multiple careers can be more fulfilling. It allows people to explore different aspects of their personalities and talents.They can gain different experiences and skills from each career, which can make them more well - rounded individuals.41. What is the old - fashioned concept mentioned in the passage?42. Why do people need to change their careers according to the passage?43. What is an example of the job market change given in the passage?44. How does living longer affect people's career choices?45. What are the benefits of having multiple careers?Passage 2.Questions 46 - 50 are based on the following passage.In recent years, the sharing economy has become a popular trend. The sharing economy refers to the economic model in which people share resources, such as cars, houses, and tools, through online platforms. There are several advantages of the sharing economy.First, it can save resources. For example, if people share cars, fewer cars will be needed, which can reduce the consumption of energy and raw materials. Second, it can be more cost - effective. For example, people can rent a house or a car at a lower price through sharing platforms than they would if they were to buy or rent them in the traditional way. Third, itcan also promote social interaction. When people share resources, they have the opportunity to meet and interact with other people.However, the sharing economy also has some challenges. One of the main challenges is the lack of regulation. Since the sharing economy is a relatively new concept, there are not enough laws and regulations to govern it. This can lead to problems such as safety concerns and unfair competition. Another challenge is the issue of trust. People need to trust the people they are sharing resources with and the platforms they are using.46. What is the sharing economy?47. What are the advantages of the sharing economy?48. What is the main challenge related to the lack of regulation in the sharing economy?49. Why is trust an issue in the sharing economy?50. Do you think the sharing economy will continue to grow in the future? Why or why not?Section C.Directions: There is one passage in this section. You are required to answer the questions below the passage according to what is stated or implied in the passage.Passage.The concept of "green living" has been around for a while, but it has become more important in recent years. Green living refers to a lifestyle that is environmentally friendly and sustainable. There are many ways to practice green living.One way is to reduce waste. We can do this by recycling, reusing, and reducing our consumption. For example, we can recycle paper, plastic, and glass products. We can also reuse items such as shopping bags and water bottles. And we can reduce our consumption of non - renewable resources such as oil and coal.Another way is to use renewable energy sources. We can install solar panels on our roofs to generate electricity. We can also use wind turbines in areas with strong winds. These renewable energy sources are clean and sustainable, and they can help reduce our dependence on fossil fuels.In addition, we can also choose environmentally friendly products. For example, we can choose products made from recycled materials or products that are biodegradable. We can also choose products that are produced in an environmentally friendly way, such as products that are made without using harmful chemicals.51. What is "green living"?52. How can we reduce waste?53. What are some renewable energy sources mentioned in the passage?54. What are the characteristics of renewable energy sources?55. How can we choose environmentally friendly products?四、翻译(15%)Part A.Directions: Translate the following sentences into English.1. 他是一个勤奋的学生,总是第一个到教室。
On the Relationship between Model-based Debugging and Program MutationFranz WotawaTechnische Universit¨a t WienInstitut f¨u r InformationssystemeDatabase and Artificial Intelligence GroupFavoritenstraße9–11,A-1040Wien,AustriaEmail:wotawa@dbai.tuwien.ac.atAbstractIn this paper we discuss the relationship betweenprogram mutation and model-based diagnosis ap-plied to locate andfix bugs in programs.We showthat the time required to search for single faultsis smaller in model-based diagnosis than in gen-eral program mutation.We use this result to speedup program mutation for debugging and develop aprocedure that combines both approaches.More-over,we show that a suitable model can deliver re-sults that are as expressive as the results obtainedby program mutation.This is done by introducinga fault mode for components associatedwith statements and expressions.1IntroductionIn the last decades several techniques have been proposedfor supporting or even automating the software debuggingprocess including[Sha83;Wei82;Wei84;Kor88;Kup89;Mur88]or more recent[Jac95;FN94;Nil98;OL94;BH93;BH95].Some of the techniques use syntactical characteris-tics,some make use of the program’s semantics,and someconsider probability measures.Beside the differences in us-ing available knowledge about a program,the techniques varyin being applicable in a given situation,e.g.,debugging ofsmall versus large programs,or helping novices versus pro-gramming experts infinding bugs.See[Duc93]for a com-parison of different approaches to automated software debug-ging.Although,the proposed techniques have their merits,no general theory comprising all techniques is available,andthere is space for optimizations,including the reduction ofrequired knowledge in order to distinguish different bug can-didates.To avoid this problems[CFD93]adapts model-baseddiagnosis(MBD)[Rei87;dKW87]for debugging and com-pares it with[Sha83].The authors claim that using MBDresults in a reduction of the number of required interactionswith an oracle to identify a bug.The oracle,e.g.,the userof a debugging tool,or a(formal)specification,is assumedto know the correct behavior of the program and is assumedto correctly answer all questions which are provided by theprogram::=statement*statement::=assignment conditional whileassignment::=Id=conditional::=if(statement*statement*expr)expr::=Id Const((op::=+*===or-...Figure1:Syntax of the language J Remark:Variables are emphasized.Keywords of the language are bold typed.All termi-nal symbols are underlined.The meta-characters have the following meaning:A’*’stands for zero or more iterations,a’+’means more than zero iterations,the braces’’,’’indicate a block,and brackets ’[’,’]’an optional block.sidered kinds of bugs are also used in other more traditional debugging techniques.2The debugging problemFormally,the debugging problem is characterized by a given program and a set of test cases.The program must be written according to the syntax which is depicted in Fig-ure1.We define the syntax of J as simple as possible to avoid overhead in the definitions.Therefore,without restricting generality user-defined functions,and general functions are not considered.The semantics of(as for other sequential languages)can be formally described using a function, that maps programs(statements)and variable environments to other variable environments.A variable environmentis itself a function that maps variables to their values.The evaluation function for J is defined as follows: StatementsAssignmentsX=E withif XE otherwiseConditionalswith else branch:if E TSt EStififwithout else branch:if E TStifotherwiseWhile statementswhile E Stwhile E St ififExpressionsVariables V VConstants COther expressions(E1op E2)E1E2(op E)EAfter having defined the syntax and semantics of J we for-mally define test cases.A test case for a program must specify the correct behavior.In this sense a test case is a small part of the specification that maps an input state to the expected output state.In our case states correspond to variable envi-ronments.So,a test case is a tuple where is the envi-ronment before executing a program and is the expected environment to be delivered when executing the program.We say that a program pass a test iff.Otherwise, we say that a program is buggy.In a real-world setting not only one test case is used to check a program.Therefore,we assume a function mapping programs to a set of test cases.We illustrate the definitions using a small example pro-gram demo comprising three assignments:1.x=(a*b);2.min=(x*lb);3.max=(x*ub);We use this program as running example of this paper.Pro-gram demo takes4variables a,b,lb,and ub as input and computes values for the variables min and max.The variable x is used as intermediate variable to avoid recomputation of a*b.The program demo is for computing a minimum and maximum value for a*b using a lower bound lb and an up-per bound ub value.In order to test the program we have to specify test cases,e.g.,Using this test case and executing the program according to its semantics leads to the conclusion that demo is correct with respect to the given test cases.Now consider the case where line3of demo is modified to:3.max=(x/ub);We refer the wrong version of demo as -ing the same test cases as before,i.e.,leads to the conclusion that the program demo2 must contain a bug.Because the execution of demo2leads to which obviously contradicts the expected value.In this case the programmer(user)would be interested in locating the source of this ing a traditional debugger,that guides the user in a sequential manner through the source code,finding the bug in line3requires3steps.Each of which consists of asking the programmer implicitly or explicitly about variable values. Implicitly means that the variables are presented to the user but where user interaction,e.g.,answering a question about correctness or not,is not required.An explicit question must be answered in order to go to the next line in the code.Tra-ditional debuggers are quite effective if the bug is located at the beginning of a program fragment to be debugged.How-ever,in cases where the bug is located at the end,debuggers are ineffective.In practice this effect is tried to be reduced by using break-points in programs.The debugger evaluates the program up to a break-point and starts interacting with the user afterwards.This technique is good for minimizing user interaction.But in order to place the break-point at the right position a good understanding of the structure and behavior of at least parts the program is required.Another way of avoiding too many steps using a debugger is program slicing[Wei82;Wei84]or similar techniques us-ing dependencies between variables,e.g.,[FSW99].Such de-pendency oriented methods collect those statements that may have an influence on a given variable.In the example demo2 only the statements in line1and3have an influence on vari-able max whereas this is not the case for the statement in line 2.An intelligent debugger can make use of this knowledge and focus the user’s attention to the two relevant statements. As a result the number of required steps is reduced.How-ever,such a reduction cannot always be provided by program slicing.In order to further reduce the number of bug candi-dates,i.e.,statements or expressions,the full programming language semantics must be used.For example consider that line1of program demo2is faulty and the other statements are not.From and we can de-rive that must be.Taking this result together with we derive that again contradict our expected value.Hence,statement1cannot be the single source of the ing similar arguments,we get line3as the only single bug location.If we prefer minimal solutions,only line3of demo would be presented to the user.3Program mutation and debuggingMutation testing,e.g.,[BDLS80;OL94],was originally de-veloped for constructing a set of tests which distinguish be-tween a given program and any nonequivalent program and for measuring the quality of test cases.The nonequivalent program is generated using the given one and applying the mutation transformation.The ideas of mutation testing can be used for debugging.In[Duc93]the author classifies pro-gram mutation as sort offiltering technique for debugging1. The changed parts of a program are bug candidates,if the modified version of the program,i.e.,the mutant,passes allWe define the size of an expression as follows:if is a variableor constantifAn orthogonal concept of ordering diagnoses wrt.the differences between the mutant and the original program is to order(and limit)diagnosis candidates wrt.min-imality.A mutation diagnosis is a minimal diag-nosis iff there exists no other mutation diagnosis that is a subset of.Similar to the hardware do-main we are interested infinding minimal bugs.For example,the mutation diagnosis x/ub x*ubis a minimal diagnosis for program demo2,whereasx/ub x*ub x*lb x*ub x*ub x*lb is not.denotes the expression used in statement.In the following section we describe the algorithm MUTA-TION for computing all possible mutations of a program up to a given maximum difference.3.1Computing mutantsThe MUTATION algorithm computes all possible mutations for a given program in an iterative way.The algorithm uses a set of mutations generated one iteration cycle before. In thefirst cycle only the original program is considered.For each of the previously generated programs(or the original program)MUTATION selects a statement and applies the ba-sic mutation functions resulting in a new mutant considered in the next iteration.The selection process isfinished when all statements have been taken into account.If we use the algorithm MUTATION we obtain a sequence of all possible mutants of up to the size.The sequence is ordered by the number of changes,i.e.,the size of the mutants.Algorithm MUTATION1.Let be0,and be a set containing the unmutatedoriginal program.2.Let be the empty set.3.For all elements in do the following:(a)For all statements in call the algorithm BA-SICMUTATIONS returns a set of mutants for.Add all elements of to.4.If is not greater than,increase by1and goto2.Otherwise,return the sequence as result.MUTATION calls the algorithm BASICMUTATIONS requires3arguments:the pro-gram,a statement,and a mutant that was generated in a previous step.Algorithm BASICMUT with,,and as arguments and add the re-sulting mutants to.3.If is a conditional statement then compute the muta-tions for the conditional expression using EXPRMUTATIONS and add all of them to.4.If is a loop statement,compute the mutations for theconditional expression using EXPRMUTATIONS.Add the resulting mutants to.5.Return the set of mutants.The EXPRMUT allows for adding an additional operator to an existing one. EXPRMUT,and a mutant. Algorithm EXPRfor computing all candidates that are checked against the test cases.The remaining mutants are bug candidates.The fol-lowing algorithm MUTATIONDIAG1.Let be an empty set and let be1.pute candidates Compute all mutants of size bycalling MUTATION.Store the mutants in.3.Check candidates For all check whetherpasses the test cases or not.If does not pass,then remove from.4.If is empty,increase by one and goto2.Otherwisereturn as result.It is obvious that in general MUTATIONDIAG.The time complexity depends on the number of test cases,the maximum runtime for checking one mutant against one test case,the number of mu-tants and the time required for creating one mutant,i.e.,.The time required for creating one mutant must linearly depend on the size of the program ,i.e.,,where denotes the number of state-ments and the number of expressions of.The number of created mutants depends also on the size of the program and the maximum difference.In each iteration the number of mutants is equal to the number of mutants in the previous iteration multiplied by a constant factor.In thefirst iteration the number of mutants is equal to the program’s size multi-plied by the factor.Hence,we have.In summary we get the following result for the time complexity. Theorem3.1(Time complexity of mutation diagnosis) The time complexity for computing all mu-tation diagnoses up to a given size is.The space complexity of mutation diagnosis can be com-puted in a similar way.For each mutant there must be a re-served space of size.In addition we require space for executing the mutant.In summary the space require-ments depend on the required space and a space for storing all mutants.Theorem3.2(Space requirements of mutation diagnosis) The space complexity for computing all mu-tation diagnoses up to a given size is.The time and space complexity of mutation diagnosis is not a problem in practice if we restrict the size to be small.In most cases the search for mutation diagnoses is restricted to and at most to2or3.In the following sections we show how mutation diagnosis can be enhanced by using model-based reasoning.Figure2:Graphical representation of the demo2model4Model-based debuggingIn various papers the authors’have shown that model-based diagnosis can be used for debugging,e.g.,[CFD93;FSW99; SW99;MSW00;Wot00].Since this paper aims not in pre-senting a new model for a sequential programming language, we use the value-based model of[MSW00]which was de-veloped for a subset of Java.To be self contained we briefly summarize the model.For more details we refer to[MSW00]. The logical model represents the semantics of the statements of our language:assignments,conditionals,and loops.Each statement and expression is associated with an diagnosis com-ponent.The behavior of the components captures the seman-tics of the underlying statement or expression.The variables are represented by connections.In addition we have connec-tions between expression and its subexpressions and when-ever required,e.g.,if a statement has an expression.For as-signments,expressions,and conditionals we have2modes: and with the usual meaning.Loops have the same modes plus1additional mode,the mode restricting the execution of the block statements to afixed number.This number is assumed to depend on the test case.For example the logical model of our demo2pro-gram is given by the following sentences:Component behavior:Structure:Declaring the component’s typeand the connectionsThe graphical representation of the demo2model is de-picted in Figure2.We see for example that the assignment statement of line1is mapped to component,the multipli-cation function is mapped to,the variable accesses a,b are mapped to and respectively.In the next step we use together with the test case for computing bug candidates.We convert the test case to a set of observations and compute4single diagnoseswhich can be mapped back to the statements and expres-sions in the source code of demo2.All single diagnoses indi-cate that the bug can only be in line3.4.1Enhancing mutation diagnosisIn this section we show how model-based diagnosis can be used to speed up mutation diagnosis.The idea behind is to use the results obtained from model-based diagnosis to avoid the computation of unnecessary mutants.Only those expres-sions lying in at least one diagnosis are subject to be mu-tated.Moreover,taking a diagnosis and the test cases we can (at least partially)compute the expected behavior of compo-nents,i.e.,statements and expressions.Table1shows the ex-pected values for the single diagnoses computed for demo2. Using this information we further can reduce the number of mutations to be considered in order tofind a solution. For example,replacing the mutant x/ub x-ub cannot ex-plain the expected values.Since all of the required tests for eliminating muta-tions from the list of possible mutants use local information only,they are not so time consuming as executing the whole program after mutating it.In order to show that model-based diagnosis can really be used to speed up mutation diagnosis,we have to show that computing diagnoses is less time consuming than computing all mutants.Wefirst discuss the time complexity of model-based diagnosis for computing single diagnosis.In the worst case all diagnosis components must be checked for be-ing faulty.Every check lasts,where is the maximum runtime of the program for the test cases.Since we have different test cases the time complexity is given as follows: Theorem4.1(Time complexity-single diagnoses)The time complexity for locating single bugs in a program using model-based diagnosis is.In general the time complexity depends on the number of subsets to check.Hence,we have when as-suming that every component has about2modes,e.g.,or .Although this is not the case for our model in general, it is a good approximation.Because only loop statements have a(very)limited number of additional modes,and usu-ally there is only a vanishing number of loops in a program (if compared to the number of expressions).For mutation de-bugging providing a mutant for all statements and expressions requires a to be.Hence,the time complexity in this case is which is obviously larger than.Space complexity for computing all single diagnoses is of order,if we assume that every component has only2modes.The space complexity is also smaller than the space complexity of mu-tation debugging.In summary the enhancement of mutation debugging in-clude3steps:First,compute diagnoses using model-based diagnosis and a value-based model.Second,compute mu-tants only for components that are element of at least one di-agnosis.Third,use the locally available expected values for eliminating mutants instead of executing the whole program.4.2Expressing mutation diagnosisIn this section we discuss how mutation diagnosis can be ex-pressed in terms of model-based diagnosis.The straight for-ward way is do use a predicate having2arguments (instead of1)for each diagnosis component.Thefirst argu-ment is for the component identifier and the second argument represents the desired behavior of the component.For exam-ple,we can declare the replacement fault modeto an and function:Other replacement modes can be easily declared in the same manner.For variable access or assignment components such a replacement mode is not so easy to define.This is due to the fact that replacing a variable by another variable has an impact on the structure of the associated diagnosis system. We can define a replacement mode for a variable access com-ponents.The respective diagnosis component must have an input for each variable used in the program.Depending on the replacement mode the corresponding input value is prop-agated to the output and the output value is propagated to the corresponding input.Such a diagnosis component can be seen as a select function.A similar technique can be used for assignment statements,where the output connection must vary according to its mode that corresponds to differ-ent target variables.The advantage of the mode is that it provides a possible repair action,i.e.,replacing the corresponding ex-pression with the specified expression.Although,we can in-troduce arbitrary replacement modes,they require additional connections between diagnosis components and cause the overall diagnosis time to increase significantly.Moreover,a more sophisticated change of the program,e.g.,replacing x +y by x+y-(z*w),can be hardly expressed by our model.In this case the diagnosis component correspond-ing to the plus operator must have knowledge about the other variables z and w.Hence,we have to introduce new inputs not only for the variable access components but also for all other components.Because of these problems we suggest to use replacement modes whenever we know a small fraction of the components and expressions to be part of a highly proba-ble diagnosis candidate.in(c3x)out(c3x)in(c3ub)out(c3ub)out(c31)out(c3) 222214 282244Table1:Expected values for demo25ConclusionThis paper dealt with establishing the relationships between model-based diagnosis and program mutation to be used insoftware debugging.In thefirst part of this paper,we dis-cussed the concept of program mutation for debugging,andwe presented definitions and algorithms for computing mu-tants of a given size.Moreover,we elaborated the time andspace complexity of mutation diagnosis.In the second part,we briefly discussed how to use model-based diagnosis for debugging and tried to investigate the relationships betweenthe two approaches.The main results of this paper are: Mutation testing can be significantly enhanced by us-ing model-based diagnosis.The resulting diagnoses are seen as focus for mutation diagnosis.Only mutants ofexpressions and components that are element of at leastone diagnosis are created.In principle the advantage of mutation diagnosis,i.e., the computation of possible corrections,can be adopted for the model-based framework.A replacement mode maps different behaviors to diagnosis compo-nents.This mode expresses changes of expressions di-rectly.However,beside the caused increase of diagnosis time,the complexity of the resulting model increases as well.In future debugging systems the combination of model-based diagnosis techniques and program mutation seems to be a good choice.Whereas thefirst supports the discrimi-nation between statements that may cause a misbehavior,the latter provides repair suggestions.References[BDLS80]Timothy Budd,R.DeMillo,R.Lipton,andF.Sayward.Theoretical and empirical studieson using program mutation to test the functionalcorrectness of programs.In Proc.Seventh ACMSymp.on Princ.of ng.(POPL).ACM,January1980.[BH93]Lisa Burnell and Eric Horvitz.A Synthesis of Logical and Probabilistic Reasoning for ProgramUnderstanding and Debugging.In Proceedingsof the International Conference on Uncertainty inArtificial Intelligence,pages285–291,1993. [BH95]Lisa Burnell and Eric Horvitz.Structure and Chance:Melding Logic and Probability for Soft-ware munications of the ACM,pages31–41,1995.[Bon94]Gregory W.Bond.Logic Programs for Consistency-Based Diagnosis.PhD thesis,Car-leton University,Faculty of Engineering,Ottawa,Canada,1994.[BP94]G.W.Bond and B.Pagurek.A Critical Analysis of“Model-Based Diagnosis Meets Error Diagno-sis in Logic Programs”.Technical Report SCE-94-15,Carleton University,Dept.of Systems andComputer Engineering,Ottawa,Canada,1994. [CFD93]Luca Console,Gerhard Friedrich,and Daniele Theseider Dupr´e.Model-based di-agnosis meets error diagnosis in logic programs.In Proceedings of the International Joint Confer-ence on Artificial Intelligence,pages1494–1499,Chambery,August1993.[dKW87]Johan de Kleer and Brian C.Williams.Diag-nosing multiple faults.Artificial Intelligence,32(1):97–130,1987.[Duc93]Mireille Ducass´e.A pragmatic survey of auto-matic debugging.In Proceedings of the1st Inter-national Workshop on Automated and Algorith-mic Debugging,AADEBUG’93,Springer LNCS749,pages1–15,May1993.[FN94]Peter Fritzson and Henrik Nilsson.Algorithmic debugging for lazy functional languages.Journalof Functional Programming,4(3),1994. [FSW99]Gerhard Friedrich,Markus Stumptner,and Franz Wotawa.Model-based diagnosis of hardware de-signs.Artificial Intelligence,111(2):3–39,July1999.[Jac95]Daniel Jackson.Aspect:Detecting Bugs with Abstract Dependences.ACM Transac-tions on Software Engineering and Methodology,4(2):109–145,April1995.[Kor88]Bogdan Korel.PELAS–Program Error-Locating Assistant System.IEEE Transactions on Soft-ware Engineering,14(9):1253–1260,1988. [Kup89]Ron I.Kuper.Dependency-directed localization of software bugs.Technical Report AI-TR1053,MIT AI Lab,May1989.[MSW00]Cristinel Mateis,Markus Stumptner,and Franz Wotawa.Modeling Java Programs for Diagnosis.In Proceedings of the European Conference onArtificial Intelligence(ECAI),Berlin,Germany,August2000.[Mur88]William R.Murray.Automatic Program Debug-ging for Intelligent Tutoring Systems.PitmanPublishing,1988.[Nil98]Henrik Nilsson.Declarative Debugging for Lazy Functional Languages.PhD thesis,Link¨o pingUniversity,April1998.[OL94]Jefferson A.Offutt and Stephen D.Lee.An em-pirical evaluation of weak mutation.IEEE Trans-actions on Software Engineering,20(5):337–344,1994.[Rei87]Raymond Reiter.A theory of diagnosis fromfirst principles.Artificial Intelligence,32(1):57–95,1987.[Sha83]Ehud Shapiro.Algorithmic Program Debugging.MIT Press,Cambridge,Massachusetts,1983. [SW99]Markus Stumptner and Franz Wotawa.De-bugging Functional Programs.In ProceedingsInternational Joint Conf.on Artificial Intel-ligence,Stockholm,Sweden,August1999. [Wei82]Mark Weiser.Programmers use slices when munications of the ACM,25(7):446–452,July1982.[Wei84]Mark Weiser.Program slicing.IEEE Transac-tions on Software Engineering,10(4):352–357,July1984.[Wot00]Franz Wotawa.Debugging VHDL Designs using Model-Based Reasoning.Artificial Intelligencein Engineering,14(4):331–351,2000.。