               1)))
         0))))
 
+(defn key= [as bs]
+  (== 0 (key-compare as bs)))
+
 (defn key-lt [as bs]
   (== -1 (key-compare as bs)))
 

                (swap! elems (fn [elems] (drop-while #(key-lt (nth % 0) (nth movement 1)) elems)))
                (first (first @elems)))))))

(defn run-iterator-prop [min-keys actions movements]
  (let [tree (apply-to-tree (tree min-keys) actions)
        sorted-map (apply-to-sorted-map (sorted-map-by compare-keys) actions)
        iterator-resukey-lts (apply-to-iterator (iterator tree) movements)
        elems-resukey-lts (apply-to-elems (seq sorted-map) movements)]
    #_(.pretty-print tree)
    (= iterator-resukey-lts elems-resukey-lts)))

(def iterator-prop
  (prop/for-all [min-keys gen/s-pos-int
                 actions (gen/vector gen-action)
                 movements (gen/vector gen-movement)]
                (run-iterator-prop min-keys actions movements)))

(defn run-intersection-prop [min-keys actionss movements]
  (let [trees (map #(apply-to-tree (tree min-keys) %) actionss)
        elems (apply clojure.set/intersection (map #(set (map vec %)) trees))
        sorted-map (into (sorted-map-by compare-keys) elems)
        iterator-resukey-lts (apply-to-iterator (intersection (into-array (map iterator trees))) movements)
        elems-resukey-lts (apply-to-elems (seq sorted-map) movements)]
    (= iterator-resukey-lts elems-resukey-lts)))

(def intersection-prop
  (prop/for-all [min-keys gen/s-pos-int
                 actionss (gen/not-empty (gen/vector (gen/vector gen-action)))
                 movements (gen/vector gen-movement)]
                (run-intersection-prop min-keys actionss movements)))

(comment
  (dc/quick-check 1000 least-prop)
  (dc/quick-check 1000 greatest-prop)
  (dc/quick-check 1000 equality-prop)
  (dc/quick-check 1000 reflexive-prop)
  (dc/quick-check 1000 transitive-prop)
  (dc/quick-check 1000 anti-symmetric-prop)
  (dc/quick-check 1000 total-prop)
  (dc/quick-check 1000 (building-prop gen-assoc))
  (dc/quick-check 10000 (building-prop gen-action))
  ;; cljs.core.pr_str(cemerick.double_check.quick_check(1000, aurora.btree.building_prop(aurora.btree.gen_action)))

        bs-len (alength bs)]
    (assert (== as-len bs-len) (pr-str as bs))
    (loop [i 0]
      (if (< i as-len)
        (let [a (aget as i)
              b (aget bs i)]
          (if (identical? a b)
