 (defmulti make-context
   "Standard constructor for contexts. Takes a sequence of objects,
   a sequence of attributes and either a set of pairs or function of
-  two elements being true iff its arguments are incident. Note that the
-  object and attribute sequences are converted to sets and therefore have to
-  not contain any douplicate elements."
+  two elements being true iff its arguments are incident. Note that
+  the object and attribute sequences are converted to sets and
+  therefore have to not contain any douplicate elements. The incidence
+  relation is auzomatically restricted to the cartesian product of the
+  object an the attribute set."
   (fn [& args] (map type-of args)))
 
 (defmethod make-context [::set ::set ::set] [objects attributes incidence]
-  (conexp.fca.Context. (set objects) (set attributes) (set incidence)))
+  (let [objs (set objects)
+	atts (set attributes)
+	inz  (set-of [g m] [[g m] incidence
+			    :when (and (contains? objs g)
+				       (contains? atts m))])]
+    (conexp.fca.Context. objs atts inz)))
 
 (defmethod make-context [::set ::set ::fn] [objects attributes incidence]
   (make-context objects attributes (set-of [x y] [x objects

  (and (instance? conexp.fca.Context other)
       (= (objects this) (objects other))
       (= (attributes this) (attributes other))
       (let [inz-this (incidence this)
	     inz-other (incidence other)]
	 (or (= (incidence this) (incidence other))
	     (forall [pair (cross-product (objects this) (attributes this))]
               (<=> (inz-this pair) (inz-other pair)))))))

(defn Context-hashCode
  "Implements hashCode for contexts."

(defn reduce-clarified-context
  "Reduces context ctx assuming it is clarified."
  [ctx]
  (let [uda (up-down-arrows ctx)
	new-obj (set (map first uda))
	new-att (set (map second uda))]
    (make-context new-obj new-att (incidence ctx))))

(defn reduce-context
  "Reduces context ctx."
