A decision problem is a language over an alphabet α, a predicate on List α. Adds complement, the full and the empty language. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Diff
2 files changed +35 -0
| @@ -0,0 +1,34 @@ | ||
| 1 | +/-! | |
| 2 | +# Languages | |
| 3 | + | |
| 4 | +A *decision problem* is a language: a set of finite words over an alphabet `α`. We represent a set of | |
| 5 | +words by its membership predicate. The alphabet is meant to be finite; the complexity classes require | |
| 6 | +`IsFinite α` where it matters. | |
| 7 | +-/ | |
| 8 | + | |
| 9 | +namespace PvsNP | |
| 10 | + | |
| 11 | +/-- A language over the alphabet `α`: which words are in it. -/ | |
| 12 | +abbrev Language (α : Type) := List α → Prop | |
| 13 | + | |
| 14 | +namespace Language | |
| 15 | + | |
| 16 | +variable {α : Type} | |
| 17 | + | |
| 18 | +/-- The complement of a language. -/ | |
| 19 | +def compl (L : Language α) : Language α := fun x => ¬ L x | |
| 20 | + | |
| 21 | +/-- The language of every word. -/ | |
| 22 | +def univ : Language α := fun _ => True | |
| 23 | + | |
| 24 | +/-- The empty language. -/ | |
| 25 | +def empty : Language α := fun _ => False | |
| 26 | + | |
| 27 | +@[simp] theorem compl_apply (L : Language α) (x : List α) : compl L x ↔ ¬ L x := Iff.rfl | |
| 28 | + | |
| 29 | +theorem compl_compl (L : Language α) (x : List α) : compl (compl L) x ↔ L x := by | |
| 30 | + simp only [compl_apply, Classical.not_not] | |
| 31 | + | |
| 32 | +end Language | |
| 33 | + | |
| 34 | +end PvsNP | |