Built with doc-gen4, running Lean4. Bubbles () indicate interactive fragments: hover for details, tap to reveal contents. Use Ctrl+↑Ctrl+↓to navigate, Ctrl+🖱️to focus. On Mac, use Cmdinstead of Ctrl.
/-
Copyright (c) 2018 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.defs
! leanprover-community/mathlib commit c4658a649d216f57e99621708b09dcb3dcccbd23
! Please do not edit these lines, except to modify the commit id
! if you have ported upstream changes.
-/
import Mathlib.Init.Algebra.Classes

/-!
# Extra definitions on `Option`

This file defines more operations involving `Option α`. Lemmas about them are located in other
files under `Mathlib.Data.Option`.
Other basic operations on `Option` are defined in the core library.
-/

namespace Option

#align option.lift_or_get 
Option.liftOrGet: {α : Type u_1} → (ααα) → Option αOption αOption α
Option.liftOrGet
/-- Lifts a relation `α → β → Prop` to a relation `Option α → Option β → Prop` by just adding `none ~ none`. -/ inductive
rel: {α : Type ?u.21} → {β : Type ?u.24} → (αβProp) → Option αOption βProp
rel
(
r: αβProp
r
:
α: ?m.4
α
β: ?m.11
β
Prop: Type
Prop
) :
Option: Type ?u.21 → Type ?u.21
Option
α: ?m.4
α
Option: Type ?u.24 → Type ?u.24
Option
β: ?m.11
β
Prop: Type
Prop
| /-- If `a ~ b`, then `some a ~ some b` -/
some: ∀ {α : Type u_1} {β : Type u_2} {r : αβProp} {a : α} {b : β}, r a brel r (some a) (some b)
some
{
a: ?m.33
a
b: ?m.36
b
} :
r: αβProp
r
a: ?m.33
a
b: ?m.36
b
rel: {α : Type ?u.21} → {β : Type ?u.24} → (αβProp) → Option αOption βProp
rel
r: αβProp
r
(
some: {α : Type ?u.49} → αOption α
some
a: ?m.33
a
) (
some: {α : Type ?u.52} → αOption α
some
b: ?m.36
b
) | /-- `none ~ none` -/
none: ∀ {α : Type u_1} {β : Type u_2} {r : αβProp}, rel r none none
none
:
rel: {α : Type ?u.21} → {β : Type ?u.24} → (αβProp) → Option αOption βProp
rel
r: αβProp
r
none: {α : Type ?u.69} → Option α
none
none: {α : Type ?u.71} → Option α
none
#align option.rel
Option.rel: {α : Type u_1} → {β : Type u_2} → (αβProp) → Option αOption βProp
Option.rel
/-- Traverse an object of `Option α` with a function `f : α → F β` for an applicative `F`. -/ protected def
traverse: {F : Type u → Type v} → [inst : Applicative F] → {α : Type u_1} → {β : Type u} → (αF β) → Option αF (Option β)
traverse
traverse.{u, v}: {F : Type u → Type v} → [inst : Applicative F] → {α : Type ?u.130} → {β : Type u} → (αF β) → Option αF (Option β)
.{u, v}
{
F: Type u → Type v
F
:
Type u: Type (u+1)
Type u
Type v: Type (v+1)
Type v
} [
Applicative: (Type ?u.124 → Type ?u.123) → Type (max(?u.124+1)?u.123)
Applicative
F: Type u → Type v
F
] {
α: Type ?u.130
α
β: Type ?u.133
β
:
Type _: Type (?u.133+1)
Type _
} (
f: αF β
f
:
α: Type ?u.130
α
F: Type u → Type v
F
β: Type ?u.133
β
) :
Option: Type ?u.141 → Type ?u.141
Option
α: Type ?u.130
α
F: Type u → Type v
F
(
Option: Type ?u.143 → Type ?u.143
Option
β: Type ?u.133
β
) |
none: {α : Type ?u.154} → Option α
none
=>
pure: {f : Type ?u.164 → Type ?u.163} → [self : Pure f] → {α : Type ?u.164} → αf α
pure
none: {α : Type ?u.185} → Option α
none
|
some: {α : Type ?u.206} → αOption α
some
x: α
x
=>
some: {α : Type ?u.236} → αOption α
some
<$>
f: αF β
f
x: α
x
#align option.traverse
Option.traverse: {F : Type u → Type v} → [inst : Applicative F] → {α : Type u_1} → {β : Type u} → (αF β) → Option αF (Option β)
Option.traverse
/-- If you maybe have a monadic computation in a `[Monad m]` which produces a term of type `α`, then there is a naturally associated way to always perform a computation in `m` which maybe produces a result. -/ def
maybe: {m : Type u → Type v} → [inst : Monad m] → {α : Type u} → Option (m α)m (Option α)
maybe
maybe.{u, v}: {m : Type u → Type v} → [inst : Monad m] → {α : Type u} → Option (m α)m (Option α)
.{u, v}
{
m: Type u → Type v
m
:
Type u: Type (u+1)
Type u
Type v: Type (v+1)
Type v
} [
Monad: (Type ?u.542 → Type ?u.541) → Type (max(?u.542+1)?u.541)
Monad
m: Type u → Type v
m
] {
α: Type u
α
:
Type u: Type (u+1)
Type u
} :
Option: Type ?u.551 → Type ?u.551
Option
(
m: Type u → Type v
m
α: Type u
α
) →
m: Type u → Type v
m
(
Option: Type ?u.553 → Type ?u.553
Option
α: Type u
α
) |
none: {α : Type ?u.562} → Option α
none
=>
pure: {f : Type ?u.572 → Type ?u.571} → [self : Pure f] → {α : Type ?u.572} → αf α
pure
none: {α : Type ?u.596} → Option α
none
|
some: {α : Type ?u.627} → αOption α
some
fn: m α
fn
=>
some: {α : Type ?u.657} → αOption α
some
<$>
fn: m α
fn
#align option.maybe
Option.maybe: {m : Type u → Type v} → [inst : Monad m] → {α : Type u} → Option (m α)m (Option α)
Option.maybe
#align option.mmap
Option.mapM: {m : Type u_1 → Type u_2} → {α : Type u_3} → {β : Type u_1} → [inst : Monad m] → (αm β) → Option αm (Option β)
Option.mapM
#align option.melim
Option.elimM: {m : Type u_1 → Type u_2} → {α β : Type u_1} → [inst : Monad m] → m (Option α)m β(αm β) → m β
Option.elimM
@[deprecated
getDM: {m : Type u_1 → Type u_2} → {α : Type u_1} → [inst : Monad m] → Option αm αm α
getDM
] protected def
getDM': {m : Type ?u.923 → Type ?u.918} → {α : Type ?u.923} → [inst : Monad m] → m (Option α)m αm α
getDM'
[
Monad: (Type ?u.919 → Type ?u.918) → Type (max(?u.919+1)?u.918)
Monad
m: ?m.905
m
] (
x: m (Option α)
x
:
m: ?m.905
m
(
Option: Type ?u.923 → Type ?u.923
Option
α: ?m.915
α
)) (
y: m α
y
:
m: ?m.905
m
α: ?m.915
α
) :
m: ?m.905
m
α: ?m.915
α
:= do
(← x): ?m.989
(←
x: m (Option α)
x
(← x): ?m.989
)
.
getDM: {m : Type ?u.992 → Type ?u.991} → {α : Type ?u.992} → [inst : Monad m] → Option αm αm α
getDM
y: m α
y
#align option.mget_or_else
Option.getDM': {m : Type u_1 → Type u_2} → {α : Type u_1} → [inst : Monad m] → m (Option α)m αm α
Option.getDM'
variable {
α: Type ?u.1136
α
:
Type _: Type (?u.1142+1)
Type _
} {
β: Type ?u.1820
β
:
Type _: Type (?u.1539+1)
Type _
} -- Porting note: Would need to add the attribute directly in `Init.Prelude`. -- attribute [inline] Option.isSome Option.isNone /-- An elimination principle for `Option`. It is a nondependent version of `Option.rec`. -/ protected def
elim': β(αβ) → Option αβ
elim'
(
b: β
b
:
β: Type ?u.1145
β
) (
f: αβ
f
:
α: Type ?u.1142
α
β: Type ?u.1145
β
) :
Option: Type ?u.1155 → Type ?u.1155
Option
α: Type ?u.1142
α
β: Type ?u.1145
β
|
some: {α : Type ?u.1163} → αOption α
some
a: α
a
=>
f: αβ
f
a: α
a
|
none: {α : Type ?u.1179} → Option α
none
=>
b: β
b
#align option.elim
Option.elim': {α : Type u_1} → {β : Type u_2} → β(αβ) → Option αβ
Option.elim'
@[simp] theorem
elim'_none: ∀ {α : Type u_2} {β : Type u_1} (b : β) (f : αβ), Option.elim' b f none = b
elim'_none
(
b: β
b
:
β: Type ?u.1388
β
) (
f: αβ
f
:
α: Type ?u.1385
α
β: Type ?u.1388
β
) :
Option.elim': {α : Type ?u.1399} → {β : Type ?u.1398} → β(αβ) → Option αβ
Option.elim'
b: β
b
f: αβ
f
none: {α : Type ?u.1405} → Option α
none
=
b: β
b
:=
rfl: ∀ {α : Sort ?u.1412} {a : α}, a = a
rfl
@[simp] theorem
elim'_some: ∀ {a : α} (b : β) (f : αβ), Option.elim' b f (some a) = f a
elim'_some
(
b: β
b
:
β: Type ?u.1451
β
) (
f: αβ
f
:
α: Type ?u.1448
α
β: Type ?u.1451
β
) :
Option.elim': {α : Type ?u.1483} → {β : Type ?u.1482} → β(αβ) → Option αβ
Option.elim'
b: β
b
f: αβ
f
(
some: {α : Type ?u.1489} → αOption α
some
a: ?m.1472
a
) =
f: αβ
f
a: ?m.1472
a
:=
rfl: ∀ {α : Sort ?u.1496} {a : α}, a = a
rfl
theorem
mem_some_iff: ∀ {α : Type u_1} {a b : α}, a some b b = a
mem_some_iff
{
α: Type ?u.1542
α
:
Type _: Type (?u.1542+1)
Type _
} {
a: α
a
b: α
b
:
α: Type ?u.1542
α
} :
a: α
a
some: {α : Type ?u.1554} → αOption α
some
b: α
b
b: α
b
=
a: α
a
:=

