1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 105 106 107 108 109 110 111 112 113 114 115 116 117 118 119 120 121 122 123 124 125 126 127 128 129 130 131 132 133 134 135 136 137 138 139 140 141 142 143 144 145 146 147 148 149 150 151 152 153 154 155 156 157 158 159 160 161 162 163 164 165 166 167 168 169 170 171 172 173 174 175 176 177 178 179 180 181 182 183 184 185 186 187 188 189 190 191 192 193 194 195 196 197 198 199
|
(in-package "ACL2")
(include-book "member-intersectp")
(include-book "std/lists/sets" :dir :system)
(include-book "centaur/fty/top" :dir :system)
; flatten-equiv.lisp Mihir Mehta
(defcong
set-equiv
equal (not-intersectp-list x l)
2
:hints
(("goal"
:in-theory
(e/d nil
((:rewrite not-intersectp-list-when-subsetp-2)))
:use
((:instance (:rewrite not-intersectp-list-when-subsetp-2)
(l1 l)
(x x)
(l2 l-equiv))
(:instance (:rewrite not-intersectp-list-when-subsetp-2)
(l2 l)
(x x)
(l1 l-equiv))))))
(defund flatten-equiv (x y)
(set-equiv (remove-equal nil (true-list-list-fix x))
(remove-equal nil (true-list-list-fix y))))
(defequiv flatten-equiv
:hints (("goal" :in-theory (enable flatten-equiv))))
(defthmd
flatten-equiv-implies-equal-not-intersectp-list-2-lemma-1
(equal (not-intersectp-list x
(remove-equal nil (true-list-list-fix l)))
(not-intersectp-list x l))
:hints (("goal" :in-theory (enable not-intersectp-list
true-list-list-fix intersectp-equal))))
(defcong
flatten-equiv
equal (not-intersectp-list x l)
2
:hints
(("goal"
:in-theory (enable flatten-equiv)
:use
((:instance
flatten-equiv-implies-equal-not-intersectp-list-2-lemma-1
(l l-equiv))
flatten-equiv-implies-equal-not-intersectp-list-2-lemma-1))))
(defthmd
flatten-equiv-implies-equal-member-intersectp-equal-1-lemma-1
(equal (member-intersectp-equal (remove-equal nil (true-list-list-fix x))
y)
(member-intersectp-equal x y))
:hints (("goal" :in-theory (enable not-intersectp-list
true-list-list-fix intersectp-equal))))
(defcong
set-equiv
equal (member-intersectp-equal x y)
1
:hints
(("goal" :do-not-induct t
:in-theory (e/d (set-equiv)
(member-intersectp-with-subset))
:use ((:instance member-intersectp-with-subset (z y)
(x x)
(y x-equiv))
(:instance member-intersectp-with-subset (z y)
(x x-equiv)
(y x))))))
(defcong
set-equiv
equal (member-intersectp-equal y x)
2
:hints
(("goal" :do-not-induct t
:in-theory (e/d (set-equiv)
(member-intersectp-with-subset))
:use ((:instance member-intersectp-with-subset (z y)
(x x)
(y x-equiv))
(:instance member-intersectp-with-subset (z y)
(x x-equiv)
(y x))))))
(defcong
flatten-equiv
equal (member-intersectp-equal x y)
1
:hints
(("goal" :do-not-induct t
:in-theory (enable member-intersectp-equal flatten-equiv)
:use ((:instance
flatten-equiv-implies-equal-member-intersectp-equal-1-lemma-1
(x x-equiv))
flatten-equiv-implies-equal-member-intersectp-equal-1-lemma-1))))
(defcong
flatten-equiv
equal (member-intersectp-equal y x)
2
:hints
(("goal" :do-not-induct t
:in-theory (enable member-intersectp-equal flatten-equiv)
:use ((:instance
flatten-equiv-implies-equal-member-intersectp-equal-1-lemma-1
(x x-equiv))
flatten-equiv-implies-equal-member-intersectp-equal-1-lemma-1))))
(defthmd set-equiv-implies-equal-true-list-listp-of-list-fix-1-lemma-1
(implies (and (not (true-list-listp x))
(true-list-listp y)
(true-listp x))
(not (subsetp-equal x y)))
:hints (("goal" :in-theory (enable subsetp-equal true-list-listp))))
(defthm
set-equiv-implies-equal-true-list-listp-of-list-fix-1
(implies (set-equiv x y)
(equal (true-list-listp (true-list-fix x))
(true-list-listp (true-list-fix y))))
:rule-classes :congruence
:hints
(("goal"
:in-theory (enable set-equiv)
:use
((:instance
set-equiv-implies-equal-true-list-listp-of-list-fix-1-lemma-1
(x (true-list-fix x))
(y (true-list-fix y)))
(:instance
set-equiv-implies-equal-true-list-listp-of-list-fix-1-lemma-1
(y (true-list-fix x))
(x (true-list-fix y)))))))
(defthm commutativity-2-of-cons-under-flatten-equiv-lemma-1
(set-equiv (list* x y z) (list* y x z))
:hints (("goal" :in-theory (enable set-equiv))))
(defthm commutativity-2-of-cons-under-flatten-equiv
(flatten-equiv (list* x y z)
(list* y x z))
:hints (("goal" :in-theory (enable flatten-equiv))))
(defcong flatten-equiv flatten-equiv (append x y) 2
:hints (("goal" :in-theory (e/d (flatten-equiv)
()))))
(defthm flatten-equiv-of-remove-of-nil
(flatten-equiv (remove-equal nil x) x)
:hints (("goal" :in-theory (e/d (flatten-equiv)
()))))
(defthm flatten-equiv-of-cons-when-atom
(implies (atom x)
(flatten-equiv (cons x y) y))
:hints (("goal" :in-theory (e/d (flatten-equiv)
()))))
(defcong flatten-equiv flatten-equiv (cons x y) 2
:hints (("goal" :in-theory (e/d (flatten-equiv)
()))))
(defthmd cons-equal-under-set-equiv-1
(iff (set-equiv (cons x y1) (cons x y2))
(set-equiv (remove-equal x y1)
(remove-equal x y2)))
:instructions ((:= (cons x y2)
(cons x (remove-equal x y2))
:equiv set-equiv)
(:= (cons x y1)
(cons x (remove-equal x y1))
:equiv set-equiv)
(:dive 1)
:x (:dive 1)
(:= (subsetp-equal (remove-equal x y1)
(remove-equal x y2)))
:top
(:= (subsetp-equal (remove-equal x y2)
(cons x (remove-equal x y1)))
(subsetp-equal (remove-equal x y2)
(remove-equal x y1)))
(:dive 2)
:x
:top :bash))
(defthm flatten-equiv-of-append-of-cons-1
(flatten-equiv (append x (cons y z))
(cons y (append x z)))
:hints (("goal" :in-theory (e/d (flatten-equiv)
()))))
|