5
split-qs-properties.lisp
6
~~~~~~~~~~~~~~~~~~~~~~~~
8
In this book we make clear the relation between split-qs and the functions walk
9
and merge-func we described earlier. These properties will allow us to reason
10
when we prove that sort-qs is equal to in-situ-qsort-fn using sort-qs as the
15
(include-book "programs")
16
(include-book "merge-intermediate")
17
(include-book "extraction")
18
(include-book "arithmetic/top-with-meta" :dir :system)
21
(in-theory (enable swap))
26
(implies (and (not (natp (1- hi)))
29
:rule-classes :forward-chaining)
33
(defthm walk-split-qs-equal
34
(implies (and (natp lo)
36
(equal (mv-nth 0 (split-qs lo hi splitter qs))
37
(+ lo (walk (extract-qs lo hi qs) splitter))))
39
:induct (split-qs lo hi splitter qs))))
43
(defthm split-qs-is-identity-for-below-range
44
(implies (and (natp i)
48
(equal (objsi i (mv-nth 1 (split-qs lo hi splitter qstor)))
51
(defthm split-qs-is-identity-for-above-range
52
(implies (and (natp i)
56
(equal (objsi i (mv-nth 1 (split-qs lo hi splitter qstor)))
59
(defthm merge-func-split-qs-equal
60
(implies (and (natp lo)
62
(equal (extract-qs lo hi (mv-nth 1 (split-qs lo hi splitter qs)))
63
(merge-func (extract-qs lo hi qs) splitter)))
65
:induct (split-qs lo hi splitter qs))))
68
(in-theory (disable extract-qs-decrement-hi))
72
(in-theory (disable walk-split-qs-equal))