CAN CSA-ISO IEC 13211-1-1997 Information Technology - Programming Languages - Prolog - Part 1 General Core (Technical Corrigendum 1 2008 Corrigendum 2 2013).pdf

上传人:eastlab115 文档编号:590304 上传时间:2018-12-15 格式:PDF 页数:253 大小:19.22MB
下载 相关 举报
CAN CSA-ISO IEC 13211-1-1997 Information Technology - Programming Languages - Prolog - Part 1 General Core (Technical Corrigendum 1 2008 Corrigendum 2 2013).pdf_第1页
第1页 / 共253页
CAN CSA-ISO IEC 13211-1-1997 Information Technology - Programming Languages - Prolog - Part 1 General Core (Technical Corrigendum 1 2008 Corrigendum 2 2013).pdf_第2页
第2页 / 共253页
CAN CSA-ISO IEC 13211-1-1997 Information Technology - Programming Languages - Prolog - Part 1 General Core (Technical Corrigendum 1 2008 Corrigendum 2 2013).pdf_第3页
第3页 / 共253页
CAN CSA-ISO IEC 13211-1-1997 Information Technology - Programming Languages - Prolog - Part 1 General Core (Technical Corrigendum 1 2008 Corrigendum 2 2013).pdf_第4页
第4页 / 共253页
CAN CSA-ISO IEC 13211-1-1997 Information Technology - Programming Languages - Prolog - Part 1 General Core (Technical Corrigendum 1 2008 Corrigendum 2 2013).pdf_第5页
第5页 / 共253页
亲,该文档总共253页,到这儿已超出免费预览范围,如果喜欢就下载吧!
资源描述

1、National Standard of Canada CAN/CSA-ISO/IEC I321 1-1 -97 International Standard ISO/IEC 13211-1:1995 (first edition, 1995-06-01) has been adopted without modification as CSA Standard CAN/CSA-ISO/IEC 13211-1-97, which has been approved as a National Standard of Canada by the Standards Council of Cana

2、da. ISSN 031 7-5669 February 1997 Information technology - Programming languages - Prolog - Part I: General core Technologies de Iinformation - langages de programmation - Prolog - Partie 7: Noyau general Reference number ISO/IEC 1321 1-1 :1995(E) LAssociation canadienne de normalisation (CSA), sous

3、 les auspices de laquelle cette Norme nationale a 616 prkparbe, a recu ses lettres patentes en 1919 et son accrbditation au sein du Systkme de normes nationales par le Conseil canadien des normes en 1973. Association daffiliation libre, sans but lucratif ni pouvoir de rkglementation, elle se consacr

4、e A Iklaboration de normes et a la certification. Les normes CSA reflktent le consensus de producteurs et dusagers de partout au pays, au nombre desquels se trouvent des fabricants, des consomrnateurs, des detaillants et des reprgsentants de syndicats, de corps professionnels et dagences gouvernemen

5、tales. Lutilisation des normes CSA est trhs repandue dans Iindustrie et le commerce, et leur adoption 1 divers ordres de Ibgislation, tant municipal et provincial que fbd cet aspect demeure la responsabilite de Iorganisme rkdacteur de normes accredit cest pourquoi il est recommand6 aux utilisateurs

6、de se procurer Iddition la plus rkcente de la norme auprks de lorganisme qui Ia priparhe. Une Norme nationale du Canada est une norme, approuvde par le Conseii canadien des normes, qui reflkte une entente raisonnable parmi les points de vue dun certain Lapprobation dune norme en tant que Norme natio

7、nale du Canada indique quelie est conforme aux methodes et crithres btablis par le Conseil canadien des normes. II est recommand6 aux personnes qui ont besoin de normes de se servir des Normes nationales du Canada lorsque la chose est possible. Ces normes font lobjet dexamens The Standards Council o

8、f Canada is the coordinating body of the National Standards system, a federation of independent, autonomous organizations working towards the further development and improvement of voluntary standardization in the national interest. The principal objects of the Council are to foster and promote volu

9、ntary standardization as a means of advancing the national economy, benefiting the health, safety, and welfare of the pubiic, assisting and protecting the consumer, facilitating domestic and international trade, and furthering internaiional cooperation in the field of standards. A National Standard

