Information technology - Programming languages - Prolog - Part 1:
General Core
WORKING DRAFT TECHNICAL CORRIGENDUM 3


JPEH comments in bold. with ***

This document is prepared in fulfillment of WG 17 resolutions in Istanbul 2013 and Vienna 2014.

Deleted text is in Strikethrough, inserted text is underlined.


C1 Allow explicitly extensions to options in 5.5 Extensions. Add new subclause

5.5.12 Options.

A processor may support one or more additional options such as stream options (7.10.2.11), stream close options (7.10.2.12), read options (7.10.3), and write options (7.10.4) as an implementation specific feature. An invalid option E shall be associated with only two error conditions: an instantiation error when there is an instance (3.95) of E that is a valid option, and a domain error for the domain xxx_option when there is no instance of E that is a valid option. Further, an instantiation error may occur in place of a domain error if a component of E is a variable, and an instantiated component is required.

NOTE — A valid option may still imply further errors ; as in 8.11.5.3 l and m.

C2 Add an optional layout text sequence to the fourth and last production

6.2.1 Prolog text

p text = [ layout text sequence (* 6.4.1 *) ] ;

C3 Replace unifies with by has the form

7.1.6.3 Iterated-goal term

a) If T unifies with has the form ^(_, G) then ...

C4 Add term-to-body conversion in example. Add to the first paragraph, and replace in Table 22 G by goal :

7.8.3.4 Examples

**** Why goal rather than Goal

Table 21 and 22 show the execution stack before and
after executing the control construct call(G) with goal
obtained from G via 7.6.2 Converting a term to the body of a clause.

Table 22

N + 1     ( (G goal, N – 1),     Σ    nil

C5 Specify left-to-right traversal order in read-options variable_names/1 and singletons/1.

7.10.3 Read-options list

variable_names(VN_list) — After inputting a
term, VN_list shall be unified with a list of ele-
ments where: (1) each element is a term A = V, and
(2) V is a named variable of the term, and (3) A is an
atom whose name is the characters of V, and (4) the elements appear in the order of the first occurrence of their variables V in the term input, in left-to-right traversal order.

singletons(VN_list) — After inputting a term,
VN_list shall be unified with a list of elements
where: (1) each element is a term A = V, and (2) V is
a named variable which occurs only once in the term,
and (3) A is an atom whose name is the characters of V,
and (4) the elements appear in the order of the first occurrence of their variables V in the term input, in left-to-right traversal order.


C6 Add write-option variable_names(VN_list) before option numbervars(Bool) in analogy to the read-option variable_names(VN_list). Replace an by a non-negative in write-option numbervars(Bool).

7.10.4 Write-option list


*** I prefer better!

variable_names(VN_list) — Each variable V is output as the unquoted atom (@@@better: is output as the sequence of characters defined by the syntax for the atom)A iff a term A = V is an element of the list VN_list. If more than one element applies, the leftmost is used.
numbervars(Bool) - Iff Bool (7.1.4.2) is true a
term of the form '$VAR'(N), where N is an a non-negative integer, is
output as a variable name consisting of a capital letter
possibly followed by an integer.

NOTE 2 — For write-option variable_names(VN_list) any instance (3.95) (obtained via unification) of a term obtained with the corresponding read-option is well defined. @@@ Actually, only the selection of the variable names to be printed is well defined.

NOTE 3 — Many Prolog processors had modified the write option numbervars/1 to permit printing arbitrary variable names. The write option variable_names/1 should be used for this purpose to avoid vulnerabilities. @@@

C7 Add writing with variable_names/1, correct terminology and writing of {}, lists, extra round brackets

7.10.5 Writing a term


Add as first subclause:
a1) If Term is a variable and there is an effective write-option variable_names(VN_list) and there is an element A = Term of the list VN_list with A an atom, then A is output with effective write-option quoted(false).

Rename subclause a to a2
Rename subclause e to e1 and replace:
e) e1) If Term has the form '$VAR'(N) for some pos-
itive
non-negative integer N, and there is an effective write-option
numbervars(true), a variable name as defined in
subclause 7.10.4 is output,

7.10.5 subclause g: Rename subclause g to subclause e2.
g) e2) Else if Term has the form '.'(Head, Tail), and
there is an effective write-option ignore_ops(false),
then Term is output using list notation, that is:
1) [ (open list char) is output.
2) Head is output by recursively applying these
rules. Head is preceded by ( (open char)
and followed by ) (close char), if the term could not be
re-input correctly with the same set of current operators.

