波兰表示法

前缀表示法 (+ 3 4 )
中缀表示法 (3 + 4)
后缀表示法 (3 4 + )

波兰表示法(英語:Polish notation,或波兰记法)是一种逻辑算术代数表示方法,其特点是操作符置于操作数的前面,因此也称做前缀表示法。如果操作符的元数(arity)是固定的,则语法上不需要括号仍然能被无歧义地解析。波兰记法是波兰数学家扬·武卡谢维奇于1920年代引入的,用于简化命题逻辑

扬·武卡谢维奇本人提到:[1]

阿隆佐·邱奇在他的经典著作《数理逻辑》中提出该表达方法是一种值得被关注的记法系统,甚至将它与阿弗烈·諾夫·懷海德伯特兰·罗素在《数学原理》中的逻辑表达式相提并论。[2]

算术形式

表达“三加四”时,前缀记法写作“+ 3 4 ”,而不是“3 + 4”。在复杂的表达式中,操作符仍然在操作数的前面,但操作数可能是包含操作符的平凡表达式。 例如,中缀運算式(5 - 6) * 7 ,在前缀表达式中可以表示為:

*(− 5 6) 7

或省略括号:

* - 5 6 7

由于简单的算术运算符都是二元的,该前缀表达式无需括号,且表述是无歧义的。在前面的例子里,中缀形式的括号是必需的,如果将括号移动到:

5 - (6 * 7)

即:

5 - 6 * 7

则会改变整个表达式的值。而其正确的前缀形式是:

- 5 * 6 7

减法运算要等它的两个操作数(5;6和7的乘积)都完成时才会处理。在任何表示法中,最里面的表达式最先运算,而在波兰表达式中,决定“最里面”的是顺序而不是括号。

简单算术的前缀表达式主要是用于学术研究方面。与逆波兰表示法不同,前缀表达式基本没有在商业计算器中使用过,但是其体系经常在编译器构造的概念教学中首先使用。

计算机编程

LISPS-表达式中广泛地使用了前缀记法,S-表达式中使用了括号是因为它的算术操作符有可变的元数(arity)。逆波兰表示法在许多基于堆栈程序语言(如PostScript)中使用,以及是一些计算器(特别是惠普)的运算原理。

假定只有二元运算时,操作数的个数必然为操作符的个数加一,否则表达式就无意义。这样在计算更复杂,更长的表达式时,可以简单地忽略某些错误表达式,因此在使用前缀记法时必须小心仔细检查其表达意义。

运算顺序

前缀表达式的运算顺序很容易检测。需注意的是,当运算时,操作符是作用在第一个操作数上,特别是需注意不满足交换律的运算,如除法减法。例如,下列式子:

 / 10 5 = 2  (前缀记法)

表示10/5,结果是2,而不是½。

基于堆栈的操作符由于其本身的特性,无需括号也很容易区分运算的顺序,因此大量使用波兰记法。运算波兰表达式时,无需记住运算的层次,只需要直接寻找第一个运算的操作符。以二元运算为例,从左至右读入表达式,遇到一个操作符后跟随两个操作数时,则计算之,然后将结果作为操作数替换这个操作符和两个操作数;重复此步骤,直至所有操作符处理完毕。因为在正确的前缀表达式中,操作数必然比操作符多一个,所以必然能找到一个操作符符合运算条件;而替换时,两个操作数和一个操作符替换为一个操作数,所以减少了各一个操作符和操作数,仍然可以迭代运算直至计算整个式子。多元运算也类似,遇到足够的操作数即产生运算,迭代直至完成。迭代结束的条件由表达式的正确性来保证。下面是一个例子,演示了每一步的运算顺序:

 - * / 15 - 7 + 1 1 3 + 2 + 1 1 =
 - * / 15 - 7   2   3 + 2 + 1 1 =
 - * / 15     5     3 + 2 + 1 1 =
 - *        3       3 + 2 + 1 1 =
 -          9         + 2 + 1 1 =
 -          9         + 2   2   =
 -          9         4         =
                5

逻辑运算的波兰记法

下面的表格显示了命题逻辑的扬·武卡谢维奇记法,波兰记法中的某些字母代表特定的波兰语单词。普遍记法在1970和1980年代演变成下表的记法。

