1-- Derived sets: the limit points of a set, their closure laws, and the2-- isolated points as the difference between a set and its derived set3-- Part of Cumulus, the Grace17 mathematics library.4-- Copyright (c) 2026 Grant Passmore.5-- Released under the Apache License 2.0. See LICENSE in the repository root.6-- Authors: Grant Passmore78module Grace.Cumulus.Topology.CantorBendixson.Derived9import Topology.Separation1011-- The derived set of A is its set of limit points.12def derivedSet (X T A : Set) : Set:= limitPoints(X, T, A)1314theorem derivedSet.membership (X T A x : Set)15shows x ∈ derivedSet(X, T, A) ↔16 x ∈ X ∧ (∀ U ∈ T, x ∈ U → Nonempty(U ∩ (A ∖ {x})))17proof18simp [derivedSet, limitPoints.membership]1920theorem derivedSet.limit_iff (X T A x : Set)21shows x ∈ derivedSet(X, T, A) ↔ x ∈ limitPoints(X, T, A)22proof23simp [derivedSet]2425theorem derivedSet.subset_whole (X T A : Set)26shows derivedSet(X, T, A) ⊆ X27proof28unfold derivedSet29exact limitPoints.subset at X, T, A3031theorem derivedSet.subset_closure (X T A : Set)32requires topology : IsTopology(X, T)33requires hA : A ⊆ X34shows derivedSet(X, T, A) ⊆ closure(X, T, A)35proof36unfold derivedSet37exact limitPoints.subset_closure with topology, hA3839theorem derivedSet.subset (X T A : Set)40requires topology : IsTopology(X, T)41requires closed : IsClosed(X, T, A)42shows derivedSet(X, T, A) ⊆ A43proof44have inside := closed.left45unfold derivedSet46exact IsClosed.iff_limitPoints_subset.forward with topology, inside, closed4748theorem derivedSet.monotone (X T A B : Set)49requires hAB : A ⊆ B50shows derivedSet(X, T, A) ⊆ derivedSet(X, T, B)51proof52unfold derivedSet53exact limitPoints.monotone at X, T with hAB5455-- The derived set of a closed set is closed: it lies inside the set, so56-- by monotonicity its own derived set lies inside it.57theorem derivedSet.closed (X T A : Set)58requires topology : IsTopology(X, T)59requires closed : IsClosed(X, T, A)60shows IsClosed(X, T, derivedSet(X, T, A))61proof62have inside := derivedSet.subset with topology, closed63have twice := derivedSet.monotone at X, T with inside64have whole := derivedSet.subset_whole at X, T, A65apply IsClosed.iff_limitPoints_subset.backward with topology, whole66intros x hx67have limit := derivedSet.limit_iff.backward with hx68exact twice with x, limit6970-- In a T1 space the derived set of any subset is closed: a limit point x71-- of the derived set has, in every open U around it, a limit point y ≠ x72-- of A, and U with x removed is an open set around y that meets A.73theorem derivedSet.closed_of_t1 (X T A : Set)74requires topology : IsTopology(X, T)75requires t1 : IsT1Space(X, T)76requires hA : A ⊆ X77shows IsClosed(X, T, derivedSet(X, T, A))78proof79have whole := derivedSet.subset_whole at X, T, A80apply IsClosed.iff_limitPoints_subset.backward with topology, whole81intros x hx82have parts := limitPoints.membership.forward with hx83apply derivedSet.membership.backward84refine⟨parts.left, ?_⟩85intros U hU hxU86obtain⟨y, hy⟩:= parts.right with U, hU, hxU87have inner := intersection.membership.forward with hy88have away := difference.singleton_membership.forward with inner.right89have yParts := derivedSet.membership.forward with away.left90have openPoint := IsT1Space.point_complement_open with91 topology, t1, parts.left92have openCut := IsTopology.intersection2 with topology, hU, openPoint93have yAway : ¬y ∈ {x}94intro same95exact away.right with (singleton.membership.forward with same)96have yOutside : y ∈ complement(X, {x})97exact complement.membership.backward with⟨yParts.left, yAway⟩98have yCut : y ∈ U ∩ complement(X, {x})99exact intersection.membership.backward with⟨inner.left, yOutside⟩100obtain⟨z, hz⟩:= yParts.right with101 U ∩ complement(X, {x}), openCut, yCut102have zParts := intersection.membership.forward with hz103have zCut := intersection.membership.forward with zParts.left104have zOutside := complement.membership.forward with zCut.right105have zInA := difference.singleton_membership.forward with zParts.right106have zDistinct : z ≠ x107intro same108apply zOutside.right109rw same110exact singleton.self at x111witness z112apply intersection.membership.backward113refine⟨zCut.left, ?_⟩114exact difference.singleton_membership.backward with⟨zInA.left, zDistinct⟩115116-- The isolated points of A: the points of A that are not limit points.117118def isolatedPoints (X T A : Set) : Set:=119 { x ∈ A | IsolatedPoint(X, T, A, x) }120121theorem derivedSet.difference (X T A : Set)122requires topology : IsTopology(X, T)123requires hA : A ⊆ X124shows A ∖ derivedSet(X, T, A) = isolatedPoints(X, T, A)125proof126ext x127constructor128 . intro hx129have parts := difference.membership.forward with hx130have notLimit : ¬x ∈ limitPoints(X, T, A)131intro limit132exact parts.right with (derivedSet.limit_iff.backward with limit)133have isolated := IsolatedPoint.of_not_limit with134 topology, hA, parts.left, notLimit135exact isolatedPoints.membership.backward with⟨parts.left, isolated⟩136 . intro hx137have parts := isolatedPoints.membership.forward with hx138have notLimit := IsolatedPoint.not_limit with parts.right139apply difference.membership.backward140refine⟨parts.left, ?_⟩141intro limit142exact notLimit with (derivedSet.limit_iff.forward with limit)143144theorem derivedSet.removed_iff (X T A x : Set)145requires topology : IsTopology(X, T)146requires hA : A ⊆ X147shows x ∈ A ∖ derivedSet(X, T, A) ↔ IsolatedPoint(X, T, A, x)148proof149havesplit:= derivedSet.difference with topology, hA150rwsplit151constructor152 . intro hx153have parts := isolatedPoints.membership.forward with hx154exact parts.right155 . intro isolated156obtain⟨hxA, U, hU, hxU, trace⟩:= isolated157have again : IsolatedPoint(X, T, A, x) :=⟨hxA, U, hU, hxU, trace⟩158exact isolatedPoints.membership.backward with⟨hxA, again⟩159