Skip to content

Commit c99d289

Browse files
gotrevorclaude
andcommitted
refactor(CoherenceSpace): use Std.Refl/Std.Symm for the reflexive/symmetric fields
Per review feedback on #834: make the reflexive/symmetric fields the Std.Refl / Std.Symm classes the mathlib deprecation points to, instead of inlining their ∀-bodies. The Coherence.refl / Coherence.symm accessors project through the classes, so all downstream use sites are unchanged. Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com>
1 parent 6d38c5a commit c99d289

1 file changed

Lines changed: 40 additions & 40 deletions

File tree

Foundation/Semantics/CoherenceSpace/Basic.lean

Lines changed: 40 additions & 40 deletions
Original file line numberDiff line numberDiff line change
@@ -17,22 +17,22 @@ namespace LO
1717
class CoherenceSpace (α : Type*) where
1818
/-- A coherence relation -/
1919
Coherence : α → α → Prop
20-
reflexive : ∀ x, Coherence x x
21-
symmetric : ∀ ⦃x y⦄, Coherence x y → Coherence y x
20+
reflexive : Std.Refl Coherence
21+
symmetric : Std.Symm Coherence
2222

2323
namespace CoherenceSpace
2424

2525
infix:40 " ⁐ " => Coherence
2626

2727
variable {α : Type*} [CoherenceSpace α]
2828

29-
instance : Std.Refl (α := α) Coherence := reflexive
29+
instance : Std.Refl (α := α) Coherence := reflexive
3030

31-
instance : Std.Symm (α := α) Coherence := symmetric
31+
instance : Std.Symm (α := α) Coherence := symmetric
3232

33-
@[simp, refl, grind .] protected lemma Coherence.refl (x : α) : x ⁐ x := reflexive x
33+
@[simp, refl, grind .] protected lemma Coherence.refl (x : α) : x ⁐ x := reflexive.refl x
3434

35-
lemma Coherence.symm {x y : α} : x ⁐ y → y ⁐ x := fun h ↦ symmetric h
35+
lemma Coherence.symm {x y : α} : x ⁐ y → y ⁐ x := symmetric.symm x y
3636

3737
@[grind =] lemma Coherence.symm_iff {x y : α} : x ⁐ y ↔ y ⁐ x := ⟨symm, symm⟩
3838

@@ -170,13 +170,13 @@ namespace CoherenceSpace
170170

171171
instance : Bot (CoherenceSpace α) := ⟨{
172172
Coherence := Eq
173-
reflexive := refl
174-
symmetric _ _ := symm }⟩
173+
reflexive := refl
174+
symmetric := ⟨fun _ _ => symm }⟩
175175

176176
instance : Top (CoherenceSpace α) := ⟨{
177177
Coherence _ _ := True
178-
reflexive _ := by trivial
179-
symmetric _ _ _ := by trivial }⟩
178+
reflexive := ⟨fun _ => by trivial
179+
symmetric := ⟨fun _ _ _ => by trivial }⟩
180180

181181
inductive Top
182182

@@ -221,12 +221,12 @@ inductive Coherence : αᗮ → αᗮ → Prop
221221

222222
instance : CoherenceSpace αᗮ where
223223
Coherence p q := Coherence p q
224-
reflexive p := by
224+
reflexive := ⟨fun p => by
225225
rcases p with ⟨a⟩
226-
exact Coherence.mk (by simp)
227-
symmetric p q := by
226+
exact Coherence.mk (by simp)
227+
symmetric := ⟨fun p q => by
228228
rintro ⟨h⟩
229-
exact Coherence.mk (symm h)
229+
exact Coherence.mk (symm h)
230230

231231
lemma coherence_def (p q : αᗮ) : p ⁐ q ↔ Coherence p q := by rfl
232232

@@ -265,12 +265,12 @@ inductive Coherence : Tensor α β → Tensor α β → Prop
265265

266266
instance : CoherenceSpace (Tensor α β) where
267267
Coherence p q := Coherence p q
268-
reflexive p := by
268+
reflexive := ⟨fun p => by
269269
rcases p with ⟨a, b⟩
270-
exact Coherence.pair (by rfl) (by rfl)
271-
symmetric p q := by
270+
exact Coherence.pair (by rfl) (by rfl)
271+
symmetric := ⟨fun p q => by
272272
rintro ⟨ha, hb⟩
273-
exact Coherence.pair (symm ha) (symm hb)
273+
exact Coherence.pair (symm ha) (symm hb)
274274

275275
lemma coherence_def (p q : Tensor α β) : p ⁐ q ↔ Coherence p q := by rfl
276276

@@ -301,12 +301,12 @@ inductive Coherence : Par α β → Par α β → Prop
301301

