From 592258de68f6a2d502fed99a883ae5fca94082b1 Mon Sep 17 00:00:00 2001 From: Vasily Ilin Date: Sun, 25 Oct 2026 02:38:04 +0000 Subject: [PATCH] Optimize DomainTheory imports and repeated proofs --- LeanPool/DomainTheory.lean | 194 +++------ .../ContinuousLattice/Constructions.lean | 15 +- .../ContinuousLattice/FunctionSpaceTower.lean | 56 +-- .../ContinuousLattice/FunctionSpaces.lean | 82 ++-- .../ContinuousLattice/Injective.lean | 6 +- .../ContinuousLattice/InverseLimits.lean | 17 +- .../ContinuousLattice/ScottMaps.lean | 12 +- .../ContinuousLattice/WayBelow.lean | 4 +- .../Neighborhood/Approximable.lean | 15 +- .../Neighborhood/ApproximableExercises.lean | 1 - LeanPool/DomainTheory/Neighborhood/Basic.lean | 5 +- .../Neighborhood/Definition610.lean | 2 +- .../Neighborhood/Definition613.lean | 8 - .../Neighborhood/Definition68.lean | 6 - .../DomainTheory/Neighborhood/Example12.lean | 50 +-- .../DomainTheory/Neighborhood/Example13.lean | 54 +-- .../DomainTheory/Neighborhood/Example14.lean | 403 +++++++++++------- .../DomainTheory/Neighborhood/Example15.lean | 3 - .../DomainTheory/Neighborhood/Example23.lean | 8 +- .../DomainTheory/Neighborhood/Example24.lean | 10 +- .../DomainTheory/Neighborhood/Example43.lean | 16 +- .../DomainTheory/Neighborhood/Example44.lean | 14 +- .../DomainTheory/Neighborhood/Example61.lean | 53 ++- .../DomainTheory/Neighborhood/Example62.lean | 18 +- .../DomainTheory/Neighborhood/Example62A.lean | 14 +- .../DomainTheory/Neighborhood/Example62C.lean | 34 +- .../Neighborhood/Example62Regular.lean | 11 +- .../DomainTheory/Neighborhood/ExampleB.lean | 7 +- .../Neighborhood/Exercise112.lean | 3 +- .../Neighborhood/Exercise113.lean | 6 +- .../Neighborhood/Exercise114.lean | 3 +- .../Neighborhood/Exercise115.lean | 38 +- .../Neighborhood/Exercise116.lean | 8 +- .../Neighborhood/Exercise117.lean | 2 +- .../Neighborhood/Exercise118.lean | 40 +- .../Neighborhood/Exercise119.lean | 30 +- .../Neighborhood/Exercise120.lean | 2 - .../Neighborhood/Exercise123.lean | 5 +- .../Neighborhood/Exercise125.lean | 2 +- .../Neighborhood/Exercise126.lean | 11 +- .../Neighborhood/Exercise127.lean | 9 +- .../Neighborhood/Exercise214.lean | 1 - .../Neighborhood/Exercise215.lean | 4 +- .../Neighborhood/Exercise218.lean | 20 +- .../Neighborhood/Exercise220.lean | 5 +- .../Neighborhood/Exercise221.lean | 16 +- .../Neighborhood/Exercise222.lean | 9 +- .../Neighborhood/Exercise315.lean | 1 - .../Neighborhood/Exercise316.lean | 7 +- .../Neighborhood/Exercise317.lean | 30 +- .../Neighborhood/Exercise318.lean | 33 +- .../Neighborhood/Exercise319Sum.lean | 1 - .../Neighborhood/Exercise321.lean | 9 +- .../Neighborhood/Exercise322.lean | 6 - .../Neighborhood/Exercise323.lean | 7 - .../Neighborhood/Exercise324.lean | 6 - .../Neighborhood/Exercise324Distrib.lean | 1 - .../Neighborhood/Exercise324Iter.lean | 6 - .../Neighborhood/Exercise325.lean | 8 +- .../Neighborhood/Exercise326.lean | 29 +- .../Neighborhood/Exercise326Sum.lean | 18 +- .../Neighborhood/Exercise327.lean | 6 - .../Neighborhood/Exercise328.lean | 17 +- .../Neighborhood/Exercise407.lean | 8 +- .../Neighborhood/Exercise408.lean | 8 +- .../Neighborhood/Exercise409.lean | 6 - .../Neighborhood/Exercise410.lean | 6 - .../Neighborhood/Exercise411.lean | 8 +- .../Neighborhood/Exercise412.lean | 11 +- .../Neighborhood/Exercise413.lean | 6 - .../Neighborhood/Exercise415.lean | 10 +- .../Neighborhood/Exercise416.lean | 6 - .../Neighborhood/Exercise417.lean | 7 +- .../Neighborhood/Exercise418.lean | 10 +- .../Neighborhood/Exercise419.lean | 22 +- .../Neighborhood/Exercise420.lean | 6 - .../Neighborhood/Exercise421.lean | 11 +- .../Neighborhood/Exercise423.lean | 9 +- .../Neighborhood/Exercise425.lean | 17 +- .../Neighborhood/Exercise507.lean | 6 - .../Neighborhood/Exercise508.lean | 8 - .../Neighborhood/Exercise509.lean | 9 +- .../Neighborhood/Exercise510.lean | 33 +- .../Neighborhood/Exercise511.lean | 8 +- .../Neighborhood/Exercise512.lean | 6 - .../Neighborhood/Exercise513.lean | 4 +- .../Neighborhood/Exercise514.lean | 2 - .../Neighborhood/Exercise515.lean | 10 +- .../Neighborhood/Exercise516.lean | 25 +- .../Neighborhood/Exercise516Overlap.lean | 13 +- .../Neighborhood/Exercise516ThueMorse.lean | 9 +- .../Neighborhood/Exercise617.lean | 41 +- .../Neighborhood/Exercise617Gen.lean | 80 ++-- .../Neighborhood/Exercise618.lean | 18 +- .../Neighborhood/Exercise619.lean | 9 +- .../Neighborhood/Exercise619PartB.lean | 60 +-- .../Neighborhood/Exercise621.lean | 64 +-- .../Neighborhood/Exercise622.lean | 7 - .../Neighborhood/Exercise623.lean | 279 ++++-------- .../Neighborhood/Exercise624.lean | 7 - .../Neighborhood/Exercise625.lean | 6 - .../Neighborhood/Exercise626.lean | 7 - .../Neighborhood/Exercise627.lean | 7 - .../Neighborhood/Exercise628.lean | 8 +- .../Neighborhood/Exercise629.lean | 18 +- .../Neighborhood/FunctionSpace.lean | 43 +- .../DomainTheory/Neighborhood/Lemma615.lean | 8 +- .../DomainTheory/Neighborhood/Product.lean | 25 +- .../Neighborhood/Proposition53.lean | 8 +- .../Neighborhood/Proposition54.lean | 8 +- .../Neighborhood/Proposition611.lean | 2 - .../Neighborhood/Proposition612.lean | 6 - .../Neighborhood/Proposition77.lean | 30 +- .../DomainTheory/Neighborhood/Recursive.lean | 28 +- .../DomainTheory/Neighborhood/Table55.lean | 6 - .../DomainTheory/Neighborhood/Theorem110.lean | 1 - .../DomainTheory/Neighborhood/Theorem41.lean | 7 - .../DomainTheory/Neighborhood/Theorem51.lean | 6 - .../DomainTheory/Neighborhood/Theorem52.lean | 6 - .../DomainTheory/Neighborhood/Theorem56.lean | 8 +- .../Neighborhood/Theorem56Full.lean | 19 +- .../DomainTheory/Neighborhood/Theorem614.lean | 8 +- .../DomainTheory/Neighborhood/Theorem616.lean | 10 +- .../DomainTheory/Neighborhood/Theorem69.lean | 12 +- .../DomainTheory/Neighborhood/Theorem74.lean | 9 +- .../DomainTheory/Neighborhood/Theorem75.lean | 76 ++-- .../DomainTheory/Neighborhood/Theorem76.lean | 19 +- 127 files changed, 1222 insertions(+), 1535 deletions(-) diff --git a/LeanPool/DomainTheory.lean b/LeanPool/DomainTheory.lean index f8a4c53fa6..6f860d02da 100644 --- a/LeanPool/DomainTheory.lean +++ b/LeanPool/DomainTheory.lean @@ -5,155 +5,91 @@ Authors: Catskills Research Company -/ module -public import LeanPool.DomainTheory.Constructive -public import LeanPool.DomainTheory.InfoSys -public import LeanPool.DomainTheory.ContinuousLattice.Injective -public import LeanPool.DomainTheory.ContinuousLattice.WayBelow -public import LeanPool.DomainTheory.ContinuousLattice.Specialization -public import LeanPool.DomainTheory.ContinuousLattice.ScottMaps -public import LeanPool.DomainTheory.ContinuousLattice.MilnerCorrection -public import LeanPool.DomainTheory.ContinuousLattice.Constructions -public import LeanPool.DomainTheory.ContinuousLattice.FunctionSpaces -public import LeanPool.DomainTheory.ContinuousLattice.Theorem212 -public import LeanPool.DomainTheory.ContinuousLattice.InverseLimits +-- Terminal imports retain the complete public API. Start with the long independent branches. +public import LeanPool.DomainTheory.Neighborhood.Exercise617Gen +public import LeanPool.DomainTheory.Neighborhood.Theorem76 public import LeanPool.DomainTheory.ContinuousLattice.FunctionSpaceTower -public import LeanPool.DomainTheory.Neighborhood.Basic -public import LeanPool.DomainTheory.Neighborhood.Example12 -public import LeanPool.DomainTheory.Neighborhood.Example13 +public import LeanPool.DomainTheory.Neighborhood.Exercise623 +public import LeanPool.DomainTheory.Neighborhood.Exercise509 +public import LeanPool.DomainTheory.Neighborhood.Theorem56Full +public import LeanPool.DomainTheory.Neighborhood.Proposition77 +public import LeanPool.DomainTheory.Neighborhood.Exercise516Overlap +public import LeanPool.DomainTheory.Neighborhood.Theorem616 +public import LeanPool.DomainTheory.Neighborhood.Exercise415 public import LeanPool.DomainTheory.Neighborhood.Example14 -public import LeanPool.DomainTheory.Neighborhood.Example15 -public import LeanPool.DomainTheory.Neighborhood.ExampleB -public import LeanPool.DomainTheory.Neighborhood.Theorem110 -public import LeanPool.DomainTheory.Neighborhood.Theorem111 -public import LeanPool.DomainTheory.Neighborhood.Exercise112 +public import LeanPool.DomainTheory.Neighborhood.Theorem614 +public import LeanPool.DomainTheory.Neighborhood.Exercise215 +public import LeanPool.DomainTheory.Neighborhood.Exercise327 +public import LeanPool.DomainTheory.Neighborhood.Exercise422 +public import LeanPool.DomainTheory.Neighborhood.Exercise626 +public import LeanPool.DomainTheory.Neighborhood.Exercise514 +public import LeanPool.DomainTheory.Neighborhood.Proposition53 +public import LeanPool.DomainTheory.Neighborhood.Exercise618 +public import LeanPool.DomainTheory.Neighborhood.Exercise627 public import LeanPool.DomainTheory.Neighborhood.Exercise113 -public import LeanPool.DomainTheory.Neighborhood.Exercise114 +public import LeanPool.DomainTheory.Neighborhood.Exercise119 +public import LeanPool.DomainTheory.Neighborhood.Exercise121 +public import LeanPool.DomainTheory.Neighborhood.Example13 +public import LeanPool.DomainTheory.Neighborhood.Exercise508 +public import LeanPool.DomainTheory.Neighborhood.Exercise622 +public import LeanPool.DomainTheory.Neighborhood.Exercise629 +public import LeanPool.DomainTheory.Neighborhood.Example62A +public import LeanPool.DomainTheory.ContinuousLattice.Theorem212 +public import LeanPool.DomainTheory.Neighborhood.Exercise126 +public import LeanPool.DomainTheory.Neighborhood.Exercise625 public import LeanPool.DomainTheory.Neighborhood.Exercise115 +public import LeanPool.DomainTheory.Neighborhood.Exercise317 +public import LeanPool.DomainTheory.Neighborhood.Exercise328 +public import LeanPool.DomainTheory.Neighborhood.Exercise112 public import LeanPool.DomainTheory.Neighborhood.Exercise116 +public import LeanPool.DomainTheory.Neighborhood.Exercise220 +public import LeanPool.DomainTheory.Neighborhood.Exercise324Iter +public import LeanPool.DomainTheory.Neighborhood.Exercise325 +public import LeanPool.DomainTheory.Neighborhood.Theorem56 +public import LeanPool.DomainTheory.Neighborhood.Exercise515 +public import LeanPool.DomainTheory.Neighborhood.Proposition611 public import LeanPool.DomainTheory.Neighborhood.Exercise117 -public import LeanPool.DomainTheory.Neighborhood.Exercise118 -public import LeanPool.DomainTheory.Neighborhood.Exercise119 -public import LeanPool.DomainTheory.Neighborhood.Exercise120 -public import LeanPool.DomainTheory.Neighborhood.Exercise121 -public import LeanPool.DomainTheory.Neighborhood.Exercise122 public import LeanPool.DomainTheory.Neighborhood.Exercise123 -public import LeanPool.DomainTheory.Neighborhood.Exercise124 public import LeanPool.DomainTheory.Neighborhood.Exercise125 -public import LeanPool.DomainTheory.Neighborhood.Exercise126 -public import LeanPool.DomainTheory.Neighborhood.Exercise127 -public import LeanPool.DomainTheory.Neighborhood.Approximable -public import LeanPool.DomainTheory.Neighborhood.ApproximableExercises -public import LeanPool.DomainTheory.Neighborhood.Example23 -public import LeanPool.DomainTheory.Neighborhood.Example24 -public import LeanPool.DomainTheory.Neighborhood.Exercise213 -public import LeanPool.DomainTheory.Neighborhood.Exercise214 -public import LeanPool.DomainTheory.Neighborhood.Exercise215 -public import LeanPool.DomainTheory.Neighborhood.Exercise216 -public import LeanPool.DomainTheory.Neighborhood.Exercise218 -public import LeanPool.DomainTheory.Neighborhood.Exercise220 public import LeanPool.DomainTheory.Neighborhood.Exercise221 -public import LeanPool.DomainTheory.Neighborhood.Exercise222 -public import LeanPool.DomainTheory.Neighborhood.Product -public import LeanPool.DomainTheory.Neighborhood.FunctionSpace -public import LeanPool.DomainTheory.Neighborhood.Exercise314 -public import LeanPool.DomainTheory.Neighborhood.Exercise315 -public import LeanPool.DomainTheory.Neighborhood.Exercise318 -public import LeanPool.DomainTheory.Neighborhood.Exercise319 -public import LeanPool.DomainTheory.Neighborhood.Exercise319Sum public import LeanPool.DomainTheory.Neighborhood.Exercise321 -public import LeanPool.DomainTheory.Neighborhood.Exercise322 -public import LeanPool.DomainTheory.Neighborhood.Exercise323 -public import LeanPool.DomainTheory.Neighborhood.Exercise324 -public import LeanPool.DomainTheory.Neighborhood.Exercise316 -public import LeanPool.DomainTheory.Neighborhood.Exercise317 -public import LeanPool.DomainTheory.Neighborhood.Exercise324Iter -public import LeanPool.DomainTheory.Neighborhood.Exercise324Distrib -public import LeanPool.DomainTheory.Neighborhood.Exercise325 -public import LeanPool.DomainTheory.Neighborhood.Exercise327 -public import LeanPool.DomainTheory.Neighborhood.Exercise326 public import LeanPool.DomainTheory.Neighborhood.Exercise326Sum -public import LeanPool.DomainTheory.Neighborhood.Exercise328 -public import LeanPool.DomainTheory.Neighborhood.Theorem41 -public import LeanPool.DomainTheory.Neighborhood.Example43 -public import LeanPool.DomainTheory.Neighborhood.Example44 -public import LeanPool.DomainTheory.Neighborhood.Theorem46 -public import LeanPool.DomainTheory.Neighborhood.Exercise407 -public import LeanPool.DomainTheory.Neighborhood.Exercise408 -public import LeanPool.DomainTheory.Neighborhood.Exercise409 -public import LeanPool.DomainTheory.Neighborhood.Exercise410 -public import LeanPool.DomainTheory.Neighborhood.Exercise411 -public import LeanPool.DomainTheory.Neighborhood.Exercise412 -public import LeanPool.DomainTheory.Neighborhood.Exercise413 -public import LeanPool.DomainTheory.Neighborhood.Exercise414 -public import LeanPool.DomainTheory.Neighborhood.Exercise415 public import LeanPool.DomainTheory.Neighborhood.Exercise416 -public import LeanPool.DomainTheory.Neighborhood.Exercise417 -public import LeanPool.DomainTheory.Neighborhood.Exercise418 -public import LeanPool.DomainTheory.Neighborhood.Exercise419 -public import LeanPool.DomainTheory.Neighborhood.Exercise420 public import LeanPool.DomainTheory.Neighborhood.Exercise421 -public import LeanPool.DomainTheory.Neighborhood.Exercise422 +public import LeanPool.DomainTheory.Neighborhood.Theorem51 +public import LeanPool.DomainTheory.Neighborhood.Proposition54 +public import LeanPool.DomainTheory.Neighborhood.Exercise624 +public import LeanPool.DomainTheory.Neighborhood.Exercise628 +public import LeanPool.DomainTheory.Constructive +public import LeanPool.DomainTheory.Neighborhood.Exercise120 +public import LeanPool.DomainTheory.Neighborhood.Exercise324Distrib public import LeanPool.DomainTheory.Neighborhood.Exercise423 -public import LeanPool.DomainTheory.Neighborhood.Exercise424 public import LeanPool.DomainTheory.Neighborhood.Exercise425 -public import LeanPool.DomainTheory.Neighborhood.Table55 -public import LeanPool.DomainTheory.Neighborhood.Theorem51 public import LeanPool.DomainTheory.Neighborhood.Theorem52 -public import LeanPool.DomainTheory.Neighborhood.Proposition53 -public import LeanPool.DomainTheory.Neighborhood.Proposition54 -public import LeanPool.DomainTheory.Neighborhood.Theorem56 -public import LeanPool.DomainTheory.Neighborhood.Theorem56Full public import LeanPool.DomainTheory.Neighborhood.Exercise507 -public import LeanPool.DomainTheory.Neighborhood.Exercise508 -public import LeanPool.DomainTheory.Neighborhood.Exercise509 -public import LeanPool.DomainTheory.Neighborhood.Exercise510 -public import LeanPool.DomainTheory.Neighborhood.Exercise511 -public import LeanPool.DomainTheory.Neighborhood.Exercise512 -public import LeanPool.DomainTheory.Neighborhood.Exercise513 -public import LeanPool.DomainTheory.Neighborhood.Exercise514 -public import LeanPool.DomainTheory.Neighborhood.Exercise515 -public import LeanPool.DomainTheory.Neighborhood.Exercise516 -public import LeanPool.DomainTheory.Neighborhood.Exercise516ThueMorse -public import LeanPool.DomainTheory.Neighborhood.Exercise516Overlap -public import LeanPool.DomainTheory.Neighborhood.Example61 -public import LeanPool.DomainTheory.Neighborhood.Example62 -public import LeanPool.DomainTheory.Neighborhood.Example62C -public import LeanPool.DomainTheory.Neighborhood.Example62A public import LeanPool.DomainTheory.Neighborhood.Example62Regular -public import LeanPool.DomainTheory.Neighborhood.Definition63 +public import LeanPool.DomainTheory.InfoSys +public import LeanPool.DomainTheory.Neighborhood.Exercise218 +public import LeanPool.DomainTheory.Neighborhood.Exercise324 +public import LeanPool.DomainTheory.Neighborhood.Exercise409 +public import LeanPool.DomainTheory.Neighborhood.Exercise420 +public import LeanPool.DomainTheory.Neighborhood.Exercise512 +public import LeanPool.DomainTheory.Neighborhood.Exercise322 +public import LeanPool.DomainTheory.Neighborhood.Exercise418 +public import LeanPool.DomainTheory.Neighborhood.Exercise214 +public import LeanPool.DomainTheory.Neighborhood.Exercise216 +public import LeanPool.DomainTheory.Neighborhood.Exercise417 +public import LeanPool.DomainTheory.ContinuousLattice.MilnerCorrection +public import LeanPool.DomainTheory.Neighborhood.Exercise323 +public import LeanPool.DomainTheory.Neighborhood.Exercise114 +public import LeanPool.DomainTheory.Neighborhood.Example24 +public import LeanPool.DomainTheory.Neighborhood.Exercise424 +public import LeanPool.DomainTheory.Neighborhood.Exercise412 public import LeanPool.DomainTheory.Neighborhood.Proposition66 +public import LeanPool.DomainTheory.Neighborhood.Example15 +public import LeanPool.DomainTheory.Neighborhood.Exercise314 +public import LeanPool.DomainTheory.Neighborhood.Exercise213 public import LeanPool.DomainTheory.Neighborhood.Proposition67 -public import LeanPool.DomainTheory.Neighborhood.Definition68 -public import LeanPool.DomainTheory.Neighborhood.Theorem69 -public import LeanPool.DomainTheory.Neighborhood.Definition610 -public import LeanPool.DomainTheory.Neighborhood.Proposition611 -public import LeanPool.DomainTheory.Neighborhood.Proposition612 -public import LeanPool.DomainTheory.Neighborhood.Definition613 -public import LeanPool.DomainTheory.Neighborhood.Theorem614 -public import LeanPool.DomainTheory.Neighborhood.Lemma615 -public import LeanPool.DomainTheory.Neighborhood.Theorem616 -public import LeanPool.DomainTheory.Neighborhood.Exercise617 -public import LeanPool.DomainTheory.Neighborhood.Exercise617Gen -public import LeanPool.DomainTheory.Neighborhood.Exercise618 -public import LeanPool.DomainTheory.Neighborhood.Exercise619 -public import LeanPool.DomainTheory.Neighborhood.Exercise619PartB -public import LeanPool.DomainTheory.Neighborhood.Exercise621 -public import LeanPool.DomainTheory.Neighborhood.Exercise622 -public import LeanPool.DomainTheory.Neighborhood.Exercise623 -public import LeanPool.DomainTheory.Neighborhood.Exercise624 -public import LeanPool.DomainTheory.Neighborhood.Exercise625 -public import LeanPool.DomainTheory.Neighborhood.Exercise626 -public import LeanPool.DomainTheory.Neighborhood.Exercise627 -public import LeanPool.DomainTheory.Neighborhood.Exercise628 -public import LeanPool.DomainTheory.Neighborhood.Exercise629 -public import LeanPool.DomainTheory.Neighborhood.Recursive -public import LeanPool.DomainTheory.Neighborhood.Definition71 -public import LeanPool.DomainTheory.Neighborhood.Definition72 -public import LeanPool.DomainTheory.Neighborhood.Theorem74 -public import LeanPool.DomainTheory.Neighborhood.Theorem75 -public import LeanPool.DomainTheory.Neighborhood.Theorem76 -public import LeanPool.DomainTheory.Neighborhood.Proposition77 -import Mathlib.Data.Rat.Floor /-! # DomainTheory diff --git a/LeanPool/DomainTheory/ContinuousLattice/Constructions.lean b/LeanPool/DomainTheory/ContinuousLattice/Constructions.lean index 9f97451dab..6514c6e3f1 100644 --- a/LeanPool/DomainTheory/ContinuousLattice/Constructions.lean +++ b/LeanPool/DomainTheory/ContinuousLattice/Constructions.lean @@ -117,7 +117,7 @@ theorem proposition_2_9_a {ι : Type*} (E : ι → Type*) [∀ i, CompleteLattic · rw [hei]; exact Set.mem_Ici.1 (hUsub hz) · rw [he, Function.update_of_ne hji]; exact bot_le have hle : e i ≤ b i := (hb hcyl) i - simp_all + simp_all only [mem_ofPred_eq, Function.update_self] /-! ### Proposition 2.9(b): the induced topology of a product is the product topology @@ -159,8 +159,9 @@ theorem update_preservesDirectedSup {ι : Type*} [DecidableEq ι] {E : ι → Ty rw [sSup_apply_eq_sSup_image, Set.image_image] rcases eq_or_ne j i with hji | hji · rw [hji, Function.update_self] - simp_all - · simp_all + simp_all only [Function.eval, Function.update_self, image_id'] + · simp_all only [ne_eq, not_false_eq_true, Function.update_of_ne, Function.eval, + Nonempty.image_const, sSup_singleton] /-- A way-below relation in a product projects to each coordinate: if `a ≪ z` in `∏ᵢ Eᵢ` then @@ -174,7 +175,7 @@ theorem wayBelow_proj {ι : Type*} {E : ι → Type*} [∀ i, CompleteLattice (E obtain ⟨W, hW, hzW, hWsub⟩ := h refine ⟨(fun v : E i => Function.update z i v) ⁻¹' W, ?_, ?_, ?_⟩ · exact scottOpen_preimage (update_preservesDirectedSup z i) hW - · simp_all + · simp_all only [mem_preimage, Function.update_eq_self] · intro v hv have hav : a ≤ Function.update z i v := Set.mem_Ici.1 (hWsub hv) have := hav i @@ -216,13 +217,13 @@ theorem wayBelow_finite_support {ι : Type*} {E : ι → Type*} [∀ i, Complete · rw [Pi.le_def]; intro j rw [sSup_apply_eq_sSup_image] refine le_sSup ⟨Z {j}, ⟨{j}, rfl⟩, ?_⟩ - simp [hZ, Function.eval] + simp only [Function.eval, hZ, Finset.mem_singleton, ↓reduceIte] rw [← hsup] at h obtain ⟨d, hd𝒵, had⟩ := (wayBelow_sSup_iff h𝒵ne h𝒵dir).1 h obtain ⟨F, rfl⟩ := hd𝒵 refine ⟨F, fun j hjF => ?_⟩ have hj := had.le j - simp_all + simp_all only [↓reduceIte, le_bot_iff] /-- **Scott 1972, Proposition 2.9(b).** For a family of continuous lattices, the Scott topology of @@ -267,7 +268,7 @@ theorem proposition_2_9_b {ι : Type*} (E : ι → Type*) [∀ i, CompleteLattic exact iInf_le (fun i => TopologicalSpace.induced (fun w : ∀ j, E j => w i) scottTopologicalSpace) i _ hind · -- the box contains `z` - simp_all + simp_all only [mem_iInter, mem_preimage, implies_true] /-- **Scott 1972, Proposition 2.9 (full statement).** The product of a family of continuous lattices diff --git a/LeanPool/DomainTheory/ContinuousLattice/FunctionSpaceTower.lean b/LeanPool/DomainTheory/ContinuousLattice/FunctionSpaceTower.lean index dc987bd546..ae64ab16b6 100644 --- a/LeanPool/DomainTheory/ContinuousLattice/FunctionSpaceTower.lean +++ b/LeanPool/DomainTheory/ContinuousLattice/FunctionSpaceTower.lean @@ -7,6 +7,8 @@ module public import LeanPool.DomainTheory.ContinuousLattice.InverseLimits +import Mathlib.Tactic.Set -- shake: keep + /-! # The function-space tower and Scott's `D_∞ ≅ [D_∞ → D_∞]` (Scott 1972, §4, Theorem 4.4) @@ -246,10 +248,8 @@ noncomputable def embInfInf : ScottMap (DInf D₀ j₀) (DInfFn D₀ j₀) := /-- `i_∞` evaluated at `x` is the pointwise supremum of the summands `iInfTerm n x`. -/ theorem embInfInf_apply (x : DInf D₀ j₀) : - embInfInf D₀ j₀ x = ⨆ n, iInfTerm D₀ j₀ n x := by - change (sSup (Set.range (iInfTerm D₀ j₀)) : ScottMap _ _) x = _ - rw [ScottMap.sSup_apply, ← Set.range_comp, sSup_range] - rfl + embInfInf D₀ j₀ x = ⨆ n, iInfTerm D₀ j₀ n x := + ScottMap.iSup_apply (iInfTerm D₀ j₀) x /-- The `n`-th summand of `j_∞`: the Scott map `f ↦ i_{(n+1)∞}(j_{∞n} ∘ f ∘ i_{n∞})`. As a map @@ -276,10 +276,8 @@ noncomputable def projInfInf : ScottMap (DInfFn D₀ j₀) (DInf D₀ j₀) := /-- `j_∞` evaluated at `f` is the supremum of the summands `jInfTerm n f`. -/ theorem projInfInf_apply (f : DInfFn D₀ j₀) : - projInfInf D₀ j₀ f = ⨆ n, jInfTerm D₀ j₀ n f := by - change (sSup (Set.range (jInfTerm D₀ j₀)) : ScottMap _ _) f = _ - rw [ScottMap.sSup_apply, ← Set.range_comp, sSup_range] - rfl + projInfInf D₀ j₀ f = ⨆ n, jInfTerm D₀ j₀ n f := + ScottMap.iSup_apply (jInfTerm D₀ j₀) f /-- `i_∞` is Scott-continuous (it is a bundled `ScottMap`). -/ theorem embInfInf_preservesDirectedSup : @@ -312,26 +310,17 @@ directed suprema. -/ theorem conjMap_iSup (n : ℕ) (post : ScottMap (DInf D₀ j₀) (towerType D₀ n)) (pre : ScottMap (towerType D₀ n) (DInf D₀ j₀)) (f : ℕ → ScottMap (DInf D₀ j₀) (DInf D₀ j₀)) (hf : Monotone f) : - conjMap post pre (⨆ m, f m) = ⨆ m, conjMap post pre (f m) := by - have hdir : DirectedOn (· ≤ ·) (Set.range f) := - directedOn_range.2 fun a b => ⟨max a b, hf (le_max_left a b), hf (le_max_right a b)⟩ - have hne := Set.range_nonempty f - rw [show (⨆ m, f m) = sSup (Set.range f) from sSup_range.symm, - (conjMap post pre).preservesDirectedSup_coe (Set.range f) hne hdir, ← Set.range_comp] - rfl + conjMap post pre (⨆ m, f m) = ⨆ m, conjMap post pre (f m) := + (conjMap post pre).map_iSup_of_directed f + (fun a b => ⟨max a b, hf (le_max_left a b), hf (le_max_right a b)⟩) /-- The inverse-limit embedding commutes with a supremum in `D_{n+1}` (monotone ⇒ directed). -/ theorem embInf_succ_iSup (n : ℕ) (f : ℕ → towerType D₀ (n + 1)) (hf : Monotone f) : embInf (towerType D₀) (towerProj D₀ j₀) (n + 1) (⨆ m, f m) = - ⨆ m, embInf (towerType D₀) (towerProj D₀ j₀) (n + 1) (f m) := by - have hdir : DirectedOn (· ≤ ·) (Set.range f) := - directedOn_range.2 fun a b => ⟨max a b, hf (le_max_left a b), hf (le_max_right a b)⟩ - have hne := Set.range_nonempty f - rw [show (⨆ m, f m) = sSup (Set.range f) from sSup_range.symm, - (embInf (towerType D₀) (towerProj D₀ j₀) (n + 1)).preservesDirectedSup_coe - (Set.range f) hne hdir, ← Set.range_comp] - rfl + ⨆ m, embInf (towerType D₀) (towerProj D₀ j₀) (n + 1) (f m) := + (embInf (towerType D₀) (towerProj D₀ j₀) (n + 1)).map_iSup_of_directed f + (fun a b => ⟨max a b, hf (le_max_left a b), hf (le_max_right a b)⟩) /-- **Diagonal simplification.** `conjMap (j_{∞n}, i_{n∞})` applied to the `n`-th summand of `i_∞` @@ -483,7 +472,7 @@ theorem projInfInf_embInfInf_eq (x : DInf D₀ j₀) : have g_mono_n (m : ℕ) : Monotone (fun n => g n m) := monotone_nat_of_le_succ (g_mono_n_succ m) have hin : (⨆ n, jInfTerm D₀ j₀ n (embInfInf D₀ j₀ x)) = ⨆ n, ⨆ m, g n m := by - simp_all + simp_all only [jInfTerm_apply] rw [hin, iSup₂_monotone_eq_diagonal g g_mono_m g_mono_n] congr 1 funext n @@ -554,7 +543,7 @@ theorem embInfInf_comp_projInfInf : have hrw : ∀ n (w : DInf D₀ j₀), r n w = embInf (towerType D₀) (towerProj D₀ j₀) n (projInf (towerType D₀) (towerProj D₀ j₀) n w) := by - simp_all + simp_all only [ScottMap.comp_apply, implies_true] have hr_mono : ∀ (w : DInf D₀ j₀), Monotone (fun m => r m w) := by intro w refine monotone_nat_of_le_succ (fun m => ?_) @@ -574,20 +563,13 @@ theorem embInfInf_comp_projInfInf : -- Evaluating a supremum of Scott maps `D_∞ → D_∞` at a point is pointwise. have hsup_apply : ∀ (g : ℕ → ScottMap (DInf D₀ j₀) (DInf D₀ j₀)) (w : DInf D₀ j₀), (⨆ n, g n) w = ⨆ n, g n w := by - intro g w - rw [show (⨆ n, g n) = sSup (Set.range g) from sSup_range.symm, - ScottMap.sSup_apply, ← Set.range_comp, sSup_range] - rfl + exact fun g w => ScottMap.iSup_apply g w -- A Scott map commutes with a monotone `ℕ`-indexed supremum. have hcont : ∀ (g : ScottMap (DInf D₀ j₀) (DInf D₀ j₀)) (a : ℕ → DInf D₀ j₀), Monotone a → g (⨆ m, a m) = ⨆ m, g (a m) := by intro g a ha - have hdir : DirectedOn (· ≤ ·) (Set.range a) := - directedOn_range.2 fun i j => ⟨max i j, ha (le_max_left i j), ha (le_max_right i j)⟩ - rw [show (⨆ m, a m) = sSup (Set.range a) from sSup_range.symm, - g.preservesDirectedSup_coe (Set.range a) (Set.range_nonempty a) hdir, - ← Set.range_comp, sSup_range] - rfl + exact g.map_iSup_of_directed a + (fun i j => ⟨max i j, ha (le_max_left i j), ha (le_max_right i j)⟩) -- `j_∞(f) = ⨆ₖ i_{(k+1)∞}(j_{∞k} ∘ f ∘ i_{k∞})`. have hpi : projInfInf D₀ j₀ f = ⨆ k, embInf (towerType D₀) (towerProj D₀ j₀) (k + 1) @@ -659,12 +641,12 @@ variable (D₀ : CLat.{u}) theorem projInfInf_embInfInf (x : DInf D₀ j₀) : projInfInf D₀ j₀ (embInfInf D₀ j₀ x) = x := by have h := congrArg (fun g => g x) (projInfInf_comp_embInfInf D₀ j₀) - simpa [ScottMap.comp_apply, ScottMap.idMap_apply] using h + simpa only [ScottMap.comp_apply, ScottMap.idMap_apply] using h theorem embInfInf_projInfInf (f : DInfFn D₀ j₀) : embInfInf D₀ j₀ (projInfInf D₀ j₀ f) = f := by have h := congrArg (fun g => g f) (embInfInf_comp_projInfInf D₀ j₀) - simpa [ScottMap.comp_apply, ScottMap.idMap_apply] using h + simpa only [ScottMap.comp_apply, ScottMap.idMap_apply] using h theorem embInfInf_le_iff (x y : DInf D₀ j₀) : embInfInf D₀ j₀ x ≤ embInfInf D₀ j₀ y ↔ x ≤ y := by diff --git a/LeanPool/DomainTheory/ContinuousLattice/FunctionSpaces.lean b/LeanPool/DomainTheory/ContinuousLattice/FunctionSpaces.lean index dc49d2e8a4..46719cf9aa 100644 --- a/LeanPool/DomainTheory/ContinuousLattice/FunctionSpaces.lean +++ b/LeanPool/DomainTheory/ContinuousLattice/FunctionSpaces.lean @@ -8,6 +8,8 @@ module public import LeanPool.DomainTheory.ContinuousLattice.ScottMaps public import Mathlib.Order.FixedPoints +import Mathlib.Tactic.Set -- shake: keep + /-! # Function spaces on continuous lattices (Scott 1972, §3) @@ -280,6 +282,22 @@ theorem isLUB_sSup (F : Set (ScottMap D D')) : IsLUB F (sSup F) := by noncomputable instance instCompleteLattice : CompleteLattice (ScottMap D D') := completeLatticeOfSup (ScottMap D D') isLUB_sSup +/-- Suprema of families of Scott maps are evaluated pointwise. -/ +theorem iSup_apply {ι : Type*} (maps : ι → ScottMap D D') (x : D) : + (⨆ i, maps i) x = ⨆ i, maps i x := by + rw [show (⨆ i, maps i) = sSup (Set.range maps) from sSup_range.symm, + ScottMap.sSup_apply, ← Set.range_comp, sSup_range] + rfl + +/-- A Scott map preserves the supremum of a nonempty directed family. -/ +theorem map_iSup_of_directed {ι : Type*} [Nonempty ι] (map : ScottMap D D') + (points : ι → D) (directed : Directed (· ≤ ·) points) : + map (⨆ i, points i) = ⨆ i, map (points i) := by + rw [show (⨆ i, points i) = sSup (Set.range points) from sSup_range.symm, + map.preservesDirectedSup_coe (Set.range points) (Set.range_nonempty points) + (directedOn_range.mpr directed), ← Set.range_comp, sSup_range] + rfl + /-- The identity Scott map. -/ def idMap : ScottMap D D := ⟨fun x => x, continuous_of_preservesDirectedSup fun S _ _ => by @@ -529,7 +547,8 @@ theorem wayBelow_le_finset_sup_step (hD : IsContinuousLattice D) (hD' : IsContin {F | ∀ p ∈ F, (p.2 : D') ≪ (g : D → D') p.1} with hSg have hSgne : Sg.Nonempty := by refine ⟨_, ∅, ?_, rfl⟩ - simp_all + simp_all only [Prod.forall, mem_ofPred_eq, Finset.notMem_empty, IsEmpty.forall_iff, + implies_true] have hSgdir : DirectedOn (· ≤ ·) Sg := by rintro _ ⟨F₁, hF₁, rfl⟩ _ ⟨F₂, hF₂, rfl⟩ refine ⟨(F₁ ∪ F₂).sup (fun p => stepMap p.1 p.2), ⟨F₁ ∪ F₂, fun p hp => ?_, rfl⟩, @@ -550,7 +569,7 @@ theorem wayBelow_le_finset_sup_step (hD : IsContinuousLattice D) (hD' : IsContin have hmemSg : stepMap e e' ∈ Sg := by refine ⟨{(e, e')}, fun p hp => ?_, ?_⟩ · rw [Finset.mem_singleton] at hp; subst hp; exact he' - · simp_all + · exact Finset.sup_singleton have hx : (stepMap e e' : D → D') x ≤ ((sSup Sg : ScottMap D D') : D → D') x := by rw [ScottMap.sSup_apply] exact le_sSup ⟨stepMap e e', hmemSg, rfl⟩ @@ -661,10 +680,10 @@ theorem sSup_image_prod_mk_left (x : D) (S : Set D') (hS : S.Nonempty) : ext ⟨a, b⟩ simp only [Set.mem_image, Set.mem_prod, Set.mem_singleton_iff] constructor - · simp_all - · simp_all + · simp_all only [Prod.mk.injEq, exists_eq_right_right, and_self, implies_true] + · simp_all only [Prod.mk.injEq, true_and, exists_eq_right, implies_true] have hx : sSup ({x} : Set D) = x := by - simp_all + exact sSup_singleton rw [himage, sSup_prod (hs := ⟨x, Set.mem_singleton x⟩) (ht := hS), hx] theorem curry_right_preservesDirectedSup (f : ScottMap (D × D') D'') (x : D) : @@ -678,12 +697,12 @@ theorem curry_right_preservesDirectedSup (f : ScottMap (D × D') D'') (x : D) : exact ⟨(x, c), Set.mem_image_of_mem _ hc, And.intro (And.intro le_rfl hac) ( And.intro le_rfl hbc)⟩ have hS'ne : (Set.image (fun y => (x, y)) S).Nonempty := by - simp_all + exact image_nonempty.mpr hS rw [show (fun y => f (x, y)) (sSup S) = f (x, sSup S) from rfl, ← sSup_image_prod_mk_left x S hS, f.preservesDirectedSup_coe (Set.image (fun y => (x, y)) S) hS'ne hS'] congr 1 - simp [Set.image_image] + simp only [image_image] /-- **Scott 1972, Proposition 3.5 (right).** Currying in the `y`-variable is Scott-continuous. -/ @@ -696,10 +715,10 @@ theorem sSup_image_prod_mk_right (y : D') (S : Set D) (hS : S.Nonempty) : ext ⟨a, b⟩ simp only [Set.mem_image, Set.mem_prod, Set.mem_singleton_iff] constructor - · simp_all - · simp_all + · simp_all only [Prod.mk.injEq, ↓existsAndEq, true_and, and_self, implies_true] + · simp_all only [Prod.mk.injEq, and_true, exists_eq_right, implies_true] have hy : sSup ({y} : Set D') = y := by - simp_all + exact sSup_singleton rw [himage, sSup_prod (hs := hS) (ht := ⟨y, Set.mem_singleton y⟩), hy] /-- Currying in the `x`-variable: `x ↦ f (x, y)` is Scott-continuous (used for @@ -716,12 +735,12 @@ theorem curry_left_preservesDirectedSup (f : ScottMap (D × D') D'') (y : D') : exact ⟨(c, y), Set.mem_image_of_mem _ hc, And.intro (And.intro hac le_rfl) ( And.intro hbc le_rfl)⟩ have hS'ne : (Set.image (fun x => (x, y)) S).Nonempty := by - simp_all + exact image_nonempty.mpr hS rw [show (fun x => f (x, y)) (sSup S) = f (sSup S, y) from rfl, ← sSup_image_prod_mk_right y S hS, f.preservesDirectedSup_coe (Set.image (fun x => (x, y)) S) hS'ne hS'] congr 1 - simp [Set.image_image] + simp only [image_image] /-- The outer half of currying: `x ↦ (y ↦ f (x, y))` preserves directed suprema (so `lambda f` is a @@ -816,7 +835,7 @@ theorem retr_ambientSSup_eq_sSup (R : IsContinuousLatticeRetraction D D') (S : S have hne' : (Set.image (R.incl : D → D') S).Nonempty := Set.image_nonempty.2 hS rw [R.retr.preservesDirectedSup_coe (Set.image (R.incl : D → D') S) hne' hdir'] rw [Set.image_image, Set.image_congr fun a _ => R.retr_incl a] - simp + simp only [image_id'] /-- The inclusion of a retraction preserves directed suprema (it is a Scott map). -/ theorem incl_preservesDirectedSup (R : IsContinuousLatticeRetraction D D') : @@ -1024,7 +1043,7 @@ theorem retr_bot (P : IsContinuousLatticeProjection D D') : (P.retr : D' → D) /-- **Scott 1972, Proposition 3.10(i), empty case.** `i(⊥) = ⊥`. -/ theorem incl_bot (P : IsContinuousLatticeProjection D D') : P.incl (⊥ : D) = ⊥ := - le_antisymm (by simpa [retr_bot P] using P.incl_retr_le (⊥ : D')) bot_le + le_antisymm (by simpa only [le_bot_iff, retr_bot P] using P.incl_retr_le (⊥ : D')) bot_le /-- **Scott 1972, Proposition 3.10(i), binary case.** `i(x ⊔ y) = i(x) ⊔ i(y)`. -/ theorem incl_sup (P : IsContinuousLatticeProjection D D') (x y : D) : @@ -1053,7 +1072,7 @@ def finsetSupOf (S : Set D) : Set D := theorem mem_finsetSupOf_of_mem {S : Set D} {x : D} (hx : x ∈ S) : x ∈ finsetSupOf S := - ⟨{x}, by simp [hx], by simp⟩ + ⟨{x}, by simp only [Finset.mem_singleton, forall_eq, hx], by simp only [sup_singleton, id_eq]⟩ theorem le_sSup_finsetSupOf (S : Set D) : sSup S ≤ sSup (finsetSupOf S) := sSup_le fun _ hx => le_sSup (mem_finsetSupOf_of_mem hx) @@ -1073,7 +1092,7 @@ theorem directedOn_finsetSupOf (S : Set D) : obtain ⟨T₁, hT₁, rfl⟩ := ha obtain ⟨T₂, hT₂, rfl⟩ := hb have hunion : (T₁ ∪ T₂).sup id = T₁.sup id ⊔ T₂.sup id := by - simpa using Finset.sup_union (s₁ := T₁) (s₂ := T₂) (f := id) + simpa only using Finset.sup_union (s₁ := T₁) (s₂ := T₂) (f := id) refine ⟨T₁.sup id ⊔ T₂.sup id, ⟨T₁ ∪ T₂, ?_, hunion.symm⟩, le_sup_left, le_sup_right⟩ intro x hx simp only [Finset.mem_union] at hx @@ -1125,7 +1144,7 @@ theorem incl_wayBelow (P : IsContinuousLatticeProjection D D') (hD' : IsContinuo @IsContinuousLattice.sSup_wayBelow D' _ hD' (P.incl y), P.retr_incl y] have hImgne : (Set.image (P.retr : D' → D) W).Nonempty := by - simp_all + exact P.toIsContinuousLatticeRetraction.image_retr_wayBelow_nonempty y have hImgdir : DirectedOn (· ≤ ·) (Set.image (P.retr : D' → D) W) := by intro p hp q hq obtain ⟨a, ha, rfl⟩ := hp @@ -1196,9 +1215,7 @@ theorem incl_sup_of_preservesSSup (hi : ∀ S : Set D, i (sSup S) = sSup (i '' S /-- From (i): `i` is monotone. -/ theorem incl_mono_of_preservesSSup (hi : ∀ S : Set D, i (sSup S) = sSup (i '' S)) : Monotone i := by - intro x y hxy - have h := incl_sup_of_preservesSSup hi x y - simp_all + exact preservesDirectedSup_monotone fun ⦃S⦄ a a_1 => hi S /-- From (i)+(ii): `i` is order-reflecting (`x ⊑ y ↔ i x ⊑ i y`), since `x ⊑ y ↔ x ⊔ y = y`. -/ @@ -1211,7 +1228,8 @@ theorem le_of_incl_le (hi : ∀ S : Set D, i (sSup S) = sSup (i '' S)) theorem incl_converseRetr_le (hi : ∀ S : Set D, i (sSup S) = sSup (i '' S)) (x' : D') : i (converseRetr i x') ≤ x' := by change i (sSup {x | i x ≤ x'}) ≤ x' - simp_all + simp_all only [sSup_le_iff, Set.mem_image, mem_ofPred_eq, forall_exists_index, and_imp, + forall_apply_eq_imp_iff₂, implies_true] /-- `j ∘ i = id` (uses (i)+(ii)): `{x | i x ⊑ i y} = Iic y`, whose join is `y`. -/ theorem converseRetr_incl (hi : ∀ S : Set D, i (sSup S) = sSup (i '' S)) @@ -1221,7 +1239,7 @@ theorem converseRetr_incl (hi : ∀ S : Set D, i (sSup S) = sSup (i '' S)) simp only [Set.mem_ofPred_eq, Set.mem_Iic] exact ⟨le_of_incl_le hi hinj, fun hx => incl_mono_of_preservesSSup hi hx⟩ change sSup {x | i x ≤ i y} = y - simp_all + simp_all only [csSup_Iic] /-- `j` is Scott-continuous (uses (i)+(iii) and continuity of `D`). For directed `S'`: monotonicity @@ -1343,7 +1361,8 @@ theorem scottSubspaceExtendInf_eq_of_comp {e : X → Y} {f : X → D} {U : Set Y scottSubspaceExtendInf e f U = sInf (Set.image (f' : Y → D) (Set.image e Set.univ ∩ U)) := by have hset : f '' (e ⁻¹' U) = Set.image (f' : Y → D) (Set.image e Set.univ ∩ U) := by ext d - simp_all + simp_all only [mem_image, mem_preimage, image_univ, mem_inter_iff, mem_range, ↓existsAndEq, + true_and] rw [scottSubspaceExtendInf, hset] /-- **Scott 1972, Proposition 3.8 (subspace variant).** `fbar` (with the Scott @@ -1406,7 +1425,7 @@ theorem scottSubspaceExtend_eq_of_ext {e : X → Y} {f g' : X → D} (h : ∀ x, unfold scottSubspaceExtend congr 1 ext d - simp [scottSubspaceExtendInf_eq_of_ext h] + simp only [scottSubspaceExtendInf_eq_of_ext h, mem_ofPred_eq] omit [CompleteLattice Y] [TopologicalSpace X] [TopologicalSpace Y] in theorem scottSubspaceExtendInf_mono_retr {e : X → Y} {g : X → D'} @@ -1537,7 +1556,13 @@ theorem isProjection_directedSup {S : Set (ScottMap D D)} (hSne : S.Nonempty) have hsSx : ((sSup S : ScottMap D D) : D → D) x = sSup A := ScottMap.sSup_apply S x apply le_antisymm · rw [hsSx, ScottMap.sSup_apply] - simp_all + refine sSup_le ?_ + rintro _ ⟨j, hj, rfl⟩ + change (j : D → D) (sSup A) ≤ sSup A + rw [j.preservesDirectedSup_coe A hAne hAdir] + refine sSup_le ?_ + rintro _ ⟨_, ⟨k, hk, rfl⟩, rfl⟩ + exact (hle j hj (k x)).trans (le_sSup (Set.mem_image_of_mem _ hk)) · rw [hsSx, ScottMap.sSup_apply] refine sSup_le ?_ rintro _ ⟨j, hj, rfl⟩ @@ -1547,7 +1572,9 @@ theorem isProjection_directedSup {S : Set (ScottMap D D)} (hSne : S.Nonempty) _ ≤ sSup (Set.image (fun f : ScottMap D D => (f : D → D) (sSup A)) S) := le_sSup (Set.mem_image_of_mem _ hj) · rw [ScottMap.sSup_apply] - simp_all + refine sSup_le ?_ + rintro _ ⟨j, hj, rfl⟩ + exact hle j hj x /-- **Scott 1972, Proposition 3.12 (`⊔`-closure).** `J_D` is closed under arbitrary suprema in @@ -1557,7 +1584,8 @@ projection by `isProjection_finsetSup`. -/ theorem isProjection_sSup {T : Set (ScottMap D D)} (hT : ∀ j ∈ T, IsProjection j) : IsProjection (sSup T) := by rw [IsContinuousLatticeProjection.sSup_finsetSupOf T] - refine isProjection_directedSup ⟨⊥, ∅, by simp, by simp⟩ + refine isProjection_directedSup ⟨⊥, ∅, by simp only [Finset.notMem_empty, IsEmpty.forall_iff, + implies_true], by simp only [Finset.sup_empty]⟩ (IsContinuousLatticeProjection.directedOn_finsetSupOf T) ?_ rintro z ⟨F, hF, rfl⟩ exact isProjection_finsetSup fun j hj => hT j (hF j hj) diff --git a/LeanPool/DomainTheory/ContinuousLattice/Injective.lean b/LeanPool/DomainTheory/ContinuousLattice/Injective.lean index 9778ac999f..4de4ddb82a 100644 --- a/LeanPool/DomainTheory/ContinuousLattice/Injective.lean +++ b/LeanPool/DomainTheory/ContinuousLattice/Injective.lean @@ -51,7 +51,7 @@ theorem isInjectiveSpace_sierpinski : IsInjectiveSpace.{u} Prop := by obtain ⟨V, hVopen, hVeq⟩ := hfopen refine ⟨⟨fun y => y ∈ V, continuous_Prop.2 hVopen⟩, fun x => ?_⟩ have : (e x ∈ V) = (x ∈ {x | f x}) := by rw [← hVeq]; rfl - simpa using this + simpa only [ContinuousMap.coe_mk, eq_iff_iff, Set.mem_ofPred_eq] using this theorem proposition_1_2 : IsInjectiveSpace.{u} Sierpinski := isInjectiveSpace_sierpinski @@ -63,7 +63,7 @@ theorem IsInjectiveSpace.pi {ι : Type w} (D : ι → Type v) [∀ i, Topologica choose g hg using fun i => h i e he ⟨fun x => f x i, (continuous_apply i).comp f.continuous⟩ refine ⟨⟨fun y i => g i y, continuous_pi fun i => (g i).continuous⟩, fun x => ?_⟩ - simp_all + exact funext fun i => hg i x theorem proposition_1_3 {ι : Type w} (D : ι → Type v) [∀ i, TopologicalSpace (D i)] (h : ∀ i, IsInjectiveSpace.{u} (D i)) : IsInjectiveSpace.{u} (∀ i, D i) := @@ -77,7 +77,7 @@ theorem IsInjectiveSpace.of_retract {D : Type v} {D' : Type v} intro X Y _ _ e he f obtain ⟨g, hg⟩ := hD e he (s.comp f) refine ⟨r.comp g, fun x => ?_⟩ - simp_all + exact (congrArg r (hg x)).trans (hrs (f x)) theorem proposition_1_4 {D : Type v} {D' : Type v} [TopologicalSpace D] [TopologicalSpace D'] (hD : IsInjectiveSpace.{u} D) (s : C(D', D)) (r : C(D, D')) (hrs : ∀ d, r (s d) = d) : diff --git a/LeanPool/DomainTheory/ContinuousLattice/InverseLimits.lean b/LeanPool/DomainTheory/ContinuousLattice/InverseLimits.lean index 282e3c05f2..a0c71e5825 100644 --- a/LeanPool/DomainTheory/ContinuousLattice/InverseLimits.lean +++ b/LeanPool/DomainTheory/ContinuousLattice/InverseLimits.lean @@ -8,6 +8,8 @@ module public import LeanPool.DomainTheory.ContinuousLattice.FunctionSpaces import LeanPool.DomainTheory.ContinuousLattice.Constructions +import Mathlib.Tactic.Set -- shake: keep + /-! # Inverse limits of continuous lattices (Scott 1972, §4) @@ -163,7 +165,8 @@ noncomputable def invLimRetr (y : ∀ n, D n) : InverseLimit D P := theorem le_coe_invLimRetr (y : ∀ n, D n) : y ≤ (invLimRetr D P y).1 := by rw [invLimRetr, coe_sInf] - simp_all + simp_all only [le_sInf_iff, mem_image, mem_ofPred_eq, Subtype.exists, exists_and_left, + exists_prop, exists_eq_right_right, implies_true] /-- `r ⊣ incl`: the retraction is left adjoint to the inclusion. -/ theorem invLimRetr_galoisConnection : @@ -187,7 +190,7 @@ theorem invLimRetr_incl (x : InverseLimit D P) : invLimRetr D P x.1 = x := by refine le_antisymm ?_ ?_ · exact sInf_le (show x ∈ {x' : InverseLimit D P | (x.1 : ∀ n, D n) ≤ x'.1} from le_refl x.1) · refine le_sInf ?_ - simp_all + simp_all only [Subtype.coe_le_coe, mem_ofPred_eq, implies_true] /-- `D_∞` is a Scott-continuous retract of the product `∏ Dₙ`. -/ noncomputable def inverseLimitRetraction : @@ -347,7 +350,7 @@ theorem embLE_preservesDirectedSup {n m : ℕ} (h : n ≤ m) : induction m, h using Nat.le_induction with | base => have hid : embLE D P (le_refl n) = id := funext (fun x => embLE_self D P (le_refl n) x) - rw [hid]; intro S _ _; simp + rw [hid]; intro S _ _; simp only [id_eq, image_id'] | succ k hk ih => have hfun : embLE D P (Nat.le_succ_of_le hk) = (fun y : D k => (P k).incl y) ∘ embLE D P hk := @@ -362,7 +365,7 @@ theorem projLE_preservesDirectedSup {m n : ℕ} (h : m ≤ n) : induction n, h using Nat.le_induction with | base => have hid : projLE D P (le_refl m) = id := funext (fun x => projLE_self D P (le_refl m) x) - rw [hid]; intro S _ _; simp + rw [hid]; intro S _ _; simp only [id_eq, image_id'] | succ k hk ih => have hfun : projLE D P (Nat.le_succ_of_le hk) = projLE D P hk ∘ (fun z : D (k + 1) => (P k).retr z) := @@ -634,10 +637,8 @@ theorem corollary_4_3 (f : ∀ n, ScottMap (D n) D') -- `g x = f∞ x`, since `x = ⨆ₙ i_{n∞}(xₙ)` and `g` is continuous on this -- directed family calc g x = g (⨆ n, embInf D P n (x.1 n)) := by rw [← inverseLimit_eq_iSup D P x] - _ = g (sSup (Set.range fun n => embInf D P n (x.1 n))) := by rw [sSup_range] - _ = sSup (g '' Set.range fun n => embInf D P n (x.1 n)) := - g.preservesDirectedSup_coe _ (Set.range_nonempty _) (embInf_family_directed D P x) - _ = ⨆ n, g (embInf D P n (x.1 n)) := by rw [← Set.range_comp, sSup_range]; rfl + _ = ⨆ n, g (embInf D P n (x.1 n)) := + g.map_iSup_of_directed _ (directedOn_range.mp (embInf_family_directed D P x)) _ = ⨆ n, f n (x.1 n) := by simp_rw [← hg] end InverseLimit diff --git a/LeanPool/DomainTheory/ContinuousLattice/ScottMaps.lean b/LeanPool/DomainTheory/ContinuousLattice/ScottMaps.lean index 372aa0a9d7..121a065808 100644 --- a/LeanPool/DomainTheory/ContinuousLattice/ScottMaps.lean +++ b/LeanPool/DomainTheory/ContinuousLattice/ScottMaps.lean @@ -29,7 +29,7 @@ theorem preservesDirectedSup_monotone {f : D → D'} (hf : PreservesDirectedSup have hdir : DirectedOn (· ≤ ·) ({x, y} : Set D) := directedOn_pair hxy have hS : ({x, y} : Set D).Nonempty := ⟨x, Set.mem_insert _ _⟩ have hsup : sSup ({x, y} : Set D) = y := by - simp_all + simp_all only [insert_nonempty, sSup_insert, sSup_singleton, sup_of_le_right] have heq := hf hS hdir rw [hsup, Set.image_pair] at heq exact le_trans (le_sSup (Set.mem_insert _ _)) heq.symm.le @@ -102,7 +102,7 @@ theorem proposition_2_6 (f : D × D' → D'') : rintro _ ⟨a, ha, rfl⟩ _ ⟨b, hb, rfl⟩ obtain ⟨c, hc, hac, hbc⟩ := hSdir a ha b hb exact ⟨(c, y), Set.mem_image_of_mem _ hc, ⟨hac, le_rfl⟩, ⟨hbc, le_rfl⟩⟩ - have hfst : Prod.fst '' T = S := by rw [hT, Set.image_image]; simp + have hfst : Prod.fst '' T = S := by rw [hT, Set.image_image]; simp only [image_id'] have hsnd : Prod.snd '' T = {y} := by rw [hT, Set.image_image]; exact hS.image_const y have hsupT : sSup T = (sSup S, y) := by have e1 : (sSup T).1 = sSup S := by rw [Prod.fst_sSup, hfst] @@ -110,7 +110,7 @@ theorem proposition_2_6 (f : D × D' → D'') : exact Prod.ext_iff.mpr ⟨e1, e2⟩ have h := hf hTne hTdir rw [hsupT, hT, Set.image_image] at h - simpa using h + simpa only using h · set T : Set (D × D') := (fun y => (x, y)) '' S with hT have hTne : T.Nonempty := hS.image _ have hTdir : DirectedOn (· ≤ ·) T := by @@ -118,14 +118,14 @@ theorem proposition_2_6 (f : D × D' → D'') : obtain ⟨c, hc, hac, hbc⟩ := hSdir a ha b hb exact ⟨(x, c), Set.mem_image_of_mem _ hc, ⟨le_rfl, hac⟩, ⟨le_rfl, hbc⟩⟩ have hfst : Prod.fst '' T = {x} := by rw [hT, Set.image_image]; exact hS.image_const x - have hsnd : Prod.snd '' T = S := by rw [hT, Set.image_image]; simp + have hsnd : Prod.snd '' T = S := by rw [hT, Set.image_image]; simp only [image_id'] have hsupT : sSup T = (x, sSup S) := by have e1 : (sSup T).1 = x := by rw [Prod.fst_sSup, hfst, sSup_singleton] have e2 : (sSup T).2 = sSup S := by rw [Prod.snd_sSup, hsnd] exact Prod.ext_iff.mpr ⟨e1, e2⟩ have h := hf hTne hTdir rw [hsupT, hT, Set.image_image] at h - simpa using h + simpa only using h · -- separate continuity ⟹ joint continuity (Scott 1972's directedness argument) rintro ⟨h1, h2⟩ Sstar hne hdir have hmono1 : ∀ y, Monotone fun x => f (x, y) := fun y => preservesDirectedSup_monotone (h1 y) @@ -177,7 +177,7 @@ theorem proposition_2_7_sup : p.1 ⊔ p.2) := continuous_of_preservesDirectedSup <| by intro S hS hSdir - simpa using (ScottContinuous.sup₂ (β := D) (d := S) hS hSdir (isLUB_sSup S)).sSup_eq.symm + simpa only using (ScottContinuous.sup₂ (β := D) (d := S) hS hSdir (isLUB_sSup S)).sSup_eq.symm theorem meet_preservesDirectedSup (x : D) (hD : IsContinuousLattice D) : PreservesDirectedSup (fun z => x ⊓ z) := by diff --git a/LeanPool/DomainTheory/ContinuousLattice/WayBelow.lean b/LeanPool/DomainTheory/ContinuousLattice/WayBelow.lean index 88dcfe8fec..1266ffb8dc 100644 --- a/LeanPool/DomainTheory/ContinuousLattice/WayBelow.lean +++ b/LeanPool/DomainTheory/ContinuousLattice/WayBelow.lean @@ -8,6 +8,8 @@ module public import Mathlib.Order.UpperLower.Basic public import Mathlib.Order.CompleteLattice.Defs +import Mathlib.Tactic.Set -- shake: keep + /-! # The induced (Scott) topology and the way-below relation (Scott 1972, §2) @@ -61,7 +63,7 @@ theorem ScottOpen.isUpperSet {U : Set D} (h : ScottOpen U) : IsUpperSet U := h.1 theorem scottOpen_univ : ScottOpen (Set.univ : Set D) := by refine ⟨isUpperSet_univ, fun S hS _ _ => ?_⟩ - simp_all + simpa only [Set.inter_univ] using hS theorem scottOpen_inter {U V : Set D} (hU : ScottOpen U) (hV : ScottOpen V) : ScottOpen (U ∩ V) := by diff --git a/LeanPool/DomainTheory/Neighborhood/Approximable.lean b/LeanPool/DomainTheory/Neighborhood/Approximable.lean index 65b034fe48..feabaab419 100644 --- a/LeanPool/DomainTheory/Neighborhood/Approximable.lean +++ b/LeanPool/DomainTheory/Neighborhood/Approximable.lean @@ -6,7 +6,6 @@ Authors: Catskills Research Company module public import LeanPool.DomainTheory.Neighborhood.Basic -import Mathlib.Data.Set.Basic import Mathlib.Tactic.Set /-! @@ -462,7 +461,7 @@ theorem exists_principal_eq_apply_principal (e : V₀.Element ≃o V₁.Element) rwa [e.apply_symm_apply] at this exact h2 Y ⟨hY, subset_rfl⟩ have hX_le_z : V₀.principal hX ≤ z := by - simp_all + simp_all only [exists_and_left, OrderIso.symm_apply_apply, map_le_map_iff] -- Hence `z = ↑X`, so `X ∈ z` lands in some member `e⁻¹(↑Y)`. have hz_eq : z = V₀.principal hX := le_antisymm hz_le hX_le_z have hXz : z.mem X := hz_eq ▸ ⟨hX, subset_rfl⟩ @@ -478,6 +477,18 @@ theorem exists_principal_eq_apply_principal (e : V₀.Element ≃o V₁.Element) rwa [← hw] at this exact le_antisymm hw_le_prinY (hprin_le_w hY hYw) +/-- Diagonal witnesses and containment in set inclusion characterize the +canonical inclusion relation. Monotonicity supplies every larger output. -/ +theorem relation_iff_subset_of_diagonal {α : Type*} {V W : NeighborhoodSystem α} + (f : ApproximableMap V W) (diagonal : ∀ X, V.mem X → f.rel X X) + (contained : ∀ X Y, f.rel X Y → X ⊆ Y) {X Y : Set α} : + f.rel X Y ↔ V.mem X ∧ W.mem Y ∧ X ⊆ Y := by + constructor + · intro relation + exact ⟨f.rel_dom relation, f.rel_cod relation, contained X Y relation⟩ + · rintro ⟨hX, hY, hXY⟩ + exact f.mono (diagonal X hX) subset_rfl hXY hX hY + end ApproximableMap end Domain.Neighborhood diff --git a/LeanPool/DomainTheory/Neighborhood/ApproximableExercises.lean b/LeanPool/DomainTheory/Neighborhood/ApproximableExercises.lean index d334974dae..f733fc1090 100644 --- a/LeanPool/DomainTheory/Neighborhood/ApproximableExercises.lean +++ b/LeanPool/DomainTheory/Neighborhood/ApproximableExercises.lean @@ -6,7 +6,6 @@ Authors: Catskills Research Company module public import LeanPool.DomainTheory.Neighborhood.Approximable -import Mathlib.Data.Set.Image /-! # Lecture II (§2) — Exercises 2.8–2.12 and 2.19 (the algebra of approximable diff --git a/LeanPool/DomainTheory/Neighborhood/Basic.lean b/LeanPool/DomainTheory/Neighborhood/Basic.lean index 41969e8550..e51b37671f 100644 --- a/LeanPool/DomainTheory/Neighborhood/Basic.lean +++ b/LeanPool/DomainTheory/Neighborhood/Basic.lean @@ -8,11 +8,8 @@ module public import Mathlib.Data.Set.Lattice.Bounded public import Mathlib.Data.Set.Lattice.Disjoint public import Mathlib.Data.Set.Lattice.Image -public import Mathlib.Data.Set.Lattice.Indexed public import Mathlib.Data.Set.Lattice.Order -public import Mathlib.Order.Hom.Basic -public import Mathlib.Data.Set.Basic /-! # Neighborhood systems (Scott 1981, PRG-19, §1) — foundations @@ -288,7 +285,7 @@ theorem Element.ext {x y : V.Element} (h : ∀ X, x.mem X ↔ y.mem X) : x = y : rcases x with ⟨xmem, _, _, _, _⟩ rcases y with ⟨ymem, _, _, _, _⟩ have hmem : xmem = ymem := funext fun X => propext (h X) - simp_all + simp_all only [implies_true] /-- A filter (`Element`) is closed under the finite intersection `⋂_{i propext (hmem X) - simp_all + simp_all only [implies_true] /-- The subsystem relation is **antisymmetric**: `D ◁ E` and `E ◁ D` force `D = E`. (Mutual `sub` diff --git a/LeanPool/DomainTheory/Neighborhood/Definition613.lean b/LeanPool/DomainTheory/Neighborhood/Definition613.lean index 254219dfce..e6ba5c9238 100644 --- a/LeanPool/DomainTheory/Neighborhood/Definition613.lean +++ b/LeanPool/DomainTheory/Neighborhood/Definition613.lean @@ -7,14 +7,6 @@ module public import LeanPool.DomainTheory.Neighborhood.Definition68 public import LeanPool.DomainTheory.Neighborhood.Proposition612 -public import Mathlib.Order.Directed -public import Mathlib.Order.SetNotation -import Mathlib.Data.Finset.Attr -import Mathlib.Data.Rat.Cast.Order -import Mathlib.Tactic.NormNum.Abs -import Mathlib.Tactic.NormNum.DivMod -import Mathlib.Tactic.NormNum.OfScientific -import Mathlib.Tactic.NormNum.Pow /-! # Lecture VI — Definition 6.13 (Scott 1981, PRG-19): functors *monotone / diff --git a/LeanPool/DomainTheory/Neighborhood/Definition68.lean b/LeanPool/DomainTheory/Neighborhood/Definition68.lean index cd56dc1f2f..7e2b172259 100644 --- a/LeanPool/DomainTheory/Neighborhood/Definition68.lean +++ b/LeanPool/DomainTheory/Neighborhood/Definition68.lean @@ -7,12 +7,6 @@ module public import LeanPool.DomainTheory.Neighborhood.Definition63 public import LeanPool.DomainTheory.Neighborhood.Exercise510 -import Mathlib.Data.Finset.Attr -import Mathlib.Data.Rat.Cast.Order -import Mathlib.Tactic.NormNum.Abs -import Mathlib.Tactic.NormNum.DivMod -import Mathlib.Tactic.NormNum.OfScientific -import Mathlib.Tactic.NormNum.Pow /-! # Lecture VI — Definition 6.8 (Scott 1981, PRG-19): functors *continuous on maps* diff --git a/LeanPool/DomainTheory/Neighborhood/Example12.lean b/LeanPool/DomainTheory/Neighborhood/Example12.lean index c856b2bc51..5e2a653f4e 100644 --- a/LeanPool/DomainTheory/Neighborhood/Example12.lean +++ b/LeanPool/DomainTheory/Neighborhood/Example12.lean @@ -6,9 +6,6 @@ Authors: Catskills Research Company module public import LeanPool.DomainTheory.Neighborhood.Basic -public import Mathlib.Data.Set.Basic -import Mathlib.Data.Fintype.Basic -import Mathlib.Tactic.FinCases /-! # Example 1.2 (Scott 1981, PRG-19, §1) @@ -45,16 +42,18 @@ def memSet : Set (Set Token) := {master, zero, one} /-- Membership in the neighbourhood system `𝒟` of Example 1.2. -/ def mem (X : Set Token) : Prop := X ∈ memSet -theorem mem_master : mem master := by simp [mem, memSet, master, zero, one] -theorem mem_zero : mem zero := by simp [mem, memSet, master, zero, one] -theorem mem_one : mem one := by simp [mem, memSet, master, zero, one] +theorem mem_master : mem master := by + exact Or.inl rfl +theorem mem_zero : mem zero := by + exact Or.inr (Or.inl rfl) +theorem mem_one : mem one := by + exact Or.inr (Or.inr (rfl)) /-- A neighbourhood of Example 1.2 is exactly one of `Δ`, `{0}`, or `{1}`. -/ theorem mem_iff (X : Set Token) : mem X ↔ X = master ∨ X = zero ∨ X = one := by constructor · intro h - simp only [mem, memSet, master, zero, one, Set.mem_insert_iff, - Set.mem_singleton_iff] at h + simp only [mem, memSet, master, zero, one, Set.mem_insert_iff, Set.mem_singleton_iff] at h rcases h with rfl | rfl | rfl · exact Or.inl rfl · exact Or.inr (Or.inl rfl) @@ -69,38 +68,41 @@ theorem not_mem_empty : ¬mem (∅ : Set Token) := by intro h rcases (mem_iff (∅ : Set Token)).mp h with h | h | h · rw [master] at h; exact Set.empty_ne_univ h - · simp [zero] at h - · simp [one] at h + · simp only [zero, Fin.isValue, Set.empty_ne_singleton] at h + · simp only [one, Fin.isValue, Set.empty_ne_singleton] at h private theorem zero_ne_master : zero ≠ master := by intro h - have : (1 : Token) ∈ zero := h ▸ (by simp [master]) - simp [zero] at this + have : (1 : Token) ∈ zero := h ▸ (by simp only [master, Fin.isValue, Set.mem_univ]) + simp only [zero, Fin.isValue, Set.mem_singleton_iff, Fin.one_eq_zero_iff, + Nat.succ_ne_self] at this private theorem one_ne_master : one ≠ master := by intro h - have : (0 : Token) ∈ one := h ▸ (by simp [master]) - simp [one] at this + have : (0 : Token) ∈ one := h ▸ (by simp only [master, Fin.isValue, Set.mem_univ]) + simp only [one, Fin.isValue, Set.mem_singleton_iff, Fin.zero_eq_one_iff, Nat.succ_ne_self] at this private theorem master_not_subset_zero : ¬master ⊆ zero := by intro h - have : (1 : Token) ∈ zero := h (by simp [master]) - simp [zero] at this + have : (1 : Token) ∈ zero := h (by simp only [master, Fin.isValue, Set.mem_univ]) + simp only [zero, Fin.isValue, Set.mem_singleton_iff, Fin.one_eq_zero_iff, + Nat.succ_ne_self] at this private theorem master_not_subset_one : ¬master ⊆ one := by intro h - have : (0 : Token) ∈ one := h (by simp [master]) - simp [one] at this + have : (0 : Token) ∈ one := h (by simp only [master, Fin.isValue, Set.mem_univ]) + simp only [one, Fin.isValue, Set.mem_singleton_iff, Fin.zero_eq_one_iff, Nat.succ_ne_self] at this private theorem one_not_subset_zero : ¬one ⊆ zero := by intro h - have : (1 : Token) ∈ zero := h (by simp [one]) - simp [zero] at this + have : (1 : Token) ∈ zero := h (by simp only [one, Fin.isValue, Set.mem_singleton_iff]) + simp only [zero, Fin.isValue, Set.mem_singleton_iff, Fin.one_eq_zero_iff, + Nat.succ_ne_self] at this private theorem zero_not_subset_one : ¬zero ⊆ one := by intro h - have : (0 : Token) ∈ one := h (by simp [zero]) - simp [one] at this + have : (0 : Token) ∈ one := h (by simp only [zero, Fin.isValue, Set.mem_singleton_iff]) + simp only [one, Fin.isValue, Set.mem_singleton_iff, Fin.zero_eq_one_iff, Nat.succ_ne_self] at this private theorem eq_of_master_subset {Y : Set Token} (h : mem Y) (hsub : master ⊆ Y) : Y = master := by @@ -116,10 +118,10 @@ private theorem inter_master (A : Set Token) : A ∩ master = A := by rw [master]; exact Set.inter_univ A private theorem zero_inter_one : zero ∩ one = (∅ : Set Token) := by - ext t; fin_cases t <;> simp [zero, one] + exact Set.inter_singleton_eq_empty.mpr (by change (1 : Token) ≠ 0; decide) private theorem one_inter_zero : one ∩ zero = (∅ : Set Token) := by - ext t; fin_cases t <;> simp [zero, one] + rw [Set.inter_comm]; exact zero_inter_one private theorem inter_eq (X Y : Set Token) (h : mem X) (h' : mem Y) : X ∩ Y = master ∨ X ∩ Y = zero ∨ X ∩ Y = one ∨ X ∩ Y = (∅ : Set Token) := by diff --git a/LeanPool/DomainTheory/Neighborhood/Example13.lean b/LeanPool/DomainTheory/Neighborhood/Example13.lean index 7dfb1a00a4..9e13ef2708 100644 --- a/LeanPool/DomainTheory/Neighborhood/Example13.lean +++ b/LeanPool/DomainTheory/Neighborhood/Example13.lean @@ -6,9 +6,6 @@ Authors: Catskills Research Company module public import LeanPool.DomainTheory.Neighborhood.Basic -public import Mathlib.Data.Set.Basic -import Mathlib.Data.Fintype.Basic -import Mathlib.Tactic.FinCases /-! # Example 1.3 (Scott 1981, PRG-19, §1) @@ -22,7 +19,7 @@ its domain elements (Definition 1.6): there are exactly three filters in a linea chain `⊥ < {Δ,{1,2}} < {Δ,{1,2},{2}}`, with token `2` the sole total element. -This is a concrete finite computation (`fin_cases`/`simp`); footprint +The finite set calculations use subset and intersection lemmas; footprint `[propext, Classical.choice, Quot.sound]` — same as Example 1.2. -/ @@ -48,16 +45,18 @@ def memSet : Set (Set Token) := {master, twelve, two} /-- Membership in the neighbourhood system `𝒟` of Example 1.3. -/ def mem (X : Set Token) : Prop := X ∈ memSet -theorem mem_master : mem master := by simp [mem, memSet, master, twelve, two] -theorem mem_twelve : mem twelve := by simp [mem, memSet, master, twelve, two] -theorem mem_two : mem two := by simp [mem, memSet, master, twelve, two] +theorem mem_master : mem master := by + exact Or.inl rfl +theorem mem_twelve : mem twelve := by + exact Or.inr (Or.inl rfl) +theorem mem_two : mem two := by + exact Or.inr (Or.inr (rfl)) /-- A neighbourhood of Example 1.3 is exactly one of `Δ`, `{1,2}`, or `{2}`. -/ theorem mem_iff (X : Set Token) : mem X ↔ X = master ∨ X = twelve ∨ X = two := by constructor · intro h - simp only [mem, memSet, master, twelve, two, Set.mem_insert_iff, - Set.mem_singleton_iff] at h + simp only [mem, memSet, master, twelve, two, Set.mem_insert_iff, Set.mem_singleton_iff] at h rcases h with rfl | rfl | rfl · exact Or.inl rfl · exact Or.inr (Or.inl rfl) @@ -72,37 +71,41 @@ private theorem twelve_ne_master : twelve ≠ master := by intro h have hmem : (0 : Token) ∈ twelve := by rw [h] - simp [master] - simp [twelve] at hmem + simp only [master, Fin.isValue, Set.mem_univ] + simp only [twelve, Fin.isValue, Set.mem_insert_iff, Fin.reduceEq, Set.mem_singleton_iff, + Fin.zero_eq_one_iff, Nat.reduceEqDiff, or_self] at hmem private theorem two_ne_master : two ≠ master := by intro h have hmem : (0 : Token) ∈ two := by rw [h] - simp [master] - simp [two] at hmem + simp only [master, Fin.isValue, Set.mem_univ] + simp only [two, Fin.isValue, Set.mem_singleton_iff, Fin.reduceEq] at hmem private theorem two_ne_twelve : two ≠ twelve := by intro h have hmem : (1 : Token) ∈ two := by rw [h] - simp [twelve] - simp [two] at hmem + simp only [twelve, Fin.isValue, Set.mem_insert_iff, Fin.reduceEq, Set.mem_singleton_iff, + or_true] + simp only [two, Fin.isValue, Set.mem_singleton_iff, Fin.reduceEq] at hmem private theorem master_not_subset_twelve : ¬master ⊆ twelve := by intro h - have : (0 : Token) ∈ twelve := h (by simp [master]) - simp [twelve] at this + have : (0 : Token) ∈ twelve := h (by simp only [master, Fin.isValue, Set.mem_univ]) + simp only [twelve, Fin.isValue, Set.mem_insert_iff, Fin.reduceEq, Set.mem_singleton_iff, + Fin.zero_eq_one_iff, Nat.reduceEqDiff, or_self] at this private theorem master_not_subset_two : ¬master ⊆ two := by intro h - have : (0 : Token) ∈ two := h (by simp [master]) - simp [two] at this + have : (0 : Token) ∈ two := h (by simp only [master, Fin.isValue, Set.mem_univ]) + simp only [two, Fin.isValue, Set.mem_singleton_iff, Fin.reduceEq] at this private theorem twelve_not_subset_two : ¬twelve ⊆ two := by intro h - have : (1 : Token) ∈ two := h (by simp [twelve]) - simp [two] at this + have : (1 : Token) ∈ two := h (by simp only [twelve, Fin.isValue, Set.mem_insert_iff, + Fin.reduceEq, Set.mem_singleton_iff, or_true]) + simp only [two, Fin.isValue, Set.mem_singleton_iff, Fin.reduceEq] at this private theorem eq_of_master_subset {Y : Set Token} (h : mem Y) (hsub : master ⊆ Y) : Y = master := by @@ -118,12 +121,10 @@ private theorem inter_master (A : Set Token) : A ∩ master = A := by rw [master]; exact Set.inter_univ A private theorem twelve_inter_two : twelve ∩ two = two := by - ext t - fin_cases t <;> simp [twelve, two] + exact Set.inter_singleton_of_mem (Or.inl rfl) private theorem two_inter_twelve : two ∩ twelve = two := by - ext t - fin_cases t <;> simp [twelve, two] + rw [Set.inter_comm]; exact twelve_inter_two private theorem inter_eq (X Y : Set Token) (h : mem X) (h' : mem Y) : X ∩ Y = master ∨ X ∩ Y = twelve ∨ X ∩ Y = two := by @@ -227,8 +228,7 @@ def elemTwo : neighborhoodSystem.Element where · exact Or.inr (Or.inr rfl) private theorem two_subset_twelve : two ⊆ twelve := by - intro t ht - fin_cases t <;> simp [two, twelve] at ht ⊢ + exact Set.singleton_subset_iff.mpr (Or.inl rfl) private theorem mem_two_of_mem (x : neighborhoodSystem.Element) (h : x.mem two) : x = elemTwo := by diff --git a/LeanPool/DomainTheory/Neighborhood/Example14.lean b/LeanPool/DomainTheory/Neighborhood/Example14.lean index c469526d97..c8cd7fa65e 100644 --- a/LeanPool/DomainTheory/Neighborhood/Example14.lean +++ b/LeanPool/DomainTheory/Neighborhood/Example14.lean @@ -6,9 +6,6 @@ Authors: Catskills Research Company module public import LeanPool.DomainTheory.Neighborhood.Basic -public import Mathlib.Data.Set.Basic -import Mathlib.Data.Fintype.Basic -import Mathlib.Tactic.FinCases /-! # Example 1.4 (Scott 1981, PRG-19, §1) @@ -39,7 +36,7 @@ the first example with **branching** — at the partial elements `elemZero`/`elemOne` one has a *choice* of how to refine toward one of the four total (leaf) elements. -This is a concrete finite computation (`fin_cases`/`simp`); footprint +The finite set calculations use subset and intersection lemmas; footprint `[propext, Classical.choice, Quot.sound]` — same as Examples 1.2/1.3. -/ @@ -80,19 +77,19 @@ def memSet : Set (Set Token) := {master, left, right, leaf00, leaf01, leaf10, le def mem (X : Set Token) : Prop := X ∈ memSet theorem mem_master : mem master := by - simp [mem, memSet, master, left, right, leaf00, leaf01, leaf10, leaf11] + exact Or.inl rfl theorem mem_left : mem left := by - simp [mem, memSet, master, left, right, leaf00, leaf01, leaf10, leaf11] + exact Or.inr (Or.inl rfl) theorem mem_right : mem right := by - simp [mem, memSet, master, left, right, leaf00, leaf01, leaf10, leaf11] + exact Or.inr (Or.inr (Or.inl rfl)) theorem mem_leaf00 : mem leaf00 := by - simp [mem, memSet, master, left, right, leaf00, leaf01, leaf10, leaf11] + exact Or.inr (Or.inr (Or.inr (Or.inl rfl))) theorem mem_leaf01 : mem leaf01 := by - simp [mem, memSet, master, left, right, leaf00, leaf01, leaf10, leaf11] + exact Or.inr (Or.inr (Or.inr (Or.inr (Or.inl rfl)))) theorem mem_leaf10 : mem leaf10 := by - simp [mem, memSet, master, left, right, leaf00, leaf01, leaf10, leaf11] + exact Or.inr (Or.inr (Or.inr (Or.inr (Or.inr (Or.inl rfl))))) theorem mem_leaf11 : mem leaf11 := by - simp [mem, memSet, master, left, right, leaf00, leaf01, leaf10, leaf11] + exact Or.inr (Or.inr (Or.inr (Or.inr (Or.inr (Or.inr (rfl)))))) /-- A neighbourhood of Example 1.4 is exactly one of the seven. -/ theorem mem_iff (X : Set Token) : @@ -100,7 +97,7 @@ theorem mem_iff (X : Set Token) : leaf11 := by constructor · intro h - simpa [mem, memSet] using h + simpa only [mem, memSet, Set.mem_insert_iff, Set.mem_singleton_iff] using h · intro h rcases h with rfl | rfl | rfl | rfl | rfl | rfl | rfl · exact mem_master @@ -114,163 +111,242 @@ theorem mem_iff (X : Set Token) : theorem not_mem_empty : ¬mem (∅ : Set Token) := by intro h rcases (mem_iff (∅ : Set Token)).mp h with h | h | h | h | h | h | h - · have : (0 : Token) ∈ (∅ : Set Token) := by rw [h]; simp [master] - simp at this - · have : (1 : Token) ∈ (∅ : Set Token) := by rw [h]; simp [left] - simp at this - · have : (2 : Token) ∈ (∅ : Set Token) := by rw [h]; simp [right] - simp at this - · have : (3 : Token) ∈ (∅ : Set Token) := by rw [h]; simp [leaf00] - simp at this - · have : (4 : Token) ∈ (∅ : Set Token) := by rw [h]; simp [leaf01] - simp at this - · have : (5 : Token) ∈ (∅ : Set Token) := by rw [h]; simp [leaf10] - simp at this - · have : (6 : Token) ∈ (∅ : Set Token) := by rw [h]; simp [leaf11] - simp at this + · have : (0 : Token) ∈ (∅ : Set Token) := by rw [h]; simp only [master, Fin.isValue, + Set.mem_univ] + simp only [Fin.isValue, Set.mem_empty_iff_false] at this + · have : (1 : Token) ∈ (∅ : Set Token) := by rw [h]; simp only [left, Fin.isValue, + Set.mem_insert_iff, Fin.reduceEq, Set.mem_singleton_iff, or_self, or_false] + simp only [Fin.isValue, Set.mem_empty_iff_false] at this + · have : (2 : Token) ∈ (∅ : Set Token) := by rw [h]; simp only [right, Fin.isValue, + Set.mem_insert_iff, Fin.reduceEq, Set.mem_singleton_iff, or_self, or_false] + simp only [Fin.isValue, Set.mem_empty_iff_false] at this + · have : (3 : Token) ∈ (∅ : Set Token) := by rw [h]; simp only [leaf00, Fin.isValue, + Set.mem_singleton_iff] + simp only [Fin.isValue, Set.mem_empty_iff_false] at this + · have : (4 : Token) ∈ (∅ : Set Token) := by rw [h]; simp only [leaf01, Fin.isValue, + Set.mem_singleton_iff] + simp only [Fin.isValue, Set.mem_empty_iff_false] at this + · have : (5 : Token) ∈ (∅ : Set Token) := by rw [h]; simp only [leaf10, Fin.isValue, + Set.mem_singleton_iff] + simp only [Fin.isValue, Set.mem_empty_iff_false] at this + · have : (6 : Token) ∈ (∅ : Set Token) := by rw [h]; simp only [leaf11, Fin.isValue, + Set.mem_singleton_iff] + simp only [Fin.isValue, Set.mem_empty_iff_false] at this /-! ### Distinctness of neighbourhoods (only the pairs needed below). -/ private theorem left_ne_master : left ≠ master := by intro h - have hmem : (0 : Token) ∈ left := by rw [h]; simp [master] - simp [left] at hmem + have hmem : (0 : Token) ∈ left := by rw [h]; simp only [master, Fin.isValue, Set.mem_univ] + simp only [left, Fin.isValue, Set.mem_insert_iff, Fin.zero_eq_one_iff, Nat.reduceEqDiff, + Fin.reduceEq, Set.mem_singleton_iff, or_self] at hmem private theorem right_ne_master : right ≠ master := by intro h - have hmem : (0 : Token) ∈ right := by rw [h]; simp [master] - simp [right] at hmem + have hmem : (0 : Token) ∈ right := by rw [h]; simp only [master, Fin.isValue, Set.mem_univ] + simp only [right, Fin.isValue, Set.mem_insert_iff, Fin.reduceEq, Set.mem_singleton_iff, + or_self] at hmem private theorem leaf00_ne_master : leaf00 ≠ master := by intro h - have hmem : (0 : Token) ∈ leaf00 := by rw [h]; simp [master] - simp [leaf00] at hmem + have hmem : (0 : Token) ∈ leaf00 := by rw [h]; simp only [master, Fin.isValue, Set.mem_univ] + simp only [leaf00, Fin.isValue, Set.mem_singleton_iff, Fin.reduceEq] at hmem private theorem leaf01_ne_master : leaf01 ≠ master := by intro h - have hmem : (0 : Token) ∈ leaf01 := by rw [h]; simp [master] - simp [leaf01] at hmem + have hmem : (0 : Token) ∈ leaf01 := by rw [h]; simp only [master, Fin.isValue, Set.mem_univ] + simp only [leaf01, Fin.isValue, Set.mem_singleton_iff, Fin.reduceEq] at hmem private theorem leaf10_ne_master : leaf10 ≠ master := by intro h - have hmem : (0 : Token) ∈ leaf10 := by rw [h]; simp [master] - simp [leaf10] at hmem + have hmem : (0 : Token) ∈ leaf10 := by rw [h]; simp only [master, Fin.isValue, Set.mem_univ] + simp only [leaf10, Fin.isValue, Set.mem_singleton_iff, Fin.reduceEq] at hmem private theorem leaf11_ne_master : leaf11 ≠ master := by intro h - have hmem : (0 : Token) ∈ leaf11 := by rw [h]; simp [master] - simp [leaf11] at hmem + have hmem : (0 : Token) ∈ leaf11 := by rw [h]; simp only [master, Fin.isValue, Set.mem_univ] + simp only [leaf11, Fin.isValue, Set.mem_singleton_iff, Fin.reduceEq] at hmem private theorem leaf00_ne_left : leaf00 ≠ left := by intro h - have hmem : (1 : Token) ∈ leaf00 := by rw [h]; simp [left] - simp [leaf00] at hmem + have hmem : (1 : Token) ∈ leaf00 := by rw [h]; simp only [left, Fin.isValue, + Set.mem_insert_iff, Fin.reduceEq, Set.mem_singleton_iff, or_self, or_false] + simp only [leaf00, Fin.isValue, Set.mem_singleton_iff, Fin.reduceEq] at hmem private theorem leaf01_ne_left : leaf01 ≠ left := by intro h - have hmem : (1 : Token) ∈ leaf01 := by rw [h]; simp [left] - simp [leaf01] at hmem + have hmem : (1 : Token) ∈ leaf01 := by rw [h]; simp only [left, Fin.isValue, + Set.mem_insert_iff, Fin.reduceEq, Set.mem_singleton_iff, or_self, or_false] + simp only [leaf01, Fin.isValue, Set.mem_singleton_iff, Fin.reduceEq] at hmem private theorem leaf10_ne_right : leaf10 ≠ right := by intro h - have hmem : (2 : Token) ∈ leaf10 := by rw [h]; simp [right] - simp [leaf10] at hmem + have hmem : (2 : Token) ∈ leaf10 := by rw [h]; simp only [right, Fin.isValue, + Set.mem_insert_iff, Fin.reduceEq, Set.mem_singleton_iff, or_self, or_false] + simp only [leaf10, Fin.isValue, Set.mem_singleton_iff, Fin.reduceEq] at hmem private theorem leaf11_ne_right : leaf11 ≠ right := by intro h - have hmem : (2 : Token) ∈ leaf11 := by rw [h]; simp [right] - simp [leaf11] at hmem + have hmem : (2 : Token) ∈ leaf11 := by rw [h]; simp only [right, Fin.isValue, + Set.mem_insert_iff, Fin.reduceEq, Set.mem_singleton_iff, or_self, or_false] + simp only [leaf11, Fin.isValue, Set.mem_singleton_iff, Fin.reduceEq] at hmem /-! ### Nested-subset facts. -/ private theorem leaf00_subset_left : leaf00 ⊆ left := by - intro t ht; fin_cases t <;> simp [leaf00, left] at ht ⊢ + exact Set.singleton_subset_iff.mpr (Or.inr (Or.inl rfl)) private theorem leaf01_subset_left : leaf01 ⊆ left := by - intro t ht; fin_cases t <;> simp [leaf01, left] at ht ⊢ + exact Set.singleton_subset_iff.mpr (Or.inr (Or.inr rfl)) private theorem leaf10_subset_right : leaf10 ⊆ right := by - intro t ht; fin_cases t <;> simp [leaf10, right] at ht ⊢ + exact Set.singleton_subset_iff.mpr (Or.inr (Or.inl rfl)) private theorem leaf11_subset_right : leaf11 ⊆ right := by - intro t ht; fin_cases t <;> simp [leaf11, right] at ht ⊢ + exact Set.singleton_subset_iff.mpr (Or.inr (Or.inr rfl)) /-! ### "Which neighbourhoods contain a given one" (upward classification). -/ private theorem eq_of_master_subset {Y : Set Token} (hY : mem Y) (h : master ⊆ Y) : Y = master := by rcases (mem_iff Y).mp hY with rfl | rfl | rfl | rfl | rfl | rfl | rfl · rfl - · exact absurd (h (show (0 : Token) ∈ master by simp [master])) (by simp [left]) - · exact absurd (h (show (0 : Token) ∈ master by simp [master])) (by simp [right]) - · exact absurd (h (show (0 : Token) ∈ master by simp [master])) (by simp [leaf00]) - · exact absurd (h (show (0 : Token) ∈ master by simp [master])) (by simp [leaf01]) - · exact absurd (h (show (0 : Token) ∈ master by simp [master])) (by simp [leaf10]) - · exact absurd (h (show (0 : Token) ∈ master by simp [master])) (by simp [leaf11]) + · exact absurd (h (show (0 : Token) ∈ master by simp only [master, Fin.isValue, + Set.mem_univ])) (by simp only [left, Fin.isValue, Set.mem_insert_iff, Fin.zero_eq_one_iff, + Nat.reduceEqDiff, Fin.reduceEq, Set.mem_singleton_iff, or_self, not_false_eq_true]) + · exact absurd (h (show (0 : Token) ∈ master by simp only [master, Fin.isValue, + Set.mem_univ])) (by simp only [right, Fin.isValue, Set.mem_insert_iff, Fin.reduceEq, + Set.mem_singleton_iff, or_self, not_false_eq_true]) + · exact absurd (h (show (0 : Token) ∈ master by simp only [master, Fin.isValue, + Set.mem_univ])) (by simp only [leaf00, Fin.isValue, Set.mem_singleton_iff, Fin.reduceEq, + not_false_eq_true]) + · exact absurd (h (show (0 : Token) ∈ master by simp only [master, Fin.isValue, + Set.mem_univ])) (by simp only [leaf01, Fin.isValue, Set.mem_singleton_iff, Fin.reduceEq, + not_false_eq_true]) + · exact absurd (h (show (0 : Token) ∈ master by simp only [master, Fin.isValue, + Set.mem_univ])) (by simp only [leaf10, Fin.isValue, Set.mem_singleton_iff, Fin.reduceEq, + not_false_eq_true]) + · exact absurd (h (show (0 : Token) ∈ master by simp only [master, Fin.isValue, + Set.mem_univ])) (by simp only [leaf11, Fin.isValue, Set.mem_singleton_iff, Fin.reduceEq, + not_false_eq_true]) private theorem left_subset_cases {Y : Set Token} (hY : mem Y) (h : left ⊆ Y) : Y = master ∨ Y = left := by rcases (mem_iff Y).mp hY with rfl | rfl | rfl | rfl | rfl | rfl | rfl · exact Or.inl rfl · exact Or.inr rfl - · exact absurd (h (show (1 : Token) ∈ left by simp [left])) (by simp [right]) - · exact absurd (h (show (1 : Token) ∈ left by simp [left])) (by simp [leaf00]) - · exact absurd (h (show (1 : Token) ∈ left by simp [left])) (by simp [leaf01]) - · exact absurd (h (show (1 : Token) ∈ left by simp [left])) (by simp [leaf10]) - · exact absurd (h (show (1 : Token) ∈ left by simp [left])) (by simp [leaf11]) + · exact absurd (h (show (1 : Token) ∈ left by simp only [left, Fin.isValue, + Set.mem_insert_iff, Fin.reduceEq, Set.mem_singleton_iff, or_self, or_false])) (by simp only [ + right, Fin.isValue, Set.mem_insert_iff, Fin.reduceEq, Set.mem_singleton_iff, or_self, + not_false_eq_true]) + · exact absurd (h (show (1 : Token) ∈ left by simp only [left, Fin.isValue, + Set.mem_insert_iff, Fin.reduceEq, Set.mem_singleton_iff, or_self, or_false])) (by simp only [ + leaf00, Fin.isValue, Set.mem_singleton_iff, Fin.reduceEq, not_false_eq_true]) + · exact absurd (h (show (1 : Token) ∈ left by simp only [left, Fin.isValue, + Set.mem_insert_iff, Fin.reduceEq, Set.mem_singleton_iff, or_self, or_false])) (by simp only [ + leaf01, Fin.isValue, Set.mem_singleton_iff, Fin.reduceEq, not_false_eq_true]) + · exact absurd (h (show (1 : Token) ∈ left by simp only [left, Fin.isValue, + Set.mem_insert_iff, Fin.reduceEq, Set.mem_singleton_iff, or_self, or_false])) (by simp only [ + leaf10, Fin.isValue, Set.mem_singleton_iff, Fin.reduceEq, not_false_eq_true]) + · exact absurd (h (show (1 : Token) ∈ left by simp only [left, Fin.isValue, + Set.mem_insert_iff, Fin.reduceEq, Set.mem_singleton_iff, or_self, or_false])) (by simp only [ + leaf11, Fin.isValue, Set.mem_singleton_iff, Fin.reduceEq, not_false_eq_true]) private theorem right_subset_cases {Y : Set Token} (hY : mem Y) (h : right ⊆ Y) : Y = master ∨ Y = right := by rcases (mem_iff Y).mp hY with rfl | rfl | rfl | rfl | rfl | rfl | rfl · exact Or.inl rfl - · exact absurd (h (show (2 : Token) ∈ right by simp [right])) (by simp [left]) + · exact absurd (h (show (2 : Token) ∈ right by simp only [right, Fin.isValue, + Set.mem_insert_iff, Fin.reduceEq, Set.mem_singleton_iff, or_self, or_false])) (by simp only [ + left, Fin.isValue, Set.mem_insert_iff, Fin.reduceEq, Set.mem_singleton_iff, or_self, + not_false_eq_true]) · exact Or.inr rfl - · exact absurd (h (show (2 : Token) ∈ right by simp [right])) (by simp [leaf00]) - · exact absurd (h (show (2 : Token) ∈ right by simp [right])) (by simp [leaf01]) - · exact absurd (h (show (2 : Token) ∈ right by simp [right])) (by simp [leaf10]) - · exact absurd (h (show (2 : Token) ∈ right by simp [right])) (by simp [leaf11]) + · exact absurd (h (show (2 : Token) ∈ right by simp only [right, Fin.isValue, + Set.mem_insert_iff, Fin.reduceEq, Set.mem_singleton_iff, or_self, or_false])) (by simp only [ + leaf00, Fin.isValue, Set.mem_singleton_iff, Fin.reduceEq, not_false_eq_true]) + · exact absurd (h (show (2 : Token) ∈ right by simp only [right, Fin.isValue, + Set.mem_insert_iff, Fin.reduceEq, Set.mem_singleton_iff, or_self, or_false])) (by simp only [ + leaf01, Fin.isValue, Set.mem_singleton_iff, Fin.reduceEq, not_false_eq_true]) + · exact absurd (h (show (2 : Token) ∈ right by simp only [right, Fin.isValue, + Set.mem_insert_iff, Fin.reduceEq, Set.mem_singleton_iff, or_self, or_false])) (by simp only [ + leaf10, Fin.isValue, Set.mem_singleton_iff, Fin.reduceEq, not_false_eq_true]) + · exact absurd (h (show (2 : Token) ∈ right by simp only [right, Fin.isValue, + Set.mem_insert_iff, Fin.reduceEq, Set.mem_singleton_iff, or_self, or_false])) (by simp only [ + leaf11, Fin.isValue, Set.mem_singleton_iff, Fin.reduceEq, not_false_eq_true]) private theorem leaf00_subset_cases {Y : Set Token} (hY : mem Y) (h : leaf00 ⊆ Y) : Y = master ∨ Y = left ∨ Y = leaf00 := by rcases (mem_iff Y).mp hY with rfl | rfl | rfl | rfl | rfl | rfl | rfl · exact Or.inl rfl · exact Or.inr (Or.inl rfl) - · exact absurd (h (show (3 : Token) ∈ leaf00 by simp [leaf00])) (by simp [right]) + · exact absurd (h (show (3 : Token) ∈ leaf00 by simp only [leaf00, Fin.isValue, + Set.mem_singleton_iff])) (by simp only [right, Fin.isValue, Set.mem_insert_iff, + Fin.reduceEq, Set.mem_singleton_iff, or_self, not_false_eq_true]) · exact Or.inr (Or.inr rfl) - · exact absurd (h (show (3 : Token) ∈ leaf00 by simp [leaf00])) (by simp [leaf01]) - · exact absurd (h (show (3 : Token) ∈ leaf00 by simp [leaf00])) (by simp [leaf10]) - · exact absurd (h (show (3 : Token) ∈ leaf00 by simp [leaf00])) (by simp [leaf11]) + · exact absurd (h (show (3 : Token) ∈ leaf00 by simp only [leaf00, Fin.isValue, + Set.mem_singleton_iff])) (by simp only [leaf01, Fin.isValue, Set.mem_singleton_iff, + Fin.reduceEq, not_false_eq_true]) + · exact absurd (h (show (3 : Token) ∈ leaf00 by simp only [leaf00, Fin.isValue, + Set.mem_singleton_iff])) (by simp only [leaf10, Fin.isValue, Set.mem_singleton_iff, + Fin.reduceEq, not_false_eq_true]) + · exact absurd (h (show (3 : Token) ∈ leaf00 by simp only [leaf00, Fin.isValue, + Set.mem_singleton_iff])) (by simp only [leaf11, Fin.isValue, Set.mem_singleton_iff, + Fin.reduceEq, not_false_eq_true]) private theorem leaf01_subset_cases {Y : Set Token} (hY : mem Y) (h : leaf01 ⊆ Y) : Y = master ∨ Y = left ∨ Y = leaf01 := by rcases (mem_iff Y).mp hY with rfl | rfl | rfl | rfl | rfl | rfl | rfl · exact Or.inl rfl · exact Or.inr (Or.inl rfl) - · exact absurd (h (show (4 : Token) ∈ leaf01 by simp [leaf01])) (by simp [right]) - · exact absurd (h (show (4 : Token) ∈ leaf01 by simp [leaf01])) (by simp [leaf00]) + · exact absurd (h (show (4 : Token) ∈ leaf01 by simp only [leaf01, Fin.isValue, + Set.mem_singleton_iff])) (by simp only [right, Fin.isValue, Set.mem_insert_iff, + Fin.reduceEq, Set.mem_singleton_iff, or_self, not_false_eq_true]) + · exact absurd (h (show (4 : Token) ∈ leaf01 by simp only [leaf01, Fin.isValue, + Set.mem_singleton_iff])) (by simp only [leaf00, Fin.isValue, Set.mem_singleton_iff, + Fin.reduceEq, not_false_eq_true]) · exact Or.inr (Or.inr rfl) - · exact absurd (h (show (4 : Token) ∈ leaf01 by simp [leaf01])) (by simp [leaf10]) - · exact absurd (h (show (4 : Token) ∈ leaf01 by simp [leaf01])) (by simp [leaf11]) + · exact absurd (h (show (4 : Token) ∈ leaf01 by simp only [leaf01, Fin.isValue, + Set.mem_singleton_iff])) (by simp only [leaf10, Fin.isValue, Set.mem_singleton_iff, + Fin.reduceEq, not_false_eq_true]) + · exact absurd (h (show (4 : Token) ∈ leaf01 by simp only [leaf01, Fin.isValue, + Set.mem_singleton_iff])) (by simp only [leaf11, Fin.isValue, Set.mem_singleton_iff, + Fin.reduceEq, not_false_eq_true]) private theorem leaf10_subset_cases {Y : Set Token} (hY : mem Y) (h : leaf10 ⊆ Y) : Y = master ∨ Y = right ∨ Y = leaf10 := by rcases (mem_iff Y).mp hY with rfl | rfl | rfl | rfl | rfl | rfl | rfl · exact Or.inl rfl - · exact absurd (h (show (5 : Token) ∈ leaf10 by simp [leaf10])) (by simp [left]) + · exact absurd (h (show (5 : Token) ∈ leaf10 by simp only [leaf10, Fin.isValue, + Set.mem_singleton_iff])) (by simp only [left, Fin.isValue, Set.mem_insert_iff, Fin.reduceEq, + Set.mem_singleton_iff, or_self, not_false_eq_true]) · exact Or.inr (Or.inl rfl) - · exact absurd (h (show (5 : Token) ∈ leaf10 by simp [leaf10])) (by simp [leaf00]) - · exact absurd (h (show (5 : Token) ∈ leaf10 by simp [leaf10])) (by simp [leaf01]) + · exact absurd (h (show (5 : Token) ∈ leaf10 by simp only [leaf10, Fin.isValue, + Set.mem_singleton_iff])) (by simp only [leaf00, Fin.isValue, Set.mem_singleton_iff, + Fin.reduceEq, not_false_eq_true]) + · exact absurd (h (show (5 : Token) ∈ leaf10 by simp only [leaf10, Fin.isValue, + Set.mem_singleton_iff])) (by simp only [leaf01, Fin.isValue, Set.mem_singleton_iff, + Fin.reduceEq, not_false_eq_true]) · exact Or.inr (Or.inr rfl) - · exact absurd (h (show (5 : Token) ∈ leaf10 by simp [leaf10])) (by simp [leaf11]) + · exact absurd (h (show (5 : Token) ∈ leaf10 by simp only [leaf10, Fin.isValue, + Set.mem_singleton_iff])) (by simp only [leaf11, Fin.isValue, Set.mem_singleton_iff, + Fin.reduceEq, not_false_eq_true]) private theorem leaf11_subset_cases {Y : Set Token} (hY : mem Y) (h : leaf11 ⊆ Y) : Y = master ∨ Y = right ∨ Y = leaf11 := by rcases (mem_iff Y).mp hY with rfl | rfl | rfl | rfl | rfl | rfl | rfl · exact Or.inl rfl - · exact absurd (h (show (6 : Token) ∈ leaf11 by simp [leaf11])) (by simp [left]) + · exact absurd (h (show (6 : Token) ∈ leaf11 by simp only [leaf11, Fin.isValue, + Set.mem_singleton_iff])) (by simp only [left, Fin.isValue, Set.mem_insert_iff, Fin.reduceEq, + Set.mem_singleton_iff, or_self, not_false_eq_true]) · exact Or.inr (Or.inl rfl) - · exact absurd (h (show (6 : Token) ∈ leaf11 by simp [leaf11])) (by simp [leaf00]) - · exact absurd (h (show (6 : Token) ∈ leaf11 by simp [leaf11])) (by simp [leaf01]) - · exact absurd (h (show (6 : Token) ∈ leaf11 by simp [leaf11])) (by simp [leaf10]) + · exact absurd (h (show (6 : Token) ∈ leaf11 by simp only [leaf11, Fin.isValue, + Set.mem_singleton_iff])) (by simp only [leaf00, Fin.isValue, Set.mem_singleton_iff, + Fin.reduceEq, not_false_eq_true]) + · exact absurd (h (show (6 : Token) ∈ leaf11 by simp only [leaf11, Fin.isValue, + Set.mem_singleton_iff])) (by simp only [leaf01, Fin.isValue, Set.mem_singleton_iff, + Fin.reduceEq, not_false_eq_true]) + · exact absurd (h (show (6 : Token) ∈ leaf11 by simp only [leaf11, Fin.isValue, + Set.mem_singleton_iff])) (by simp only [leaf10, Fin.isValue, Set.mem_singleton_iff, + Fin.reduceEq, not_false_eq_true]) · exact Or.inr (Or.inr rfl) /-! ### Intersections. -/ @@ -279,67 +355,71 @@ private theorem master_inter (A : Set Token) : master ∩ A = A := by rw [master]; exact Set.univ_inter A private theorem inter_master (A : Set Token) : A ∩ master = A := by - rw [master]; exact Set.inter_univ A + exact Set.inter_eq_left.mpr fun ⦃a⦄ a_1 => trivial private theorem left_inter_leaf00 : left ∩ leaf00 = leaf00 := by - ext t; fin_cases t <;> simp [left, leaf00] + exact Set.inter_singleton_of_mem (Or.inr (Or.inl rfl)) private theorem leaf00_inter_left : leaf00 ∩ left = leaf00 := by rw [Set.inter_comm]; exact left_inter_leaf00 private theorem left_inter_leaf01 : left ∩ leaf01 = leaf01 := by - ext t; fin_cases t <;> simp [left, leaf01] + exact Set.inter_singleton_of_mem (Or.inr (Or.inr rfl)) private theorem leaf01_inter_left : leaf01 ∩ left = leaf01 := by rw [Set.inter_comm]; exact left_inter_leaf01 private theorem right_inter_leaf10 : right ∩ leaf10 = leaf10 := by - ext t; fin_cases t <;> simp [right, leaf10] + exact Set.inter_singleton_of_mem (Or.inr (Or.inl rfl)) private theorem leaf10_inter_right : leaf10 ∩ right = leaf10 := by rw [Set.inter_comm]; exact right_inter_leaf10 private theorem right_inter_leaf11 : right ∩ leaf11 = leaf11 := by - ext t; fin_cases t <;> simp [right, leaf11] + exact Set.inter_singleton_of_mem (Or.inr (Or.inr rfl)) private theorem leaf11_inter_right : leaf11 ∩ right = leaf11 := by rw [Set.inter_comm]; exact right_inter_leaf11 private theorem left_inter_right : left ∩ right = (∅ : Set Token) := by - ext t; fin_cases t <;> simp [left, right] + apply Set.disjoint_iff_inter_eq_empty.mp + apply Set.disjoint_left.mpr + intro t hl hr + rcases hl with rfl | rfl | rfl <;> + simp only [right, Set.mem_insert_iff, Set.mem_singleton_iff, Fin.reduceEq, or_self] at hr private theorem right_inter_left : right ∩ left = (∅ : Set Token) := by rw [Set.inter_comm]; exact left_inter_right private theorem left_inter_leaf10 : left ∩ leaf10 = (∅ : Set Token) := by - ext t; fin_cases t <;> simp [left, leaf10] + exact Set.inter_singleton_eq_empty.mpr (by change ¬(((5 : Token) = 1) ∨ 5 = 3 ∨ 5 = 4); decide) private theorem leaf10_inter_left : leaf10 ∩ left = (∅ : Set Token) := by rw [Set.inter_comm]; exact left_inter_leaf10 private theorem left_inter_leaf11 : left ∩ leaf11 = (∅ : Set Token) := by - ext t; fin_cases t <;> simp [left, leaf11] + exact Set.inter_singleton_eq_empty.mpr (by change ¬(((6 : Token) = 1) ∨ 6 = 3 ∨ 6 = 4); decide) private theorem leaf11_inter_left : leaf11 ∩ left = (∅ : Set Token) := by rw [Set.inter_comm]; exact left_inter_leaf11 private theorem right_inter_leaf00 : right ∩ leaf00 = (∅ : Set Token) := by - ext t; fin_cases t <;> simp [right, leaf00] + exact Set.inter_singleton_eq_empty.mpr (by change ¬(((3 : Token) = 2) ∨ 3 = 5 ∨ 3 = 6); decide) private theorem leaf00_inter_right : leaf00 ∩ right = (∅ : Set Token) := by rw [Set.inter_comm]; exact right_inter_leaf00 private theorem right_inter_leaf01 : right ∩ leaf01 = (∅ : Set Token) := by - ext t; fin_cases t <;> simp [right, leaf01] + exact Set.inter_singleton_eq_empty.mpr (by change ¬(((4 : Token) = 2) ∨ 4 = 5 ∨ 4 = 6); decide) private theorem leaf01_inter_right : leaf01 ∩ right = (∅ : Set Token) := by rw [Set.inter_comm]; exact right_inter_leaf01 private theorem leaf00_inter_leaf01 : leaf00 ∩ leaf01 = (∅ : Set Token) := by - ext t; fin_cases t <;> simp [leaf00, leaf01] + exact Set.inter_singleton_eq_empty.mpr (by change (4 : Token) ≠ 3; decide) private theorem leaf01_inter_leaf00 : leaf01 ∩ leaf00 = (∅ : Set Token) := by rw [Set.inter_comm]; exact leaf00_inter_leaf01 private theorem leaf00_inter_leaf10 : leaf00 ∩ leaf10 = (∅ : Set Token) := by - ext t; fin_cases t <;> simp [leaf00, leaf10] + exact Set.inter_singleton_eq_empty.mpr (by change (5 : Token) ≠ 3; decide) private theorem leaf10_inter_leaf00 : leaf10 ∩ leaf00 = (∅ : Set Token) := by rw [Set.inter_comm]; exact leaf00_inter_leaf10 private theorem leaf00_inter_leaf11 : leaf00 ∩ leaf11 = (∅ : Set Token) := by - ext t; fin_cases t <;> simp [leaf00, leaf11] + exact Set.inter_singleton_eq_empty.mpr (by change (6 : Token) ≠ 3; decide) private theorem leaf11_inter_leaf00 : leaf11 ∩ leaf00 = (∅ : Set Token) := by rw [Set.inter_comm]; exact leaf00_inter_leaf11 private theorem leaf01_inter_leaf10 : leaf01 ∩ leaf10 = (∅ : Set Token) := by - ext t; fin_cases t <;> simp [leaf01, leaf10] + exact Set.inter_singleton_eq_empty.mpr (by change (5 : Token) ≠ 4; decide) private theorem leaf10_inter_leaf01 : leaf10 ∩ leaf01 = (∅ : Set Token) := by rw [Set.inter_comm]; exact leaf01_inter_leaf10 private theorem leaf01_inter_leaf11 : leaf01 ∩ leaf11 = (∅ : Set Token) := by - ext t; fin_cases t <;> simp [leaf01, leaf11] + exact Set.inter_singleton_eq_empty.mpr (by change (6 : Token) ≠ 4; decide) private theorem leaf11_inter_leaf01 : leaf11 ∩ leaf01 = (∅ : Set Token) := by rw [Set.inter_comm]; exact leaf01_inter_leaf11 private theorem leaf10_inter_leaf11 : leaf10 ∩ leaf11 = (∅ : Set Token) := by - ext t; fin_cases t <;> simp [leaf10, leaf11] + exact Set.inter_singleton_eq_empty.mpr (by change (6 : Token) ≠ 5; decide) private theorem leaf11_inter_leaf10 : leaf11 ∩ leaf10 = (∅ : Set Token) := by rw [Set.inter_comm]; exact leaf10_inter_leaf11 @@ -350,17 +430,56 @@ private theorem inter_eq (X Y : Set Token) (hX : mem X) (hY : mem Y) : X ∩ Y = master ∨ X ∩ Y = left ∨ X ∩ Y = right ∨ X ∩ Y = leaf00 ∨ X ∩ Y = leaf01 ∨ X ∩ Y = leaf10 ∨ X ∩ Y = leaf11 ∨ X ∩ Y = (∅ : Set Token) := by rcases (mem_iff X).mp hX with rfl | rfl | rfl | rfl | rfl | rfl | rfl <;> - rcases (mem_iff Y).mp hY with rfl | rfl | rfl | rfl | rfl | rfl | rfl <;> - simp only [master_inter, inter_master, Set.inter_self, - left_inter_right, right_inter_left, left_inter_leaf10, leaf10_inter_left, - left_inter_leaf11, leaf11_inter_left, right_inter_leaf00, leaf00_inter_right, - right_inter_leaf01, leaf01_inter_right, leaf00_inter_leaf01, leaf01_inter_leaf00, - leaf00_inter_leaf10, leaf10_inter_leaf00, leaf00_inter_leaf11, leaf11_inter_leaf00, - leaf01_inter_leaf10, leaf10_inter_leaf01, leaf01_inter_leaf11, leaf11_inter_leaf01, - leaf10_inter_leaf11, leaf11_inter_leaf10, - left_inter_leaf00, leaf00_inter_left, left_inter_leaf01, leaf01_inter_left, - right_inter_leaf10, leaf10_inter_right, right_inter_leaf11, leaf11_inter_right, - true_or, or_true] + rcases (mem_iff Y).mp hY with rfl | rfl | rfl | rfl | rfl | rfl | rfl + · exact Or.inl (master_inter _) + · exact Or.inr (Or.inl (master_inter _)) + · exact Or.inr (Or.inr (Or.inl (master_inter _))) + · exact Or.inr (Or.inr (Or.inr (Or.inl (master_inter _)))) + · exact Or.inr (Or.inr (Or.inr (Or.inr (Or.inl (master_inter _))))) + · exact Or.inr (Or.inr (Or.inr (Or.inr (Or.inr (Or.inl (master_inter _)))))) + · exact Or.inr (Or.inr (Or.inr (Or.inr (Or.inr (Or.inr (Or.inl (master_inter _))))))) + · exact Or.inr (Or.inl (inter_master _)) + · exact Or.inr (Or.inl (Set.inter_self _)) + · exact Or.inr (Or.inr (Or.inr (Or.inr (Or.inr (Or.inr (Or.inr (left_inter_right))))))) + · exact Or.inr (Or.inr (Or.inr (Or.inl (left_inter_leaf00)))) + · exact Or.inr (Or.inr (Or.inr (Or.inr (Or.inl (left_inter_leaf01))))) + · exact Or.inr (Or.inr (Or.inr (Or.inr (Or.inr (Or.inr (Or.inr (left_inter_leaf10))))))) + · exact Or.inr (Or.inr (Or.inr (Or.inr (Or.inr (Or.inr (Or.inr (left_inter_leaf11))))))) + · exact Or.inr (Or.inr (Or.inl (inter_master _))) + · exact Or.inr (Or.inr (Or.inr (Or.inr (Or.inr (Or.inr (Or.inr (right_inter_left))))))) + · exact Or.inr (Or.inr (Or.inl (Set.inter_self _))) + · exact Or.inr (Or.inr (Or.inr (Or.inr (Or.inr (Or.inr (Or.inr (right_inter_leaf00))))))) + · exact Or.inr (Or.inr (Or.inr (Or.inr (Or.inr (Or.inr (Or.inr (right_inter_leaf01))))))) + · exact Or.inr (Or.inr (Or.inr (Or.inr (Or.inr (Or.inl (right_inter_leaf10)))))) + · exact Or.inr (Or.inr (Or.inr (Or.inr (Or.inr (Or.inr (Or.inl (right_inter_leaf11))))))) + · exact Or.inr (Or.inr (Or.inr (Or.inl (inter_master _)))) + · exact Or.inr (Or.inr (Or.inr (Or.inl (leaf00_inter_left)))) + · exact Or.inr (Or.inr (Or.inr (Or.inr (Or.inr (Or.inr (Or.inr (leaf00_inter_right))))))) + · exact Or.inr (Or.inr (Or.inr (Or.inl (Set.inter_self _)))) + · exact Or.inr (Or.inr (Or.inr (Or.inr (Or.inr (Or.inr (Or.inr (leaf00_inter_leaf01))))))) + · exact Or.inr (Or.inr (Or.inr (Or.inr (Or.inr (Or.inr (Or.inr (leaf00_inter_leaf10))))))) + · exact Or.inr (Or.inr (Or.inr (Or.inr (Or.inr (Or.inr (Or.inr (leaf00_inter_leaf11))))))) + · exact Or.inr (Or.inr (Or.inr (Or.inr (Or.inl (inter_master _))))) + · exact Or.inr (Or.inr (Or.inr (Or.inr (Or.inl (leaf01_inter_left))))) + · exact Or.inr (Or.inr (Or.inr (Or.inr (Or.inr (Or.inr (Or.inr (leaf01_inter_right))))))) + · exact Or.inr (Or.inr (Or.inr (Or.inr (Or.inr (Or.inr (Or.inr (leaf01_inter_leaf00))))))) + · exact Or.inr (Or.inr (Or.inr (Or.inr (Or.inl (Set.inter_self _))))) + · exact Or.inr (Or.inr (Or.inr (Or.inr (Or.inr (Or.inr (Or.inr (leaf01_inter_leaf10))))))) + · exact Or.inr (Or.inr (Or.inr (Or.inr (Or.inr (Or.inr (Or.inr (leaf01_inter_leaf11))))))) + · exact Or.inr (Or.inr (Or.inr (Or.inr (Or.inr (Or.inl (inter_master _)))))) + · exact Or.inr (Or.inr (Or.inr (Or.inr (Or.inr (Or.inr (Or.inr (leaf10_inter_left))))))) + · exact Or.inr (Or.inr (Or.inr (Or.inr (Or.inr (Or.inl (leaf10_inter_right)))))) + · exact Or.inr (Or.inr (Or.inr (Or.inr (Or.inr (Or.inr (Or.inr (leaf10_inter_leaf00))))))) + · exact Or.inr (Or.inr (Or.inr (Or.inr (Or.inr (Or.inr (Or.inr (leaf10_inter_leaf01))))))) + · exact Or.inr (Or.inr (Or.inr (Or.inr (Or.inr (Or.inl (Set.inter_self _)))))) + · exact Or.inr (Or.inr (Or.inr (Or.inr (Or.inr (Or.inr (Or.inr (leaf10_inter_leaf11))))))) + · exact Or.inr (Or.inr (Or.inr (Or.inr (Or.inr (Or.inr (Or.inl (inter_master _))))))) + · exact Or.inr (Or.inr (Or.inr (Or.inr (Or.inr (Or.inr (Or.inr (leaf11_inter_left))))))) + · exact Or.inr (Or.inr (Or.inr (Or.inr (Or.inr (Or.inr (Or.inl (leaf11_inter_right))))))) + · exact Or.inr (Or.inr (Or.inr (Or.inr (Or.inr (Or.inr (Or.inr (leaf11_inter_leaf00))))))) + · exact Or.inr (Or.inr (Or.inr (Or.inr (Or.inr (Or.inr (Or.inr (leaf11_inter_leaf01))))))) + · exact Or.inr (Or.inr (Or.inr (Or.inr (Or.inr (Or.inr (Or.inr (leaf11_inter_leaf10))))))) + · exact Or.inr (Or.inr (Or.inr (Or.inr (Or.inr (Or.inr (Or.inl (Set.inter_self _))))))) /-- **Example 1.4.** The binary-tree neighbourhood system on `Δ = {Λ,0,1,00,01,10,11}`. -/ @@ -591,24 +710,20 @@ private theorem mem_leaf00_imp (x : neighborhoodSystem.Element) (h : x.mem leaf0 · exact Or.inr (Or.inl rfl) · exfalso have hi := x.inter_mem hx h - rw [show (right ∩ leaf00 : Set Token) = ∅ from by - ext t; fin_cases t <;> simp [right, leaf00]] at hi + rw [right_inter_leaf00] at hi exact not_mem_empty (x.sub hi) · exact Or.inr (Or.inr rfl) · exfalso have hi := x.inter_mem hx h - rw [show (leaf01 ∩ leaf00 : Set Token) = ∅ from by - ext t; fin_cases t <;> simp [leaf01, leaf00]] at hi + rw [leaf01_inter_leaf00] at hi exact not_mem_empty (x.sub hi) · exfalso have hi := x.inter_mem hx h - rw [show (leaf10 ∩ leaf00 : Set Token) = ∅ from by - ext t; fin_cases t <;> simp [leaf10, leaf00]] at hi + rw [leaf10_inter_leaf00] at hi exact not_mem_empty (x.sub hi) · exfalso have hi := x.inter_mem hx h - rw [show (leaf11 ∩ leaf00 : Set Token) = ∅ from by - ext t; fin_cases t <;> simp [leaf11, leaf00]] at hi + rw [leaf11_inter_leaf00] at hi exact not_mem_empty (x.sub hi) · intro hx rcases hx with rfl | rfl | rfl @@ -628,24 +743,20 @@ private theorem mem_leaf01_imp (x : neighborhoodSystem.Element) (h : x.mem leaf0 · exact Or.inr (Or.inl rfl) · exfalso have hi := x.inter_mem hx h - rw [show (right ∩ leaf01 : Set Token) = ∅ from by - ext t; fin_cases t <;> simp [right, leaf01]] at hi + rw [right_inter_leaf01] at hi exact not_mem_empty (x.sub hi) · exfalso have hi := x.inter_mem hx h - rw [show (leaf00 ∩ leaf01 : Set Token) = ∅ from by - ext t; fin_cases t <;> simp [leaf00, leaf01]] at hi + rw [leaf00_inter_leaf01] at hi exact not_mem_empty (x.sub hi) · exact Or.inr (Or.inr rfl) · exfalso have hi := x.inter_mem hx h - rw [show (leaf10 ∩ leaf01 : Set Token) = ∅ from by - ext t; fin_cases t <;> simp [leaf10, leaf01]] at hi + rw [leaf10_inter_leaf01] at hi exact not_mem_empty (x.sub hi) · exfalso have hi := x.inter_mem hx h - rw [show (leaf11 ∩ leaf01 : Set Token) = ∅ from by - ext t; fin_cases t <;> simp [leaf11, leaf01]] at hi + rw [leaf11_inter_leaf01] at hi exact not_mem_empty (x.sub hi) · intro hx rcases hx with rfl | rfl | rfl @@ -664,25 +775,21 @@ private theorem mem_leaf10_imp (x : neighborhoodSystem.Element) (h : x.mem leaf1 · exact Or.inl rfl · exfalso have hi := x.inter_mem hx h - rw [show (left ∩ leaf10 : Set Token) = ∅ from by - ext t; fin_cases t <;> simp [left, leaf10]] at hi + rw [left_inter_leaf10] at hi exact not_mem_empty (x.sub hi) · exact Or.inr (Or.inl rfl) · exfalso have hi := x.inter_mem hx h - rw [show (leaf00 ∩ leaf10 : Set Token) = ∅ from by - ext t; fin_cases t <;> simp [leaf00, leaf10]] at hi + rw [leaf00_inter_leaf10] at hi exact not_mem_empty (x.sub hi) · exfalso have hi := x.inter_mem hx h - rw [show (leaf01 ∩ leaf10 : Set Token) = ∅ from by - ext t; fin_cases t <;> simp [leaf01, leaf10]] at hi + rw [leaf01_inter_leaf10] at hi exact not_mem_empty (x.sub hi) · exact Or.inr (Or.inr rfl) · exfalso have hi := x.inter_mem hx h - rw [show (leaf11 ∩ leaf10 : Set Token) = ∅ from by - ext t; fin_cases t <;> simp [leaf11, leaf10]] at hi + rw [leaf11_inter_leaf10] at hi exact not_mem_empty (x.sub hi) · intro hx rcases hx with rfl | rfl | rfl @@ -701,24 +808,20 @@ private theorem mem_leaf11_imp (x : neighborhoodSystem.Element) (h : x.mem leaf1 · exact Or.inl rfl · exfalso have hi := x.inter_mem hx h - rw [show (left ∩ leaf11 : Set Token) = ∅ from by - ext t; fin_cases t <;> simp [left, leaf11]] at hi + rw [left_inter_leaf11] at hi exact not_mem_empty (x.sub hi) · exact Or.inr (Or.inl rfl) · exfalso have hi := x.inter_mem hx h - rw [show (leaf00 ∩ leaf11 : Set Token) = ∅ from by - ext t; fin_cases t <;> simp [leaf00, leaf11]] at hi + rw [leaf00_inter_leaf11] at hi exact not_mem_empty (x.sub hi) · exfalso have hi := x.inter_mem hx h - rw [show (leaf01 ∩ leaf11 : Set Token) = ∅ from by - ext t; fin_cases t <;> simp [leaf01, leaf11]] at hi + rw [leaf01_inter_leaf11] at hi exact not_mem_empty (x.sub hi) · exfalso have hi := x.inter_mem hx h - rw [show (leaf10 ∩ leaf11 : Set Token) = ∅ from by - ext t; fin_cases t <;> simp [leaf10, leaf11]] at hi + rw [leaf10_inter_leaf11] at hi exact not_mem_empty (x.sub hi) · exact Or.inr (Or.inr rfl) · intro hx @@ -738,20 +841,17 @@ private theorem mem_left_imp (x : neighborhoodSystem.Element) (hl : x.mem left) · exact Or.inr rfl · exfalso have hi := x.inter_mem hl hx - rw [show (left ∩ right : Set Token) = ∅ from by - ext t; fin_cases t <;> simp [left, right]] at hi + rw [left_inter_right] at hi exact not_mem_empty (x.sub hi) · exact absurd hx h00 · exact absurd hx h01 · exfalso have hi := x.inter_mem hl hx - rw [show (left ∩ leaf10 : Set Token) = ∅ from by - ext t; fin_cases t <;> simp [left, leaf10]] at hi + rw [left_inter_leaf10] at hi exact not_mem_empty (x.sub hi) · exfalso have hi := x.inter_mem hl hx - rw [show (left ∩ leaf11 : Set Token) = ∅ from by - ext t; fin_cases t <;> simp [left, leaf11]] at hi + rw [left_inter_leaf11] at hi exact not_mem_empty (x.sub hi) · intro hx rcases hx with rfl | rfl @@ -768,19 +868,16 @@ private theorem mem_right_imp (x : neighborhoodSystem.Element) (hr : x.mem right · exact Or.inl rfl · exfalso have hi := x.inter_mem hr hx - rw [show (right ∩ left : Set Token) = ∅ from by - ext t; fin_cases t <;> simp [right, left]] at hi + rw [right_inter_left] at hi exact not_mem_empty (x.sub hi) · exact Or.inr rfl · exfalso have hi := x.inter_mem hr hx - rw [show (right ∩ leaf00 : Set Token) = ∅ from by - ext t; fin_cases t <;> simp [right, leaf00]] at hi + rw [right_inter_leaf00] at hi exact not_mem_empty (x.sub hi) · exfalso have hi := x.inter_mem hr hx - rw [show (right ∩ leaf01 : Set Token) = ∅ from by - ext t; fin_cases t <;> simp [right, leaf01]] at hi + rw [right_inter_leaf01] at hi exact not_mem_empty (x.sub hi) · exact absurd hx h10 · exact absurd hx h11 diff --git a/LeanPool/DomainTheory/Neighborhood/Example15.lean b/LeanPool/DomainTheory/Neighborhood/Example15.lean index 83a4d27c9a..790fad1c25 100644 --- a/LeanPool/DomainTheory/Neighborhood/Example15.lean +++ b/LeanPool/DomainTheory/Neighborhood/Example15.lean @@ -6,9 +6,6 @@ Authors: Catskills Research Company module public import LeanPool.DomainTheory.Neighborhood.Basic -public import Mathlib.Data.Set.Basic -import Mathlib.Data.Finset.Attr -import Mathlib.Order.BooleanAlgebra.Set import Mathlib.Tactic.SetLike /-! diff --git a/LeanPool/DomainTheory/Neighborhood/Example23.lean b/LeanPool/DomainTheory/Neighborhood/Example23.lean index 6b4c031836..8fa8e9b4cf 100644 --- a/LeanPool/DomainTheory/Neighborhood/Example23.lean +++ b/LeanPool/DomainTheory/Neighborhood/Example23.lean @@ -8,8 +8,6 @@ module public import LeanPool.DomainTheory.Neighborhood.Approximable public import LeanPool.DomainTheory.Neighborhood.Example12 public import LeanPool.DomainTheory.Neighborhood.ExampleB -public import Mathlib.Tactic.ToAdditive -import Mathlib.Data.Finset.Attr import Mathlib.Tactic.Attr.Core import Mathlib.Tactic.SetLike @@ -106,7 +104,7 @@ every extension `σ ++ t` keeps that value. This is the engine of monotonicity f theorem scan_append {σ : Str} {b : Bool} (h : scan σ = some b) (t : Str) : scan (σ ++ t) = some b := by induction σ generalizing b with - | nil => simp at h + | nil => simp only [scan_nil, reduceCtorEq] at h | cons c σ₀ ih => cases c with | true => simp only [scan_true] at h ⊢; exact h @@ -114,7 +112,7 @@ theorem scan_append {σ : Str} {b : Bool} (h : scan σ = some b) (t : Str) : simp only [List.cons_append, scan_false] at h ⊢ rw [Option.map_eq_some_iff] at h obtain ⟨a, ha, rfl⟩ := h - simp_all + simp_all only [Option.some.injEq, forall_eq', Option.map_some] /-- **Monotonicity of the parity value.** A longer prefix `σ <+: σ'` yields a (weakly) more defined @@ -125,7 +123,7 @@ theorem valElt_scan_mono {σ σ' : Str} (h : σ <+: σ') : valElt (scan σ) ≤ valElt (scan σ') := by obtain ⟨t, rfl⟩ := h cases hσ : scan σ with - | none => simpa [valElt, hσ] using botElt_le _ + | none => simpa only [valElt] using botElt_le _ | some b => rw [scan_append hσ t] /-- **Example 2.3 — the parity mapping `f : B → T`.** `X f Y` iff `X` is the cone diff --git a/LeanPool/DomainTheory/Neighborhood/Example24.lean b/LeanPool/DomainTheory/Neighborhood/Example24.lean index 072dd83192..dd9a35c9b8 100644 --- a/LeanPool/DomainTheory/Neighborhood/Example24.lean +++ b/LeanPool/DomainTheory/Neighborhood/Example24.lean @@ -70,21 +70,21 @@ def out : Str → Str /-- `del` only grows under extension: `del s <+: del (s ++ t)`. -/ theorem del_append (s t : Str) : del s <+: del (s ++ t) := by induction s with - | nil => simp + | nil => simp only [del_nil, List.nil_append, List.nil_prefix] | cons c s₀ ih => cases c with - | true => simpa using ih + | true => simpa only [del_true, List.cons_append] using ih | false => exact ⟨t, rfl⟩ /-- `out` only grows under extension: `out σ <+: out (σ ++ t)`. -/ theorem out_append (σ t : Str) : out σ <+: out (σ ++ t) := by induction σ with - | nil => simp + | nil => simp only [out_nil, List.nil_append, List.nil_prefix] | cons c σ₀ ih => cases c with - | true => simpa using del_append σ₀ t + | true => simpa only [out_true, List.cons_append] using del_append σ₀ t | false => - simp_all + simp_all only [out_false, List.cons_append, List.cons_prefix_cons, and_self] /-- **Prefix-monotonicity of the output.** Extending the input prefix can only extend the guaranteed diff --git a/LeanPool/DomainTheory/Neighborhood/Example43.lean b/LeanPool/DomainTheory/Neighborhood/Example43.lean index c71d4f8667..dc23fb2293 100644 --- a/LeanPool/DomainTheory/Neighborhood/Example43.lean +++ b/LeanPool/DomainTheory/Neighborhood/Example43.lean @@ -6,12 +6,6 @@ Authors: Catskills Research Company module public import LeanPool.DomainTheory.Neighborhood.Example23 -import Mathlib.Data.Finset.Attr -import Mathlib.Data.Rat.Cast.Order -import Mathlib.Tactic.NormNum.Abs -import Mathlib.Tactic.NormNum.DivMod -import Mathlib.Tactic.NormNum.OfScientific -import Mathlib.Tactic.NormNum.Pow /-! # Example 4.3 (Scott 1981, PRG-19, §4) — the natural-number domain `N` @@ -86,7 +80,7 @@ theorem singleton_ne_univ (n : ℕ) : ({n} : Set ℕ) ≠ Set.univ := fun h => u /-- Singletons of naturals are one-one as sets. -/ theorem singleton_nat_inj {n m : ℕ} (h : ({n} : Set ℕ) = {m}) : n = m := by - simp_all + simp_all only [Set.singleton_eq_singleton_iff] /-- Any two neighbourhoods of `N` are nested or disjoint: `ℕ` contains every singleton, and two @@ -98,7 +92,8 @@ theorem nestedOrDisjoint : NestedOrDisjoint memN := by · exact Or.inl (Set.subset_univ _) · by_cases h : n = m · subst h; exact Or.inl (Set.Subset.refl _) - · simp_all + · simp_all only [Set.subset_singleton_iff, Set.mem_singleton_iff, imp_false, forall_eq, + not_false_eq_true, Set.singleton_inter_of_notMem, or_true] /-- **Example 4.3 (Scott 1981, PRG-19).** The natural-number neighbourhood system `N` on `Δ = ℕ`. -/ @@ -129,7 +124,8 @@ theorem mem_natElem_iff {n : ℕ} {Y : Set ℕ} : · rintro ⟨hY, hsub⟩ rcases hY with rfl | ⟨m, rfl⟩ · exact Or.inl rfl - · simp_all + · simp_all only [Set.subset_singleton_iff, Set.mem_singleton_iff, forall_eq, + Set.singleton_ne_univ, or_true] · rintro (rfl | rfl) · exact ⟨memN_univ, Set.subset_univ _⟩ · exact ⟨memN_singleton n, subset_rfl⟩ @@ -200,7 +196,7 @@ theorem constLiftN_natElem {β : Type*} (V : NeighborhoodSystem β) (val : ℕ rw [mem_natElem_iff] at hXmem rcases hrel with ⟨_, rfl⟩ | ⟨k, hXk, hY⟩ · exact (val n).master_mem - · simp_all + · simp_all only [Set.singleton_ne_univ, Set.singleton_eq_singleton_iff, false_or] · intro hY exact ⟨{n}, mem_natElem_iff.mpr (Or.inr rfl), Or.inr ⟨n, rfl, hY⟩⟩ diff --git a/LeanPool/DomainTheory/Neighborhood/Example44.lean b/LeanPool/DomainTheory/Neighborhood/Example44.lean index 5cd97af96d..e97dacdabe 100644 --- a/LeanPool/DomainTheory/Neighborhood/Example44.lean +++ b/LeanPool/DomainTheory/Neighborhood/Example44.lean @@ -7,12 +7,6 @@ module public import LeanPool.DomainTheory.Neighborhood.Theorem41 public import LeanPool.DomainTheory.Neighborhood.ExampleB -import Mathlib.Data.Finset.Attr -import Mathlib.Data.Rat.Cast.Order -import Mathlib.Tactic.NormNum.Abs -import Mathlib.Tactic.NormNum.DivMod -import Mathlib.Tactic.NormNum.OfScientific -import Mathlib.Tactic.NormNum.Pow /-! # Example 4.4 (Scott 1981, PRG-19, §4) — the domain `C` of binary sequences @@ -70,7 +64,7 @@ open Domain.Neighborhood NeighborhoodSystem ApproximableMap ExampleB concatenation. -/ theorem prepend_singleton (σ τ : Str) : prepend σ {τ} = {σ ++ τ} := by ext w - simp_all + simp_all only [mem_prepend, Set.mem_singleton_iff, exists_eq_left] /-- Prepending is monotone in its set argument. -/ theorem prepend_mono (σ : Str) {X X' : Set Str} (h : X' ⊆ X) : prepend σ X' ⊆ prepend σ X := by @@ -95,7 +89,8 @@ theorem singleton_cone_nd (σ τ : Str) : ({τ} : Set Str) ⊆ cone σ ∨ cone σ ⊆ {τ} ∨ ({τ} : Set Str) ∩ cone σ = ∅ := by by_cases h : σ <+: τ · exact Or.inl (singleton_subset_cone.mpr h) - · simp_all + · simp_all only [Set.singleton_subset_iff, mem_cone, Set.subset_singleton_iff, + not_false_eq_true, Set.singleton_inter_of_notMem, or_true] /-- Any two neighbourhoods of `C` are nested or disjoint. -/ theorem nestedOrDisjoint : NestedOrDisjoint memC := by @@ -111,7 +106,8 @@ theorem nestedOrDisjoint : NestedOrDisjoint memC := by · exact Or.inr (Or.inr h) · by_cases h : σ = τ · subst h; exact Or.inl (Set.Subset.refl _) - · simp_all + · simp_all only [Set.subset_singleton_iff, Set.mem_singleton_iff, imp_false, forall_eq, + not_false_eq_true, Set.singleton_inter_of_notMem, or_true] /-- **Example 4.4 (Scott 1981, PRG-19).** The neighbourhood system `C` of finite or infinite binary diff --git a/LeanPool/DomainTheory/Neighborhood/Example61.lean b/LeanPool/DomainTheory/Neighborhood/Example61.lean index 4a59ade913..f35351bdcb 100644 --- a/LeanPool/DomainTheory/Neighborhood/Example61.lean +++ b/LeanPool/DomainTheory/Neighborhood/Example61.lean @@ -8,7 +8,6 @@ module public import LeanPool.DomainTheory.Neighborhood.Product public import LeanPool.DomainTheory.Neighborhood.Exercise318 import LeanPool.DomainTheory.Neighborhood.Exercise319Sum -import Mathlib.Order.BooleanAlgebra.Set /-! # Example 6.1 (Scott 1981, PRG-19, §6) — the tree algebra `D^§` and the domain @@ -115,13 +114,15 @@ theorem embPair_inter (P Q P' Q' : Set (List Bool × α)) : ext ⟨p, a⟩ simp only [Set.mem_inter_iff, mem_embPair] rcases p with _ | ⟨b, ps⟩ - · simp + · simp only [List.nil_eq, reduceCtorEq, false_and, exists_const, or_self, and_self] · cases b <;> simp [List.cons.injEq] theorem embZero_inter_embPair (X : Set α) (P Q : Set (List Bool × α)) : embZero X ∩ embPair P Q = ∅ := by ext ⟨p, a⟩ - simp_all + simp_all only [Set.mem_inter_iff, mem_embZero, mem_embPair, Set.mem_empty_iff_false, + iff_false, not_and, List.nil_eq, reduceCtorEq, false_and, exists_const, or_self, + not_false_eq_true, implies_true] /-! ### Subset / injectivity. -/ @@ -140,11 +141,13 @@ theorem embPair_subset {P Q P' Q' : Set (List Bool × α)} : · obtain ⟨p', a⟩ := t have hmem : ((true :: p', a) : List Bool × α) ∈ embPair P' Q' := h (Or.inl ⟨p', rfl, ht⟩) - simp_all + simp_all only [mem_embPair, List.cons.injEq, true_and, exists_eq_left', + Bool.true_eq_false, false_and, exists_const, or_false] · obtain ⟨q', a⟩ := t have hmem : ((false :: q', a) : List Bool × α) ∈ embPair P' Q' := h (Or.inr ⟨q', rfl, ht⟩) - simp_all + simp_all only [mem_embPair, List.cons.injEq, Bool.false_eq_true, false_and, exists_const, + true_and, exists_eq_left', false_or] · rintro ⟨hP, hQ⟩ t ht rcases ht with ⟨p', hp', hPmem⟩ | ⟨q', hq', hQmem⟩ · exact Or.inl ⟨p', hp', hP hPmem⟩ @@ -242,15 +245,19 @@ theorem memS_inter {D : NeighborhoodSystem α} (hD : ∀ X, D.mem X → X.Nonemp cases hZ with | gamma => obtain ⟨a, ha⟩ := hD D.master D.master_mem - exact absurd (hsub (show ((true :: [], a) : List Bool × α) ∈ Gamma D from ha)) (by simp) + exact absurd (hsub (show ((true :: [], a) : List Bool × α) ∈ Gamma D from ha)) + (by simp only [mem_embZero, List.cons_ne_self, Set.mem_inter_iff, false_and, + not_false_eq_true]) | @zero C hC => exact MemS.zero (D.inter_mem hA hB hC (embZero_subset.mp hsub)) | @pair P Q hP hQ => obtain ⟨t, hmem⟩ := embPair_nonempty (memS_nonempty hD hP) (Q := Q) have hempty : t.1 = [] := (hsub hmem).1 rcases hmem with ⟨p', hp', -⟩ | ⟨q', hq', -⟩ - · rw [hp'] at hempty; exact absurd hempty (by simp) - · rw [hq'] at hempty; exact absurd hempty (by simp) + · rw [hp'] at hempty; exact absurd hempty (by simp only [reduceCtorEq, + not_false_eq_true]) + · rw [hq'] at hempty; exact absurd hempty (by simp only [reduceCtorEq, + not_false_eq_true]) | @pair P Q _ _ => rw [embZero_inter_embPair] at hsub obtain ⟨z, hz⟩ := memS_nonempty hD hZ @@ -272,10 +279,14 @@ theorem memS_inter {D : NeighborhoodSystem α} (hD : ∀ X, D.mem X → X.Nonemp cases hZ with | gamma => obtain ⟨a, ha⟩ := hD D.master D.master_mem - exact absurd (hsub (show (([], a) : List Bool × α) ∈ Gamma D from ha)) (by simp) + exact absurd (hsub (show (([], a) : List Bool × α) ∈ Gamma D from ha)) (by simp only [ + mem_embPair, List.nil_eq, reduceCtorEq, Set.mem_inter_iff, false_and, exists_const, + or_self, not_false_eq_true]) | @zero C hC => obtain ⟨a, ha⟩ := hD C hC - exact absurd (hsub (show (([], a) : List Bool × α) ∈ embZero C from ⟨rfl, ha⟩)) (by simp) + exact absurd (hsub (show (([], a) : List Bool × α) ∈ embZero C from ⟨rfl, ha⟩)) + (by simp only [mem_embPair, List.nil_eq, reduceCtorEq, Set.mem_inter_iff, false_and, + exists_const, or_self, not_false_eq_true]) | @pair Z₀ Z₁ hZ₀ hZ₁ => obtain ⟨hsub₀, hsub₁⟩ := embPair_subset.mp hsub exact MemS.pair (ihP hP' hZ₀ hsub₀) (ihQ hQ' hZ₁ hsub₁) @@ -313,15 +324,15 @@ theorem memS_embZero_inv {D : NeighborhoodSystem α} (hD : ∀ X, D.mem X → X. exfalso obtain ⟨a, ha⟩ := hD D.master D.master_mem have h1 : ((true :: [], a) : List Bool × α) ∈ Gamma D := ha - rw [← hW] at h1; exact absurd h1.1 (by simp) + rw [← hW] at h1; exact absurd h1.1 (by simp only [List.cons_ne_self, not_false_eq_true]) | @zero X' hX' => rw [embZero_injective hW]; exact hX' | @pair P Q hP hQ => exfalso obtain ⟨t, ht⟩ := embPair_nonempty (memS_nonempty hD hP) (Q := Q) have hcons : t.1 ≠ [] := by rcases ht with ⟨p', hp', -⟩ | ⟨q', hq', -⟩ - · simp [hp'] - · simp [hq'] + · simp only [hp', ne_eq, reduceCtorEq, not_false_eq_true] + · simp only [hq', ne_eq, reduceCtorEq, not_false_eq_true] have hz : t ∈ embZero X := by rw [← hW] at ht; exact ht exact hcons hz.1 @@ -335,16 +346,16 @@ theorem memS_embPair_inv {D : NeighborhoodSystem α} (hD : ∀ X, D.mem X → X. have h1 : (([], a) : List Bool × α) ∈ Gamma D := ha rw [← hW] at h1 rcases h1 with ⟨p', hp', -⟩ | ⟨q', hq', -⟩ - · simp at hp' - · simp at hq' + · simp only [List.nil_eq, reduceCtorEq] at hp' + · simp only [List.nil_eq, reduceCtorEq] at hq' | @zero X hX => exfalso obtain ⟨t, ht⟩ := embZero_nonempty (hD X hX) have hempty : t.1 = [] := ht.1 rw [← hW] at ht rcases ht with ⟨p', hp', -⟩ | ⟨q', hq', -⟩ - · rw [hp'] at hempty; simp at hempty - · rw [hq'] at hempty; simp at hempty + · rw [hp'] at hempty; simp only [reduceCtorEq] at hempty + · rw [hq'] at hempty; simp only [reduceCtorEq] at hempty | @pair P' Q' hP' hQ' => obtain ⟨hPP, hQQ⟩ := embPair_injective hW rw [hPP, hQQ]; exact ⟨hP', hQ'⟩ @@ -557,7 +568,7 @@ theorem embZero_ne_Gamma (X : Set α) : embZero X ≠ Gamma D := by intro h obtain ⟨a, ha⟩ := hD D.master D.master_mem have hmem : ((true :: [], a) : List Bool × α) ∈ Gamma D := ha - rw [← h] at hmem; exact absurd hmem.1 (by simp) + rw [← h] at hmem; exact absurd hmem.1 (by simp only [List.cons_ne_self, not_false_eq_true]) theorem embPair_ne_Gamma (P Q : Set (List Bool × α)) : embPair P Q ≠ Gamma D := by intro h @@ -565,15 +576,15 @@ theorem embPair_ne_Gamma (P Q : Set (List Bool × α)) : embPair P Q ≠ Gamma D have hmem : (([], a) : List Bool × α) ∈ Gamma D := ha rw [← h] at hmem rcases hmem with ⟨p', hp', -⟩ | ⟨q', hq', -⟩ - · simp at hp' - · simp at hq' + · simp only [List.nil_eq, reduceCtorEq] at hp' + · simp only [List.nil_eq, reduceCtorEq] at hq' theorem embZero_ne_embPair {X : Set α} (hX : D.mem X) (P Q : Set (List Bool × α)) : embZero X ≠ embPair P Q := by intro h obtain ⟨a, ha⟩ := hD X hX have hmem : (([], a) : List Bool × α) ∈ embPair P Q := h ▸ (⟨rfl, ha⟩ : ([], a) ∈ embZero X) - simp_all + simp_all only [mem_embPair, List.nil_eq, reduceCtorEq, false_and, exists_const, or_self] @[simp] theorem fromS_mem_embZero {s : (sumSys D hD).Element} {X : Set α} (hX : D.mem X) : (fromS D hD s).mem (embZero X) ↔ s.mem (inj₀ X) := by diff --git a/LeanPool/DomainTheory/Neighborhood/Example62.lean b/LeanPool/DomainTheory/Neighborhood/Example62.lean index e1c1f163dd..6ccb527f36 100644 --- a/LeanPool/DomainTheory/Neighborhood/Example62.lean +++ b/LeanPool/DomainTheory/Neighborhood/Example62.lean @@ -9,7 +9,6 @@ public import LeanPool.DomainTheory.Neighborhood.ExampleB public import LeanPool.DomainTheory.Neighborhood.Exercise318 import LeanPool.DomainTheory.Neighborhood.Exercise319Sum import Mathlib.Data.List.Monad -import Mathlib.Order.BooleanAlgebra.Set import Mathlib.Tactic.Attr.Core /-! @@ -85,7 +84,8 @@ theorem memB_embBit (b : Bool) {X : Set Str} (hX : B.mem X) : B.mem (embBit b X) rw [embBit_eq_prepend]; exact memB_prepend [b] hX theorem nil_not_mem_embBit {b : Bool} {X : Set Str} : ([] : Str) ∉ embBit b X := by - rintro ⟨w', heq, -⟩; exact absurd heq (by simp) + rintro ⟨w', heq, -⟩; exact absurd heq (by simp only [List.nil_eq, reduceCtorEq, + not_false_eq_true]) theorem embBit_ne_univ (b : Bool) (X : Set Str) : embBit b X ≠ Set.univ := by intro h; exact nil_not_mem_embBit (X := X) (b := b) (by rw [h]; trivial) @@ -95,20 +95,24 @@ theorem embBit_inter (b : Bool) (X X' : Set Str) : ext w simp only [Set.mem_inter_iff, mem_embBit] constructor - · simp_all - · simp_all + · simp_all only [and_imp, forall_exists_index, List.cons.injEq, true_and, exists_eq_left', + and_true, forall_eq', implies_true] + · simp_all only [forall_exists_index, List.cons.injEq, true_and, exists_eq_left', and_self, + implies_true] theorem embBit_inter_ne {b b' : Bool} (h : b ≠ b') (X Y : Set Str) : embBit b X ∩ embBit b' Y = ∅ := by ext w - simp_all + simp_all only [ne_eq, Set.mem_inter_iff, mem_embBit, Set.mem_empty_iff_false, iff_false, + not_and, not_exists, forall_exists_index, List.cons.injEq, false_and, IsEmpty.forall_iff, + implies_true] theorem embBit_subset {b : Bool} {X X' : Set Str} : embBit b X ⊆ embBit b X' ↔ X ⊆ X' := by constructor · intro h w' hw' obtain ⟨w'', heq, hX'⟩ := h ⟨w', rfl, hw'⟩ - simp_all + simp_all only [List.cons.injEq, true_and] · rintro h w ⟨w', rfl, hX⟩ exact ⟨w', rfl, h hX⟩ @@ -134,7 +138,7 @@ theorem embBit_ne {b b' : Bool} (h : b ≠ b') {X Y : Set Str} (hX : X.Nonempty) intro heq obtain ⟨w', hw'⟩ := hX have hmem : (b :: w') ∈ embBit b' Y := heq ▸ (⟨w', rfl, hw'⟩ : (b :: w') ∈ embBit b X) - simp_all + simp_all only [ne_eq, mem_embBit, List.cons.injEq, false_and, exists_const] /-! ### `B` is positive (no empty neighbourhood) and its neighbourhood-shape classification. -/ diff --git a/LeanPool/DomainTheory/Neighborhood/Example62A.lean b/LeanPool/DomainTheory/Neighborhood/Example62A.lean index 5cfc9390f5..5fcf326f0d 100644 --- a/LeanPool/DomainTheory/Neighborhood/Example62A.lean +++ b/LeanPool/DomainTheory/Neighborhood/Example62A.lean @@ -8,7 +8,6 @@ module public import LeanPool.DomainTheory.Neighborhood.ExampleB public import LeanPool.DomainTheory.Neighborhood.Exercise318 import LeanPool.DomainTheory.Neighborhood.Exercise319Sum -import Mathlib.Order.BooleanAlgebra.Set import Mathlib.Tactic.Attr.Core /-! @@ -136,9 +135,12 @@ def slotPre (i : Bool) (j : ℕ) : Str := i :: (List.replicate j true ++ [false] the remainder. -/ theorem slot_list_inj : ∀ (j j' : ℕ) (u v : Str), List.replicate j true ++ false :: u = List.replicate j' true ++ false :: v → j = j' ∧ u = v - | 0, 0, u, v, h => by simpa using h - | 0, j' + 1, u, v, h => by simp [List.replicate_succ] at h - | j + 1, 0, u, v, h => by simp [List.replicate_succ] at h + | 0, 0, u, v, h => by simpa only [true_and, List.replicate_zero, List.nil_append, + List.cons.injEq] using h + | 0, j' + 1, u, v, h => by simp only [List.replicate_zero, List.nil_append, + List.replicate_succ, List.cons_append, List.cons.injEq, Bool.false_eq_true, false_and] at h + | j + 1, 0, u, v, h => by simp only [List.replicate_succ, List.cons_append, + List.replicate_zero, List.nil_append, List.cons.injEq, Bool.true_eq_false, false_and] at h | j + 1, j' + 1, u, v, h => by rw [List.replicate_succ, List.cons_append, List.replicate_succ, List.cons_append, List.cons.injEq] at h @@ -289,7 +291,7 @@ theorem memA_inter (hn : 0 < n) : intro X hX induction hX with | univ => - simp_all + simp_all only [Set.univ_inter, implies_true] | @tuple i X hX ih => intro Y hY Z hZ hsub cases hY with @@ -306,7 +308,7 @@ theorem memA_inter (hn : 0 < n) : have hZsub := embTuple_subset.mp hsub exact MemA.tuple i' (fun j => ih j (hX' j) (hZW j) (hZsub j)) · rw [embTuple_inter_ne hii] at hsub ⊢ - simp_all + simp_all only [Set.subset_inter_iff, and_imp, Set.subset_empty_iff] /-- **Scott's domain `A`** packaged as a neighbourhood system over `{0,1}*` (needs `0 < n`). -/ diff --git a/LeanPool/DomainTheory/Neighborhood/Example62C.lean b/LeanPool/DomainTheory/Neighborhood/Example62C.lean index 97619320e9..4b02fe2747 100644 --- a/LeanPool/DomainTheory/Neighborhood/Example62C.lean +++ b/LeanPool/DomainTheory/Neighborhood/Example62C.lean @@ -9,11 +9,6 @@ public import LeanPool.DomainTheory.Neighborhood.Example62 public import LeanPool.DomainTheory.Neighborhood.Example44 public import LeanPool.DomainTheory.Neighborhood.Exercise315 import Mathlib.Data.Fintype.EquivFin -import Mathlib.Data.Rat.Cast.Order -import Mathlib.Tactic.NormNum.Abs -import Mathlib.Tactic.NormNum.DivMod -import Mathlib.Tactic.NormNum.OfScientific -import Mathlib.Tactic.NormNum.Pow /-! # Example 6.2 (Scott 1981, PRG-19, §6) — `C ≅ {{Λ}} + C + C` @@ -99,31 +94,37 @@ variable {α β γ : Type*} · intro hc; exact ⟨c, rfl, hc⟩ @[simp] theorem none_not_mem_j0 {X : Set α} : (none : Option (α ⊕ β ⊕ γ)) ∉ j0 X := by - rintro ⟨a, heq, -⟩; exact absurd heq (by simp [t0]) + rintro ⟨a, heq, -⟩; exact absurd heq (by simp only [t0, reduceCtorEq, not_false_eq_true]) @[simp] theorem none_not_mem_j1 {Y : Set β} : (none : Option (α ⊕ β ⊕ γ)) ∉ j1 Y := by - rintro ⟨b, heq, -⟩; exact absurd heq (by simp [t1]) + rintro ⟨b, heq, -⟩; exact absurd heq (by simp only [t1, reduceCtorEq, not_false_eq_true]) @[simp] theorem none_not_mem_j2 {Z : Set γ} : (none : Option (α ⊕ β ⊕ γ)) ∉ j2 Z := by - rintro ⟨c, heq, -⟩; exact absurd heq (by simp [t2]) + rintro ⟨c, heq, -⟩; exact absurd heq (by simp only [t2, reduceCtorEq, not_false_eq_true]) @[simp] theorem t1_not_mem_j0 {X : Set α} {b : β} : (t1 b : Option (α ⊕ β ⊕ γ)) ∉ j0 X := by - rintro ⟨a, heq, -⟩; exact absurd heq (by simp [t0, t1]) + rintro ⟨a, heq, -⟩; exact absurd heq (by simp only [t1, t0, Option.some.injEq, reduceCtorEq, + not_false_eq_true]) @[simp] theorem t2_not_mem_j0 {X : Set α} {c : γ} : (t2 c : Option (α ⊕ β ⊕ γ)) ∉ j0 X := by - rintro ⟨a, heq, -⟩; exact absurd heq (by simp [t0, t2]) + rintro ⟨a, heq, -⟩; exact absurd heq (by simp only [t2, t0, Option.some.injEq, reduceCtorEq, + not_false_eq_true]) @[simp] theorem t0_not_mem_j1 {Y : Set β} {a : α} : (t0 a : Option (α ⊕ β ⊕ γ)) ∉ j1 Y := by - rintro ⟨b, heq, -⟩; exact absurd heq (by simp [t0, t1]) + rintro ⟨b, heq, -⟩; exact absurd heq (by simp only [t0, t1, Option.some.injEq, reduceCtorEq, + not_false_eq_true]) @[simp] theorem t2_not_mem_j1 {Y : Set β} {c : γ} : (t2 c : Option (α ⊕ β ⊕ γ)) ∉ j1 Y := by - rintro ⟨b, heq, -⟩; exact absurd heq (by simp [t1, t2]) + rintro ⟨b, heq, -⟩; exact absurd heq (by simp only [t2, t1, Option.some.injEq, Sum.inr.injEq, + reduceCtorEq, not_false_eq_true]) @[simp] theorem t0_not_mem_j2 {Z : Set γ} {a : α} : (t0 a : Option (α ⊕ β ⊕ γ)) ∉ j2 Z := by - rintro ⟨c, heq, -⟩; exact absurd heq (by simp [t0, t2]) + rintro ⟨c, heq, -⟩; exact absurd heq (by simp only [t0, t2, Option.some.injEq, reduceCtorEq, + not_false_eq_true]) @[simp] theorem t1_not_mem_j2 {Z : Set γ} {b : β} : (t1 b : Option (α ⊕ β ⊕ γ)) ∉ j2 Z := by - rintro ⟨c, heq, -⟩; exact absurd heq (by simp [t1, t2]) + rintro ⟨c, heq, -⟩; exact absurd heq (by simp only [t1, t2, Option.some.injEq, Sum.inr.injEq, + reduceCtorEq, not_false_eq_true]) theorem j0_inter_j0 (X X' : Set α) : (j0 X ∩ j0 X' : Set (Option (α ⊕ β ⊕ γ))) = j0 (X ∩ X') := by @@ -368,10 +369,11 @@ theorem memC_embBit_inv {b : Bool} {W : Set Str} (h : C.mem (embBit b W)) : C.me theorem singleton_nil_inter_embBit (b : Bool) (X : Set Str) : (({[]} : Set Str) ∩ embBit b X) = ∅ := by - simp_all + simp_all only [mem_embBit, List.nil_eq, reduceCtorEq, false_and, exists_const, + not_false_eq_true, Set.singleton_inter_of_notMem] theorem singleton_nil_ne_univ : ({[]} : Set Str) ≠ Set.univ := by - simp_all + exact Set.singleton_ne_univ [] theorem singleton_nil_ne_embBit (b : Bool) (X : Set Str) : ({[]} : Set Str) ≠ embBit b X := by intro h diff --git a/LeanPool/DomainTheory/Neighborhood/Example62Regular.lean b/LeanPool/DomainTheory/Neighborhood/Example62Regular.lean index cc7ad7360e..521e67956b 100644 --- a/LeanPool/DomainTheory/Neighborhood/Example62Regular.lean +++ b/LeanPool/DomainTheory/Neighborhood/Example62Regular.lean @@ -92,24 +92,24 @@ def child (a : Tree n) (i : Fin n) : Tree n := select a [i] /-- **Scott's selector recursion, base case `aΛ = a`.** -/ @[simp] theorem select_nil (a : Tree n) : select a [] = a := by - funext τ; simp + funext τ; simp only [select_apply, List.nil_append] /-- **Scott's selector recursion, step `a(iσ) = (aᵢ)σ`.** Reading the digit `i` then `σ` is the same as descending to the `i`-th child `aᵢ` and reading `σ` there. -/ theorem select_cons (a : Tree n) (i : Fin n) (σ : List (Fin n)) : select a (i :: σ) = select (child a i) σ := by - funext τ; simp [child] + funext τ; simp only [select_apply, List.cons_append, child, List.nil_append] /-- `pos(aσ) = a σ`: the root label of the subtree at `σ` is the label `a` assigns to node `σ`. -/ @[simp] theorem pos_select (a : Tree n) (σ : List (Fin n)) : pos (select a σ) = a σ := by - simp [pos] + simp only [pos, select_apply, List.append_nil] /-- Composing selectors: `a(στ) = (aσ)τ`. -/ theorem select_append (a : Tree n) (σ τ : List (Fin n)) : select a (σ ++ τ) = select (select a σ) τ := by - funext ρ; simp [List.append_assoc] + funext ρ; simp only [select_apply, List.append_assoc] /-- **Scott's language of a tree.** `L_a = {σ ∈ Σ* ∣ pos(aσ) = true}` — the selectors that land on a @@ -146,7 +146,8 @@ theorem treeLang_injective : Function.Injective (treeLang (n := n)) := by funext σ have hmem : (σ ∈ treeLang a) ↔ (σ ∈ treeLang a') := by rw [h] simp only [mem_treeLang] at hmem - cases ha : a σ <;> cases ha' : a' σ <;> simp_all + cases ha : a σ <;> cases ha' : a' σ <;> + simp_all only [Bool.false_eq_true, iff_false, not_true_eq_false, iff_true] /-- **Eventual periodicity (Scott).** A tree `a` is *eventually periodic* iff the set of its diff --git a/LeanPool/DomainTheory/Neighborhood/ExampleB.lean b/LeanPool/DomainTheory/Neighborhood/ExampleB.lean index 5c358cdc64..3c3e09a466 100644 --- a/LeanPool/DomainTheory/Neighborhood/ExampleB.lean +++ b/LeanPool/DomainTheory/Neighborhood/ExampleB.lean @@ -6,7 +6,6 @@ Authors: Catskills Research Company module public import LeanPool.DomainTheory.Neighborhood.Basic -public import Mathlib.Data.Set.Basic import Mathlib.Tactic.Attr.Core /-! @@ -70,7 +69,7 @@ def cone (σ : Str) : Set Str := {w | σ <+: w} /-- `ΛΣ* = Σ*`: the cone of the empty string is everything (Scott's `Δ`). -/ theorem cone_nil : cone [] = Set.univ := by - ext w; simp [cone] + ext w; simp only [cone, List.nil_prefix, Set.ofPred_true, Set.mem_univ] /-- **Cones reverse the prefix order.** `σΣ* ⊆ τΣ*` iff `τ` is an initial segment of `σ`: a longer @@ -150,7 +149,7 @@ theorem prepend_cone (σ ρ : Str) : prepend σ (cone ρ) = cone (σ ++ ρ) := b ext w simp only [mem_prepend, mem_cone] constructor - · simp_all + · simp_all only [forall_exists_index, List.prefix_append_right_inj, implies_true] · rintro ⟨t, ht⟩ exact ⟨ρ ++ t, List.prefix_append ρ t, by rw [← ht, List.append_assoc]⟩ @@ -159,7 +158,7 @@ theorem prepend_univ (σ : Str) : prepend σ Set.univ = cone σ := by ext w simp only [mem_prepend, Set.mem_univ, true_and, mem_cone] constructor - · simp_all + · simp_all only [forall_exists_index, List.prefix_append, implies_true] · rintro ⟨t, ht⟩ exact ⟨t, ht.symm⟩ diff --git a/LeanPool/DomainTheory/Neighborhood/Exercise112.lean b/LeanPool/DomainTheory/Neighborhood/Exercise112.lean index 7c3bdd1ae2..2b731121ee 100644 --- a/LeanPool/DomainTheory/Neighborhood/Exercise112.lean +++ b/LeanPool/DomainTheory/Neighborhood/Exercise112.lean @@ -7,7 +7,6 @@ module public import LeanPool.DomainTheory.Neighborhood.Basic import Mathlib.Data.Nat.Find -import Mathlib.Data.Set.Basic /-! # Exercise 1.12 (Scott 1981, PRG-19, §1) — the final-segment system on `ℕ` @@ -64,7 +63,7 @@ theorem tail_subset_iff {n m : ℕ} : tail n ⊆ tail m ↔ m ≤ n := by shorter one). -/ theorem tail_inter (n m : ℕ) : tail n ∩ tail m = tail (max n m) := by ext k - simp_all + simp_all only [Set.mem_inter_iff, mem_tail, sup_le_iff] /-- Membership in the final-segment system: `X` is a neighbourhood iff `X = tail n` for some `n`. -/ diff --git a/LeanPool/DomainTheory/Neighborhood/Exercise113.lean b/LeanPool/DomainTheory/Neighborhood/Exercise113.lean index 2b01062d25..a815226a7a 100644 --- a/LeanPool/DomainTheory/Neighborhood/Exercise113.lean +++ b/LeanPool/DomainTheory/Neighborhood/Exercise113.lean @@ -8,7 +8,6 @@ module public import LeanPool.DomainTheory.Neighborhood.ExampleB public import LeanPool.DomainTheory.Neighborhood.Theorem111 public import Mathlib.Tactic.Attr.Core -public import Mathlib.Tactic.Basic /-! # Exercise 1.13 (Scott 1981, PRG-19, §1) — the infinite binary system `B`, @@ -56,7 +55,8 @@ def prefixSeq (p : ℕ → Bool) : ℕ → Str @[simp] theorem prefixSeq_length (p : ℕ → Bool) (n : ℕ) : (prefixSeq p n).length = n := by induction n with | zero => rfl - | succ k ih => simp [prefixSeq, ih] + | succ k ih => simp only [prefixSeq, List.length_append, ih, List.length_cons, + List.length_nil, Nat.zero_add] theorem prefixSeq_prefix_succ (p : ℕ → Bool) (n : ℕ) : prefixSeq p n <+: prefixSeq p (n + 1) := ⟨[p n], rfl⟩ @@ -110,7 +110,7 @@ theorem prefix_comparable_of_mem {σ τ : Str} (y : B.Element) · exfalso have hmem : ρ ∈ cone ρ := mem_cone.mpr List.prefix_rfl rw [← hρ, h] at hmem - simp at hmem + simp only [Set.mem_empty_iff_false] at hmem /-- **Exercise 1.13 (total elements).** Each infinite path `p` gives a *total* (maximal) element diff --git a/LeanPool/DomainTheory/Neighborhood/Exercise114.lean b/LeanPool/DomainTheory/Neighborhood/Exercise114.lean index eafe98b2d0..5ca400ad15 100644 --- a/LeanPool/DomainTheory/Neighborhood/Exercise114.lean +++ b/LeanPool/DomainTheory/Neighborhood/Exercise114.lean @@ -7,7 +7,6 @@ module public import LeanPool.DomainTheory.Neighborhood.Basic public import Mathlib.Basic.Finite.Defs -public import Mathlib.Data.Set.Basic import Mathlib.Data.Set.Finite.Basic /-! @@ -103,7 +102,7 @@ theorem singleton_isTotal (n : ℕ) : by_contra hc rw [Set.singleton_subset_iff] at hc have hempty : ({n} : Set ℕ) ∩ W = (∅ : Set ℕ) := by - simp_all + exact Set.singleton_inter_eq_empty.mpr hc have hi := y.inter_mem hn hW rw [hempty] at hi exact empty_not_mem (y.sub hi) diff --git a/LeanPool/DomainTheory/Neighborhood/Exercise115.lean b/LeanPool/DomainTheory/Neighborhood/Exercise115.lean index 709cbb444f..fdede2ca50 100644 --- a/LeanPool/DomainTheory/Neighborhood/Exercise115.lean +++ b/LeanPool/DomainTheory/Neighborhood/Exercise115.lean @@ -6,12 +6,6 @@ Authors: Catskills Research Company module public import LeanPool.DomainTheory.Neighborhood.Basic -public import Mathlib.Data.Set.Basic -import Mathlib.Data.Rat.Cast.Order -import Mathlib.Tactic.NormNum.Abs -import Mathlib.Tactic.NormNum.DivMod -import Mathlib.Tactic.NormNum.OfScientific -import Mathlib.Tactic.NormNum.Pow /-! # Exercise 1.15 (Scott 1981, PRG-19, §1) — non-isomorphic "finite-only" domains @@ -59,7 +53,7 @@ open Domain.Neighborhood NeighborhoodSystem /-- `{n} ∩ {m} = ∅` for `n ≠ m`. -/ theorem singleton_disjoint {n m : ℕ} (h : n ≠ m) : ({n} : Set ℕ) ∩ {m} = ∅ := by - simp_all + exact Set.singleton_inter_eq_empty.mpr h /-! ## The flat domain `flat`. -/ @@ -110,7 +104,8 @@ theorem flat_classify (x : flat.Element) : · intro hx rcases (x.sub hx) with rfl | ⟨k, rfl⟩ · exact ⟨Or.inl rfl, Set.subset_univ _⟩ - · simp_all + · simp_all only [mem_principal, flat_mem, Set.singleton_ne_univ, + Set.singleton_eq_singleton_iff, exists_eq', or_true, Std.le_refl, and_self] · rintro ⟨hWmem, hsub⟩ exact x.up_mem hn hWmem hsub · refine Or.inl ?_ @@ -132,10 +127,10 @@ theorem flat_atom_maximal (n : ℕ) (y : flat.Element) rcases flat_classify y with rfl | ⟨m, rfl⟩ · exfalso have hmem : flat.bot.mem {n} := hle {n} ⟨flat_mem_singleton n, subset_rfl⟩ - simp_all + simp_all only [mem_bot, flat_master, Set.singleton_ne_univ] · have hsub : ({m} : Set ℕ) ⊆ {n} := (flat.principal_le_iff (flat_mem_singleton n) (flat_mem_singleton m)).mp hle - simp_all + exact principal.congr_simp flat (congrArg singleton (hsub rfl)) (flat_mem_singleton m) /-- **Flat has no strict 3-chain** (`a ⊏ b ⊏ c` is impossible): `⊥` is least and atoms are @@ -150,7 +145,7 @@ theorem flat_no_three_chain : ¬ ∃ a b c : flat.Element, a < b ∧ b < c := by theorem flat_no_infinite_chain : ¬ ∃ f : ℕ → flat.Element, StrictMono f := by rintro ⟨f, hf⟩ exact flat_no_three_chain - ⟨f 0, f 1, f 2, hf (by norm_num), hf (by norm_num)⟩ + ⟨f 0, f 1, f 2, hf (by decide), hf (by decide)⟩ /-- **All elements of `flat` are finite** (principal). -/ theorem flat_all_finite (x : flat.Element) : @@ -175,15 +170,19 @@ theorem stemNOD : NestedOrDisjoint stemMem := by have pair_single : ∀ m : ℕ, ({m} : Set ℕ) ⊆ {0, 1} ∨ ({0, 1} : Set ℕ) ∩ {m} = ∅ := by intro m by_cases h : m = 0 ∨ m = 1 - · simp_all - · simp_all + · simp_all only [Set.singleton_subset_iff, Set.mem_insert_iff, Set.mem_singleton_iff, + Set.inter_singleton_of_mem, Set.singleton_ne_empty, or_false] + · simp_all only [not_or, Set.singleton_subset_iff, Set.mem_insert_iff, + Set.mem_singleton_iff, or_self, not_false_eq_true, Set.inter_singleton_of_notMem, or_true] rintro X Y (rfl | rfl | ⟨n, rfl⟩) (rfl | rfl | ⟨m, rfl⟩) · exact Or.inl (subset_refl _) · exact Or.inr (Or.inl (Set.subset_univ _)) · exact Or.inr (Or.inl (Set.subset_univ _)) · exact Or.inl (Set.subset_univ _) · exact Or.inl (subset_refl _) - · simp_all + · simp_all only [Set.singleton_subset_iff, Set.mem_insert_iff, Set.mem_singleton_iff, + Set.inter_singleton_eq_empty, not_or, Set.subset_singleton_iff, forall_eq_or_imp, forall_eq, + or_true] · exact Or.inl (Set.subset_univ _) · rcases pair_single n with h | h · exact Or.inl h @@ -221,12 +220,15 @@ theorem stem_three_chain : ∃ a b c : stem.Element, a < b ∧ b < c := by · refine stem_principal_lt stem_mem_univ stem_mem_pair (Set.subset_univ _) ?_ intro h have : (2 : ℕ) ∈ ({0, 1} : Set ℕ) := h ▸ Set.mem_univ 2 - simp at this + simp only [Set.mem_insert_iff, reduceCtorEq, Set.mem_singleton_iff, Nat.succ_ne_self, + or_self] at this · refine stem_principal_lt stem_mem_pair stem_mem_zero - (Set.singleton_subset_iff.mpr (by simp)) ?_ + (Set.singleton_subset_iff.mpr (by simp only [Set.mem_insert_iff, Set.mem_singleton_iff, + Nat.zero_ne_one, or_false])) ?_ intro h - have : (1 : ℕ) ∈ ({0} : Set ℕ) := h ▸ (by simp : (1 : ℕ) ∈ ({0, 1} : Set ℕ)) - simp at this + have : (1 : ℕ) ∈ ({0} : Set ℕ) := h ▸ (by simp only [Set.mem_insert_iff, Nat.succ_ne_self, + Set.mem_singleton_iff, or_true] : (1 : ℕ) ∈ ({0, 1} : Set ℕ)) + simp only [Set.mem_singleton_iff, Nat.succ_ne_self] at this /-! ## Non-isomorphism. -/ diff --git a/LeanPool/DomainTheory/Neighborhood/Exercise116.lean b/LeanPool/DomainTheory/Neighborhood/Exercise116.lean index e1fd9f8c09..d02d991407 100644 --- a/LeanPool/DomainTheory/Neighborhood/Exercise116.lean +++ b/LeanPool/DomainTheory/Neighborhood/Exercise116.lean @@ -7,7 +7,6 @@ module public import LeanPool.DomainTheory.Neighborhood.Basic public import Mathlib.Basic.Finite.Defs -public import Mathlib.Data.Set.Basic import Mathlib.Data.Set.Finite.Basic /-! @@ -90,7 +89,7 @@ def toExcluded (x : cofiniteSystem.Element) : Set ℕ := {n | x.mem ({n}ᶜ)} /-- Each `{n}ᶜ` is a neighbourhood (its complement `{n}` is finite). -/ theorem mem_compl_singleton (n : ℕ) : cofiniteSystem.mem (({n} : Set ℕ)ᶜ) := by - simp_all + simp_all only [cofiniteSystem_mem, compl_compl, Set.finite_singleton] /-- **Reconstruction lemma.** For finite `F` of points each of whose single-deletion `{n}ᶜ` @@ -107,11 +106,12 @@ theorem mem_compl_of_finite (x : cofiniteSystem.Element) {F : Set ℕ} (hF : F.F /-- For `n ∉ Y`, the neighbourhood `Y` is contained in `{n}ᶜ`. -/ theorem subset_compl_singleton {Y : Set ℕ} {n : ℕ} (hn : n ∈ Yᶜ) : Y ⊆ ({n} : Set ℕ)ᶜ := by - simp_all + exact Set.subset_compl_singleton_iff.mpr hn theorem toExcluded_ofExcluded (E : Set ℕ) : toExcluded (ofExcluded E) = E := by ext n - simp_all + simp_all only [mem_toExcluded, mem_ofExcluded, compl_compl, Set.finite_singleton, + Set.singleton_subset_iff, true_and] theorem ofExcluded_toExcluded (x : cofiniteSystem.Element) : ofExcluded (toExcluded x) = x := by diff --git a/LeanPool/DomainTheory/Neighborhood/Exercise117.lean b/LeanPool/DomainTheory/Neighborhood/Exercise117.lean index adf78989d8..c78f233398 100644 --- a/LeanPool/DomainTheory/Neighborhood/Exercise117.lean +++ b/LeanPool/DomainTheory/Neighborhood/Exercise117.lean @@ -73,7 +73,7 @@ theorem inter_mem' {X Y : Set ℝ} (hX : ratIntervalMem X) (hY : ratIntervalMem have had : a < d := by exact_mod_cast hza.trans hzd have hcb : c < b := by exact_mod_cast hzc.trans hzb have hlt : max a c < min b d := by - simp_all + simp_all only [lt_min_iff, max_lt_iff, and_self] have hset : Set.Ioo (a : ℝ) b ∩ Set.Ioo (c : ℝ) d = Set.Ioo ((max a c : ℚ) : ℝ) ((min b d : ℚ) : ℝ) := by rw [Set.Ioo_inter_Ioo, Rat.cast_max, Rat.cast_min] diff --git a/LeanPool/DomainTheory/Neighborhood/Exercise118.lean b/LeanPool/DomainTheory/Neighborhood/Exercise118.lean index 7f590dc439..867869e01e 100644 --- a/LeanPool/DomainTheory/Neighborhood/Exercise118.lean +++ b/LeanPool/DomainTheory/Neighborhood/Exercise118.lean @@ -97,7 +97,7 @@ theorem interUpTo_appendSeq (X1 : ℕ → Set α) (n1 : ℕ) (X2 : ℕ → Set rw [Nat.add_succ, interUpTo_succ, ih] have happ : appendSeq X1 n1 X2 (n1 + j) = X2 j := by simp only [appendSeq, ite_eq_right (by omega : ¬ n1 + j < n1)] - simp_all + simp_all only [add_tsub_cancel_left] rw [happ, interUpTo_succ, Set.inter_assoc] /-! ### Finite consistency. -/ @@ -164,7 +164,7 @@ theorem subset_leastFilter (C : Set (Set α)) (hCsub : ∀ X ∈ C, V.mem X) (hC : V.FinitelyConsistent C) {W : Set α} (hW : W ∈ C) : (V.leastFilter C hCsub hC).mem W := by refine ⟨hCsub W hW, 1, (fun _ => W), (fun _ _ => hW), ?_⟩ - simp_all + simp_all only [interUpTo_succ, interUpTo_zero, Set.inter_subset_right] /-- **Exercise 1.18 — `leastFilter` is least.** Any filter `z` with `C ⊆ z` contains @@ -206,15 +206,28 @@ theorem family_pairwise_nonempty : intro X hX Y hY simp only [family, Set.mem_insert_iff, Set.mem_singleton_iff] at hX hY rcases hX with rfl | rfl | rfl <;> rcases hY with rfl | rfl | rfl - · exact ⟨0, by simp [A]⟩ - · exact ⟨1, by simp [A, B]⟩ - · exact ⟨0, by simp [A, Cc]⟩ - · exact ⟨1, by simp [A, B]⟩ - · exact ⟨1, by simp [B]⟩ - · exact ⟨2, by simp [B, Cc]⟩ - · exact ⟨0, by simp [A, Cc]⟩ - · exact ⟨2, by simp [B, Cc]⟩ - · exact ⟨0, by simp [Cc]⟩ + · exact ⟨0, by simp only [A, Fin.isValue, Set.inter_self, Set.mem_insert_iff, + Set.mem_singleton_iff, Fin.zero_eq_one_iff, OfNat.ofNat_ne_one, or_false]⟩ + · exact ⟨1, by simp only [A, Fin.isValue, B, Set.mem_inter_iff, Set.mem_insert_iff, + Fin.one_eq_zero_iff, OfNat.ofNat_ne_one, Set.mem_singleton_iff, or_true, Fin.reduceEq, + or_false, and_self]⟩ + · exact ⟨0, by simp only [A, Fin.isValue, Cc, Set.mem_inter_iff, Set.mem_insert_iff, + Set.mem_singleton_iff, Fin.zero_eq_one_iff, OfNat.ofNat_ne_one, or_false, Fin.reduceEq, + and_self]⟩ + · exact ⟨1, by simp only [B, Fin.isValue, A, Set.mem_inter_iff, Set.mem_insert_iff, + Set.mem_singleton_iff, Fin.reduceEq, or_false, Fin.one_eq_zero_iff, OfNat.ofNat_ne_one, + or_true, and_self]⟩ + · exact ⟨1, by simp only [B, Fin.isValue, Set.inter_self, Set.mem_insert_iff, + Set.mem_singleton_iff, Fin.reduceEq, or_false]⟩ + · exact ⟨2, by simp only [B, Fin.isValue, Cc, Set.mem_inter_iff, Set.mem_insert_iff, + Fin.reduceEq, Set.mem_singleton_iff, or_true, and_self]⟩ + · exact ⟨0, by simp only [Cc, Fin.isValue, A, Set.mem_inter_iff, Set.mem_insert_iff, + Set.mem_singleton_iff, Fin.reduceEq, or_false, Fin.zero_eq_one_iff, OfNat.ofNat_ne_one, + and_self]⟩ + · exact ⟨2, by simp only [Cc, Fin.isValue, B, Set.mem_inter_iff, Set.mem_insert_iff, + Fin.reduceEq, Set.mem_singleton_iff, or_true, and_self]⟩ + · exact ⟨0, by simp only [Cc, Fin.isValue, Set.inter_self, Set.mem_insert_iff, + Set.mem_singleton_iff, Fin.reduceEq, or_false]⟩ /-- The triple `A, B, Cc` as a finite sequence. -/ def triple : ℕ → Set (Fin 3) := fun i => if i = 0 then A else if i = 1 then B else Cc @@ -228,7 +241,8 @@ theorem triple_mem : ∀ i, i < 3 → triple i ∈ family := by · exact Or.inr (Or.inr rfl) theorem triple_interUpTo_empty : triSys.interUpTo triple 3 = (∅ : Set (Fin 3)) := by - simp only [NeighborhoodSystem.interUpTo_succ, NeighborhoodSystem.interUpTo_zero, triSys_master] + simp only [NeighborhoodSystem.interUpTo_succ, NeighborhoodSystem.interUpTo_zero, + triSys_master] ext x fin_cases x <;> simp [triple, A, B, Cc] @@ -240,7 +254,7 @@ theorem not_finitelyConsistent : ¬ triSys.FinitelyConsistent family := by obtain ⟨Z, hZmem, hZsub⟩ := h 3 triple triple_mem have hZne : Z.Nonempty := hZmem rw [triple_interUpTo_empty, Set.subset_empty_iff] at hZsub - simp_all + simp_all only [Set.not_nonempty_empty] end triSys diff --git a/LeanPool/DomainTheory/Neighborhood/Exercise119.lean b/LeanPool/DomainTheory/Neighborhood/Exercise119.lean index cdcf9d7968..8fbe8e7fe7 100644 --- a/LeanPool/DomainTheory/Neighborhood/Exercise119.lean +++ b/LeanPool/DomainTheory/Neighborhood/Exercise119.lean @@ -6,7 +6,6 @@ Authors: Catskills Research Company module public import LeanPool.DomainTheory.Neighborhood.Basic -public import Mathlib.Data.Set.Basic import Mathlib.Data.Fintype.Basic import Mathlib.Tactic.FinCases @@ -93,21 +92,32 @@ theorem a_inter_b : a ∩ b = ({1} : Set Tok) := by ext x; fin_cases x <;> simp theorem one_not_mem : ¬ mem ({1} : Set Tok) := by intro h rcases (mem_iff _).mp h with h | h | h - · have h0 : (0 : Tok) ∈ master := by simp [master] - rw [← h] at h0; simp at h0 - · have h0 : (0 : Tok) ∈ a := by simp [a] - rw [← h] at h0; simp at h0 - · have h2 : (2 : Tok) ∈ b := by simp [b] - rw [← h] at h2; simp at h2 + · have h0 : (0 : Tok) ∈ master := by simp only [master, Fin.isValue, Set.mem_univ] + rw [← h] at h0; simp only [Fin.isValue, Set.mem_singleton_iff, Fin.zero_eq_one_iff, + Nat.reduceEqDiff] at h0 + · have h0 : (0 : Tok) ∈ a := by simp only [a, Fin.isValue, Set.mem_insert_iff, + Set.mem_singleton_iff, Fin.zero_eq_one_iff, Nat.reduceEqDiff, or_false] + rw [← h] at h0; simp only [Fin.isValue, Set.mem_singleton_iff, Fin.zero_eq_one_iff, + Nat.reduceEqDiff] at h0 + · have h2 : (2 : Tok) ∈ b := by simp only [b, Fin.isValue, Set.mem_insert_iff, Fin.reduceEq, + Set.mem_singleton_iff, or_true] + rw [← h] at h2; simp only [Fin.isValue, Set.mem_singleton_iff, Fin.reduceEq] at h2 /-- No neighbourhood is contained in `{1}` (each contains a token other than `1`). This is why the overlapping pair `{0,1}`, `{1,2}` never triggers condition (ii). -/ theorem not_mem_sub_one {Z : Set Tok} (hZ : mem Z) (hsub : Z ⊆ ({1} : Set Tok)) : False := by rcases (mem_iff Z).mp hZ with rfl | rfl | rfl - · exact absurd (hsub (show (0 : Tok) ∈ master by simp [master])) (by simp) - · exact absurd (hsub (show (0 : Tok) ∈ a by simp [a])) (by simp) - · exact absurd (hsub (show (2 : Tok) ∈ b by simp [b])) (by simp) + · exact absurd (hsub (show (0 : Tok) ∈ master by simp only [master, Fin.isValue, + Set.mem_univ])) (by simp only [Fin.isValue, Set.mem_singleton_iff, Fin.zero_eq_one_iff, + Nat.reduceEqDiff, not_false_eq_true]) + · exact absurd (hsub (show (0 : Tok) ∈ a by simp only [a, Fin.isValue, Set.mem_insert_iff, + Set.mem_singleton_iff, Fin.zero_eq_one_iff, Nat.reduceEqDiff, + or_false])) (by simp only [Fin.isValue, Set.mem_singleton_iff, Fin.zero_eq_one_iff, + Nat.reduceEqDiff, not_false_eq_true]) + · exact absurd (hsub (show (2 : Tok) ∈ b by simp only [b, Fin.isValue, Set.mem_insert_iff, + Fin.reduceEq, Set.mem_singleton_iff, or_true])) (by simp only [Fin.isValue, + Set.mem_singleton_iff, Fin.reduceEq, not_false_eq_true]) /-- Classification of binary intersections in `𝒟`. -/ theorem inter_eq (X Y : Set Tok) (hX : mem X) (hY : mem Y) : diff --git a/LeanPool/DomainTheory/Neighborhood/Exercise120.lean b/LeanPool/DomainTheory/Neighborhood/Exercise120.lean index c7f29b0cce..efa0fee99e 100644 --- a/LeanPool/DomainTheory/Neighborhood/Exercise120.lean +++ b/LeanPool/DomainTheory/Neighborhood/Exercise120.lean @@ -6,8 +6,6 @@ Authors: Catskills Research Company module public import LeanPool.DomainTheory.Neighborhood.Basic -import Mathlib.Data.Set.Basic -import Mathlib.Tactic.Tauto /-! # Exercise 1.20 (Scott 1981, PRG-19, §1) — the power system `𝒟' = {↑X}` diff --git a/LeanPool/DomainTheory/Neighborhood/Exercise123.lean b/LeanPool/DomainTheory/Neighborhood/Exercise123.lean index 58861a5431..9a7806f81e 100644 --- a/LeanPool/DomainTheory/Neighborhood/Exercise123.lean +++ b/LeanPool/DomainTheory/Neighborhood/Exercise123.lean @@ -6,7 +6,6 @@ Authors: Catskills Research Company module public import LeanPool.DomainTheory.Neighborhood.Basic -import Mathlib.Data.Set.Basic /-! # Exercise 1.23 (Scott 1981, PRG-19, §1) — the greedy total element of a countable @@ -140,7 +139,7 @@ theorem acc_eq_interUpTo : ∀ n, acc V enum n = V.interUpTo (Y V enum) (n + 1) by_cases h : cond V enum n · rw [acc_succ_pos V enum h, Y_succ_pos V enum h] · rw [acc_succ_neg V enum h, Y_succ_neg V enum h] - simp_all + simp_all only [interUpTo_succ, Set.left_eq_inter, Set.inter_subset_right] variable (henum : ∀ n, V.mem (enum n)) include henum @@ -266,7 +265,7 @@ theorem filters_sequence_determined (x : V.Element) : obtain ⟨k, hk⟩ := hsurj (x.sub hZ) have hxk : x.mem (enum k) := by rw [hk]; exact hZ refine ⟨x.sub hZ, k, ?_⟩ - simp_all + simp_all only [↓reduceIte, Std.le_refl] · rintro ⟨hZmem, n, hn⟩ have hsx : x.mem (if x.mem (enum n) then enum n else V.master) := by by_cases h : x.mem (enum n) diff --git a/LeanPool/DomainTheory/Neighborhood/Exercise125.lean b/LeanPool/DomainTheory/Neighborhood/Exercise125.lean index 5c2189e00c..2e30654e81 100644 --- a/LeanPool/DomainTheory/Neighborhood/Exercise125.lean +++ b/LeanPool/DomainTheory/Neighborhood/Exercise125.lean @@ -114,7 +114,7 @@ theorem exists_Ici_of_mem {X : Set Δ} (hX : (finalSegmentSystem Δ).mem X) : ∃ a, X = Set.Ici a := by obtain ⟨a, haX, hmin⟩ := (wellFounded_lt (α := Δ)).has_min X hX.1 refine ⟨a, Set.ext fun b => ⟨fun hb => ?_, fun hb => ?_⟩⟩ - · simp_all + · simp_all only [mem_def, not_lt, Set.mem_Ici] · exact hX.2 (Set.mem_Ici.mp hb) haX /-! ### The classification of `|𝒟|` as the non-empty lower sets (initial diff --git a/LeanPool/DomainTheory/Neighborhood/Exercise126.lean b/LeanPool/DomainTheory/Neighborhood/Exercise126.lean index d2b83d5085..a04f781fa2 100644 --- a/LeanPool/DomainTheory/Neighborhood/Exercise126.lean +++ b/LeanPool/DomainTheory/Neighborhood/Exercise126.lean @@ -92,7 +92,8 @@ intersections. -/ theorem IFamily_inter (F₁ F₂ : Finset A) : IFamily F₁ ∩ IFamily F₂ = IFamily (F₁ ∪ F₂) := by ext G - simp only [IFamily, Set.mem_inter_iff, Set.mem_ofPred_eq, Finset.coe_union, Set.union_subset_iff] + simp only [IFamily, Set.mem_inter_iff, Set.mem_ofPred_eq, Finset.coe_union, + Set.union_subset_iff] /-- **Exercise 1.26 — the neighbourhood system of a commutative ring.** Tokens are finite subsets @@ -161,9 +162,10 @@ theorem mem_IFamily_of_forall (x : (ringSystem (A := A)).Element) (F : Finset A) | empty => exact x.master_mem | @insert a F' _ ih => have hins : (insert a F' : Finset A) = {a} ∪ F' := by - ext y; simp [Finset.mem_insert] + ext y; simp only [Finset.mem_insert, Finset.singleton_union] rw [hins, ← IFamily_inter] - exact x.inter_mem (h a (by simp)) (ih (fun b hb => h b (by simp [hb]))) + exact x.inter_mem (h a (by simp only [Finset.mem_insert, + true_or])) (ih (fun b hb => h b (by simp only [Finset.mem_insert, hb, or_true]))) /-! ### From ideals to filters. -/ @@ -208,7 +210,8 @@ theorem ofIdeal_idealOf (x : (ringSystem (A := A)).Element) : ofIdeal (idealOf x constructor · rintro ⟨F, rfl, hF⟩ refine mem_IFamily_of_forall x F (fun a ha => ?_) - have haspan : a ∈ Ideal.span (↑F : Set A) := Ideal.subset_span (by simpa using ha) + have haspan : a ∈ Ideal.span (↑F : Set A) := Ideal.subset_span (by simpa only [ + SetLike.mem_coe] using ha) exact mem_idealOf.mp (hF haspan) · intro hS obtain ⟨F, rfl⟩ := x.sub hS diff --git a/LeanPool/DomainTheory/Neighborhood/Exercise127.lean b/LeanPool/DomainTheory/Neighborhood/Exercise127.lean index 9a66ef36ea..272b49f78c 100644 --- a/LeanPool/DomainTheory/Neighborhood/Exercise127.lean +++ b/LeanPool/DomainTheory/Neighborhood/Exercise127.lean @@ -7,12 +7,9 @@ module public import LeanPool.DomainTheory.Neighborhood.Exercise118 public import Mathlib.Basic.Finite.Defs -import Mathlib.Data.Rat.Cast.Order import Mathlib.Data.Set.Finite.Range -import Mathlib.Tactic.NormNum.Abs -import Mathlib.Tactic.NormNum.DivMod -import Mathlib.Tactic.NormNum.OfScientific -import Mathlib.Tactic.NormNum.Pow + +import Mathlib.Tactic.Set -- shake: keep /-! # Exercise 1.27 (Scott 1981, PRG-19, §1) — bounded sets and least upper bounds @@ -98,7 +95,7 @@ def pairSeq (U W : Set α) : ℕ → Set α := fun i => if i = 0 then U else W theorem interUpTo_pairSeq (U W : Set α) : V.interUpTo (pairSeq U W) 2 = V.master ∩ U ∩ W := by simp only [interUpTo_succ, interUpTo_zero, pairSeq] - norm_num + rfl /-- **Exercise 1.27 — "boundedness is for elements what consistency is for neighbourhoods".** diff --git a/LeanPool/DomainTheory/Neighborhood/Exercise214.lean b/LeanPool/DomainTheory/Neighborhood/Exercise214.lean index d5fde454b2..ad8b7a0024 100644 --- a/LeanPool/DomainTheory/Neighborhood/Exercise214.lean +++ b/LeanPool/DomainTheory/Neighborhood/Exercise214.lean @@ -6,7 +6,6 @@ Authors: Catskills Research Company module public import LeanPool.DomainTheory.Neighborhood.Approximable -import Mathlib.Data.Set.Basic /-! # Exercise 2.14 (Scott 1981, PRG-19, §2) — the neighbourhood correspondence `φ` of diff --git a/LeanPool/DomainTheory/Neighborhood/Exercise215.lean b/LeanPool/DomainTheory/Neighborhood/Exercise215.lean index cb7a800717..475f25e7ae 100644 --- a/LeanPool/DomainTheory/Neighborhood/Exercise215.lean +++ b/LeanPool/DomainTheory/Neighborhood/Exercise215.lean @@ -73,7 +73,7 @@ open Domain.Neighborhood NeighborhoodSystem def memO (X : Set (Fin 1)) : Prop := X = Set.univ ∨ X = ∅ theorem univ_ne_empty : (Set.univ : Set (Fin 1)) ≠ ∅ := by - simp_all + exact Ne.symm Set.empty_ne_univ theorem nestedOrDisjoint_O : NestedOrDisjoint memO := by rintro X Y (rfl | rfl) (rfl | rfl) @@ -223,7 +223,7 @@ theorem toElementMap_openToMap_principal_mem_empty (U : Set V.Element) (hU : IsO rw [← (openToMap V U hU).rel_iff_mem_principal hX] constructor · rintro ⟨_, _, fimpl⟩ - simp_all + simp_all only [O_mem, exists_true_left, forall_const] · intro h exact ⟨hX, O_mem_empty, fun _ => ⟨hX, h⟩⟩ diff --git a/LeanPool/DomainTheory/Neighborhood/Exercise218.lean b/LeanPool/DomainTheory/Neighborhood/Exercise218.lean index 23dbda4a6f..0fe04858dc 100644 --- a/LeanPool/DomainTheory/Neighborhood/Exercise218.lean +++ b/LeanPool/DomainTheory/Neighborhood/Exercise218.lean @@ -8,7 +8,6 @@ module public import LeanPool.DomainTheory.Neighborhood.Approximable public import LeanPool.DomainTheory.Neighborhood.ExampleB public import Mathlib.Tactic.Attr.Core -import Mathlib.Order.BooleanAlgebra.Set import Mathlib.Tactic.Widget.Calc /-! @@ -68,9 +67,9 @@ def hOut : Str → Str /-- `hOut` grows under extension: `hOut σ <+: hOut (σ ++ t)`. -/ theorem hOut_append (σ t : Str) : hOut σ <+: hOut (σ ++ t) := by induction σ with - | nil => simp + | nil => simp only [hOut_nil, List.nil_append, List.nil_prefix] | cons b s ih => - simp_all + simp_all only [hOut_cons, List.cons_append, List.cons_prefix_cons, and_self] /-- **Prefix-monotonicity of `hOut`.** `σ <+: σ' → hOut σ <+: hOut σ'`. -/ theorem hOut_mono {σ σ' : Str} (h : σ <+: σ') : hOut σ <+: hOut σ' := by @@ -100,10 +99,10 @@ theorem kOut_hOut (σ : Str) : kOut (hOut σ) = σ := by /-- `kOut` grows under extension: `kOut σ <+: kOut (σ ++ t)`. -/ theorem kOut_append (σ t : Str) : kOut σ <+: kOut (σ ++ t) := by induction σ using kOut.induct with - | case1 => simp - | case2 _ => simp + | case1 => simp only [kOut_nil, List.nil_append, List.nil_prefix] + | case2 _ => simp only [kOut_single, List.cons_append, List.nil_append, List.nil_prefix] | case3 b c t' ih => - simp_all + simp_all only [kOut_cons, List.cons_append, List.cons_prefix_cons, and_self] /-- **Prefix-monotonicity of `kOut`.** `σ <+: σ' → kOut σ <+: kOut σ'`. -/ theorem kOut_mono {σ σ' : Str} (h : σ <+: σ') : kOut σ <+: kOut σ' := by @@ -172,7 +171,7 @@ theorem toElementMap_hMap_cone (σ : Str) : constructor · rintro ⟨ρ, hcone, hYmem, hsub⟩ have : σ = ρ := cone_injective hcone - simp_all + simp_all only [B_mem, and_self] · rintro ⟨hYmem, hsub⟩ exact ⟨σ, rfl, hYmem, hsub⟩ @@ -186,7 +185,7 @@ theorem toElementMap_kMap_cone (σ : Str) : constructor · rintro ⟨ρ, hcone, hYmem, hsub⟩ have : σ = ρ := cone_injective hcone - simp_all + simp_all only [B_mem, and_self] · rintro ⟨hYmem, hsub⟩ exact ⟨σ, rfl, hYmem, hsub⟩ @@ -224,7 +223,7 @@ theorem kMap_not_injective : ¬ Function.Injective kMap.toElementMap := by rw [toElementMap_kMap_cone, toElementMap_kMap_cone]; rfl have h2 := hinj h1 have hcone := cone_injective (B.principal_injective (memB_cone _) (memB_cone _) h2) - simp at hcone + simp only [List.cons.injEq, Bool.false_eq_true, and_true] at hcone /-- **Exercise 2.18 — `h` is not an isomorphism.** It is not surjective: `↑(01Σ*)` is not in the @@ -238,6 +237,7 @@ theorem hMap_not_surjective : ¬ Function.Surjective hMap.toElementMap := by rw [hx, toElementMap_kMap_cone] at hkhx rw [← hkhx, toElementMap_hMap_cone] at hx have hcone := cone_injective (B.principal_injective (memB_cone _) (memB_cone _) hx) - simp at hcone + simp only [kOut_cons, kOut_nil, hOut_cons, hOut_nil, List.cons.injEq, Bool.false_eq_true, + and_true, and_false] at hcone end Domain.Neighborhood.Exercise218 diff --git a/LeanPool/DomainTheory/Neighborhood/Exercise220.lean b/LeanPool/DomainTheory/Neighborhood/Exercise220.lean index c285c3e8a9..b3e045c5c6 100644 --- a/LeanPool/DomainTheory/Neighborhood/Exercise220.lean +++ b/LeanPool/DomainTheory/Neighborhood/Exercise220.lean @@ -7,7 +7,6 @@ module public import LeanPool.DomainTheory.Neighborhood.ApproximableExercises public import Mathlib.Basic.Finite.Defs -public import Mathlib.Data.Set.Basic import Mathlib.Data.Set.Finite.Basic /-! @@ -128,7 +127,7 @@ theorem toSet_ofSet (S : Set ℕ) : toSet (ofSet S) = S := by simp only [mem_toSet] constructor · rintro ⟨_, hsub⟩ - simp_all + exact Set.mem_of_subset_of_mem hsub fun a => a rfl · intro hn exact ⟨mem_compl_singleton n, by rw [compl_compl]; exact Set.singleton_subset_iff.mpr hn⟩ @@ -238,7 +237,7 @@ theorem toSet_predMap (x : powerSet.Element) : exact x.up_mem hxX (mem_compl_singleton (k + 1)) (Set.subset_compl_singleton_iff.mpr hk) · intro hk refine ⟨{k + 1}ᶜ, hk, mem_compl_singleton (k + 1), mem_compl_singleton k, ?_⟩ - simp_all + simp_all only [compl_compl, Set.singleton_subset_iff, mem_predSet, Set.mem_singleton_iff] /-! ### Union and intersection as two-variable approximable maps. -/ diff --git a/LeanPool/DomainTheory/Neighborhood/Exercise221.lean b/LeanPool/DomainTheory/Neighborhood/Exercise221.lean index 64066d85fe..43bd783a91 100644 --- a/LeanPool/DomainTheory/Neighborhood/Exercise221.lean +++ b/LeanPool/DomainTheory/Neighborhood/Exercise221.lean @@ -7,7 +7,6 @@ module public import LeanPool.DomainTheory.Neighborhood.ApproximableExercises public import LeanPool.DomainTheory.Neighborhood.ExampleB -import Mathlib.Order.BooleanAlgebra.Set import Mathlib.Tactic.Attr.Core /-! @@ -86,7 +85,7 @@ theorem cone_not_subset_singleton (σ τ : Str) : ¬ cone σ ⊆ ({τ} : Set Str theorem cone_ne_singleton (σ τ : Str) : cone σ ≠ ({τ} : Set Str) := by intro h refine cone_not_subset_singleton σ τ ?_ - simp_all + exact le_of_le_of_eq (fun ⦃a⦄ a_1 => a_1) h /-- Nested-or-disjoint for a cone vs. a terminator singleton: `{τ} ⊆ σΣ*` iff `σ prefix τ`, else @@ -97,7 +96,7 @@ theorem cone_singleton_nd (σ τ : Str) : Or.inr (Or.inl (Set.singleton_subset_iff.mpr (mem_cone.mpr h))) else Or.inr (Or.inr (by - simp_all)) + exact Set.inter_singleton_of_notMem h)) /-- Nested-or-disjoint for a terminator singleton vs. a cone (the mirror of `cone_singleton_nd`). -/ @@ -107,7 +106,7 @@ theorem singleton_cone_nd (σ τ : Str) : Or.inl (Set.singleton_subset_iff.mpr (mem_cone.mpr h)) else Or.inr (Or.inr (by - simp_all)) + exact Set.singleton_inter_eq_empty.mpr h)) /-- Nested-or-disjoint for two terminator singletons: equal or disjoint. -/ theorem singleton_singleton_nd (σ τ : Str) : @@ -115,7 +114,8 @@ theorem singleton_singleton_nd (σ τ : Str) : ({σ} : Set Str) ∩ ({τ} : Set Str) = ∅ := by by_cases h : σ = τ · subst h; exact Or.inl subset_rfl - · simp_all + · simp_all only [Set.subset_singleton_iff, Set.mem_singleton_iff, imp_false, forall_eq, + not_false_eq_true, Set.singleton_inter_of_notMem, or_true] /-- **`𝒞` is pairwise nested-or-disjoint.** Cone/cone is the `𝔹` trichotomy; the mixed and @@ -158,7 +158,7 @@ theorem subset_singleton_eq {W : Set Str} {σ : Str} (hW : C.mem W) (hsub : W W = ({σ} : Set Str) := by rcases hW with ⟨ρ, rfl⟩ | ⟨ρ, rfl⟩ · exact absurd hsub (cone_not_subset_singleton ρ σ) - · simp_all + · exact Set.singleton_eq_singleton_iff.mpr (hsub rfl) /-! ### Total elements: finite sequences `↑{σ}`, and `⊥ ⊏ Λ`. -/ @@ -202,7 +202,7 @@ theorem bot_lt_Lambda : C.bot < Lambda := by /-- `σ{ρ} = {σρ}`: prepending `σ` to a terminator singleton. -/ theorem prepend_singleton (σ ρ : Str) : prepend σ ({ρ} : Set Str) = ({σ ++ ρ} : Set Str) := by ext w - simp_all + simp_all only [mem_prepend, Set.mem_singleton_iff, exists_eq_left] /-- Prepending preserves `𝒞`-membership (cone ↦ cone, singleton ↦ singleton). -/ theorem memC_prepend (σ : Str) {Y : Set Str} (hY : C.mem Y) : C.mem (prepend σ Y) := by @@ -306,7 +306,7 @@ theorem juxtapose_singleton_mem (σ : Str) (y : C.Element) {Z : Set Str} : rw [C_master, prepend_univ] exact (cone_subset_cone.mpr hρσ).trans hsub · obtain rfl : σ = ρ := by - simp_all + exact cone_injective (congrArg cone (hsingleX rfl)) exact ⟨Y, hYmem, hsub⟩ · rintro ⟨hZ, Y', hY'mem, hsub⟩ exact ⟨{σ}, Y', ⟨memC_singleton σ, subset_rfl⟩, hY'mem, y.sub hY'mem, hZ, diff --git a/LeanPool/DomainTheory/Neighborhood/Exercise222.lean b/LeanPool/DomainTheory/Neighborhood/Exercise222.lean index f890abbfd2..a063e50bee 100644 --- a/LeanPool/DomainTheory/Neighborhood/Exercise222.lean +++ b/LeanPool/DomainTheory/Neighborhood/Exercise222.lean @@ -8,9 +8,6 @@ module public import Mathlib.Order.Directed public import LeanPool.DomainTheory.Neighborhood.Basic public import Mathlib.Basic.Finite.Defs -public import Mathlib.Order.SetNotation -public import Mathlib.Tactic.ToAdditive -import Mathlib.Data.Set.BooleanAlgebra public import Mathlib.Data.Set.Finite.Basic /-! @@ -96,7 +93,7 @@ theorem Cl_mem {F : Set τ} (h : ∃ X ∈ C, F ⊆ X) : Cl C F ∈ C := by apply hInter · obtain ⟨X, hX, hFX⟩ := h exact ⟨X, hX, hFX⟩ - · simp_all + · exact sep_subset C (LE.le F) /-! ### The neighbourhood system `reprSystem`. -/ @@ -120,7 +117,7 @@ theorem nbhd_subset_iff {F G : Set τ} (hF : IsTok C F) : /-- `C(∅) = Δ`: the empty token's neighbourhood is everything (the master). -/ theorem nbhd_empty : nbhd C (∅ : Set τ) = Set.univ := by ext G - simp [nbhd] + simp only [nbhd, empty_subset, ofPred_true, mem_univ] variable (hne : C.Nonempty) @@ -166,7 +163,7 @@ def toC (x : (reprSystem C hInter hne).Element) : Set τ := ⋃₀ famC C hInter theorem mem_toC (x : (reprSystem C hInter hne).Element) {t : τ} : t ∈ toC C hInter hne x ↔ ∃ F : Tok C, x.mem (nbhd C F.1) ∧ t ∈ Cl C F.1 := by simp only [toC, famC, Set.mem_sUnion, Set.mem_ofPred_eq] - simp_all + simp_all only [↓existsAndEq, and_true, Subtype.exists, exists_and_left, exists_prop] /-- **Directedness step.** If `C(F), C(F') ∈ x` then there is a token `F₃` with `C(F₃) ∈ x` whose diff --git a/LeanPool/DomainTheory/Neighborhood/Exercise315.lean b/LeanPool/DomainTheory/Neighborhood/Exercise315.lean index b28c2528a2..7c6356c80a 100644 --- a/LeanPool/DomainTheory/Neighborhood/Exercise315.lean +++ b/LeanPool/DomainTheory/Neighborhood/Exercise315.lean @@ -6,7 +6,6 @@ Authors: Catskills Research Company module public import LeanPool.DomainTheory.Neighborhood.Product -import Mathlib.Order.BooleanAlgebra.Set /-! # Exercise 3.15 (Scott 1981, PRG-19, §3) — the usual product isomorphisms diff --git a/LeanPool/DomainTheory/Neighborhood/Exercise316.lean b/LeanPool/DomainTheory/Neighborhood/Exercise316.lean index d2be68f42c..46be9261c5 100644 --- a/LeanPool/DomainTheory/Neighborhood/Exercise316.lean +++ b/LeanPool/DomainTheory/Neighborhood/Exercise316.lean @@ -6,7 +6,6 @@ Authors: Catskills Research Company module public import LeanPool.DomainTheory.Neighborhood.Exercise315 -import Mathlib.Order.BooleanAlgebra.Set /-! # Exercise 3.16 (Scott 1981, PRG-19, §3) — the infinite iterate `𝒟^∞` @@ -93,10 +92,10 @@ def single (n : ℕ) (X : Set α) : Set (ℕ × α) := variable {V} @[simp] theorem fiber_single_self (n : ℕ) (X : Set α) : fiber (single V n X) n = X := by - ext a; simp [fiber, single] + ext a; simp only [fiber, single, Set.mem_ofPred_eq, ↓reduceIte, Set.ofPred_mem_eq] theorem fiber_single_ne {n i : ℕ} (h : i ≠ n) (X : Set α) : fiber (single V n X) i = V.master := by - ext a; simp [fiber, single, h] + ext a; simp only [fiber, single, Set.mem_ofPred_eq, h, ↓reduceIte, Set.ofPred_mem_eq] theorem single_mono {n : ℕ} {X X' : Set α} (h : X ⊆ X') : single V n X ⊆ single V n X' := by intro p hp @@ -182,7 +181,7 @@ theorem reconstruct_subset {W : Set (ℕ × α)} (_hW : (iterSys V).mem W) {N : by_cases h : j < N · have hsub := (iterSys V).interUpTo_subset (fun i => single V i (fiber W i)) h have hmem : (j, a) ∈ single V j (fiber W j) := hsub ha - simpa [single] using hmem + simpa only [single, mem_fiber, Set.mem_ofPred_eq, ↓reduceIte] using hmem · have haM : a ∈ V.master := interUpTo_subset_master (fun i => single V i (fiber W i)) N ha have : a ∈ fiber W j := by rw [hN j (not_lt.mp h)]; exact haM exact this diff --git a/LeanPool/DomainTheory/Neighborhood/Exercise317.lean b/LeanPool/DomainTheory/Neighborhood/Exercise317.lean index fb2ba574dd..342a454225 100644 --- a/LeanPool/DomainTheory/Neighborhood/Exercise317.lean +++ b/LeanPool/DomainTheory/Neighborhood/Exercise317.lean @@ -9,13 +9,7 @@ public import LeanPool.DomainTheory.Neighborhood.Exercise316 public import LeanPool.DomainTheory.Neighborhood.FunctionSpace public import LeanPool.DomainTheory.Neighborhood.Example12 public import LeanPool.DomainTheory.Neighborhood.ExampleB -public import Mathlib.Tactic.ToAdditive -import Mathlib.Data.Finset.Attr -import Mathlib.Data.Rat.Cast.Order -import Mathlib.Tactic.NormNum.Abs -import Mathlib.Tactic.NormNum.DivMod -import Mathlib.Tactic.NormNum.OfScientific -import Mathlib.Tactic.NormNum.Pow +import Mathlib.Algebra.Order.Ring.Nat /-! # Exercise 3.17 (Scott 1981, PRG-19, §3) — `B` is a retract of `T^∞` @@ -75,15 +69,15 @@ theorem bitNbhd_mem (b : Bool) : T.mem (bitNbhd b) := by theorem exists_not_mem_bitNbhd (b : Bool) : ∃ t : Token, t ∉ bitNbhd b := by cases b - · exact ⟨1, by simp [bitNbhd, Example12.zero]⟩ - · exact ⟨0, by simp [bitNbhd, Example12.one]⟩ + · exact ⟨1, by change (1 : Fin 2) ≠ 0; decide⟩ + · exact ⟨0, by change (0 : Fin 2) ≠ 1; decide⟩ /-- `T`-neighbourhoods are non-empty (`∅ ∉ T`). -/ theorem T_nbhd_nonempty {F : Set Token} (hF : T.mem F) : F.Nonempty := by rcases (Example12.mem_iff F).mp hF with rfl | rfl | rfl - · exact ⟨0, by simp [Example12.master]⟩ - · exact ⟨0, by simp [Example12.zero]⟩ - · exact ⟨1, by simp [Example12.one]⟩ + · exact ⟨0, by simp only [Example12.master, Fin.isValue, Set.mem_univ]⟩ + · exact ⟨0, by simp only [Example12.zero, Fin.isValue, Set.mem_singleton_iff]⟩ + · exact ⟨1, by simp only [Example12.one, Fin.isValue, Set.mem_singleton_iff]⟩ /-! ### The encoding set `encSet σ`. -/ @@ -97,15 +91,17 @@ def encSet (σ : Str) : Set (ℕ × Token) := {p | ∀ b, σ[p.1]? = some b → theorem fiber_encSet_some {σ : Str} {i : ℕ} {b : Bool} (h : σ[i]? = some b) : fiber (encSet σ) i = bitNbhd b := by ext t - simp_all + simp_all only [mem_fiber, mem_encSet, Option.some.injEq, forall_eq'] theorem fiber_encSet_none {σ : Str} {i : ℕ} (h : σ[i]? = none) : fiber (encSet σ) i = Set.univ := by ext t - simp_all + simp_all only [getElem?_eq_none_iff, not_lt, mem_fiber, mem_encSet, getElem?_neg, + reduceCtorEq, IsEmpty.forall_iff, implies_true, Set.mem_univ] @[simp] theorem encSet_nil : encSet [] = Set.univ := by - ext p; simp [encSet] + ext p; simp only [encSet, List.getElem?_nil, reduceCtorEq, IsEmpty.forall_iff, implies_true, + Set.ofPred_true, Set.mem_univ] /-- `encSet σ` is a `T^∞`-neighbourhood. -/ theorem encSet_mem (σ : Str) : (iterSys T).mem (encSet σ) := by @@ -163,7 +159,9 @@ theorem prefix_of_encSet_subset {σ τ : Str} (h : encSet σ ⊆ encSet τ) : τ have hb' : τ[σ.length]? = some τ[σ.length] := List.getElem?_eq_getElem hlt obtain ⟨t, ht⟩ := exists_not_mem_bitNbhd τ[σ.length] have hmemσ : (σ.length, t) ∈ encSet σ := by - simp_all + simp_all only [Bool.forall_bool, implies_true, Bool.false_eq_true, imp_false, true_and, + Bool.true_eq_false, and_true, getElem?_pos, mem_encSet, lt_self_iff_false, + not_false_eq_true, getElem?_neg, reduceCtorEq, IsEmpty.forall_iff] exact ht ((h hmemσ) _ hb') · exact hτσ diff --git a/LeanPool/DomainTheory/Neighborhood/Exercise318.lean b/LeanPool/DomainTheory/Neighborhood/Exercise318.lean index de2be68ad4..dcc6f35fd5 100644 --- a/LeanPool/DomainTheory/Neighborhood/Exercise318.lean +++ b/LeanPool/DomainTheory/Neighborhood/Exercise318.lean @@ -6,7 +6,6 @@ Authors: Catskills Research Company module public import LeanPool.DomainTheory.Neighborhood.Approximable -import Mathlib.Data.Set.Image /-! # Exercise 3.18 (Scott 1981, PRG-19, §3) — the sum (coproduct) system @@ -59,23 +58,25 @@ def inj₁ (Y : Set β) : Set (Option (α ⊕ β)) := ir '' Y @[simp] theorem il_mem_inj₀ {X : Set α} {a : α} : (il a : Option (α ⊕ β)) ∈ inj₀ X ↔ a ∈ X := by simp only [inj₀, Set.mem_image, il] - simp_all + simp_all only [Option.some.injEq, Sum.inl.injEq, exists_eq_right] @[simp] theorem ir_mem_inj₀ {X : Set α} {b : β} : (ir b : Option (α ⊕ β)) ∉ inj₀ X := by - rintro ⟨a, _, hb⟩; exact absurd hb (by simp [il, ir]) + rintro ⟨a, _, hb⟩; exact absurd hb (by simp only [il, ir, Option.some.injEq, reduceCtorEq, + not_false_eq_true]) @[simp] theorem none_mem_inj₀ {X : Set α} : (none : Option (α ⊕ β)) ∉ inj₀ X := by - rintro ⟨a, _, hb⟩; exact absurd hb (by simp [il]) + rintro ⟨a, _, hb⟩; exact absurd hb (by simp only [il, reduceCtorEq, not_false_eq_true]) @[simp] theorem ir_mem_inj₁ {Y : Set β} {b : β} : (ir b : Option (α ⊕ β)) ∈ inj₁ Y ↔ b ∈ Y := by simp only [inj₁, Set.mem_image, ir] - simp_all + simp_all only [Option.some.injEq, Sum.inr.injEq, exists_eq_right] @[simp] theorem il_mem_inj₁ {Y : Set β} {a : α} : (il a : Option (α ⊕ β)) ∉ inj₁ Y := by - rintro ⟨b, _, hb⟩; exact absurd hb (by simp [il, ir]) + rintro ⟨b, _, hb⟩; exact absurd hb (by simp only [ir, il, Option.some.injEq, reduceCtorEq, + not_false_eq_true]) @[simp] theorem none_mem_inj₁ {Y : Set β} : (none : Option (α ⊕ β)) ∉ inj₁ Y := by - rintro ⟨b, _, hb⟩; exact absurd hb (by simp [ir]) + rintro ⟨b, _, hb⟩; exact absurd hb (by simp only [ir, reduceCtorEq, not_false_eq_true]) theorem inj₀_inter (X X' : Set α) : (inj₀ X ∩ inj₀ X' : Set (Option (α ⊕ β))) = inj₀ (X ∩ X') := by @@ -210,10 +211,10 @@ def sum (V₀ : NeighborhoodSystem α) (V₁ : NeighborhoodSystem β) /-! ### The injections `inᵢ` and projections `outᵢ`. -/ theorem il_injective : Function.Injective (il : α → Option (α ⊕ β)) := by - intro a a' h; simpa [il] using h + intro a a' h; simpa only [il, Option.some.injEq, Sum.inl.injEq] using h theorem ir_injective : Function.Injective (ir : β → Option (α ⊕ β)) := by - intro b b' h; simpa [ir] using h + intro b b' h; simpa only [ir, Option.some.injEq, Sum.inr.injEq] using h @[simp] theorem il_preimage_inj₀ (X : Set α) : ((il : α → Option (α ⊕ β)) ⁻¹' inj₀ X) = X := @@ -262,12 +263,14 @@ theorem rightPart_mono (V₁ : NeighborhoodSystem β) {W W' : Set (Option (α @[simp] theorem leftPart_inj₀ (V₀ : NeighborhoodSystem α) (X : Set α) : leftPart V₀ (inj₀ X : Set (Option (α ⊕ β))) = X := by ext a - simp_all + simp_all only [mem_leftPart, il_mem_inj₀, ir_mem_inj₀, exists_false, none_mem_inj₀, or_self, + and_false, or_false] @[simp] theorem rightPart_inj₁ (V₁ : NeighborhoodSystem β) (Y : Set β) : rightPart V₁ (inj₁ Y : Set (Option (α ⊕ β))) = Y := by ext b - simp_all + simp_all only [mem_rightPart, ir_mem_inj₁, il_mem_inj₁, exists_false, none_mem_inj₁, or_self, + and_false, or_false] theorem leftPart_sumMaster (V₀ : NeighborhoodSystem α) (V₁ : NeighborhoodSystem β) : leftPart V₀ (sumMaster V₀ V₁) = V₀.master := by @@ -277,8 +280,8 @@ theorem leftPart_sumMaster (V₀ : NeighborhoodSystem α) (V₁ : NeighborhoodSy · rintro (h | h) · have : (il a : Option (α ⊕ β)) ∈ sumMaster V₀ V₁ := h rcases Set.mem_insert_iff.mp this with h' | h' - · exact absurd h' (by simp [il]) - · simp_all + · exact absurd h' (by simp only [il, reduceCtorEq, not_false_eq_true]) + · simp_all only [Set.mem_union, il_mem_inj₀, il_mem_inj₁, or_false] · exact h · intro ha; exact Or.inr ha @@ -298,8 +301,8 @@ theorem rightPart_sumMaster (V₀ : NeighborhoodSystem α) (V₁ : NeighborhoodS · rintro (h | h) · have : (ir b : Option (α ⊕ β)) ∈ sumMaster V₀ V₁ := h rcases Set.mem_insert_iff.mp this with h' | h' - · exact absurd h' (by simp [ir]) - · simp_all + · exact absurd h' (by simp only [ir, reduceCtorEq, not_false_eq_true]) + · simp_all only [Set.mem_union, ir_mem_inj₀, ir_mem_inj₁, false_or] · exact h · intro hb; exact Or.inr hb diff --git a/LeanPool/DomainTheory/Neighborhood/Exercise319Sum.lean b/LeanPool/DomainTheory/Neighborhood/Exercise319Sum.lean index fe81562a61..50afc27e47 100644 --- a/LeanPool/DomainTheory/Neighborhood/Exercise319Sum.lean +++ b/LeanPool/DomainTheory/Neighborhood/Exercise319Sum.lean @@ -6,7 +6,6 @@ Authors: Catskills Research Company module public import LeanPool.DomainTheory.Neighborhood.Exercise318 -import Mathlib.Order.BooleanAlgebra.Set /-! # Exercise 3.19 (Scott 1981, PRG-19, §3) — the sum functor `f + g` diff --git a/LeanPool/DomainTheory/Neighborhood/Exercise321.lean b/LeanPool/DomainTheory/Neighborhood/Exercise321.lean index 3a2ccb4f05..e7f36f8384 100644 --- a/LeanPool/DomainTheory/Neighborhood/Exercise321.lean +++ b/LeanPool/DomainTheory/Neighborhood/Exercise321.lean @@ -6,12 +6,6 @@ Authors: Catskills Research Company module public import LeanPool.DomainTheory.Neighborhood.FunctionSpace -import Mathlib.Data.Finset.Attr -import Mathlib.Data.Rat.Cast.Order -import Mathlib.Tactic.NormNum.Abs -import Mathlib.Tactic.NormNum.DivMod -import Mathlib.Tactic.NormNum.OfScientific -import Mathlib.Tactic.NormNum.Pow /-! # Exercise 3.21 (Scott 1981, PRG-19, §3) — when does `[Y, Z]` determine `Y` and @@ -67,7 +61,8 @@ theorem interYs_single_not_subset_eq {YX : Set α} {Z : Set β} {X : Set α} (hXY : ¬ X ⊆ YX) : interYs V₁.master [(YX, Z)] X = V₁.master := by ext z rw [mem_interYs] - simp_all + simp_all only [List.mem_cons, List.not_mem_nil, or_false, IsEmpty.forall_iff, implies_true, + and_true] /-! ### The least element of a single step neighbourhood. -/ diff --git a/LeanPool/DomainTheory/Neighborhood/Exercise322.lean b/LeanPool/DomainTheory/Neighborhood/Exercise322.lean index ae9ce768b5..8ffe786518 100644 --- a/LeanPool/DomainTheory/Neighborhood/Exercise322.lean +++ b/LeanPool/DomainTheory/Neighborhood/Exercise322.lean @@ -6,12 +6,6 @@ Authors: Catskills Research Company module public import LeanPool.DomainTheory.Neighborhood.FunctionSpace -import Mathlib.Data.Finset.Attr -import Mathlib.Data.Rat.Cast.Order -import Mathlib.Tactic.NormNum.Abs -import Mathlib.Tactic.NormNum.DivMod -import Mathlib.Tactic.NormNum.OfScientific -import Mathlib.Tactic.NormNum.Pow /-! # Exercise 3.22 (Scott 1981, PRG-19, §3) — composition is approximable diff --git a/LeanPool/DomainTheory/Neighborhood/Exercise323.lean b/LeanPool/DomainTheory/Neighborhood/Exercise323.lean index 2559389f94..ec37f67e10 100644 --- a/LeanPool/DomainTheory/Neighborhood/Exercise323.lean +++ b/LeanPool/DomainTheory/Neighborhood/Exercise323.lean @@ -7,13 +7,6 @@ module public import LeanPool.DomainTheory.Neighborhood.Exercise315 public import LeanPool.DomainTheory.Neighborhood.FunctionSpace -public import Mathlib.Tactic.ToAdditive -import Mathlib.Data.Finset.Attr -import Mathlib.Data.Rat.Cast.Order -import Mathlib.Tactic.NormNum.Abs -import Mathlib.Tactic.NormNum.DivMod -import Mathlib.Tactic.NormNum.OfScientific -import Mathlib.Tactic.NormNum.Pow /-! # Exercise 3.23 (Scott 1981, PRG-19, §3) — the category of domains is cartesian diff --git a/LeanPool/DomainTheory/Neighborhood/Exercise324.lean b/LeanPool/DomainTheory/Neighborhood/Exercise324.lean index 2e6ec590d1..98e3a86de9 100644 --- a/LeanPool/DomainTheory/Neighborhood/Exercise324.lean +++ b/LeanPool/DomainTheory/Neighborhood/Exercise324.lean @@ -7,12 +7,6 @@ module public import LeanPool.DomainTheory.Neighborhood.Exercise315 public import LeanPool.DomainTheory.Neighborhood.FunctionSpace -import Mathlib.Data.Finset.Attr -import Mathlib.Data.Rat.Cast.Order -import Mathlib.Tactic.NormNum.Abs -import Mathlib.Tactic.NormNum.DivMod -import Mathlib.Tactic.NormNum.OfScientific -import Mathlib.Tactic.NormNum.Pow /-! # Exercise 3.24 (Scott 1981, PRG-19, §3) — function-space isomorphisms diff --git a/LeanPool/DomainTheory/Neighborhood/Exercise324Distrib.lean b/LeanPool/DomainTheory/Neighborhood/Exercise324Distrib.lean index accfe24cd2..0c7c1eab08 100644 --- a/LeanPool/DomainTheory/Neighborhood/Exercise324Distrib.lean +++ b/LeanPool/DomainTheory/Neighborhood/Exercise324Distrib.lean @@ -8,7 +8,6 @@ module public import LeanPool.DomainTheory.Neighborhood.Product public import LeanPool.DomainTheory.Neighborhood.Exercise318 import LeanPool.DomainTheory.Neighborhood.Exercise319Sum -import Mathlib.Order.BooleanAlgebra.Set /-! # Exercise 3.24(iii)(iv) (Scott 1981, PRG-19, §3) — sum/product "isomorphisms" diff --git a/LeanPool/DomainTheory/Neighborhood/Exercise324Iter.lean b/LeanPool/DomainTheory/Neighborhood/Exercise324Iter.lean index 9835a8f4c9..d32a70fd79 100644 --- a/LeanPool/DomainTheory/Neighborhood/Exercise324Iter.lean +++ b/LeanPool/DomainTheory/Neighborhood/Exercise324Iter.lean @@ -7,12 +7,6 @@ module public import LeanPool.DomainTheory.Neighborhood.Exercise316 public import LeanPool.DomainTheory.Neighborhood.FunctionSpace -import Mathlib.Data.Finset.Attr -import Mathlib.Data.Rat.Cast.Order -import Mathlib.Tactic.NormNum.Abs -import Mathlib.Tactic.NormNum.DivMod -import Mathlib.Tactic.NormNum.OfScientific -import Mathlib.Tactic.NormNum.Pow /-! # Exercise 3.24(ii) (Scott 1981, PRG-19, §3) — `(𝒟₀ → 𝒟₁^∞) ≅ (𝒟₀ → 𝒟₁)^∞` diff --git a/LeanPool/DomainTheory/Neighborhood/Exercise325.lean b/LeanPool/DomainTheory/Neighborhood/Exercise325.lean index d3c6d04d00..a6d8c79229 100644 --- a/LeanPool/DomainTheory/Neighborhood/Exercise325.lean +++ b/LeanPool/DomainTheory/Neighborhood/Exercise325.lean @@ -7,12 +7,6 @@ module public import LeanPool.DomainTheory.Neighborhood.Exercise122 public import LeanPool.DomainTheory.Neighborhood.FunctionSpace -import Mathlib.Data.Finset.Attr -import Mathlib.Data.Rat.Cast.Order -import Mathlib.Tactic.NormNum.Abs -import Mathlib.Tactic.NormNum.DivMod -import Mathlib.Tactic.NormNum.OfScientific -import Mathlib.Tactic.NormNum.Pow /-! # Exercise 3.25 (Scott 1981, PRG-19, §3) — the open sets of `|𝒟|` form a domain @@ -117,7 +111,7 @@ theorem mapOfOpen_rel_empty (U : Set V.Element) (X : Set α) : rcases h with h | ⟨_, h⟩ · exact absurd h Set.empty_ne_univ · exact h - · simp_all + · simp_all only [and_self, or_true, implies_true] /-! ### From an approximable map `𝒟 → 𝒪` to an open set. -/ diff --git a/LeanPool/DomainTheory/Neighborhood/Exercise326.lean b/LeanPool/DomainTheory/Neighborhood/Exercise326.lean index 73dfe78ef6..32b001c13c 100644 --- a/LeanPool/DomainTheory/Neighborhood/Exercise326.lean +++ b/LeanPool/DomainTheory/Neighborhood/Exercise326.lean @@ -7,8 +7,6 @@ module public import LeanPool.DomainTheory.Neighborhood.Product public import LeanPool.DomainTheory.Neighborhood.Example23 -import Mathlib.Data.Finset.Attr -import Mathlib.Data.Set.Image import Mathlib.Tactic.Attr.Core import Mathlib.Tactic.SetLike @@ -76,35 +74,44 @@ abbrev TD : NeighborhoodSystem Example12.Token := Example12.neighborhoodSystem theorem zero_ne_one : (Example12.zero : Set Example12.Token) ≠ Example12.one := by intro h have h0 := Set.ext_iff.mp h 0 - simp [Example12.zero, Example12.one] at h0 + simp only [Example12.zero, Fin.isValue, Set.mem_singleton_iff, Example12.one, + Fin.zero_eq_one_iff, Nat.succ_ne_self, iff_false, not_true_eq_false] at h0 theorem zero_ne_master : (Example12.zero : Set Example12.Token) ≠ Example12.master := by intro h have h1 := Set.ext_iff.mp h 1 - simp [Example12.zero, Example12.master] at h1 + simp only [Example12.zero, Fin.isValue, Set.mem_singleton_iff, Fin.one_eq_zero_iff, + Nat.succ_ne_self, Example12.master, Set.mem_univ, iff_true] at h1 theorem one_ne_master : (Example12.one : Set Example12.Token) ≠ Example12.master := by intro h have h0 := Set.ext_iff.mp h 0 - simp [Example12.one, Example12.master] at h0 + simp only [Example12.one, Fin.isValue, Set.mem_singleton_iff, Fin.zero_eq_one_iff, + Nat.succ_ne_self, Example12.master, Set.mem_univ, iff_true] at h0 /-- A `T`-neighbourhood contained in `{0}` is `{0}` (the other two, `Δ` and `{1}`, are not). -/ theorem Tmem_eq_zero {C : Set Example12.Token} (hC : Example12.mem C) (h : C ⊆ Example12.zero) : C = Example12.zero := by rcases (Example12.mem_iff C).mp hC with rfl | rfl | rfl - · exact absurd (h (Set.mem_univ 1)) (by simp [Example12.zero]) + · exact absurd (h (Set.mem_univ 1)) (by simp only [Example12.zero, Fin.isValue, + Set.mem_singleton_iff, Fin.one_eq_zero_iff, Nat.succ_ne_self, not_false_eq_true]) · rfl - · exact absurd (h (by simp [Example12.one] : (1 : Example12.Token) ∈ Example12.one)) - (by simp [Example12.zero]) + · exact absurd (h (by simp only [Example12.one, Fin.isValue, + Set.mem_singleton_iff] : (1 : Example12.Token) ∈ Example12.one)) + (by simp only [Example12.zero, Fin.isValue, Set.mem_singleton_iff, Fin.one_eq_zero_iff, + Nat.succ_ne_self, not_false_eq_true]) /-- A `T`-neighbourhood contained in `{1}` is `{1}`. -/ theorem Tmem_eq_one {C : Set Example12.Token} (hC : Example12.mem C) (h : C ⊆ Example12.one) : C = Example12.one := by rcases (Example12.mem_iff C).mp hC with rfl | rfl | rfl - · exact absurd (h (Set.mem_univ 0)) (by simp [Example12.one]) - · exact absurd (h (by simp [Example12.zero] : (0 : Example12.Token) ∈ Example12.zero)) - (by simp [Example12.one]) + · exact absurd (h (Set.mem_univ 0)) (by simp only [Example12.one, Fin.isValue, + Set.mem_singleton_iff, Fin.zero_eq_one_iff, Nat.succ_ne_self, not_false_eq_true]) + · exact absurd (h (by simp only [Example12.zero, Fin.isValue, + Set.mem_singleton_iff] : (0 : Example12.Token) ∈ Example12.zero)) + (by simp only [Example12.one, Fin.isValue, Set.mem_singleton_iff, Fin.zero_eq_one_iff, + Nat.succ_ne_self, not_false_eq_true]) · rfl /-! ### The conditional relation. -/ diff --git a/LeanPool/DomainTheory/Neighborhood/Exercise326Sum.lean b/LeanPool/DomainTheory/Neighborhood/Exercise326Sum.lean index 52f9621627..312fa44973 100644 --- a/LeanPool/DomainTheory/Neighborhood/Exercise326Sum.lean +++ b/LeanPool/DomainTheory/Neighborhood/Exercise326Sum.lean @@ -8,8 +8,6 @@ module public import LeanPool.DomainTheory.Neighborhood.Exercise326 public import LeanPool.DomainTheory.Neighborhood.Exercise318 import LeanPool.DomainTheory.Neighborhood.Exercise319Sum -import Mathlib.Data.Finset.Attr -import Mathlib.Order.BooleanAlgebra.Set import Mathlib.Tactic.Attr.Core import Mathlib.Tactic.SetLike @@ -109,16 +107,20 @@ theorem Tmem_ge_zero {C : Set Example12.Token} (hC : Example12.mem C) rcases (Example12.mem_iff C).mp hC with rfl | rfl | rfl · exact Or.inr rfl · exact Or.inl rfl - · exact absurd (h (by simp [Example12.zero] : (0 : Example12.Token) ∈ Example12.zero)) - (by simp [Example12.one]) + · exact absurd (h (by simp only [Example12.zero, Fin.isValue, + Set.mem_singleton_iff] : (0 : Example12.Token) ∈ Example12.zero)) + (by simp only [Example12.one, Fin.isValue, Set.mem_singleton_iff, Fin.zero_eq_one_iff, + Nat.succ_ne_self, not_false_eq_true]) /-- A `T`-neighbourhood containing `{1}` is `{1}` or `Δ`. -/ theorem Tmem_ge_one {C : Set Example12.Token} (hC : Example12.mem C) (h : Example12.one ⊆ C) : C = Example12.one ∨ C = Example12.master := by rcases (Example12.mem_iff C).mp hC with rfl | rfl | rfl · exact Or.inr rfl - · exact absurd (h (by simp [Example12.one] : (1 : Example12.Token) ∈ Example12.one)) - (by simp [Example12.zero]) + · exact absurd (h (by simp only [Example12.one, Fin.isValue, + Set.mem_singleton_iff] : (1 : Example12.Token) ∈ Example12.one)) + (by simp only [Example12.zero, Fin.isValue, Set.mem_singleton_iff, Fin.one_eq_zero_iff, + Nat.succ_ne_self, not_false_eq_true]) · exact Or.inl rfl theorem inter_in_zeroset {C C' : Set Example12.Token} (hc : C = Example12.master ∨ C = @@ -156,7 +158,7 @@ theorem whichGuard_left {W : Set (Option (α ⊕ β))} {C : Set Example12.Token} · exact hc · refine absurd (hW.symm.trans hWY) ?_ intro h; exact not_inj₀_subset_inj₁ hX h.subset - · simp_all + · simp_all only [true_or] theorem whichGuard_right {W : Set (Option (α ⊕ β))} {C : Set Example12.Token} {Y : Set β} (hg : whichGuard V₀ V₁ W C) (hW : W = inj₁ Y) (hY : Y.Nonempty) : @@ -165,7 +167,7 @@ theorem whichGuard_right {W : Set (Option (α ⊕ β))} {C : Set Example12.Token · refine absurd (hW.symm.trans hWX) ?_ intro h; exact not_inj₁_subset_inj₀ hY h.subset · exact hc - · simp_all + · simp_all only [true_or] theorem whichGuard_masterC {W : Set (Option (α ⊕ β))} {C : Set Example12.Token} (hg : whichGuard V₀ V₁ W C) (hW : W = sumMaster V₀ V₁) : C = Example12.master := by diff --git a/LeanPool/DomainTheory/Neighborhood/Exercise327.lean b/LeanPool/DomainTheory/Neighborhood/Exercise327.lean index fecf233419..11190cf50e 100644 --- a/LeanPool/DomainTheory/Neighborhood/Exercise327.lean +++ b/LeanPool/DomainTheory/Neighborhood/Exercise327.lean @@ -7,12 +7,6 @@ module public import LeanPool.DomainTheory.Neighborhood.Exercise222 public import LeanPool.DomainTheory.Neighborhood.FunctionSpace -import Mathlib.Data.Finset.Attr -import Mathlib.Data.Rat.Cast.Order -import Mathlib.Tactic.NormNum.Abs -import Mathlib.Tactic.NormNum.DivMod -import Mathlib.Tactic.NormNum.OfScientific -import Mathlib.Tactic.NormNum.Pow /-! # Exercise 3.27 (Scott 1981, PRG-19, §3) — `(𝒟₀ → 𝒟₁)` is a domain, via Exercise diff --git a/LeanPool/DomainTheory/Neighborhood/Exercise328.lean b/LeanPool/DomainTheory/Neighborhood/Exercise328.lean index 3a97bb8774..f3cca7c590 100644 --- a/LeanPool/DomainTheory/Neighborhood/Exercise328.lean +++ b/LeanPool/DomainTheory/Neighborhood/Exercise328.lean @@ -6,12 +6,6 @@ Authors: Catskills Research Company module public import LeanPool.DomainTheory.Neighborhood.FunctionSpace -import Mathlib.Data.Finset.Attr -import Mathlib.Data.Rat.Cast.Order -import Mathlib.Tactic.NormNum.Abs -import Mathlib.Tactic.NormNum.DivMod -import Mathlib.Tactic.NormNum.OfScientific -import Mathlib.Tactic.NormNum.Pow /-! # Exercise 3.28 (Scott 1981, PRG-19, §3) — the elementwise formula for the least @@ -63,12 +57,17 @@ theorem Element.mem_interYs_of (z : V₁.Element) {L : List (Set α × Set β)} fun q hq => hall q (List.mem_cons.mpr (Or.inr hq)) by_cases hXp : X ⊆ p.1 · have heq : interYs V₁.master (p :: L) X = p.2 ∩ interYs V₁.master L X := by - rw [interYs_cons]; simp_all + rw [interYs_cons]; + simp_all only [List.mem_cons, or_true, implies_true, forall_const, forall_eq_or_imp, + and_true, Prod.forall, Set.ofPred_mem_eq] rw [heq] exact z.inter_mem (hall p (List.mem_cons.mpr (Or.inl rfl)) hXp) (ih htail) · have heq : interYs V₁.master (p :: L) X = interYs V₁.master L X := by - rw [interYs_cons]; simp_all - simp_all + rw [interYs_cons]; + simp_all only [List.mem_cons, or_true, implies_true, forall_const, forall_eq_or_imp, + IsEmpty.forall_iff, and_self, Prod.forall, Set.ofPred_true, Set.univ_inter] + simp_all only [List.mem_cons, or_true, implies_true, forall_const, forall_eq_or_imp, + IsEmpty.forall_iff, and_self, Prod.forall] /-- **Exercise 3.28 — the active values.** The set `{ ↑Yᵢ ∣ x ∈ [Xᵢ] }` of principal filters whose diff --git a/LeanPool/DomainTheory/Neighborhood/Exercise407.lean b/LeanPool/DomainTheory/Neighborhood/Exercise407.lean index 2f321cc4db..cee12ca77a 100644 --- a/LeanPool/DomainTheory/Neighborhood/Exercise407.lean +++ b/LeanPool/DomainTheory/Neighborhood/Exercise407.lean @@ -6,12 +6,8 @@ Authors: Catskills Research Company module public import LeanPool.DomainTheory.Neighborhood.ApproximableExercises -import Mathlib.Data.Finset.Attr -import Mathlib.Data.Rat.Cast.Order -import Mathlib.Tactic.NormNum.Abs -import Mathlib.Tactic.NormNum.DivMod -import Mathlib.Tactic.NormNum.OfScientific -import Mathlib.Tactic.NormNum.Pow + +import Mathlib.Tactic.Set -- shake: keep /-! # Exercise 4.7 (Scott 1981, PRG-19, Lecture IV) diff --git a/LeanPool/DomainTheory/Neighborhood/Exercise408.lean b/LeanPool/DomainTheory/Neighborhood/Exercise408.lean index 67086a5f21..efdec65809 100644 --- a/LeanPool/DomainTheory/Neighborhood/Exercise408.lean +++ b/LeanPool/DomainTheory/Neighborhood/Exercise408.lean @@ -6,12 +6,6 @@ Authors: Catskills Research Company module public import LeanPool.DomainTheory.Neighborhood.Theorem41 -import Mathlib.Data.Finset.Attr -import Mathlib.Data.Rat.Cast.Order -import Mathlib.Tactic.NormNum.Abs -import Mathlib.Tactic.NormNum.DivMod -import Mathlib.Tactic.NormNum.OfScientific -import Mathlib.Tactic.NormNum.Pow /-! # Exercise 4.8 (Scott 1981, PRG-19, Lecture IV) — the principle of fixed-point @@ -126,7 +120,7 @@ theorem fix_induction_eq (f a b : ApproximableMap V V) have h1 : (b.comp f).toElementMap x = (f.comp b).toElementMap x := by rw [hfb] rwa [toElementMap_comp, toElementMap_comp] at h1 refine fix_induction f (fun x => a.toElementMap x = b.toElementMap x) hbot ?_ ?_ - · simp_all + · simp_all only [implies_true] · intro s hmono hs -- both sides are directed unions of equal families. show a.toElementMap (supChain s hmono) = b.toElementMap (supChain s hmono) diff --git a/LeanPool/DomainTheory/Neighborhood/Exercise409.lean b/LeanPool/DomainTheory/Neighborhood/Exercise409.lean index 1cac0a56fd..b49c8d7160 100644 --- a/LeanPool/DomainTheory/Neighborhood/Exercise409.lean +++ b/LeanPool/DomainTheory/Neighborhood/Exercise409.lean @@ -6,12 +6,6 @@ Authors: Catskills Research Company module public import LeanPool.DomainTheory.Neighborhood.Theorem41 -import Mathlib.Data.Finset.Attr -import Mathlib.Data.Rat.Cast.Order -import Mathlib.Tactic.NormNum.Abs -import Mathlib.Tactic.NormNum.DivMod -import Mathlib.Tactic.NormNum.OfScientific -import Mathlib.Tactic.NormNum.Pow /-! # Exercise 4.9 (Scott 1981, PRG-19, Lecture IV) — the operator `Ψ` and `fix = diff --git a/LeanPool/DomainTheory/Neighborhood/Exercise410.lean b/LeanPool/DomainTheory/Neighborhood/Exercise410.lean index 922648774c..b131bd16e4 100644 --- a/LeanPool/DomainTheory/Neighborhood/Exercise410.lean +++ b/LeanPool/DomainTheory/Neighborhood/Exercise410.lean @@ -6,12 +6,6 @@ Authors: Catskills Research Company module public import LeanPool.DomainTheory.Neighborhood.Theorem41 -import Mathlib.Data.Finset.Attr -import Mathlib.Data.Rat.Cast.Order -import Mathlib.Tactic.NormNum.Abs -import Mathlib.Tactic.NormNum.DivMod -import Mathlib.Tactic.NormNum.OfScientific -import Mathlib.Tactic.NormNum.Pow /-! # Exercise 4.10 (Scott 1981, PRG-19, Lecture IV) — the relativized domain `Dₐ` diff --git a/LeanPool/DomainTheory/Neighborhood/Exercise411.lean b/LeanPool/DomainTheory/Neighborhood/Exercise411.lean index 8fc17ebef4..7e7fc09da9 100644 --- a/LeanPool/DomainTheory/Neighborhood/Exercise411.lean +++ b/LeanPool/DomainTheory/Neighborhood/Exercise411.lean @@ -6,12 +6,6 @@ Authors: Catskills Research Company module public import LeanPool.DomainTheory.Neighborhood.Exercise410 -import Mathlib.Data.Finset.Attr -import Mathlib.Data.Rat.Cast.Order -import Mathlib.Tactic.NormNum.Abs -import Mathlib.Tactic.NormNum.DivMod -import Mathlib.Tactic.NormNum.OfScientific -import Mathlib.Tactic.NormNum.Pow /-! # Exercise 4.11 (Scott 1981, PRG-19, Lecture IV) — Plotkin's uniqueness of `fix` @@ -82,7 +76,7 @@ theorem fixElement_uniform {β γ : Type*} {W₀ : NeighborhoodSystem β} {W₁ intro n rw [iterElem_eq_iterate f₀ n, iterElem_eq_iterate f₁ n] induction n with - | zero => simpa using hbot + | zero => simpa only [Function.iterate_zero, id_eq] using hbot | succ k ih => rw [Function.iterate_succ', Function.comp_apply, Function.iterate_succ', Function.comp_apply, hintw, ih] diff --git a/LeanPool/DomainTheory/Neighborhood/Exercise412.lean b/LeanPool/DomainTheory/Neighborhood/Exercise412.lean index 907f114cb7..a1482c2092 100644 --- a/LeanPool/DomainTheory/Neighborhood/Exercise412.lean +++ b/LeanPool/DomainTheory/Neighborhood/Exercise412.lean @@ -7,8 +7,6 @@ module public import LeanPool.DomainTheory.Neighborhood.Approximable public import LeanPool.DomainTheory.Neighborhood.Example12 -import Mathlib.Data.Finset.Attr -import Mathlib.Data.Set.Insert import Mathlib.Tactic.Attr.Core import Mathlib.Tactic.SetLike @@ -49,19 +47,22 @@ abbrev T : NeighborhoodSystem Example12.Token := Example12.neighborhoodSystem private theorem one_ne_zero : (Example12.one) ≠ Example12.zero := by intro h rw [Example12.one, Example12.zero, Set.ext_iff] at h - simp_all + simp_all only [Fin.isValue, Set.mem_singleton_iff, eq_iff_eq_cancel_left, Fin.one_eq_zero_iff, + Nat.succ_ne_self] /-- `{1} ≠ Δ` as tokens. -/ private theorem one_ne_master : (Example12.one) ≠ Example12.master := by intro h rw [Example12.one, Example12.master, Set.ext_iff] at h - simp_all + simp_all only [Fin.isValue, Set.mem_singleton_iff, Set.mem_univ, iff_true, Fin.forall_fin_two, + Fin.zero_eq_one_iff, Nat.succ_ne_self, and_true] /-- `{0} ≠ Δ` as tokens. -/ private theorem zero_ne_master : (Example12.zero) ≠ Example12.master := by intro h rw [Example12.zero, Example12.master, Set.ext_iff] at h - simp_all + simp_all only [Fin.isValue, Set.mem_singleton_iff, Set.mem_univ, iff_true, Fin.forall_fin_two, + Fin.one_eq_zero_iff, Nat.succ_ne_self, and_false] /-- The two total elements are incomparable: `elemOne ⋢ elemZero`. -/ theorem elemOne_not_le_elemZero : ¬ elemOne ≤ elemZero := by diff --git a/LeanPool/DomainTheory/Neighborhood/Exercise413.lean b/LeanPool/DomainTheory/Neighborhood/Exercise413.lean index 65f70c06b9..7ab4ded7ce 100644 --- a/LeanPool/DomainTheory/Neighborhood/Exercise413.lean +++ b/LeanPool/DomainTheory/Neighborhood/Exercise413.lean @@ -6,12 +6,6 @@ Authors: Catskills Research Company module public import LeanPool.DomainTheory.Neighborhood.Exercise118 -import Mathlib.Data.Finset.Attr -import Mathlib.Data.Rat.Cast.Order -import Mathlib.Tactic.NormNum.Abs -import Mathlib.Tactic.NormNum.DivMod -import Mathlib.Tactic.NormNum.OfScientific -import Mathlib.Tactic.NormNum.Pow /-! # Exercise 4.13 (Scott 1981, PRG-19, Lecture IV) — eliminating the circularity diff --git a/LeanPool/DomainTheory/Neighborhood/Exercise415.lean b/LeanPool/DomainTheory/Neighborhood/Exercise415.lean index 444ffee287..dce60aeaeb 100644 --- a/LeanPool/DomainTheory/Neighborhood/Exercise415.lean +++ b/LeanPool/DomainTheory/Neighborhood/Exercise415.lean @@ -7,13 +7,9 @@ module public import LeanPool.DomainTheory.Neighborhood.Exercise124 import LeanPool.DomainTheory.Neighborhood.Exercise413 -import Mathlib.Data.Finset.Attr -import Mathlib.Data.Rat.Cast.Order import Mathlib.Order.Zorn -import Mathlib.Tactic.NormNum.Abs -import Mathlib.Tactic.NormNum.DivMod -import Mathlib.Tactic.NormNum.OfScientific -import Mathlib.Tactic.NormNum.Pow + +import Mathlib.Tactic.Set -- shake: keep /-! # Exercise 4.15 (Scott 1981, PRG-19, Lecture IV) — a maximal (and a least) fixed @@ -78,7 +74,7 @@ theorem exists_maximal_fixedPoint (f : V.Element → V.Element) (hf : Monotone f intro c hcS hchain rcases c.eq_empty_or_nonempty with rfl | hne · refine ⟨⊥, ?_, fun z hz => ((Set.mem_empty_iff_false z).mp hz).elim⟩ - simp_all + simp_all only [Set.empty_subset, IsChain.empty, Set.mem_ofPred_eq, _root_.bot_le] · refine ⟨V.chainUnion c hne hchain, ?_, fun z hz => V.le_chainUnion c hne hchain hz⟩ -- `⊔c` is post-fixed: each `x ∈ c` has `x ⊑ f x ⊑ f(⊔c)`. change V.chainUnion c hne hchain ≤ f (V.chainUnion c hne hchain) diff --git a/LeanPool/DomainTheory/Neighborhood/Exercise416.lean b/LeanPool/DomainTheory/Neighborhood/Exercise416.lean index d3aa4d9a34..64254c03ea 100644 --- a/LeanPool/DomainTheory/Neighborhood/Exercise416.lean +++ b/LeanPool/DomainTheory/Neighborhood/Exercise416.lean @@ -6,12 +6,6 @@ Authors: Catskills Research Company module public import LeanPool.DomainTheory.Neighborhood.Exercise413 -import Mathlib.Data.Finset.Attr -import Mathlib.Data.Rat.Cast.Order -import Mathlib.Tactic.NormNum.Abs -import Mathlib.Tactic.NormNum.DivMod -import Mathlib.Tactic.NormNum.OfScientific -import Mathlib.Tactic.NormNum.Pow /-! # Exercise 4.16 (Scott 1981, PRG-19, Lecture IV) — the *optimal* fixed point diff --git a/LeanPool/DomainTheory/Neighborhood/Exercise417.lean b/LeanPool/DomainTheory/Neighborhood/Exercise417.lean index bf124723a4..85b3b465cf 100644 --- a/LeanPool/DomainTheory/Neighborhood/Exercise417.lean +++ b/LeanPool/DomainTheory/Neighborhood/Exercise417.lean @@ -113,7 +113,7 @@ theorem lfpSet_eq_closure (a b : S) : apply Set.union_subset · apply Set.union_subset · rintro s rfl; exact (Submonoid.closure ({a, b} : Set S)).one_mem - · simp_all + · exact Submonoid.subset_closure · rintro s ⟨t, ht, u, hu, rfl⟩ exact (Submonoid.closure ({a, b} : Set S)).mul_mem ht hu exact lfpSet_subset (F a b) hclosed @@ -141,7 +141,8 @@ theorem F_univ (a b : S) : F a b (Set.univ : Set S) = Set.univ := by /-- `{1}` is a fixed point of `F 1 1`: `{1} ∪ {1, 1} ∪ {1}·{1} = {1}`. -/ theorem F_one_one_singleton : F (1 : ℕ) 1 ({1} : Set ℕ) = {1} := by unfold F - simp_all + simp_all only [Set.mem_singleton_iff, Set.insert_eq_of_mem, Set.union_self, Set.mul_singleton, + mul_one, Set.image_singleton] /-- **Exercise 4.17 (Scott 1981, PRG-19).** The fixed point need **not** be unique: over `S = ℕ` @@ -151,6 +152,6 @@ they are distinct. -/ theorem fixedPoint_not_unique : ∃ x y : Set ℕ, F 1 1 x = x ∧ F 1 1 y = y ∧ x ≠ y := by refine ⟨{1}, Set.univ, F_one_one_singleton, F_univ 1 1, ?_⟩ - simp_all + exact Set.singleton_ne_univ 1 end Domain.Neighborhood.Exercise417 diff --git a/LeanPool/DomainTheory/Neighborhood/Exercise418.lean b/LeanPool/DomainTheory/Neighborhood/Exercise418.lean index bb83c67506..00e474dcb6 100644 --- a/LeanPool/DomainTheory/Neighborhood/Exercise418.lean +++ b/LeanPool/DomainTheory/Neighborhood/Exercise418.lean @@ -6,12 +6,6 @@ Authors: Catskills Research Company module public import LeanPool.DomainTheory.Neighborhood.Example43 -import Mathlib.Data.Finset.Attr -import Mathlib.Data.Rat.Cast.Order -import Mathlib.Tactic.NormNum.Abs -import Mathlib.Tactic.NormNum.DivMod -import Mathlib.Tactic.NormNum.OfScientific -import Mathlib.Tactic.NormNum.Pow /-! # Exercise 4.18 (Scott 1981, PRG-19, Lecture IV) @@ -60,7 +54,7 @@ theorem not_N_mem_empty : ¬ N.mem (∅ : Set ℕ) := by /-- Distinct singletons are disjoint. -/ private theorem singleton_inter_eq_empty {n m : ℕ} (hmn : m ≠ n) : ({n} : Set ℕ) ∩ {m} = ∅ := by - simp_all + exact Set.singleton_inter_eq_empty.mpr (id (Ne.symm hmn)) /-- **Exercise 4.18 (Scott 1981, PRG-19).** Element classification: every element of `|N|` is either @@ -103,7 +97,7 @@ n = m`. -/ theorem natElem_injective {n m : ℕ} (h : natElem n = natElem m) : n = m := by have hmem : (natElem m).mem {n} := h ▸ (mem_natElem_iff.mpr (Or.inr rfl)) rw [mem_natElem_iff] at hmem - simp_all + simp_all only [Set.singleton_ne_univ, Set.singleton_eq_singleton_iff, false_or] /-- **Exercise 4.18 (Scott 1981, PRG-19).** `succ` is injective on the total elements. -/ diff --git a/LeanPool/DomainTheory/Neighborhood/Exercise419.lean b/LeanPool/DomainTheory/Neighborhood/Exercise419.lean index 99553e5bba..670f2df40c 100644 --- a/LeanPool/DomainTheory/Neighborhood/Exercise419.lean +++ b/LeanPool/DomainTheory/Neighborhood/Exercise419.lean @@ -7,12 +7,6 @@ module public import LeanPool.DomainTheory.Neighborhood.Example44 public import LeanPool.DomainTheory.Neighborhood.Exercise326 -import Mathlib.Data.Finset.Attr -import Mathlib.Data.Rat.Cast.Order -import Mathlib.Tactic.NormNum.Abs -import Mathlib.Tactic.NormNum.DivMod -import Mathlib.Tactic.NormNum.OfScientific -import Mathlib.Tactic.NormNum.Pow /-! # Exercise 4.19 (Scott 1981, PRG-19, Lecture IV) — verifying Example 4.4 @@ -75,7 +69,7 @@ open Domain.Neighborhood NeighborhoodSystem ApproximableMap ExampleB Example44 /-- **Exercise 4.19 — Peano (i) for `{0,1}*`.** `Λ` is not a successor: `[] ≠ b :: σ`. -/ theorem peano_nil_ne_cons (b : Bool) (σ : Str) : ([] : Str) ≠ b :: σ := by - simp + simp only [ne_eq, List.nil_eq, reduceCtorEq, not_false_eq_true] /-- **Exercise 4.19 — Peano (ii) for `{0,1}*`.** Each successor `b ::·` is injective. -/ @@ -86,7 +80,7 @@ theorem peano_cons_injective {b : Bool} {σ τ : Str} (h : b :: σ = b :: τ) : disjoint: `0σ ≠ 1τ`. -/ theorem peano_cons_disjoint (σ τ : Str) : (false :: σ) ≠ (true :: τ) := by - simp + simp only [ne_eq, List.cons.injEq, Bool.false_eq_true, false_and, not_false_eq_true] /-- **Exercise 4.19 — Peano (iii) for `{0,1}*`.** Induction: a predicate holding at `Λ` and closed @@ -105,11 +99,11 @@ theorem peano_induction (P : Str → Prop) (hnil : P []) (hcons : ∀ b σ, P σ /-- A cone is never contained in a singleton (it has at least two elements). -/ theorem not_cone_subset_singleton (τ σ : Str) : ¬ cone τ ⊆ ({σ} : Set Str) := by intro h - have h1 : τ ∈ ({σ} : Set Str) := h (by simp [mem_cone]) - have h2 : (τ ++ [true]) ∈ ({σ} : Set Str) := h (by simp [mem_cone]) + have h1 : τ ∈ ({σ} : Set Str) := h (by simp only [mem_cone, List.prefix_rfl]) + have h2 : (τ ++ [true]) ∈ ({σ} : Set Str) := h (by simp only [mem_cone, List.prefix_append]) rw [Set.mem_singleton_iff] at h1 h2 have : τ = τ ++ [true] := h1.trans h2.symm - simp at this + simp only [List.self_eq_append_right, List.cons_ne_self] at this /-- A cone is never equal to a singleton. -/ theorem cone_ne_singleton (τ σ : Str) : cone τ ≠ ({σ} : Set Str) := by @@ -233,9 +227,9 @@ theorem liftC_strElem (V : NeighborhoodSystem β) (coneVal singVal : Str → V.E · rintro ⟨X, ⟨_, hsub⟩, hrel⟩ rcases hrel with ⟨σ', hXcone, hY⟩ | ⟨σ', hXsing, hY⟩ · have hpre : σ' <+: σ := by - simp_all + simp_all only [C_mem, Set.singleton_subset_iff, mem_cone] exact hsing hpre Y hY - · simp_all + · simp_all only [C_mem, Set.subset_singleton_iff, Set.mem_singleton_iff, forall_eq] · intro hY exact ⟨{σ}, ⟨memC_singleton σ, subset_rfl⟩, Or.inr ⟨σ, rfl, hY⟩⟩ @@ -309,7 +303,7 @@ theorem condT_bot (x y : T.Element) : · rw [NeighborhoodSystem.mem_bot] at h0; exact absurd h0 Exercise326.zero_ne_master · rw [NeighborhoodSystem.mem_bot] at h1; exact absurd h1 Exercise326.one_ne_master · exact T.bot.master_mem - · simp_all + · simp_all only [mem_bot, or_true, implies_true] /-- The defining right-hand side: `cond(empty(x), false, cond(zero(x), false, true))`. It uses only diff --git a/LeanPool/DomainTheory/Neighborhood/Exercise420.lean b/LeanPool/DomainTheory/Neighborhood/Exercise420.lean index aad40d4895..b813ea783c 100644 --- a/LeanPool/DomainTheory/Neighborhood/Exercise420.lean +++ b/LeanPool/DomainTheory/Neighborhood/Exercise420.lean @@ -6,12 +6,6 @@ Authors: Catskills Research Company module public import LeanPool.DomainTheory.Neighborhood.Theorem41 -import Mathlib.Data.Finset.Attr -import Mathlib.Data.Rat.Cast.Order -import Mathlib.Tactic.NormNum.Abs -import Mathlib.Tactic.NormNum.DivMod -import Mathlib.Tactic.NormNum.OfScientific -import Mathlib.Tactic.NormNum.Pow /-! # Exercise 4.20 (Scott 1981, PRG-19, Lecture IV) diff --git a/LeanPool/DomainTheory/Neighborhood/Exercise421.lean b/LeanPool/DomainTheory/Neighborhood/Exercise421.lean index bcbf08e1a5..88971a2d63 100644 --- a/LeanPool/DomainTheory/Neighborhood/Exercise421.lean +++ b/LeanPool/DomainTheory/Neighborhood/Exercise421.lean @@ -140,7 +140,7 @@ def upSet (m : ℕ) : Set ℕ := {k | m ≤ k} /-- `[0] = ℕ`: the recursion base of 4.13(3). -/ theorem upSet_zero : upSet 0 = Set.univ := by - ext k; simp [upSet] + ext k; simp only [upSet, zero_le, Set.ofPred_true, Set.mem_univ] /-- `[m⁺] = [m]⁺`: the recursion step of 4.13(3). -/ theorem upSet_succ (m : ℕ) : upSet (m + 1) = succImage (upSet m) := by @@ -149,7 +149,7 @@ theorem upSet_succ (m : ℕ) : upSet (m + 1) = succImage (upSet m) := by constructor · intro h exact ⟨k - 1, by omega, by omega⟩ - · simp_all + · simp_all only [forall_exists_index, add_le_add_iff_right, implies_true] /-- **Exercise 4.21 / 4.13(3) (Scott 1981, PRG-19).** `[·] = upSet` is the *unique* function with @@ -181,7 +181,8 @@ def addIso (m : ℕ) : ℕ ≃ {k : ℕ // k ∈ upSet m} where theorem addIso_apply (m n : ℕ) : (addIso m n : ℕ) = m + n := rfl /-- The isomorphism sends `0` to the distinguished element `m` of `[m]`. -/ -theorem addIso_zero (m : ℕ) : (addIso m 0 : ℕ) = m := by simp [addIso] +theorem addIso_zero (m : ℕ) : (addIso m 0 : ℕ) = m := by simp only [addIso, Equiv.coe_fn_mk, + add_zero] /-- The isomorphism preserves the successor: `addIso m (n⁺) = (addIso m n)⁺`. -/ theorem addIso_succ (m n : ℕ) : (addIso m (n + 1) : ℕ) = (addIso m n : ℕ) + 1 := by @@ -207,7 +208,7 @@ theorem mulOp_lfp_eq_multiples (n : ℕ) : · -- `lfpSet ⊆ multiples`: the multiples form a pre-fixed point. have hpre : mulOp n {k | ∃ i, k = n * i} ⊆ {k | ∃ i, k = n * i} := by rintro k (rfl | ⟨m, ⟨i, rfl⟩, rfl⟩) - · exact ⟨0, by simp⟩ + · exact ⟨0, by simp only [mul_zero]⟩ · exact ⟨i + 1, by ring⟩ exact lfpSet_subset (mulOp n) hpre · -- `multiples ⊆ lfpSet`: each `n * i` is reached by induction on `i`. @@ -216,7 +217,7 @@ theorem mulOp_lfp_eq_multiples (n : ℕ) : rintro k ⟨i, rfl⟩ induction i with | zero => - rw [← hfix]; exact Or.inl (by simp) + rw [← hfix]; exact Or.inl (by simp only [mul_zero, Set.mem_singleton_iff]) | succ j ih => rw [← hfix] exact Or.inr ⟨n * j, ih, by ring⟩ diff --git a/LeanPool/DomainTheory/Neighborhood/Exercise423.lean b/LeanPool/DomainTheory/Neighborhood/Exercise423.lean index ef121a5b03..6df05521b9 100644 --- a/LeanPool/DomainTheory/Neighborhood/Exercise423.lean +++ b/LeanPool/DomainTheory/Neighborhood/Exercise423.lean @@ -6,14 +6,9 @@ Authors: Catskills Research Company module public import LeanPool.DomainTheory.Neighborhood.Approximable -public import Mathlib.Order.Bounds.Defs import LeanPool.DomainTheory.Neighborhood.Theorem41 -import Mathlib.Data.Finset.Attr -import Mathlib.Data.Rat.Cast.Order -import Mathlib.Tactic.NormNum.Abs -import Mathlib.Tactic.NormNum.DivMod -import Mathlib.Tactic.NormNum.OfScientific -import Mathlib.Tactic.NormNum.Pow + +import Mathlib.Tactic.Set -- shake: keep /-! # Exercise 4.23 (Scott 1981, PRG-19, Lecture IV) — Eilenberg's uniqueness diff --git a/LeanPool/DomainTheory/Neighborhood/Exercise425.lean b/LeanPool/DomainTheory/Neighborhood/Exercise425.lean index 2fdc6f38a4..75e6b6eabb 100644 --- a/LeanPool/DomainTheory/Neighborhood/Exercise425.lean +++ b/LeanPool/DomainTheory/Neighborhood/Exercise425.lean @@ -7,12 +7,6 @@ module public import LeanPool.DomainTheory.Neighborhood.Example43 public import LeanPool.DomainTheory.Neighborhood.Theorem41 -import Mathlib.Data.Finset.Attr -import Mathlib.Data.Rat.Cast.Order -import Mathlib.Tactic.NormNum.Abs -import Mathlib.Tactic.NormNum.DivMod -import Mathlib.Tactic.NormNum.OfScientific -import Mathlib.Tactic.NormNum.Pow /-! # Exercise 4.25 (Scott 1981, PRG-19, Lecture IV) — the unary sequence domain `C₁` @@ -76,7 +70,8 @@ of prepending a `1`). -/ def shift (X : Set ℕ) : Set ℕ := {k | ∃ m ∈ X, k = m + 1} -theorem tail_zero : tail 0 = Set.univ := by ext k; simp [tail] +theorem tail_zero : tail 0 = Set.univ := by ext k; simp only [tail, Nat.zero_le, + Set.ofPred_true, Set.mem_univ] @[simp] theorem mem_tail {n k : ℕ} : k ∈ tail n ↔ n ≤ k := Iff.rfl @@ -92,7 +87,7 @@ theorem shift_tail (n : ℕ) : shift (tail n) = tail (n + 1) := by theorem shift_singleton (n : ℕ) : shift ({n} : Set ℕ) = {n + 1} := by ext k simp only [shift, Set.mem_singleton_iff, Set.mem_ofPred_eq] - simp_all + exact exists_eq_left theorem shift_mono {X X' : Set ℕ} (h : X' ⊆ X) : shift X' ⊆ shift X := by rintro k ⟨m, hm, rfl⟩; exact ⟨m, h hm, rfl⟩ @@ -120,7 +115,8 @@ theorem singleton_tail_nd (n k : ℕ) : ({k} : Set ℕ) ⊆ tail n ∨ tail n ⊆ {k} ∨ ({k} : Set ℕ) ∩ tail n = ∅ := by by_cases h : n ≤ k · exact Or.inl (by intro x hx; rw [Set.mem_singleton_iff] at hx; subst hx; exact h) - · simp_all + · simp_all only [not_le, Set.singleton_subset_iff, mem_tail, Set.subset_singleton_iff, + Set.singleton_inter_of_notMem, or_true] /-- Any two neighbourhoods of `C₁` are nested or disjoint. -/ theorem nestedOrDisjoint : NestedOrDisjoint memC1 := by @@ -138,7 +134,8 @@ theorem nestedOrDisjoint : NestedOrDisjoint memC1 := by · exact Or.inr (Or.inr h) · by_cases h : n = m · subst h; exact Or.inl (Set.Subset.refl _) - · simp_all + · simp_all only [Set.subset_singleton_iff, Set.mem_singleton_iff, imp_false, forall_eq, + not_false_eq_true, Set.singleton_inter_of_notMem, or_true] /-- **Exercise 4.25 (Scott 1981, PRG-19).** The unary sequence system `C₁` on `Δ = {1}* ≅ ℕ`. -/ diff --git a/LeanPool/DomainTheory/Neighborhood/Exercise507.lean b/LeanPool/DomainTheory/Neighborhood/Exercise507.lean index a4ec940d85..c48f45c546 100644 --- a/LeanPool/DomainTheory/Neighborhood/Exercise507.lean +++ b/LeanPool/DomainTheory/Neighborhood/Exercise507.lean @@ -6,12 +6,6 @@ Authors: Catskills Research Company module public import LeanPool.DomainTheory.Neighborhood.FunctionSpace -import Mathlib.Data.Finset.Attr -import Mathlib.Data.Rat.Cast.Order -import Mathlib.Tactic.NormNum.Abs -import Mathlib.Tactic.NormNum.DivMod -import Mathlib.Tactic.NormNum.OfScientific -import Mathlib.Tactic.NormNum.Pow /-! # Exercise 5.7 (Scott 1981, PRG-19, §5) — multi-variable `λ` and application from diff --git a/LeanPool/DomainTheory/Neighborhood/Exercise508.lean b/LeanPool/DomainTheory/Neighborhood/Exercise508.lean index e11ceaa94c..714c6b8f78 100644 --- a/LeanPool/DomainTheory/Neighborhood/Exercise508.lean +++ b/LeanPool/DomainTheory/Neighborhood/Exercise508.lean @@ -7,14 +7,6 @@ module public import LeanPool.DomainTheory.Neighborhood.FunctionSpace public import Mathlib.Tactic.Attr.Core -public import Mathlib.Tactic.Basic -public import Mathlib.Tactic.ToAdditive -import Mathlib.Data.Finset.Attr -import Mathlib.Data.Rat.Cast.Order -import Mathlib.Tactic.NormNum.Abs -import Mathlib.Tactic.NormNum.DivMod -import Mathlib.Tactic.NormNum.OfScientific -import Mathlib.Tactic.NormNum.Pow /-! # Exercise 5.8 (Scott 1981, PRG-19, §5) — combinatory completeness diff --git a/LeanPool/DomainTheory/Neighborhood/Exercise509.lean b/LeanPool/DomainTheory/Neighborhood/Exercise509.lean index 218c79fa3d..126c721159 100644 --- a/LeanPool/DomainTheory/Neighborhood/Exercise509.lean +++ b/LeanPool/DomainTheory/Neighborhood/Exercise509.lean @@ -9,13 +9,10 @@ public import LeanPool.DomainTheory.Neighborhood.Exercise407 public import LeanPool.DomainTheory.Neighborhood.Theorem41 public import LeanPool.DomainTheory.Neighborhood.Exercise408 public import LeanPool.DomainTheory.Neighborhood.Exercise411 -import Mathlib.Data.Finset.Attr -import Mathlib.Data.Rat.Cast.Order -import Mathlib.Tactic.NormNum.Abs -import Mathlib.Tactic.NormNum.DivMod -import Mathlib.Tactic.NormNum.OfScientific import Mathlib.Tactic.Ring.RingNF +import Mathlib.Tactic.Set -- shake: keep + /-! # Exercise 5.9 (Scott 1981, PRG-19, Lecture V) @@ -88,7 +85,7 @@ theorem commuting_least_common_fixed {f g : ApproximableMap V V} (hcomm : f.comp have hfx : f.toElementMap x = x := by apply le_antisymm · rw [hx_def, fixAbove, toElementMap_iSupDirected] - simp_all + simp_all only [Std.le_refl] · rw [hx_def, fixAbove] apply NeighborhoodSystem.iSupDirected_le intro n diff --git a/LeanPool/DomainTheory/Neighborhood/Exercise510.lean b/LeanPool/DomainTheory/Neighborhood/Exercise510.lean index 5a892c8579..c0033d5863 100644 --- a/LeanPool/DomainTheory/Neighborhood/Exercise510.lean +++ b/LeanPool/DomainTheory/Neighborhood/Exercise510.lean @@ -6,13 +6,6 @@ Authors: Catskills Research Company module public import LeanPool.DomainTheory.Neighborhood.FunctionSpace -public import Mathlib.Tactic.ToAdditive -import Mathlib.Data.Finset.Attr -import Mathlib.Data.Rat.Cast.Order -import Mathlib.Tactic.NormNum.Abs -import Mathlib.Tactic.NormNum.DivMod -import Mathlib.Tactic.NormNum.OfScientific -import Mathlib.Tactic.NormNum.Pow /-! # Exercise 5.10 (Scott 1981, PRG-19, §5) — the smash product and the strict @@ -292,12 +285,14 @@ theorem principal_master_eq_bot {X : Set α} (hX : V₀.mem X) (hXm : X = V₀.m /-- A `⊥` left factor collapses the strict pairing to `⊥` (choice-free). -/ theorem smashPair_bot_left (y : V₁.Element) : smashPair V₀.bot y = (smash V₀ V₁).bot := by apply eq_bot_of_no_proper - simp_all + simp_all only [mem_smashPair, mem_bot, ne_eq, exists_and_left, exists_eq_left, + not_true_eq_false, false_and, or_false, smash_master, implies_true] /-- A `⊥` right factor collapses the strict pairing to `⊥` (choice-free). -/ theorem smashPair_bot_right (x : V₀.Element) : smashPair x V₁.bot = (smash V₀ V₁).bot := by apply eq_bot_of_no_proper - simp_all + simp_all only [mem_smashPair, ne_eq, mem_bot, exists_and_left, ↓existsAndEq, + not_true_eq_false, false_and, and_false, exists_const, or_false, smash_master, implies_true] /-! ### The strict function space `(𝒟₀ →⊥ 𝒟₁)`. @@ -342,7 +337,7 @@ theorem isStrict_iff_apply_bot {f : ApproximableMap V₀ V₁} : exact ⟨V₀.master, V₀.bot.master_mem, f.master_rel⟩ · intro h Y hrel have : (f.toElementMap V₀.bot).mem Y := ⟨V₀.master, V₀.bot.master_mem, hrel⟩ - simp_all + simp_all only [mem_bot] /-- Strictness is downward closed: a map below a strict map is strict. -/ theorem IsStrict.mono {f g : ApproximableMap V₀ V₁} (hf : IsStrict f) (hgf : g ≤ f) : IsStrict g := @@ -377,12 +372,14 @@ def sstepFun (L : List (Set α × Set β)) : Set (StrictMap V₀ V₁) := f ∈ sstepFun L ↔ ∀ p ∈ L, f.1.rel p.1 p.2 := Iff.rfl @[simp] theorem sstepFun_nil : (sstepFun [] : Set (StrictMap V₀ V₁)) = Set.univ := by - ext f; simp + ext f; simp only [mem_sstepFun, List.not_mem_nil, IsEmpty.forall_iff, implies_true, + Set.mem_univ] theorem sstepFun_cons (p : Set α × Set β) (L : List (Set α × Set β)) : (sstepFun (p :: L) : Set (StrictMap V₀ V₁)) = sstep p.1 p.2 ∩ sstepFun L := by ext f - simp_all + simp_all only [mem_sstepFun, List.mem_cons, forall_eq_or_imp, Prod.forall, Set.mem_inter_iff, + mem_sstep] theorem sstepFun_append (L L' : List (Set α × Set β)) : (sstepFun (L ++ L') : Set (StrictMap V₀ V₁)) = sstepFun L ∩ sstepFun L' := by @@ -401,7 +398,7 @@ theorem sstepFun_singleton (X : Set α) (Y : Set β) : /-- `[Δ₀, Δ₁] = |𝒟₀ →⊥ 𝒟₁|`: every (strict) map relates the masters. -/ @[simp] theorem sstep_master_eq : (sstep V₀.master V₁.master : Set (StrictMap V₀ V₁)) = Set.univ := by - ext f; simpa using f.1.master_rel + ext f; simpa only [mem_sstep, Set.mem_univ, iff_true] using f.1.master_rel theorem sstep_inter_right {X : Set α} {Y Y' : Set β} (hY : V₁.mem Y) (hY' : V₁.mem Y') : (sstep X Y ∩ sstep X Y' : Set (StrictMap V₀ V₁)) = sstep X (Y ∩ Y') := by @@ -479,7 +476,8 @@ theorem mem_sstepFun_iff (φ : (strictFun V₀ V₁).Element) {L : List (Set α (hL : ∀ p ∈ L, V₀.mem p.1 ∧ V₁.mem p.2) : φ.mem (sstepFun L) ↔ ∀ p ∈ L, φ.mem (sstep p.1 p.2) := by induction L with - | nil => simp only [sstepFun_nil, List.not_mem_nil, IsEmpty.forall_iff, implies_true, iff_true] + | nil => simp only [sstepFun_nil, List.not_mem_nil, IsEmpty.forall_iff, implies_true, + iff_true] exact φ.master_mem | cons p L ih => rw [sstepFun_cons] @@ -493,7 +491,9 @@ theorem mem_sstepFun_iff (φ : (strictFun V₀ V₁).Element) {L : List (Set α have hne : (sstep p.1 p.2 ∩ sstepFun L).Nonempty := (φ.sub hmem).2 have htail : φ.mem (sstepFun L) := φ.up_mem hmem ⟨⟨L, hLtail, rfl⟩, hne.mono Set.inter_subset_right⟩ Set.inter_subset_right - simp_all + simp_all only [List.mem_cons, or_true, and_self, implies_true, Prod.forall, true_iff, + forall_const, forall_eq_or_imp, and_true, Set.mem_inter_iff, mem_sstep, mem_sstepFun, + Prod.mk.eta] · intro hall have hstep : φ.mem (sstep p.1 p.2) := hall p (List.mem_cons.mpr (Or.inl rfl)) have htail : φ.mem (sstepFun L) := @@ -691,7 +691,8 @@ theorem rel_sstepFun_iff (h : ApproximableMap V₀ (strictFun V₁ V₂)) {X : S have htail : h.rel X (sstepFun L) := h.mono hmem subset_rfl Set.inter_subset_right hX ⟨⟨L, hLtail, rfl⟩, hne.mono Set.inter_subset_right⟩ - simp_all + simp_all only [List.mem_cons, or_true, and_self, implies_true, Prod.forall, true_iff, + forall_const, forall_eq_or_imp, Set.mem_inter_iff, mem_sstep, mem_sstepFun, Prod.mk.eta] · intro hall have hstep : h.rel X (sstep p.1 p.2) := hall p (List.mem_cons.mpr (Or.inl rfl)) have htail : h.rel X (sstepFun L) := diff --git a/LeanPool/DomainTheory/Neighborhood/Exercise511.lean b/LeanPool/DomainTheory/Neighborhood/Exercise511.lean index 6a499e121b..8a40eb229f 100644 --- a/LeanPool/DomainTheory/Neighborhood/Exercise511.lean +++ b/LeanPool/DomainTheory/Neighborhood/Exercise511.lean @@ -7,12 +7,8 @@ module public import LeanPool.DomainTheory.Neighborhood.Exercise316 public import LeanPool.DomainTheory.Neighborhood.Theorem41 -import Mathlib.Data.Finset.Attr -import Mathlib.Data.Rat.Cast.Order -import Mathlib.Tactic.NormNum.Abs -import Mathlib.Tactic.NormNum.DivMod -import Mathlib.Tactic.NormNum.OfScientific -import Mathlib.Tactic.NormNum.Pow + +import Mathlib.Tactic.Set -- shake: keep /-! # Exercise 5.11 (Scott 1981, PRG-19, §5) — `D^∞` as stacks; stack combinators diff --git a/LeanPool/DomainTheory/Neighborhood/Exercise512.lean b/LeanPool/DomainTheory/Neighborhood/Exercise512.lean index 05d75cb174..a571a3827c 100644 --- a/LeanPool/DomainTheory/Neighborhood/Exercise512.lean +++ b/LeanPool/DomainTheory/Neighborhood/Exercise512.lean @@ -7,12 +7,6 @@ module public import LeanPool.DomainTheory.Neighborhood.Theorem41 public import LeanPool.DomainTheory.Neighborhood.Exercise326 -import Mathlib.Data.Finset.Attr -import Mathlib.Data.Rat.Cast.Order -import Mathlib.Tactic.NormNum.Abs -import Mathlib.Tactic.NormNum.DivMod -import Mathlib.Tactic.NormNum.OfScientific -import Mathlib.Tactic.NormNum.Pow /-! # Exercise 5.12 (Scott 1981, PRG-19, §5) — the `while` combinator diff --git a/LeanPool/DomainTheory/Neighborhood/Exercise513.lean b/LeanPool/DomainTheory/Neighborhood/Exercise513.lean index 9d353890fa..d14be06832 100644 --- a/LeanPool/DomainTheory/Neighborhood/Exercise513.lean +++ b/LeanPool/DomainTheory/Neighborhood/Exercise513.lean @@ -109,7 +109,7 @@ theorem tri_succ (k : ℕ) : tri (k + 1) = tri k + (k + 1) := by have key : tri (k + 1) * 2 = (tri k + (k + 1)) * 2 := by have hexp : (tri k + (k + 1)) * 2 = tri k * 2 + (k + 1) * 2 := by ring rw [hexp, e1, e2]; ring - exact Nat.eq_of_mul_eq_mul_right (by norm_num) key + exact Nat.eq_of_mul_eq_mul_right (by decide) key theorem tri_le_succ (k : ℕ) : tri k ≤ tri (k + 1) := by rw [tri_succ]; omega @@ -168,7 +168,7 @@ theorem num_injective : Function.Injective numP := by have h3 : tri (n₁ + m₁) ≤ num n₁ m₁ := by unfold num; omega omega have hbase : tri (n₁ + m₁) + m₁ = tri (n₂ + m₂) + m₂ := h' - simp_all + simp_all only [Nat.add_left_cancel_iff, Prod.mk.injEq, and_true, Nat.add_right_cancel_iff] /-! ### The inverse: walking the diagonals -/ diff --git a/LeanPool/DomainTheory/Neighborhood/Exercise514.lean b/LeanPool/DomainTheory/Neighborhood/Exercise514.lean index 05fcbd151b..ddc45f7aa9 100644 --- a/LeanPool/DomainTheory/Neighborhood/Exercise514.lean +++ b/LeanPool/DomainTheory/Neighborhood/Exercise514.lean @@ -6,8 +6,6 @@ Authors: Catskills Research Company module public import LeanPool.DomainTheory.Neighborhood.Exercise513 -import Mathlib.Tactic.NormNum.Inv -import Mathlib.Tactic.NormNum.Pow /-! # Exercise 5.14 (Scott 1981, PRG-19, Lecture V) — the graph model `Pω` diff --git a/LeanPool/DomainTheory/Neighborhood/Exercise515.lean b/LeanPool/DomainTheory/Neighborhood/Exercise515.lean index b7a8d3cbe6..a2cdab2735 100644 --- a/LeanPool/DomainTheory/Neighborhood/Exercise515.lean +++ b/LeanPool/DomainTheory/Neighborhood/Exercise515.lean @@ -119,7 +119,7 @@ theorem star_eq (z : Set S) : star z = (1 : Set S) ∪ z * star z := by obtain ⟨n, hn⟩ := mem_star.mp hs cases n with | zero => - simp_all + exact Set.mem_union_left (z * star z) hn | succ m => rw [kpow_succ, Set.mem_mul] at hn obtain ⟨a, ha, t, ht, rfl⟩ := hn @@ -188,8 +188,8 @@ theorem mem_kpow_singleton (e s : S) (n : ℕ) : s ∈ kpow ({e} : Set S) n ↔ | succ m ih => rw [kpow_succ, pow_succ', Set.mem_mul] constructor - · simp_all - · simp_all + · simp_all only [Set.mem_singleton_iff, exists_eq_left, implies_true] + · simp_all only [Set.mem_singleton_iff, exists_eq_left, implies_true] /-- `{e}* = e* = {Λ, e, e², …}`: a point lies in `star {e}` iff it is some power of `e`. -/ @@ -234,8 +234,8 @@ theorem parkX_eq (a b c d : Set S) : have hfix : parkA a b * parkX a b c d ∪ parkC a b c d = parkX a b c d := star_mul_isFixed (parkA a b) (parkC a b c d) conv_lhs => rw [← hfix] - simp only [parkA, parkC, parkY, sunion_mul, smul_union, smul_assoc, - Set.union_comm, Set.union_left_comm] + simp only [parkA, parkC, parkY, sunion_mul, smul_union, smul_assoc, Set.union_comm, + Set.union_left_comm] /-- `y₀` satisfies the second equation `y = b·x ∪ a·y ∪ d`. -/ theorem parkY_eq (a b c d : Set S) : diff --git a/LeanPool/DomainTheory/Neighborhood/Exercise516.lean b/LeanPool/DomainTheory/Neighborhood/Exercise516.lean index c5e0b9cb6d..258ee55495 100644 --- a/LeanPool/DomainTheory/Neighborhood/Exercise516.lean +++ b/LeanPool/DomainTheory/Neighborhood/Exercise516.lean @@ -7,13 +7,6 @@ module public import LeanPool.DomainTheory.Neighborhood.Exercise419 public import Mathlib.Tactic.Attr.Core -public import Mathlib.Tactic.Basic -import Mathlib.Data.Finset.Attr -import Mathlib.Data.Rat.Cast.Order -import Mathlib.Tactic.NormNum.Abs -import Mathlib.Tactic.NormNum.DivMod -import Mathlib.Tactic.NormNum.OfScientific -import Mathlib.Tactic.NormNum.Pow /-! # Exercise 5.16 (Scott 1981, PRG-19, Lecture V) — `neg`, `merge` and `d` on `C` @@ -83,7 +76,7 @@ abbrev flip (σ : Str) : Str := σ.map not theorem flip_flip (σ : Str) : flip (flip σ) = σ := by induction σ with | nil => rfl - | cons b σ ih => simp [ih] + | cons b σ ih => simp only [List.map_cons, Bool.not_not, ih] /-- `flip` preserves the prefix order. -/ theorem flip_prefix {σ τ : Str} (h : σ <+: τ) : flip σ <+: flip τ := h.map _ @@ -100,7 +93,7 @@ def double : Str → Str theorem double_append (σ τ : Str) : double (σ ++ τ) = double σ ++ double τ := by induction σ with | nil => rfl - | cons b σ ih => simp [double, ih] + | cons b σ ih => simp only [List.cons_append, double_cons, ih, double] /-- `double` preserves the prefix order. -/ theorem double_prefix {σ τ : Str} (h : σ <+: τ) : double σ <+: double τ := by @@ -128,7 +121,7 @@ theorem not_strElem_le_strBot {σ τ : Str} : ¬ strElem σ ≤ strBot τ := by theorem tail_prefix {σ τ : Str} (h : σ <+: τ) : σ.tail <+: τ.tail := by obtain ⟨ρ, rfl⟩ := h cases σ with - | nil => simp + | nil => simp only [List.tail_nil, List.nil_append, List.nil_prefix] | cons a σ' => exact List.prefix_append σ' ρ /-! ### Determination by finite elements: an equality criterion for maps `C → V`. -/ @@ -165,7 +158,7 @@ theorem tail_hsing {σ τ : Str} (h : σ <+: τ) : strBot σ.tail ≤ tailSing cases σ with | nil => exact List.nil_prefix | cons b σ' => - simp_all + simp_all only [List.cons_prefix_cons, List.tail_cons] /-- **Exercise 5.16 / Example 4.4 — `tail : C → C`.** Built with the head-test combinator `liftC`: @@ -323,7 +316,8 @@ theorem shapeElem_le_iff {b b' : Bool} {σ σ' : Str} : cases b <;> cases b' <;> simp only [shapeElem_true, shapeElem_false, SLe, strElem_le_strElem_iff, strBot_le_strBot_iff, strBot_le_strElem_iff, true_and] - · exact ⟨fun h => absurd h not_strElem_le_strBot, fun h => absurd h (by simp)⟩ + · exact ⟨fun h => absurd h not_strElem_le_strBot, fun h => absurd h (by simp only [ + Bool.false_eq_true, false_and, not_false_eq_true])⟩ /-- The interleave value function: `mergeVal σ b₀ τ b₁` returns the interleaving of the tagged @@ -367,7 +361,8 @@ theorem SLe_cons_inv {b₀ b₀' : Bool} {a : Bool} {σ₀ σ' : Str} (h : SLe b exact ⟨σ₀, rfl, rfl, rfl⟩ | false => cases σ' with - | nil => exact absurd h (by simp [SLe]) + | nil => exact absurd h (by simp only [SLe, List.prefix_nil, reduceCtorEq, + not_false_eq_true]) | cons a' σ₀' => obtain ⟨rfl, h'⟩ := List.cons_prefix_cons.mp h exact ⟨σ₀', rfl, h'⟩ @@ -411,11 +406,11 @@ theorem mergeElem_mono {σ σ' τ τ' : Str} {b₀ b₀' b₁ b₁' : Bool} theorem mergeVal_diag (s : Bool) (σ : Str) : mergeVal σ s σ s = (double σ, s) := by induction σ with | nil => rfl - | cons a σ ih => simp [mergeVal_cons_cons, ih] + | cons a σ ih => simp only [mergeVal_cons_cons, ih, double_cons] /-- On the diagonal `merge(⟨(s, σ), (s, σ)⟩)` doubles `σ`. -/ theorem mergeElem_diag (s : Bool) (σ : Str) : mergeElem σ s σ s = shapeElem s (double σ) := by - simp [mergeElem, mergeVal_diag] + simp only [mergeElem, mergeVal_diag] /-! #### A refinement lemma packaging both the representation and the order. -/ diff --git a/LeanPool/DomainTheory/Neighborhood/Exercise516Overlap.lean b/LeanPool/DomainTheory/Neighborhood/Exercise516Overlap.lean index 2c1c225d95..325e0c990e 100644 --- a/LeanPool/DomainTheory/Neighborhood/Exercise516Overlap.lean +++ b/LeanPool/DomainTheory/Neighborhood/Exercise516Overlap.lean @@ -7,12 +7,6 @@ module public import LeanPool.DomainTheory.Neighborhood.Exercise516ThueMorse public import Mathlib.Algebra.Ring.Parity -import Mathlib.Data.Finset.Attr -import Mathlib.Data.Rat.Cast.Order -import Mathlib.Tactic.NormNum.Abs -import Mathlib.Tactic.NormNum.DivMod -import Mathlib.Tactic.NormNum.OfScientific -import Mathlib.Tactic.NormNum.Pow /-! # Exercise 5.16 follow-up (Scott 1981, PRG-19, Lecture V) — overlap-freeness of @@ -123,8 +117,9 @@ theorem no_overlap (p : ℕ) : ∀ i, ¬ Overlap i p := by rcases Nat.eq_zero_or_pos q with rfl | hq1 · -- `p = 1`: three consecutive equal symbols. refine no_three_consec i ⟨?_, ?_⟩ - · have := hrel 0 (by omega); simpa using this - · have := hrel 1 (by omega); simpa [show i + 1 + 1 = i + 2 by omega] using this + · have := hrel 0 (by omega); simpa only [add_zero, mul_zero, zero_add] using this + · have := hrel 1 (by omega); simpa only [mul_zero, zero_add, + show i + 1 + 1 = i + 2 by omega] using this · -- `p = 2q+1 ≥ 3`. obtain ⟨a, hi | hi⟩ := Nat.even_or_odd' i · -- `i = 2a`: relations at `k = 0,1,2,3` give a run of three equal symbols at `a+q`. @@ -257,6 +252,6 @@ theorem tElt_cube_free (u a : Str) (ha : a ≠ []) : show u.length + a.length + k - u.length = k + a.length by omega] at e2 -- Period: `(a++(a++a))[k]? = (a++(a++a))[k+|a|]?`. have hper := append_three_period a k (by omega) - simp_all + simp_all only [ne_eq, List.append_assoc, List.length_append, Option.some.injEq] end Domain.Neighborhood.Exercise516 diff --git a/LeanPool/DomainTheory/Neighborhood/Exercise516ThueMorse.lean b/LeanPool/DomainTheory/Neighborhood/Exercise516ThueMorse.lean index 456dda2429..7e90ceb976 100644 --- a/LeanPool/DomainTheory/Neighborhood/Exercise516ThueMorse.lean +++ b/LeanPool/DomainTheory/Neighborhood/Exercise516ThueMorse.lean @@ -8,11 +8,6 @@ module public import LeanPool.DomainTheory.Neighborhood.Exercise516 public import Mathlib.Data.Nat.Bits public import Mathlib.Algebra.Group.Nat.Defs -import Mathlib.Data.Finset.Attr -import Mathlib.Data.Rat.Cast.Order -import Mathlib.Tactic.NormNum.Abs -import Mathlib.Tactic.NormNum.DivMod -import Mathlib.Tactic.NormNum.OfScientific import Mathlib.Tactic.Ring.RingNF /-! @@ -86,7 +81,7 @@ def expand : Str → Str theorem expand_append (σ τ : Str) : expand (σ ++ τ) = expand σ ++ expand τ := by induction σ with | nil => rfl - | cons b σ ih => simp [ih] + | cons b σ ih => simp only [List.cons_append, expand_cons, ih] /-! ### `Φ` on a partial element computes by interleaving — and equals `expand`. -/ @@ -189,7 +184,7 @@ number of `1`s in the binary expansion of `n` (Lambek's description). -/ def tm (n : ℕ) : Bool := (Nat.bits n).foldr xor false -@[simp] theorem tm_zero : tm 0 = false := by simp [tm, Nat.zero_bits] +@[simp] theorem tm_zero : tm 0 = false := by simp only [tm, Nat.zero_bits, List.foldr_nil] /-- The even recurrence `tm (2n) = tm n` (appending a `0`-digit does not change the parity). -/ diff --git a/LeanPool/DomainTheory/Neighborhood/Exercise617.lean b/LeanPool/DomainTheory/Neighborhood/Exercise617.lean index c7920df486..b7e93d1ed8 100644 --- a/LeanPool/DomainTheory/Neighborhood/Exercise617.lean +++ b/LeanPool/DomainTheory/Neighborhood/Exercise617.lean @@ -12,12 +12,6 @@ public import LeanPool.DomainTheory.Neighborhood.Exercise510 public import Mathlib.Tactic.Attr.Core import LeanPool.DomainTheory.Neighborhood.Exercise516 public import LeanPool.DomainTheory.Neighborhood.Theorem69 -import Mathlib.Data.Finset.Attr -import Mathlib.Data.Rat.Cast.Order -import Mathlib.Tactic.NormNum.Abs -import Mathlib.Tactic.NormNum.DivMod -import Mathlib.Tactic.NormNum.OfScientific -import Mathlib.Tactic.NormNum.Pow /-! # Exercise 6.17 (Scott 1981, PRG-19, §6) — the algebras for which `C` is initial @@ -340,34 +334,22 @@ theorem sumMap3_id : (idMap V₀) (idMap V₁) (idMap V₂) = idMap (sum3 V₀ V₁ V₂ h₀ h₁ h₂) := by apply ApproximableMap.ext intro W W' - constructor - · rintro ⟨hW, hW', hd⟩ - refine ⟨hW, hW', ?_⟩ + apply (sumMap3 (h₀ := h₀) (h₁ := h₁) (h₂ := h₂) (h₀' := h₀) (h₁' := h₁) (h₂' := h₂) + (idMap V₀) (idMap V₁) (idMap V₂)).relation_iff_subset_of_diagonal + · intro W hW + refine ⟨hW, hW, ?_⟩ + rcases hW with rfl | ⟨X, hX, rfl⟩ | ⟨Y, hY, rfl⟩ | ⟨Z, hZ, rfl⟩ + · exact Or.inl rfl + · exact Or.inr (Or.inl ⟨X, X, rfl, rfl, hX, hX, subset_rfl⟩) + · exact Or.inr (Or.inr (Or.inl ⟨Y, Y, rfl, rfl, hY, hY, subset_rfl⟩)) + · exact Or.inr (Or.inr (Or.inr ⟨Z, Z, rfl, rfl, hZ, hZ, subset_rfl⟩)) + · rintro W W' ⟨hW, _, hd⟩ rcases hd with rfl | ⟨X, Y', rfl, rfl, _, _, hXY⟩ | ⟨Y, Y', rfl, rfl, _, _, hXY⟩ | ⟨Z, Y', rfl, rfl, _, _, hXY⟩ · exact (sum3 V₀ V₁ V₂ h₀ h₁ h₂).sub_master hW · exact j0_subset_j0.mpr hXY · exact j1_subset_j1.mpr hXY · exact j2_subset_j2.mpr hXY - · rintro ⟨hW, hW', hsub⟩ - refine ⟨hW, hW', ?_⟩ - rcases hW with rfl | ⟨X, hX, rfl⟩ | ⟨Y, hY, rfl⟩ | ⟨Z, hZ, rfl⟩ - · left; exact eq_master3_of_subset hsub ((sum3 V₀ V₁ V₂ h₀ h₁ h₂).sub_master hW') - · rcases hW' with rfl | ⟨X', hX', rfl⟩ | ⟨Y', hY', rfl⟩ | ⟨Z', hZ', rfl⟩ - · exact Or.inl rfl - · exact Or.inr (Or.inl ⟨X, X', rfl, rfl, hX, hX', j0_subset_j0.mp hsub⟩) - · obtain ⟨a, ha⟩ := h₀ X hX; exact absurd (hsub (t0_mem_j0.mpr ha)) t0_not_mem_j1 - · obtain ⟨a, ha⟩ := h₀ X hX; exact absurd (hsub (t0_mem_j0.mpr ha)) t0_not_mem_j2 - · rcases hW' with rfl | ⟨X', hX', rfl⟩ | ⟨Y', hY', rfl⟩ | ⟨Z', hZ', rfl⟩ - · exact Or.inl rfl - · obtain ⟨b, hb⟩ := h₁ Y hY; exact absurd (hsub (t1_mem_j1.mpr hb)) t1_not_mem_j0 - · exact Or.inr (Or.inr (Or.inl ⟨Y, Y', rfl, rfl, hY, hY', j1_subset_j1.mp hsub⟩)) - · obtain ⟨b, hb⟩ := h₁ Y hY; exact absurd (hsub (t1_mem_j1.mpr hb)) t1_not_mem_j2 - · rcases hW' with rfl | ⟨X', hX', rfl⟩ | ⟨Y', hY', rfl⟩ | ⟨Z', hZ', rfl⟩ - · exact Or.inl rfl - · obtain ⟨c, hc⟩ := h₂ Z hZ; exact absurd (hsub (t2_mem_j2.mpr hc)) t2_not_mem_j0 - · obtain ⟨c, hc⟩ := h₂ Z hZ; exact absurd (hsub (t2_mem_j2.mpr hc)) t2_not_mem_j1 - · exact Or.inr (Or.inr (Or.inr ⟨Z, Z', rfl, rfl, hZ, hZ', j2_subset_j2.mp hsub⟩)) /-- **Functoriality (composition): `(g₀∘f₀) + (g₁∘f₁) + (g₂∘f₂) = (g₀+g₁+g₂) ∘ (f₀+f₁+f₂)`.** -/ @@ -786,7 +768,8 @@ theorem consMap_not_mem_nil {b : Bool} {z : C.Element} : rintro ⟨X', hzX', hX'mem, _, hsub⟩ obtain ⟨a, ha⟩ := C_nonempty X' hX'mem rw [← embBit_eq_prepend] at hsub - simp_all + simp_all only [Set.subset_singleton_iff, mem_embBit, forall_exists_index, reduceCtorEq, + imp_false, not_and] /-- **`toCC ∘ (0·) = inj₁` and `toCC ∘ (1·) = inj₂`.** Prepending the bit `b` to `z` is, across the diff --git a/LeanPool/DomainTheory/Neighborhood/Exercise617Gen.lean b/LeanPool/DomainTheory/Neighborhood/Exercise617Gen.lean index cda2a834ee..2ee1041ced 100644 --- a/LeanPool/DomainTheory/Neighborhood/Exercise617Gen.lean +++ b/LeanPool/DomainTheory/Neighborhood/Exercise617Gen.lean @@ -7,11 +7,6 @@ module public import LeanPool.DomainTheory.Neighborhood.Exercise617 import Mathlib.Data.Fintype.EquivFin -import Mathlib.Data.Rat.Cast.Order -import Mathlib.Tactic.NormNum.Abs -import Mathlib.Tactic.NormNum.DivMod -import Mathlib.Tactic.NormNum.OfScientific -import Mathlib.Tactic.NormNum.Pow /-! # Exercise 6.17 part 2 (Scott 1981, PRG-19) — the generalization `Cₐ ≅ 𝟙 + Σₐ Cₐ` @@ -61,7 +56,8 @@ omit [DecidableEq A] in @[simp] theorem mem_coneN {σ w : Strn A} : w ∈ coneN σ ↔ σ <+: w := Iff.rfl omit [DecidableEq A] in -theorem coneN_nil : coneN ([] : Strn A) = Set.univ := by ext w; simp [coneN] +theorem coneN_nil : coneN ([] : Strn A) = Set.univ := by ext w; simp only [coneN, + List.nil_prefix, Set.ofPred_true, Set.mem_univ] omit [DecidableEq A] in theorem coneN_subset_coneN {σ τ : Strn A} : coneN σ ⊆ coneN τ ↔ τ <+: σ := by @@ -107,7 +103,8 @@ theorem singleton_coneN_nd (σ τ : Strn A) : ({τ} : Set (Strn A)) ⊆ coneN σ ∨ coneN σ ⊆ {τ} ∨ ({τ} : Set (Strn A)) ∩ coneN σ = ∅ := by by_cases h : σ <+: τ · exact Or.inl (singleton_subset_coneN.mpr h) - · simp_all + · simp_all only [Set.singleton_subset_iff, mem_coneN, Set.subset_singleton_iff, + not_false_eq_true, Set.singleton_inter_of_notMem, or_true] omit [DecidableEq A] in theorem nestedOrDisjointN : NestedOrDisjoint (memCn (A := A)) := by @@ -123,7 +120,8 @@ theorem nestedOrDisjointN : NestedOrDisjoint (memCn (A := A)) := by · exact Or.inr (Or.inr h) · by_cases h : σ = τ · subst h; exact Or.inl (Set.Subset.refl _) - · simp_all + · simp_all only [Set.subset_singleton_iff, Set.mem_singleton_iff, imp_false, forall_eq, + not_false_eq_true, Set.singleton_inter_of_notMem, or_true] /-- **The generic domain `Cₐ`** of finite-or-infinite `A`-sequences. -/ def Cn (A : Type) : NeighborhoodSystem (Strn A) := @@ -172,7 +170,7 @@ theorem prependN_coneN (σ ρ : Strn A) : prependN σ (coneN ρ) = coneN (σ ++ omit [DecidableEq A] in theorem prependN_singleton (σ τ : Strn A) : prependN σ {τ} = {σ ++ τ} := by ext w - simp_all + simp_all only [mem_prependN, Set.mem_singleton_iff, exists_eq_left] omit [DecidableEq A] in theorem prependN_mono (σ : Strn A) {X X' : Set (Strn A)} (h : X' ⊆ X) : @@ -286,20 +284,22 @@ omit [DecidableEq A] in omit [DecidableEq A] in theorem none_not_mem_jU : (none : SigTok A β) ∉ (jU : Set (SigTok A β)) := by - simp [jU, tu] + simp only [jU, tu, Set.mem_singleton_iff, reduceCtorEq, not_false_eq_true] omit [DecidableEq A] in @[simp] theorem none_not_mem_jc {a : A} {X : Set β} : (none : SigTok A β) ∉ jc a X := by - rintro ⟨t, heq, -⟩; exact absurd heq (by simp [tc]) + rintro ⟨t, heq, -⟩; exact absurd heq (by simp only [tc, reduceCtorEq, not_false_eq_true]) omit [DecidableEq A] in @[simp] theorem tu_not_mem_jc {a : A} {X : Set β} : (tu : SigTok A β) ∉ jc a X := by - rintro ⟨t, heq, -⟩; exact absurd heq (by simp [tu, tc]) + rintro ⟨t, heq, -⟩; exact absurd heq (by simp only [tu, tc, Option.some.injEq, reduceCtorEq, + not_false_eq_true]) omit [DecidableEq A] in theorem tc_not_mem_jU {a : A} {t : β} : (tc a t : SigTok A β) ∉ (jU : Set (SigTok A β)) := by - simp [jU, tu, tc] + simp only [jU, tu, tc, Set.mem_singleton_iff, Option.some.injEq, reduceCtorEq, + not_false_eq_true] omit [DecidableEq A] in theorem tc_mem_jc_ne {a a' : A} (h : a ≠ a') {X : Set β} {t : β} : @@ -326,7 +326,8 @@ theorem jc_inter_jc_ne {a a' : A} (h : a ≠ a') (X X' : Set β) : omit [DecidableEq A] in theorem jU_inter_jc (a : A) (X : Set β) : (jU ∩ jc a X : Set (SigTok A β)) = ∅ := by ext w - simp_all + simp_all only [Set.mem_inter_iff, mem_jU, Set.mem_empty_iff_false, iff_false, not_and, + tu_not_mem_jc, not_false_eq_true, implies_true] omit [DecidableEq A] in theorem jU_nonempty : (jU : Set (SigTok A β)).Nonempty := ⟨tu, rfl⟩ @@ -694,28 +695,19 @@ theorem sumMapSig_id : = idMap (sumSig A V₀ h₀) := by apply ApproximableMap.ext intro W W' - constructor - · rintro ⟨hW, hW', hd⟩ - refine ⟨hW, hW', ?_⟩ + apply (sumMapSig (A := A) (V₀ := V₀) (V₁ := V₀) (h₀ := h₀) (h₁ := h₀) + (idMap V₀)).relation_iff_subset_of_diagonal + · intro W hW + refine ⟨hW, hW, ?_⟩ + rcases hW with rfl | rfl | ⟨a, X, hX, rfl⟩ + · exact Or.inl rfl + · exact Or.inr (Or.inl ⟨rfl, rfl⟩) + · exact Or.inr (Or.inr ⟨a, X, X, rfl, rfl, hX, hX, subset_rfl⟩) + · rintro W W' ⟨hW, _, hd⟩ rcases hd with rfl | ⟨rfl, rfl⟩ | ⟨a, X, Y', rfl, rfl, -, -, hXY⟩ · exact (sumSig A V₀ h₀).sub_master hW · exact subset_rfl · exact jc_subset_jc.mpr hXY - · rintro ⟨hW, hW', hsub⟩ - refine ⟨hW, hW', ?_⟩ - rcases hW with rfl | rfl | ⟨a, X, hX, rfl⟩ - · exact Or.inl (eq_masterSig_of_subset hsub ((sumSig A V₀ h₀).sub_master hW')) - · rcases hW' with rfl | rfl | ⟨a', X', hX', rfl⟩ - · exact Or.inl rfl - · exact Or.inr (Or.inl ⟨rfl, rfl⟩) - · exact absurd (hsub (show tu ∈ jU from rfl)) tu_not_mem_jc - · rcases hW' with rfl | rfl | ⟨a', X', hX', rfl⟩ - · exact Or.inl rfl - · obtain ⟨t, ht⟩ := h₀ X hX; exact absurd (hsub (tc_mem_jc.mpr ht)) tc_not_mem_jU - · obtain ⟨t, ht⟩ := h₀ X hX - obtain ⟨t', he, -⟩ := hsub (tc_mem_jc.mpr ht) - obtain ⟨rfl, -⟩ := tc_injective he - exact Or.inr (Or.inr ⟨a, X, X', rfl, rfl, hX, hX', jc_subset_jc.mp hsub⟩) /-- **Functoriality (composition): `Σ(g∘f) = Σg ∘ Σf`.** -/ theorem sumMapSig_comp (g : ApproximableMap V₁ V₂) (f : ApproximableMap V₀ V₁) : @@ -832,7 +824,8 @@ theorem memCn_embA (a : A) {X : Set (Strn A)} (hX : memCn X) : memCn (embA a X) omit [DecidableEq A] [Inhabited A] in theorem nil_not_mem_embA {a : A} {X : Set (Strn A)} : ([] : Strn A) ∉ embA a X := by - rintro ⟨w', heq, -⟩; exact absurd heq (by simp) + rintro ⟨w', heq, -⟩; exact absurd heq (by simp only [List.nil_eq, reduceCtorEq, + not_false_eq_true]) omit [DecidableEq A] [Inhabited A] in theorem embA_ne_univ (a : A) (X : Set (Strn A)) : embA a X ≠ Set.univ := by @@ -843,14 +836,17 @@ theorem embA_inter (a : A) (X X' : Set (Strn A)) : embA a X ∩ embA a X' = embA ext w simp only [Set.mem_inter_iff, mem_embA] constructor - · simp_all + · simp_all only [and_imp, forall_exists_index, List.cons.injEq, true_and, exists_eq_left', + and_true, forall_eq', implies_true] · rintro ⟨w', rfl, hX, hX'⟩; exact ⟨⟨w', rfl, hX⟩, ⟨w', rfl, hX'⟩⟩ omit [DecidableEq A] [Inhabited A] in theorem embA_inter_ne {a a' : A} (h : a ≠ a') (X Y : Set (Strn A)) : embA a X ∩ embA a' Y = ∅ := by ext w - simp_all + simp_all only [ne_eq, Set.mem_inter_iff, mem_embA, Set.mem_empty_iff_false, iff_false, + not_and, not_exists, forall_exists_index, List.cons.injEq, false_and, IsEmpty.forall_iff, + implies_true] omit [DecidableEq A] [Inhabited A] in theorem embA_subset {a : A} {X X' : Set (Strn A)} : embA a X ⊆ embA a X' ↔ X ⊆ X' := by @@ -884,16 +880,17 @@ theorem embA_ne {a a' : A} (h : a ≠ a') {X Y : Set (Strn A)} (hX : X.Nonempty) intro heq obtain ⟨w', hw'⟩ := hX have hmem : (a :: w') ∈ embA a' Y := heq ▸ (⟨w', rfl, hw'⟩ : (a :: w') ∈ embA a X) - simp_all + simp_all only [ne_eq, mem_embA, List.cons.injEq, false_and, exists_const] omit [DecidableEq A] [Inhabited A] in theorem singleton_nil_inter_embA (a : A) (X : Set (Strn A)) : (({[]} : Set (Strn A)) ∩ embA a X) = ∅ := by - simp_all + simp_all only [mem_embA, List.nil_eq, reduceCtorEq, false_and, exists_const, + not_false_eq_true, Set.singleton_inter_of_notMem] omit [DecidableEq A] in theorem singleton_nil_ne_univ : ({[]} : Set (Strn A)) ≠ Set.univ := by - simp_all + exact Set.singleton_ne_univ [] omit [DecidableEq A] [Inhabited A] in theorem singleton_nil_ne_embA (a : A) (X : Set (Strn A)) : @@ -1179,7 +1176,8 @@ theorem consMapN_not_mem_nil {a : A} {z : (Cn A).Element} : rintro ⟨X', hzX', hX'mem, -, hsub⟩ obtain ⟨t, ht⟩ := Cn_nonempty X' hX'mem rw [← embA_eq_prependN] at hsub - simp_all + simp_all only [Set.subset_singleton_iff, mem_embA, forall_exists_index, reduceCtorEq, + imp_false, not_and] omit [Inhabited A] in /-- **`toCC ∘ (a·) = inj_a`.** Prepending the letter `a` to `z` is, across `Cₐ ≅ @@ -1258,7 +1256,7 @@ theorem not_coneN_subset_singleton (τ σ : Strn A) : ¬ coneN τ ⊆ ({σ} : Se have h2 : (τ ++ [default]) ∈ ({σ} : Set (Strn A)) := h (List.prefix_append τ [default]) rw [Set.mem_singleton_iff] at h1 h2 have : τ = τ ++ [default] := h1.trans h2.symm - simp at this + simp only [List.self_eq_append_right, List.cons_ne_self] at this omit [DecidableEq A] in theorem coneN_ne_singleton (τ σ : Strn A) : coneN τ ≠ ({σ} : Set (Strn A)) := fun h => @@ -1336,7 +1334,7 @@ theorem liftCn_strElem (V : NeighborhoodSystem β) (coneVal singVal : Strn A → · have hpre : σ' <+: σ := by apply singleton_subset_coneN.mp; rw [← hXcone]; exact hsub exact hsing hpre Y hY - · simp_all + · simp_all only [Cn_mem, Set.subset_singleton_iff, Set.mem_singleton_iff, forall_eq] · intro hY exact ⟨{σ}, ⟨memCn_singleton σ, subset_rfl⟩, Or.inr ⟨σ, rfl, hY⟩⟩ diff --git a/LeanPool/DomainTheory/Neighborhood/Exercise618.lean b/LeanPool/DomainTheory/Neighborhood/Exercise618.lean index 196f58284c..9354b91c12 100644 --- a/LeanPool/DomainTheory/Neighborhood/Exercise618.lean +++ b/LeanPool/DomainTheory/Neighborhood/Exercise618.lean @@ -8,13 +8,6 @@ module public import LeanPool.DomainTheory.Neighborhood.Exercise316 public import LeanPool.DomainTheory.Neighborhood.Exercise319 public import LeanPool.DomainTheory.Neighborhood.Exercise617 -import LeanPool.DomainTheory.Neighborhood.Theorem69 -import Mathlib.Data.Finset.Attr -import Mathlib.Data.Rat.Cast.Order -import Mathlib.Tactic.NormNum.Abs -import Mathlib.Tactic.NormNum.DivMod -import Mathlib.Tactic.NormNum.OfScientific -import Mathlib.Tactic.NormNum.Pow /-! # Exercise 6.18 (Scott 1981, PRG-19, §6) — `𝒟^∞` as an initial algebra @@ -127,7 +120,7 @@ theorem iterProdIso_symm_pair (a : V.Element) (b : (iterSys V).Element) : (iterProdIso V).symm (pair a b) = ofSeq (consSeq a b) := by have hkey : iterProdIso V (ofSeq (consSeq a b)) = pair a b := by rw [iterProdIso_apply] - simp_all + simp_all only [component_ofSeq, consSeq_zero, consSeq_succ, ofSeq_component] rw [← hkey, OrderIso.symm_apply_apply] /-! ## Bottom-element computations -/ @@ -156,7 +149,8 @@ theorem iterBot_eq : (iterSys V).bot = ofSeq (fun _ : ℕ => V.bot) := by theorem pair_bot {α β : Type*} {V₀ : NeighborhoodSystem α} {V₁ : NeighborhoodSystem β} : pair V₀.bot V₁.bot = (prod V₀ V₁).bot := by apply Element.ext - simp_all + simp_all only [mem_pair, mem_bot, exists_and_left, ↓existsAndEq, true_and, exists_eq_left, + prod_master, implies_true] /-! ## The structure isomorphism `i, j` as approximable maps -/ @@ -356,7 +350,7 @@ theorem descMap_strict (k : ApproximableMap (prod V E) E) (hk : IsStrict k) : · rintro ⟨n, hn⟩ have hs := descSeq_strict k hk n rw [isStrict_iff_apply_bot] at hs - simp_all + simp_all only [mem_bot] · rintro rfl have hs := descSeq_strict k hk 0 rw [isStrict_iff_apply_bot] at hs @@ -403,9 +397,9 @@ theorem rho_apply (n : ℕ) (z : (iterSys V).Element) : funext j cases j with | zero => - simp_all + simp only [component_ofSeq, consSeq_zero, Nat.zero_lt_succ, ↓reduceIte] | succ k => - simp_all + simp only [component_ofSeq, consSeq_succ, Nat.add_lt_add_iff_right] /-- **`⋃ₙ ρₙ = I`.** Every `z` is the directed union of its truncations: the cofinite-`Δ` structure diff --git a/LeanPool/DomainTheory/Neighborhood/Exercise619.lean b/LeanPool/DomainTheory/Neighborhood/Exercise619.lean index 1487f7a3c8..9f379d01b3 100644 --- a/LeanPool/DomainTheory/Neighborhood/Exercise619.lean +++ b/LeanPool/DomainTheory/Neighborhood/Exercise619.lean @@ -9,7 +9,6 @@ public import LeanPool.DomainTheory.Neighborhood.Example62 public import LeanPool.DomainTheory.Neighborhood.Product import LeanPool.DomainTheory.Neighborhood.Exercise319Sum import Mathlib.Data.List.Monad -import Mathlib.Order.BooleanAlgebra.Set import Mathlib.Tactic.Attr.Core /-! @@ -442,12 +441,14 @@ def prodTokNbhd (X Y : Set Str) : Set Str := insert [] (embBit false X ∪ embBi @[simp] theorem mem_prodTokNbhd_false {X Y : Set Str} {w' : Str} : (false :: w') ∈ prodTokNbhd X Y ↔ w' ∈ X := by simp only [prodTokNbhd, Set.mem_insert_iff, Set.mem_union, mem_embBit] - simp_all + simp_all only [reduceCtorEq, List.cons.injEq, true_and, exists_eq_left', Bool.false_eq_true, + false_and, exists_const, or_false, false_or] @[simp] theorem mem_prodTokNbhd_true {X Y : Set Str} {w' : Str} : (true :: w') ∈ prodTokNbhd X Y ↔ w' ∈ Y := by simp only [prodTokNbhd, Set.mem_insert_iff, Set.mem_union, mem_embBit] - simp_all + simp_all only [reduceCtorEq, List.cons.injEq, Bool.true_eq_false, false_and, exists_const, + true_and, exists_eq_left', false_or] /-- `prodTokNbhd D₀.master D₁.master` is exactly the sum master `{Λ} ∪ 0Δ₀ ∪ 1Δ₁`. -/ theorem prodTokNbhd_master_eq : prodTokNbhd D₀.master D₁.master = sumTokMaster D₀ D₁ := rfl @@ -457,7 +458,7 @@ theorem prodTokNbhd_inter (X X' Y Y' : Set Str) : prodTokNbhd X Y ∩ prodTokNbhd X' Y' = prodTokNbhd (X ∩ X') (Y ∩ Y') := by ext w cases w with - | nil => simp [Set.mem_inter_iff] + | nil => simp only [Set.mem_inter_iff, mem_prodTokNbhd_nil, and_self] | cons b w' => cases b <;> simp [Set.mem_inter_iff] /-- Scott's (1) for the product: inclusion of product neighbourhoods is diff --git a/LeanPool/DomainTheory/Neighborhood/Exercise619PartB.lean b/LeanPool/DomainTheory/Neighborhood/Exercise619PartB.lean index 456276b5d3..a4fb2541d1 100644 --- a/LeanPool/DomainTheory/Neighborhood/Exercise619PartB.lean +++ b/LeanPool/DomainTheory/Neighborhood/Exercise619PartB.lean @@ -8,18 +8,8 @@ module public import LeanPool.DomainTheory.Neighborhood.Exercise619 public import LeanPool.DomainTheory.Neighborhood.Definition610 public import LeanPool.DomainTheory.Neighborhood.Exercise510 -public import Mathlib.Order.Directed -public import Mathlib.Order.SetNotation public import Mathlib.Tactic.Attr.Core -public import Mathlib.Tactic.Basic -import Mathlib.Data.Finset.Attr import Mathlib.Data.List.Monad -import Mathlib.Data.Rat.Cast.Order -import Mathlib.Tactic.Continuity.Init -import Mathlib.Tactic.NormNum.Abs -import Mathlib.Tactic.NormNum.DivMod -import Mathlib.Tactic.NormNum.OfScientific -import Mathlib.Tactic.NormNum.Pow /-! # Exercise 6.19 (Scott 1981, PRG-19, §6) — Part B: the functor algebra @@ -133,7 +123,7 @@ theorem embBit_not_subset_cross {b b' : Bool} (h : b ≠ b') {X Y : Set Str} (hX (hsub : embBit b X ⊆ embBit b' Y) : False := by obtain ⟨t, ht⟩ := hX obtain ⟨w', he, -⟩ := hsub ⟨t, rfl, ht⟩ - simp_all + simp_all only [ne_eq, List.cons.injEq, false_and] /-! ## The functorial action of sum on maps -/ @@ -267,22 +257,18 @@ theorem sumMapTok_id : sumMapTok (idMap A₀.sys) (idMap A₁.sys) = idMap (A₀.sum A₁).sys := by apply ApproximableMap.ext intro W W' - constructor - · rintro (⟨hW, rfl⟩ | ⟨X, X', ⟨hX, hX', hsub⟩, rfl, rfl⟩ | ⟨Y, Y', ⟨hY, hY', hsub⟩, rfl, rfl⟩) - · exact ⟨hW, (A₀.sum A₁).sys.master_mem, (A₀.sum A₁).sys.sub_master hW⟩ - · exact ⟨Or.inr (Or.inl ⟨X, hX, rfl⟩), Or.inr (Or.inl ⟨X', hX', rfl⟩), embBit_subset.mpr hsub⟩ - · exact ⟨Or.inr (Or.inr ⟨Y, hY, rfl⟩), Or.inr (Or.inr ⟨Y', hY', rfl⟩), embBit_subset.mpr hsub⟩ - · rintro ⟨hW, hW', hsub⟩ - rcases hW' with rfl | ⟨X', hX', rfl⟩ | ⟨Y', hY', rfl⟩ - · exact Or.inl ⟨hW, rfl⟩ - · rcases hW with rfl | ⟨X, hX, rfl⟩ | ⟨Y, hY, rfl⟩ - · exact absurd (hsub nil_mem_sumTokMaster) nil_not_mem_embBit - · exact Or.inr (Or.inl ⟨X, X', ⟨hX, hX', embBit_subset.mp hsub⟩, rfl, rfl⟩) - · exact absurd hsub (fun h => embBit_not_subset_cross (by decide) (A₁.ne Y hY) h) - · rcases hW with rfl | ⟨X, hX, rfl⟩ | ⟨Y, hY, rfl⟩ - · exact absurd (hsub nil_mem_sumTokMaster) nil_not_mem_embBit - · exact absurd hsub (fun h => embBit_not_subset_cross (by decide) (A₀.ne X hX) h) - · exact Or.inr (Or.inr ⟨Y, Y', ⟨hY, hY', embBit_subset.mp hsub⟩, rfl, rfl⟩) + apply (sumMapTok (idMap A₀.sys) (idMap A₁.sys)).relation_iff_subset_of_diagonal + · rintro W (rfl | ⟨X, hX, rfl⟩ | ⟨Y, hY, rfl⟩) + · exact Or.inl ⟨(A₀.sum A₁).sys.master_mem, rfl⟩ + · exact Or.inr (Or.inl ⟨X, X, + ⟨hX, hX, subset_rfl⟩, rfl, rfl⟩) + · exact Or.inr (Or.inr ⟨Y, Y, + ⟨hY, hY, subset_rfl⟩, rfl, rfl⟩) + · rintro W W' (⟨hW, rfl⟩ | ⟨X, X', ⟨_, _, hXs⟩, rfl, rfl⟩ | + ⟨Y, Y', ⟨_, _, hYs⟩, rfl, rfl⟩) + · exact (A₀.sum A₁).sys.sub_master hW + · exact embBit_subset.mpr hXs + · exact embBit_subset.mpr hYs /-- **`(g₀ ∘ f₀) + (g₁ ∘ f₁) = (g₀ + g₁) ∘ (f₀ + f₁)`.** -/ theorem sumMapTok_comp (f₀ : ApproximableMap A₀.sys B₀.sys) (f₁ : ApproximableMap A₁.sys B₁.sys) @@ -320,13 +306,11 @@ theorem prodMapTok_id : prodMapTok (idMap A₀.sys) (idMap A₁.sys) = idMap (A₀.prod A₁).sys := by apply ApproximableMap.ext intro W W' - constructor - · rintro ⟨X, Y, X', Y', ⟨hX, hX', hsX⟩, ⟨hY, hY', hsY⟩, rfl, rfl⟩ - exact ⟨prodTok_mem_prodTokNbhd hX hY, prodTok_mem_prodTokNbhd hX' hY', - prodTokNbhd_subset_iff.mpr ⟨hsX, hsY⟩⟩ - · rintro ⟨⟨X, Y, hX, hY, rfl⟩, ⟨X', Y', hX', hY', rfl⟩, hsub⟩ - obtain ⟨hsX, hsY⟩ := prodTokNbhd_subset_iff.mp hsub - exact ⟨X, Y, X', Y', ⟨hX, hX', hsX⟩, ⟨hY, hY', hsY⟩, rfl, rfl⟩ + apply (prodMapTok (idMap A₀.sys) (idMap A₁.sys)).relation_iff_subset_of_diagonal + · rintro W ⟨X, Y, hX, hY, rfl⟩ + exact ⟨X, Y, X, Y, ⟨hX, hX, subset_rfl⟩, ⟨hY, hY, subset_rfl⟩, rfl, rfl⟩ + · rintro W W' ⟨X, Y, X', Y', ⟨_, _, hXs⟩, ⟨_, _, hYs⟩, rfl, rfl⟩ + exact prodTokNbhd_subset_iff.mpr ⟨hXs, hYs⟩ /-- **`(g₀ ∘ f₀) × (g₁ ∘ f₁) = (g₀ × g₁) ∘ (f₀ × f₁)`.** -/ theorem prodMapTok_comp (f₀ : ApproximableMap A₀.sys B₀.sys) (f₁ : ApproximableMap A₁.sys B₁.sys) @@ -738,9 +722,11 @@ theorem insertTag_continuous {ℱ : Set (Set Str)} {U : Set Str} (hne : ℱ.None · rintro (rfl | hw | hw) · obtain ⟨Γ, hΓ⟩ := hne; exact ⟨Γ, hΓ, Or.inl rfl⟩ · obtain ⟨w', rfl, hw'⟩ := hw - simp_all + simp_all only [reduceCtorEq, mem_embBit, List.cons.injEq, true_and, exists_eq_left', + Bool.false_eq_true, false_and, exists_const, or_false, false_or] · obtain ⟨w', rfl, hw'⟩ := hw - simp_all + simp_all only [reduceCtorEq, mem_embBit, List.cons.injEq, Bool.true_eq_false, false_and, + exists_const, true_and, exists_eq_left', false_or] · rintro ⟨Γ, hΓ, (rfl | hw | hw)⟩ · exact Or.inl rfl · obtain ⟨w', rfl, hw'⟩ := hw @@ -824,7 +810,7 @@ theorem mFun_iter_fixed (T : FExpr) (hT : T.RootedConst) : exact ⟨mIter T (max i j), ⟨max i j, rfl⟩, mIter_mono T hT (le_max_left i j), mIter_mono T hT (le_max_right i j)⟩ have hU : ∀ v, v ∈ (⋃ n, mIter T n) ↔ ∃ S ∈ Set.range (mIter T), v ∈ S := by - simp_all + exact fun v => Iff.of_eq rfl apply Set.ext; intro w rw [mFun_continuous T hdir hne hU w] constructor diff --git a/LeanPool/DomainTheory/Neighborhood/Exercise621.lean b/LeanPool/DomainTheory/Neighborhood/Exercise621.lean index fbebf27ec7..645c44aa7d 100644 --- a/LeanPool/DomainTheory/Neighborhood/Exercise621.lean +++ b/LeanPool/DomainTheory/Neighborhood/Exercise621.lean @@ -6,13 +6,6 @@ Authors: Catskills Research Company module public import LeanPool.DomainTheory.Neighborhood.Exercise619PartB -import Mathlib.Data.Finset.Attr -import Mathlib.Data.Rat.Cast.Order -import Mathlib.Tactic.Continuity.Init -import Mathlib.Tactic.NormNum.Abs -import Mathlib.Tactic.NormNum.DivMod -import Mathlib.Tactic.NormNum.OfScientific -import Mathlib.Tactic.NormNum.Pow /-! # Exercise 6.21 (Scott 1981, PRG-19, §6) — the *separated* sum `⊕` and product `⊗` @@ -395,25 +388,18 @@ theorem oplusMapTok_id : oplusMapTok (idMap A₀.sys) (idMap A₁.sys) = idMap (A₀.oplus A₁).sys := by apply ApproximableMap.ext intro W W' - constructor - · rintro (⟨hW, rfl⟩ | ⟨X, X', ⟨hX, hX', hsub⟩, hXne, hX'ne, rfl, rfl⟩ | - ⟨Y, Y', ⟨hY, hY', hsub⟩, hYne, hY'ne, rfl, rfl⟩) - · exact ⟨hW, (A₀.oplus A₁).sys.master_mem, (A₀.oplus A₁).sys.sub_master hW⟩ - · exact ⟨oplusTok_mem_embF (h₀ := A₀.ne) (h₁ := A₁.ne) hX hXne, - oplusTok_mem_embF (h₀ := A₀.ne) (h₁ := A₁.ne) hX' hX'ne, embBit_subset.mpr hsub⟩ - · exact ⟨oplusTok_mem_embT (h₀ := A₀.ne) (h₁ := A₁.ne) hY hYne, - oplusTok_mem_embT (h₀ := A₀.ne) (h₁ := A₁.ne) hY' hY'ne, embBit_subset.mpr hsub⟩ - · rintro ⟨hW, hW', hsub⟩ - rcases hW' with rfl | ⟨X', hX', hX'ne, rfl⟩ | ⟨Y', hY', hY'ne, rfl⟩ - · exact Or.inl ⟨hW, rfl⟩ - · rcases hW with rfl | ⟨X, hX, hXne, rfl⟩ | ⟨Y, hY, hYne, rfl⟩ - · exact absurd (hsub nil_mem_sumTokMaster) nil_not_mem_embBit - · exact Or.inr (Or.inl ⟨X, X', ⟨hX, hX', embBit_subset.mp hsub⟩, hXne, hX'ne, rfl, rfl⟩) - · exact absurd hsub (fun h => embBit_not_subset_cross (by decide) (A₁.ne Y hY) h) - · rcases hW with rfl | ⟨X, hX, hXne, rfl⟩ | ⟨Y, hY, hYne, rfl⟩ - · exact absurd (hsub nil_mem_sumTokMaster) nil_not_mem_embBit - · exact absurd hsub (fun h => embBit_not_subset_cross (by decide) (A₀.ne X hX) h) - · exact Or.inr (Or.inr ⟨Y, Y', ⟨hY, hY', embBit_subset.mp hsub⟩, hYne, hY'ne, rfl, rfl⟩) + apply (oplusMapTok (idMap A₀.sys) (idMap A₁.sys)).relation_iff_subset_of_diagonal + · rintro W (rfl | ⟨X, hX, hXne, rfl⟩ | ⟨Y, hY, hYne, rfl⟩) + · exact Or.inl ⟨(A₀.oplus A₁).sys.master_mem, rfl⟩ + · exact Or.inr (Or.inl ⟨X, X, + ⟨hX, hX, subset_rfl⟩, hXne, hXne, rfl, rfl⟩) + · exact Or.inr (Or.inr ⟨Y, Y, + ⟨hY, hY, subset_rfl⟩, hYne, hYne, rfl, rfl⟩) + · rintro W W' (⟨hW, rfl⟩ | ⟨X, X', ⟨_, _, hXs⟩, _, _, rfl, rfl⟩ | + ⟨Y, Y', ⟨_, _, hYs⟩, _, _, rfl, rfl⟩) + · exact (A₀.oplus A₁).sys.sub_master hW + · exact embBit_subset.mpr hXs + · exact embBit_subset.mpr hYs /-- **`(g₀ ∘ f₀) ⊕ (g₁ ∘ f₁) = (g₀ ⊕ g₁) ∘ (f₀ ⊕ f₁)`** for **strict** `g₀, g₁`. (Strictness of the @@ -537,21 +523,15 @@ theorem otimesMapTok_id : otimesMapTok (idMap A₀.sys) (idMap A₁.sys) = idMap (A₀.otimes A₁).sys := by apply ApproximableMap.ext intro W W' - constructor - · rintro (⟨hW, rfl⟩ | ⟨X, Y, X', Y', ⟨hX, hX', hsubX⟩, ⟨hY, hY', hsubY⟩, - hXne, hYne, hX'ne, hY'ne, rfl, rfl⟩) - · exact ⟨hW, (A₀.otimes A₁).sys.master_mem, (A₀.otimes A₁).sys.sub_master hW⟩ - · exact ⟨otimesTok_mem_prod hX hY hXne hYne, otimesTok_mem_prod hX' hY' hX'ne hY'ne, - prodTokNbhd_subset_iff.mpr ⟨hsubX, hsubY⟩⟩ - · rintro ⟨hW, hW', hsub⟩ - rcases hW' with rfl | ⟨X', Y', hX', hY', hX'ne, hY'ne, rfl⟩ - · exact Or.inl ⟨hW, rfl⟩ - · rcases hW with rfl | ⟨X, Y, hX, hY, hXne, hYne, rfl⟩ - · obtain ⟨hsubX, -⟩ := prodTokNbhd_subset_iff.mp hsub - exact absurd (Set.Subset.antisymm (A₀.sys.sub_master hX') hsubX) hX'ne - · obtain ⟨hsX, hsY⟩ := prodTokNbhd_subset_iff.mp hsub - exact Or.inr ⟨X, Y, X', Y', ⟨hX, hX', hsX⟩, ⟨hY, hY', hsY⟩, - hXne, hYne, hX'ne, hY'ne, rfl, rfl⟩ + apply (otimesMapTok (idMap A₀.sys) (idMap A₁.sys)).relation_iff_subset_of_diagonal + · rintro W (rfl | ⟨X, Y, hX, hY, hXne, hYne, rfl⟩) + · exact Or.inl ⟨(A₀.otimes A₁).sys.master_mem, rfl⟩ + · exact Or.inr ⟨X, Y, X, Y, ⟨hX, hX, subset_rfl⟩, ⟨hY, hY, subset_rfl⟩, + hXne, hYne, hXne, hYne, rfl, rfl⟩ + · rintro W W' (⟨hW, rfl⟩ | + ⟨X, Y, X', Y', ⟨_, _, hXs⟩, ⟨_, _, hYs⟩, _, _, _, _, rfl, rfl⟩) + · exact (A₀.otimes A₁).sys.sub_master hW + · exact prodTokNbhd_subset_iff.mpr ⟨hXs, hYs⟩ /-- **`(g₀ ∘ f₀) ⊗ (g₁ ∘ f₁) = (g₀ ⊗ g₁) ∘ (f₀ ⊗ f₁)`** for **strict** `g₀, g₁`. -/ theorem otimesMapTok_comp (f₀ : ApproximableMap A₀.sys B₀.sys) (f₁ : ApproximableMap A₁.sys B₁.sys) @@ -960,7 +940,7 @@ theorem gFun_iter_fixed (T : GExpr) (hT : T.RootedConst) : exact ⟨gIter T (max i j), ⟨max i j, rfl⟩, gIter_mono T hT (le_max_left i j), gIter_mono T hT (le_max_right i j)⟩ have hU : ∀ v, v ∈ (⋃ n, gIter T n) ↔ ∃ S ∈ Set.range (gIter T), v ∈ S := by - simp_all + exact fun v => Iff.of_eq rfl apply Set.ext; intro w rw [gFun_continuous T hdir hne hU w] constructor diff --git a/LeanPool/DomainTheory/Neighborhood/Exercise622.lean b/LeanPool/DomainTheory/Neighborhood/Exercise622.lean index f68f65f529..cb5bcaf617 100644 --- a/LeanPool/DomainTheory/Neighborhood/Exercise622.lean +++ b/LeanPool/DomainTheory/Neighborhood/Exercise622.lean @@ -6,13 +6,6 @@ Authors: Catskills Research Company module public import LeanPool.DomainTheory.Neighborhood.Exercise621 -import Mathlib.Data.Finset.Attr -import Mathlib.Data.Rat.Cast.Order -import Mathlib.Tactic.Continuity.Init -import Mathlib.Tactic.NormNum.Abs -import Mathlib.Tactic.NormNum.DivMod -import Mathlib.Tactic.NormNum.OfScientific -import Mathlib.Tactic.NormNum.Pow /-! # Exercise 6.22 (Scott 1981, PRG-19, §6) — commenting on three domain equations diff --git a/LeanPool/DomainTheory/Neighborhood/Exercise623.lean b/LeanPool/DomainTheory/Neighborhood/Exercise623.lean index 60843ca728..733a538902 100644 --- a/LeanPool/DomainTheory/Neighborhood/Exercise623.lean +++ b/LeanPool/DomainTheory/Neighborhood/Exercise623.lean @@ -9,13 +9,8 @@ public import LeanPool.DomainTheory.Neighborhood.Exercise621 public import LeanPool.DomainTheory.Neighborhood.Definition63 public import LeanPool.DomainTheory.Neighborhood.Proposition612 public import LeanPool.DomainTheory.Neighborhood.Theorem69 -import Mathlib.Data.Finset.Attr -import Mathlib.Data.Rat.Cast.Order -import Mathlib.Tactic.Continuity.Init -import Mathlib.Tactic.NormNum.Abs -import Mathlib.Tactic.NormNum.DivMod -import Mathlib.Tactic.NormNum.OfScientific -import Mathlib.Tactic.NormNum.Pow + +import Mathlib.Tactic.Set -- shake: keep /-! # Exercise 6.23 (Scott 1981, PRG-19, §6) — the syntactic domain of expressions @@ -237,7 +232,8 @@ theorem gColim_obj_sys_eq (T : GExpr) (hT : T.RootedConst) : exact ⟨gTower T (max n m), ⟨max n m, rfl⟩, gTower_le T hT (le_max_left n m), gTower_le T hT (le_max_right n m)⟩ have hU : ∀ X, (gColim T hT).sys.mem X ↔ ∃ D ∈ ℱ, D.sys.mem X := by - simp_all + simp_all only [Set.mem_range, forall_exists_index, forall_apply_eq_imp_iff, mem_gColim, + exists_exists_eq_and, implies_true] apply NeighborhoodSystem.ext · intro W rw [T.obj_continuous hdir hne hsub hU W] @@ -663,13 +659,30 @@ relations are theorem Subsystem.self_inj {α : Type*} {D : NeighborhoodSystem α} (h : D ◁ D) : h.inj = idMap D := by apply ApproximableMap.ext - simp_all + exact fun X Y => Iff.of_eq rfl /-- On `D ◁ D`, the projection is the identity. -/ theorem Subsystem.self_proj {α : Type*} {D : NeighborhoodSystem α} (h : D ◁ D) : h.proj = idMap D := by apply ApproximableMap.ext - simp_all + exact fun X Y => Iff.of_eq rfl + +/-- A projection in a projection pair is determined by its injection. -/ +theorem Subsystem.projection_eq_of_projection_pair {α : Type*} + {D E : NeighborhoodSystem α} (h : D ◁ E) (projection : ApproximableMap E D) + (retraction : projection.comp h.inj = idMap D) + (below_identity : h.inj.comp projection ≤ idMap E) : projection = h.proj := by + apply le_antisymm + · calc projection = (idMap D).comp projection := (idMap_comp projection).symm + _ = (h.proj.comp h.inj).comp projection := by rw [h.proj_comp_inj] + _ = h.proj.comp (h.inj.comp projection) := comp_assoc _ _ _ + _ ≤ h.proj.comp (idMap E) := comp_mono_gen le_rfl below_identity + _ = h.proj := comp_idMap _ + · calc h.proj = (idMap D).comp h.proj := (idMap_comp h.proj).symm + _ = (projection.comp h.inj).comp h.proj := by rw [retraction] + _ = projection.comp (h.inj.comp h.proj) := comp_assoc _ _ _ + _ ≤ projection.comp (idMap E) := comp_mono_gen le_rfl h.inj_comp_proj_le + _ = projection := comp_idMap _ /-! ### The functor carries projection pairs: the token-level lemmas -/ @@ -680,62 +693,31 @@ relate `W ↦ W'` iff `W ∈ 𝒟₀+𝒟₁`, `W' ∈ ℰ₀+ℰ₁`, `W ⊆ W'`. -/ theorem sumMapTok_inj (h0 : A₀.sys ◁ B₀.sys) (h1 : A₁.sys ◁ B₁.sys) : sumMapTok h0.inj h1.inj = (sumTok_subsystem h0 h1).inj := by - have hsubM : ∀ {W : Set Str}, (A₀.sum A₁).sys.mem W → W ⊆ sumTokMaster B₀.sys B₁.sys := by - rintro W (rfl | ⟨X, hX, rfl⟩ | ⟨Y, hY, rfl⟩) - · exact (show sumTokMaster A₀.sys A₁.sys = sumTokMaster B₀.sys B₁.sys by - unfold sumTokMaster; rw [h0.master_eq, h1.master_eq]).subset - · exact embF_subset_sumTokMaster (h0.sub hX) - · exact embT_subset_sumTokMaster (h1.sub hY) apply ApproximableMap.ext intro W W' rw [Subsystem.inj_rel] - constructor - · rintro (⟨hW, rfl⟩ | ⟨X, X', ⟨hX, hX', hXsub⟩, rfl, rfl⟩ | ⟨Y, Y', ⟨hY, hY', hYsub⟩, rfl, rfl⟩) - · exact ⟨hW, (B₀.sum B₁).sys.master_mem, hsubM hW⟩ - · exact ⟨Or.inr (Or.inl ⟨X, hX, rfl⟩), Or.inr (Or.inl ⟨X', hX', rfl⟩), embBit_subset.mpr hXsub⟩ - · exact ⟨Or.inr (Or.inr ⟨Y, hY, rfl⟩), Or.inr (Or.inr ⟨Y', hY', rfl⟩), embBit_subset.mpr hYsub⟩ - · rintro ⟨hW, hW', hsub⟩ - rcases hW' with rfl | ⟨X', hX', rfl⟩ | ⟨Y', hY', rfl⟩ - · exact Or.inl ⟨hW, rfl⟩ - · rcases hW with rfl | ⟨X, hX, rfl⟩ | ⟨Y, hY, rfl⟩ - · exact absurd (hsub nil_mem_sumTokMaster) nil_not_mem_embBit - · exact Or.inr (Or.inl ⟨X, X', ⟨hX, hX', embBit_subset.mp hsub⟩, rfl, rfl⟩) - · exact absurd hsub (fun h => embBit_not_subset_cross (by decide) (A₁.ne Y hY) h) - · rcases hW with rfl | ⟨X, hX, rfl⟩ | ⟨Y, hY, rfl⟩ - · exact absurd (hsub nil_mem_sumTokMaster) nil_not_mem_embBit - · exact absurd hsub (fun h => embBit_not_subset_cross (by decide) (A₀.ne X hX) h) - · exact Or.inr (Or.inr ⟨Y, Y', ⟨hY, hY', embBit_subset.mp hsub⟩, rfl, rfl⟩) + apply (sumMapTok h0.inj h1.inj).relation_iff_subset_of_diagonal + · rintro W (rfl | ⟨X, hX, rfl⟩ | ⟨Y, hY, rfl⟩) + · exact Or.inl ⟨(A₀.sum A₁).sys.master_mem, + by unfold sumTokMaster; rw [h0.master_eq, h1.master_eq]⟩ + · exact Or.inr (Or.inl ⟨X, X, + ⟨hX, h0.sub hX, subset_rfl⟩, rfl, rfl⟩) + · exact Or.inr (Or.inr ⟨Y, Y, + ⟨hY, h1.sub hY, subset_rfl⟩, rfl, rfl⟩) + · rintro W W' (⟨hW, rfl⟩ | ⟨X, X', ⟨_, _, hXs⟩, rfl, rfl⟩ | + ⟨Y, Y', ⟨_, _, hYs⟩, rfl, rfl⟩) + · exact (B₀.sum B₁).sys.sub_master ((sumTok_subsystem h0 h1).sub hW) + · exact embBit_subset.mpr hXs + · exact embBit_subset.mpr hYs /-- **Sum carries the projection.** -/ theorem sumMapTok_proj (h0 : A₀.sys ◁ B₀.sys) (h1 : A₁.sys ◁ B₁.sys) : sumMapTok h0.proj h1.proj = (sumTok_subsystem h0 h1).proj := by - have hsubM : ∀ {W : Set Str}, (B₀.sum B₁).sys.mem W → W ⊆ sumTokMaster A₀.sys A₁.sys := by - rintro W (rfl | ⟨X, hX, rfl⟩ | ⟨Y, hY, rfl⟩) - · exact (show sumTokMaster B₀.sys B₁.sys = sumTokMaster A₀.sys A₁.sys by - unfold sumTokMaster; rw [h0.master_eq, h1.master_eq]).subset - · exact (embBit_subset.mpr (by rw [h0.master_eq]; exact B₀.sys.sub_master hX)).trans - (embF_subset_sumTokMaster A₀.sys.master_mem) - · exact (embBit_subset.mpr (by rw [h1.master_eq]; exact B₁.sys.sub_master hY)).trans - (embT_subset_sumTokMaster A₁.sys.master_mem) - apply ApproximableMap.ext - intro W W' - rw [Subsystem.proj_rel] - constructor - · rintro (⟨hW, rfl⟩ | ⟨X, X', ⟨hX, hX', hXsub⟩, rfl, rfl⟩ | ⟨Y, Y', ⟨hY, hY', hYsub⟩, rfl, rfl⟩) - · exact ⟨hW, (A₀.sum A₁).sys.master_mem, hsubM hW⟩ - · exact ⟨Or.inr (Or.inl ⟨X, hX, rfl⟩), Or.inr (Or.inl ⟨X', hX', rfl⟩), embBit_subset.mpr hXsub⟩ - · exact ⟨Or.inr (Or.inr ⟨Y, hY, rfl⟩), Or.inr (Or.inr ⟨Y', hY', rfl⟩), embBit_subset.mpr hYsub⟩ - · rintro ⟨hW, hW', hsub⟩ - rcases hW' with rfl | ⟨X', hX', rfl⟩ | ⟨Y', hY', rfl⟩ - · exact Or.inl ⟨hW, rfl⟩ - · rcases hW with rfl | ⟨X, hX, rfl⟩ | ⟨Y, hY, rfl⟩ - · exact absurd (hsub nil_mem_sumTokMaster) nil_not_mem_embBit - · exact Or.inr (Or.inl ⟨X, X', ⟨hX, hX', embBit_subset.mp hsub⟩, rfl, rfl⟩) - · exact absurd hsub (fun h => embBit_not_subset_cross (by decide) (B₁.ne Y hY) h) - · rcases hW with rfl | ⟨X, hX, rfl⟩ | ⟨Y, hY, rfl⟩ - · exact absurd (hsub nil_mem_sumTokMaster) nil_not_mem_embBit - · exact absurd hsub (fun h => embBit_not_subset_cross (by decide) (B₀.ne X hX) h) - · exact Or.inr (Or.inr ⟨Y, Y', ⟨hY, hY', embBit_subset.mp hsub⟩, rfl, rfl⟩) + apply Subsystem.projection_eq_of_projection_pair (sumTok_subsystem h0 h1) + · rw [← sumMapTok_inj h0 h1, ← sumMapTok_comp, h0.proj_comp_inj, + h1.proj_comp_inj, sumMapTok_id] + · rw [← sumMapTok_inj h0 h1, ← sumMapTok_comp] + exact (sumMapTok_mono h0.inj_comp_proj_le h1.inj_comp_proj_le).trans_eq sumMapTok_id /-- **Product carries the injection.** -/ theorem prodMapTok_inj (h0 : A₀.sys ◁ B₀.sys) (h1 : A₁.sys ◁ B₁.sys) : @@ -743,93 +725,52 @@ theorem prodMapTok_inj (h0 : A₀.sys ◁ B₀.sys) (h1 : A₁.sys ◁ B₁.sys) apply ApproximableMap.ext intro W W' rw [Subsystem.inj_rel] - constructor - · rintro ⟨X, Y, X', Y', ⟨hX, hX', hXs⟩, ⟨hY, hY', hYs⟩, rfl, rfl⟩ - exact ⟨prodTok_mem_prodTokNbhd hX hY, prodTok_mem_prodTokNbhd hX' hY', - prodTokNbhd_subset_iff.mpr ⟨hXs, hYs⟩⟩ - · rintro ⟨⟨X, Y, hX, hY, rfl⟩, ⟨X', Y', hX', hY', rfl⟩, hsub⟩ - obtain ⟨hXs, hYs⟩ := prodTokNbhd_subset_iff.mp hsub - exact ⟨X, Y, X', Y', ⟨hX, hX', hXs⟩, ⟨hY, hY', hYs⟩, rfl, rfl⟩ + apply (prodMapTok h0.inj h1.inj).relation_iff_subset_of_diagonal + · rintro W ⟨X, Y, hX, hY, rfl⟩ + exact ⟨X, Y, X, Y, ⟨hX, h0.sub hX, subset_rfl⟩, + ⟨hY, h1.sub hY, subset_rfl⟩, rfl, rfl⟩ + · rintro W W' ⟨X, Y, X', Y', ⟨_, _, hXs⟩, ⟨_, _, hYs⟩, rfl, rfl⟩ + exact prodTokNbhd_subset_iff.mpr ⟨hXs, hYs⟩ /-- **Product carries the projection.** -/ theorem prodMapTok_proj (h0 : A₀.sys ◁ B₀.sys) (h1 : A₁.sys ◁ B₁.sys) : prodMapTok h0.proj h1.proj = (prodTok_subsystem h0 h1).proj := by - apply ApproximableMap.ext - intro W W' - rw [Subsystem.proj_rel] - constructor - · rintro ⟨X, Y, X', Y', ⟨hX, hX', hXs⟩, ⟨hY, hY', hYs⟩, rfl, rfl⟩ - exact ⟨prodTok_mem_prodTokNbhd hX hY, prodTok_mem_prodTokNbhd hX' hY', - prodTokNbhd_subset_iff.mpr ⟨hXs, hYs⟩⟩ - · rintro ⟨⟨X, Y, hX, hY, rfl⟩, ⟨X', Y', hX', hY', rfl⟩, hsub⟩ - obtain ⟨hXs, hYs⟩ := prodTokNbhd_subset_iff.mp hsub - exact ⟨X, Y, X', Y', ⟨hX, hX', hXs⟩, ⟨hY, hY', hYs⟩, rfl, rfl⟩ + apply Subsystem.projection_eq_of_projection_pair (prodTok_subsystem h0 h1) + · rw [← prodMapTok_inj h0 h1, ← prodMapTok_comp, h0.proj_comp_inj, + h1.proj_comp_inj, prodMapTok_id] + · rw [← prodMapTok_inj h0 h1, ← prodMapTok_comp] + exact (prodMapTok_mono h0.inj_comp_proj_le h1.inj_comp_proj_le).trans_eq prodMapTok_id /-- **Coalesced sum carries the injection.** -/ theorem oplusMapTok_inj (h0 : A₀.sys ◁ B₀.sys) (h1 : A₁.sys ◁ B₁.sys) : oplusMapTok h0.inj h1.inj = (oplusTok_subsystem h0 h1).inj := by - have hsubM : ∀ {W : Set Str}, (A₀.oplus A₁).sys.mem W → W ⊆ sumTokMaster B₀.sys B₁.sys := by - rintro W (rfl | ⟨X, hX, hXne, rfl⟩ | ⟨Y, hY, hYne, rfl⟩) - · exact (show sumTokMaster A₀.sys A₁.sys = sumTokMaster B₀.sys B₁.sys by - unfold sumTokMaster; rw [h0.master_eq, h1.master_eq]).subset - · exact embF_subset_sumTokMaster (h0.sub hX) - · exact embT_subset_sumTokMaster (h1.sub hY) apply ApproximableMap.ext intro W W' rw [Subsystem.inj_rel] - constructor - · rintro (⟨hW, rfl⟩ | ⟨X, X', ⟨hX, hX', hXs⟩, hXne, hX'ne, rfl, rfl⟩ | - ⟨Y, Y', ⟨hY, hY', hYs⟩, hYne, hY'ne, rfl, rfl⟩) - · exact ⟨hW, (B₀.oplus B₁).sys.master_mem, hsubM hW⟩ - · exact ⟨Or.inr (Or.inl ⟨X, hX, hXne, rfl⟩), Or.inr (Or.inl ⟨X', hX', hX'ne, rfl⟩), - embBit_subset.mpr hXs⟩ - · exact ⟨Or.inr (Or.inr ⟨Y, hY, hYne, rfl⟩), Or.inr (Or.inr ⟨Y', hY', hY'ne, rfl⟩), - embBit_subset.mpr hYs⟩ - · rintro ⟨hW, hW', hsub⟩ - rcases hW' with rfl | ⟨X', hX', hX'ne, rfl⟩ | ⟨Y', hY', hY'ne, rfl⟩ - · exact Or.inl ⟨hW, rfl⟩ - · rcases hW with rfl | ⟨X, hX, hXne, rfl⟩ | ⟨Y, hY, hYne, rfl⟩ - · exact absurd (hsub nil_mem_sumTokMaster) nil_not_mem_embBit - · exact Or.inr (Or.inl ⟨X, X', ⟨hX, hX', embBit_subset.mp hsub⟩, hXne, hX'ne, rfl, rfl⟩) - · exact absurd hsub (fun h => embBit_not_subset_cross (by decide) (A₁.ne Y hY) h) - · rcases hW with rfl | ⟨X, hX, hXne, rfl⟩ | ⟨Y, hY, hYne, rfl⟩ - · exact absurd (hsub nil_mem_sumTokMaster) nil_not_mem_embBit - · exact absurd hsub (fun h => embBit_not_subset_cross (by decide) (A₀.ne X hX) h) - · exact Or.inr (Or.inr ⟨Y, Y', ⟨hY, hY', embBit_subset.mp hsub⟩, hYne, hY'ne, rfl, rfl⟩) + apply (oplusMapTok h0.inj h1.inj).relation_iff_subset_of_diagonal + · rintro W (rfl | ⟨X, hX, hXne, rfl⟩ | ⟨Y, hY, hYne, rfl⟩) + · exact Or.inl ⟨(A₀.oplus A₁).sys.master_mem, + by unfold sumTokMaster; rw [h0.master_eq, h1.master_eq]⟩ + · exact Or.inr (Or.inl ⟨X, X, + ⟨hX, h0.sub hX, subset_rfl⟩, hXne, by rwa [← h0.master_eq], rfl, rfl⟩) + · exact Or.inr (Or.inr ⟨Y, Y, + ⟨hY, h1.sub hY, subset_rfl⟩, hYne, by rwa [← h1.master_eq], rfl, rfl⟩) + · rintro W W' (⟨hW, rfl⟩ | ⟨X, X', ⟨_, _, hXs⟩, _, _, rfl, rfl⟩ | + ⟨Y, Y', ⟨_, _, hYs⟩, _, _, rfl, rfl⟩) + · exact (B₀.oplus B₁).sys.sub_master ((oplusTok_subsystem h0 h1).sub hW) + · exact embBit_subset.mpr hXs + · exact embBit_subset.mpr hYs /-- **Coalesced sum carries the projection.** -/ theorem oplusMapTok_proj (h0 : A₀.sys ◁ B₀.sys) (h1 : A₁.sys ◁ B₁.sys) : oplusMapTok h0.proj h1.proj = (oplusTok_subsystem h0 h1).proj := by - have hsubM : ∀ {W : Set Str}, (B₀.oplus B₁).sys.mem W → W ⊆ sumTokMaster A₀.sys A₁.sys := by - rintro W (rfl | ⟨X, hX, hXne, rfl⟩ | ⟨Y, hY, hYne, rfl⟩) - · exact (show sumTokMaster B₀.sys B₁.sys = sumTokMaster A₀.sys A₁.sys by - unfold sumTokMaster; rw [h0.master_eq, h1.master_eq]).subset - · exact (embBit_subset.mpr (by rw [h0.master_eq]; exact B₀.sys.sub_master hX)).trans - (embF_subset_sumTokMaster A₀.sys.master_mem) - · exact (embBit_subset.mpr (by rw [h1.master_eq]; exact B₁.sys.sub_master hY)).trans - (embT_subset_sumTokMaster A₁.sys.master_mem) - apply ApproximableMap.ext - intro W W' - rw [Subsystem.proj_rel] - constructor - · rintro (⟨hW, rfl⟩ | ⟨X, X', ⟨hX, hX', hXs⟩, hXne, hX'ne, rfl, rfl⟩ | - ⟨Y, Y', ⟨hY, hY', hYs⟩, hYne, hY'ne, rfl, rfl⟩) - · exact ⟨hW, (A₀.oplus A₁).sys.master_mem, hsubM hW⟩ - · exact ⟨Or.inr (Or.inl ⟨X, hX, hXne, rfl⟩), Or.inr (Or.inl ⟨X', hX', hX'ne, rfl⟩), - embBit_subset.mpr hXs⟩ - · exact ⟨Or.inr (Or.inr ⟨Y, hY, hYne, rfl⟩), Or.inr (Or.inr ⟨Y', hY', hY'ne, rfl⟩), - embBit_subset.mpr hYs⟩ - · rintro ⟨hW, hW', hsub⟩ - rcases hW' with rfl | ⟨X', hX', hX'ne, rfl⟩ | ⟨Y', hY', hY'ne, rfl⟩ - · exact Or.inl ⟨hW, rfl⟩ - · rcases hW with rfl | ⟨X, hX, hXne, rfl⟩ | ⟨Y, hY, hYne, rfl⟩ - · exact absurd (hsub nil_mem_sumTokMaster) nil_not_mem_embBit - · exact Or.inr (Or.inl ⟨X, X', ⟨hX, hX', embBit_subset.mp hsub⟩, hXne, hX'ne, rfl, rfl⟩) - · exact absurd hsub (fun h => embBit_not_subset_cross (by decide) (B₁.ne Y hY) h) - · rcases hW with rfl | ⟨X, hX, hXne, rfl⟩ | ⟨Y, hY, hYne, rfl⟩ - · exact absurd (hsub nil_mem_sumTokMaster) nil_not_mem_embBit - · exact absurd hsub (fun h => embBit_not_subset_cross (by decide) (B₀.ne X hX) h) - · exact Or.inr (Or.inr ⟨Y, Y', ⟨hY, hY', embBit_subset.mp hsub⟩, hYne, hY'ne, rfl, rfl⟩) + apply Subsystem.projection_eq_of_projection_pair (oplusTok_subsystem h0 h1) + · rw [← oplusMapTok_inj h0 h1, + ← oplusMapTok_comp _ _ (Subsystem.proj_isStrict h0) (Subsystem.proj_isStrict h1), + h0.proj_comp_inj, h1.proj_comp_inj, oplusMapTok_id] + · rw [← oplusMapTok_inj h0 h1, + ← oplusMapTok_comp _ _ (Subsystem.inj_isStrict h0) (Subsystem.inj_isStrict h1)] + exact (oplusMapTok_mono h0.inj_comp_proj_le h1.inj_comp_proj_le).trans_eq oplusMapTok_id /-- **Smash product carries the injection.** -/ theorem otimesMapTok_inj (h0 : A₀.sys ◁ B₀.sys) (h1 : A₁.sys ◁ B₁.sys) : @@ -837,65 +778,27 @@ theorem otimesMapTok_inj (h0 : A₀.sys ◁ B₀.sys) (h1 : A₁.sys ◁ B₁.sy apply ApproximableMap.ext intro W W' rw [Subsystem.inj_rel] - constructor - · rintro (⟨hW, rfl⟩ | - ⟨X, Y, X', Y', ⟨hX, hX', hXs⟩, ⟨hY, hY', hYs⟩, hXne, hYne, hX'ne, hY'ne, rfl, rfl⟩) - · refine ⟨hW, (B₀.otimes B₁).sys.master_mem, ?_⟩ - rcases hW with rfl | ⟨P, Q, hP, hQ, hPne, hQne, rfl⟩ - · exact (show prodTokNbhd A₀.sys.master A₁.sys.master - = prodTokNbhd B₀.sys.master B₁.sys.master by rw [h0.master_eq, h1.master_eq]).subset - · exact prodTokNbhd_subset_iff.mpr ⟨B₀.sys.sub_master (h0.sub hP), - B₁.sys.sub_master (h1.sub hQ)⟩ - · exact ⟨Or.inr ⟨X, Y, hX, hY, hXne, hYne, rfl⟩, Or.inr ⟨X', Y', hX', hY', hX'ne, hY'ne, rfl⟩, - prodTokNbhd_subset_iff.mpr ⟨hXs, hYs⟩⟩ - · rintro ⟨hW, hW', hsub⟩ - rcases hW' with rfl | ⟨X', Y', hX', hY', hX'ne, hY'ne, rfl⟩ - · exact Or.inl ⟨hW, rfl⟩ - · rcases hW with rfl | ⟨X, Y, hX, hY, hXne, hYne, rfl⟩ - · obtain ⟨hsX, _⟩ := prodTokNbhd_subset_iff.mp hsub - exact absurd (Set.Subset.antisymm (B₀.sys.sub_master hX') - (by rw [← h0.master_eq]; exact hsX)) hX'ne - · obtain ⟨hXs, hYs⟩ := prodTokNbhd_subset_iff.mp hsub - exact Or.inr ⟨X, Y, X', Y', ⟨hX, hX', hXs⟩, ⟨hY, hY', hYs⟩, - hXne, hYne, hX'ne, hY'ne, rfl, rfl⟩ + apply (otimesMapTok h0.inj h1.inj).relation_iff_subset_of_diagonal + · rintro W (rfl | ⟨X, Y, hX, hY, hXne, hYne, rfl⟩) + · exact Or.inl ⟨(A₀.otimes A₁).sys.master_mem, by rw [h0.master_eq, h1.master_eq]⟩ + · exact Or.inr ⟨X, Y, X, Y, ⟨hX, h0.sub hX, subset_rfl⟩, + ⟨hY, h1.sub hY, subset_rfl⟩, hXne, hYne, + by rwa [← h0.master_eq], by rwa [← h1.master_eq], rfl, rfl⟩ + · rintro W W' (⟨hW, rfl⟩ | + ⟨X, Y, X', Y', ⟨_, _, hXs⟩, ⟨_, _, hYs⟩, _, _, _, _, rfl, rfl⟩) + · exact (B₀.otimes B₁).sys.sub_master ((otimesTok_subsystem h0 h1).sub hW) + · exact prodTokNbhd_subset_iff.mpr ⟨hXs, hYs⟩ /-- **Smash product carries the projection.** -/ theorem otimesMapTok_proj (h0 : A₀.sys ◁ B₀.sys) (h1 : A₁.sys ◁ B₁.sys) : otimesMapTok h0.proj h1.proj = (otimesTok_subsystem h0 h1).proj := by - apply ApproximableMap.ext - intro W W' - rw [Subsystem.proj_rel] - constructor - · rintro (⟨hW, rfl⟩ | - ⟨X, Y, X', Y', ⟨hX, hX', hXs⟩, ⟨hY, hY', hYs⟩, hXne, hYne, hX'ne, hY'ne, rfl, rfl⟩) - · refine ⟨hW, (A₀.otimes A₁).sys.master_mem, ?_⟩ - rcases hW with rfl | ⟨P, Q, hP, hQ, hPne, hQne, rfl⟩ - · exact (show prodTokNbhd B₀.sys.master B₁.sys.master - = prodTokNbhd A₀.sys.master A₁.sys.master by rw [h0.master_eq, h1.master_eq]).subset - · exact prodTokNbhd_subset_iff.mpr ⟨by rw [h0.master_eq]; exact B₀.sys.sub_master hP, - by rw [h1.master_eq]; exact B₁.sys.sub_master hQ⟩ - · exact ⟨Or.inr ⟨X, Y, hX, hY, hXne, hYne, rfl⟩, Or.inr ⟨X', Y', hX', hY', hX'ne, hY'ne, rfl⟩, - prodTokNbhd_subset_iff.mpr ⟨hXs, hYs⟩⟩ - · rintro ⟨hW, hW', hsub⟩ - rcases hW' with rfl | ⟨X', Y', hX', hY', hX'ne, hY'ne, rfl⟩ - · exact Or.inl ⟨hW, rfl⟩ - · rcases hW with rfl | ⟨X, Y, hX, hY, hXne, hYne, rfl⟩ - · obtain ⟨hsX, _⟩ := prodTokNbhd_subset_iff.mp hsub - exact absurd (Set.Subset.antisymm (A₀.sys.sub_master hX') - (by rw [h0.master_eq]; exact hsX)) hX'ne - · obtain ⟨hXs, hYs⟩ := prodTokNbhd_subset_iff.mp hsub - exact Or.inr ⟨X, Y, X', Y', ⟨hX, hX', hXs⟩, ⟨hY, hY', hYs⟩, - hXne, hYne, hX'ne, hY'ne, rfl, rfl⟩ - -/-! ### The crux (Definition 6.13, concrete): `T` carries the 6.12 projection pair - -This is the *monotone on domains* content of Definition 6.13, but here a genuine -**equality** of maps -over the single token type `Str` (no `HEq` carrier transport): the functor `T = -GExpr` sends the -injection/projection of `D ◁ E` to the injection/projection of `T(D) ◁ T(E)`. -Proved by induction -over the six constructors using the token-level lemmas just established. -/ + apply Subsystem.projection_eq_of_projection_pair (otimesTok_subsystem h0 h1) + · rw [← otimesMapTok_inj h0 h1, + ← otimesMapTok_comp _ _ (Subsystem.proj_isStrict h0) (Subsystem.proj_isStrict h1), + h0.proj_comp_inj, h1.proj_comp_inj, otimesMapTok_id] + · rw [← otimesMapTok_inj h0 h1, + ← otimesMapTok_comp _ _ (Subsystem.inj_isStrict h0) (Subsystem.inj_isStrict h1)] + exact (otimesMapTok_mono h0.inj_comp_proj_le h1.inj_comp_proj_le).trans_eq otimesMapTok_id /-- **`T(i) = i'`** — the functor carries the injection of `D ◁ E` to that of `T(D) ◁ T(E)`. -/ @@ -1066,8 +969,8 @@ theorem key_rho (n : ℕ) : apply ApproximableMap.ext intro A E rw [map_rho_eq] - simp only [comp_rel, rho_rel, expInv_rel, expHom_rel, Subsystem.proj_rel, - Subsystem.inj_rel, hsyseq] + simp only [comp_rel, rho_rel, expInv_rel, expHom_rel, Subsystem.proj_rel, Subsystem.inj_rel, + hsyseq] constructor · rintro ⟨hcA, hcE, z, hTz, hAz, hzE⟩ exact ⟨E, ⟨A, ⟨hcA, hcA, subset_rfl⟩, z, ⟨hcA, hTz, hAz⟩, hTz, hcE, hzE⟩, diff --git a/LeanPool/DomainTheory/Neighborhood/Exercise624.lean b/LeanPool/DomainTheory/Neighborhood/Exercise624.lean index b23b89dc1e..c63d25cc9d 100644 --- a/LeanPool/DomainTheory/Neighborhood/Exercise624.lean +++ b/LeanPool/DomainTheory/Neighborhood/Exercise624.lean @@ -6,13 +6,6 @@ Authors: Catskills Research Company module public import LeanPool.DomainTheory.Neighborhood.Exercise619PartB -import Mathlib.Data.Finset.Attr -import Mathlib.Data.Rat.Cast.Order -import Mathlib.Tactic.Continuity.Init -import Mathlib.Tactic.NormNum.Abs -import Mathlib.Tactic.NormNum.DivMod -import Mathlib.Tactic.NormNum.OfScientific -import Mathlib.Tactic.NormNum.Pow /-! # Exercise 6.24 (Scott 1981, PRG-19, §6) — a **double fixed point** for a system diff --git a/LeanPool/DomainTheory/Neighborhood/Exercise625.lean b/LeanPool/DomainTheory/Neighborhood/Exercise625.lean index 1eba16677d..0ab8bc7757 100644 --- a/LeanPool/DomainTheory/Neighborhood/Exercise625.lean +++ b/LeanPool/DomainTheory/Neighborhood/Exercise625.lean @@ -6,12 +6,6 @@ Authors: Catskills Research Company module public import LeanPool.DomainTheory.Neighborhood.Proposition612 -import Mathlib.Data.Finset.Attr -import Mathlib.Data.Rat.Cast.Order -import Mathlib.Tactic.NormNum.Abs -import Mathlib.Tactic.NormNum.DivMod -import Mathlib.Tactic.NormNum.OfScientific -import Mathlib.Tactic.NormNum.Pow /-! # Lecture VI — Exercise 6.25 (Scott 1981, PRG-19): the Galois connection of a diff --git a/LeanPool/DomainTheory/Neighborhood/Exercise626.lean b/LeanPool/DomainTheory/Neighborhood/Exercise626.lean index c854b87f1f..f404d093da 100644 --- a/LeanPool/DomainTheory/Neighborhood/Exercise626.lean +++ b/LeanPool/DomainTheory/Neighborhood/Exercise626.lean @@ -6,13 +6,6 @@ Authors: Catskills Research Company module public import LeanPool.DomainTheory.Neighborhood.Exercise621 -import Mathlib.Data.Finset.Attr -import Mathlib.Data.Rat.Cast.Order -import Mathlib.Tactic.Continuity.Init -import Mathlib.Tactic.NormNum.Abs -import Mathlib.Tactic.NormNum.DivMod -import Mathlib.Tactic.NormNum.OfScientific -import Mathlib.Tactic.NormNum.Pow /-! # Exercise 6.26 (Scott 1981, PRG-19, §6) — the lifting `𝒟_⊥` over `{0,1}*` diff --git a/LeanPool/DomainTheory/Neighborhood/Exercise627.lean b/LeanPool/DomainTheory/Neighborhood/Exercise627.lean index eae830046e..cb16c1d434 100644 --- a/LeanPool/DomainTheory/Neighborhood/Exercise627.lean +++ b/LeanPool/DomainTheory/Neighborhood/Exercise627.lean @@ -7,13 +7,6 @@ module public import LeanPool.DomainTheory.Neighborhood.Exercise621 public import LeanPool.DomainTheory.Neighborhood.Lemma615 -import Mathlib.Data.Finset.Attr -import Mathlib.Data.Rat.Cast.Order -import Mathlib.Tactic.Continuity.Init -import Mathlib.Tactic.NormNum.Abs -import Mathlib.Tactic.NormNum.DivMod -import Mathlib.Tactic.NormNum.OfScientific -import Mathlib.Tactic.NormNum.Pow /-! # Exercise 6.27 (Scott 1981, PRG-19, §6) — which subsystem relations hold diff --git a/LeanPool/DomainTheory/Neighborhood/Exercise628.lean b/LeanPool/DomainTheory/Neighborhood/Exercise628.lean index 805d23fbbb..51e077746f 100644 --- a/LeanPool/DomainTheory/Neighborhood/Exercise628.lean +++ b/LeanPool/DomainTheory/Neighborhood/Exercise628.lean @@ -6,14 +6,8 @@ Authors: Catskills Research Company module public import LeanPool.DomainTheory.Neighborhood.Lemma615 -public import Mathlib.Tactic.ToAdditive import LeanPool.DomainTheory.Neighborhood.Proposition612 import Mathlib.Data.Fintype.Powerset -import Mathlib.Data.Rat.Cast.Order -import Mathlib.Tactic.NormNum.Abs -import Mathlib.Tactic.NormNum.DivMod -import Mathlib.Tactic.NormNum.OfScientific -import Mathlib.Tactic.NormNum.Pow /-! # Exercise 6.28 (Scott 1981, PRG-19, §6) — Plotkin's finite @@ -172,7 +166,7 @@ theorem finite_element_of_isFinite {α : Type*} {D : NeighborhoodSystem α} (h : intro X by_cases hX : D.mem X · have := Set.ext_iff.mp hxy ⟨X, hX⟩ - simpa using this + simpa only [Set.mem_ofPred_eq] using this · exact ⟨fun hmem => absurd (x.sub hmem) hX, fun hmem => absurd (y.sub hmem) hX⟩ /-- **Exercise 6.28 (Scott 1981, PRG-19; suggested by G. Plotkin).** If `𝒟` and diff --git a/LeanPool/DomainTheory/Neighborhood/Exercise629.lean b/LeanPool/DomainTheory/Neighborhood/Exercise629.lean index 6785dcc5eb..e26bc425e3 100644 --- a/LeanPool/DomainTheory/Neighborhood/Exercise629.lean +++ b/LeanPool/DomainTheory/Neighborhood/Exercise629.lean @@ -100,7 +100,7 @@ def iprodNbhd (X : ∀ i, Set (α i)) : Set (Σ i, α i) := {p | p.2 ∈ X p.1} /-- Product neighbourhoods intersect coordinatewise (Scott's (2)). -/ theorem iprodNbhd_inter (X X' : ∀ i, Set (α i)) : iprodNbhd X ∩ iprodNbhd X' = iprodNbhd (fun i => X i ∩ X' i) := by - apply Set.ext; rintro ⟨i, a⟩; simp [iprodNbhd, Set.mem_inter_iff] + apply Set.ext; rintro ⟨i, a⟩; simp only [iprodNbhd, Set.mem_inter_iff, Set.mem_ofPred_eq] /-- Inclusion of product neighbourhoods is coordinatewise (Scott's (1)). -/ theorem iprodNbhd_subset_iff {X X' : ∀ i, Set (α i)} : @@ -133,7 +133,7 @@ theorem FinSupp.inter {X X' : ∀ i, Set (α i)} -- fully constructive, -- no case split on the undecidable proposition `X i = master`. refine ⟨l ++ l', fun i hi => ?_⟩ - simp_all + simp_all only [List.mem_append, not_or, not_false_eq_true, Set.inter_self] variable (D) in /-- **Exercise 6.29 — the indexed product `∏_i D_i`.** Neighbourhoods are @@ -172,11 +172,11 @@ def updTuple (D : ∀ i, NeighborhoodSystem (α i)) (i : ι) (U : Set (α i)) : Function.update (fun j => (D j).master) i U @[simp] theorem updTuple_apply_self (i : ι) (U : Set (α i)) : updTuple D i U i = U := by - simp [updTuple] + simp only [updTuple, Function.update_self] theorem updTuple_apply_ne {i j : ι} (U : Set (α i)) (h : j ≠ i) : updTuple D i U j = (D j).master := by - simp [updTuple, Function.update_of_ne h] + simp only [updTuple, Function.update_of_ne h] /-- The slice cylinder: `U` at coordinate `i`, master elsewhere. -/ def slice (D : ∀ i, NeighborhoodSystem (α i)) (i : ι) (U : Set (α i)) : Set (Σ i, α i) := @@ -331,7 +331,7 @@ theorem z_mem_of_slices (z : (iprod D).Element) {X : ∀ i, Set (α i)} have heq : restrictTo D l X = X := by funext j rw [restrictTo] - simp_all + simp_all only [ite_eq_left_iff, not_false_eq_true, implies_true] rwa [heq] at key theorem fromPi_toPi (z : (iprod D).Element) : fromPi D (fun i => proj z i) = z := by @@ -392,20 +392,20 @@ def injI (i : ι) (X : Set (α i)) : Set (Option (Σ i, α i)) := (fun a => (some ⟨i, a⟩ : Option (Σ i, α i))) '' X theorem none_not_mem_injI {i : ι} {X : Set (α i)} : (none : Option (Σ i, α i)) ∉ injI i X := by - rintro ⟨a, _, heq⟩; simp at heq + rintro ⟨a, _, heq⟩; simp only [reduceCtorEq] at heq @[simp] theorem some_mem_injI {i : ι} {a : α i} {X : Set (α i)} : (some ⟨i, a⟩ : Option (Σ i, α i)) ∈ injI i X ↔ a ∈ X := by constructor · rintro ⟨b, hb, heq⟩ - simp_all + simp_all only [Option.some.injEq, Sigma.mk.injEq, heq_eq_eq, true_and] · intro ha; exact ⟨a, ha, rfl⟩ /-- A tagged token determines its summand index. -/ theorem index_of_some_mem_injI {i k : ι} {a : α k} {X : Set (α i)} (hmem : (some ⟨k, a⟩ : Option (Σ i, α i)) ∈ injI i X) : k = i := by obtain ⟨b, _, heq⟩ := hmem - simp_all + simp_all only [Option.some.injEq, Sigma.mk.injEq] theorem injI_nonempty {i : ι} {X : Set (α i)} (hX : X.Nonempty) : (injI i X).Nonempty := by obtain ⟨a, ha⟩ := hX; exact ⟨some ⟨i, a⟩, some_mem_injI.mpr ha⟩ @@ -427,7 +427,7 @@ theorem injI_inter_same (i : ι) (X Y : Set (α i)) : injI i X ∩ injI i Y = in exact some_mem_injI.mpr ⟨some_mem_injI.mp hx, some_mem_injI.mp hy⟩ · intro h obtain rfl := index_of_some_mem_injI h - simp_all + simp_all only [some_mem_injI, Set.mem_inter_iff, and_self] theorem injI_inter_ne {i j : ι} (h : i ≠ j) (X : Set (α i)) (Y : Set (α j)) : injI i X ∩ injI j Y = ∅ := by diff --git a/LeanPool/DomainTheory/Neighborhood/FunctionSpace.lean b/LeanPool/DomainTheory/Neighborhood/FunctionSpace.lean index cb3f523be6..578c625c82 100644 --- a/LeanPool/DomainTheory/Neighborhood/FunctionSpace.lean +++ b/LeanPool/DomainTheory/Neighborhood/FunctionSpace.lean @@ -7,12 +7,6 @@ module public import LeanPool.DomainTheory.Neighborhood.Product public import LeanPool.DomainTheory.Neighborhood.Exercise127 -import Mathlib.Data.Finset.Attr -import Mathlib.Data.Rat.Cast.Order -import Mathlib.Tactic.NormNum.Abs -import Mathlib.Tactic.NormNum.DivMod -import Mathlib.Tactic.NormNum.OfScientific -import Mathlib.Tactic.NormNum.Pow /-! # Lecture III (§3) — the function space `(𝒟₀ → 𝒟₁)`: Definitions 3.8, Propositions @@ -98,12 +92,14 @@ def stepFun (L : List (Set α × Set β)) : Set (ApproximableMap V₀ V₁) := f ∈ stepFun L ↔ ∀ p ∈ L, f.rel p.1 p.2 := Iff.rfl @[simp] theorem stepFun_nil : (stepFun [] : Set (ApproximableMap V₀ V₁)) = Set.univ := by - ext f; simp + ext f; simp only [mem_stepFun, List.not_mem_nil, IsEmpty.forall_iff, implies_true, + Set.mem_univ] theorem stepFun_cons (p : Set α × Set β) (L : List (Set α × Set β)) : (stepFun (p :: L) : Set (ApproximableMap V₀ V₁)) = step p.1 p.2 ∩ stepFun L := by ext f - simp_all + simp_all only [mem_stepFun, List.mem_cons, forall_eq_or_imp, Prod.forall, Set.mem_inter_iff, + mem_step] theorem stepFun_append (L L' : List (Set α × Set β)) : (stepFun (L ++ L') : Set (ApproximableMap V₀ V₁)) = stepFun L ∩ stepFun L' := by @@ -122,7 +118,7 @@ theorem stepFun_singleton (X : Set α) (Y : Set β) : /-- `[Δ₀, Δ₁] = |𝒟₀ → 𝒟₁|`: every map relates the masters. -/ @[simp] theorem step_master_eq : (step V₀.master V₁.master : Set (ApproximableMap V₀ V₁)) = Set.univ := by - ext f; simpa using f.master_rel + ext f; simpa only [mem_step, Set.mem_univ, iff_true] using f.master_rel /-- `[X, Y] ∩ [X, Y'] = [X, Y ∩ Y']` (intersectivity in the output). -/ theorem step_inter_right {X : Set α} {Y Y' : Set β} (hY : V₁.mem Y) (hY' : V₁.mem Y') : @@ -174,7 +170,7 @@ theorem step_mem {X : Set α} {Y : Set β} (hX : V₀.mem X) (hY : V₁.mem Y) : refine ⟨⟨[(X, Y)], ?_, (stepFun_singleton X Y).symm⟩, ⟨constMap V₀ (V₁.principal hY), ?_⟩⟩ · intro p hp; rw [List.mem_singleton] at hp; subst hp; exact ⟨hX, hY⟩ - · simp_all + · simp_all only [mem_step, constMap_rel, mem_principal, Std.le_refl, and_self] /-- The "generation" lemma: a filter contains the intersection `stepFun L` iff it contains each @@ -197,7 +193,8 @@ theorem mem_stepFun_iff (φ : (funSpace V₀ V₁).Element) {L : List (Set α × have hne : (step p.1 p.2 ∩ stepFun L).Nonempty := (φ.sub hmem).2 have htail : φ.mem (stepFun L) := φ.up_mem hmem ⟨⟨L, hLtail, rfl⟩, hne.mono Set.inter_subset_right⟩ Set.inter_subset_right - simp_all + simp_all only [List.mem_cons, or_true, and_self, implies_true, Prod.forall, true_iff, + forall_const, forall_eq_or_imp, Prod.mk.eta] · intro hall have hstep : φ.mem (step p.1 p.2) := hall p (List.mem_cons.mpr (Or.inl rfl)) have htail : φ.mem (stepFun L) := @@ -348,8 +345,8 @@ theorem mem_interYs {m : Set β} {L : List (Set α × Set β)} {X : Set α} {z : rw [interYs_cons] simp only [Set.mem_inter_iff, Set.mem_ofPred_eq, ih, List.mem_cons] constructor - · simp_all - · simp_all + · simp_all only [Prod.forall, forall_eq_or_imp, implies_true, true_and, and_imp, imp_self] + · simp_all only [Prod.forall, forall_eq_or_imp, implies_true, true_and, and_imp, imp_self] /-- `interYs` is contained in the master neighbourhood. -/ theorem interYs_subset_master {m : Set β} {L : List (Set α × Set β)} {X : Set α} : @@ -425,10 +422,14 @@ theorem rel_interYs {L : List (Set α × Set β)} {f : ApproximableMap V₀ V₁ · have hp : f.rel p.1 p.2 := hf p (List.mem_cons.mpr (Or.inl rfl)) have hXp2 : f.rel X p.2 := f.mono hp hXp subset_rfl hX (f.rel_cod hp) have heq : interYs V₁.master (p :: L) X = p.2 ∩ interYs V₁.master L X := by - rw [interYs_cons]; simp_all + rw [interYs_cons]; simp_all only [imp_self, mem_stepFun, List.mem_cons, + forall_eq_or_imp, Prod.forall, true_and, Prod.mk.eta, implies_true, forall_const, + Set.ofPred_mem_eq] rw [heq]; exact f.inter_right hXp2 htail · have heq : interYs V₁.master (p :: L) X = interYs V₁.master L X := by - rw [interYs_cons]; simp_all + rw [interYs_cons]; simp_all only [imp_self, mem_stepFun, List.mem_cons, + forall_eq_or_imp, Prod.forall, Prod.mk.eta, implies_true, IsEmpty.forall_iff, + Set.ofPred_true, Set.univ_inter] rw [heq]; exact htail /-- **Proposition 3.9 (Scott 1981, PRG-19).** `f₀` is the *minimal* element of the @@ -724,7 +725,8 @@ theorem rel_stepFun_iff (h : ApproximableMap V₀ (funSpace V₁ V₂)) {X : Set have htail : h.rel X (stepFun L) := h.mono hmem subset_rfl Set.inter_subset_right hX ⟨⟨L, hLtail, rfl⟩, hne.mono Set.inter_subset_right⟩ - simp_all + simp_all only [List.mem_cons, or_true, and_self, implies_true, Prod.forall, true_iff, + forall_const, forall_eq_or_imp, Prod.mk.eta] · intro hall have hstep : h.rel X (step p.1 p.2) := hall p (List.mem_cons.mpr (Or.inl rfl)) have htail : h.rel X (stepFun L) := @@ -792,14 +794,16 @@ theorem uncurry_eq (h : ApproximableMap V₀ (funSpace V₁ V₂)) : exact ⟨Y, ⟨hY, hwY⟩, X, ⟨hX, hwX⟩, hrel⟩ · rintro ⟨Y, ⟨hY, hwY⟩, X, ⟨hX, hwX⟩, hrel⟩ refine ⟨prodNbhd X Y, (prod_mem_split hX hY).mpr ⟨hwX, hwY⟩, prod_mem_prodNbhd hX hY, ?_⟩ - simp_all + simp_all only [inl_preimage_prodNbhd, inr_preimage_prodNbhd] /-- **Theorem 3.12 (Scott 1981, PRG-19).** `uncurry (curry g) = g`. -/ theorem uncurry_curry (g : ApproximableMap (prod V₀ V₁) V₂) : uncurry (curry g) = g := by apply ApproximableMap.ext intro W Z constructor - · simp_all + · simp_all only [uncurry_rel, prod_mem_iff, exists_and_left, curry_rel, mem_step, + gSection_rel, exists_prop, and_imp, forall_exists_index, inr_preimage_prodNbhd, + inl_preimage_prodNbhd, implies_true] · intro hrel have hW := g.rel_dom hrel refine ⟨hW, prod_mem_inl hW, step_mem (prod_mem_inr hW) (g.rel_cod hrel), ?_⟩ @@ -814,7 +818,8 @@ theorem curry_uncurry (h : ApproximableMap V₀ (funSpace V₁ V₂)) : curry (u · rintro ⟨hX, hW, hmem⟩ obtain ⟨⟨L, hL, rfl⟩, _⟩ := hW refine (rel_stepFun_iff h hX hL).mpr (fun p hp => ?_) - simp_all + simp_all only [Prod.forall, mem_stepFun, gSection_rel, uncurry_rel, prod_mem_iff, + exists_and_left, inl_preimage_prodNbhd, inr_preimage_prodNbhd, Prod.mk.eta] · intro hrel have hX : V₀.mem X := h.rel_dom hrel have hW : (funSpace V₁ V₂).mem W := h.rel_cod hrel diff --git a/LeanPool/DomainTheory/Neighborhood/Lemma615.lean b/LeanPool/DomainTheory/Neighborhood/Lemma615.lean index 286bddaef0..08b35833de 100644 --- a/LeanPool/DomainTheory/Neighborhood/Lemma615.lean +++ b/LeanPool/DomainTheory/Neighborhood/Lemma615.lean @@ -9,12 +9,6 @@ public import LeanPool.DomainTheory.Neighborhood.Definition610 public import LeanPool.DomainTheory.Neighborhood.FunctionSpace public meta import Mathlib.Tactic.ToAdditive public meta import Mathlib.Tactic.ToDual -import Mathlib.Data.Finset.Attr -import Mathlib.Data.Rat.Cast.Order -import Mathlib.Tactic.NormNum.Abs -import Mathlib.Tactic.NormNum.DivMod -import Mathlib.Tactic.NormNum.OfScientific -import Mathlib.Tactic.NormNum.Pow /-! # Lecture VI — Lemma 6.15 (Scott 1981, PRG-19): the converse of Proposition 6.12 @@ -125,7 +119,7 @@ theorem isGen_mono (hji : j.comp i = idMap D) {X X' : Set α} {Z W : Set β} have hiXW : i.rel X W := i.mono hiXZ subset_rfl hZW (i.rel_dom hiXZ) (j.rel_dom hjWX') have hrel : (j.comp i).rel X X' := ⟨W, hiXW, hjWX'⟩ - simp_all + simp_all only [idMap_rel] /-- **The generator correspondence is monotone, other direction** (uses `i ∘ j ⊆ I_E`): if `Z, W` diff --git a/LeanPool/DomainTheory/Neighborhood/Product.lean b/LeanPool/DomainTheory/Neighborhood/Product.lean index b4454f392f..48d3f322ae 100644 --- a/LeanPool/DomainTheory/Neighborhood/Product.lean +++ b/LeanPool/DomainTheory/Neighborhood/Product.lean @@ -6,7 +6,6 @@ Authors: Catskills Research Company module public import LeanPool.DomainTheory.Neighborhood.ApproximableExercises -import Mathlib.Data.Set.Image /-! # Lecture III (§3) — the product system: Definitions 3.1, 3.3, Propositions 3.2, @@ -70,17 +69,19 @@ def prodNbhd (X : Set α) (Y : Set β) : Set (α ⊕ β) := Sum.inl '' X ∪ Sum @[simp] theorem mem_prodNbhd_inl {X : Set α} {Y : Set β} {a : α} : (Sum.inl a : α ⊕ β) ∈ prodNbhd X Y ↔ a ∈ X := by - simp [prodNbhd] + simp only [prodNbhd, Set.mem_union, Set.mem_image, Sum.inl.injEq, exists_eq_right, + reduceCtorEq, and_false, exists_false, or_false] @[simp] theorem mem_prodNbhd_inr {X : Set α} {Y : Set β} {b : β} : (Sum.inr b : α ⊕ β) ∈ prodNbhd X Y ↔ b ∈ Y := by - simp [prodNbhd] + simp only [prodNbhd, Set.mem_union, Set.mem_image, reduceCtorEq, and_false, exists_false, + Sum.inr.injEq, exists_eq_right, false_or] @[simp] theorem inl_preimage_prodNbhd (X : Set α) (Y : Set β) : - Sum.inl ⁻¹' prodNbhd X Y = X := by ext a; simp + Sum.inl ⁻¹' prodNbhd X Y = X := by ext a; simp only [Set.mem_preimage, mem_prodNbhd_inl] @[simp] theorem inr_preimage_prodNbhd (X : Set α) (Y : Set β) : - Sum.inr ⁻¹' prodNbhd X Y = Y := by ext b; simp + Sum.inr ⁻¹' prodNbhd X Y = Y := by ext b; simp only [Set.mem_preimage, mem_prodNbhd_inr] /-- Scott's (2): the product nbhds intersect componentwise. -/ theorem prodNbhd_inter (X X' : Set α) (Y Y' : Set β) : @@ -94,10 +95,10 @@ theorem prodNbhd_subset_iff {X X' : Set α} {Y Y' : Set β} : constructor · intro h refine ⟨fun a ha => ?_, fun b hb => ?_⟩ - · have : (Sum.inl a : α ⊕ β) ∈ prodNbhd X' Y' := h (by simpa using ha) - simpa using this - · have : (Sum.inr b : α ⊕ β) ∈ prodNbhd X' Y' := h (by simpa using hb) - simpa using this + · have : (Sum.inl a : α ⊕ β) ∈ prodNbhd X' Y' := h (by simpa only [mem_prodNbhd_inl] using ha) + simpa only [mem_prodNbhd_inl] using this + · have : (Sum.inr b : α ⊕ β) ∈ prodNbhd X' Y' := h (by simpa only [mem_prodNbhd_inr] using hb) + simpa only [mem_prodNbhd_inr] using this · rintro ⟨hX, hY⟩ (a | b) hs · simp only [mem_prodNbhd_inl] at hs ⊢; exact hX hs · simp only [mem_prodNbhd_inr] at hs ⊢; exact hY hs @@ -412,7 +413,8 @@ def paired (f : ApproximableMap V₂ V₀) (g : ApproximableMap V₂ V₁) : refine ⟨hX', z.up_mem hzW (prod_mem_prodNbhd hX' V₁.master_mem) ?_⟩ exact prodNbhd_subset_iff.mpr ⟨hsub, V₁.sub_master hB⟩ · rintro ⟨hX', hz⟩ - exact ⟨prodNbhd X' V₁.master, hz, prod_mem_prodNbhd hX' V₁.master_mem, hX', by simp⟩ + exact ⟨prodNbhd X' V₁.master, hz, prod_mem_prodNbhd hX' V₁.master_mem, hX', by simp only [ + inl_preimage_prodNbhd, Std.le_refl]⟩ /-- **Proposition 3.4(ii) (Scott 1981, PRG-19).** `p₁(z) = z₁`. -/ @[simp] theorem toElementMap_proj₁ (z : (prod V₀ V₁).Element) : @@ -426,7 +428,8 @@ def paired (f : ApproximableMap V₂ V₀) (g : ApproximableMap V₂ V₁) : refine ⟨hY', z.up_mem hzW (prod_mem_prodNbhd V₀.master_mem hY') ?_⟩ exact prodNbhd_subset_iff.mpr ⟨V₀.sub_master hA, hsub⟩ · rintro ⟨hY', hz⟩ - exact ⟨prodNbhd V₀.master Y', hz, prod_mem_prodNbhd V₀.master_mem hY', hY', by simp⟩ + exact ⟨prodNbhd V₀.master Y', hz, prod_mem_prodNbhd V₀.master_mem hY', hY', by simp only [ + inr_preimage_prodNbhd, Std.le_refl]⟩ /-- **Proposition 3.4(iv) (Scott 1981, PRG-19).** `⟨f, g⟩(w) = ⟨f(w), g(w)⟩`. -/ theorem toElementMap_paired (f : ApproximableMap V₂ V₀) (g : ApproximableMap V₂ V₁) diff --git a/LeanPool/DomainTheory/Neighborhood/Proposition53.lean b/LeanPool/DomainTheory/Neighborhood/Proposition53.lean index 5b3037f3cf..b30ba1c22f 100644 --- a/LeanPool/DomainTheory/Neighborhood/Proposition53.lean +++ b/LeanPool/DomainTheory/Neighborhood/Proposition53.lean @@ -6,12 +6,8 @@ Authors: Catskills Research Company module public import LeanPool.DomainTheory.Neighborhood.Table55 -import Mathlib.Data.Finset.Attr -import Mathlib.Data.Rat.Cast.Order -import Mathlib.Tactic.NormNum.Abs -import Mathlib.Tactic.NormNum.DivMod -import Mathlib.Tactic.NormNum.OfScientific -import Mathlib.Tactic.NormNum.Pow + +import Mathlib.Tactic.Set -- shake: keep /-! # Lecture V (§5) — Proposition 5.3 (Scott 1981, PRG-19) diff --git a/LeanPool/DomainTheory/Neighborhood/Proposition54.lean b/LeanPool/DomainTheory/Neighborhood/Proposition54.lean index 04046e46fe..163df717aa 100644 --- a/LeanPool/DomainTheory/Neighborhood/Proposition54.lean +++ b/LeanPool/DomainTheory/Neighborhood/Proposition54.lean @@ -6,12 +6,8 @@ Authors: Catskills Research Company module public import LeanPool.DomainTheory.Neighborhood.Theorem41 -import Mathlib.Data.Finset.Attr -import Mathlib.Data.Rat.Cast.Order -import Mathlib.Tactic.NormNum.Abs -import Mathlib.Tactic.NormNum.DivMod -import Mathlib.Tactic.NormNum.OfScientific -import Mathlib.Tactic.NormNum.Pow + +import Mathlib.Tactic.Set -- shake: keep /-! # Lecture V (§5) — Proposition 5.4 (Scott 1981, PRG-19) diff --git a/LeanPool/DomainTheory/Neighborhood/Proposition611.lean b/LeanPool/DomainTheory/Neighborhood/Proposition611.lean index be82e865a0..1f2cf28c00 100644 --- a/LeanPool/DomainTheory/Neighborhood/Proposition611.lean +++ b/LeanPool/DomainTheory/Neighborhood/Proposition611.lean @@ -7,8 +7,6 @@ module public import LeanPool.DomainTheory.Neighborhood.Definition610 public import LeanPool.DomainTheory.Neighborhood.Exercise222 -import Mathlib.Data.Finset.Attr -import Mathlib.Tactic.SetLike /-! # Lecture VI — Proposition 6.11 (Scott 1981, PRG-19): the subsystems of `E` form a diff --git a/LeanPool/DomainTheory/Neighborhood/Proposition612.lean b/LeanPool/DomainTheory/Neighborhood/Proposition612.lean index 51602eb545..0b6fb8193f 100644 --- a/LeanPool/DomainTheory/Neighborhood/Proposition612.lean +++ b/LeanPool/DomainTheory/Neighborhood/Proposition612.lean @@ -8,12 +8,6 @@ module public import LeanPool.DomainTheory.Neighborhood.Definition610 public import LeanPool.DomainTheory.Neighborhood.FunctionSpace public import Mathlib.Tactic.Attr.Core -import Mathlib.Data.Finset.Attr -import Mathlib.Data.Rat.Cast.Order -import Mathlib.Tactic.NormNum.Abs -import Mathlib.Tactic.NormNum.DivMod -import Mathlib.Tactic.NormNum.OfScientific -import Mathlib.Tactic.NormNum.Pow /-! # Lecture VI — Proposition 6.12 (Scott 1981, PRG-19): a subdomain yields a diff --git a/LeanPool/DomainTheory/Neighborhood/Proposition77.lean b/LeanPool/DomainTheory/Neighborhood/Proposition77.lean index 2a5b72fec7..2e48ed2277 100644 --- a/LeanPool/DomainTheory/Neighborhood/Proposition77.lean +++ b/LeanPool/DomainTheory/Neighborhood/Proposition77.lean @@ -235,12 +235,14 @@ theorem memS_sub_embZero (hD : ∀ X, D.mem X → X.Nonempty) {W : Set (List Boo cases hW with | gamma => obtain ⟨a, ha⟩ := hD D.master D.master_mem - exact absurd (hsub (show ((true :: [], a) : List Bool × α) ∈ Gamma D from ha)).1 (by simp) + exact absurd (hsub (show ((true :: [], a) : List Bool × α) ∈ Gamma D from ha)).1 + (by simp only [List.cons_ne_self, not_false_eq_true]) | @zero Z hZ => exact ⟨Z, hZ, rfl⟩ | @pair Pp Qq hP hQ => obtain ⟨⟨pth, a⟩, ht⟩ := embPair_nonempty (memS_nonempty hD hP) (Q := Qq) have hmem := hsub ht - simp_all + simp_all only [mem_embPair, mem_embZero, List.nil_eq, reduceCtorEq, false_and, + exists_const, or_self] theorem memS_sub_embPair (hD : ∀ X, D.mem X → X.Nonempty) {W A B : Set (List Bool × α)} (hW : MemS D W) (hsub : W ⊆ embPair A B) : @@ -250,14 +252,14 @@ theorem memS_sub_embPair (hD : ∀ X, D.mem X → X.Nonempty) obtain ⟨a, ha⟩ := hD D.master D.master_mem rcases hsub (show (([], a) : List Bool × α) ∈ Gamma D from ha) with ⟨p', hp', -⟩ | ⟨q', hq', -⟩ - · simp at hp' - · simp at hq' + · simp only [List.nil_eq, reduceCtorEq] at hp' + · simp only [List.nil_eq, reduceCtorEq] at hq' | @zero Z hZ => obtain ⟨a, ha⟩ := hD Z hZ rcases hsub (show (([], a) : List Bool × α) ∈ embZero Z from ⟨rfl, ha⟩) with ⟨p', hp', -⟩ | ⟨q', hq', -⟩ - · simp at hp' - · simp at hq' + · simp only [List.nil_eq, reduceCtorEq] at hp' + · simp only [List.nil_eq, reduceCtorEq] at hq' | @pair Pp Qq hP hQ => exact ⟨Pp, Qq, hP, hQ, rfl⟩ theorem exists_sub_embZero_iff (hD : ∀ X, D.mem X → X.Nonempty) (Y : Set α) : @@ -336,7 +338,7 @@ private theorem listGet_foldl_zero (l : List ℕ) (val : ℕ) : (List.foldl (fun acc x => listGetStp (Nat.pair x (Nat.pair acc 0))) (Nat.pair 0 val) l).unpair.2 = val := by induction l generalizing val with - | nil => simp + | nil => simp only [List.foldl_nil, Nat.unpair_pair] | cons x xs ih => rw [List.foldl_cons, listGetStp_pair, Nat.zero_sub, show isOne 0 = 0 from rfl, selectFn_zero, ih] @@ -542,13 +544,19 @@ theorem dsharpStep_ln (a b tbl : ℕ) : dsharpStep fcons feq finter (Nat.pair (Nat.pair (2 * a + 1) (2 * b + 2)) tbl) = packT 0 0 0 := by simp only [dsharpStep, unpair_pair_fst, unpair_pair_snd] - simp_all + simp_all only [le_add_iff_nonneg_left, zero_le, Nat.sub_eq_zero_of_le, + Nat.mul_add_mod_self_left, Nat.mod_succ, Nat.add_mod_right, Nat.mul_mod_right, zero_lt_two, + Nat.add_div_right, ne_eq, OfNat.ofNat_ne_zero, not_false_eq_true, mul_div_cancel_left₀, + selectFn_zero, add_tsub_cancel_right, selectFn_one] theorem dsharpStep_nl (a b tbl : ℕ) : dsharpStep fcons feq finter (Nat.pair (Nat.pair (2 * a + 2) (2 * b + 1)) tbl) = packT 0 0 0 := by simp only [dsharpStep, unpair_pair_fst, unpair_pair_snd] - simp_all + simp_all only [le_add_iff_nonneg_left, zero_le, Nat.sub_eq_zero_of_le, Nat.add_mod_right, + Nat.mul_mod_right, Nat.mul_add_mod_self_left, Nat.mod_succ, zero_lt_two, Nat.add_div_right, + ne_eq, OfNat.ofNat_ne_zero, not_false_eq_true, mul_div_cancel_left₀, selectFn_one, + add_tsub_cancel_right, selectFn_zero] theorem dsharpStep_nn (a b tbl : ℕ) : dsharpStep fcons feq finter (Nat.pair (Nat.pair (2 * a + 2) (2 * b + 2)) tbl) @@ -567,7 +575,9 @@ theorem dsharpStep_nn (a b tbl : ℕ) : 2) - 1 - Nat.pair a.unpair.2 b.unpair.2))) + 2) := by simp only [dsharpStep, unpair_pair_fst, unpair_pair_snd] - simp_all + simp_all only [le_add_iff_nonneg_left, zero_le, Nat.sub_eq_zero_of_le, Nat.add_mod_right, + Nat.mul_mod_right, zero_lt_two, Nat.add_div_right, ne_eq, OfNat.ofNat_ne_zero, + not_false_eq_true, mul_div_cancel_left₀, selectFn_zero, add_tsub_cancel_right] /-- The decider step is primitive recursive when the `D`-level functions are. -/ theorem primrec_dsharpStep (hfcons : Nat.Primrec fcons) (hfeq : Nat.Primrec feq) diff --git a/LeanPool/DomainTheory/Neighborhood/Recursive.lean b/LeanPool/DomainTheory/Neighborhood/Recursive.lean index a0d58c39d8..9865c3ff31 100644 --- a/LeanPool/DomainTheory/Neighborhood/Recursive.lean +++ b/LeanPool/DomainTheory/Neighborhood/Recursive.lean @@ -188,7 +188,7 @@ choice-free `sqrt`. -/ /-- **`unpair ∘ pair = id` (choice-free).** Mirrors `Nat.unpair_pair`. -/ theorem unpair_pair (a b : ℕ) : Nat.unpair (Nat.pair a b) = (a, b) := by - simp_all + simp_all only [Nat.unpair_pair] /-- First projection of the pairing round-trip. -/ theorem unpair_pair_fst (a b : ℕ) : (Nat.pair a b).unpair.1 = a := by rw [unpair_pair] @@ -205,7 +205,7 @@ theorem sqrt_le_add (n : ℕ) : n ≤ Nat.sqrt n * Nat.sqrt n + Nat.sqrt n + Nat /-- **`pair ∘ unpair = id` (choice-free).** Mirrors `Nat.pair_unpair`. -/ theorem pair_unpair (n : ℕ) : Nat.pair (Nat.unpair n).1 (Nat.unpair n).2 = n := by - simp_all + simp_all only [Nat.pair_unpair] /-! ## Choice-free primitive-recursive arithmetic @@ -319,9 +319,11 @@ theorem primrec_sub₂ {f g : ℕ → ℕ} (hf : Nat.Primrec f) (hg : Nat.Primre (for a `{0,1}`-valued `c`), via `c * a + (1 - c) * b`. -/ def selectFn (c a b : ℕ) : ℕ := c * a + (1 - c) * b -@[simp] theorem selectFn_one (a b : ℕ) : selectFn 1 a b = a := by simp [selectFn] +@[simp] theorem selectFn_one (a b : ℕ) : selectFn 1 a b = a := by simp only [selectFn, one_mul, + Nat.sub_self, zero_mul, add_zero] -@[simp] theorem selectFn_zero (a b : ℕ) : selectFn 0 a b = b := by simp [selectFn] +@[simp] theorem selectFn_zero (a b : ℕ) : selectFn 0 a b = b := by simp only [selectFn, + zero_mul, tsub_zero, one_mul, zero_add] /-- `selectFn` of primitive-recursive `c, a, b` is primitive recursive. -/ theorem primrec_selectFn {c a b : ℕ → ℕ} (hc : Nat.Primrec c) (ha : Nat.Primrec a) @@ -448,7 +450,7 @@ theorem RecDecidable.or {p q : ℕ → Prop} (hp : RecDecidable p) (hq : RecDeci · intro h rcases hp.em n with hp' | hp' · exact Or.inl hp' - · simp_all + · simp_all only [not_false_eq_true, true_and, not_not, or_true] /-! ## "Recursively enumerable" predicates (Scott's notion, Definition 7.2) @@ -486,7 +488,7 @@ variable `i`); the witness `i = 0` makes the projection trivial. -/ theorem RecDecidable.re {p : ℕ → Prop} (hp : RecDecidable p) : REPred p := by refine ⟨fun t => p t.unpair.2, hp.comp Nat.Primrec.right, fun n => ?_⟩ - simp_all + simp_all only [Nat.unpair_pair, exists_const] /-- A recursively decidable binary relation is recursively enumerable. -/ theorem RecDecidable₂.re {r : ℕ → ℕ → Prop} (hr : RecDecidable₂ r) : REPred₂ r := @@ -521,7 +523,7 @@ theorem REPred.comp {p : ℕ → Prop} (hp : REPred p) {g : ℕ → ℕ} (hg : N obtain ⟨q, hq, hqe⟩ := hp refine ⟨fun t => q (Nat.pair t.unpair.1 (g t.unpair.2)), hq.comp (Nat.Primrec.left.pair (hg.comp Nat.Primrec.right)), fun n => ?_⟩ - simp_all + simp_all only [Nat.unpair_pair] /-- **Conjunction.** Recursive enumerability is closed under `∧`: combine the two decidable @@ -673,7 +675,8 @@ theorem foldStep_pos (stp : ℕ → ℕ) (params a t acc : ℕ) : foldStep stp params (Nat.pair (Nat.pair a t + 1) acc) = Nat.pair t (stp (Nat.pair a (Nat.pair acc params))) := by unfold foldStep - simp_all + simp_all only [Nat.unpair_pair, le_add_iff_nonneg_left, zero_le, Nat.sub_eq_zero_of_le, + add_tsub_cancel_right, selectFn_zero] /-- Fold the list coded by `c`, threading accumulator `z` and parameter `params`. Implemented as @@ -1191,7 +1194,9 @@ theorem REPred.forall_mem_decodeList {p : ℕ → Prop} (hp : REPred p) : refine ⟨j :: iws, fun k hk => ?_⟩ rcases k with _ | k' · rw [List.getD_cons_zero, List.getD_cons_zero]; exact hj - · simp_all + · simp_all only [implies_true, List.getD_eq_getElem?_getD, List.mem_cons, or_true, + getElem?_pos, Option.getD_some, forall_const, forall_eq_or_imp, List.length_cons, + add_lt_add_iff_right, List.getElem?_cons_succ, List.getElem_cons_succ] obtain ⟨iws, hiws⟩ := hwit (decodeList c) (fun e he => (hpe e).mp (hall e he)) refine ⟨encodeList iws, (reForallChar_eq_one_iff qc _ c).mpr (fun k hk => ?_)⟩ rw [decodeList_encodeList]; exact hiws k hk @@ -1235,7 +1240,7 @@ theorem decodeList_foldl_mapPairStp (n : ℕ) (el : List ℕ) (acc : ℕ) : decodeList (List.foldl (fun acc x => mapPairStp (Nat.pair x (Nat.pair acc n))) acc el) = (el.map (Nat.pair n ·)).reverse ++ decodeList acc := by induction el generalizing acc with - | nil => simp + | nil => simp only [List.foldl_nil, List.map_nil, List.reverse_nil, List.nil_append] | cons e el ih => rw [List.foldl_cons, ih, mapPairStp_eq, decodeList_mapPairStep, List.map_cons, List.reverse_cons, List.append_assoc, List.singleton_append] @@ -1275,6 +1280,7 @@ theorem REPred.forall_mem_decodeList₂ {p : ℕ → ℕ → Prop} (hp : REPred hp'.forall_mem_decodeList refine REPred.of_iff (fun t => ?_) (hbase.comp primrec_mapPairCode) rw [decodeList_mapPairCode] - simp_all + simp_all only [List.mem_reverse, List.mem_map, forall_exists_index, and_imp, + forall_apply_eq_imp_iff₂, Nat.unpair_pair] end Domain.Recursive diff --git a/LeanPool/DomainTheory/Neighborhood/Table55.lean b/LeanPool/DomainTheory/Neighborhood/Table55.lean index 51724cccc9..9da66dea31 100644 --- a/LeanPool/DomainTheory/Neighborhood/Table55.lean +++ b/LeanPool/DomainTheory/Neighborhood/Table55.lean @@ -6,12 +6,6 @@ Authors: Catskills Research Company module public import LeanPool.DomainTheory.Neighborhood.Theorem41 -import Mathlib.Data.Finset.Attr -import Mathlib.Data.Rat.Cast.Order -import Mathlib.Tactic.NormNum.Abs -import Mathlib.Tactic.NormNum.DivMod -import Mathlib.Tactic.NormNum.OfScientific -import Mathlib.Tactic.NormNum.Pow /-! # Lecture V (§5) — Table 5.5: a table of combinators diff --git a/LeanPool/DomainTheory/Neighborhood/Theorem110.lean b/LeanPool/DomainTheory/Neighborhood/Theorem110.lean index 768ea483f5..5d008786fe 100644 --- a/LeanPool/DomainTheory/Neighborhood/Theorem110.lean +++ b/LeanPool/DomainTheory/Neighborhood/Theorem110.lean @@ -6,7 +6,6 @@ Authors: Catskills Research Company module public import LeanPool.DomainTheory.Neighborhood.Basic -import Mathlib.Data.Set.Basic /-! # Theorem 1.10 (Scott 1981, PRG-19, §1) — the element-token system `{[X]}` diff --git a/LeanPool/DomainTheory/Neighborhood/Theorem41.lean b/LeanPool/DomainTheory/Neighborhood/Theorem41.lean index 34e31289e0..c29b4b79f5 100644 --- a/LeanPool/DomainTheory/Neighborhood/Theorem41.lean +++ b/LeanPool/DomainTheory/Neighborhood/Theorem41.lean @@ -6,13 +6,6 @@ Authors: Catskills Research Company module public import LeanPool.DomainTheory.Neighborhood.FunctionSpace -public import Mathlib.Tactic.ToAdditive -import Mathlib.Data.Finset.Attr -import Mathlib.Data.Rat.Cast.Order -import Mathlib.Tactic.NormNum.Abs -import Mathlib.Tactic.NormNum.DivMod -import Mathlib.Tactic.NormNum.OfScientific -import Mathlib.Tactic.NormNum.Pow /-! # Lecture IV (§4) — fixed points and recursion: Theorems 4.1 and 4.2 diff --git a/LeanPool/DomainTheory/Neighborhood/Theorem51.lean b/LeanPool/DomainTheory/Neighborhood/Theorem51.lean index ce1471d368..7bac9e0555 100644 --- a/LeanPool/DomainTheory/Neighborhood/Theorem51.lean +++ b/LeanPool/DomainTheory/Neighborhood/Theorem51.lean @@ -6,12 +6,6 @@ Authors: Catskills Research Company module public import LeanPool.DomainTheory.Neighborhood.FunctionSpace -import Mathlib.Data.Finset.Attr -import Mathlib.Data.Rat.Cast.Order -import Mathlib.Tactic.NormNum.Abs -import Mathlib.Tactic.NormNum.DivMod -import Mathlib.Tactic.NormNum.OfScientific -import Mathlib.Tactic.NormNum.Pow /-! # Lecture V (§5) — Theorem 5.1 (Scott 1981, PRG-19) diff --git a/LeanPool/DomainTheory/Neighborhood/Theorem52.lean b/LeanPool/DomainTheory/Neighborhood/Theorem52.lean index e81093d9bf..951194f676 100644 --- a/LeanPool/DomainTheory/Neighborhood/Theorem52.lean +++ b/LeanPool/DomainTheory/Neighborhood/Theorem52.lean @@ -6,12 +6,6 @@ Authors: Catskills Research Company module public import LeanPool.DomainTheory.Neighborhood.FunctionSpace -import Mathlib.Data.Finset.Attr -import Mathlib.Data.Rat.Cast.Order -import Mathlib.Tactic.NormNum.Abs -import Mathlib.Tactic.NormNum.DivMod -import Mathlib.Tactic.NormNum.OfScientific -import Mathlib.Tactic.NormNum.Pow /-! # Lecture V (§5) — Theorem 5.2 (Scott 1981, PRG-19) diff --git a/LeanPool/DomainTheory/Neighborhood/Theorem56.lean b/LeanPool/DomainTheory/Neighborhood/Theorem56.lean index 95915c72ec..1208f36ee8 100644 --- a/LeanPool/DomainTheory/Neighborhood/Theorem56.lean +++ b/LeanPool/DomainTheory/Neighborhood/Theorem56.lean @@ -8,12 +8,6 @@ module public import LeanPool.DomainTheory.Neighborhood.Example43 public import LeanPool.DomainTheory.Neighborhood.Exercise326 public import LeanPool.DomainTheory.Neighborhood.Theorem41 -import Mathlib.Data.Finset.Attr -import Mathlib.Data.Rat.Cast.Order -import Mathlib.Tactic.NormNum.Abs -import Mathlib.Tactic.NormNum.DivMod -import Mathlib.Tactic.NormNum.OfScientific -import Mathlib.Tactic.NormNum.Pow /-! # Theorem 5.6 (Scott 1981, PRG-19, §5) — recursive functions are λ-definable @@ -347,7 +341,7 @@ theorem muMap_eq_least {m n₀ : ℕ} (hpos : ∀ i < n₀, ∃ j, f.toElementMap (pair (natElem i) (natElem m)) = natElem (j + 1)) : (muMap f).toElementMap (natElem m) = natElem n₀ := by rw [muMap_natElem] - have hclimb := muRec_climb f m n₀ 0 (by simpa using hpos) + have hclimb := muRec_climb f m n₀ 0 (by simpa only [Nat.zero_add] using hpos) rw [show (zeroElt : N.Element) = natElem 0 from rfl, hclimb, Nat.zero_add] exact muRec_found f hzero diff --git a/LeanPool/DomainTheory/Neighborhood/Theorem56Full.lean b/LeanPool/DomainTheory/Neighborhood/Theorem56Full.lean index 0c1b34ec94..ed8efbe194 100644 --- a/LeanPool/DomainTheory/Neighborhood/Theorem56Full.lean +++ b/LeanPool/DomainTheory/Neighborhood/Theorem56Full.lean @@ -9,11 +9,6 @@ public import LeanPool.DomainTheory.Neighborhood.Example43 public import LeanPool.DomainTheory.Neighborhood.Exercise326 public import LeanPool.DomainTheory.Neighborhood.Exercise511 public import Mathlib.Computability.PartrecBasis -import Mathlib.Data.Rat.Cast.Order -import Mathlib.Tactic.NormNum.Abs -import Mathlib.Tactic.NormNum.DivMod -import Mathlib.Tactic.NormNum.OfScientific -import Mathlib.Tactic.NormNum.Pow /-! # Theorem 5.6 (Scott 1981, PRG-19, §5) — the FULL closure: partial recursive ⟹ @@ -214,7 +209,8 @@ theorem component_tupleMap : ∀ (n : ℕ) (gs : Fin n → ApproximableMap 𝒩 | 0, _, _, i, hi => absurd hi (Nat.not_lt_zero i) | n + 1, gs, z, 0, hi => by rw [tupleMap_succ, toElementMap_comp, toElementMap_paired, component_push_zero] - exact congrArg (fun w => (gs w).toElementMap z) (Fin.ext (by simp)) + exact congrArg (fun w => (gs w).toElementMap z) (Fin.ext (by simp only [ + Fin.coe_ofNat_eq_mod, Nat.zero_mod])) | n + 1, gs, z, i + 1, hi => by rw [tupleMap_succ, toElementMap_comp, toElementMap_paired, component_push_succ, component_tupleMap n (fun j => gs j.succ) z i (Nat.lt_of_succ_lt_succ hi)] @@ -280,9 +276,9 @@ theorem lamDef_zero : LamDef (strictGuardN 0 (constMap 𝒩 (natElem 0))) theorem lamDef_succ : LamDef (strictGuardN 1 (succMap.comp (projN N 0))) ((fun v => Nat.succ v.head : List.Vector ℕ 1 → ℕ) : List.Vector ℕ 1 →. ℕ) := lamDef_total _ _ (fun v => by - rw [toElementMap_comp, toElementMap_projN, component_vecElem_lt v (by norm_num), + rw [toElementMap_comp, toElementMap_projN, component_vecElem_lt v (by decide), succMap_natElem] - simp_all) + simp_all only [Fin.zero_eta, Fin.isValue, List.Vector.get_zero, Nat.succ_eq_add_one]) /-- `get i : Vector ℕ n → ℕ`, the `i`-th projection. -/ theorem lamDef_get {n : ℕ} (i : Fin n) : @@ -376,8 +372,8 @@ theorem mem_mOfFn : ∀ {n : ℕ} (p : Fin n → Part ℕ) (w : List.Vector ℕ have hu' := (mem_mOfFn (fun i => p i.succ) u).mp hu intro i refine Fin.cases ?_ ?_ i - · simpa using ha - · intro k; simpa using hu' k + · simpa only [List.Vector.get_zero, List.Vector.head_cons] using ha + · intro k; simpa only [List.Vector.get_cons_succ] using hu' k · intro hall refine ⟨w.head, ?_, ?_⟩ · have := hall 0; rwa [List.Vector.get_zero] at this @@ -813,7 +809,8 @@ theorem lamDef_rfind {n : ℕ} {f : List.Vector ℕ (n + 1) → ℕ} · intro v hv rw [findMap_vecElem] have hdiv : ∀ k, f (k ::ᵥ v) ≠ 0 := by - simp_all + simp_all only [Nat.rfind_dom, Part.mem_some_iff, true_eq_decide_iff, Part.some_dom, + implies_true, and_true, not_exists, ne_eq, not_false_eq_true] exact searchMap_diverge φf hf v hdiv 0 end Rfind diff --git a/LeanPool/DomainTheory/Neighborhood/Theorem614.lean b/LeanPool/DomainTheory/Neighborhood/Theorem614.lean index 182ff720d1..3508441ffa 100644 --- a/LeanPool/DomainTheory/Neighborhood/Theorem614.lean +++ b/LeanPool/DomainTheory/Neighborhood/Theorem614.lean @@ -286,7 +286,8 @@ theorem Tcolim_sub_colim (s : Setup.{w}) {X : Set s.Tok} (hX : (Tcolim s).mem X) exact ⟨Dsys s (max n m), ⟨max n m, rfl⟩, chain_le s (le_max_left n m), chain_le s (le_max_right n m)⟩ have hU : ∀ Y, (colim s).mem Y ↔ ∃ D ∈ ℱ, D.mem Y := by - simp_all + simp_all only [Set.mem_range, forall_exists_index, forall_apply_eq_imp_iff, mem_colim, + exists_exists_eq_and, implies_true] have heq := hC ℱ hℱ hne hdir (Subsystem.refl (colim s)) hU set Y₀ : Set (s.T.obj ⟨s.Tok, colim s⟩).carrier := (colimCeq s).symm ▸ X with hY₀ -- `X ∈ T(𝒟)` says `Y₀ ∈ targetFam (refl 𝒟)` = the neighbourhood family of @@ -305,7 +306,8 @@ theorem Tcolim_sub_colim (s : Setup.{w}) {X : Set s.Tok} (hX : (Tcolim s).mem X) have key : ((Dceq s n).symm ▸ X : Set (s.T.obj ⟨s.Tok, Dsys s n⟩).carrier) = (s.hmono (hℱ ⟨n, rfl⟩)).carrier_eq ▸ Y₀ := by rw [hY₀, set_rec_trans] - simp_all + simp_all only [mem_colim, Set.mem_range, exists_exists_eq_and, implies_true, + Set.iUnion_exists] /-- **`T(𝒟) = 𝒟`** (Scott's `𝒟 = T(𝒟)`): the two systems have the same neighbourhoods (mutual @@ -502,7 +504,7 @@ theorem map_comp_proj_heq {Tok : Type w} {Pc Qc : Type w} (cn : Pc = Tok) (cc : subst cc obtain rfl := hDn1 obtain rfl := hCol - simp_all + simp_all only [heq_eq_eq] /-- **`T(ρₙ) = ρₙ₊₁`, heterogeneously.** The image `T(ρₙ)` of the `n`-th projection, living over diff --git a/LeanPool/DomainTheory/Neighborhood/Theorem616.lean b/LeanPool/DomainTheory/Neighborhood/Theorem616.lean index 6a770c1dbe..a8eca34678 100644 --- a/LeanPool/DomainTheory/Neighborhood/Theorem616.lean +++ b/LeanPool/DomainTheory/Neighborhood/Theorem616.lean @@ -9,12 +9,8 @@ public import LeanPool.DomainTheory.Neighborhood.Theorem69 public import LeanPool.DomainTheory.Neighborhood.Lemma615 import LeanPool.DomainTheory.Neighborhood.Exercise408 import LeanPool.DomainTheory.Neighborhood.Proposition67 -import Mathlib.Data.Finset.Attr -import Mathlib.Data.Rat.Cast.Order -import Mathlib.Tactic.NormNum.Abs -import Mathlib.Tactic.NormNum.DivMod -import Mathlib.Tactic.NormNum.OfScientific -import Mathlib.Tactic.NormNum.Pow + +import Mathlib.Tactic.Set -- shake: keep /-! # Lecture VI — Theorem 6.16 (Scott 1981, PRG-19): an initial algebra embeds in @@ -217,7 +213,7 @@ theorem trianglelefteq_of_isInitial change (toStrictMap (Opk.iterElem 0)).1.rel P Q ↔ _ rw [iterElem_zero]; exact botStrict_rel constructor - · simp_all + · simp_all only [Subtype.forall, comp_rel, ↓existsAndEq, and_true, and_self, implies_true] · intro hK rw [hK0] at hK obtain ⟨hEX, rfl⟩ := hK diff --git a/LeanPool/DomainTheory/Neighborhood/Theorem69.lean b/LeanPool/DomainTheory/Neighborhood/Theorem69.lean index bf31a1fbe7..b6519ffa48 100644 --- a/LeanPool/DomainTheory/Neighborhood/Theorem69.lean +++ b/LeanPool/DomainTheory/Neighborhood/Theorem69.lean @@ -7,12 +7,8 @@ module public import LeanPool.DomainTheory.Neighborhood.Definition68 import LeanPool.DomainTheory.Neighborhood.Theorem41 -import Mathlib.Data.Finset.Attr -import Mathlib.Data.Rat.Cast.Order -import Mathlib.Tactic.NormNum.Abs -import Mathlib.Tactic.NormNum.DivMod -import Mathlib.Tactic.NormNum.OfScientific -import Mathlib.Tactic.NormNum.Pow + +import Mathlib.Tactic.Set -- shake: keep /-! # Lecture VI — Theorem 6.9 (Scott 1981, PRG-19): homomorphisms out of a fixed @@ -231,10 +227,10 @@ theorem homOp_apply_filter (g : StrictMap (T.obj D).sys (T.obj E).sys) : = homOpComp T D E j k hj hk g := by apply Subtype.ext apply ApproximableMap.ext - simp_all + simp_all only [mem_toElementMap, mem_toStrictFilter, toStrictMap_rel, implies_true] have hL := toStrictFilter_toStrictMap ((homOp T D E j k hj hk).toElementMap (toStrictFilter g)) - simp_all + simp_all only [mem_toElementMap, mem_toStrictFilter] end HomOp diff --git a/LeanPool/DomainTheory/Neighborhood/Theorem74.lean b/LeanPool/DomainTheory/Neighborhood/Theorem74.lean index 9aceb55ada..05546e03c3 100644 --- a/LeanPool/DomainTheory/Neighborhood/Theorem74.lean +++ b/LeanPool/DomainTheory/Neighborhood/Theorem74.lean @@ -110,7 +110,8 @@ def prodPresentation (P₀ : ComputablePresentation V₀) (P₁ : ComputablePres ((Nat.Primrec.right.comp (Nat.Primrec.left.comp Nat.Primrec.right)).pair (Nat.Primrec.right.comp (Nat.Primrec.right.comp Nat.Primrec.right))) refine RecDecidable.of_iff (fun t => ?_) ((hIE0.comp hg0).and (hIE1.comp hg1)) - simp only [prodEnum_apply, unpair_pair_fst, unpair_pair_snd, prodNbhd_inter, prodNbhd_eq_iff] + simp only [prodEnum_apply, unpair_pair_fst, unpair_pair_snd, prodNbhd_inter, + prodNbhd_eq_iff] cons_computable := by have hC0 : RecDecidable (fun s => ∃ k, P₀.X k ⊆ P₀.X s.unpair.1 ∩ P₀.X s.unpair.2) := P₀.cons_computable @@ -173,7 +174,8 @@ theorem proj₀_isComputable (P₀ : ComputablePresentation V₀) (P₁ : Comput have hr : Nat.Primrec (fun t => Nat.pair t.unpair.1.unpair.1 t.unpair.2) := (Nat.Primrec.left.comp Nat.Primrec.left).pair Nat.Primrec.right refine (RecDecidable.of_iff (fun t => ?_) (hincl.comp hr)).re - simp only [prodPresentation_X, proj₀_rel, inl_preimage_prodNbhd, unpair_pair_fst, unpair_pair_snd] + simp only [prodPresentation_X, proj₀_rel, inl_preimage_prodNbhd, unpair_pair_fst, + unpair_pair_snd] exact ⟨fun h => h.2.2, fun h => ⟨prod_mem_prodNbhd (P₀.mem_X _) (P₁.mem_X _), P₀.mem_X _, h⟩⟩ @@ -186,7 +188,8 @@ theorem proj₁_isComputable (P₀ : ComputablePresentation V₀) (P₁ : Comput have hr : Nat.Primrec (fun t => Nat.pair t.unpair.1.unpair.2 t.unpair.2) := (Nat.Primrec.right.comp Nat.Primrec.left).pair Nat.Primrec.right refine (RecDecidable.of_iff (fun t => ?_) (hincl.comp hr)).re - simp only [prodPresentation_X, proj₁_rel, inr_preimage_prodNbhd, unpair_pair_fst, unpair_pair_snd] + simp only [prodPresentation_X, proj₁_rel, inr_preimage_prodNbhd, unpair_pair_fst, + unpair_pair_snd] exact ⟨fun h => h.2.2, fun h => ⟨prod_mem_prodNbhd (P₀.mem_X _) (P₁.mem_X _), P₁.mem_X _, h⟩⟩ diff --git a/LeanPool/DomainTheory/Neighborhood/Theorem75.lean b/LeanPool/DomainTheory/Neighborhood/Theorem75.lean index 1ad2b683b2..cf191dd1f0 100644 --- a/LeanPool/DomainTheory/Neighborhood/Theorem75.lean +++ b/LeanPool/DomainTheory/Neighborhood/Theorem75.lean @@ -7,11 +7,7 @@ module public import LeanPool.DomainTheory.Neighborhood.FunctionSpace public import LeanPool.DomainTheory.Neighborhood.Theorem74 -import Mathlib.Data.Rat.Cast.Order -import Mathlib.Tactic.NormNum.Abs -import Mathlib.Tactic.NormNum.DivMod -import Mathlib.Tactic.NormNum.OfScientific -import Mathlib.Tactic.NormNum.Pow +import Mathlib.Order.ConditionallyCompleteLattice.Basic /-! # Theorem 7.5 (Scott 1981, PRG-19, §7) — `(𝒟₀ → 𝒟₁)` is effectively given @@ -87,8 +83,8 @@ theorem mem_interList {base : Set β} {M : List (Set β)} {z : β} : rw [interList_cons] simp only [Set.mem_inter_iff, ih, List.mem_cons] constructor - · simp_all - · simp_all + · simp_all only [forall_eq_or_imp, implies_true, and_self] + · simp_all only [forall_eq_or_imp, implies_true, and_self] theorem interList_subset_base {base : Set β} {M : List (Set β)} : interList base M ⊆ base := fun _ hz => (mem_interList.mp hz).1 @@ -199,7 +195,8 @@ theorem stepFun_funListOf_nonempty_iff (el : List ℕ) : obtain ⟨Z, hZ, hZle⟩ := hcons have hsub' : (sub.map (funPair P₀ P₁)).Sublist (funListOf P₀ P₁ el) := hsub.map _ have hZle' : ∀ p ∈ sub.map (funPair P₀ P₁), Z ⊆ p.1 := by - simp_all + simp_all only [List.mem_map, forall_exists_index, and_imp, forall_apply_eq_imp_iff₂, + funPair_fst, implies_true] have hres := interList_mem_of_stepFun_nonempty h hsub' hZ hZle' have hlist : (sub.map (funPair P₀ P₁)).map Prod.snd = sub.map (fun e => P₁.X e.unpair.2) := by rw [List.map_map]; rfl @@ -215,11 +212,12 @@ theorem stepFun_funListOf_nonempty_iff (el : List ℕ) : let : DecidablePred (fun e : ℕ => X' ⊆ P₀.X e.unpair.1) := fun e => decidable_of_iff (finc (Nat.pair nx e.unpair.1) = 1) (by have h := hfinc (Nat.pair nx e.unpair.1) - simp_all) + simp_all only [forall_exists_index, and_imp, Prod.forall, Nat.unpair_pair]) set sub : List ℕ := el.filter (fun e => decide (X' ⊆ P₀.X e.unpair.1)) with hsubdef have hsub : sub.Sublist el := List.filter_sublist have hmem_iff : ∀ e, e ∈ sub ↔ e ∈ el ∧ X' ⊆ P₀.X e.unpair.1 := by - simp_all + simp_all only [forall_exists_index, and_imp, Prod.forall, List.filter_sublist, + List.mem_filter, decide_eq_true_eq, implies_true] have heq : interYs V₁.master (funListOf P₀ P₁ el) X' = interList V₁.master (sub.map (fun e => P₁.X e.unpair.2)) := by apply Set.ext; intro z @@ -242,7 +240,8 @@ theorem stepFun_funListOf_nonempty_iff (el : List ℕ) : exact hall (P₁.X e.unpair.2) (List.mem_map.mpr ⟨e, hesub, rfl⟩) rw [heq] refine hcond sub hsub ⟨X', hX', ?_⟩ - simp_all + simp_all only [forall_exists_index, and_imp, Prod.forall, List.filter_sublist, + List.mem_filter, decide_eq_true_eq, implies_true] exact ⟨leastMap (funListOf P₀ P₁ el) hcons, leastMap_mem_stepFun hL hcons⟩ /-! ### Milestone 3a — deciding consistency of a finite index set via the @@ -286,8 +285,8 @@ theorem mem_interFrom {A : Set α} {js : List ℕ} {z : α} : rw [interFrom, ih] simp only [Set.mem_inter_iff, List.mem_cons] constructor - · simp_all - · simp_all + · simp_all only [forall_eq_or_imp, implies_true, and_self] + · simp_all only [forall_eq_or_imp, and_self, implies_true] theorem interFrom_subset {A : Set α} {js : List ℕ} : interFrom P A js ⊆ A := fun _ hz => (mem_interFrom P |>.mp hz).1 @@ -298,7 +297,7 @@ theorem interFrom_mem_of_witness {A : Set α} {js : List ℕ} {Z : Set α} (hZ : V.mem Z) (hZsub : Z ⊆ interFrom P A js) (hA : V.mem A) : V.mem (interFrom P A js) := by induction js generalizing A with - | nil => simpa [interFrom] using hA + | nil => simpa only [interFrom] using hA | cons j js ih => rw [interFrom] at hZsub ⊢ have hAXj : V.mem (A ∩ P.X j) := @@ -313,7 +312,7 @@ each prefix is too, by theorem interFrom_eq_of_foldl : ∀ (js : List ℕ) (A : Set α) (a : ℕ), P.X a = A → V.mem A → V.mem (interFrom P A js) → P.X (js.foldl (fun acc j => P.inter acc j) a) = interFrom P A js - | [], A, a, hXa, _, _ => by simpa [interFrom] using hXa + | [], A, a, hXa, _, _ => by simpa only [List.foldl_nil, interFrom] using hXa | j :: js, A, a, hXa, hA, hmem => by have hmem' : V.mem (interFrom P (A ∩ P.X j) js) := by rwa [interFrom] at hmem have hAXj : V.mem (A ∩ P.X j) := @@ -381,7 +380,7 @@ theorem bitSelect_cons (e : ℕ) (L : List ℕ) (b : ℕ) : theorem bitSelect_sublist (L : List ℕ) (b : ℕ) : (bitSelect L b).Sublist L := by induction L generalizing b with - | nil => simp + | nil => simp only [bitSelect_nil, List.Sublist.refl] | cons e L ih => rw [bitSelect_cons] split @@ -472,8 +471,8 @@ theorem consUpd_foldl_flag_zero (projFn fc : ℕ → ℕ) (el : List ℕ) (b a : | cons e el ih => rw [List.foldl_cons, consUpd_eval] by_cases hb : b % 2 = 1 - · simp_all - · simp_all + · simp_all only [selectFn_zero, selectFn_one] + · simp_all only [Nat.mod_two_not_eq_one, selectFn_zero] /-- **Single-pass consistency fold — correctness.** Starting from index `a` (an index of `X a`) with @@ -615,7 +614,7 @@ theorem interList_X_eq_interFrom {V : NeighborhoodSystem α} (P : ComputablePres (js : List ℕ) : interList V.master (js.map (fun j => P.X j)) = interFrom P V.master js := by apply Set.ext; intro z rw [mem_interList, mem_interFrom] - simp_all + simp_all only [List.mem_map, forall_exists_index, and_imp, forall_apply_eq_imp_iff₂] /-- The antecedent of Prop 3.9(i) — `{X_{e.1} ∣ e ∈ sub}` admits a common lower neighbourhood — is @@ -730,7 +729,7 @@ theorem decodeList_foldl_appendStp (el : List ℕ) (acc : ℕ) : decodeList (List.foldl (fun acc x => appendStp (Nat.pair x (Nat.pair acc 0))) acc el) = el.reverse ++ decodeList acc := by induction el generalizing acc with - | nil => simp + | nil => simp only [List.foldl_nil, List.reverse_nil, List.nil_append] | cons e el ih => rw [List.foldl_cons, ih, appendStp_eq, decodeList_appendStep, List.reverse_cons, List.append_assoc, List.singleton_append] @@ -751,7 +750,7 @@ theorem primrec_appendCode : Nat.Primrec (fun t => appendCode t.unpair.1 t.unpai theorem funListOf_append (la lb : List ℕ) : funListOf P₀ P₁ (la ++ lb) = funListOf P₀ P₁ la ++ funListOf P₀ P₁ lb := by - simp [funListOf, List.map_append] + simp only [funListOf, List.map_append] /-- `stepFun (funListOf (decodeList (appendCode a b)))` is exactly `X a ∩ X b` at the level of the @@ -813,11 +812,15 @@ theorem rel_interYs_funList {f : ApproximableMap V₀ V₁} {el : List ℕ} f.mono hp hinc subset_rfl (P₀.mem_X n') (f.rel_cod hp) have heq : interYs V₁.master (funPair P₀ P₁ e :: funListOf P₀ P₁ el) (P₀.X n') = P₁.X e.unpair.2 ∩ interYs V₁.master (funListOf P₀ P₁ el) (P₀.X n') := by - rw [interYs_cons]; simp_all + rw [interYs_cons]; simp_all only [imp_self, mem_stepFun, List.mem_cons, + forall_eq_or_imp, funPair_fst, funPair_snd, Prod.forall, true_and, Prod.mk.eta, + implies_true, forall_const, Set.ofPred_mem_eq] rw [heq]; exact f.inter_right hXp2 htail · have heq : interYs V₁.master (funPair P₀ P₁ e :: funListOf P₀ P₁ el) (P₀.X n') = interYs V₁.master (funListOf P₀ P₁ el) (P₀.X n') := by - rw [interYs_cons]; simp_all + rw [interYs_cons]; simp_all only [imp_self, mem_stepFun, List.mem_cons, + forall_eq_or_imp, funPair_fst, funPair_snd, Prod.forall, Prod.mk.eta, implies_true, + IsEmpty.forall_iff, Set.ofPred_true, Set.univ_inter] rw [heq]; exact htail /-- If `stepFun (funListOf ea)` is non-empty, then `interYs Δ₁ (funListOf ea) X` @@ -913,7 +916,8 @@ theorem mem_condSet {k : ℕ} {A : Set β} {el : List ℕ} {z : β} : Iff.rfl theorem condSet_nil (k : ℕ) (A : Set β) : condSet P₀ P₁ k A [] = A := by - ext z; simp [condSet] + ext z; simp only [condSet, List.not_mem_nil, IsEmpty.forall_iff, implies_true, and_true, + Set.ofPred_mem_eq] theorem condSet_subset (k : ℕ) (A : Set β) (el : List ℕ) : condSet P₀ P₁ k A el ⊆ A := fun _ hz => hz.1 @@ -927,8 +931,8 @@ theorem condSet_cons_pos {k : ℕ} {A : Set β} {e : ℕ} {el : List ℕ} ext z simp only [mem_condSet, List.mem_cons, Set.mem_inter_iff] constructor - · simp_all - · simp_all + · simp_all only [forall_eq_or_imp, forall_const, and_self, implies_true] + · simp_all only [forall_eq_or_imp, imp_self, implies_true, and_self] /-- `condSet` cons-step when the input does not dominate the head entry's input: drop the head. -/ @@ -937,7 +941,7 @@ theorem condSet_cons_neg {k : ℕ} {A : Set β} {e : ℕ} {el : List ℕ} condSet P₀ P₁ k A (e :: el) = condSet P₀ P₁ k A el := by ext z simp only [mem_condSet, List.mem_cons] - simp_all + simp_all only [forall_eq_or_imp, IsEmpty.forall_iff, true_and] /-- `condSet k Δ₁ el` is exactly `interYs Δ₁ (funListOf el) (X₀_k)`. -/ theorem condSet_eq_interYs (k : ℕ) (el : List ℕ) : @@ -986,7 +990,7 @@ theorem condFoldl_spec (incl0 : ℕ → ℕ) by_cases hpred : incl0 (Nat.pair k e.unpair.1) = 1 · rw [ite_eq_left hpred] have hincl : P₀.X k ⊆ P₀.X e.unpair.1 := by - simp_all + simp_all only [Nat.unpair_pair] rw [condSet_cons_pos P₀ P₁ hincl] at hcons ⊢ have hwit : V₁.mem (A ∩ P₁.X e.unpair.2) := V₁.inter_mem hA (P₁.mem_X _) hcons (condSet_subset P₀ P₁ k (A ∩ P₁.X e.unpair.2) el) @@ -1064,8 +1068,8 @@ component presentations' consistency chars `fc0`/`fc1`, and prove its spec via theorem selectFn_one_iff_imp {A B : ℕ} (hA : A ≤ 1) : selectFn A B 1 = 1 ↔ (A = 1 → B = 1) := by rcases (show A = 0 ∨ A = 1 by omega) with h | h <;> subst h - · rw [selectFn_zero]; simp - · rw [selectFn_one]; simp + · rw [selectFn_zero]; simp only [zero_ne_one, IsEmpty.forall_iff] + · rw [selectFn_one]; simp only [forall_const] /-- The per-bitmask implication char: `cons₀(selected inputs) → cons₁(selected outputs)`. -/ @@ -1132,11 +1136,11 @@ theorem andFoldl_eq_one_iff (g : ℕ → ℕ) : rcases (show a = 0 ∨ a = 1 by omega) with h | h <;> subst h · rw [selectFn_zero]; simp · rw [selectFn_one, List.forall_mem_cons, isOne_eq_one_iff] - simp_all + simp_all only [Std.le_refl, selectFn_one, true_and] theorem andFoldl_one (g : ℕ → ℕ) (el : List ℕ) : List.foldl (fun acc x => selectFn acc (isOne (g x)) 0) 1 el = 1 ↔ ∀ e ∈ el, g e = 1 := by - rw [andFoldl_eq_one_iff g el 1 (le_refl 1)]; simp + rw [andFoldl_eq_one_iff g el 1 (le_refl 1)]; simp only [true_and] /-- One step of the `stepFun`-inclusion fold over `decodeList b`: test `interYs-index ⊆ output`. -/ @@ -1659,7 +1663,7 @@ theorem Xenum_isComputableElement_iff (gN : ℕ → ℕ) (hgNp : Nat.Primrec gN) : Set (ApproximableMap V₀ V₁)).Nonempty rw [stepFun_singleton] exact (step_mem (P₀.mem_X _) (P₁.mem_X _)).2 - simp_all + simp_all only [List.mem_cons, List.not_mem_nil, or_false, forall_eq, forall_const] · -- map computable ⟹ element computable: guard the bounded-`∀` by the decidable `gN c = 1`. intro hmap have hR' : REPred (fun s => φ.mem (step (P₀.X s.unpair.1) (P₁.X s.unpair.2))) := hmap @@ -1825,7 +1829,7 @@ theorem mem_Xenum_iff_map (gN : ℕ → ℕ) (f : ApproximableMap V₀ V₁) (c obtain ⟨e, he, rfl⟩ := hp exact himp h e he · rw [Xenum_neg P₀ P₁ h] - simp_all + simp_all only [Set.mem_univ, not_isEmpty_of_nonempty, IsEmpty.forall_iff] /-- **Bridge for `curry`.** `(X₀ₙ) curry(g) (Xenum c)` iff, *when `c` is consistent*, `g` relates @@ -1842,11 +1846,11 @@ theorem curry_rel_Xenum_iff {V₂ : NeighborhoodSystem γ} (P₂ : ComputablePre constructor · rintro ⟨hX, _, hmem⟩ rw [mem_Xenum_iff_map P₁ P₂ gN (gSection g hX) c] at hmem - simp_all + simp_all only [gSection_rel, implies_true] · intro himp refine ⟨P₀.mem_X n, Xenum_mem P₁ P₂ gN hgN c, ?_⟩ rw [mem_Xenum_iff_map P₁ P₂ gN (gSection g (P₀.mem_X n)) c] - simp_all + simp_all only [gSection_rel, implies_true] /-- **Theorem 7.5 (Scott 1981, PRG-19) — `curry` is computable (choice-free).** If `g : 𝒟₀ × 𝒟₁ diff --git a/LeanPool/DomainTheory/Neighborhood/Theorem76.lean b/LeanPool/DomainTheory/Neighborhood/Theorem76.lean index d7a03fa284..eb5606e6d5 100644 --- a/LeanPool/DomainTheory/Neighborhood/Theorem76.lean +++ b/LeanPool/DomainTheory/Neighborhood/Theorem76.lean @@ -7,11 +7,8 @@ module public import LeanPool.DomainTheory.Neighborhood.Theorem75 public import LeanPool.DomainTheory.Neighborhood.Theorem41 -import Mathlib.Data.Rat.Cast.Order -import Mathlib.Tactic.NormNum.Abs -import Mathlib.Tactic.NormNum.DivMod -import Mathlib.Tactic.NormNum.OfScientific -import Mathlib.Tactic.NormNum.Pow + +import Mathlib.Tactic.Set -- shake: keep /-! # Theorem 7.6 (Scott 1981, PRG-19, §7) — `fix : (𝒟 → 𝒟) → 𝒟` is computable @@ -335,7 +332,7 @@ theorem fixPStep_foldl_snd (fincl : ℕ → ℕ) (c : ℕ) : intro prev fl _ change (Nat.pair prev fl).unpair.2 = 1 ↔ fl = 1 ∧ chainDec fincl c prev [] rw [unpair_pair_snd] - simp [chainDec] + simp only [chainDec, and_true] | cons b rest ih => intro prev fl _ rw [List.foldl_cons] @@ -353,8 +350,8 @@ theorem fixPStep_foldl_snd (fincl : ℕ → ℕ) (c : ℕ) : have hnf1 : nf = 1 ↔ (fl = 1 ∧ fincl (Nat.pair c (codePair prev b)) = 1) := by rw [hnf] rcases (show fl = 0 ∨ fl = 1 by omega) with h | h <;> rw [h] - · rw [selectFn_zero]; simp - · rw [selectFn_one, isOne_eq_one_iff]; simp + · rw [selectFn_zero]; simp only [zero_ne_one, false_and] + · rw [selectFn_one, isOne_eq_one_iff]; simp only [true_and] rw [hnf1] constructor · rintro ⟨⟨hfl1, hfincl1⟩, hrest⟩; exact ⟨hfl1, hfincl1, hrest⟩ @@ -369,7 +366,7 @@ theorem fixChainChar_spec (fincl : ℕ → ℕ) (c i : ℕ) : rw [fixChainChar_eq] refine ⟨fixPStep_foldl_fst fincl c (decodeList i) P.masterIdx 1, ?_⟩ rw [fixPStep_foldl_snd fincl c (decodeList i) P.masterIdx 1 (le_refl 1)] - simp + simp only [true_and] /-- **Theorem 7.6 (Scott 1981, PRG-19) — `fix` is computable (choice-free).** For any effectively @@ -426,7 +423,7 @@ theorem fixMap_isComputable rw [hdec] at hfst hsnd refine ⟨hsnd.mpr ((chainDec_iff_gStepsOK P gN hgN fincl hfincl t.unpair.1 full P.masterIdx).mpr hsteps), ?_⟩ - simp_all + simp_all only [Nat.unpair_pair] · rintro ⟨i, hi⟩ simp only [unpair_pair_fst, unpair_pair_snd] at hi obtain ⟨hi1, hi2⟩ := hi @@ -434,6 +431,6 @@ theorem fixMap_isComputable refine ⟨decodeList i, ?_, ?_⟩ · exact (chainDec_iff_gStepsOK P gN hgN fincl hfincl t.unpair.1 (decodeList i) P.masterIdx).mp (hsnd.mp hi1) - · simp_all + · simp_all only [Nat.unpair_pair, iff_true] end Domain.Neighborhood