cfahlgren1/math / lean /OAI /Analysis /Nonexpansive /CandidateLedgerJoin.lean
cfahlgren1's picture
download
raw
12 kB
import OAI.Analysis.Nonexpansive.CandidateLabels
import OAI.Analysis.Nonexpansive.CandidateLevelHistory
import OAI.Analysis.Nonexpansive.CandidateLedger
namespace OAI
/-!
# The candidate ledger of the actual recursively constructed tree
The full ordered candidate groups supply the ledger's records. The actual
positive-support embeddings select its retained entries. Thus its parent
map and its retained maps agree with the tree extracted from the frontier
tower, including all discarded records in every earlier prefix.
-/
noncomputable section
namespace ReflexiveFixedPoints
universe u
variable {X : Type u} [NormedAddCommGroup X] [NormedSpace ℝ X] [CompleteSpace X]
namespace CandidateContext
variable {D : NormalizedMinimalData (X := X)} (C : CandidateContext D)
variable (A : AnchorPoint (tailFamily D.closed D.convex D.T D.nonexpansive))
variable (hanchor : C.anchor = A.x)
variable {τ : ℝ} (hτ : 0 < τ)
/-- The literal immutable history preceding a candidate in the full level. -/
def levelPrefix (i : Fin (OrderedGroupConcat.total (C.groupN A hanchor hτ))) :
List (CandidateRecord C) :=
(C.finalState A hanchor hτ).entries.take i.val
@[simp] theorem levelPrefix_length
(i : Fin (OrderedGroupConcat.total (C.groupN A hanchor hτ))) :
(C.levelPrefix A hanchor hτ i).length = i.val := by
rw [levelPrefix, List.length_take, C.finalState_length_eq_total]
exact Nat.min_eq_left i.isLt.le
/-- The prefix indices are the corresponding initial candidate ordinals. -/
def levelPrefixInclusion
(i : Fin (OrderedGroupConcat.total (C.groupN A hanchor hτ))) :
Fin (C.levelPrefix A hanchor hτ i).length ↪
Fin (OrderedGroupConcat.total (C.groupN A hanchor hτ)) :=
FinitePrefix.inclusion (by rw [C.levelPrefix_length]; exact i.isLt.le)
/-- Reading the immutable prefix returns exactly the full ledger record. -/
theorem levelPrefix_get
(i : Fin (OrderedGroupConcat.total (C.groupN A hanchor hτ)))
(j : Fin (C.levelPrefix A hanchor hτ i).length) :
(C.levelPrefix A hanchor hτ i).get j =
C.levelRecord A hanchor hτ (C.levelPrefixInclusion A hanchor hτ i j) := by
change ((C.finalState A hanchor hτ).entries.take i.val)[j.val] = _
rw [List.getElem_take]
exact C.finalState_get_levelRecord A hanchor hτ
(C.levelPrefixInclusion A hanchor hτ i j)
/-- Legality was established against this literal preceding prefix. -/
theorem levelPrefix_legal
(i : Fin (OrderedGroupConcat.total (C.groupN A hanchor hτ))) :
C.Legal (C.levelPrefix A hanchor hτ i) (C.levelRecord A hanchor hτ i) :=
C.levelRecord_legal A hanchor hτ i
/-- The retained record stores the very map installed in the extension. -/
theorem levelRecord_retainedCandidate_map
(v : Fin (C.selectedExtension A hanchor).size) :
(C.levelRecord A hanchor C.runTolerance_pos
(C.retainedCandidate A hanchor v)).map =
(C.selectedExtension A hanchor).map v := by
obtain ⟨⟨p, j⟩, rfl⟩ :=
(OrderedGroupConcat.equiv
(fun p => (C.group A hanchor C.runTolerance_pos p).q)).surjective v
change (C.levelRecord A hanchor C.runTolerance_pos
(C.retainedCandidate A hanchor (OrderedGroupConcat.group
(fun p => (C.group A hanchor C.runTolerance_pos p).q) p j))).map = _
rw [C.retainedCandidate_group]
change (C.levelRecord A hanchor C.runTolerance_pos
(OrderedGroupConcat.group (C.groupN A hanchor C.runTolerance_pos) p
((C.group A hanchor C.runTolerance_pos p).retain j))).map = _
rw [C.levelRecord_group A hanchor C.runTolerance_pos p
((C.group A hanchor C.runTolerance_pos p).retain j),
(C.group A hanchor C.runTolerance_pos p).record_map]
exact (C.levelExtension_map_group A hanchor C.runTolerance_pos p j).symm
end CandidateContext
namespace AnchoredCandidateContext
variable (D : NormalizedMinimalData (X := X))
variable (A : AnchorPoint (tailFamily D.closed D.convex D.T D.nonexpansive))
variable (U : Ultrafilter ℕ)
/-- The concrete ledger retains every candidate chosen at this level. -/
def candidateLedger (k : ℕ) :
CandidateLedger (tower D A U).toOrderedTree k
(CandidateRecord (context D A U k)) where
count := (context D A U k).candidateCount A (context_anchor D A U k)
parent := OrderedGroupConcat.parent
((context D A U k).groupN A (context_anchor D A U k)
(context D A U k).runTolerance_pos)
parent_monotone := OrderedGroupConcat.parent_monotone _
point := (context D A U k).levelRecord A (context_anchor D A U k)
(context D A U k).runTolerance_pos
retain := retainedCandidate D A U k
parent_retain := by
intro v
change OrderedGroupConcat.parent
((context D A U k).groupN A (context_anchor D A U k)
(context D A U k).runTolerance_pos)
((context D A U k).retainedCandidate A (context_anchor D A U k)
((tower D A U).nextNode k v)) =
((context D A U k).selectedExtension A (context_anchor D A U k)).parent
((tower D A U).nextNode k v)
exact (context D A U k).retainedCandidate_parent A
(context_anchor D A U k) ((tower D A U).nextNode k v)
@[simp] theorem candidateLedger_count (k : ℕ) :
(candidateLedger D A U k).count =
(context D A U k).candidateCount A (context_anchor D A U k) := rfl
@[simp] theorem candidateLedger_retain (k : ℕ)
(v : (tower D A U).toOrderedTree.Node (k + 1)) :
(candidateLedger D A U k).retain v = retainedCandidate D A U k v := rfl
/-- Each ledger entry's stored parent equals its ordered ledger parent. -/
theorem candidateLedger_point_parent (k : ℕ)
(i : Fin (candidateLedger D A U k).count) :
((candidateLedger D A U k).point i).parent =
(candidateLedger D A U k).parent i :=
(context D A U k).levelRecord_parent A (context_anchor D A U k)
(context D A U k).runTolerance_pos i
/-- Retaining a record preserves the parent of the final tree node. -/
theorem candidateLedger_retainedPoint_parent (k : ℕ)
(v : (tower D A U).toOrderedTree.Node (k + 1)) :
((candidateLedger D A U k).retainedPoint v).parent =
(tower D A U).toOrderedTree.parent k v := by
rw [CandidateLedger.retainedPoint, candidateLedger_point_parent,
CandidateLedger.parent_retain]
/-- The retained point is the actual map used by the infinite evaluator. -/
theorem candidateLedger_retainedPoint_map (k : ℕ)
(v : (tower D A U).toOrderedTree.Node (k + 1)) :
((candidateLedger D A U k).retainedPoint v).map =
(tower D A U).toEvaluation.map (k + 1) v := by
change ((context D A U k).levelRecord A (context_anchor D A U k)
(context D A U k).runTolerance_pos
((context D A U k).retainedCandidate A (context_anchor D A U k)
((tower D A U).nextNode k v))).map = _
exact ((context D A U k).levelRecord_retainedCandidate_map A
(context_anchor D A U k) ((tower D A U).nextNode k v)).trans
((tower D A U).toEvaluation_map_succ k v).symm
/-- Each actual retained map carries its original generation derivation. -/
theorem candidateLedger_retainedPoint_generated (k : ℕ)
(v : (tower D A U).toOrderedTree.Node (k + 1)) :
Generated D.closed D.convex D.T D.nonexpansive
(((candidateLedger D A U k).retainedPoint v).map) :=
((candidateLedger D A U k).retainedPoint v).generated
/-- The detector functional is the one chosen for this candidate record. -/
def candidateFunctional (k : ℕ)
(v : (tower D A U).toOrderedTree.Node (k + 1)) : X →L[ℝ] ℝ :=
((candidateLedger D A U k).retainedPoint v).functional
/-- The same actual ledger, evaluated at the single fixed anchor. -/
def candidatePointLedger (k : ℕ) :
CandidateLedger (tower D A U).toOrderedTree k D.K where
count := (candidateLedger D A U k).count
parent := (candidateLedger D A U k).parent
parent_monotone := (candidateLedger D A U k).parent_monotone
point := fun i => ((candidateLedger D A U k).point i).map A.x
retain := (candidateLedger D A U k).retain
parent_retain := (candidateLedger D A U k).parent_retain
/-- Its retained outputs are the actual final tree maps at the fixed anchor. -/
theorem candidatePointLedger_retainedPoint (k : ℕ)
(v : (tower D A U).toOrderedTree.Node (k + 1)) :
(candidatePointLedger D A U k).retainedPoint v =
(tower D A U).toEvaluation.map (k + 1) v A.x := by
change ((candidateLedger D A U k).retainedPoint v).map A.x = _
rw [candidateLedger_retainedPoint_map]
@[simp] theorem candidatePointLedger_earlierParent (k : ℕ)
(v : (tower D A U).toOrderedTree.Node (k + 1)) :
(candidatePointLedger D A U k).earlierParent v =
(candidateLedger D A U k).earlierParent v := rfl
@[simp] theorem candidatePointLedger_earlierPoint (k : ℕ)
(v : (tower D A U).toOrderedTree.Node (k + 1))
(i : (candidatePointLedger D A U k).Earlier v) :
(candidatePointLedger D A U k).earlierPoint v i =
((candidateLedger D A U k).earlierPoint v i).map A.x := rfl
/-- The actual history at the instant this retained candidate was chosen. -/
def candidatePrefix (k : ℕ)
(v : (tower D A U).toOrderedTree.Node (k + 1)) :
List (CandidateRecord (context D A U k)) :=
(context D A U k).levelPrefix A (context_anchor D A U k)
(context D A U k).runTolerance_pos ((candidateLedger D A U k).retain v)
@[simp] theorem candidatePrefix_length (k : ℕ)
(v : (tower D A U).toOrderedTree.Node (k + 1)) :
(candidatePrefix D A U k v).length = ((candidateLedger D A U k).retain v).val :=
(context D A U k).levelPrefix_length A (context_anchor D A U k)
(context D A U k).runTolerance_pos _
/-- This equivalence only changes the proof of the same prefix length. -/
def candidatePrefixIndex (k : ℕ)
(v : (tower D A U).toOrderedTree.Node (k + 1)) :
Fin (candidatePrefix D A U k v).length ≃
(candidatePointLedger D A U k).Earlier v :=
finCongr (candidatePrefix_length D A U k v)
@[simp] theorem candidatePrefixIndex_val (k : ℕ)
(v : (tower D A U).toOrderedTree.Node (k + 1))
(i : Fin (candidatePrefix D A U k v).length) :
(candidatePrefixIndex D A U k v i).val = i.val := rfl
/-- Every earlier ledger entry is the record in the actual earlier history. -/
theorem candidatePrefix_record (k : ℕ)
(v : (tower D A U).toOrderedTree.Node (k + 1))
(i : Fin (candidatePrefix D A U k v).length) :
(candidatePrefix D A U k v).get i =
(candidateLedger D A U k).earlierPoint v
(candidatePrefixIndex D A U k v i) :=
(context D A U k).levelPrefix_get A (context_anchor D A U k)
(context D A U k).runTolerance_pos _ i
/-- The history and the final prediction parameter use the same parent labels. -/
theorem candidatePrefix_parent (k : ℕ)
(v : (tower D A U).toOrderedTree.Node (k + 1))
(i : Fin (candidatePrefix D A U k v).length) :
(context D A U k).historyParent (candidatePrefix D A U k v) i =
(candidatePointLedger D A U k).earlierParent v
(candidatePrefixIndex D A U k v i) := by
change ((candidatePrefix D A U k v).get i).parent = _
rw [candidatePrefix_record]
exact candidateLedger_point_parent D A U k _
/-- History outputs and the prediction ledger agree at the original anchor. -/
theorem candidatePrefix_point (k : ℕ)
(v : (tower D A U).toOrderedTree.Node (k + 1))
(i : Fin (candidatePrefix D A U k v).length) :
(context D A U k).historyPoint (candidatePrefix D A U k v) i =
(candidatePointLedger D A U k).earlierPoint v
(candidatePrefixIndex D A U k v i) := by
change ((candidatePrefix D A U k v).get i).map (context D A U k).anchor = _
rw [candidatePrefix_record, context_anchor]
rfl
/-- The retained candidate's detector was proved for this exact prefix. -/
theorem candidatePrefix_legal (k : ℕ)
(v : (tower D A U).toOrderedTree.Node (k + 1)) :
(context D A U k).Legal (candidatePrefix D A U k v)
((candidateLedger D A U k).retainedPoint v) :=
(context D A U k).levelPrefix_legal A (context_anchor D A U k)
(context D A U k).runTolerance_pos _
end AnchoredCandidateContext
end ReflexiveFixedPoints
end
end OAI

Xet Storage Details

Size:
12 kB
·
Xet hash:
6112f1b32f0f9a55dc6b2fdc8023d5ce4768bd2ca9f1bf30668ddb85fa186df0

Xet efficiently stores files, intelligently splitting them into unique chunks and accelerating uploads and downloads. More info.