4.5 Descriptive Renderings

In Section 4.3, we described a succinct audio notation for mathematics. However, renderings that are more descriptive also sound more natural. As mentioned earlier, the extent to which we use descriptive renderings is an entirely subjective choice. This section presents some descriptive AFL rendering rules from AS TE R.

Rendering Integrals

The various parts of an integral have special meaning. Using the audio notation would produce a rendering that cues the subscript and superscript on the integral, leaving it to the listener to interpret their meaning. Rule descriptive for object integral (see Figure 4.6 on page 130) interprets the subscript and superscript as the limits of integration. Integrals having no superscript are interpreted as surface integrals. The rule also correctly identifies the variable of integration in the majority of examples.


(def-reading-rule (integral descriptive)

    "Descriptive rendering  rule for integrals"

     (let ((lower-limit (subscript integral ))

           (upper-limit (superscript integral ))

           (children (children integral))

           (pause-amount (compute-pause integral ))

           (var (variable-of-integration integral)))

       (afl:with-surrounding-pause pause-amount

            (read-aloud " Integral ")

            (cond

              ((and lower-limit upper-limit)

               (read-aloud "from  ")

               (when var (read-aloud (children var))

                     (read-aloud " equals" ))

               (read-aloud lower-limit)

               (afl:pause 1)

               (read-aloud " to ")

               (read-aloud upper-limit)

               (afl:pause 1))

              (lower-limit

               (when var (read-aloud " with respect to ")

                     (read-aloud (children var )))

               (read-aloud " over, ")

               (read-aloud lower-limit ))

              (var (read-aloud "with respect to ")

                   (read-aloud (children  var ))))

            (afl:force-speech)

            (read-aloud (first children)) (afl:force-speech)

            (read-aloud var) (afl:subclause-boundary))))

Figure 4.6: Descriptive rendering rule for integrals.

We have a similar rendering rule for summations that interprets the subscript as a constraint on the summation. The rule also correctly renders examples where the subscript and superscript to the summation operator give the lower and upper bound on the range of summation.

Obtaining Different Views

We can think of rendering rules as producing a particular “display” of a given structured object. Thus, in a system like (LA)TEX, the author of a macro picks a specific layout for objects appearing in the document. This choice, once made, holds throughout the rendering of the document. On an interactive system like AS TE R, the listener can pick different ways of “hearing” the same object8.

In CS611, a course on advanced programming languages, we work with proof trees. Proof trees typically have a set of premises that lead to a conclusion. A typical rendering of a proof tree is:

We know that …; Hence we infer ….

On the other hand, another rendering rule might “display” the same structure as:

We can conclude … because we know ….

This has the effect of inverting a proof tree. We perform such actions all the time when perusing written material. On the other hand, when listening to recorded books on tape, a listener is tied down to the one rendering order that the reader chose to use. In contrast, AS TE R allows the listener to determine the rendering order by activating different rules, thus enabling better comprehension of complex material.

Here is another example from the same course. The following rules show different ways of rendering occurrences of operator subst (textual substitution). They allow the listener to “look” at a particular expression from different perspectives. R[S∕T] denotes R with T replaced by S. The linear “display” used to layout this expression on paper is just one possible linearization of operator subst. When speaking this expression, the description can be formulated in several ways.

R[S∕T]is written using macro \subst, a macro that takes three arguments. AS TE R is first extended to recognize this macro call into object subst having three arguments as follows:

(define-text-object :macro-name "subst" :number-args 3

  :processing-function subst-expand :object-name subst

  :precedence mathematical-function :supers (math))

Instances of \subst occurring in the document are now represented as instances of object subst. Object subst has its argument slot set to a list containing the result of processing the arguments to the \subst call. Function argument can be used to access these within rendering rules. Here are some AFL rules to generate different renderings of this object.

English descriptions The next two rendering rules use plain English to produce a descriptive rendering. They are good rules to use when the concept of substitution is being introduced. However, they do not work well for more complex examples like R[X∕Y ][S∕T].

(def-reading-rule (subst english-active)

    " english-active rendering  rule for object subst."

  (let  ((pause-amount (compute-pause subst)))

    (afl:with-surrounding-pause pause-amount

      (read-aloud (argument subst 1 ))

      (read-aloud " with ")

      (read-aloud (argument subst 2))

      (read-aloud " for  ")

      (read-aloud (argument subst 3 )))))

(def-reading-rule (subst english-passive)

    " english-passive rendering  rule for object subst."

  (let((pause-amount (compute-pause subst)))

    (afl:with-surrounding-pause pause-amount

      (read-aloud (argument subst 1))

      (read-aloud " with ")

      (read-aloud (argument subst 3))

      (read-aloud "replaced by ")

      (read-aloud (argument subst 2 )))))

Linear rendering The following linear rendering rule mimics the visual notation. It is succinct, since it avoids words like “brackets”, instead relying on voice changes to convey the nesting. It is a good alternative to the tree-like rendering.

(def-reading-rule (subst linear)

    " linear rendering  rule for object subst"

  (read-aloud  (argument subst 1))

  (afl:new-block

   (afl:local-set-state (reading-state 'dim-children))

   (read-aloud  (argument subst 2))

   (read-aloud " slash " )

   (read-aloud (argument subst 3))))

Tree-like rendering The following produces a “tree-like” rendering of object subst by displaying it as a prefix ternary-operator. It is a good rule for rendering complex subst objects once the listener is familiar with the concept of textual substitution. It is very succinct and conveys nesting effectively.

(def-reading-rule (subst tree-like)

    " tree-like rendering  rule for object subst."

  (read-aloud "substitution ")

  (afl:new-block

   (afl:local-set-state (reading-state 'dim-children))

   (read-aloud (argument subst 1))

   (read-aloud (argument subst 2))

   (read-aloud (argument subst 3))))

where

(reading-state 'dim-children)

generates a new AFL state along dimension dim-children; see Figure 4.2 on page 112.