Goals accomplished! 🐙
α✝: Type ?u.1536

β: Type ?u.1539

α: Type u_1

a, b: α


a some b b = a

Goals accomplished! 🐙
#align option.mem_some_iff
Option.mem_some_iff: ∀ {α : Type u_1} {a b : α}, a some b b = a
Option.mem_some_iff
/-- `o = none` is decidable even if the wrapped type does not have decidable equality. This is not an instance because it is not definitionally equal to `Option.decidableEq`. Try to use `o.isNone` or `o.isSome` instead. -/ @[inline] def
decidableEqNone: {o : Option α} → Decidable (o = none)
decidableEqNone
{
o: Option α
o
:
Option: Type ?u.1670 → Type ?u.1670
Option
α: Type ?u.1664
α
} :
Decidable: PropType
Decidable
(
o: Option α
o
=
none: {α : Type ?u.1674} → Option α
none
) :=
decidable_of_decidable_of_iff: {p q : Prop} → [inst : Decidable p] → (p q) → Decidable q
decidable_of_decidable_of_iff
isNone_iff_eq_none: ∀ {α : Type ?u.1748} {o : Option α}, isNone o = true o = none
isNone_iff_eq_none
#align option.decidable_eq_none
Option.decidableEqNone: {α : Type u_1} → {o : Option α} → Decidable (o = none)
Option.decidableEqNone
instance
decidableForallMem: {p : αProp} → [inst : DecidablePred p] → (o : Option α) → Decidable (∀ (a : α), a op a)
decidableForallMem
{
p: αProp
p
:
α: Type ?u.1817
α
Prop: Type
Prop
} [
DecidablePred: {α : Sort ?u.1827} → (αProp) → Sort (max1?u.1827)
DecidablePred
p: αProp
p
] : ∀
o: Option α
o
:
Option: Type ?u.1838 → Type ?u.1838
Option
α: Type ?u.1817
α
,
Decidable: PropType
Decidable
(∀
a: ?m.1842
a
o: Option α
o
,
p: αProp
p
a: ?m.1842
a
) |
none: {α : Type ?u.1886} → Option α
none
=>
isTrue: {p : Prop} → pDecidable p
isTrue
(

Goals accomplished! 🐙
α: Type ?u.1817

β: Type ?u.1820

p: αProp

inst✝: DecidablePred p


∀ (a : α), a nonep a

Goals accomplished! 🐙
) |
some: {α : Type ?u.1904} → αOption α
some
a: α
a
=> if
h: ?m.1932
h
:
p: αProp
p
a: α
a
then
isTrue: {p : Prop} → pDecidable p
isTrue
fun
o: ?m.1938
o
e: ?m.1941
e
some_inj: ∀ {α : Type ?u.1943} {a b : α}, some a = some b a = b
some_inj
.
1: ∀ {a b : Prop}, (a b) → ab
1
e: ?m.1941
e
h: ?m.1932
h
else
isFalse: {p : Prop} → ¬pDecidable p
isFalse
<|
mt: ∀ {a b : Prop}, (ab) → ¬b¬a
mt
(fun
H: ?m.1981
H
H: ?m.1981
H
_: α
_
rfl: ∀ {α : Sort ?u.1987} {a : α}, a = a
rfl
)
h: ?m.1969
h
instance
decidableExistsMem: {α : Type u_1} → {p : αProp} → [inst : DecidablePred p] → (o : Option α) → Decidable (a, a o p a)
decidableExistsMem
{
p: αProp
p
:
α: Type ?u.2426
α
Prop: Type
Prop
} [
DecidablePred: {α : Sort ?u.2436} → (αProp) → Sort (max1?u.2436)
DecidablePred
p: αProp
p
] : ∀
o: Option α
o
:
Option: Type ?u.2447 → Type ?u.2447
Option
α: Type ?u.2426
α
,
Decidable: PropType
Decidable
(∃
a: ?m.2453
a
o: Option α
o
,
p: αProp
p
a: ?m.2453
a
) |
none: {α : Type ?u.2484} → Option α
none
=>
isFalse: {p : Prop} → ¬pDecidable p
isFalse
fun
a: α
a
, ⟨
h: a none
h
, _⟩⟩ ↦

