包可以加什么偏旁| 你在看什么| 什么的去路| 感冒为什么会咳嗽| 翼龙吃什么| 午夜梦回是什么意思| 沐雨栉风是什么生肖| 男人下面胀痛什么原因造成呢| 高压高低压正常是什么原因| 丁羟甲苯是什么| 百什么争什么| 心房扑动是什么意思| 大方得体是什么意思| 阴道里面有个肉球是什么| 夏天脸上皮肤痒是什么原因| 壁虎是什么类动物| 十九岁属什么| 胎头位于耻上是什么意思| 点字五行属什么| 来大姨妈适合吃什么水果| 大腿酸软无力是什么原因| 成双成对是什么意思| 只是当时已惘然是什么意思| 今天是什么日子 农历| 做爱时间短吃什么药好| 8月30号是什么星座| 开路是什么意思| 郑恺的父母是做什么的| 鹅喜欢吃什么草| 教导是什么意思| 怀孕肚皮痒是什么原因| 头疼想吐吃什么药| 感染hpv有什么症状| 秦始皇为什么要焚书坑儒| 内膜厚是什么原因引起的| 99年属什么生肖| 甲亢是什么原因导致的| 强肉弱食是什么意思| 车前草的作用是什么| 蓝海是什么意思| 胸部胀痛是什么原因| winbond是什么品牌| fgr医学上是什么意思| 肤如凝脂是什么意思| 2.3是什么星座| 12年义务教育什么时候开始| 褪黑素什么时候吃| 为什么会阑尾炎| 支原体阳性是什么病| 后厨是做什么的| 食物过敏吃什么药| 氨是什么| 小孩头晕是什么原因| 交警大队长是什么级别| 阴道松弛吃什么药| 钙化灶是什么意思| 奶思是什么意思| 不倒翁是什么意思| 什么名字好听| 探望产妇带什么礼物好| oppo最新款是什么型号| 回奶吃什么快最有效的| 马躺下睡觉为什么会死| 血红蛋白浓度是什么意思| 县政府党组成员什么级别| 胆囊息肉挂什么科| 梦见盖房子什么意思| 肺积水有什么症状| hpv52高危阳性是什么意思| 双非是什么| 小脚趾麻木是什么原因| 拉拉是什么意思| 6.5是什么星座| 乳腺结节有什么症状| 双重所有格是什么意思| 血红蛋白是指什么| 广西北海有什么好玩的地方| 熬夜为什么会胖| 口爆什么意思| 剧透什么意思| 严密是什么意思| 吃什么能| 人体缺钾会有什么症状| 喉咙里痰多是什么原因| 晚上喝牛奶有什么好处| 殊荣是什么意思| 鼻子发干是什么原因造成的| 为什么都说头胎很重要| 理疗是什么| 武警和特警有什么区别| 异常灌注是什么意思| 脖子上长癣是什么原因| 苹果5s什么时候上市的| 开业送什么| 自言自语是什么病| 心什么神往| 尽形寿是什么意思| 碧螺春属于什么茶类| 急性结膜炎用什么眼药水| 暗送秋波是什么意思| 黄豆吃多了有什么坏处| 艾滋病挂什么科| 呕心沥血是什么意思| 尼古拉斯是什么意思| 胃肠镜能检查出什么病| 什么中药补气血效果最好| 流年不利什么意思| 尿血是什么原因女性| 95年什么生肖| 石英表是什么意思| 眼圈黑是什么原因| 梦见手抓屎是什么意思| 秦始皇的佩剑叫什么剑| 喝枸杞水有什么好处| 吃什么补内膜最快| 什么时候高速免费| 破伤风是什么| 蔚姓氏读什么| 今天什么属相| 什么叫服务贸易| 唏嘘什么意思| 贲门ca是什么意思| 2月8号什么星座| 东北小咬是什么虫子| 宫腔镜手术是什么原因才要做| 乐高为什么这么贵| 什么是汛期| 乳腺增生乳腺结节吃什么药| 咳黄痰吃什么药好得快| 总是低烧是什么原因造成的| 烧伤病人吃什么恢复快| 结膜炎用什么眼药水效果好| 小孩急性肠胃炎吃什么药| 心机重的人弱点是什么| au750是什么金属| 吃什么有助于睡眠| 恋恋不舍的意思是什么| 为什么会有耳石症| 什么事每人每天都必须认真的做| 梦见抽血是什么预兆| 小老弟是什么意思| 总流口水是什么原因| 晁盖的绰号是什么| 晚上吃什么有助于睡眠| 大红袍属于什么档次| 吃什么增加免疫力最快| 吃孕酮片有什么副作用| 加拿大签证需要什么材料| 梦到鳄鱼是什么意思| 心肌桥是什么病| 舒肝解郁胶囊治什么病| 梦见卖衣服是什么意思| 肺部硬结灶是什么意思| kv是什么单位| 扁桃体发炎不能吃什么东西| 北京立冬吃什么| 眼角下面长斑是什么原因引起的| 夏天容易出汗是什么原因| 得乙肝的人有什么症状| 喝什么茶去火| 年下是什么意思| 什么是早搏| 乳腺回声不均匀是什么意思| 日柱将星是什么意思| 19岁属什么的生肖| 等闲之辈是什么意思| 侧颜杀是什么意思| pg在医学是什么意思| 11月5号什么星座| 9月出生的是什么星座| 结石什么原因引起的| 速写男装属于什么档次| 乳糖不耐受可以喝什么奶| 气罐和火罐有什么区别| 胖头鱼又叫什么鱼| 思的五行属性是什么| 声带白斑是什么病严重吗| 兵员预征是什么意思| 我低头向山沟是什么歌| 骨折吃什么补品| 草字头内念什么| 哥弟属于什么档次| 肺癌靶向治疗是什么意思| 春天有什么花开| 血小板压积是什么意思| 十二生肖叫老大是什么生肖| 老婆子是什么意思| 薄熙来为什么被抓| 西洋参不能和什么一起吃| 眼睛充血吃什么药| 颤栗是什么意思| 磨砂膏是什么| 弱冠是什么意思| 不建议什么意思| 西瓜可以做什么饮料| 来例假吃什么好| 发泥和发蜡有什么区别| lomo卡是什么| 阳卦代表什么意思| 万艾可是什么| 紫涵女装属于什么档次| 277是什么意思| 内急是什么意思| 清明节什么时候| 态生两靥之愁中靥指什么| 夏枯草有什么作用| 什么相关四字成语| 毒枭是什么意思| 格力空调se是什么意思| 龟头上抹什么可以延时| 牙刷属于什么垃圾| 春天开什么花| 红薯什么时候传入中国| 手长水泡是什么原因| 聚宝盆什么意思| 属狗和什么属相最配| 度蜜月什么意思| 八月十八号是什么星座| 阿司匹林和阿莫西林有什么区别| sp是什么意思| 睡眠不好总做梦是什么原因| 吃什么有助于骨头愈合| 弱精症有什么症状表现| 牛肉炒什么菜| 生育登记有什么用| 我是什么结构| 羊是什么结构的字| 下肢血液循环不好吃什么药| 姜对头发有什么作用| 什么的小院| 貌不惊人是什么意思| 嫂夫人什么意思| 犀利是什么意思| 瘦马什么意思| 明年生肖是什么| 纯是什么意思| 猫为什么流眼泪| 凯旋归来是什么意思| 脸上起疙瘩是什么原因| 正品行货是什么意思| 第二次世界大战是什么时候| 欢喜冤家是什么意思| 宇宙之外还有什么| 总是低烧是什么原因造成的| 牙龈萎缩用什么牙膏好| 糖化血红蛋白高是什么意思| 什么手表品牌最好| 急性阑尾炎什么症状| 梦见栽花是什么意思| rip什么意思| 乙状结肠管状腺瘤是什么意思| 数字2代表什么意思| 多囊卵巢综合征是什么意思| 鼻子有痣代表什么| 首台套是什么意思| 属兔五行属什么| 骨质疏松是什么症状| 最大的罩杯是什么杯| 慢性萎缩性胃炎吃什么药可以根治| 玉溪烟属于什么档次| 狗狗中毒了用什么办法可以解毒| 冬阴功汤是什么味道| 什么是脱脂牛奶| 甲亢是什么原因造成的| 百度Jump to content

