-
Notifications
You must be signed in to change notification settings - Fork 251
/
Hom.lean
627 lines (491 loc) · 22.8 KB
/
Hom.lean
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
342
343
344
345
346
347
348
349
350
351
352
353
354
355
356
357
358
359
360
361
362
363
364
365
366
367
368
369
370
371
372
373
374
375
376
377
378
379
380
381
382
383
384
385
386
387
388
389
390
391
392
393
394
395
396
397
398
399
400
401
402
403
404
405
406
407
408
409
410
411
412
413
414
415
416
417
418
419
420
421
422
423
424
425
426
427
428
429
430
431
432
433
434
435
436
437
438
439
440
441
442
443
444
445
446
447
448
449
450
451
452
453
454
455
456
457
458
459
460
461
462
463
464
465
466
467
468
469
470
471
472
473
474
475
476
477
478
479
480
481
482
483
484
485
486
487
488
489
490
491
492
493
494
495
496
497
498
499
500
501
502
503
504
505
506
507
508
509
510
511
512
513
514
515
516
517
518
519
520
521
522
523
524
525
526
527
528
529
530
531
532
533
534
535
536
537
538
539
540
541
542
543
544
545
546
547
548
549
550
551
552
553
554
555
556
557
558
559
560
561
562
563
564
565
566
567
568
569
570
571
572
573
574
575
576
577
578
579
580
581
582
583
584
585
586
587
588
589
590
591
592
593
594
595
596
597
598
599
600
601
602
603
604
605
606
607
608
609
610
611
612
613
614
615
616
617
618
619
620
621
622
623
624
625
626
627
/-
Copyright (c) 2022 Yaël Dillies. All rights reserved.
Released under Apache 2.0 license as described in the file LICENSE.
Authors: Yaël Dillies
-/
import Mathlib.Order.Hom.Lattice
#align_import order.heyting.hom from "leanprover-community/mathlib"@"4c19a16e4b705bf135cf9a80ac18fcc99c438514"
/-!
# Heyting algebra morphisms
A Heyting homomorphism between two Heyting algebras is a bounded lattice homomorphism that preserves
Heyting implication.
We use the `DFunLike` design, so each type of morphisms has a companion typeclass which is meant to
be satisfied by itself and all stricter types.
## Types of morphisms
* `HeytingHom`: Heyting homomorphisms.
* `CoheytingHom`: Co-Heyting homomorphisms.
* `BiheytingHom`: Bi-Heyting homomorphisms.
## Typeclasses
* `HeytingHomClass`
* `CoheytingHomClass`
* `BiheytingHomClass`
-/
open Function
variable {F α β γ δ : Type*}
/-- The type of Heyting homomorphisms from `α` to `β`. Bounded lattice homomorphisms that preserve
Heyting implication. -/
structure HeytingHom (α β : Type*) [HeytingAlgebra α] [HeytingAlgebra β] extends
LatticeHom α β where
/-- The proposition that a Heyting homomorphism preserves the bottom element.-/
protected map_bot' : toFun ⊥ = ⊥
/-- The proposition that a Heyting homomorphism preserves the Heyting implication.-/
protected map_himp' : ∀ a b, toFun (a ⇨ b) = toFun a ⇨ toFun b
#align heyting_hom HeytingHom
/-- The type of co-Heyting homomorphisms from `α` to `β`. Bounded lattice homomorphisms that
preserve difference. -/
structure CoheytingHom (α β : Type*) [CoheytingAlgebra α] [CoheytingAlgebra β] extends
LatticeHom α β where
/-- The proposition that a co-Heyting homomorphism preserves the top element.-/
protected map_top' : toFun ⊤ = ⊤
/-- The proposition that a co-Heyting homomorphism preserves the difference operation.-/
protected map_sdiff' : ∀ a b, toFun (a \ b) = toFun a \ toFun b
#align coheyting_hom CoheytingHom
/-- The type of bi-Heyting homomorphisms from `α` to `β`. Bounded lattice homomorphisms that
preserve Heyting implication and difference. -/
structure BiheytingHom (α β : Type*) [BiheytingAlgebra α] [BiheytingAlgebra β] extends
LatticeHom α β where
/-- The proposition that a bi-Heyting homomorphism preserves the Heyting implication.-/
protected map_himp' : ∀ a b, toFun (a ⇨ b) = toFun a ⇨ toFun b
/-- The proposition that a bi-Heyting homomorphism preserves the difference operation.-/
protected map_sdiff' : ∀ a b, toFun (a \ b) = toFun a \ toFun b
#align biheyting_hom BiheytingHom
/-- `HeytingHomClass F α β` states that `F` is a type of Heyting homomorphisms.
You should extend this class when you extend `HeytingHom`. -/
class HeytingHomClass (F α β : Type*) [HeytingAlgebra α] [HeytingAlgebra β] [FunLike F α β]
extends LatticeHomClass F α β : Prop where
/-- The proposition that a Heyting homomorphism preserves the bottom element.-/
map_bot (f : F) : f ⊥ = ⊥
/-- The proposition that a Heyting homomorphism preserves the Heyting implication.-/
map_himp (f : F) : ∀ a b, f (a ⇨ b) = f a ⇨ f b
#align heyting_hom_class HeytingHomClass
/-- `CoheytingHomClass F α β` states that `F` is a type of co-Heyting homomorphisms.
You should extend this class when you extend `CoheytingHom`. -/
class CoheytingHomClass (F α β : Type*) [CoheytingAlgebra α] [CoheytingAlgebra β] [FunLike F α β]
extends LatticeHomClass F α β : Prop where
/-- The proposition that a co-Heyting homomorphism preserves the top element.-/
map_top (f : F) : f ⊤ = ⊤
/-- The proposition that a co-Heyting homomorphism preserves the difference operation.-/
map_sdiff (f : F) : ∀ a b, f (a \ b) = f a \ f b
#align coheyting_hom_class CoheytingHomClass
/-- `BiheytingHomClass F α β` states that `F` is a type of bi-Heyting homomorphisms.
You should extend this class when you extend `BiheytingHom`. -/
class BiheytingHomClass (F α β : Type*) [BiheytingAlgebra α] [BiheytingAlgebra β] [FunLike F α β]
extends LatticeHomClass F α β : Prop where
/-- The proposition that a bi-Heyting homomorphism preserves the Heyting implication.-/
map_himp (f : F) : ∀ a b, f (a ⇨ b) = f a ⇨ f b
/-- The proposition that a bi-Heyting homomorphism preserves the difference operation.-/
map_sdiff (f : F) : ∀ a b, f (a \ b) = f a \ f b
#align biheyting_hom_class BiheytingHomClass
export HeytingHomClass (map_himp)
export CoheytingHomClass (map_sdiff)
attribute [simp] map_himp map_sdiff
section Hom
variable [FunLike F α β]
/- Porting note: `[HeytingAlgebra α, β]` -> `{ _ : HeytingAlgebra α, β}` as a dangerous instance fix
similar for Coheyting & Biheyting instances -/
-- See note [lower instance priority]
instance (priority := 100) HeytingHomClass.toBoundedLatticeHomClass [HeytingAlgebra α]
{ _ : HeytingAlgebra β} [HeytingHomClass F α β] : BoundedLatticeHomClass F α β :=
{ ‹HeytingHomClass F α β› with
map_top := fun f => by rw [← @himp_self α _ ⊥, ← himp_self, map_himp] }
#align heyting_hom_class.to_bounded_lattice_hom_class HeytingHomClass.toBoundedLatticeHomClass
-- See note [lower instance priority]
instance (priority := 100) CoheytingHomClass.toBoundedLatticeHomClass [CoheytingAlgebra α]
{ _ : CoheytingAlgebra β} [CoheytingHomClass F α β] : BoundedLatticeHomClass F α β :=
{ ‹CoheytingHomClass F α β› with
map_bot := fun f => by rw [← @sdiff_self α _ ⊤, ← sdiff_self, map_sdiff] }
#align coheyting_hom_class.to_bounded_lattice_hom_class CoheytingHomClass.toBoundedLatticeHomClass
-- See note [lower instance priority]
instance (priority := 100) BiheytingHomClass.toHeytingHomClass [BiheytingAlgebra α]
{ _ : BiheytingAlgebra β} [BiheytingHomClass F α β] : HeytingHomClass F α β :=
{ ‹BiheytingHomClass F α β› with
map_bot := fun f => by rw [← @sdiff_self α _ ⊤, ← sdiff_self, BiheytingHomClass.map_sdiff] }
#align biheyting_hom_class.to_heyting_hom_class BiheytingHomClass.toHeytingHomClass
-- See note [lower instance priority]
instance (priority := 100) BiheytingHomClass.toCoheytingHomClass [BiheytingAlgebra α]
{ _ : BiheytingAlgebra β} [BiheytingHomClass F α β] : CoheytingHomClass F α β :=
{ ‹BiheytingHomClass F α β› with
map_top := fun f => by rw [← @himp_self α _ ⊥, ← himp_self, map_himp] }
#align biheyting_hom_class.to_coheyting_hom_class BiheytingHomClass.toCoheytingHomClass
end Hom
section Equiv
variable [EquivLike F α β]
-- See note [lower instance priority]
instance (priority := 100) OrderIsoClass.toHeytingHomClass [HeytingAlgebra α]
{ _ : HeytingAlgebra β} [OrderIsoClass F α β] : HeytingHomClass F α β :=
{ OrderIsoClass.toBoundedLatticeHomClass with
map_himp := fun f a b =>
eq_of_forall_le_iff fun c => by
simp only [← map_inv_le_iff, le_himp_iff]
rw [← OrderIsoClass.map_le_map_iff f]
simp }
#align order_iso_class.to_heyting_hom_class OrderIsoClass.toHeytingHomClass
-- See note [lower instance priority]
instance (priority := 100) OrderIsoClass.toCoheytingHomClass [CoheytingAlgebra α]
{ _ : CoheytingAlgebra β} [OrderIsoClass F α β] : CoheytingHomClass F α β :=
{ OrderIsoClass.toBoundedLatticeHomClass with
map_sdiff := fun f a b =>
eq_of_forall_ge_iff fun c => by
simp only [← le_map_inv_iff, sdiff_le_iff]
rw [← OrderIsoClass.map_le_map_iff f]
simp }
#align order_iso_class.to_coheyting_hom_class OrderIsoClass.toCoheytingHomClass
-- See note [lower instance priority]
instance (priority := 100) OrderIsoClass.toBiheytingHomClass [BiheytingAlgebra α]
{ _ : BiheytingAlgebra β} [OrderIsoClass F α β] : BiheytingHomClass F α β :=
{ OrderIsoClass.toLatticeHomClass with
map_himp := fun f a b =>
eq_of_forall_le_iff fun c => by
simp only [← map_inv_le_iff, le_himp_iff]
rw [← OrderIsoClass.map_le_map_iff f]
simp
map_sdiff := fun f a b =>
eq_of_forall_ge_iff fun c => by
simp only [← le_map_inv_iff, sdiff_le_iff]
rw [← OrderIsoClass.map_le_map_iff f]
simp }
#align order_iso_class.to_biheyting_hom_class OrderIsoClass.toBiheytingHomClass
end Equiv
variable [FunLike F α β]
-- Porting note: Revisit this issue to see if it works in Lean 4. -/
-- See note [reducible non instances]
/-- This can't be an instance because of typeclass loops. -/
@[reducible]
lemma BoundedLatticeHomClass.toBiheytingHomClass [BooleanAlgebra α] [BooleanAlgebra β]
[BoundedLatticeHomClass F α β] : BiheytingHomClass F α β :=
{ ‹BoundedLatticeHomClass F α β› with
map_himp := fun f a b => by rw [himp_eq, himp_eq, map_sup, (isCompl_compl.map _).compl_eq]
map_sdiff := fun f a b => by rw [sdiff_eq, sdiff_eq, map_inf, (isCompl_compl.map _).compl_eq] }
#align bounded_lattice_hom_class.to_biheyting_hom_class BoundedLatticeHomClass.toBiheytingHomClass
section HeytingAlgebra
open scoped symmDiff
variable [HeytingAlgebra α] [HeytingAlgebra β] [HeytingHomClass F α β] (f : F)
@[simp]
theorem map_compl (a : α) : f aᶜ = (f a)ᶜ := by rw [← himp_bot, ← himp_bot, map_himp, map_bot]
#align map_compl map_compl
@[simp]
theorem map_bihimp (a b : α) : f (a ⇔ b) = f a ⇔ f b := by simp_rw [bihimp, map_inf, map_himp]
#align map_bihimp map_bihimp
-- TODO: `map_bihimp`
end HeytingAlgebra
section CoheytingAlgebra
open scoped symmDiff
variable [CoheytingAlgebra α] [CoheytingAlgebra β] [CoheytingHomClass F α β] (f : F)
@[simp]
theorem map_hnot (a : α) : f (¬a) = ¬f a := by rw [← top_sdiff', ← top_sdiff', map_sdiff, map_top]
#align map_hnot map_hnot
@[simp]
theorem map_symmDiff (a b : α) : f (a ∆ b) = f a ∆ f b := by simp_rw [symmDiff, map_sup, map_sdiff]
#align map_symm_diff map_symmDiff
end CoheytingAlgebra
instance [HeytingAlgebra α] [HeytingAlgebra β] [HeytingHomClass F α β] : CoeTC F (HeytingHom α β) :=
⟨fun f =>
{ toFun := f
map_sup' := map_sup f
map_inf' := map_inf f
map_bot' := map_bot f
map_himp' := map_himp f }⟩
instance [CoheytingAlgebra α] [CoheytingAlgebra β] [CoheytingHomClass F α β] :
CoeTC F (CoheytingHom α β) :=
⟨fun f =>
{ toFun := f
map_sup' := map_sup f
map_inf' := map_inf f
map_top' := map_top f
map_sdiff' := map_sdiff f }⟩
instance [BiheytingAlgebra α] [BiheytingAlgebra β] [BiheytingHomClass F α β] :
CoeTC F (BiheytingHom α β) :=
⟨fun f =>
{ toFun := f
map_sup' := map_sup f
map_inf' := map_inf f
map_himp' := map_himp f
map_sdiff' := map_sdiff f }⟩
namespace HeytingHom
variable [HeytingAlgebra α] [HeytingAlgebra β] [HeytingAlgebra γ] [HeytingAlgebra δ]
instance instFunLike : FunLike (HeytingHom α β) α β where
coe f := f.toFun
coe_injective' f g h := by obtain ⟨⟨⟨_, _⟩, _⟩, _⟩ := f; obtain ⟨⟨⟨_, _⟩, _⟩, _⟩ := g; congr
instance instHeytingHomClass : HeytingHomClass (HeytingHom α β) α β where
map_sup f := f.map_sup'
map_inf f := f.map_inf'
map_bot f := f.map_bot'
map_himp := HeytingHom.map_himp'
-- Porting note: CoeFun undesired here in lean 4
-- /-- Helper instance for when there's too many metavariables to apply `DFunLike.CoeFun`
-- directly. -/
-- instance : CoeFun (HeytingHom α β) fun _ => α → β :=
-- DFunLike.hasCoeToFun
-- @[simp] -- Porting note: not in simp-nf, simp can simplify lhs. Added aux simp lemma
theorem toFun_eq_coe {f : HeytingHom α β} : f.toFun = ⇑f :=
rfl
#align heyting_hom.to_fun_eq_coe HeytingHom.toFun_eq_coe
@[simp]
theorem toFun_eq_coe_aux {f : HeytingHom α β} : (↑f.toLatticeHom) = ⇑f :=
rfl
@[ext]
theorem ext {f g : HeytingHom α β} (h : ∀ a, f a = g a) : f = g :=
DFunLike.ext f g h
#align heyting_hom.ext HeytingHom.ext
/-- Copy of a `HeytingHom` with a new `toFun` equal to the old one. Useful to fix definitional
equalities. -/
protected def copy (f : HeytingHom α β) (f' : α → β) (h : f' = f) : HeytingHom α β where
toFun := f'
map_sup' := by simpa only [h] using map_sup f
map_inf' := by simpa only [h] using map_inf f
map_bot' := by simpa only [h] using map_bot f
map_himp' := by simpa only [h] using map_himp f
#align heyting_hom.copy HeytingHom.copy
@[simp]
theorem coe_copy (f : HeytingHom α β) (f' : α → β) (h : f' = f) : ⇑(f.copy f' h) = f' :=
rfl
#align heyting_hom.coe_copy HeytingHom.coe_copy
theorem copy_eq (f : HeytingHom α β) (f' : α → β) (h : f' = f) : f.copy f' h = f :=
DFunLike.ext' h
#align heyting_hom.copy_eq HeytingHom.copy_eq
variable (α)
/-- `id` as a `HeytingHom`. -/
protected def id : HeytingHom α α :=
{ BotHom.id _ with
toLatticeHom := LatticeHom.id _
map_himp' := fun _ _ => rfl }
#align heyting_hom.id HeytingHom.id
@[simp]
theorem coe_id : ⇑(HeytingHom.id α) = id :=
rfl
#align heyting_hom.coe_id HeytingHom.coe_id
variable {α}
@[simp]
theorem id_apply (a : α) : HeytingHom.id α a = a :=
rfl
#align heyting_hom.id_apply HeytingHom.id_apply
instance : Inhabited (HeytingHom α α) :=
⟨HeytingHom.id _⟩
instance : PartialOrder (HeytingHom α β) :=
PartialOrder.lift _ DFunLike.coe_injective
/-- Composition of `HeytingHom`s as a `HeytingHom`. -/
def comp (f : HeytingHom β γ) (g : HeytingHom α β) : HeytingHom α γ :=
{ f.toLatticeHom.comp g.toLatticeHom with
toFun := f ∘ g
map_bot' := by simp
map_himp' := fun a b => by simp }
#align heyting_hom.comp HeytingHom.comp
variable {f f₁ f₂ : HeytingHom α β} {g g₁ g₂ : HeytingHom β γ}
@[simp]
theorem coe_comp (f : HeytingHom β γ) (g : HeytingHom α β) : ⇑(f.comp g) = f ∘ g :=
rfl
#align heyting_hom.coe_comp HeytingHom.coe_comp
@[simp]
theorem comp_apply (f : HeytingHom β γ) (g : HeytingHom α β) (a : α) : f.comp g a = f (g a) :=
rfl
#align heyting_hom.comp_apply HeytingHom.comp_apply
@[simp]
theorem comp_assoc (f : HeytingHom γ δ) (g : HeytingHom β γ) (h : HeytingHom α β) :
(f.comp g).comp h = f.comp (g.comp h) :=
rfl
#align heyting_hom.comp_assoc HeytingHom.comp_assoc
@[simp]
theorem comp_id (f : HeytingHom α β) : f.comp (HeytingHom.id α) = f :=
ext fun _ => rfl
#align heyting_hom.comp_id HeytingHom.comp_id
@[simp]
theorem id_comp (f : HeytingHom α β) : (HeytingHom.id β).comp f = f :=
ext fun _ => rfl
#align heyting_hom.id_comp HeytingHom.id_comp
@[simp]
theorem cancel_right (hf : Surjective f) : g₁.comp f = g₂.comp f ↔ g₁ = g₂ :=
⟨fun h => ext <| hf.forall.2 <| DFunLike.ext_iff.1 h, congr_arg (fun a ↦ comp a f)⟩
#align heyting_hom.cancel_right HeytingHom.cancel_right
@[simp]
theorem cancel_left (hg : Injective g) : g.comp f₁ = g.comp f₂ ↔ f₁ = f₂ :=
⟨fun h => HeytingHom.ext fun a => hg <| by rw [← comp_apply, h, comp_apply], congr_arg _⟩
#align heyting_hom.cancel_left HeytingHom.cancel_left
end HeytingHom
namespace CoheytingHom
variable [CoheytingAlgebra α] [CoheytingAlgebra β] [CoheytingAlgebra γ] [CoheytingAlgebra δ]
instance : FunLike (CoheytingHom α β) α β where
coe f := f.toFun
coe_injective' f g h := by obtain ⟨⟨⟨_, _⟩, _⟩, _⟩ := f; obtain ⟨⟨⟨_, _⟩, _⟩, _⟩ := g; congr
instance : CoheytingHomClass (CoheytingHom α β) α β where
map_sup f := f.map_sup'
map_inf f := f.map_inf'
map_top f := f.map_top'
map_sdiff := CoheytingHom.map_sdiff'
-- @[simp] -- Porting note: not in simp-nf, simp can simplify lhs. Added aux simp lemma
theorem toFun_eq_coe {f : CoheytingHom α β} : f.toFun = (f : α → β) :=
rfl
#align coheyting_hom.to_fun_eq_coe CoheytingHom.toFun_eq_coe
@[simp]
theorem toFun_eq_coe_aux {f : CoheytingHom α β} : (↑f.toLatticeHom) = ⇑f :=
rfl
@[ext]
theorem ext {f g : CoheytingHom α β} (h : ∀ a, f a = g a) : f = g :=
DFunLike.ext f g h
#align coheyting_hom.ext CoheytingHom.ext
/-- Copy of a `CoheytingHom` with a new `toFun` equal to the old one. Useful to fix definitional
equalities. -/
protected def copy (f : CoheytingHom α β) (f' : α → β) (h : f' = f) : CoheytingHom α β where
toFun := f'
map_sup' := by simpa only [h] using map_sup f
map_inf' := by simpa only [h] using map_inf f
map_top' := by simpa only [h] using map_top f
map_sdiff' := by simpa only [h] using map_sdiff f
#align coheyting_hom.copy CoheytingHom.copy
@[simp]
theorem coe_copy (f : CoheytingHom α β) (f' : α → β) (h : f' = f) : ⇑(f.copy f' h) = f' :=
rfl
#align coheyting_hom.coe_copy CoheytingHom.coe_copy
theorem copy_eq (f : CoheytingHom α β) (f' : α → β) (h : f' = f) : f.copy f' h = f :=
DFunLike.ext' h
#align coheyting_hom.copy_eq CoheytingHom.copy_eq
variable (α)
/-- `id` as a `CoheytingHom`. -/
protected def id : CoheytingHom α α :=
{ TopHom.id _ with
toLatticeHom := LatticeHom.id _
map_sdiff' := fun _ _ => rfl }
#align coheyting_hom.id CoheytingHom.id
@[simp]
theorem coe_id : ⇑(CoheytingHom.id α) = id :=
rfl
#align coheyting_hom.coe_id CoheytingHom.coe_id
variable {α}
@[simp]
theorem id_apply (a : α) : CoheytingHom.id α a = a :=
rfl
#align coheyting_hom.id_apply CoheytingHom.id_apply
instance : Inhabited (CoheytingHom α α) :=
⟨CoheytingHom.id _⟩
instance : PartialOrder (CoheytingHom α β) :=
PartialOrder.lift _ DFunLike.coe_injective
/-- Composition of `CoheytingHom`s as a `CoheytingHom`. -/
def comp (f : CoheytingHom β γ) (g : CoheytingHom α β) : CoheytingHom α γ :=
{ f.toLatticeHom.comp g.toLatticeHom with
toFun := f ∘ g
map_top' := by simp
map_sdiff' := fun a b => by simp }
#align coheyting_hom.comp CoheytingHom.comp
variable {f f₁ f₂ : CoheytingHom α β} {g g₁ g₂ : CoheytingHom β γ}
@[simp]
theorem coe_comp (f : CoheytingHom β γ) (g : CoheytingHom α β) : ⇑(f.comp g) = f ∘ g :=
rfl
#align coheyting_hom.coe_comp CoheytingHom.coe_comp
@[simp]
theorem comp_apply (f : CoheytingHom β γ) (g : CoheytingHom α β) (a : α) : f.comp g a = f (g a) :=
rfl
#align coheyting_hom.comp_apply CoheytingHom.comp_apply
@[simp]
theorem comp_assoc (f : CoheytingHom γ δ) (g : CoheytingHom β γ) (h : CoheytingHom α β) :
(f.comp g).comp h = f.comp (g.comp h) :=
rfl
#align coheyting_hom.comp_assoc CoheytingHom.comp_assoc
@[simp]
theorem comp_id (f : CoheytingHom α β) : f.comp (CoheytingHom.id α) = f :=
ext fun _ => rfl
#align coheyting_hom.comp_id CoheytingHom.comp_id
@[simp]
theorem id_comp (f : CoheytingHom α β) : (CoheytingHom.id β).comp f = f :=
ext fun _ => rfl
#align coheyting_hom.id_comp CoheytingHom.id_comp
@[simp]
theorem cancel_right (hf : Surjective f) : g₁.comp f = g₂.comp f ↔ g₁ = g₂ :=
⟨fun h => ext <| hf.forall.2 <| DFunLike.ext_iff.1 h, congr_arg (fun a ↦ comp a f)⟩
#align coheyting_hom.cancel_right CoheytingHom.cancel_right
@[simp]
theorem cancel_left (hg : Injective g) : g.comp f₁ = g.comp f₂ ↔ f₁ = f₂ :=
⟨fun h => CoheytingHom.ext fun a => hg <| by rw [← comp_apply, h, comp_apply], congr_arg _⟩
#align coheyting_hom.cancel_left CoheytingHom.cancel_left
end CoheytingHom
namespace BiheytingHom
variable [BiheytingAlgebra α] [BiheytingAlgebra β] [BiheytingAlgebra γ] [BiheytingAlgebra δ]
instance : FunLike (BiheytingHom α β) α β where
coe f := f.toFun
coe_injective' f g h := by obtain ⟨⟨⟨_, _⟩, _⟩, _⟩ := f; obtain ⟨⟨⟨_, _⟩, _⟩, _⟩ := g; congr
instance : BiheytingHomClass (BiheytingHom α β) α β where
map_sup f := f.map_sup'
map_inf f := f.map_inf'
map_himp f := f.map_himp'
map_sdiff f := f.map_sdiff'
-- @[simp] -- Porting note: not in simp-nf, simp can simplify lhs. Added aux simp lemma
theorem toFun_eq_coe {f : BiheytingHom α β} : f.toFun = (f : α → β) :=
rfl
#align biheyting_hom.to_fun_eq_coe BiheytingHom.toFun_eq_coe
@[simp]
theorem toFun_eq_coe_aux {f : BiheytingHom α β} : (↑f.toLatticeHom) = ⇑f :=
rfl
@[ext]
theorem ext {f g : BiheytingHom α β} (h : ∀ a, f a = g a) : f = g :=
DFunLike.ext f g h
#align biheyting_hom.ext BiheytingHom.ext
/-- Copy of a `BiheytingHom` with a new `toFun` equal to the old one. Useful to fix definitional
equalities. -/
protected def copy (f : BiheytingHom α β) (f' : α → β) (h : f' = f) : BiheytingHom α β where
toFun := f'
map_sup' := by simpa only [h] using map_sup f
map_inf' := by simpa only [h] using map_inf f
map_himp' := by simpa only [h] using map_himp f
map_sdiff' := by simpa only [h] using map_sdiff f
#align biheyting_hom.copy BiheytingHom.copy
@[simp]
theorem coe_copy (f : BiheytingHom α β) (f' : α → β) (h : f' = f) : ⇑(f.copy f' h) = f' :=
rfl
#align biheyting_hom.coe_copy BiheytingHom.coe_copy
theorem copy_eq (f : BiheytingHom α β) (f' : α → β) (h : f' = f) : f.copy f' h = f :=
DFunLike.ext' h
#align biheyting_hom.copy_eq BiheytingHom.copy_eq
variable (α)
/-- `id` as a `BiheytingHom`. -/
protected def id : BiheytingHom α α :=
{ HeytingHom.id _, CoheytingHom.id _ with toLatticeHom := LatticeHom.id _ }
#align biheyting_hom.id BiheytingHom.id
@[simp]
theorem coe_id : ⇑(BiheytingHom.id α) = id :=
rfl
#align biheyting_hom.coe_id BiheytingHom.coe_id
variable {α}
@[simp]
theorem id_apply (a : α) : BiheytingHom.id α a = a :=
rfl
#align biheyting_hom.id_apply BiheytingHom.id_apply
instance : Inhabited (BiheytingHom α α) :=
⟨BiheytingHom.id _⟩
instance : PartialOrder (BiheytingHom α β) :=
PartialOrder.lift _ DFunLike.coe_injective
/-- Composition of `BiheytingHom`s as a `BiheytingHom`. -/
def comp (f : BiheytingHom β γ) (g : BiheytingHom α β) : BiheytingHom α γ :=
{ f.toLatticeHom.comp g.toLatticeHom with
toFun := f ∘ g
map_himp' := fun a b => by simp
map_sdiff' := fun a b => by simp }
#align biheyting_hom.comp BiheytingHom.comp
variable {f f₁ f₂ : BiheytingHom α β} {g g₁ g₂ : BiheytingHom β γ}
@[simp]
theorem coe_comp (f : BiheytingHom β γ) (g : BiheytingHom α β) : ⇑(f.comp g) = f ∘ g :=
rfl
#align biheyting_hom.coe_comp BiheytingHom.coe_comp
@[simp]
theorem comp_apply (f : BiheytingHom β γ) (g : BiheytingHom α β) (a : α) : f.comp g a = f (g a) :=
rfl
#align biheyting_hom.comp_apply BiheytingHom.comp_apply
@[simp]
theorem comp_assoc (f : BiheytingHom γ δ) (g : BiheytingHom β γ) (h : BiheytingHom α β) :
(f.comp g).comp h = f.comp (g.comp h) :=
rfl
#align biheyting_hom.comp_assoc BiheytingHom.comp_assoc
@[simp]
theorem comp_id (f : BiheytingHom α β) : f.comp (BiheytingHom.id α) = f :=
ext fun _ => rfl
#align biheyting_hom.comp_id BiheytingHom.comp_id
@[simp]
theorem id_comp (f : BiheytingHom α β) : (BiheytingHom.id β).comp f = f :=
ext fun _ => rfl
#align biheyting_hom.id_comp BiheytingHom.id_comp
@[simp]
theorem cancel_right (hf : Surjective f) : g₁.comp f = g₂.comp f ↔ g₁ = g₂ :=
⟨fun h => ext <| hf.forall.2 <| DFunLike.ext_iff.1 h, congr_arg (fun a ↦ comp a f)⟩
#align biheyting_hom.cancel_right BiheytingHom.cancel_right
@[simp]
theorem cancel_left (hg : Injective g) : g.comp f₁ = g.comp f₂ ↔ f₁ = f₂ :=
⟨fun h => BiheytingHom.ext fun a => hg <| by rw [← comp_apply, h, comp_apply], congr_arg _⟩
#align biheyting_hom.cancel_left BiheytingHom.cancel_left
end BiheytingHom