File size: 2,865 Bytes
2f887db
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
import OAI.Computability.PerfectCompleteness.Reduction.FixedTarget

namespace OAI


namespace PerfectCompleteness.FixedTargetValue


open UniqueGamesTheorem.Foundations Target
open FixedParameters FixedRows FixedPreliminaryGame
open scoped Classical

noncomputable section

private theorem packed_value_le (formula : Formula) [NeZero formula.clauses.length]
    (nonempty : formula.clauses ≠ [])
    (distinct : ∀ clause ∈ formula.clauses, ∀ i j : Fin 3,
      clause[i].variableIndex = clause[j].variableIndex → i = j)
    (branch : Nat → Nat) (n t : Nat) (rows repeats : Nat → Nat)
    (hn : 0 < n) (hbranch : ∀ k < n, 0 < branch k)
    (hrows : ∀ k, 0 < rows (k + 1)) (δ : ℚ) (hδ : 0 < δ) :
    (NormalizedTarget.construct (branch := branch) (n := n) (t := t)
      rows repeats hn hbranch hrows δ ⟨formula, nonempty, distinct⟩).value ≤
      PreliminaryOutput.value
        (fun index : Fin formula.clauses.length =>
          ({ clause := PCP.clauseAt formula index
             distinct := fun i j same => distinct _ (List.getElem_mem index.isLt) i j same } :
            SourceClause.NormalizedClause formula.variables))
        branch n t rows repeats hn hbranch hrows + (δ : ℝ) / 3 := by
  have clauses_eq :
      NormalizedSourceInput.clauses ⟨formula, nonempty, distinct⟩ =
        (fun index : Fin formula.clauses.length =>
          ({ clause := PCP.clauseAt formula index
             distinct := fun i j same => distinct _ (List.getElem_mem index.isLt) i j same } :
            SourceClause.NormalizedClause formula.variables)) := by
    funext index
    rfl
  have native :
      (NormalizedTarget.construct (branch := branch) (n := n) (t := t)
        rows repeats hn hbranch hrows δ ⟨formula, nonempty, distinct⟩).value ≤
        PreliminaryOutput.value (NormalizedSourceInput.clauses ⟨formula, nonempty, distinct⟩)
          branch n t rows repeats hn hbranch hrows + (δ : ℝ) / 3 := by
    simpa only [PreliminaryOutput.value] using
      (NormalizedTarget.value_le (branch := branch) (n := n) (t := t)
        rows repeats hn hbranch hrows δ ⟨formula, nonempty, distinct⟩ hδ)
  rw [clauses_eq] at native
  exact native

variable {δ : ℚ} {hδ : 0 < δ} (p : Parameters δ hδ)

theorem value_le (input : List Bool) :
    (FixedTarget.construct p input).value ≤
      FixedPreliminaryGame.value p input + (δ : ℝ) / 3 :=
  packed_value_le (PCPSource.normalizedFormula (BinaryLanguage.totalRename input))
    (PCPSource.normalizedFormula_nonempty (BinaryLanguage.totalRename input))
    (PCPSource.normalizedFormula_distinct (BinaryLanguage.totalRename input))
    (branch p) p.plan.depth (sourceLength p.plan hδ) (rows p.plan) (repeats p.plan)
    (depth_pos p) (fun k _ => branch_pos p k) (fun k => rows_pos p (k + 1)) δ hδ

end
end PerfectCompleteness.FixedTargetValue

end OAI