Buckets:
| import Mathlib.Data.List.OfFn | |
| import Mathlib.Tactic.FinCases | |
| import Mathlib.Tactic.Linarith | |
| import Mathlib.Tactic.NormNum | |
| import OAI.Computability.UniqueGames.PCP.AlphabetReductionLemmas | |
| import OAI.Computability.UniqueGames.PCP.AlphabetRetractionLemmas | |
| import OAI.Computability.UniqueGames.PCP.AlphabetTableBoundsLemmas | |
| import OAI.Computability.UniqueGames.PCP.FinalConstantsLemmas | |
| import OAI.Computability.UniqueGames.PCP.GraphTables | |
| import OAI.Computability.UniqueGames.PCP.InputLemmas | |
| import OAI.Computability.UniqueGames.PCP.PoweringPortReindexLemmas | |
| import OAI.Computability.UniqueGames.PCP.PoweringTableSemanticsLemmas | |
| import OAI.Computability.UniqueGames.PCP.PreprocessingTablesLemmas | |
| import OAI.Computability.UniqueGames.Reduction.BinaryCoordinates | |
| namespace OAI | |
| /-! Explicit structural numberings of the raw 3SAT incidence graph. Unused | |
| declared variable names are retained; their unary input header pays for them. | |
| The graph has one dummy vertex and one tautological loop, even for an empty | |
| formula. No input-dependent choice of a finite enumeration is made. -/ | |
| namespace UniqueGamesTheorem.Foundations.PCP.RawInitialTables | |
| open Target GraphTables | |
| def unitOrder : Unit ≃ Fin 1 where | |
| toFun _ := 0 | |
| invFun _ := () | |
| left_inv _ := rfl | |
| right_inv i := by fin_cases i; rfl | |
| def slotOrder : Slot ≃ Fin 3 where | |
| toFun | |
| | .first => 0 | |
| | .second => 1 | |
| | .third => 2 | |
| invFun i := if i = 0 then .first else if i = 1 then .second else .third | |
| left_inv s := by cases s <;> rfl | |
| right_inv i := by fin_cases i <;> rfl | |
| def binaryOrder (n : Nat) : (Fin n → Bool) ≃ Fin (2 ^ n) where | |
| toFun bits := (UniqueGamesTheorem.Integration.BinaryCoordinates.pack bits).toFin | |
| invFun index := UniqueGamesTheorem.Integration.BinaryCoordinates.unpack (BitVec.ofFin index) | |
| left_inv bits := UniqueGamesTheorem.Integration.BinaryCoordinates.unpack_pack bits | |
| right_inv index := by | |
| change (UniqueGamesTheorem.Integration.BinaryCoordinates.pack | |
| (UniqueGamesTheorem.Integration.BinaryCoordinates.unpack (BitVec.ofFin index))).toFin = index | |
| rw [UniqueGamesTheorem.Integration.BinaryCoordinates.pack_unpack] | |
| def labelOrder : AlphabetRetraction.Label64 ≃ GraphTables.Label := binaryOrder 6 | |
| def vertexOrder (F : Formula) : | |
| InitialGraph.Vertex F ≃ Fin (F.variables + F.clauses.length + 1) := | |
| ((finSumFinEquiv.sumCongr unitOrder).trans finSumFinEquiv) | |
| def eventOrder (F : Formula) : RandomEvent F ≃ Fin (F.clauses.length * 3) := | |
| ((Equiv.refl (Fin F.clauses.length)).prodCongr slotOrder).trans finProdFinEquiv | |
| def dartOrder (F : Formula) : InitialGraph.Dart F ≃ Fin (6 * F.clauses.length + 1) := | |
| (((((eventOrder F).prodCongr finTwoEquiv.symm).trans finProdFinEquiv).sumCongr | |
| unitOrder).trans finSumFinEquiv).trans (finCongr (by omega)) | |
| def raw64 (F : Formula) : ConstraintGraph (InitialGraph.Vertex F) | |
| (InitialGraph.Dart F) AlphabetRetraction.Label64 := | |
| AlphabetRetraction.pullback (InitialGraph.raw F) AlphabetRetraction.decode64 | |
| def table (F : Formula) : GraphTables.Table := | |
| GraphTables.ofEnumeratedGraph (raw64 F) (vertexOrder F) (dartOrder F) labelOrder | |
| @[simp] theorem table_vertices (F : Formula) : | |
| (table F).vertices = F.variables + F.clauses.length + 1 := rfl | |
| @[simp] theorem table_darts (F : Formula) : (table F).darts = 6 * F.clauses.length + 1 := rfl | |
| theorem table_vertices_positive (F : Formula) : 0 < (table F).vertices := by | |
| rw [table_vertices]; omega | |
| theorem table_darts_positive (F : Formula) : 0 < (table F).darts := by | |
| rw [table_darts]; omega | |
| theorem raw64_satisfiable_iff (F : Formula) : (raw64 F).Satisfiable ↔ F.Satisfiable := | |
| (AlphabetRetraction.satisfiable_pullback_iff (InitialGraph.raw F) | |
| AlphabetRetraction.decode64 AlphabetRetraction.encode64 | |
| AlphabetRetraction.decode_encode64).trans (InitialGraph.raw_satisfiable_iff F) | |
| theorem table_semantics (F : Formula) : | |
| GraphTables.semantics (table F) = | |
| (raw64 F).reindex (vertexOrder F) (dartOrder F) labelOrder := by | |
| change GraphTables.semantics (GraphTables.ofGraph | |
| (GraphTables.enumeratedGraph (raw64 F) (vertexOrder F) (dartOrder F) labelOrder)) = _ | |
| rw [GraphTables.semantics_ofGraph] | |
| rfl | |
| theorem table_satisfiable_iff (F : Formula) : | |
| (GraphTables.semantics (table F)).Satisfiable ↔ F.Satisfiable := by | |
| rw [table_semantics] | |
| exact ((raw64 F).satisfiable_reindex (vertexOrder F) (dartOrder F) labelOrder).trans | |
| (raw64_satisfiable_iff F) | |
| theorem initial_rejection (F : Formula) (unsat : ¬ F.Satisfiable) | |
| (labeling : Fin (table F).vertices → GraphTables.Label) : | |
| 1 ≤ (GraphTables.semantics (table F)).rejectionCount labeling := | |
| ConstraintGraph.rejectionCount_positive _ | |
| (fun h => unsat ((table_satisfiable_iff F).mp h)) labeling | |
| theorem initial_size (F : Formula) : | |
| (table F).vertices + (table F).darts = F.variables + 7 * F.clauses.length + 2 := by | |
| rw [table_vertices, table_darts] | |
| omega | |
| end UniqueGamesTheorem.Foundations.PCP.RawInitialTables | |
| /-! Polynomial arithmetic for the actual initial-machine phase counts. The | |
| separate execution theorem must connect these counts to the concrete program. -/ | |
| namespace UniqueGamesTheorem.Foundations.PCP.RawInitialMachineBudget | |
| open Target Complexity | |
| def nameSum {n : Nat} (clause : Clause n) : Nat := | |
| clause[0].variableIndex.val + clause[1].variableIndex.val + clause[2].variableIndex.val | |
| def bodyTime {n : Nat} (i : Nat) (c : Clause n) : Nat := | |
| 6 * n + 18 * i + 2 * nameSum c + | |
| 2 * (encodeWords (Complexity.clauseWords c)).length + 63 | |
| def loopTime {n : Nat} (i : Nat) : List (Clause n) → Nat | |
| | [] => 1 | |
| | c :: cs => bodyTime i c + loopTime (i + 1) cs | |
| theorem nameSum_le {n : Nat} (clause : Clause n) : nameSum clause ≤ 3 * n := by | |
| have h0 := clause[0].variableIndex.isLt | |
| have h1 := clause[1].variableIndex.isLt | |
| have h2 := clause[2].variableIndex.isLt | |
| unfold nameSum | |
| omega | |
| theorem bodyTime_le {n : Nat} (i : Nat) (c : Clause n) : | |
| bodyTime i c ≤ 18 * n + 18 * i + 81 := by | |
| have hn := nameSum_le c | |
| have hb := clauseBits_length_le c | |
| unfold bodyTime | |
| omega | |
| theorem loopTime_le {n : Nat} (i : Nat) (cs : List (Clause n)) : | |
| loopTime i cs ≤ cs.length * (18 * n + 18 * (i + cs.length) + 81) + 1 := by | |
| induction cs generalizing i with | |
| | nil => simp [loopTime] | |
| | cons c cs ih => | |
| have hc := bodyTime_le i c | |
| have ht := ih (i + 1) | |
| have hbound : bodyTime i c ≤ 18 * n + 18 * (i + (c :: cs).length) + 81 := by | |
| simp only [List.length_cons] | |
| omega | |
| have hsame : 18 * n + 18 * (i + 1 + cs.length) + 81 = | |
| 18 * n + 18 * (i + (c :: cs).length) + 81 := by | |
| simp only [List.length_cons] | |
| omega | |
| rw [hsame] at ht | |
| rw [loopTime] | |
| calc | |
| _ ≤ (18 * n + 18 * (i + (c :: cs).length) + 81) + | |
| (cs.length * (18 * n + 18 * (i + (c :: cs).length) + 81) + 1) := | |
| Nat.add_le_add hbound ht | |
| _ = _ := by rw [List.length_cons]; ring | |
| theorem input_header_bound (F : Formula) : | |
| F.variables + F.clauses.length + 2 ≤ (formulaBits F).length := by | |
| simp only [formulaBits, formulaWords, encodeWords_append, List.length_append, | |
| encodeWords, encodeWord_length, List.length_nil] | |
| omega | |
| theorem graph_size_bound (F : Formula) : | |
| (RawInitialTables.table F).vertices + (RawInitialTables.table F).darts ≤ | |
| 7 * (formulaBits F).length := by | |
| rw [RawInitialTables.initial_size] | |
| have h := input_header_bound F | |
| omega | |
| def fullBudget (F : Formula) : Nat := | |
| 6 * F.variables + 10 * F.clauses.length + 30 + loopTime 0 F.clauses + | |
| (GraphTables.tableBits (RawInitialTables.table F)).length | |
| noncomputable def timePolynomial : Polynomial Nat := | |
| Polynomial.C 100 * Polynomial.X ^ 2 + Polynomial.C 60000 * Polynomial.X + | |
| Polynomial.C 100 | |
| theorem timePolynomial_eval (N : Nat) : | |
| timePolynomial.eval N = 100 * N ^ 2 + 60000 * N + 100 := by | |
| simp [timePolynomial] | |
| theorem fullBudget_le (F : Formula) : | |
| fullBudget F ≤ timePolynomial.eval (formulaBits F).length := by | |
| have hinput := input_header_bound F | |
| have hloop := loopTime_le 0 F.clauses | |
| have hout := GraphTableComplexity.bits_le_of_size_le (RawInitialTables.table F) | |
| (graph_size_bound F) | |
| rw [GraphTableComplexity.encodingPolynomial_eval] at hout | |
| simp only [Nat.zero_add] at hloop | |
| have hm : F.clauses.length ≤ (formulaBits F).length := by omega | |
| have hcoefficient : 18 * F.variables + 18 * F.clauses.length + 81 ≤ | |
| 18 * (formulaBits F).length + 81 := by omega | |
| have hproduct := Nat.mul_le_mul hm hcoefficient | |
| rw [timePolynomial_eval] | |
| unfold fullBudget | |
| nlinarith | |
| end UniqueGamesTheorem.Foundations.PCP.RawInitialMachineBudget | |
| /-! Explicit finite predicates and numeric row words of the initial incidence table. | |
| Every relation retains all 4096 entries, including repetitions. -/ | |
| namespace UniqueGamesTheorem.Foundations.PCP.RawInitialRows | |
| open Target GraphTables RawInitialTables | |
| abbrev Signs := Bool × Bool × Bool | |
| abbrev Names := Nat × Nat × Nat | |
| def clauseSigns {n : Nat} (clause : Clause n) : Signs := | |
| (clause[0].positive, clause[1].positive, clause[2].positive) | |
| def clauseNames {n : Nat} (clause : Clause n) : Names := | |
| (clause[0].variableIndex.val, clause[1].variableIndex.val, clause[2].variableIndex.val) | |
| def nameWord (names : Names) : Slot → Nat | |
| | .first => names.1 | |
| | .second => names.2.1 | |
| | .third => names.2.2 | |
| def decodedLabel (a : GraphTables.Label) : InitialGraph.Label := | |
| AlphabetRetraction.decode64 (labelOrder.symm a) | |
| def incidencePredicate (signs : Signs) (slot : Slot) | |
| (clauseLabel variableLabel : InitialGraph.Label) : Bool := | |
| InitialGraph.variableValid variableLabel && | |
| (((literalValue signs.1 clauseLabel.1 || | |
| literalValue signs.2.1 clauseLabel.2.1) || | |
| literalValue signs.2.2 clauseLabel.2.2) && | |
| decide (answerAt (InitialGraph.toClauseAnswer clauseLabel) slot = variableLabel.1)) | |
| def relationPredicate (signs : Signs) (slot : Slot) : | |
| Bool → GraphTables.Label → GraphTables.Label → Bool | |
| | false, a, b => incidencePredicate signs slot (decodedLabel a) (decodedLabel b) | |
| | true, a, b => incidencePredicate signs slot (decodedLabel b) (decodedLabel a) | |
| def relationWordsFor (signs : Signs) (slot : Slot) (orientation : Bool) : List Nat := | |
| relationWords (relationOf (relationPredicate signs slot orientation)) | |
| @[simp] theorem relationWordsFor_length (signs : Signs) (slot : Slot) (orientation : Bool) : | |
| (relationWordsFor signs slot orientation).length = 4096 := by | |
| exact relationWords_length _ | |
| def incidenceWords (n i : Nat) (names : Names) (signs : Signs) | |
| (slot : Slot) (orientation : Bool) : List Nat := | |
| [if orientation then nameWord names slot else n + i, | |
| 6 * i + 2 * (slotOrder slot).val + (if orientation then 0 else 1)] ++ | |
| relationWordsFor signs slot orientation | |
| def clauseWords (n i : Nat) (names : Names) (signs : Signs) : List Nat := | |
| incidenceWords n i names signs .first false ++ | |
| incidenceWords n i names signs .first true ++ | |
| incidenceWords n i names signs .second false ++ | |
| incidenceWords n i names signs .second true ++ | |
| incidenceWords n i names signs .third false ++ | |
| incidenceWords n i names signs .third true | |
| def dummyWords (n m : Nat) : List Nat := | |
| [n + m, 6 * m] ++ List.replicate 4096 1 | |
| /-! Exact ordered rows of the initial incidence table. Every relation retains | |
| all 4096 entries, including repetitions; this is a list identity, not a runtime bound. -/ | |
| /-- The list induced by an explicit numbering, in increasing numeric order. -/ | |
| def orderedList {α : Type*} {n : Nat} (e : α ≃ Fin n) : List α := | |
| List.ofFn e.symm | |
| theorem orderedList_cast {α : Type*} {m n : Nat} (e : α ≃ Fin m) (h : m = n) : | |
| orderedList (e.trans (finCongr h)) = orderedList e := by | |
| subst n | |
| rfl | |
| theorem orderedList_prod {α β : Type*} {m n : Nat} | |
| (e : α ≃ Fin m) (f : β ≃ Fin n) : | |
| orderedList ((e.prodCongr f).trans finProdFinEquiv) = | |
| (orderedList e).flatMap (fun a => (orderedList f).map (fun b => (a, b))) := by | |
| change List.ofFn (fun q : Fin (m * n) => | |
| (e.symm (finProdFinEquiv.symm q).1, f.symm (finProdFinEquiv.symm q).2)) = _ | |
| rw [List.ofFn_mul] | |
| simp only [orderedList, List.flatMap_def, List.map_ofFn] | |
| apply congrArg List.flatten | |
| apply congrArg List.ofFn | |
| funext i | |
| apply congrArg List.ofFn | |
| funext j | |
| have h : (⟨i.val * n + j.val, by | |
| calc | |
| i.val * n + j.val < (i.val + 1) * n := | |
| (Nat.add_lt_add_left j.isLt _).trans_eq (by rw [Nat.add_mul, Nat.one_mul]) | |
| _ ≤ m * n := Nat.mul_le_mul_right _ i.isLt⟩ : Fin (m * n)) = | |
| finProdFinEquiv (i, j) := by | |
| apply Fin.ext | |
| simp [finProdFinEquiv, Nat.add_comm, Nat.mul_comm] | |
| rw [h, Equiv.symm_apply_apply] | |
| rfl | |
| theorem orderedList_sum {α β : Type*} {m n : Nat} | |
| (e : α ≃ Fin m) (f : β ≃ Fin n) : | |
| orderedList ((e.sumCongr f).trans finSumFinEquiv) = | |
| (orderedList e).map Sum.inl ++ (orderedList f).map Sum.inr := by | |
| change List.ofFn (fun q : Fin (m + n) => | |
| (e.sumCongr f).symm (finSumFinEquiv.symm q)) = _ | |
| rw [List.ofFn_add] | |
| change (List.ofFn (fun i : Fin m => | |
| (e.sumCongr f).symm (finSumFinEquiv.symm (i.castAdd n)))) ++ | |
| (List.ofFn (fun i : Fin n => | |
| (e.sumCongr f).symm (finSumFinEquiv.symm (i.natAdd m)))) = _ | |
| simp [orderedList, List.map_ofFn] | |
| rfl | |
| def clauseDarts (F : Formula) (i : Fin F.clauses.length) : List (InitialGraph.Dart F) := | |
| [.inl ((i, .first), false), .inl ((i, .first), true), | |
| .inl ((i, .second), false), .inl ((i, .second), true), | |
| .inl ((i, .third), false), .inl ((i, .third), true)] | |
| theorem orderedList_dartOrder (F : Formula) : | |
| orderedList (dartOrder F) = | |
| (List.finRange F.clauses.length).flatMap (clauseDarts F) ++ [.inr ()] := by | |
| rw [dartOrder, orderedList_cast, orderedList_sum, orderedList_prod] | |
| rw [eventOrder, orderedList_prod] | |
| have hs : orderedList slotOrder = [.first, .second, .third] := rfl | |
| have hb : orderedList finTwoEquiv.symm = [false, true] := rfl | |
| have hu : orderedList unitOrder = [()] := rfl | |
| rw [hs, hb, hu] | |
| simp [orderedList, List.finRange, List.flatMap_assoc, List.map_flatMap, | |
| ] | |
| rfl | |
| def rowFor (F : Formula) (d : InitialGraph.Dart F) : | |
| DartRow (F.variables + F.clauses.length + 1) (6 * F.clauses.length + 1) where | |
| tail := vertexOrder F (InitialGraph.tail F d) | |
| reverseIndex := dartOrder F (InitialGraph.reverse F d) | |
| relation := relationOf (fun a b => InitialGraph.predicate F d (decodedLabel a) (decodedLabel b)) | |
| theorem rowList_table (F : Formula) : | |
| rowList (table F) = (orderedList (dartOrder F)).map (rowFor F) := by | |
| simp only [rowList, table, ofEnumeratedGraph, ofGraph, graphRows, Vector.toList_ofFn, | |
| orderedList, List.map_ofFn] | |
| rfl | |
| theorem rowWords_incidence (F : Formula) (i : Fin F.clauses.length) | |
| (slot : Slot) (orientation : Bool) : | |
| rowWords (rowFor F (.inl ((i, slot), orientation))) = | |
| incidenceWords F.variables i.val (clauseNames (clauseAt F i)) | |
| (clauseSigns (clauseAt F i)) slot orientation := by | |
| have ht : (rowFor F (.inl ((i, slot), orientation))).tail.val = | |
| if orientation then nameWord (clauseNames (clauseAt F i)) slot else F.variables + i.val := by | |
| cases orientation <;> cases slot <;> rfl | |
| have hr : (rowFor F (.inl ((i, slot), orientation))).reverseIndex.val = | |
| 6 * i.val + 2 * (slotOrder slot).val + (if orientation then 0 else 1) := by | |
| cases orientation <;> cases slot <;> | |
| simp [rowFor, InitialGraph.reverse, dartOrder, eventOrder, slotOrder, unitOrder, | |
| finProdFinEquiv, finSumFinEquiv, finTwoEquiv, Nat.mul_add, | |
| Nat.mul_comm, Nat.mul_left_comm, Nat.add_comm] | |
| have hp : (rowFor F (.inl ((i, slot), orientation))).relation = | |
| relationOf (relationPredicate (clauseSigns (clauseAt F i)) slot orientation) := by | |
| cases orientation <;> rfl | |
| unfold rowWords incidenceWords relationWordsFor | |
| rw [ht, hr, hp] | |
| theorem rowWords_dummy (F : Formula) : | |
| rowWords (rowFor F (.inr ())) = dummyWords F.variables F.clauses.length := by | |
| have ht : (rowFor F (.inr ())).tail.val = F.variables + F.clauses.length := rfl | |
| have hr : (rowFor F (.inr ())).reverseIndex.val = 6 * F.clauses.length := by | |
| simp [rowFor, InitialGraph.reverse, dartOrder, unitOrder, finSumFinEquiv] | |
| have hp : (rowFor F (.inr ())).relation = relationOf (fun _ _ => true) := rfl | |
| have hw : relationWords (relationOf (fun _ _ => true)) = List.replicate 4096 1 := by | |
| unfold relationWords | |
| rw [relationOf, Vector.toList_ofFn, List.map_ofFn] | |
| exact List.ofFn_const 4096 1 | |
| unfold rowWords dummyWords | |
| rw [ht, hr, hp, hw] | |
| theorem clauseDarts_rowWords (F : Formula) (i : Fin F.clauses.length) : | |
| (clauseDarts F i).flatMap (fun d => rowWords (rowFor F d)) = | |
| clauseWords F.variables i.val (clauseNames (clauseAt F i)) | |
| (clauseSigns (clauseAt F i)) := by | |
| simp [clauseDarts, rowWords_incidence, clauseWords, List.append_assoc] | |
| /-- Exact headers and exact clause/slot/orientation order of every emitted word. -/ | |
| theorem tableWords_eq (F : Formula) : | |
| tableWords (table F) = | |
| [F.variables + F.clauses.length + 1, 6 * F.clauses.length + 1] ++ | |
| (List.finRange F.clauses.length).flatMap (fun i => | |
| clauseWords F.variables i.val (clauseNames (clauseAt F i)) | |
| (clauseSigns (clauseAt F i))) ++ dummyWords F.variables F.clauses.length := by | |
| rw [tableWords, rowList_table, orderedList_dartOrder] | |
| simp [List.flatMap_map, List.flatMap_append, List.flatMap_assoc, clauseDarts_rowWords, | |
| rowWords_dummy] | |
| end UniqueGamesTheorem.Foundations.PCP.RawInitialRows | |
| /-! The concrete numbered amplification round, with one fixed base expander. | |
| Every intermediate is an actual stored table, with explicit finite coordinates. | |
| The running-time certificate is a separate theorem about these same functions. -/ | |
| namespace UniqueGamesTheorem.Foundations.PCP.RoundTables | |
| abbrev BaseTable := PreprocessingTables.BaseTable | |
| /-- Initialized fixed data keep enormous constant powers symbolic in the kernel. | |
| The stored equality proves the exact requested parameter; no value is assumed. -/ | |
| opaque fixedWalkParameter : {n : Nat // n = 2 * FinalConstants.endpointLength} := | |
| ⟨2 * FinalConstants.endpointLength, rfl⟩ | |
| def walkParameter : Nat := fixedWalkParameter.val | |
| theorem walkParameter_eq : walkParameter = 2 * FinalConstants.endpointLength := | |
| fixedWalkParameter.property | |
| def alphabet : Nat := PoweringTables.labelCount PreprocessingTables.degree walkParameter | |
| theorem alphabet_positive : 0 < alphabet := by | |
| unfold alphabet PoweringTables.labelCount | |
| exact Nat.pow_pos (by decide) | |
| def powered (H : BaseTable) (table : GraphTables.Table) : GenericGraphTables.Table alphabet := | |
| PoweringTables.table (PreprocessingTables.preprocess H table) walkParameter | |
| def build (H : BaseTable) (table : GraphTables.Table) : GraphTables.Table := | |
| AlphabetTable.Table.build (powered H table) | |
| def sizeFactor : Nat := AlphabetGraphBounds.sizeFactor alphabet * | |
| (ExpanderFamily.growth ^ 2 * (1 + 2 * PreprocessingTables.degree ^ (walkParameter + 1))) | |
| theorem degree_positive : 0 < PreprocessingTables.degree := by | |
| unfold PreprocessingTables.degree | |
| omega | |
| theorem dartFactor_positive (q : Nat) : 0 < AlphabetGraphBounds.dartFactor q := by | |
| unfold AlphabetGraphBounds.dartFactor AlphabetGraphBounds.localEventFactor | |
| positivity | |
| theorem sizeFactor_positive : 0 < sizeFactor := by | |
| unfold sizeFactor | |
| apply Nat.mul_pos (AlphabetGraphBounds.sizeFactor_positive alphabet) | |
| apply Nat.mul_pos | |
| · exact Nat.pow_pos (Nat.zero_lt_one.trans ExpanderFamily.growth_gt_one) | |
| · omega | |
| theorem powered_vertices (H : BaseTable) (table : GraphTables.Table) : | |
| (powered H table).vertices = PreprocessingTables.vertices table := rfl | |
| theorem powered_darts (H : BaseTable) (table : GraphTables.Table) : | |
| (powered H table).darts = 2 * PreprocessingTables.vertices table * | |
| PreprocessingTables.degree ^ (walkParameter + 1) := rfl | |
| theorem build_darts_positive (H : BaseTable) (table : GraphTables.Table) : | |
| 0 < (build H table).darts := by | |
| change 0 < (AlphabetTable.Table.build (powered H table)).darts | |
| rw [AlphabetTableBounds.build_darts, powered_darts] | |
| exact Nat.mul_pos (Nat.mul_pos | |
| (Nat.mul_pos (by decide) (PreprocessingTables.vertices_positive table)) | |
| (Nat.pow_pos degree_positive)) (dartFactor_positive alphabet) | |
| theorem build_size_le (H : BaseTable) (table : GraphTables.Table) | |
| (ht : 0 < table.darts) : | |
| (build H table).vertices + (build H table).darts ≤ | |
| sizeFactor * (table.vertices + table.darts) := by | |
| have hv := PreprocessingTables.vertices_le_of_positive table ht | |
| have he : (powered H table).vertices + (powered H table).darts = | |
| PreprocessingTables.vertices table * | |
| (1 + 2 * PreprocessingTables.degree ^ (walkParameter + 1)) := by | |
| rw [powered_vertices, powered_darts] | |
| ring | |
| have hp := Nat.mul_le_mul_right | |
| (1 + 2 * PreprocessingTables.degree ^ (walkParameter + 1)) hv | |
| calc | |
| _ ≤ AlphabetGraphBounds.sizeFactor alphabet * | |
| ((powered H table).vertices + (powered H table).darts) := | |
| AlphabetTableBounds.build_total_le (powered H table) | |
| _ = AlphabetGraphBounds.sizeFactor alphabet * | |
| (PreprocessingTables.vertices table * | |
| (1 + 2 * PreprocessingTables.degree ^ (walkParameter + 1))) := by rw [he] | |
| _ ≤ AlphabetGraphBounds.sizeFactor alphabet * | |
| ((ExpanderFamily.growth ^ 2 * table.darts) * | |
| (1 + 2 * PreprocessingTables.degree ^ (walkParameter + 1))) := | |
| Nat.mul_le_mul_left _ hp | |
| _ = sizeFactor * table.darts := by unfold sizeFactor; ring | |
| _ ≤ sizeFactor * (table.vertices + table.darts) := | |
| Nat.mul_le_mul_left _ (Nat.le_add_left _ _) | |
| theorem build_completeness (H : BaseTable) (table : GraphTables.Table) | |
| (sat : (GraphTables.semantics table).Satisfiable) : | |
| (GraphTables.semantics (build H table)).Satisfiable := by | |
| let : Nonempty (Fin alphabet) := ⟨⟨0, alphabet_positive⟩⟩ | |
| exact AlphabetTable.Table.perfect_completeness (powered H table) | |
| (PoweringTableSemantics.preserves_satisfiability | |
| (PreprocessingTables.preprocess H table) walkParameter | |
| (PreprocessingGuarantees.completeness H table sat)) | |
| abbrev Input := {table : GraphTables.Table // 0 < table.darts} | |
| instance (input : Input) : Nonempty (Fin input.val.darts) := ⟨⟨0, input.property⟩⟩ | |
| def step (H : BaseTable) (input : Input) : Input := | |
| ⟨build H input.val, build_darts_positive H input.val⟩ | |
| def initial (F : Target.Formula) : Input := | |
| ⟨RawInitialTables.table F, RawInitialTables.table_darts_positive F⟩ | |
| def size (input : Input) : Nat := input.val.vertices + input.val.darts | |
| def Satisfiable (input : Input) : Prop := (GraphTables.semantics input.val).Satisfiable | |
| noncomputable def gap (input : Input) : ℝ := (GraphTables.semantics input.val).gap | |
| theorem size_positive (input : Input) : 0 < size input := | |
| input.property.trans_le (Nat.le_add_left _ _) | |
| theorem gap_nonnegative (input : Input) : 0 ≤ gap input := | |
| (GraphTables.semantics input.val).gap_nonnegative | |
| theorem gap_eq_zero_iff (input : Input) : gap input = 0 ↔ Satisfiable input := | |
| (GraphTables.semantics input.val).gap_eq_zero_iff | |
| theorem one_le_size_mul_gap (input : Input) (unsat : ¬ Satisfiable input) : | |
| 1 ≤ (size input : ℝ) * gap input := by | |
| have h := (GraphTables.semantics input.val).inverse_card_le_gap_of_unsatisfiable unsat | |
| have hp : (0 : ℝ) < input.val.darts := Nat.cast_pos.mpr input.property | |
| simp only [Fintype.card_fin] at h | |
| have hd := (div_le_iff₀ hp).mp h | |
| have hsize : (input.val.darts : ℝ) ≤ (size input : ℝ) := by | |
| exact_mod_cast (Nat.le_add_left input.val.darts input.val.vertices) | |
| exact (show 1 ≤ (input.val.darts : ℝ) * gap input by | |
| simpa only [gap, mul_comm] using hd).trans | |
| (mul_le_mul_of_nonneg_right hsize (gap_nonnegative input)) | |
| theorem initial_satisfiable_iff (F : Target.Formula) : Satisfiable (initial F) ↔ F.Satisfiable := | |
| RawInitialTables.table_satisfiable_iff F | |
| theorem step_completeness (H : BaseTable) (input : Input) : | |
| Satisfiable input → Satisfiable (step H input) := build_completeness H input.val | |
| theorem step_size (H : BaseTable) (input : Input) : | |
| size (step H input) ≤ sizeFactor * size input := build_size_le H input.val input.property | |
| end UniqueGamesTheorem.Foundations.PCP.RoundTables | |
| /-! Gap amplification for the actual numbered table round. The fixed base | |
| expander is the only supplied construction datum with a spectral certificate. -/ | |
| namespace UniqueGamesTheorem.Foundations.PCP.RoundTableGap | |
| open RoundTables | |
| open PoweringWalks SpectralReturn | |
| variable (H : BaseTable) | |
| (certificate : SpectralCertificate (ExpanderTables.graph H) (1 / 100 : ℝ)) | |
| include certificate | |
| theorem powered_count_gap (input : Input) | |
| (labeling : Fin (powered H input.val).vertices → Fin alphabet) : | |
| RoundGap.poweredLower (gap input) * ((powered H input.val).darts : ℝ) ≤ | |
| ((GenericGraphTables.semantics (powered H input.val)).rejectionCount labeling : ℝ) := by | |
| let old := PreprocessingOverlayTables.overlay | |
| (PreprocessingTables.padded H input.val) (PreprocessingTables.overlayFamily H input.val) | |
| have hd : 0 < (PreprocessingRegularTables.internalDegree + 1) + | |
| PreprocessingRegularTables.internalDegree := by omega | |
| let : Nonempty (Fin ((PreprocessingRegularTables.internalDegree + 1) + | |
| PreprocessingRegularTables.internalDegree)) := ⟨⟨0, hd⟩⟩ | |
| have spectral : SpectralCertificate (lazyGraph (PortTables.portGraph old)) (31 / 32 : ℝ) := | |
| LazySpectral.lazy_certificate_31_32 (PortTables.portGraph old) | |
| (PreprocessingGuarantees.overlay_certificate H certificate input.val) | |
| have lower := PreprocessingGuarantees.gap_transfer_real H certificate input.val input.property | |
| (gap input) (gap_nonnegative input) | |
| (by simpa only [Fintype.card_fin] using | |
| ((GraphTables.semantics input.val).le_gap_iff (gap input)).mp le_rfl) | |
| have hs : (0 : ℝ) < Preprocessing.sizeFactor := Nat.cast_pos.mpr Preprocessing.sizeFactor_positive | |
| have hn : walkParameter = 2 * PoweringSoundness.center 64 FinalConstants.windowHalf := | |
| walkParameter_eq | |
| have bound := PoweringPortReindex.lazy_table_uniform_count_gap_at old | |
| (PreprocessingTables.vertices_positive input.val) hd (31 / 32) spectral | |
| FinalConstants.windowHalf FinalConstants.windowHalf_positive walkParameter hn | |
| (gap input / Preprocessing.sizeFactor) (div_nonneg (gap_nonnegative input) hs.le) | |
| lower labeling | |
| have hw : walkParameter + 1 = FinalConstants.walkLength := by | |
| rw [walkParameter_eq] | |
| rfl | |
| simpa only [RoundGap.poweredLower, PoweringFinalConstants.card_alphabet, | |
| hw, FinalConstants.cap, powered, PreprocessingTables.preprocess, old] using! bound | |
| theorem build_count_gap (input : Input) | |
| (labeling : Fin (build H input.val).vertices → GraphTables.Label) : | |
| min (2 * gap input) FinalConstants.cap * ((build H input.val).darts : ℝ) ≤ | |
| ((GraphTables.semantics (build H input.val)).rejectionCount labeling : ℝ) := by | |
| have h := AlphabetTableBounds.gap_transfer_real alphabet_positive (powered H input.val) | |
| (RoundGap.poweredLower (gap input)) | |
| (RoundGap.poweredLower_nonnegative (gap input) (gap_nonnegative input)) | |
| (powered_count_gap H certificate input) labeling | |
| have scalar : min (2 * gap input) FinalConstants.cap ≤ | |
| RoundGap.poweredLower (gap input) / 12288 := by | |
| simpa only [RoundGap.poweredLower, FinalConstants.cap, FinalConstants.walkLength, | |
| PoweringFinalConstants.center_eq] using | |
| PoweringFinalConstants.composed_scaled_gap (gap input) (gap_nonnegative input) | |
| exact (mul_le_mul_of_nonneg_right scalar (Nat.cast_nonneg _)).trans h | |
| theorem step_gap (input : Input) : | |
| min (2 * gap input) FinalConstants.cap ≤ gap (step H input) := by | |
| apply ((GraphTables.semantics (step H input).val).le_gap_iff _).mpr | |
| simp only [step] | |
| intro labeling | |
| erw [Fintype.card_fin] | |
| exact build_count_gap H certificate input labeling | |
| end UniqueGamesTheorem.Foundations.PCP.RoundTableGap | |
| end OAI | |
Xet Storage Details
- Size:
- 28 kB
- Xet hash:
- 676df50d0b326c37f6ddaf495a5df17a59904c0fe4604ec998f1d4edb1f89e79
·
Xet efficiently stores files, intelligently splitting them into unique chunks and accelerating uploads and downloads. More info.