Goals accomplished! 🐙
α: Type ?u.2426

β: Type ?u.2429

p: αProp

inst✝: DecidablePred p

x✝: a, a none p a

a: α

h: a none

right✝: p a



Goals accomplished! 🐙
|
some: {α : Type ?u.2648} → αOption α
some
a: α
a
=> if
h: ?m.2676
h
:
p: αProp
p
a: α
a
then
isTrue: {p : Prop} → pDecidable p
isTrue
<| ⟨
_: ?m.2684
_
,
rfl: ∀ {α : Sort ?u.2700} {a : α}, a = a
rfl
,
h: ?m.2676
h
else
isFalse: {p : Prop} → ¬pDecidable p
isFalse
fun
_: α
_
, ⟨
rfl: ∀ {α : Sort ?u.2719} {a : α}, a = a
rfl
,
hn: p a
hn
⟩⟩ ↦
h: ?m.2711
h
hn: p a
hn
/-- Inhabited `get` function. Returns `a` if the input is `some a`, otherwise returns `default`. -/ @[reducible] def
iget: [inst : Inhabited α] → Option αα
iget
[
Inhabited: Sort ?u.3243 → Sort (max1?u.3243)
Inhabited
α: Type ?u.3237
α
] :
Option: Type ?u.3247 → Type ?u.3247
Option
α: Type ?u.3237
α
α: Type ?u.3237
α
|
some: {α : Type ?u.3254} → αOption α
some
x: α
x
=>
x: α
x
|
none: {α : Type ?u.3270} → Option α
none
=>
default: {α : Sort ?u.3278} → [self : Inhabited α] → α
default
#align option.iget
Option.iget: {α : Type u_1} → [inst : Inhabited α] → Option αα
Option.iget
theorem
iget_some: ∀ [inst : Inhabited α] {a : α}, iget (some a) = a
iget_some
[
Inhabited: Sort ?u.3530 → Sort (max1?u.3530)
Inhabited
α: Type ?u.3524
α
] {
a: α
a
:
α: Type ?u.3524
α
} : (
some: {α : Type ?u.3536} → αOption α
some
a: α
a
).
iget: {α : Type ?u.3538} → [inst : Inhabited α] → Option αα
iget
=
a: α
a
:=
rfl: ∀ {α : Sort ?u.3554} {a : α}, a = a
rfl
#align option.iget_some
Option.iget_some: ∀ {α : Type u_1} [inst : Inhabited α] {a : α}, iget (some a) = a
Option.iget_some
@[simp] theorem
mem_toList: ∀ {α : Type u_1} {a : α} {o : Option α}, a toList o a o
mem_toList
{
a: α
a
:
α: Type ?u.3573
α
} {
o: Option α
o
:
Option: Type ?u.3581 → Type ?u.3581
Option
α: Type ?u.3573
α
} :
a: α
a
toList: {α : Type ?u.3589} → Option αList α
toList
o: Option α
o
a: α
a
o: Option α
o
:=