脂肪肝吃什么药最好

From Wikipedia, the free encyclopedia
Queue and Stack, incorrectly and correctly
百度 贷款方面,按央行基准利率首付30%三年期计算,首付万元左右(包含车款、上牌、保险、购置税和担保金等),月供3400元左右。

In object-oriented programming, behavioral subtyping is the principle that subclasses should satisfy the expectations of clients accessing subclass objects through references of superclass type, not just as regards syntactic safety (such as the absence of "method-not-found" errors) but also as regards behavioral correctness. Specifically, properties that clients can prove using the specification of an object's presumed type should hold even though the object is actually a member of a subtype of that type.[1]

For example, consider a type Stack and a type Queue, which both have a put method to add an element and a get method to remove one. Suppose the documentation associated with these types specifies that type Stack's methods shall behave as expected for stacks (i.e. they shall exhibit LIFO behavior), and that type Queue's methods shall behave as expected for queues (i.e. they shall exhibit FIFO behavior). Suppose, now, that type Stack was declared as a subclass of type Queue. Most programming language compilers ignore documentation and perform only the checks that are necessary to preserve type safety. Since, for each method of type Queue, type Stack provides a method with a matching name and signature, this check would succeed. However, clients accessing a Stack object through a reference of type Queue would, based on Queue's documentation, expect FIFO behavior but observe LIFO behavior, invalidating these clients' correctness proofs and potentially leading to incorrect behavior of the program as a whole.