10、01 Canada is a standard which has been approved by the Standards Council of Canada and one which reflects a reasonable agreement among the views of a number of capable individuals whose collective interests provide to the greatest practicable extent a balance of representation of producers, users, c

11、onsumers, and others with relevant interests, as may be appropriate to the subject in hand. It normally is a standard which is capable of making a significant and timely contribution to the national interest. Approval of a standard as a National Standard of Canada indicates that a standard conforms

12、to the criteria and procedures established by the Standards Council of Canada. Approval does not refer to the technical content of the standard; this remains the continuing responsibility of the accredited standards-development organization. Those who have a need to apply standards are encouraged to

13、 use National Standards of Canada whenever practicable. These standards are subject to periodic review; therefore, users are cautioned to obtain the latest edition from the organization preparing the standard. La responsabilitk dapprouver ies Normes nationales du Canada incombe au The responsibility

14、 for approving National Standards of Canada rests with the Conseil canadien des normes Standards Councii of Canada 45, rue OConnor, Bureau 1200 45 OConnor Street, Suite 1200 Ottawa, Ontario, K1 P 6N7 Canada Bien que le but premier vise par cette norme soit enonce sous sa rubrique Domaine dapplicatio

15、n, il est imporfant de retenir quii incornbe a Iutilisateur de juger si la norme convient a ses besoins particuliers. Although the intended primary application of this Standard is stated in its Scope, it is important to note that it remains the responsibility of fhe user to judge its suitability for

16、 their particular purpose. Information technology Prog ramming languages Prolog Part 1: General coreTechnical Corrigendum 2:2013 (IDT) toNational Standard of CanadaCAN/CSA-ISO/IEC 13211-1-97(ISO/IEC 13211-1:1995, IDT)NOT FOR RESALE. / PUBLICATION NON DESTINE LA REVENTE.Standards Update ServiceTechni

17、cal Corrigendum 2:2013 toCAN/CSA-ISO/IEC 13211-1-97January 2013Title:Information technology Pr ogramming languages Prol og Part 1: General corePagination:28 pagesTo register for e-mail notification about any updates to this publicationgo to shop.csa.caclick on CSA Update ServiceThe List ID that you

18、will need to register for updates to this publication is 2410755.If you require assistance, please e-mail techsupportcsagroup.org or call 416-747-2233.Visit CSA Groups policy on privacy at csagroup.org/legal to find out how we protect your personal information.INTERNATIONAL STANDARD ISO/IEC 13211-1:

19、1995TECHNICAL CORRIGENDUM 2 Published 2012-02-15 INTERNATIONAL ORGANIZATION FOR STANDARDIZATION ORGANISATION INTERNATIONALE DE NORMALISATIONINTERNATIONAL ELECTROTECHNICAL COMMISSION COMMISSION LECTROTECHNIQUE INTERNATIONALEInformation technology Programming languages Prolog Part 1: General core TECH

20、NICAL CORRIGENDUM 2 Technologies de linformation Langages de programmation Prolog Partie 1: Noyau gnral RECTIFICATIF TECHNIQUE 2 Technical Corrigendum 2 to ISO/IEC 13211-1:1995 was prepared by Joint Technical Committee ISO/IEC JTC 1, Information technology, Subcommittee SC 22, Programming languages,

21、 their environments and system software interfaces. ICS 35.060 Ref. No. ISO/IEC 13211-1:1995/Cor.2:2012(E) ISO/IEC 2012 All rights reserved Technical Corrigendum 2:2013 to CAN/CSA-ISO/IEC 13211-1-97 ISO/IEC 2012 All rights reservedInformation technology - Programming languages - Prolog - Part 1: Gen

22、eral Core TECHNICAL CORRIGENDUM 2 Allow bar character | as infix operator, forbid and as operators. 6.3.4.3 Operators Add prior to syntax rules: A bar (6.4) shall be equivalent to the atom | when | is an operator. Add the syntax rule: op = bar ; Abstract: | Priority: n n Specifier: s s Condition: |

23、is an operator Add at the end of 6.3.4.3 before NOTES: There shall not be an operator or . An operator | shall be only an infix operator with priority greater than or equal to 1001. Add to note 1 Bar is also a solo character (6.5.3), and a token (6.4) but not an atom. Replace note 3 3 The third argu