Goals accomplished! 🐙
α: Type u_1

β: Type ?u.3576

a: α

o: Option α


a toList o a o
α: Type u_1

β: Type ?u.3576

a: α


none
a toList none a none
α: Type u_1

β: Type ?u.3576

a, val✝: α


some
a toList (some val✝) a some val✝
α: Type u_1

β: Type ?u.3576

a: α

o: Option α


a toList o a o
α: Type u_1

β: Type ?u.3576

a: α


none
a toList none a none
α: Type u_1

β: Type ?u.3576

a, val✝: α


some
a toList (some val✝) a some val✝
α: Type u_1

β: Type ?u.3576

a: α

o: Option α


a toList o a o

Goals accomplished! 🐙
#align option.mem_to_list
Option.mem_toList: ∀ {α : Type u_1} {a : α} {o : Option α}, a toList o a o
Option.mem_toList
instance
liftOrGet_isCommutative: ∀ (f : ααα) [inst : IsCommutative α f], IsCommutative (Option α) (liftOrGet f)
liftOrGet_isCommutative
(
f: ααα
f
:
α: Type ?u.3969
α
α: Type ?u.3969
α
α: Type ?u.3969
α
) [
IsCommutative: (α : Type ?u.3981) → (ααα) → Prop
IsCommutative
α: Type ?u.3969
α
f: ααα
f
] :
IsCommutative: (α : Type ?u.3986) → (ααα) → Prop
IsCommutative
(
Option: Type ?u.3987 → Type ?u.3987
Option
α: Type ?u.3969
α
) (
liftOrGet: {α : Type ?u.3988} → (ααα) → Option αOption αOption α
liftOrGet
f: ααα
f
) := ⟨fun
a: ?m.4023
a
b: ?m.4026
b

