This repository was archived by the owner on Jul 24, 2024. It is now read-only.
File tree Expand file tree Collapse file tree 1 file changed +15
-0
lines changed Expand file tree Collapse file tree 1 file changed +15
-0
lines changed Original file line number Diff line number Diff line change @@ -493,6 +493,14 @@ option.rec h₁ h₂
493
493
theorem coe_eq_coe {a b : α} : (a : with_bot α) = b ↔ a = b :=
494
494
by rw [← option.some.inj_eq a b]; refl
495
495
496
+ /-- Deconstruct a `x : with_bot α` to the underlying value in `α`, given a proof that `x ≠ ⊥`. -/
497
+ def unbot : Π (x : with_bot α), x ≠ ⊥ → α
498
+ | ⊥ h := absurd rfl h
499
+ | (some x) h := x
500
+
501
+ @[simp] lemma unbot_coe (x : α) (h : (x : with_bot α) ≠ ⊥ := coe_ne_bot _) :
502
+ (x : with_bot α).unbot h = x := rfl
503
+
496
504
@[priority 10 ]
497
505
instance has_lt [has_lt α] : has_lt (with_bot α) :=
498
506
{ lt := λ o₁ o₂ : option α, ∃ b ∈ o₂, ∀ a ∈ o₁, a < b }
@@ -720,6 +728,13 @@ by rw [← option.some.inj_eq a b]; refl
720
728
@[simp] theorem top_ne_coe {a : α} : ⊤ ≠ (a : with_top α) .
721
729
@[simp] theorem coe_ne_top {a : α} : (a : with_top α) ≠ ⊤ .
722
730
731
+ /-- Deconstruct a `x : with_top α` to the underlying value in `α`, given a proof that `x ≠ ⊤`. -/
732
+ def untop : Π (x : with_top α), x ≠ ⊤ → α :=
733
+ with_bot.unbot
734
+
735
+ @[simp] lemma untop_coe (x : α) (h : (x : with_top α) ≠ ⊤ := coe_ne_top) :
736
+ (x : with_top α).untop h = x := rfl
737
+
723
738
@[priority 10 ]
724
739
instance has_lt [has_lt α] : has_lt (with_top α) :=
725
740
{ lt := λ o₁ o₂ : option α, ∃ b ∈ o₁, ∀ a ∈ o₂, b < a }
You can’t perform that action at this time.
0 commit comments