Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Why are round brackets not needed for atoms that are high priority operators?

In older textbooks1 one frequently encounters operator declarations like the following:

?- op(1200,fx,(:-)).
              ^  ^

These round brackets used to be necessary. But today, they are no longer needed:

| ?- writeq(op(1200,fx,(:-))).     
op(1200,fx,:-)

Why are they no longer needed? How does the standard cope with this situation?


1 p.97 6. Standard Operator Declarations of MU-Prolog 3.2db reference manual, appearing in Negation and Control in Prolog by Lee Naish, LNCS 238, Springer-Verlag 1985.

like image 246
false Avatar asked Jun 17 '15 17:06

false


People also ask

What are brackets in chemistry?

Brackets are only needed for compounds formed from complex ions. But what is a complex ion? Well, it’s an ion that is made up of more than one element. The most common examples of complex ions are: You’re expected to know the formulae of these complex ions (and their charges) for the exam.

Why do we put Brackets around complex ions?

The reason is that you need to put a bracket around the complex ion to show how many of those whole complex ions there are in the compound. That’s it for brackets!

Do you need brackets for the ionic Chemistry GCSE?

No brackets. That’s it. Simple! Brackets are only needed for compounds formed from complex ions. But what is a complex ion? Well, it’s an ion that is made up of more than one element. The most common examples of complex ions are: You’re expected to know the formulae of these complex ions (and their charges) for the exam.

What are brackets and why are they important?

Brackets are only needed for compounds formed from complex ions. But what is a complex ion? Well, it’s an ion that is made up of more than one element. The most common examples of complex ions are:


1 Answers

All of the following refers to ISO/IEC 13211-1:1995. Let me move inside out...

6.5.1     graphic char       = ":";
          graphic char       = "-";

6.4.2     graphic token char = graphic char;

          graphic token      = graphic token char, { graphic token char };

          name token         = graphic token;

6.4       name               = [ layout text sequence (* 6.4.1 *) ], name token;

6.3.1.3   atom               = name;

6.5.3     open  char         = "(";
          close char         = ")";
          comma char         = ",";

6.4.8     open  token        = open  char; 
          close token        = close char;
          comma token        = comma char;

6.4.1     (* grammar rules for layout text sequence were omitted *)

6.4       comma              = comma token;
          open ct            = open  token;
          close              = [ layout text sequence ], close token;

6.3.3.1   arg                = atom; (* if that atom is an operator *)
          arg                = term; (* otherwise: priority = 999   *)

6.3.3     arg list           = arg;
          arg list           = arg, comma, arg list;

6.3.3     term               = atom, open ct, arg list, close ;

So we come back to the initial question:

These round brackets used to be necessary. But today, they are no longer needed. Why are they no longer needed? How does the standard cope with this situation?

Let's assume T = op(1200,fx,:-) holds.

  1. T is a compound term provided in functional notation.

  2. T is covered by above rule term = atom, open ct, arg list, close;

  3. atom matches op, which is the functor of T.

  4. open ct matches an open bracket.

  5. the "middle part" (the arguments of T) is covered by the grammar rules for arg list.

  6. arg list is a non-empty list of arg.

  7. What's arg?

    • a term with priority less than 1000, the priority of (',')/2. E.g., 1200 and fx.

    • an atom that is an operator. (No strings attached!)

  8. close matches a closing bracket.

Quoting:

An argument (represented by arg in the syntax rules occurs as the argument of a compount term or element of a list. It can be an atom which is an operator,or a term with priority not greater than 999. When an argument is an arbitrary term, its priority shall be less than the priority of the ',' (comma) operator so that there is no conflict between comma as an infix operator and comma as an argument or list element separator.

Note:

This concept of an "argument" ensures that both the terms f(x,y) and f(:-, ;, [:-, :-|:-]) are syntactically valid whatever operator definitions are currently defined. Comma is not an atom and the following "terms" have syntax errors: f(,,a), [a,,|v], and [a,b|,]; but the following two terms are syntactically valid: f(',',a), [a,','|v], and [a,b|','].

like image 129
repeat Avatar answered Oct 25 '22 17:10

repeat