概念 普遍记法 波兰记法
逻辑非 φ
逻辑与 φψ Kφψ
逻辑或 φψ Aφψ
逻辑条件 φψ Cφψ
逻辑双条件 φψ Eφψ
谢费尔竖线 Dφψ
可能性 φ
必然性 φ
全称量化 φ Πφ
存在量化 φ Σφ

注釋

  1. ^ from Nicod's Axiom and Generalizing Deduction, page 180. 原文用波兰语写在一个平版报告上。
  2. ^ Church, Alonzo. Introduction to Mathematical Logic. Princeton, New Jersey: Princeton University Press. 1944.  - p.38: "Worthy of remark is the parenthesis-free notation of Jan Łukasiewicz. In this the letters N, A, C, E, K are used in the roles of negation, disjunction, implication, equivalence, conjunction respectively. ..."

参见

延伸阅读

  • Łukasiewicz, Jan. Aristotle’s Syllogistic from the Standpoint of Modern Formal Logic. Oxford University Press. 1957. 
  • Łukasiewicz, Jan, "Philosophische Bemerkungen zu mehrwertigen Systemen des Aussagenkalküls", Comptes rendus des séances de la Société des Sciences et des Lettres de Varsovie, 23:51-77 (1930). Translated by H. Weber as "Philosophical Remarks on Many-Valued Systems of Propositional Logics", in Storrs McCall, Polish Logic 1920-1939, Clarendon Press: Oxford (1967).

Read other articles:

سفارة أوكرانيا في سلوفينيا أوكرانيا سلوفينيا الإحداثيات 46°02′23″N 14°30′06″E / 46.03975°N 14.501583333333°E / 46.03975; 14.501583333333 البلد سلوفينيا  المكان ليوبليانا الاختصاص سلوفينيا  الموقع الالكتروني الموقع الرسمي تعديل مصدري - تعديل   سفارة أوكرانيا في سلوفينيا هي أرفع ت...

 

OnewOnew di Dream Concert 2015Informasi latar belakangNama lahirLee JinkiLahir14 Desember 1989 (umur 34)GenreK-pop, dance-popPekerjaanPenyanyi, pemusik, pembawa acara, aktorTahun aktif2008–sekarangLabelSM Entertainment (Korea Selatan)EMI Music Japan (Jepang)[1]Artis terkaitShinee, SM Town Nama panggungHangul온유 Hanja温流 Alih AksaraOn YuMcCune–ReischauerOn YuNama lahirHangul이진기 Hanja李珍基 Alih AksaraI Jin GiMcCune–ReischauerYi Jin Ki atau Yi Chin Ki Lee Jinki...

 

