Index: doc/theses/jiada_liang_MMath/intro.tex
===================================================================
--- doc/theses/jiada_liang_MMath/intro.tex	(revision ec20ab955a5e90eda7cf9217db6a7c54ed964e01)
+++ doc/theses/jiada_liang_MMath/intro.tex	(revision e6f1a4b922af95b15a46dbbe3fc1d50a69b0900b)
@@ -1,21 +1,26 @@
 \chapter{Introduction}
 
-All types in a programming language must have a set of constants, and these constants have \newterm{primary names}, \eg integral types have constants @-1@, @17@, @0xff@, floating-point types have constants @5.3@, @2.3E-5@, @0xff.ffp0@, character types have constants @'a'@, @"abc\n"@, \mbox{\lstinline{u8"}\texttt{\guillemotleft{na\"{i}ve}\guillemotright}\lstinline{"}}, \etc.
-Con\-stants can be overloaded among types, \eg @0@ is a null pointer for all pointer types, and the value zero for integral and floating-point types.
-(In \CFA, the primary constants @0@ and @1@ can be overloaded for any type.)
-Hence, each primary constant has a symbolic name referring to its internal representation, and these names are dictated by language syntax related to types.
-In theory, there are an infinite set of primary constant names per type.
-
-\newterm{Secondary naming} is a common practice in mathematics, engineering and computer science, \eg $\pi$, $\tau$ (2$\pi$), $\phi$ (golden ratio), MB (megabyte, 1E6), and in general situations, \eg specific times (noon, New Years), cities (Big Apple), flowers (Lily), \etc.
-Many programming languages capture this important software-engineering capability through a mechanism called \newterm{constant} or \newterm{literal} naming, where a secondary name is aliased to a primary name.
-Its purpose is for readability and to eliminate duplication of the primary constant throughout a program.
-For example, a meaningful secondary name replaces a primary name throughout a program;
-thereafter, changing the binding of the secondary to primary name automatically distributes the rebinding, preventing errors.
-In some cases, secondary naming is \newterm{opaque}, where the matching internal representation can be chosen arbitrarily, and only equality operations are available, \eg @O_RDONLY@, @O_WRONLY@, @O_CREAT@, @O_TRUNC@, @O_APPEND@.
-Because a secondary name is a constant, it cannot appear in a mutable context, \eg \mbox{$\pi$ \lstinline{= 42}} is meaningless, and a constant has no address, \ie it is an \newterm{rvalue}\footnote{
+All types in a programming language have a set of constants (symbols), and these constants represent values, \eg integer types have constants @-1@, @17@, @0xff@ representing whole numbers, floating-point types have constants @5.3@, @2.3E-5@, @0xff.ffp0@ representing  real numbers, character types have constants @'a'@, @"abc\n"@, \mbox{\lstinline{u8"}\texttt{\guillemotleft{na\"{i}ve}\guillemotright}\lstinline{"}} representing (human readable) text, \etc.
+Constants can be overloaded among types, \eg @0@ is a null pointer for all pointer types, and the value zero for integer and floating-point types.
+(In \CFA, the constants @0@ and @1@ can be overloaded for any type.)
+A constant's symbolic name is dictated by language syntax related to types.
+In general, the representation of a constant's value is \newterm{opaque}, so the internal representation can be chosen arbitrarily.
+In theory, there are an infinite set of constant names per type representing an infinite set of values.
+
+It is common in mathematics, engineering and computer science to alias new constants to existing constants so they have the same value, \eg $\pi$, $\tau$ (2$\pi$), $\phi$ (golden ratio), K(k), M, G, T for powers of 2\footnote{Overloaded with SI powers of 10.} often prefixing bits (b) or bytes (B), \eg Gb, MB, and in general situations, \eg specific times (noon, New Years), cities (Big Apple), flowers (Lily), \etc.
+An alias can bind to another alias, which transitively binds it to the specified constant.
+Multiple aliases can represent the same value, \eg eighth note and quaver, giving synonyms.
+
+Many programming languages capture this important software-engineering capability through a mechanism called \newterm{constant} or \newterm{literal} naming, where a new constant is aliased to an existing constant.
+Its purpose is for readability, replacing a constant name that directly represents a value with a name that is more symbolic and meaningful in the context of the program.
+Thereafter, changing the aliasing of the new constant to another constant automatically distributes the rebinding, preventing errors.
+% and only equality operations are available, \eg @O_RDONLY@, @O_WRONLY@, @O_CREAT@, @O_TRUNC@, @O_APPEND@.
+Because an aliased name is a constant, it cannot appear in a mutable context, \eg \mbox{$\pi$ \lstinline{= 42}} is meaningless, and a constant has no address, \ie it is an \newterm{rvalue}\footnote{
 The term rvalue defines an expression that can only appear on the right-hand side of an assignment expression.}.
-
-Secondary names can form an (ordered) set, \eg days of a week, months of a year, floors of a building (basement, ground, 1st), colours in a rainbow, \etc.
-Many programming languages capture these groupings through a mechanism called an \newterm{enumeration}.
+In theory, there are an infinite set of possible aliasing, in practice, the number of aliasing per program is finite and small.
+
+Aliased constants can form an (ordered) set, \eg days of a week, months of a year, floors of a building (basement, ground, 1st), colours in a rainbow, \etc.
+In this case, the binding between a constant name and value can be implicit, where the values are chosen to support any set operations.
+Many programming languages capture the aliasing and ordering through a mechanism called an \newterm{enumeration}.
 \begin{quote}
 enumerate (verb, transitive).
@@ -24,6 +29,7 @@
 to specify as in a list or catalogue.~\cite{OEDenumerate}
 \end{quote}
-Within an enumeration set, the enumeration names must be unique, and instances of an enumerated type are \emph{often} restricted to hold only the secondary names.
-It is possible to enumerate among set names without having an ordering among the set elements.
+Within an enumeration set, the enumeration names (aliases) must be unique, and instances of an enumerated type are \emph{often} restricted to hold only these names.
+
+It is possible to enumerate among set names without having an ordering among the set values.
 For example, the week, the weekdays, the weekend, and every second day of the week.
 \begin{cfa}[morekeywords={in}]
@@ -33,5 +39,4 @@
 for ( cursor in Mon, Wed, Fri, Sun } ...		$\C{// every second day of week}\CRT$
 \end{cfa}
-This independence from internal representation allows multiple names to have the same representation (eighth note, quaver), giving synonyms.
 A set can have a partial or total ordering, making it possible to compare set elements, \eg Monday is before Friday and Friday is after.
 Ordering allows iterating among the enumeration set using relational operators and advancement, \eg:
@@ -39,5 +44,5 @@
 for ( cursor = Monday; cursor @<=@ Friday; cursor = @succ@( cursor ) ) ...
 \end{cfa}
-Here the internal representation for the secondary names are logically \emph{generated} rather than listing a subset of names.
+Here the values for the set names are logically \emph{generated} rather than listing a subset of names.
 
 Hence, the fundamental aspects of an enumeration are:
@@ -45,16 +50,15 @@
 \item
 \begin{sloppypar}
-It provides a finite set of secondary names, which become its primary constants.
-This differentiates an enumeration from general types with an infinite set
-of primary constants.
+It provides a finite set of new constants, which are implicitly or explicitly assigned values that must be appropriate for any set operations.
+This aspect differentiates an enumeration from general types with an infinite set of constants.
 \end{sloppypar}
 \item
-The secondary names are constants, which follows transitively from their binding (aliasing) to primary names, which are constants.
+The alias names are constants, which follows transitively from their binding to other constants.
 \item
 Defines a type for generating instants (variables).
 \item
-For safety, an enumeration instance should be restricted to hold only its type's secondary names.
-\item
-There is a mechanism for \emph{enumerating} over the secondary names, where the ordering can be implicit from the type, explicitly listed, or generated arithmetically.
+For safety, an enumeration instance should be restricted to hold only its constant names.
+\item
+There is a mechanism for \emph{enumerating} over the enumeration names, where the ordering can be implicit from the type, explicitly listed, or generated arithmetically.
 \end{enumerate}
 
@@ -63,5 +67,5 @@
 \label{s:Terminology}
 
-The term \newterm{enumeration} defines a type with a set of secondary names, and the term \newterm{enumerator} represents an arbitrary secondary name \see{\VRef{s:CEnumeration} for the name derivation}.
+The term \newterm{enumeration} defines a type with a set of new constants, and the term \newterm{enumerator} represents an arbitrary alias name \see{\VRef{s:CEnumeration} for the name derivation}.
 As well, an enumerated type can have three fundamental properties, \newterm{label}, \newterm{order}, and \newterm{value}.
 \begin{cquote}
@@ -76,7 +80,8 @@
 \end{tabular}
 \end{cquote}
-Here, the enumeration @Week@ defines the enumerator labels @Mon@, @Tue@, @Wed@, @Thu@, @Fri@, @Sat@ and @Sun@.
+Here, the enumeration @Week@ defines the enumerator constant @Mon@, @Tue@, @Wed@, @Thu@, @Fri@, @Sat@ and @Sun@.
 The implicit ordering implies the successor of @Tue@ is @Mon@ and the predecessor of @Tue@ is @Wed@, independent of any associated enumerator values.
-The value is the constant represented by the secondary name, which can be implicitly or explicitly set.
+The value is the implicitly/explicitly assigned constant to support any enumeration operations;
+the value may be hidden (opaque) or visible.
 
 Specifying complex ordering is possible:
@@ -94,5 +99,5 @@
 Many programming languages provide an enumeration-like mechanism, which may or may not cover the previous five fundamental enumeration aspects.
 Hence, the term \emph{enumeration} can be confusing and misunderstood.
-Furthermore, some languages conjoin the enumeration with other type features, making it difficult to tease apart which featuring is being used.
+Furthermore, some languages conjoin the enumeration with other type features, making it difficult to tease apart which feature is being used.
 This section discusses some language features that are sometimes called an enumeration but do not provide all enumeration aspects.
 
@@ -101,13 +106,14 @@
 \label{s:Aliasing}
 
-Some languages provide simple secondary aliasing (renaming), \eg:
+Some languages provide simple aliasing (renaming), \eg:
 \begin{cfa}
 const Size = 20, Pi = 3.14159, Name = "Jane";
 \end{cfa}
-The secondary name is logically replaced in the program text by its corresponding primary name.
-Therefore, it is possible to compare the secondary names, \eg @Size < Pi@, only because the primary constants allow it, whereas \eg @Pi < Name@ might be disallowed depending on the language.
+The alias name is logically replaced in the program text by its matching constant.
+It is possible to compare aliases, if the constants allow it, \eg @Size < Pi@;
+whereas \eg @Pi < Name@ might be disallowed depending on the language.
 
 Aliasing is not macro substitution, \eg @#define Size 20@, where a name is replaced by its value \emph{before} compilation, so the name is invisible to the programming language.
-With aliasing, each secondary name is part of the language, and hence, participates fully, such as name overloading in the type system.
+With aliasing, each new name is part of the language, and hence, participates fully, such as name overloading in the type system.
 Aliasing is not an immutable variable, \eg:
 \begin{cfa}
@@ -121,5 +127,5 @@
 
 Aliasing does provide readability and automatic resubstitution.
-It also provides simple enumeration properties, but with extra effort.
+It also provides simple enumeration properties, but with effort.
 \begin{cfa}
 const Mon = 1, Tue = 2, Wed = 3, Thu = 4, Fri = 5, Sat = 6, Sun = 7;
@@ -148,5 +154,5 @@
 the ADT has three variants (constructors), @A@, @B@, @C@ with associated types @Int@, @Double@, and @S@.
 The constructors create an initialized value of the specific type that is bound to the immutable variables @foo@, @bar@, and @baz@.
-Hence, the ADT @Foo@ is like a union containing values of the associated types, and a constructor name is used to access the value using dynamic pattern-matching.
+Hence, the ADT @Foo@ is like a union containing values of the associated types, and a constructor name is used to intialize and access the value using dynamic pattern-matching.
 \begin{cquote}
 \setlength{\tabcolsep}{15pt}
@@ -175,5 +181,5 @@
 \end{tabular}
 \end{cquote}
-For safety, most languages require all assocaited types to be listed or a default case with no field accesses.
+For safety, most languages require all associated types to be listed or a default case with no field accesses.
 
 A less frequent case is multiple constructors with the same type.
@@ -188,5 +194,5 @@
 Note, the term \newterm{variant} is often associated with ADTs.
 However, there are multiple languages with a @variant@ type that is not an ADT \see{Algol68~\cite{Algol68} or \CC \lstinline{variant}}.
-In these languages, the variant is often a union using RTTI tags, which cannot be used to simulate an enumeration.
+In these languages, the variant is often a union using RTTI tags for discrimination, which cannot be used to simulate an enumeration.
 Hence, in this work the term variant is not a synonym for ADT.
 
@@ -208,5 +214,5 @@
 data Week = Mon | Tue | Wed | Thu | Fri | Sat | Sun deriving(Enum, Eq, Show)
 \end{haskell}
-the default type for each constructor is the unit type, and deriving from @Enum@ enforces no other type, @Eq@ allows equality comparison, and @Show@ is for printing.
+the default type for each constructor is the unit type, and deriving from @Enum@ enforces no other associated types, @Eq@ allows equality comparison, and @Show@ is for printing.
 The nullary constructors for the unit types are numbered left-to-right from $0$ to @maxBound@$- 1$, and provides enumerating operations @succ@, @pred@, @enumFrom@ @enumFromTo@.
 \VRef[Figure]{f:HaskellEnumeration} shows enumeration comparison and iterating (enumerating).
@@ -246,5 +252,5 @@
 
 The key observation is the dichotomy between an ADT and enumeration: the ADT uses the associated type resulting in a union-like data structure, and the enumeration does not use the associated type, and hence, is not a union.
-While the enumeration is constructed using the ADT mechanism, it is so restricted it is not really an ADT.
+While the enumeration is constructed using the ADT mechanism, it is so restricted it is not an ADT.
 Furthermore, a general ADT cannot be an enumeration because the constructors generate different values making enumerating meaningless.
 While functional programming languages regularly repurpose the ADT type into an enumeration type, this process seems contrived and confusing.
