File size: 8,919 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 103 104 105 106 107 108 109 110 111 112 113 114 115 116 117 118 119 120 121 122 123 124 125 126 127 128 129 130 131 132 133 134 135 136 137 138 139 140 141 142 143 144 145 146 147 148 149 150 151 152 153 154 155 156 157 158 159 160 161 162 163 164 165 166 167 168 169 170 171 172 | import OAI.Computability.PerfectCompleteness.Foundations.CanonicalEdgesLemmas
import OAI.Computability.PerfectCompleteness.Foundations.QuotientTableAgreementLemmas
import OAI.Computability.PerfectCompleteness.Machines.CanonicalLabelEncoding
namespace OAI
section
namespace PerfectCompleteness.CanonicalCoarseningEncoding
open MixedSupport CanonicalKeys CanonicalEdges
noncomputable section
universe uY uY' uZ uZ'
variable {n : Nat} {Y : Type uY} {Y' : Type uY'} {Z : Type uZ} {Z' : Type uZ'}
theorem fineKernel (slots : Fin n → Slot) (f : Assignment slots → Y)
(eL : Y → Y') (heL : Function.Injective eL) :
∀ x x', f x = f x' ↔ (eL ∘ f) x = (eL ∘ f) x' := by
intro x x'
exact ⟨fun h => congrArg eL h, fun h => heL h⟩
theorem coarseKernel (slots : Fin n → Slot) (f : Assignment slots → Y)
(p : Y → Z) (eL : Y → Y') (eR : Z → Z') (p' : Y' → Z')
(heR : Function.Injective eR) (commutes : ∀ y, p' (eL y) = eR (p y)) :
∀ x x', (p ∘ f) x = (p ∘ f) x' ↔
(p' ∘ (eL ∘ f)) x = (p' ∘ (eL ∘ f)) x' := by
intro x x'
change p (f x) = p (f x') ↔ p' (eL (f x)) = p' (eL (f x'))
rw [commutes (f x), commutes (f x')]
exact ⟨fun h => congrArg eR h, fun h => heR h⟩
theorem key_fine (side : Side) (slots : Fin n → Slot) (f : Assignment slots → Y)
(eL : Y → Y') (heL : Function.Injective eL) :
key side slots (eL ∘ f) = key side slots f :=
key_postcomp_injective side slots f eL heL
theorem key_coarse (side : Side) (slots : Fin n → Slot) (f : Assignment slots → Y)
(p : Y → Z) (eL : Y → Y') (eR : Z → Z') (p' : Y' → Z')
(heR : Function.Injective eR) (commutes : ∀ y, p' (eL y) = eR (p y)) :
key side slots (p' ∘ (eL ∘ f)) = key side slots (p ∘ f) :=
(key_kernel_invariant side slots (p ∘ f) (p' ∘ (eL ∘ f))
(coarseKernel slots f p eL eR p' heR commutes)).symm
def transportFine (slots : Fin n → Slot) (f : Assignment slots → Y)
(eL : Y → Y') (heL : Function.Injective eL) (P : Label slots f) :
Label slots (eL ∘ f) :=
transportKernel slots f (eL ∘ f) (fineKernel slots f eL heL) P
def transportCoarse (slots : Fin n → Slot) (f : Assignment slots → Y)
(p : Y → Z) (eL : Y → Y') (eR : Z → Z') (p' : Y' → Z')
(heR : Function.Injective eR) (commutes : ∀ y, p' (eL y) = eR (p y))
(Q : Label slots (p ∘ f)) : Label slots (p' ∘ (eL ∘ f)) :=
transportKernel slots (p ∘ f) (p' ∘ (eL ∘ f))
(coarseKernel slots f p eL eR p' heR commutes) Q
@[simp] theorem transportFine_val (slots : Fin n → Slot) (f : Assignment slots → Y)
(eL : Y → Y') (heL : Function.Injective eL) (P : Label slots f) :
(transportFine slots f eL heL P).val = P.val := rfl
@[simp] theorem transportCoarse_val (slots : Fin n → Slot) (f : Assignment slots → Y)
(p : Y → Z) (eL : Y → Y') (eR : Z → Z') (p' : Y' → Z')
(heR : Function.Injective eR) (commutes : ∀ y, p' (eL y) = eR (p y))
(Q : Label slots (p ∘ f)) :
(transportCoarse slots f p eL eR p' heR commutes Q).val = Q.val := rfl
theorem transportFine_bijective (slots : Fin n → Slot) (f : Assignment slots → Y)
(eL : Y → Y') (heL : Function.Injective eL) :
Function.Bijective (transportFine slots f eL heL) :=
transportKernel_bijective slots f (eL ∘ f) (fineKernel slots f eL heL)
theorem restore_transportFine (slots : Fin n → Slot) (f : Assignment slots → Y)
(eL : Y → Y') (heL : Function.Injective eL) (P : Label slots f) :
restore slots (eL ∘ f) (transportFine slots f eL heL P) = eL (restore slots f P) :=
restore_transportKernel slots f (eL ∘ f) (fineKernel slots f eL heL)
eL (fun _ => rfl) P
theorem restore_transportCoarse (slots : Fin n → Slot) (f : Assignment slots → Y)
(p : Y → Z) (eL : Y → Y') (eR : Z → Z') (p' : Y' → Z')
(heR : Function.Injective eR) (commutes : ∀ y, p' (eL y) = eR (p y))
(Q : Label slots (p ∘ f)) :
restore slots (p' ∘ (eL ∘ f)) (transportCoarse slots f p eL eR p' heR commutes Q) =
eR (restore slots (p ∘ f) Q) :=
restore_transportKernel slots (p ∘ f) (p' ∘ (eL ∘ f))
(coarseKernel slots f p eL eR p' heR commutes) eR (fun x => commutes (f x)) Q
theorem coarsen_transport (slots : Fin n → Slot) (f : Assignment slots → Y)
(p : Y → Z) (eL : Y → Y') (eR : Z → Z') (p' : Y' → Z')
(heL : Function.Injective eL) (heR : Function.Injective eR)
(commutes : ∀ y, p' (eL y) = eR (p y)) (P : Label slots f) :
transportCoarse slots f p eL eR p' heR commutes (coarsen slots f p P) =
coarsen slots (eL ∘ f) p' (transportFine slots f eL heL P) := by
apply restore_injective slots (p' ∘ (eL ∘ f))
calc
restore slots (p' ∘ (eL ∘ f))
(transportCoarse slots f p eL eR p' heR commutes (coarsen slots f p P)) =
eR (restore slots (p ∘ f) (coarsen slots f p P)) :=
restore_transportCoarse slots f p eL eR p' heR commutes (coarsen slots f p P)
_ = eR (p (restore slots f P)) := congrArg eR (restore_coarsen slots f p P)
_ = p' (eL (restore slots f P)) := (commutes (restore slots f P)).symm
_ = p' (restore slots (eL ∘ f) (transportFine slots f eL heL P)) :=
congrArg p' (restore_transportFine slots f eL heL P).symm
_ = restore slots (p' ∘ (eL ∘ f))
(coarsen slots (eL ∘ f) p' (transportFine slots f eL heL P)) :=
(restore_coarsen slots (eL ∘ f) p' (transportFine slots f eL heL P)).symm
theorem coarsen_val (slots : Fin n → Slot) (f : Assignment slots → Y)
(p : Y → Z) (eL : Y → Y') (eR : Z → Z') (p' : Y' → Z')
(heL : Function.Injective eL) (heR : Function.Injective eR)
(commutes : ∀ y, p' (eL y) = eR (p y)) (P : Label slots f) :
(coarsen slots f p P).val =
(coarsen slots (eL ∘ f) p' (transportFine slots f eL heL P)).val :=
congrArg Subtype.val (coarsen_transport slots f p eL eR p' heL heR commutes P)
@[simp] theorem partIndex_transportFine (slots : Fin n → Slot) (f : Assignment slots → Y)
(eL : Y → Y') (heL : Function.Injective eL) (P : Label slots f) :
CanonicalKeyEncoding.partEnum n (transportFine slots f eL heL P).val =
CanonicalKeyEncoding.partEnum n P.val := rfl
theorem partIndex_coarsen (slots : Fin n → Slot) (f : Assignment slots → Y)
(p : Y → Z) (eL : Y → Y') (eR : Z → Z') (p' : Y' → Z')
(heL : Function.Injective eL) (heR : Function.Injective eR)
(commutes : ∀ y, p' (eL y) = eR (p y)) (P : Label slots f) :
CanonicalKeyEncoding.partEnum n (coarsen slots f p P).val =
CanonicalKeyEncoding.partEnum n
(coarsen slots (eL ∘ f) p' (transportFine slots f eL heL P)).val :=
congrArg (CanonicalKeyEncoding.partEnum n)
(coarsen_val slots f p eL eR p' heL heR commutes P)
theorem labelIndex_coarsen (side : Side) (slots : Fin n → Slot)
(f : Assignment slots → Y) (p : Y → Z) (eL : Y → Y') (eR : Z → Z') (p' : Y' → Z')
(heL : Function.Injective eL) (heR : Function.Injective eR)
(commutes : ∀ y, p' (eL y) = eR (p y)) (P : Label slots f) :
CanonicalLabelEncoding.labelIndex (key side slots (p ∘ f)) (coarsen slots f p P) =
CanonicalLabelEncoding.labelIndex (key side slots (p' ∘ (eL ∘ f)))
(coarsen slots (eL ∘ f) p' (transportFine slots f eL heL P)) :=
partIndex_coarsen slots f p eL eR p' heL heR commutes P
@[simp] theorem labelEmbedding_transportFine {q : Nat} (side : Side)
(large : CanonicalKeyEncoding.partitionWidth n ≤ q)
(slots : Fin n → Slot) (f : Assignment slots → Y)
(eL : Y → Y') (heL : Function.Injective eL) (P : Label slots f) :
CanonicalLabelEncoding.labelEmbedding (key side slots (eL ∘ f)) large
(transportFine slots f eL heL P) =
CanonicalLabelEncoding.labelEmbedding (key side slots f) large P := rfl
theorem labelEmbedding_coarsen {q : Nat} (side : Side)
(large : CanonicalKeyEncoding.partitionWidth n ≤ q)
(slots : Fin n → Slot) (f : Assignment slots → Y)
(p : Y → Z) (eL : Y → Y') (eR : Z → Z') (p' : Y' → Z')
(heL : Function.Injective eL) (heR : Function.Injective eR)
(commutes : ∀ y, p' (eL y) = eR (p y)) (P : Label slots f) :
CanonicalLabelEncoding.labelEmbedding (key side slots (p ∘ f)) large
(coarsen slots f p P) =
CanonicalLabelEncoding.labelEmbedding (key side slots (p' ∘ (eL ∘ f))) large
(coarsen slots (eL ∘ f) p' (transportFine slots f eL heL P)) := by
apply Fin.ext
change (CanonicalKeyEncoding.partEnum n (coarsen slots f p P).val).val =
(CanonicalKeyEncoding.partEnum n
(coarsen slots (eL ∘ f) p' (transportFine slots f eL heL P)).val).val
exact congrArg (fun i : Fin (CanonicalKeyEncoding.partitionWidth n) => i.val)
(partIndex_coarsen slots f p eL eR p' heL heR commutes P)
end
end PerfectCompleteness.CanonicalCoarseningEncoding
end
end OAI
|