Download lean/OAI/Combinatorics/IndependentSets/PCP/ConstraintGraph.lean from roseking/openAI-math-dataset: direct link, hf CLI and curl.
- Browser
- Download file 2.69 kB
-
https://huggingface.co/datasets/roseking/openAI-math-dataset/resolve/main/lean/OAI/Combinatorics/IndependentSets/PCP/ConstraintGraph.lean
- Command line
-
hf download hf://datasets/roseking/openAI-math-dataset/lean/OAI/Combinatorics/IndependentSets/PCP/ConstraintGraph.lean
-
curl -L -o ConstraintGraph.lean https://huggingface.co/datasets/roseking/openAI-math-dataset/resolve/main/lean/OAI/Combinatorics/IndependentSets/PCP/ConstraintGraph.lean
2.69 kB
| import Mathlib | |
| namespace OAI | |
| namespace IndependentSetsGames.Foundations.PCP | |
| structure ConstraintGraph (V E A : Type*) where | |
| reverse : E ≃ E | |
| reverse_involutive : Function.Involutive reverse | |
| tail : E → V | |
| accepts : E → A → A → Bool | |
| reverse_accepts : ∀ e a b, accepts (reverse e) b a = accepts e a b | |
| namespace ConstraintGraph | |
| variable {V E A : Type*} | |
| def head (G : ConstraintGraph V E A) (e : E) : V := G.tail (G.reverse e) | |
| @[simp] theorem head_reverse (G : ConstraintGraph V E A) (e : E) : | |
| G.head (G.reverse e) = G.tail e := by | |
| simp only [head, G.reverse_involutive e] | |
| def edgeSatisfied (G : ConstraintGraph V E A) (labeling : V → A) (e : E) : Bool := | |
| G.accepts e (labeling (G.tail e)) (labeling (G.head e)) | |
| @[simp] theorem edgeSatisfied_reverse (G : ConstraintGraph V E A) | |
| (labeling : V → A) (e : E) : | |
| G.edgeSatisfied labeling (G.reverse e) = G.edgeSatisfied labeling e := by | |
| simpa only [edgeSatisfied, head, G.reverse_involutive e] using | |
| G.reverse_accepts e (labeling (G.tail e)) (labeling (G.tail (G.reverse e))) | |
| def Satisfiable (G : ConstraintGraph V E A) : Prop := | |
| ∃ labeling : V → A, ∀ e, G.edgeSatisfied labeling e = true | |
| def rejectedDarts [Fintype E] (G : ConstraintGraph V E A) (labeling : V → A) : | |
| Finset E := Finset.univ.filter (fun e => G.edgeSatisfied labeling e = false) | |
| def rejectionCount [Fintype E] (G : ConstraintGraph V E A) (labeling : V → A) : Nat := | |
| (G.rejectedDarts labeling).card | |
| theorem mem_rejectedDarts [Fintype E] (G : ConstraintGraph V E A) | |
| (labeling : V → A) (e : E) : | |
| e ∈ G.rejectedDarts labeling ↔ G.edgeSatisfied labeling e = false := by | |
| simp [rejectedDarts] | |
| theorem rejectionCount_le [Fintype E] (G : ConstraintGraph V E A) | |
| (labeling : V → A) : G.rejectionCount labeling ≤ Fintype.card E := by | |
| exact Finset.card_le_card (Finset.filter_subset _ _) | |
| theorem rejected_exists_of_not_satisfiable (G : ConstraintGraph V E A) | |
| (unsat : ¬ G.Satisfiable) (labeling : V → A) : | |
| ∃ e, G.edgeSatisfied labeling e = false := by | |
| classical | |
| by_contra none | |
| apply unsat | |
| refine ⟨labeling, fun e => ?_⟩ | |
| have notFalse : G.edgeSatisfied labeling e ≠ false := by | |
| intro h | |
| exact none ⟨e, h⟩ | |
| cases h : G.edgeSatisfied labeling e <;> simp_all | |
| theorem rejectionCount_positive [Fintype E] (G : ConstraintGraph V E A) | |
| (unsat : ¬ G.Satisfiable) (labeling : V → A) : | |
| 1 ≤ G.rejectionCount labeling := by | |
| obtain ⟨e, he⟩ := G.rejected_exists_of_not_satisfiable unsat labeling | |
| exact Finset.one_le_card.mpr ⟨e, (G.mem_rejectedDarts labeling e).mpr he⟩ | |
| end ConstraintGraph | |
| end IndependentSetsGames.Foundations.PCP | |
| end OAI | |