Thomas Tuerk
3c35cc25c3
cleaned-up the sources of the ITP course - remove internal notes - remove exercise solutions - remove KTH logo - add Creative Commons license
12 lines
512 B
Plaintext
12 lines
512 B
Plaintext
val IS_WEAK_SUBLIST_REC_def = Define `
|
|
(IS_WEAK_SUBLIST_REC (l1 : 'a list) ([]:'a list) = T) /\
|
|
(IS_WEAK_SUBLIST_REC [] (_::_) = F) /\
|
|
(IS_WEAK_SUBLIST_REC (y::ys) (x::xs) = (
|
|
(x = y) /\ IS_WEAK_SUBLIST_REC ys xs) \/ (IS_WEAK_SUBLIST_REC ys (x::xs)))`;
|
|
|
|
val FILTER_BY_BOOLS_def = Define `
|
|
FILTER_BY_BOOLS bl l = MAP SND (FILTER FST (ZIP (bl, l)))`
|
|
|
|
val IS_WEAK_SUBLIST_FILTER_def = Define `IS_WEAK_SUBLIST_FILTER l1 l2 =
|
|
?(bl : bool list). (LENGTH bl = LENGTH l1) /\ (l2 = FILTER_BY_BOOLS bl l1)`
|