File size: 4,404 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 101 102 | import OAI.Computability.PerfectCompleteness.Algebra.PreliminaryMatrixAcceptance
import OAI.Computability.PerfectCompleteness.Foundations.PrefixTests
import OAI.Computability.PerfectCompleteness.Machines.StoppedOwnInputGeometry
namespace OAI
section
namespace PerfectCompleteness.PrefixMatrixAcceptance
noncomputable section
open scoped Classical
open RecursiveSpaces DescendantSpaces TreeSourceSpaces HierarchicalArrays
variable {branch rows : Nat → Nat} {v m n t : Nat}
(clauses : Fin m → SourceClause.NormalizedClause v)
(σ : KeyStrategy.Strategy (TreeCanonical.locationCount branch n t))
(questions : PreliminarySampler.Questions branch n t m)
local notation "slots" => sourceSlots clauses (PreliminarySampler.endpoints questions)
theorem observe_iff_matrix
(arrays : Arrays slots rows) (level : Fin n)
(node : PrefixTests.LevelNode branch level)
(a : PrefixTests.LevelDirection rows level) :
PrefixTests.observeAtLevelNode clauses σ questions arrays level node a = true ↔
CanonicalMatrixTable.Accepts (TreeCanonical.numberedSlots slots)
(NodeEmbedding.RowSpace slots node.val)
(HierarchicalMatrixTable.other slots node.val
(HierarchicalMatrixTable.backgroundOf slots node.val arrays))
σ (PrefixTests.nodeDirection rows level node a).val
(NodeEmbedding.matrix arrays node.val) := by
have h := (HierarchicalMatrixTable.accepts_iff_canonical slots node.val σ
(HierarchicalMatrixTable.backgroundOf slots node.val arrays)
(NodeEmbedding.matrix arrays node.val)
(PrefixTests.nodeDirection rows level node a).val).symm
rw [HierarchicalMatrixTable.displayed_original] at h
unfold PrefixTests.observeAtLevelNode
dsimp only
constructor
· intro hevent
exact h.mp (@of_decide_eq_true _ _ hevent)
· intro haccept
exact @decide_eq_true _ _ (h.mpr haccept)
theorem observe_iff_lower
(arrays : Arrays slots rows) (level : Fin n)
(node : PrefixTests.LevelNode branch level)
(a : PrefixTests.LevelDirection rows level) (upper : Nodes branch n) :
PrefixTests.observeAtLevelNode clauses σ questions arrays level node a = true ↔
HierarchicalPrediction.LowerAccepts slots upper
(HierarchicalMatrixTable.backgroundOf slots upper arrays) σ node.val
(PrefixTests.nodeDirection rows level node a).val
(NodeEmbedding.matrix arrays upper) := by
unfold HierarchicalPrediction.LowerAccepts
rw [HierarchicalMatrixTable.displayed_original]
unfold PrefixTests.observeAtLevelNode
dsimp only
constructor
· intro hevent
exact @of_decide_eq_true _ _ hevent
· intro haccept
exact @decide_eq_true _ _ haccept
theorem observe_eq_lower
(arrays : Arrays slots rows) (level : Fin n)
(node : PrefixTests.LevelNode branch level)
(a : PrefixTests.LevelDirection rows level) (upper : Nodes branch n) :
PrefixTests.observeAtLevelNode clauses σ questions arrays level node a =
decide (HierarchicalPrediction.LowerAccepts slots upper
(HierarchicalMatrixTable.backgroundOf slots upper arrays) σ node.val
(PrefixTests.nodeDirection rows level node a).val
(NodeEmbedding.matrix arrays upper)) := by
apply Bool.eq_iff_iff.mpr
simpa only [decide_eq_true_eq] using
observe_iff_lower clauses σ questions arrays level node a upper
theorem observe_endpoint {k : Nat} (p : Path branch n (k + 1))
(suffix : Slots branch (k + 1)) (arrays : Arrays slots rows)
(a : PrefixTests.LevelDirection rows
(⟨k, Nat.lt_of_lt_of_le (Nat.lt_succ_self k) p.height_le⟩ : Fin n)) :
PreliminaryStrategy.observe clauses σ (questions, p.slotEmbedding suffix) arrays
(PrefixTests.choiceAt rows (p.slotEmbedding suffix)
⟨k, Nat.lt_of_lt_of_le (Nat.lt_succ_self k) p.height_le⟩ a) =
PrefixTests.observeAtLevelNode clauses σ questions arrays
⟨k, Nat.lt_of_lt_of_le (Nat.lt_succ_self k) p.height_le⟩
⟨WholeArrayInteriorExterior.upperNode p,
WholeArrayInteriorExterior.upperNode_height p⟩ a := by
rw [PrefixTests.observe_choiceAt_eq]
apply congrArg (fun node => PrefixTests.observeAtLevelNode clauses σ questions arrays
⟨k, Nat.lt_of_lt_of_le (Nat.lt_succ_self k) p.height_le⟩ node a)
apply Subtype.ext
exact StoppedOwnInputGeometry.nodeAtLevel_endpoint p suffix
end
end PerfectCompleteness.PrefixMatrixAcceptance
end
end OAI
|