Piala AlbaniaMulai digelar1939Wilayah AlbaniaJumlah tim64Juara bertahanKF LaciTim tersuksesKF Tirana(15 gelar) KF Partizani Tirana(15 gelar)Situs webSitus resmi Piala Albania 2013–14 Piala Albania (bahasa Albania: Kupa e Shqipërisë) adalah sebuah kejuaraan sepak bola yang diselenggarakan di Albania. Kejuaraan dimulai sejak tahun 1939 sebagai Kupa e Mbretit (English:The King's Cup). Pemenangnya akan mengikuti babak pertama kualifikasi Liga Eropa UEFA. Daftar juara Tahun Juara Runn...

No debe confundirse con la actual República de Ghana, ubicada en el golfo de Guinea. Imperio de GhanaWagadu Imperio africano aprox. 200s-1240 El Imperio de Ghana.Coordenadas 15°40′00″N 8°00′00″O / 15.66666667, -8Capital Kumbi SalehEntidad Imperio africanoIdioma oficial SoninkéLenguas mandéPeríodo histórico Edad Media • aprox. 200s Establecido • 1240 Conquista por los SossoForma de gobierno MonarquíaEmperador (Ghana)• 700• 790• 1040-1062• 1...

 

2007 film This article needs additional citations for verification. Please help improve this article by adding citations to reliable sources. Unsourced material may be challenged and removed.Find sources: BloodRayne 2: Deliverance – news · newspapers · books · scholar · JSTOR (July 2021) (Learn how and when to remove this template message) BloodRayne 2: DeliveranceDVD coverDirected byUwe BollWritten byChristopher DonaldsonNeil EveryBased onBloodRayne s...

 

Data visualization with quartiles A dispersion fan diagram (left) in comparison with a box plot A fan chart is made of a group of dispersion fan diagrams, which may be positioned according to two categorising dimensions. A dispersion fan diagram is a circular diagram which reports the same information about a dispersion as a box plot: namely median, quartiles, and two extreme values. Elements The elements of a dispersion fan diagram[1] are: a circular line as scale a diameter which in...

Questa voce sugli argomenti cestisti statunitensi e allenatori di pallacanestro statunitensi è solo un abbozzo. Contribuisci a migliorarla secondo le convenzioni di Wikipedia. Segui i suggerimenti dei progetti di riferimento 1, 2. C.M. Newton Nazionalità  Stati Uniti Altezza 188 cm Peso 86 kg Pallacanestro Ruolo Guardia / alaAllenatore Termine carriera 1951 - giocatore1989 - allenatore Hall of fame Naismith Hall of Fame (2000) Carriera Giovanili Fort Lauderdale High School19...

 

British politician (1823–1898) The Right HonourableThe Lord CarlingfordKP PCLord President of the CouncilIn office19 March 1883 – 24 June 1885MonarchVictoriaPrime MinisterWilliam Ewart GladstonePreceded byThe Earl SpencerSucceeded byThe Viscount CranbrookPresident of the Board of TradeIn office14 January 1871 – 17 February 1874MonarchVictoriaPrime MinisterWilliam Ewart GladstonePreceded byJohn BrightSucceeded bySir Charles Adderley Personal detailsBorn(1823-01-18)18 Ja...

 

American computer scientist (born 1981) Scott AaronsonAaronson in 2011BornScott Joel Aaronson (1981-05-21) May 21, 1981 (age 43)Philadelphia, Pennsylvania, United StatesNationalityAmericanAlma mater Cornell University University of California, Berkeley Known for Quantum Turing machine with postselection Algebrization Boson sampling SpouseDana MoshkovitzAwards Alan T. Waterman Award PECASE Tomassoni–Chisesi Prize ACM Prize in Computing Scientific careerFieldsComputational comp...

School district in California Needles Unified School DistrictAddress1900 Erin Drive Needles, California, 92363United StatesCoordinates34°50′19″N 114°37′11″W / 34.83861°N 114.61972°W / 34.83861; -114.61972District informationTypePublicMottoEducation FirstGradesK–12[1]SuperintendentDr Garry CameronNCES District ID0626760 [1]Students and staffStudents967 (2020–2021)[1]Teachers46.75 (FTE)[1]Staff53.01 (FTE)[1]Student�...

 

الشركة الوطنية للإذاعة والتلفزةSociété nationale de radiodiffusion et de télévisionJenisPerusahaan milik pemerintahIndustriMedia massaGenreLayanan penyiaran masyarakatPendiriPemerintah MarokoKantorpusatRabat, MarokoWilayah operasiMaroko, Eropa, Timur TengahTokohkunciFayçal Laâraïchi, Presiden (PDG)JasaTelevisi, radio, daringPemilikPemerintahan MarokoKaryawan2,300Situs webwww.snrt.ma Société nationale de radiodiffusion et de télévision (SNRT) adalah penyi...

 

هذه مقالة غير مراجعة. ينبغي أن يزال هذا القالب بعد أن يراجعها محرر؛ إذا لزم الأمر فيجب أن توسم المقالة بقوالب الصيانة المناسبة. يمكن أيضاً تقديم طلب لمراجعة المقالة في الصفحة المخصصة لذلك. (أكتوبر 2021) هذه المقالة يتيمة إذ تصل إليها مقالات أخرى قليلة جدًا. فضلًا، ساعد بإضافة �...

Chadian politician Emmanuel Nadingar15th Prime Minister of ChadIn office5 March 2010 – 21 January 2013PresidentIdriss DébyPreceded byYoussouf Saleh AbbasSucceeded byDjimrangar Dadnadji Personal detailsBorn1951 (age 72–73)Bebidja, French Equatorial Africa (now Chad)Political partyPatriotic Salvation Movement Emmanuel Djelassem Nadingar (born 1951[1]) is a Chadian politician who served as Prime Minister of Chad from March 2010 to January 2013. Political career...

 

Eliteserien 1999 Competizione Eliteserien Sport Calcio Edizione 54ª Organizzatore NFF Date dal 10 aprile 1999al 24 ottobre 1999 Luogo  Norvegia Partecipanti 14 Formula Girone all'italiana Risultati Vincitore Rosenborg(14º titolo) Secondo Molde Retrocessioni StrømsgodsetSkeidKongsvinger Statistiche Miglior marcatore Rune Lange (23) Incontri disputati 182 Gol segnati 697 (3,83 per incontro) Cronologia della competizione 1998 2000 Manuale La Eliteserien 1999, nota anch...

 

L'orologiaio di Saint-PaulPhilippe Noiret, l'orologiaioTitolo originaleL'horloger de Saint-Paul Paese di produzioneFrancia Anno1974 Durata105 min Generedrammatico RegiaBertrand Tavernier SoggettoGeorges Simenon SceneggiaturaJean Aurenche, Pierre Bost, Bertrand Tavernier ProduttoreRaymond Danon Casa di produzioneLira Films FotografiaPierre-William Glenn, Walter Bal, Jean-François Gondre MontaggioArmand Psenny, Ariane Boeglin MusichePhilippe Sarde ScenografiaJean Mandaroux CostumiYvette Bonnay...

Sporting event delegationAlbania at the2018 Mediterranean GamesIOC codeALBNOCAlbanian National Olympic Committeein Tarragona, SpainCompetitors41 in 14 sportsMedalsRanked 20th Gold 1 Silver 1 Bronze 0 Total 2 Mediterranean Games appearances (overview)1987199119931997200120052009201320182022 Albania (ALB) competed at the 2018 Mediterranean Games in Tarragona, Spain, from the 22 June to 1 July 2018 and was represented by the Albanian National Olympic Committee (KOKSH). Medalists Medal Name Spor...

 

Pakistanپاكِستانى قومFlag Of PakistanJumlah populasica 242,341,368[a] Daerah dengan populasi signifikan Pakistan233,500,636[1] Arab Saudi2,600,000 (2017 memperkirakan)[2] Uni Emirat Arab1,500,000 (2017 memperkirakan)[3] Britania Raya1,174,983 (2011 official British census)[4][b] Amerika Serikat526,956 (2018 Amerika Masyakarat Survei memperkirakan)[5] Oman235,000 (2013 memperkirakan)[6&#...

 

  「永泰」重定向至此。关于其他用法,请见「永泰 (消歧义)」。 永泰县县永泰县青云山风景永泰县的地理位置图荧光绿部分 为福州市永泰县范围坐标:25°32′N 118°34′E / 25.54°N 118.56°E / 25.54; 118.56国家 中华人民共和国隶属行政区福建省福州市政府駐地樟城镇政府 • 县长林永泰面积 • 总计2,229.02 平方公里(860.63 平方...

1963 film The Trip to BiarritzDirected byGilles GrangierWritten byMichel Audiard Raymond Castans Gilles Grangier Jean Manse Massimo UleriBased onThe Trip to Biarritz by Jean SarmentProduced byJacques Plante Massimo UleriStarringFernandel Michel Galabru RellysCinematographyRoger HubertEdited byMadeleine GugMusic byGeorges Van ParysProductioncompaniesMillimax Produzione Cinematografica MediterraneeDistributed byCinédisRelease date 15 March 1963 (1963-03-15) Running time94 minute...

 

By the Macedonians under Alexander the Great For other uses, see Siege of Tyre (disambiguation). Siege of Tyre (332 BC)Part of the Wars of Alexander the GreatMap of troop movements during Alexander's siegeDateJanuary–July 332 BCLocationTyre, Phoenicia (modern-day Lebanon)33°16′15″N 35°11′46″E / 33.27083°N 35.19611°E / 33.27083; 35.19611Result Macedonian victoryTerritorialchanges Macedonian army captures TyreBelligerents Macedonian EmpireHellenic League Ty...