Goals accomplished! 🐙
α: Type ?u.3969

β: Type ?u.3972

f: ααα

inst✝: IsCommutative α f

a, b: Option α


liftOrGet f a b = liftOrGet f b a
α: Type ?u.3969

β: Type ?u.3972

f: ααα

inst✝: IsCommutative α f

b: Option α


none
liftOrGet f none b = liftOrGet f b none
α: Type ?u.3969

β: Type ?u.3972

f: ααα

inst✝: IsCommutative α f

b: Option α

val✝: α


some
liftOrGet f (some val✝) b = liftOrGet f b (some val✝)
α: Type ?u.3969

β: Type ?u.3972

f: ααα

inst✝: IsCommutative α f

a, b: Option α


liftOrGet f a b = liftOrGet f b a
α: Type ?u.3969

β: Type ?u.3972

f: ααα

inst✝: IsCommutative α f

b: Option α


none
liftOrGet f none b = liftOrGet f b none
α: Type ?u.3969

β: Type ?u.3972

f: ααα

inst✝: IsCommutative α f

b: Option α

val✝: α


some
liftOrGet f (some val✝) b = liftOrGet f b (some val✝)
α: Type ?u.3969

β: Type ?u.3972

f: ααα

inst✝: IsCommutative α f

a, b: Option α


liftOrGet f a b = liftOrGet f b a
α: Type ?u.3969

β: Type ?u.3972

f: ααα

inst✝: IsCommutative α f

val✝: α


some.none
liftOrGet f (some val✝) none = liftOrGet f none (some val✝)
α: Type ?u.3969

β: Type ?u.3972

f: ααα

inst✝: IsCommutative α f

val✝¹, val✝: α


some.some
liftOrGet f (some val✝¹) (some val✝) = liftOrGet f (some val✝) (some val✝¹)
α: Type ?u.3969

β: Type ?u.3972

f: ααα

inst✝: IsCommutative α f

a, b: Option α


liftOrGet f a b = liftOrGet f b a
α: Type ?u.3969

β: Type ?u.3972

f: ααα

inst✝: IsCommutative α f


none.none
liftOrGet f none none = liftOrGet f none none
α: Type ?u.3969

β: Type ?u.3972

f: ααα

inst✝: IsCommutative α f

val✝: α


none.some
liftOrGet f none (some val✝) = liftOrGet f (some val✝) none
α: Type ?u.3969

β: Type ?u.3972

f: ααα

inst✝: IsCommutative α f

val✝: α


some.none
liftOrGet f (some val✝) none = liftOrGet f none (some val✝)
α: Type ?u.3969

β: Type ?u.3972

f: ααα

inst✝: IsCommutative α f

val✝¹, val✝: α


some.some
liftOrGet f (some val✝¹) (some val✝) = liftOrGet f (some val✝) (some val✝¹)
α: Type ?u.3969

β: Type ?u.3972

f: ααα

inst✝: IsCommutative α f

a, b: Option α


liftOrGet f a b = liftOrGet f b a

Goals accomplished! 🐙
instance
liftOrGet_isAssociative: ∀ (f : ααα) [inst : IsAssociative α f], IsAssociative (Option α) (liftOrGet f)
liftOrGet_isAssociative
(
f: ααα
f
:
α: Type ?u.4687
α
α: Type ?u.4687
α
α: Type ?u.4687
α
) [
IsAssociative: (α : Type ?u.4699) → (ααα) → Prop
IsAssociative
α: Type ?u.4687
α
f: ααα
f
] :
IsAssociative: (α : Type ?u.4704) → (ααα) → Prop
IsAssociative
(
Option: Type ?u.4705 → Type ?u.4705
Option
α: Type ?u.4687
α
) (
liftOrGet: {α : Type ?u.4706} → (ααα) → Option αOption αOption α
liftOrGet
f: ααα
f
) := ⟨fun
a: ?m.4741
a
b: ?m.4744
b
c: ?m.4747
c

