fact
stringlengths
10
4.79k
type
stringclasses
9 values
library
stringclasses
44 values
imports
listlengths
0
13
filename
stringclasses
718 values
symbolic_name
stringlengths
1
76
docstring
stringlengths
10
64.6k
exists_imp : ((∃ x, p x) → b) ↔ ∀ x, p x → b := forall_exists_index
theorem
Init.PropLemmas
[ "Init.NotationExtra" ]
Init/PropLemmas.lean
exists_imp
null
exists₂_imp {P : (x : α) → p x → Prop} : (∃ x h, P x h) → b ↔ ∀ x h, P x h → b := by simp @[simp] theorem exists_const (α) [i : Nonempty α] : (∃ _ : α, b) ↔ b := ⟨fun ⟨_, h⟩ => h, i.elim Exists.intro⟩ @[congr]
theorem
Init.PropLemmas
[ "Init.NotationExtra" ]
Init/PropLemmas.lean
exists₂_imp
null
exists_prop_congr {p p' : Prop} {q q' : p → Prop} (hq : ∀ h, q h ↔ q' h) (hp : p ↔ p') : Exists q ↔ ∃ h : p', q' (hp.2 h) := ⟨fun ⟨_, _⟩ ↦ ⟨hp.1 ‹_›, (hq _).1 ‹_›⟩, fun ⟨_, _⟩ ↦ ⟨_, (hq _).2 ‹_›⟩⟩
theorem
Init.PropLemmas
[ "Init.NotationExtra" ]
Init/PropLemmas.lean
exists_prop_congr
null
exists_prop_of_true {p : Prop} {q : p → Prop} (h : p) : (Exists fun h' : p => q h') ↔ q h := @exists_const (q h) p ⟨h⟩ @[simp] theorem exists_true_left {p : True → Prop} : Exists p ↔ p True.intro := exists_prop_of_true _
theorem
Init.PropLemmas
[ "Init.NotationExtra" ]
Init/PropLemmas.lean
exists_prop_of_true
null
forall_congr' (h : ∀ a, p a ↔ q a) : (∀ a, p a) ↔ ∀ a, q a := ⟨fun H a => (h a).1 (H a), fun H a => (h a).2 (H a)⟩
theorem
Init.PropLemmas
[ "Init.NotationExtra" ]
Init/PropLemmas.lean
forall_congr'
null
exists_congr (h : ∀ a, p a ↔ q a) : (∃ a, p a) ↔ ∃ a, q a := ⟨Exists.imp fun x => (h x).1, Exists.imp fun x => (h x).2⟩ variable {β : α → Sort _}
theorem
Init.PropLemmas
[ "Init.NotationExtra" ]
Init/PropLemmas.lean
exists_congr
null
forall₂_congr {p q : ∀ a, β a → Prop} (h : ∀ a b, p a b ↔ q a b) : (∀ a b, p a b) ↔ ∀ a b, q a b := forall_congr' fun a => forall_congr' <| h a
theorem
Init.PropLemmas
[ "Init.NotationExtra" ]
Init/PropLemmas.lean
forall₂_congr
null
exists₂_congr {p q : ∀ a, β a → Prop} (h : ∀ a b, p a b ↔ q a b) : (∃ a b, p a b) ↔ ∃ a b, q a b := exists_congr fun a => exists_congr <| h a variable {γ : ∀ a, β a → Sort _}
theorem
Init.PropLemmas
[ "Init.NotationExtra" ]
Init/PropLemmas.lean
exists₂_congr
null
forall₃_congr {p q : ∀ a b, γ a b → Prop} (h : ∀ a b c, p a b c ↔ q a b c) : (∀ a b c, p a b c) ↔ ∀ a b c, q a b c := forall_congr' fun a => forall₂_congr <| h a
theorem
Init.PropLemmas
[ "Init.NotationExtra" ]
Init/PropLemmas.lean
forall₃_congr
null
exists₃_congr {p q : ∀ a b, γ a b → Prop} (h : ∀ a b c, p a b c ↔ q a b c) : (∃ a b c, p a b c) ↔ ∃ a b c, q a b c := exists_congr fun a => exists₂_congr <| h a variable {δ : ∀ a b, γ a b → Sort _}
theorem
Init.PropLemmas
[ "Init.NotationExtra" ]
Init/PropLemmas.lean
exists₃_congr
null
forall₄_congr {p q : ∀ a b c, δ a b c → Prop} (h : ∀ a b c d, p a b c d ↔ q a b c d) : (∀ a b c d, p a b c d) ↔ ∀ a b c d, q a b c d := forall_congr' fun a => forall₃_congr <| h a
theorem
Init.PropLemmas
[ "Init.NotationExtra" ]
Init/PropLemmas.lean
forall₄_congr
null
exists₄_congr {p q : ∀ a b c, δ a b c → Prop} (h : ∀ a b c d, p a b c d ↔ q a b c d) : (∃ a b c d, p a b c d) ↔ ∃ a b c d, q a b c d := exists_congr fun a => exists₃_congr <| h a variable {ε : ∀ a b c, δ a b c → Sort _}
theorem
Init.PropLemmas
[ "Init.NotationExtra" ]
Init/PropLemmas.lean
exists₄_congr
null
forall₅_congr {p q : ∀ a b c d, ε a b c d → Prop} (h : ∀ a b c d e, p a b c d e ↔ q a b c d e) : (∀ a b c d e, p a b c d e) ↔ ∀ a b c d e, q a b c d e := forall_congr' fun a => forall₄_congr <| h a
theorem
Init.PropLemmas
[ "Init.NotationExtra" ]
Init/PropLemmas.lean
forall₅_congr
null
exists₅_congr {p q : ∀ a b c d, ε a b c d → Prop} (h : ∀ a b c d e, p a b c d e ↔ q a b c d e) : (∃ a b c d e, p a b c d e) ↔ ∃ a b c d e, q a b c d e := exists_congr fun a => exists₄_congr <| h a
theorem
Init.PropLemmas
[ "Init.NotationExtra" ]
Init/PropLemmas.lean
exists₅_congr
null
@[simp] not_exists : (¬∃ x, p x) ↔ ∀ x, ¬p x := exists_imp
theorem
Init.PropLemmas
[ "Init.NotationExtra" ]
Init/PropLemmas.lean
not_exists
null
forall_not_of_not_exists (h : ¬∃ x, p x) : ∀ x, ¬p x := not_exists.mp h
theorem
Init.PropLemmas
[ "Init.NotationExtra" ]
Init/PropLemmas.lean
forall_not_of_not_exists
null
not_exists_of_forall_not (h : ∀ x, ¬p x) : ¬∃ x, p x := not_exists.mpr h
theorem
Init.PropLemmas
[ "Init.NotationExtra" ]
Init/PropLemmas.lean
not_exists_of_forall_not
null
forall_and : (∀ x, p x ∧ q x) ↔ (∀ x, p x) ∧ (∀ x, q x) := ⟨fun h => ⟨fun x => (h x).1, fun x => (h x).2⟩, fun ⟨h₁, h₂⟩ x => ⟨h₁ x, h₂ x⟩⟩
theorem
Init.PropLemmas
[ "Init.NotationExtra" ]
Init/PropLemmas.lean
forall_and
null
exists_or : (∃ x, p x ∨ q x) ↔ (∃ x, p x) ∨ ∃ x, q x := ⟨fun | ⟨x, .inl h⟩ => .inl ⟨x, h⟩ | ⟨x, .inr h⟩ => .inr ⟨x, h⟩, fun | .inl ⟨x, h⟩ => ⟨x, .inl h⟩ | .inr ⟨x, h⟩ => ⟨x, .inr h⟩⟩ @[simp] theorem exists_false : ¬(∃ _a : α, False) := fun ⟨_, h⟩ => h @[simp] theorem forall_const (α : Sort _) [i : Nonempty α] : ...
theorem
Init.PropLemmas
[ "Init.NotationExtra" ]
Init/PropLemmas.lean
exists_or
null
Exists.nonempty : (∃ x, p x) → Nonempty α | ⟨x, _⟩ => ⟨x⟩
theorem
Init.PropLemmas
[ "Init.NotationExtra" ]
Init/PropLemmas.lean
Exists.nonempty
null
not_forall_of_exists_not {p : α → Prop} : (∃ x, ¬p x) → ¬∀ x, p x | ⟨x, hn⟩, h => hn (h x) @[simp] theorem forall_eq {p : α → Prop} {a' : α} : (∀ a, a = a' → p a) ↔ p a' := ⟨fun h => h a' rfl, fun h _ e => e.symm ▸ h⟩ @[simp] theorem forall_eq' {a' : α} : (∀ a, a' = a → p a) ↔ p a' := by simp [@eq_comm _ a'] @[s...
theorem
Init.PropLemmas
[ "Init.NotationExtra" ]
Init/PropLemmas.lean
not_forall_of_exists_not
null
exists_prop' {p : Prop} : (∃ _ : α, p) ↔ Nonempty α ∧ p := ⟨fun ⟨a, h⟩ => ⟨⟨a⟩, h⟩, fun ⟨⟨a⟩, h⟩ => ⟨a, h⟩⟩ @[simp] theorem exists_prop : (∃ _h : a, b) ↔ a ∧ b := ⟨fun ⟨hp, hq⟩ => ⟨hp, hq⟩, fun ⟨hp, hq⟩ => ⟨hp, hq⟩⟩ @[simp] theorem exists_idem {P : Prop} (f : P → P → Sort _) : (∃ (p₁ : P), ∃ (p₂ : P), f p₁ p₂...
theorem
Init.PropLemmas
[ "Init.NotationExtra" ]
Init/PropLemmas.lean
exists_prop'
null
forall_prop_of_true {p : Prop} {q : p → Prop} (h : p) : (∀ h' : p, q h') ↔ q h := @forall_const (q h) p ⟨h⟩
theorem
Init.PropLemmas
[ "Init.NotationExtra" ]
Init/PropLemmas.lean
forall_prop_of_true
null
forall_comm {p : α → β → Prop} : (∀ a b, p a b) ↔ (∀ b a, p a b) := ⟨fun h b a => h a b, fun h a b => h b a⟩
theorem
Init.PropLemmas
[ "Init.NotationExtra" ]
Init/PropLemmas.lean
forall_comm
null
exists_comm {p : α → β → Prop} : (∃ a b, p a b) ↔ (∃ b a, p a b) := ⟨fun ⟨a, b, h⟩ => ⟨b, a, h⟩, fun ⟨b, a, h⟩ => ⟨a, b, h⟩⟩ @[simp] theorem forall_apply_eq_imp_iff {f : α → β} {p : β → Prop} : (∀ b a, f a = b → p b) ↔ ∀ a, p (f a) := by simp [forall_comm] @[simp] theorem forall_eq_apply_imp_iff {f : α → β} {p ...
theorem
Init.PropLemmas
[ "Init.NotationExtra" ]
Init/PropLemmas.lean
exists_comm
null
forall_prop_of_false {p : Prop} {q : p → Prop} (hn : ¬p) : (∀ h' : p, q h') ↔ True := iff_true_intro fun h => hn.elim h @[simp] theorem and_exists_self (P : Prop) (Q : P → Prop) : (P ∧ ∃ p, Q p) ↔ ∃ p, Q p := ⟨fun ⟨_, h⟩ => h, fun ⟨p, q⟩ => ⟨p, ⟨p, q⟩⟩⟩ @[simp] theorem exists_and_self (P : Prop) (Q : P → Prop) : ...
theorem
Init.PropLemmas
[ "Init.NotationExtra" ]
Init/PropLemmas.lean
forall_prop_of_false
null
ne_of_mem_of_not_mem (h : a ∈ s) : b ∉ s → a ≠ b := mt fun e => e ▸ h
theorem
Init.PropLemmas
[ "Init.NotationExtra" ]
Init/PropLemmas.lean
ne_of_mem_of_not_mem
null
ne_of_mem_of_not_mem' (h : a ∈ s) : a ∉ t → s ≠ t := mt fun e => e ▸ h
theorem
Init.PropLemmas
[ "Init.NotationExtra" ]
Init/PropLemmas.lean
ne_of_mem_of_not_mem'
null
@[simp] nonempty_prop {p : Prop} : Nonempty p ↔ p := ⟨fun ⟨h⟩ => h, fun h => ⟨h⟩⟩ /-! ## decidable -/ @[simp] theorem Decidable.not_not [Decidable p] : ¬¬p ↔ p := ⟨of_not_not, not_not_intro⟩
theorem
Init.PropLemmas
[ "Init.NotationExtra" ]
Init/PropLemmas.lean
nonempty_prop
null
Decidable.or_not_self := em
abbrev
Init.PropLemmas
[ "Init.NotationExtra" ]
Init/PropLemmas.lean
Decidable.or_not_self
Excluded middle. Added as alias for Decidable.em
Decidable.not_or_self (p : Prop) [h : Decidable p] : ¬p ∨ p := by cases h <;> simp [*]
theorem
Init.PropLemmas
[ "Init.NotationExtra" ]
Init/PropLemmas.lean
Decidable.not_or_self
Excluded middle commuted. Added as alias for Decidable.em
Decidable.by_contra [Decidable p] : (¬p → False) → p := of_not_not
theorem
Init.PropLemmas
[ "Init.NotationExtra" ]
Init/PropLemmas.lean
Decidable.by_contra
null
@[expose] protected Or.by_cases [Decidable p] {α : Sort u} (h : p ∨ q) (h₁ : p → α) (h₂ : q → α) : α := if hp : p then h₁ hp else h₂ (h.resolve_left hp)
def
Init.PropLemmas
[ "Init.NotationExtra" ]
Init/PropLemmas.lean
Or.by_cases
Construct a non-Prop by cases on an `Or`, when the left conjunct is decidable.
@[expose] protected Or.by_cases' [Decidable q] {α : Sort u} (h : p ∨ q) (h₁ : p → α) (h₂ : q → α) : α := if hq : q then h₂ hq else h₁ (h.resolve_right hq) @[inline]
def
Init.PropLemmas
[ "Init.NotationExtra" ]
Init/PropLemmas.lean
Or.by_cases'
Construct a non-Prop by cases on an `Or`, when the right conjunct is decidable.
exists_prop_decidable {p} (P : p → Prop) [Decidable p] [∀ h, Decidable (P h)] : Decidable (∃ h, P h) := if h : p then decidable_of_decidable_of_iff ⟨fun h2 => ⟨h, h2⟩, fun ⟨_, h2⟩ => h2⟩ else isFalse fun ⟨h', _⟩ => h h' @[inline]
instance
Init.PropLemmas
[ "Init.NotationExtra" ]
Init/PropLemmas.lean
exists_prop_decidable
null
forall_prop_decidable {p} (P : p → Prop) [Decidable p] [∀ h, Decidable (P h)] : Decidable (∀ h, P h) := if h : p then decidable_of_decidable_of_iff ⟨fun h2 _ => h2, fun al => al h⟩ else isTrue fun h2 => absurd h2 h @[bool_to_prop] theorem decide_eq_true_iff {p : Prop} [Decidable p] : (decide p = true) ↔ p := by si...
instance
Init.PropLemmas
[ "Init.NotationExtra" ]
Init/PropLemmas.lean
forall_prop_decidable
null
Decidable.of_not_imp [Decidable a] (h : ¬(a → b)) : a := byContradiction (not_not_of_not_imp h)
theorem
Init.PropLemmas
[ "Init.NotationExtra" ]
Init/PropLemmas.lean
Decidable.of_not_imp
null
Decidable.not_imp_symm [Decidable a] (h : ¬a → b) (hb : ¬b) : a := byContradiction <| hb ∘ h
theorem
Init.PropLemmas
[ "Init.NotationExtra" ]
Init/PropLemmas.lean
Decidable.not_imp_symm
null
Decidable.not_imp_comm [Decidable a] [Decidable b] : (¬a → b) ↔ (¬b → a) := ⟨not_imp_symm, not_imp_symm⟩
theorem
Init.PropLemmas
[ "Init.NotationExtra" ]
Init/PropLemmas.lean
Decidable.not_imp_comm
null
Decidable.not_imp_self [Decidable a] : (¬a → a) ↔ a := by have := @imp_not_self (¬a); rwa [not_not] at this
theorem
Init.PropLemmas
[ "Init.NotationExtra" ]
Init/PropLemmas.lean
Decidable.not_imp_self
null
Decidable.or_iff_not_imp_left [Decidable a] : a ∨ b ↔ (¬a → b) := ⟨Or.resolve_left, fun h => dite _ .inl (.inr ∘ h)⟩
theorem
Init.PropLemmas
[ "Init.NotationExtra" ]
Init/PropLemmas.lean
Decidable.or_iff_not_imp_left
null
Decidable.or_iff_not_imp_right [Decidable b] : a ∨ b ↔ (¬b → a) := or_comm.trans or_iff_not_imp_left
theorem
Init.PropLemmas
[ "Init.NotationExtra" ]
Init/PropLemmas.lean
Decidable.or_iff_not_imp_right
null
Decidable.not_imp_not [Decidable a] : (¬a → ¬b) ↔ (b → a) := ⟨fun h hb => byContradiction (h · hb), mt⟩
theorem
Init.PropLemmas
[ "Init.NotationExtra" ]
Init/PropLemmas.lean
Decidable.not_imp_not
null
Decidable.not_or_of_imp [Decidable a] (h : a → b) : ¬a ∨ b := if ha : a then .inr (h ha) else .inl ha
theorem
Init.PropLemmas
[ "Init.NotationExtra" ]
Init/PropLemmas.lean
Decidable.not_or_of_imp
null
Decidable.imp_iff_not_or [Decidable a] : (a → b) ↔ (¬a ∨ b) := ⟨not_or_of_imp, Or.neg_resolve_left⟩
theorem
Init.PropLemmas
[ "Init.NotationExtra" ]
Init/PropLemmas.lean
Decidable.imp_iff_not_or
null
Decidable.imp_iff_or_not [Decidable b] : b → a ↔ a ∨ ¬b := Decidable.imp_iff_not_or.trans or_comm
theorem
Init.PropLemmas
[ "Init.NotationExtra" ]
Init/PropLemmas.lean
Decidable.imp_iff_or_not
null
Decidable.imp_or [Decidable a] : (a → b ∨ c) ↔ (a → b) ∨ (a → c) := if h : a then by rw [imp_iff_right h, imp_iff_right h, imp_iff_right h] else by rw [iff_false_intro h, false_imp_iff, false_imp_iff, true_or]
theorem
Init.PropLemmas
[ "Init.NotationExtra" ]
Init/PropLemmas.lean
Decidable.imp_or
null
Decidable.imp_or' [Decidable b] : (a → b ∨ c) ↔ (a → b) ∨ (a → c) := if h : b then by simp [h] else by rw [eq_false h, false_or]; exact (or_iff_right_of_imp fun hx x => (hx x).elim).symm
theorem
Init.PropLemmas
[ "Init.NotationExtra" ]
Init/PropLemmas.lean
Decidable.imp_or'
null
Decidable.not_imp_iff_and_not [Decidable a] : ¬(a → b) ↔ a ∧ ¬b := ⟨fun h => ⟨of_not_imp h, not_of_not_imp h⟩, not_imp_of_and_not⟩
theorem
Init.PropLemmas
[ "Init.NotationExtra" ]
Init/PropLemmas.lean
Decidable.not_imp_iff_and_not
null
Decidable.peirce (a b : Prop) [Decidable a] : ((a → b) → a) → a := if ha : a then fun _ => ha else fun h => h ha.elim
theorem
Init.PropLemmas
[ "Init.NotationExtra" ]
Init/PropLemmas.lean
Decidable.peirce
null
peirce' {a : Prop} (H : ∀ b : Prop, (a → b) → a) : a := H _ id
theorem
Init.PropLemmas
[ "Init.NotationExtra" ]
Init/PropLemmas.lean
peirce'
null
Decidable.not_iff_not [Decidable a] [Decidable b] : (¬a ↔ ¬b) ↔ (a ↔ b) := by rw [@iff_def (¬a), @iff_def' a]; exact and_congr not_imp_not not_imp_not
theorem
Init.PropLemmas
[ "Init.NotationExtra" ]
Init/PropLemmas.lean
Decidable.not_iff_not
null
Decidable.not_iff_comm [Decidable a] [Decidable b] : (¬a ↔ b) ↔ (¬b ↔ a) := by rw [@iff_def (¬a), @iff_def (¬b)]; exact and_congr not_imp_comm imp_not_comm
theorem
Init.PropLemmas
[ "Init.NotationExtra" ]
Init/PropLemmas.lean
Decidable.not_iff_comm
null
Decidable.not_iff [Decidable b] : ¬(a ↔ b) ↔ (¬a ↔ b) := if h : b then by rw [iff_true_right h, iff_true_right h] else by rw [iff_false_right h, iff_false_right h]
theorem
Init.PropLemmas
[ "Init.NotationExtra" ]
Init/PropLemmas.lean
Decidable.not_iff
null
Decidable.iff_not_comm [Decidable a] [Decidable b] : (a ↔ ¬b) ↔ (b ↔ ¬a) := by rw [@iff_def a, @iff_def b]; exact and_congr imp_not_comm not_imp_comm
theorem
Init.PropLemmas
[ "Init.NotationExtra" ]
Init/PropLemmas.lean
Decidable.iff_not_comm
null
Decidable.iff_iff_and_or_not_and_not {a b : Prop} [Decidable b] : (a ↔ b) ↔ (a ∧ b) ∨ (¬a ∧ ¬b) := ⟨fun e => if h : b then .inl ⟨e.2 h, h⟩ else .inr ⟨mt e.1 h, h⟩, Or.rec (And.rec iff_of_true) (And.rec iff_of_false)⟩
theorem
Init.PropLemmas
[ "Init.NotationExtra" ]
Init/PropLemmas.lean
Decidable.iff_iff_and_or_not_and_not
null
Decidable.iff_iff_not_or_and_or_not [Decidable a] [Decidable b] : (a ↔ b) ↔ (¬a ∨ b) ∧ (a ∨ ¬b) := by rw [iff_iff_implies_and_implies (a := a) (b := b)]; simp only [imp_iff_not_or, Or.comm]
theorem
Init.PropLemmas
[ "Init.NotationExtra" ]
Init/PropLemmas.lean
Decidable.iff_iff_not_or_and_or_not
null
Decidable.not_and_not_right [Decidable b] : ¬(a ∧ ¬b) ↔ (a → b) := ⟨fun h ha => not_imp_symm (And.intro ha) h, fun h ⟨ha, hb⟩ => hb <| h ha⟩
theorem
Init.PropLemmas
[ "Init.NotationExtra" ]
Init/PropLemmas.lean
Decidable.not_and_not_right
null
Decidable.not_and_iff_not_or_not [Decidable a] : ¬(a ∧ b) ↔ ¬a ∨ ¬b := ⟨fun h => if ha : a then .inr (h ⟨ha, ·⟩) else .inl ha, not_and_of_not_or_not⟩
theorem
Init.PropLemmas
[ "Init.NotationExtra" ]
Init/PropLemmas.lean
Decidable.not_and_iff_not_or_not
null
Decidable.not_and_iff_not_or_not' [Decidable b] : ¬(a ∧ b) ↔ ¬a ∨ ¬b := ⟨fun h => if hb : b then .inl (h ⟨·, hb⟩) else .inr hb, not_and_of_not_or_not⟩
theorem
Init.PropLemmas
[ "Init.NotationExtra" ]
Init/PropLemmas.lean
Decidable.not_and_iff_not_or_not'
null
Decidable.or_iff_not_not_and_not [Decidable a] [Decidable b] : a ∨ b ↔ ¬(¬a ∧ ¬b) := by rw [← not_or, not_not]
theorem
Init.PropLemmas
[ "Init.NotationExtra" ]
Init/PropLemmas.lean
Decidable.or_iff_not_not_and_not
null
Decidable.and_iff_not_not_or_not [Decidable a] [Decidable b] : a ∧ b ↔ ¬(¬a ∨ ¬b) := by rw [← not_and_iff_not_or_not, not_not]
theorem
Init.PropLemmas
[ "Init.NotationExtra" ]
Init/PropLemmas.lean
Decidable.and_iff_not_not_or_not
null
Decidable.imp_iff_right_iff [Decidable a] : (a → b ↔ b) ↔ a ∨ b := Iff.intro (fun h => (Decidable.em a).imp_right fun ha' => h.mp fun ha => (ha' ha).elim) (fun ab => ab.elim imp_iff_right fun hb => iff_of_true (fun _ => hb) hb)
theorem
Init.PropLemmas
[ "Init.NotationExtra" ]
Init/PropLemmas.lean
Decidable.imp_iff_right_iff
null
Decidable.imp_iff_left_iff [Decidable a] : (b ↔ a → b) ↔ a ∨ b := propext (@Iff.comm (a → b) b) ▸ (@Decidable.imp_iff_right_iff a b _)
theorem
Init.PropLemmas
[ "Init.NotationExtra" ]
Init/PropLemmas.lean
Decidable.imp_iff_left_iff
null
Decidable.and_or_imp [Decidable a] : a ∧ b ∨ (a → c) ↔ a → b ∨ c := if ha : a then by simp only [ha, true_and, true_imp_iff] else by simp only [ha, false_or, false_and, false_imp_iff]
theorem
Init.PropLemmas
[ "Init.NotationExtra" ]
Init/PropLemmas.lean
Decidable.and_or_imp
null
Decidable.or_congr_left' [Decidable c] (h : ¬c → (a ↔ b)) : a ∨ c ↔ b ∨ c := by rw [or_iff_not_imp_right, or_iff_not_imp_right]; exact imp_congr_right h
theorem
Init.PropLemmas
[ "Init.NotationExtra" ]
Init/PropLemmas.lean
Decidable.or_congr_left'
null
Decidable.or_congr_right' [Decidable a] (h : ¬a → (b ↔ c)) : a ∨ b ↔ a ∨ c := by rw [or_iff_not_imp_left, or_iff_not_imp_left]; exact imp_congr_right h @[simp] theorem Decidable.iff_congr_left {P Q R : Prop} [Decidable P] [Decidable Q] [Decidable R] : ((P ↔ R) ↔ (Q ↔ R)) ↔ (P ↔ Q) := if h : R then by simp_all ...
theorem
Init.PropLemmas
[ "Init.NotationExtra" ]
Init/PropLemmas.lean
Decidable.or_congr_right'
null
@[inline, expose] decidable_of_iff (a : Prop) (h : a ↔ b) [Decidable a] : Decidable b := decidable_of_decidable_of_iff h
def
Init.PropLemmas
[ "Init.NotationExtra" ]
Init/PropLemmas.lean
decidable_of_iff
Transfer decidability of `a` to decidability of `b`, if the propositions are equivalent. **Important**: this function should be used instead of `rw` on `Decidable b`, because the kernel will get stuck reducing the usage of `propext` otherwise, and `decide` will not work.
@[inline, expose] decidable_of_iff' (b : Prop) (h : a ↔ b) [Decidable b] : Decidable a := decidable_of_decidable_of_iff h.symm
def
Init.PropLemmas
[ "Init.NotationExtra" ]
Init/PropLemmas.lean
decidable_of_iff'
Transfer decidability of `b` to decidability of `a`, if the propositions are equivalent. This is the same as `decidable_of_iff` but the iff is flipped.
Decidable.predToBool (p : α → Prop) [DecidablePred p] : CoeDep (α → Prop) p (α → Bool) := ⟨fun b => decide <| p b⟩
instance
Init.PropLemmas
[ "Init.NotationExtra" ]
Init/PropLemmas.lean
Decidable.predToBool
null
@[expose] decidable_of_bool : ∀ (b : Bool), (b ↔ a) → Decidable a | true, h => isTrue (h.1 rfl) | false, h => isFalse (mt h.2 Bool.noConfusion)
def
Init.PropLemmas
[ "Init.NotationExtra" ]
Init/PropLemmas.lean
decidable_of_bool
Prove that `a` is decidable by constructing a boolean `b` and a proof that `b ↔ a`. (This is sometimes taken as an alternate definition of decidability.)
protected Decidable.not_forall {p : α → Prop} [Decidable (∃ x, ¬p x)] [∀ x, Decidable (p x)] : (¬∀ x, p x) ↔ ∃ x, ¬p x := ⟨Decidable.not_imp_symm fun nx x => Decidable.not_imp_symm (fun h => ⟨x, h⟩) nx, not_forall_of_exists_not⟩
theorem
Init.PropLemmas
[ "Init.NotationExtra" ]
Init/PropLemmas.lean
Decidable.not_forall
null
protected Decidable.not_forall_not {p : α → Prop} [Decidable (∃ x, p x)] : (¬∀ x, ¬p x) ↔ ∃ x, p x := (@Decidable.not_iff_comm _ _ _ (decidable_of_iff (¬∃ x, p x) not_exists)).1 not_exists
theorem
Init.PropLemmas
[ "Init.NotationExtra" ]
Init/PropLemmas.lean
Decidable.not_forall_not
null
protected Decidable.not_exists_not {p : α → Prop} [∀ x, Decidable (p x)] : (¬∃ x, ¬p x) ↔ ∀ x, p x := by simp only [not_exists, Decidable.not_not] export Decidable (not_imp_self) /- `decide_implies` simp justification. We have a critical pair from `decide (¬(p ∧ q))`: 1. `decide (p → ¬q)` via `not_and` 2. `...
theorem
Init.PropLemmas
[ "Init.NotationExtra" ]
Init/PropLemmas.lean
Decidable.not_exists_not
null
decide_implies (u v : Prop) [duv : Decidable (u → v)] [du : Decidable u] {dv : u → Decidable v} : decide (u → v) = dite u (fun h => @decide v (dv h)) (fun _ => true) := if h : u then by simp [h] else by simp [h] /- `decide_ite` is needed to resolve critical pair with We have a critical pair from `de...
theorem
Init.PropLemmas
[ "Init.NotationExtra" ]
Init/PropLemmas.lean
decide_implies
null
decide_ite (u : Prop) [du : Decidable u] (p q : Prop) [dpq : Decidable (ite u p q)] [dp : Decidable p] [dq : Decidable q] : decide (ite u p q) = ite u (decide p) (decide q) := by cases du <;> simp [*] /- Confluence for `ite_then_self` and `decide_ite`. -/ @[simp] theorem ite_then_decide_self (p : Prop) [h ...
theorem
Init.PropLemmas
[ "Init.NotationExtra" ]
Init/PropLemmas.lean
decide_ite
null
Object : Type := NonScalar
abbrev
Init.ShareCommon
[ "Init.Data.UInt.Basic" ]
Init/ShareCommon.lean
Object
null
unsafe Object.ptrEq (a b : Object) : Bool := ptrAddrUnsafe a == ptrAddrUnsafe b
def
Init.ShareCommon
[ "Init.Data.UInt.Basic" ]
Init/ShareCommon.lean
Object.ptrEq
null
unsafe Object.ptrHash (a : Object) : UInt64 := ptrAddrUnsafe a |>.toUInt64
abbrev
Init.ShareCommon
[ "Init.Data.UInt.Basic" ]
Init/ShareCommon.lean
Object.ptrHash
null
StateFactoryImpl where (Map Set : Type) mkState : Unit → Map × Set mapFind? (m : Map) (k : Object) : Option Object mapInsert (m : Map) (k v : Object) : Map setFind? (m : Set) (k : Object) : Option Object setInsert (m : Set) (o : Object) : Set
structure
Init.ShareCommon
[ "Init.Data.UInt.Basic" ]
Init/ShareCommon.lean
StateFactoryImpl
null
StateFactoryPointed : NonemptyType
opaque
Init.ShareCommon
[ "Init.Data.UInt.Basic" ]
Init/ShareCommon.lean
StateFactoryPointed
null
StateFactory : Type := StateFactoryPointed.type
abbrev
Init.ShareCommon
[ "Init.Data.UInt.Basic" ]
Init/ShareCommon.lean
StateFactory
null
@[extern "lean_sharecommon_eq"] unsafe Object.eq (a b : @& Object) : Bool @[extern "lean_sharecommon_hash"]
opaque
Init.ShareCommon
[ "Init.Data.UInt.Basic" ]
Init/ShareCommon.lean
Object.eq
null
unsafe Object.hash (a : @& Object) : UInt64
opaque
Init.ShareCommon
[ "Init.Data.UInt.Basic" ]
Init/ShareCommon.lean
Object.hash
null
StateFactoryBuilder where Map (α _β : Type) [BEq α] [Hashable α] : Type mkMap {α β : Type} [BEq α] [Hashable α] (capacity : Nat) : Map α β mapFind? {α β : Type} [BEq α] [Hashable α] : Map α β → α → Option β mapInsert {α β : Type} [BEq α] [Hashable α] : Map α β → α → β → Map α β Set (α : Type) [BEq α] [Hashabl...
structure
Init.ShareCommon
[ "Init.Data.UInt.Basic" ]
Init/ShareCommon.lean
StateFactoryBuilder
null
unsafe StateFactory.mkImpl : StateFactoryBuilder → StateFactory | { Map, mkMap, mapFind?, mapInsert, Set, mkSet, setFind?, setInsert } => unsafeCast { Map := @Map Object Object ⟨Object.ptrEq⟩ ⟨Object.ptrHash⟩ Set := @Set Object ⟨Object.eq⟩ ⟨Object.hash⟩ mkState := fun _ => ( @mkMap Objec...
def
Init.ShareCommon
[ "Init.Data.UInt.Basic" ]
Init/ShareCommon.lean
StateFactory.mkImpl
null
StateFactory.mk : StateFactoryBuilder → StateFactory
opaque
Init.ShareCommon
[ "Init.Data.UInt.Basic" ]
Init/ShareCommon.lean
StateFactory.mk
null
unsafe StateFactory.get : StateFactory → StateFactoryImpl := unsafeCast
def
Init.ShareCommon
[ "Init.Data.UInt.Basic" ]
Init/ShareCommon.lean
StateFactory.get
null
StatePointed (σ : StateFactory) : NonemptyType
opaque
Init.ShareCommon
[ "Init.Data.UInt.Basic" ]
Init/ShareCommon.lean
StatePointed
Internally `State` is implemented as a pair `ObjectMap` and `ObjectSet`
State (σ : StateFactory) : Type u := (StatePointed σ).type
abbrev
Init.ShareCommon
[ "Init.Data.UInt.Basic" ]
Init/ShareCommon.lean
State
null
unsafe mkStateImpl (σ : StateFactory) : State σ := unsafeCast (σ.get.mkState ()) @[implemented_by mkStateImpl] opaque State.mk (σ : StateFactory) : State σ
def
Init.ShareCommon
[ "Init.Data.UInt.Basic" ]
Init/ShareCommon.lean
mkStateImpl
null
@[extern "lean_state_sharecommon"] State.shareCommon {σ : @& StateFactory} (s : State σ) (a : α) : α × State σ := (a, s)
def
Init.ShareCommon
[ "Init.Data.UInt.Basic" ]
Init/ShareCommon.lean
State.shareCommon
null
MonadShareCommon (m : Type u → Type v) where withShareCommon {α : Type u} : α → m α
class
Init.ShareCommon
[ "Init.Data.UInt.Basic" ]
Init/ShareCommon.lean
MonadShareCommon
null
withShareCommon := @MonadShareCommon.withShareCommon
abbrev
Init.ShareCommon
[ "Init.Data.UInt.Basic" ]
Init/ShareCommon.lean
withShareCommon
null
shareCommonM [MonadShareCommon m] (a : α) : m α := withShareCommon a
abbrev
Init.ShareCommon
[ "Init.Data.UInt.Basic" ]
Init/ShareCommon.lean
shareCommonM
null
ShareCommonT (σ) (m : Type u → Type v) := StateT (ShareCommon.State σ) m
abbrev
Init.ShareCommon
[ "Init.Data.UInt.Basic" ]
Init/ShareCommon.lean
ShareCommonT
null
ShareCommonM (σ) := ShareCommonT σ Id @[specialize] def ShareCommonT.withShareCommon [Monad m] (a : α) : ShareCommonT σ m α := modifyGet fun s => s.shareCommon a
abbrev
Init.ShareCommon
[ "Init.Data.UInt.Basic" ]
Init/ShareCommon.lean
ShareCommonM
null
ShareCommonT.monadShareCommon [Monad m] : MonadShareCommon (ShareCommonT σ m) where withShareCommon := ShareCommonT.withShareCommon @[inline] def ShareCommonT.run [Monad m] (x : ShareCommonT σ m α) : m α := x.run' default @[inline] def ShareCommonM.run (x : ShareCommonM σ α) : α := ShareCommonT.run x
instance
Init.ShareCommon
[ "Init.Data.UInt.Basic" ]
Init/ShareCommon.lean
ShareCommonT.monadShareCommon
null
@[extern "lean_sharecommon_quick"] ShareCommon.shareCommon' (a : @& α) : α := a
def
Init.ShareCommon
[ "Init.Data.UInt.Basic" ]
Init/ShareCommon.lean
ShareCommon.shareCommon'
A more restrictive but efficient max sharing primitive. Remark: it optimizes the number of RC operations, and the strategy for caching results.
of_eq_true (h : p = True) : p := h ▸ trivial
theorem
Init.SimpLemmas
[ "Init.Core" ]
Init/SimpLemmas.lean
of_eq_true
null