data.option.basic
⟷
Mathlib.Data.Option.Basic
The following section lists changes to this file in mathlib3 and mathlib4 that occured after the initial port. Most recent changes are shown first. Hovering over a commit will show all commits associated with the same mathlib3 commit.
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(last sync)
mathlib commit https://github.com/leanprover-community/mathlib/commit/65a1391a0106c9204fe45bc73a039f056558cb83
@@ -766,7 +766,7 @@ theorem ne_none_iff_exists' {o : Option α} : o ≠ none ↔ ∃ x : α, o = som
#align option.ne_none_iff_exists' Option.ne_none_iff_exists'
-/
-/- ./././Mathport/Syntax/Translate/Basic.lean:641:2: warning: expanding binder collection (x «expr ≠ » none[option.none]) -/
+/- ./././Mathport/Syntax/Translate/Basic.lean:642:2: warning: expanding binder collection (x «expr ≠ » none[option.none]) -/
#print Option.bex_ne_none /-
theorem bex_ne_none {p : Option α → Prop} : (∃ (x : _) (_ : x ≠ none), p x) ↔ ∃ x, p (some x) :=
⟨fun ⟨x, hx, hp⟩ => ⟨get <| ne_none_iff_isSome.1 hx, by rwa [some_get]⟩, fun ⟨x, hx⟩ =>
@@ -774,7 +774,7 @@ theorem bex_ne_none {p : Option α → Prop} : (∃ (x : _) (_ : x ≠ none), p
#align option.bex_ne_none Option.bex_ne_none
-/
-/- ./././Mathport/Syntax/Translate/Basic.lean:641:2: warning: expanding binder collection (x «expr ≠ » none[option.none]) -/
+/- ./././Mathport/Syntax/Translate/Basic.lean:642:2: warning: expanding binder collection (x «expr ≠ » none[option.none]) -/
#print Option.ball_ne_none /-
theorem ball_ne_none {p : Option α → Prop} : (∀ (x) (_ : x ≠ none), p x) ↔ ∀ x, p (some x) :=
⟨fun h x => h (some x) (some_ne_none x), fun h x hx => by
mathlib commit https://github.com/leanprover-community/mathlib/commit/65a1391a0106c9204fe45bc73a039f056558cb83
@@ -192,7 +192,7 @@ theorem ext : ∀ {o₁ o₂ : Option α}, (∀ a, a ∈ o₁ ↔ a ∈ o₂)
#print Option.eq_none_iff_forall_not_mem /-
theorem eq_none_iff_forall_not_mem {o : Option α} : o = none ↔ ∀ a, a ∉ o :=
- ⟨fun e a h => by rw [e] at h <;> cases h, fun h => ext <| by simpa⟩
+ ⟨fun e a h => by rw [e] at h <;> cases h, fun h => ext <| by simpa⟩
#align option.eq_none_iff_forall_not_mem Option.eq_none_iff_forall_not_mem
-/
@@ -614,7 +614,7 @@ theorem pbind_eq_some {f : ∀ a : α, a ∈ x → Option β} {y : β} :
use x
simpa only [mem_def, exists_prop_of_true] using h
· rintro ⟨z, H, hz⟩
- simp only [mem_def] at H
+ simp only [mem_def] at H
simpa only [H] using hz
#align option.pbind_eq_some Option.pbind_eq_some
-/
@@ -634,10 +634,10 @@ theorem pmap_eq_some_iff {hf} {y : β} :
· simp only [not_mem_none, exists_false, pmap, not_false_iff, exists_prop_of_false]
· constructor
· intro h
- simp only [pmap] at h
+ simp only [pmap] at h
exact ⟨x, rfl, h⟩
· rintro ⟨a, H, rfl⟩
- simp only [mem_def] at H
+ simp only [mem_def] at H
simp only [H, pmap]
#align option.pmap_eq_some_iff Option.pmap_eq_some_iff
-/
mathlib commit https://github.com/leanprover-community/mathlib/commit/65a1391a0106c9204fe45bc73a039f056558cb83
@@ -312,10 +312,10 @@ theorem joinM_eq_join : joinM = @join α :=
#align option.join_eq_join Option.joinM_eq_join
-/
-#print Option.bind_eq_bind /-
-theorem bind_eq_bind {α β : Type _} {f : α → Option β} {x : Option α} : x >>= f = x.bind f :=
+#print Option.bind_eq_bind' /-
+theorem bind_eq_bind' {α β : Type _} {f : α → Option β} {x : Option α} : x >>= f = x.bind f :=
rfl
-#align option.bind_eq_bind Option.bind_eq_bind
+#align option.bind_eq_bind Option.bind_eq_bind'
-/
#print Option.map_eq_map /-
mathlib commit https://github.com/leanprover-community/mathlib/commit/ce64cd319bb6b3e82f31c2d38e79080d377be451
@@ -3,9 +3,9 @@ Copyright (c) 2017 Mario Carneiro. All rights reserved.
Released under Apache 2.0 license as described in the file LICENSE.
Authors: Mario Carneiro
-/
-import Mathbin.Logic.IsEmpty
-import Mathbin.Control.Traversable.Basic
-import Mathbin.Tactic.Basic
+import Logic.IsEmpty
+import Control.Traversable.Basic
+import Tactic.Basic
#align_import data.option.basic from "leanprover-community/mathlib"@"448144f7ae193a8990cb7473c9e9a01990f64ac7"
@@ -766,7 +766,7 @@ theorem ne_none_iff_exists' {o : Option α} : o ≠ none ↔ ∃ x : α, o = som
#align option.ne_none_iff_exists' Option.ne_none_iff_exists'
-/
-/- ./././Mathport/Syntax/Translate/Basic.lean:635:2: warning: expanding binder collection (x «expr ≠ » none[option.none]) -/
+/- ./././Mathport/Syntax/Translate/Basic.lean:641:2: warning: expanding binder collection (x «expr ≠ » none[option.none]) -/
#print Option.bex_ne_none /-
theorem bex_ne_none {p : Option α → Prop} : (∃ (x : _) (_ : x ≠ none), p x) ↔ ∃ x, p (some x) :=
⟨fun ⟨x, hx, hp⟩ => ⟨get <| ne_none_iff_isSome.1 hx, by rwa [some_get]⟩, fun ⟨x, hx⟩ =>
@@ -774,7 +774,7 @@ theorem bex_ne_none {p : Option α → Prop} : (∃ (x : _) (_ : x ≠ none), p
#align option.bex_ne_none Option.bex_ne_none
-/
-/- ./././Mathport/Syntax/Translate/Basic.lean:635:2: warning: expanding binder collection (x «expr ≠ » none[option.none]) -/
+/- ./././Mathport/Syntax/Translate/Basic.lean:641:2: warning: expanding binder collection (x «expr ≠ » none[option.none]) -/
#print Option.ball_ne_none /-
theorem ball_ne_none {p : Option α → Prop} : (∀ (x) (_ : x ≠ none), p x) ↔ ∀ x, p (some x) :=
⟨fun h x => h (some x) (some_ne_none x), fun h x hx => by
mathlib commit https://github.com/leanprover-community/mathlib/commit/8ea5598db6caeddde6cb734aa179cc2408dbd345
@@ -107,6 +107,8 @@ theorem get_some (x : α) (h : isSome (some x)) : Option.get h = x :=
#align option.get_some Option.get_some
-/
+/- warning: option.get_or_else_some clashes with option.get_or_else_coe -> Option.getD_some
+Case conversion may be inaccurate. Consider using '#align option.get_or_else_some Option.getD_someₓ'. -/
#print Option.getD_some /-
@[simp]
theorem getD_some (x y : α) : Option.getD (some x) y = x :=
@@ -121,11 +123,11 @@ theorem getD_none (x : α) : Option.getD none x = x :=
#align option.get_or_else_none Option.getD_none
-/
-#print Option.getD_coe /-
+#print Option.getD_some /-
@[simp]
-theorem getD_coe (x y : α) : Option.getD (↑x) y = x :=
+theorem getD_some (x y : α) : Option.getD (↑x) y = x :=
rfl
-#align option.get_or_else_coe Option.getD_coe
+#align option.get_or_else_coe Option.getD_some
-/
#print Option.getD_of_ne_none /-
@@ -451,16 +453,22 @@ theorem mem_map_of_mem {a : α} {x : Option α} (g : α → β) (h : a ∈ x) :
#align option.mem_map_of_mem Option.mem_map_of_mem
-/
+#print Option.mem_map /-
theorem mem_map {f : α → β} {y : β} {o : Option α} : y ∈ o.map f ↔ ∃ x ∈ o, f x = y := by simp
#align option.mem_map Option.mem_map
+-/
+#print Option.forall_mem_map /-
theorem forall_mem_map {f : α → β} {o : Option α} {p : β → Prop} :
(∀ y ∈ o.map f, p y) ↔ ∀ x ∈ o, p (f x) := by simp
#align option.forall_mem_map Option.forall_mem_map
+-/
+#print Option.exists_mem_map /-
theorem exists_mem_map {f : α → β} {o : Option α} {p : β → Prop} :
(∃ y ∈ o.map f, p y) ↔ ∃ x ∈ o, p (f x) := by simp
#align option.exists_mem_map Option.exists_mem_map
+-/
#print Option.bind_map_comm /-
theorem bind_map_comm {α β} {x : Option (Option α)} {f : α → β} :
mathlib commit https://github.com/leanprover-community/mathlib/commit/8ea5598db6caeddde6cb734aa179cc2408dbd345
@@ -2,16 +2,13 @@
Copyright (c) 2017 Mario Carneiro. All rights reserved.
Released under Apache 2.0 license as described in the file LICENSE.
Authors: Mario Carneiro
-
-! This file was ported from Lean 3 source module data.option.basic
-! leanprover-community/mathlib commit 448144f7ae193a8990cb7473c9e9a01990f64ac7
-! Please do not edit these lines, except to modify the commit id
-! if you have ported upstream changes.
-/
import Mathbin.Logic.IsEmpty
import Mathbin.Control.Traversable.Basic
import Mathbin.Tactic.Basic
+#align_import data.option.basic from "leanprover-community/mathlib"@"448144f7ae193a8990cb7473c9e9a01990f64ac7"
+
/-!
# Option of a type
@@ -761,7 +758,7 @@ theorem ne_none_iff_exists' {o : Option α} : o ≠ none ↔ ∃ x : α, o = som
#align option.ne_none_iff_exists' Option.ne_none_iff_exists'
-/
-/- ./././Mathport/Syntax/Translate/Basic.lean:638:2: warning: expanding binder collection (x «expr ≠ » none[option.none]) -/
+/- ./././Mathport/Syntax/Translate/Basic.lean:635:2: warning: expanding binder collection (x «expr ≠ » none[option.none]) -/
#print Option.bex_ne_none /-
theorem bex_ne_none {p : Option α → Prop} : (∃ (x : _) (_ : x ≠ none), p x) ↔ ∃ x, p (some x) :=
⟨fun ⟨x, hx, hp⟩ => ⟨get <| ne_none_iff_isSome.1 hx, by rwa [some_get]⟩, fun ⟨x, hx⟩ =>
@@ -769,7 +766,7 @@ theorem bex_ne_none {p : Option α → Prop} : (∃ (x : _) (_ : x ≠ none), p
#align option.bex_ne_none Option.bex_ne_none
-/
-/- ./././Mathport/Syntax/Translate/Basic.lean:638:2: warning: expanding binder collection (x «expr ≠ » none[option.none]) -/
+/- ./././Mathport/Syntax/Translate/Basic.lean:635:2: warning: expanding binder collection (x «expr ≠ » none[option.none]) -/
#print Option.ball_ne_none /-
theorem ball_ne_none {p : Option α → Prop} : (∀ (x) (_ : x ≠ none), p x) ↔ ∀ x, p (some x) :=
⟨fun h x => h (some x) (some_ne_none x), fun h x hx => by
mathlib commit https://github.com/leanprover-community/mathlib/commit/9fb8964792b4237dac6200193a0d533f1b3f7423
@@ -167,16 +167,20 @@ theorem some_injective (α : Type _) : Function.Injective (@some α) := fun _ _
#align option.some_injective Option.some_injective
-/
+#print Option.map_injective /-
/-- `option.map f` is injective if `f` is injective. -/
theorem map_injective {f : α → β} (Hf : Function.Injective f) : Function.Injective (Option.map f)
| none, none, H => rfl
| some a₁, some a₂, H => by rw [Hf (Option.some.inj H)]
#align option.map_injective Option.map_injective
+-/
+#print Option.map_comp_some /-
@[simp]
theorem map_comp_some (f : α → β) : Option.map f ∘ some = some ∘ f :=
rfl
#align option.map_comp_some Option.map_comp_some
+-/
#print Option.ext /-
@[ext]
@@ -193,15 +197,19 @@ theorem eq_none_iff_forall_not_mem {o : Option α} : o = none ↔ ∀ a, a ∉ o
#align option.eq_none_iff_forall_not_mem Option.eq_none_iff_forall_not_mem
-/
+#print Option.none_bind /-
@[simp]
theorem none_bind {α β} (f : α → Option β) : none >>= f = none :=
rfl
#align option.none_bind Option.none_bind
+-/
+#print Option.some_bind /-
@[simp]
theorem some_bind {α β} (a : α) (f : α → Option β) : some a >>= f = f a :=
rfl
#align option.some_bind Option.some_bind
+-/
#print Option.none_bind' /-
@[simp]
@@ -217,50 +225,66 @@ theorem some_bind' (a : α) (f : α → Option β) : (some a).bind f = f a :=
#align option.some_bind' Option.some_bind'
-/
+#print Option.bind_some /-
@[simp]
theorem bind_some : ∀ x : Option α, x >>= some = x :=
@bind_pure α Option _ _
#align option.bind_some Option.bind_some
+-/
@[simp]
theorem bind_some' : ∀ x : Option α, x.bind some = x :=
bind_some
#align option.bind_some' Option.bind_some'
+#print Option.bind_eq_some /-
@[simp]
theorem bind_eq_some {α β} {x : Option α} {f : α → Option β} {b : β} :
x >>= f = some b ↔ ∃ a, x = some a ∧ f a = some b := by cases x <;> simp
#align option.bind_eq_some Option.bind_eq_some
+-/
+#print Option.bind_eq_some' /-
@[simp]
theorem bind_eq_some' {x : Option α} {f : α → Option β} {b : β} :
x.bind f = some b ↔ ∃ a, x = some a ∧ f a = some b := by cases x <;> simp
#align option.bind_eq_some' Option.bind_eq_some'
+-/
+#print Option.bind_eq_none' /-
@[simp]
theorem bind_eq_none' {o : Option α} {f : α → Option β} :
o.bind f = none ↔ ∀ b a, a ∈ o → b ∉ f a := by
simp only [eq_none_iff_forall_not_mem, not_exists, not_and, mem_def, bind_eq_some']
#align option.bind_eq_none' Option.bind_eq_none'
+-/
+#print Option.bind_eq_none /-
@[simp]
theorem bind_eq_none {α β} {o : Option α} {f : α → Option β} :
o >>= f = none ↔ ∀ b a, a ∈ o → b ∉ f a :=
bind_eq_none'
#align option.bind_eq_none Option.bind_eq_none
+-/
+#print Option.bind_comm /-
theorem bind_comm {α β γ} {f : α → β → Option γ} (a : Option α) (b : Option β) :
(a.bind fun x => b.bind (f x)) = b.bind fun y => a.bind fun x => f x y := by
cases a <;> cases b <;> rfl
#align option.bind_comm Option.bind_comm
+-/
+#print Option.bind_assoc /-
theorem bind_assoc (x : Option α) (f : α → Option β) (g : β → Option γ) :
(x.bind f).bind g = x.bind fun y => (f y).bind g := by cases x <;> rfl
#align option.bind_assoc Option.bind_assoc
+-/
+#print Option.join_eq_some /-
theorem join_eq_some {x : Option (Option α)} {a : α} : x.join = some a ↔ x = some (some a) := by
simp
#align option.join_eq_some Option.join_eq_some
+-/
#print Option.join_ne_none /-
theorem join_ne_none {x : Option (Option α)} : x.join ≠ none ↔ ∃ z, x = some (some z) := by simp
@@ -278,43 +302,61 @@ theorem join_eq_none {o : Option (Option α)} : o.join = none ↔ o = none ∨ o
#align option.join_eq_none Option.join_eq_none
-/
+#print Option.bind_id_eq_join /-
theorem bind_id_eq_join {x : Option (Option α)} : x >>= id = x.join := by simp
#align option.bind_id_eq_join Option.bind_id_eq_join
+-/
+#print Option.joinM_eq_join /-
theorem joinM_eq_join : joinM = @join α :=
funext fun x => by rw [joinM, bind_id_eq_join]
#align option.join_eq_join Option.joinM_eq_join
+-/
+#print Option.bind_eq_bind /-
theorem bind_eq_bind {α β : Type _} {f : α → Option β} {x : Option α} : x >>= f = x.bind f :=
rfl
#align option.bind_eq_bind Option.bind_eq_bind
+-/
+#print Option.map_eq_map /-
@[simp]
theorem map_eq_map {α β} {f : α → β} : (· <$> ·) f = Option.map f :=
rfl
#align option.map_eq_map Option.map_eq_map
+-/
+#print Option.map_none /-
theorem map_none {α β} {f : α → β} : f <$> none = none :=
rfl
#align option.map_none Option.map_none
+-/
+#print Option.map_some /-
theorem map_some {α β} {a : α} {f : α → β} : f <$> some a = some (f a) :=
rfl
#align option.map_some Option.map_some
+-/
+#print Option.map_coe /-
theorem map_coe {α β} {a : α} {f : α → β} : f <$> (a : Option α) = ↑(f a) :=
rfl
#align option.map_coe Option.map_coe
+-/
+#print Option.map_none' /-
@[simp]
theorem map_none' {f : α → β} : Option.map f none = none :=
rfl
#align option.map_none' Option.map_none'
+-/
+#print Option.map_some' /-
@[simp]
theorem map_some' {a : α} {f : α → β} : Option.map f (some a) = some (f a) :=
rfl
#align option.map_some' Option.map_some'
+-/
#print Option.map_coe' /-
@[simp]
@@ -323,37 +365,51 @@ theorem map_coe' {a : α} {f : α → β} : Option.map f (a : Option α) = ↑(f
#align option.map_coe' Option.map_coe'
-/
+#print Option.map_eq_some /-
theorem map_eq_some {α β} {x : Option α} {f : α → β} {b : β} :
f <$> x = some b ↔ ∃ a, x = some a ∧ f a = b := by cases x <;> simp
#align option.map_eq_some Option.map_eq_some
+-/
+#print Option.map_eq_some' /-
@[simp]
theorem map_eq_some' {x : Option α} {f : α → β} {b : β} :
x.map f = some b ↔ ∃ a, x = some a ∧ f a = b := by cases x <;> simp
#align option.map_eq_some' Option.map_eq_some'
+-/
+#print Option.map_eq_none /-
theorem map_eq_none {α β} {x : Option α} {f : α → β} : f <$> x = none ↔ x = none := by
cases x <;> simp only [map_none, map_some, eq_self_iff_true]
#align option.map_eq_none Option.map_eq_none
+-/
+#print Option.map_eq_none' /-
@[simp]
theorem map_eq_none' {x : Option α} {f : α → β} : x.map f = none ↔ x = none := by
cases x <;> simp only [map_none', map_some', eq_self_iff_true]
#align option.map_eq_none' Option.map_eq_none'
+-/
+#print Option.map_injective' /-
/-- `option.map` as a function between functions is injective. -/
theorem map_injective' : Function.Injective (@Option.map α β) := fun f g h =>
funext fun x => some_injective _ <| by simp only [← map_some', h]
#align option.map_injective' Option.map_injective'
+-/
+#print Option.map_inj /-
@[simp]
theorem map_inj {f g : α → β} : Option.map f = Option.map g ↔ f = g :=
map_injective'.eq_iff
#align option.map_inj Option.map_inj
+-/
+#print Option.map_congr /-
theorem map_congr {f g : α → β} {x : Option α} (h : ∀ a ∈ x, f a = g a) :
Option.map f x = Option.map g x := by cases x <;> simp only [map_none', map_some', h, mem_def]
#align option.map_congr Option.map_congr
+-/
attribute [simp] map_id
@@ -364,29 +420,39 @@ theorem map_eq_id {f : α → α} : Option.map f = id ↔ f = id :=
#align option.map_eq_id Option.map_eq_id
-/
+#print Option.map_map /-
@[simp]
theorem map_map (h : β → γ) (g : α → β) (x : Option α) :
Option.map h (Option.map g x) = Option.map (h ∘ g) x := by
cases x <;> simp only [map_none', map_some']
#align option.map_map Option.map_map
+-/
+#print Option.map_comm /-
theorem map_comm {f₁ : α → β} {f₂ : α → γ} {g₁ : β → δ} {g₂ : γ → δ} (h : g₁ ∘ f₁ = g₂ ∘ f₂)
(a : α) : (Option.map f₁ a).map g₁ = (Option.map f₂ a).map g₂ := by rw [map_map, h, ← map_map]
#align option.map_comm Option.map_comm
+-/
+#print Option.comp_map /-
theorem comp_map (h : β → γ) (g : α → β) (x : Option α) :
Option.map (h ∘ g) x = Option.map h (Option.map g x) :=
(map_map _ _ _).symm
#align option.comp_map Option.comp_map
+-/
+#print Option.map_comp_map /-
@[simp]
theorem map_comp_map (f : α → β) (g : β → γ) : Option.map g ∘ Option.map f = Option.map (g ∘ f) :=
by ext x; rw [comp_map]
#align option.map_comp_map Option.map_comp_map
+-/
+#print Option.mem_map_of_mem /-
theorem mem_map_of_mem {a : α} {x : Option α} (g : α → β) (h : a ∈ x) : g a ∈ x.map g :=
mem_def.mpr ((mem_def.mp h).symm ▸ map_some')
#align option.mem_map_of_mem Option.mem_map_of_mem
+-/
theorem mem_map {f : α → β} {y : β} {o : Option α} : y ∈ o.map f ↔ ∃ x ∈ o, f x = y := by simp
#align option.mem_map Option.mem_map
@@ -399,13 +465,17 @@ theorem exists_mem_map {f : α → β} {o : Option α} {p : β → Prop} :
(∃ y ∈ o.map f, p y) ↔ ∃ x ∈ o, p (f x) := by simp
#align option.exists_mem_map Option.exists_mem_map
+#print Option.bind_map_comm /-
theorem bind_map_comm {α β} {x : Option (Option α)} {f : α → β} :
x >>= Option.map f = x.map (Option.map f) >>= id := by cases x <;> simp
#align option.bind_map_comm Option.bind_map_comm
+-/
+#print Option.join_map_eq_map_join /-
theorem join_map_eq_map_join {f : α → β} {x : Option (Option α)} :
(x.map (Option.map f)).join = x.join.map f := by rcases x with (_ | _ | x) <;> simp
#align option.join_map_eq_map_join Option.join_map_eq_map_join
+-/
#print Option.join_join /-
theorem join_join {x : Option (Option (Option α))} : x.join.join = (x.map join).join := by
@@ -430,28 +500,38 @@ theorem pbind_eq_bind (f : α → Option β) (x : Option α) : (x.pbind fun a _
#align option.pbind_eq_bind Option.pbind_eq_bind
-/
+#print Option.map_bind /-
theorem map_bind {α β γ} (f : β → γ) (x : Option α) (g : α → Option β) :
Option.map f (x >>= g) = x >>= fun a => Option.map f (g a) := by
simp_rw [← map_eq_map, ← bind_pure_comp_eq_map, LawfulMonad.bind_assoc]
#align option.map_bind Option.map_bind
+-/
+#print Option.map_bind' /-
theorem map_bind' (f : β → γ) (x : Option α) (g : α → Option β) :
Option.map f (x.bind g) = x.bind fun a => Option.map f (g a) := by cases x <;> simp
#align option.map_bind' Option.map_bind'
+-/
+#print Option.map_pbind /-
theorem map_pbind (f : β → γ) (x : Option α) (g : ∀ a, a ∈ x → Option β) :
Option.map f (x.pbind g) = x.pbind fun a H => Option.map f (g a H) := by
cases x <;> simp only [pbind, map_none']
#align option.map_pbind Option.map_pbind
+-/
+#print Option.pbind_map /-
theorem pbind_map (f : α → β) (x : Option α) (g : ∀ b : β, b ∈ x.map f → Option γ) :
pbind (Option.map f x) g = x.pbind fun a h => g (f a) (mem_map_of_mem _ h) := by cases x <;> rfl
#align option.pbind_map Option.pbind_map
+-/
+#print Option.pmap_none /-
@[simp]
theorem pmap_none (f : ∀ a : α, p a → β) {H} : pmap f (@none α) H = none :=
rfl
#align option.pmap_none Option.pmap_none
+-/
#print Option.pmap_some /-
@[simp]
@@ -461,39 +541,52 @@ theorem pmap_some (f : ∀ a : α, p a → β) {x : α} (h : p x) :
#align option.pmap_some Option.pmap_some
-/
+#print Option.mem_pmem /-
theorem mem_pmem {a : α} (h : ∀ a ∈ x, p a) (ha : a ∈ x) : f a (h a ha) ∈ pmap f x h := by
rw [mem_def] at ha ⊢; subst ha; rfl
#align option.mem_pmem Option.mem_pmem
+-/
+#print Option.pmap_map /-
theorem pmap_map (g : γ → α) (x : Option γ) (H) :
pmap f (x.map g) H = pmap (fun a h => f (g a) h) x fun a h => H _ (mem_map_of_mem _ h) := by
cases x <;> simp only [map_none', map_some', pmap]
#align option.pmap_map Option.pmap_map
+-/
+#print Option.map_pmap /-
theorem map_pmap (g : β → γ) (f : ∀ a, p a → β) (x H) :
Option.map g (pmap f x H) = pmap (fun a h => g (f a h)) x H := by
cases x <;> simp only [map_none', map_some', pmap]
#align option.map_pmap Option.map_pmap
+-/
+#print Option.pmap_eq_map /-
@[simp]
theorem pmap_eq_map (p : α → Prop) (f : α → β) (x H) :
@pmap _ _ p (fun a _ => f a) x H = Option.map f x := by
cases x <;> simp only [map_none', map_some', pmap]
#align option.pmap_eq_map Option.pmap_eq_map
+-/
+#print Option.pmap_bind /-
theorem pmap_bind {α β γ} {x : Option α} {g : α → Option β} {p : β → Prop} {f : ∀ b, p b → γ} (H)
(H' : ∀ (a : α), ∀ b ∈ g a, b ∈ x >>= g) :
pmap f (x >>= g) H = x >>= fun a => pmap f (g a) fun b h => H _ (H' a _ h) := by
cases x <;> simp only [pmap, none_bind, some_bind]
#align option.pmap_bind Option.pmap_bind
+-/
+#print Option.bind_pmap /-
theorem bind_pmap {α β γ} {p : α → Prop} (f : ∀ a, p a → β) (x : Option α) (g : β → Option γ) (H) :
pmap f x H >>= g = x.pbind fun a h => g (f a (H _ h)) := by
cases x <;> simp only [pmap, none_bind, some_bind, pbind]
#align option.bind_pmap Option.bind_pmap
+-/
variable {f x}
+#print Option.pbind_eq_none /-
theorem pbind_eq_none {f : ∀ a : α, a ∈ x → Option β} (h' : ∀ a ∈ x, f a H = none → x = none) :
x.pbind f = none ↔ x = none := by
cases x
@@ -502,7 +595,9 @@ theorem pbind_eq_none {f : ∀ a : α, a ∈ x → Option β} (h' : ∀ a ∈ x,
intro h
cases h' x rfl h
#align option.pbind_eq_none Option.pbind_eq_none
+-/
+#print Option.pbind_eq_some /-
theorem pbind_eq_some {f : ∀ a : α, a ∈ x → Option β} {y : β} :
x.pbind f = some y ↔ ∃ z ∈ x, f z H = some y :=
by
@@ -517,11 +612,15 @@ theorem pbind_eq_some {f : ∀ a : α, a ∈ x → Option β} {y : β} :
simp only [mem_def] at H
simpa only [H] using hz
#align option.pbind_eq_some Option.pbind_eq_some
+-/
+#print Option.pmap_eq_none_iff /-
@[simp]
theorem pmap_eq_none_iff {h} : pmap f x h = none ↔ x = none := by cases x <;> simp
#align option.pmap_eq_none_iff Option.pmap_eq_none_iff
+-/
+#print Option.pmap_eq_some_iff /-
@[simp]
theorem pmap_eq_some_iff {hf} {y : β} :
pmap f x hf = some y ↔ ∃ (a : α) (H : x = some a), f a (hf a H) = y :=
@@ -536,19 +635,24 @@ theorem pmap_eq_some_iff {hf} {y : β} :
simp only [mem_def] at H
simp only [H, pmap]
#align option.pmap_eq_some_iff Option.pmap_eq_some_iff
+-/
+#print Option.join_pmap_eq_pmap_join /-
@[simp]
theorem join_pmap_eq_pmap_join {f : ∀ a, p a → β} {x : Option (Option α)} (H) :
(pmap (pmap f) x H).join = pmap f x.join fun a h => H (some a) (mem_of_mem_join h) _ rfl := by
rcases x with (_ | _ | x) <;> simp
#align option.join_pmap_eq_pmap_join Option.join_pmap_eq_pmap_join
+-/
end Pmap
+#print Option.seq_some /-
@[simp]
theorem seq_some {α β} {a : α} {f : α → β} : some f <*> some a = some (f a) :=
rfl
#align option.seq_some Option.seq_some
+-/
#print Option.some_orElse' /-
@[simp]
@@ -557,19 +661,25 @@ theorem some_orElse' (a : α) (x : Option α) : (some a).orelse x = some a :=
#align option.some_orelse' Option.some_orElse'
-/
+#print Option.some_orElse /-
@[simp]
theorem some_orElse (a : α) (x : Option α) : (some a <|> x) = some a :=
rfl
#align option.some_orelse Option.some_orElse
+-/
+#print Option.none_orElse' /-
@[simp]
theorem none_orElse' (x : Option α) : none.orelse x = x := by cases x <;> rfl
#align option.none_orelse' Option.none_orElse'
+-/
+#print Option.none_orElse /-
@[simp]
theorem none_orElse (x : Option α) : (none <|> x) = x :=
none_orElse' x
#align option.none_orelse Option.none_orElse
+-/
#print Option.orElse_none' /-
@[simp]
@@ -577,10 +687,12 @@ theorem orElse_none' (x : Option α) : x.orelse none = x := by cases x <;> rfl
#align option.orelse_none' Option.orElse_none'
-/
+#print Option.orElse_none /-
@[simp]
theorem orElse_none (x : Option α) : (x <|> none) = x :=
orElse_none' x
#align option.orelse_none Option.orElse_none
+-/
#print Option.isSome_none /-
@[simp]
@@ -683,12 +795,15 @@ theorem getD_default_eq_iget [Inhabited α] (o : Option α) : o.getD default = o
#align option.get_or_else_default_eq_iget Option.getD_default_eq_iget
-/
+#print Option.guard_eq_some /-
@[simp]
theorem guard_eq_some {p : α → Prop} [DecidablePred p] {a b : α} :
guard p a = some b ↔ a = b ∧ p a := by
by_cases p a <;> simp [Option.guard, h] <;> intro <;> contradiction
#align option.guard_eq_some Option.guard_eq_some
+-/
+#print Option.guard_eq_some' /-
@[simp]
theorem guard_eq_some' {p : Prop} [Decidable p] (u) : guard p = some u ↔ p :=
by
@@ -698,6 +813,7 @@ theorem guard_eq_some' {p : Prop} [Decidable p] (u) : guard p = some u ↔ p :=
| rfl
| contradiction
#align option.guard_eq_some' Option.guard_eq_some'
+-/
#print Option.liftOrGet_choice /-
theorem liftOrGet_choice {f : α → α → α} (h : ∀ a b, f a b = a ∨ f a b = b) :
@@ -758,16 +874,21 @@ theorem casesOn'_coe (x : β) (f : α → β) (a : α) : casesOn' (a : Option α
#align option.cases_on'_coe Option.casesOn'_coe
-/
+#print Option.casesOn'_none_coe /-
@[simp]
theorem casesOn'_none_coe (f : Option α → β) (o : Option α) : casesOn' o (f none) (f ∘ coe) = f o :=
by cases o <;> rfl
#align option.cases_on'_none_coe Option.casesOn'_none_coe
+-/
+#print Option.getD_map /-
@[simp]
theorem getD_map (f : α → β) (x : α) (o : Option α) : getD (o.map f) (f x) = f (getD o x) := by
cases o <;> rfl
#align option.get_or_else_map Option.getD_map
+-/
+#print Option.orElse_eq_some /-
theorem orElse_eq_some (o o' : Option α) (x : α) :
(o <|> o') = some x ↔ o = some x ∨ o = none ∧ o' = some x :=
by
@@ -775,12 +896,16 @@ theorem orElse_eq_some (o o' : Option α) (x : α) :
· simp only [true_and_iff, false_or_iff, eq_self_iff_true, none_orelse]
· simp only [some_orelse, or_false_iff, false_and_iff]
#align option.orelse_eq_some Option.orElse_eq_some
+-/
+#print Option.orElse_eq_some' /-
theorem orElse_eq_some' (o o' : Option α) (x : α) :
o.orelse o' = some x ↔ o = some x ∨ o = none ∧ o' = some x :=
Option.orElse_eq_some o o' x
#align option.orelse_eq_some' Option.orElse_eq_some'
+-/
+#print Option.orElse_eq_none /-
@[simp]
theorem orElse_eq_none (o o' : Option α) : (o <|> o') = none ↔ o = none ∧ o' = none :=
by
@@ -788,11 +913,14 @@ theorem orElse_eq_none (o o' : Option α) : (o <|> o') = none ↔ o = none ∧ o
· simp only [true_and_iff, none_orelse, eq_self_iff_true]
· simp only [some_orelse, false_and_iff]
#align option.orelse_eq_none Option.orElse_eq_none
+-/
+#print Option.orElse_eq_none' /-
@[simp]
theorem orElse_eq_none' (o o' : Option α) : o.orelse o' = none ↔ o = none ∧ o' = none :=
Option.orElse_eq_none o o'
#align option.orelse_eq_none' Option.orElse_eq_none'
+-/
section
@@ -848,10 +976,12 @@ theorem to_list_none (α : Type _) : (none : Option α).toList = [] :=
#align option.to_list_none Option.to_list_none
-/
+#print Option.elim_none_some /-
@[simp]
theorem elim_none_some (f : Option α → β) : Option.elim' (f none) (f ∘ some) = f :=
funext fun o => by cases o <;> rfl
#align option.elim_none_some Option.elim_none_some
+-/
end Option
mathlib commit https://github.com/leanprover-community/mathlib/commit/31c24aa72e7b3e5ed97a8412470e904f82b81004
@@ -649,7 +649,7 @@ theorem ne_none_iff_exists' {o : Option α} : o ≠ none ↔ ∃ x : α, o = som
#align option.ne_none_iff_exists' Option.ne_none_iff_exists'
-/
-/- ./././Mathport/Syntax/Translate/Basic.lean:635:2: warning: expanding binder collection (x «expr ≠ » none[option.none]) -/
+/- ./././Mathport/Syntax/Translate/Basic.lean:638:2: warning: expanding binder collection (x «expr ≠ » none[option.none]) -/
#print Option.bex_ne_none /-
theorem bex_ne_none {p : Option α → Prop} : (∃ (x : _) (_ : x ≠ none), p x) ↔ ∃ x, p (some x) :=
⟨fun ⟨x, hx, hp⟩ => ⟨get <| ne_none_iff_isSome.1 hx, by rwa [some_get]⟩, fun ⟨x, hx⟩ =>
@@ -657,7 +657,7 @@ theorem bex_ne_none {p : Option α → Prop} : (∃ (x : _) (_ : x ≠ none), p
#align option.bex_ne_none Option.bex_ne_none
-/
-/- ./././Mathport/Syntax/Translate/Basic.lean:635:2: warning: expanding binder collection (x «expr ≠ » none[option.none]) -/
+/- ./././Mathport/Syntax/Translate/Basic.lean:638:2: warning: expanding binder collection (x «expr ≠ » none[option.none]) -/
#print Option.ball_ne_none /-
theorem ball_ne_none {p : Option α → Prop} : (∀ (x) (_ : x ≠ none), p x) ↔ ∀ x, p (some x) :=
⟨fun h x => h (some x) (some_ne_none x), fun h x hx => by
mathlib commit https://github.com/leanprover-community/mathlib/commit/cca40788df1b8755d5baf17ab2f27dacc2e17acb
@@ -133,7 +133,7 @@ theorem getD_coe (x y : α) : Option.getD (↑x) y = x :=
#print Option.getD_of_ne_none /-
theorem getD_of_ne_none {x : Option α} (hx : x ≠ none) (y : α) : some (x.getD y) = x := by
- cases x <;> [contradiction;rw [get_or_else_some]]
+ cases x <;> [contradiction; rw [get_or_else_some]]
#align option.get_or_else_of_ne_none Option.getD_of_ne_none
-/
@@ -189,7 +189,7 @@ theorem ext : ∀ {o₁ o₂ : Option α}, (∀ a, a ∈ o₁ ↔ a ∈ o₂)
#print Option.eq_none_iff_forall_not_mem /-
theorem eq_none_iff_forall_not_mem {o : Option α} : o = none ↔ ∀ a, a ∉ o :=
- ⟨fun e a h => by rw [e] at h <;> cases h, fun h => ext <| by simpa⟩
+ ⟨fun e a h => by rw [e] at h <;> cases h, fun h => ext <| by simpa⟩
#align option.eq_none_iff_forall_not_mem Option.eq_none_iff_forall_not_mem
-/
@@ -462,7 +462,7 @@ theorem pmap_some (f : ∀ a : α, p a → β) {x : α} (h : p x) :
-/
theorem mem_pmem {a : α} (h : ∀ a ∈ x, p a) (ha : a ∈ x) : f a (h a ha) ∈ pmap f x h := by
- rw [mem_def] at ha⊢; subst ha; rfl
+ rw [mem_def] at ha ⊢; subst ha; rfl
#align option.mem_pmem Option.mem_pmem
theorem pmap_map (g : γ → α) (x : Option γ) (H) :
@@ -514,7 +514,7 @@ theorem pbind_eq_some {f : ∀ a : α, a ∈ x → Option β} {y : β} :
use x
simpa only [mem_def, exists_prop_of_true] using h
· rintro ⟨z, H, hz⟩
- simp only [mem_def] at H
+ simp only [mem_def] at H
simpa only [H] using hz
#align option.pbind_eq_some Option.pbind_eq_some
@@ -524,16 +524,16 @@ theorem pmap_eq_none_iff {h} : pmap f x h = none ↔ x = none := by cases x <;>
@[simp]
theorem pmap_eq_some_iff {hf} {y : β} :
- pmap f x hf = some y ↔ ∃ (a : α)(H : x = some a), f a (hf a H) = y :=
+ pmap f x hf = some y ↔ ∃ (a : α) (H : x = some a), f a (hf a H) = y :=
by
cases x
· simp only [not_mem_none, exists_false, pmap, not_false_iff, exists_prop_of_false]
· constructor
· intro h
- simp only [pmap] at h
+ simp only [pmap] at h
exact ⟨x, rfl, h⟩
· rintro ⟨a, H, rfl⟩
- simp only [mem_def] at H
+ simp only [mem_def] at H
simp only [H, pmap]
#align option.pmap_eq_some_iff Option.pmap_eq_some_iff
@@ -651,7 +651,7 @@ theorem ne_none_iff_exists' {o : Option α} : o ≠ none ↔ ∃ x : α, o = som
/- ./././Mathport/Syntax/Translate/Basic.lean:635:2: warning: expanding binder collection (x «expr ≠ » none[option.none]) -/
#print Option.bex_ne_none /-
-theorem bex_ne_none {p : Option α → Prop} : (∃ (x : _)(_ : x ≠ none), p x) ↔ ∃ x, p (some x) :=
+theorem bex_ne_none {p : Option α → Prop} : (∃ (x : _) (_ : x ≠ none), p x) ↔ ∃ x, p (some x) :=
⟨fun ⟨x, hx, hp⟩ => ⟨get <| ne_none_iff_isSome.1 hx, by rwa [some_get]⟩, fun ⟨x, hx⟩ =>
⟨some x, some_ne_none x, hx⟩⟩
#align option.bex_ne_none Option.bex_ne_none
@@ -693,7 +693,10 @@ theorem guard_eq_some {p : α → Prop} [DecidablePred p] {a b : α} :
theorem guard_eq_some' {p : Prop} [Decidable p] (u) : guard p = some u ↔ p :=
by
cases u
- by_cases p <;> simp [_root_.guard, h] <;> first |rfl|contradiction
+ by_cases p <;> simp [_root_.guard, h] <;>
+ first
+ | rfl
+ | contradiction
#align option.guard_eq_some' Option.guard_eq_some'
#print Option.liftOrGet_choice /-
mathlib commit https://github.com/leanprover-community/mathlib/commit/917c3c072e487b3cccdbfeff17e75b40e45f66cb
@@ -793,7 +793,7 @@ theorem orElse_eq_none' (o o' : Option α) : o.orelse o' = none ↔ o = none ∧
section
-open Classical
+open scoped Classical
#print Option.choice /-
/-- An arbitrary `some a` with `a : α` if `α` is nonempty, and otherwise `none`. -/
mathlib commit https://github.com/leanprover-community/mathlib/commit/917c3c072e487b3cccdbfeff17e75b40e45f66cb
@@ -167,24 +167,12 @@ theorem some_injective (α : Type _) : Function.Injective (@some α) := fun _ _
#align option.some_injective Option.some_injective
-/
-/- warning: option.map_injective -> Option.map_injective is a dubious translation:
-lean 3 declaration is
- forall {α : Type.{u1}} {β : Type.{u2}} {f : α -> β}, (Function.Injective.{succ u1, succ u2} α β f) -> (Function.Injective.{succ u1, succ u2} (Option.{u1} α) (Option.{u2} β) (Option.map.{u1, u2} α β f))
-but is expected to have type
- forall {α : Type.{u2}} {β : Type.{u1}} {f : α -> β}, (Function.Injective.{succ u2, succ u1} α β f) -> (Function.Injective.{succ u2, succ u1} (Option.{u2} α) (Option.{u1} β) (Option.map.{u2, u1} α β f))
-Case conversion may be inaccurate. Consider using '#align option.map_injective Option.map_injectiveₓ'. -/
/-- `option.map f` is injective if `f` is injective. -/
theorem map_injective {f : α → β} (Hf : Function.Injective f) : Function.Injective (Option.map f)
| none, none, H => rfl
| some a₁, some a₂, H => by rw [Hf (Option.some.inj H)]
#align option.map_injective Option.map_injective
-/- warning: option.map_comp_some -> Option.map_comp_some is a dubious translation:
-lean 3 declaration is
- forall {α : Type.{u1}} {β : Type.{u2}} (f : α -> β), Eq.{max (succ u1) (succ u2)} (α -> (Option.{u2} β)) (Function.comp.{succ u1, succ u1, succ u2} α (Option.{u1} α) (Option.{u2} β) (Option.map.{u1, u2} α β f) (Option.some.{u1} α)) (Function.comp.{succ u1, succ u2, succ u2} α β (Option.{u2} β) (Option.some.{u2} β) f)
-but is expected to have type
- forall {α : Type.{u2}} {β : Type.{u1}} (f : α -> β), Eq.{max (succ u2) (succ u1)} (α -> (Option.{u1} β)) (Function.comp.{succ u2, succ u2, succ u1} α (Option.{u2} α) (Option.{u1} β) (Option.map.{u2, u1} α β f) (Option.some.{u2} α)) (Function.comp.{succ u2, succ u1, succ u1} α β (Option.{u1} β) (Option.some.{u1} β) f)
-Case conversion may be inaccurate. Consider using '#align option.map_comp_some Option.map_comp_someₓ'. -/
@[simp]
theorem map_comp_some (f : α → β) : Option.map f ∘ some = some ∘ f :=
rfl
@@ -205,23 +193,11 @@ theorem eq_none_iff_forall_not_mem {o : Option α} : o = none ↔ ∀ a, a ∉ o
#align option.eq_none_iff_forall_not_mem Option.eq_none_iff_forall_not_mem
-/
-/- warning: option.none_bind -> Option.none_bind is a dubious translation:
-lean 3 declaration is
- forall {α : Type.{u_1}} {β : Type.{u_1}} (f : α -> (Option.{u_1} β)), Eq.{succ u_1} (Option.{u_1} β) (Bind.bind.{u_1, u_1} Option.{u_1} (Monad.toHasBind.{u_1, u_1} Option.{u_1} Option.monad.{u_1}) α β (Option.none.{u_1} α) f) (Option.none.{u_1} β)
-but is expected to have type
- forall {α : Type.{u_1}} {β : Type.{u_2}} (f : α -> (Option.{u_2} β)), Eq.{succ u_2} (Option.{u_2} β) (Option.bind.{u_1, u_2} α β (Option.none.{u_1} α) f) (Option.none.{u_2} β)
-Case conversion may be inaccurate. Consider using '#align option.none_bind Option.none_bindₓ'. -/
@[simp]
theorem none_bind {α β} (f : α → Option β) : none >>= f = none :=
rfl
#align option.none_bind Option.none_bind
-/- warning: option.some_bind -> Option.some_bind is a dubious translation:
-lean 3 declaration is
- forall {α : Type.{u_1}} {β : Type.{u_1}} (a : α) (f : α -> (Option.{u_1} β)), Eq.{succ u_1} (Option.{u_1} β) (Bind.bind.{u_1, u_1} Option.{u_1} (Monad.toHasBind.{u_1, u_1} Option.{u_1} Option.monad.{u_1}) α β (Option.some.{u_1} α a) f) (f a)
-but is expected to have type
- forall {α : Type.{u_1}} {β : Type.{u_2}} (a : α) (f : α -> (Option.{u_2} β)), Eq.{succ u_2} (Option.{u_2} β) (Option.bind.{u_1, u_2} α β (Option.some.{u_1} α a) f) (f a)
-Case conversion may be inaccurate. Consider using '#align option.some_bind Option.some_bindₓ'. -/
@[simp]
theorem some_bind {α β} (a : α) (f : α → Option β) : some a >>= f = f a :=
rfl
@@ -241,12 +217,6 @@ theorem some_bind' (a : α) (f : α → Option β) : (some a).bind f = f a :=
#align option.some_bind' Option.some_bind'
-/
-/- warning: option.bind_some -> Option.bind_some is a dubious translation:
-lean 3 declaration is
- forall {α : Type.{u1}} (x : Option.{u1} α), Eq.{succ u1} (Option.{u1} α) (Bind.bind.{u1, u1} Option.{u1} (Monad.toHasBind.{u1, u1} Option.{u1} Option.monad.{u1}) α α x (Option.some.{u1} α)) x
-but is expected to have type
- forall {α : Type.{u1}} (x : Option.{u1} α), Eq.{succ u1} (Option.{u1} α) (Option.bind.{u1, u1} α α x (Option.some.{u1} α)) x
-Case conversion may be inaccurate. Consider using '#align option.bind_some Option.bind_someₓ'. -/
@[simp]
theorem bind_some : ∀ x : Option α, x >>= some = x :=
@bind_pure α Option _ _
@@ -257,79 +227,37 @@ theorem bind_some' : ∀ x : Option α, x.bind some = x :=
bind_some
#align option.bind_some' Option.bind_some'
-/- warning: option.bind_eq_some -> Option.bind_eq_some is a dubious translation:
-lean 3 declaration is
- forall {α : Type.{u_1}} {β : Type.{u_1}} {x : Option.{u_1} α} {f : α -> (Option.{u_1} β)} {b : β}, Iff (Eq.{succ u_1} (Option.{u_1} β) (Bind.bind.{u_1, u_1} Option.{u_1} (Monad.toHasBind.{u_1, u_1} Option.{u_1} Option.monad.{u_1}) α β x f) (Option.some.{u_1} β b)) (Exists.{succ u_1} α (fun (a : α) => And (Eq.{succ u_1} (Option.{u_1} α) x (Option.some.{u_1} α a)) (Eq.{succ u_1} (Option.{u_1} β) (f a) (Option.some.{u_1} β b))))
-but is expected to have type
- forall {α : Type.{u_1}} {β : α} {x : Type.{u_2}} {f : Option.{u_2} x} {b : x -> (Option.{u_1} α)}, Iff (Eq.{succ u_1} (Option.{u_1} α) (Option.bind.{u_2, u_1} x α f b) (Option.some.{u_1} α β)) (Exists.{succ u_2} x (fun (a : x) => And (Eq.{succ u_2} (Option.{u_2} x) f (Option.some.{u_2} x a)) (Eq.{succ u_1} (Option.{u_1} α) (b a) (Option.some.{u_1} α β))))
-Case conversion may be inaccurate. Consider using '#align option.bind_eq_some Option.bind_eq_someₓ'. -/
@[simp]
theorem bind_eq_some {α β} {x : Option α} {f : α → Option β} {b : β} :
x >>= f = some b ↔ ∃ a, x = some a ∧ f a = some b := by cases x <;> simp
#align option.bind_eq_some Option.bind_eq_some
-/- warning: option.bind_eq_some' -> Option.bind_eq_some' is a dubious translation:
-lean 3 declaration is
- forall {α : Type.{u1}} {β : Type.{u2}} {x : Option.{u1} α} {f : α -> (Option.{u2} β)} {b : β}, Iff (Eq.{succ u2} (Option.{u2} β) (Option.bind.{u1, u2} α β x f) (Option.some.{u2} β b)) (Exists.{succ u1} α (fun (a : α) => And (Eq.{succ u1} (Option.{u1} α) x (Option.some.{u1} α a)) (Eq.{succ u2} (Option.{u2} β) (f a) (Option.some.{u2} β b))))
-but is expected to have type
- forall {α : Type.{u2}} {β : Type.{u1}} {x : Option.{u2} α} {f : α -> (Option.{u1} β)} {b : β}, Iff (Eq.{succ u1} (Option.{u1} β) (Option.bind.{u2, u1} α β x f) (Option.some.{u1} β b)) (Exists.{succ u2} α (fun (a : α) => And (Eq.{succ u2} (Option.{u2} α) x (Option.some.{u2} α a)) (Eq.{succ u1} (Option.{u1} β) (f a) (Option.some.{u1} β b))))
-Case conversion may be inaccurate. Consider using '#align option.bind_eq_some' Option.bind_eq_some'ₓ'. -/
@[simp]
theorem bind_eq_some' {x : Option α} {f : α → Option β} {b : β} :
x.bind f = some b ↔ ∃ a, x = some a ∧ f a = some b := by cases x <;> simp
#align option.bind_eq_some' Option.bind_eq_some'
-/- warning: option.bind_eq_none' -> Option.bind_eq_none' is a dubious translation:
-lean 3 declaration is
- forall {α : Type.{u1}} {β : Type.{u2}} {o : Option.{u1} α} {f : α -> (Option.{u2} β)}, Iff (Eq.{succ u2} (Option.{u2} β) (Option.bind.{u1, u2} α β o f) (Option.none.{u2} β)) (forall (b : β) (a : α), (Membership.Mem.{u1, u1} α (Option.{u1} α) (Option.hasMem.{u1} α) a o) -> (Not (Membership.Mem.{u2, u2} β (Option.{u2} β) (Option.hasMem.{u2} β) b (f a))))
-but is expected to have type
- forall {α : Type.{u2}} {β : Type.{u1}} {o : Option.{u2} α} {f : α -> (Option.{u1} β)}, Iff (Eq.{succ u1} (Option.{u1} β) (Option.bind.{u2, u1} α β o f) (Option.none.{u1} β)) (forall (b : β) (a : α), (Membership.mem.{u2, u2} α (Option.{u2} α) (Option.instMembershipOption.{u2} α) a o) -> (Not (Membership.mem.{u1, u1} β (Option.{u1} β) (Option.instMembershipOption.{u1} β) b (f a))))
-Case conversion may be inaccurate. Consider using '#align option.bind_eq_none' Option.bind_eq_none'ₓ'. -/
@[simp]
theorem bind_eq_none' {o : Option α} {f : α → Option β} :
o.bind f = none ↔ ∀ b a, a ∈ o → b ∉ f a := by
simp only [eq_none_iff_forall_not_mem, not_exists, not_and, mem_def, bind_eq_some']
#align option.bind_eq_none' Option.bind_eq_none'
-/- warning: option.bind_eq_none -> Option.bind_eq_none is a dubious translation:
-lean 3 declaration is
- forall {α : Type.{u_1}} {β : Type.{u_1}} {o : Option.{u_1} α} {f : α -> (Option.{u_1} β)}, Iff (Eq.{succ u_1} (Option.{u_1} β) (Bind.bind.{u_1, u_1} Option.{u_1} (Monad.toHasBind.{u_1, u_1} Option.{u_1} Option.monad.{u_1}) α β o f) (Option.none.{u_1} β)) (forall (b : β) (a : α), (Membership.Mem.{u_1, u_1} α (Option.{u_1} α) (Option.hasMem.{u_1} α) a o) -> (Not (Membership.Mem.{u_1, u_1} β (Option.{u_1} β) (Option.hasMem.{u_1} β) b (f a))))
-but is expected to have type
- forall {α : Type.{u_1}} {β : Type.{u_2}} {o : Option.{u_1} α} {f : α -> (Option.{u_2} β)}, Iff (Eq.{succ u_2} (Option.{u_2} β) (Option.bind.{u_1, u_2} α β o f) (Option.none.{u_2} β)) (forall (b : β) (a : α), (Membership.mem.{u_1, u_1} α (Option.{u_1} α) (Option.instMembershipOption.{u_1} α) a o) -> (Not (Membership.mem.{u_2, u_2} β (Option.{u_2} β) (Option.instMembershipOption.{u_2} β) b (f a))))
-Case conversion may be inaccurate. Consider using '#align option.bind_eq_none Option.bind_eq_noneₓ'. -/
@[simp]
theorem bind_eq_none {α β} {o : Option α} {f : α → Option β} :
o >>= f = none ↔ ∀ b a, a ∈ o → b ∉ f a :=
bind_eq_none'
#align option.bind_eq_none Option.bind_eq_none
-/- warning: option.bind_comm -> Option.bind_comm is a dubious translation:
-lean 3 declaration is
- forall {α : Type.{u1}} {β : Type.{u2}} {γ : Type.{u3}} {f : α -> β -> (Option.{u3} γ)} (a : Option.{u1} α) (b : Option.{u2} β), Eq.{succ u3} (Option.{u3} γ) (Option.bind.{u1, u3} α γ a (fun (x : α) => Option.bind.{u2, u3} β γ b (f x))) (Option.bind.{u2, u3} β γ b (fun (y : β) => Option.bind.{u1, u3} α γ a (fun (x : α) => f x y)))
-but is expected to have type
- forall {α : Type.{u3}} {β : Type.{u2}} {γ : Type.{u1}} {f : α -> β -> (Option.{u1} γ)} (a : Option.{u3} α) (b : Option.{u2} β), Eq.{succ u1} (Option.{u1} γ) (Option.bind.{u3, u1} α γ a (fun (x : α) => Option.bind.{u2, u1} β γ b (f x))) (Option.bind.{u2, u1} β γ b (fun (y : β) => Option.bind.{u3, u1} α γ a (fun (x : α) => f x y)))
-Case conversion may be inaccurate. Consider using '#align option.bind_comm Option.bind_commₓ'. -/
theorem bind_comm {α β γ} {f : α → β → Option γ} (a : Option α) (b : Option β) :
(a.bind fun x => b.bind (f x)) = b.bind fun y => a.bind fun x => f x y := by
cases a <;> cases b <;> rfl
#align option.bind_comm Option.bind_comm
-/- warning: option.bind_assoc -> Option.bind_assoc is a dubious translation:
-lean 3 declaration is
- forall {α : Type.{u1}} {β : Type.{u2}} {γ : Type.{u3}} (x : Option.{u1} α) (f : α -> (Option.{u2} β)) (g : β -> (Option.{u3} γ)), Eq.{succ u3} (Option.{u3} γ) (Option.bind.{u2, u3} β γ (Option.bind.{u1, u2} α β x f) g) (Option.bind.{u1, u3} α γ x (fun (y : α) => Option.bind.{u2, u3} β γ (f y) g))
-but is expected to have type
- forall {α : Type.{u3}} {β : Type.{u2}} {γ : Type.{u1}} (x : Option.{u3} α) (f : α -> (Option.{u2} β)) (g : β -> (Option.{u1} γ)), Eq.{succ u1} (Option.{u1} γ) (Option.bind.{u2, u1} β γ (Option.bind.{u3, u2} α β x f) g) (Option.bind.{u3, u1} α γ x (fun (y : α) => Option.bind.{u2, u1} β γ (f y) g))
-Case conversion may be inaccurate. Consider using '#align option.bind_assoc Option.bind_assocₓ'. -/
theorem bind_assoc (x : Option α) (f : α → Option β) (g : β → Option γ) :
(x.bind f).bind g = x.bind fun y => (f y).bind g := by cases x <;> rfl
#align option.bind_assoc Option.bind_assoc
-/- warning: option.join_eq_some -> Option.join_eq_some is a dubious translation:
-lean 3 declaration is
- forall {α : Type.{u1}} {x : Option.{u1} (Option.{u1} α)} {a : α}, Iff (Eq.{succ u1} (Option.{u1} α) (Option.join.{u1} α x) (Option.some.{u1} α a)) (Eq.{succ u1} (Option.{u1} (Option.{u1} α)) x (Option.some.{u1} (Option.{u1} α) (Option.some.{u1} α a)))
-but is expected to have type
- forall {α : Type.{u1}} {x : α} {a : Option.{u1} (Option.{u1} α)}, Iff (Eq.{succ u1} (Option.{u1} α) (Option.join.{u1} α a) (Option.some.{u1} α x)) (Eq.{succ u1} (Option.{u1} (Option.{u1} α)) a (Option.some.{u1} (Option.{u1} α) (Option.some.{u1} α x)))
-Case conversion may be inaccurate. Consider using '#align option.join_eq_some Option.join_eq_someₓ'. -/
theorem join_eq_some {x : Option (Option α)} {a : α} : x.join = some a ↔ x = some (some a) := by
simp
#align option.join_eq_some Option.join_eq_some
@@ -350,93 +278,39 @@ theorem join_eq_none {o : Option (Option α)} : o.join = none ↔ o = none ∨ o
#align option.join_eq_none Option.join_eq_none
-/
-/- warning: option.bind_id_eq_join -> Option.bind_id_eq_join is a dubious translation:
-lean 3 declaration is
- forall {α : Type.{u1}} {x : Option.{u1} (Option.{u1} α)}, Eq.{succ u1} (Option.{u1} α) (Bind.bind.{u1, u1} Option.{u1} (Monad.toHasBind.{u1, u1} Option.{u1} Option.monad.{u1}) (Option.{u1} α) α x (id.{succ u1} (Option.{u1} α))) (Option.join.{u1} α x)
-but is expected to have type
- forall {α : Type.{u1}} {x : Option.{u1} (Option.{u1} α)}, Eq.{succ u1} (Option.{u1} α) (Option.bind.{u1, u1} (Option.{u1} α) α x (id.{succ u1} (Option.{u1} α))) (Option.join.{u1} α x)
-Case conversion may be inaccurate. Consider using '#align option.bind_id_eq_join Option.bind_id_eq_joinₓ'. -/
theorem bind_id_eq_join {x : Option (Option α)} : x >>= id = x.join := by simp
#align option.bind_id_eq_join Option.bind_id_eq_join
-/- warning: option.join_eq_join -> Option.joinM_eq_join is a dubious translation:
-lean 3 declaration is
- forall {α : Type.{u1}}, Eq.{succ u1} ((Option.{u1} (Option.{u1} α)) -> (Option.{u1} α)) (joinM.{u1} Option.{u1} Option.monad.{u1} α) (Option.join.{u1} α)
-but is expected to have type
- forall {α : Type.{u1}}, Eq.{succ u1} ((Option.{u1} (Option.{u1} α)) -> (Option.{u1} α)) (joinM.{u1} Option.{u1} instMonadOption.{u1} α) (Option.join.{u1} α)
-Case conversion may be inaccurate. Consider using '#align option.join_eq_join Option.joinM_eq_joinₓ'. -/
theorem joinM_eq_join : joinM = @join α :=
funext fun x => by rw [joinM, bind_id_eq_join]
#align option.join_eq_join Option.joinM_eq_join
-/- warning: option.bind_eq_bind -> Option.bind_eq_bind is a dubious translation:
-lean 3 declaration is
- forall {α : Type.{u1}} {β : Type.{u1}} {f : α -> (Option.{u1} β)} {x : Option.{u1} α}, Eq.{succ u1} (Option.{u1} β) (Bind.bind.{u1, u1} Option.{u1} (Monad.toHasBind.{u1, u1} Option.{u1} Option.monad.{u1}) α β x f) (Option.bind.{u1, u1} α β x f)
-but is expected to have type
- forall {α : Type.{u1}} {β : Type.{u1}} {f : α -> (Option.{u1} β)} {x : Option.{u1} α}, Eq.{succ u1} (Option.{u1} β) (Bind.bind.{u1, u1} Option.{u1} (Monad.toBind.{u1, u1} Option.{u1} instMonadOption.{u1}) α β x f) (Option.bind.{u1, u1} α β x f)
-Case conversion may be inaccurate. Consider using '#align option.bind_eq_bind Option.bind_eq_bindₓ'. -/
theorem bind_eq_bind {α β : Type _} {f : α → Option β} {x : Option α} : x >>= f = x.bind f :=
rfl
#align option.bind_eq_bind Option.bind_eq_bind
-/- warning: option.map_eq_map -> Option.map_eq_map is a dubious translation:
-lean 3 declaration is
- forall {α : Type.{u1}} {β : Type.{u1}} {f : α -> β}, Eq.{succ u1} ((Option.{u1} α) -> (Option.{u1} β)) (Functor.map.{u1, u1} Option.{u1} (Traversable.toFunctor.{u1} Option.{u1} Option.traversable.{u1}) α β f) (Option.map.{u1, u1} α β f)
-but is expected to have type
- forall {α : Type.{u1}} {β : Type.{u1}} {f : α -> β}, Eq.{succ u1} ((Option.{u1} α) -> (Option.{u1} β)) (Functor.map.{u1, u1} Option.{u1} instFunctorOption.{u1} α β f) (Option.map.{u1, u1} α β f)
-Case conversion may be inaccurate. Consider using '#align option.map_eq_map Option.map_eq_mapₓ'. -/
@[simp]
theorem map_eq_map {α β} {f : α → β} : (· <$> ·) f = Option.map f :=
rfl
#align option.map_eq_map Option.map_eq_map
-/- warning: option.map_none -> Option.map_none is a dubious translation:
-lean 3 declaration is
- forall {α : Type.{u1}} {β : Type.{u1}} {f : α -> β}, Eq.{succ u1} (Option.{u1} β) (Functor.map.{u1, u1} Option.{u1} (Traversable.toFunctor.{u1} Option.{u1} Option.traversable.{u1}) α β f (Option.none.{u1} α)) (Option.none.{u1} β)
-but is expected to have type
- forall {α : Type.{u1}} {β : Type.{u1}} {f : α -> β}, Eq.{succ u1} (Option.{u1} β) (Functor.map.{u1, u1} Option.{u1} instFunctorOption.{u1} α β f (Option.none.{u1} α)) (Option.none.{u1} β)
-Case conversion may be inaccurate. Consider using '#align option.map_none Option.map_noneₓ'. -/
theorem map_none {α β} {f : α → β} : f <$> none = none :=
rfl
#align option.map_none Option.map_none
-/- warning: option.map_some -> Option.map_some is a dubious translation:
-lean 3 declaration is
- forall {α : Type.{u1}} {β : Type.{u1}} {a : α} {f : α -> β}, Eq.{succ u1} (Option.{u1} β) (Functor.map.{u1, u1} Option.{u1} (Traversable.toFunctor.{u1} Option.{u1} Option.traversable.{u1}) α β f (Option.some.{u1} α a)) (Option.some.{u1} β (f a))
-but is expected to have type
- forall {α : Type.{u1}} {β : Type.{u1}} {a : α -> β} {f : α}, Eq.{succ u1} (Option.{u1} β) (Functor.map.{u1, u1} Option.{u1} instFunctorOption.{u1} α β a (Option.some.{u1} α f)) (Option.some.{u1} β (a f))
-Case conversion may be inaccurate. Consider using '#align option.map_some Option.map_someₓ'. -/
theorem map_some {α β} {a : α} {f : α → β} : f <$> some a = some (f a) :=
rfl
#align option.map_some Option.map_some
-/- warning: option.map_coe -> Option.map_coe is a dubious translation:
-lean 3 declaration is
- forall {α : Type.{u1}} {β : Type.{u1}} {a : α} {f : α -> β}, Eq.{succ u1} (Option.{u1} β) (Functor.map.{u1, u1} (fun {α : Type.{u1}} => Option.{u1} α) (Traversable.toFunctor.{u1} (fun {α : Type.{u1}} => Option.{u1} α) Option.traversable.{u1}) α β f ((fun (a : Type.{u1}) (b : Type.{u1}) [self : HasLiftT.{succ u1, succ u1} a b] => self.0) α (Option.{u1} α) (HasLiftT.mk.{succ u1, succ u1} α (Option.{u1} α) (CoeTCₓ.coe.{succ u1, succ u1} α (Option.{u1} α) (coeOption.{u1} α))) a)) ((fun (a : Type.{u1}) (b : Type.{u1}) [self : HasLiftT.{succ u1, succ u1} a b] => self.0) β (Option.{u1} β) (HasLiftT.mk.{succ u1, succ u1} β (Option.{u1} β) (CoeTCₓ.coe.{succ u1, succ u1} β (Option.{u1} β) (coeOption.{u1} β))) (f a))
-but is expected to have type
- forall {α : Type.{u1}} {β : Type.{u1}} {a : α} {f : α -> β}, Eq.{succ u1} (Option.{u1} β) (Functor.map.{u1, u1} Option.{u1} instFunctorOption.{u1} α β f (Option.some.{u1} α a)) (Option.some.{u1} β (f a))
-Case conversion may be inaccurate. Consider using '#align option.map_coe Option.map_coeₓ'. -/
theorem map_coe {α β} {a : α} {f : α → β} : f <$> (a : Option α) = ↑(f a) :=
rfl
#align option.map_coe Option.map_coe
-/- warning: option.map_none' -> Option.map_none' is a dubious translation:
-lean 3 declaration is
- forall {α : Type.{u1}} {β : Type.{u2}} {f : α -> β}, Eq.{succ u2} (Option.{u2} β) (Option.map.{u1, u2} α β f (Option.none.{u1} α)) (Option.none.{u2} β)
-but is expected to have type
- forall {α : Type.{u2}} {β : Type.{u1}} (f : α -> β), Eq.{succ u1} (Option.{u1} β) (Option.map.{u2, u1} α β f (Option.none.{u2} α)) (Option.none.{u1} β)
-Case conversion may be inaccurate. Consider using '#align option.map_none' Option.map_none'ₓ'. -/
@[simp]
theorem map_none' {f : α → β} : Option.map f none = none :=
rfl
#align option.map_none' Option.map_none'
-/- warning: option.map_some' -> Option.map_some' is a dubious translation:
-lean 3 declaration is
- forall {α : Type.{u1}} {β : Type.{u2}} {a : α} {f : α -> β}, Eq.{succ u2} (Option.{u2} β) (Option.map.{u1, u2} α β f (Option.some.{u1} α a)) (Option.some.{u2} β (f a))
-but is expected to have type
- forall {α : Type.{u2}} {β : Type.{u1}} (a : α) (f : α -> β), Eq.{succ u1} (Option.{u1} β) (Option.map.{u2, u1} α β f (Option.some.{u2} α a)) (Option.some.{u1} β (f a))
-Case conversion may be inaccurate. Consider using '#align option.map_some' Option.map_some'ₓ'. -/
@[simp]
theorem map_some' {a : α} {f : α → β} : Option.map f (some a) = some (f a) :=
rfl
@@ -449,76 +323,34 @@ theorem map_coe' {a : α} {f : α → β} : Option.map f (a : Option α) = ↑(f
#align option.map_coe' Option.map_coe'
-/
-/- warning: option.map_eq_some -> Option.map_eq_some is a dubious translation:
-lean 3 declaration is
- forall {α : Type.{u1}} {β : Type.{u1}} {x : Option.{u1} α} {f : α -> β} {b : β}, Iff (Eq.{succ u1} (Option.{u1} β) (Functor.map.{u1, u1} (fun {α : Type.{u1}} => Option.{u1} α) (Traversable.toFunctor.{u1} (fun {α : Type.{u1}} => Option.{u1} α) Option.traversable.{u1}) α β f x) (Option.some.{u1} β b)) (Exists.{succ u1} α (fun (a : α) => And (Eq.{succ u1} (Option.{u1} α) x (Option.some.{u1} α a)) (Eq.{succ u1} β (f a) b)))
-but is expected to have type
- forall {α : Type.{u1}} {β : Type.{u1}} {x : α -> β} {f : Option.{u1} α} {b : β}, Iff (Eq.{succ u1} (Option.{u1} β) (Functor.map.{u1, u1} Option.{u1} instFunctorOption.{u1} α β x f) (Option.some.{u1} β b)) (Exists.{succ u1} α (fun (a : α) => And (Eq.{succ u1} (Option.{u1} α) f (Option.some.{u1} α a)) (Eq.{succ u1} β (x a) b)))
-Case conversion may be inaccurate. Consider using '#align option.map_eq_some Option.map_eq_someₓ'. -/
theorem map_eq_some {α β} {x : Option α} {f : α → β} {b : β} :
f <$> x = some b ↔ ∃ a, x = some a ∧ f a = b := by cases x <;> simp
#align option.map_eq_some Option.map_eq_some
-/- warning: option.map_eq_some' -> Option.map_eq_some' is a dubious translation:
-lean 3 declaration is
- forall {α : Type.{u1}} {β : Type.{u2}} {x : Option.{u1} α} {f : α -> β} {b : β}, Iff (Eq.{succ u2} (Option.{u2} β) (Option.map.{u1, u2} α β f x) (Option.some.{u2} β b)) (Exists.{succ u1} α (fun (a : α) => And (Eq.{succ u1} (Option.{u1} α) x (Option.some.{u1} α a)) (Eq.{succ u2} β (f a) b)))
-but is expected to have type
- forall {α : Type.{u2}} {β : α} {x : Type.{u1}} {f : Option.{u1} x} {b : x -> α}, Iff (Eq.{succ u2} (Option.{u2} α) (Option.map.{u1, u2} x α b f) (Option.some.{u2} α β)) (Exists.{succ u1} x (fun (a : x) => And (Eq.{succ u1} (Option.{u1} x) f (Option.some.{u1} x a)) (Eq.{succ u2} α (b a) β)))
-Case conversion may be inaccurate. Consider using '#align option.map_eq_some' Option.map_eq_some'ₓ'. -/
@[simp]
theorem map_eq_some' {x : Option α} {f : α → β} {b : β} :
x.map f = some b ↔ ∃ a, x = some a ∧ f a = b := by cases x <;> simp
#align option.map_eq_some' Option.map_eq_some'
-/- warning: option.map_eq_none -> Option.map_eq_none is a dubious translation:
-lean 3 declaration is
- forall {α : Type.{u1}} {β : Type.{u1}} {x : Option.{u1} α} {f : α -> β}, Iff (Eq.{succ u1} (Option.{u1} β) (Functor.map.{u1, u1} (fun {α : Type.{u1}} => Option.{u1} α) (Traversable.toFunctor.{u1} (fun {α : Type.{u1}} => Option.{u1} α) Option.traversable.{u1}) α β f x) (Option.none.{u1} β)) (Eq.{succ u1} (Option.{u1} α) x (Option.none.{u1} α))
-but is expected to have type
- forall {α : Type.{u1}} {β : Type.{u1}} {x : α -> β} {f : Option.{u1} α}, Iff (Eq.{succ u1} (Option.{u1} β) (Functor.map.{u1, u1} Option.{u1} instFunctorOption.{u1} α β x f) (Option.none.{u1} β)) (Eq.{succ u1} (Option.{u1} α) f (Option.none.{u1} α))
-Case conversion may be inaccurate. Consider using '#align option.map_eq_none Option.map_eq_noneₓ'. -/
theorem map_eq_none {α β} {x : Option α} {f : α → β} : f <$> x = none ↔ x = none := by
cases x <;> simp only [map_none, map_some, eq_self_iff_true]
#align option.map_eq_none Option.map_eq_none
-/- warning: option.map_eq_none' -> Option.map_eq_none' is a dubious translation:
-lean 3 declaration is
- forall {α : Type.{u1}} {β : Type.{u2}} {x : Option.{u1} α} {f : α -> β}, Iff (Eq.{succ u2} (Option.{u2} β) (Option.map.{u1, u2} α β f x) (Option.none.{u2} β)) (Eq.{succ u1} (Option.{u1} α) x (Option.none.{u1} α))
-but is expected to have type
- forall {α : Type.{u2}} {β : Option.{u2} α} {x : Type.{u1}} {f : α -> x}, Iff (Eq.{succ u1} (Option.{u1} x) (Option.map.{u2, u1} α x f β) (Option.none.{u1} x)) (Eq.{succ u2} (Option.{u2} α) β (Option.none.{u2} α))
-Case conversion may be inaccurate. Consider using '#align option.map_eq_none' Option.map_eq_none'ₓ'. -/
@[simp]
theorem map_eq_none' {x : Option α} {f : α → β} : x.map f = none ↔ x = none := by
cases x <;> simp only [map_none', map_some', eq_self_iff_true]
#align option.map_eq_none' Option.map_eq_none'
-/- warning: option.map_injective' -> Option.map_injective' is a dubious translation:
-lean 3 declaration is
- forall {α : Type.{u1}} {β : Type.{u2}}, Function.Injective.{max (succ u1) (succ u2), max (succ u1) (succ u2)} (α -> β) ((Option.{u1} α) -> (Option.{u2} β)) (Option.map.{u1, u2} α β)
-but is expected to have type
- forall {α : Type.{u2}} {β : Type.{u1}}, Function.Injective.{max (succ u2) (succ u1), max (succ u2) (succ u1)} (α -> β) ((Option.{u2} α) -> (Option.{u1} β)) (Option.map.{u2, u1} α β)
-Case conversion may be inaccurate. Consider using '#align option.map_injective' Option.map_injective'ₓ'. -/
/-- `option.map` as a function between functions is injective. -/
theorem map_injective' : Function.Injective (@Option.map α β) := fun f g h =>
funext fun x => some_injective _ <| by simp only [← map_some', h]
#align option.map_injective' Option.map_injective'
-/- warning: option.map_inj -> Option.map_inj is a dubious translation:
-lean 3 declaration is
- forall {α : Type.{u1}} {β : Type.{u2}} {f : α -> β} {g : α -> β}, Iff (Eq.{max (succ u1) (succ u2)} ((Option.{u1} α) -> (Option.{u2} β)) (Option.map.{u1, u2} α β f) (Option.map.{u1, u2} α β g)) (Eq.{max (succ u1) (succ u2)} (α -> β) f g)
-but is expected to have type
- forall {α : Type.{u2}} {β : Type.{u1}} {f : α -> β} {g : α -> β}, Iff (Eq.{max (succ u2) (succ u1)} ((Option.{u2} α) -> (Option.{u1} β)) (Option.map.{u2, u1} α β f) (Option.map.{u2, u1} α β g)) (Eq.{max (succ u2) (succ u1)} (α -> β) f g)
-Case conversion may be inaccurate. Consider using '#align option.map_inj Option.map_injₓ'. -/
@[simp]
theorem map_inj {f g : α → β} : Option.map f = Option.map g ↔ f = g :=
map_injective'.eq_iff
#align option.map_inj Option.map_inj
-/- warning: option.map_congr -> Option.map_congr is a dubious translation:
-lean 3 declaration is
- forall {α : Type.{u1}} {β : Type.{u2}} {f : α -> β} {g : α -> β} {x : Option.{u1} α}, (forall (a : α), (Membership.Mem.{u1, u1} α (Option.{u1} α) (Option.hasMem.{u1} α) a x) -> (Eq.{succ u2} β (f a) (g a))) -> (Eq.{succ u2} (Option.{u2} β) (Option.map.{u1, u2} α β f x) (Option.map.{u1, u2} α β g x))
-but is expected to have type
- forall {α : Type.{u2}} {β : Type.{u1}} {f : α -> β} {g : α -> β} {x : Option.{u2} α}, (forall (a : α), (Membership.mem.{u2, u2} α (Option.{u2} α) (Option.instMembershipOption.{u2} α) a x) -> (Eq.{succ u1} β (f a) (g a))) -> (Eq.{succ u1} (Option.{u1} β) (Option.map.{u2, u1} α β f x) (Option.map.{u2, u1} α β g x))
-Case conversion may be inaccurate. Consider using '#align option.map_congr Option.map_congrₓ'. -/
theorem map_congr {f g : α → β} {x : Option α} (h : ∀ a ∈ x, f a = g a) :
Option.map f x = Option.map g x := by cases x <;> simp only [map_none', map_some', h, mem_def]
#align option.map_congr Option.map_congr
@@ -532,56 +364,26 @@ theorem map_eq_id {f : α → α} : Option.map f = id ↔ f = id :=
#align option.map_eq_id Option.map_eq_id
-/
-/- warning: option.map_map -> Option.map_map is a dubious translation:
-lean 3 declaration is
- forall {α : Type.{u1}} {β : Type.{u2}} {γ : Type.{u3}} (h : β -> γ) (g : α -> β) (x : Option.{u1} α), Eq.{succ u3} (Option.{u3} γ) (Option.map.{u2, u3} β γ h (Option.map.{u1, u2} α β g x)) (Option.map.{u1, u3} α γ (Function.comp.{succ u1, succ u2, succ u3} α β γ h g) x)
-but is expected to have type
- forall {α : Type.{u3}} {β : Type.{u2}} {γ : Type.{u1}} (h : α -> β) (g : γ -> α) (x : Option.{u1} γ), Eq.{succ u2} (Option.{u2} β) (Option.map.{u3, u2} α β h (Option.map.{u1, u3} γ α g x)) (Option.map.{u1, u2} γ β (Function.comp.{succ u1, succ u3, succ u2} γ α β h g) x)
-Case conversion may be inaccurate. Consider using '#align option.map_map Option.map_mapₓ'. -/
@[simp]
theorem map_map (h : β → γ) (g : α → β) (x : Option α) :
Option.map h (Option.map g x) = Option.map (h ∘ g) x := by
cases x <;> simp only [map_none', map_some']
#align option.map_map Option.map_map
-/- warning: option.map_comm -> Option.map_comm is a dubious translation:
-lean 3 declaration is
- forall {α : Type.{u1}} {β : Type.{u2}} {γ : Type.{u3}} {δ : Type.{u4}} {f₁ : α -> β} {f₂ : α -> γ} {g₁ : β -> δ} {g₂ : γ -> δ}, (Eq.{max (succ u1) (succ u4)} (α -> δ) (Function.comp.{succ u1, succ u2, succ u4} α β δ g₁ f₁) (Function.comp.{succ u1, succ u3, succ u4} α γ δ g₂ f₂)) -> (forall (a : α), Eq.{succ u4} (Option.{u4} δ) (Option.map.{u2, u4} β δ g₁ (Option.map.{u1, u2} α β f₁ ((fun (a : Type.{u1}) (b : Type.{u1}) [self : HasLiftT.{succ u1, succ u1} a b] => self.0) α (Option.{u1} α) (HasLiftT.mk.{succ u1, succ u1} α (Option.{u1} α) (CoeTCₓ.coe.{succ u1, succ u1} α (Option.{u1} α) (coeOption.{u1} α))) a))) (Option.map.{u3, u4} γ δ g₂ (Option.map.{u1, u3} α γ f₂ ((fun (a : Type.{u1}) (b : Type.{u1}) [self : HasLiftT.{succ u1, succ u1} a b] => self.0) α (Option.{u1} α) (HasLiftT.mk.{succ u1, succ u1} α (Option.{u1} α) (CoeTCₓ.coe.{succ u1, succ u1} α (Option.{u1} α) (coeOption.{u1} α))) a))))
-but is expected to have type
- forall {α : Type.{u4}} {β : Type.{u2}} {γ : Type.{u1}} {δ : Type.{u3}} {f₁ : α -> β} {f₂ : α -> γ} {g₁ : β -> δ} {g₂ : γ -> δ}, (Eq.{max (succ u4) (succ u3)} (α -> δ) (Function.comp.{succ u4, succ u2, succ u3} α β δ g₁ f₁) (Function.comp.{succ u4, succ u1, succ u3} α γ δ g₂ f₂)) -> (forall (a : α), Eq.{succ u3} (Option.{u3} δ) (Option.map.{u2, u3} β δ g₁ (Option.map.{u4, u2} α β f₁ (Option.some.{u4} α a))) (Option.map.{u1, u3} γ δ g₂ (Option.map.{u4, u1} α γ f₂ (Option.some.{u4} α a))))
-Case conversion may be inaccurate. Consider using '#align option.map_comm Option.map_commₓ'. -/
theorem map_comm {f₁ : α → β} {f₂ : α → γ} {g₁ : β → δ} {g₂ : γ → δ} (h : g₁ ∘ f₁ = g₂ ∘ f₂)
(a : α) : (Option.map f₁ a).map g₁ = (Option.map f₂ a).map g₂ := by rw [map_map, h, ← map_map]
#align option.map_comm Option.map_comm
-/- warning: option.comp_map -> Option.comp_map is a dubious translation:
-lean 3 declaration is
- forall {α : Type.{u1}} {β : Type.{u2}} {γ : Type.{u3}} (h : β -> γ) (g : α -> β) (x : Option.{u1} α), Eq.{succ u3} (Option.{u3} γ) (Option.map.{u1, u3} α γ (Function.comp.{succ u1, succ u2, succ u3} α β γ h g) x) (Option.map.{u2, u3} β γ h (Option.map.{u1, u2} α β g x))
-but is expected to have type
- forall {α : Type.{u3}} {β : Type.{u2}} {γ : Type.{u1}} (h : α -> β) (g : γ -> α) (x : Option.{u1} γ), Eq.{succ u2} (Option.{u2} β) (Option.map.{u1, u2} γ β (Function.comp.{succ u1, succ u3, succ u2} γ α β h g) x) (Option.map.{u3, u2} α β h (Option.map.{u1, u3} γ α g x))
-Case conversion may be inaccurate. Consider using '#align option.comp_map Option.comp_mapₓ'. -/
theorem comp_map (h : β → γ) (g : α → β) (x : Option α) :
Option.map (h ∘ g) x = Option.map h (Option.map g x) :=
(map_map _ _ _).symm
#align option.comp_map Option.comp_map
-/- warning: option.map_comp_map -> Option.map_comp_map is a dubious translation:
-lean 3 declaration is
- forall {α : Type.{u1}} {β : Type.{u2}} {γ : Type.{u3}} (f : α -> β) (g : β -> γ), Eq.{max (succ u1) (succ u3)} ((Option.{u1} α) -> (Option.{u3} γ)) (Function.comp.{succ u1, succ u2, succ u3} (Option.{u1} α) (Option.{u2} β) (Option.{u3} γ) (Option.map.{u2, u3} β γ g) (Option.map.{u1, u2} α β f)) (Option.map.{u1, u3} α γ (Function.comp.{succ u1, succ u2, succ u3} α β γ g f))
-but is expected to have type
- forall {α : Type.{u3}} {β : Type.{u2}} {γ : Type.{u1}} (f : α -> β) (g : β -> γ), Eq.{max (succ u1) (succ u3)} ((Option.{u3} α) -> (Option.{u1} γ)) (Function.comp.{succ u3, succ u2, succ u1} (Option.{u3} α) (Option.{u2} β) (Option.{u1} γ) (Option.map.{u2, u1} β γ g) (Option.map.{u3, u2} α β f)) (Option.map.{u3, u1} α γ (Function.comp.{succ u3, succ u2, succ u1} α β γ g f))
-Case conversion may be inaccurate. Consider using '#align option.map_comp_map Option.map_comp_mapₓ'. -/
@[simp]
theorem map_comp_map (f : α → β) (g : β → γ) : Option.map g ∘ Option.map f = Option.map (g ∘ f) :=
by ext x; rw [comp_map]
#align option.map_comp_map Option.map_comp_map
-/- warning: option.mem_map_of_mem -> Option.mem_map_of_mem is a dubious translation:
-lean 3 declaration is
- forall {α : Type.{u1}} {β : Type.{u2}} {a : α} {x : Option.{u1} α} (g : α -> β), (Membership.Mem.{u1, u1} α (Option.{u1} α) (Option.hasMem.{u1} α) a x) -> (Membership.Mem.{u2, u2} β (Option.{u2} β) (Option.hasMem.{u2} β) (g a) (Option.map.{u1, u2} α β g x))
-but is expected to have type
- forall {α : Type.{u2}} {β : Type.{u1}} {a : α} {x : Option.{u2} α} (g : α -> β), (Membership.mem.{u2, u2} α (Option.{u2} α) (Option.instMembershipOption.{u2} α) a x) -> (Membership.mem.{u1, u1} β (Option.{u1} β) (Option.instMembershipOption.{u1} β) (g a) (Option.map.{u2, u1} α β g x))
-Case conversion may be inaccurate. Consider using '#align option.mem_map_of_mem Option.mem_map_of_memₓ'. -/
theorem mem_map_of_mem {a : α} {x : Option α} (g : α → β) (h : a ∈ x) : g a ∈ x.map g :=
mem_def.mpr ((mem_def.mp h).symm ▸ map_some')
#align option.mem_map_of_mem Option.mem_map_of_mem
@@ -597,22 +399,10 @@ theorem exists_mem_map {f : α → β} {o : Option α} {p : β → Prop} :
(∃ y ∈ o.map f, p y) ↔ ∃ x ∈ o, p (f x) := by simp
#align option.exists_mem_map Option.exists_mem_map
-/- warning: option.bind_map_comm -> Option.bind_map_comm is a dubious translation:
-lean 3 declaration is
- forall {α : Type.{u_1}} {β : Type.{u_1}} {x : Option.{u_1} (Option.{u_1} α)} {f : α -> β}, Eq.{succ u_1} (Option.{u_1} β) (Bind.bind.{u_1, u_1} Option.{u_1} (Monad.toHasBind.{u_1, u_1} Option.{u_1} Option.monad.{u_1}) (Option.{u_1} α) β x (Option.map.{u_1, u_1} α β f)) (Bind.bind.{u_1, u_1} Option.{u_1} (Monad.toHasBind.{u_1, u_1} Option.{u_1} Option.monad.{u_1}) (Option.{u_1} β) β (Option.map.{u_1, u_1} (Option.{u_1} α) (Option.{u_1} β) (Option.map.{u_1, u_1} α β f) x) (id.{succ u_1} (Option.{u_1} β)))
-but is expected to have type
- forall {α : Type.{u_1}} {β : Type.{u_2}} {x : Option.{u_1} (Option.{u_1} α)} {f : α -> β}, Eq.{succ u_2} (Option.{u_2} β) (Option.bind.{u_1, u_2} (Option.{u_1} α) β x (Option.map.{u_1, u_2} α β f)) (Option.bind.{u_2, u_2} (Option.{u_2} β) β (Option.map.{u_1, u_2} (Option.{u_1} α) (Option.{u_2} β) (Option.map.{u_1, u_2} α β f) x) (id.{succ u_2} (Option.{u_2} β)))
-Case conversion may be inaccurate. Consider using '#align option.bind_map_comm Option.bind_map_commₓ'. -/
theorem bind_map_comm {α β} {x : Option (Option α)} {f : α → β} :
x >>= Option.map f = x.map (Option.map f) >>= id := by cases x <;> simp
#align option.bind_map_comm Option.bind_map_comm
-/- warning: option.join_map_eq_map_join -> Option.join_map_eq_map_join is a dubious translation:
-lean 3 declaration is
- forall {α : Type.{u1}} {β : Type.{u2}} {f : α -> β} {x : Option.{u1} (Option.{u1} α)}, Eq.{succ u2} (Option.{u2} β) (Option.join.{u2} β (Option.map.{u1, u2} (Option.{u1} α) (Option.{u2} β) (Option.map.{u1, u2} α β f) x)) (Option.map.{u1, u2} α β f (Option.join.{u1} α x))
-but is expected to have type
- forall {α : Type.{u2}} {β : Type.{u1}} {f : α -> β} {x : Option.{u2} (Option.{u2} α)}, Eq.{succ u1} (Option.{u1} β) (Option.join.{u1} β (Option.map.{u2, u1} (Option.{u2} α) (Option.{u1} β) (Option.map.{u2, u1} α β f) x)) (Option.map.{u2, u1} α β f (Option.join.{u2} α x))
-Case conversion may be inaccurate. Consider using '#align option.join_map_eq_map_join Option.join_map_eq_map_joinₓ'. -/
theorem join_map_eq_map_join {f : α → β} {x : Option (Option α)} :
(x.map (Option.map f)).join = x.join.map f := by rcases x with (_ | _ | x) <;> simp
#align option.join_map_eq_map_join Option.join_map_eq_map_join
@@ -640,54 +430,24 @@ theorem pbind_eq_bind (f : α → Option β) (x : Option α) : (x.pbind fun a _
#align option.pbind_eq_bind Option.pbind_eq_bind
-/
-/- warning: option.map_bind -> Option.map_bind is a dubious translation:
-lean 3 declaration is
- forall {α : Type.{u1}} {β : Type.{u1}} {γ : Type.{u1}} (f : β -> γ) (x : Option.{u1} α) (g : α -> (Option.{u1} β)), Eq.{succ u1} (Option.{u1} γ) (Option.map.{u1, u1} β γ f (Bind.bind.{u1, u1} Option.{u1} (Monad.toHasBind.{u1, u1} Option.{u1} Option.monad.{u1}) α β x g)) (Bind.bind.{u1, u1} Option.{u1} (Monad.toHasBind.{u1, u1} Option.{u1} Option.monad.{u1}) α γ x (fun (a : α) => Option.map.{u1, u1} β γ f (g a)))
-but is expected to have type
- forall {α : Type.{u1}} {β : Type.{u1}} {γ : Type.{u1}} (f : β -> γ) (x : Option.{u1} α) (g : α -> (Option.{u1} β)), Eq.{succ u1} (Option.{u1} γ) (Option.map.{u1, u1} β γ f (Bind.bind.{u1, u1} Option.{u1} (Monad.toBind.{u1, u1} Option.{u1} instMonadOption.{u1}) α β x g)) (Bind.bind.{u1, u1} Option.{u1} (Monad.toBind.{u1, u1} Option.{u1} instMonadOption.{u1}) α γ x (fun (a : α) => Option.map.{u1, u1} β γ f (g a)))
-Case conversion may be inaccurate. Consider using '#align option.map_bind Option.map_bindₓ'. -/
theorem map_bind {α β γ} (f : β → γ) (x : Option α) (g : α → Option β) :
Option.map f (x >>= g) = x >>= fun a => Option.map f (g a) := by
simp_rw [← map_eq_map, ← bind_pure_comp_eq_map, LawfulMonad.bind_assoc]
#align option.map_bind Option.map_bind
-/- warning: option.map_bind' -> Option.map_bind' is a dubious translation:
-lean 3 declaration is
- forall {α : Type.{u1}} {β : Type.{u2}} {γ : Type.{u3}} (f : β -> γ) (x : Option.{u1} α) (g : α -> (Option.{u2} β)), Eq.{succ u3} (Option.{u3} γ) (Option.map.{u2, u3} β γ f (Option.bind.{u1, u2} α β x g)) (Option.bind.{u1, u3} α γ x (fun (a : α) => Option.map.{u2, u3} β γ f (g a)))
-but is expected to have type
- forall {α : Type.{u3}} {β : Type.{u2}} {γ : Type.{u1}} (f : β -> γ) (x : Option.{u3} α) (g : α -> (Option.{u2} β)), Eq.{succ u1} (Option.{u1} γ) (Option.map.{u2, u1} β γ f (Option.bind.{u3, u2} α β x g)) (Option.bind.{u3, u1} α γ x (fun (a : α) => Option.map.{u2, u1} β γ f (g a)))
-Case conversion may be inaccurate. Consider using '#align option.map_bind' Option.map_bind'ₓ'. -/
theorem map_bind' (f : β → γ) (x : Option α) (g : α → Option β) :
Option.map f (x.bind g) = x.bind fun a => Option.map f (g a) := by cases x <;> simp
#align option.map_bind' Option.map_bind'
-/- warning: option.map_pbind -> Option.map_pbind is a dubious translation:
-lean 3 declaration is
- forall {α : Type.{u1}} {β : Type.{u2}} {γ : Type.{u3}} (f : β -> γ) (x : Option.{u1} α) (g : forall (a : α), (Membership.Mem.{u1, u1} α (Option.{u1} α) (Option.hasMem.{u1} α) a x) -> (Option.{u2} β)), Eq.{succ u3} (Option.{u3} γ) (Option.map.{u2, u3} β γ f (Option.pbind.{u1, u2} α β x g)) (Option.pbind.{u1, u3} α γ x (fun (a : α) (H : Membership.Mem.{u1, u1} α (Option.{u1} α) (Option.hasMem.{u1} α) a x) => Option.map.{u2, u3} β γ f (g a H)))
-but is expected to have type
- forall {α : Type.{u3}} {β : Type.{u2}} {γ : Type.{u1}} (f : β -> γ) (x : Option.{u3} α) (g : forall (a : α), (Membership.mem.{u3, u3} α (Option.{u3} α) (Option.instMembershipOption.{u3} α) a x) -> (Option.{u2} β)), Eq.{succ u1} (Option.{u1} γ) (Option.map.{u2, u1} β γ f (Option.pbind.{u3, u2} α β x g)) (Option.pbind.{u3, u1} α γ x (fun (a : α) (H : Membership.mem.{u3, u3} α (Option.{u3} α) (Option.instMembershipOption.{u3} α) a x) => Option.map.{u2, u1} β γ f (g a H)))
-Case conversion may be inaccurate. Consider using '#align option.map_pbind Option.map_pbindₓ'. -/
theorem map_pbind (f : β → γ) (x : Option α) (g : ∀ a, a ∈ x → Option β) :
Option.map f (x.pbind g) = x.pbind fun a H => Option.map f (g a H) := by
cases x <;> simp only [pbind, map_none']
#align option.map_pbind Option.map_pbind
-/- warning: option.pbind_map -> Option.pbind_map is a dubious translation:
-lean 3 declaration is
- forall {α : Type.{u1}} {β : Type.{u2}} {γ : Type.{u3}} (f : α -> β) (x : Option.{u1} α) (g : forall (b : β), (Membership.Mem.{u2, u2} β (Option.{u2} β) (Option.hasMem.{u2} β) b (Option.map.{u1, u2} α β f x)) -> (Option.{u3} γ)), Eq.{succ u3} (Option.{u3} γ) (Option.pbind.{u2, u3} β γ (Option.map.{u1, u2} α β f x) g) (Option.pbind.{u1, u3} α γ x (fun (a : α) (h : Membership.Mem.{u1, u1} α (Option.{u1} α) (Option.hasMem.{u1} α) a x) => g (f a) (Option.mem_map_of_mem.{u1, u2} α β a x f h)))
-but is expected to have type
- forall {α : Type.{u3}} {β : Type.{u2}} {γ : Type.{u1}} (f : α -> β) (x : Option.{u3} α) (g : forall (b : β), (Membership.mem.{u2, u2} β (Option.{u2} β) (Option.instMembershipOption.{u2} β) b (Option.map.{u3, u2} α β f x)) -> (Option.{u1} γ)), Eq.{succ u1} (Option.{u1} γ) (Option.pbind.{u2, u1} β γ (Option.map.{u3, u2} α β f x) g) (Option.pbind.{u3, u1} α γ x (fun (a : α) (h : Membership.mem.{u3, u3} α (Option.{u3} α) (Option.instMembershipOption.{u3} α) a x) => g (f a) (Option.mem_map_of_mem.{u2, u3} α β a x f h)))
-Case conversion may be inaccurate. Consider using '#align option.pbind_map Option.pbind_mapₓ'. -/
theorem pbind_map (f : α → β) (x : Option α) (g : ∀ b : β, b ∈ x.map f → Option γ) :
pbind (Option.map f x) g = x.pbind fun a h => g (f a) (mem_map_of_mem _ h) := by cases x <;> rfl
#align option.pbind_map Option.pbind_map
-/- warning: option.pmap_none -> Option.pmap_none is a dubious translation:
-lean 3 declaration is
- forall {α : Type.{u1}} {β : Type.{u2}} {p : α -> Prop} (f : forall (a : α), (p a) -> β) {H : forall (a : α), (Membership.Mem.{u1, u1} α (Option.{u1} α) (Option.hasMem.{u1} α) a (Option.none.{u1} α)) -> (p a)}, Eq.{succ u2} (Option.{u2} β) (Option.pmap.{u1, u2} α β (fun (a : α) => p a) f (Option.none.{u1} α) H) (Option.none.{u2} β)
-but is expected to have type
- forall {α : Type.{u2}} {β : Type.{u1}} {p : α -> Prop} (f : forall (a : α), (p a) -> β) {H : forall (a : α), (Membership.mem.{u2, u2} α (Option.{u2} α) (Option.instMembershipOption.{u2} α) a (Option.none.{u2} α)) -> (p a)}, Eq.{succ u1} (Option.{u1} β) (Option.pmap.{u2, u1} α β (fun (a : α) => p a) f (Option.none.{u2} α) H) (Option.none.{u1} β)
-Case conversion may be inaccurate. Consider using '#align option.pmap_none Option.pmap_noneₓ'. -/
@[simp]
theorem pmap_none (f : ∀ a : α, p a → β) {H} : pmap f (@none α) H = none :=
rfl
@@ -701,68 +461,32 @@ theorem pmap_some (f : ∀ a : α, p a → β) {x : α} (h : p x) :
#align option.pmap_some Option.pmap_some
-/
-/- warning: option.mem_pmem -> Option.mem_pmem is a dubious translation:
-lean 3 declaration is
- forall {α : Type.{u1}} {β : Type.{u2}} {p : α -> Prop} (f : forall (a : α), (p a) -> β) (x : Option.{u1} α) {a : α} (h : forall (a : α), (Membership.Mem.{u1, u1} α (Option.{u1} α) (Option.hasMem.{u1} α) a x) -> (p a)) (ha : Membership.Mem.{u1, u1} α (Option.{u1} α) (Option.hasMem.{u1} α) a x), Membership.Mem.{u2, u2} β (Option.{u2} β) (Option.hasMem.{u2} β) (f a (h a ha)) (Option.pmap.{u1, u2} α β (fun (a : α) => p a) f x h)
-but is expected to have type
- forall {α : Type.{u2}} {β : Type.{u1}} {p : α -> Prop} (f : forall (a : α), (p a) -> β) (x : Option.{u2} α) {a : α} (h : forall (a : α), (Membership.mem.{u2, u2} α (Option.{u2} α) (Option.instMembershipOption.{u2} α) a x) -> (p a)) (ha : Membership.mem.{u2, u2} α (Option.{u2} α) (Option.instMembershipOption.{u2} α) a x), Membership.mem.{u1, u1} β (Option.{u1} β) (Option.instMembershipOption.{u1} β) (f a (h a ha)) (Option.pmap.{u2, u1} α β (fun (a : α) => p a) f x h)
-Case conversion may be inaccurate. Consider using '#align option.mem_pmem Option.mem_pmemₓ'. -/
theorem mem_pmem {a : α} (h : ∀ a ∈ x, p a) (ha : a ∈ x) : f a (h a ha) ∈ pmap f x h := by
rw [mem_def] at ha⊢; subst ha; rfl
#align option.mem_pmem Option.mem_pmem
-/- warning: option.pmap_map -> Option.pmap_map is a dubious translation:
-lean 3 declaration is
- forall {α : Type.{u1}} {β : Type.{u2}} {γ : Type.{u3}} {p : α -> Prop} (f : forall (a : α), (p a) -> β) (g : γ -> α) (x : Option.{u3} γ) (H : forall (a : α), (Membership.Mem.{u1, u1} α (Option.{u1} α) (Option.hasMem.{u1} α) a (Option.map.{u3, u1} γ α g x)) -> (p a)), Eq.{succ u2} (Option.{u2} β) (Option.pmap.{u1, u2} α β (fun (a : α) => p a) f (Option.map.{u3, u1} γ α g x) H) (Option.pmap.{u3, u2} γ β (fun (a : γ) => p (g a)) (fun (a : γ) (h : p (g a)) => f (g a) h) x (fun (a : γ) (h : Membership.Mem.{u3, u3} γ (Option.{u3} γ) (Option.hasMem.{u3} γ) a x) => H (g a) (Option.mem_map_of_mem.{u3, u1} γ α a x g h)))
-but is expected to have type
- forall {α : Type.{u2}} {β : Type.{u1}} {γ : Type.{u3}} {p : α -> Prop} (f : forall (a : α), (p a) -> β) (g : γ -> α) (x : Option.{u3} γ) (H : forall (a : α), (Membership.mem.{u2, u2} α (Option.{u2} α) (Option.instMembershipOption.{u2} α) a (Option.map.{u3, u2} γ α g x)) -> (p a)), Eq.{succ u1} (Option.{u1} β) (Option.pmap.{u2, u1} α β (fun (a : α) => p a) f (Option.map.{u3, u2} γ α g x) H) (Option.pmap.{u3, u1} γ β (fun (a : γ) => p (g a)) (fun (a : γ) (h : p (g a)) => f (g a) h) x (fun (a : γ) (h : Membership.mem.{u3, u3} γ (Option.{u3} γ) (Option.instMembershipOption.{u3} γ) a x) => H (g a) (Option.mem_map_of_mem.{u2, u3} γ α a x g h)))
-Case conversion may be inaccurate. Consider using '#align option.pmap_map Option.pmap_mapₓ'. -/
theorem pmap_map (g : γ → α) (x : Option γ) (H) :
pmap f (x.map g) H = pmap (fun a h => f (g a) h) x fun a h => H _ (mem_map_of_mem _ h) := by
cases x <;> simp only [map_none', map_some', pmap]
#align option.pmap_map Option.pmap_map
-/- warning: option.map_pmap -> Option.map_pmap is a dubious translation:
-lean 3 declaration is
- forall {α : Type.{u1}} {β : Type.{u2}} {γ : Type.{u3}} {p : α -> Prop} (g : β -> γ) (f : forall (a : α), (p a) -> β) (x : Option.{u1} α) (H : forall (a : α), (Membership.Mem.{u1, u1} α (Option.{u1} α) (Option.hasMem.{u1} α) a x) -> (p a)), Eq.{succ u3} (Option.{u3} γ) (Option.map.{u2, u3} β γ g (Option.pmap.{u1, u2} α β (fun (a : α) => p a) f x H)) (Option.pmap.{u1, u3} α γ (fun (a : α) => p a) (fun (a : α) (h : p a) => g (f a h)) x H)
-but is expected to have type
- forall {α : Type.{u3}} {β : Type.{u1}} {γ : Type.{u2}} {p : α -> Prop} (g : β -> γ) (f : forall (a : α), (p a) -> β) (x : Option.{u3} α) (H : forall (a : α), (Membership.mem.{u3, u3} α (Option.{u3} α) (Option.instMembershipOption.{u3} α) a x) -> (p a)), Eq.{succ u2} (Option.{u2} γ) (Option.map.{u1, u2} β γ g (Option.pmap.{u3, u1} α β (fun (a : α) => p a) f x H)) (Option.pmap.{u3, u2} α γ (fun (a : α) => p a) (fun (a : α) (h : p a) => g (f a h)) x H)
-Case conversion may be inaccurate. Consider using '#align option.map_pmap Option.map_pmapₓ'. -/
theorem map_pmap (g : β → γ) (f : ∀ a, p a → β) (x H) :
Option.map g (pmap f x H) = pmap (fun a h => g (f a h)) x H := by
cases x <;> simp only [map_none', map_some', pmap]
#align option.map_pmap Option.map_pmap
-/- warning: option.pmap_eq_map -> Option.pmap_eq_map is a dubious translation:
-lean 3 declaration is
- forall {α : Type.{u1}} {β : Type.{u2}} (p : α -> Prop) (f : α -> β) (x : Option.{u1} α) (H : forall (a : α), (Membership.Mem.{u1, u1} α (Option.{u1} α) (Option.hasMem.{u1} α) a x) -> (p a)), Eq.{succ u2} (Option.{u2} β) (Option.pmap.{u1, u2} α β p (fun (a : α) (_x : p a) => f a) x H) (Option.map.{u1, u2} α β f x)
-but is expected to have type
- forall {α : Type.{u2}} {β : Type.{u1}} (p : α -> Prop) (f : α -> β) (x : Option.{u2} α) (H : forall (a : α), (Membership.mem.{u2, u2} α (Option.{u2} α) (Option.instMembershipOption.{u2} α) a x) -> (p a)), Eq.{succ u1} (Option.{u1} β) (Option.pmap.{u2, u1} α β p (fun (a : α) (_x : p a) => f a) x H) (Option.map.{u2, u1} α β f x)
-Case conversion may be inaccurate. Consider using '#align option.pmap_eq_map Option.pmap_eq_mapₓ'. -/
@[simp]
theorem pmap_eq_map (p : α → Prop) (f : α → β) (x H) :
@pmap _ _ p (fun a _ => f a) x H = Option.map f x := by
cases x <;> simp only [map_none', map_some', pmap]
#align option.pmap_eq_map Option.pmap_eq_map
-/- warning: option.pmap_bind -> Option.pmap_bind is a dubious translation:
-lean 3 declaration is
- forall {α : Type.{u1}} {β : Type.{u1}} {γ : Type.{u1}} {x : Option.{u1} α} {g : α -> (Option.{u1} β)} {p : β -> Prop} {f : forall (b : β), (p b) -> γ} (H : forall (a : β), (Membership.Mem.{u1, u1} β (Option.{u1} β) (Option.hasMem.{u1} β) a (Bind.bind.{u1, u1} Option.{u1} (Monad.toHasBind.{u1, u1} Option.{u1} Option.monad.{u1}) α β x g)) -> (p a)) (H' : forall (a : α) (b : β), (Membership.Mem.{u1, u1} β (Option.{u1} β) (Option.hasMem.{u1} β) b (g a)) -> (Membership.Mem.{u1, u1} β (Option.{u1} β) (Option.hasMem.{u1} β) b (Bind.bind.{u1, u1} Option.{u1} (Monad.toHasBind.{u1, u1} Option.{u1} Option.monad.{u1}) α β x g))), Eq.{succ u1} (Option.{u1} γ) (Option.pmap.{u1, u1} β γ (fun (b : β) => p b) f (Bind.bind.{u1, u1} Option.{u1} (Monad.toHasBind.{u1, u1} Option.{u1} Option.monad.{u1}) α β x g) H) (Bind.bind.{u1, u1} Option.{u1} (Monad.toHasBind.{u1, u1} Option.{u1} Option.monad.{u1}) α γ x (fun (a : α) => Option.pmap.{u1, u1} β γ (fun (b : β) => p b) f (g a) (fun (b : β) (h : Membership.Mem.{u1, u1} β (Option.{u1} β) (Option.hasMem.{u1} β) b (g a)) => H b (H' a b h))))
-but is expected to have type
- forall {α : Type.{u1}} {β : Type.{u1}} {γ : Type.{u1}} {x : Option.{u1} α} {g : α -> (Option.{u1} β)} {p : β -> Prop} {f : forall (b : β), (p b) -> γ} (H : forall (a : β), (Membership.mem.{u1, u1} β (Option.{u1} β) (Option.instMembershipOption.{u1} β) a (Bind.bind.{u1, u1} Option.{u1} (Monad.toBind.{u1, u1} Option.{u1} instMonadOption.{u1}) α β x g)) -> (p a)) (H' : forall (a : α) (b : β), (Membership.mem.{u1, u1} β (Option.{u1} β) (Option.instMembershipOption.{u1} β) b (g a)) -> (Membership.mem.{u1, u1} β (Option.{u1} β) (Option.instMembershipOption.{u1} β) b (Bind.bind.{u1, u1} Option.{u1} (Monad.toBind.{u1, u1} Option.{u1} instMonadOption.{u1}) α β x g))), Eq.{succ u1} (Option.{u1} γ) (Option.pmap.{u1, u1} β γ (fun (b : β) => p b) f (Bind.bind.{u1, u1} Option.{u1} (Monad.toBind.{u1, u1} Option.{u1} instMonadOption.{u1}) α β x g) H) (Bind.bind.{u1, u1} Option.{u1} (Monad.toBind.{u1, u1} Option.{u1} instMonadOption.{u1}) α γ x (fun (a : α) => Option.pmap.{u1, u1} β γ (fun (b : β) => p b) f (g a) (fun (b : β) (h : Membership.mem.{u1, u1} β (Option.{u1} β) (Option.instMembershipOption.{u1} β) b (g a)) => H b (H' a b h))))
-Case conversion may be inaccurate. Consider using '#align option.pmap_bind Option.pmap_bindₓ'. -/
theorem pmap_bind {α β γ} {x : Option α} {g : α → Option β} {p : β → Prop} {f : ∀ b, p b → γ} (H)
(H' : ∀ (a : α), ∀ b ∈ g a, b ∈ x >>= g) :
pmap f (x >>= g) H = x >>= fun a => pmap f (g a) fun b h => H _ (H' a _ h) := by
cases x <;> simp only [pmap, none_bind, some_bind]
#align option.pmap_bind Option.pmap_bind
-/- warning: option.bind_pmap -> Option.bind_pmap is a dubious translation:
-lean 3 declaration is
- forall {α : Type.{u1}} {β : Type.{u2}} {γ : Type.{u2}} {p : α -> Prop} (f : forall (a : α), (p a) -> β) (x : Option.{u1} α) (g : β -> (Option.{u2} γ)) (H : forall (a : α), (Membership.Mem.{u1, u1} α (Option.{u1} α) (Option.hasMem.{u1} α) a x) -> (p a)), Eq.{succ u2} (Option.{u2} γ) (Bind.bind.{u2, u2} Option.{u2} (Monad.toHasBind.{u2, u2} Option.{u2} Option.monad.{u2}) β γ (Option.pmap.{u1, u2} α β (fun (a : α) => p a) f x H) g) (Option.pbind.{u1, u2} α γ x (fun (a : α) (h : Membership.Mem.{u1, u1} α (Option.{u1} α) (Option.hasMem.{u1} α) a x) => g (f a (H a h))))
-but is expected to have type
- forall {α : Type.{u2}} {β : Type.{u1}} {γ : Type.{u1}} {p : α -> Prop} (f : forall (a : α), (p a) -> β) (x : Option.{u2} α) (g : β -> (Option.{u1} γ)) (H : forall (a : α), (Membership.mem.{u2, u2} α (Option.{u2} α) (Option.instMembershipOption.{u2} α) a x) -> (p a)), Eq.{succ u1} (Option.{u1} γ) (Bind.bind.{u1, u1} Option.{u1} (Monad.toBind.{u1, u1} Option.{u1} instMonadOption.{u1}) β γ (Option.pmap.{u2, u1} α β (fun (a : α) => p a) f x H) g) (Option.pbind.{u2, u1} α γ x (fun (a : α) (h : Membership.mem.{u2, u2} α (Option.{u2} α) (Option.instMembershipOption.{u2} α) a x) => g (f a (H a h))))
-Case conversion may be inaccurate. Consider using '#align option.bind_pmap Option.bind_pmapₓ'. -/
theorem bind_pmap {α β γ} {p : α → Prop} (f : ∀ a, p a → β) (x : Option α) (g : β → Option γ) (H) :
pmap f x H >>= g = x.pbind fun a h => g (f a (H _ h)) := by
cases x <;> simp only [pmap, none_bind, some_bind, pbind]
@@ -770,12 +494,6 @@ theorem bind_pmap {α β γ} {p : α → Prop} (f : ∀ a, p a → β) (x : Opti
variable {f x}
-/- warning: option.pbind_eq_none -> Option.pbind_eq_none is a dubious translation:
-lean 3 declaration is
- forall {α : Type.{u1}} {β : Type.{u2}} {x : Option.{u1} α} {f : forall (a : α), (Membership.Mem.{u1, u1} α (Option.{u1} α) (Option.hasMem.{u1} α) a x) -> (Option.{u2} β)}, (forall (a : α) (H : Membership.Mem.{u1, u1} α (Option.{u1} α) (Option.hasMem.{u1} α) a x), (Eq.{succ u2} (Option.{u2} β) (f a H) (Option.none.{u2} β)) -> (Eq.{succ u1} (Option.{u1} α) x (Option.none.{u1} α))) -> (Iff (Eq.{succ u2} (Option.{u2} β) (Option.pbind.{u1, u2} α β x f) (Option.none.{u2} β)) (Eq.{succ u1} (Option.{u1} α) x (Option.none.{u1} α)))
-but is expected to have type
- forall {α : Type.{u2}} {β : Type.{u1}} {x : Option.{u2} α} {f : forall (a : α), (Membership.mem.{u2, u2} α (Option.{u2} α) (Option.instMembershipOption.{u2} α) a x) -> (Option.{u1} β)}, (forall (a : α) (H : Membership.mem.{u2, u2} α (Option.{u2} α) (Option.instMembershipOption.{u2} α) a x), (Eq.{succ u1} (Option.{u1} β) (f a H) (Option.none.{u1} β)) -> (Eq.{succ u2} (Option.{u2} α) x (Option.none.{u2} α))) -> (Iff (Eq.{succ u1} (Option.{u1} β) (Option.pbind.{u2, u1} α β x f) (Option.none.{u1} β)) (Eq.{succ u2} (Option.{u2} α) x (Option.none.{u2} α)))
-Case conversion may be inaccurate. Consider using '#align option.pbind_eq_none Option.pbind_eq_noneₓ'. -/
theorem pbind_eq_none {f : ∀ a : α, a ∈ x → Option β} (h' : ∀ a ∈ x, f a H = none → x = none) :
x.pbind f = none ↔ x = none := by
cases x
@@ -785,12 +503,6 @@ theorem pbind_eq_none {f : ∀ a : α, a ∈ x → Option β} (h' : ∀ a ∈ x,
cases h' x rfl h
#align option.pbind_eq_none Option.pbind_eq_none
-/- warning: option.pbind_eq_some -> Option.pbind_eq_some is a dubious translation:
-lean 3 declaration is
- forall {α : Type.{u1}} {β : Type.{u2}} {x : Option.{u1} α} {f : forall (a : α), (Membership.Mem.{u1, u1} α (Option.{u1} α) (Option.hasMem.{u1} α) a x) -> (Option.{u2} β)} {y : β}, Iff (Eq.{succ u2} (Option.{u2} β) (Option.pbind.{u1, u2} α β x f) (Option.some.{u2} β y)) (Exists.{succ u1} α (fun (z : α) => Exists.{0} (Membership.Mem.{u1, u1} α (Option.{u1} α) (Option.hasMem.{u1} α) z x) (fun (H : Membership.Mem.{u1, u1} α (Option.{u1} α) (Option.hasMem.{u1} α) z x) => Eq.{succ u2} (Option.{u2} β) (f z H) (Option.some.{u2} β y))))
-but is expected to have type
- forall {α : Type.{u2}} {β : Type.{u1}} {x : Option.{u2} α} {f : forall (a : α), (Membership.mem.{u2, u2} α (Option.{u2} α) (Option.instMembershipOption.{u2} α) a x) -> (Option.{u1} β)} {y : β}, Iff (Eq.{succ u1} (Option.{u1} β) (Option.pbind.{u2, u1} α β x f) (Option.some.{u1} β y)) (Exists.{succ u2} α (fun (z : α) => Exists.{0} (Membership.mem.{u2, u2} α (Option.{u2} α) (Option.instMembershipOption.{u2} α) z x) (fun (H : Membership.mem.{u2, u2} α (Option.{u2} α) (Option.instMembershipOption.{u2} α) z x) => Eq.{succ u1} (Option.{u1} β) (f z H) (Option.some.{u1} β y))))
-Case conversion may be inaccurate. Consider using '#align option.pbind_eq_some Option.pbind_eq_someₓ'. -/
theorem pbind_eq_some {f : ∀ a : α, a ∈ x → Option β} {y : β} :
x.pbind f = some y ↔ ∃ z ∈ x, f z H = some y :=
by
@@ -806,22 +518,10 @@ theorem pbind_eq_some {f : ∀ a : α, a ∈ x → Option β} {y : β} :
simpa only [H] using hz
#align option.pbind_eq_some Option.pbind_eq_some
-/- warning: option.pmap_eq_none_iff -> Option.pmap_eq_none_iff is a dubious translation:
-lean 3 declaration is
- forall {α : Type.{u1}} {β : Type.{u2}} {p : α -> Prop} {f : forall (a : α), (p a) -> β} {x : Option.{u1} α} {h : forall (a : α), (Membership.Mem.{u1, u1} α (Option.{u1} α) (Option.hasMem.{u1} α) a x) -> (p a)}, Iff (Eq.{succ u2} (Option.{u2} β) (Option.pmap.{u1, u2} α β (fun (a : α) => p a) f x h) (Option.none.{u2} β)) (Eq.{succ u1} (Option.{u1} α) x (Option.none.{u1} α))
-but is expected to have type
- forall {α : Type.{u2}} {β : Type.{u1}} {p : α -> Prop} {f : forall (a : α), (p a) -> β} {x : Option.{u2} α} {h : forall (a : α), (Membership.mem.{u2, u2} α (Option.{u2} α) (Option.instMembershipOption.{u2} α) a x) -> (p a)}, Iff (Eq.{succ u1} (Option.{u1} β) (Option.pmap.{u2, u1} α β (fun (a : α) => p a) f x h) (Option.none.{u1} β)) (Eq.{succ u2} (Option.{u2} α) x (Option.none.{u2} α))
-Case conversion may be inaccurate. Consider using '#align option.pmap_eq_none_iff Option.pmap_eq_none_iffₓ'. -/
@[simp]
theorem pmap_eq_none_iff {h} : pmap f x h = none ↔ x = none := by cases x <;> simp
#align option.pmap_eq_none_iff Option.pmap_eq_none_iff
-/- warning: option.pmap_eq_some_iff -> Option.pmap_eq_some_iff is a dubious translation:
-lean 3 declaration is
- forall {α : Type.{u1}} {β : Type.{u2}} {p : α -> Prop} {f : forall (a : α), (p a) -> β} {x : Option.{u1} α} {hf : forall (a : α), (Membership.Mem.{u1, u1} α (Option.{u1} α) (Option.hasMem.{u1} α) a x) -> (p a)} {y : β}, Iff (Eq.{succ u2} (Option.{u2} β) (Option.pmap.{u1, u2} α β (fun (a : α) => p a) f x hf) (Option.some.{u2} β y)) (Exists.{succ u1} α (fun (a : α) => Exists.{0} (Eq.{succ u1} (Option.{u1} α) x (Option.some.{u1} α a)) (fun (H : Eq.{succ u1} (Option.{u1} α) x (Option.some.{u1} α a)) => Eq.{succ u2} β (f a (hf a H)) y)))
-but is expected to have type
- forall {α : Type.{u2}} {β : Type.{u1}} {p : α -> Prop} {f : forall (a : α), (p a) -> β} {x : Option.{u2} α} {hf : forall (a : α), (Membership.mem.{u2, u2} α (Option.{u2} α) (Option.instMembershipOption.{u2} α) a x) -> (p a)} {y : β}, Iff (Eq.{succ u1} (Option.{u1} β) (Option.pmap.{u2, u1} α β (fun (a : α) => p a) f x hf) (Option.some.{u1} β y)) (Exists.{succ u2} α (fun (a : α) => Exists.{0} (Eq.{succ u2} (Option.{u2} α) x (Option.some.{u2} α a)) (fun (H : Eq.{succ u2} (Option.{u2} α) x (Option.some.{u2} α a)) => Eq.{succ u1} β (f a (hf a H)) y)))
-Case conversion may be inaccurate. Consider using '#align option.pmap_eq_some_iff Option.pmap_eq_some_iffₓ'. -/
@[simp]
theorem pmap_eq_some_iff {hf} {y : β} :
pmap f x hf = some y ↔ ∃ (a : α)(H : x = some a), f a (hf a H) = y :=
@@ -837,12 +537,6 @@ theorem pmap_eq_some_iff {hf} {y : β} :
simp only [H, pmap]
#align option.pmap_eq_some_iff Option.pmap_eq_some_iff
-/- warning: option.join_pmap_eq_pmap_join -> Option.join_pmap_eq_pmap_join is a dubious translation:
-lean 3 declaration is
- forall {α : Type.{u1}} {β : Type.{u2}} {p : α -> Prop} {f : forall (a : α), (p a) -> β} {x : Option.{u1} (Option.{u1} α)} (H : forall (a : Option.{u1} α), (Membership.Mem.{u1, u1} (Option.{u1} α) (Option.{u1} (Option.{u1} α)) (Option.hasMem.{u1} (Option.{u1} α)) a x) -> (forall (a_1 : α), (Membership.Mem.{u1, u1} α (Option.{u1} α) (Option.hasMem.{u1} α) a_1 a) -> (p a_1))), Eq.{succ u2} (Option.{u2} β) (Option.join.{u2} β (Option.pmap.{u1, u2} (Option.{u1} α) (Option.{u2} β) (fun (a : Option.{u1} α) => forall (a_1 : α), (Membership.Mem.{u1, u1} α (Option.{u1} α) (Option.hasMem.{u1} α) a_1 a) -> (p a_1)) (Option.pmap.{u1, u2} α β (fun (a : α) => p a) f) x H)) (Option.pmap.{u1, u2} α β (fun (a : α) => p a) f (Option.join.{u1} α x) (fun (a : α) (h : Membership.Mem.{u1, u1} α (Option.{u1} α) (Option.hasMem.{u1} α) a (Option.join.{u1} α x)) => H (Option.some.{u1} α a) (Option.mem_of_mem_join.{u1} α a x h) a (rfl.{succ u1} (Option.{u1} α) (Option.some.{u1} α a))))
-but is expected to have type
- forall {α : Type.{u2}} {β : Type.{u1}} {p : α -> Prop} {f : forall (a : α), (p a) -> β} {x : Option.{u2} (Option.{u2} α)} (H : forall (a : Option.{u2} α), (Membership.mem.{u2, u2} (Option.{u2} α) (Option.{u2} (Option.{u2} α)) (Option.instMembershipOption.{u2} (Option.{u2} α)) a x) -> (forall (a_1 : α), (Membership.mem.{u2, u2} α (Option.{u2} α) (Option.instMembershipOption.{u2} α) a_1 a) -> (p a_1))), Eq.{succ u1} (Option.{u1} β) (Option.join.{u1} β (Option.pmap.{u2, u1} (Option.{u2} α) (Option.{u1} β) (fun (a : Option.{u2} α) => forall (a_1 : α), (Membership.mem.{u2, u2} α (Option.{u2} α) (Option.instMembershipOption.{u2} α) a_1 a) -> (p a_1)) (Option.pmap.{u2, u1} α β (fun (a : α) => p a) f) x H)) (Option.pmap.{u2, u1} α β (fun (a : α) => p a) f (Option.join.{u2} α x) (fun (a : α) (h : Membership.mem.{u2, u2} α (Option.{u2} α) (Option.instMembershipOption.{u2} α) a (Option.join.{u2} α x)) => H (Option.some.{u2} α a) (Option.mem_of_mem_join.{u2} α a x h) a (rfl.{succ u2} (Option.{u2} α) (Option.some.{u2} α a))))
-Case conversion may be inaccurate. Consider using '#align option.join_pmap_eq_pmap_join Option.join_pmap_eq_pmap_joinₓ'. -/
@[simp]
theorem join_pmap_eq_pmap_join {f : ∀ a, p a → β} {x : Option (Option α)} (H) :
(pmap (pmap f) x H).join = pmap f x.join fun a h => H (some a) (mem_of_mem_join h) _ rfl := by
@@ -851,12 +545,6 @@ theorem join_pmap_eq_pmap_join {f : ∀ a, p a → β} {x : Option (Option α)}
end Pmap
-/- warning: option.seq_some -> Option.seq_some is a dubious translation:
-lean 3 declaration is
- forall {α : Type.{u1}} {β : Type.{u1}} {a : α} {f : α -> β}, Eq.{succ u1} (Option.{u1} β) (Seq.seq.{u1, u1} Option.{u1} (Applicative.toHasSeq.{u1, u1} Option.{u1} (Monad.toApplicative.{u1, u1} Option.{u1} Option.monad.{u1})) α β (Option.some.{u1} (α -> β) f) (Option.some.{u1} α a)) (Option.some.{u1} β (f a))
-but is expected to have type
- forall {α : Type.{u1}} {β : Type.{u1}} {a : α} {f : α -> β}, Eq.{succ u1} (Option.{u1} β) (Seq.seq.{u1, u1} Option.{u1} (Applicative.toSeq.{u1, u1} Option.{u1} (Alternative.toApplicative.{u1, u1} Option.{u1} instAlternativeOption.{u1})) α β (Option.some.{u1} (α -> β) f) (fun (x._@.Mathlib.Data.Option.Basic._hyg.2261 : Unit) => Option.some.{u1} α a)) (Option.some.{u1} β (f a))
-Case conversion may be inaccurate. Consider using '#align option.seq_some Option.seq_someₓ'. -/
@[simp]
theorem seq_some {α β} {a : α} {f : α → β} : some f <*> some a = some (f a) :=
rfl
@@ -869,33 +557,15 @@ theorem some_orElse' (a : α) (x : Option α) : (some a).orelse x = some a :=
#align option.some_orelse' Option.some_orElse'
-/
-/- warning: option.some_orelse -> Option.some_orElse is a dubious translation:
-lean 3 declaration is
- forall {α : Type.{u1}} (a : α) (x : Option.{u1} α), Eq.{succ u1} (Option.{u1} α) (HasOrelse.orelse.{u1, u1} Option.{u1} (Alternative.toHasOrelse.{u1, u1} Option.{u1} Option.alternative.{u1}) α (Option.some.{u1} α a) x) (Option.some.{u1} α a)
-but is expected to have type
- forall {α : Type.{u1}} (a : α) (x : Option.{u1} α), Eq.{succ u1} (Option.{u1} α) (HOrElse.hOrElse.{u1, u1, u1} (Option.{u1} α) (Option.{u1} α) (Option.{u1} α) (instHOrElse.{u1} (Option.{u1} α) (Option.instOrElseOption.{u1} α)) (Option.some.{u1} α a) (fun (x._@.Std.Data.Option.Lemmas._hyg.3089 : Unit) => x)) (Option.some.{u1} α a)
-Case conversion may be inaccurate. Consider using '#align option.some_orelse Option.some_orElseₓ'. -/
@[simp]
theorem some_orElse (a : α) (x : Option α) : (some a <|> x) = some a :=
rfl
#align option.some_orelse Option.some_orElse
-/- warning: option.none_orelse' -> Option.none_orElse' is a dubious translation:
-lean 3 declaration is
- forall {α : Type.{u1}} (x : Option.{u1} α), Eq.{succ u1} (Option.{u1} α) (Option.orelse.{u1} α (Option.none.{u1} α) x) x
-but is expected to have type
- forall {α : Type.{u1}} (x : Option.{u1} α), Eq.{succ u1} (Option.{u1} α) (Option.orElse.{u1} α (Option.none.{u1} α) (fun (x._@.Mathlib.Data.Option.Basic._hyg.2315 : Unit) => x)) x
-Case conversion may be inaccurate. Consider using '#align option.none_orelse' Option.none_orElse'ₓ'. -/
@[simp]
theorem none_orElse' (x : Option α) : none.orelse x = x := by cases x <;> rfl
#align option.none_orelse' Option.none_orElse'
-/- warning: option.none_orelse -> Option.none_orElse is a dubious translation:
-lean 3 declaration is
- forall {α : Type.{u1}} (x : Option.{u1} α), Eq.{succ u1} (Option.{u1} α) (HasOrelse.orelse.{u1, u1} Option.{u1} (Alternative.toHasOrelse.{u1, u1} Option.{u1} Option.alternative.{u1}) α (Option.none.{u1} α) x) x
-but is expected to have type
- forall {α : Type.{u1}} (x : Option.{u1} α), Eq.{succ u1} (Option.{u1} α) (HOrElse.hOrElse.{u1, u1, u1} (Option.{u1} α) (Option.{u1} α) (Option.{u1} α) (instHOrElse.{u1} (Option.{u1} α) (Option.instOrElseOption.{u1} α)) (Option.none.{u1} α) (fun (x._@.Std.Data.Option.Lemmas._hyg.3103 : Unit) => x)) x
-Case conversion may be inaccurate. Consider using '#align option.none_orelse Option.none_orElseₓ'. -/
@[simp]
theorem none_orElse (x : Option α) : (none <|> x) = x :=
none_orElse' x
@@ -907,12 +577,6 @@ theorem orElse_none' (x : Option α) : x.orelse none = x := by cases x <;> rfl
#align option.orelse_none' Option.orElse_none'
-/
-/- warning: option.orelse_none -> Option.orElse_none is a dubious translation:
-lean 3 declaration is
- forall {α : Type.{u1}} (x : Option.{u1} α), Eq.{succ u1} (Option.{u1} α) (HasOrelse.orelse.{u1, u1} Option.{u1} (Alternative.toHasOrelse.{u1, u1} Option.{u1} Option.alternative.{u1}) α x (Option.none.{u1} α)) x
-but is expected to have type
- forall {α : Type.{u1}} (x : Option.{u1} α), Eq.{succ u1} (Option.{u1} α) (HOrElse.hOrElse.{u1, u1, u1} (Option.{u1} α) (Option.{u1} α) (Option.{u1} α) (instHOrElse.{u1} (Option.{u1} α) (Option.instOrElseOption.{u1} α)) x (fun (x._@.Std.Data.Option.Lemmas._hyg.3117 : Unit) => Option.none.{u1} α)) x
-Case conversion may be inaccurate. Consider using '#align option.orelse_none Option.orElse_noneₓ'. -/
@[simp]
theorem orElse_none (x : Option α) : (x <|> none) = x :=
orElse_none' x
@@ -1019,24 +683,12 @@ theorem getD_default_eq_iget [Inhabited α] (o : Option α) : o.getD default = o
#align option.get_or_else_default_eq_iget Option.getD_default_eq_iget
-/
-/- warning: option.guard_eq_some -> Option.guard_eq_some is a dubious translation:
-lean 3 declaration is
- forall {α : Type.{u1}} {p : α -> Prop} [_inst_1 : DecidablePred.{succ u1} α p] {a : α} {b : α}, Iff (Eq.{succ u1} (Option.{u1} α) (Option.guard.{u1} α p (fun (a : α) => _inst_1 a) a) (Option.some.{u1} α b)) (And (Eq.{succ u1} α a b) (p a))
-but is expected to have type
- forall {α : Type.{u1}} {p : α -> Prop} {_inst_1 : α} {a : α} [b : DecidablePred.{succ u1} α p], Iff (Eq.{succ u1} (Option.{u1} α) (Option.guard.{u1} α p (fun (a : α) => b a) _inst_1) (Option.some.{u1} α a)) (And (Eq.{succ u1} α _inst_1 a) (p _inst_1))
-Case conversion may be inaccurate. Consider using '#align option.guard_eq_some Option.guard_eq_someₓ'. -/
@[simp]
theorem guard_eq_some {p : α → Prop} [DecidablePred p] {a b : α} :
guard p a = some b ↔ a = b ∧ p a := by
by_cases p a <;> simp [Option.guard, h] <;> intro <;> contradiction
#align option.guard_eq_some Option.guard_eq_some
-/- warning: option.guard_eq_some' -> Option.guard_eq_some' is a dubious translation:
-lean 3 declaration is
- forall {p : Prop} [_inst_1 : Decidable p] (u : Unit), Iff (Eq.{1} (Option.{0} Unit) (guard.{0} Option.{0} Option.alternative.{0} p _inst_1) (Option.some.{0} Unit u)) p
-but is expected to have type
- forall {p : Prop} [_inst_1 : Decidable p] (u : Unit), Iff (Eq.{1} (Option.{0} Unit) (guard.{0} Option.{0} instAlternativeOption.{0} p _inst_1) (Option.some.{0} Unit u)) p
-Case conversion may be inaccurate. Consider using '#align option.guard_eq_some' Option.guard_eq_some'ₓ'. -/
@[simp]
theorem guard_eq_some' {p : Prop} [Decidable p] (u) : guard p = some u ↔ p :=
by
@@ -1103,34 +755,16 @@ theorem casesOn'_coe (x : β) (f : α → β) (a : α) : casesOn' (a : Option α
#align option.cases_on'_coe Option.casesOn'_coe
-/
-/- warning: option.cases_on'_none_coe -> Option.casesOn'_none_coe is a dubious translation:
-lean 3 declaration is
- forall {α : Type.{u1}} {β : Type.{u2}} (f : (Option.{u1} α) -> β) (o : Option.{u1} α), Eq.{succ u2} β (Option.casesOn'.{u1, u2} α β o (f (Option.none.{u1} α)) (Function.comp.{succ u1, succ u1, succ u2} α (Option.{u1} α) β f ((fun (a : Type.{u1}) (b : Type.{u1}) [self : HasLiftT.{succ u1, succ u1} a b] => self.0) α (Option.{u1} α) (HasLiftT.mk.{succ u1, succ u1} α (Option.{u1} α) (CoeTCₓ.coe.{succ u1, succ u1} α (Option.{u1} α) (coeOption.{u1} α)))))) (f o)
-but is expected to have type
- forall {α : Type.{u2}} {β : Type.{u1}} (f : (Option.{u2} α) -> β) (o : Option.{u2} α), Eq.{succ u1} β (Option.casesOn'.{u2, u1} α β o (f (Option.none.{u2} α)) (Function.comp.{succ u2, succ u2, succ u1} α (Option.{u2} α) β f (fun (a : α) => Option.some.{u2} α a))) (f o)
-Case conversion may be inaccurate. Consider using '#align option.cases_on'_none_coe Option.casesOn'_none_coeₓ'. -/
@[simp]
theorem casesOn'_none_coe (f : Option α → β) (o : Option α) : casesOn' o (f none) (f ∘ coe) = f o :=
by cases o <;> rfl
#align option.cases_on'_none_coe Option.casesOn'_none_coe
-/- warning: option.get_or_else_map -> Option.getD_map is a dubious translation:
-lean 3 declaration is
- forall {α : Type.{u1}} {β : Type.{u2}} (f : α -> β) (x : α) (o : Option.{u1} α), Eq.{succ u2} β (Option.getD.{u2} β (Option.map.{u1, u2} α β f o) (f x)) (f (Option.getD.{u1} α o x))
-but is expected to have type
- forall {α : Type.{u2}} {β : Type.{u1}} (f : α -> β) (x : α) (o : Option.{u2} α), Eq.{succ u1} β (Option.getD.{u1} β (Option.map.{u2, u1} α β f o) (f x)) (f (Option.getD.{u2} α o x))
-Case conversion may be inaccurate. Consider using '#align option.get_or_else_map Option.getD_mapₓ'. -/
@[simp]
theorem getD_map (f : α → β) (x : α) (o : Option α) : getD (o.map f) (f x) = f (getD o x) := by
cases o <;> rfl
#align option.get_or_else_map Option.getD_map
-/- warning: option.orelse_eq_some -> Option.orElse_eq_some is a dubious translation:
-lean 3 declaration is
- forall {α : Type.{u1}} (o : Option.{u1} α) (o' : Option.{u1} α) (x : α), Iff (Eq.{succ u1} (Option.{u1} α) (HasOrelse.orelse.{u1, u1} Option.{u1} (Alternative.toHasOrelse.{u1, u1} Option.{u1} Option.alternative.{u1}) α o o') (Option.some.{u1} α x)) (Or (Eq.{succ u1} (Option.{u1} α) o (Option.some.{u1} α x)) (And (Eq.{succ u1} (Option.{u1} α) o (Option.none.{u1} α)) (Eq.{succ u1} (Option.{u1} α) o' (Option.some.{u1} α x))))
-but is expected to have type
- forall {α : Type.{u1}} (o : Option.{u1} α) (o' : Option.{u1} α) (x : α), Iff (Eq.{succ u1} (Option.{u1} α) (HOrElse.hOrElse.{u1, u1, u1} (Option.{u1} α) (Option.{u1} α) (Option.{u1} α) (instHOrElse.{u1} (Option.{u1} α) (Option.instOrElseOption.{u1} α)) o (fun (x._@.Mathlib.Data.Option.Basic._hyg.3245 : Unit) => o')) (Option.some.{u1} α x)) (Or (Eq.{succ u1} (Option.{u1} α) o (Option.some.{u1} α x)) (And (Eq.{succ u1} (Option.{u1} α) o (Option.none.{u1} α)) (Eq.{succ u1} (Option.{u1} α) o' (Option.some.{u1} α x))))
-Case conversion may be inaccurate. Consider using '#align option.orelse_eq_some Option.orElse_eq_someₓ'. -/
theorem orElse_eq_some (o o' : Option α) (x : α) :
(o <|> o') = some x ↔ o = some x ∨ o = none ∧ o' = some x :=
by
@@ -1139,23 +773,11 @@ theorem orElse_eq_some (o o' : Option α) (x : α) :
· simp only [some_orelse, or_false_iff, false_and_iff]
#align option.orelse_eq_some Option.orElse_eq_some
-/- warning: option.orelse_eq_some' -> Option.orElse_eq_some' is a dubious translation:
-lean 3 declaration is
- forall {α : Type.{u1}} (o : Option.{u1} α) (o' : Option.{u1} α) (x : α), Iff (Eq.{succ u1} (Option.{u1} α) (Option.orelse.{u1} α o o') (Option.some.{u1} α x)) (Or (Eq.{succ u1} (Option.{u1} α) o (Option.some.{u1} α x)) (And (Eq.{succ u1} (Option.{u1} α) o (Option.none.{u1} α)) (Eq.{succ u1} (Option.{u1} α) o' (Option.some.{u1} α x))))
-but is expected to have type
- forall {α : Type.{u1}} (o : Option.{u1} α) (o' : Option.{u1} α) (x : α), Iff (Eq.{succ u1} (Option.{u1} α) (Option.orElse.{u1} α o (fun (x._@.Mathlib.Data.Option.Basic._hyg.3306 : Unit) => o')) (Option.some.{u1} α x)) (Or (Eq.{succ u1} (Option.{u1} α) o (Option.some.{u1} α x)) (And (Eq.{succ u1} (Option.{u1} α) o (Option.none.{u1} α)) (Eq.{succ u1} (Option.{u1} α) o' (Option.some.{u1} α x))))
-Case conversion may be inaccurate. Consider using '#align option.orelse_eq_some' Option.orElse_eq_some'ₓ'. -/
theorem orElse_eq_some' (o o' : Option α) (x : α) :
o.orelse o' = some x ↔ o = some x ∨ o = none ∧ o' = some x :=
Option.orElse_eq_some o o' x
#align option.orelse_eq_some' Option.orElse_eq_some'
-/- warning: option.orelse_eq_none -> Option.orElse_eq_none is a dubious translation:
-lean 3 declaration is
- forall {α : Type.{u1}} (o : Option.{u1} α) (o' : Option.{u1} α), Iff (Eq.{succ u1} (Option.{u1} α) (HasOrelse.orelse.{u1, u1} Option.{u1} (Alternative.toHasOrelse.{u1, u1} Option.{u1} Option.alternative.{u1}) α o o') (Option.none.{u1} α)) (And (Eq.{succ u1} (Option.{u1} α) o (Option.none.{u1} α)) (Eq.{succ u1} (Option.{u1} α) o' (Option.none.{u1} α)))
-but is expected to have type
- forall {α : Type.{u1}} (o : Option.{u1} α) (o' : Option.{u1} α), Iff (Eq.{succ u1} (Option.{u1} α) (HOrElse.hOrElse.{u1, u1, u1} (Option.{u1} α) (Option.{u1} α) (Option.{u1} α) (instHOrElse.{u1} (Option.{u1} α) (Option.instOrElseOption.{u1} α)) o (fun (x._@.Mathlib.Data.Option.Basic._hyg.3358 : Unit) => o')) (Option.none.{u1} α)) (And (Eq.{succ u1} (Option.{u1} α) o (Option.none.{u1} α)) (Eq.{succ u1} (Option.{u1} α) o' (Option.none.{u1} α)))
-Case conversion may be inaccurate. Consider using '#align option.orelse_eq_none Option.orElse_eq_noneₓ'. -/
@[simp]
theorem orElse_eq_none (o o' : Option α) : (o <|> o') = none ↔ o = none ∧ o' = none :=
by
@@ -1164,12 +786,6 @@ theorem orElse_eq_none (o o' : Option α) : (o <|> o') = none ↔ o = none ∧ o
· simp only [some_orelse, false_and_iff]
#align option.orelse_eq_none Option.orElse_eq_none
-/- warning: option.orelse_eq_none' -> Option.orElse_eq_none' is a dubious translation:
-lean 3 declaration is
- forall {α : Type.{u1}} (o : Option.{u1} α) (o' : Option.{u1} α), Iff (Eq.{succ u1} (Option.{u1} α) (Option.orelse.{u1} α o o') (Option.none.{u1} α)) (And (Eq.{succ u1} (Option.{u1} α) o (Option.none.{u1} α)) (Eq.{succ u1} (Option.{u1} α) o' (Option.none.{u1} α)))
-but is expected to have type
- forall {α : Type.{u1}} (o : Option.{u1} α) (o' : Option.{u1} α), Iff (Eq.{succ u1} (Option.{u1} α) (Option.orElse.{u1} α o (fun (x._@.Mathlib.Data.Option.Basic._hyg.3408 : Unit) => o')) (Option.none.{u1} α)) (And (Eq.{succ u1} (Option.{u1} α) o (Option.none.{u1} α)) (Eq.{succ u1} (Option.{u1} α) o' (Option.none.{u1} α)))
-Case conversion may be inaccurate. Consider using '#align option.orelse_eq_none' Option.orElse_eq_none'ₓ'. -/
@[simp]
theorem orElse_eq_none' (o o' : Option α) : o.orelse o' = none ↔ o = none ∧ o' = none :=
Option.orElse_eq_none o o'
@@ -1229,12 +845,6 @@ theorem to_list_none (α : Type _) : (none : Option α).toList = [] :=
#align option.to_list_none Option.to_list_none
-/
-/- warning: option.elim_none_some -> Option.elim_none_some is a dubious translation:
-lean 3 declaration is
- forall {α : Type.{u1}} {β : Type.{u2}} (f : (Option.{u1} α) -> β), Eq.{max (succ u1) (succ u2)} ((Option.{u1} α) -> β) (Option.elim'.{u1, u2} α β (f (Option.none.{u1} α)) (Function.comp.{succ u1, succ u1, succ u2} α (Option.{u1} α) β f (Option.some.{u1} α))) f
-but is expected to have type
- forall {α : Type.{u2}} {β : Type.{u1}} (f : (Option.{u2} α) -> β), Eq.{max (succ u2) (succ u1)} ((Option.{u2} α) -> β) (fun (x : Option.{u2} α) => Option.elim.{u2, succ u1} α β x (f (Option.none.{u2} α)) (Function.comp.{succ u2, succ u2, succ u1} α (Option.{u2} α) β f (Option.some.{u2} α))) f
-Case conversion may be inaccurate. Consider using '#align option.elim_none_some Option.elim_none_someₓ'. -/
@[simp]
theorem elim_none_some (f : Option α → β) : Option.elim' (f none) (f ∘ some) = f :=
funext fun o => by cases o <;> rfl
mathlib commit https://github.com/leanprover-community/mathlib/commit/917c3c072e487b3cccdbfeff17e75b40e45f66cb
@@ -573,9 +573,7 @@ but is expected to have type
Case conversion may be inaccurate. Consider using '#align option.map_comp_map Option.map_comp_mapₓ'. -/
@[simp]
theorem map_comp_map (f : α → β) (g : β → γ) : Option.map g ∘ Option.map f = Option.map (g ∘ f) :=
- by
- ext x
- rw [comp_map]
+ by ext x; rw [comp_map]
#align option.map_comp_map Option.map_comp_map
/- warning: option.mem_map_of_mem -> Option.mem_map_of_mem is a dubious translation:
@@ -709,11 +707,8 @@ lean 3 declaration is
but is expected to have type
forall {α : Type.{u2}} {β : Type.{u1}} {p : α -> Prop} (f : forall (a : α), (p a) -> β) (x : Option.{u2} α) {a : α} (h : forall (a : α), (Membership.mem.{u2, u2} α (Option.{u2} α) (Option.instMembershipOption.{u2} α) a x) -> (p a)) (ha : Membership.mem.{u2, u2} α (Option.{u2} α) (Option.instMembershipOption.{u2} α) a x), Membership.mem.{u1, u1} β (Option.{u1} β) (Option.instMembershipOption.{u1} β) (f a (h a ha)) (Option.pmap.{u2, u1} α β (fun (a : α) => p a) f x h)
Case conversion may be inaccurate. Consider using '#align option.mem_pmem Option.mem_pmemₓ'. -/
-theorem mem_pmem {a : α} (h : ∀ a ∈ x, p a) (ha : a ∈ x) : f a (h a ha) ∈ pmap f x h :=
- by
- rw [mem_def] at ha⊢
- subst ha
- rfl
+theorem mem_pmem {a : α} (h : ∀ a ∈ x, p a) (ha : a ∈ x) : f a (h a ha) ∈ pmap f x h := by
+ rw [mem_def] at ha⊢; subst ha; rfl
#align option.mem_pmem Option.mem_pmem
/- warning: option.pmap_map -> Option.pmap_map is a dubious translation:
@@ -1210,8 +1205,7 @@ theorem choice_eq_none (α : Type _) [IsEmpty α] : choice α = none :=
theorem choice_isSome_iff_nonempty {α : Type _} : (choice α).isSome ↔ Nonempty α :=
by
fconstructor
- · intro h
- exact ⟨Option.get h⟩
+ · intro h; exact ⟨Option.get h⟩
· intro h
dsimp only [choice]
rw [dif_pos h]
mathlib commit https://github.com/leanprover-community/mathlib/commit/8d33f09cd7089ecf074b4791907588245aec5d1b
@@ -133,7 +133,7 @@ theorem getD_coe (x y : α) : Option.getD (↑x) y = x :=
#print Option.getD_of_ne_none /-
theorem getD_of_ne_none {x : Option α} (hx : x ≠ none) (y : α) : some (x.getD y) = x := by
- cases x <;> [contradiction, rw [get_or_else_some]]
+ cases x <;> [contradiction;rw [get_or_else_some]]
#align option.get_or_else_of_ne_none Option.getD_of_ne_none
-/
mathlib commit https://github.com/leanprover-community/mathlib/commit/95a87616d63b3cb49d3fe678d416fbe9c4217bf4
@@ -860,7 +860,7 @@ end Pmap
lean 3 declaration is
forall {α : Type.{u1}} {β : Type.{u1}} {a : α} {f : α -> β}, Eq.{succ u1} (Option.{u1} β) (Seq.seq.{u1, u1} Option.{u1} (Applicative.toHasSeq.{u1, u1} Option.{u1} (Monad.toApplicative.{u1, u1} Option.{u1} Option.monad.{u1})) α β (Option.some.{u1} (α -> β) f) (Option.some.{u1} α a)) (Option.some.{u1} β (f a))
but is expected to have type
- forall {α : Type.{u1}} {β : Type.{u1}} {a : α} {f : α -> β}, Eq.{succ u1} (Option.{u1} β) (Seq.seq.{u1, u1} Option.{u1} (Applicative.toSeq.{u1, u1} Option.{u1} (Alternative.toApplicative.{u1, u1} Option.{u1} instAlternativeOption.{u1})) α β (Option.some.{u1} (α -> β) f) (fun (x._@.Mathlib.Data.Option.Basic._hyg.2260 : Unit) => Option.some.{u1} α a)) (Option.some.{u1} β (f a))
+ forall {α : Type.{u1}} {β : Type.{u1}} {a : α} {f : α -> β}, Eq.{succ u1} (Option.{u1} β) (Seq.seq.{u1, u1} Option.{u1} (Applicative.toSeq.{u1, u1} Option.{u1} (Alternative.toApplicative.{u1, u1} Option.{u1} instAlternativeOption.{u1})) α β (Option.some.{u1} (α -> β) f) (fun (x._@.Mathlib.Data.Option.Basic._hyg.2261 : Unit) => Option.some.{u1} α a)) (Option.some.{u1} β (f a))
Case conversion may be inaccurate. Consider using '#align option.seq_some Option.seq_someₓ'. -/
@[simp]
theorem seq_some {α β} {a : α} {f : α → β} : some f <*> some a = some (f a) :=
@@ -889,7 +889,7 @@ theorem some_orElse (a : α) (x : Option α) : (some a <|> x) = some a :=
lean 3 declaration is
forall {α : Type.{u1}} (x : Option.{u1} α), Eq.{succ u1} (Option.{u1} α) (Option.orelse.{u1} α (Option.none.{u1} α) x) x
but is expected to have type
- forall {α : Type.{u1}} (x : Option.{u1} α), Eq.{succ u1} (Option.{u1} α) (Option.orElse.{u1} α (Option.none.{u1} α) (fun (x._@.Mathlib.Data.Option.Basic._hyg.2314 : Unit) => x)) x
+ forall {α : Type.{u1}} (x : Option.{u1} α), Eq.{succ u1} (Option.{u1} α) (Option.orElse.{u1} α (Option.none.{u1} α) (fun (x._@.Mathlib.Data.Option.Basic._hyg.2315 : Unit) => x)) x
Case conversion may be inaccurate. Consider using '#align option.none_orelse' Option.none_orElse'ₓ'. -/
@[simp]
theorem none_orElse' (x : Option α) : none.orelse x = x := by cases x <;> rfl
@@ -1134,7 +1134,7 @@ theorem getD_map (f : α → β) (x : α) (o : Option α) : getD (o.map f) (f x)
lean 3 declaration is
forall {α : Type.{u1}} (o : Option.{u1} α) (o' : Option.{u1} α) (x : α), Iff (Eq.{succ u1} (Option.{u1} α) (HasOrelse.orelse.{u1, u1} Option.{u1} (Alternative.toHasOrelse.{u1, u1} Option.{u1} Option.alternative.{u1}) α o o') (Option.some.{u1} α x)) (Or (Eq.{succ u1} (Option.{u1} α) o (Option.some.{u1} α x)) (And (Eq.{succ u1} (Option.{u1} α) o (Option.none.{u1} α)) (Eq.{succ u1} (Option.{u1} α) o' (Option.some.{u1} α x))))
but is expected to have type
- forall {α : Type.{u1}} (o : Option.{u1} α) (o' : Option.{u1} α) (x : α), Iff (Eq.{succ u1} (Option.{u1} α) (HOrElse.hOrElse.{u1, u1, u1} (Option.{u1} α) (Option.{u1} α) (Option.{u1} α) (instHOrElse.{u1} (Option.{u1} α) (Option.instOrElseOption.{u1} α)) o (fun (x._@.Mathlib.Data.Option.Basic._hyg.3239 : Unit) => o')) (Option.some.{u1} α x)) (Or (Eq.{succ u1} (Option.{u1} α) o (Option.some.{u1} α x)) (And (Eq.{succ u1} (Option.{u1} α) o (Option.none.{u1} α)) (Eq.{succ u1} (Option.{u1} α) o' (Option.some.{u1} α x))))
+ forall {α : Type.{u1}} (o : Option.{u1} α) (o' : Option.{u1} α) (x : α), Iff (Eq.{succ u1} (Option.{u1} α) (HOrElse.hOrElse.{u1, u1, u1} (Option.{u1} α) (Option.{u1} α) (Option.{u1} α) (instHOrElse.{u1} (Option.{u1} α) (Option.instOrElseOption.{u1} α)) o (fun (x._@.Mathlib.Data.Option.Basic._hyg.3245 : Unit) => o')) (Option.some.{u1} α x)) (Or (Eq.{succ u1} (Option.{u1} α) o (Option.some.{u1} α x)) (And (Eq.{succ u1} (Option.{u1} α) o (Option.none.{u1} α)) (Eq.{succ u1} (Option.{u1} α) o' (Option.some.{u1} α x))))
Case conversion may be inaccurate. Consider using '#align option.orelse_eq_some Option.orElse_eq_someₓ'. -/
theorem orElse_eq_some (o o' : Option α) (x : α) :
(o <|> o') = some x ↔ o = some x ∨ o = none ∧ o' = some x :=
@@ -1148,7 +1148,7 @@ theorem orElse_eq_some (o o' : Option α) (x : α) :
lean 3 declaration is
forall {α : Type.{u1}} (o : Option.{u1} α) (o' : Option.{u1} α) (x : α), Iff (Eq.{succ u1} (Option.{u1} α) (Option.orelse.{u1} α o o') (Option.some.{u1} α x)) (Or (Eq.{succ u1} (Option.{u1} α) o (Option.some.{u1} α x)) (And (Eq.{succ u1} (Option.{u1} α) o (Option.none.{u1} α)) (Eq.{succ u1} (Option.{u1} α) o' (Option.some.{u1} α x))))
but is expected to have type
- forall {α : Type.{u1}} (o : Option.{u1} α) (o' : Option.{u1} α) (x : α), Iff (Eq.{succ u1} (Option.{u1} α) (Option.orElse.{u1} α o (fun (x._@.Mathlib.Data.Option.Basic._hyg.3300 : Unit) => o')) (Option.some.{u1} α x)) (Or (Eq.{succ u1} (Option.{u1} α) o (Option.some.{u1} α x)) (And (Eq.{succ u1} (Option.{u1} α) o (Option.none.{u1} α)) (Eq.{succ u1} (Option.{u1} α) o' (Option.some.{u1} α x))))
+ forall {α : Type.{u1}} (o : Option.{u1} α) (o' : Option.{u1} α) (x : α), Iff (Eq.{succ u1} (Option.{u1} α) (Option.orElse.{u1} α o (fun (x._@.Mathlib.Data.Option.Basic._hyg.3306 : Unit) => o')) (Option.some.{u1} α x)) (Or (Eq.{succ u1} (Option.{u1} α) o (Option.some.{u1} α x)) (And (Eq.{succ u1} (Option.{u1} α) o (Option.none.{u1} α)) (Eq.{succ u1} (Option.{u1} α) o' (Option.some.{u1} α x))))
Case conversion may be inaccurate. Consider using '#align option.orelse_eq_some' Option.orElse_eq_some'ₓ'. -/
theorem orElse_eq_some' (o o' : Option α) (x : α) :
o.orelse o' = some x ↔ o = some x ∨ o = none ∧ o' = some x :=
@@ -1159,7 +1159,7 @@ theorem orElse_eq_some' (o o' : Option α) (x : α) :
lean 3 declaration is
forall {α : Type.{u1}} (o : Option.{u1} α) (o' : Option.{u1} α), Iff (Eq.{succ u1} (Option.{u1} α) (HasOrelse.orelse.{u1, u1} Option.{u1} (Alternative.toHasOrelse.{u1, u1} Option.{u1} Option.alternative.{u1}) α o o') (Option.none.{u1} α)) (And (Eq.{succ u1} (Option.{u1} α) o (Option.none.{u1} α)) (Eq.{succ u1} (Option.{u1} α) o' (Option.none.{u1} α)))
but is expected to have type
- forall {α : Type.{u1}} (o : Option.{u1} α) (o' : Option.{u1} α), Iff (Eq.{succ u1} (Option.{u1} α) (HOrElse.hOrElse.{u1, u1, u1} (Option.{u1} α) (Option.{u1} α) (Option.{u1} α) (instHOrElse.{u1} (Option.{u1} α) (Option.instOrElseOption.{u1} α)) o (fun (x._@.Mathlib.Data.Option.Basic._hyg.3352 : Unit) => o')) (Option.none.{u1} α)) (And (Eq.{succ u1} (Option.{u1} α) o (Option.none.{u1} α)) (Eq.{succ u1} (Option.{u1} α) o' (Option.none.{u1} α)))
+ forall {α : Type.{u1}} (o : Option.{u1} α) (o' : Option.{u1} α), Iff (Eq.{succ u1} (Option.{u1} α) (HOrElse.hOrElse.{u1, u1, u1} (Option.{u1} α) (Option.{u1} α) (Option.{u1} α) (instHOrElse.{u1} (Option.{u1} α) (Option.instOrElseOption.{u1} α)) o (fun (x._@.Mathlib.Data.Option.Basic._hyg.3358 : Unit) => o')) (Option.none.{u1} α)) (And (Eq.{succ u1} (Option.{u1} α) o (Option.none.{u1} α)) (Eq.{succ u1} (Option.{u1} α) o' (Option.none.{u1} α)))
Case conversion may be inaccurate. Consider using '#align option.orelse_eq_none Option.orElse_eq_noneₓ'. -/
@[simp]
theorem orElse_eq_none (o o' : Option α) : (o <|> o') = none ↔ o = none ∧ o' = none :=
@@ -1173,7 +1173,7 @@ theorem orElse_eq_none (o o' : Option α) : (o <|> o') = none ↔ o = none ∧ o
lean 3 declaration is
forall {α : Type.{u1}} (o : Option.{u1} α) (o' : Option.{u1} α), Iff (Eq.{succ u1} (Option.{u1} α) (Option.orelse.{u1} α o o') (Option.none.{u1} α)) (And (Eq.{succ u1} (Option.{u1} α) o (Option.none.{u1} α)) (Eq.{succ u1} (Option.{u1} α) o' (Option.none.{u1} α)))
but is expected to have type
- forall {α : Type.{u1}} (o : Option.{u1} α) (o' : Option.{u1} α), Iff (Eq.{succ u1} (Option.{u1} α) (Option.orElse.{u1} α o (fun (x._@.Mathlib.Data.Option.Basic._hyg.3402 : Unit) => o')) (Option.none.{u1} α)) (And (Eq.{succ u1} (Option.{u1} α) o (Option.none.{u1} α)) (Eq.{succ u1} (Option.{u1} α) o' (Option.none.{u1} α)))
+ forall {α : Type.{u1}} (o : Option.{u1} α) (o' : Option.{u1} α), Iff (Eq.{succ u1} (Option.{u1} α) (Option.orElse.{u1} α o (fun (x._@.Mathlib.Data.Option.Basic._hyg.3408 : Unit) => o')) (Option.none.{u1} α)) (And (Eq.{succ u1} (Option.{u1} α) o (Option.none.{u1} α)) (Eq.{succ u1} (Option.{u1} α) o' (Option.none.{u1} α)))
Case conversion may be inaccurate. Consider using '#align option.orelse_eq_none' Option.orElse_eq_none'ₓ'. -/
@[simp]
theorem orElse_eq_none' (o o' : Option α) : o.orelse o' = none ↔ o = none ∧ o' = none :=
mathlib commit https://github.com/leanprover-community/mathlib/commit/730c6d4cab72b9d84fcfb9e95e8796e9cd8f40ba
@@ -1134,7 +1134,7 @@ theorem getD_map (f : α → β) (x : α) (o : Option α) : getD (o.map f) (f x)
lean 3 declaration is
forall {α : Type.{u1}} (o : Option.{u1} α) (o' : Option.{u1} α) (x : α), Iff (Eq.{succ u1} (Option.{u1} α) (HasOrelse.orelse.{u1, u1} Option.{u1} (Alternative.toHasOrelse.{u1, u1} Option.{u1} Option.alternative.{u1}) α o o') (Option.some.{u1} α x)) (Or (Eq.{succ u1} (Option.{u1} α) o (Option.some.{u1} α x)) (And (Eq.{succ u1} (Option.{u1} α) o (Option.none.{u1} α)) (Eq.{succ u1} (Option.{u1} α) o' (Option.some.{u1} α x))))
but is expected to have type
- forall {α : Type.{u1}} (o : Option.{u1} α) (o' : Option.{u1} α) (x : α), Iff (Eq.{succ u1} (Option.{u1} α) (HOrElse.hOrElse.{u1, u1, u1} (Option.{u1} α) (Option.{u1} α) (Option.{u1} α) (instHOrElse.{u1} (Option.{u1} α) (Option.instOrElseOption.{u1} α)) o (fun (x._@.Mathlib.Data.Option.Basic._hyg.3157 : Unit) => o')) (Option.some.{u1} α x)) (Or (Eq.{succ u1} (Option.{u1} α) o (Option.some.{u1} α x)) (And (Eq.{succ u1} (Option.{u1} α) o (Option.none.{u1} α)) (Eq.{succ u1} (Option.{u1} α) o' (Option.some.{u1} α x))))
+ forall {α : Type.{u1}} (o : Option.{u1} α) (o' : Option.{u1} α) (x : α), Iff (Eq.{succ u1} (Option.{u1} α) (HOrElse.hOrElse.{u1, u1, u1} (Option.{u1} α) (Option.{u1} α) (Option.{u1} α) (instHOrElse.{u1} (Option.{u1} α) (Option.instOrElseOption.{u1} α)) o (fun (x._@.Mathlib.Data.Option.Basic._hyg.3239 : Unit) => o')) (Option.some.{u1} α x)) (Or (Eq.{succ u1} (Option.{u1} α) o (Option.some.{u1} α x)) (And (Eq.{succ u1} (Option.{u1} α) o (Option.none.{u1} α)) (Eq.{succ u1} (Option.{u1} α) o' (Option.some.{u1} α x))))
Case conversion may be inaccurate. Consider using '#align option.orelse_eq_some Option.orElse_eq_someₓ'. -/
theorem orElse_eq_some (o o' : Option α) (x : α) :
(o <|> o') = some x ↔ o = some x ∨ o = none ∧ o' = some x :=
@@ -1148,7 +1148,7 @@ theorem orElse_eq_some (o o' : Option α) (x : α) :
lean 3 declaration is
forall {α : Type.{u1}} (o : Option.{u1} α) (o' : Option.{u1} α) (x : α), Iff (Eq.{succ u1} (Option.{u1} α) (Option.orelse.{u1} α o o') (Option.some.{u1} α x)) (Or (Eq.{succ u1} (Option.{u1} α) o (Option.some.{u1} α x)) (And (Eq.{succ u1} (Option.{u1} α) o (Option.none.{u1} α)) (Eq.{succ u1} (Option.{u1} α) o' (Option.some.{u1} α x))))
but is expected to have type
- forall {α : Type.{u1}} (o : Option.{u1} α) (o' : Option.{u1} α) (x : α), Iff (Eq.{succ u1} (Option.{u1} α) (Option.orElse.{u1} α o (fun (x._@.Mathlib.Data.Option.Basic._hyg.3218 : Unit) => o')) (Option.some.{u1} α x)) (Or (Eq.{succ u1} (Option.{u1} α) o (Option.some.{u1} α x)) (And (Eq.{succ u1} (Option.{u1} α) o (Option.none.{u1} α)) (Eq.{succ u1} (Option.{u1} α) o' (Option.some.{u1} α x))))
+ forall {α : Type.{u1}} (o : Option.{u1} α) (o' : Option.{u1} α) (x : α), Iff (Eq.{succ u1} (Option.{u1} α) (Option.orElse.{u1} α o (fun (x._@.Mathlib.Data.Option.Basic._hyg.3300 : Unit) => o')) (Option.some.{u1} α x)) (Or (Eq.{succ u1} (Option.{u1} α) o (Option.some.{u1} α x)) (And (Eq.{succ u1} (Option.{u1} α) o (Option.none.{u1} α)) (Eq.{succ u1} (Option.{u1} α) o' (Option.some.{u1} α x))))
Case conversion may be inaccurate. Consider using '#align option.orelse_eq_some' Option.orElse_eq_some'ₓ'. -/
theorem orElse_eq_some' (o o' : Option α) (x : α) :
o.orelse o' = some x ↔ o = some x ∨ o = none ∧ o' = some x :=
@@ -1159,7 +1159,7 @@ theorem orElse_eq_some' (o o' : Option α) (x : α) :
lean 3 declaration is
forall {α : Type.{u1}} (o : Option.{u1} α) (o' : Option.{u1} α), Iff (Eq.{succ u1} (Option.{u1} α) (HasOrelse.orelse.{u1, u1} Option.{u1} (Alternative.toHasOrelse.{u1, u1} Option.{u1} Option.alternative.{u1}) α o o') (Option.none.{u1} α)) (And (Eq.{succ u1} (Option.{u1} α) o (Option.none.{u1} α)) (Eq.{succ u1} (Option.{u1} α) o' (Option.none.{u1} α)))
but is expected to have type
- forall {α : Type.{u1}} (o : Option.{u1} α) (o' : Option.{u1} α), Iff (Eq.{succ u1} (Option.{u1} α) (HOrElse.hOrElse.{u1, u1, u1} (Option.{u1} α) (Option.{u1} α) (Option.{u1} α) (instHOrElse.{u1} (Option.{u1} α) (Option.instOrElseOption.{u1} α)) o (fun (x._@.Mathlib.Data.Option.Basic._hyg.3270 : Unit) => o')) (Option.none.{u1} α)) (And (Eq.{succ u1} (Option.{u1} α) o (Option.none.{u1} α)) (Eq.{succ u1} (Option.{u1} α) o' (Option.none.{u1} α)))
+ forall {α : Type.{u1}} (o : Option.{u1} α) (o' : Option.{u1} α), Iff (Eq.{succ u1} (Option.{u1} α) (HOrElse.hOrElse.{u1, u1, u1} (Option.{u1} α) (Option.{u1} α) (Option.{u1} α) (instHOrElse.{u1} (Option.{u1} α) (Option.instOrElseOption.{u1} α)) o (fun (x._@.Mathlib.Data.Option.Basic._hyg.3352 : Unit) => o')) (Option.none.{u1} α)) (And (Eq.{succ u1} (Option.{u1} α) o (Option.none.{u1} α)) (Eq.{succ u1} (Option.{u1} α) o' (Option.none.{u1} α)))
Case conversion may be inaccurate. Consider using '#align option.orelse_eq_none Option.orElse_eq_noneₓ'. -/
@[simp]
theorem orElse_eq_none (o o' : Option α) : (o <|> o') = none ↔ o = none ∧ o' = none :=
@@ -1173,7 +1173,7 @@ theorem orElse_eq_none (o o' : Option α) : (o <|> o') = none ↔ o = none ∧ o
lean 3 declaration is
forall {α : Type.{u1}} (o : Option.{u1} α) (o' : Option.{u1} α), Iff (Eq.{succ u1} (Option.{u1} α) (Option.orelse.{u1} α o o') (Option.none.{u1} α)) (And (Eq.{succ u1} (Option.{u1} α) o (Option.none.{u1} α)) (Eq.{succ u1} (Option.{u1} α) o' (Option.none.{u1} α)))
but is expected to have type
- forall {α : Type.{u1}} (o : Option.{u1} α) (o' : Option.{u1} α), Iff (Eq.{succ u1} (Option.{u1} α) (Option.orElse.{u1} α o (fun (x._@.Mathlib.Data.Option.Basic._hyg.3320 : Unit) => o')) (Option.none.{u1} α)) (And (Eq.{succ u1} (Option.{u1} α) o (Option.none.{u1} α)) (Eq.{succ u1} (Option.{u1} α) o' (Option.none.{u1} α)))
+ forall {α : Type.{u1}} (o : Option.{u1} α) (o' : Option.{u1} α), Iff (Eq.{succ u1} (Option.{u1} α) (Option.orElse.{u1} α o (fun (x._@.Mathlib.Data.Option.Basic._hyg.3402 : Unit) => o')) (Option.none.{u1} α)) (And (Eq.{succ u1} (Option.{u1} α) o (Option.none.{u1} α)) (Eq.{succ u1} (Option.{u1} α) o' (Option.none.{u1} α)))
Case conversion may be inaccurate. Consider using '#align option.orelse_eq_none' Option.orElse_eq_none'ₓ'. -/
@[simp]
theorem orElse_eq_none' (o o' : Option α) : o.orelse o' = none ↔ o = none ∧ o' = none :=
mathlib commit https://github.com/leanprover-community/mathlib/commit/3cacc945118c8c637d89950af01da78307f59325
@@ -1134,7 +1134,7 @@ theorem getD_map (f : α → β) (x : α) (o : Option α) : getD (o.map f) (f x)
lean 3 declaration is
forall {α : Type.{u1}} (o : Option.{u1} α) (o' : Option.{u1} α) (x : α), Iff (Eq.{succ u1} (Option.{u1} α) (HasOrelse.orelse.{u1, u1} Option.{u1} (Alternative.toHasOrelse.{u1, u1} Option.{u1} Option.alternative.{u1}) α o o') (Option.some.{u1} α x)) (Or (Eq.{succ u1} (Option.{u1} α) o (Option.some.{u1} α x)) (And (Eq.{succ u1} (Option.{u1} α) o (Option.none.{u1} α)) (Eq.{succ u1} (Option.{u1} α) o' (Option.some.{u1} α x))))
but is expected to have type
- forall {α : Type.{u1}} (o : Option.{u1} α) (o' : Option.{u1} α) (x : α), Iff (Eq.{succ u1} (Option.{u1} α) (HOrElse.hOrElse.{u1, u1, u1} (Option.{u1} α) (Option.{u1} α) (Option.{u1} α) (instHOrElse.{u1} (Option.{u1} α) (Option.instOrElseOption.{u1} α)) o (fun (x._@.Mathlib.Data.Option.Basic._hyg.3038 : Unit) => o')) (Option.some.{u1} α x)) (Or (Eq.{succ u1} (Option.{u1} α) o (Option.some.{u1} α x)) (And (Eq.{succ u1} (Option.{u1} α) o (Option.none.{u1} α)) (Eq.{succ u1} (Option.{u1} α) o' (Option.some.{u1} α x))))
+ forall {α : Type.{u1}} (o : Option.{u1} α) (o' : Option.{u1} α) (x : α), Iff (Eq.{succ u1} (Option.{u1} α) (HOrElse.hOrElse.{u1, u1, u1} (Option.{u1} α) (Option.{u1} α) (Option.{u1} α) (instHOrElse.{u1} (Option.{u1} α) (Option.instOrElseOption.{u1} α)) o (fun (x._@.Mathlib.Data.Option.Basic._hyg.3157 : Unit) => o')) (Option.some.{u1} α x)) (Or (Eq.{succ u1} (Option.{u1} α) o (Option.some.{u1} α x)) (And (Eq.{succ u1} (Option.{u1} α) o (Option.none.{u1} α)) (Eq.{succ u1} (Option.{u1} α) o' (Option.some.{u1} α x))))
Case conversion may be inaccurate. Consider using '#align option.orelse_eq_some Option.orElse_eq_someₓ'. -/
theorem orElse_eq_some (o o' : Option α) (x : α) :
(o <|> o') = some x ↔ o = some x ∨ o = none ∧ o' = some x :=
@@ -1148,7 +1148,7 @@ theorem orElse_eq_some (o o' : Option α) (x : α) :
lean 3 declaration is
forall {α : Type.{u1}} (o : Option.{u1} α) (o' : Option.{u1} α) (x : α), Iff (Eq.{succ u1} (Option.{u1} α) (Option.orelse.{u1} α o o') (Option.some.{u1} α x)) (Or (Eq.{succ u1} (Option.{u1} α) o (Option.some.{u1} α x)) (And (Eq.{succ u1} (Option.{u1} α) o (Option.none.{u1} α)) (Eq.{succ u1} (Option.{u1} α) o' (Option.some.{u1} α x))))
but is expected to have type
- forall {α : Type.{u1}} (o : Option.{u1} α) (o' : Option.{u1} α) (x : α), Iff (Eq.{succ u1} (Option.{u1} α) (Option.orElse.{u1} α o (fun (x._@.Mathlib.Data.Option.Basic._hyg.3099 : Unit) => o')) (Option.some.{u1} α x)) (Or (Eq.{succ u1} (Option.{u1} α) o (Option.some.{u1} α x)) (And (Eq.{succ u1} (Option.{u1} α) o (Option.none.{u1} α)) (Eq.{succ u1} (Option.{u1} α) o' (Option.some.{u1} α x))))
+ forall {α : Type.{u1}} (o : Option.{u1} α) (o' : Option.{u1} α) (x : α), Iff (Eq.{succ u1} (Option.{u1} α) (Option.orElse.{u1} α o (fun (x._@.Mathlib.Data.Option.Basic._hyg.3218 : Unit) => o')) (Option.some.{u1} α x)) (Or (Eq.{succ u1} (Option.{u1} α) o (Option.some.{u1} α x)) (And (Eq.{succ u1} (Option.{u1} α) o (Option.none.{u1} α)) (Eq.{succ u1} (Option.{u1} α) o' (Option.some.{u1} α x))))
Case conversion may be inaccurate. Consider using '#align option.orelse_eq_some' Option.orElse_eq_some'ₓ'. -/
theorem orElse_eq_some' (o o' : Option α) (x : α) :
o.orelse o' = some x ↔ o = some x ∨ o = none ∧ o' = some x :=
@@ -1159,7 +1159,7 @@ theorem orElse_eq_some' (o o' : Option α) (x : α) :
lean 3 declaration is
forall {α : Type.{u1}} (o : Option.{u1} α) (o' : Option.{u1} α), Iff (Eq.{succ u1} (Option.{u1} α) (HasOrelse.orelse.{u1, u1} Option.{u1} (Alternative.toHasOrelse.{u1, u1} Option.{u1} Option.alternative.{u1}) α o o') (Option.none.{u1} α)) (And (Eq.{succ u1} (Option.{u1} α) o (Option.none.{u1} α)) (Eq.{succ u1} (Option.{u1} α) o' (Option.none.{u1} α)))
but is expected to have type
- forall {α : Type.{u1}} (o : Option.{u1} α) (o' : Option.{u1} α), Iff (Eq.{succ u1} (Option.{u1} α) (HOrElse.hOrElse.{u1, u1, u1} (Option.{u1} α) (Option.{u1} α) (Option.{u1} α) (instHOrElse.{u1} (Option.{u1} α) (Option.instOrElseOption.{u1} α)) o (fun (x._@.Mathlib.Data.Option.Basic._hyg.3151 : Unit) => o')) (Option.none.{u1} α)) (And (Eq.{succ u1} (Option.{u1} α) o (Option.none.{u1} α)) (Eq.{succ u1} (Option.{u1} α) o' (Option.none.{u1} α)))
+ forall {α : Type.{u1}} (o : Option.{u1} α) (o' : Option.{u1} α), Iff (Eq.{succ u1} (Option.{u1} α) (HOrElse.hOrElse.{u1, u1, u1} (Option.{u1} α) (Option.{u1} α) (Option.{u1} α) (instHOrElse.{u1} (Option.{u1} α) (Option.instOrElseOption.{u1} α)) o (fun (x._@.Mathlib.Data.Option.Basic._hyg.3270 : Unit) => o')) (Option.none.{u1} α)) (And (Eq.{succ u1} (Option.{u1} α) o (Option.none.{u1} α)) (Eq.{succ u1} (Option.{u1} α) o' (Option.none.{u1} α)))
Case conversion may be inaccurate. Consider using '#align option.orelse_eq_none Option.orElse_eq_noneₓ'. -/
@[simp]
theorem orElse_eq_none (o o' : Option α) : (o <|> o') = none ↔ o = none ∧ o' = none :=
@@ -1173,7 +1173,7 @@ theorem orElse_eq_none (o o' : Option α) : (o <|> o') = none ↔ o = none ∧ o
lean 3 declaration is
forall {α : Type.{u1}} (o : Option.{u1} α) (o' : Option.{u1} α), Iff (Eq.{succ u1} (Option.{u1} α) (Option.orelse.{u1} α o o') (Option.none.{u1} α)) (And (Eq.{succ u1} (Option.{u1} α) o (Option.none.{u1} α)) (Eq.{succ u1} (Option.{u1} α) o' (Option.none.{u1} α)))
but is expected to have type
- forall {α : Type.{u1}} (o : Option.{u1} α) (o' : Option.{u1} α), Iff (Eq.{succ u1} (Option.{u1} α) (Option.orElse.{u1} α o (fun (x._@.Mathlib.Data.Option.Basic._hyg.3201 : Unit) => o')) (Option.none.{u1} α)) (And (Eq.{succ u1} (Option.{u1} α) o (Option.none.{u1} α)) (Eq.{succ u1} (Option.{u1} α) o' (Option.none.{u1} α)))
+ forall {α : Type.{u1}} (o : Option.{u1} α) (o' : Option.{u1} α), Iff (Eq.{succ u1} (Option.{u1} α) (Option.orElse.{u1} α o (fun (x._@.Mathlib.Data.Option.Basic._hyg.3320 : Unit) => o')) (Option.none.{u1} α)) (And (Eq.{succ u1} (Option.{u1} α) o (Option.none.{u1} α)) (Eq.{succ u1} (Option.{u1} α) o' (Option.none.{u1} α)))
Case conversion may be inaccurate. Consider using '#align option.orelse_eq_none' Option.orElse_eq_none'ₓ'. -/
@[simp]
theorem orElse_eq_none' (o o' : Option α) : o.orelse o' = none ↔ o = none ∧ o' = none :=
mathlib commit https://github.com/leanprover-community/mathlib/commit/38f16f960f5006c6c0c2bac7b0aba5273188f4e5
@@ -1134,7 +1134,7 @@ theorem getD_map (f : α → β) (x : α) (o : Option α) : getD (o.map f) (f x)
lean 3 declaration is
forall {α : Type.{u1}} (o : Option.{u1} α) (o' : Option.{u1} α) (x : α), Iff (Eq.{succ u1} (Option.{u1} α) (HasOrelse.orelse.{u1, u1} Option.{u1} (Alternative.toHasOrelse.{u1, u1} Option.{u1} Option.alternative.{u1}) α o o') (Option.some.{u1} α x)) (Or (Eq.{succ u1} (Option.{u1} α) o (Option.some.{u1} α x)) (And (Eq.{succ u1} (Option.{u1} α) o (Option.none.{u1} α)) (Eq.{succ u1} (Option.{u1} α) o' (Option.some.{u1} α x))))
but is expected to have type
- forall {α : Type.{u1}} (o : Option.{u1} α) (o' : Option.{u1} α) (x : α), Iff (Eq.{succ u1} (Option.{u1} α) (HOrElse.hOrElse.{u1, u1, u1} (Option.{u1} α) (Option.{u1} α) (Option.{u1} α) (instHOrElse.{u1} (Option.{u1} α) (Option.instOrElseOption.{u1} α)) o (fun (x._@.Mathlib.Data.Option.Basic._hyg.3040 : Unit) => o')) (Option.some.{u1} α x)) (Or (Eq.{succ u1} (Option.{u1} α) o (Option.some.{u1} α x)) (And (Eq.{succ u1} (Option.{u1} α) o (Option.none.{u1} α)) (Eq.{succ u1} (Option.{u1} α) o' (Option.some.{u1} α x))))
+ forall {α : Type.{u1}} (o : Option.{u1} α) (o' : Option.{u1} α) (x : α), Iff (Eq.{succ u1} (Option.{u1} α) (HOrElse.hOrElse.{u1, u1, u1} (Option.{u1} α) (Option.{u1} α) (Option.{u1} α) (instHOrElse.{u1} (Option.{u1} α) (Option.instOrElseOption.{u1} α)) o (fun (x._@.Mathlib.Data.Option.Basic._hyg.3038 : Unit) => o')) (Option.some.{u1} α x)) (Or (Eq.{succ u1} (Option.{u1} α) o (Option.some.{u1} α x)) (And (Eq.{succ u1} (Option.{u1} α) o (Option.none.{u1} α)) (Eq.{succ u1} (Option.{u1} α) o' (Option.some.{u1} α x))))
Case conversion may be inaccurate. Consider using '#align option.orelse_eq_some Option.orElse_eq_someₓ'. -/
theorem orElse_eq_some (o o' : Option α) (x : α) :
(o <|> o') = some x ↔ o = some x ∨ o = none ∧ o' = some x :=
@@ -1148,7 +1148,7 @@ theorem orElse_eq_some (o o' : Option α) (x : α) :
lean 3 declaration is
forall {α : Type.{u1}} (o : Option.{u1} α) (o' : Option.{u1} α) (x : α), Iff (Eq.{succ u1} (Option.{u1} α) (Option.orelse.{u1} α o o') (Option.some.{u1} α x)) (Or (Eq.{succ u1} (Option.{u1} α) o (Option.some.{u1} α x)) (And (Eq.{succ u1} (Option.{u1} α) o (Option.none.{u1} α)) (Eq.{succ u1} (Option.{u1} α) o' (Option.some.{u1} α x))))
but is expected to have type
- forall {α : Type.{u1}} (o : Option.{u1} α) (o' : Option.{u1} α) (x : α), Iff (Eq.{succ u1} (Option.{u1} α) (Option.orElse.{u1} α o (fun (x._@.Mathlib.Data.Option.Basic._hyg.3101 : Unit) => o')) (Option.some.{u1} α x)) (Or (Eq.{succ u1} (Option.{u1} α) o (Option.some.{u1} α x)) (And (Eq.{succ u1} (Option.{u1} α) o (Option.none.{u1} α)) (Eq.{succ u1} (Option.{u1} α) o' (Option.some.{u1} α x))))
+ forall {α : Type.{u1}} (o : Option.{u1} α) (o' : Option.{u1} α) (x : α), Iff (Eq.{succ u1} (Option.{u1} α) (Option.orElse.{u1} α o (fun (x._@.Mathlib.Data.Option.Basic._hyg.3099 : Unit) => o')) (Option.some.{u1} α x)) (Or (Eq.{succ u1} (Option.{u1} α) o (Option.some.{u1} α x)) (And (Eq.{succ u1} (Option.{u1} α) o (Option.none.{u1} α)) (Eq.{succ u1} (Option.{u1} α) o' (Option.some.{u1} α x))))
Case conversion may be inaccurate. Consider using '#align option.orelse_eq_some' Option.orElse_eq_some'ₓ'. -/
theorem orElse_eq_some' (o o' : Option α) (x : α) :
o.orelse o' = some x ↔ o = some x ∨ o = none ∧ o' = some x :=
@@ -1159,7 +1159,7 @@ theorem orElse_eq_some' (o o' : Option α) (x : α) :
lean 3 declaration is
forall {α : Type.{u1}} (o : Option.{u1} α) (o' : Option.{u1} α), Iff (Eq.{succ u1} (Option.{u1} α) (HasOrelse.orelse.{u1, u1} Option.{u1} (Alternative.toHasOrelse.{u1, u1} Option.{u1} Option.alternative.{u1}) α o o') (Option.none.{u1} α)) (And (Eq.{succ u1} (Option.{u1} α) o (Option.none.{u1} α)) (Eq.{succ u1} (Option.{u1} α) o' (Option.none.{u1} α)))
but is expected to have type
- forall {α : Type.{u1}} (o : Option.{u1} α) (o' : Option.{u1} α), Iff (Eq.{succ u1} (Option.{u1} α) (HOrElse.hOrElse.{u1, u1, u1} (Option.{u1} α) (Option.{u1} α) (Option.{u1} α) (instHOrElse.{u1} (Option.{u1} α) (Option.instOrElseOption.{u1} α)) o (fun (x._@.Mathlib.Data.Option.Basic._hyg.3153 : Unit) => o')) (Option.none.{u1} α)) (And (Eq.{succ u1} (Option.{u1} α) o (Option.none.{u1} α)) (Eq.{succ u1} (Option.{u1} α) o' (Option.none.{u1} α)))
+ forall {α : Type.{u1}} (o : Option.{u1} α) (o' : Option.{u1} α), Iff (Eq.{succ u1} (Option.{u1} α) (HOrElse.hOrElse.{u1, u1, u1} (Option.{u1} α) (Option.{u1} α) (Option.{u1} α) (instHOrElse.{u1} (Option.{u1} α) (Option.instOrElseOption.{u1} α)) o (fun (x._@.Mathlib.Data.Option.Basic._hyg.3151 : Unit) => o')) (Option.none.{u1} α)) (And (Eq.{succ u1} (Option.{u1} α) o (Option.none.{u1} α)) (Eq.{succ u1} (Option.{u1} α) o' (Option.none.{u1} α)))
Case conversion may be inaccurate. Consider using '#align option.orelse_eq_none Option.orElse_eq_noneₓ'. -/
@[simp]
theorem orElse_eq_none (o o' : Option α) : (o <|> o') = none ↔ o = none ∧ o' = none :=
@@ -1173,7 +1173,7 @@ theorem orElse_eq_none (o o' : Option α) : (o <|> o') = none ↔ o = none ∧ o
lean 3 declaration is
forall {α : Type.{u1}} (o : Option.{u1} α) (o' : Option.{u1} α), Iff (Eq.{succ u1} (Option.{u1} α) (Option.orelse.{u1} α o o') (Option.none.{u1} α)) (And (Eq.{succ u1} (Option.{u1} α) o (Option.none.{u1} α)) (Eq.{succ u1} (Option.{u1} α) o' (Option.none.{u1} α)))
but is expected to have type
- forall {α : Type.{u1}} (o : Option.{u1} α) (o' : Option.{u1} α), Iff (Eq.{succ u1} (Option.{u1} α) (Option.orElse.{u1} α o (fun (x._@.Mathlib.Data.Option.Basic._hyg.3203 : Unit) => o')) (Option.none.{u1} α)) (And (Eq.{succ u1} (Option.{u1} α) o (Option.none.{u1} α)) (Eq.{succ u1} (Option.{u1} α) o' (Option.none.{u1} α)))
+ forall {α : Type.{u1}} (o : Option.{u1} α) (o' : Option.{u1} α), Iff (Eq.{succ u1} (Option.{u1} α) (Option.orElse.{u1} α o (fun (x._@.Mathlib.Data.Option.Basic._hyg.3201 : Unit) => o')) (Option.none.{u1} α)) (And (Eq.{succ u1} (Option.{u1} α) o (Option.none.{u1} α)) (Eq.{succ u1} (Option.{u1} α) o' (Option.none.{u1} α)))
Case conversion may be inaccurate. Consider using '#align option.orelse_eq_none' Option.orElse_eq_none'ₓ'. -/
@[simp]
theorem orElse_eq_none' (o o' : Option α) : o.orelse o' = none ↔ o = none ∧ o' = none :=
mathlib commit https://github.com/leanprover-community/mathlib/commit/4c586d291f189eecb9d00581aeb3dd998ac34442
@@ -990,7 +990,7 @@ theorem ne_none_iff_exists' {o : Option α} : o ≠ none ↔ ∃ x : α, o = som
#align option.ne_none_iff_exists' Option.ne_none_iff_exists'
-/
-/- ./././Mathport/Syntax/Translate/Basic.lean:628:2: warning: expanding binder collection (x «expr ≠ » none[option.none]) -/
+/- ./././Mathport/Syntax/Translate/Basic.lean:635:2: warning: expanding binder collection (x «expr ≠ » none[option.none]) -/
#print Option.bex_ne_none /-
theorem bex_ne_none {p : Option α → Prop} : (∃ (x : _)(_ : x ≠ none), p x) ↔ ∃ x, p (some x) :=
⟨fun ⟨x, hx, hp⟩ => ⟨get <| ne_none_iff_isSome.1 hx, by rwa [some_get]⟩, fun ⟨x, hx⟩ =>
@@ -998,7 +998,7 @@ theorem bex_ne_none {p : Option α → Prop} : (∃ (x : _)(_ : x ≠ none), p x
#align option.bex_ne_none Option.bex_ne_none
-/
-/- ./././Mathport/Syntax/Translate/Basic.lean:628:2: warning: expanding binder collection (x «expr ≠ » none[option.none]) -/
+/- ./././Mathport/Syntax/Translate/Basic.lean:635:2: warning: expanding binder collection (x «expr ≠ » none[option.none]) -/
#print Option.ball_ne_none /-
theorem ball_ne_none {p : Option α → Prop} : (∀ (x) (_ : x ≠ none), p x) ↔ ∀ x, p (some x) :=
⟨fun h x => h (some x) (some_ne_none x), fun h x hx => by
mathlib commit https://github.com/leanprover-community/mathlib/commit/bd9851ca476957ea4549eb19b40e7b5ade9428cc
@@ -310,6 +310,15 @@ theorem orElse_none' (x : Option α) : x.orElse (fun _ ↦ none) = x := by cases
#align option.ne_none_iff_is_some Option.ne_none_iff_isSome
+@[simp]
+theorem isSome_map (f : α → β) (o : Option α) : isSome (o.map f) = isSome o := by
+ cases o <;> rfl
+
+@[simp]
+theorem get_map (f : α → β) {o : Option α} (h : isSome (o.map f)) :
+ (o.map f).get h = f (o.get (by rwa [← isSome_map])) := by
+ cases o <;> [simp at h; rfl]
+
theorem iget_mem [Inhabited α] : ∀ {o : Option α}, isSome o → o.iget ∈ o
| some _, _ => rfl
#align option.iget_mem Option.iget_mem
λ
by fun
(#11301)
Per the style guidelines, λ
is disallowed in mathlib.
This is close to exhaustive; I left some tactic code alone when it seemed to me that tactic could be upstreamed soon.
Notes
=>
to ↦
.Mathlib/Order/SupClosed
.λ x,
, which I also replaced.@@ -235,7 +235,7 @@ theorem pbind_eq_some {f : ∀ a : α, a ∈ x → Option β} {y : β} :
intro z h
simp at h
· simp only [pbind]
- refine ⟨λ h => ⟨x, rfl, h⟩, ?_⟩
+ refine ⟨fun h ↦ ⟨x, rfl, h⟩, ?_⟩
rintro ⟨z, H, hz⟩
simp only [mem_def, Option.some_inj] at H
simpa [H] using hz
open Classical
(#11199)
We remove all but one open Classical
s, instead preferring to use open scoped Classical
. The only real side-effect this led to is moving a couple declarations to use Exists.choose
instead of Classical.choose
.
The first few commits are explicitly labelled regex replaces for ease of review.
@@ -403,7 +403,7 @@ theorem orElse_eq_none' (o o' : Option α) : o.orElse (fun _ ↦ o') = none ↔
section
-open Classical
+open scoped Classical
theorem choice_eq_none (α : Type*) [IsEmpty α] : choice α = none :=
dif_neg (not_nonempty_iff_imp_false.mpr isEmptyElim)
Option {b // b ≠ a} ≃ α
(#11095)
Extract from partialFunEquivPointed
the equivalence between any type with a distinguished element and an Option type.
Co-authored-by: @YaelDillies <yael.dillies@gmail.com> Co-authored-by: @fpvandoorn <fpvdoorn@gmail.com>
Co-authored-by: Yaël Dillies <yael.dillies@gmail.com>
@@ -370,7 +370,10 @@ theorem casesOn'_none_coe (f : Option α → β) (o : Option α) :
casesOn' o (f none) (f ∘ (fun a ↦ ↑a)) = f o := by cases o <;> rfl
#align option.cases_on'_none_coe Option.casesOn'_none_coe
--- Porting note: workaround for leanprover/lean4#2049
+lemma casesOn'_eq_elim (b : β) (f : α → β) (a : Option α) :
+ Option.casesOn' a b f = Option.elim a b f := by cases a <;> rfl
+
+-- porting note: workaround for leanprover/lean4#2049
compile_inductive% Option
theorem orElse_eq_some (o o' : Option α) (x : α) :
Homogenises porting notes via capitalisation and addition of whitespace.
It makes the following changes:
@@ -370,7 +370,7 @@ theorem casesOn'_none_coe (f : Option α → β) (o : Option α) :
casesOn' o (f none) (f ∘ (fun a ↦ ↑a)) = f o := by cases o <;> rfl
#align option.cases_on'_none_coe Option.casesOn'_none_coe
--- porting note: workaround for leanprover/lean4#2049
+-- Porting note: workaround for leanprover/lean4#2049
compile_inductive% Option
theorem orElse_eq_some (o o' : Option α) (x : α) :
refine
s (#10762)
I replaced a few "terminal" refine/refine'
s with exact
.
The strategy was very simple-minded: essentially any refine
whose following line had smaller indentation got replaced by exact
and then I cleaned up the mess.
This PR certainly leaves some further terminal refine
s, but maybe the current change is beneficial.
@@ -255,7 +255,7 @@ theorem pmap_eq_some_iff {hf} {y : β} :
· constructor
· intro h
simp only [pmap, Option.some_inj] at h
- refine ⟨x, rfl, h⟩
+ exact ⟨x, rfl, h⟩
· rintro ⟨a, H, rfl⟩
simp only [mem_def, Option.some_inj] at H
simp only [H, pmap]
@@ -103,18 +103,15 @@ theorem bind_eq_some' {x : Option α} {f : α → Option β} {b : β} :
by cases x <;> simp
#align option.bind_eq_some' Option.bind_eq_some'
-theorem bind_eq_none' {o : Option α} {f : α → Option β} :
- o.bind f = none ↔ ∀ b a, a ∈ o → b ∉ f a := by
- simp only [eq_none_iff_forall_not_mem, mem_def, bind_eq_some, not_exists, not_and]
#align option.bind_eq_none' Option.bind_eq_none'
theorem joinM_eq_join : joinM = @join α :=
funext fun _ ↦ rfl
#align option.join_eq_join Option.joinM_eq_join
-theorem bind_eq_bind {α β : Type u} {f : α → Option β} {x : Option α} : x >>= f = x.bind f :=
+theorem bind_eq_bind' {α β : Type u} {f : α → Option β} {x : Option α} : x >>= f = x.bind f :=
rfl
-#align option.bind_eq_bind Option.bind_eq_bind
+#align option.bind_eq_bind Option.bind_eq_bind'
theorem map_coe {α β} {a : α} {f : α → β} : f <$> (a : Option α) = ↑(f a) :=
rfl
@@ -328,7 +325,7 @@ theorem getD_default_eq_iget [Inhabited α] (o : Option α) :
@[simp]
theorem guard_eq_some' {p : Prop} [Decidable p] (u) : _root_.guard p = some u ↔ p := by
cases u
- by_cases h : p <;> simp [_root_.guard, h]; rfl
+ by_cases h : p <;> simp [_root_.guard, h]
#align option.guard_eq_some' Option.guard_eq_some'
theorem liftOrGet_choice {f : α → α → α} (h : ∀ a b, f a b = a ∨ f a b = b) :
This is the supremum of
along with some minor fixes from failures on nightly-testing as Mathlib master
is merged into it.
Note that some PRs for changes that are already compatible with the current toolchain and will be necessary have already been split out: #8380.
I am hopeful that in future we will be able to progressively merge adaptation PRs into a bump/v4.X.0
branch, so we never end up with a "big merge" like this. However one of these adaptation PRs (#8056) predates my new scheme for combined CI, and it wasn't possible to keep that PR viable in the meantime.
In particular this includes adjustments for the Lean PRs
We can get rid of all the
local macro_rules | `($x ^ $y) => `(HPow.hPow $x $y) -- Porting note: See issue [lean4#2220](https://github.com/leanprover/lean4/pull/2220)
macros across Mathlib (and in any projects that want to write natural number powers of reals).
Changes the default behaviour of simp
to (config := {decide := false})
. This makes simp
(and consequentially norm_num
) less powerful, but also more consistent, and less likely to blow up in long failures. This requires a variety of changes: changing some previously by simp
or norm_num
to decide
or rfl
, or adding (config := {decide := true})
.
This changed the behaviour of simp
so that simp [f]
will only unfold "fully applied" occurrences of f
. The old behaviour can be recovered with simp (config := { unfoldPartialApp := true })
. We may in future add a syntax for this, e.g. simp [!f]
; please provide feedback! In the meantime, we have made the following changes:
(config := { unfoldPartialApp := true })
in some places, to recover the old behaviour@[eqns]
to manually adjust the equation lemmas for a particular definition, recovering the old behaviour just for that definition. See #8371, where we do this for Function.comp
and Function.flip
.This change in Lean may require further changes down the line (e.g. adding the !f
syntax, and/or upstreaming the special treatment for Function.comp
and Function.flip
, and/or removing this special treatment). Please keep an open and skeptical mind about these changes!
Co-authored-by: leanprover-community-mathlib4-bot <leanprover-community-mathlib4-bot@users.noreply.github.com> Co-authored-by: Scott Morrison <scott.morrison@gmail.com> Co-authored-by: Eric Wieser <wieser.eric@gmail.com> Co-authored-by: Mauricio Collares <mauricio@collares.org>
@@ -328,7 +328,7 @@ theorem getD_default_eq_iget [Inhabited α] (o : Option α) :
@[simp]
theorem guard_eq_some' {p : Prop} [Decidable p] (u) : _root_.guard p = some u ↔ p := by
cases u
- by_cases h : p <;> simp [_root_.guard, h]
+ by_cases h : p <;> simp [_root_.guard, h]; rfl
#align option.guard_eq_some' Option.guard_eq_some'
theorem liftOrGet_choice {f : α → α → α} (h : ∀ a b, f a b = a ∨ f a b = b) :
Type _
before the colon (#7718)
We have turned to Type*
instead of Type _
, but many of them remained in mathlib because the straight replacement did not work. In general, having Type _
before the colon is a code smell, though, as it hides which types should be in the same universe and which shouldn't, and is not very robust.
This PR replaces most of the remaining Type _
before the colon (except those in category theory) by Type*
or Type u
. This has uncovered a few bugs (where declarations were not as polymorphic as they should be).
I had to increase heartbeats at two places when replacing Type _
by Type*
, but I think it's worth it as it's really more robust.
@@ -33,6 +33,8 @@ along with a term `a : α` if the value is `True`.
-/
+universe u
+
namespace Option
variable {α β γ δ : Type*}
@@ -110,7 +112,7 @@ theorem joinM_eq_join : joinM = @join α :=
funext fun _ ↦ rfl
#align option.join_eq_join Option.joinM_eq_join
-theorem bind_eq_bind {α β : Type _} {f : α → Option β} {x : Option α} : x >>= f = x.bind f :=
+theorem bind_eq_bind {α β : Type u} {f : α → Option β} {x : Option α} : x >>= f = x.bind f :=
rfl
#align option.bind_eq_bind Option.bind_eq_bind
@@ -417,4 +417,14 @@ theorem elim_none_some (f : Option α → β) : (fun x ↦ Option.elim x (f none
funext fun o ↦ by cases o <;> rfl
#align option.elim_none_some Option.elim_none_some
+theorem elim_comp (h : α → β) {f : γ → α} {x : α} {i : Option γ} :
+ (i.elim (h x) fun j => h (f j)) = h (i.elim x f) := by cases i <;> rfl
+
+theorem elim_comp₂ (h : α → β → γ) {f : γ → α} {x : α} {g : γ → β} {y : β}
+ {i : Option γ} : (i.elim (h x y) fun j => h (f j) (g j)) = h (i.elim x f) (i.elim y g) := by
+ cases i <;> rfl
+
+theorem elim_apply {f : γ → α → β} {x : α → β} {i : Option γ} {y : α} :
+ i.elim x f y = i.elim (x y) fun j => f j y := by rw [elim_comp fun f : α → β => f y]
+
end Option
@@ -141,7 +141,7 @@ theorem map_eq_id {f : α → α} : Option.map f = id ↔ f = id :=
#align option.map_eq_id Option.map_eq_id
theorem map_comm {f₁ : α → β} {f₂ : α → γ} {g₁ : β → δ} {g₂ : γ → δ} (h : g₁ ∘ f₁ = g₂ ∘ f₂)
- (a : α) :
+ (a : α) :
(Option.map f₁ a).map g₁ = (Option.map f₂ a).map g₂ := by rw [map_map, h, ← map_map]
#align option.map_comm Option.map_comm
I know that this is contrary to what we've done previously, but:
norm_num
/ ring
/ linarith
)(Oh
Co-authored-by: Scott Morrison <scott.morrison@gmail.com>
@@ -7,8 +7,8 @@ import Mathlib.Init.Control.Combinators
import Mathlib.Data.Option.Defs
import Mathlib.Logic.IsEmpty
import Mathlib.Logic.Relator
-import Mathlib.Tactic.Common
import Mathlib.Util.CompileInductive
+import Aesop
#align_import data.option.basic from "leanprover-community/mathlib"@"f340f229b1f461aa1c8ee11e0a172d0a3b301a4a"
@@ -8,6 +8,7 @@ import Mathlib.Data.Option.Defs
import Mathlib.Logic.IsEmpty
import Mathlib.Logic.Relator
import Mathlib.Tactic.Common
+import Mathlib.Util.CompileInductive
#align_import data.option.basic from "leanprover-community/mathlib"@"f340f229b1f461aa1c8ee11e0a172d0a3b301a4a"
The mem_map
lemmas were inconsistently either not simp
lemmas at all, simp
lemmas, or simp
lemmas with a lowered priority.
This PR makes them uniformly low priority simp lemmas, and adds a few simp attributes to "better" simp lemmas instead. (However these lemmas are themselves quite inconsistent across different algebraic structures, and I haven't attempted to add missing ones.)
Co-authored-by: Scott Morrison <scott.morrison@gmail.com>
@@ -43,6 +43,14 @@ theorem coe_def : (fun a ↦ ↑a : α → Option α) = some :=
theorem mem_map {f : α → β} {y : β} {o : Option α} : y ∈ o.map f ↔ ∃ x ∈ o, f x = y := by simp
#align option.mem_map Option.mem_map
+-- The simpNF linter says that the LHS can be simplified via `Option.mem_def`.
+-- However this is a higher priority lemma.
+-- https://github.com/leanprover/std4/issues/207
+@[simp 1100, nolint simpNF]
+theorem mem_map_of_injective {f : α → β} (H : Function.Injective f) {a : α} {o : Option α} :
+ f a ∈ o.map f ↔ a ∈ o := by
+ aesop
+
theorem forall_mem_map {f : α → β} {o : Option α} {p : β → Prop} :
(∀ y ∈ o.map f, p y) ↔ ∀ x ∈ o, p (f x) := by simp
#align option.forall_mem_map Option.forall_mem_map
Type _
and Sort _
(#6499)
We remove all possible occurences of Type _
and Sort _
in favor of Type*
and Sort*
.
This has nice performance benefits.
@@ -34,7 +34,7 @@ along with a term `a : α` if the value is `True`.
namespace Option
-variable {α β γ δ : Type _}
+variable {α β γ δ : Type*}
theorem coe_def : (fun a ↦ ↑a : α → Option α) = some :=
rfl
@@ -63,7 +63,7 @@ theorem Mem.leftUnique : Relator.LeftUnique ((· ∈ ·) : α → Option α →
fun _ _ _=> mem_unique
#align option.mem.left_unique Option.Mem.leftUnique
-theorem some_injective (α : Type _) : Function.Injective (@some α) := fun _ _ ↦ some_inj.mp
+theorem some_injective (α : Type*) : Function.Injective (@some α) := fun _ _ ↦ some_inj.mp
#align option.some_injective Option.some_injective
/-- `Option.map f` is injective if `f` is injective. -/
@@ -394,7 +394,7 @@ section
open Classical
-theorem choice_eq_none (α : Type _) [IsEmpty α] : choice α = none :=
+theorem choice_eq_none (α : Type*) [IsEmpty α] : choice α = none :=
dif_neg (not_nonempty_iff_imp_false.mpr isEmptyElim)
#align option.choice_eq_none Option.choice_eq_none
align
s (#6049)
The lemmas were lost while porting. Also drop Option.getD_coe
since it is the same as Option.getD_some
.
@@ -40,12 +40,16 @@ theorem coe_def : (fun a ↦ ↑a : α → Option α) = some :=
rfl
#align option.coe_def Option.coe_def
-#align option.get_or_else Option.getD
+theorem mem_map {f : α → β} {y : β} {o : Option α} : y ∈ o.map f ↔ ∃ x ∈ o, f x = y := by simp
+#align option.mem_map Option.mem_map
-@[simp]
-theorem getD_coe (x y : α) : Option.getD (↑x) y = x :=
- rfl
-#align option.get_or_else_coe Option.getD_coe
+theorem forall_mem_map {f : α → β} {o : Option α} {p : β → Prop} :
+ (∀ y ∈ o.map f, p y) ↔ ∀ x ∈ o, p (f x) := by simp
+#align option.forall_mem_map Option.forall_mem_map
+
+theorem exists_mem_map {f : α → β} {o : Option α} {p : β → Prop} :
+ (∃ y ∈ o.map f, p y) ↔ ∃ x ∈ o, p (f x) := by simp
+#align option.exists_mem_map Option.exists_mem_map
theorem coe_get {o : Option α} (h : o.isSome) : ((Option.get _ h : α) : Option α) = o :=
Option.some_get h
@@ -2,11 +2,6 @@
Copyright (c) 2017 Mario Carneiro. All rights reserved.
Released under Apache 2.0 license as described in the file LICENSE.
Authors: Mario Carneiro
-
-! This file was ported from Lean 3 source module data.option.basic
-! leanprover-community/mathlib commit f340f229b1f461aa1c8ee11e0a172d0a3b301a4a
-! Please do not edit these lines, except to modify the commit id
-! if you have ported upstream changes.
-/
import Mathlib.Init.Control.Combinators
import Mathlib.Data.Option.Defs
@@ -14,6 +9,8 @@ import Mathlib.Logic.IsEmpty
import Mathlib.Logic.Relator
import Mathlib.Tactic.Common
+#align_import data.option.basic from "leanprover-community/mathlib"@"f340f229b1f461aa1c8ee11e0a172d0a3b301a4a"
+
/-!
# Option of a type
@@ -59,7 +59,7 @@ theorem eq_of_mem_of_mem {a : α} {o1 o2 : Option α} (h1 : a ∈ o1) (h2 : a
#align option.eq_of_mem_of_mem Option.eq_of_mem_of_mem
theorem Mem.leftUnique : Relator.LeftUnique ((· ∈ ·) : α → Option α → Prop) :=
-fun _ _ _=> mem_unique
+ fun _ _ _=> mem_unique
#align option.mem.left_unique Option.Mem.leftUnique
theorem some_injective (α : Type _) : Function.Injective (@some α) := fun _ _ ↦ some_inj.mp
compile_inductive%
and compile_def%
commands (#4097)
Add a #compile inductive
command to compile the recursors of an inductive type, which works by creating a recursive definition and using @[csimp]
.
Co-authored-by: Parth Shastri <31370288+cppio@users.noreply.github.com> Co-authored-by: Mario Carneiro <di.gama@gmail.com>
@@ -362,34 +362,7 @@ theorem casesOn'_none_coe (f : Option α → β) (o : Option α) :
#align option.cases_on'_none_coe Option.casesOn'_none_coe
-- porting note: workaround for leanprover/lean4#2049
-section recursor_workarounds
-
-/-- A computable version of `Option.rec`. Workaround until Lean has native support for this. -/
-def recC.{u_1, u} {α : Type u} {motive : Option α → Sort u_1} (none : motive none)
- (some : (val : α) → motive (some val)) :
- (t : Option α) → motive t
-| Option.none => none
-| Option.some a => some a
-
-@[csimp]
-lemma rec_eq_recC : @Option.rec = @Option.recC := by
- ext α motive none some o
- induction o with
- | none => rfl
- | some a =>
- rw [Option.recC]
-
-/-- A computable version of `Option.recOn`. Workaround until Lean has native support for this. -/
-def recOnC.{u_1, u} {α : Type u} {motive : Option α → Sort u_1}
- (t : Option α) (none : motive none) (some : (val : α) → motive (some val)) : motive t :=
- Option.recC none some t
-
-@[csimp]
-lemma recOn_eq_recOnC : @Option.recOn = @Option.recOnC := by
- ext α motive o none some
- rw [Option.recOn, rec_eq_recC, Option.recOnC]
-
-end recursor_workarounds
+compile_inductive% Option
theorem orElse_eq_some (o o' : Option α) (x : α) :
(o <|> o') = some x ↔ o = some x ∨ o = none ∧ o' = some x := by
fix-comments.py
on all files.@@ -333,7 +333,7 @@ theorem liftOrGet_choice {f : α → α → α} (h : ∀ a b, f a b = a ∨ f a
#align option.lift_or_get_some_some Option.liftOrGet_some_some
-/-- Given an element of `a : option α`, a default element `b : β` and a function `α → β`, apply this
+/-- Given an element of `a : Option α`, a default element `b : β` and a function `α → β`, apply this
function to `a` if it comes from `α`, and return `b` otherwise. -/
def casesOn' : Option α → β → (α → β) → β
| none, n, _ => n
This makes a mathlib4 version of mathlib3's tactic.basic
, now called Mathlib.Tactic.Common
, which imports all tactics which do not have significant theory requirements, and then is imported all across the base of the hierarchy.
This ensures that all common tactics are available nearly everywhere in the library, rather than having to be imported one-by-one as you need them.
Co-authored-by: Scott Morrison <scott.morrison@gmail.com>
@@ -12,7 +12,7 @@ import Mathlib.Init.Control.Combinators
import Mathlib.Data.Option.Defs
import Mathlib.Logic.IsEmpty
import Mathlib.Logic.Relator
-import Mathlib.Mathport.Rename
+import Mathlib.Tactic.Common
/-!
# Option of a type
@@ -12,7 +12,7 @@ import Mathlib.Init.Control.Combinators
import Mathlib.Data.Option.Defs
import Mathlib.Logic.IsEmpty
import Mathlib.Logic.Relator
-import Mathlib.Tactic.Common
+import Mathlib.Mathport.Rename
/-!
# Option of a type
@@ -12,7 +12,7 @@ import Mathlib.Init.Control.Combinators
import Mathlib.Data.Option.Defs
import Mathlib.Logic.IsEmpty
import Mathlib.Logic.Relator
-import Mathlib.Mathport.Rename
+import Mathlib.Tactic.Common
/-!
# Option of a type
This PR fixes two things:
align
statements for definitions and theorems and instances that are separated by two newlines from the relevant declaration (s/\n\n#align/\n#align
). This is often seen in the mathport output after ending calc
blocks.#align
statements. (This was needed for a script I wrote for #3630.)@@ -281,7 +281,6 @@ theorem none_orElse' (x : Option α) : none.orElse (fun _ ↦ x) = x := by cases
@[simp]
theorem orElse_none' (x : Option α) : x.orElse (fun _ ↦ none) = x := by cases x <;> rfl
-
#align option.orelse_none' Option.orElse_none'
#align option.orelse_none Option.orElse_none
@@ -379,7 +379,17 @@ lemma rec_eq_recC : @Option.rec = @Option.recC := by
| none => rfl
| some a =>
rw [Option.recC]
-
+
+/-- A computable version of `Option.recOn`. Workaround until Lean has native support for this. -/
+def recOnC.{u_1, u} {α : Type u} {motive : Option α → Sort u_1}
+ (t : Option α) (none : motive none) (some : (val : α) → motive (some val)) : motive t :=
+ Option.recC none some t
+
+@[csimp]
+lemma recOn_eq_recOnC : @Option.recOn = @Option.recOnC := by
+ ext α motive o none some
+ rw [Option.recOn, rec_eq_recC, Option.recOnC]
+
end recursor_workarounds
theorem orElse_eq_some (o o' : Option α) (x : α) :
@@ -362,6 +362,26 @@ theorem casesOn'_none_coe (f : Option α → β) (o : Option α) :
casesOn' o (f none) (f ∘ (fun a ↦ ↑a)) = f o := by cases o <;> rfl
#align option.cases_on'_none_coe Option.casesOn'_none_coe
+-- porting note: workaround for leanprover/lean4#2049
+section recursor_workarounds
+
+/-- A computable version of `Option.rec`. Workaround until Lean has native support for this. -/
+def recC.{u_1, u} {α : Type u} {motive : Option α → Sort u_1} (none : motive none)
+ (some : (val : α) → motive (some val)) :
+ (t : Option α) → motive t
+| Option.none => none
+| Option.some a => some a
+
+@[csimp]
+lemma rec_eq_recC : @Option.rec = @Option.recC := by
+ ext α motive none some o
+ induction o with
+ | none => rfl
+ | some a =>
+ rw [Option.recC]
+
+end recursor_workarounds
+
theorem orElse_eq_some (o o' : Option α) (x : α) :
(o <|> o') = some x ↔ o = some x ∨ o = none ∧ o' = some x := by
cases o
@@ -317,7 +317,7 @@ theorem getD_default_eq_iget [Inhabited α] (o : Option α) :
@[simp]
theorem guard_eq_some' {p : Prop} [Decidable p] (u) : _root_.guard p = some u ↔ p := by
cases u
- by_cases p <;> simp [_root_.guard, h]
+ by_cases h : p <;> simp [_root_.guard, h]
#align option.guard_eq_some' Option.guard_eq_some'
theorem liftOrGet_choice {f : α → α → α} (h : ∀ a b, f a b = a ∨ f a b = b) :
@@ -104,11 +104,6 @@ theorem bind_eq_bind {α β : Type _} {f : α → Option β} {x : Option α} : x
rfl
#align option.bind_eq_bind Option.bind_eq_bind
---Porting note: New lemma used to prove a theorem in Data.List.Basic
-theorem map_eq_bind (f : α → β) (o : Option α) :
- Option.map f o = Option.bind o (some ∘ f) := by
- cases o <;> rfl
-
theorem map_coe {α β} {a : α} {f : α → β} : f <$> (a : Option α) = ↑(f a) :=
rfl
#align option.map_coe Option.map_coe
This PR is the result of a slight variant on the following "algorithm"
_
and make all uppercase letters into lowercase_
and make all uppercase letters into lowercase(original_lean3_name, OriginalLean4Name)
#align
statement just before the next empty line#align
statement to have been inserted too early)@@ -41,6 +41,7 @@ variable {α β γ δ : Type _}
theorem coe_def : (fun a ↦ ↑a : α → Option α) = some :=
rfl
+#align option.coe_def Option.coe_def
#align option.get_or_else Option.getD
@@ -51,40 +52,49 @@ theorem getD_coe (x y : α) : Option.getD (↑x) y = x :=
theorem coe_get {o : Option α} (h : o.isSome) : ((Option.get _ h : α) : Option α) = o :=
Option.some_get h
+#align option.coe_get Option.coe_get
theorem eq_of_mem_of_mem {a : α} {o1 o2 : Option α} (h1 : a ∈ o1) (h2 : a ∈ o2) : o1 = o2 :=
h1.trans h2.symm
+#align option.eq_of_mem_of_mem Option.eq_of_mem_of_mem
theorem Mem.leftUnique : Relator.LeftUnique ((· ∈ ·) : α → Option α → Prop) :=
fun _ _ _=> mem_unique
#align option.mem.left_unique Option.Mem.leftUnique
theorem some_injective (α : Type _) : Function.Injective (@some α) := fun _ _ ↦ some_inj.mp
+#align option.some_injective Option.some_injective
/-- `Option.map f` is injective if `f` is injective. -/
theorem map_injective {f : α → β} (Hf : Function.Injective f) : Function.Injective (Option.map f)
| none, none, _ => rfl
| some a₁, some a₂, H => by rw [Hf (Option.some.inj H)]
+#align option.map_injective Option.map_injective
@[simp]
theorem map_comp_some (f : α → β) : Option.map f ∘ some = some ∘ f :=
rfl
+#align option.map_comp_some Option.map_comp_some
@[simp]
theorem none_bind' (f : α → Option β) : none.bind f = none :=
rfl
+#align option.none_bind' Option.none_bind'
@[simp]
theorem some_bind' (a : α) (f : α → Option β) : (some a).bind f = f a :=
rfl
+#align option.some_bind' Option.some_bind'
theorem bind_eq_some' {x : Option α} {f : α → Option β} {b : β} :
x.bind f = some b ↔ ∃ a, x = some a ∧ f a = some b :=
by cases x <;> simp
+#align option.bind_eq_some' Option.bind_eq_some'
theorem bind_eq_none' {o : Option α} {f : α → Option β} :
o.bind f = none ↔ ∀ b a, a ∈ o → b ∉ f a := by
simp only [eq_none_iff_forall_not_mem, mem_def, bind_eq_some, not_exists, not_and]
+#align option.bind_eq_none' Option.bind_eq_none'
theorem joinM_eq_join : joinM = @join α :=
funext fun _ ↦ rfl
@@ -92,6 +102,7 @@ theorem joinM_eq_join : joinM = @join α :=
theorem bind_eq_bind {α β : Type _} {f : α → Option β} {x : Option α} : x >>= f = x.bind f :=
rfl
+#align option.bind_eq_bind Option.bind_eq_bind
--Porting note: New lemma used to prove a theorem in Data.List.Basic
theorem map_eq_bind (f : α → β) (o : Option α) :
@@ -100,28 +111,34 @@ theorem map_eq_bind (f : α → β) (o : Option α) :
theorem map_coe {α β} {a : α} {f : α → β} : f <$> (a : Option α) = ↑(f a) :=
rfl
+#align option.map_coe Option.map_coe
@[simp]
theorem map_coe' {a : α} {f : α → β} : Option.map f (a : Option α) = ↑(f a) :=
rfl
+#align option.map_coe' Option.map_coe'
/-- `Option.map` as a function between functions is injective. -/
theorem map_injective' : Function.Injective (@Option.map α β) := fun f g h ↦
funext fun x ↦ some_injective _ <| by simp only [← map_some', h]
+#align option.map_injective' Option.map_injective'
@[simp]
theorem map_inj {f g : α → β} : Option.map f = Option.map g ↔ f = g :=
map_injective'.eq_iff
+#align option.map_inj Option.map_inj
attribute [simp] map_id
@[simp]
theorem map_eq_id {f : α → α} : Option.map f = id ↔ f = id :=
map_injective'.eq_iff' map_id
+#align option.map_eq_id Option.map_eq_id
theorem map_comm {f₁ : α → β} {f₂ : α → γ} {g₁ : β → δ} {g₂ : γ → δ} (h : g₁ ∘ f₁ = g₂ ∘ f₂)
(a : α) :
(Option.map f₁ a).map g₁ = (Option.map f₂ a).map g₂ := by rw [map_map, h, ← map_map]
+#align option.map_comm Option.map_comm
section pmap
@@ -131,57 +148,70 @@ variable {p : α → Prop} (f : ∀ a : α, p a → β) (x : Option α)
-- @[simp]
theorem pbind_eq_bind (f : α → Option β) (x : Option α) : (x.pbind fun a _ ↦ f a) = x.bind f := by
cases x <;> simp only [pbind, none_bind', some_bind']
+#align option.pbind_eq_bind Option.pbind_eq_bind
theorem map_bind {α β γ} (f : β → γ) (x : Option α) (g : α → Option β) :
Option.map f (x >>= g) = x >>= fun a ↦ Option.map f (g a) := by
simp only [← map_eq_map, ← bind_pure_comp, LawfulMonad.bind_assoc]
+#align option.map_bind Option.map_bind
theorem map_bind' (f : β → γ) (x : Option α) (g : α → Option β) :
Option.map f (x.bind g) = x.bind fun a ↦ Option.map f (g a) := by cases x <;> simp
+#align option.map_bind' Option.map_bind'
theorem map_pbind (f : β → γ) (x : Option α) (g : ∀ a, a ∈ x → Option β) :
Option.map f (x.pbind g) = x.pbind fun a H ↦ Option.map f (g a H) := by
cases x <;> simp only [pbind, map_none']
+#align option.map_pbind Option.map_pbind
theorem pbind_map (f : α → β) (x : Option α) (g : ∀ b : β, b ∈ x.map f → Option γ) :
pbind (Option.map f x) g = x.pbind fun a h ↦ g (f a) (mem_map_of_mem _ h) := by cases x <;> rfl
+#align option.pbind_map Option.pbind_map
@[simp]
theorem pmap_none (f : ∀ a : α, p a → β) {H} : pmap f (@none α) H = none :=
rfl
+#align option.pmap_none Option.pmap_none
@[simp]
theorem pmap_some (f : ∀ a : α, p a → β) {x : α} (h : p x) :
pmap f (some x) = fun _ ↦ some (f x h) :=
rfl
+#align option.pmap_some Option.pmap_some
theorem mem_pmem {a : α} (h : ∀ a ∈ x, p a) (ha : a ∈ x) : f a (h a ha) ∈ pmap f x h := by
rw [mem_def] at ha ⊢
subst ha
rfl
+#align option.mem_pmem Option.mem_pmem
theorem pmap_map (g : γ → α) (x : Option γ) (H) :
pmap f (x.map g) H = pmap (fun a h ↦ f (g a) h) x fun a h ↦ H _ (mem_map_of_mem _ h) := by
cases x <;> simp only [map_none', map_some', pmap]
+#align option.pmap_map Option.pmap_map
theorem map_pmap (g : β → γ) (f : ∀ a, p a → β) (x H) :
Option.map g (pmap f x H) = pmap (fun a h ↦ g (f a h)) x H :=
by cases x <;> simp only [map_none', map_some', pmap]
+#align option.map_pmap Option.map_pmap
-- Porting note: Can't simp tag this anymore because `pmap` simplifies
-- @[simp]
theorem pmap_eq_map (p : α → Prop) (f : α → β) (x H) :
@pmap _ _ p (fun a _ ↦ f a) x H = Option.map f x := by
cases x <;> simp only [map_none', map_some', pmap]
+#align option.pmap_eq_map Option.pmap_eq_map
theorem pmap_bind {α β γ} {x : Option α} {g : α → Option β} {p : β → Prop} {f : ∀ b, p b → γ} (H)
(H' : ∀ (a : α), ∀ b ∈ g a, b ∈ x >>= g) :
pmap f (x >>= g) H = x >>= fun a ↦ pmap f (g a) fun b h ↦ H _ (H' a _ h) := by
cases x <;> simp only [pmap, bind_eq_bind, none_bind, some_bind]
+#align option.pmap_bind Option.pmap_bind
theorem bind_pmap {α β γ} {p : α → Prop} (f : ∀ a, p a → β) (x : Option α) (g : β → Option γ) (H) :
pmap f x H >>= g = x.pbind fun a h ↦ g (f a (H _ h)) := by
cases x <;> simp only [pmap, bind_eq_bind, none_bind, some_bind, pbind]
+#align option.bind_pmap Option.bind_pmap
variable {f x}
@@ -192,6 +222,7 @@ theorem pbind_eq_none {f : ∀ a : α, a ∈ x → Option β}
· simp only [pbind, iff_false]
intro h
cases h' _ rfl h
+#align option.pbind_eq_none Option.pbind_eq_none
theorem pbind_eq_some {f : ∀ a : α, a ∈ x → Option β} {y : β} :
x.pbind f = some y ↔ ∃ (z : α) (H : z ∈ x), f z H = some y := by
@@ -204,10 +235,12 @@ theorem pbind_eq_some {f : ∀ a : α, a ∈ x → Option β} {y : β} :
rintro ⟨z, H, hz⟩
simp only [mem_def, Option.some_inj] at H
simpa [H] using hz
+#align option.pbind_eq_some Option.pbind_eq_some
-- Porting note: Can't simp tag this anymore because `pmap` simplifies
-- @[simp]
theorem pmap_eq_none_iff {h} : pmap f x h = none ↔ x = none := by cases x <;> simp
+#align option.pmap_eq_none_iff Option.pmap_eq_none_iff
-- Porting note: Can't simp tag this anymore because `pmap` simplifies
-- @[simp]
@@ -222,18 +255,21 @@ theorem pmap_eq_some_iff {hf} {y : β} :
· rintro ⟨a, H, rfl⟩
simp only [mem_def, Option.some_inj] at H
simp only [H, pmap]
+#align option.pmap_eq_some_iff Option.pmap_eq_some_iff
-- Porting note: Can't simp tag this anymore because `join` and `pmap` simplify
-- @[simp]
theorem join_pmap_eq_pmap_join {f : ∀ a, p a → β} {x : Option (Option α)} (H) :
(pmap (pmap f) x H).join = pmap f x.join fun a h ↦ H (some a) (mem_of_mem_join h) _ rfl := by
rcases x with (_ | _ | x) <;> simp
+#align option.join_pmap_eq_pmap_join Option.join_pmap_eq_pmap_join
end pmap
@[simp]
theorem seq_some {α β} {a : α} {f : α → β} : some f <*> some a = some (f a) :=
rfl
+#align option.seq_some Option.seq_some
@[simp]
theorem some_orElse' (a : α) (x : Option α) : (some a).orElse (fun _ ↦ x) = some a :=
@@ -273,9 +309,11 @@ theorem orElse_none' (x : Option α) : x.orElse (fun _ ↦ none) = x := by cases
theorem iget_mem [Inhabited α] : ∀ {o : Option α}, isSome o → o.iget ∈ o
| some _, _ => rfl
+#align option.iget_mem Option.iget_mem
theorem iget_of_mem [Inhabited α] {a : α} : ∀ {o : Option α}, a ∈ o → o.iget = a
| _, rfl => rfl
+#align option.iget_of_mem Option.iget_of_mem
theorem getD_default_eq_iget [Inhabited α] (o : Option α) :
o.getD default = o.iget := by cases o <;> rfl
@@ -285,6 +323,7 @@ theorem getD_default_eq_iget [Inhabited α] (o : Option α) :
theorem guard_eq_some' {p : Prop} [Decidable p] (u) : _root_.guard p = some u ↔ p := by
cases u
by_cases p <;> simp [_root_.guard, h]
+#align option.guard_eq_some' Option.guard_eq_some'
theorem liftOrGet_choice {f : α → α → α} (h : ∀ a b, f a b = a ∨ f a b = b) :
∀ o₁ o₂, liftOrGet f o₁ o₂ = o₁ ∨ liftOrGet f o₁ o₂ = o₂
@@ -305,44 +344,53 @@ function to `a` if it comes from `α`, and return `b` otherwise. -/
def casesOn' : Option α → β → (α → β) → β
| none, n, _ => n
| some a, _, s => s a
+#align option.cases_on' Option.casesOn'
@[simp]
theorem casesOn'_none (x : β) (f : α → β) : casesOn' none x f = x :=
rfl
+#align option.cases_on'_none Option.casesOn'_none
@[simp]
theorem casesOn'_some (x : β) (f : α → β) (a : α) : casesOn' (some a) x f = f a :=
rfl
+#align option.cases_on'_some Option.casesOn'_some
@[simp]
theorem casesOn'_coe (x : β) (f : α → β) (a : α) : casesOn' (a : Option α) x f = f a :=
rfl
+#align option.cases_on'_coe Option.casesOn'_coe
-- Porting note: Left-hand side does not simplify.
-- @[simp]
theorem casesOn'_none_coe (f : Option α → β) (o : Option α) :
casesOn' o (f none) (f ∘ (fun a ↦ ↑a)) = f o := by cases o <;> rfl
+#align option.cases_on'_none_coe Option.casesOn'_none_coe
theorem orElse_eq_some (o o' : Option α) (x : α) :
(o <|> o') = some x ↔ o = some x ∨ o = none ∧ o' = some x := by
cases o
· simp only [true_and, false_or, eq_self_iff_true, none_orElse]
· simp only [some_orElse, or_false, false_and]
+#align option.orelse_eq_some Option.orElse_eq_some
theorem orElse_eq_some' (o o' : Option α) (x : α) :
o.orElse (fun _ ↦ o') = some x ↔ o = some x ∨ o = none ∧ o' = some x :=
Option.orElse_eq_some o o' x
+#align option.orelse_eq_some' Option.orElse_eq_some'
@[simp]
theorem orElse_eq_none (o o' : Option α) : (o <|> o') = none ↔ o = none ∧ o' = none := by
cases o
· simp only [true_and, none_orElse, eq_self_iff_true]
· simp only [some_orElse, false_and]
+#align option.orelse_eq_none Option.orElse_eq_none
@[simp]
theorem orElse_eq_none' (o o' : Option α) : o.orElse (fun _ ↦ o') = none ↔ o = none ∧ o' = none :=
Option.orElse_eq_none o o'
+#align option.orelse_eq_none' Option.orElse_eq_none'
section
@@ -350,6 +398,7 @@ open Classical
theorem choice_eq_none (α : Type _) [IsEmpty α] : choice α = none :=
dif_neg (not_nonempty_iff_imp_false.mpr isEmptyElim)
+#align option.choice_eq_none Option.choice_eq_none
#align option.choice_is_some_iff_nonempty Option.choice_isSome_iff_nonempty
@@ -359,5 +408,6 @@ end
-- @[simp]
theorem elim_none_some (f : Option α → β) : (fun x ↦ Option.elim x (f none) (f ∘ some)) = f :=
funext fun o ↦ by cases o <;> rfl
+#align option.elim_none_some Option.elim_none_some
end Option
Co-authored-by: Scott Morrison <scott.morrison@gmail.com>
@@ -84,7 +84,7 @@ theorem bind_eq_some' {x : Option α} {f : α → Option β} {b : β} :
theorem bind_eq_none' {o : Option α} {f : α → Option β} :
o.bind f = none ↔ ∀ b a, a ∈ o → b ∉ f a := by
- simp only [eq_none_iff_forall_not_mem, mem_def, bind_eq_some, not_exists, not_and, iff_self]
+ simp only [eq_none_iff_forall_not_mem, mem_def, bind_eq_some, not_exists, not_and]
theorem joinM_eq_join : joinM = @join α :=
funext fun _ ↦ rfl
@@ -326,8 +326,8 @@ theorem casesOn'_none_coe (f : Option α → β) (o : Option α) :
theorem orElse_eq_some (o o' : Option α) (x : α) :
(o <|> o') = some x ↔ o = some x ∨ o = none ∧ o' = some x := by
cases o
- · simp only [true_and, false_or, eq_self_iff_true, none_orElse, iff_self]
- · simp only [some_orElse, or_false, false_and, iff_self]
+ · simp only [true_and, false_or, eq_self_iff_true, none_orElse]
+ · simp only [some_orElse, or_false, false_and]
theorem orElse_eq_some' (o o' : Option α) (x : α) :
@@ -337,8 +337,8 @@ theorem orElse_eq_some' (o o' : Option α) (x : α) :
@[simp]
theorem orElse_eq_none (o o' : Option α) : (o <|> o') = none ↔ o = none ∧ o' = none := by
cases o
- · simp only [true_and, none_orElse, eq_self_iff_true, iff_self]
- · simp only [some_orElse, false_and, iff_self]
+ · simp only [true_and, none_orElse, eq_self_iff_true]
+ · simp only [some_orElse, false_and]
@[simp]
theorem orElse_eq_none' (o o' : Option α) : o.orElse (fun _ ↦ o') = none ↔ o = none ∧ o' = none :=
Notes so far
There are various problems with theorems already having been ported. Sometimes there was a change in universe level order, implicit argument order, or explicit arguments order or explicicity of arguments. In these situations I did the following.
--Ignore the error and align the old lemma when the difference between the two was just universe.
--Align the old lemma with the new lemma but incluce a porting note when the difference was the order of implicit arguments
--Make a new lemma with a '
at the end when the difference was to do with explicit arguments.
I also added a bunch of definitions that were not imported, possibly with the wrong names. These definitions are
repeat
, ret
, empty
, init
, last
, ilast
There is a question to be answered about what to do with list.nth_le
, which is discussed on Zulip
Co-authored-by: Scott Morrison <scott.morrison@gmail.com> Co-authored-by: ChrisHughes24 <chrishughes24@gmail.com> Co-authored-by: Johan Commelin <johan@commelin.net> Co-authored-by: Siddhartha Gadgil <siddhartha.gadgil@gmail.com>
@@ -93,6 +93,11 @@ theorem joinM_eq_join : joinM = @join α :=
theorem bind_eq_bind {α β : Type _} {f : α → Option β} {x : Option α} : x >>= f = x.bind f :=
rfl
+--Porting note: New lemma used to prove a theorem in Data.List.Basic
+theorem map_eq_bind (f : α → β) (o : Option α) :
+ Option.map f o = Option.bind o (some ∘ f) := by
+ cases o <;> rfl
+
theorem map_coe {α β} {a : α} {f : α → β} : f <$> (a : Option α) = ↑(f a) :=
rfl
Fix a lot of wrong casing mostly in the docstrings but also sometimes in def/theorem names. E.g. fin 2 --> Fin 2
, add_monoid_hom --> AddMonoidHom
Remove \n
from to_additive
docstrings that were inserted by mathport.
Move files and directories with Gcd
and Smul
to GCD
and SMul
@@ -22,7 +22,7 @@ This file develops the basic theory of option types.
If `α` is a type, then `Option α` can be understood as the type with one more element than `α`.
`Option α` has terms `some a`, where `a : α`, and `none`, which is the added element.
This is useful in multiple ways:
-* It is the prototype of addition of terms to a type. See for example `with_bot α` which uses
+* It is the prototype of addition of terms to a type. See for example `WithBot α` which uses
`none` as an element smaller than all others.
* It can be used to define failsafe partial functions, which return `some the_result_we_expect`
if we can find `the_result_we_expect`, and `none` if there is no meaningful result. This forces
@@ -100,7 +100,7 @@ theorem map_coe {α β} {a : α} {f : α → β} : f <$> (a : Option α) = ↑(f
theorem map_coe' {a : α} {f : α → β} : Option.map f (a : Option α) = ↑(f a) :=
rfl
-/-- `option.map` as a function between functions is injective. -/
+/-- `Option.map` as a function between functions is injective. -/
theorem map_injective' : Function.Injective (@Option.map α β) := fun f g h ↦
funext fun x ↦ some_injective _ <| by simp only [← map_some', h]
The script used to do this is included. The yaml file was obtained from https://raw.githubusercontent.com/wiki/leanprover-community/mathlib/mathlib4-port-status.md
@@ -2,6 +2,11 @@
Copyright (c) 2017 Mario Carneiro. All rights reserved.
Released under Apache 2.0 license as described in the file LICENSE.
Authors: Mario Carneiro
+
+! This file was ported from Lean 3 source module data.option.basic
+! leanprover-community/mathlib commit f340f229b1f461aa1c8ee11e0a172d0a3b301a4a
+! Please do not edit these lines, except to modify the commit id
+! if you have ported upstream changes.
-/
import Mathlib.Init.Control.Combinators
import Mathlib.Data.Option.Defs
All dependencies are ported!