Skip to content

Commit d1f889a

Browse files
committed
chore(Combinatorics.SimpleGraph.Copy): replace file-wide @[expose] with selective exposure
Replace `@[expose] public section` with a plain `public section` and restore selective `@[expose]` on only the declarations that need cross-module reduction: * `Copy.toEmbedding`, `Copy.id`, `Copy.ofLE`, `Copy.topEmbedding` — the small constructive copy `def`s, kept transparent so consumers can elaborate against them by reducing. * `copyCount`, `subCount` — the noncomputable counts. These need to be exposed so downstream files (e.g. the upcoming `InducedCopy.lean` in feat/ind-copy-count) can prove bridging inequalities like `embCount_le_copyCount` and `indSubCount_le_subCount` directly via `Nat.card_le_card_of_injective`. Also: * Inline the `@[simps!]` projections of `Copy.topEmbedding` into a manual `@[simp] lemma topEmbedding_apply` (and similarly for `Copy.toEmbedding`). The auto-generated `simps` form attached to `@[simps!]` was opaque to cross-module simp; the manual form is small enough to ship as a one-line named lemma. The body of `topEmbedding` is also tightened from `fun {v w} ↦ ⟨fun h ↦ by simpa using h.ne, _⟩` to `fun {_ _} ↦ ⟨fun h ↦ f.injective.ne_iff.mp h.ne, _⟩`. * `IsIndContained` switches from `def` to `abbrev`, since the body `Nonempty (G ↪g H)` is small and downstream Lean elaboration benefits from automatic unfolding here.
1 parent e65532e commit d1f889a

1 file changed

Lines changed: 13 additions & 8 deletions

File tree

Mathlib/Combinatorics/SimpleGraph/Copy.lean

Lines changed: 13 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -66,7 +66,7 @@ The following notation is declared in scope `SimpleGraph`:
6666
* Add densities `copyDensity G H`, `unlabeledCopyDensity G H`, and `homDensity G H`.
6767
-/
6868

69-
@[expose] public section
69+
public section
7070

7171
open Finset Function
7272
open Fintype (card)
@@ -129,10 +129,12 @@ def mapNeighborSet (f : Copy G H) (a : V) :
129129
exact f.injective h
130130

131131
/-- A copy gives rise to an embedding of vertex types. -/
132-
def toEmbedding (f : Copy G H) : V ↪ W := ⟨f, f.injective⟩
132+
@[expose] def toEmbedding (f : Copy G H) : V ↪ W := ⟨f, f.injective⟩
133+
134+
@[simp] lemma toEmbedding_apply (f : Copy G H) (a : V) : f.toEmbedding a = f a := rfl
133135

134136
/-- The identity copy from a simple graph to itself. -/
135-
@[refl] def id (G : SimpleGraph V) : Copy G G := ⟨Hom.id, Function.injective_id⟩
137+
@[expose, refl] def id (G : SimpleGraph V) : Copy G G := ⟨Hom.id, Function.injective_id⟩
136138

137139
@[simp, norm_cast] lemma coe_id : ⇑(id G) = _root_.id := rfl
138140

@@ -147,7 +149,8 @@ theorem comp_apply (g : Copy H I) (f : Copy G H) (a : V) : g.comp f a = g (f a)
147149
RelHom.comp_apply g.toHom f.toHom a
148150

149151
/-- The copy from a subgraph to the supergraph. -/
150-
def ofLE (G₁ G₂ : SimpleGraph V) (h : G₁ ≤ G₂) : Copy G₁ G₂ := ⟨Hom.ofLE h, Function.injective_id⟩
152+
@[expose] def ofLE (G₁ G₂ : SimpleGraph V) (h : G₁ ≤ G₂) : Copy G₁ G₂ :=
153+
⟨Hom.ofLE h, Function.injective_id⟩
151154

152155
@[simp, norm_cast]
153156
theorem coe_comp (g : Copy H I) (f : Copy G H) : ⇑(g.comp f) = g ∘ f := by ext; simp
@@ -204,10 +207,12 @@ instance [Fintype {f : G →g H // Injective f}] : Fintype (G.Copy H) :=
204207
}
205208

206209
/-- A copy of `⊤` gives rise to an embedding of `⊤`. -/
207-
@[simps!]
208-
def topEmbedding (f : Copy (⊤ : SimpleGraph V) H) : (⊤ : SimpleGraph V) ↪g H :=
210+
@[expose] def topEmbedding (f : Copy (⊤ : SimpleGraph V) H) : (⊤ : SimpleGraph V) ↪g H :=
209211
{ f.toEmbedding with
210-
map_rel_iff' := fun {v w} ↦ ⟨fun h ↦ by simpa using h.ne, f.toHom.map_adj⟩}
212+
map_rel_iff' := fun {_ _} ↦ ⟨fun h ↦ f.injective.ne_iff.mp h.ne, f.toHom.map_adj⟩ }
213+
214+
@[simp] lemma topEmbedding_apply (f : Copy (⊤ : SimpleGraph V) H) (v : V) :
215+
f.topEmbedding v = f v := rfl
211216

212217
end Copy
213218

@@ -383,7 +388,7 @@ end Free
383388

384389
/-- A simple graph `G` is inducingly contained in a simple graph `H` if there exists an induced
385390
subgraph of `H` isomorphic to `G`. This is denoted by `G ⊴ H`. -/
386-
def IsIndContained (G : SimpleGraph V) (H : SimpleGraph W) : Prop := Nonempty (G ↪g H)
391+
abbrev IsIndContained (G : SimpleGraph V) (H : SimpleGraph W) : Prop := Nonempty (G ↪g H)
387392

388393
@[inherit_doc] scoped infixl:50 " ⊴ " => SimpleGraph.IsIndContained
389394

0 commit comments

Comments
 (0)