@@ -30,8 +30,8 @@ The difference with `Denumerable` is that finite types are encodable. For infini
30
30
partial inverse `decode : ℕ → Option α`.
31
31
* `decode₂`: Version of `decode` that is equal to `none` outside of the range of `encode`. Useful as
32
32
we do not require this in the definition of `decode`.
33
- * `Ulower α`: Any encodable type has an equivalent type living in the lowest universe, namely a
34
- subtype of `ℕ`. `Ulower α` finds it.
33
+ * `ULower α`: Any encodable type has an equivalent type living in the lowest universe, namely a
34
+ subtype of `ℕ`. `ULower α` finds it.
35
35
36
36
## Implementation notes
37
37
@@ -479,73 +479,73 @@ theorem nonempty_encodable (α : Type _) [Countable α] : Nonempty (Encodable α
479
479
instance : Countable ℕ+ := by delta PNat; infer_instance
480
480
481
481
-- short-circuit instance search
482
- section Ulower
482
+ section ULower
483
483
484
484
attribute [local instance] Encodable.decidableRangeEncode
485
485
486
486
/-- `ULower α : Type` is an equivalent type in the lowest universe, given `Encodable α`. -/
487
- def Ulower (α : Type _) [Encodable α] : Type :=
487
+ def ULower (α : Type _) [Encodable α] : Type :=
488
488
Set.range (Encodable.encode : α → ℕ)
489
- #align ulower Ulower
489
+ #align ulower ULower
490
490
491
- instance {α : Type _} [Encodable α] : DecidableEq (Ulower α) :=
492
- by delta Ulower ; exact Encodable.decidableEqOfEncodable _
491
+ instance {α : Type _} [Encodable α] : DecidableEq (ULower α) :=
492
+ by delta ULower ; exact Encodable.decidableEqOfEncodable _
493
493
494
- instance {α : Type _} [Encodable α] : Encodable (Ulower α) :=
495
- by delta Ulower ; infer_instance
494
+ instance {α : Type _} [Encodable α] : Encodable (ULower α) :=
495
+ by delta ULower ; infer_instance
496
496
497
- end Ulower
497
+ end ULower
498
498
499
- namespace Ulower
499
+ namespace ULower
500
500
501
501
variable (α : Type _) [Encodable α]
502
502
503
- /-- The equivalence between the encodable type `α` and `Ulower α : Type`. -/
504
- def equiv : α ≃ Ulower α :=
503
+ /-- The equivalence between the encodable type `α` and `ULower α : Type`. -/
504
+ def equiv : α ≃ ULower α :=
505
505
Encodable.equivRangeEncode α
506
- #align ulower.equiv Ulower .equiv
506
+ #align ulower.equiv ULower .equiv
507
507
508
508
variable {α}
509
509
510
- /-- Lowers an `a : α` into `Ulower α`. -/
511
- def down (a : α) : Ulower α :=
510
+ /-- Lowers an `a : α` into `ULower α`. -/
511
+ def down (a : α) : ULower α :=
512
512
equiv α a
513
- #align ulower.down Ulower .down
513
+ #align ulower.down ULower .down
514
514
515
- instance [Inhabited α] : Inhabited (Ulower α) :=
515
+ instance [Inhabited α] : Inhabited (ULower α) :=
516
516
⟨down default⟩
517
517
518
- /-- Lifts an `a : Ulower α` into `α`. -/
519
- def up (a : Ulower α) : α :=
518
+ /-- Lifts an `a : ULower α` into `α`. -/
519
+ def up (a : ULower α) : α :=
520
520
(equiv α).symm a
521
- #align ulower.up Ulower .up
521
+ #align ulower.up ULower .up
522
522
523
523
@[simp]
524
- theorem down_up {a : Ulower α} : down a.up = a :=
524
+ theorem down_up {a : ULower α} : down a.up = a :=
525
525
Equiv.right_inv _ _
526
- #align ulower.down_up Ulower .down_up
526
+ #align ulower.down_up ULower .down_up
527
527
528
528
@[simp]
529
529
theorem up_down {a : α} : (down a).up = a := by
530
530
simp [up, down,Equiv.left_inv _ _, Equiv.symm_apply_apply]
531
- #align ulower.up_down Ulower .up_down
531
+ #align ulower.up_down ULower .up_down
532
532
533
533
@[simp]
534
- theorem up_eq_up {a b : Ulower α} : a.up = b.up ↔ a = b :=
534
+ theorem up_eq_up {a b : ULower α} : a.up = b.up ↔ a = b :=
535
535
Equiv.apply_eq_iff_eq _
536
- #align ulower.up_eq_up Ulower .up_eq_up
536
+ #align ulower.up_eq_up ULower .up_eq_up
537
537
538
538
@[simp]
539
539
theorem down_eq_down {a b : α} : down a = down b ↔ a = b :=
540
540
Equiv.apply_eq_iff_eq _
541
- #align ulower.down_eq_down Ulower .down_eq_down
541
+ #align ulower.down_eq_down ULower .down_eq_down
542
542
543
543
@[ext]
544
- protected theorem ext {a b : Ulower α} : a.up = b.up → a = b :=
544
+ protected theorem ext {a b : ULower α} : a.up = b.up → a = b :=
545
545
up_eq_up.1
546
- #align ulower.ext Ulower .ext
546
+ #align ulower.ext ULower .ext
547
547
548
- end Ulower
548
+ end ULower
549
549
550
550
/-
551
551
Choice function for encodable types and decidable predicates.
0 commit comments