This example violates behavioral subtyping because type Stack is not a behavioral subtype of type Queue: it is not the case that the behavior described by the documentation of type Stack (i.e. LIFO behavior) complies with the documentation of type Queue (which requires FIFO behavior).

In contrast, a program where both Stack and Queue are subclasses of a type Bag, whose specification for get is merely that it removes some element, does satisfy behavioral subtyping and allows clients to safely reason about correctness based on the presumed types of the objects they interact with. Indeed, any object that satisfies the Stack or Queue specification also satisfies the Bag specification.

It is important to stress that whether a type S is a behavioral subtype of a type T depends only on the specification (i.e. the documentation) of type T; the implementation of type T, if it has any, is completely irrelevant to this question. Indeed, type T need not even have an implementation; it might be a purely abstract class. As another case in point, type Stack above is a behavioral subtype of type Bag even if type Bag's implementation exhibits FIFO behavior: what matters is that type Bag's specification does not specify which element is removed by method get. This also means that behavioral subtyping can be discussed only with respect to a particular (behavioral) specification for each type involved and that if the types involved have no well-defined behavioral specification, behavioral subtyping cannot be discussed meaningfully.

Verifying behavioral subtyping

[edit]

A type S is a behavioral subtype of a type T if each behavior allowed by the specification of S is also allowed by the specification of T. This requires, in particular, that for each method M of T, the specification of M in S is stronger than the one in T.

A method specification given by a precondition Ps and a postcondition Qs is stronger than one given by a precondition Pt and a postcondition Qt (formally: (Ps, Qs) ? (Pt, Qt)) if Ps is weaker than Pt (i.e. Pt implies Ps) and Qs is stronger than Qt (i.e. Qs implies Qt). That is, strengthening a method specification can be done by strengthening the postcondition and by weakening the precondition. Indeed, a method specification is stronger if it imposes more specific constraints on the outputs for inputs that were already supported, or if it requires more inputs to be supported.

For example, consider the (very weak) specification for a method that computes the absolute value of an argument x, that specifies a precondition 0 ≤ x and a postcondition 0 ≤ result. This specification says the method need not support negative values for x, and it need only ensure the result is nonnegative as well. Two possible ways to strengthen this specification are by strengthening the postcondition to state result = |x|, i.e. the result is equal to the absolute value of x, or by weakening the precondition to "true", i.e. all values for x should be supported. Of course, we can also combine both, into a specification that states that the result should equal the absolute value of x, for any value of x.

Note, however, that it is possible to strengthen a specification ((Ps, Qs) ? (Pt, Qt)) without strengthening the postcondition (Qs ? Qt).[2][3] Consider a specification for the absolute value method that specifies a precondition 0 ≤ x and a postcondition result = x. The specification that specifies a precondition "true" and a postcondition result = |x| strengthens this specification, even though the postcondition result = |x| does not strengthen (or weaken) the postcondition result = x. The necessary condition for a specification with precondition Ps and postcondition Qs to be stronger than a specification with precondition Pt and postcondition Qt is that Ps is weaker than Pt and "Qs or not Ps" is stronger than "Qt or not Pt". Indeed, "result = |x| or false" does strengthen "result = x or x < 0".

"Substitutability"

[edit]

