File size: 2,245 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
import OAI.Computability.PerfectCompleteness.Foundations.StoppedSharedComparison
import OAI.Computability.PerfectCompleteness.Reduction.FixedComparisonErrorsLemmas

namespace OAI

section

namespace PerfectCompleteness.FixedStoppedError

open FixedParameters FixedRows

noncomputable section

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

theorem original_calls_le {root cutoff : Nat}
    (hroot : root ≤ p.plan.depth) (hcut : cutoff ≤ root) :
    OriginalCutCalls.count (rows p.plan) (repeats p.plan) root cutoff ≤ calls p.plan := by
  have h := FixedCallBudget.pairCount_le (rows p.plan) (repeats p.plan)
    hroot (hcut.trans hroot)
  unfold FixedCallBudget.pairCount at h
  unfold calls
  omega

theorem original_calls_add_one_le {root cutoff : Nat}
    (hroot : root ≤ p.plan.depth) (hcut : cutoff ≤ root) :
    OriginalCutCalls.count (rows p.plan) (repeats p.plan) root cutoff + 1 ≤ calls p.plan := by
  have h := FixedCallBudget.pairCount_le (rows p.plan) (repeats p.plan)
    hroot (hcut.trans hroot)
  unfold FixedCallBudget.pairCount at h
  unfold calls
  omega

theorem hidden_error_lt {retained : Nat} (hcalls : retained ≤ calls p.plan) (height : Nat) :
    Real.sqrt ((ChildBlockCardinality.bound (branch p) height (sourceLength p.plan hδ)
      retained (rows p.plan) : ℝ) ^ 2 / branch p height) / 2 < p.accuracy := by
  have h := (FixedComparisonErrors.comparison_errors p hcalls height).1
  simpa only [branch, Nat.cast_pow] using h

theorem stopped_error_lt {root cut : Nat}
    (hroot : root ≤ p.plan.depth) (hcut : cut + 1 ≤ root) :
    StoppedSharedComparison.error (branch p) (rows p.plan) (repeats p.plan)
      root cut (sourceLength p.plan hδ) < p.accuracy :=
  hidden_error_lt p (original_calls_le p hroot hcut) cut

theorem collision_error_lt {root cut : Nat}
    (hroot : root ≤ p.plan.depth) (hcut : cut + 1 ≤ root) :
    Real.sqrt ((ChildBlockCardinality.bound (branch p) cut (sourceLength p.plan hδ)
      (OriginalCutCalls.count (rows p.plan) (repeats p.plan) root (cut + 1) + 1)
      (rows p.plan) : ℝ) ^ 2 / branch p cut) / 2 < p.accuracy :=
  hidden_error_lt p (original_calls_add_one_le p hroot hcut) cut

end
end PerfectCompleteness.FixedStoppedError

end

end OAI