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



This document is prepared in fulfillment of WG 17 resolutions in Istanbul 2013/Vienna 2014.
C1 Allow explicitly extensions to options in 5.5 Extensions.
  • 5.5.12 Add new subclause

    5.5.12 Options.

    A processor may support one or more additional options, like stream options (7.10.2.11), stream close options (7.10.2.12), stream properties (7.10.2.13), read options (7.10.3), and write options (7.10.4) as an implementation specific feature.

    @@@ The processing of options is associated only with instantiation errors and domain errors for the specific option domain. (Refer to 8.1.2 Notes)

    7.1.6.3 Iterated-goal term

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

    7.8.3.4, Table 22

    : Replace ((G, N-1), ...) by ((goal, N-1), ...) where goal is obtained from G via 7.6.2.

    7.10.3

    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 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.
    @@@ idem

    7.10.4 Write-option numbervars(Bool)

    add:
    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.

    7.10.4 Write-option list

    add missing write-option variable_names(VN_list) in analogy to the read-option variable_names(VN_list).

    7.10.4 add:

    variable_names(VN_list) — Each variable V is output as the unquoted 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.
    NOTE 2 — For write-option variable_names(VN_list) any instance (3.95) 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 &mdahs; Many processors had @@@abused the write option numbervars/1 for printing arbitrary variable names. @@@

    7.10.5 Writing a term

    The following changes
  • 7.10.5 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).

    7.10.5 subclause a

    . Rename subclause a to a2.
  • (WDCor.3) 7.10.5 subclause e: Replace: If Term has the form '$VAR'(N) for some pos-
    itive
    integer N, ... by non-negative.
  • (WDCor.3) 7.10.5 subclause e. Rename subclause to e1.
  • (WDCor.3) 7.10.5 new subclause for {X} needed (Already noted in DTC1). Tentative new clause
    e2) 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
  • (WDCor.3) 7.10.5 subclause f 3 must mention the required open char, close char.
  • (WDCor.3) 7.10.5 subclause g must precede subclause f. Otherwise, writeq([a]) always has to write '.'(a,[]). That is, rename subclause g to subclause e3.
  • 7.10.5 h Replace
    h) If Term has a principal functor ...
    by Else if
  • 7.10.5 h
    h) 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.
    Add:
    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 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.
    1. Condition (ii) never applies, because there is a further contradicting condition in front: "When an argument is itself to be output in operator form". If we have an argument which is an atom then that atom is not be output in operator form. Only certain principal functors of arity one and two are to be output in operator form. Thus, we will never get to condition (ii).
    2. The cases - (1) and - (1^a) are not mentioned explicitly.
    3. The cases (1,2) and (1|2) are not mentioned.
    Tentative new formulation:
    2) Each argument of the term is output by recursively applying these rules. An argument 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 the 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 to be output in infix or postfix operator form.
  • (WDCor.3) 7.12.2 b: Add float to the set ValidType.
  • (WDCor.3) 7.12.2 c: Remove character_code_list from the set ValidDomain.
  • 7.12.2 e: PermissionType ∈ { binary_stream flag, add comma.
  • 8.1.3 Errors. Add Note 7:
    7 When a built-in predicate has an argument whose type is a list of options (@@@ as input?), that argument will be an +xxx_options_list. (There should be a type name_options_list used in Template and Modes, and a corresponding domain_error(name_option)). 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.
  • 8.5.1.4 Examples second last: Missing alternative error type_error(evaluable,unbound) when Prolog flag bounded is false. @@@
  • (WDCor.3) 8.9.2.1
    e) Constructs the clause with head H and body B,
    Replace by G.
  • (WDCor.3) 8.10.3.4 example no. 20 undo the change introduced in Cor.1. That is, keep the list [a, b, f(b), f(a)] as in IS 13211-1:1995.
  • (WDCor.3) 8.11.4.1 Add subclause
    b) the goal succeeds.
  • (WDCor.3) 8.11.5.3 c:
    c) Options is a partial list or a list with an element
    E which is a variable or which has a component
    which is a variable, and an instantiated component is required.

    instantiation_error.
    Same for 8.11.6.3 b, 8.14.1.3 b, 8.14.2.3 b.
  • (WDCor.3) 8.14.1.1 k
    k) Parses C_Seq as a read-term (6.4) T.,
    by
    k) Parses C_Seq as a read-term (6.2.2) T.,
  • (WDCor.3) 8.14.2.3 e
    e) An element E of the Options list is neither a
    variable nor a valid write-option
    domain_error(write_option, E).
    write_term(1,[quoted(nonbool)]).
       domain_error(write_option,quoted(nonbool))
    write_term(1,[quoted(B)]).
       domain_error(write_option,quoted(_))
    
    The second case seems to be particularly problematic because a further instantiation would make this goal succeed.
    B = true, write_term(1,[quoted(B)]).
       Succeeds, outputting the character 1.
    
    See also write options.
  • (WDCor.3) 8.14.2.4 Examples

    Replace

    write_canonical([1,2,3]).
       Succeeds, outputting the characters
    .(1,.(2,.(3,[ ])))
        to the current output stream.
    
    by
    write_canonical([1,2,3]).
       Succeeds, outputting the characters
    '.'(1,'.'(2,'.'(3,[])))
        to the current output stream.
    
  • (WDCor.3) 9.3.1.3 c) VX is negative and Y is not. Replace by VY.
  • (WDCor.3) 9.3.10.3 e. Error condition needs to be reformulated to cover all cases where the resulting value cannot be in I but still is in R.

    Here are the values for X^Y for X, Y in -3..3.

    Y
    3 -27 -8 -1 0 1 8 27
    2 9 4 1 0 1 4 9
    1 -3 -2 -1 0 1 2 3
    0 1 1 1 1 1 1 1
    -1 ty.ety.e -1e.u 1ty.ety.e
    -2 ty.ety.e 1e.u 1ty.ety.e
    -3 ty.ety.e -1e.u 1ty.ety.e
     
    X -3 -2 -1 0 1 2 3
    Replace
    e) VX and VY are integers and VX is not equal to 1 and VY is less than -1.
    type_error(float, VX).
    by
    e) VX and VY are integers and VY is negative and VX is greater than 1 or less than -1
    type_error(float, VX).
    alternatively
    e) VX and VY are integers and VY is negative and VX is not equal to 1, 0, or -1
    type_error(float, VX).
    Replace in 9.3.10.4 Examples,
    2^(-1).
       evaluation_error(undefined).
    
    by
    2^(-1).
       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) starting with C1: Mdash: —
    C3 8.2.4.1: Theta: θ
    C5 8.4.2: Ndash: –
    C14 9.1.3:
    Times: ×
    Rightwards arrow: →
    Union: ∪
    Floor: ⌊ ⌋
    Inequality: ≠
    Logical and: ∧
    Element of, not in: ∈, ∉
    C15 9.3.11.1, 9.3.12.1, 9.3.13.1, C16:
    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 - June 2014

    Document history

    Version control
    Validated HTML