Goals accomplished! 🐙
α: Type ?u.4687

β: Type ?u.4690

f: ααα

inst✝: IsAssociative α f

a, b, c: Option α


liftOrGet f (liftOrGet f a b) c = liftOrGet f a (liftOrGet f b c)
α: Type ?u.4687

β: Type ?u.4690

f: ααα

inst✝: IsAssociative α f

b, c: Option α


none
liftOrGet f (liftOrGet f none b) c = liftOrGet f none (liftOrGet f b c)
α: Type ?u.4687

β: Type ?u.4690

f: ααα

inst✝: IsAssociative α f

b, c: Option α

val✝: α


some
liftOrGet f (liftOrGet f (some val✝) b) c = liftOrGet f (some val✝) (liftOrGet f b c)
α: Type ?u.4687

β: Type ?u.4690

f: ααα

inst✝: IsAssociative α f

a, b, c: Option α


liftOrGet f (liftOrGet f a b) c = liftOrGet f a (liftOrGet f b c)
α: Type ?u.4687

β: Type ?u.4690

f: ααα

inst✝: IsAssociative α f

b, c: Option α


none
liftOrGet f (liftOrGet f none b) c = liftOrGet f none (liftOrGet f b c)
α: Type ?u.4687

β: Type ?u.4690

f: ααα

inst✝: IsAssociative α f

b, c: Option α

val✝: α


some
liftOrGet f (liftOrGet f (some val✝) b) c = liftOrGet f (some val✝) (liftOrGet f b c)
α: Type ?u.4687

β: Type ?u.4690

f: ααα

inst✝: IsAssociative α f

a, b, c: Option α


liftOrGet f (liftOrGet f a b) c = liftOrGet f a (liftOrGet f b c)
α: Type ?u.4687

β: Type ?u.4690

f: ααα

inst✝: IsAssociative α f

c: Option α


none.none
liftOrGet f (liftOrGet f none none) c = liftOrGet f none (liftOrGet f none c)
α: Type ?u.4687

β: Type ?u.4690

f: ααα

inst✝: IsAssociative α f

c: Option α

val✝: α


none.some
liftOrGet f (liftOrGet f none (some val✝)) c = liftOrGet f none (liftOrGet f (some val✝) c)
α: Type ?u.4687

β: Type ?u.4690

f: ααα

inst✝: IsAssociative α f

a, b, c: Option α


liftOrGet f (liftOrGet f a b) c = liftOrGet f a (liftOrGet f b c)
α: Type ?u.4687

β: Type ?u.4690

f: ααα

inst✝: IsAssociative α f

c: Option α


none.none
liftOrGet f (liftOrGet f none none) c = liftOrGet f none (liftOrGet f none c)
α: Type ?u.4687

β: Type ?u.4690

f: ααα

inst✝: IsAssociative α f

c: Option α

val✝: α


none.some
liftOrGet f (liftOrGet f none (some val✝)) c = liftOrGet f none (liftOrGet f (some val✝) c)
α: Type ?u.4687

β: Type ?u.4690

f: ααα

inst✝: IsAssociative α f

c: Option α

val✝: α


some.none
liftOrGet f (liftOrGet f (some val✝) none) c = liftOrGet f (some val✝) (liftOrGet f none c)
α: Type ?u.4687

β: Type ?u.4690

f: ααα

inst✝: IsAssociative α f

c: Option α

val✝¹, val✝: α


some.some
liftOrGet f (liftOrGet f (some val✝¹) (some val✝)) c = liftOrGet f (some val✝¹) (liftOrGet f (some val✝) c)
α: Type ?u.4687

β: Type ?u.4690

f: ααα

inst✝: IsAssociative α f

a, b, c: Option α


liftOrGet f (liftOrGet f a b) c = liftOrGet f a (liftOrGet f b c)
α: Type ?u.4687

β: Type ?u.4690

f: ααα

inst✝: IsAssociative α f

val✝: α


some.none.none
liftOrGet f (liftOrGet f (some val✝) none) none = liftOrGet f (some val✝) (liftOrGet f none none)
α: Type ?u.4687

β: Type ?u.4690

f: ααα

inst✝: IsAssociative α f

val✝¹, val✝: α


some.none.some
liftOrGet f (liftOrGet f (some val✝¹) none) (some val✝) = liftOrGet f (some val✝¹) (liftOrGet f none (some val✝))
α: Type ?u.4687

β: Type ?u.4690

