formal stringlengths 41 427k | informal stringclasses 1
value |
|---|---|
Option.guard_eq_some ** α✝ : Type u_1 p : α✝ → Prop a b : α✝ inst✝ : DecidablePred p ⊢ guard p a = some b ↔ a = b ∧ p a ** by_cases h : p a <;> simp [Option.guard, h] ** Qed | |
Option.liftOrGet_eq_or_eq ** α : Type u_1 f : α → α → α h : ∀ (a b : α), f a b = a ∨ f a b = b a b : α ⊢ liftOrGet f (some a) (some b) = some a ∨ liftOrGet f (some a) (some b) = some b ** have := h a b ** α : Type u_1 f : α → α → α h : ∀ (a b : α), f a b = a ∨ f a b = b a b : α this : f a b = a ∨ f a b = b ⊢ liftOrGet ... | |
Option.liftOrGet_none_left ** α : Type u_1 f : α → α → α b : Option α ⊢ liftOrGet f none b = b ** cases b <;> rfl ** Qed | |
Option.liftOrGet_none_right ** α : Type u_1 f : α → α → α a : Option α ⊢ liftOrGet f a none = a ** cases a <;> rfl ** Qed | |
Option.getD_map ** α : Type u_1 β : Type u_2 f : α → β x : α o : Option α ⊢ getD (Option.map f o) (f x) = f (getD o x) ** cases o <;> rfl ** Qed | |
Option.choice_eq ** α : Type u_1 inst✝ : Subsingleton α a : α ⊢ choice α = some a ** simp [choice] ** α : Type u_1 inst✝ : Subsingleton α a : α ⊢ (if h : Nonempty α then some (Classical.choice h) else none) = some a ** rw [dif_pos (⟨a⟩ : Nonempty α)] ** α : Type u_1 inst✝ : Subsingleton α a : α ⊢ some (Classical.choice... | |
Option.choice_isSome_iff_nonempty ** α : Type u_1 h : Nonempty α ⊢ isSome (choice α) = true ** simp only [choice, dif_pos h, isSome_some] ** Qed | |
Std.HashMap.Imp.WF.empty ** α : Type u_1 β : Type u_2 n : Nat inst✝¹ : BEq α inst✝ : Hashable α ⊢ WF (Imp.empty n) ** unfold empty ** α : Type u_1 β : Type u_2 n : Nat inst✝¹ : BEq α inst✝ : Hashable α ⊢ WF (let nbuckets := numBucketsForCapacity n; let n_1 := if h : nbuckets = 0 then { val := 8, property ... | |
Array.size_toArray ** α : Type u_1 as : List α ⊢ size (List.toArray as) = List.length as ** simp [size] ** Qed | |
Array.size_mk ** α : Type u_1 as : List α ⊢ size { data := as } = List.length as ** simp [size] ** Qed | |
Array.getElem_eq_data_get ** α : Type u_1 i : Nat a : Array α h : i < size a ⊢ a[i] = List.get a.data { val := i, isLt := h } ** by_cases i < a.size <;> (try simp [*]) <;> rfl ** Qed | |
Array.foldlM_eq_foldlM_data.aux ** m : Type u_1 → Type u_2 β : Type u_1 α : Type u_3 inst✝ : Monad m f : β → α → m β arr : Array α i j : Nat H : size arr ≤ i + j b : β ⊢ foldlM.loop f arr (size arr) (_ : size arr ≤ size arr) i j b = List.foldlM f b (List.drop j arr.data) ** unfold foldlM.loop ** m : Type u_1 → Type u_2... | |
Array.foldrM_eq_foldrM_data ** m : Type u_1 → Type u_2 α : Type u_3 β : Type u_1 inst✝ : Monad m f : α → β → m β init : β arr : Array α ⊢ foldrM f init arr (size arr) = List.foldrM f init arr.data ** rw [foldrM_eq_reverse_foldlM_data, List.foldlM_reverse] ** Qed | |
Array.push_data ** α : Type u_1 arr : Array α a : α ⊢ (push arr a).data = arr.data ++ [a] ** simp [push, List.concat_eq_append] ** Qed | |
Array.foldrM_push ** m : Type u_1 → Type u_2 α : Type u_3 β : Type u_1 inst✝ : Monad m f : α → β → m β init : β arr : Array α a : α ⊢ foldrM f init (push arr a) (size (push arr a)) = do let init ← f a init foldrM f init arr (size arr) ** simp [foldrM_eq_reverse_foldlM_data, -size_push] ** Qed | |
Array.foldrM_push' ** m : Type u_1 → Type u_2 α : Type u_3 β : Type u_1 inst✝ : Monad m f : α → β → m β init : β arr : Array α a : α ⊢ foldrM f init (push arr a) (size arr + 1) = do let init ← f a init foldrM f init arr (size arr) ** simp [← foldrM_push] ** Qed | |
Array.toList_eq ** α : Type u_1 arr : Array α ⊢ toList arr = arr.data ** simp [toList, foldr_eq_foldr_data] ** Qed | |
Array.SatisfiesM_foldlM ** m : Type u_1 → Type u_2 α : Type u_3 β : Type u_1 inst✝¹ : Monad m inst✝ : LawfulMonad m as : Array α motive : Nat → β → Prop init : β h0 : motive 0 init f : β → α → m β hf : ∀ (i : Fin (size as)) (b : β), motive i.val b → SatisfiesM (motive (i.val + 1)) (f b as[i]) ⊢ SatisfiesM (motive (size... | |
Array.foldl_induction ** α : Type u_1 β : Type u_2 as : Array α motive : Nat → β → Prop init : β h0 : motive 0 init f : β → α → β hf : ∀ (i : Fin (size as)) (b : β), motive i.val b → motive (i.val + 1) (f b as[i]) ⊢ motive (size as) (foldl f init as 0 (size as)) ** have := SatisfiesM_foldlM (m := Id) (as := as) (f := f... | |
Array.get_push_eq ** α : Type u_1 a : Array α x : α ⊢ (push a x)[size a] = x ** simp only [push, getElem_eq_data_get, List.concat_eq_append] ** α : Type u_1 a : Array α x : α ⊢ List.get (a.data ++ [x]) { val := size a, isLt := (_ : (fun xs i => i < size xs) { data := a.data ++ [x] } (size a)) } = x ** rw [Lis... | |
Array.get_push ** α : Type u_1 a : Array α x : α i : Nat h : i < size (push a x) ⊢ (push a x)[i] = if h : i < size a then a[i] else x ** if h' : i < a.size then
simp [get_push_lt, h']
else
simp at h
simp [get_push_lt, Nat.le_antisymm (Nat.le_of_lt_succ h) (Nat.ge_of_not_lt h')] ** α : Type u_1 a : Array α x : α i... | |
Array.mapM_eq_foldlM ** m : Type u_1 → Type u_2 α : Type u_3 β : Type u_1 inst✝¹ : Monad m inst✝ : LawfulMonad m f : α → m β arr : Array α ⊢ mapM f arr = foldlM (fun bs a => push bs <$> f a) #[] arr 0 (size arr) ** rw [mapM, aux, foldlM_eq_foldlM_data] ** m : Type u_1 → Type u_2 α : Type u_3 β : Type u_1 inst✝¹ : Monad... | |
Array.size_map ** α : Type u_1 β : Type u_2 f : α → β arr : Array α ⊢ size (map f arr) = size arr ** simp [size] ** Qed | |
Array.getElem_map ** α : Type u_1 β : Type u_2 f : α → β arr : Array α i : Nat h : i < size (map f arr) ⊢ (map f arr)[i] = f arr[i] ** have := SatisfiesM_mapM' (m := Id) arr f (fun i b => b = f (arr[i])) ** α : Type u_1 β : Type u_2 f : α → β arr : Array α i : Nat h : i < size (map f arr) this : (∀ (i : Fin (size arr... | |
Array.foldl_data_eq_bind ** α : Type u_1 β : Type u_2 l : List α acc : Array β F : Array β → α → Array β G : α → List β H : ∀ (acc : Array β) (a : α), (F acc a).data = acc.data ++ G a ⊢ (List.foldl F acc l).data = acc.data ++ List.bind l G ** induction l generalizing acc <;> simp [*, List.bind] ** Qed | |
Array.foldl_data_eq_map ** α : Type u_1 β : Type u_2 l : List α acc : Array β G : α → β ⊢ (List.foldl (fun acc a => push acc (G a)) acc l).data = acc.data ++ List.map G l ** induction l generalizing acc <;> simp [*] ** Qed | |
List.countP_go_eq_add ** α : Type u_1 p q : α → Bool n : Nat l : List α ⊢ countP.go p l n = n + countP.go p l 0 ** induction l generalizing n with
| nil => rfl
| cons head tail ih =>
unfold countP.go
rw [ih (n := n + 1), ih (n := n), ih (n := 1)]
if h : p head then simp [h, Nat.add_assoc] else simp [h] ** case ni... | |
List.countP_cons_of_neg ** α : Type u_1 p q : α → Bool a : α l : List α pa : ¬p a = true ⊢ countP p (a :: l) = countP p l ** simp [countP, countP.go, pa] ** Qed | |
List.countP_cons ** α : Type u_1 p q : α → Bool a : α l : List α ⊢ countP p (a :: l) = countP p l + if p a = true then 1 else 0 ** by_cases h : p a <;> simp [h] ** Qed | |
List.length_eq_countP_add_countP ** case nil α : Type u_1 p q : α → Bool ⊢ length [] = countP p [] + countP (fun a => decide ¬p a = true) [] ** rfl ** α : Type u_1 p q : α → Bool x : α h✝ : List α ih : length h✝ = countP p h✝ + countP (fun a => decide ¬p a = true) h✝ h : p x = true ⊢ length (x :: h✝) = countP p (x :: h... | |
List.countP_eq_length_filter ** α : Type u_1 p q : α → Bool l : List α ⊢ countP p l = length (filter p l) ** induction l with
| nil => rfl
| cons x l ih =>
if h : p x
then rw [countP_cons_of_pos p l h, ih, filter_cons_of_pos l h, length]
else rw [countP_cons_of_neg p l h, ih, filter_cons_of_neg l h] ** case nil α... | |
List.countP_le_length ** α : Type u_1 p q : α → Bool l : List α ⊢ countP p l ≤ length l ** simp only [countP_eq_length_filter] ** α : Type u_1 p q : α → Bool l : List α ⊢ length (filter p l) ≤ length l ** apply length_filter_le ** Qed | |
List.countP_append ** α : Type u_1 p q : α → Bool l₁ l₂ : List α ⊢ countP p (l₁ ++ l₂) = countP p l₁ + countP p l₂ ** simp only [countP_eq_length_filter, filter_append, length_append] ** Qed | |
List.countP_pos ** α : Type u_1 p q : α → Bool l : List α ⊢ 0 < countP p l ↔ ∃ a, a ∈ l ∧ p a = true ** simp only [countP_eq_length_filter, length_pos_iff_exists_mem, mem_filter, exists_prop] ** Qed | |
List.countP_eq_zero ** α : Type u_1 p q : α → Bool l : List α ⊢ countP p l = 0 ↔ ∀ (a : α), a ∈ l → ¬p a = true ** simp only [countP_eq_length_filter, length_eq_zero, filter_eq_nil] ** Qed | |
List.Sublist.countP_le ** α : Type u_1 p q : α → Bool l₁ l₂ : List α s : l₁ <+ l₂ ⊢ countP p l₁ ≤ countP p l₂ ** simp only [countP_eq_length_filter] ** α : Type u_1 p q : α → Bool l₁ l₂ : List α s : l₁ <+ l₂ ⊢ length (List.filter p l₁) ≤ length (List.filter p l₂) ** apply s.filter _ |>.length_le ** Qed | |
List.countP_filter ** α : Type u_1 p q : α → Bool l : List α ⊢ countP p (filter q l) = countP (fun a => decide (p a = true ∧ q a = true)) l ** simp only [countP_eq_length_filter, filter_filter] ** Qed | |
List.countP_true ** α : Type u_1 p q : α → Bool l : List α ⊢ countP (fun x => true) l = length l ** rw [countP_eq_length] ** α : Type u_1 p q : α → Bool l : List α ⊢ ∀ (a : α), a ∈ l → true = true ** simp ** Qed | |
List.countP_false ** α : Type u_1 p q : α → Bool l : List α ⊢ countP (fun x => false) l = 0 ** rw [countP_eq_zero] ** α : Type u_1 p q : α → Bool l : List α ⊢ ∀ (a : α), a ∈ l → ¬false = true ** simp ** Qed | |
List.countP_map ** α : Type u_2 p✝ q : α → Bool β : Type u_1 p : β → Bool f : α → β a : α l : List α ⊢ countP p (map f (a :: l)) = countP (p ∘ f) (a :: l) ** rw [map_cons, countP_cons, countP_cons, countP_map p f l] ** α : Type u_2 p✝ q : α → Bool β : Type u_1 p : β → Bool f : α → β a : α l : List α ⊢ (countP (p ∘ f) l... | |
List.countP_mono_left ** α : Type u_1 p q : α → Bool l : List α h : ∀ (x : α), x ∈ l → p x = true → q x = true ⊢ countP p l ≤ countP q l ** induction l with
| nil => apply Nat.le_refl
| cons a l ihl =>
rw [forall_mem_cons] at h
have ⟨ha, hl⟩ := h
simp [countP_cons]
cases h : p a
. simp
apply Nat.le_trans ... | |
List.count_cons ** α : Type u_1 inst✝ : DecidableEq α a b : α l : List α ⊢ count a (b :: l) = count a l + if a = b then 1 else 0 ** simp [count, countP_cons, eq_comm (a := a)] ** Qed | |
List.count_cons_self ** α : Type u_1 inst✝ : DecidableEq α a : α l : List α ⊢ count a (a :: l) = count a l + 1 ** simp [count_cons] ** Qed | |
List.count_cons_of_ne ** α : Type u_1 inst✝ : DecidableEq α a b : α h : a ≠ b l : List α ⊢ count a (b :: l) = count a l ** simp [count_cons, h] ** Qed | |
List.count_tail ** α : Type u_1 inst✝ : DecidableEq α head : α tail : List α a : α h : 0 < length (head :: tail) ⊢ count a (List.tail (head :: tail)) = count a (head :: tail) - if a = get (head :: tail) { val := 0, isLt := h } then 1 else 0 ** simp [count_cons] ** Qed | |
List.count_singleton ** α : Type u_1 inst✝ : DecidableEq α a : α ⊢ count a [a] = 1 ** simp ** Qed | |
List.count_singleton' ** α : Type u_1 inst✝ : DecidableEq α a b : α ⊢ count a [b] = if a = b then 1 else 0 ** simp [count_cons] ** Qed | |
List.count_concat ** α : Type u_1 inst✝ : DecidableEq α a : α l : List α ⊢ count a (concat l a) = succ (count a l) ** simp ** Qed | |
List.count_pos_iff_mem ** α : Type u_1 inst✝ : DecidableEq α a : α l : List α ⊢ 0 < count a l ↔ a ∈ l ** simp only [count, countP_pos, beq_iff_eq, exists_eq_right] ** Qed | |
List.count_eq_length ** α : Type u_1 inst✝ : DecidableEq α a : α l : List α ⊢ count a l = length l ↔ ∀ (b : α), b ∈ l → a = b ** rw [count, countP_eq_length] ** α : Type u_1 inst✝ : DecidableEq α a : α l : List α ⊢ (∀ (a_1 : α), a_1 ∈ l → (a_1 == a) = true) ↔ ∀ (b : α), b ∈ l → a = b ** refine ⟨fun h b hb => Eq.symm ?_... | |
List.count_replicate ** α : Type u_1 inst✝ : DecidableEq α a b : α n : Nat ⊢ count a (replicate n b) = if a = b then n else 0 ** split ** case inl α : Type u_1 inst✝ : DecidableEq α a b : α n : Nat h✝ : a = b ⊢ count a (replicate n b) = n case inr α : Type u_1 inst✝ : DecidableEq α a b : α n : Nat h✝ : ¬a = b ⊢ count ... | |
List.filter_beq' ** α : Type u_1 inst✝ : DecidableEq α l : List α a : α ⊢ filter (fun x => x == a) l = replicate (count a l) a ** simp only [count, countP_eq_length_filter, eq_replicate, mem_filter, beq_iff_eq] ** α : Type u_1 inst✝ : DecidableEq α l : List α a : α ⊢ True ∧ ∀ (b : α), b ∈ l ∧ b = a → b = a ** exact ⟨tr... | |
List.filter_eq ** α : Type u_1 inst✝ : DecidableEq α l : List α a : α ⊢ filter (fun x => decide (a = x)) l = replicate (count a l) a ** simpa only [eq_comm] using filter_eq' l a ** Qed | |
List.le_count_iff_replicate_sublist ** α : Type u_1 inst✝ : DecidableEq α n : Nat a : α l : List α ⊢ n ≤ count a l ↔ replicate n a <+ l ** refine ⟨fun h => ?_, fun h => ?_⟩ ** case refine_1 α : Type u_1 inst✝ : DecidableEq α n : Nat a : α l : List α h : n ≤ count a l ⊢ replicate n a <+ l ** exact ((replicate_sublist_re... | |
List.count_le_count_map ** α : Type u_2 inst✝¹ : DecidableEq α β : Type u_1 inst✝ : DecidableEq β l : List α f : α → β x : α ⊢ count x l ≤ count (f x) (map f l) ** rw [count, count, countP_map] ** α : Type u_2 inst✝¹ : DecidableEq α β : Type u_1 inst✝ : DecidableEq β l : List α f : α → β x : α ⊢ countP (fun x_1 => x_1 ... | |
List.count_erase ** α : Type u_1 inst✝ : DecidableEq α a b : α ⊢ count a (List.erase [] b) = count a [] - if a = b then 1 else 0 ** simp ** α : Type u_1 inst✝ : DecidableEq α a b c : α l : List α ⊢ count a (List.erase (c :: l) b) = count a (c :: l) - if a = b then 1 else 0 ** rw [erase_cons] ** α : Type u_1 inst✝ : Dec... | |
List.count_erase_self ** α : Type u_1 inst✝ : DecidableEq α a : α l : List α ⊢ count a (List.erase l a) = count a l - 1 ** rw [count_erase, if_pos rfl] ** Qed | |
List.count_erase_of_ne ** α : Type u_1 inst✝ : DecidableEq α a b : α ab : a ≠ b l : List α ⊢ count a (List.erase l b) = count a l ** rw [count_erase, if_neg ab, Nat.sub_zero] ** Qed | |
Std.RBNode.Path.zoom_ins ** α : Type u_1 v : α path : Path α t' : RBNode α path' : Path α t : RBNode α cmp : α → α → Ordering ⊢ zoom (cmp v) t path = (t', path') → ins path (RBNode.ins cmp v t) = ins path' (setRoot v t') ** unfold RBNode.ins ** α : Type u_1 v : α path : Path α t' : RBNode α path' : Path α t : RBNode α ... | |
Std.RBNode.Path.zoom_del ** α : Type u_1 cut : α → Ordering path : Path α t' : RBNode α path' : Path α t : RBNode α ⊢ zoom cut t path = (t', path') → del path (RBNode.del cut t) (match t with | node c l v r => c | x => red) = del path' (delRoot t') (match t' with | node... | |
Std.RBNode.Balanced.zoom ** α✝ : Type u_1 cut : α✝ → Ordering t : RBNode α✝ path : Path α✝ t' : RBNode α✝ path' : Path α✝ c₀ : RBColor n₀ : Nat c : RBColor n : Nat hp : Path.Balanced c₀ n₀ path black 0 e : zoom cut nil path = (t', path') ⊢ ∃ c n, Balanced t' c n ∧ Path.Balanced c₀ n₀ path' c n ** cases e ** case refl α... | |
Std.RBNode.Path.Balanced.ins ** α : Type u_1 c₀ : RBColor n₀ : Nat c : RBColor n : Nat t : RBNode α path : Path α hp : Path.Balanced c₀ n₀ path c n ht : RedRed (c = red) t n ⊢ ∃ n, Balanced (ins path t) black n ** induction hp generalizing t with
| root => exact ht.setBlack
| redL hr hp ih => match ht with
| .balance... | |
Std.RBNode.Path.Balanced.del ** α : Type u_1 c₀ : RBColor n₀ : Nat c : RBColor n : Nat c' : RBColor t : RBNode α path : Path α hp : Path.Balanced c₀ n₀ path c n ht : DelProp c' t n hc : c = black → c' ≠ red ⊢ ∃ n, Balanced (del path t c') black n ** induction hp generalizing t c' with
| root => match c', ht with
| re... | |
Std.RBNode.Path.zoom_zoomed₁ ** α✝ : Type u_1 cut : α✝ → Ordering t : RBNode α✝ path : Path α✝ t'✝ : RBNode α✝ path'✝ : Path α✝ e✝ : zoom cut t path = (t'✝, path'✝) path' : Path α✝ t' : RBNode α✝ c✝ : RBColor l✝ : RBNode α✝ v✝ : α✝ r✝ : RBNode α✝ e : zoom cut (node c✝ l✝ v✝ r✝) path = (t', path') ⊢ OnRoot (fun x => cut... | |
Std.RBNode.Path.zoom_zoomed₂ ** α✝ : Type u_1 cut : α✝ → Ordering t : RBNode α✝ path : Path α✝ t'✝ : RBNode α✝ path'✝ : Path α✝ e✝ : zoom cut t path = (t'✝, path'✝) hp : Zoomed cut path path' : Path α✝ t' : RBNode α✝ c✝ : RBColor l✝ : RBNode α✝ v✝ : α✝ r✝ : RBNode α✝ e : zoom cut (node c✝ l✝ v✝ r✝) path = (t', path') ⊢... | |
Std.RBNode.Path.Ordered.fill ** α : Type u_1 cmp : α → α → Ordering c✝ : RBColor parent✝ : Path α v✝ : α r✝ x✝ : RBNode α ⊢ RBNode.Ordered cmp (fill (left c✝ parent✝ v✝ r✝) x✝) ↔ Ordered cmp (left c✝ parent✝ v✝ r✝) ∧ RBNode.Ordered cmp x✝ ∧ All (RootOrdered cmp (left c✝ parent✝ v✝ r✝)) x✝ ** simp [Ordered.fill, RBN... | |
Std.RBNode.Path.Ordered.ins ** α : Type u_1 cmp : α → α → Ordering parent : Path α x : α b a : RBNode α ha : RBNode.Ordered cmp a hp : Ordered cmp parent xb : All (fun x_1 => cmpLT cmp x x_1) b xp : RootOrdered cmp parent x bp : All (RootOrdered cmp parent) b hb : RBNode.Ordered cmp b H : All (RootOrdered cmp (left red... | |
Std.RBNode.Path.Ordered.del ** α : Type u_1 cmp : α → α → Ordering c✝ : RBColor parent : Path α x : α b a : RBNode α ha : RBNode.Ordered cmp a hp : Ordered cmp parent xb : All (fun x_1 => cmpLT cmp x x_1) b xp : RootOrdered cmp parent x bp : All (RootOrdered cmp parent) b hb : RBNode.Ordered cmp b H : All (RootOrdered ... | |
Std.RBNode.Ordered.alter ** α : Type u_1 cut : α → Ordering f : Option α → Option α cmp : α → α → Ordering t : RBNode α H : ∀ {x : α} {t' : RBNode α} {p : Path α}, RBNode.zoom cut t Path.root = (t', p) → f (root? t') = some x → Path.RootOrdered cmp p x ∧ OnRoot (cmpEq cmp x) t' h : Ordered cmp t ⊢ Ordered cmp (al... | |
Std.RBNode.Balanced.alter ** α : Type u_1 c : RBColor n : Nat cut : α → Ordering f : Option α → Option α t : RBNode α h : Balanced t c n ⊢ ∃ c n, Balanced (alter cut f t) c n ** simp [alter] ** α : Type u_1 c : RBColor n : Nat cut : α → Ordering f : Option α → Option α t : RBNode α h : Balanced t c n ⊢ ∃ c n, Balan... | |
Std.RBNode.modify_eq_alter ** α : Type u_1 cut : α → Ordering f : α → α t : RBNode α ⊢ modify cut f t = alter cut (Option.map f) t ** simp [modify, alter] ** α : Type u_1 cut : α → Ordering f : α → α t : RBNode α ⊢ (match zoom cut t Path.root with | (nil, snd) => t | (node c a x b, path) => Path.fill path (node... | |
Std.RBNode.Ordered.modify ** α : Type u_1 cut : α → Ordering cmp : α → α → Ordering f : α → α t : RBNode α H : OnRoot (fun x => cmpEq cmp (f x) x) (RBNode.zoom cut t Path.root).fst h : Ordered cmp t c✝ : RBColor l✝ : RBNode α v✝ : α r✝ : RBNode α x✝ : Path α eq : RBNode.zoom cut t Path.root = (node c✝ l✝ v✝ r✝, x✝) ⊢ P... | |
Std.HashMap.Imp.Buckets.exists_of_update ** α : Type u_1 β : Type u_2 self : Buckets α β i : USize d : AssocList α β h : USize.toNat i < Array.size self.val ⊢ ∃ l₁ l₂, self.val.data = l₁ ++ self.val[i] :: l₂ ∧ List.length l₁ = USize.toNat i ∧ (update self i d h).val.data = l₁ ++ d :: l₂ ** simp [Array.getElem... | |
Std.HashMap.Imp.Buckets.mk_size ** α : Type u_1 β : Type u_2 n : Nat h : 0 < n ⊢ size (mk n) = 0 ** simp [Buckets.size_eq, Buckets.mk, mkArray] ** α : Type u_1 β : Type u_2 n : Nat h : 0 < n ⊢ Nat.sum (List.map (fun x => List.length (AssocList.toList x)) (List.replicate n AssocList.nil)) = 0 ** clear h ** α : Type u_1 ... | |
Std.HashMap.Imp.Buckets.WF.mk' ** α : Type u_1 β : Type u_2 n : Nat inst✝¹ : BEq α inst✝ : Hashable α h : 0 < n ⊢ WF (Buckets.mk n) ** refine ⟨fun _ h => ?_, fun i h => ?_⟩ ** case refine_1 α : Type u_1 β : Type u_2 n : Nat inst✝³ : BEq α inst✝² : Hashable α h✝ : 0 < n inst✝¹ : LawfulHashable α inst✝ : PartialEquivBEq ... | |
Std.HashMap.Imp.reinsertAux_size ** α : Type u_1 β : Type u_2 inst✝ : Hashable α data : Buckets α β a : α b : β ⊢ Buckets.size (reinsertAux data a b) = Nat.succ (Buckets.size data) ** simp [Buckets.size_eq, reinsertAux] ** α : Type u_1 β : Type u_2 inst✝ : Hashable α data : Buckets α β a : α b : β ⊢ Nat.sum (List... | |
Std.HashMap.Imp.mem_replaceF ** case nil α : Type u_1 β : Type u_2 k : α x : α × β p : α × β → Bool f : α × β → β ⊢ x ∈ List.replaceF (fun a => bif p a then some (k, f a) else none) [] → x.fst = k ∨ x ∈ [] ** exact .inr ** case cons α : Type u_1 β : Type u_2 k : α x : α × β p : α × β → Bool f : α × β → β a : α × β l : ... | |
Std.HashMap.Imp.erase_WF ** α : Type u_1 β : Type u_2 inst✝¹ : BEq α inst✝ : Hashable α m : Imp α β k : α h : Buckets.WF m.buckets ⊢ Buckets.WF (erase m k).buckets ** dsimp [erase, cond] ** α : Type u_1 β : Type u_2 inst✝¹ : BEq α inst✝ : Hashable α m : Imp α β k : α h : Buckets.WF m.buckets ⊢ Buckets.WF (match ... | |
Std.HashMap.Imp.modify_size ** α : Type u_1 β : Type u_2 f : α → β → β inst✝¹ : BEq α inst✝ : Hashable α m : Imp α β k : α h : m.size = Buckets.size m.buckets ⊢ (modify m k f).size = Buckets.size (modify m k f).buckets ** dsimp [modify, cond] ** α : Type u_1 β : Type u_2 f : α → β → β inst✝¹ : BEq α inst✝ : Hashable α ... | |
Std.HashMap.Imp.modify_WF ** α : Type u_1 β : Type u_2 f : α → β → β inst✝¹ : BEq α inst✝ : Hashable α m : Imp α β k : α h : Buckets.WF m.buckets ⊢ Buckets.WF (modify m k f).buckets ** dsimp [modify, cond] ** α : Type u_1 β : Type u_2 f : α → β → β inst✝¹ : BEq α inst✝ : Hashable α m : Imp α β k : α h : Buckets.WF m.bu... | |
Array.get?_len_le ** α : Type u_1 a : Array α i : Nat h : size a ≤ i ⊢ a[i]? = none ** simp [getElem?_neg, h] ** Qed | |
Array.getElem_mem_data ** α : Type u_1 i : Nat a : Array α h : i < size a ⊢ a[i] ∈ a.data ** simp [getElem_eq_data_get, List.get_mem] ** Qed | |
Array.getElem?_eq_data_get? ** α : Type u_1 a : Array α i : Nat ⊢ a[i]? = List.get? a.data i ** by_cases i < a.size <;> simp_all [getElem?_pos, getElem?_neg, List.get?_eq_get, eq_comm] ** case pos α : Type u_1 a : Array α i : Nat h✝ : i < size a ⊢ List.get a.data { val := i, isLt := (_ : i < size a) } = a[i] ** rfl ** ... | |
Array.back_eq_back? ** α : Type u_1 inst✝ : Inhabited α a : Array α ⊢ back a = Option.getD (back? a) default ** simp [back, back?] ** Qed | |
Array.back?_push ** α : Type u_1 x : α a : Array α ⊢ back? (push a x) = some x ** simp [back?, getElem?_eq_data_get?] ** Qed | |
Array.back_push ** α : Type u_1 x : α inst✝ : Inhabited α a : Array α ⊢ back (push a x) = x ** simp ** Qed | |
Array.get?_push_lt ** α : Type u_1 a : Array α x : α i : Nat h : i < size a ⊢ (push a x)[i]? = some a[i] ** rw [getElem?_pos, get_push_lt] ** Qed | |
Array.get_set_eq ** α : Type ?u.12801 a : Array α i : Fin (size a) v : α ⊢ i.val < size (set a i v) ** simp [i.2] ** α : Type u_1 a : Array α i : Fin (size a) v : α ⊢ (set a i v)[i.val] = v ** simp only [set, getElem_eq_data_get, List.get_set_eq] ** Qed | |
Array.get?_set_eq ** α : Type u_1 a : Array α i : Fin (size a) v : α ⊢ (set a i v)[i.val]? = some v ** simp [getElem?_pos, i.2] ** Qed | |
Array.get?_set_ne ** α : Type u_1 a : Array α i : Fin (size a) j : Nat v : α h : i.val ≠ j ⊢ (set a i v)[j]? = a[j]? ** by_cases j < a.size <;> simp [getElem?_pos, getElem?_neg, *] ** Qed | |
Array.get?_set ** α : Type u_1 a : Array α i : Fin (size a) j : Nat v : α ⊢ (set a i v)[j]? = if i.val = j then some v else a[j]? ** if h : i.1 = j then subst j; simp [*] else simp [*] ** α : Type u_1 a : Array α i : Fin (size a) j : Nat v : α h : i.val = j ⊢ (set a i v)[j]? = if i.val = j then some v else a[j]? ** sub... | |
Array.get_set ** α : Type ?u.16065 a : Array α i : Fin (size a) j : Nat hj : j < size a v : α ⊢ j < size (set a i v) ** simp [*] ** α : Type u_1 a : Array α i : Fin (size a) j : Nat hj : j < size a v : α ⊢ (set a i v)[j] = if i.val = j then v else a[j] ** if h : i.1 = j then subst j; simp [*] else simp [*] ** α : Type ... | |
Array.fin_cast_val ** n n' : Nat e : n = n' i : Fin n ⊢ e ▸ i = { val := i.val, isLt := (_ : i.val < n') } ** cases e ** case refl n : Nat i : Fin n ⊢ (_ : n = n) ▸ i = { val := i.val, isLt := (_ : i.val < n) } ** rfl ** Qed | |
Array.data_swap ** α : Type u_1 a : Array α i j : Fin (size a) ⊢ (swap a i j).data = List.set (List.set a.data i.val (get a j)) j.val (get a i) ** simp [swap_def] ** Qed | |
Array.data_pop ** α : Type u_1 a : Array α ⊢ (pop a).data = List.dropLast a.data ** simp [pop] ** Qed | |
Array.pop_push ** α : Type u_1 x : α a : Array α ⊢ pop (push a x) = a ** simp [pop] ** Qed | |
Array.SatisfiesM_foldrM ** m : Type u_1 → Type u_2 α : Type u_3 β : Type u_1 inst✝¹ : Monad m inst✝ : LawfulMonad m as : Array α motive : Nat → β → Prop init : β h0 : motive (size as) init f : α → β → m β hf : ∀ (i : Fin (size as)) (b : β), motive (i.val + 1) b → SatisfiesM (motive i.val) (f as[i] b) ⊢ SatisfiesM (moti... | |
Array.SatisfiesM_mapIdxM ** m : Type u_1 → Type u_2 α : Type u_3 β : Type u_1 inst✝¹ : Monad m inst✝ : LawfulMonad m as : Array α f : Fin (size as) → α → m β motive : Nat → Prop h0 : motive 0 p : Fin (size as) → β → Prop hs : ∀ (i : Fin (size as)), motive i.val → SatisfiesM (fun x => p i x ∧ motive (i.val + 1)) (f i as... | |
Array.getElem_mapIdx ** α : Type ?u.58055 β : Type ?u.58096 a : Array α f : Fin (size a) → α → β i : Nat h : i < size (mapIdx a f) ⊢ i < size a ** simp_all ** Qed | |
Array.size_reverse ** α : Type u_1 a : Array α ⊢ size (reverse a) = size a ** simp only [reverse] ** α : Type u_1 a : Array α ⊢ size (if h : size a ≤ 1 then a else reverse.loop a 0 { val := size a - 1, isLt := (_ : Nat.pred (Nat.sub (size a) 0) < Nat.sub (size a) 0) }) = size a ** split <;> simp [go] **... |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.