24、ment of op/3 (8.14.3) may be any atom except , so the priority of the comma operator cannot be changed. by 3 The third argument of op/3 (8.14.3) may be any atom except , , and so the priority of the comma operator cannot be changed, and so empty lists and curly bracket pairs cannot be declared as op

25、erators. 6.3.4.4 Technical Corrigendum 2:2013 to CAN/CSA-ISO/IEC 13211-1-97Add in Table 7 - The operator table: Priority Specifier Operator(s) 400 yfx div 200 fy + 6.4 Tokens Add as the last syntax rule: bar (* 6.4 *) = layout text sequence (* 6.4.1 *) , bar token (* 6.4.8 *) ; 6.4.8 Other tokens Ad

26、d as the last syntax rule: bar token (* 6.4.8 *) = bar char (* 6.5.3 *) ; 6.5.3 Solo characters Add alternative for solo char: | bar char (* 6.5.3 *) Add as the last syntax rule: bar char (* 6.5.3 *) = “|“ ; Add the new subclause into the place indicated by its number: 7.1.1.5 Witness variable list

27、of a term The witness variable list of a term T is a list of variables and a witness of the variable set (7.1.1.2) of T. The variables appear according to their first occurrence in left-to-right traversal of T. NOTES 1 For example, X, Y is the witness variable list of each of the terms f(X,Y), X+Y+X

28、+Y, X+Y+X, and X*Y+X*Y. 2 The concept of a witness variable list of a term is required when defining term_variables/2 (8.5.5). Add the new sublause into the place indicated by its number: 7.1.6.9 List prefix of a term LP is a list prefix of a term P if: a) LP is an empty list, or ISO/IEC 2012 All ri

29、ghts reserved Technical Corrigendum 2:2013 to CAN/CSA-ISO/IEC 13211-1-97 ISO/IEC 2012 All rights reservedb) P is a compound term whose principal functor is the list constructor and the heads of LP and P are identical, and the tail of LP is a list prefix of the tail of P. NOTE For example, , 1, and 1

30、,2 are all list prefixes of 1,2,3, 1,2|X, and 1,2|nonlist. Correct example for call/1. 7.8.3.4 example no. 6 For program b(X) :- Y = (write(X), X), call(Y). replace b(3). Outputs 3, then type_error(callable, 3). by b(3). type_error(callable, (write(3),3). Adjust Template and Modes of catch/3, remove

31、 error conditions. In this manner all errors of the goal are caught by catch/3. 7.8.9 catch/3 Replace 7.8.9.2 Template and modes catch(+callable_term, ?term, ?term) 7.8.9.3 Errors a) G is a variable instantiation_error. b) G is neither a variable nor a callable term type_error(callable, G) by 7.8.9.

32、2 Template and modes catch(goal, ?term, goal) 7.8.9.3 Errors Technical Corrigendum 2:2013 to CAN/CSA-ISO/IEC 13211-1-97None. 7.9.1 Description (Evaluating an expression) Replace 7.9.1 Note 1 1 An error occurs if T is an atom or variable. by 1 An error occurs if T is a variable or if there is no oper

33、ation F in step 7.9.1 c). 7.9.2 Errors (Evaluating an expression) Replace error condition i and j which both were added in Technical Corrigendum 1. i) The value of an argument Culprit is not a member of the set I type_error(integer, Culprit). j) The value of an argument Culprit is not a member of th

34、e set F type_error(float, Culprit). by i) E is a compound term with no corresponding operator in step 7.9.1 c but there is an operator corresponding to the same principal functor with different types such that a) the i-th argument of the corresponding operator has type Type, and b) the value Culprit

35、 of the i-th argument of E has a different type type_error(Type, Culprit). Add new error class, new types, and new domain. 7.12.2 Error classification Remove in subclause b variable from the enumerated set ValidType and add pair to the set ValidType. Add in subclause c order to the set ValidDomain.

36、Add additional error class: k) There shall be an Uninstantiation Error when an argument or one of its components is not a variable, and a variable or a component as variable is required. It has the form uninstantiation_error(Culprit) where Culprit is the argument or one of its components which cause

37、d the error. 8.1.3 Errors (The format of built-in predicate definitions) Replace in Note 5 5 When a built-in predicate has a single mode and template, an argument whose mode is - is always associated with an error condition: a type error when the argument is not a variable. the words ISO/IEC 2012 Al

