Erasing duplicates in polynomial time #
List.eraseDupsBy r l keeps each entry of l that is related by r to no entry kept before it.
It is a left fold that appends at most one entry at a time (List.eraseDupsBy_eq_foldl), so a
polynomial-time comparison, which may capture the original input, makes it polynomial-time
(Turing.MultiTapeTM.ComputableInPolyTime.eraseDupsByWithInput).
Main results #
Turing.MultiTapeTM.ComputableInPolyTime.eraseDupsByWithInput: erasing duplicates of a computed framed list with a computed comparison.Turing.MultiTapeTM.ComputableInPolyTime.decide_nodup,Turing.MultiTapeTM.ComputableInPolyTime.decide_nodup_bits: decidingList.Nodupon a computed framed list (and itsfun_propspecialization to bit strings).
Erase the entries of a computed framed list related by r x to an earlier kept entry. Each
step of the fold appends at most one entry of the list, so the accumulator stays polynomially
bounded.
Decide whether a computed framed list has no duplicate entries by comparing it with the result
of erasing duplicates by equality (eraseDupsByWithInput).
Decide whether a computed framed list of bit strings has no duplicate entries. Fixing the
element encoding to encBits avoids an ambiguous List Bool encoding metavariable during
fun_prop search.