Compatibility and agreement of partial values #
Two relations on Option α viewed as partial specifications:
Option.Compatible holds when the two values do not disagree (if both
are some, they coincide), Option.Agrees when both are some of the
same value. Agrees is the positive-evidence strengthening of
Compatible: none is compatible with everything and agrees with
nothing.
[UPSTREAM] Mathlib candidate: no counterpart exists (Option.Rel
relates none only to none, so it is not compatibility).
Two partial values are compatible: if both are some, they
coincide.
Equations
- a.Compatible b = ∀ (x : α), x ∈ a → ∀ (y : α), y ∈ b → x = y
Instances For
Two partial values agree: both are some of the same value.
Equations
- a.Agrees b = ∃ (x : α), x ∈ a ∧ x ∈ b
Instances For
@[simp]
theorem
Option.compatible_iff
{α : Type u_1}
{a b : Option α}
:
a.Compatible b ↔ a = none ∨ b = none ∨ a = b
@[simp]
@[instance_reducible]
instance
Option.instDecidableCompatibleOfDecidableEq
{α : Type u_1}
{a b : Option α}
[DecidableEq α]
:
Decidable (a.Compatible b)
Equations
- Option.instDecidableCompatibleOfDecidableEq = decidable_of_iff (a = none ∨ b = none ∨ a = b) ⋯
@[instance_reducible]
instance
Option.instDecidableAgreesOfDecidableEq
{α : Type u_1}
{a b : Option α}
[DecidableEq α]
:
Decidable (a.Agrees b)
Equations
- Option.instDecidableAgreesOfDecidableEq = decidable_of_iff (a ≠ none ∧ a = b) ⋯