f: ααα

inst✝: IsAssociative α f

a, b, c: Option α


liftOrGet f (liftOrGet f a b) c = liftOrGet f a (liftOrGet f b c)
α: Type ?u.4687

β: Type ?u.4690

f: ααα

inst✝: IsAssociative α f


none.none.none
liftOrGet f (liftOrGet f none none) none = liftOrGet f none (liftOrGet f none none)
α: Type ?u.4687

β: Type ?u.4690

f: ααα

inst✝: IsAssociative α f

val✝: α


none.none.some
liftOrGet f (liftOrGet f none none) (some val✝) = liftOrGet f none (liftOrGet f none (some val✝))
α: Type ?u.4687

β: Type ?u.4690

f: ααα

inst✝: IsAssociative α f

val✝: α


none.some.none
liftOrGet f (liftOrGet f none (some val✝)) none = liftOrGet f none (liftOrGet f (some val✝) none)
α: Type ?u.4687

β: Type ?u.4690

f: ααα

inst✝: IsAssociative α f

val✝¹, val✝: α


none.some.some
liftOrGet f (liftOrGet f none (some val✝¹)) (some val✝) = liftOrGet f none (liftOrGet f (some val✝¹) (some val✝))
α: Type ?u.4687

β: Type ?u.4690

f: ααα

inst✝: IsAssociative α f

val✝: α


some.none.none
liftOrGet f (liftOrGet f (some val✝) none) none = liftOrGet f (some val✝) (liftOrGet f none none)
α: Type ?u.4687

β: Type ?u.4690

f: ααα

inst✝: IsAssociative α f

val✝¹, val✝: α


some.none.some
liftOrGet f (liftOrGet f (some val✝¹) none) (some val✝) = liftOrGet f (some val✝¹) (liftOrGet f none (some val✝))
α: Type ?u.4687

β: Type ?u.4690

f: ααα

inst✝: IsAssociative α f

val✝¹, val✝: α


some.some.none
liftOrGet f (liftOrGet f (some val✝¹) (some val✝)) none = liftOrGet f (some val✝¹) (liftOrGet f (some val✝) none)
α: Type ?u.4687

β: Type ?u.4690

f: ααα

inst✝: IsAssociative α f

val✝², val✝¹, val✝: α


some.some.some
liftOrGet f (liftOrGet f (some val✝²) (some val✝¹)) (some val✝) = liftOrGet f (some val✝²) (liftOrGet f (some val✝¹) (some val✝))
α: Type ?u.4687

β: Type ?u.4690

f: ααα

inst✝: IsAssociative α f

a, b, c: Option α


liftOrGet f (liftOrGet f a b) c = liftOrGet f a (liftOrGet f b c)

Goals accomplished! 🐙
instance
liftOrGet_isIdempotent: ∀ (f : ααα) [inst : IsIdempotent α f], IsIdempotent (Option α) (liftOrGet f)
liftOrGet_isIdempotent
(
f: ααα
f
:
α: Type ?u.11257
α
α: Type ?u.11257
α
α: Type ?u.11257
α
) [
IsIdempotent: (α : Type ?u.11269) → (ααα) → Prop
IsIdempotent
α: Type ?u.11257
α
f: ααα
f
] :
IsIdempotent: (α : Type ?u.11274) → (ααα) → Prop
IsIdempotent
(
Option: Type ?u.11275 → Type ?u.11275
Option
α: Type ?u.11257
α
) (
liftOrGet: {α : Type ?u.11276} → (ααα) → Option αOption αOption α
liftOrGet
f: ααα
f
) := ⟨fun
a: ?m.11311
a

Goals accomplished! 🐙
α: Type ?u.11257

β: Type ?u.11260

f: ααα

inst✝: IsIdempotent α f

a: Option α


liftOrGet f a a = a
α: Type ?u.11257

β: Type ?u.11260

f: ααα

inst✝: IsIdempotent α f


none
liftOrGet f none none = none
α: Type ?u.11257

β: Type ?u.11260

f: ααα

inst✝: IsIdempotent α f

val✝: α


some
liftOrGet f (some val✝) (some val✝) = some val✝
α: Type ?u.11257

β: Type ?u.11260

f: ααα

inst✝: IsIdempotent α f

a: Option α


liftOrGet f a a = a
α: Type ?u.11257

β: Type ?u.11260

f: ααα

inst✝: IsIdempotent α f


none
liftOrGet f none none = none
α: Type ?u.11257

β: Type ?u.11260

f: ααα

inst✝: IsIdempotent α f

val✝: α


some
liftOrGet f (some val✝) (some val✝) = some val✝
α: Type ?u.11257

β: Type ?u.11260

