introvoyz045's picture
Migrated from GitHub
4a56cd6 verified
Raw History Blame Contribute Delete
3.17 kB
import OAI.Computability.PerfectCompleteness.Foundations.WholeCutReplayKeys
namespace OAI
section
namespace PerfectCompleteness.CutSlotAssembly
noncomputable section
open scoped Classical
open RecursiveSpaces DescendantSpaces TreeSourceSpaces
variable {branch : Nat β†’ Nat} {n m : Nat} {V : Type*}
def fill : {n m : Nat} β†’ Path branch n m β†’
(Slots branch n β†’ V) β†’ (Slots branch m β†’ V) β†’ Slots branch n β†’ V
| _, _, .refl _, _, inside, s => inside s
| _, _, .step i p, outside, inside, s =>
if s.1 = i then fill p (fun j => outside (i, j)) inside s.2 else outside s
@[simp] theorem fill_at_cut (p : Path branch n m)
(outside : Slots branch n β†’ V) (inside : Slots branch m β†’ V)
(s : Slots branch m) :
fill p outside inside (p.slotEmbedding s) = inside s := by
revert outside inside s
induction p with
| refl _ => intros; rfl
| step i p ih =>
intro outside inside s
simp only [fill, Path.slotEmbedding]
exact ih (fun j => outside (i, j)) inside s
theorem fill_restrict (p : Path branch n m) (outside : Slots branch n β†’ V) :
fill p outside (fun s => outside (p.slotEmbedding s)) = outside := by
induction p with
| refl _ => rfl
| step i p ih =>
funext s
by_cases hs : s.1 = i
· obtain ⟨j, s⟩ := s
dsimp only at hs
subst j
simp only [fill]
exact congrFun (ih (fun j => outside (i, j))) s
Β· simp only [fill, ite_eq_right hs]
theorem fill_kept_eq (p : Path branch n (m + 1))
(outside : Slots branch n β†’ V) (left right : Slots branch (m + 1) β†’ V)
(clean : Fin (branch m) β†’ Prop)
(h : βˆ€ (i : Fin (branch m)), Β¬ clean i β†’ βˆ€ s, left (i, s) = right (i, s)) :
βˆ€ s, CutSamplerKeyLocality.keptLeaf p clean s β†’
fill p outside left s = fill p outside right s := by
revert outside left right clean h
induction n generalizing m with
| zero =>
have hp := p.height_le
omega
| succ n ih =>
cases p with
| refl =>
intro outside left right clean h s hs
exact h s.1 hs s.2
| step i p =>
intro outside left right clean h s hs
by_cases hi : s.1 = i
Β· simp only [fill, ite_eq_left hi]
exact ih p (fun j => outside (i, j)) left right clean h s.2
(hs.resolve_left (not_not_intro hi))
Β· simp only [fill, ite_eq_right hi]
section Replay
variable {t : Nat} (rows repeats : Nat β†’ Nat)
(p : Path branch n (m + 1))
(outside : Slots branch n β†’ Fin t β†’ MixedSupport.Slot)
(reference target : Slots branch (m + 1) β†’ Fin t β†’ MixedSupport.Slot)
(clean : Fin (branch m) β†’ Prop)
(h : βˆ€ (i : Fin (branch m)), Β¬ clean i β†’ βˆ€ s, reference (i, s) = target (i, s))
def transport (tape : WholeCutReplay.Tape rows repeats p (fill p outside reference) clean) :
WholeCutReplay.Tape rows repeats p (fill p outside target) clean :=
WholeCutReplayKeys.transportTape rows repeats p (fill p outside reference)
(fill p outside target) clean (fill_kept_eq p outside reference target clean h) tape
end Replay
end
end PerfectCompleteness.CutSlotAssembly
end
end OAI