Download data/lean/OAI/Computability/PerfectCompleteness/Foundations/CanonicalKeys.lean from introvoyz045/math: direct link, hf CLI and curl.
- Browser
- Download file 5.44 kB
-
https://huggingface.co/datasets/introvoyz045/math/resolve/main/data/lean/OAI/Computability/PerfectCompleteness/Foundations/CanonicalKeys.lean
- Command line
-
hf download hf://datasets/introvoyz045/math/data/lean/OAI/Computability/PerfectCompleteness/Foundations/CanonicalKeys.lean
-
curl -L -o CanonicalKeys.lean https://huggingface.co/datasets/introvoyz045/math/resolve/main/data/lean/OAI/Computability/PerfectCompleteness/Foundations/CanonicalKeys.lean
5.44 kB
| import OAI.Computability.PerfectCompleteness.Foundations.RecursiveSpaceEquivLemmas | |
| import OAI.Computability.PerfectCompleteness.Foundations.ReducedDomains | |
| namespace OAI | |
| section | |
| namespace PerfectCompleteness.CanonicalKeys | |
| open ClauseSupport MixedSupport | |
| variable {n : Nat} {Y : Type*} | |
| inductive Side where | |
| | left | |
| | right | |
| deriving DecidableEq | |
| structure Key (n : Nat) where | |
| side : Side | |
| retained : List (Fin n Γ SlotKey) | |
| partition : Set (Set (Fin n β ReducedValue)) | |
| noncomputable def partition (slots : Fin n β Slot) (f : Assignment slots β Y) : | |
| Set (Set (Fin n β ReducedValue)) := | |
| ReducedPartition.parts (reduction slots f) f | |
| noncomputable def key (side : Side) (slots : Fin n β Slot) | |
| (f : Assignment slots β Y) : Key n := | |
| β¨side, retainedKeys slots f, partition slots fβ© | |
| theorem constantOnFibers (slots : Fin n β Slot) (f : Assignment slots β Y) : | |
| ReducedPartition.ConstantOnFibers (reduction slots f) f := by | |
| intro x x' h | |
| exact constant_on_reduction_fibers slots f h | |
| theorem covered_iff_legal (slots : Fin n β Slot) (f : Assignment slots β Y) | |
| (values : Fin n β ReducedValue) : | |
| (β P β partition slots f, values β P) β | |
| values β ReducedDomains.legalAssignments (keyFields slots f) := by | |
| rw [β ReducedDomains.range_reduction slots f] | |
| exact ReducedPartition.covered_iff_mem_range (reduction slots f) f values | |
| theorem legal_domain_projection {slots projected : Fin n β Slot} | |
| (p : β i, Projection (slots i) (projected i)) (f : Assignment projected β Y) : | |
| ReducedDomains.legalAssignments (keyFields slots (f β projectionMap p)) = | |
| ReducedDomains.legalAssignments (keyFields projected f) := by | |
| rw [keyFields_projection] | |
| theorem partition_projection {slots projected : Fin n β Slot} | |
| (p : β i, Projection (slots i) (projected i)) (f : Assignment projected β Y) : | |
| partition slots (f β projectionMap p) = partition projected f := by | |
| exact ReducedPartition.parts_eq_of_pullback | |
| (projectionMap p) (projectionMap_surjective p) | |
| (reduction slots (f β projectionMap p)) (reduction projected f) | |
| (f β projectionMap p) f (reduction_projection p f) (fun _ => rfl) | |
| theorem key_projection (side : Side) {slots projected : Fin n β Slot} | |
| (p : β i, Projection (slots i) (projected i)) (f : Assignment projected β Y) : | |
| key side slots (f β projectionMap p) = key side projected f := by | |
| simp only [key, retainedKeys_projection, partition_projection] | |
| abbrev Label (slots : Fin n β Slot) (f : Assignment slots β Y) := | |
| ReducedPartition.Part (reduction slots f) f | |
| noncomputable def evaluateLabel (slots : Fin n β Slot) (f : Assignment slots β Y) | |
| (x : Assignment slots) : Label slots f := | |
| ReducedPartition.label (reduction slots f) f x | |
| noncomputable def restore (slots : Fin n β Slot) (f : Assignment slots β Y) | |
| (P : Label slots f) : Y := | |
| ReducedPartition.output (reduction slots f) f P | |
| @[simp] theorem restore_evaluateLabel (slots : Fin n β Slot) | |
| (f : Assignment slots β Y) (x : Assignment slots) : | |
| restore slots f (evaluateLabel slots f x) = f x := | |
| ReducedPartition.output_label (reduction slots f) f (constantOnFibers slots f) x | |
| theorem restore_injective (slots : Fin n β Slot) (f : Assignment slots β Y) : | |
| Function.Injective (restore slots f) := | |
| ReducedPartition.output_injective (reduction slots f) f | |
| noncomputable def transportLabel {slots projected : Fin n β Slot} | |
| (p : β i, Projection (slots i) (projected i)) (f : Assignment projected β Y) | |
| (P : Label slots (f β projectionMap p)) : Label projected f := | |
| β¨P.val, by | |
| change P.val β partition projected f | |
| rw [β partition_projection p f] | |
| exact P.propertyβ© | |
| theorem transportLabel_bijective {slots projected : Fin n β Slot} | |
| (p : β i, Projection (slots i) (projected i)) (f : Assignment projected β Y) : | |
| Function.Bijective (transportLabel p f) := by | |
| constructor | |
| Β· intro P Q h | |
| exact Subtype.ext (congrArg (fun R : Label projected f => R.val) h) | |
| Β· intro Q | |
| have hQ : Q.val β partition slots (f β projectionMap p) := by | |
| rw [partition_projection p f] | |
| exact Q.property | |
| exact β¨β¨Q.val, hQβ©, Subtype.ext rflβ© | |
| theorem evaluateLabel_projection {slots projected : Fin n β Slot} | |
| (p : β i, Projection (slots i) (projected i)) (f : Assignment projected β Y) | |
| (x : Assignment slots) : | |
| transportLabel p f (evaluateLabel slots (f β projectionMap p) x) = | |
| evaluateLabel projected f (projectionMap p x) := by | |
| apply Subtype.ext | |
| exact ReducedPartition.fiber_eq_of_pullback | |
| (projectionMap p) (projectionMap_surjective p) | |
| (reduction slots (f β projectionMap p)) (reduction projected f) | |
| (f β projectionMap p) f (reduction_projection p f) (fun _ => rfl) x | |
| theorem restore_projection {slots projected : Fin n β Slot} | |
| (p : β i, Projection (slots i) (projected i)) (f : Assignment projected β Y) | |
| (P : Label slots (f β projectionMap p)) : | |
| restore slots (f β projectionMap p) P = | |
| restore projected f (transportLabel p f P) := by | |
| exact ReducedPartition.output_eq_of_shared_part | |
| (projectionMap p) (reduction slots (f β projectionMap p)) (reduction projected f) | |
| (f β projectionMap p) f (reduction_projection p f) (fun _ => rfl) | |
| (constantOnFibers projected f) P (transportLabel p f P) rfl | |
| end PerfectCompleteness.CanonicalKeys | |
| end | |
| end OAI | |