   [?aspect ?interface]
   (all
     (aspect ?aspect)
-    (contains (.getDeclaredInterfaces ?aspect) ?interface)))
+    (type-declaredinterface ?aspect ?interface)))
+
 
 (defn
   aspect-declaredsuper

  (all
    (aspect ?aspect)
    (equals ?super (.getSuperclass ?aspect))))

(defn
  aspect-declaredsuperaspect

  (all
    (member ?member)
    (member|ajsynthetic? ?member false)))
  
(defn
  type-declaredinterface
  "Relation between a type and one of the interfaces it 
   declares to be implementing (for a class and aspect)
   or extending (for an interface)."
  [?type ?interface]
  (all
    (type ?type)
    (contains (.getDeclaredInterfaces ?type) ?interface)))  

(defn
  type-declaredinterface+
  "Relation between a type and one of the ancestors in its declared interface hierarchy."
  [?type ?ancestor]
  (conde
    [(type-declaredinterface ?type ?ancestor) ]
    [(fresh [?inbetween]
              (type-declaredinterface ?type ?inbetween)
              (type-declaredinterface+ ?inbetween ?ancestor))]))

(defn
  aspect-declaredinterface
