path stringlengths 20 108 | imports listlengths 0 20 | full_name stringlengths 1 124 | code stringlengths 15 16.6k | start listlengths 2 2 | end listlengths 2 2 | kind stringclasses 3
values | pid int64 0 249k |
|---|---|---|---|---|---|---|---|
.lake/packages/lean4/src/lean/Init/Prelude.lean | [] | System.Platform.numBits_eq | theorem System.Platform.numBits_eq : Or (Eq numBits 32) (Eq numBits 64) | [
1977,
1
] | [
1981,
27
] | commanddeclaration | 200 |
.lake/packages/lean4/src/lean/Init/Prelude.lean | [] | Fin | @[pp_using_anonymous_constructor]
structure Fin (n : Nat) where
mk ::
val : Nat
isLt : LT.lt val n | [
1983,
1
] | [
2002,
21
] | commanddeclaration | 201 |
.lake/packages/lean4/src/lean/Init/Prelude.lean | [] | Fin.eq_of_val_eq | theorem Fin.eq_of_val_eq {n} : ∀ {i j : Fin n}, Eq i.val j.val → Eq i j | [
2006,
1
] | [
2007,
31
] | commanddeclaration | 202 |
.lake/packages/lean4/src/lean/Init/Prelude.lean | [] | Fin.val_eq_of_eq | theorem Fin.val_eq_of_eq {n} {i j : Fin n} (h : Eq i j) : Eq i.val j.val | [
2009,
1
] | [
2010,
10
] | commanddeclaration | 203 |
.lake/packages/lean4/src/lean/Init/Prelude.lean | [] | Fin.decLt | instance Fin.decLt {n} (a b : Fin n) : Decidable (LT.lt a b) := Nat.decLt .. | [
2024,
1
] | [
2024,
77
] | commanddeclaration | 204 |
.lake/packages/lean4/src/lean/Init/Prelude.lean | [] | Fin.decLe | instance Fin.decLe {n} (a b : Fin n) : Decidable (LE.le a b) := Nat.decLe .. | [
2025,
1
] | [
2025,
77
] | commanddeclaration | 205 |
.lake/packages/lean4/src/lean/Init/Prelude.lean | [] | BitVec | structure BitVec (w : Nat) where
ofFin ::
toFin : Fin (hPow 2 w) | [
2027,
1
] | [
2039,
25
] | commanddeclaration | 206 |
.lake/packages/lean4/src/lean/Init/Prelude.lean | [] | BitVec.decEq | def BitVec.decEq (x y : BitVec w) : Decidable (Eq x y) :=
match x, y with
| ⟨n⟩, ⟨m⟩ =>
dite (Eq n m)
(fun h => isTrue (h ▸ rfl))
(fun h => isFalse (fun h' => BitVec.noConfusion h' (fun h' => absurd h' h))) | [
2041,
1
] | [
2054,
83
] | commanddeclaration | 207 |
.lake/packages/lean4/src/lean/Init/Prelude.lean | [] | BitVec.ofNatLT | @[match_pattern]
protected def BitVec.ofNatLT {w : Nat} (i : Nat) (p : LT.lt i (hPow 2 w)) : BitVec w where
toFin := ⟨i, p⟩ | [
2058,
1
] | [
2061,
18
] | commanddeclaration | 208 |
.lake/packages/lean4/src/lean/Init/Prelude.lean | [] | BitVec.toNat | protected def BitVec.toNat (x : BitVec w) : Nat := x.toFin.val | [
2063,
1
] | [
2068,
63
] | commanddeclaration | 209 |
.lake/packages/lean4/src/lean/Init/Prelude.lean | [] | UInt8.size | abbrev UInt8.size : Nat := 256 | [
2078,
1
] | [
2079,
31
] | commanddeclaration | 210 |
.lake/packages/lean4/src/lean/Init/Prelude.lean | [] | UInt8 | structure UInt8 where
ofBitVec ::
toBitVec : BitVec 8 | [
2081,
1
] | [
2095,
22
] | commanddeclaration | 211 |
.lake/packages/lean4/src/lean/Init/Prelude.lean | [] | UInt8.ofNatLT | @[extern "lean_uint8_of_nat"]
def UInt8.ofNatLT (n : @& Nat) (h : LT.lt n UInt8.size) : UInt8 where
toBitVec := BitVec.ofNatLT n h | [
2100,
1
] | [
2108,
33
] | commanddeclaration | 212 |
.lake/packages/lean4/src/lean/Init/Prelude.lean | [] | UInt8.decEq | @[extern "lean_uint8_dec_eq"]
def UInt8.decEq (a b : UInt8) : Decidable (Eq a b) :=
match a, b with
| ⟨n⟩, ⟨m⟩ =>
dite (Eq n m)
(fun h => isTrue (h ▸ rfl))
(fun h => isFalse (fun h' => UInt8.noConfusion h' (fun h' => absurd h' h))) | [
2111,
1
] | [
2128,
82
] | commanddeclaration | 213 |
.lake/packages/lean4/src/lean/Init/Prelude.lean | [] | UInt16.size | abbrev UInt16.size : Nat := 65536 | [
2135,
1
] | [
2136,
34
] | commanddeclaration | 214 |
.lake/packages/lean4/src/lean/Init/Prelude.lean | [] | UInt16 | structure UInt16 where
ofBitVec ::
toBitVec : BitVec 16 | [
2138,
1
] | [
2152,
23
] | commanddeclaration | 215 |
.lake/packages/lean4/src/lean/Init/Prelude.lean | [] | UInt16.ofNatLT | @[extern "lean_uint16_of_nat"]
def UInt16.ofNatLT (n : @& Nat) (h : LT.lt n UInt16.size) : UInt16 where
toBitVec := BitVec.ofNatLT n h | [
2157,
1
] | [
2165,
33
] | commanddeclaration | 216 |
.lake/packages/lean4/src/lean/Init/Prelude.lean | [] | UInt16.decEq | @[extern "lean_uint16_dec_eq"]
def UInt16.decEq (a b : UInt16) : Decidable (Eq a b) :=
match a, b with
| ⟨n⟩, ⟨m⟩ =>
dite (Eq n m)
(fun h => isTrue (h ▸ rfl))
(fun h => isFalse (fun h' => UInt16.noConfusion h' (fun h' => absurd h' h))) | [
2169,
1
] | [
2186,
83
] | commanddeclaration | 217 |
.lake/packages/lean4/src/lean/Init/Prelude.lean | [] | UInt32.size | abbrev UInt32.size : Nat := 4294967296 | [
2193,
1
] | [
2194,
39
] | commanddeclaration | 218 |
.lake/packages/lean4/src/lean/Init/Prelude.lean | [] | UInt32 | structure UInt32 where
ofBitVec ::
toBitVec : BitVec 32 | [
2196,
1
] | [
2210,
23
] | commanddeclaration | 219 |
.lake/packages/lean4/src/lean/Init/Prelude.lean | [] | UInt32.ofNatLT | @[extern "lean_uint32_of_nat"]
def UInt32.ofNatLT (n : @& Nat) (h : LT.lt n UInt32.size) : UInt32 where
toBitVec := BitVec.ofNatLT n h | [
2215,
1
] | [
2223,
33
] | commanddeclaration | 220 |
.lake/packages/lean4/src/lean/Init/Prelude.lean | [] | UInt32.toNat | @[extern "lean_uint32_to_nat"]
def UInt32.toNat (n : UInt32) : Nat := n.toBitVec.toNat | [
2225,
1
] | [
2231,
56
] | commanddeclaration | 221 |
.lake/packages/lean4/src/lean/Init/Prelude.lean | [] | UInt32.decEq | @[extern "lean_uint32_dec_eq"]
def UInt32.decEq (a b : UInt32) : Decidable (Eq a b) :=
match a, b with
| ⟨n⟩, ⟨m⟩ =>
dite (Eq n m) (fun h => isTrue (h ▸ rfl)) (fun h => isFalse (fun h' => UInt32.noConfusion h' (fun h' => absurd h' h))) | [
2234,
1
] | [
2249,
123
] | commanddeclaration | 222 |
.lake/packages/lean4/src/lean/Init/Prelude.lean | [] | UInt32.decLt | @[extern "lean_uint32_dec_lt"]
def UInt32.decLt (a b : UInt32) : Decidable (LT.lt a b) :=
inferInstanceAs (Decidable (LT.lt a.toBitVec b.toBitVec)) | [
2262,
1
] | [
2275,
60
] | commanddeclaration | 223 |
.lake/packages/lean4/src/lean/Init/Prelude.lean | [] | UInt32.decLe | @[extern "lean_uint32_dec_le"]
def UInt32.decLe (a b : UInt32) : Decidable (LE.le a b) :=
inferInstanceAs (Decidable (LE.le a.toBitVec b.toBitVec)) | [
2277,
1
] | [
2291,
60
] | commanddeclaration | 224 |
.lake/packages/lean4/src/lean/Init/Prelude.lean | [] | UInt64.size | abbrev UInt64.size : Nat := 18446744073709551616 | [
2298,
1
] | [
2299,
49
] | commanddeclaration | 225 |
.lake/packages/lean4/src/lean/Init/Prelude.lean | [] | UInt64 | structure UInt64 where
ofBitVec ::
toBitVec : BitVec 64 | [
2301,
1
] | [
2315,
23
] | commanddeclaration | 226 |
.lake/packages/lean4/src/lean/Init/Prelude.lean | [] | UInt64.ofNatLT | @[extern "lean_uint64_of_nat"]
def UInt64.ofNatLT (n : @& Nat) (h : LT.lt n UInt64.size) : UInt64 where
toBitVec := BitVec.ofNatLT n h | [
2320,
1
] | [
2328,
33
] | commanddeclaration | 227 |
.lake/packages/lean4/src/lean/Init/Prelude.lean | [] | UInt64.decEq | @[extern "lean_uint64_dec_eq"]
def UInt64.decEq (a b : UInt64) : Decidable (Eq a b) :=
match a, b with
| ⟨n⟩, ⟨m⟩ =>
dite (Eq n m)
(fun h => isTrue (h ▸ rfl))
(fun h => isFalse (fun h' => UInt64.noConfusion h' (fun h' => absurd h' h))) | [
2332,
1
] | [
2349,
83
] | commanddeclaration | 228 |
.lake/packages/lean4/src/lean/Init/Prelude.lean | [] | USize.size | abbrev USize.size : Nat := (hPow 2 System.Platform.numBits) | [
2356,
1
] | [
2357,
60
] | commanddeclaration | 229 |
.lake/packages/lean4/src/lean/Init/Prelude.lean | [] | USize.size_eq | theorem USize.size_eq : Or (Eq USize.size 4294967296) (Eq USize.size 18446744073709551616) | [
2359,
1
] | [
2363,
52
] | commanddeclaration | 230 |
.lake/packages/lean4/src/lean/Init/Prelude.lean | [] | USize.size_pos | theorem USize.size_pos : LT.lt 0 USize.size | [
2365,
1
] | [
2368,
43
] | commanddeclaration | 231 |
.lake/packages/lean4/src/lean/Init/Prelude.lean | [] | USize | structure USize where
ofBitVec ::
toBitVec : BitVec System.Platform.numBits | [
2370,
1
] | [
2386,
44
] | commanddeclaration | 232 |
.lake/packages/lean4/src/lean/Init/Prelude.lean | [] | USize.ofNatLT | @[extern "lean_usize_of_nat"]
def USize.ofNatLT (n : @& Nat) (h : LT.lt n USize.size) : USize where
toBitVec := BitVec.ofNatLT n h | [
2391,
1
] | [
2399,
33
] | commanddeclaration | 233 |
.lake/packages/lean4/src/lean/Init/Prelude.lean | [] | USize.decEq | @[extern "lean_usize_dec_eq"]
def USize.decEq (a b : USize) : Decidable (Eq a b) :=
match a, b with
| ⟨n⟩, ⟨m⟩ =>
dite (Eq n m)
(fun h => isTrue (h ▸ rfl))
(fun h => isFalse (fun h' => USize.noConfusion h' (fun h' => absurd h' h))) | [
2402,
1
] | [
2419,
82
] | commanddeclaration | 234 |
.lake/packages/lean4/src/lean/Init/Prelude.lean | [] | Nat.isValidChar | abbrev Nat.isValidChar (n : Nat) : Prop :=
Or (LT.lt n 0xd800) (And (LT.lt 0xdfff n) (LT.lt n 0x110000)) | [
2426,
1
] | [
2431,
64
] | commanddeclaration | 235 |
.lake/packages/lean4/src/lean/Init/Prelude.lean | [] | UInt32.isValidChar | abbrev UInt32.isValidChar (n : UInt32) : Prop :=
n.toNat.isValidChar | [
2433,
1
] | [
2438,
22
] | commanddeclaration | 236 |
.lake/packages/lean4/src/lean/Init/Prelude.lean | [] | Char | structure Char where
val : UInt32
valid : val.isValidChar | [
2440,
1
] | [
2447,
26
] | commanddeclaration | 237 |
.lake/packages/lean4/src/lean/Init/Prelude.lean | [] | isValidChar_UInt32 | private theorem isValidChar_UInt32 {n : Nat} (h : n.isValidChar) : LT.lt n UInt32.size | [
2449,
1
] | [
2452,
60
] | commanddeclaration | 238 |
.lake/packages/lean4/src/lean/Init/Prelude.lean | [] | Char.ofNatAux | @[extern "lean_uint32_of_nat"]
def Char.ofNatAux (n : @& Nat) (h : n.isValidChar) : Char :=
{ val := ⟨BitVec.ofNatLT n (isValidChar_UInt32 h)⟩, valid := h } | [
2454,
1
] | [
2460,
67
] | commanddeclaration | 239 |
.lake/packages/lean4/src/lean/Init/Prelude.lean | [] | Char.ofNat | @[noinline, match_pattern]
def Char.ofNat (n : Nat) : Char :=
dite (n.isValidChar)
(fun h => Char.ofNatAux n h)
(fun _ => { val := ⟨BitVec.ofNatLT 0 (of_decide_eq_true rfl)⟩, valid := Or.inl (of_decide_eq_true rfl) }) | [
2462,
1
] | [
2470,
110
] | commanddeclaration | 240 |
.lake/packages/lean4/src/lean/Init/Prelude.lean | [] | Char.eq_of_val_eq | theorem Char.eq_of_val_eq : ∀ {c d : Char}, Eq c.val d.val → Eq c d | [
2472,
1
] | [
2473,
31
] | commanddeclaration | 241 |
.lake/packages/lean4/src/lean/Init/Prelude.lean | [] | Char.val_eq_of_eq | theorem Char.val_eq_of_eq : ∀ {c d : Char}, Eq c d → Eq c.val d.val | [
2475,
1
] | [
2476,
21
] | commanddeclaration | 242 |
.lake/packages/lean4/src/lean/Init/Prelude.lean | [] | Char.ne_of_val_ne | theorem Char.ne_of_val_ne {c d : Char} (h : Not (Eq c.val d.val)) : Not (Eq c d) | [
2478,
1
] | [
2479,
39
] | commanddeclaration | 243 |
.lake/packages/lean4/src/lean/Init/Prelude.lean | [] | Char.val_ne_of_ne | theorem Char.val_ne_of_ne {c d : Char} (h : Not (Eq c d)) : Not (Eq c.val d.val) | [
2481,
1
] | [
2482,
39
] | commanddeclaration | 244 |
.lake/packages/lean4/src/lean/Init/Prelude.lean | [] | Char.utf8Size | def Char.utf8Size (c : Char) : Nat :=
let v := c.val
ite (LE.le v (UInt32.ofNatLT 0x7F (of_decide_eq_true rfl))) 1
(ite (LE.le v (UInt32.ofNatLT 0x7FF (of_decide_eq_true rfl))) 2
(ite (LE.le v (UInt32.ofNatLT 0xFFFF (of_decide_eq_true rfl))) 3 4)) | [
2490,
1
] | [
2495,
75
] | commanddeclaration | 245 |
.lake/packages/lean4/src/lean/Init/Prelude.lean | [] | Option | inductive Option (α : Type u) where
| none : Option α
| some (val : α) : Option α | [
2497,
1
] | [
2507,
30
] | commanddeclaration | 246 |
.lake/packages/lean4/src/lean/Init/Prelude.lean | [] | Option.getD | @[macro_inline] def Option.getD (opt : Option α) (dflt : α) : α :=
match opt with
| some x => x
| none => dflt | [
2516,
1
] | [
2529,
17
] | commanddeclaration | 247 |
.lake/packages/lean4/src/lean/Init/Prelude.lean | [] | Option.map | @[inline] protected def Option.map (f : α → β) : Option α → Option β
| some x => some (f x)
| none => none | [
2531,
1
] | [
2543,
19
] | commanddeclaration | 248 |
.lake/packages/lean4/src/lean/Init/Prelude.lean | [] | List | inductive List (α : Type u) where
| nil : List α
| cons (head : α) (tail : List α) : List α | [
2545,
1
] | [
2564,
45
] | commanddeclaration | 249 |
.lake/packages/lean4/src/lean/Init/Prelude.lean | [] | List.hasDecEq | protected def List.hasDecEq {α : Type u} [DecidableEq α] : (a b : List α) → Decidable (Eq a b)
| nil, nil => isTrue rfl
| cons _ _, nil => isFalse (fun h => List.noConfusion h)
| nil, cons _ _ => isFalse (fun h => List.noConfusion h)
| cons a as, cons b bs =>
match decEq a b with
| isTrue hab =>
match List.hasDecEq as bs with
| isTrue habs => isTrue (hab ▸ habs ▸ rfl)
| isFalse nabs => isFalse (fun h => List.noConfusion h (fun _ habs => absurd habs nabs))
| isFalse nab => isFalse (fun h => List.noConfusion h (fun hab _ => absurd hab nab)) | [
2569,
1
] | [
2580,
89
] | commanddeclaration | 250 |
.lake/packages/lean4/src/lean/Init/Prelude.lean | [] | List.length | def List.length : List α → Nat
| nil => 0
| cons _ as => HAdd.hAdd (length as) 1 | [
2584,
1
] | [
2595,
41
] | commanddeclaration | 251 |
.lake/packages/lean4/src/lean/Init/Prelude.lean | [] | List.lengthTRAux | def List.lengthTRAux : List α → Nat → Nat
| nil, n => n
| cons _ as, n => lengthTRAux as (Nat.succ n) | [
2597,
1
] | [
2600,
48
] | commanddeclaration | 252 |
.lake/packages/lean4/src/lean/Init/Prelude.lean | [] | List.lengthTR | def List.lengthTR (as : List α) : Nat :=
lengthTRAux as 0 | [
2602,
1
] | [
2613,
19
] | commanddeclaration | 253 |
.lake/packages/lean4/src/lean/Init/Prelude.lean | [] | List.get | def List.get {α : Type u} : (as : List α) → Fin as.length → α
| cons a _, ⟨0, _⟩ => a
| cons _ as, ⟨Nat.succ i, h⟩ => get as ⟨i, Nat.le_of_succ_le_succ h⟩ | [
2615,
1
] | [
2627,
71
] | commanddeclaration | 254 |
.lake/packages/lean4/src/lean/Init/Prelude.lean | [] | List.set | def List.set : (l : List α) → (n : Nat) → (a : α) → List α
| cons _ as, 0, b => cons b as
| cons a as, Nat.succ n, b => cons a (set as n b)
| nil, _, _ => nil | [
2629,
1
] | [
2640,
36
] | commanddeclaration | 255 |
.lake/packages/lean4/src/lean/Init/Prelude.lean | [] | List.foldl | @[specialize]
def List.foldl {α : Type u} {β : Type v} (f : α → β → α) : (init : α) → List β → α
| a, nil => a
| a, cons b l => foldl f (f a b) l | [
2642,
1
] | [
2654,
37
] | commanddeclaration | 256 |
.lake/packages/lean4/src/lean/Init/Prelude.lean | [] | List.concat | def List.concat {α : Type u} : List α → α → List α
| nil, b => cons b nil
| cons a as, b => cons a (concat as b) | [
2656,
1
] | [
2668,
41
] | commanddeclaration | 257 |
.lake/packages/lean4/src/lean/Init/Prelude.lean | [] | String | structure String where
mk ::
data : List Char | [
2670,
1
] | [
2684,
19
] | commanddeclaration | 258 |
.lake/packages/lean4/src/lean/Init/Prelude.lean | [] | String.decEq | @[extern "lean_string_dec_eq"]
def String.decEq (s₁ s₂ : @& String) : Decidable (Eq s₁ s₂) :=
match s₁, s₂ with
| ⟨s₁⟩, ⟨s₂⟩ =>
dite (Eq s₁ s₂) (fun h => isTrue (congrArg _ h)) (fun h => isFalse (fun h' => String.noConfusion h' (fun h' => absurd h' h))) | [
2689,
1
] | [
2699,
130
] | commanddeclaration | 259 |
.lake/packages/lean4/src/lean/Init/Prelude.lean | [] | String.Pos | structure String.Pos where
byteIdx : Nat := 0 | [
2703,
1
] | [
2715,
21
] | commanddeclaration | 260 |
.lake/packages/lean4/src/lean/Init/Prelude.lean | [] | Substring | structure Substring where
str : String
startPos : String.Pos
stopPos : String.Pos | [
2725,
1
] | [
2744,
24
] | commanddeclaration | 261 |
.lake/packages/lean4/src/lean/Init/Prelude.lean | [] | Substring.bsize | @[inline] def Substring.bsize : Substring → Nat
| ⟨_, b, e⟩ => e.byteIdx.sub b.byteIdx | [
2749,
1
] | [
2753,
41
] | commanddeclaration | 262 |
.lake/packages/lean4/src/lean/Init/Prelude.lean | [] | String.utf8ByteSize | @[extern "lean_string_utf8_byte_size"]
def String.utf8ByteSize : (@& String) → Nat
| ⟨s⟩ => go s
where
go : List Char → Nat
| .nil => 0
| .cons c cs => hAdd (go cs) c.utf8Size | [
2755,
1
] | [
2766,
43
] | commanddeclaration | 263 |
.lake/packages/lean4/src/lean/Init/Prelude.lean | [] | String.endPos | @[inline] def String.endPos (s : String) : String.Pos where
byteIdx := utf8ByteSize s | [
2795,
1
] | [
2802,
28
] | commanddeclaration | 264 |
.lake/packages/lean4/src/lean/Init/Prelude.lean | [] | String.toSubstring | @[inline] def String.toSubstring (s : String) : Substring where
str := s
startPos := {}
stopPos := s.endPos | [
2804,
1
] | [
2810,
23
] | commanddeclaration | 265 |
.lake/packages/lean4/src/lean/Init/Prelude.lean | [] | String.toSubstring' | def String.toSubstring' (s : String) : Substring :=
s.toSubstring | [
2812,
1
] | [
2818,
16
] | commanddeclaration | 266 |
.lake/packages/lean4/src/lean/Init/Prelude.lean | [] | unsafeCast | unsafe def unsafeCast {α : Sort u} {β : Sort v} (a : α) : β :=
PLift.down (ULift.down.{max u v} (cast lcProof (ULift.up.{max u v} (PLift.up a)))) | [
2820,
1
] | [
2845,
85
] | commanddeclaration | 267 |
.lake/packages/lean4/src/lean/Init/Prelude.lean | [] | panicCore | @[never_extract, extern "lean_panic_fn"]
def panicCore {α : Sort u} [Inhabited α] (msg : String) : α := default | [
2848,
1
] | [
2860,
71
] | commanddeclaration | 268 |
.lake/packages/lean4/src/lean/Init/Prelude.lean | [] | panic | @[noinline, never_extract]
def panic {α : Sort u} [Inhabited α] (msg : String) : α :=
panicCore msg | [
2862,
1
] | [
2875,
16
] | commanddeclaration | 269 |
.lake/packages/lean4/src/lean/Init/Prelude.lean | [] | Array | structure Array (α : Type u) where
mk ::
toList : List α | [
2880,
1
] | [
2912,
18
] | commanddeclaration | 270 |
.lake/packages/lean4/src/lean/Init/Prelude.lean | [] | List.toArray | @[match_pattern]
abbrev List.toArray (xs : List α) : Array α := .mk xs | [
2917,
1
] | [
2928,
54
] | commanddeclaration | 271 |
.lake/packages/lean4/src/lean/Init/Prelude.lean | [] | Array.mkEmpty | @[extern "lean_mk_empty_array_with_capacity"]
def Array.mkEmpty {α : Type u} (c : @& Nat) : Array α where
toList := List.nil | [
2930,
1
] | [
2937,
21
] | commanddeclaration | 272 |
.lake/packages/lean4/src/lean/Init/Prelude.lean | [] | Array.emptyWithCapacity | @[extern "lean_mk_empty_array_with_capacity"]
def Array.emptyWithCapacity {α : Type u} (c : @& Nat) : Array α where
toList := List.nil | [
2939,
1
] | [
2944,
21
] | commanddeclaration | 273 |
.lake/packages/lean4/src/lean/Init/Prelude.lean | [] | Array.empty | def Array.empty {α : Type u} : Array α := emptyWithCapacity 0 | [
2946,
1
] | [
2951,
62
] | commanddeclaration | 274 |
.lake/packages/lean4/src/lean/Init/Prelude.lean | [] | Array.size | @[reducible, extern "lean_array_get_size"]
def Array.size {α : Type u} (a : @& Array α) : Nat :=
a.toList.length | [
2953,
1
] | [
2962,
17
] | commanddeclaration | 275 |
.lake/packages/lean4/src/lean/Init/Prelude.lean | [] | Array.getInternal | @[extern "lean_array_fget"]
def Array.getInternal {α : Type u} (a : @& Array α) (i : @& Nat) (h : LT.lt i a.size) : α :=
a.toList.get ⟨i, h⟩ | [
2964,
1
] | [
2976,
22
] | commanddeclaration | 276 |
.lake/packages/lean4/src/lean/Init/Prelude.lean | [] | Array.getD | @[inline] abbrev Array.getD (a : Array α) (i : Nat) (v₀ : α) : α :=
dite (LT.lt i a.size) (fun h => a.getInternal i h) (fun _ => v₀) | [
2978,
1
] | [
2991,
67
] | commanddeclaration | 277 |
.lake/packages/lean4/src/lean/Init/Prelude.lean | [] | Array.get!Internal | @[extern "lean_array_get"]
def Array.get!Internal {α : Type u} [Inhabited α] (a : @& Array α) (i : @& Nat) : α :=
Array.getD a i default | [
2993,
1
] | [
3000,
25
] | commanddeclaration | 278 |
.lake/packages/lean4/src/lean/Init/Prelude.lean | [] | Array.push | @[extern "lean_array_push"]
def Array.push {α : Type u} (a : Array α) (v : α) : Array α where
toList := List.concat a.toList v | [
3002,
1
] | [
3014,
35
] | commanddeclaration | 279 |
.lake/packages/lean4/src/lean/Init/Prelude.lean | [] | Array.mkArray0 | def Array.mkArray0 {α : Type u} : Array α :=
emptyWithCapacity 0 | [
3016,
1
] | [
3018,
22
] | commanddeclaration | 280 |
.lake/packages/lean4/src/lean/Init/Prelude.lean | [] | Array.mkArray1 | def Array.mkArray1 {α : Type u} (a₁ : α) : Array α :=
(emptyWithCapacity 1).push a₁ | [
3020,
1
] | [
3022,
32
] | commanddeclaration | 281 |
.lake/packages/lean4/src/lean/Init/Prelude.lean | [] | Array.mkArray2 | def Array.mkArray2 {α : Type u} (a₁ a₂ : α) : Array α :=
((emptyWithCapacity 2).push a₁).push a₂ | [
3024,
1
] | [
3026,
42
] | commanddeclaration | 282 |
.lake/packages/lean4/src/lean/Init/Prelude.lean | [] | Array.mkArray3 | def Array.mkArray3 {α : Type u} (a₁ a₂ a₃ : α) : Array α :=
(((emptyWithCapacity 3).push a₁).push a₂).push a₃ | [
3028,
1
] | [
3030,
52
] | commanddeclaration | 283 |
.lake/packages/lean4/src/lean/Init/Prelude.lean | [] | Array.mkArray4 | def Array.mkArray4 {α : Type u} (a₁ a₂ a₃ a₄ : α) : Array α :=
((((emptyWithCapacity 4).push a₁).push a₂).push a₃).push a₄ | [
3032,
1
] | [
3034,
62
] | commanddeclaration | 284 |
.lake/packages/lean4/src/lean/Init/Prelude.lean | [] | Array.mkArray5 | def Array.mkArray5 {α : Type u} (a₁ a₂ a₃ a₄ a₅ : α) : Array α :=
(((((emptyWithCapacity 5).push a₁).push a₂).push a₃).push a₄).push a₅ | [
3036,
1
] | [
3038,
72
] | commanddeclaration | 285 |
.lake/packages/lean4/src/lean/Init/Prelude.lean | [] | Array.mkArray6 | def Array.mkArray6 {α : Type u} (a₁ a₂ a₃ a₄ a₅ a₆ : α) : Array α :=
((((((emptyWithCapacity 6).push a₁).push a₂).push a₃).push a₄).push a₅).push a₆ | [
3040,
1
] | [
3042,
82
] | commanddeclaration | 286 |
.lake/packages/lean4/src/lean/Init/Prelude.lean | [] | Array.mkArray7 | def Array.mkArray7 {α : Type u} (a₁ a₂ a₃ a₄ a₅ a₆ a₇ : α) : Array α :=
(((((((emptyWithCapacity 7).push a₁).push a₂).push a₃).push a₄).push a₅).push a₆).push a₇ | [
3044,
1
] | [
3046,
92
] | commanddeclaration | 287 |
.lake/packages/lean4/src/lean/Init/Prelude.lean | [] | Array.mkArray8 | def Array.mkArray8 {α : Type u} (a₁ a₂ a₃ a₄ a₅ a₆ a₇ a₈ : α) : Array α :=
((((((((emptyWithCapacity 8).push a₁).push a₂).push a₃).push a₄).push a₅).push a₆).push a₇).push a₈ | [
3048,
1
] | [
3050,
102
] | commanddeclaration | 288 |
.lake/packages/lean4/src/lean/Init/Prelude.lean | [] | Array.appendCore | protected def Array.appendCore {α : Type u} (as : Array α) (bs : Array α) : Array α :=
let rec loop (i : Nat) (j : Nat) (as : Array α) : Array α :=
dite (LT.lt j bs.size)
(fun hlt =>
match i with
| 0 => as
| Nat.succ i' => loop i' (hAdd j 1) (as.push (bs.getInternal j hlt)))
(fun _ => as)
loop bs.size 0 as | [
3052,
1
] | [
3061,
20
] | commanddeclaration | 289 |
.lake/packages/lean4/src/lean/Init/Prelude.lean | [] | Array.extract | def Array.extract (as : Array α) (start : Nat := 0) (stop : Nat := as.size) : Array α :=
let rec loop (i : Nat) (j : Nat) (bs : Array α) : Array α :=
dite (LT.lt j as.size)
(fun hlt =>
match i with
| 0 => bs
| Nat.succ i' => loop i' (hAdd j 1) (bs.push (as.getInternal j hlt)))
(fun _ => bs)
let sz' := Nat.sub (min stop as.size) start
loop sz' start (emptyWithCapacity sz') | [
3063,
1
] | [
3089,
41
] | commanddeclaration | 290 |
.lake/packages/lean4/src/lean/Init/Prelude.lean | [] | Bind | class Bind (m : Type u → Type v) where
bind : {α β : Type u} → m α → (α → m β) → m β | [
3091,
1
] | [
3103,
48
] | commanddeclaration | 291 |
.lake/packages/lean4/src/lean/Init/Prelude.lean | [] | Pure | class Pure (f : Type u → Type v) where
pure {α : Type u} : α → f α | [
3107,
1
] | [
3121,
30
] | commanddeclaration | 292 |
.lake/packages/lean4/src/lean/Init/Prelude.lean | [] | Functor | class Functor (f : Type u → Type v) : Type (max (u+1) v) where
map : {α β : Type u} → (α → β) → f α → f β
mapConst : {α β : Type u} → α → f β → f α := Function.comp map (Function.const _) | [
3125,
1
] | [
3159,
84
] | commanddeclaration | 293 |
.lake/packages/lean4/src/lean/Init/Prelude.lean | [] | Seq | class Seq (f : Type u → Type v) : Type (max (u+1) v) where
seq : {α β : Type u} → f (α → β) → (Unit → f α) → f β | [
3161,
1
] | [
3180,
56
] | commanddeclaration | 294 |
.lake/packages/lean4/src/lean/Init/Prelude.lean | [] | SeqLeft | class SeqLeft (f : Type u → Type v) : Type (max (u+1) v) where
seqLeft : {α β : Type u} → f α → (Unit → f β) → f α | [
3182,
1
] | [
3202,
54
] | commanddeclaration | 295 |
.lake/packages/lean4/src/lean/Init/Prelude.lean | [] | SeqRight | class SeqRight (f : Type u → Type v) : Type (max (u+1) v) where
seqRight : {α β : Type u} → f α → (Unit → f β) → f β | [
3204,
1
] | [
3224,
55
] | commanddeclaration | 296 |
.lake/packages/lean4/src/lean/Init/Prelude.lean | [] | Applicative | class Applicative (f : Type u → Type v) extends Functor f, Pure f, Seq f, SeqLeft f, SeqRight f where
map := fun x y => Seq.seq (pure x) fun _ => y
seqLeft := fun a b => Seq.seq (Functor.map (Function.const _) a) b
seqRight := fun a b => Seq.seq (Functor.map (Function.const _ id) a) b | [
3226,
1
] | [
3240,
73
] | commanddeclaration | 297 |
.lake/packages/lean4/src/lean/Init/Prelude.lean | [] | Monad | class Monad (m : Type u → Type v) : Type (max (u+1) v) extends Applicative m, Bind m where
map f x := bind x (Function.comp pure f)
seq f x := bind f fun y => Functor.map y (x ())
seqLeft x y := bind x fun a => bind (y ()) (fun _ => pure a)
seqRight x y := bind x fun _ => y () | [
3242,
1
] | [
3260,
39
] | commanddeclaration | 298 |
.lake/packages/lean4/src/lean/Init/Prelude.lean | [] | MonadLift | class MonadLift (m : semiOutParam (Type u → Type v)) (n : Type u → Type w) where
monadLift : {α : Type u} → m α → n α | [
3271,
1
] | [
3289,
39
] | commanddeclaration | 299 |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.