f: ααα

inst✝: IsIdempotent α f

a: Option α


liftOrGet f a a = a

Goals accomplished! 🐙
instance
liftOrGet_isLeftId: ∀ {α : Type u_1} (f : ααα), IsLeftId (Option α) (liftOrGet f) none
liftOrGet_isLeftId
(
f: ααα
f
:
α: Type ?u.11597
α
α: Type ?u.11597
α
α: Type ?u.11597
α
) :
IsLeftId: (α : Type ?u.11609) → (ααα) → outParam αProp
IsLeftId
(
Option: Type ?u.11610 → Type ?u.11610
Option
α: Type ?u.11597
α
) (
liftOrGet: {α : Type ?u.11611} → (ααα) → Option αOption αOption α
liftOrGet
f: ααα
f
)
none: {α : Type ?u.11630} → Option α
none
:= ⟨fun
a: ?m.11650
a

Goals accomplished! 🐙
α: Type ?u.11597

β: Type ?u.11600

f: ααα

a: Option α


liftOrGet f none a = a
α: Type ?u.11597

β: Type ?u.11600

f: ααα


none
liftOrGet f none none = none
α: Type ?u.11597

β: Type ?u.11600

f: ααα

val✝: α


some
liftOrGet f none (some val✝) = some val✝
α: Type ?u.11597

β: Type ?u.11600

f: ααα

a: Option α


liftOrGet f none a = a
α: Type ?u.11597

β: Type ?u.11600

f: ααα


none
liftOrGet f none none = none
α: Type ?u.11597

β: Type ?u.11600

f: ααα

val✝: α


some
liftOrGet f none (some val✝) = some val✝
α: Type ?u.11597

β: Type ?u.11600

f: ααα

a: Option α


liftOrGet f none a = a

Goals accomplished! 🐙
instance
liftOrGet_isRightId: ∀ (f : ααα), IsRightId (Option α) (liftOrGet f) none
liftOrGet_isRightId
(
f: ααα
f
:
α: Type ?u.11807
α
α: Type ?u.11807
α
α: Type ?u.11807
α
) :
IsRightId: (α : Type ?u.11819) → (ααα) → outParam αProp
IsRightId
(
Option: Type ?u.11820 → Type ?u.11820
Option
α: Type ?u.11807
α
) (
liftOrGet: {α : Type ?u.11821} → (ααα) → Option αOption αOption α
liftOrGet
f: ααα
f
)
none: {α : Type ?u.11840} → Option α
none
:= ⟨fun
a: ?m.11860
a

Goals accomplished! 🐙
α: Type ?u.11807

β: Type ?u.11810

f: ααα

a: Option α


liftOrGet f a none = a
α: Type ?u.11807

β: Type ?u.11810

f: ααα


none
liftOrGet f none none = none
α: Type ?u.11807

β: Type ?u.11810

f: ααα

val✝: α


some
liftOrGet f (some val✝) none = some val✝
α: Type ?u.11807

β: Type ?u.11810

f: ααα

a: Option α


liftOrGet f a none = a
α: Type ?u.11807

β: Type ?u.11810

f: ααα


none
liftOrGet f none none = none
α: Type ?u.11807

β: Type ?u.11810

f: ααα

val✝: α


some
liftOrGet f (some val✝) none = some val✝
α: Type ?u.11807

β: Type ?u.11810

f: ααα

a: Option α


liftOrGet f a none = a

Goals accomplished! 🐙
#align option.lift_or_get_comm
Option.liftOrGet_isCommutative: ∀ {α : Type u_1} (f : ααα) [inst : IsCommutative α f], IsCommutative (Option α) (liftOrGet f)
Option.liftOrGet_isCommutative
#align option.lift_or_get_assoc
Option.liftOrGet_isAssociative: ∀ {α : Type u_1} (f : ααα) [inst : IsAssociative α f], IsAssociative (Option α) (liftOrGet f)
Option.liftOrGet_isAssociative
#align option.lift_or_get_idem
Option.liftOrGet_isIdempotent: ∀ {α : Type u_1} (f : ααα) [inst : IsIdempotent α f], IsIdempotent (Option α) (liftOrGet f)
Option.liftOrGet_isIdempotent
#align option.lift_or_get_is_left_id
Option.liftOrGet_isLeftId: ∀ {α : Type u_1} (f : ααα), IsLeftId (Option α) (liftOrGet f) none
Option.liftOrGet_isLeftId
#align option.lift_or_get_is_right_id
Option.liftOrGet_isRightId: ∀ {α : Type u_1} (f : ααα), IsRightId (Option α) (liftOrGet f) none
Option.liftOrGet_isRightId