38、l rights reserved Technical Corrigendum 2:2013 to CAN/CSA-ISO/IEC 13211-1-97 ISO/IEC 2012 All rights reserveda type error by an uninstantiation error Add testing built-in predicate subsumes_term/2. Add the new subclauses into the place indicated by their number: 8.2.4 subsumes_term/2 This built-in p

39、redicate provides a test for syntactic one-sided unification. 8.2.4.1 Description subsumes_term(General, Specific) is true iff there is a substitution such that a) General and Specific are identical, and b) Specific and Specific are identical. Procedurally, subsumes_term(General, Specific) simply su

40、cceeds or fails accordingly. There is no side effect or unification. 8.2.4.2 Template and modes subsumes_term(term, term) 8.2.4.3 Errors None. 8.2.4.4 Examples subsumes_term(a, a). Succeeds. subsumes_term(f(X,Y), f(Z,Z). Succeeds. subsumes_term(f(Z,Z), f(X,Y). Fails. subsumes_term(g(X), g(f(X). Fail

41、s. subsumes_term(X, f(X). Fails. subsumes_term(X, Y), subsumes_term(Y, f(X). Succeeds. NOTES Technical Corrigendum 2:2013 to CAN/CSA-ISO/IEC 13211-1-971 The final two examples show that subsumes_term/2 is not transitive. A transitive definition corresponding to the term-lattice partial order is term

42、_instance/2 (3.95). term_instance(Term, Instance) :- copy_term(Term, Copy), subsumes_term(Copy, Instance). term_instance(g(X), g(f(X). Succeeds. 2 Many existing processors implement a built-in predicate subsumes/2 which unifies the arguments. This often leads to erroneous programs. The following def

43、inition is mentioned only for backwards compatibility. subsumes(General, Specific) :- subsumes_term(General, Specific), General = Specific. Add testing built-in predicates callable/1, ground/1, acyclic_term/1. Add the new subclauses into the place indicated by their number: 8.3.9 callable/1 8.3.9.1

44、Description callable(Term) is true iff Term is a callable term (3.24). NOTE Not every callable term can be converted to the body of a clause, for example (1,2). 8.3.9.2 Template and modes callable(term) 8.3.9.3 Errors None. 8.3.9.4 Examples callable(a). Succeeds. callable(3). Fails. callable(X). Fai

45、ls. callable(1,2). Succeeds. 8.3.10 ground/1 ISO/IEC 2012 All rights reserved Technical Corrigendum 2:2013 to CAN/CSA-ISO/IEC 13211-1-97 ISO/IEC 2012 All rights reserved8.3.10.1 Description ground(Term) is true iff Term is a ground term (3.82). 8.3.10.2 Template and modes ground(term) 8.3.10.3 Error

46、s None. 8.3.10.4 Examples ground(3). Succeeds. ground(a(1, _). Fails. 8.3.11 acyclic_term/1 8.3.11.1 Description acyclic_term(Term) is true iff Term is acyclic, that is, it is a variable or a term instantiated (3.96) with respect to the substitution of a set of equations not subject to occurs check

47、(7.3.3). 8.3.11.2 Template and modes acyclic_term(term) 8.3.11.3 Errors None. 8.3.11.4 Examples acyclic_term(a(1, _). Succeeds. X = f(X), acyclic_term(X). Undefined. STO 7.3.3, does not succeed in many implementations, but fails, produces an error, or loops Add built-in predicates compare/3, sort/2,

48、 keysort/2 based on term order. 8.4 Term comparison, 8.4.1 Technical Corrigendum 2:2013 to CAN/CSA-ISO/IEC 13211-1-97Move the two paragraphs from subclause 8.4 to subclause 8.4.1. Add into subclause 8.4: These built-in predicates compare and sort terms based on the ordering of terms (7.2). Add the n

49、ew subclauses into the place indicated by their number: 8.4.2 compare/3 three-way comparison 8.4.2.1 Description compare(Order, X, Y) is true iff Order unifies with R which is one of the following atoms: = iff X and Y are identical terms (3.87), iff Y term_precedes X. Procedurally, compare(Order, X, Y)

展开阅读全文
相关资源
猜你喜欢
相关搜索

当前位置:首页 > 标准规范 > 国际标准 > 其他

copyright@ 2008-2019 麦多课文库(www.mydoc123.com)网站版权所有
备案/许可证编号:苏ICP备17064731号-1