\name{dot-class}
\docType{class}
\alias{dot}
\alias{.}
\alias{dot-class}
\alias{extract}
\alias{commutator}
\alias{jacobi}
\alias{dot_error}
\alias{[.dot}
\alias{[,dot-method}
\alias{[,dot,ANY,ANY-method}
\alias{[,dot,free,ANY,ANY-method}
\title{Class \dQuote{dot}}
\description{

  The dot object is defined in the \CRANpkg{freealg} package, and
  imported here, so that idiom like \code{.[x,y]} returns the
  commutator, that is, \code{x^-1 y^-1 xy}.

  The dot object is generated by running script \code{inst/dot.Rmd},
  which includes some further discussion and technical documentation,
  and creates file \code{dot.rda} which resides in the \code{data/}
  directory.

}
\usage{
\S4method{[}{dot,ANY,ANY}(x, i, j, drop)
\S4method{[}{dot,free,ANY,ANY}(x, i, j, drop)
}
\arguments{
  \item{x}{Object of any class}
  \item{i, j}{elements to commute}
  \item{drop}{Boolean, indicates whether to drop attributes}
}
\value{
  Always returns an object of the same class as \code{xy}.
}
\author{Robin K. S. Hankin}
\examples{

.[as.free("x"), as.free("y")]

.[abc(1:6), "z"]

x <- rfree()
y <- rfree()
z <- rfree()

.[x, y] == -x-y+x+y   # should be TRUE

abelianize(.[x, y])

## Jacobi identity _not_ satisfied with this definition:
is.id(.[x, .[y, z]] + .[y, .[z, x]] + .[z, .[x, y]])

## But the Hall-Witt identity is:
all(is.id(.[.[x, -y], z]^y + .[.[y, -z], x]^z + .[.[z, -x], y]^x))

}