3) If Tail has the form '.'(H,T) then , (comma
char) is output, set Head:=H, Tail:=T, and goto (2).
4) If Tail is [] then a closing bracket ] (close list
char) is output,
5) Else a | (head tail separator char) is output,
Tail is output by recursively applying these rules,
Tail is preceded by ( (open char)
and followed by ) (close char), if the term could not be
re-input correctly with the same set of current operators,

and finally, ] (close list char) is output.

Add new 7.10.5 subclause e3 for {X} (Already noted in DTC1)
e3) Else if Term has the form '{}'(Arg), and there is an effective write-option ignore_ops(false), then Term is output as a curly bracketed term (6.3.6), that is:
1) { (open curly char) is output
2) Arg is output by recursively applying these rules
3) } (close curly char) is output

7.10.5 Replace canonical form by functional notation ; subclause f 3 must mention the required open char, close char.
f) Else if Term has a principal functor which is not
a current operator, or if there is an effective write-
option ignore_ops(true), then the term is output in
canonical form functional notation (6.3.3), that is:
1) The atom of the principal functor is output.
2) ( (open char) is output.
3) Each argument of the term is output by recursively
applying these rules. The argument is preceded by ( (open char) and followed by ) (close char), if the term could not be re-input correctly with the same set of current operators.
4) , (comma char) is output between each successive
pair of arguments.
5) ) (close char) is output.

7.10.5 h
h) If Else if Term has a principal functor which is an
operator, and there is an effective write-option
ignore_ops(false), then the term is output in operator
form, that is:
1) The atom of the principal functor is output
in front of its argument (prefix operator), between
its arguments (infix operator), or after its argument
(postfix operator). In all cases, a space is output
to separate an operator from its argument(s) if any
ambiguity could otherwise arise.

Operators ',' and '|' are output as , (comma char) and | (bar char) respectively.

2) Each argument of the term is output by recursively
applying these rules. When an An argument is itself
to be output in operator form, it
is preceded by (
(open char) and followed by ) (close char) if: (i) the
principal functor is an operator whose priority is so
high that the term could not be re-input correctly with
same set of current operators, or (ii) the argument is
an atom which is a current operator, or (iii) the principal functor is output as a prefix operator - and the argument is a non-negative number, or (iv) the principal functor is output as a prefix operator - and the argument is output in infix or postfix operator form.


C8

7.12.2 Error classification

7.12.2 b: Add float to the set ValidType.
7.12.2 c: Remove character_code_list from the set ValidDomain.
7.12.2 e: add comma to PermissionType ∈ { binary_stream flag,
C9 Add Note 7 for options lists.

8.1.3 Errors

.*** 13211-1 does not use these sublists.
7 When a built-in predicate has an argument whose type is a list of options (@@@ as input?), that argument will be an +oname_options_list. (There should be a type oname_options_list used in Template and Modes, and a corresponding domain_error(oname_option, Culprit)). That argument will always be associated with
  1. an instantiation error, when the argument is a partial list, or an element is not a valid option but an instance of the element is a valid option.
  2. a domain error, when an element is neither a valid option nor any instance is a valid option.
  3. additionally, an instantation error may occur in place of the domain error, if ...@
Errors caused by a well-formed option are not subsumed by the domain error. They are reported differently. @@@using different errors.

CXXX Replace error condition for (^)/2, when resulting value is not an integer but still a real number.

9.3.10 (^)/2 – integer power

9.3.10.3 e

e) VX and VY are integers and VX is not equal to 1 and VY is less than -1 VY is negative and VX is not equal to 1, 0, or -1.
— type_error(float, VX).

CXXX Replace example error

9.3.10.4 Examples

2^(-1).
evaluation_error(undefined). type_error(float, 2).

Annex B
(informative)
Editorial notes

Check that there are no @@@.

Unusual characters

Check the following characters are correctly printed.
All error subclauses (X.Y.Z.3)
Mdash: —, Theta: θ, Ndash: –, Times: ×, Rightwards arrow: →, Union: ∪, Floor: ⌊ ⌋, Inequality: ≠, Logical and: ∧, Element of, not in: ∈, ∉, Pi: π Less or equal: ≤

Background

These faults were noted after preparing for publication the text of ISO/IEC 13211-1:1995 Prolog: Part 1 - General Core, subsequent lists of errors noted by WG17 and after preparing for publication the text of Technical Corrigendum 1 and Technical Corrigendum 2.

Ulrich Neumerkel (editor)
Institut für Computersprachen E185/1
TU Wien
Argentinierstr. 8
A-1040 Wien
Austria
Telephone: +43 1 58801 18513
E-Mail: Ulrich.Neumerkel@tuwien.ac.at
October 2013 -

Document history

Version control
Validated HTML