302302
instance : CoherenceSpace (Par α β) where
303303
Coherence p q := Coherence p q
304-
reflexive p := Coherence.refl _
305-
symmetric p q := by
304+
reflexive := ⟨fun p => Coherence.refl _
305+
symmetric := ⟨fun p q => by
306306
rintro (h | h | h)
307307
· exact Coherence.refl _
308308
· exact Coherence.left (symm h)
309-
· exact Coherence.right (symm h)
309+
· exact Coherence.right (symm h)
310310

311311
lemma coherence_def (p q : Par α β) : p ⁐ q ↔ Coherence p q := by rfl
312312

@@ -339,11 +339,11 @@ inductive ArrowParCoherence : (f g : (i : ι) → ρ i) → Prop
339339

340340
instance arrowPar : CoherenceSpace ((i : ι) → ρ i) where
341341
Coherence f g := ArrowParCoherence f g
342-
reflexive f := ArrowParCoherence.refl f
343-
symmetric f g := by
342+
reflexive := ⟨fun f => ArrowParCoherence.refl f
343+
symmetric := ⟨fun f g => by
344344
rintro (h | ⟨_, h⟩)
345345
· exact ArrowParCoherence.refl _
346-
· exact ArrowParCoherence.pointwise _ (symm h)
346+
· exact ArrowParCoherence.pointwise _ (symm h)
347347

348348
lemma arrowPar_coherence_def (f g : (i : ι) → ρ i) : f ⁐ g ↔ ArrowParCoherence f g := by rfl
349349

@@ -398,16 +398,16 @@ inductive Coherence : With α β → With α β → Prop
398398
/-- An additive conjunction of coherence spaces is also a coherence space -/
399399
instance : CoherenceSpace (With α β) where
400400
Coherence p q := Coherence p q
401-
reflexive p := by
401+
reflexive := ⟨fun p => by
402402
rcases p
403403
· exact Coherence.inl (by rfl)
404-
· exact Coherence.inr (by rfl)
405-
symmetric p q := by
404+
· exact Coherence.inr (by rfl)
405+
symmetric := ⟨fun p q => by
406406
rintro (h | h | _ | _)
407407
· exact Coherence.inl (symm h)
408408
· exact Coherence.inr (symm h)
409409
· exact Coherence.inr_inl _ _
410-
· exact Coherence.inl_inr _ _
410+
· exact Coherence.inl_inr _ _
411411

412412
lemma coherence_def (p q : With α β) : p ⁐ q ↔ Coherence p q := by rfl
413413

@@ -426,13 +426,13 @@ inductive Coherence : BigWith ρ → BigWith ρ → Prop
426426

427427
instance : CoherenceSpace (BigWith ρ) where
428428
Coherence p q := p.Coherence q
429-
reflexive p := by
429+
reflexive := ⟨fun p => by
430430
rcases p with ⟨a⟩
431-
exact Coherence.mk (by rfl)
432-
symmetric p q := by
431+
exact Coherence.mk (by rfl)
432+
symmetric := ⟨fun p q => by
433433
rintro (h | ⟨_, _, h⟩)
434434
· exact Coherence.mk (symm h)
435-
· exact Coherence.of_ne _ _ (Ne.symm h)
435+
· exact Coherence.of_ne _ _ (Ne.symm h)
436436

437437
lemma coherence_def (p q : BigWith ρ) : p ⁐ q ↔ Coherence p q := by rfl
438438

@@ -454,14 +454,14 @@ inductive Coherence : Plus α β → Plus α β → Prop
454454
/-- An additive conjunction of coherence spaces is also a coherence space -/
455455
instance : CoherenceSpace (Plus α β) where
456456
Coherence p q := Coherence p q
457-
reflexive p := by
457+
reflexive := ⟨fun p => by
458458
rcases p
459459
· exact Coherence.inl (by rfl)
460-
· exact Coherence.inr (by rfl)
461-
symmetric p q := by
460+
· exact Coherence.inr (by rfl)
461+
symmetric := ⟨fun p q => by
462462
rintro (h | h)
463463
· exact Coherence.inl (symm h)
464-
· exact Coherence.inr (symm h)
464+
· exact Coherence.inr (symm h)
465465

466466
lemma coherence_def (p q : Plus α β) : p ⁐ q ↔ Coherence p q := by rfl
467467

@@ -479,12 +479,12 @@ inductive Coherence : BigPlus ρ → BigPlus ρ → Prop
479479

480480
instance : CoherenceSpace (BigPlus ρ) where
481481
Coherence p q := p.Coherence q
482-
reflexive p := by
482+
reflexive := ⟨fun p => by
483483
rcases p with ⟨a⟩
484-
exact Coherence.mk (by rfl)
485-
symmetric p q := by
484+
exact Coherence.mk (by rfl)
485+
symmetric := ⟨fun p q => by
486486
rintro ⟨h⟩
487-
exact Coherence.mk (symm h)
487+
exact Coherence.mk (symm h)
488488

489489
lemma coherence_def (p q : BigPlus ρ) : p ⁐ q ↔ Coherence p q := by rfl
490490

0 commit comments

Comments
 (0)