File size: 3,916 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
65
66
67
68
69
70
71
72
import Mathlib
import OAI.Computability.MinUncut.Machines.MachineTableIteration
import OAI.Computability.MinUncut.Graphs.GeneratedGraph
import OAI.Computability.MinUncut.Estimates.SelectedSyntax

namespace OAI

section
noncomputable section
namespace MinUncut.Uniform
open MinUncut.Preprocess MinUncut.Inner MinUncut.Outer MinUncut.SourceBridge
open MinUncut.Costed MinUncut.Costed.SourceWords
open MinUncutGames MinUncutGames.Foundations MinUncutGames.Foundations.Complexity
open MinUncutGames.Foundations.Hastad MinUncutGames.Foundations.Hastad.SourceOccurrences
open MinUncutGames.Reduction

def frontend (F : BinaryFormula.Formula) : SourceGeneratorContract.NonemptyFormula :=
  MinUncutGames.Outer.HastadSource.gapInput Parameters.baseTable (BinaryOccurrenceRename.renamed F)
def frontendMachine : Turing.TM2ComputableInPolyTime BinaryEncoding.formulaBits
    SourceGeneratorContract.inputEncoding frontend :=
  MachineSequential.composeBits (f := BinaryOccurrenceRename.renamed)
    (g := MinUncutGames.Outer.HastadSource.gapInput Parameters.baseTable) BinaryRenameMachine.computableInPolyTime
    (MinUncutGames.Outer.HastadSource.gapMachine Parameters.baseTable)
lemma frontend_finite : MachineFiniteAlphabet.FiniteAlphabet frontendMachine.tm :=
  MachineFiniteAlphabet.composeBits _ _ BinaryRenameMachine.computation_finiteAlphabet
    (TableIterationFiniteAlphabet.gapMap Parameters.baseTable
      (MinUncutGames.Outer.HastadSource.roundMachine Parameters.baseTable)
      (MinUncutGames.Outer.HastadSource.roundMachine_finite Parameters.baseTable))

def program (K : ℕ) := completeGraphProgram (selectedParameters K) (chosenEnumeration K)
  (chosenRepetition K) (chosenNoise K)
lemma program_computable : Computable (fun K=>(program K).code) := c_selectedGraphCode

def source (K : ℕ) (F : BinaryFormula.Formula) : SourceEncoding.Input :=
  (selectedParameters K).sourceReduction.reduce F
lemma source_eq (K : ℕ) (F : BinaryFormula.Formula) :
    source K F=sourceInput (frontend F).val (chosenRepetition K) (chosenNoise K)
      (SourceNoiseParameter.noiseDenominator_pos (chosenError K)) := rfl

def output (K : ℕ) (F : BinaryFormula.Formula) : MinUncut.Output :=
  generatedGraph (selectedParameters K) (source K F) (chosenEnumeration K)
lemma output_yes (K : ℕ) (F : BinaryFormula.Formula) (hF : F.Satisfiable) :
    (output K F).opt≤(output K F).threshold := by
  obtain ⟨s,hs⟩:=binaryReduction_complete (selectedParameters K).sourceReduction F hF
    (selectedParameters K).o.t (selectedParameters K).o.b4 (selectedParameters K).sourceError_budget
  exact generatedGraph_yes (selectedParameters K) (source K F) (chosenEnumeration K) s hs
lemma output_no (K : ℕ) (hK : 2≤K) (F : BinaryFormula.Formula) (hF : ¬F.Satisfiable) :
    K*(output K F).threshold<(output K F).opt := by
  apply generatedGraph_no (selectedParameters K) (source K F) (chosenEnumeration K) hK
    (show 8*K≤parameterJ K by unfold parameterJ; omega)
  exact binaryReduction_sound (selectedParameters K).sourceError_small
    (selectedParameters K).sourceReduction F hF

lemma output_words (K : ℕ) (F : BinaryFormula.Formula) :
    ∃table junk,completeGraphWords (selectedParameters K) (chosenEnumeration K)
      (chosenRepetition K) (chosenNoise K) (formulaWords (frontend F).val)=
      (output K F).vertices::((table : List Bool).map Bool.toNat++2::(output K F).threshold::junk) ∧
      (output K F).bits=BinaryEncoding.nameBits (output K F).vertices++table++
        BinaryEncoding.nameBits (output K F).threshold := by
  obtain ⟨junk,hj⟩:=completeGraphWords_spec (selectedParameters K) (chosenEnumeration K)
    (frontend F).val (chosenRepetition K) (chosenNoise K)
    (SourceNoiseParameter.noiseDenominator_pos (chosenError K)) (frontend F).property
  rw [←source_eq] at hj
  refine ⟨_,junk,hj,?_⟩
  exact GraphRegisters.listOutput_bits _ _ _
end MinUncut.Uniform

end
end

end OAI