Friday, March 30, 2012

Partitions and unions

A collection can be described as a whole that consists of several parts. Partition functions go from the whole to the parts and union functions go from the parts to the whole. Partitions and unions can be encoded in a single bijection that goes from the whole to the parts and back again. For example, here is a seqify function that goes from a whole object to first and rest parts:
(defn seqify
  [coll]

  {:first (first coll)
   :rest  (rest coll)})

(defn unseqify
  [coll]

  (vec (cons (:first coll) (:rest coll))))
All one-way functions operate on selected parts of a partition such that the returned whole cannot be reconstructed from the selected parts. For example, you can't reconstruct a list from its first element alone, so the first function is one-way. Monoids are union functions that join together several parts into a new whole and that have a notion of an empty part. Monoids are one-way functions because each object is the product of several different types of partitions.

Tuesday, March 27, 2012

Mathematical invariance

The no-effect? predicate returns true if the specified function doesn't apply to some value. The no-effect? predicate can be used to establish many other predicates, for example each part function can establish a predicate:
(def int? (partial no-effect? int))
(def unit-vector? (partial no-effect? unit-vector-part))
(def non-negative? (partial no-effect? (fn [i] (Math/abs i)))
An understanding of the no-effect? predicate can be used to eliminate unnecessary calls to one-way functions.

Sunday, March 25, 2012

Simplifying function calls

Argument equivalence:
A function is symmetric if arguments with different orders are all equivalent to one another:
(= (+ 1 2 3) 
   (apply + #{1 2 3}))
Monoids are variadic functions such that two adjacent constant arguments can be reduced by their application and other calls to the monoid can be reduced in place:
(= (* 1 2 3 (* 4 5) (+ x y))
   (* 120 (+ x y)))
Constant reduction and combiner rewriting
After reducing a function's input argument we can reduce the call to the function itself. If the argument given to the function is constant then we can replace the call to the function with its result:
(= (apply + #{1 2 3}) 6)
In certain conditions the call to the function can be replaced with the call to another function:
(= (* 120 (+ x y))
   (+ (* 120 x) (* 120 y)))
In this case, we can replace the multiplication operation with an addition operation using the distributive law.

Iteration equvialence:
Each function has an iteration equivalence relation associated with it that represents rather or not the function is equal when iterated to different numbers. This includes the order of the function which states a number which you can mod out of any iteration number without effecting it. Functions that have an order of two are involutions:
(comp reverse reverse)
(comp - -)
(comp / /)
(comp inc dec) 
If every value in the iteration equivalence relation is either equal to the identity or one then that function is idempotent:
(= (comp abs abs) abs)
(= (comp int int) int)
In order to use the iteration properties of a function it is important to know when two functions are of the same iteration class.

Reflexivity:
The reflexivity of a function describes an equivalence relation which states that certain parts of a data structure are uneffected by this function. For example, additive negation doesn't effect the absolute value of a number:
(= (comp abs -) abs)
The complemented of the targeted place of the function is included in the reflexivity because it isn't effected by applying the function.

Friday, March 23, 2012

Implementation of monoids

Monoids are functions that have the property that calls to the monoid within the monoid can be replaced with the arguments of the call. In other words, the order and amount of calls to the operation is irrelevant. Addition, concatenation, composition, and other related operations are all monoidal.
(+ 1 2 3)
(concat [1 2] [3 4])
(comp (partial apply +) range inc)
The set of quantities under multiplication forms a monoid. Furthermore, with respect to booleans there are two commutative monoids corresponding to the two possible identities. The function or? corresponds to a monoid with an identity of false and the function and? corresponds to a monoid with an identity of true. The computer algebra system can simplify the call to any monoid:
(defn simplify-monoid-call
  [expr]

  (cons 
   (first expr)
   (apply concat
          (map
           (fn [current-expr]
             (if (and (seq? current-expr)
                      (= (first expr) (first current-expr)))
               (rest (simplify-monoid-call current-expr))
               (list current-expr)))
           (rest expr)))))
Here is an example of how this function might work:
(= (simplify-monoid-call '(+ 1 2 (+ 3 4) 5 (+))
  '(+ 1 2 3 4 5))
This is one small step towards building an effective Lisp based computer algebra system.

Sunday, March 18, 2012

Multiply perfect numbers

The first three multiply perfect numbers are 1, 6, and 120. These three numbers are both factorials and triangular. They also appear to be the only numbers that exhibit that property.

The numbers 1 and 6 are the only numbers that are triangular and factorial with respect to the same argument because 1 is both the sum and the product of the first one numbers and 6 is both the sum and product of the first three numbers.

The only number that appears to be factorial and triangular to a different argument is 120 which is the product of the first five numbers and the sum of the first fifteen. Interestingly, 120 is also a tetrahedral number.

Friday, March 2, 2012

Artificial systems thinking

In the future, strong AI should be able to see the connections between diverse groups of subjects through the creation of graph structures. Humans have never been able to achieve such an effect because human natural intelligence was not engineered to create an optimal understanding relations, interactions, and connections.

The process of artificial systems thinking unites the areas of AI and systems thinking. In this process, we will create all the fundamental substrates for effective systems thinking in the machine.

The most important tool for systems thinking is the understanding of relations using graph theory, so this sort of AI will be based upon the management of graph theoretic structures in the machine.