In an influential keynote address[4] on data abstraction and class hierarchies at the OOPSLA 1987 programming language research conference, Barbara Liskov said the following: "What is wanted here is something like the following substitution property: If for each object of type S there is an object of type T such that for all programs P defined in terms of T, the behavior of P is unchanged when is substituted for , then S is a subtype of T." This characterization has since been widely known as the Liskov substitution principle (LSP). Unfortunately, though, it has several issues. Firstly, in its original formulation, it is too strong: we rarely want the behavior of a subclass to be identical to that of its superclass; substituting a subclass object for a superclass object is often done with the intent to change the program's behavior, albeit, if behavioral subtyping is respected, in a way that maintains the program's desirable properties. Secondly, it makes no mention of specifications, so it invites an incorrect reading where the implementation of type S is compared to the implementation of type T. This is problematic for several reasons, one being that it does not support the common case where T is abstract and has no implementation. Thirdly, and most subtly, in the context of object-oriented imperative programming it is difficult to define precisely what it means to universally or existentially quantify over objects of a given type, or to substitute one object for another.[3] In the example above, we are not substituting a Stack object for a Bag object, we are simply using a Stack object as a Bag object.

In an interview in 2016, Liskov herself explains that what she presented in her keynote address was an "informal rule", that Jeannette Wing later proposed that they "try to figure out precisely what this means", which led to their joint publication[1] on behavioral subtyping, and indeed that "technically, it's called behavioral subtyping".[5] During the interview, she does not use substitution terminology to discuss the concepts.

Notes

[edit]
  1. ^ a b Liskov, Barbara; Wing, Jeannette (2025-08-07). "A behavioral notion of subtyping". ACM Transactions on Programming Languages and Systems. 16 (6): 1811–1841. doi:10.1145/197320.197383.
  2. ^ Parkinson, Matthew J. (2005). Local reasoning for Java (PDF) (PhD). University of Cambridge.
  3. ^ a b Leavens, Gary T.; Naumann, David A. (August 2015). "Behavioral subtyping, specification inheritance, and modular reasoning". ACM Transactions on Programming Languages and Systems. 37 (4). doi:10.1145/2766446.
  4. ^ Liskov, B. (May 1988). "Keynote address - data abstraction and hierarchy". ACM SIGPLAN Notices. 23 (5): 17–34. doi:10.1145/62139.62141.
  5. ^ van Vleck, Tom (April 20, 2016). Interview with Barbara Liskov. ACM. Archived from the original on 2025-08-07.

References

[edit]
  • Parkinson, Matthew J.; Bierman, Gavin M. (January 2008). "Separation logic, abstraction and inheritance". ACM SIGPLAN Notices. 43 (1): 75–86. doi:10.1145/1328897.1328451.
1964年是什么命 润喉喝什么 1958年属狗的是什么命 便秘用什么药 什么食物高蛋白含量高
间谍是什么意思 9月25日什么星座 长期肚子疼是什么原因 脚抽筋是什么原因 生殖器疱疹是什么原因引起的
甲功四项是什么检查项目 口干嗓子干是什么原因 老鼠屎长什么样 嫖娼是什么 什么是修行人
st股票是什么意思 七九年属什么生肖 生肖龙和什么生肖相冲 no医学上是什么意思 布鲁斯是什么意思
北芪与黄芪有什么区别96micro.com 仙人跳是什么意思啊hcv8jop7ns6r.cn 胜字五行属什么jiuxinfghf.com em什么意思hcv8jop1ns5r.cn 腰椎生理曲度变直什么意思hcv9jop0ns0r.cn
foreverlove是什么意思hanqikai.com 什么是寻麻疹hcv9jop2ns3r.cn minute什么意思xinjiangjialails.com 什么样的秋天hcv9jop3ns0r.cn 为什么叫汉族hcv8jop3ns4r.cn
今天是什么日子老黄历hcv8jop0ns3r.cn 肾结石去医院挂什么科hcv8jop9ns4r.cn 白细胞高是什么原因造成的hcv8jop8ns9r.cn 抓龙筋什么意思hcv7jop9ns5r.cn 开除党籍有什么后果hcv7jop6ns5r.cn
什么地方看到的月亮最大hcv9jop1ns8r.cn ad是什么的缩写hcv9jop4ns7r.cn 不知道饿是什么原因hcv8jop3ns9r.cn 皮肤病挂什么科hcv9jop4ns3r.cn 考试紧张吃什么药可缓解xscnpatent.com
百度