Monday, April 30, 2012

Maxima operator properties

Maxima provides a variety of operator properties to developers including linear, additive, multiplicative, outative, evenfun, oddfun, commutative, symmetric, antisymmetric, nary, lassociative, rassociative.

Linearity and distribution:
A function is additive or multiplicative if the use of addition or multiplication in the function can be distributed out into separate calls. A function is outative if constants can be distributed out, and a function is an oddfun if its sign can be distributed out. Finally, a function is linear if it is both additive and outative.

Input properties:
The operator properties commutative, symmetric, antisymmetric, evenfun, nary, lassociative, and rassociative describe the input properties of a function.

Saturday, April 28, 2012

Divisibility operations

Divide, undivide, factorize, and unfactorize are partition relations. Division takes a natural number and it splits it into quotient and remainder parts and the gcd function splits an unordered pair of numbers into the gcd and a fractional part. Fractional parts are useful in dealing with gunk mereology and the field of rational numbers.
(defn divide
  [n]
  
  (fn [a]
    {:q (quot a n), 
     :r (rem a n)}))

(defn undivide 
  [n]
  
  (fn [a]
    (+ (* n (:q a)) (:r a)))

(defn divides?
  [a b]

  (zero? (:r ((divide b) a))))

(defn divisors
  [n]
  
  (filter (partial divides? n) (range 1 (inc n))))

(defn common-divisors
  [& nums]

  (apply clojure.set/intersection (map (comp set divisors) nums)))

(defn factorize-pair
  [a]

  (let [gcd (apply max (apply common-divisors a))]
    {:gcd gcd,
     :fp (sort < (map (partial * (/ gcd)) a))}))

(defn unfactorize-pair
  [a]
  
  (map (partial * (:gcd a)) (:fp a)))

Wednesday, April 25, 2012

Category of equivalence relations

The functions square and abs are equivalence relation isomorphic to one another because they both partitioned the set of all real numbers into positive and negative segments. If there is a one to one correspondence between all equivalence classes induced by an equivalence relation then that equivalence relation also induces a partition of members.

The category of equivalence relations is partially ordered by a coarseness relation that determines rather or not an equivalence relation is coarser, finer, or equal to another equivalence relation.

Tuesday, April 24, 2012

Modeling time with identities

An identity represents a series of values over time. Each identity can be associated with an equivalence class which describes the properties of the object that are conserved through transformations over time. If the equivalence class has only one element, then an identity represents a constant value.

I would like to propose that the conservative transformations model is more efficient then the write-once model that is common to the functional programming community. An identity is associated with an object that undergoes a series of property conserving transformations over time. For example, in physical systems mass and energy are conserved through transformations.

Sunday, April 22, 2012

Types of transformations

Reversible transformations change the form of an object but they do not create or destroy objects. Motion is effectively a reversible process of reconfiguring some object with respect to a reference frame. Mereological transformations include the composition of parts into wholes and the decomposition of wholes into parts:

Parts: pieces, components, fragments, sections, segments

Decomposition: break up, disintegrate, disunite, divide, divorce, segregate, separate, shatter, split, uncouple

Composition: amalgamate, coalesce, collect, compound, come together, combine, integrate, fuse, join, merge, mix, synthesize, unite

In a non-conservative system the act of destruction can be described as decomposing the system into parts and sending away a part to some other location such as a garbage dump and the act of creation can be described as fusion involving an object on the heap.

Wednesday, April 18, 2012

Place forms

Common Lisp supports place forms with the setf function:
(setf (first coll) 10)
(setf (rest coll) '(20 30))
Place forms provide an elegant mechanism for handling parts of structures. This is arguably the most important distinguish feature of Common Lisp. Since Common Lisp is a Lisp-2, symbols have a symbol-function and a symbol-value part, which can be handled using setf:
(setf (symbol-function 'inc)
  (lambda (n)
    (+ n 1)))

(setf (symbol-value 'inc) 10)
An argument can be made in favor of Lisp-1's such as Clojure and Scheme, however, whatever the disadvantages of being a Lisp-2 are the use of place forms in Common Lisp make handling the parts of a symbol easy.

Sunday, April 15, 2012

Progression of categories

Categories can be progressively enhanced by introducing new forms of relations:

(Objects, Edges)
(Sets, Functions)
(Categories, Functors, Natural Transformations)

Saturday, April 7, 2012

Binary relations

Preorders:
The reachability condition on a directed graph is reflexive and transitive so it produces a preorder. Symmetric preorders are equivalence relations and antisymmetric preorders are partial orders. Equivalence relations are partially ordered in terms of fineness and coarseness.

Parthood relations form a partial order. In particular, parthood relations are often hierarchical in nature so they can be modelled by undirected trees or polytrees.

Many to one relations:
Many to one relations induce an equivalence relation whose equivalence classes are the many part of the relation. Many to one relations are strong simplification rules for equivalence relations.