File size: 4,686 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
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
import OAI.Computability.PerfectCompleteness.Foundations.HierarchicalPrediction
import OAI.Computability.PerfectCompleteness.Reduction.HierarchicalFixedAdviceFamilyLemmas

namespace OAI

section

namespace PerfectCompleteness.PreliminaryMatrixAcceptance

noncomputable section

open scoped Classical
open PreliminarySampler TreeSourceSpaces HierarchicalArrays

variable {v m n t : Nat} {branch rows : Nat → Nat}
  (clauses : Fin m → SourceClause.NormalizedClause v)
  (σ : KeyStrategy.Strategy (TreeCanonical.locationCount branch n t))
  (b : Base branch n t m)

theorem observe_iff_matrix_accepts
    (arrays : Arrays (sourceSlots clauses (endpoints b.1)) rows)
    (choice : Choice rows b.2) :
    PreliminaryStrategy.observe clauses σ b arrays choice = true ↔
      CanonicalMatrixTable.Accepts
        (TreeCanonical.numberedSlots (sourceSlots clauses (endpoints b.1)))
        (NodeEmbedding.RowSpace (sourceSlots clauses (endpoints b.1))
          (GeometricPath.nodeAtLevel b.2 choice.1))
        (HierarchicalMatrixTable.other (sourceSlots clauses (endpoints b.1))
          (GeometricPath.nodeAtLevel b.2 choice.1)
          (HierarchicalMatrixTable.backgroundOf (sourceSlots clauses (endpoints b.1))
            (GeometricPath.nodeAtLevel b.2 choice.1) arrays))
        σ choice.2.val (NodeEmbedding.matrix arrays (GeometricPath.nodeAtLevel b.2 choice.1)) := by
  have h := (HierarchicalMatrixTable.accepts_iff_canonical
    (sourceSlots clauses (endpoints b.1)) (GeometricPath.nodeAtLevel b.2 choice.1) σ
    (HierarchicalMatrixTable.backgroundOf (sourceSlots clauses (endpoints b.1))
      (GeometricPath.nodeAtLevel b.2 choice.1) arrays)
    (NodeEmbedding.matrix arrays (GeometricPath.nodeAtLevel b.2 choice.1)) choice.2.val).symm
  rw [HierarchicalMatrixTable.displayed_original] at h
  unfold PreliminaryStrategy.observe
  dsimp only
  constructor
  · intro hobserve
    exact h.mp (@of_decide_eq_true _ _ hobserve)
  · intro haccepts
    exact @decide_eq_true _ _ (h.mpr haccepts)

theorem observe_eq_decide_matrix_accepts
    (arrays : Arrays (sourceSlots clauses (endpoints b.1)) rows)
    (choice : Choice rows b.2) :
    PreliminaryStrategy.observe clauses σ b arrays choice =
      decide (CanonicalMatrixTable.Accepts
        (TreeCanonical.numberedSlots (sourceSlots clauses (endpoints b.1)))
        (NodeEmbedding.RowSpace (sourceSlots clauses (endpoints b.1))
          (GeometricPath.nodeAtLevel b.2 choice.1))
        (HierarchicalMatrixTable.other (sourceSlots clauses (endpoints b.1))
          (GeometricPath.nodeAtLevel b.2 choice.1)
          (HierarchicalMatrixTable.backgroundOf (sourceSlots clauses (endpoints b.1))
            (GeometricPath.nodeAtLevel b.2 choice.1) arrays))
        σ choice.2.val (NodeEmbedding.matrix arrays (GeometricPath.nodeAtLevel b.2 choice.1))) := by
  apply Bool.eq_iff_iff.mpr
  simpa only [decide_eq_true_eq] using observe_iff_matrix_accepts clauses σ b arrays choice

theorem observe_assembled_iff_lower_accepts (upper : Nodes branch n)
    (background : HierarchicalMatrixTable.Background (rows := rows)
      (sourceSlots clauses (endpoints b.1)) upper)
    (X : HierarchicalMatrixTable.Matrix (rows := rows) (sourceSlots clauses (endpoints b.1)) upper)
    (choice : Choice rows b.2) :
    PreliminaryStrategy.observe clauses σ b
        (HierarchicalMatrixTable.assemble (sourceSlots clauses (endpoints b.1)) upper background X)
        choice = true ↔
      HierarchicalPrediction.LowerAccepts (sourceSlots clauses (endpoints b.1)) upper
        background σ (GeometricPath.nodeAtLevel b.2 choice.1) choice.2.val X := by
  unfold PreliminaryStrategy.observe
  dsimp only
  constructor
  · intro hobserve
    have hcanonical := @of_decide_eq_true _ _ hobserve
    exact hcanonical
  · intro haccepts
    exact @decide_eq_true _ _ haccepts

theorem observe_iff_lower_accepts
    (arrays : Arrays (sourceSlots clauses (endpoints b.1)) rows)
    (choice : Choice rows b.2) (upper : Nodes branch n) :
    PreliminaryStrategy.observe clauses σ b arrays choice = true ↔
      HierarchicalPrediction.LowerAccepts (sourceSlots clauses (endpoints b.1)) upper
        (HierarchicalMatrixTable.backgroundOf (sourceSlots clauses (endpoints b.1)) upper arrays)
        σ (GeometricPath.nodeAtLevel b.2 choice.1) choice.2.val (NodeEmbedding.matrix arrays upper) := by
  have h := observe_assembled_iff_lower_accepts clauses σ b upper
    (HierarchicalMatrixTable.backgroundOf (sourceSlots clauses (endpoints b.1)) upper arrays)
    (NodeEmbedding.matrix arrays upper) choice
  rwa [HierarchicalMatrixTable.assemble_original] at h

end
end PerfectCompleteness.PreliminaryMatrixAcceptance

end

end OAI