Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
6 changes: 6 additions & 0 deletions Complexity/Computability/Complexity/Problems/Clique.lean
Original file line number Diff line number Diff line change
Expand Up @@ -122,6 +122,12 @@ theorem computableTidilyInPolyTime_compl :
unfold compl encGraph
fun_prop

/-- Complementing a graph on its declared vertices is polynomial-time with the graph encoding. -/
@[fun_prop]
theorem computableInPolyTime_compl :
ComputableInPolyTime compl encGraph encGraph :=
.of_tidy computableTidilyInPolyTime_compl

end Graph

namespace Clique
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -491,4 +491,20 @@ theorem bitsPadWord {α : Type}
.of_tidy (@Turing.MultiTapeTM.ComputableTidilyInPolyTime.bitsPadWord α input bound word
hbound.tidy hword.tidy)

/-- Repeat a fixed bit a unary number of times, including zero repetitions. -/
@[fun_prop]
theorem bitsReplicate (bit : Bool) :
ComputableInPolyTime (fun n => List.replicate n bit) encUnary encBits :=
.of_tidy (ComputableTidilyInPolyTime.bitsReplicate bit)

/-- Apply a fixed Boolean operation pointwise to two computed raw words. The result stops at
whichever word ends first; the two certificates retain their raw bit-string encoding. -/
@[fun_prop]
theorem bitsZipWithInput (op : Bool → Bool → Bool) {α : Type} {input : α ↪ List Bool}
{left right : α → List Bool}
(hleft : ComputableInPolyTime left input encBits)
(hright : ComputableInPolyTime right input encBits) :
ComputableInPolyTime (fun a => (left a).zipWith op (right a)) input encBits :=
.of_tidy (ComputableTidilyInPolyTime.bitsZipWithInput op hleft.tidy hright.tidy)

end Turing.MultiTapeTM.ComputableInPolyTime
Original file line number Diff line number Diff line change
Expand Up @@ -978,4 +978,14 @@ theorem mapWithInput {α : Type}
.of_tidy (@Turing.MultiTapeTM.ComputableTidilyInPolyTime.mapWithInput α β γ encA encB encIn f
list hlist.tidy hf.tidy)

/-- Drop a computed unary number of bits from a computed raw word. Counts beyond the word
length return the empty word, with no promise on the count or input. -/
@[fun_prop]
theorem bitsDropWithInput {α : Type} {input : α ↪ List Bool}
{list : α → List Bool} {count : α → ℕ}
(hlist : ComputableInPolyTime list input encBits)
(hcount : ComputableInPolyTime count input encUnary) :
ComputableInPolyTime (fun a => (list a).drop (count a)) input encBits :=
.of_tidy (ComputableTidilyInPolyTime.bitsDropWithInput hlist.tidy hcount.tidy)

end Turing.MultiTapeTM.ComputableInPolyTime
Original file line number Diff line number Diff line change
Expand Up @@ -121,4 +121,10 @@ theorem optionGetDWithInput {α : Type}
.of_tidy (@Turing.MultiTapeTM.ComputableTidilyInPolyTime.optionGetDWithInput α β encA encB value
fallback hvalue.tidy hfallback.tidy)

/-- Construct an optional value while retaining the complete input encoding. -/
@[fun_prop]
theorem optionSome {α : Type} (enc : α ↪ List Bool) :
ComputableInPolyTime (some (α := α)) enc (encOption enc) :=
.of_tidy (ComputableTidilyInPolyTime.optionSome enc)

end Turing.MultiTapeTM.ComputableInPolyTime
Loading